-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
chore(db): bundle builder #9192
Conversation
Co-authored-by: Emilia Hane <elsaemiliaevahane@gmail.com>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de> Co-authored-by: Emilia Hane <elsaemiliaevahane@gmail.com>
// If the address is not already in the bundle builder's state, add it. | ||
if !bundle_builder.get_states().contains(&address) { | ||
// Seek the address in the plain account state. | ||
if let Some(new_info) = plain_accounts_cursor.seek_exact(address)?.map(|kv| kv.1) { | ||
// Add the new info to the bundle builder. | ||
bundle_builder = | ||
bundle_builder.state_present_account_info(address, new_info.into()); | ||
} | ||
} | ||
// insert old info into reverts. | ||
reverts.entry(block_number).or_default().entry(address).or_default().0 = Some(old_info); | ||
|
||
// Add the old account info to the bundle builder if it exists. | ||
if let Some(old_info) = old_info { | ||
bundle_builder = | ||
bundle_builder.state_original_account_info(address, old_info.into()); | ||
} |
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.
review from https://github.com/paradigmxyz/reth/pull/8264/files#r1646535481 @rkrasiuk
previous behavior: if the entry is occuppied, overwrite the original account state even if old_info is None
current behavior: only overwrite the original account state if old_info is Some.
if old_info is None, original info must still be overwritten
the methods BundleBuilder::state_original_account_info
and BundleBuilder::state_present_account_info
don't take an Option<AccountInfo
as param. so I'm wondering:
- if entry is occupied but the original info is
None
, should we pass thenew_info
toBundleBuilder::state_original_account_info
? - there is another method
BundleBuilder::set_revert_account_info
, that takesOption<Option<AccountInfo>>
, is that the one we should be calling here?
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.
@DaniPopes, you're probably familiar with the revm api and can answer this too?
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'm not familiar with state/transitions/bundles APIs
as i mentioned in reviews for #8264, bundle builder API must be improved first before integration in reth |
Merges changes from #8264 and #8861