-
Notifications
You must be signed in to change notification settings - Fork 14
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
Run P7 delegator migrations at every P7 block instead of only payday #283
Conversation
} else if (payload.BlockInfo.ProtocolVersion == ProtocolVersion.P7) { | ||
// Starting from Concordium Protocol Version 7 stake changes are immediate, | ||
// meaning no delegators are expected to have pending changes from this point. | ||
// Only the block in P7 should this do anything, afterwards it is a | ||
// no-op, since no accounts with pending changes are expected. | ||
await _writer.UpdateAccountsWithPendingDelegationChange(DateTimeOffset.MaxValue, | ||
account => ApplyPendingChange(account, resultBuilder)); | ||
|
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.
Not a blocker, but could be:
} else if (payload.BlockInfo.ProtocolVersion == ProtocolVersion.P7) { | |
// Starting from Concordium Protocol Version 7 stake changes are immediate, | |
// meaning no delegators are expected to have pending changes from this point. | |
// Only the block in P7 should this do anything, afterwards it is a | |
// no-op, since no accounts with pending changes are expected. | |
await _writer.UpdateAccountsWithPendingDelegationChange(DateTimeOffset.MaxValue, | |
account => ApplyPendingChange(account, resultBuilder)); | |
} else if (payload.BlockInfo.ProtocolVersion >= ProtocolVersion.P7) { | |
// Starting from Concordium Protocol Version 7 stake changes are immediate, | |
// meaning no delegators are expected to have pending changes from this point. | |
// Only the block in P7 should this do anything, afterwards it is a | |
// no-op, since no accounts with pending changes are expected. | |
await _writer.UpdateAccountsWithPendingDelegationChange(DateTimeOffset.MaxValue, | |
account => ApplyPendingChange(account, resultBuilder)); | |
Also seems to reflect the comment more precisely?
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.
This is migrating state from P6 to P7, so when we get to P8 it does not need to be run.
Ideally we would not run it more than once, either but this was quick solution.
} else if (payload.BlockInfo.ProtocolVersion == ProtocolVersion.P7) { | ||
// Starting from Concordium Protocol Version 7 stake changes are immediate, | ||
// meaning no delegators are expected to have pending changes from this point. | ||
// Only the block in P7 should this do anything, afterwards it is a |
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.
// Only the block in P7 should this do anything, afterwards it is a | |
// Only the first block in P7 should this do anything, afterwards it is a |
?
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, that is what I meant to write 😅 maybe I'll fix it
Purpose
Fix bug preventing the ingestion from proceeding.
The issue was that delegators with pending changes from P6 were not migrated immediately in P7, as the migration logic was only run at payday.
This PR changes the migration logic to be run at every block ingested in P7.