logos-co / staking

SNT Staking contracts
Creative Commons Zero v1.0 Universal
0 stars 4 forks source link

fix(StakeManager): don't allow migration initialization while migrating #76

Closed 0x-r4bbit closed 6 months ago

0x-r4bbit commented 6 months ago

This is actually a bug that the certora prover found. The rule epochStaysSameOnMigration failed because a previous StakeManager could call migrationInitialize and change currentEpoch on a next StakeManager, even though the next StakeManager might be in migration itself (which means the currentEpoch is now allowed to change).

This commit fixes this by ensure migrationInitialize() will revert if the StakeManager already has a migration on going.

Checklist

Ensure you completed all of the steps below before submitting your pull request:

0x-r4bbit commented 6 months ago

This commit should actually pass just fine. Here's a certora job I ran on this commit: https://prover.certora.com/output/6199/9108462dc0734e85a63d32a303036c00?anonymousKey=ad4b679fc143ce45ebc4193e4fbd892f93eead05

For some reason, CI is taking an outdated state of the rules.