-
Notifications
You must be signed in to change notification settings - Fork 5
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
Implement BMPT ParallelStateRoot
#72
Comments
@greged93 Can you explore this issue by exploring the open questions raised in the description to see what direction we should take please? |
I'm running into some cyclic dep issues which might limit the above design. Currently, I have added a I think being able to go around this would require a rework on the |
Can you provide references to the code where you have implemented this please so I can have some additional context. |
here is the branch for it.
|
Right, I see the issue here. I think given that we will be deprecating the tree I would propose that we implement |
adding this suggestion from @frisitano here in case we want to explore an abstraction in the future:
pub trait ConsistentDBViewProviderFactory {
type DB: Database;
type Provider: DBProvider<Tx = <Self::DB as Database>::TX>;
fn provider_ro(&self) -> ProviderResult<Self::Provider>;
}
pub trait ParallelDatabaseStateRoot<F: ConsistentDBViewProviderFactory> {
/// Returns a parallel state root instance from the [`ConsistentDbView`].
fn from_consistent_db_view(view: F) -> Result<Self, ProviderError>;
/// Calculate the state root in parallel.
fn incremental_root(self, input: TrieInput) -> Result<B256, ParallelStateRootError>;
/// Calculate the state root in parallel and returns the trie updates.
fn incremental_root_with_updates(
self,
input: TrieInput,
) -> Result<(B256, TrieUpdates), ParallelStateRootError>;
} |
closed by #100 |
Describe the feature
Currently, we only have a
StateRoot
implementation for the BMPT (#36). However, in live sync mode, the engine uses aParallelStateRoot
object, which computes all storage tries in parallel. We should create aParallelStateRoot
type for the BMPT, introduce aParallelStateRootProvider
, and include it in theStateCommitment
type.Implementation
First, we should review usage of the
ParallelStateRoot
object within the reth codebase and implement aDatabaseParallelStateRoot
trait in https://github.com/scroll-tech/reth/blob/scroll/crates/trie/db/src/state.rs. We should then introduce aParallelStateRoot
type for scroll in https://github.com/scroll-tech/reth/tree/scroll/crates/scroll/state-commitment/src/root. We should implementDatabaseParallelStateRoot
on both the scroll and nativeParallelStateRoot
types. We should addParallelStateRoot
GAT which is bound byDatabaseParallelStateRoot
inStateCommitment
. We should update the concrete implementations ofStateCommitment
for both BMPT and MPT. We should introduce aParallelStateRootProvider
in https://github.com/scroll-tech/reth/tree/scroll/crates/storage/provider. Alternatively, it may be sufficient to add additional methods toStateRootProviderExt
if we only use theParallelStateRoot
when calculating the state root for the most recent state (this should be investigated).reth/crates/storage/storage-api/src/trie.rs
Lines 46 to 78 in b456d1f
We should replace direct instantiation and invocation of
ParallelStateRoot
in the codebase with invocations of the provider methods.Additional context
No response
The text was updated successfully, but these errors were encountered: