-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat(pruner): storage history #4006
Conversation
…nto alexey/pruner-storage-history
2f5365c
to
ae9bb3a
Compare
b9a7784
to
13131a4
Compare
ae9bb3a
to
2f5365c
Compare
…nto alexey/pruner-storage-history
…nto alexey/pruner-storage-history
…nto alexey/pruner-storage-history
…nto alexey/pruner-storage-history
…nto alexey/pruner-storage-history
…nto alexey/pruner-storage-history
…nto alexey/pruner-storage-history
ee60036
to
e5fe91b
Compare
…nto alexey/pruner-storage-history
Codecov Report
... and 8 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
lgtm
// Shard contains block numbers that are higher than the target one, so we need to | ||
// filter it. It is guaranteed that further shards for this address and storage slot | ||
// will not contain the target block number, as it's in this shard. |
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 a very useful comment
let blocks = blocks | ||
.iter(0) | ||
.skip_while(|block| *block <= to_block as usize) | ||
.collect::<Vec<_>>(); |
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.
these are only numbers and not the actual blocks, so we can safely load them
// shards are not allowed. | ||
if key.sharded_key.highest_block_number == u64::MAX { | ||
// If current shard is the last shard for this address and storage slot, | ||
// replace it with the previous shard. | ||
if let Some((prev_key, prev_value)) = cursor.prev()? { | ||
if prev_key.address == key.address && |
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.
even if we have a bunch of levels, this is still readable imo
f5652d1
to
1317aea
Compare
Resolves #3694
Prunes:
StorageChangeSet
table: all keys starting with block numbers (and their subkeys which are storage keys) which need to be prunedStorageHistory
table:highest_block_number
less than or equal to the target block number for pruning, delete the shard completely.highest_block_number
greater than the target block number for pruning, filter block numbers inside the shard which are less than the target block number for pruning.