Skip to content

Commit 2776bea

Browse files
committed
new tmp fin/prefin w/o root hash
1 parent 71b9741 commit 2776bea

File tree

24 files changed

+551
-494
lines changed

24 files changed

+551
-494
lines changed

crates/eth-sparse-mpt/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ rustc-hash = "2.0.0"
1717
rayon = "1.10.0"
1818
smallvec = "1.13.2"
1919
alloy-trie.workspace = true
20-
nybbles = { version = "0.3.3" }
20+
nybbles = { version = "0.3.3", features = ["serde"] }
2121

2222
tracing.workspace = true
2323

crates/eth-sparse-mpt/src/lib.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88

99
use crate::utils::{HashMap, HashSet};
1010
use alloy_primitives::{Address, Bytes, B256};
11-
use reth_provider::{
12-
providers::ConsistentDbView, BlockReader, DatabaseProviderFactory, ExecutionOutcome,
13-
};
11+
use reth_provider::{providers::ConsistentDbView, BlockReader, DatabaseProviderFactory};
12+
use revm::database::BundleState;
1413
use std::sync::Arc;
1514

1615
#[cfg(any(test, feature = "benchmark-utils"))]
@@ -140,7 +139,7 @@ impl SparseTrieError {
140139

141140
pub fn calculate_account_proofs_with_sparse_trie<Provider>(
142141
consistent_db_view: ConsistentDbView<Provider>,
143-
outcome: &ExecutionOutcome,
142+
outcome: &BundleState,
144143
proof_targets: &HashSet<Address>,
145144
shared_cache: &SparseTrieSharedCache,
146145
local_cache: &mut SparseTrieLocalCache,
@@ -165,6 +164,7 @@ where
165164
consistent_db_view,
166165
shared_cache.cache_v2.clone(),
167166
outcome,
167+
&[],
168168
proof_targets,
169169
);
170170
match result {
@@ -182,7 +182,8 @@ where
182182

183183
pub fn calculate_root_hash_with_sparse_trie<Provider>(
184184
consistent_db_view: ConsistentDbView<Provider>,
185-
outcome: &ExecutionOutcome,
185+
outcome: &BundleState,
186+
incremental_change: &[Address],
186187
shared_cache: &SparseTrieSharedCache,
187188
local_cache: &mut SparseTrieLocalCache,
188189
thread_pool: &Option<RootHashThreadPool>,
@@ -196,6 +197,7 @@ where
196197
calculate_root_hash_with_sparse_trie_internal(
197198
consistent_db_view,
198199
outcome,
200+
incremental_change,
199201
shared_cache,
200202
local_cache,
201203
version,
@@ -205,6 +207,7 @@ where
205207
calculate_root_hash_with_sparse_trie_internal(
206208
consistent_db_view,
207209
outcome,
210+
incremental_change,
208211
shared_cache,
209212
local_cache,
210213
version,
@@ -214,7 +217,8 @@ where
214217

215218
pub fn calculate_root_hash_with_sparse_trie_internal<Provider>(
216219
consistent_db_view: ConsistentDbView<Provider>,
217-
outcome: &ExecutionOutcome,
220+
outcome: &BundleState,
221+
incremental_change: &[Address],
218222
shared_cache: &SparseTrieSharedCache,
219223
local_cache: &mut SparseTrieLocalCache,
220224
version: ETHSpareMPTVersion,
@@ -239,6 +243,7 @@ where
239243
consistent_db_view,
240244
shared_cache.cache_v2.clone(),
241245
outcome,
246+
incremental_change,
242247
&Default::default(),
243248
);
244249
match result {

crates/eth-sparse-mpt/src/v1/reth_sparse_trie/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ use alloy_primitives::B256;
22
use change_set::{prepare_change_set, prepare_change_set_for_prefetch};
33
use hash::RootHashError;
44
use reth_provider::{
5-
providers::ConsistentDbView, BlockReader, DatabaseProviderFactory, ExecutionOutcome,
5+
providers::ConsistentDbView, BlockReader, DatabaseProviderFactory,
66
};
7+
use revm::database::BundleState;
78
use std::time::{Duration, Instant};
89

910
pub mod change_set;
@@ -105,7 +106,7 @@ where
105106
/// * It uses rayon for parallelism and the thread pool should be configured from outside.
106107
pub fn calculate_root_hash_with_sparse_trie<Provider>(
107108
consistent_db_view: ConsistentDbView<Provider>,
108-
outcome: &ExecutionOutcome,
109+
outcome: &BundleState,
109110
shared_cache: SparseTrieSharedCache,
110111
) -> (Result<B256, SparseTrieError>, SparseTrieMetrics)
111112
where
@@ -116,7 +117,7 @@ where
116117
let fetcher = TrieFetcher::new(consistent_db_view);
117118

118119
let start = Instant::now();
119-
let change_set = prepare_change_set(outcome.bundle_accounts_iter());
120+
let change_set = prepare_change_set(outcome.state.iter().map(|(a, acc)| (*a, acc)));
120121
metrics.change_set_time += start.elapsed();
121122

122123
// {

0 commit comments

Comments
 (0)