chore(db): move mod tables to db-api (#14540)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
DaniPopes
2025-02-17 21:53:39 +01:00
committed by GitHub
parent 336c3d1fac
commit 482f4557eb
106 changed files with 269 additions and 274 deletions

8
Cargo.lock generated
View File

@@ -7006,7 +7006,6 @@ dependencies = [
"alloy-primitives", "alloy-primitives",
"arbitrary", "arbitrary",
"assert_matches", "assert_matches",
"bytes",
"codspeed-criterion-compat", "codspeed-criterion-compat",
"derive_more", "derive_more",
"eyre", "eyre",
@@ -7022,18 +7021,14 @@ dependencies = [
"reth-nippy-jar", "reth-nippy-jar",
"reth-primitives", "reth-primitives",
"reth-primitives-traits", "reth-primitives-traits",
"reth-prune-types",
"reth-stages-types",
"reth-storage-errors", "reth-storage-errors",
"reth-tracing", "reth-tracing",
"reth-trie-common",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
"serde", "serde",
"serde_json", "serde_json",
"strum", "strum",
"sysinfo", "sysinfo",
"tempfile", "tempfile",
"test-fuzz",
"thiserror 2.0.11", "thiserror 2.0.11",
] ]
@@ -9543,7 +9538,6 @@ dependencies = [
"alloy-rpc-types-engine", "alloy-rpc-types-engine",
"auto_impl", "auto_impl",
"reth-chainspec", "reth-chainspec",
"reth-db",
"reth-db-api", "reth-db-api",
"reth-ethereum-primitives", "reth-ethereum-primitives",
"reth-execution-types", "reth-execution-types",
@@ -9778,11 +9772,11 @@ dependencies = [
"proptest-arbitrary-interop", "proptest-arbitrary-interop",
"rand 0.8.5", "rand 0.8.5",
"rayon", "rayon",
"reth-db",
"reth-execution-errors", "reth-execution-errors",
"reth-metrics", "reth-metrics",
"reth-primitives", "reth-primitives",
"reth-provider", "reth-provider",
"reth-storage-errors",
"reth-trie", "reth-trie",
"reth-trie-common", "reth-trie-common",
"reth-trie-db", "reth-trie-db",

View File

@@ -11,8 +11,7 @@ use reth_cli_runner::CliContext;
use reth_cli_util::get_secret_key; use reth_cli_util::get_secret_key;
use reth_config::Config; use reth_config::Config;
use reth_consensus::{Consensus, ConsensusError}; use reth_consensus::{Consensus, ConsensusError};
use reth_db::tables; use reth_db_api::{cursor::DbCursorRO, tables, transaction::DbTx};
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
use reth_ethereum_primitives::EthPrimitives; use reth_ethereum_primitives::EthPrimitives;
use reth_evm::execute::{BlockExecutorProvider, Executor}; use reth_evm::execute::{BlockExecutorProvider, Executor};
use reth_network::{BlockDownloaderProvider, NetworkHandle}; use reth_network::{BlockDownloaderProvider, NetworkHandle};

View File

@@ -5,8 +5,11 @@ use crate::{
use ahash::RandomState; use ahash::RandomState;
use clap::Parser; use clap::Parser;
use reth_chainspec::EthereumHardforks; use reth_chainspec::EthereumHardforks;
use reth_db::{DatabaseEnv, RawKey, RawTable, RawValue, TableViewer, Tables}; use reth_db::DatabaseEnv;
use reth_db_api::{cursor::DbCursorRO, table::Table, transaction::DbTx}; use reth_db_api::{
cursor::DbCursorRO, table::Table, transaction::DbTx, RawKey, RawTable, RawValue, TableViewer,
Tables,
};
use reth_db_common::DbTool; use reth_db_common::DbTool;
use reth_node_builder::{NodeTypesWithDB, NodeTypesWithDBAdapter}; use reth_node_builder::{NodeTypesWithDB, NodeTypesWithDBAdapter};
use reth_provider::{providers::ProviderNodeTypes, DBProvider}; use reth_provider::{providers::ProviderNodeTypes, DBProvider};

View File

@@ -1,9 +1,10 @@
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use reth_db::{static_file::iter_static_files, TableViewer, Tables}; use reth_db::static_file::iter_static_files;
use reth_db_api::{ use reth_db_api::{
database::Database, database::Database,
table::Table, table::Table,
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
TableViewer, Tables,
}; };
use reth_node_builder::NodeTypesWithDB; use reth_node_builder::NodeTypesWithDB;
use reth_provider::{ProviderFactory, StaticFileProviderFactory}; use reth_provider::{ProviderFactory, StaticFileProviderFactory};

View File

@@ -1,6 +1,8 @@
use clap::Parser; use clap::Parser;
use reth_db::{open_db_read_only, tables_to_generic, DatabaseEnv, Tables}; use reth_db::{open_db_read_only, tables_to_generic, DatabaseEnv};
use reth_db_api::{cursor::DbCursorRO, database::Database, table::Table, transaction::DbTx}; use reth_db_api::{
cursor::DbCursorRO, database::Database, table::Table, transaction::DbTx, Tables,
};
use reth_db_common::DbTool; use reth_db_common::DbTool;
use reth_node_builder::{NodeTypesWithDBAdapter, NodeTypesWithEngine}; use reth_node_builder::{NodeTypesWithDBAdapter, NodeTypesWithEngine};
use reth_node_core::{ use reth_node_core::{

View File

@@ -1,13 +1,13 @@
use alloy_consensus::Header; use alloy_consensus::Header;
use alloy_primitives::{hex, BlockHash}; use alloy_primitives::{hex, BlockHash};
use clap::Parser; use clap::Parser;
use reth_db::{ use reth_db::static_file::{
static_file::{ ColumnSelectorOne, ColumnSelectorTwo, HeaderWithHashMask, ReceiptMask, TransactionMask,
ColumnSelectorOne, ColumnSelectorTwo, HeaderWithHashMask, ReceiptMask, TransactionMask, };
}, use reth_db_api::{
table::{Decompress, DupSort, Table},
tables, RawKey, RawTable, Receipts, TableViewer, Transactions, tables, RawKey, RawTable, Receipts, TableViewer, Transactions,
}; };
use reth_db_api::table::{Decompress, DupSort, Table};
use reth_db_common::DbTool; use reth_db_common::DbTool;
use reth_node_api::{ReceiptTy, TxTy}; use reth_node_api::{ReceiptTy, TxTy};
use reth_node_builder::NodeTypesWithDB; use reth_node_builder::NodeTypesWithDB;
@@ -207,8 +207,10 @@ mod tests {
use super::*; use super::*;
use alloy_primitives::{Address, B256}; use alloy_primitives::{Address, B256};
use clap::{Args, Parser}; use clap::{Args, Parser};
use reth_db::{AccountsHistory, HashedAccounts, Headers, StageCheckpoints, StoragesHistory}; use reth_db_api::{
use reth_db_api::models::{storage_sharded_key::StorageShardedKey, ShardedKey}; models::{storage_sharded_key::StorageShardedKey, ShardedKey},
AccountsHistory, HashedAccounts, Headers, StageCheckpoints, StoragesHistory,
};
use std::str::FromStr; use std::str::FromStr;
/// A helper type to parse Args more easily /// A helper type to parse Args more easily

View File

@@ -3,8 +3,8 @@ use alloy_primitives::hex;
use clap::Parser; use clap::Parser;
use eyre::WrapErr; use eyre::WrapErr;
use reth_chainspec::EthereumHardforks; use reth_chainspec::EthereumHardforks;
use reth_db::{DatabaseEnv, RawValue, TableViewer, Tables}; use reth_db::DatabaseEnv;
use reth_db_api::{database::Database, table::Table}; use reth_db_api::{database::Database, table::Table, RawValue, TableViewer, Tables};
use reth_db_common::{DbTool, ListFilter}; use reth_db_common::{DbTool, ListFilter};
use reth_node_builder::{NodeTypesWithDBAdapter, NodeTypesWithEngine}; use reth_node_builder::{NodeTypesWithDBAdapter, NodeTypesWithEngine};
use std::{cell::RefCell, sync::Arc}; use std::{cell::RefCell, sync::Arc};

View File

@@ -5,8 +5,8 @@ use eyre::WrapErr;
use human_bytes::human_bytes; use human_bytes::human_bytes;
use itertools::Itertools; use itertools::Itertools;
use reth_chainspec::EthereumHardforks; use reth_chainspec::EthereumHardforks;
use reth_db::{mdbx, static_file::iter_static_files, DatabaseEnv, TableViewer, Tables}; use reth_db::{mdbx, static_file::iter_static_files, DatabaseEnv};
use reth_db_api::database::Database; use reth_db_api::{database::Database, TableViewer, Tables};
use reth_db_common::DbTool; use reth_db_common::DbTool;
use reth_fs_util as fs; use reth_fs_util as fs;
use reth_node_builder::{NodePrimitives, NodeTypesWithDB, NodeTypesWithDBAdapter}; use reth_node_builder::{NodePrimitives, NodeTypesWithDB, NodeTypesWithDBAdapter};

View File

@@ -10,8 +10,10 @@ use ratatui::{
widgets::{Block, Borders, List, ListItem, ListState, Paragraph, Wrap}, widgets::{Block, Borders, List, ListItem, ListState, Paragraph, Wrap},
Frame, Terminal, Frame, Terminal,
}; };
use reth_db::RawValue; use reth_db_api::{
use reth_db_api::table::{Table, TableRow}; table::{Table, TableRow},
RawValue,
};
use std::{ use std::{
io, io,
time::{Duration, Instant}, time::{Duration, Instant},

View File

@@ -7,8 +7,7 @@ use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_cli::chainspec::ChainSpecParser; use reth_cli::chainspec::ChainSpecParser;
use reth_config::Config; use reth_config::Config;
use reth_consensus::{ConsensusError, FullConsensus}; use reth_consensus::{ConsensusError, FullConsensus};
use reth_db::tables; use reth_db_api::{tables, transaction::DbTx};
use reth_db_api::transaction::DbTx;
use reth_downloaders::{ use reth_downloaders::{
bodies::bodies::BodiesDownloaderBuilder, bodies::bodies::BodiesDownloaderBuilder,
file_client::{ChunkedFileReader, FileClient, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE}, file_client::{ChunkedFileReader, FileClient, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE},

View File

@@ -4,9 +4,9 @@ use clap::Parser;
use reth_chainspec::{EthChainSpec, EthereumHardforks}; use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_cli::chainspec::ChainSpecParser; use reth_cli::chainspec::ChainSpecParser;
use reth_cli_runner::CliContext; use reth_cli_runner::CliContext;
use reth_db::tables;
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbDupCursorRW}, cursor::{DbCursorRO, DbDupCursorRW},
tables,
transaction::DbTx, transaction::DbTx,
}; };
use reth_provider::{BlockNumReader, HeaderProvider, ProviderError}; use reth_provider::{BlockNumReader, HeaderProvider, ProviderError};

View File

@@ -4,8 +4,11 @@ use clap::Parser;
use itertools::Itertools; use itertools::Itertools;
use reth_chainspec::EthChainSpec; use reth_chainspec::EthChainSpec;
use reth_cli::chainspec::ChainSpecParser; use reth_cli::chainspec::ChainSpecParser;
use reth_db::{mdbx::tx::Tx, static_file::iter_static_files, tables, DatabaseError}; use reth_db::{mdbx::tx::Tx, static_file::iter_static_files, DatabaseError};
use reth_db_api::transaction::{DbTx, DbTxMut}; use reth_db_api::{
tables,
transaction::{DbTx, DbTxMut},
};
use reth_db_common::{ use reth_db_common::{
init::{insert_genesis_header, insert_genesis_history, insert_genesis_state}, init::{insert_genesis_header, insert_genesis_history, insert_genesis_state},
DbTool, DbTool,

View File

@@ -1,10 +1,8 @@
use std::sync::Arc;
use super::setup; use super::setup;
use reth_consensus::{noop::NoopConsensus, ConsensusError, FullConsensus}; use reth_consensus::{noop::NoopConsensus, ConsensusError, FullConsensus};
use reth_db::{tables, DatabaseEnv}; use reth_db::DatabaseEnv;
use reth_db_api::{ use reth_db_api::{
cursor::DbCursorRO, database::Database, table::TableImporter, transaction::DbTx, cursor::DbCursorRO, database::Database, table::TableImporter, tables, transaction::DbTx,
}; };
use reth_db_common::DbTool; use reth_db_common::DbTool;
use reth_evm::{execute::BlockExecutorProvider, noop::NoopBlockExecutorProvider}; use reth_evm::{execute::BlockExecutorProvider, noop::NoopBlockExecutorProvider};
@@ -15,6 +13,7 @@ use reth_provider::{
DatabaseProviderFactory, ProviderFactory, DatabaseProviderFactory, ProviderFactory,
}; };
use reth_stages::{stages::ExecutionStage, Stage, StageCheckpoint, UnwindInput}; use reth_stages::{stages::ExecutionStage, Stage, StageCheckpoint, UnwindInput};
use std::sync::Arc;
use tracing::info; use tracing::info;
pub(crate) async fn dump_execution_stage<N, E, C>( pub(crate) async fn dump_execution_stage<N, E, C>(

View File

@@ -1,10 +1,8 @@
use std::sync::Arc;
use super::setup; use super::setup;
use alloy_primitives::BlockNumber; use alloy_primitives::BlockNumber;
use eyre::Result; use eyre::Result;
use reth_db::{tables, DatabaseEnv}; use reth_db::DatabaseEnv;
use reth_db_api::{database::Database, table::TableImporter}; use reth_db_api::{database::Database, table::TableImporter, tables};
use reth_db_common::DbTool; use reth_db_common::DbTool;
use reth_node_core::dirs::{ChainPath, DataDirPath}; use reth_node_core::dirs::{ChainPath, DataDirPath};
use reth_provider::{ use reth_provider::{
@@ -12,6 +10,7 @@ use reth_provider::{
DatabaseProviderFactory, ProviderFactory, DatabaseProviderFactory, ProviderFactory,
}; };
use reth_stages::{stages::AccountHashingStage, Stage, StageCheckpoint, UnwindInput}; use reth_stages::{stages::AccountHashingStage, Stage, StageCheckpoint, UnwindInput};
use std::sync::Arc;
use tracing::info; use tracing::info;
pub(crate) async fn dump_hashing_account_stage<N: ProviderNodeTypes<DB = Arc<DatabaseEnv>>>( pub(crate) async fn dump_hashing_account_stage<N: ProviderNodeTypes<DB = Arc<DatabaseEnv>>>(

View File

@@ -1,9 +1,7 @@
use std::sync::Arc;
use super::setup; use super::setup;
use eyre::Result; use eyre::Result;
use reth_db::{tables, DatabaseEnv}; use reth_db::DatabaseEnv;
use reth_db_api::{database::Database, table::TableImporter}; use reth_db_api::{database::Database, table::TableImporter, tables};
use reth_db_common::DbTool; use reth_db_common::DbTool;
use reth_node_core::dirs::{ChainPath, DataDirPath}; use reth_node_core::dirs::{ChainPath, DataDirPath};
use reth_provider::{ use reth_provider::{
@@ -11,6 +9,7 @@ use reth_provider::{
DatabaseProviderFactory, ProviderFactory, DatabaseProviderFactory, ProviderFactory,
}; };
use reth_stages::{stages::StorageHashingStage, Stage, StageCheckpoint, UnwindInput}; use reth_stages::{stages::StorageHashingStage, Stage, StageCheckpoint, UnwindInput};
use std::sync::Arc;
use tracing::info; use tracing::info;
pub(crate) async fn dump_hashing_storage_stage<N: ProviderNodeTypes<DB = Arc<DatabaseEnv>>>( pub(crate) async fn dump_hashing_storage_stage<N: ProviderNodeTypes<DB = Arc<DatabaseEnv>>>(

View File

@@ -5,8 +5,8 @@ use alloy_primitives::BlockNumber;
use eyre::Result; use eyre::Result;
use reth_config::config::EtlConfig; use reth_config::config::EtlConfig;
use reth_consensus::noop::NoopConsensus; use reth_consensus::noop::NoopConsensus;
use reth_db::{tables, DatabaseEnv}; use reth_db::DatabaseEnv;
use reth_db_api::{database::Database, table::TableImporter}; use reth_db_api::{database::Database, table::TableImporter, tables};
use reth_db_common::DbTool; use reth_db_common::DbTool;
use reth_evm::noop::NoopBlockExecutorProvider; use reth_evm::noop::NoopBlockExecutorProvider;
use reth_exex::ExExManagerHandle; use reth_exex::ExExManagerHandle;

View File

@@ -3,9 +3,9 @@ use crate::common::{AccessRights, CliNodeComponents, CliNodeTypes, Environment,
use clap::Parser; use clap::Parser;
use reth_chainspec::{EthChainSpec, EthereumHardforks}; use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_cli::chainspec::ChainSpecParser; use reth_cli::chainspec::ChainSpecParser;
use reth_db::{init_db, mdbx::DatabaseArguments, tables, DatabaseEnv}; use reth_db::{init_db, mdbx::DatabaseArguments, DatabaseEnv};
use reth_db_api::{ use reth_db_api::{
cursor::DbCursorRO, database::Database, models::ClientVersion, table::TableImporter, cursor::DbCursorRO, database::Database, models::ClientVersion, table::TableImporter, tables,
transaction::DbTx, transaction::DbTx,
}; };
use reth_db_common::DbTool; use reth_db_common::DbTool;

View File

@@ -8,8 +8,10 @@ use proptest::{
test_runner::{TestRng, TestRunner}, test_runner::{TestRng, TestRunner},
}; };
use proptest_arbitrary_interop::arb; use proptest_arbitrary_interop::arb;
use reth_db::tables; use reth_db_api::{
use reth_db_api::table::{DupSort, Table, TableRow}; table::{DupSort, Table, TableRow},
tables,
};
use reth_fs_util as fs; use reth_fs_util as fs;
use reth_primitives::TransactionSigned; use reth_primitives::TransactionSigned;
use std::collections::HashSet; use std::collections::HashSet;

View File

@@ -1,5 +1,3 @@
use std::collections::BTreeSet;
use alloy_primitives::{map::HashMap, B256}; use alloy_primitives::{map::HashMap, B256};
use reth_db::DatabaseError; use reth_db::DatabaseError;
use reth_trie::{ use reth_trie::{
@@ -7,6 +5,7 @@ use reth_trie::{
updates::{StorageTrieUpdates, TrieUpdates}, updates::{StorageTrieUpdates, TrieUpdates},
BranchNodeCompact, Nibbles, BranchNodeCompact, Nibbles,
}; };
use std::collections::BTreeSet;
use tracing::warn; use tracing::warn;
#[derive(Debug)] #[derive(Debug)]

View File

@@ -4,8 +4,8 @@
use alloy_consensus::BlockHeader; use alloy_consensus::BlockHeader;
use alloy_primitives::B256; use alloy_primitives::B256;
use reth_db::{tables, DatabaseEnv}; use reth_db::DatabaseEnv;
use reth_db_api::{database::Database, transaction::DbTxMut}; use reth_db_api::{database::Database, tables, transaction::DbTxMut};
use reth_network_p2p::bodies::response::BlockResponse; use reth_network_p2p::bodies::response::BlockResponse;
use reth_primitives::{BlockBody, SealedBlock, SealedHeader}; use reth_primitives::{BlockBody, SealedBlock, SealedHeader};
use reth_primitives_traits::Block; use reth_primitives_traits::Block;

View File

@@ -7,8 +7,7 @@ use reth_cli_commands::{
import::build_import_pipeline, import::build_import_pipeline,
}; };
use reth_consensus::noop::NoopConsensus; use reth_consensus::noop::NoopConsensus;
use reth_db::tables; use reth_db_api::{tables, transaction::DbTx};
use reth_db_api::transaction::DbTx;
use reth_downloaders::file_client::{ChunkedFileReader, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE}; use reth_downloaders::file_client::{ChunkedFileReader, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE};
use reth_node_builder::BlockTy; use reth_node_builder::BlockTy;
use reth_node_core::version::SHORT_VERSION; use reth_node_core::version::SHORT_VERSION;

View File

@@ -6,7 +6,7 @@ use std::path::{Path, PathBuf};
use clap::Parser; use clap::Parser;
use reth_cli::chainspec::ChainSpecParser; use reth_cli::chainspec::ChainSpecParser;
use reth_cli_commands::common::{AccessRights, CliNodeTypes, Environment, EnvironmentArgs}; use reth_cli_commands::common::{AccessRights, CliNodeTypes, Environment, EnvironmentArgs};
use reth_db::tables; use reth_db_api::tables;
use reth_downloaders::{ use reth_downloaders::{
file_client::{ChunkedFileReader, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE}, file_client::{ChunkedFileReader, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE},
receipt_file_client::ReceiptFileClient, receipt_file_client::ReceiptFileClient,

View File

@@ -15,7 +15,6 @@ workspace = true
# reth # reth
reth-chainspec.workspace = true reth-chainspec.workspace = true
reth-exex-types.workspace = true reth-exex-types.workspace = true
reth-db.workspace = true
reth-db-api.workspace = true reth-db-api.workspace = true
reth-errors.workspace = true reth-errors.workspace = true
reth-provider.workspace = true reth-provider.workspace = true

View File

@@ -2,7 +2,7 @@ use crate::{segments::SegmentSet, Pruner};
use alloy_eips::eip2718::Encodable2718; use alloy_eips::eip2718::Encodable2718;
use reth_chainspec::MAINNET; use reth_chainspec::MAINNET;
use reth_config::PruneConfig; use reth_config::PruneConfig;
use reth_db::{table::Value, transaction::DbTxMut}; use reth_db_api::{table::Value, transaction::DbTxMut};
use reth_exex_types::FinishedExExHeight; use reth_exex_types::FinishedExExHeight;
use reth_primitives_traits::NodePrimitives; use reth_primitives_traits::NodePrimitives;
use reth_provider::{ use reth_provider::{

View File

@@ -1,12 +1,11 @@
use std::{fmt::Debug, ops::RangeBounds};
use crate::PruneLimiter; use crate::PruneLimiter;
use reth_db::{ use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW, RangeWalker}, cursor::{DbCursorRO, DbCursorRW, RangeWalker},
table::{Table, TableRow}, table::{Table, TableRow},
transaction::DbTxMut, transaction::DbTxMut,
DatabaseError, DatabaseError,
}; };
use std::{fmt::Debug, ops::RangeBounds};
use tracing::debug; use tracing::debug;
pub(crate) trait DbTxPruneExt: DbTxMut { pub(crate) trait DbTxPruneExt: DbTxMut {

View File

@@ -1,5 +1,4 @@
use reth_db::DatabaseError; use reth_errors::{DatabaseError, RethError};
use reth_errors::RethError;
use reth_provider::ProviderError; use reth_provider::ProviderError;
use reth_prune_types::PruneSegmentError; use reth_prune_types::PruneSegmentError;
use thiserror::Error; use thiserror::Error;

View File

@@ -6,7 +6,7 @@
//! node after static file producer has finished //! node after static file producer has finished
use crate::{db_ext::DbTxPruneExt, segments::PruneInput, PrunerError}; use crate::{db_ext::DbTxPruneExt, segments::PruneInput, PrunerError};
use reth_db::{table::Value, tables, transaction::DbTxMut}; use reth_db_api::{table::Value, tables, transaction::DbTxMut};
use reth_primitives_traits::NodePrimitives; use reth_primitives_traits::NodePrimitives;
use reth_provider::{ use reth_provider::{
errors::provider::ProviderResult, BlockReader, DBProvider, NodePrimitivesProvider, errors::provider::ProviderResult, BlockReader, DBProvider, NodePrimitivesProvider,
@@ -88,7 +88,7 @@ mod tests {
FoldWhile::{Continue, Done}, FoldWhile::{Continue, Done},
Itertools, Itertools,
}; };
use reth_db::tables; use reth_db_api::tables;
use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader}; use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader};
use reth_prune_types::{ use reth_prune_types::{
PruneCheckpoint, PruneInterruptReason, PruneMode, PruneProgress, PruneSegment, PruneCheckpoint, PruneInterruptReason, PruneMode, PruneProgress, PruneSegment,

View File

@@ -3,7 +3,7 @@ use crate::segments::{
UserReceipts, UserReceipts,
}; };
use alloy_eips::eip2718::Encodable2718; use alloy_eips::eip2718::Encodable2718;
use reth_db::{table::Value, transaction::DbTxMut}; use reth_db_api::{table::Value, transaction::DbTxMut};
use reth_primitives_traits::NodePrimitives; use reth_primitives_traits::NodePrimitives;
use reth_provider::{ use reth_provider::{
providers::StaticFileProvider, BlockReader, DBProvider, PruneCheckpointWriter, providers::StaticFileProvider, BlockReader, DBProvider, PruneCheckpointWriter,

View File

@@ -1,5 +1,3 @@
use std::num::NonZeroUsize;
use crate::{ use crate::{
db_ext::DbTxPruneExt, db_ext::DbTxPruneExt,
segments::{PruneInput, Segment}, segments::{PruneInput, Segment},
@@ -7,7 +5,7 @@ use crate::{
}; };
use alloy_primitives::BlockNumber; use alloy_primitives::BlockNumber;
use itertools::Itertools; use itertools::Itertools;
use reth_db::{ use reth_db_api::{
cursor::{DbCursorRO, RangeWalker}, cursor::{DbCursorRO, RangeWalker},
tables, tables,
transaction::DbTxMut, transaction::DbTxMut,
@@ -17,6 +15,7 @@ use reth_prune_types::{
PruneMode, PrunePurpose, PruneSegment, SegmentOutput, SegmentOutputCheckpoint, PruneMode, PrunePurpose, PruneSegment, SegmentOutput, SegmentOutputCheckpoint,
}; };
use reth_static_file_types::StaticFileSegment; use reth_static_file_types::StaticFileSegment;
use std::num::NonZeroUsize;
use tracing::trace; use tracing::trace;
/// Number of header tables to prune in one step /// Number of header tables to prune in one step
@@ -199,8 +198,7 @@ mod tests {
}; };
use alloy_primitives::{BlockNumber, B256, U256}; use alloy_primitives::{BlockNumber, B256, U256};
use assert_matches::assert_matches; use assert_matches::assert_matches;
use reth_db::tables; use reth_db_api::{tables, transaction::DbTx};
use reth_db_api::transaction::DbTx;
use reth_provider::{ use reth_provider::{
DatabaseProviderFactory, PruneCheckpointReader, PruneCheckpointWriter, DatabaseProviderFactory, PruneCheckpointReader, PruneCheckpointWriter,
StaticFileProviderFactory, StaticFileProviderFactory,

View File

@@ -2,7 +2,7 @@ use crate::{
segments::{PruneInput, Segment}, segments::{PruneInput, Segment},
PrunerError, PrunerError,
}; };
use reth_db::{table::Value, transaction::DbTxMut}; use reth_db_api::{table::Value, transaction::DbTxMut};
use reth_primitives_traits::NodePrimitives; use reth_primitives_traits::NodePrimitives;
use reth_provider::{ use reth_provider::{
errors::provider::ProviderResult, providers::StaticFileProvider, BlockReader, DBProvider, errors::provider::ProviderResult, providers::StaticFileProvider, BlockReader, DBProvider,

View File

@@ -3,7 +3,7 @@ use crate::{
segments::{PruneInput, Segment}, segments::{PruneInput, Segment},
PrunerError, PrunerError,
}; };
use reth_db::{table::Value, tables, transaction::DbTxMut}; use reth_db_api::{table::Value, tables, transaction::DbTxMut};
use reth_primitives_traits::NodePrimitives; use reth_primitives_traits::NodePrimitives;
use reth_provider::{ use reth_provider::{
providers::StaticFileProvider, BlockReader, DBProvider, StaticFileProviderFactory, providers::StaticFileProvider, BlockReader, DBProvider, StaticFileProviderFactory,
@@ -98,7 +98,7 @@ mod tests {
FoldWhile::{Continue, Done}, FoldWhile::{Continue, Done},
Itertools, Itertools,
}; };
use reth_db::tables; use reth_db_api::tables;
use reth_provider::{ use reth_provider::{
DatabaseProviderFactory, PruneCheckpointReader, PruneCheckpointWriter, DatabaseProviderFactory, PruneCheckpointReader, PruneCheckpointWriter,
StaticFileProviderFactory, StaticFileProviderFactory,

View File

@@ -4,8 +4,7 @@ use crate::{
PrunerError, PrunerError,
}; };
use itertools::Itertools; use itertools::Itertools;
use reth_db::{tables, transaction::DbTxMut}; use reth_db_api::{models::ShardedKey, tables, transaction::DbTxMut};
use reth_db_api::models::ShardedKey;
use reth_provider::DBProvider; use reth_provider::DBProvider;
use reth_prune_types::{ use reth_prune_types::{
PruneMode, PrunePurpose, PruneSegment, SegmentOutput, SegmentOutputCheckpoint, PruneMode, PrunePurpose, PruneSegment, SegmentOutput, SegmentOutputCheckpoint,
@@ -133,7 +132,7 @@ mod tests {
}; };
use alloy_primitives::{BlockNumber, B256}; use alloy_primitives::{BlockNumber, B256};
use assert_matches::assert_matches; use assert_matches::assert_matches;
use reth_db::{tables, BlockNumberList}; use reth_db_api::{tables, BlockNumberList};
use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader}; use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader};
use reth_prune_types::{ use reth_prune_types::{
PruneCheckpoint, PruneInterruptReason, PruneMode, PruneProgress, PruneSegment, PruneCheckpoint, PruneInterruptReason, PruneMode, PruneProgress, PruneSegment,

View File

@@ -1,11 +1,10 @@
use alloy_primitives::BlockNumber; use alloy_primitives::BlockNumber;
use reth_db::{BlockNumberList, RawKey, RawTable, RawValue};
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW}, cursor::{DbCursorRO, DbCursorRW},
models::ShardedKey, models::ShardedKey,
table::Table, table::Table,
transaction::DbTxMut, transaction::DbTxMut,
DatabaseError, BlockNumberList, DatabaseError, RawKey, RawTable, RawValue,
}; };
use reth_provider::DBProvider; use reth_provider::DBProvider;

View File

@@ -2,7 +2,7 @@ use crate::{
segments::{PruneInput, Segment}, segments::{PruneInput, Segment},
PrunerError, PrunerError,
}; };
use reth_db::{table::Value, transaction::DbTxMut}; use reth_db_api::{table::Value, transaction::DbTxMut};
use reth_primitives_traits::NodePrimitives; use reth_primitives_traits::NodePrimitives;
use reth_provider::{ use reth_provider::{
errors::provider::ProviderResult, BlockReader, DBProvider, NodePrimitivesProvider, errors::provider::ProviderResult, BlockReader, DBProvider, NodePrimitivesProvider,

View File

@@ -4,7 +4,7 @@ use crate::{
PrunerError, PrunerError,
}; };
use alloy_consensus::TxReceipt; use alloy_consensus::TxReceipt;
use reth_db::{table::Value, tables, transaction::DbTxMut}; use reth_db_api::{table::Value, tables, transaction::DbTxMut};
use reth_primitives_traits::NodePrimitives; use reth_primitives_traits::NodePrimitives;
use reth_provider::{ use reth_provider::{
BlockReader, DBProvider, NodePrimitivesProvider, PruneCheckpointWriter, TransactionsProvider, BlockReader, DBProvider, NodePrimitivesProvider, PruneCheckpointWriter, TransactionsProvider,
@@ -230,8 +230,7 @@ mod tests {
use crate::segments::{PruneInput, PruneLimiter, ReceiptsByLogs, Segment}; use crate::segments::{PruneInput, PruneLimiter, ReceiptsByLogs, Segment};
use alloy_primitives::B256; use alloy_primitives::B256;
use assert_matches::assert_matches; use assert_matches::assert_matches;
use reth_db::tables; use reth_db_api::{cursor::DbCursorRO, tables, transaction::DbTx};
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
use reth_primitives_traits::InMemorySize; use reth_primitives_traits::InMemorySize;
use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader, TransactionsProvider}; use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader, TransactionsProvider};
use reth_prune_types::{PruneMode, PruneSegment, ReceiptsLogPruneConfig}; use reth_prune_types::{PruneMode, PruneSegment, ReceiptsLogPruneConfig};

View File

@@ -3,7 +3,7 @@ use crate::{
segments::{PruneInput, Segment}, segments::{PruneInput, Segment},
PrunerError, PrunerError,
}; };
use reth_db::{tables, transaction::DbTxMut}; use reth_db_api::{tables, transaction::DbTxMut};
use reth_provider::{BlockReader, DBProvider, TransactionsProvider}; use reth_provider::{BlockReader, DBProvider, TransactionsProvider};
use reth_prune_types::{ use reth_prune_types::{
PruneMode, PrunePurpose, PruneSegment, SegmentOutput, SegmentOutputCheckpoint, PruneMode, PrunePurpose, PruneSegment, SegmentOutput, SegmentOutputCheckpoint,
@@ -89,7 +89,7 @@ mod tests {
FoldWhile::{Continue, Done}, FoldWhile::{Continue, Done},
Itertools, Itertools,
}; };
use reth_db::tables; use reth_db_api::tables;
use reth_primitives_traits::SignedTransaction; use reth_primitives_traits::SignedTransaction;
use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader}; use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader};
use reth_prune_types::{PruneCheckpoint, PruneMode, PruneProgress, PruneSegment}; use reth_prune_types::{PruneCheckpoint, PruneMode, PruneProgress, PruneSegment};

View File

@@ -4,8 +4,11 @@ use crate::{
PrunerError, PrunerError,
}; };
use itertools::Itertools; use itertools::Itertools;
use reth_db::{tables, transaction::DbTxMut}; use reth_db_api::{
use reth_db_api::models::{storage_sharded_key::StorageShardedKey, BlockNumberAddress}; models::{storage_sharded_key::StorageShardedKey, BlockNumberAddress},
tables,
transaction::DbTxMut,
};
use reth_provider::DBProvider; use reth_provider::DBProvider;
use reth_prune_types::{PruneMode, PrunePurpose, PruneSegment, SegmentOutputCheckpoint}; use reth_prune_types::{PruneMode, PrunePurpose, PruneSegment, SegmentOutputCheckpoint};
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
@@ -136,7 +139,7 @@ mod tests {
}; };
use alloy_primitives::{BlockNumber, B256}; use alloy_primitives::{BlockNumber, B256};
use assert_matches::assert_matches; use assert_matches::assert_matches;
use reth_db::{tables, BlockNumberList}; use reth_db_api::{tables, BlockNumberList};
use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader}; use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader};
use reth_prune_types::{PruneCheckpoint, PruneMode, PruneProgress, PruneSegment}; use reth_prune_types::{PruneCheckpoint, PruneMode, PruneProgress, PruneSegment};
use reth_stages::test_utils::{StorageKind, TestStageDB}; use reth_stages::test_utils::{StorageKind, TestStageDB};

View File

@@ -5,7 +5,7 @@ use crate::{
}; };
use alloy_eips::eip2718::Encodable2718; use alloy_eips::eip2718::Encodable2718;
use rayon::prelude::*; use rayon::prelude::*;
use reth_db::{tables, transaction::DbTxMut}; use reth_db_api::{tables, transaction::DbTxMut};
use reth_provider::{BlockReader, DBProvider}; use reth_provider::{BlockReader, DBProvider};
use reth_prune_types::{PruneMode, PrunePurpose, PruneSegment, SegmentOutputCheckpoint}; use reth_prune_types::{PruneMode, PrunePurpose, PruneSegment, SegmentOutputCheckpoint};
use tracing::{instrument, trace}; use tracing::{instrument, trace};
@@ -116,7 +116,7 @@ mod tests {
FoldWhile::{Continue, Done}, FoldWhile::{Continue, Done},
Itertools, Itertools,
}; };
use reth_db::tables; use reth_db_api::tables;
use reth_primitives_traits::SignedTransaction; use reth_primitives_traits::SignedTransaction;
use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader}; use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader};
use reth_prune_types::{ use reth_prune_types::{

View File

@@ -2,9 +2,8 @@
use super::constants; use super::constants;
use alloy_primitives::BlockNumber; use alloy_primitives::BlockNumber;
use reth_db::tables;
use reth_db_api::{ use reth_db_api::{
cursor::DbCursorRO, database::Database, transaction::DbTx, DatabaseError as DbError, cursor::DbCursorRO, database::Database, tables, transaction::DbTx, DatabaseError as DbError,
}; };
use reth_stages::{ use reth_stages::{
stages::{AccountHashingStage, SeedOpts}, stages::{AccountHashingStage, SeedOpts},

View File

@@ -1,9 +1,10 @@
#![allow(unreachable_pub)] #![allow(unreachable_pub)]
use alloy_primitives::{Address, B256, U256}; use alloy_primitives::{Address, B256, U256};
use itertools::concat; use itertools::concat;
use reth_db::{tables, test_utils::TempDatabase, Database, DatabaseEnv}; use reth_db::{test_utils::TempDatabase, Database, DatabaseEnv};
use reth_db_api::{ use reth_db_api::{
cursor::DbCursorRO, cursor::DbCursorRO,
tables,
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
}; };
use reth_primitives::{Account, SealedBlock, SealedHeader}; use reth_primitives::{Account, SealedBlock, SealedHeader};

View File

@@ -1,7 +1,10 @@
use super::missing_static_data_error; use super::missing_static_data_error;
use futures_util::TryStreamExt; use futures_util::TryStreamExt;
use reth_db::{tables, transaction::DbTx}; use reth_db_api::{
use reth_db_api::{cursor::DbCursorRO, transaction::DbTxMut}; cursor::DbCursorRO,
tables,
transaction::{DbTx, DbTxMut},
};
use reth_network_p2p::bodies::{downloader::BodyDownloader, response::BlockResponse}; use reth_network_p2p::bodies::{downloader::BodyDownloader, response::BlockResponse};
use reth_primitives::StaticFileSegment; use reth_primitives::StaticFileSegment;
use reth_provider::{ use reth_provider::{
@@ -36,19 +39,19 @@ use tracing::*;
/// ///
/// The bodies are processed and data is inserted into these tables: /// The bodies are processed and data is inserted into these tables:
/// ///
/// - [`BlockOmmers`][reth_db::tables::BlockOmmers] /// - [`BlockOmmers`][reth_db_api::tables::BlockOmmers]
/// - [`BlockBodies`][reth_db::tables::BlockBodyIndices] /// - [`BlockBodies`][reth_db_api::tables::BlockBodyIndices]
/// - [`Transactions`][reth_db::tables::Transactions] /// - [`Transactions`][reth_db_api::tables::Transactions]
/// - [`TransactionBlocks`][reth_db::tables::TransactionBlocks] /// - [`TransactionBlocks`][reth_db_api::tables::TransactionBlocks]
/// ///
/// # Genesis /// # Genesis
/// ///
/// This stage expects that the genesis has been inserted into the appropriate tables: /// This stage expects that the genesis has been inserted into the appropriate tables:
/// ///
/// - The header tables (see [`HeaderStage`][crate::stages::HeaderStage]) /// - The header tables (see [`HeaderStage`][crate::stages::HeaderStage])
/// - The [`BlockOmmers`][reth_db::tables::BlockOmmers] table /// - The [`BlockOmmers`][reth_db_api::tables::BlockOmmers] table
/// - The [`BlockBodies`][reth_db::tables::BlockBodyIndices] table /// - The [`BlockBodies`][reth_db_api::tables::BlockBodyIndices] table
/// - The [`Transactions`][reth_db::tables::Transactions] table /// - The [`Transactions`][reth_db_api::tables::Transactions] table
#[derive(Debug)] #[derive(Debug)]
pub struct BodyStage<D: BodyDownloader> { pub struct BodyStage<D: BodyDownloader> {
/// The body downloader. /// The body downloader.

View File

@@ -674,8 +674,10 @@ mod tests {
use alloy_rlp::Decodable; use alloy_rlp::Decodable;
use assert_matches::assert_matches; use assert_matches::assert_matches;
use reth_chainspec::ChainSpecBuilder; use reth_chainspec::ChainSpecBuilder;
use reth_db::transaction::DbTx; use reth_db_api::{
use reth_db_api::{models::AccountBeforeTx, transaction::DbTxMut}; models::AccountBeforeTx,
transaction::{DbTx, DbTxMut},
};
use reth_ethereum_consensus::EthBeaconConsensus; use reth_ethereum_consensus::EthBeaconConsensus;
use reth_evm::execute::BasicBlockExecutorProvider; use reth_evm::execute::BasicBlockExecutorProvider;
use reth_evm_ethereum::execute::EthExecutionStrategyFactory; use reth_evm_ethereum::execute::EthExecutionStrategyFactory;

View File

@@ -1,10 +1,11 @@
use alloy_primitives::{keccak256, B256}; use alloy_primitives::{keccak256, B256};
use itertools::Itertools; use itertools::Itertools;
use reth_config::config::{EtlConfig, HashingConfig}; use reth_config::config::{EtlConfig, HashingConfig};
use reth_db::{tables, RawKey, RawTable, RawValue};
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW}, cursor::{DbCursorRO, DbCursorRW},
tables,
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
RawKey, RawTable, RawValue,
}; };
use reth_etl::Collector; use reth_etl::Collector;
use reth_primitives::Account; use reth_primitives::Account;

View File

@@ -1,11 +1,11 @@
use alloy_primitives::{bytes::BufMut, keccak256, B256}; use alloy_primitives::{bytes::BufMut, keccak256, B256};
use itertools::Itertools; use itertools::Itertools;
use reth_config::config::{EtlConfig, HashingConfig}; use reth_config::config::{EtlConfig, HashingConfig};
use reth_db::tables;
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbDupCursorRW}, cursor::{DbCursorRO, DbDupCursorRW},
models::{BlockNumberAddress, CompactU256}, models::{BlockNumberAddress, CompactU256},
table::Decompress, table::Decompress,
tables,
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
}; };
use reth_etl::Collector; use reth_etl::Collector;

View File

@@ -4,11 +4,12 @@ use alloy_primitives::{BlockHash, BlockNumber, Bytes, B256};
use futures_util::StreamExt; use futures_util::StreamExt;
use reth_config::config::EtlConfig; use reth_config::config::EtlConfig;
use reth_consensus::HeaderValidator; use reth_consensus::HeaderValidator;
use reth_db::{table::Value, tables, transaction::DbTx, RawKey, RawTable, RawValue};
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW}, cursor::{DbCursorRO, DbCursorRW},
transaction::DbTxMut, table::Value,
DbTxUnwindExt, tables,
transaction::{DbTx, DbTxMut},
DbTxUnwindExt, RawKey, RawTable, RawValue,
}; };
use reth_etl::Collector; use reth_etl::Collector;
use reth_network_p2p::headers::{downloader::HeaderDownloader, error::HeadersDownloaderError}; use reth_network_p2p::headers::{downloader::HeaderDownloader, error::HeadersDownloaderError};
@@ -36,7 +37,7 @@ use tracing::*;
/// the perceived highest block on the network. /// the perceived highest block on the network.
/// ///
/// The headers are processed and data is inserted into static files, as well as into the /// The headers are processed and data is inserted into static files, as well as into the
/// [`HeaderNumbers`][reth_db::tables::HeaderNumbers] table. /// [`HeaderNumbers`][reth_db_api::tables::HeaderNumbers] table.
/// ///
/// NOTE: This stage downloads headers in reverse and pushes them to the ETL [`Collector`]. It then /// NOTE: This stage downloads headers in reverse and pushes them to the ETL [`Collector`]. It then
/// proceeds to push them sequentially to static files. The stage checkpoint is not updated until /// proceeds to push them sequentially to static files. The stage checkpoint is not updated until

View File

@@ -1,8 +1,7 @@
use super::{collect_history_indices, load_history_indices}; use super::{collect_history_indices, load_history_indices};
use alloy_primitives::Address; use alloy_primitives::Address;
use reth_config::config::{EtlConfig, IndexHistoryConfig}; use reth_config::config::{EtlConfig, IndexHistoryConfig};
use reth_db::tables; use reth_db_api::{models::ShardedKey, table::Decode, tables, transaction::DbTxMut};
use reth_db_api::{models::ShardedKey, table::Decode, transaction::DbTxMut};
use reth_provider::{DBProvider, HistoryWriter, PruneCheckpointReader, PruneCheckpointWriter}; use reth_provider::{DBProvider, HistoryWriter, PruneCheckpointReader, PruneCheckpointWriter};
use reth_prune_types::{PruneCheckpoint, PruneMode, PrunePurpose, PruneSegment}; use reth_prune_types::{PruneCheckpoint, PruneMode, PrunePurpose, PruneSegment};
use reth_stages_api::{ use reth_stages_api::{
@@ -150,7 +149,6 @@ mod tests {
}; };
use alloy_primitives::{address, BlockNumber, B256}; use alloy_primitives::{address, BlockNumber, B256};
use itertools::Itertools; use itertools::Itertools;
use reth_db::BlockNumberList;
use reth_db_api::{ use reth_db_api::{
cursor::DbCursorRO, cursor::DbCursorRO,
models::{ models::{
@@ -158,6 +156,7 @@ mod tests {
StoredBlockBodyIndices, StoredBlockBodyIndices,
}, },
transaction::DbTx, transaction::DbTx,
BlockNumberList,
}; };
use reth_provider::{providers::StaticFileWriter, DatabaseProviderFactory}; use reth_provider::{providers::StaticFileWriter, DatabaseProviderFactory};
use reth_testing_utils::generators::{ use reth_testing_utils::generators::{

View File

@@ -1,10 +1,10 @@
use super::{collect_history_indices, load_history_indices}; use super::{collect_history_indices, load_history_indices};
use crate::{StageCheckpoint, StageId}; use crate::{StageCheckpoint, StageId};
use reth_config::config::{EtlConfig, IndexHistoryConfig}; use reth_config::config::{EtlConfig, IndexHistoryConfig};
use reth_db::tables;
use reth_db_api::{ use reth_db_api::{
models::{storage_sharded_key::StorageShardedKey, AddressStorageKey, BlockNumberAddress}, models::{storage_sharded_key::StorageShardedKey, AddressStorageKey, BlockNumberAddress},
table::Decode, table::Decode,
tables,
transaction::DbTxMut, transaction::DbTxMut,
}; };
use reth_provider::{DBProvider, HistoryWriter, PruneCheckpointReader, PruneCheckpointWriter}; use reth_provider::{DBProvider, HistoryWriter, PruneCheckpointReader, PruneCheckpointWriter};
@@ -155,7 +155,6 @@ mod tests {
}; };
use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256}; use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256};
use itertools::Itertools; use itertools::Itertools;
use reth_db::BlockNumberList;
use reth_db_api::{ use reth_db_api::{
cursor::DbCursorRO, cursor::DbCursorRO,
models::{ models::{
@@ -163,6 +162,7 @@ mod tests {
StoredBlockBodyIndices, StoredBlockBodyIndices,
}, },
transaction::DbTx, transaction::DbTx,
BlockNumberList,
}; };
use reth_primitives::StorageEntry; use reth_primitives::StorageEntry;
use reth_provider::{providers::StaticFileWriter, DatabaseProviderFactory}; use reth_provider::{providers::StaticFileWriter, DatabaseProviderFactory};

View File

@@ -2,8 +2,10 @@ use alloy_consensus::BlockHeader;
use alloy_primitives::{BlockNumber, Sealable, B256}; use alloy_primitives::{BlockNumber, Sealable, B256};
use reth_codecs::Compact; use reth_codecs::Compact;
use reth_consensus::ConsensusError; use reth_consensus::ConsensusError;
use reth_db::tables; use reth_db_api::{
use reth_db_api::transaction::{DbTx, DbTxMut}; tables,
transaction::{DbTx, DbTxMut},
};
use reth_primitives::{GotExpected, SealedHeader}; use reth_primitives::{GotExpected, SealedHeader};
use reth_provider::{ use reth_provider::{
DBProvider, HeaderProvider, ProviderError, StageCheckpointReader, StageCheckpointWriter, DBProvider, HeaderProvider, ProviderError, StageCheckpointReader, StageCheckpointWriter,

View File

@@ -48,14 +48,13 @@ mod tests {
use alloy_primitives::{address, hex_literal::hex, keccak256, BlockNumber, B256, U256}; use alloy_primitives::{address, hex_literal::hex, keccak256, BlockNumber, B256, U256};
use alloy_rlp::Decodable; use alloy_rlp::Decodable;
use reth_chainspec::ChainSpecBuilder; use reth_chainspec::ChainSpecBuilder;
use reth_db::{ use reth_db::mdbx::{cursor::Cursor, RW};
mdbx::{cursor::Cursor, RW},
tables, AccountsHistory,
};
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW}, cursor::{DbCursorRO, DbCursorRW},
table::Table, table::Table,
tables,
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
AccountsHistory,
}; };
use reth_ethereum_consensus::EthBeaconConsensus; use reth_ethereum_consensus::EthBeaconConsensus;
use reth_evm_ethereum::execute::EthExecutorProvider; use reth_evm_ethereum::execute::EthExecutorProvider;

View File

@@ -1,4 +1,4 @@
use reth_db::{table::Value, transaction::DbTxMut}; use reth_db_api::{table::Value, transaction::DbTxMut};
use reth_primitives::NodePrimitives; use reth_primitives::NodePrimitives;
use reth_provider::{ use reth_provider::{
BlockReader, DBProvider, PruneCheckpointReader, PruneCheckpointWriter, BlockReader, DBProvider, PruneCheckpointReader, PruneCheckpointWriter,

View File

@@ -5,7 +5,7 @@ use downloader::{DownloaderError, S3DownloaderResponse};
mod filelist; mod filelist;
use filelist::DOWNLOAD_FILE_LIST; use filelist::DOWNLOAD_FILE_LIST;
use reth_db::transaction::DbTxMut; use reth_db_api::transaction::DbTxMut;
use reth_primitives::StaticFileSegment; use reth_primitives::StaticFileSegment;
use reth_provider::{ use reth_provider::{
DBProvider, StageCheckpointReader, StageCheckpointWriter, StaticFileProviderFactory, DBProvider, StageCheckpointReader, StageCheckpointWriter, StaticFileProviderFactory,

View File

@@ -1,11 +1,13 @@
use alloy_primitives::{Address, TxNumber}; use alloy_primitives::{Address, TxNumber};
use reth_config::config::SenderRecoveryConfig; use reth_config::config::SenderRecoveryConfig;
use reth_consensus::ConsensusError; use reth_consensus::ConsensusError;
use reth_db::{static_file::TransactionMask, table::Value, tables, RawValue}; use reth_db::static_file::TransactionMask;
use reth_db_api::{ use reth_db_api::{
cursor::DbCursorRW, cursor::DbCursorRW,
table::Value,
tables,
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
DbTxUnwindExt, DbTxUnwindExt, RawValue,
}; };
use reth_primitives::{GotExpected, NodePrimitives, StaticFileSegment}; use reth_primitives::{GotExpected, NodePrimitives, StaticFileSegment};
use reth_primitives_traits::SignedTransaction; use reth_primitives_traits::SignedTransaction;
@@ -35,7 +37,7 @@ type RecoveryResultSender = mpsc::Sender<Result<(u64, Address), Box<SenderRecove
/// The sender recovery stage iterates over existing transactions, /// The sender recovery stage iterates over existing transactions,
/// recovers the transaction signer and stores them /// recovers the transaction signer and stores them
/// in [`TransactionSenders`][reth_db::tables::TransactionSenders] table. /// in [`TransactionSenders`][reth_db_api::tables::TransactionSenders] table.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct SenderRecoveryStage { pub struct SenderRecoveryStage {
/// The size of inserted items after which the control /// The size of inserted items after which the control
@@ -70,9 +72,9 @@ where
} }
/// Retrieve the range of transactions to iterate over by querying /// Retrieve the range of transactions to iterate over by querying
/// [`BlockBodyIndices`][reth_db::tables::BlockBodyIndices], /// [`BlockBodyIndices`][reth_db_api::tables::BlockBodyIndices],
/// collect transactions within that range, recover signer for each transaction and store /// collect transactions within that range, recover signer for each transaction and store
/// entries in the [`TransactionSenders`][reth_db::tables::TransactionSenders] table. /// entries in the [`TransactionSenders`][reth_db_api::tables::TransactionSenders] table.
fn execute(&mut self, provider: &Provider, input: ExecInput) -> Result<ExecOutput, StageError> { fn execute(&mut self, provider: &Provider, input: ExecInput) -> Result<ExecOutput, StageError> {
if input.target_reached() { if input.target_reached() {
return Ok(ExecOutput::done(input.checkpoint())) return Ok(ExecOutput::done(input.checkpoint()))

View File

@@ -2,10 +2,12 @@ use alloy_eips::eip2718::Encodable2718;
use alloy_primitives::{TxHash, TxNumber}; use alloy_primitives::{TxHash, TxNumber};
use num_traits::Zero; use num_traits::Zero;
use reth_config::config::{EtlConfig, TransactionLookupConfig}; use reth_config::config::{EtlConfig, TransactionLookupConfig};
use reth_db::{table::Value, tables, RawKey, RawValue};
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW}, cursor::{DbCursorRO, DbCursorRW},
table::Value,
tables,
transaction::DbTxMut, transaction::DbTxMut,
RawKey, RawValue,
}; };
use reth_etl::Collector; use reth_etl::Collector;
use reth_primitives::NodePrimitives; use reth_primitives::NodePrimitives;
@@ -259,7 +261,7 @@ mod tests {
}; };
use alloy_primitives::{BlockNumber, B256}; use alloy_primitives::{BlockNumber, B256};
use assert_matches::assert_matches; use assert_matches::assert_matches;
use reth_db::transaction::DbTx; use reth_db_api::transaction::DbTx;
use reth_primitives::SealedBlock; use reth_primitives::SealedBlock;
use reth_provider::{ use reth_provider::{
providers::StaticFileWriter, BlockBodyIndicesProvider, DatabaseProviderFactory, providers::StaticFileWriter, BlockBodyIndicesProvider, DatabaseProviderFactory,

View File

@@ -1,13 +1,12 @@
//! Utils for `stages`. //! Utils for `stages`.
use alloy_primitives::{BlockNumber, TxNumber}; use alloy_primitives::{BlockNumber, TxNumber};
use reth_config::config::EtlConfig; use reth_config::config::EtlConfig;
use reth_db::BlockNumberList;
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW}, cursor::{DbCursorRO, DbCursorRW},
models::sharded_key::NUM_OF_INDICES_IN_SHARD, models::sharded_key::NUM_OF_INDICES_IN_SHARD,
table::{Decompress, Table}, table::{Decompress, Table},
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
DatabaseError, BlockNumberList, DatabaseError,
}; };
use reth_etl::Collector; use reth_etl::Collector;
use reth_primitives::StaticFileSegment; use reth_primitives::StaticFileSegment;

View File

@@ -1,7 +1,6 @@
use alloy_primitives::{keccak256, Address, BlockNumber, TxHash, TxNumber, B256, U256}; use alloy_primitives::{keccak256, Address, BlockNumber, TxHash, TxNumber, B256, U256};
use reth_chainspec::MAINNET; use reth_chainspec::MAINNET;
use reth_db::{ use reth_db::{
tables,
test_utils::{create_test_rw_db, create_test_rw_db_with_path, create_test_static_files_dir}, test_utils::{create_test_rw_db, create_test_rw_db_with_path, create_test_static_files_dir},
DatabaseEnv, DatabaseEnv,
}; };
@@ -11,6 +10,7 @@ use reth_db_api::{
database::Database, database::Database,
models::{AccountBeforeTx, StoredBlockBodyIndices}, models::{AccountBeforeTx, StoredBlockBodyIndices},
table::Table, table::Table,
tables,
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
DatabaseError as DbError, DatabaseError as DbError,
}; };

View File

@@ -1,8 +1,7 @@
use crate::segments::Segment; use crate::segments::Segment;
use alloy_primitives::BlockNumber; use alloy_primitives::BlockNumber;
use reth_codecs::Compact; use reth_codecs::Compact;
use reth_db::{table::Value, tables}; use reth_db_api::{cursor::DbCursorRO, table::Value, tables, transaction::DbTx};
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
use reth_primitives_traits::NodePrimitives; use reth_primitives_traits::NodePrimitives;
use reth_provider::{providers::StaticFileWriter, DBProvider, StaticFileProviderFactory}; use reth_provider::{providers::StaticFileWriter, DBProvider, StaticFileProviderFactory};
use reth_static_file_types::StaticFileSegment; use reth_static_file_types::StaticFileSegment;

View File

@@ -1,8 +1,7 @@
use crate::segments::Segment; use crate::segments::Segment;
use alloy_primitives::BlockNumber; use alloy_primitives::BlockNumber;
use reth_codecs::Compact; use reth_codecs::Compact;
use reth_db::{table::Value, tables}; use reth_db_api::{cursor::DbCursorRO, table::Value, tables, transaction::DbTx};
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
use reth_primitives_traits::NodePrimitives; use reth_primitives_traits::NodePrimitives;
use reth_provider::{ use reth_provider::{
providers::StaticFileWriter, BlockReader, DBProvider, StaticFileProviderFactory, providers::StaticFileWriter, BlockReader, DBProvider, StaticFileProviderFactory,

View File

@@ -1,8 +1,7 @@
use crate::segments::Segment; use crate::segments::Segment;
use alloy_primitives::BlockNumber; use alloy_primitives::BlockNumber;
use reth_codecs::Compact; use reth_codecs::Compact;
use reth_db::{table::Value, tables}; use reth_db_api::{cursor::DbCursorRO, table::Value, tables, transaction::DbTx};
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
use reth_primitives_traits::NodePrimitives; use reth_primitives_traits::NodePrimitives;
use reth_provider::{ use reth_provider::{
providers::StaticFileWriter, BlockReader, DBProvider, StaticFileProviderFactory, providers::StaticFileWriter, BlockReader, DBProvider, StaticFileProviderFactory,

View File

@@ -5,7 +5,7 @@ use alloy_primitives::BlockNumber;
use parking_lot::Mutex; use parking_lot::Mutex;
use rayon::prelude::*; use rayon::prelude::*;
use reth_codecs::Compact; use reth_codecs::Compact;
use reth_db::table::Value; use reth_db_api::table::Value;
use reth_primitives_traits::NodePrimitives; use reth_primitives_traits::NodePrimitives;
use reth_provider::{ use reth_provider::{
providers::StaticFileWriter, BlockReader, ChainStateBlockReader, DBProvider, providers::StaticFileWriter, BlockReader, ChainStateBlockReader, DBProvider,

View File

@@ -18,7 +18,7 @@ reth-db-models = { workspace = true, features = ["reth-codec"] }
reth-primitives = { workspace = true, features = ["reth-codec"] } reth-primitives = { workspace = true, features = ["reth-codec"] }
reth-primitives-traits = { workspace = true, features = ["serde", "reth-codec"] } reth-primitives-traits = { workspace = true, features = ["serde", "reth-codec"] }
reth-stages-types = { 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-storage-errors.workspace = true
reth-trie-common.workspace = true reth-trie-common.workspace = true
@@ -96,3 +96,4 @@ op = [
"reth-codecs/op", "reth-codecs/op",
"reth-primitives-traits/op", "reth-primitives-traits/op",
] ]
bench = []

View File

@@ -61,17 +61,27 @@
/// Common types used throughout the abstraction. /// Common types used throughout the abstraction.
pub mod common; pub mod common;
/// Cursor database traits. /// Cursor database traits.
pub mod cursor; pub mod cursor;
/// Database traits. /// Database traits.
pub mod database; pub mod database;
/// Database metrics trait extensions. /// Database metrics trait extensions.
pub mod database_metrics; pub mod database_metrics;
pub mod mock; pub mod mock;
/// Table traits /// Table traits
pub mod table; pub mod table;
pub mod tables;
pub use tables::*;
/// Transaction database traits. /// Transaction database traits.
pub mod transaction; pub mod transaction;
/// Re-exports /// Re-exports
pub use reth_storage_errors::db::{DatabaseError, DatabaseWriteOperation}; pub use reth_storage_errors::db::{DatabaseError, DatabaseWriteOperation};

View File

@@ -1,6 +1,6 @@
//! Curates the input coming from the fuzzer for certain types. //! Curates the input coming from the fuzzer for certain types.
use reth_db_api::models::IntegerList; use crate::models::IntegerList;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Makes sure that the list provided by the fuzzer is not empty and pre-sorted /// Makes sure that the list provided by the fuzzer is not empty and pre-sorted

View File

@@ -14,7 +14,7 @@ macro_rules! impl_fuzzer_with_input {
#[allow(non_snake_case)] #[allow(non_snake_case)]
#[cfg(any(test, feature = "bench"))] #[cfg(any(test, feature = "bench"))]
pub mod $name { pub mod $name {
use reth_db_api::table; use crate::table;
#[allow(unused_imports)] #[allow(unused_imports)]
use reth_primitives_traits::*; use reth_primitives_traits::*;
@@ -23,7 +23,7 @@ macro_rules! impl_fuzzer_with_input {
use super::inputs::*; use super::inputs::*;
#[allow(unused_imports)] #[allow(unused_imports)]
use reth_db_api::models::*; use crate::models::*;
/// Encodes and decodes table types returning its encoded size and the decoded object. /// 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. /// This method is used for benchmarking, so its parameter should be the actual type that is being tested.

View File

@@ -5,7 +5,7 @@
//! This module defines the tables in reth, as well as some table-related abstractions: //! This module defines the tables in reth, as well as some table-related abstractions:
//! //!
//! - [`codecs`] integrates different codecs into [`Encode`] and [`Decode`] //! - [`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 //! # Database Tour
//! //!
@@ -16,12 +16,7 @@ pub mod codecs;
mod raw; mod raw;
pub use raw::{RawDupSort, RawKey, RawTable, RawValue, TableRawRow}; pub use raw::{RawDupSort, RawKey, RawTable, RawValue, TableRawRow};
#[cfg(feature = "mdbx")] use crate::{
pub(crate) mod utils;
use alloy_consensus::Header;
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256};
use reth_db_api::{
models::{ models::{
accounts::BlockNumberAddress, accounts::BlockNumberAddress,
blocks::{HeaderHash, StoredBlockOmmers}, blocks::{HeaderHash, StoredBlockOmmers},
@@ -31,6 +26,8 @@ use reth_db_api::{
}, },
table::{Decode, DupSort, Encode, Table, TableInfo}, 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::{Receipt, StorageEntry, TransactionSigned};
use reth_primitives_traits::{Account, Bytecode}; use reth_primitives_traits::{Account, Bytecode};
use reth_prune_types::{PruneCheckpoint, PruneSegment}; use reth_prune_types::{PruneCheckpoint, PruneSegment};
@@ -54,8 +51,10 @@ pub enum TableType {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// use reth_db::{TableViewer, Tables}; /// use reth_db_api::{
/// use reth_db_api::table::{DupSort, Table}; /// table::{DupSort, Table},
/// TableViewer, Tables,
/// };
/// ///
/// struct MyTableViewer; /// 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 where
$value: reth_db_api::table::Value + 'static $value: $crate::table::Value + 'static
$($(,$generic: Send + Sync)*)? $($(,$generic: Send + Sync)*)?
{ {
const NAME: &'static str = table_names::$name; const NAME: &'static str = table_names::$name;
@@ -163,9 +162,6 @@ macro_rules! tables {
)* )*
// Tables enum. // 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. /// A table in the database.
#[derive(Clone, Copy, PartialEq, Eq, Hash)] #[derive(Clone, Copy, PartialEq, Eq, Hash)]
@@ -281,8 +277,7 @@ macro_rules! tables {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// use reth_db::{Tables, tables_to_generic}; /// use reth_db_api::{table::Table, Tables, tables_to_generic};
/// use reth_db_api::table::Table;
/// ///
/// let table = Tables::Headers; /// let table = Tables::Headers;
/// let result = tables_to_generic!(table, |GenericTable| <GenericTable as Table>::NAME); /// let result = tables_to_generic!(table, |GenericTable| <GenericTable as Table>::NAME);
@@ -553,11 +548,11 @@ impl Encode for ChainStateKey {
} }
impl Decode 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 { match value {
[0] => Ok(Self::LastFinalizedBlock), [0] => Ok(Self::LastFinalizedBlock),
[1] => Ok(Self::LastSafeBlockBlock), [1] => Ok(Self::LastSafeBlockBlock),
_ => Err(reth_db_api::DatabaseError::Decode), _ => Err(crate::DatabaseError::Decode),
} }
} }
} }

View File

@@ -1,5 +1,7 @@
use crate::DatabaseError; use crate::{
use reth_db_api::table::{Compress, Decode, Decompress, DupSort, Encode, Key, Table, Value}; table::{Compress, Decode, Decompress, DupSort, Encode, Key, Table, Value},
DatabaseError,
};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Tuple with `RawKey<T::Key>` and `RawValue<T::Value>`. /// Tuple with `RawKey<T::Key>` and `RawValue<T::Value>`.

View File

@@ -11,7 +11,6 @@ repository.workspace = true
# reth # reth
reth-chainspec.workspace = true reth-chainspec.workspace = true
reth-primitives.workspace = true reth-primitives.workspace = true
reth-db = { workspace = true, features = ["mdbx"] }
reth-db-api.workspace = true reth-db-api.workspace = true
reth-provider.workspace = true reth-provider.workspace = true
reth-config.workspace = true reth-config.workspace = true
@@ -41,6 +40,7 @@ serde_json.workspace = true
tracing.workspace = true tracing.workspace = true
[dev-dependencies] [dev-dependencies]
reth-db = { workspace = true, features = ["mdbx"] }
reth-primitives-traits.workspace = true reth-primitives-traits.workspace = true
reth-provider = { workspace = true, features = ["test-utils"] } reth-provider = { workspace = true, features = ["test-utils"] }
alloy-consensus.workspace = true alloy-consensus.workspace = true

View File

@@ -2,13 +2,12 @@
use boyer_moore_magiclen::BMByte; use boyer_moore_magiclen::BMByte;
use eyre::Result; use eyre::Result;
use reth_db::{RawTable, TableRawRow};
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbDupCursorRO}, cursor::{DbCursorRO, DbDupCursorRO},
database::Database, database::Database,
table::{Decode, Decompress, DupSort, Table, TableRow}, table::{Decode, Decompress, DupSort, Table, TableRow},
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
DatabaseError, DatabaseError, RawTable, TableRawRow,
}; };
use reth_fs_util as fs; use reth_fs_util as fs;
use reth_node_types::NodeTypesWithDB; use reth_node_types::NodeTypesWithDB;

View File

@@ -6,8 +6,7 @@ use alloy_primitives::{map::HashMap, Address, B256, U256};
use reth_chainspec::EthChainSpec; use reth_chainspec::EthChainSpec;
use reth_codecs::Compact; use reth_codecs::Compact;
use reth_config::config::EtlConfig; use reth_config::config::EtlConfig;
use reth_db::tables; use reth_db_api::{tables, transaction::DbTxMut, DatabaseError};
use reth_db_api::{transaction::DbTxMut, DatabaseError};
use reth_etl::Collector; use reth_etl::Collector;
use reth_primitives::{ use reth_primitives::{
Account, Bytecode, GotExpected, NodePrimitives, StaticFileSegment, StorageEntry, Account, Bytecode, GotExpected, NodePrimitives, StaticFileSegment, StorageEntry,

View File

@@ -15,32 +15,23 @@ workspace = true
# reth # reth
reth-db-api.workspace = true reth-db-api.workspace = true
reth-primitives = { workspace = true, features = ["reth-codec"] } reth-primitives = { workspace = true, features = ["reth-codec"] }
reth-primitives-traits = { workspace = true, features = ["reth-codec"] }
reth-fs-util.workspace = true reth-fs-util.workspace = true
reth-storage-errors.workspace = true reth-storage-errors.workspace = true
reth-nippy-jar.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 reth-tracing.workspace = true
# ethereum # ethereum
alloy-primitives.workspace = true alloy-primitives.workspace = true
alloy-consensus.workspace = true
# mdbx # mdbx
reth-libmdbx = { workspace = true, optional = true, features = ["return-borrowed", "read-tx-timeouts"] } reth-libmdbx = { workspace = true, optional = true, features = ["return-borrowed", "read-tx-timeouts"] }
eyre = { workspace = true, optional = true } eyre = { workspace = true, optional = true }
# codecs
serde = { workspace = true, default-features = false }
# metrics # metrics
reth-metrics = { workspace = true, optional = true } reth-metrics = { workspace = true, optional = true }
metrics = { workspace = true, optional = true } metrics = { workspace = true, optional = true }
# misc # misc
bytes.workspace = true
page_size = { version = "0.6.0", optional = true } page_size = { version = "0.6.0", optional = true }
thiserror.workspace = true thiserror.workspace = true
tempfile = { workspace = true, optional = true } tempfile = { workspace = true, optional = true }
@@ -55,11 +46,13 @@ strum = { workspace = true, features = ["derive"], optional = true }
[dev-dependencies] [dev-dependencies]
# reth libs with arbitrary # reth libs with arbitrary
reth-primitives = { workspace = true, features = ["arbitrary"] } reth-primitives = { workspace = true, features = ["arbitrary"] }
reth-primitives-traits = { workspace = true, features = ["reth-codec"] }
serde_json.workspace = true serde_json.workspace = true
tempfile.workspace = true tempfile.workspace = true
test-fuzz.workspace = true
parking_lot.workspace = true parking_lot.workspace = true
alloy-consensus.workspace = true
serde.workspace = true
pprof = { workspace = true, features = ["flamegraph", "frame-pointer", "criterion"] } pprof = { workspace = true, features = ["flamegraph", "frame-pointer", "criterion"] }
criterion.workspace = true criterion.workspace = true
@@ -85,23 +78,17 @@ test-utils = [
"arbitrary", "arbitrary",
"parking_lot", "parking_lot",
"reth-primitives/test-utils", "reth-primitives/test-utils",
"reth-primitives-traits/test-utils",
"reth-db-api/test-utils", "reth-db-api/test-utils",
"reth-nippy-jar/test-utils", "reth-nippy-jar/test-utils",
"reth-trie-common/test-utils", "reth-primitives-traits/test-utils",
"reth-prune-types/test-utils",
"reth-stages-types/test-utils",
] ]
bench = [] bench = ["reth-db-api/bench"]
arbitrary = [ arbitrary = [
"reth-primitives/arbitrary", "reth-primitives/arbitrary",
"reth-db-api/arbitrary", "reth-db-api/arbitrary",
"reth-primitives-traits/arbitrary",
"reth-trie-common/arbitrary",
"alloy-primitives/arbitrary", "alloy-primitives/arbitrary",
"reth-prune-types/arbitrary",
"reth-stages-types/arbitrary",
"alloy-consensus/arbitrary", "alloy-consensus/arbitrary",
"reth-primitives-traits/arbitrary",
] ]
optimism = ["reth-db-api/optimism"] optimism = ["reth-db-api/optimism"]
op = [ op = [

View File

@@ -6,11 +6,12 @@ use criterion::{
criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion, criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion,
}; };
use pprof::criterion::{Output, PProfProfiler}; 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::{ use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO, DbDupCursorRW}, cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO, DbDupCursorRW},
database::Database, database::Database,
table::{Compress, Decode, Decompress, DupSort, Encode, Table}, table::{Compress, Decode, Decompress, DupSort, Encode, Table},
tables::*,
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
}; };
use reth_fs_util as fs; use reth_fs_util as fs;

View File

@@ -1,8 +1,8 @@
//! Cursor wrapper for libmdbx-sys. //! Cursor wrapper for libmdbx-sys.
use super::utils::*;
use crate::{ use crate::{
metrics::{DatabaseEnvMetrics, Operation}, metrics::{DatabaseEnvMetrics, Operation},
tables::utils::*,
DatabaseError, DatabaseError,
}; };
use reth_db_api::{ use reth_db_api::{

View File

@@ -33,6 +33,8 @@ use tx::Tx;
pub mod cursor; pub mod cursor;
pub mod tx; pub mod tx;
mod utils;
/// 1 KB in bytes /// 1 KB in bytes
pub const KILOBYTE: usize = 1024; pub const KILOBYTE: usize = 1024;
/// 1 MB in bytes /// 1 MB in bytes

View File

@@ -1,9 +1,8 @@
//! Transaction wrapper for libmdbx-sys. //! Transaction wrapper for libmdbx-sys.
use super::cursor::Cursor; use super::{cursor::Cursor, utils::*};
use crate::{ use crate::{
metrics::{DatabaseEnvMetrics, Operation, TransactionMode, TransactionOutcome}, metrics::{DatabaseEnvMetrics, Operation, TransactionMode, TransactionOutcome},
tables::utils::decode_one,
DatabaseError, DatabaseError,
}; };
use reth_db_api::{ use reth_db_api::{

View File

@@ -1,7 +1,9 @@
//! Small database table utilities and helper functions. //! Small database table utilities and helper functions.
use crate::DatabaseError; use crate::{
use reth_db_api::table::{Decode, Decompress, Table, TableRow}; table::{Decode, Decompress, Table, TableRow},
DatabaseError,
};
use std::borrow::Cow; use std::borrow::Cow;
/// Helper function to decode a `(key, value)` pair. /// Helper function to decode a `(key, value)` pair.

View File

@@ -20,7 +20,6 @@ pub mod lockfile;
#[cfg(feature = "mdbx")] #[cfg(feature = "mdbx")]
mod metrics; mod metrics;
pub mod static_file; pub mod static_file;
pub mod tables;
#[cfg(feature = "mdbx")] #[cfg(feature = "mdbx")]
mod utils; mod utils;
pub mod version; pub mod version;
@@ -29,7 +28,6 @@ pub mod version;
pub mod mdbx; pub mod mdbx;
pub use reth_storage_errors::db::{DatabaseError, DatabaseWriteOperation}; pub use reth_storage_errors::db::{DatabaseError, DatabaseWriteOperation};
pub use tables::*;
#[cfg(feature = "mdbx")] #[cfg(feature = "mdbx")]
pub use utils::is_database_empty; pub use utils::is_database_empty;

View File

@@ -21,8 +21,11 @@ use reth_chain_state::{
MemoryOverlayStateProvider, MemoryOverlayStateProvider,
}; };
use reth_chainspec::{ChainInfo, EthereumHardforks}; use reth_chainspec::{ChainInfo, EthereumHardforks};
use reth_db::{models::BlockNumberAddress, transaction::DbTx, Database}; use reth_db_api::{
use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices}; models::{AccountBeforeTx, BlockNumberAddress, StoredBlockBodyIndices},
transaction::DbTx,
Database,
};
use reth_evm::{ConfigureEvmEnv, EvmEnv}; use reth_evm::{ConfigureEvmEnv, EvmEnv};
use reth_execution_types::ExecutionOutcome; use reth_execution_types::ExecutionOutcome;
use reth_node_types::{BlockTy, HeaderTy, NodeTypesWithDB, ReceiptTy, TxTy}; use reth_node_types::{BlockTy, HeaderTy, NodeTypesWithDB, ReceiptTy, TxTy};
@@ -789,11 +792,12 @@ mod tests {
use reth_chainspec::{ use reth_chainspec::{
ChainSpec, ChainSpecBuilder, ChainSpecProvider, EthereumHardfork, MAINNET, ChainSpec, ChainSpecBuilder, ChainSpecProvider, EthereumHardfork, MAINNET,
}; };
use reth_db::{ use reth_db_api::{
cursor::DbCursorRO,
models::{AccountBeforeTx, StoredBlockBodyIndices}, models::{AccountBeforeTx, StoredBlockBodyIndices},
tables, tables,
transaction::DbTx,
}; };
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
use reth_errors::ProviderError; use reth_errors::ProviderError;
use reth_execution_types::{Chain, ExecutionOutcome}; use reth_execution_types::{Chain, ExecutionOutcome};
use reth_primitives::{EthPrimitives, Receipt, RecoveredBlock, SealedBlock, StaticFileSegment}; use reth_primitives::{EthPrimitives, Receipt, RecoveredBlock, SealedBlock, StaticFileSegment};

View File

@@ -17,8 +17,7 @@ use alloy_primitives::{
}; };
use reth_chain_state::{BlockState, CanonicalInMemoryState, MemoryOverlayStateProviderRef}; use reth_chain_state::{BlockState, CanonicalInMemoryState, MemoryOverlayStateProviderRef};
use reth_chainspec::{ChainInfo, EthereumHardforks}; use reth_chainspec::{ChainInfo, EthereumHardforks};
use reth_db::models::BlockNumberAddress; use reth_db_api::models::{AccountBeforeTx, BlockNumberAddress, StoredBlockBodyIndices};
use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_execution_types::{BundleStateInit, ExecutionOutcome, RevertsInit}; use reth_execution_types::{BundleStateInit, ExecutionOutcome, RevertsInit};
use reth_node_types::{BlockTy, HeaderTy, ReceiptTy, TxTy}; use reth_node_types::{BlockTy, HeaderTy, ReceiptTy, TxTy};
use reth_primitives::{Account, RecoveredBlock, SealedBlock, SealedHeader, StorageEntry}; use reth_primitives::{Account, RecoveredBlock, SealedBlock, SealedHeader, StorageEntry};
@@ -1485,7 +1484,7 @@ mod tests {
use itertools::Itertools; use itertools::Itertools;
use rand::Rng; use rand::Rng;
use reth_chain_state::{ExecutedBlock, ExecutedBlockWithTrieUpdates, NewCanonicalChain}; 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_execution_types::ExecutionOutcome;
use reth_primitives::{RecoveredBlock, SealedBlock}; use reth_primitives::{RecoveredBlock, SealedBlock};
use reth_storage_api::{BlockReader, BlockSource, ChangeSetReader}; use reth_storage_api::{BlockReader, BlockSource, ChangeSetReader};

View File

@@ -1,5 +1,5 @@
use crate::{providers::NodeTypesForProvider, DatabaseProvider}; 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_node_types::{FullNodePrimitives, FullSignedTx};
use reth_primitives_traits::FullBlockHeader; use reth_primitives_traits::FullBlockHeader;
use reth_storage_api::{ChainStorageReader, ChainStorageWriter, EthStorage}; use reth_storage_api::{ChainStorageReader, ChainStorageWriter, EthStorage};

View File

@@ -669,9 +669,9 @@ mod tests {
use reth_chainspec::ChainSpecBuilder; use reth_chainspec::ChainSpecBuilder;
use reth_db::{ use reth_db::{
mdbx::DatabaseArguments, mdbx::DatabaseArguments,
tables,
test_utils::{create_test_static_files_dir, ERROR_TEMPDIR}, test_utils::{create_test_static_files_dir, ERROR_TEMPDIR},
}; };
use reth_db_api::tables;
use reth_primitives::StaticFileSegment; use reth_primitives::StaticFileSegment;
use reth_primitives_traits::SignedTransaction; use reth_primitives_traits::SignedTransaction;
use reth_prune_types::{PruneMode, PruneModes}; use reth_prune_types::{PruneMode, PruneModes};

View File

@@ -29,19 +29,17 @@ use alloy_primitives::{
use itertools::Itertools; use itertools::Itertools;
use rayon::slice::ParallelSliceMut; use rayon::slice::ParallelSliceMut;
use reth_chainspec::{ChainInfo, ChainSpecProvider, EthChainSpec, EthereumHardforks}; use reth_chainspec::{ChainInfo, ChainSpecProvider, EthChainSpec, EthereumHardforks};
use reth_db::{
cursor::DbDupCursorRW, tables, BlockNumberList, PlainAccountState, PlainStorageState,
};
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO}, cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO, DbDupCursorRW},
database::Database, database::Database,
models::{ models::{
sharded_key, storage_sharded_key::StorageShardedKey, AccountBeforeTx, BlockNumberAddress, sharded_key, storage_sharded_key::StorageShardedKey, AccountBeforeTx, BlockNumberAddress,
ShardedKey, StoredBlockBodyIndices, ShardedKey, StoredBlockBodyIndices,
}, },
table::Table, table::Table,
tables,
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
DatabaseError, BlockNumberList, DatabaseError, PlainAccountState, PlainStorageState,
}; };
use reth_execution_types::{Chain, ExecutionOutcome}; use reth_execution_types::{Chain, ExecutionOutcome};
use reth_network_p2p::headers::downloader::SyncTarget; 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) let (new_state_root, trie_updates) = StateRoot::from_tx(&self.tx)
.with_prefix_sets(prefix_sets) .with_prefix_sets(prefix_sets)
.root_with_updates() .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_number = range.start().saturating_sub(1);
let parent_state_root = self 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) let (state_root, trie_updates) = StateRoot::from_tx(&self.tx)
.with_prefix_sets(prefix_sets) .with_prefix_sets(prefix_sets)
.root_with_updates() .root_with_updates()
.map_err(reth_db::DatabaseError::from)?; .map_err(reth_db_api::DatabaseError::from)?;
if state_root != expected_state_root { if state_root != expected_state_root {
return Err(ProviderError::StateRootMismatch(Box::new(RootMismatch { return Err(ProviderError::StateRootMismatch(Box::new(RootMismatch {
root: GotExpected { got: state_root, expected: expected_state_root }, root: GotExpected { got: state_root, expected: expected_state_root },

View File

@@ -1,7 +1,7 @@
//! Contains the main provider types and traits for interacting with the blockchain's storage. //! Contains the main provider types and traits for interacting with the blockchain's storage.
use reth_chainspec::EthereumHardforks; use reth_chainspec::EthereumHardforks;
use reth_db::table::Value; use reth_db_api::table::Value;
use reth_node_types::{FullNodePrimitives, NodeTypes, NodeTypesWithDB, NodeTypesWithEngine}; use reth_node_types::{FullNodePrimitives, NodeTypes, NodeTypesWithDB, NodeTypesWithEngine};
mod database; mod database;

View File

@@ -4,12 +4,13 @@ use crate::{
}; };
use alloy_eips::merge::EPOCH_SLOTS; use alloy_eips::merge::EPOCH_SLOTS;
use alloy_primitives::{map::B256Map, Address, BlockNumber, Bytes, StorageKey, StorageValue, B256}; use alloy_primitives::{map::B256Map, Address, BlockNumber, Bytes, StorageKey, StorageValue, B256};
use reth_db::{tables, BlockNumberList};
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbDupCursorRO}, cursor::{DbCursorRO, DbDupCursorRO},
models::{storage_sharded_key::StorageShardedKey, ShardedKey}, models::{storage_sharded_key::StorageShardedKey, ShardedKey},
table::Table, table::Table,
tables,
transaction::DbTx, transaction::DbTx,
BlockNumberList,
}; };
use reth_primitives::{Account, Bytecode}; use reth_primitives::{Account, Bytecode};
use reth_storage_api::{ use reth_storage_api::{
@@ -541,10 +542,11 @@ mod tests {
AccountReader, HistoricalStateProvider, HistoricalStateProviderRef, StateProvider, AccountReader, HistoricalStateProvider, HistoricalStateProviderRef, StateProvider,
}; };
use alloy_primitives::{address, b256, Address, B256, U256}; use alloy_primitives::{address, b256, Address, B256, U256};
use reth_db::{tables, BlockNumberList};
use reth_db_api::{ use reth_db_api::{
models::{storage_sharded_key::StorageShardedKey, AccountBeforeTx, ShardedKey}, models::{storage_sharded_key::StorageShardedKey, AccountBeforeTx, ShardedKey},
tables,
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
BlockNumberList,
}; };
use reth_primitives::{Account, StorageEntry}; use reth_primitives::{Account, StorageEntry};
use reth_storage_api::{ use reth_storage_api::{

View File

@@ -3,8 +3,7 @@ use crate::{
HashedPostStateProvider, StateProvider, StateRootProvider, HashedPostStateProvider, StateProvider, StateRootProvider,
}; };
use alloy_primitives::{map::B256Map, Address, BlockNumber, Bytes, StorageKey, StorageValue, B256}; use alloy_primitives::{map::B256Map, Address, BlockNumber, Bytes, StorageKey, StorageValue, B256};
use reth_db::tables; use reth_db_api::{cursor::DbDupCursorRO, tables, transaction::DbTx};
use reth_db_api::{cursor::DbDupCursorRO, transaction::DbTx};
use reth_primitives::{Account, Bytecode}; use reth_primitives::{Account, Bytecode};
use reth_storage_api::{ use reth_storage_api::{
DBProvider, StateCommitmentProvider, StateProofProvider, StorageRootProvider, DBProvider, StateCommitmentProvider, StateProofProvider, StorageRootProvider,

View File

@@ -10,12 +10,12 @@ use alloy_consensus::transaction::TransactionMeta;
use alloy_eips::{eip2718::Encodable2718, eip4895::Withdrawals, BlockHashOrNumber}; use alloy_eips::{eip2718::Encodable2718, eip4895::Withdrawals, BlockHashOrNumber};
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256}; use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use reth_chainspec::ChainInfo; 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, models::StoredBlockBodyIndices,
static_file::{
BlockHashMask, BodyIndicesMask, HeaderMask, HeaderWithHashMask, OmmersMask, ReceiptMask,
StaticFileCursor, TDWithHashMask, TotalDifficultyMask, TransactionMask, WithdrawalsMask,
},
table::{Decompress, Value}, table::{Decompress, Value},
}; };
use reth_node_types::{FullNodePrimitives, NodePrimitives}; use reth_node_types::{FullNodePrimitives, NodePrimitives};

View File

@@ -22,11 +22,13 @@ use reth_db::{
iter_static_files, BlockHashMask, BodyIndicesMask, HeaderMask, HeaderWithHashMask, iter_static_files, BlockHashMask, BodyIndicesMask, HeaderMask, HeaderWithHashMask,
ReceiptMask, StaticFileCursor, TDWithHashMask, TransactionMask, ReceiptMask, StaticFileCursor, TDWithHashMask, TransactionMask,
}, },
table::{Decompress, Value},
tables,
}; };
use reth_db_api::{ 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_nippy_jar::{NippyJar, NippyJarChecker, CONFIG_FILE_EXTENSION};
use reth_node_types::{FullNodePrimitives, NodePrimitives}; use reth_node_types::{FullNodePrimitives, NodePrimitives};

View File

@@ -61,11 +61,10 @@ mod tests {
use alloy_consensus::{Header, Transaction}; use alloy_consensus::{Header, Transaction};
use alloy_primitives::{BlockHash, TxNumber, B256, U256}; use alloy_primitives::{BlockHash, TxNumber, B256, U256};
use rand::seq::SliceRandom; use rand::seq::SliceRandom;
use reth_db::{ use reth_db::test_utils::create_test_static_files_dir;
test_utils::create_test_static_files_dir, CanonicalHeaders, HeaderNumbers, use reth_db_api::{
HeaderTerminalDifficulties, Headers, transaction::DbTxMut, CanonicalHeaders, HeaderNumbers, HeaderTerminalDifficulties, Headers,
}; };
use reth_db_api::transaction::DbTxMut;
use reth_primitives::{ use reth_primitives::{
static_file::{find_fixed_range, SegmentRangeInclusive, DEFAULT_BLOCKS_PER_STATIC_FILE}, static_file::{find_fixed_range, SegmentRangeInclusive, DEFAULT_BLOCKS_PER_STATIC_FILE},
EthPrimitives, Receipt, TransactionSigned, EthPrimitives, Receipt, TransactionSigned,

View File

@@ -6,8 +6,9 @@ use alloy_consensus::BlockHeader;
use alloy_primitives::{BlockHash, BlockNumber, TxNumber, U256}; use alloy_primitives::{BlockHash, BlockNumber, TxNumber, U256};
use parking_lot::{lock_api::RwLockWriteGuard, RawRwLock, RwLock}; use parking_lot::{lock_api::RwLockWriteGuard, RawRwLock, RwLock};
use reth_codecs::Compact; use reth_codecs::Compact;
use reth_db::models::{StoredBlockBodyIndices, StoredBlockOmmers, StoredBlockWithdrawals}; use reth_db_api::models::{
use reth_db_api::models::CompactU256; CompactU256, StoredBlockBodyIndices, StoredBlockOmmers, StoredBlockWithdrawals,
};
use reth_nippy_jar::{NippyJar, NippyJarError, NippyJarWriter}; use reth_nippy_jar::{NippyJar, NippyJarError, NippyJarWriter};
use reth_node_types::NodePrimitives; use reth_node_types::NodePrimitives;
use reth_primitives::{ use reth_primitives::{

View File

@@ -8,8 +8,7 @@ use alloy_primitives::{
use alloy_consensus::Header; use alloy_consensus::Header;
use alloy_eips::eip4895::{Withdrawal, Withdrawals}; use alloy_eips::eip4895::{Withdrawal, Withdrawals};
use alloy_primitives::PrimitiveSignature as Signature; use alloy_primitives::PrimitiveSignature as Signature;
use reth_db::tables; use reth_db_api::{database::Database, models::StoredBlockBodyIndices, tables};
use reth_db_api::{database::Database, models::StoredBlockBodyIndices};
use reth_node_types::NodeTypes; use reth_node_types::NodeTypes;
use reth_primitives::{ use reth_primitives::{
Account, BlockBody, Receipt, RecoveredBlock, SealedBlock, SealedHeader, Transaction, Account, BlockBody, Receipt, RecoveredBlock, SealedBlock, SealedHeader, Transaction,

View File

@@ -16,8 +16,10 @@ use alloy_primitives::{
}; };
use parking_lot::Mutex; use parking_lot::Mutex;
use reth_chainspec::{ChainInfo, EthChainSpec}; use reth_chainspec::{ChainInfo, EthChainSpec};
use reth_db::mock::{DatabaseMock, TxMock}; use reth_db_api::{
use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices}; mock::{DatabaseMock, TxMock},
models::{AccountBeforeTx, StoredBlockBodyIndices},
};
use reth_execution_types::ExecutionOutcome; use reth_execution_types::ExecutionOutcome;
use reth_node_types::NodeTypes; use reth_node_types::NodeTypes;
use reth_primitives::{ use reth_primitives::{

View File

@@ -5,7 +5,7 @@ use crate::{
}; };
use alloy_consensus::BlockHeader; use alloy_consensus::BlockHeader;
use reth_chain_state::{ExecutedBlock, ExecutedBlockWithTrieUpdates}; 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_errors::ProviderResult;
use reth_primitives::{NodePrimitives, StaticFileSegment}; use reth_primitives::{NodePrimitives, StaticFileSegment};
use reth_primitives_traits::SignedTransaction; use reth_primitives_traits::SignedTransaction;
@@ -228,10 +228,10 @@ mod tests {
test_utils::create_test_provider_factory, AccountReader, StorageTrieWriter, TrieWriter, test_utils::create_test_provider_factory, AccountReader, StorageTrieWriter, TrieWriter,
}; };
use alloy_primitives::{keccak256, map::HashMap, Address, B256, U256}; use alloy_primitives::{keccak256, map::HashMap, Address, B256, U256};
use reth_db::tables;
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO}, cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO},
models::{AccountBeforeTx, BlockNumberAddress}, models::{AccountBeforeTx, BlockNumberAddress},
tables,
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
}; };
use reth_execution_types::ExecutionOutcome; use reth_execution_types::ExecutionOutcome;

View File

@@ -22,7 +22,6 @@ reth-stages-types.workspace = true
reth-storage-errors.workspace = true reth-storage-errors.workspace = true
reth-trie.workspace = true reth-trie.workspace = true
reth-trie-db.workspace = true reth-trie-db.workspace = true
reth-db.workspace = true
revm-database.workspace = true revm-database.workspace = true
reth-ethereum-primitives.workspace = true reth-ethereum-primitives.workspace = true

View File

@@ -4,10 +4,10 @@ use alloy_consensus::Header;
use alloy_primitives::BlockNumber; use alloy_primitives::BlockNumber;
use core::marker::PhantomData; use core::marker::PhantomData;
use reth_chainspec::{ChainSpecProvider, EthereumHardforks}; use reth_chainspec::{ChainSpecProvider, EthereumHardforks};
use reth_db::tables;
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW}, cursor::{DbCursorRO, DbCursorRW},
models::{StoredBlockOmmers, StoredBlockWithdrawals}, models::{StoredBlockOmmers, StoredBlockWithdrawals},
tables,
transaction::{DbTx, DbTxMut}, transaction::{DbTx, DbTxMut},
DbTxUnwindExt, DbTxUnwindExt,
}; };

View File

@@ -29,7 +29,7 @@ pub trait HashingWriter: Send + Sync {
range: impl RangeBounds<BlockNumber>, range: impl RangeBounds<BlockNumber>,
) -> ProviderResult<BTreeMap<B256, Option<Account>>>; ) -> ProviderResult<BTreeMap<B256, Option<Account>>>;
/// Inserts all accounts into the `AccountsHistory` table. /// Inserts all accounts into [`AccountsHistory`][reth_db_api::tables::AccountsHistory] table.
/// ///
/// # Returns /// # Returns
/// ///

View File

@@ -15,9 +15,7 @@ workspace = true
# reth # reth
reth-primitives-traits.workspace = true reth-primitives-traits.workspace = true
reth-execution-errors.workspace = true reth-execution-errors.workspace = true
reth-db.workspace = true
reth-db-api.workspace = true reth-db-api.workspace = true
reth-storage-errors.workspace = true
reth-trie.workspace = true reth-trie.workspace = true
revm.workspace = true revm.workspace = true

View File

@@ -2,7 +2,7 @@ use crate::{
DatabaseHashedCursorFactory, DatabaseProof, DatabaseStateRoot, DatabaseStorageRoot, DatabaseHashedCursorFactory, DatabaseProof, DatabaseStateRoot, DatabaseStorageRoot,
DatabaseTrieCursorFactory, DatabaseTrieWitness, DatabaseTrieCursorFactory, DatabaseTrieWitness,
}; };
use reth_db::transaction::DbTx; use reth_db_api::transaction::DbTx;
use reth_trie::{ use reth_trie::{
proof::Proof, witness::TrieWitness, KeccakKeyHasher, KeyHasher, StateRoot, StorageRoot, proof::Proof, witness::TrieWitness, KeccakKeyHasher, KeyHasher, StateRoot, StorageRoot,
}; };

View File

@@ -1,8 +1,9 @@
use alloy_primitives::{B256, U256}; use alloy_primitives::{B256, U256};
use reth_db::tables;
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbDupCursorRO}, cursor::{DbCursorRO, DbDupCursorRO},
tables,
transaction::DbTx, transaction::DbTx,
DatabaseError,
}; };
use reth_primitives_traits::Account; use reth_primitives_traits::Account;
use reth_trie::hashed_cursor::{HashedCursor, HashedCursorFactory, HashedStorageCursor}; use reth_trie::hashed_cursor::{HashedCursor, HashedCursorFactory, HashedStorageCursor};
@@ -29,14 +30,14 @@ impl<TX: DbTx> HashedCursorFactory for DatabaseHashedCursorFactory<'_, TX> {
type StorageCursor = type StorageCursor =
DatabaseHashedStorageCursor<<TX as DbTx>::DupCursor<tables::HashedStorages>>; DatabaseHashedStorageCursor<<TX as DbTx>::DupCursor<tables::HashedStorages>>;
fn hashed_account_cursor(&self) -> Result<Self::AccountCursor, reth_db::DatabaseError> { fn hashed_account_cursor(&self) -> Result<Self::AccountCursor, DatabaseError> {
Ok(DatabaseHashedAccountCursor(self.0.cursor_read::<tables::HashedAccounts>()?)) Ok(DatabaseHashedAccountCursor(self.0.cursor_read::<tables::HashedAccounts>()?))
} }
fn hashed_storage_cursor( fn hashed_storage_cursor(
&self, &self,
hashed_address: B256, hashed_address: B256,
) -> Result<Self::StorageCursor, reth_db::DatabaseError> { ) -> Result<Self::StorageCursor, DatabaseError> {
Ok(DatabaseHashedStorageCursor::new( Ok(DatabaseHashedStorageCursor::new(
self.0.cursor_dup_read::<tables::HashedStorages>()?, self.0.cursor_dup_read::<tables::HashedStorages>()?,
hashed_address, hashed_address,
@@ -62,11 +63,11 @@ where
{ {
type Value = Account; type Value = Account;
fn seek(&mut self, key: B256) -> Result<Option<(B256, Self::Value)>, reth_db::DatabaseError> { fn seek(&mut self, key: B256) -> Result<Option<(B256, Self::Value)>, DatabaseError> {
self.0.seek(key) self.0.seek(key)
} }
fn next(&mut self) -> Result<Option<(B256, Self::Value)>, reth_db::DatabaseError> { fn next(&mut self) -> Result<Option<(B256, Self::Value)>, DatabaseError> {
self.0.next() self.0.next()
} }
} }
@@ -95,14 +96,11 @@ where
{ {
type Value = U256; type Value = U256;
fn seek( fn seek(&mut self, subkey: B256) -> Result<Option<(B256, Self::Value)>, DatabaseError> {
&mut self,
subkey: B256,
) -> Result<Option<(B256, Self::Value)>, reth_db::DatabaseError> {
Ok(self.cursor.seek_by_key_subkey(self.hashed_address, subkey)?.map(|e| (e.key, e.value))) Ok(self.cursor.seek_by_key_subkey(self.hashed_address, subkey)?.map(|e| (e.key, e.value)))
} }
fn next(&mut self) -> Result<Option<(B256, Self::Value)>, reth_db::DatabaseError> { fn next(&mut self) -> Result<Option<(B256, Self::Value)>, DatabaseError> {
Ok(self.cursor.next_dup_val()?.map(|e| (e.key, e.value))) Ok(self.cursor.next_dup_val()?.map(|e| (e.key, e.value)))
} }
} }
@@ -111,7 +109,7 @@ impl<C> HashedStorageCursor for DatabaseHashedStorageCursor<C>
where where
C: DbCursorRO<tables::HashedStorages> + DbDupCursorRO<tables::HashedStorages>, C: DbCursorRO<tables::HashedStorages> + DbDupCursorRO<tables::HashedStorages>,
{ {
fn is_storage_empty(&mut self) -> Result<bool, reth_db::DatabaseError> { fn is_storage_empty(&mut self) -> Result<bool, DatabaseError> {
Ok(self.cursor.seek_exact(self.hashed_address)?.is_none()) Ok(self.cursor.seek_exact(self.hashed_address)?.is_none())
} }
} }

View File

@@ -4,10 +4,10 @@ use alloy_primitives::{
}; };
use core::{marker::PhantomData, ops::RangeInclusive}; use core::{marker::PhantomData, ops::RangeInclusive};
use derive_more::Deref; use derive_more::Deref;
use reth_db::tables;
use reth_db_api::{ use reth_db_api::{
cursor::DbCursorRO, cursor::DbCursorRO,
models::{AccountBeforeTx, BlockNumberAddress}, models::{AccountBeforeTx, BlockNumberAddress},
tables,
transaction::DbTx, transaction::DbTx,
DatabaseError, DatabaseError,
}; };

View File

@@ -3,14 +3,14 @@ use alloy_primitives::{
map::{AddressMap, B256Map}, map::{AddressMap, B256Map},
Address, BlockNumber, B256, U256, Address, BlockNumber, B256, U256,
}; };
use reth_db::tables;
use reth_db_api::{ use reth_db_api::{
cursor::DbCursorRO, cursor::DbCursorRO,
models::{AccountBeforeTx, BlockNumberAddress}, models::{AccountBeforeTx, BlockNumberAddress},
tables,
transaction::DbTx, transaction::DbTx,
DatabaseError,
}; };
use reth_execution_errors::StateRootError; use reth_execution_errors::StateRootError;
use reth_storage_errors::db::DatabaseError;
use reth_trie::{ use reth_trie::{
hashed_cursor::HashedPostStateCursorFactory, trie_cursor::InMemoryTrieCursorFactory, hashed_cursor::HashedPostStateCursorFactory, trie_cursor::InMemoryTrieCursorFactory,
updates::TrieUpdates, HashedPostState, HashedStorage, KeccakKeyHasher, KeyHasher, StateRoot, updates::TrieUpdates, HashedPostState, HashedStorage, KeccakKeyHasher, KeyHasher, StateRoot,

View File

@@ -1,7 +1,8 @@
use crate::{DatabaseHashedCursorFactory, DatabaseTrieCursorFactory}; use crate::{DatabaseHashedCursorFactory, DatabaseTrieCursorFactory};
use alloy_primitives::{keccak256, map::hash_map, Address, BlockNumber, B256}; use alloy_primitives::{keccak256, map::hash_map, Address, BlockNumber, B256};
use reth_db::{cursor::DbCursorRO, models::BlockNumberAddress, tables, DatabaseError}; use reth_db_api::{
use reth_db_api::transaction::DbTx; cursor::DbCursorRO, models::BlockNumberAddress, tables, transaction::DbTx, DatabaseError,
};
use reth_execution_errors::StorageRootError; use reth_execution_errors::StorageRootError;
use reth_trie::{ use reth_trie::{
hashed_cursor::HashedPostStateCursorFactory, HashedPostState, HashedStorage, StorageRoot, hashed_cursor::HashedPostStateCursorFactory, HashedPostState, HashedStorage, StorageRoot,

Some files were not shown because too many files have changed in this diff Show More