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

perf(tree): state provider builder #14279

Merged
merged 3 commits into from
Feb 7, 2025

Conversation

namn-grg
Copy link
Contributor

@namn-grg namn-grg commented Feb 6, 2025

Overview

Introduces a cloneable state provider builder to optimize state provider creation by moving it out of the critical execution path.

Closes #14136

@namn-grg namn-grg force-pushed the chore/clone-state-provider branch from 3db0e67 to 2695011 Compare February 6, 2025 19:45
Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

Just have one comment, this looks very good already!

Comment on lines 443 to 456
/// Returns a builder for creating state providers for the given hash.
///
/// This is used to optimize state provider creation in parallel execution contexts.
pub fn state_provider_builder<P>(
&self,
provider: P,
hash: B256,
) -> Option<StateProviderBuilder<N, P>>
where
P: BlockReader + StateProviderFactory + StateReader + StateCommitmentProvider + Clone,
{
let (historical, blocks) = self.blocks_by_hash(hash)?;
Some(StateProviderBuilder { provider, historical, blocks })
}
Copy link
Member

@Rjected Rjected Feb 6, 2025

Choose a reason for hiding this comment

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

I think we can remove this method and call self.blocks_by_hash + init the builder in the other state_provider_builder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi just saw this thanks for review and fixing

@Rjected
Copy link
Member

Rjected commented Feb 6, 2025

also needs fmt

@Rjected
Copy link
Member

Rjected commented Feb 6, 2025

taking over as this is urgent now

@Rjected Rjected marked this pull request as ready for review February 7, 2025 00:39
@Rjected Rjected added this pull request to the merge queue Feb 7, 2025
Merged via the queue into paradigmxyz:main with commit 2933ec7 Feb 7, 2025
44 checks passed
18aaddy pushed a commit to 18aaddy/reth that referenced this pull request Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce clone-able state provider builder for tree state
2 participants