-
Notifications
You must be signed in to change notification settings - Fork 164
feat: post horizon transition period clean up #1261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
feat: post horizon transition period clean up
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1261 +/- ##
==========================================
+ Coverage 84.05% 84.18% +0.12%
==========================================
Files 42 42
Lines 2070 2068 -2
Branches 615 613 -2
==========================================
+ Hits 1740 1741 +1
+ Misses 330 327 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Worth noting this is expected to happen after the RewardsManager is upgraded for REO and IA, but that upgrade is not included on main yet. Not sure if you want to base on main and subsequently adjust, or instead make relative to an issuance related branch that is anticipated to be closer to what the changes will be relative to? |
| sp.__DEPRECATED_tokensLockedUntil = block.number + lockingPeriod; | ||
| emit HorizonStakeLocked(serviceProvider, sp.__DEPRECATED_tokensLocked, sp.__DEPRECATED_tokensLockedUntil); | ||
| } | ||
| sp.tokensStaked = stakedTokens - _tokens; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply sp.tokensStaked -= _tokens? (Intermediate stakedTokens no longer needed?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
| * a global lock. After that, unstake() will automatically withdraw. | ||
| * This function is for backwards compatibility with the legacy staking contract. | ||
| * It only allows withdrawing tokens unstaked before horizon upgrade. | ||
| * @dev This function can't be removed in case there are still pre-horizon unstakes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So presumed in this scenario they are no longer locked although not yet withdrawn?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, thats something we need to actually verify before deploying, though it should be true if the transition period is greater than the legacy thawing period (which is going to be)
|
The use of __DEPRECATED prefix might be misleading, because although no longer intended to be the main flow, in many cases the variables are still being used and have valid values that can still be updated. Not sure if or how to change, it might be another prefix (__LEGACY) could be used for this scenario? You could argue 'deprecated' does mean this, but I think for the rest of the code it generally implies 'no longer used', representing a field that could (for example) be repurposed? |
Maikol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also delete the files in subgraphService/test/integration/during-transition-period/
| * @inheritdoc IRewardsManager | ||
| * @dev This function can only be called by an authorized rewards issuer which are | ||
| * the staking contract (for legacy allocations), and the subgraph service (for new allocations). | ||
| * - the subgraph service (for new allocations). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: very minor but I would remove the new and have it (for allocations)
| * This function is for backwards compatibility with the legacy staking contract. | ||
| * It only allows withdrawing tokens unstaked before horizon upgrade. | ||
| * @dev This function can't be removed in case there are still pre-horizon unstakes. | ||
| * Note that it's assumed unstakes have already passed their thawing period. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we'll be deploying these changes after the transition period plus 28 epochs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we only need go live + 28 epochs no? undelegations during the transition period are horizon undelegations already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For undelegation yes but unstaking will still use the legacy method until the transition period ends. By go live do you mean when the transition period ends?
This PR removes code that's no longer relevant after the transition period.
In order for these changes to be valid there are some assumptions about the network state that must hold:
SubgraphService. This is a privileged account operation that will be executed once Horizon is live and legacy allocations can no longer be created.Note that
contractspackage tests are failing due to removing the staking contract as a valid rewards issuer from theRewardsManager. A deeper refactor of the package is required to fix this, most contracts in thecontractspackage are now deprecated so it's likely we need to extract those that are not intohorizonpackage or a brand new one.