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

feat: reset trie updates on make_canonical #8370

Merged
merged 5 commits into from
May 27, 2024

Conversation

fgimenez
Copy link
Member

Reset trie updates for the rest of the children forking from the canonical tip after a fork choice update.

@fgimenez fgimenez added A-engine Related to the engine implementation C-security Issue or pull request related to security. labels May 23, 2024
Copy link
Member

@rkrasiuk rkrasiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm pending @rakita

Copy link
Collaborator

@rakita rakita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one nit, but lgtm

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, optional suggestion re standalone function, but didn't check if viable

Comment on lines 1206 to 1207
.filter_map(|child| self.block_indices().get_blocks_chain_id(&child))
.collect();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah we need this collect because this resides in state and the compiler doesn't allow us to borrow here.

maybe we could move this to a function in state

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattsse exactly, with a for_each after the filter_map the second closure (in for_each) required exclusive access to self.state.chains but was already borrowed in the first closure (filter_map) due to the use of *self.

Not sure if moving the code to a function in state could help, the first part (determining the dependent blocks that extend the old tip and their chain ids) is done using the indices, not the state, and the second one (querying the chains associated with each chain id) is done using the state, maybe I'm missing something?

I've pushed changes to prevent creating the temporary vector using nested if lets, ptal.

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@fgimenez fgimenez added this pull request to the merge queue May 27, 2024
Merged via the queue into main with commit 89e55c4 May 27, 2024
30 checks passed
@fgimenez fgimenez deleted the fgimenez/remove-trie-updates-during-fcu branch May 27, 2024 10:37
mw2000 pushed a commit to mw2000/reth that referenced this pull request Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-engine Related to the engine implementation C-security Issue or pull request related to security.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants