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

Lay way for l2tol1 storage root verification in pipeline sync #16

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions bin/reth/src/commands/debug_cmd/build_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use reth_provider::{
BlockHashReader, BlockReader, BlockWriter, ChainSpecProvider, ProviderFactory,
StageCheckpointReader, StateProviderFactory,
};
use reth_revm::{cached::CachedReads, database::StateProviderDatabase, primitives::KzgSettings};
use reth_revm::{cached::CachedReads, primitives::KzgSettings};
use reth_stages::StageId;
use reth_transaction_pool::{
blobstore::InMemoryBlobStore, BlobStore, EthPooledTransaction, PoolConfig, TransactionOrigin,
Expand Down Expand Up @@ -260,7 +260,7 @@ impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
SealedBlockWithSenders::<BlockTy<N>>::new(block.clone(), senders).unwrap();

let state_provider = blockchain_db.latest()?;
let db = StateProviderDatabase::new(&state_provider);
let db = &state_provider;
let executor =
EthExecutorProvider::ethereum(provider_factory.chain_spec()).executor(db);

Expand Down
3 changes: 1 addition & 2 deletions bin/reth/src/commands/debug_cmd/in_memory_merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use reth_provider::{
OriginalValuesKnown, ProviderFactory, StageCheckpointReader, StateWriter, StorageLocation,
StorageReader,
};
use reth_revm::database::StateProviderDatabase;
use reth_stages::StageId;
use reth_tasks::TaskExecutor;
use reth_trie::StateRoot;
Expand Down Expand Up @@ -145,7 +144,7 @@ impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
.await?;

let state_provider = LatestStateProviderRef::new(&provider);
let db = StateProviderDatabase::new(&state_provider);
let db = &state_provider;

let executor = EthExecutorProvider::ethereum(provider_factory.chain_spec()).executor(db);

Expand Down
6 changes: 2 additions & 4 deletions bin/reth/src/commands/debug_cmd/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ use reth_provider::{
DatabaseProviderFactory, HeaderProvider, LatestStateProviderRef, OriginalValuesKnown,
ProviderError, ProviderFactory, StateWriter, StorageLocation,
};
use reth_revm::database::StateProviderDatabase;
use reth_stages::{
stages::{AccountHashingStage, MerkleStage, StorageHashingStage},
ExecInput, Stage, StageCheckpoint,
Expand Down Expand Up @@ -161,9 +160,8 @@ impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
provider_rw.insert_block(sealed_block.clone(), StorageLocation::Database)?;

td += sealed_block.difficulty;
let mut executor = executor_provider.batch_executor(StateProviderDatabase::new(
LatestStateProviderRef::new(&provider_rw),
));
let mut executor =
executor_provider.batch_executor(LatestStateProviderRef::new(&provider_rw));
executor.execute_and_verify_one((&sealed_block.clone().unseal(), td).into())?;
let execution_outcome = executor.finalize();

Expand Down
1 change: 0 additions & 1 deletion crates/blockchain-tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ reth-execution-errors.workspace = true
reth-db.workspace = true
reth-db-api.workspace = true
reth-evm.workspace = true
reth-revm.workspace = true
reth-provider.workspace = true
reth-execution-types.workspace = true
reth-stages-api.workspace = true
Expand Down
3 changes: 1 addition & 2 deletions crates/blockchain-tree/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use reth_provider::{
DBProvider, FullExecutionDataProvider, HashedPostStateProvider, ProviderError,
StateRootProvider, TryIntoHistoricalStateProvider,
};
use reth_revm::database::StateProviderDatabase;
use reth_trie::{updates::TrieUpdates, TrieInput};
use reth_trie_parallel::root::ParallelStateRoot;
use std::{
Expand Down Expand Up @@ -204,7 +203,7 @@ impl AppendableChain {

let provider = BundleStateProvider::new(state_provider, bundle_state_data_provider);

let db = StateProviderDatabase::new(&provider);
let db = &provider;
let executor = externals.executor_factory.executor(db);
let block_hash = block.hash();
let block = block.unseal();
Expand Down
6 changes: 3 additions & 3 deletions crates/engine/invalid-block-hooks/src/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use reth_primitives::{NodePrimitives, SealedBlockWithSenders, SealedHeader};
use reth_primitives_traits::SignedTransaction;
use reth_provider::{BlockExecutionOutput, ChainSpecProvider, StateProviderFactory};
use reth_revm::{
database::StateProviderDatabase, db::states::bundle_state::BundleRetention,
primitives::EnvWithHandlerCfg, DatabaseCommit, StateBuilder,
db::states::bundle_state::BundleRetention, primitives::EnvWithHandlerCfg, DatabaseCommit,
StateBuilder, StateProviderDatabase,
};
use reth_rpc_api::DebugApiClient;
use reth_tracing::tracing::warn;
Expand Down Expand Up @@ -71,7 +71,7 @@ where

// Setup database.
let mut db = StateBuilder::new()
.with_database(StateProviderDatabase::new(
.with_database(StateProviderDatabase(
self.provider.state_by_block_hash(parent_header.hash())?,
))
.with_bundle_update()
Expand Down
2 changes: 0 additions & 2 deletions crates/engine/tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ reth-primitives.workspace = true
reth-primitives-traits.workspace = true
reth-provider.workspace = true
reth-prune.workspace = true
reth-revm.workspace = true
reth-stages-api.workspace = true
reth-tasks.workspace = true
reth-trie-parallel.workspace = true
Expand Down Expand Up @@ -114,7 +113,6 @@ test-utils = [
"reth-provider/test-utils",
"reth-prune-types",
"reth-prune-types?/test-utils",
"reth-revm/test-utils",
"reth-stages-api/test-utils",
"reth-stages/test-utils",
"reth-static-file",
Expand Down
3 changes: 1 addition & 2 deletions crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ use reth_provider::{
HashedPostStateProvider, ProviderError, StateCommitmentProvider, StateProviderBox,
StateProviderFactory, StateReader, StateRootProvider, TransactionVariant,
};
use reth_revm::database::StateProviderDatabase;
use reth_stages_api::ControlFlow;
use reth_trie::{updates::TrieUpdates, HashedPostState, TrieInput};
use reth_trie_parallel::root::{ParallelStateRoot, ParallelStateRootError};
Expand Down Expand Up @@ -2215,7 +2214,7 @@ where
}

trace!(target: "engine::tree", block=?block.num_hash(), "Executing block");
let executor = self.executor_provider.executor(StateProviderDatabase::new(&state_provider));
let executor = self.executor_provider.executor(&state_provider);

let block_number = block.number();
let block_hash = block.hash();
Expand Down
1 change: 1 addition & 0 deletions crates/ethereum/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ reth-primitives = { workspace = true, features = ["reth-codec"] }
reth-revm.workspace = true
reth-ethereum-consensus.workspace = true
reth-consensus.workspace = true
reth-storage-api.workspace = true

# Ethereum
revm-primitives.workspace = true
Expand Down
Loading