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(provider): add BlockchainProvider3 with only one view #11706

Merged
merged 4 commits into from
Oct 18, 2024

Conversation

joshieDo
Copy link
Collaborator

@joshieDo joshieDo commented Oct 14, 2024

on top of #11705

  • add BP3 and replace BP2
  • BP3 holds a DatabaseProvider with a DbTx and a head BlockState.
  • removes CanonChainTracker, CanonStateSubscriptions and ForkChoiceSubscriptions from BP3 . Should be called from BPF

hive https://github.com/paradigmxyz/reth/actions/runs/11377134508

@joshieDo joshieDo added C-enhancement New feature or request A-db Related to the database A-blockchain-tree Related to sidechains, reorgs and pending blocks labels Oct 14, 2024
@joshieDo joshieDo requested a review from mattsse October 14, 2024 06:27
@joshieDo joshieDo force-pushed the joshie/bp3 branch 3 times, most recently from e4520b9 to 2539f1d Compare October 14, 2024 08:42
@joshieDo joshieDo force-pushed the joshie/bp3 branch 2 times, most recently from 9e4b59e to 6482f4a Compare October 14, 2024 11:32
Comment on lines 2167 to 1931
provider.canonical_in_memory_state.update_chain(chain);
let provider = provider_factory.provider3()?;

// Now the block should be found in memory
assert_eq!(
provider.find_block_by_hash(first_in_mem_block.hash(), BlockSource::Any)?,
Some(first_in_mem_block.clone().into())
);
Copy link
Collaborator Author

@joshieDo joshieDo Oct 14, 2024

Choose a reason for hiding this comment

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

notice that we need to instantiate a provider again to get the new in-memory view, otherwise this fails

storage_provider: <ProviderFactory<N> as DatabaseProviderFactory>::Provider,
/// Storage provider factory. Necessary for `StateProviderFactory` since it takes ownership of
/// a read tx.
storage_provider_factory: ProviderFactory<N>,
Copy link
Collaborator Author

@joshieDo joshieDo Oct 17, 2024

Choose a reason for hiding this comment

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

factory goes away in #11778

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.

I'm a bit lost now.

what impact does this have on consumers that currently rely on all the provider traits, which type will be used there then?

@joshieDo joshieDo merged commit 1673817 into joshie/bpf Oct 18, 2024
30 checks passed
@joshieDo joshieDo deleted the joshie/bp3 branch October 18, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-tree Related to sidechains, reorgs and pending blocks A-db Related to the database C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants