fix(stakeweight): correct permanent lock epoch accounting#45
Conversation
The OldPermanentLockStakeWeight.sol snapshot was retained only to support the bug-demonstration test. The fix is deployed and verified on-chain, so the demo carries no ongoing regression value — permanentLockFix.t.sol still covers the post-fix invariants. History at 615f1a0 preserves the snapshot if anyone needs it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude finished @rplusq's task in 3m 41s —— View job PR Review: fix(stakeweight): correct permanent lock epoch accounting
The epoch-ordering fix is correct. Pre-checkpoint state updates in Found 2 issue(s)Issue 1:
|
Summary
userPermanentWeightAtEpochinupdatePermanentLockandincreasePermanentLockDurationto occur after_checkpoint, so the parallel-array slot lands on the freshly-created user epoch instead of the previous oneconvertToPermanentandtriggerUnlockso intermediate epochs reflect correct permanent supplyincreaseLockAmountto redirect permanent-lock holders toupdatePermanentLock; permits internal_increaseLockAmountcallers to bypass the expired-lock check for permanent positionsStakeWeightHealer, an admin-gated migration contract used in a sandwich-upgrade to backfilluserPermanentWeightAtEpochfor affected usersDeployment status
The fix and healer migration were deployed and executed on Optimism mainnet on 2025-12-17 (
0xa9b9...be51). This PR brings the canonical repository in line with what was shipped.Test plan
permanentLockFix.t.solcovers post-fix invariants for both updated functionsStakeWeightPermanentUpgradeFork.t.solcontinue to pass🤖 Generated with Claude Code