mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 02:49:55 +00:00
chore(db): move mod tables to db-api (#14540)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -7006,7 +7006,6 @@ dependencies = [
|
||||
"alloy-primitives",
|
||||
"arbitrary",
|
||||
"assert_matches",
|
||||
"bytes",
|
||||
"codspeed-criterion-compat",
|
||||
"derive_more",
|
||||
"eyre",
|
||||
@ -7022,18 +7021,14 @@ dependencies = [
|
||||
"reth-nippy-jar",
|
||||
"reth-primitives",
|
||||
"reth-primitives-traits",
|
||||
"reth-prune-types",
|
||||
"reth-stages-types",
|
||||
"reth-storage-errors",
|
||||
"reth-tracing",
|
||||
"reth-trie-common",
|
||||
"rustc-hash 2.1.1",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"strum",
|
||||
"sysinfo",
|
||||
"tempfile",
|
||||
"test-fuzz",
|
||||
"thiserror 2.0.11",
|
||||
]
|
||||
|
||||
@ -9543,7 +9538,6 @@ dependencies = [
|
||||
"alloy-rpc-types-engine",
|
||||
"auto_impl",
|
||||
"reth-chainspec",
|
||||
"reth-db",
|
||||
"reth-db-api",
|
||||
"reth-ethereum-primitives",
|
||||
"reth-execution-types",
|
||||
@ -9778,11 +9772,11 @@ dependencies = [
|
||||
"proptest-arbitrary-interop",
|
||||
"rand 0.8.5",
|
||||
"rayon",
|
||||
"reth-db",
|
||||
"reth-execution-errors",
|
||||
"reth-metrics",
|
||||
"reth-primitives",
|
||||
"reth-provider",
|
||||
"reth-storage-errors",
|
||||
"reth-trie",
|
||||
"reth-trie-common",
|
||||
"reth-trie-db",
|
||||
|
||||
@ -11,8 +11,7 @@ use reth_cli_runner::CliContext;
|
||||
use reth_cli_util::get_secret_key;
|
||||
use reth_config::Config;
|
||||
use reth_consensus::{Consensus, ConsensusError};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
|
||||
use reth_db_api::{cursor::DbCursorRO, tables, transaction::DbTx};
|
||||
use reth_ethereum_primitives::EthPrimitives;
|
||||
use reth_evm::execute::{BlockExecutorProvider, Executor};
|
||||
use reth_network::{BlockDownloaderProvider, NetworkHandle};
|
||||
|
||||
@ -5,8 +5,11 @@ use crate::{
|
||||
use ahash::RandomState;
|
||||
use clap::Parser;
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_db::{DatabaseEnv, RawKey, RawTable, RawValue, TableViewer, Tables};
|
||||
use reth_db_api::{cursor::DbCursorRO, table::Table, transaction::DbTx};
|
||||
use reth_db::DatabaseEnv;
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO, table::Table, transaction::DbTx, RawKey, RawTable, RawValue, TableViewer,
|
||||
Tables,
|
||||
};
|
||||
use reth_db_common::DbTool;
|
||||
use reth_node_builder::{NodeTypesWithDB, NodeTypesWithDBAdapter};
|
||||
use reth_provider::{providers::ProviderNodeTypes, DBProvider};
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
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::{
|
||||
database::Database,
|
||||
table::Table,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
TableViewer, Tables,
|
||||
};
|
||||
use reth_node_builder::NodeTypesWithDB;
|
||||
use reth_provider::{ProviderFactory, StaticFileProviderFactory};
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
use clap::Parser;
|
||||
use reth_db::{open_db_read_only, tables_to_generic, DatabaseEnv, Tables};
|
||||
use reth_db_api::{cursor::DbCursorRO, database::Database, table::Table, transaction::DbTx};
|
||||
use reth_db::{open_db_read_only, tables_to_generic, DatabaseEnv};
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO, database::Database, table::Table, transaction::DbTx, Tables,
|
||||
};
|
||||
use reth_db_common::DbTool;
|
||||
use reth_node_builder::{NodeTypesWithDBAdapter, NodeTypesWithEngine};
|
||||
use reth_node_core::{
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
use alloy_consensus::Header;
|
||||
use alloy_primitives::{hex, BlockHash};
|
||||
use clap::Parser;
|
||||
use reth_db::{
|
||||
static_file::{
|
||||
ColumnSelectorOne, ColumnSelectorTwo, HeaderWithHashMask, ReceiptMask, TransactionMask,
|
||||
},
|
||||
use reth_db::static_file::{
|
||||
ColumnSelectorOne, ColumnSelectorTwo, HeaderWithHashMask, ReceiptMask, TransactionMask,
|
||||
};
|
||||
use reth_db_api::{
|
||||
table::{Decompress, DupSort, Table},
|
||||
tables, RawKey, RawTable, Receipts, TableViewer, Transactions,
|
||||
};
|
||||
use reth_db_api::table::{Decompress, DupSort, Table};
|
||||
use reth_db_common::DbTool;
|
||||
use reth_node_api::{ReceiptTy, TxTy};
|
||||
use reth_node_builder::NodeTypesWithDB;
|
||||
@ -207,8 +207,10 @@ mod tests {
|
||||
use super::*;
|
||||
use alloy_primitives::{Address, B256};
|
||||
use clap::{Args, Parser};
|
||||
use reth_db::{AccountsHistory, HashedAccounts, Headers, StageCheckpoints, StoragesHistory};
|
||||
use reth_db_api::models::{storage_sharded_key::StorageShardedKey, ShardedKey};
|
||||
use reth_db_api::{
|
||||
models::{storage_sharded_key::StorageShardedKey, ShardedKey},
|
||||
AccountsHistory, HashedAccounts, Headers, StageCheckpoints, StoragesHistory,
|
||||
};
|
||||
use std::str::FromStr;
|
||||
|
||||
/// A helper type to parse Args more easily
|
||||
|
||||
@ -3,8 +3,8 @@ use alloy_primitives::hex;
|
||||
use clap::Parser;
|
||||
use eyre::WrapErr;
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_db::{DatabaseEnv, RawValue, TableViewer, Tables};
|
||||
use reth_db_api::{database::Database, table::Table};
|
||||
use reth_db::DatabaseEnv;
|
||||
use reth_db_api::{database::Database, table::Table, RawValue, TableViewer, Tables};
|
||||
use reth_db_common::{DbTool, ListFilter};
|
||||
use reth_node_builder::{NodeTypesWithDBAdapter, NodeTypesWithEngine};
|
||||
use std::{cell::RefCell, sync::Arc};
|
||||
|
||||
@ -5,8 +5,8 @@ use eyre::WrapErr;
|
||||
use human_bytes::human_bytes;
|
||||
use itertools::Itertools;
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_db::{mdbx, static_file::iter_static_files, DatabaseEnv, TableViewer, Tables};
|
||||
use reth_db_api::database::Database;
|
||||
use reth_db::{mdbx, static_file::iter_static_files, DatabaseEnv};
|
||||
use reth_db_api::{database::Database, TableViewer, Tables};
|
||||
use reth_db_common::DbTool;
|
||||
use reth_fs_util as fs;
|
||||
use reth_node_builder::{NodePrimitives, NodeTypesWithDB, NodeTypesWithDBAdapter};
|
||||
|
||||
@ -10,8 +10,10 @@ use ratatui::{
|
||||
widgets::{Block, Borders, List, ListItem, ListState, Paragraph, Wrap},
|
||||
Frame, Terminal,
|
||||
};
|
||||
use reth_db::RawValue;
|
||||
use reth_db_api::table::{Table, TableRow};
|
||||
use reth_db_api::{
|
||||
table::{Table, TableRow},
|
||||
RawValue,
|
||||
};
|
||||
use std::{
|
||||
io,
|
||||
time::{Duration, Instant},
|
||||
|
||||
@ -7,8 +7,7 @@ use reth_chainspec::{EthChainSpec, EthereumHardforks};
|
||||
use reth_cli::chainspec::ChainSpecParser;
|
||||
use reth_config::Config;
|
||||
use reth_consensus::{ConsensusError, FullConsensus};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::transaction::DbTx;
|
||||
use reth_db_api::{tables, transaction::DbTx};
|
||||
use reth_downloaders::{
|
||||
bodies::bodies::BodiesDownloaderBuilder,
|
||||
file_client::{ChunkedFileReader, FileClient, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE},
|
||||
|
||||
@ -4,9 +4,9 @@ use clap::Parser;
|
||||
use reth_chainspec::{EthChainSpec, EthereumHardforks};
|
||||
use reth_cli::chainspec::ChainSpecParser;
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbDupCursorRW},
|
||||
tables,
|
||||
transaction::DbTx,
|
||||
};
|
||||
use reth_provider::{BlockNumReader, HeaderProvider, ProviderError};
|
||||
|
||||
@ -4,8 +4,11 @@ use clap::Parser;
|
||||
use itertools::Itertools;
|
||||
use reth_chainspec::EthChainSpec;
|
||||
use reth_cli::chainspec::ChainSpecParser;
|
||||
use reth_db::{mdbx::tx::Tx, static_file::iter_static_files, tables, DatabaseError};
|
||||
use reth_db_api::transaction::{DbTx, DbTxMut};
|
||||
use reth_db::{mdbx::tx::Tx, static_file::iter_static_files, DatabaseError};
|
||||
use reth_db_api::{
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
};
|
||||
use reth_db_common::{
|
||||
init::{insert_genesis_header, insert_genesis_history, insert_genesis_state},
|
||||
DbTool,
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::setup;
|
||||
use reth_consensus::{noop::NoopConsensus, ConsensusError, FullConsensus};
|
||||
use reth_db::{tables, DatabaseEnv};
|
||||
use reth_db::DatabaseEnv;
|
||||
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_evm::{execute::BlockExecutorProvider, noop::NoopBlockExecutorProvider};
|
||||
@ -15,6 +13,7 @@ use reth_provider::{
|
||||
DatabaseProviderFactory, ProviderFactory,
|
||||
};
|
||||
use reth_stages::{stages::ExecutionStage, Stage, StageCheckpoint, UnwindInput};
|
||||
use std::sync::Arc;
|
||||
use tracing::info;
|
||||
|
||||
pub(crate) async fn dump_execution_stage<N, E, C>(
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::setup;
|
||||
use alloy_primitives::BlockNumber;
|
||||
use eyre::Result;
|
||||
use reth_db::{tables, DatabaseEnv};
|
||||
use reth_db_api::{database::Database, table::TableImporter};
|
||||
use reth_db::DatabaseEnv;
|
||||
use reth_db_api::{database::Database, table::TableImporter, tables};
|
||||
use reth_db_common::DbTool;
|
||||
use reth_node_core::dirs::{ChainPath, DataDirPath};
|
||||
use reth_provider::{
|
||||
@ -12,6 +10,7 @@ use reth_provider::{
|
||||
DatabaseProviderFactory, ProviderFactory,
|
||||
};
|
||||
use reth_stages::{stages::AccountHashingStage, Stage, StageCheckpoint, UnwindInput};
|
||||
use std::sync::Arc;
|
||||
use tracing::info;
|
||||
|
||||
pub(crate) async fn dump_hashing_account_stage<N: ProviderNodeTypes<DB = Arc<DatabaseEnv>>>(
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::setup;
|
||||
use eyre::Result;
|
||||
use reth_db::{tables, DatabaseEnv};
|
||||
use reth_db_api::{database::Database, table::TableImporter};
|
||||
use reth_db::DatabaseEnv;
|
||||
use reth_db_api::{database::Database, table::TableImporter, tables};
|
||||
use reth_db_common::DbTool;
|
||||
use reth_node_core::dirs::{ChainPath, DataDirPath};
|
||||
use reth_provider::{
|
||||
@ -11,6 +9,7 @@ use reth_provider::{
|
||||
DatabaseProviderFactory, ProviderFactory,
|
||||
};
|
||||
use reth_stages::{stages::StorageHashingStage, Stage, StageCheckpoint, UnwindInput};
|
||||
use std::sync::Arc;
|
||||
use tracing::info;
|
||||
|
||||
pub(crate) async fn dump_hashing_storage_stage<N: ProviderNodeTypes<DB = Arc<DatabaseEnv>>>(
|
||||
|
||||
@ -5,8 +5,8 @@ use alloy_primitives::BlockNumber;
|
||||
use eyre::Result;
|
||||
use reth_config::config::EtlConfig;
|
||||
use reth_consensus::noop::NoopConsensus;
|
||||
use reth_db::{tables, DatabaseEnv};
|
||||
use reth_db_api::{database::Database, table::TableImporter};
|
||||
use reth_db::DatabaseEnv;
|
||||
use reth_db_api::{database::Database, table::TableImporter, tables};
|
||||
use reth_db_common::DbTool;
|
||||
use reth_evm::noop::NoopBlockExecutorProvider;
|
||||
use reth_exex::ExExManagerHandle;
|
||||
|
||||
@ -3,9 +3,9 @@ use crate::common::{AccessRights, CliNodeComponents, CliNodeTypes, Environment,
|
||||
use clap::Parser;
|
||||
use reth_chainspec::{EthChainSpec, EthereumHardforks};
|
||||
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::{
|
||||
cursor::DbCursorRO, database::Database, models::ClientVersion, table::TableImporter,
|
||||
cursor::DbCursorRO, database::Database, models::ClientVersion, table::TableImporter, tables,
|
||||
transaction::DbTx,
|
||||
};
|
||||
use reth_db_common::DbTool;
|
||||
|
||||
@ -8,8 +8,10 @@ use proptest::{
|
||||
test_runner::{TestRng, TestRunner},
|
||||
};
|
||||
use proptest_arbitrary_interop::arb;
|
||||
use reth_db::tables;
|
||||
use reth_db_api::table::{DupSort, Table, TableRow};
|
||||
use reth_db_api::{
|
||||
table::{DupSort, Table, TableRow},
|
||||
tables,
|
||||
};
|
||||
use reth_fs_util as fs;
|
||||
use reth_primitives::TransactionSigned;
|
||||
use std::collections::HashSet;
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
use alloy_primitives::{map::HashMap, B256};
|
||||
use reth_db::DatabaseError;
|
||||
use reth_trie::{
|
||||
@ -7,6 +5,7 @@ use reth_trie::{
|
||||
updates::{StorageTrieUpdates, TrieUpdates},
|
||||
BranchNodeCompact, Nibbles,
|
||||
};
|
||||
use std::collections::BTreeSet;
|
||||
use tracing::warn;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
|
||||
use alloy_consensus::BlockHeader;
|
||||
use alloy_primitives::B256;
|
||||
use reth_db::{tables, DatabaseEnv};
|
||||
use reth_db_api::{database::Database, transaction::DbTxMut};
|
||||
use reth_db::DatabaseEnv;
|
||||
use reth_db_api::{database::Database, tables, transaction::DbTxMut};
|
||||
use reth_network_p2p::bodies::response::BlockResponse;
|
||||
use reth_primitives::{BlockBody, SealedBlock, SealedHeader};
|
||||
use reth_primitives_traits::Block;
|
||||
|
||||
@ -7,8 +7,7 @@ use reth_cli_commands::{
|
||||
import::build_import_pipeline,
|
||||
};
|
||||
use reth_consensus::noop::NoopConsensus;
|
||||
use reth_db::tables;
|
||||
use reth_db_api::transaction::DbTx;
|
||||
use reth_db_api::{tables, transaction::DbTx};
|
||||
use reth_downloaders::file_client::{ChunkedFileReader, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE};
|
||||
use reth_node_builder::BlockTy;
|
||||
use reth_node_core::version::SHORT_VERSION;
|
||||
|
||||
@ -6,7 +6,7 @@ use std::path::{Path, PathBuf};
|
||||
use clap::Parser;
|
||||
use reth_cli::chainspec::ChainSpecParser;
|
||||
use reth_cli_commands::common::{AccessRights, CliNodeTypes, Environment, EnvironmentArgs};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::tables;
|
||||
use reth_downloaders::{
|
||||
file_client::{ChunkedFileReader, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE},
|
||||
receipt_file_client::ReceiptFileClient,
|
||||
|
||||
@ -15,7 +15,6 @@ workspace = true
|
||||
# reth
|
||||
reth-chainspec.workspace = true
|
||||
reth-exex-types.workspace = true
|
||||
reth-db.workspace = true
|
||||
reth-db-api.workspace = true
|
||||
reth-errors.workspace = true
|
||||
reth-provider.workspace = true
|
||||
|
||||
@ -2,7 +2,7 @@ use crate::{segments::SegmentSet, Pruner};
|
||||
use alloy_eips::eip2718::Encodable2718;
|
||||
use reth_chainspec::MAINNET;
|
||||
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_primitives_traits::NodePrimitives;
|
||||
use reth_provider::{
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
use std::{fmt::Debug, ops::RangeBounds};
|
||||
|
||||
use crate::PruneLimiter;
|
||||
use reth_db::{
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW, RangeWalker},
|
||||
table::{Table, TableRow},
|
||||
transaction::DbTxMut,
|
||||
DatabaseError,
|
||||
};
|
||||
use std::{fmt::Debug, ops::RangeBounds};
|
||||
use tracing::debug;
|
||||
|
||||
pub(crate) trait DbTxPruneExt: DbTxMut {
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
use reth_db::DatabaseError;
|
||||
use reth_errors::RethError;
|
||||
use reth_errors::{DatabaseError, RethError};
|
||||
use reth_provider::ProviderError;
|
||||
use reth_prune_types::PruneSegmentError;
|
||||
use thiserror::Error;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
//! node after static file producer has finished
|
||||
|
||||
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_provider::{
|
||||
errors::provider::ProviderResult, BlockReader, DBProvider, NodePrimitivesProvider,
|
||||
@ -88,7 +88,7 @@ mod tests {
|
||||
FoldWhile::{Continue, Done},
|
||||
Itertools,
|
||||
};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::tables;
|
||||
use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader};
|
||||
use reth_prune_types::{
|
||||
PruneCheckpoint, PruneInterruptReason, PruneMode, PruneProgress, PruneSegment,
|
||||
|
||||
@ -3,7 +3,7 @@ use crate::segments::{
|
||||
UserReceipts,
|
||||
};
|
||||
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_provider::{
|
||||
providers::StaticFileProvider, BlockReader, DBProvider, PruneCheckpointWriter,
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
use std::num::NonZeroUsize;
|
||||
|
||||
use crate::{
|
||||
db_ext::DbTxPruneExt,
|
||||
segments::{PruneInput, Segment},
|
||||
@ -7,7 +5,7 @@ use crate::{
|
||||
};
|
||||
use alloy_primitives::BlockNumber;
|
||||
use itertools::Itertools;
|
||||
use reth_db::{
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, RangeWalker},
|
||||
tables,
|
||||
transaction::DbTxMut,
|
||||
@ -17,6 +15,7 @@ use reth_prune_types::{
|
||||
PruneMode, PrunePurpose, PruneSegment, SegmentOutput, SegmentOutputCheckpoint,
|
||||
};
|
||||
use reth_static_file_types::StaticFileSegment;
|
||||
use std::num::NonZeroUsize;
|
||||
use tracing::trace;
|
||||
|
||||
/// Number of header tables to prune in one step
|
||||
@ -199,8 +198,7 @@ mod tests {
|
||||
};
|
||||
use alloy_primitives::{BlockNumber, B256, U256};
|
||||
use assert_matches::assert_matches;
|
||||
use reth_db::tables;
|
||||
use reth_db_api::transaction::DbTx;
|
||||
use reth_db_api::{tables, transaction::DbTx};
|
||||
use reth_provider::{
|
||||
DatabaseProviderFactory, PruneCheckpointReader, PruneCheckpointWriter,
|
||||
StaticFileProviderFactory,
|
||||
|
||||
@ -2,7 +2,7 @@ use crate::{
|
||||
segments::{PruneInput, Segment},
|
||||
PrunerError,
|
||||
};
|
||||
use reth_db::{table::Value, transaction::DbTxMut};
|
||||
use reth_db_api::{table::Value, transaction::DbTxMut};
|
||||
use reth_primitives_traits::NodePrimitives;
|
||||
use reth_provider::{
|
||||
errors::provider::ProviderResult, providers::StaticFileProvider, BlockReader, DBProvider,
|
||||
|
||||
@ -3,7 +3,7 @@ use crate::{
|
||||
segments::{PruneInput, Segment},
|
||||
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_provider::{
|
||||
providers::StaticFileProvider, BlockReader, DBProvider, StaticFileProviderFactory,
|
||||
@ -98,7 +98,7 @@ mod tests {
|
||||
FoldWhile::{Continue, Done},
|
||||
Itertools,
|
||||
};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::tables;
|
||||
use reth_provider::{
|
||||
DatabaseProviderFactory, PruneCheckpointReader, PruneCheckpointWriter,
|
||||
StaticFileProviderFactory,
|
||||
|
||||
@ -4,8 +4,7 @@ use crate::{
|
||||
PrunerError,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use reth_db::{tables, transaction::DbTxMut};
|
||||
use reth_db_api::models::ShardedKey;
|
||||
use reth_db_api::{models::ShardedKey, tables, transaction::DbTxMut};
|
||||
use reth_provider::DBProvider;
|
||||
use reth_prune_types::{
|
||||
PruneMode, PrunePurpose, PruneSegment, SegmentOutput, SegmentOutputCheckpoint,
|
||||
@ -133,7 +132,7 @@ mod tests {
|
||||
};
|
||||
use alloy_primitives::{BlockNumber, B256};
|
||||
use assert_matches::assert_matches;
|
||||
use reth_db::{tables, BlockNumberList};
|
||||
use reth_db_api::{tables, BlockNumberList};
|
||||
use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader};
|
||||
use reth_prune_types::{
|
||||
PruneCheckpoint, PruneInterruptReason, PruneMode, PruneProgress, PruneSegment,
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
use alloy_primitives::BlockNumber;
|
||||
use reth_db::{BlockNumberList, RawKey, RawTable, RawValue};
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW},
|
||||
models::ShardedKey,
|
||||
table::Table,
|
||||
transaction::DbTxMut,
|
||||
DatabaseError,
|
||||
BlockNumberList, DatabaseError, RawKey, RawTable, RawValue,
|
||||
};
|
||||
use reth_provider::DBProvider;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ use crate::{
|
||||
segments::{PruneInput, Segment},
|
||||
PrunerError,
|
||||
};
|
||||
use reth_db::{table::Value, transaction::DbTxMut};
|
||||
use reth_db_api::{table::Value, transaction::DbTxMut};
|
||||
use reth_primitives_traits::NodePrimitives;
|
||||
use reth_provider::{
|
||||
errors::provider::ProviderResult, BlockReader, DBProvider, NodePrimitivesProvider,
|
||||
|
||||
@ -4,7 +4,7 @@ use crate::{
|
||||
PrunerError,
|
||||
};
|
||||
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_provider::{
|
||||
BlockReader, DBProvider, NodePrimitivesProvider, PruneCheckpointWriter, TransactionsProvider,
|
||||
@ -230,8 +230,7 @@ mod tests {
|
||||
use crate::segments::{PruneInput, PruneLimiter, ReceiptsByLogs, Segment};
|
||||
use alloy_primitives::B256;
|
||||
use assert_matches::assert_matches;
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
|
||||
use reth_db_api::{cursor::DbCursorRO, tables, transaction::DbTx};
|
||||
use reth_primitives_traits::InMemorySize;
|
||||
use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader, TransactionsProvider};
|
||||
use reth_prune_types::{PruneMode, PruneSegment, ReceiptsLogPruneConfig};
|
||||
|
||||
@ -3,7 +3,7 @@ use crate::{
|
||||
segments::{PruneInput, Segment},
|
||||
PrunerError,
|
||||
};
|
||||
use reth_db::{tables, transaction::DbTxMut};
|
||||
use reth_db_api::{tables, transaction::DbTxMut};
|
||||
use reth_provider::{BlockReader, DBProvider, TransactionsProvider};
|
||||
use reth_prune_types::{
|
||||
PruneMode, PrunePurpose, PruneSegment, SegmentOutput, SegmentOutputCheckpoint,
|
||||
@ -89,7 +89,7 @@ mod tests {
|
||||
FoldWhile::{Continue, Done},
|
||||
Itertools,
|
||||
};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::tables;
|
||||
use reth_primitives_traits::SignedTransaction;
|
||||
use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader};
|
||||
use reth_prune_types::{PruneCheckpoint, PruneMode, PruneProgress, PruneSegment};
|
||||
|
||||
@ -4,8 +4,11 @@ use crate::{
|
||||
PrunerError,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use reth_db::{tables, transaction::DbTxMut};
|
||||
use reth_db_api::models::{storage_sharded_key::StorageShardedKey, BlockNumberAddress};
|
||||
use reth_db_api::{
|
||||
models::{storage_sharded_key::StorageShardedKey, BlockNumberAddress},
|
||||
tables,
|
||||
transaction::DbTxMut,
|
||||
};
|
||||
use reth_provider::DBProvider;
|
||||
use reth_prune_types::{PruneMode, PrunePurpose, PruneSegment, SegmentOutputCheckpoint};
|
||||
use rustc_hash::FxHashMap;
|
||||
@ -136,7 +139,7 @@ mod tests {
|
||||
};
|
||||
use alloy_primitives::{BlockNumber, B256};
|
||||
use assert_matches::assert_matches;
|
||||
use reth_db::{tables, BlockNumberList};
|
||||
use reth_db_api::{tables, BlockNumberList};
|
||||
use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader};
|
||||
use reth_prune_types::{PruneCheckpoint, PruneMode, PruneProgress, PruneSegment};
|
||||
use reth_stages::test_utils::{StorageKind, TestStageDB};
|
||||
|
||||
@ -5,7 +5,7 @@ use crate::{
|
||||
};
|
||||
use alloy_eips::eip2718::Encodable2718;
|
||||
use rayon::prelude::*;
|
||||
use reth_db::{tables, transaction::DbTxMut};
|
||||
use reth_db_api::{tables, transaction::DbTxMut};
|
||||
use reth_provider::{BlockReader, DBProvider};
|
||||
use reth_prune_types::{PruneMode, PrunePurpose, PruneSegment, SegmentOutputCheckpoint};
|
||||
use tracing::{instrument, trace};
|
||||
@ -116,7 +116,7 @@ mod tests {
|
||||
FoldWhile::{Continue, Done},
|
||||
Itertools,
|
||||
};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::tables;
|
||||
use reth_primitives_traits::SignedTransaction;
|
||||
use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader};
|
||||
use reth_prune_types::{
|
||||
|
||||
@ -2,9 +2,8 @@
|
||||
|
||||
use super::constants;
|
||||
use alloy_primitives::BlockNumber;
|
||||
use reth_db::tables;
|
||||
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::{
|
||||
stages::{AccountHashingStage, SeedOpts},
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
#![allow(unreachable_pub)]
|
||||
use alloy_primitives::{Address, B256, U256};
|
||||
use itertools::concat;
|
||||
use reth_db::{tables, test_utils::TempDatabase, Database, DatabaseEnv};
|
||||
use reth_db::{test_utils::TempDatabase, Database, DatabaseEnv};
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO,
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
};
|
||||
use reth_primitives::{Account, SealedBlock, SealedHeader};
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
use super::missing_static_data_error;
|
||||
use futures_util::TryStreamExt;
|
||||
use reth_db::{tables, transaction::DbTx};
|
||||
use reth_db_api::{cursor::DbCursorRO, transaction::DbTxMut};
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO,
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
};
|
||||
use reth_network_p2p::bodies::{downloader::BodyDownloader, response::BlockResponse};
|
||||
use reth_primitives::StaticFileSegment;
|
||||
use reth_provider::{
|
||||
@ -36,19 +39,19 @@ use tracing::*;
|
||||
///
|
||||
/// The bodies are processed and data is inserted into these tables:
|
||||
///
|
||||
/// - [`BlockOmmers`][reth_db::tables::BlockOmmers]
|
||||
/// - [`BlockBodies`][reth_db::tables::BlockBodyIndices]
|
||||
/// - [`Transactions`][reth_db::tables::Transactions]
|
||||
/// - [`TransactionBlocks`][reth_db::tables::TransactionBlocks]
|
||||
/// - [`BlockOmmers`][reth_db_api::tables::BlockOmmers]
|
||||
/// - [`BlockBodies`][reth_db_api::tables::BlockBodyIndices]
|
||||
/// - [`Transactions`][reth_db_api::tables::Transactions]
|
||||
/// - [`TransactionBlocks`][reth_db_api::tables::TransactionBlocks]
|
||||
///
|
||||
/// # Genesis
|
||||
///
|
||||
/// This stage expects that the genesis has been inserted into the appropriate tables:
|
||||
///
|
||||
/// - The header tables (see [`HeaderStage`][crate::stages::HeaderStage])
|
||||
/// - The [`BlockOmmers`][reth_db::tables::BlockOmmers] table
|
||||
/// - The [`BlockBodies`][reth_db::tables::BlockBodyIndices] table
|
||||
/// - The [`Transactions`][reth_db::tables::Transactions] table
|
||||
/// - The [`BlockOmmers`][reth_db_api::tables::BlockOmmers] table
|
||||
/// - The [`BlockBodies`][reth_db_api::tables::BlockBodyIndices] table
|
||||
/// - The [`Transactions`][reth_db_api::tables::Transactions] table
|
||||
#[derive(Debug)]
|
||||
pub struct BodyStage<D: BodyDownloader> {
|
||||
/// The body downloader.
|
||||
|
||||
@ -674,8 +674,10 @@ mod tests {
|
||||
use alloy_rlp::Decodable;
|
||||
use assert_matches::assert_matches;
|
||||
use reth_chainspec::ChainSpecBuilder;
|
||||
use reth_db::transaction::DbTx;
|
||||
use reth_db_api::{models::AccountBeforeTx, transaction::DbTxMut};
|
||||
use reth_db_api::{
|
||||
models::AccountBeforeTx,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
};
|
||||
use reth_ethereum_consensus::EthBeaconConsensus;
|
||||
use reth_evm::execute::BasicBlockExecutorProvider;
|
||||
use reth_evm_ethereum::execute::EthExecutionStrategyFactory;
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
use alloy_primitives::{keccak256, B256};
|
||||
use itertools::Itertools;
|
||||
use reth_config::config::{EtlConfig, HashingConfig};
|
||||
use reth_db::{tables, RawKey, RawTable, RawValue};
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW},
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
RawKey, RawTable, RawValue,
|
||||
};
|
||||
use reth_etl::Collector;
|
||||
use reth_primitives::Account;
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
use alloy_primitives::{bytes::BufMut, keccak256, B256};
|
||||
use itertools::Itertools;
|
||||
use reth_config::config::{EtlConfig, HashingConfig};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbDupCursorRW},
|
||||
models::{BlockNumberAddress, CompactU256},
|
||||
table::Decompress,
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
};
|
||||
use reth_etl::Collector;
|
||||
|
||||
@ -4,11 +4,12 @@ use alloy_primitives::{BlockHash, BlockNumber, Bytes, B256};
|
||||
use futures_util::StreamExt;
|
||||
use reth_config::config::EtlConfig;
|
||||
use reth_consensus::HeaderValidator;
|
||||
use reth_db::{table::Value, tables, transaction::DbTx, RawKey, RawTable, RawValue};
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW},
|
||||
transaction::DbTxMut,
|
||||
DbTxUnwindExt,
|
||||
table::Value,
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
DbTxUnwindExt, RawKey, RawTable, RawValue,
|
||||
};
|
||||
use reth_etl::Collector;
|
||||
use reth_network_p2p::headers::{downloader::HeaderDownloader, error::HeadersDownloaderError};
|
||||
@ -36,7 +37,7 @@ use tracing::*;
|
||||
/// the perceived highest block on the network.
|
||||
///
|
||||
/// 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
|
||||
/// proceeds to push them sequentially to static files. The stage checkpoint is not updated until
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
use super::{collect_history_indices, load_history_indices};
|
||||
use alloy_primitives::Address;
|
||||
use reth_config::config::{EtlConfig, IndexHistoryConfig};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{models::ShardedKey, table::Decode, transaction::DbTxMut};
|
||||
use reth_db_api::{models::ShardedKey, table::Decode, tables, transaction::DbTxMut};
|
||||
use reth_provider::{DBProvider, HistoryWriter, PruneCheckpointReader, PruneCheckpointWriter};
|
||||
use reth_prune_types::{PruneCheckpoint, PruneMode, PrunePurpose, PruneSegment};
|
||||
use reth_stages_api::{
|
||||
@ -150,7 +149,6 @@ mod tests {
|
||||
};
|
||||
use alloy_primitives::{address, BlockNumber, B256};
|
||||
use itertools::Itertools;
|
||||
use reth_db::BlockNumberList;
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO,
|
||||
models::{
|
||||
@ -158,6 +156,7 @@ mod tests {
|
||||
StoredBlockBodyIndices,
|
||||
},
|
||||
transaction::DbTx,
|
||||
BlockNumberList,
|
||||
};
|
||||
use reth_provider::{providers::StaticFileWriter, DatabaseProviderFactory};
|
||||
use reth_testing_utils::generators::{
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
use super::{collect_history_indices, load_history_indices};
|
||||
use crate::{StageCheckpoint, StageId};
|
||||
use reth_config::config::{EtlConfig, IndexHistoryConfig};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
models::{storage_sharded_key::StorageShardedKey, AddressStorageKey, BlockNumberAddress},
|
||||
table::Decode,
|
||||
tables,
|
||||
transaction::DbTxMut,
|
||||
};
|
||||
use reth_provider::{DBProvider, HistoryWriter, PruneCheckpointReader, PruneCheckpointWriter};
|
||||
@ -155,7 +155,6 @@ mod tests {
|
||||
};
|
||||
use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256};
|
||||
use itertools::Itertools;
|
||||
use reth_db::BlockNumberList;
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO,
|
||||
models::{
|
||||
@ -163,6 +162,7 @@ mod tests {
|
||||
StoredBlockBodyIndices,
|
||||
},
|
||||
transaction::DbTx,
|
||||
BlockNumberList,
|
||||
};
|
||||
use reth_primitives::StorageEntry;
|
||||
use reth_provider::{providers::StaticFileWriter, DatabaseProviderFactory};
|
||||
|
||||
@ -2,8 +2,10 @@ use alloy_consensus::BlockHeader;
|
||||
use alloy_primitives::{BlockNumber, Sealable, B256};
|
||||
use reth_codecs::Compact;
|
||||
use reth_consensus::ConsensusError;
|
||||
use reth_db::tables;
|
||||
use reth_db_api::transaction::{DbTx, DbTxMut};
|
||||
use reth_db_api::{
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
};
|
||||
use reth_primitives::{GotExpected, SealedHeader};
|
||||
use reth_provider::{
|
||||
DBProvider, HeaderProvider, ProviderError, StageCheckpointReader, StageCheckpointWriter,
|
||||
|
||||
@ -48,14 +48,13 @@ mod tests {
|
||||
use alloy_primitives::{address, hex_literal::hex, keccak256, BlockNumber, B256, U256};
|
||||
use alloy_rlp::Decodable;
|
||||
use reth_chainspec::ChainSpecBuilder;
|
||||
use reth_db::{
|
||||
mdbx::{cursor::Cursor, RW},
|
||||
tables, AccountsHistory,
|
||||
};
|
||||
use reth_db::mdbx::{cursor::Cursor, RW};
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW},
|
||||
table::Table,
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
AccountsHistory,
|
||||
};
|
||||
use reth_ethereum_consensus::EthBeaconConsensus;
|
||||
use reth_evm_ethereum::execute::EthExecutorProvider;
|
||||
|
||||
@ -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_provider::{
|
||||
BlockReader, DBProvider, PruneCheckpointReader, PruneCheckpointWriter,
|
||||
|
||||
@ -5,7 +5,7 @@ use downloader::{DownloaderError, S3DownloaderResponse};
|
||||
mod filelist;
|
||||
use filelist::DOWNLOAD_FILE_LIST;
|
||||
|
||||
use reth_db::transaction::DbTxMut;
|
||||
use reth_db_api::transaction::DbTxMut;
|
||||
use reth_primitives::StaticFileSegment;
|
||||
use reth_provider::{
|
||||
DBProvider, StageCheckpointReader, StageCheckpointWriter, StaticFileProviderFactory,
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
use alloy_primitives::{Address, TxNumber};
|
||||
use reth_config::config::SenderRecoveryConfig;
|
||||
use reth_consensus::ConsensusError;
|
||||
use reth_db::{static_file::TransactionMask, table::Value, tables, RawValue};
|
||||
use reth_db::static_file::TransactionMask;
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRW,
|
||||
table::Value,
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
DbTxUnwindExt,
|
||||
DbTxUnwindExt, RawValue,
|
||||
};
|
||||
use reth_primitives::{GotExpected, NodePrimitives, StaticFileSegment};
|
||||
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,
|
||||
/// 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)]
|
||||
pub struct SenderRecoveryStage {
|
||||
/// The size of inserted items after which the control
|
||||
@ -70,9 +72,9 @@ where
|
||||
}
|
||||
|
||||
/// 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
|
||||
/// 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> {
|
||||
if input.target_reached() {
|
||||
return Ok(ExecOutput::done(input.checkpoint()))
|
||||
|
||||
@ -2,10 +2,12 @@ use alloy_eips::eip2718::Encodable2718;
|
||||
use alloy_primitives::{TxHash, TxNumber};
|
||||
use num_traits::Zero;
|
||||
use reth_config::config::{EtlConfig, TransactionLookupConfig};
|
||||
use reth_db::{table::Value, tables, RawKey, RawValue};
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW},
|
||||
table::Value,
|
||||
tables,
|
||||
transaction::DbTxMut,
|
||||
RawKey, RawValue,
|
||||
};
|
||||
use reth_etl::Collector;
|
||||
use reth_primitives::NodePrimitives;
|
||||
@ -259,7 +261,7 @@ mod tests {
|
||||
};
|
||||
use alloy_primitives::{BlockNumber, B256};
|
||||
use assert_matches::assert_matches;
|
||||
use reth_db::transaction::DbTx;
|
||||
use reth_db_api::transaction::DbTx;
|
||||
use reth_primitives::SealedBlock;
|
||||
use reth_provider::{
|
||||
providers::StaticFileWriter, BlockBodyIndicesProvider, DatabaseProviderFactory,
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
//! Utils for `stages`.
|
||||
use alloy_primitives::{BlockNumber, TxNumber};
|
||||
use reth_config::config::EtlConfig;
|
||||
use reth_db::BlockNumberList;
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW},
|
||||
models::sharded_key::NUM_OF_INDICES_IN_SHARD,
|
||||
table::{Decompress, Table},
|
||||
transaction::{DbTx, DbTxMut},
|
||||
DatabaseError,
|
||||
BlockNumberList, DatabaseError,
|
||||
};
|
||||
use reth_etl::Collector;
|
||||
use reth_primitives::StaticFileSegment;
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
use alloy_primitives::{keccak256, Address, BlockNumber, TxHash, TxNumber, B256, U256};
|
||||
use reth_chainspec::MAINNET;
|
||||
use reth_db::{
|
||||
tables,
|
||||
test_utils::{create_test_rw_db, create_test_rw_db_with_path, create_test_static_files_dir},
|
||||
DatabaseEnv,
|
||||
};
|
||||
@ -11,6 +10,7 @@ use reth_db_api::{
|
||||
database::Database,
|
||||
models::{AccountBeforeTx, StoredBlockBodyIndices},
|
||||
table::Table,
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
DatabaseError as DbError,
|
||||
};
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
use crate::segments::Segment;
|
||||
use alloy_primitives::BlockNumber;
|
||||
use reth_codecs::Compact;
|
||||
use reth_db::{table::Value, tables};
|
||||
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
|
||||
use reth_db_api::{cursor::DbCursorRO, table::Value, tables, transaction::DbTx};
|
||||
use reth_primitives_traits::NodePrimitives;
|
||||
use reth_provider::{providers::StaticFileWriter, DBProvider, StaticFileProviderFactory};
|
||||
use reth_static_file_types::StaticFileSegment;
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
use crate::segments::Segment;
|
||||
use alloy_primitives::BlockNumber;
|
||||
use reth_codecs::Compact;
|
||||
use reth_db::{table::Value, tables};
|
||||
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
|
||||
use reth_db_api::{cursor::DbCursorRO, table::Value, tables, transaction::DbTx};
|
||||
use reth_primitives_traits::NodePrimitives;
|
||||
use reth_provider::{
|
||||
providers::StaticFileWriter, BlockReader, DBProvider, StaticFileProviderFactory,
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
use crate::segments::Segment;
|
||||
use alloy_primitives::BlockNumber;
|
||||
use reth_codecs::Compact;
|
||||
use reth_db::{table::Value, tables};
|
||||
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
|
||||
use reth_db_api::{cursor::DbCursorRO, table::Value, tables, transaction::DbTx};
|
||||
use reth_primitives_traits::NodePrimitives;
|
||||
use reth_provider::{
|
||||
providers::StaticFileWriter, BlockReader, DBProvider, StaticFileProviderFactory,
|
||||
|
||||
@ -5,7 +5,7 @@ use alloy_primitives::BlockNumber;
|
||||
use parking_lot::Mutex;
|
||||
use rayon::prelude::*;
|
||||
use reth_codecs::Compact;
|
||||
use reth_db::table::Value;
|
||||
use reth_db_api::table::Value;
|
||||
use reth_primitives_traits::NodePrimitives;
|
||||
use reth_provider::{
|
||||
providers::StaticFileWriter, BlockReader, ChainStateBlockReader, DBProvider,
|
||||
|
||||
@ -18,7 +18,7 @@ reth-db-models = { workspace = true, features = ["reth-codec"] }
|
||||
reth-primitives = { workspace = true, features = ["reth-codec"] }
|
||||
reth-primitives-traits = { workspace = true, features = ["serde", "reth-codec"] }
|
||||
reth-stages-types = { workspace = true, features = ["serde", "reth-codec"] }
|
||||
reth-prune-types = { workspace = true, features = ["reth-codec"] }
|
||||
reth-prune-types = { workspace = true, features = ["serde", "reth-codec"] }
|
||||
reth-storage-errors.workspace = true
|
||||
reth-trie-common.workspace = true
|
||||
|
||||
@ -96,3 +96,4 @@ op = [
|
||||
"reth-codecs/op",
|
||||
"reth-primitives-traits/op",
|
||||
]
|
||||
bench = []
|
||||
|
||||
@ -61,17 +61,27 @@
|
||||
|
||||
/// Common types used throughout the abstraction.
|
||||
pub mod common;
|
||||
|
||||
/// Cursor database traits.
|
||||
pub mod cursor;
|
||||
|
||||
/// Database traits.
|
||||
pub mod database;
|
||||
|
||||
/// Database metrics trait extensions.
|
||||
pub mod database_metrics;
|
||||
|
||||
pub mod mock;
|
||||
|
||||
/// Table traits
|
||||
pub mod table;
|
||||
|
||||
pub mod tables;
|
||||
pub use tables::*;
|
||||
|
||||
/// Transaction database traits.
|
||||
pub mod transaction;
|
||||
|
||||
/// Re-exports
|
||||
pub use reth_storage_errors::db::{DatabaseError, DatabaseWriteOperation};
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
//! Curates the input coming from the fuzzer for certain types.
|
||||
|
||||
use reth_db_api::models::IntegerList;
|
||||
use crate::models::IntegerList;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Makes sure that the list provided by the fuzzer is not empty and pre-sorted
|
||||
@ -14,7 +14,7 @@ macro_rules! impl_fuzzer_with_input {
|
||||
#[allow(non_snake_case)]
|
||||
#[cfg(any(test, feature = "bench"))]
|
||||
pub mod $name {
|
||||
use reth_db_api::table;
|
||||
use crate::table;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use reth_primitives_traits::*;
|
||||
@ -23,7 +23,7 @@ macro_rules! impl_fuzzer_with_input {
|
||||
use super::inputs::*;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use reth_db_api::models::*;
|
||||
use crate::models::*;
|
||||
|
||||
/// Encodes and decodes table types returning its encoded size and the decoded object.
|
||||
/// This method is used for benchmarking, so its parameter should be the actual type that is being tested.
|
||||
@ -5,7 +5,7 @@
|
||||
//! This module defines the tables in reth, as well as some table-related abstractions:
|
||||
//!
|
||||
//! - [`codecs`] integrates different codecs into [`Encode`] and [`Decode`]
|
||||
//! - [`models`](reth_db_api::models) defines the values written to tables
|
||||
//! - [`models`](crate::models) defines the values written to tables
|
||||
//!
|
||||
//! # Database Tour
|
||||
//!
|
||||
@ -16,12 +16,7 @@ pub mod codecs;
|
||||
mod raw;
|
||||
pub use raw::{RawDupSort, RawKey, RawTable, RawValue, TableRawRow};
|
||||
|
||||
#[cfg(feature = "mdbx")]
|
||||
pub(crate) mod utils;
|
||||
|
||||
use alloy_consensus::Header;
|
||||
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256};
|
||||
use reth_db_api::{
|
||||
use crate::{
|
||||
models::{
|
||||
accounts::BlockNumberAddress,
|
||||
blocks::{HeaderHash, StoredBlockOmmers},
|
||||
@ -31,6 +26,8 @@ use reth_db_api::{
|
||||
},
|
||||
table::{Decode, DupSort, Encode, Table, TableInfo},
|
||||
};
|
||||
use alloy_consensus::Header;
|
||||
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256};
|
||||
use reth_primitives::{Receipt, StorageEntry, TransactionSigned};
|
||||
use reth_primitives_traits::{Account, Bytecode};
|
||||
use reth_prune_types::{PruneCheckpoint, PruneSegment};
|
||||
@ -54,8 +51,10 @@ pub enum TableType {
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use reth_db::{TableViewer, Tables};
|
||||
/// use reth_db_api::table::{DupSort, Table};
|
||||
/// use reth_db_api::{
|
||||
/// table::{DupSort, Table},
|
||||
/// TableViewer, Tables,
|
||||
/// };
|
||||
///
|
||||
/// struct MyTableViewer;
|
||||
///
|
||||
@ -143,9 +142,9 @@ macro_rules! tables {
|
||||
}
|
||||
}
|
||||
|
||||
impl$(<$($generic),*>)? reth_db_api::table::Table for $name$(<$($generic),*>)?
|
||||
impl$(<$($generic),*>)? $crate::table::Table for $name$(<$($generic),*>)?
|
||||
where
|
||||
$value: reth_db_api::table::Value + 'static
|
||||
$value: $crate::table::Value + 'static
|
||||
$($(,$generic: Send + Sync)*)?
|
||||
{
|
||||
const NAME: &'static str = table_names::$name;
|
||||
@ -163,9 +162,6 @@ macro_rules! tables {
|
||||
)*
|
||||
|
||||
// Tables enum.
|
||||
// NOTE: the ordering of the enum does not matter, but it is assumed that the discriminants
|
||||
// start at 0 and increment by 1 for each variant (the default behavior).
|
||||
// See for example `reth_db::implementation::mdbx::tx::Tx::db_handles`.
|
||||
|
||||
/// A table in the database.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
@ -281,8 +277,7 @@ macro_rules! tables {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use reth_db::{Tables, tables_to_generic};
|
||||
/// use reth_db_api::table::Table;
|
||||
/// use reth_db_api::{table::Table, Tables, tables_to_generic};
|
||||
///
|
||||
/// let table = Tables::Headers;
|
||||
/// let result = tables_to_generic!(table, |GenericTable| <GenericTable as Table>::NAME);
|
||||
@ -553,11 +548,11 @@ impl Encode for ChainStateKey {
|
||||
}
|
||||
|
||||
impl Decode for ChainStateKey {
|
||||
fn decode(value: &[u8]) -> Result<Self, reth_db_api::DatabaseError> {
|
||||
fn decode(value: &[u8]) -> Result<Self, crate::DatabaseError> {
|
||||
match value {
|
||||
[0] => Ok(Self::LastFinalizedBlock),
|
||||
[1] => Ok(Self::LastSafeBlockBlock),
|
||||
_ => Err(reth_db_api::DatabaseError::Decode),
|
||||
_ => Err(crate::DatabaseError::Decode),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
use crate::DatabaseError;
|
||||
use reth_db_api::table::{Compress, Decode, Decompress, DupSort, Encode, Key, Table, Value};
|
||||
use crate::{
|
||||
table::{Compress, Decode, Decompress, DupSort, Encode, Key, Table, Value},
|
||||
DatabaseError,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Tuple with `RawKey<T::Key>` and `RawValue<T::Value>`.
|
||||
@ -11,7 +11,6 @@ repository.workspace = true
|
||||
# reth
|
||||
reth-chainspec.workspace = true
|
||||
reth-primitives.workspace = true
|
||||
reth-db = { workspace = true, features = ["mdbx"] }
|
||||
reth-db-api.workspace = true
|
||||
reth-provider.workspace = true
|
||||
reth-config.workspace = true
|
||||
@ -41,6 +40,7 @@ serde_json.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
reth-db = { workspace = true, features = ["mdbx"] }
|
||||
reth-primitives-traits.workspace = true
|
||||
reth-provider = { workspace = true, features = ["test-utils"] }
|
||||
alloy-consensus.workspace = true
|
||||
|
||||
@ -2,13 +2,12 @@
|
||||
|
||||
use boyer_moore_magiclen::BMByte;
|
||||
use eyre::Result;
|
||||
use reth_db::{RawTable, TableRawRow};
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbDupCursorRO},
|
||||
database::Database,
|
||||
table::{Decode, Decompress, DupSort, Table, TableRow},
|
||||
transaction::{DbTx, DbTxMut},
|
||||
DatabaseError,
|
||||
DatabaseError, RawTable, TableRawRow,
|
||||
};
|
||||
use reth_fs_util as fs;
|
||||
use reth_node_types::NodeTypesWithDB;
|
||||
|
||||
@ -6,8 +6,7 @@ use alloy_primitives::{map::HashMap, Address, B256, U256};
|
||||
use reth_chainspec::EthChainSpec;
|
||||
use reth_codecs::Compact;
|
||||
use reth_config::config::EtlConfig;
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{transaction::DbTxMut, DatabaseError};
|
||||
use reth_db_api::{tables, transaction::DbTxMut, DatabaseError};
|
||||
use reth_etl::Collector;
|
||||
use reth_primitives::{
|
||||
Account, Bytecode, GotExpected, NodePrimitives, StaticFileSegment, StorageEntry,
|
||||
|
||||
@ -15,32 +15,23 @@ workspace = true
|
||||
# reth
|
||||
reth-db-api.workspace = true
|
||||
reth-primitives = { workspace = true, features = ["reth-codec"] }
|
||||
reth-primitives-traits = { workspace = true, features = ["reth-codec"] }
|
||||
reth-fs-util.workspace = true
|
||||
reth-storage-errors.workspace = true
|
||||
reth-nippy-jar.workspace = true
|
||||
reth-prune-types = { workspace = true, features = ["reth-codec", "serde"] }
|
||||
reth-stages-types.workspace = true
|
||||
reth-trie-common = { workspace = true, features = ["serde"] }
|
||||
reth-tracing.workspace = true
|
||||
|
||||
# ethereum
|
||||
alloy-primitives.workspace = true
|
||||
alloy-consensus.workspace = true
|
||||
|
||||
# mdbx
|
||||
reth-libmdbx = { workspace = true, optional = true, features = ["return-borrowed", "read-tx-timeouts"] }
|
||||
eyre = { workspace = true, optional = true }
|
||||
|
||||
# codecs
|
||||
serde = { workspace = true, default-features = false }
|
||||
|
||||
# metrics
|
||||
reth-metrics = { workspace = true, optional = true }
|
||||
metrics = { workspace = true, optional = true }
|
||||
|
||||
# misc
|
||||
bytes.workspace = true
|
||||
page_size = { version = "0.6.0", optional = true }
|
||||
thiserror.workspace = true
|
||||
tempfile = { workspace = true, optional = true }
|
||||
@ -55,11 +46,13 @@ strum = { workspace = true, features = ["derive"], optional = true }
|
||||
[dev-dependencies]
|
||||
# reth libs with arbitrary
|
||||
reth-primitives = { workspace = true, features = ["arbitrary"] }
|
||||
reth-primitives-traits = { workspace = true, features = ["reth-codec"] }
|
||||
serde_json.workspace = true
|
||||
tempfile.workspace = true
|
||||
test-fuzz.workspace = true
|
||||
parking_lot.workspace = true
|
||||
|
||||
alloy-consensus.workspace = true
|
||||
serde.workspace = true
|
||||
pprof = { workspace = true, features = ["flamegraph", "frame-pointer", "criterion"] }
|
||||
criterion.workspace = true
|
||||
|
||||
@ -85,23 +78,17 @@ test-utils = [
|
||||
"arbitrary",
|
||||
"parking_lot",
|
||||
"reth-primitives/test-utils",
|
||||
"reth-primitives-traits/test-utils",
|
||||
"reth-db-api/test-utils",
|
||||
"reth-nippy-jar/test-utils",
|
||||
"reth-trie-common/test-utils",
|
||||
"reth-prune-types/test-utils",
|
||||
"reth-stages-types/test-utils",
|
||||
"reth-primitives-traits/test-utils",
|
||||
]
|
||||
bench = []
|
||||
bench = ["reth-db-api/bench"]
|
||||
arbitrary = [
|
||||
"reth-primitives/arbitrary",
|
||||
"reth-db-api/arbitrary",
|
||||
"reth-primitives-traits/arbitrary",
|
||||
"reth-trie-common/arbitrary",
|
||||
"alloy-primitives/arbitrary",
|
||||
"reth-prune-types/arbitrary",
|
||||
"reth-stages-types/arbitrary",
|
||||
"alloy-consensus/arbitrary",
|
||||
"reth-primitives-traits/arbitrary",
|
||||
]
|
||||
optimism = ["reth-db-api/optimism"]
|
||||
op = [
|
||||
|
||||
@ -6,11 +6,12 @@ use criterion::{
|
||||
criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion,
|
||||
};
|
||||
use pprof::criterion::{Output, PProfProfiler};
|
||||
use reth_db::{tables::*, test_utils::create_test_rw_db_with_path};
|
||||
use reth_db::test_utils::create_test_rw_db_with_path;
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO, DbDupCursorRW},
|
||||
database::Database,
|
||||
table::{Compress, Decode, Decompress, DupSort, Encode, Table},
|
||||
tables::*,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
};
|
||||
use reth_fs_util as fs;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
//! Cursor wrapper for libmdbx-sys.
|
||||
|
||||
use super::utils::*;
|
||||
use crate::{
|
||||
metrics::{DatabaseEnvMetrics, Operation},
|
||||
tables::utils::*,
|
||||
DatabaseError,
|
||||
};
|
||||
use reth_db_api::{
|
||||
|
||||
@ -33,6 +33,8 @@ use tx::Tx;
|
||||
pub mod cursor;
|
||||
pub mod tx;
|
||||
|
||||
mod utils;
|
||||
|
||||
/// 1 KB in bytes
|
||||
pub const KILOBYTE: usize = 1024;
|
||||
/// 1 MB in bytes
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
//! Transaction wrapper for libmdbx-sys.
|
||||
|
||||
use super::cursor::Cursor;
|
||||
use super::{cursor::Cursor, utils::*};
|
||||
use crate::{
|
||||
metrics::{DatabaseEnvMetrics, Operation, TransactionMode, TransactionOutcome},
|
||||
tables::utils::decode_one,
|
||||
DatabaseError,
|
||||
};
|
||||
use reth_db_api::{
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
//! Small database table utilities and helper functions.
|
||||
|
||||
use crate::DatabaseError;
|
||||
use reth_db_api::table::{Decode, Decompress, Table, TableRow};
|
||||
use crate::{
|
||||
table::{Decode, Decompress, Table, TableRow},
|
||||
DatabaseError,
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
|
||||
/// Helper function to decode a `(key, value)` pair.
|
||||
@ -20,7 +20,6 @@ pub mod lockfile;
|
||||
#[cfg(feature = "mdbx")]
|
||||
mod metrics;
|
||||
pub mod static_file;
|
||||
pub mod tables;
|
||||
#[cfg(feature = "mdbx")]
|
||||
mod utils;
|
||||
pub mod version;
|
||||
@ -29,7 +28,6 @@ pub mod version;
|
||||
pub mod mdbx;
|
||||
|
||||
pub use reth_storage_errors::db::{DatabaseError, DatabaseWriteOperation};
|
||||
pub use tables::*;
|
||||
#[cfg(feature = "mdbx")]
|
||||
pub use utils::is_database_empty;
|
||||
|
||||
|
||||
@ -21,8 +21,11 @@ use reth_chain_state::{
|
||||
MemoryOverlayStateProvider,
|
||||
};
|
||||
use reth_chainspec::{ChainInfo, EthereumHardforks};
|
||||
use reth_db::{models::BlockNumberAddress, transaction::DbTx, Database};
|
||||
use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
|
||||
use reth_db_api::{
|
||||
models::{AccountBeforeTx, BlockNumberAddress, StoredBlockBodyIndices},
|
||||
transaction::DbTx,
|
||||
Database,
|
||||
};
|
||||
use reth_evm::{ConfigureEvmEnv, EvmEnv};
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
use reth_node_types::{BlockTy, HeaderTy, NodeTypesWithDB, ReceiptTy, TxTy};
|
||||
@ -789,11 +792,12 @@ mod tests {
|
||||
use reth_chainspec::{
|
||||
ChainSpec, ChainSpecBuilder, ChainSpecProvider, EthereumHardfork, MAINNET,
|
||||
};
|
||||
use reth_db::{
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO,
|
||||
models::{AccountBeforeTx, StoredBlockBodyIndices},
|
||||
tables,
|
||||
transaction::DbTx,
|
||||
};
|
||||
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
|
||||
use reth_errors::ProviderError;
|
||||
use reth_execution_types::{Chain, ExecutionOutcome};
|
||||
use reth_primitives::{EthPrimitives, Receipt, RecoveredBlock, SealedBlock, StaticFileSegment};
|
||||
|
||||
@ -17,8 +17,7 @@ use alloy_primitives::{
|
||||
};
|
||||
use reth_chain_state::{BlockState, CanonicalInMemoryState, MemoryOverlayStateProviderRef};
|
||||
use reth_chainspec::{ChainInfo, EthereumHardforks};
|
||||
use reth_db::models::BlockNumberAddress;
|
||||
use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
|
||||
use reth_db_api::models::{AccountBeforeTx, BlockNumberAddress, StoredBlockBodyIndices};
|
||||
use reth_execution_types::{BundleStateInit, ExecutionOutcome, RevertsInit};
|
||||
use reth_node_types::{BlockTy, HeaderTy, ReceiptTy, TxTy};
|
||||
use reth_primitives::{Account, RecoveredBlock, SealedBlock, SealedHeader, StorageEntry};
|
||||
@ -1485,7 +1484,7 @@ mod tests {
|
||||
use itertools::Itertools;
|
||||
use rand::Rng;
|
||||
use reth_chain_state::{ExecutedBlock, ExecutedBlockWithTrieUpdates, NewCanonicalChain};
|
||||
use reth_db::models::AccountBeforeTx;
|
||||
use reth_db_api::models::AccountBeforeTx;
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
use reth_primitives::{RecoveredBlock, SealedBlock};
|
||||
use reth_storage_api::{BlockReader, BlockSource, ChangeSetReader};
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use crate::{providers::NodeTypesForProvider, DatabaseProvider};
|
||||
use reth_db::transaction::{DbTx, DbTxMut};
|
||||
use reth_db_api::transaction::{DbTx, DbTxMut};
|
||||
use reth_node_types::{FullNodePrimitives, FullSignedTx};
|
||||
use reth_primitives_traits::FullBlockHeader;
|
||||
use reth_storage_api::{ChainStorageReader, ChainStorageWriter, EthStorage};
|
||||
|
||||
@ -669,9 +669,9 @@ mod tests {
|
||||
use reth_chainspec::ChainSpecBuilder;
|
||||
use reth_db::{
|
||||
mdbx::DatabaseArguments,
|
||||
tables,
|
||||
test_utils::{create_test_static_files_dir, ERROR_TEMPDIR},
|
||||
};
|
||||
use reth_db_api::tables;
|
||||
use reth_primitives::StaticFileSegment;
|
||||
use reth_primitives_traits::SignedTransaction;
|
||||
use reth_prune_types::{PruneMode, PruneModes};
|
||||
|
||||
@ -29,19 +29,17 @@ use alloy_primitives::{
|
||||
use itertools::Itertools;
|
||||
use rayon::slice::ParallelSliceMut;
|
||||
use reth_chainspec::{ChainInfo, ChainSpecProvider, EthChainSpec, EthereumHardforks};
|
||||
use reth_db::{
|
||||
cursor::DbDupCursorRW, tables, BlockNumberList, PlainAccountState, PlainStorageState,
|
||||
};
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO},
|
||||
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO, DbDupCursorRW},
|
||||
database::Database,
|
||||
models::{
|
||||
sharded_key, storage_sharded_key::StorageShardedKey, AccountBeforeTx, BlockNumberAddress,
|
||||
ShardedKey, StoredBlockBodyIndices,
|
||||
},
|
||||
table::Table,
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
DatabaseError,
|
||||
BlockNumberList, DatabaseError, PlainAccountState, PlainStorageState,
|
||||
};
|
||||
use reth_execution_types::{Chain, ExecutionOutcome};
|
||||
use reth_network_p2p::headers::downloader::SyncTarget;
|
||||
@ -316,7 +314,7 @@ impl<TX: DbTx + DbTxMut + 'static, N: NodeTypesForProvider> DatabaseProvider<TX,
|
||||
let (new_state_root, trie_updates) = StateRoot::from_tx(&self.tx)
|
||||
.with_prefix_sets(prefix_sets)
|
||||
.root_with_updates()
|
||||
.map_err(reth_db::DatabaseError::from)?;
|
||||
.map_err(reth_db_api::DatabaseError::from)?;
|
||||
|
||||
let parent_number = range.start().saturating_sub(1);
|
||||
let parent_state_root = self
|
||||
@ -2590,7 +2588,7 @@ impl<TX: DbTxMut + DbTx + 'static, N: NodeTypes> HashingWriter for DatabaseProvi
|
||||
let (state_root, trie_updates) = StateRoot::from_tx(&self.tx)
|
||||
.with_prefix_sets(prefix_sets)
|
||||
.root_with_updates()
|
||||
.map_err(reth_db::DatabaseError::from)?;
|
||||
.map_err(reth_db_api::DatabaseError::from)?;
|
||||
if state_root != expected_state_root {
|
||||
return Err(ProviderError::StateRootMismatch(Box::new(RootMismatch {
|
||||
root: GotExpected { got: state_root, expected: expected_state_root },
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
//! Contains the main provider types and traits for interacting with the blockchain's storage.
|
||||
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_db::table::Value;
|
||||
use reth_db_api::table::Value;
|
||||
use reth_node_types::{FullNodePrimitives, NodeTypes, NodeTypesWithDB, NodeTypesWithEngine};
|
||||
|
||||
mod database;
|
||||
|
||||
@ -4,12 +4,13 @@ use crate::{
|
||||
};
|
||||
use alloy_eips::merge::EPOCH_SLOTS;
|
||||
use alloy_primitives::{map::B256Map, Address, BlockNumber, Bytes, StorageKey, StorageValue, B256};
|
||||
use reth_db::{tables, BlockNumberList};
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbDupCursorRO},
|
||||
models::{storage_sharded_key::StorageShardedKey, ShardedKey},
|
||||
table::Table,
|
||||
tables,
|
||||
transaction::DbTx,
|
||||
BlockNumberList,
|
||||
};
|
||||
use reth_primitives::{Account, Bytecode};
|
||||
use reth_storage_api::{
|
||||
@ -541,10 +542,11 @@ mod tests {
|
||||
AccountReader, HistoricalStateProvider, HistoricalStateProviderRef, StateProvider,
|
||||
};
|
||||
use alloy_primitives::{address, b256, Address, B256, U256};
|
||||
use reth_db::{tables, BlockNumberList};
|
||||
use reth_db_api::{
|
||||
models::{storage_sharded_key::StorageShardedKey, AccountBeforeTx, ShardedKey},
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
BlockNumberList,
|
||||
};
|
||||
use reth_primitives::{Account, StorageEntry};
|
||||
use reth_storage_api::{
|
||||
|
||||
@ -3,8 +3,7 @@ use crate::{
|
||||
HashedPostStateProvider, StateProvider, StateRootProvider,
|
||||
};
|
||||
use alloy_primitives::{map::B256Map, Address, BlockNumber, Bytes, StorageKey, StorageValue, B256};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{cursor::DbDupCursorRO, transaction::DbTx};
|
||||
use reth_db_api::{cursor::DbDupCursorRO, tables, transaction::DbTx};
|
||||
use reth_primitives::{Account, Bytecode};
|
||||
use reth_storage_api::{
|
||||
DBProvider, StateCommitmentProvider, StateProofProvider, StorageRootProvider,
|
||||
|
||||
@ -10,12 +10,12 @@ use alloy_consensus::transaction::TransactionMeta;
|
||||
use alloy_eips::{eip2718::Encodable2718, eip4895::Withdrawals, BlockHashOrNumber};
|
||||
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
|
||||
use reth_chainspec::ChainInfo;
|
||||
use reth_db::{
|
||||
use reth_db::static_file::{
|
||||
BlockHashMask, BodyIndicesMask, HeaderMask, HeaderWithHashMask, OmmersMask, ReceiptMask,
|
||||
StaticFileCursor, TDWithHashMask, TotalDifficultyMask, TransactionMask, WithdrawalsMask,
|
||||
};
|
||||
use reth_db_api::{
|
||||
models::StoredBlockBodyIndices,
|
||||
static_file::{
|
||||
BlockHashMask, BodyIndicesMask, HeaderMask, HeaderWithHashMask, OmmersMask, ReceiptMask,
|
||||
StaticFileCursor, TDWithHashMask, TotalDifficultyMask, TransactionMask, WithdrawalsMask,
|
||||
},
|
||||
table::{Decompress, Value},
|
||||
};
|
||||
use reth_node_types::{FullNodePrimitives, NodePrimitives};
|
||||
|
||||
@ -22,11 +22,13 @@ use reth_db::{
|
||||
iter_static_files, BlockHashMask, BodyIndicesMask, HeaderMask, HeaderWithHashMask,
|
||||
ReceiptMask, StaticFileCursor, TDWithHashMask, TransactionMask,
|
||||
},
|
||||
table::{Decompress, Value},
|
||||
tables,
|
||||
};
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO, models::StoredBlockBodyIndices, table::Table, transaction::DbTx,
|
||||
cursor::DbCursorRO,
|
||||
models::StoredBlockBodyIndices,
|
||||
table::{Decompress, Table, Value},
|
||||
tables,
|
||||
transaction::DbTx,
|
||||
};
|
||||
use reth_nippy_jar::{NippyJar, NippyJarChecker, CONFIG_FILE_EXTENSION};
|
||||
use reth_node_types::{FullNodePrimitives, NodePrimitives};
|
||||
|
||||
@ -61,11 +61,10 @@ mod tests {
|
||||
use alloy_consensus::{Header, Transaction};
|
||||
use alloy_primitives::{BlockHash, TxNumber, B256, U256};
|
||||
use rand::seq::SliceRandom;
|
||||
use reth_db::{
|
||||
test_utils::create_test_static_files_dir, CanonicalHeaders, HeaderNumbers,
|
||||
HeaderTerminalDifficulties, Headers,
|
||||
use reth_db::test_utils::create_test_static_files_dir;
|
||||
use reth_db_api::{
|
||||
transaction::DbTxMut, CanonicalHeaders, HeaderNumbers, HeaderTerminalDifficulties, Headers,
|
||||
};
|
||||
use reth_db_api::transaction::DbTxMut;
|
||||
use reth_primitives::{
|
||||
static_file::{find_fixed_range, SegmentRangeInclusive, DEFAULT_BLOCKS_PER_STATIC_FILE},
|
||||
EthPrimitives, Receipt, TransactionSigned,
|
||||
|
||||
@ -6,8 +6,9 @@ use alloy_consensus::BlockHeader;
|
||||
use alloy_primitives::{BlockHash, BlockNumber, TxNumber, U256};
|
||||
use parking_lot::{lock_api::RwLockWriteGuard, RawRwLock, RwLock};
|
||||
use reth_codecs::Compact;
|
||||
use reth_db::models::{StoredBlockBodyIndices, StoredBlockOmmers, StoredBlockWithdrawals};
|
||||
use reth_db_api::models::CompactU256;
|
||||
use reth_db_api::models::{
|
||||
CompactU256, StoredBlockBodyIndices, StoredBlockOmmers, StoredBlockWithdrawals,
|
||||
};
|
||||
use reth_nippy_jar::{NippyJar, NippyJarError, NippyJarWriter};
|
||||
use reth_node_types::NodePrimitives;
|
||||
use reth_primitives::{
|
||||
|
||||
@ -8,8 +8,7 @@ use alloy_primitives::{
|
||||
use alloy_consensus::Header;
|
||||
use alloy_eips::eip4895::{Withdrawal, Withdrawals};
|
||||
use alloy_primitives::PrimitiveSignature as Signature;
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{database::Database, models::StoredBlockBodyIndices};
|
||||
use reth_db_api::{database::Database, models::StoredBlockBodyIndices, tables};
|
||||
use reth_node_types::NodeTypes;
|
||||
use reth_primitives::{
|
||||
Account, BlockBody, Receipt, RecoveredBlock, SealedBlock, SealedHeader, Transaction,
|
||||
|
||||
@ -16,8 +16,10 @@ use alloy_primitives::{
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
use reth_chainspec::{ChainInfo, EthChainSpec};
|
||||
use reth_db::mock::{DatabaseMock, TxMock};
|
||||
use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
|
||||
use reth_db_api::{
|
||||
mock::{DatabaseMock, TxMock},
|
||||
models::{AccountBeforeTx, StoredBlockBodyIndices},
|
||||
};
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
use reth_node_types::NodeTypes;
|
||||
use reth_primitives::{
|
||||
|
||||
@ -5,7 +5,7 @@ use crate::{
|
||||
};
|
||||
use alloy_consensus::BlockHeader;
|
||||
use reth_chain_state::{ExecutedBlock, ExecutedBlockWithTrieUpdates};
|
||||
use reth_db::transaction::{DbTx, DbTxMut};
|
||||
use reth_db_api::transaction::{DbTx, DbTxMut};
|
||||
use reth_errors::ProviderResult;
|
||||
use reth_primitives::{NodePrimitives, StaticFileSegment};
|
||||
use reth_primitives_traits::SignedTransaction;
|
||||
@ -228,10 +228,10 @@ mod tests {
|
||||
test_utils::create_test_provider_factory, AccountReader, StorageTrieWriter, TrieWriter,
|
||||
};
|
||||
use alloy_primitives::{keccak256, map::HashMap, Address, B256, U256};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO},
|
||||
models::{AccountBeforeTx, BlockNumberAddress},
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
};
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
|
||||
@ -22,7 +22,6 @@ reth-stages-types.workspace = true
|
||||
reth-storage-errors.workspace = true
|
||||
reth-trie.workspace = true
|
||||
reth-trie-db.workspace = true
|
||||
reth-db.workspace = true
|
||||
revm-database.workspace = true
|
||||
reth-ethereum-primitives.workspace = true
|
||||
|
||||
|
||||
@ -4,10 +4,10 @@ use alloy_consensus::Header;
|
||||
use alloy_primitives::BlockNumber;
|
||||
use core::marker::PhantomData;
|
||||
use reth_chainspec::{ChainSpecProvider, EthereumHardforks};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbCursorRW},
|
||||
models::{StoredBlockOmmers, StoredBlockWithdrawals},
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
DbTxUnwindExt,
|
||||
};
|
||||
|
||||
@ -29,7 +29,7 @@ pub trait HashingWriter: Send + Sync {
|
||||
range: impl RangeBounds<BlockNumber>,
|
||||
) -> ProviderResult<BTreeMap<B256, Option<Account>>>;
|
||||
|
||||
/// Inserts all accounts into the `AccountsHistory` table.
|
||||
/// Inserts all accounts into [`AccountsHistory`][reth_db_api::tables::AccountsHistory] table.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
|
||||
@ -15,9 +15,7 @@ workspace = true
|
||||
# reth
|
||||
reth-primitives-traits.workspace = true
|
||||
reth-execution-errors.workspace = true
|
||||
reth-db.workspace = true
|
||||
reth-db-api.workspace = true
|
||||
reth-storage-errors.workspace = true
|
||||
reth-trie.workspace = true
|
||||
|
||||
revm.workspace = true
|
||||
|
||||
@ -2,7 +2,7 @@ use crate::{
|
||||
DatabaseHashedCursorFactory, DatabaseProof, DatabaseStateRoot, DatabaseStorageRoot,
|
||||
DatabaseTrieCursorFactory, DatabaseTrieWitness,
|
||||
};
|
||||
use reth_db::transaction::DbTx;
|
||||
use reth_db_api::transaction::DbTx;
|
||||
use reth_trie::{
|
||||
proof::Proof, witness::TrieWitness, KeccakKeyHasher, KeyHasher, StateRoot, StorageRoot,
|
||||
};
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
use alloy_primitives::{B256, U256};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
cursor::{DbCursorRO, DbDupCursorRO},
|
||||
tables,
|
||||
transaction::DbTx,
|
||||
DatabaseError,
|
||||
};
|
||||
use reth_primitives_traits::Account;
|
||||
use reth_trie::hashed_cursor::{HashedCursor, HashedCursorFactory, HashedStorageCursor};
|
||||
@ -29,14 +30,14 @@ impl<TX: DbTx> HashedCursorFactory for DatabaseHashedCursorFactory<'_, TX> {
|
||||
type StorageCursor =
|
||||
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>()?))
|
||||
}
|
||||
|
||||
fn hashed_storage_cursor(
|
||||
&self,
|
||||
hashed_address: B256,
|
||||
) -> Result<Self::StorageCursor, reth_db::DatabaseError> {
|
||||
) -> Result<Self::StorageCursor, DatabaseError> {
|
||||
Ok(DatabaseHashedStorageCursor::new(
|
||||
self.0.cursor_dup_read::<tables::HashedStorages>()?,
|
||||
hashed_address,
|
||||
@ -62,11 +63,11 @@ where
|
||||
{
|
||||
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)
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
@ -95,14 +96,11 @@ where
|
||||
{
|
||||
type Value = U256;
|
||||
|
||||
fn seek(
|
||||
&mut self,
|
||||
subkey: B256,
|
||||
) -> Result<Option<(B256, Self::Value)>, reth_db::DatabaseError> {
|
||||
fn seek(&mut self, subkey: B256) -> Result<Option<(B256, Self::Value)>, DatabaseError> {
|
||||
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)))
|
||||
}
|
||||
}
|
||||
@ -111,7 +109,7 @@ impl<C> HashedStorageCursor for DatabaseHashedStorageCursor<C>
|
||||
where
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,10 +4,10 @@ use alloy_primitives::{
|
||||
};
|
||||
use core::{marker::PhantomData, ops::RangeInclusive};
|
||||
use derive_more::Deref;
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO,
|
||||
models::{AccountBeforeTx, BlockNumberAddress},
|
||||
tables,
|
||||
transaction::DbTx,
|
||||
DatabaseError,
|
||||
};
|
||||
|
||||
@ -3,14 +3,14 @@ use alloy_primitives::{
|
||||
map::{AddressMap, B256Map},
|
||||
Address, BlockNumber, B256, U256,
|
||||
};
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO,
|
||||
models::{AccountBeforeTx, BlockNumberAddress},
|
||||
tables,
|
||||
transaction::DbTx,
|
||||
DatabaseError,
|
||||
};
|
||||
use reth_execution_errors::StateRootError;
|
||||
use reth_storage_errors::db::DatabaseError;
|
||||
use reth_trie::{
|
||||
hashed_cursor::HashedPostStateCursorFactory, trie_cursor::InMemoryTrieCursorFactory,
|
||||
updates::TrieUpdates, HashedPostState, HashedStorage, KeccakKeyHasher, KeyHasher, StateRoot,
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
use crate::{DatabaseHashedCursorFactory, DatabaseTrieCursorFactory};
|
||||
use alloy_primitives::{keccak256, map::hash_map, Address, BlockNumber, B256};
|
||||
use reth_db::{cursor::DbCursorRO, models::BlockNumberAddress, tables, DatabaseError};
|
||||
use reth_db_api::transaction::DbTx;
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO, models::BlockNumberAddress, tables, transaction::DbTx, DatabaseError,
|
||||
};
|
||||
use reth_execution_errors::StorageRootError;
|
||||
use reth_trie::{
|
||||
hashed_cursor::HashedPostStateCursorFactory, HashedPostState, HashedStorage, StorageRoot,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user