This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
grandpa: cleanup stale entries in set id session mapping #13237
Merged
paritytech-processbot
merged 8 commits into
master
from
andre/grandpa-cleanup-stale-set-id-session
Jan 30, 2023
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bcc6c9a
grandpa: cleanup stale entries in set id session mapping
andresilva 0cca7c1
Update frame/grandpa/src/migrations.rs
andresilva 5b07212
grandpa: remove unused import
andresilva 50b175d
grandpa: migration off-by-one
andresilva 7f3b301
Update frame/grandpa/src/lib.rs
andresilva ac6caad
Update frame/grandpa/src/lib.rs
andresilva cb3fadb
grandpa: MaxSetIdSessionEntries as u64
andresilva 0598c70
node-template: fix MaxSetIdSessionEntries type
andresilva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just curious.
In case we have more than
X
entries this will bail out entirely.In this case what is the strategy to cleanup the leftovers?
The note talks about a multi-block migration. How this can be implemented? And who is in charge to implement it? Just asking to prevent it from being forgotten forever 😃
Also at this point can't we at least use a best effort approach and cleanup the first
X
entries?Another idea/question (not a super expert of runtime upgrades... but I assume it can work)
If we save in the state a temporary variable to keep track of where we arrived (with the cleanup) so far and we leave this migration code here for the next runtime, then in the worst case after a bunch of upgrades we cleaned everything and at that point we also remove the temporary state variable.
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.
I just put this (random) cut-off here to prevent any users from shooting themselves in the foot. By "multi-block" migration I mean exactly what you suggested, just keep track of the current state of cleanup and remove N entries every block until it's finished. The reason I didn't implement this is because we don't need it for any of our networks and I figured it was unnecessary to add the extra complexity. I put this note here in case any other user of substrate needs to implement this (TBH even 25000 entries might be fast enough to do in a single block, I didn't test this as our limits are way lower than this ~6500).
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.
Got it! Thank you