mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(db): move reth-storage-api::ClientVersion and StoredBlockWithdrawals to reth-db-models (#10763)
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2927,7 +2927,6 @@ dependencies = [
|
|||||||
"reth",
|
"reth",
|
||||||
"reth-chainspec",
|
"reth-chainspec",
|
||||||
"reth-db",
|
"reth-db",
|
||||||
"reth-db-api",
|
|
||||||
"reth-node-ethereum",
|
"reth-node-ethereum",
|
||||||
"reth-provider",
|
"reth-provider",
|
||||||
"tokio",
|
"tokio",
|
||||||
@ -7684,7 +7683,6 @@ dependencies = [
|
|||||||
"reth-config",
|
"reth-config",
|
||||||
"reth-consensus-common",
|
"reth-consensus-common",
|
||||||
"reth-db",
|
"reth-db",
|
||||||
"reth-db-api",
|
|
||||||
"reth-discv4",
|
"reth-discv4",
|
||||||
"reth-discv5",
|
"reth-discv5",
|
||||||
"reth-fs-util",
|
"reth-fs-util",
|
||||||
|
|||||||
@ -18,7 +18,6 @@ reth-cli.workspace = true
|
|||||||
reth-cli-util.workspace = true
|
reth-cli-util.workspace = true
|
||||||
reth-fs-util.workspace = true
|
reth-fs-util.workspace = true
|
||||||
reth-db = { workspace = true, features = ["mdbx"] }
|
reth-db = { workspace = true, features = ["mdbx"] }
|
||||||
reth-db-api.workspace = true
|
|
||||||
reth-storage-errors.workspace = true
|
reth-storage-errors.workspace = true
|
||||||
reth-provider.workspace = true
|
reth-provider.workspace = true
|
||||||
reth-network = { workspace = true, features = ["serde"] }
|
reth-network = { workspace = true, features = ["serde"] }
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
//! Version information for reth.
|
//! Version information for reth.
|
||||||
use reth_db_api::models::ClientVersion;
|
use reth_db::ClientVersion;
|
||||||
use reth_rpc_types::engine::ClientCode;
|
use reth_rpc_types::engine::ClientCode;
|
||||||
|
|
||||||
/// The client code for Reth
|
/// The client code for Reth
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
//! Block related models and types.
|
//! Block related models and types.
|
||||||
|
|
||||||
use reth_codecs::{add_arbitrary_tests, Compact};
|
use reth_codecs::{add_arbitrary_tests, Compact};
|
||||||
use reth_primitives::{Header, Withdrawals, B256};
|
use reth_primitives::{Header, B256};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// The storage representation of a block's ommers.
|
/// The storage representation of a block's ommers.
|
||||||
@ -15,15 +15,6 @@ pub struct StoredBlockOmmers {
|
|||||||
pub ommers: Vec<Header>,
|
pub ommers: Vec<Header>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
/// Hash of the block header.
|
||||||
pub type HeaderHash = B256;
|
pub type HeaderHash = B256;
|
||||||
|
|
||||||
|
|||||||
@ -13,15 +13,15 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
pub mod accounts;
|
pub mod accounts;
|
||||||
pub mod blocks;
|
pub mod blocks;
|
||||||
pub mod client_version;
|
|
||||||
pub mod integer_list;
|
pub mod integer_list;
|
||||||
pub mod sharded_key;
|
pub mod sharded_key;
|
||||||
pub mod storage_sharded_key;
|
pub mod storage_sharded_key;
|
||||||
|
|
||||||
pub use accounts::*;
|
pub use accounts::*;
|
||||||
pub use blocks::*;
|
pub use blocks::*;
|
||||||
pub use client_version::ClientVersion;
|
pub use reth_db_models::{
|
||||||
pub use reth_db_models::{AccountBeforeTx, StoredBlockBodyIndices};
|
AccountBeforeTx, ClientVersion, StoredBlockBodyIndices, StoredBlockWithdrawals,
|
||||||
|
};
|
||||||
pub use sharded_key::ShardedKey;
|
pub use sharded_key::ShardedKey;
|
||||||
|
|
||||||
/// Macro that implements [`Encode`] and [`Decode`] for uint types.
|
/// Macro that implements [`Encode`] and [`Decode`] for uint types.
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
|
||||||
use reth_codecs::{add_arbitrary_tests, Compact};
|
use reth_codecs::{add_arbitrary_tests, Compact};
|
||||||
use reth_primitives::TxNumber;
|
use reth_primitives::{TxNumber, Withdrawals};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Total number of transactions.
|
/// 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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::StoredBlockBodyIndices;
|
use crate::StoredBlockBodyIndices;
|
||||||
|
|||||||
@ -6,4 +6,8 @@ pub use accounts::AccountBeforeTx;
|
|||||||
|
|
||||||
/// Blocks
|
/// Blocks
|
||||||
pub mod blocks;
|
pub mod blocks;
|
||||||
pub use blocks::StoredBlockBodyIndices;
|
pub use blocks::{StoredBlockBodyIndices, StoredBlockWithdrawals};
|
||||||
|
|
||||||
|
/// Client Version
|
||||||
|
pub mod client_version;
|
||||||
|
pub use client_version::ClientVersion;
|
||||||
|
|||||||
@ -13,7 +13,7 @@ use reth_db_api::{
|
|||||||
cursor::{DbCursorRO, DbCursorRW},
|
cursor::{DbCursorRO, DbCursorRW},
|
||||||
database::Database,
|
database::Database,
|
||||||
database_metrics::{DatabaseMetadata, DatabaseMetadataValue, DatabaseMetrics},
|
database_metrics::{DatabaseMetadata, DatabaseMetadataValue, DatabaseMetrics},
|
||||||
models::client_version::ClientVersion,
|
models::ClientVersion,
|
||||||
transaction::{DbTx, DbTxMut},
|
transaction::{DbTx, DbTxMut},
|
||||||
};
|
};
|
||||||
use reth_libmdbx::{
|
use reth_libmdbx::{
|
||||||
|
|||||||
@ -36,6 +36,7 @@ pub use utils::is_database_empty;
|
|||||||
#[cfg(feature = "mdbx")]
|
#[cfg(feature = "mdbx")]
|
||||||
pub use mdbx::{create_db, init_db, open_db, open_db_read_only, DatabaseEnv, DatabaseEnvKind};
|
pub use mdbx::{create_db, init_db, open_db, open_db_read_only, DatabaseEnv, DatabaseEnvKind};
|
||||||
|
|
||||||
|
pub use models::ClientVersion;
|
||||||
pub use reth_db_api::*;
|
pub use reth_db_api::*;
|
||||||
|
|
||||||
/// Collection of database test utilities
|
/// Collection of database test utilities
|
||||||
|
|||||||
@ -23,9 +23,9 @@ use reth_db_api::{
|
|||||||
models::{
|
models::{
|
||||||
accounts::BlockNumberAddress,
|
accounts::BlockNumberAddress,
|
||||||
blocks::{HeaderHash, StoredBlockOmmers},
|
blocks::{HeaderHash, StoredBlockOmmers},
|
||||||
client_version::ClientVersion,
|
|
||||||
storage_sharded_key::StorageShardedKey,
|
storage_sharded_key::StorageShardedKey,
|
||||||
AccountBeforeTx, CompactU256, ShardedKey, StoredBlockBodyIndices, StoredBlockWithdrawals,
|
AccountBeforeTx, ClientVersion, CompactU256, ShardedKey, StoredBlockBodyIndices,
|
||||||
|
StoredBlockWithdrawals,
|
||||||
},
|
},
|
||||||
table::{Decode, DupSort, Encode, Table},
|
table::{Decode, DupSort, Encode, Table},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -11,7 +11,6 @@ jsonrpsee.workspace = true
|
|||||||
reth.workspace = true
|
reth.workspace = true
|
||||||
reth-chainspec.workspace = true
|
reth-chainspec.workspace = true
|
||||||
reth-db.workspace = true
|
reth-db.workspace = true
|
||||||
reth-db-api.workspace = true
|
|
||||||
reth-node-ethereum.workspace = true
|
reth-node-ethereum.workspace = true
|
||||||
reth-provider = { workspace = true, features = ["test-utils"] }
|
reth-provider = { workspace = true, features = ["test-utils"] }
|
||||||
tokio = { workspace = true, features = ["full"] }
|
tokio = { workspace = true, features = ["full"] }
|
||||||
|
|||||||
@ -24,8 +24,7 @@ use reth::{
|
|||||||
utils::open_db_read_only,
|
utils::open_db_read_only,
|
||||||
};
|
};
|
||||||
use reth_chainspec::ChainSpecBuilder;
|
use reth_chainspec::ChainSpecBuilder;
|
||||||
use reth_db::{mdbx::DatabaseArguments, DatabaseEnv};
|
use reth_db::{mdbx::DatabaseArguments, ClientVersion, DatabaseEnv};
|
||||||
use reth_db_api::models::ClientVersion;
|
|
||||||
|
|
||||||
// Bringing up the RPC
|
// Bringing up the RPC
|
||||||
use reth::rpc::builder::{
|
use reth::rpc::builder::{
|
||||||
|
|||||||
Reference in New Issue
Block a user