Skip to content
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

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

limemloh
Copy link
Contributor

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.

@limemloh limemloh requested a review from DOBEN October 30, 2024 12:37
@limemloh limemloh merged commit caed5d8 into main Oct 30, 2024
4 checks passed
@limemloh limemloh deleted the p7-migration-delegators branch October 30, 2024 12:41
Comment on lines +38 to +45
} 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));

Copy link
Collaborator

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:

Suggested change
} 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?

Copy link
Contributor Author

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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

?

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants