-
Notifications
You must be signed in to change notification settings - Fork 2.2k
refactor: Use BundleBuilder instead of hashmaps #8264
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
refactor: Use BundleBuilder instead of hashmaps #8264
Conversation
emhane
left a comment
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, pending @rakita
Upgrade revm version to help unblock changes needed in paradigmxyz/reth#8264 (comment) --------- Co-authored-by: DaniPopes <[email protected]>
mattsse
left a comment
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.
| if let Some(old_info) = old_info { | ||
| bundle_builder = | ||
| bundle_builder.state_original_account_info(address, into_revm_acc(old_info)); | ||
| } |
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.
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
| if let Some(new_info) = new_info { | ||
| bundle_builder = | ||
| bundle_builder.state_present_account_info(address, into_revm_acc(new_info)); |
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.
same as the comment below, this leads to incorrect state for destroyed accounts
| entry.insert((present_info, present_info, HashMap::new())) | ||
| if !bundle_builder.get_states().contains(&address) { | ||
| let present_info = plain_accounts_cursor.seek_exact(address)?.map(|kv| kv.1); | ||
| if let Some(present_info) = present_info { |
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.
there should be no Some check here
| let account_state = match bundle_builder.get_state_storage_mut().entry(address) { | ||
| hash_map::Entry::Occupied(entry) => entry.into_mut(), | ||
| hash_map::Entry::Vacant(entry) => entry.insert(HashMap::new()), | ||
| }; |
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.
| let account_state = match bundle_builder.get_state_storage_mut().entry(address) { | |
| hash_map::Entry::Occupied(entry) => entry.into_mut(), | |
| hash_map::Entry::Vacant(entry) => entry.insert(HashMap::new()), | |
| }; | |
| let account_storage = bundle_builder.get_state_storage_mut().entry(address).or_default(); |
|
addressing my comments probably requires some rework of |
|
Thank you all for reviewing. Unfortunately, I don't think that I'll be able to address the comments on this PR as I have some other commitments at the moment. If anyone else wants to pick this up or close the PR, then please do so. |
Upgrade revm version to help unblock changes needed in paradigmxyz/reth#8264 (comment) --------- Co-authored-by: DaniPopes <[email protected]>
Upgrade revm version to help unblock changes needed in paradigmxyz/reth#8264 (comment) --------- Co-authored-by: DaniPopes <[email protected]>
Closes #4614
insert_stateincrates/storage/db-common/src/init.rsto use BundleBuilderunwind_or_peek_stateincrates/storage/provider/src/providers/database/provider.rsto use BundleBuilderBundleStateInit,AccountRevertInit, andRevertInit.