-
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(storage): account for pruned account/storage history #4092
Conversation
i don't quite like that i'm getting a provider for a block that i didn't request. I'd rather it fail (or |
Codecov Report
... and 59 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.
agree with @joshieDo
if the requested block's state is pruned this should just fail.
this looks way too complex
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 definitely need this.
left some suggestions,
a helper wrapper type could be nice with functions to ensure target block number is present
let account_history_prune_checkpoint = | ||
provider.get_prune_checkpoint(PrunePart::AccountHistory)?; | ||
let storage_history_prune_checkpoint = | ||
provider.get_prune_checkpoint(PrunePart::StorageHistory)?; |
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 makes sense and is the correct way, should be negligible
lowest_account_history_block_number: Option<BlockNumber>, | ||
lowest_storage_history_block_number: Option<BlockNumber>, | ||
block_number: BlockNumber, |
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.
lets flip the order
block_number first then the options
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.
agree, fixed
/// Lowest block number at which the account history is available. | ||
lowest_account_history_block_number: Option<BlockNumber>, | ||
/// Lowest block number at which the storage history is available. | ||
lowest_storage_history_block_number: Option<BlockNumber>, |
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'd like to add some docs here that we have this because data could be pruned
perhaps consider adding a helper type for this, maybe we need more things in the future?
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.
added docs, helper struct and also tests
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
Tested with requesting the
trace_transaction
for beacon deposit contract creation transaction https://etherscan.io/tx/0xe75fb554e433e03763a1560646ee22dcb74e5274b34c5ad644e7c0f619a7e1d0.Before:
After:
Same for other methods that use the historical state provider: