Skip to content
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

Closed
wants to merge 3 commits into from
Closed

Conversation

emhane
Copy link
Member

@emhane emhane commented Jun 29, 2024

Merges changes from #8264 and #8861

quentinv72 and others added 3 commits June 29, 2024 11:18
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>
@emhane emhane added C-debt Refactor of code section that is hard to understand or maintain 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
Member 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
Member 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 Refactor of code section that is hard to understand or maintain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants