Skip to content

Conversation

@emhane
Copy link
Collaborator

@emhane emhane commented Jun 29, 2024

Merges changes from #8264 and #8861

@emhane emhane added C-debt A clean up/refactor of existing code A-db Related to the database labels Jun 29, 2024
Comment on lines +657 to +671
// 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());
}
Copy link
Collaborator Author

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 the new_info to BundleBuilder::state_original_account_info?
  • there is another method BundleBuilder::set_revert_account_info, that takes Option<Option<AccountInfo>>, is that the one we should be calling here?

Copy link
Collaborator Author

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?

Copy link
Member

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

@rkrasiuk
Copy link
Member

rkrasiuk commented Jul 3, 2024

as i mentioned in reviews for #8264, bundle builder API must be improved first before integration in reth

@rkrasiuk rkrasiuk closed this Jul 3, 2024
@rkrasiuk rkrasiuk deleted the emhane/integrate-bundle-builder branch July 3, 2024 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-db Related to the database C-debt A clean up/refactor of existing code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants