mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(db): move mod tables to db-api (#14540)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -18,7 +18,7 @@ reth-db-models = { workspace = true, features = ["reth-codec"] }
|
||||
reth-primitives = { workspace = true, features = ["reth-codec"] }
|
||||
reth-primitives-traits = { workspace = true, features = ["serde", "reth-codec"] }
|
||||
reth-stages-types = { workspace = true, features = ["serde", "reth-codec"] }
|
||||
reth-prune-types = { workspace = true, features = ["reth-codec"] }
|
||||
reth-prune-types = { workspace = true, features = ["serde", "reth-codec"] }
|
||||
reth-storage-errors.workspace = true
|
||||
reth-trie-common.workspace = true
|
||||
|
||||
@ -96,3 +96,4 @@ op = [
|
||||
"reth-codecs/op",
|
||||
"reth-primitives-traits/op",
|
||||
]
|
||||
bench = []
|
||||
|
||||
@ -61,17 +61,27 @@
|
||||
|
||||
/// Common types used throughout the abstraction.
|
||||
pub mod common;
|
||||
|
||||
/// Cursor database traits.
|
||||
pub mod cursor;
|
||||
|
||||
/// Database traits.
|
||||
pub mod database;
|
||||
|
||||
/// Database metrics trait extensions.
|
||||
pub mod database_metrics;
|
||||
|
||||
pub mod mock;
|
||||
|
||||
/// Table traits
|
||||
pub mod table;
|
||||
|
||||
pub mod tables;
|
||||
pub use tables::*;
|
||||
|
||||
/// Transaction database traits.
|
||||
pub mod transaction;
|
||||
|
||||
/// Re-exports
|
||||
pub use reth_storage_errors::db::{DatabaseError, DatabaseWriteOperation};
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
//! Curates the input coming from the fuzzer for certain types.
|
||||
|
||||
use reth_db_api::models::IntegerList;
|
||||
use crate::models::IntegerList;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Makes sure that the list provided by the fuzzer is not empty and pre-sorted
|
||||
@ -14,7 +14,7 @@ macro_rules! impl_fuzzer_with_input {
|
||||
#[allow(non_snake_case)]
|
||||
#[cfg(any(test, feature = "bench"))]
|
||||
pub mod $name {
|
||||
use reth_db_api::table;
|
||||
use crate::table;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use reth_primitives_traits::*;
|
||||
@ -23,7 +23,7 @@ macro_rules! impl_fuzzer_with_input {
|
||||
use super::inputs::*;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use reth_db_api::models::*;
|
||||
use crate::models::*;
|
||||
|
||||
/// Encodes and decodes table types returning its encoded size and the decoded object.
|
||||
/// This method is used for benchmarking, so its parameter should be the actual type that is being tested.
|
||||
@ -5,7 +5,7 @@
|
||||
//! This module defines the tables in reth, as well as some table-related abstractions:
|
||||
//!
|
||||
//! - [`codecs`] integrates different codecs into [`Encode`] and [`Decode`]
|
||||
//! - [`models`](reth_db_api::models) defines the values written to tables
|
||||
//! - [`models`](crate::models) defines the values written to tables
|
||||
//!
|
||||
//! # Database Tour
|
||||
//!
|
||||
@ -16,12 +16,7 @@ pub mod codecs;
|
||||
mod raw;
|
||||
pub use raw::{RawDupSort, RawKey, RawTable, RawValue, TableRawRow};
|
||||
|
||||
#[cfg(feature = "mdbx")]
|
||||
pub(crate) mod utils;
|
||||
|
||||
use alloy_consensus::Header;
|
||||
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256};
|
||||
use reth_db_api::{
|
||||
use crate::{
|
||||
models::{
|
||||
accounts::BlockNumberAddress,
|
||||
blocks::{HeaderHash, StoredBlockOmmers},
|
||||
@ -31,6 +26,8 @@ use reth_db_api::{
|
||||
},
|
||||
table::{Decode, DupSort, Encode, Table, TableInfo},
|
||||
};
|
||||
use alloy_consensus::Header;
|
||||
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256};
|
||||
use reth_primitives::{Receipt, StorageEntry, TransactionSigned};
|
||||
use reth_primitives_traits::{Account, Bytecode};
|
||||
use reth_prune_types::{PruneCheckpoint, PruneSegment};
|
||||
@ -54,8 +51,10 @@ pub enum TableType {
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use reth_db::{TableViewer, Tables};
|
||||
/// use reth_db_api::table::{DupSort, Table};
|
||||
/// use reth_db_api::{
|
||||
/// table::{DupSort, Table},
|
||||
/// TableViewer, Tables,
|
||||
/// };
|
||||
///
|
||||
/// struct MyTableViewer;
|
||||
///
|
||||
@ -143,9 +142,9 @@ macro_rules! tables {
|
||||
}
|
||||
}
|
||||
|
||||
impl$(<$($generic),*>)? reth_db_api::table::Table for $name$(<$($generic),*>)?
|
||||
impl$(<$($generic),*>)? $crate::table::Table for $name$(<$($generic),*>)?
|
||||
where
|
||||
$value: reth_db_api::table::Value + 'static
|
||||
$value: $crate::table::Value + 'static
|
||||
$($(,$generic: Send + Sync)*)?
|
||||
{
|
||||
const NAME: &'static str = table_names::$name;
|
||||
@ -163,9 +162,6 @@ macro_rules! tables {
|
||||
)*
|
||||
|
||||
// Tables enum.
|
||||
// NOTE: the ordering of the enum does not matter, but it is assumed that the discriminants
|
||||
// start at 0 and increment by 1 for each variant (the default behavior).
|
||||
// See for example `reth_db::implementation::mdbx::tx::Tx::db_handles`.
|
||||
|
||||
/// A table in the database.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
@ -281,8 +277,7 @@ macro_rules! tables {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use reth_db::{Tables, tables_to_generic};
|
||||
/// use reth_db_api::table::Table;
|
||||
/// use reth_db_api::{table::Table, Tables, tables_to_generic};
|
||||
///
|
||||
/// let table = Tables::Headers;
|
||||
/// let result = tables_to_generic!(table, |GenericTable| <GenericTable as Table>::NAME);
|
||||
@ -553,11 +548,11 @@ impl Encode for ChainStateKey {
|
||||
}
|
||||
|
||||
impl Decode for ChainStateKey {
|
||||
fn decode(value: &[u8]) -> Result<Self, reth_db_api::DatabaseError> {
|
||||
fn decode(value: &[u8]) -> Result<Self, crate::DatabaseError> {
|
||||
match value {
|
||||
[0] => Ok(Self::LastFinalizedBlock),
|
||||
[1] => Ok(Self::LastSafeBlockBlock),
|
||||
_ => Err(reth_db_api::DatabaseError::Decode),
|
||||
_ => Err(crate::DatabaseError::Decode),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
use crate::DatabaseError;
|
||||
use reth_db_api::table::{Compress, Decode, Decompress, DupSort, Encode, Key, Table, Value};
|
||||
use crate::{
|
||||
table::{Compress, Decode, Decompress, DupSort, Encode, Key, Table, Value},
|
||||
DatabaseError,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Tuple with `RawKey<T::Key>` and `RawValue<T::Value>`.
|
||||
@ -11,7 +11,6 @@ repository.workspace = true
|
||||
# reth
|
||||
reth-chainspec.workspace = true
|
||||
reth-primitives.workspace = true
|
||||
reth-db = { workspace = true, features = ["mdbx"] }
|
||||
reth-db-api.workspace = true
|
||||
reth-provider.workspace = true
|
||||
reth-config.workspace = true
|
||||
@ -41,6 +40,7 @@ serde_json.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
reth-db = { workspace = true, features = ["mdbx"] }
|
||||
reth-primitives-traits.workspace = true
|
||||
reth-provider = { workspace = true, features = ["test-utils"] }
|
||||
alloy-consensus.workspace = true
|
||||
|
||||
@ -2,13 +2,12 @@
|
||||
|
||||
use boyer_moore_magiclen::BMByte;
|
||||
use eyre::Result;
|
||||
use reth_db::{RawTable, TableRawRow};
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbDupCursorRO},
|
||||
database::Database,
|
||||
table::{Decode, Decompress, DupSort, Table, TableRow},
|
||||
transaction::{DbTx, DbTxMut},
|
||||
DatabaseError,
|
||||
DatabaseError, RawTable, TableRawRow,
|
||||
};
|
||||
use reth_fs_util as fs;
|
||||
use reth_node_types::NodeTypesWithDB;
|
||||
|
||||
@ -6,8 +6,7 @@ use alloy_primitives::{map::HashMap, Address, B256, U256};
|
||||
use reth_chainspec::EthChainSpec;
|
||||
use reth_codecs::Compact;
|
||||
use reth_config::config::EtlConfig;
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{transaction::DbTxMut, DatabaseError};
|
||||
use reth_db_api::{tables, transaction::DbTxMut, DatabaseError};
|
||||
use reth_etl::Collector;
|
||||
use reth_primitives::{
|
||||
Account, Bytecode, GotExpected, NodePrimitives, StaticFileSegment, StorageEntry,
|
||||
|
||||
@ -15,32 +15,23 @@ workspace = true
|
||||
# reth
|
||||
reth-db-api.workspace = true
|
||||
reth-primitives = { workspace = true, features = ["reth-codec"] }
|
||||
reth-primitives-traits = { workspace = true, features = ["reth-codec"] }
|
||||
reth-fs-util.workspace = true
|
||||
reth-storage-errors.workspace = true
|
||||
reth-nippy-jar.workspace = true
|
||||
reth-prune-types = { workspace = true, features = ["reth-codec", "serde"] }
|
||||
reth-stages-types.workspace = true
|
||||
reth-trie-common = { workspace = true, features = ["serde"] }
|
||||
reth-tracing.workspace = true
|
||||
|
||||
# ethereum
|
||||
alloy-primitives.workspace = true
|
||||
alloy-consensus.workspace = true
|
||||
|
||||
# mdbx
|
||||
reth-libmdbx = { workspace = true, optional = true, features = ["return-borrowed", "read-tx-timeouts"] }
|
||||
eyre = { workspace = true, optional = true }
|
||||
|
||||
# codecs
|
||||
serde = { workspace = true, default-features = false }
|
||||
|
||||
# metrics
|
||||
reth-metrics = { workspace = true, optional = true }
|
||||
metrics = { workspace = true, optional = true }
|
||||
|
||||
# misc
|
||||
bytes.workspace = true
|
||||
page_size = { version = "0.6.0", optional = true }
|
||||
thiserror.workspace = true
|
||||
tempfile = { workspace = true, optional = true }
|
||||
@ -55,11 +46,13 @@ strum = { workspace = true, features = ["derive"], optional = true }
|
||||
[dev-dependencies]
|
||||
# reth libs with arbitrary
|
||||
reth-primitives = { workspace = true, features = ["arbitrary"] }
|
||||
reth-primitives-traits = { workspace = true, features = ["reth-codec"] }
|
||||
serde_json.workspace = true
|
||||
tempfile.workspace = true
|
||||
test-fuzz.workspace = true
|
||||
parking_lot.workspace = true
|
||||
|
||||
alloy-consensus.workspace = true
|
||||
serde.workspace = true
|
||||
pprof = { workspace = true, features = ["flamegraph", "frame-pointer", "criterion"] }
|
||||
criterion.workspace = true
|
||||
|
||||
@ -85,23 +78,17 @@ test-utils = [
|
||||
"arbitrary",
|
||||
"parking_lot",
|
||||
"reth-primitives/test-utils",
|
||||
"reth-primitives-traits/test-utils",
|
||||
"reth-db-api/test-utils",
|
||||
"reth-nippy-jar/test-utils",
|
||||
"reth-trie-common/test-utils",
|
||||
"reth-prune-types/test-utils",
|
||||
"reth-stages-types/test-utils",
|
||||
"reth-primitives-traits/test-utils",
|
||||
]
|
||||
bench = []
|
||||
bench = ["reth-db-api/bench"]
|
||||
arbitrary = [
|
||||
"reth-primitives/arbitrary",
|
||||
"reth-db-api/arbitrary",
|
||||
"reth-primitives-traits/arbitrary",
|
||||
"reth-trie-common/arbitrary",
|
||||
"alloy-primitives/arbitrary",
|
||||
"reth-prune-types/arbitrary",
|
||||
"reth-stages-types/arbitrary",
|
||||
"alloy-consensus/arbitrary",
|
||||
"reth-primitives-traits/arbitrary",
|
||||
]
|
||||
optimism = ["reth-db-api/optimism"]
|
||||
op = [
|
||||
|
||||
@ -6,11 +6,12 @@ use criterion::{
|
||||
criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion,
|
||||
};
|
||||
use pprof::criterion::{Output, PProfProfiler};
|
||||
use reth_db::{tables::*, test_utils::create_test_rw_db_with_path};
|
||||
use reth_db::test_utils::create_test_rw_db_with_path;
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO, DbDupCursorRW},
|
||||
database::Database,
|
||||
table::{Compress, Decode, Decompress, DupSort, Encode, Table},
|
||||
tables::*,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
};
|
||||
use reth_fs_util as fs;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
//! Cursor wrapper for libmdbx-sys.
|
||||
|
||||
use super::utils::*;
|
||||
use crate::{
|
||||
metrics::{DatabaseEnvMetrics, Operation},
|
||||
tables::utils::*,
|
||||
DatabaseError,
|
||||
};
|
||||
use reth_db_api::{
|
||||
|
||||
@ -33,6 +33,8 @@ use tx::Tx;
|
||||
pub mod cursor;
|
||||
pub mod tx;
|
||||
|
||||
mod utils;
|
||||
|
||||
/// 1 KB in bytes
|
||||
pub const KILOBYTE: usize = 1024;
|
||||
/// 1 MB in bytes
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
//! Transaction wrapper for libmdbx-sys.
|
||||
|
||||
use super::cursor::Cursor;
|
||||
use super::{cursor::Cursor, utils::*};
|
||||
use crate::{
|
||||
metrics::{DatabaseEnvMetrics, Operation, TransactionMode, TransactionOutcome},
|
||||
tables::utils::decode_one,
|
||||
DatabaseError,
|
||||
};
|
||||
use reth_db_api::{
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
//! Small database table utilities and helper functions.
|
||||
|
||||
use crate::DatabaseError;
|
||||
use reth_db_api::table::{Decode, Decompress, Table, TableRow};
|
||||
use crate::{
|
||||
table::{Decode, Decompress, Table, TableRow},
|
||||
DatabaseError,
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
|
||||
/// Helper function to decode a `(key, value)` pair.
|
||||
@ -20,7 +20,6 @@ pub mod lockfile;
|
||||
#[cfg(feature = "mdbx")]
|
||||
mod metrics;
|
||||
pub mod static_file;
|
||||
pub mod tables;
|
||||
#[cfg(feature = "mdbx")]
|
||||
mod utils;
|
||||
pub mod version;
|
||||
@ -29,7 +28,6 @@ pub mod version;
|
||||
pub mod mdbx;
|
||||
|
||||
pub use reth_storage_errors::db::{DatabaseError, DatabaseWriteOperation};
|
||||
pub use tables::*;
|
||||
#[cfg(feature = "mdbx")]
|
||||
pub use utils::is_database_empty;
|
||||
|
||||
|
||||
@ -21,8 +21,11 @@ use reth_chain_state::{
|
||||
MemoryOverlayStateProvider,
|
||||
};
|
||||
use reth_chainspec::{ChainInfo, EthereumHardforks};
|
||||
use reth_db::{models::BlockNumberAddress, transaction::DbTx, Database};
|
||||
use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
|
||||
use reth_db_api::{
|
||||
models::{AccountBeforeTx, BlockNumberAddress, StoredBlockBodyIndices},
|
||||
transaction::DbTx,
|
||||
Database,
|
||||
};
|
||||
use reth_evm::{ConfigureEvmEnv, EvmEnv};
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
use reth_node_types::{BlockTy, HeaderTy, NodeTypesWithDB, ReceiptTy, TxTy};
|
||||
@ -789,11 +792,12 @@ mod tests {
|
||||
use reth_chainspec::{
|
||||
ChainSpec, ChainSpecBuilder, ChainSpecProvider, EthereumHardfork, MAINNET,
|
||||
};
|
||||
use reth_db::{
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO,
|
||||
models::{AccountBeforeTx, StoredBlockBodyIndices},
|
||||
tables,
|
||||
transaction::DbTx,
|
||||
};
|
||||
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
|
||||
use reth_errors::ProviderError;
|
||||
use reth_execution_types::{Chain, ExecutionOutcome};
|
||||
use reth_primitives::{EthPrimitives, Receipt, RecoveredBlock, SealedBlock, StaticFileSegment};
|
||||
|
||||
@ -17,8 +17,7 @@ use alloy_primitives::{
|
||||
};
|
||||
use reth_chain_state::{BlockState, CanonicalInMemoryState, MemoryOverlayStateProviderRef};
|
||||
use reth_chainspec::{ChainInfo, EthereumHardforks};
|
||||
use reth_db::models::BlockNumberAddress;
|
||||
use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
|
||||
use reth_db_api::models::{AccountBeforeTx, BlockNumberAddress, StoredBlockBodyIndices};
|
||||
use reth_execution_types::{BundleStateInit, ExecutionOutcome, RevertsInit};
|
||||
use reth_node_types::{BlockTy, HeaderTy, ReceiptTy, TxTy};
|
||||
use reth_primitives::{Account, RecoveredBlock, SealedBlock, SealedHeader, StorageEntry};
|
||||
@ -1485,7 +1484,7 @@ mod tests {
|
||||
use itertools::Itertools;
|
||||
use rand::Rng;
|
||||
use reth_chain_state::{ExecutedBlock, ExecutedBlockWithTrieUpdates, NewCanonicalChain};
|
||||
use reth_db::models::AccountBeforeTx;
|
||||
use reth_db_api::models::AccountBeforeTx;
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
use reth_primitives::{RecoveredBlock, SealedBlock};
|
||||
use reth_storage_api::{BlockReader, BlockSource, ChangeSetReader};
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use crate::{providers::NodeTypesForProvider, DatabaseProvider};
|
||||
use reth_db::transaction::{DbTx, DbTxMut};
|
||||
use reth_db_api::transaction::{DbTx, DbTxMut};
|
||||
use reth_node_types::{FullNodePrimitives, FullSignedTx};
|
||||
use reth_primitives_traits::FullBlockHeader;
|
||||
use reth_storage_api::{ChainStorageReader, ChainStorageWriter, EthStorage};
|
||||
|
||||
@ -669,9 +669,9 @@ mod tests {
|
||||
use reth_chainspec::ChainSpecBuilder;
|
||||
use reth_db::{
|
||||
mdbx::DatabaseArguments,
|
||||
tables,
|
||||
test_utils::{create_test_static_files_dir, ERROR_TEMPDIR},
|
||||
};
|
||||
use reth_db_api::tables;
|
||||
use reth_primitives::StaticFileSegment;
|
||||
use reth_primitives_traits::SignedTransaction;
|
||||
use reth_prune_types::{PruneMode, PruneModes};
|
||||
|
||||
@ -29,19 +29,17 @@ use alloy_primitives::{
|
||||
use itertools::Itertools;
|
||||
use rayon::slice::ParallelSliceMut;
|
||||
use reth_chainspec::{ChainInfo, ChainSpecProvider, EthChainSpec, EthereumHardforks};
|
||||
use reth_db::{
|
||||
cursor::DbDupCursorRW, tables, BlockNumberList, PlainAccountState, PlainStorageState,
|
||||
};
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO},
|
||||
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO, DbDupCursorRW},
|
||||
database::Database,
|
||||
models::{
|
||||
sharded_key, storage_sharded_key::StorageShardedKey, AccountBeforeTx, BlockNumberAddress,
|
||||
ShardedKey, StoredBlockBodyIndices,
|
||||
},
|
||||
table::Table,
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
DatabaseError,
|
||||
BlockNumberList, DatabaseError, PlainAccountState, PlainStorageState,
|
||||
};
|
||||
use reth_execution_types::{Chain, ExecutionOutcome};
|
||||
use reth_network_p2p::headers::downloader::SyncTarget;
|
||||
@ -316,7 +314,7 @@ impl<TX: DbTx + DbTxMut + 'static, N: NodeTypesForProvider> DatabaseProvider<TX,
|
||||
let (new_state_root, trie_updates) = StateRoot::from_tx(&self.tx)
|
||||
.with_prefix_sets(prefix_sets)
|
||||
.root_with_updates()
|
||||
.map_err(reth_db::DatabaseError::from)?;
|
||||
.map_err(reth_db_api::DatabaseError::from)?;
|
||||
|
||||
let parent_number = range.start().saturating_sub(1);
|
||||
let parent_state_root = self
|
||||
@ -2590,7 +2588,7 @@ impl<TX: DbTxMut + DbTx + 'static, N: NodeTypes> HashingWriter for DatabaseProvi
|
||||
let (state_root, trie_updates) = StateRoot::from_tx(&self.tx)
|
||||
.with_prefix_sets(prefix_sets)
|
||||
.root_with_updates()
|
||||
.map_err(reth_db::DatabaseError::from)?;
|
||||
.map_err(reth_db_api::DatabaseError::from)?;
|
||||
if state_root != expected_state_root {
|
||||
return Err(ProviderError::StateRootMismatch(Box::new(RootMismatch {
|
||||
root: GotExpected { got: state_root, expected: expected_state_root },
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
//! Contains the main provider types and traits for interacting with the blockchain's storage.
|
||||
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_db::table::Value;
|
||||
use reth_db_api::table::Value;
|
||||
use reth_node_types::{FullNodePrimitives, NodeTypes, NodeTypesWithDB, NodeTypesWithEngine};
|
||||
|
||||
mod database;
|
||||
|
||||
@ -4,12 +4,13 @@ use crate::{
|
||||
};
|
||||
use alloy_eips::merge::EPOCH_SLOTS;
|
||||
use alloy_primitives::{map::B256Map, Address, BlockNumber, Bytes, StorageKey, StorageValue, B256};
|
||||
use reth_db::{tables, BlockNumberList};
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbDupCursorRO},
|
||||
models::{storage_sharded_key::StorageShardedKey, ShardedKey},
|
||||
table::Table,
|
||||
tables,
|
||||
transaction::DbTx,
|
||||
BlockNumberList,
|
||||
};
|
||||
use reth_primitives::{Account, Bytecode};
|
||||
use reth_storage_api::{
|
||||
@ -541,10 +542,11 @@ mod tests {
|
||||
AccountReader, HistoricalStateProvider, HistoricalStateProviderRef, StateProvider,
|
||||
};
|
||||
use alloy_primitives::{address, b256, Address, B256, U256};
|
||||
use reth_db::{tables, BlockNumberList};
|
||||
use reth_db_api::{
|
||||
models::{storage_sharded_key::StorageShardedKey, AccountBeforeTx, ShardedKey},
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
BlockNumberList,
|
||||
};
|
||||
use reth_primitives::{Account, StorageEntry};
|
||||
use reth_storage_api::{
|
||||
|
||||
@ -3,8 +3,7 @@ use crate::{
|
||||
HashedPostStateProvider, StateProvider, StateRootProvider,
|
||||
};
|
||||
use alloy_primitives::{map::B256Map, Address, BlockNumber, Bytes, StorageKey, StorageValue, B256};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{cursor::DbDupCursorRO, transaction::DbTx};
|
||||
use reth_db_api::{cursor::DbDupCursorRO, tables, transaction::DbTx};
|
||||
use reth_primitives::{Account, Bytecode};
|
||||
use reth_storage_api::{
|
||||
DBProvider, StateCommitmentProvider, StateProofProvider, StorageRootProvider,
|
||||
|
||||
@ -10,12 +10,12 @@ use alloy_consensus::transaction::TransactionMeta;
|
||||
use alloy_eips::{eip2718::Encodable2718, eip4895::Withdrawals, BlockHashOrNumber};
|
||||
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
|
||||
use reth_chainspec::ChainInfo;
|
||||
use reth_db::{
|
||||
use reth_db::static_file::{
|
||||
BlockHashMask, BodyIndicesMask, HeaderMask, HeaderWithHashMask, OmmersMask, ReceiptMask,
|
||||
StaticFileCursor, TDWithHashMask, TotalDifficultyMask, TransactionMask, WithdrawalsMask,
|
||||
};
|
||||
use reth_db_api::{
|
||||
models::StoredBlockBodyIndices,
|
||||
static_file::{
|
||||
BlockHashMask, BodyIndicesMask, HeaderMask, HeaderWithHashMask, OmmersMask, ReceiptMask,
|
||||
StaticFileCursor, TDWithHashMask, TotalDifficultyMask, TransactionMask, WithdrawalsMask,
|
||||
},
|
||||
table::{Decompress, Value},
|
||||
};
|
||||
use reth_node_types::{FullNodePrimitives, NodePrimitives};
|
||||
|
||||
@ -22,11 +22,13 @@ use reth_db::{
|
||||
iter_static_files, BlockHashMask, BodyIndicesMask, HeaderMask, HeaderWithHashMask,
|
||||
ReceiptMask, StaticFileCursor, TDWithHashMask, TransactionMask,
|
||||
},
|
||||
table::{Decompress, Value},
|
||||
tables,
|
||||
};
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO, models::StoredBlockBodyIndices, table::Table, transaction::DbTx,
|
||||
cursor::DbCursorRO,
|
||||
models::StoredBlockBodyIndices,
|
||||
table::{Decompress, Table, Value},
|
||||
tables,
|
||||
transaction::DbTx,
|
||||
};
|
||||
use reth_nippy_jar::{NippyJar, NippyJarChecker, CONFIG_FILE_EXTENSION};
|
||||
use reth_node_types::{FullNodePrimitives, NodePrimitives};
|
||||
|
||||
@ -61,11 +61,10 @@ mod tests {
|
||||
use alloy_consensus::{Header, Transaction};
|
||||
use alloy_primitives::{BlockHash, TxNumber, B256, U256};
|
||||
use rand::seq::SliceRandom;
|
||||
use reth_db::{
|
||||
test_utils::create_test_static_files_dir, CanonicalHeaders, HeaderNumbers,
|
||||
HeaderTerminalDifficulties, Headers,
|
||||
use reth_db::test_utils::create_test_static_files_dir;
|
||||
use reth_db_api::{
|
||||
transaction::DbTxMut, CanonicalHeaders, HeaderNumbers, HeaderTerminalDifficulties, Headers,
|
||||
};
|
||||
use reth_db_api::transaction::DbTxMut;
|
||||
use reth_primitives::{
|
||||
static_file::{find_fixed_range, SegmentRangeInclusive, DEFAULT_BLOCKS_PER_STATIC_FILE},
|
||||
EthPrimitives, Receipt, TransactionSigned,
|
||||
|
||||
@ -6,8 +6,9 @@ use alloy_consensus::BlockHeader;
|
||||
use alloy_primitives::{BlockHash, BlockNumber, TxNumber, U256};
|
||||
use parking_lot::{lock_api::RwLockWriteGuard, RawRwLock, RwLock};
|
||||
use reth_codecs::Compact;
|
||||
use reth_db::models::{StoredBlockBodyIndices, StoredBlockOmmers, StoredBlockWithdrawals};
|
||||
use reth_db_api::models::CompactU256;
|
||||
use reth_db_api::models::{
|
||||
CompactU256, StoredBlockBodyIndices, StoredBlockOmmers, StoredBlockWithdrawals,
|
||||
};
|
||||
use reth_nippy_jar::{NippyJar, NippyJarError, NippyJarWriter};
|
||||
use reth_node_types::NodePrimitives;
|
||||
use reth_primitives::{
|
||||
|
||||
@ -8,8 +8,7 @@ use alloy_primitives::{
|
||||
use alloy_consensus::Header;
|
||||
use alloy_eips::eip4895::{Withdrawal, Withdrawals};
|
||||
use alloy_primitives::PrimitiveSignature as Signature;
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{database::Database, models::StoredBlockBodyIndices};
|
||||
use reth_db_api::{database::Database, models::StoredBlockBodyIndices, tables};
|
||||
use reth_node_types::NodeTypes;
|
||||
use reth_primitives::{
|
||||
Account, BlockBody, Receipt, RecoveredBlock, SealedBlock, SealedHeader, Transaction,
|
||||
|
||||
@ -16,8 +16,10 @@ use alloy_primitives::{
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
use reth_chainspec::{ChainInfo, EthChainSpec};
|
||||
use reth_db::mock::{DatabaseMock, TxMock};
|
||||
use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
|
||||
use reth_db_api::{
|
||||
mock::{DatabaseMock, TxMock},
|
||||
models::{AccountBeforeTx, StoredBlockBodyIndices},
|
||||
};
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
use reth_node_types::NodeTypes;
|
||||
use reth_primitives::{
|
||||
|
||||
@ -5,7 +5,7 @@ use crate::{
|
||||
};
|
||||
use alloy_consensus::BlockHeader;
|
||||
use reth_chain_state::{ExecutedBlock, ExecutedBlockWithTrieUpdates};
|
||||
use reth_db::transaction::{DbTx, DbTxMut};
|
||||
use reth_db_api::transaction::{DbTx, DbTxMut};
|
||||
use reth_errors::ProviderResult;
|
||||
use reth_primitives::{NodePrimitives, StaticFileSegment};
|
||||
use reth_primitives_traits::SignedTransaction;
|
||||
@ -228,10 +228,10 @@ mod tests {
|
||||
test_utils::create_test_provider_factory, AccountReader, StorageTrieWriter, TrieWriter,
|
||||
};
|
||||
use alloy_primitives::{keccak256, map::HashMap, Address, B256, U256};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO},
|
||||
models::{AccountBeforeTx, BlockNumberAddress},
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
};
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
|
||||
@ -22,7 +22,6 @@ reth-stages-types.workspace = true
|
||||
reth-storage-errors.workspace = true
|
||||
reth-trie.workspace = true
|
||||
reth-trie-db.workspace = true
|
||||
reth-db.workspace = true
|
||||
revm-database.workspace = true
|
||||
reth-ethereum-primitives.workspace = true
|
||||
|
||||
|
||||
@ -4,10 +4,10 @@ use alloy_consensus::Header;
|
||||
use alloy_primitives::BlockNumber;
|
||||
use core::marker::PhantomData;
|
||||
use reth_chainspec::{ChainSpecProvider, EthereumHardforks};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW},
|
||||
models::{StoredBlockOmmers, StoredBlockWithdrawals},
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
DbTxUnwindExt,
|
||||
};
|
||||
|
||||
@ -29,7 +29,7 @@ pub trait HashingWriter: Send + Sync {
|
||||
range: impl RangeBounds<BlockNumber>,
|
||||
) -> ProviderResult<BTreeMap<B256, Option<Account>>>;
|
||||
|
||||
/// Inserts all accounts into the `AccountsHistory` table.
|
||||
/// Inserts all accounts into [`AccountsHistory`][reth_db_api::tables::AccountsHistory] table.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user