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

refactor: move payload/builder/src/database.rs to revm/src/cached.rs #12252

Merged
merged 10 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
237 changes: 124 additions & 113 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions bin/reth/src/commands/debug_cmd/build_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use reth_node_api::{
EngineApiMessageVersion, NodeTypesWithDB, NodeTypesWithEngine, PayloadBuilderAttributes,
};
use reth_node_ethereum::{EthEvmConfig, EthExecutorProvider};
use reth_payload_builder::database::CachedReads;
use reth_primitives::{
revm_primitives::KzgSettings, BlobTransaction, BlobTransactionSidecar,
PooledTransactionsElement, SealedBlock, SealedBlockWithSenders, SealedHeader, Transaction,
Expand All @@ -36,7 +35,7 @@ use reth_provider::{
providers::BlockchainProvider, BlockHashReader, BlockReader, BlockWriter, ChainSpecProvider,
ProviderFactory, StageCheckpointReader, StateProviderFactory,
};
use reth_revm::{database::StateProviderDatabase, primitives::EnvKzgSettings};
use reth_revm::{cached::CachedReads, database::StateProviderDatabase, primitives::EnvKzgSettings};
use reth_stages::StageId;
use reth_transaction_pool::{
blobstore::InMemoryBlobStore, BlobStore, EthPooledTransaction, PoolConfig, TransactionOrigin,
Expand Down
1 change: 1 addition & 0 deletions crates/payload/basic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ reth-payload-builder.workspace = true
reth-payload-primitives.workspace = true
reth-tasks.workspace = true
reth-evm.workspace = true
reth-revm.workspace=true

# ethereum
alloy-rlp.workspace = true
Expand Down
5 changes: 2 additions & 3 deletions crates/payload/basic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ use futures_core::ready;
use futures_util::FutureExt;
use reth_chainspec::{ChainSpec, EthereumHardforks};
use reth_evm::state_change::post_block_withdrawals_balance_increments;
use reth_payload_builder::{
database::CachedReads, KeepPayloadJobAlive, PayloadId, PayloadJob, PayloadJobGenerator,
};
use reth_payload_builder::{KeepPayloadJobAlive, PayloadId, PayloadJob, PayloadJobGenerator};
use reth_payload_primitives::{
BuiltPayload, PayloadBuilderAttributes, PayloadBuilderError, PayloadKind,
};
Expand All @@ -28,6 +26,7 @@ use reth_primitives::{
use reth_provider::{
BlockReaderIdExt, BlockSource, CanonStateNotification, ProviderError, StateProviderFactory,
};
use reth_revm::cached::CachedReads;
use reth_tasks::TaskSpawner;
use reth_transaction_pool::TransactionPool;
use revm::{Database, State};
Expand Down
2 changes: 1 addition & 1 deletion crates/payload/builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ reth-ethereum-engine-primitives.workspace = true
reth-chain-state = { workspace = true, optional = true }

# alloy
alloy-rpc-types = { workspace = true, features = ["engine"] }
alloy-primitives.workspace = true
alloy-rpc-types = { workspace = true, features = ["engine"] }

# async
async-trait.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion crates/payload/builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub mod database;
mod metrics;
mod service;
mod traits;
Expand All @@ -111,8 +110,10 @@ pub mod noop;
#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;

use alloy_primitives as _;
pub use alloy_rpc_types::engine::PayloadId;
pub use reth_payload_primitives::{PayloadBuilderError, PayloadKind};
use reth_primitives as _;
pub use service::{
PayloadBuilderHandle, PayloadBuilderService, PayloadServiceCommand, PayloadStore,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//! Database adapters for payload building.
use alloy_primitives::{Address, B256, U256};
use alloy_primitives::{
map::{Entry, HashMap},
Address, B256, U256,
};
use core::cell::RefCell;
use reth_primitives::revm_primitives::{
db::{Database, DatabaseRef},
AccountInfo, Bytecode,
};
use std::{
cell::RefCell,
collections::{hash_map::Entry, HashMap},
};

/// A container type that caches reads from an underlying [`DatabaseRef`].
///
Expand All @@ -17,7 +17,7 @@ use std::{
/// # Example
///
/// ```
/// use reth_payload_builder::database::CachedReads;
/// use reth_revm::cached::CachedReads;
/// use revm::db::{DatabaseRef, State};
///
/// fn build_payload<DB: DatabaseRef>(db: DB) {
Expand Down
8 changes: 6 additions & 2 deletions crates/revm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@

extern crate alloc;

pub mod batch;

/// Cache database that reads from an underlying [`DatabaseRef`].
/// Database adapters for payload building.
pub mod cached;

/// Contains glue code for integrating reth database into revm's [Database].
pub mod database;

pub mod batch;

/// Common test helpers
#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;
Expand Down
Loading