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:
|
…melock deploy infra - 10.json was stale: LTS entries pointed at old immutable contracts; StakeWeight/ Distributor/Pauser impls predated P3/#45. Reconciled all proxy entries to live on-chain values (verified via EIP-1967 slots + getPostClaimHandlers). - Add TimelockDeploy.s.sol + arbitrum/base RPC aliases so ProxyAdmin ownership and the token admin role can be moved behind a per-chain timelock. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ploy infra (#50) * chore(deployments): reconcile 10.json to live chain + add Arb/Base timelock deploy infra - 10.json was stale: LTS entries pointed at old immutable contracts; StakeWeight/ Distributor/Pauser impls predated P3/#45. Reconciled all proxy entries to live on-chain values (verified via EIP-1967 slots + getPostClaimHandlers). - Add TimelockDeploy.s.sol + arbitrum/base RPC aliases so ProxyAdmin ownership and the token admin role can be moved behind a per-chain timelock. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore(deploy): consolidate Etherscan verification on V2 single key Etherscan V2 uses one API key across all chains (routed by chainid); the per-explorer V1 keys are deprecated. Add arbitrum/base [etherscan] entries and collapse optimism + the Makefile onto ${API_KEY_ETHERSCAN}, dropping API_KEY_OPTIMISTIC_ETHERSCAN from the env sample. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: rplusq <rplusq@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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