diff --git a/Cargo.lock b/Cargo.lock index 7929e1f15cb7..6b809a08dbac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2927,7 +2927,6 @@ dependencies = [ "reth", "reth-chainspec", "reth-db", - "reth-db-api", "reth-node-ethereum", "reth-provider", "tokio", @@ -7684,7 +7683,6 @@ dependencies = [ "reth-config", "reth-consensus-common", "reth-db", - "reth-db-api", "reth-discv4", "reth-discv5", "reth-fs-util", diff --git a/crates/node/core/Cargo.toml b/crates/node/core/Cargo.toml index 0d507853d770..fabdecd3b1e7 100644 --- a/crates/node/core/Cargo.toml +++ b/crates/node/core/Cargo.toml @@ -18,7 +18,6 @@ reth-cli.workspace = true reth-cli-util.workspace = true reth-fs-util.workspace = true reth-db = { workspace = true, features = ["mdbx"] } -reth-db-api.workspace = true reth-storage-errors.workspace = true reth-provider.workspace = true reth-network = { workspace = true, features = ["serde"] } diff --git a/crates/node/core/src/version.rs b/crates/node/core/src/version.rs index 78dbcfbcf5e9..683c30564265 100644 --- a/crates/node/core/src/version.rs +++ b/crates/node/core/src/version.rs @@ -1,5 +1,5 @@ //! Version information for reth. -use reth_db_api::models::ClientVersion; +use reth_db::ClientVersion; use reth_rpc_types::engine::ClientCode; /// The client code for Reth diff --git a/crates/storage/db-api/src/models/blocks.rs b/crates/storage/db-api/src/models/blocks.rs index 052254be784b..0da35da6b5f4 100644 --- a/crates/storage/db-api/src/models/blocks.rs +++ b/crates/storage/db-api/src/models/blocks.rs @@ -1,7 +1,7 @@ //! Block related models and types. use reth_codecs::{add_arbitrary_tests, Compact}; -use reth_primitives::{Header, Withdrawals, B256}; +use reth_primitives::{Header, B256}; use serde::{Deserialize, Serialize}; /// The storage representation of a block's ommers. @@ -15,15 +15,6 @@ pub struct StoredBlockOmmers { pub ommers: Vec
, } -/// The storage representation of block withdrawals. -#[derive(Debug, Default, Eq, PartialEq, Clone, Serialize, Deserialize, Compact)] -#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] -#[add_arbitrary_tests(compact)] -pub struct StoredBlockWithdrawals { - /// The block withdrawals. - pub withdrawals: Withdrawals, -} - /// Hash of the block header. pub type HeaderHash = B256; diff --git a/crates/storage/db-api/src/models/mod.rs b/crates/storage/db-api/src/models/mod.rs index 07f69402ef5c..5061876fb9ff 100644 --- a/crates/storage/db-api/src/models/mod.rs +++ b/crates/storage/db-api/src/models/mod.rs @@ -13,15 +13,15 @@ use serde::{Deserialize, Serialize}; pub mod accounts; pub mod blocks; -pub mod client_version; pub mod integer_list; pub mod sharded_key; pub mod storage_sharded_key; pub use accounts::*; pub use blocks::*; -pub use client_version::ClientVersion; -pub use reth_db_models::{AccountBeforeTx, StoredBlockBodyIndices}; +pub use reth_db_models::{ + AccountBeforeTx, ClientVersion, StoredBlockBodyIndices, StoredBlockWithdrawals, +}; pub use sharded_key::ShardedKey; /// Macro that implements [`Encode`] and [`Decode`] for uint types. diff --git a/crates/storage/db-models/src/blocks.rs b/crates/storage/db-models/src/blocks.rs index c993e58dad6d..72ff433f83de 100644 --- a/crates/storage/db-models/src/blocks.rs +++ b/crates/storage/db-models/src/blocks.rs @@ -1,7 +1,7 @@ use std::ops::Range; use reth_codecs::{add_arbitrary_tests, Compact}; -use reth_primitives::TxNumber; +use reth_primitives::{TxNumber, Withdrawals}; use serde::{Deserialize, Serialize}; /// Total number of transactions. @@ -66,6 +66,15 @@ impl StoredBlockBodyIndices { } } +/// The storage representation of block withdrawals. +#[derive(Debug, Default, Eq, PartialEq, Clone, Serialize, Deserialize, Compact)] +#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] +#[add_arbitrary_tests(compact)] +pub struct StoredBlockWithdrawals { + /// The block withdrawals. + pub withdrawals: Withdrawals, +} + #[cfg(test)] mod tests { use crate::StoredBlockBodyIndices; diff --git a/crates/storage/db-api/src/models/client_version.rs b/crates/storage/db-models/src/client_version.rs similarity index 100% rename from crates/storage/db-api/src/models/client_version.rs rename to crates/storage/db-models/src/client_version.rs diff --git a/crates/storage/db-models/src/lib.rs b/crates/storage/db-models/src/lib.rs index 55a210269caa..b8595362afc3 100644 --- a/crates/storage/db-models/src/lib.rs +++ b/crates/storage/db-models/src/lib.rs @@ -6,4 +6,8 @@ pub use accounts::AccountBeforeTx; /// Blocks pub mod blocks; -pub use blocks::StoredBlockBodyIndices; +pub use blocks::{StoredBlockBodyIndices, StoredBlockWithdrawals}; + +/// Client Version +pub mod client_version; +pub use client_version::ClientVersion; diff --git a/crates/storage/db/src/implementation/mdbx/mod.rs b/crates/storage/db/src/implementation/mdbx/mod.rs index aff1da56d68a..e53fbfbe3ac3 100644 --- a/crates/storage/db/src/implementation/mdbx/mod.rs +++ b/crates/storage/db/src/implementation/mdbx/mod.rs @@ -13,7 +13,7 @@ use reth_db_api::{ cursor::{DbCursorRO, DbCursorRW}, database::Database, database_metrics::{DatabaseMetadata, DatabaseMetadataValue, DatabaseMetrics}, - models::client_version::ClientVersion, + models::ClientVersion, transaction::{DbTx, DbTxMut}, }; use reth_libmdbx::{ diff --git a/crates/storage/db/src/lib.rs b/crates/storage/db/src/lib.rs index c16f2b73c4e9..a9f073d7b546 100644 --- a/crates/storage/db/src/lib.rs +++ b/crates/storage/db/src/lib.rs @@ -36,6 +36,7 @@ pub use utils::is_database_empty; #[cfg(feature = "mdbx")] pub use mdbx::{create_db, init_db, open_db, open_db_read_only, DatabaseEnv, DatabaseEnvKind}; +pub use models::ClientVersion; pub use reth_db_api::*; /// Collection of database test utilities diff --git a/crates/storage/db/src/tables/mod.rs b/crates/storage/db/src/tables/mod.rs index cff4b8009044..090c22e97aad 100644 --- a/crates/storage/db/src/tables/mod.rs +++ b/crates/storage/db/src/tables/mod.rs @@ -23,9 +23,9 @@ use reth_db_api::{ models::{ accounts::BlockNumberAddress, blocks::{HeaderHash, StoredBlockOmmers}, - client_version::ClientVersion, storage_sharded_key::StorageShardedKey, - AccountBeforeTx, CompactU256, ShardedKey, StoredBlockBodyIndices, StoredBlockWithdrawals, + AccountBeforeTx, ClientVersion, CompactU256, ShardedKey, StoredBlockBodyIndices, + StoredBlockWithdrawals, }, table::{Decode, DupSort, Encode, Table}, }; diff --git a/examples/rpc-db/Cargo.toml b/examples/rpc-db/Cargo.toml index 007a488b8174..262b3df8babc 100644 --- a/examples/rpc-db/Cargo.toml +++ b/examples/rpc-db/Cargo.toml @@ -11,7 +11,6 @@ jsonrpsee.workspace = true reth.workspace = true reth-chainspec.workspace = true reth-db.workspace = true -reth-db-api.workspace = true reth-node-ethereum.workspace = true reth-provider = { workspace = true, features = ["test-utils"] } tokio = { workspace = true, features = ["full"] } diff --git a/examples/rpc-db/src/main.rs b/examples/rpc-db/src/main.rs index ccf81acdd05a..7c978cf085d5 100644 --- a/examples/rpc-db/src/main.rs +++ b/examples/rpc-db/src/main.rs @@ -24,8 +24,7 @@ use reth::{ utils::open_db_read_only, }; use reth_chainspec::ChainSpecBuilder; -use reth_db::{mdbx::DatabaseArguments, DatabaseEnv}; -use reth_db_api::models::ClientVersion; +use reth_db::{mdbx::DatabaseArguments, ClientVersion, DatabaseEnv}; // Bringing up the RPC use reth::rpc::builder::{