Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into alexey/remote-exex
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Jun 17, 2024
2 parents 251249b + 2a5c93f commit fbd0003
Show file tree
Hide file tree
Showing 183 changed files with 430 additions and 261 deletions.
54 changes: 52 additions & 2 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ workspace = true

[dependencies]
# reth
reth-chainspec.workspace = true
reth-config.workspace = true
reth-primitives.workspace = true
reth-fs-util.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ use crate::{
version::{LONG_VERSION, SHORT_VERSION},
};
use clap::{value_parser, Parser, Subcommand};
use reth_chainspec::ChainSpec;
use reth_cli_runner::CliRunner;
use reth_db::DatabaseEnv;
use reth_node_builder::{NodeBuilder, WithLaunchContext};
use reth_primitives::ChainSpec;
use reth_tracing::FileWorkerGuard;
use std::{ffi::OsString, fmt, future::Future, sync::Arc};
use tracing::info;
Expand Down
3 changes: 2 additions & 1 deletion bin/reth/src/commands/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use clap::Parser;
use reth_beacon_consensus::EthBeaconConsensus;
use reth_chainspec::ChainSpec;
use reth_config::{config::EtlConfig, Config};
use reth_db::{init_db, open_db_read_only, DatabaseEnv};
use reth_db_common::init::init_genesis;
Expand All @@ -14,7 +15,7 @@ use reth_node_core::{
},
dirs::{ChainPath, DataDirPath},
};
use reth_primitives::{ChainSpec, B256};
use reth_primitives::B256;
use reth_provider::{providers::StaticFileProvider, ProviderFactory, StaticFileProviderFactory};
use reth_stages::{sets::DefaultStages, Pipeline, PipelineTarget};
use reth_static_file::StaticFileProducer;
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/dump_genesis.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Command that dumps genesis block JSON configuration to stdout
use crate::args::utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS};
use clap::Parser;
use reth_primitives::ChainSpec;
use reth_chainspec::ChainSpec;
use std::sync::Arc;

/// Dumps genesis block JSON configuration to stdout
Expand Down Expand Up @@ -39,7 +39,7 @@ mod tests {
DumpGenesisCommand::parse_from(["reth", "--chain", chain]);
assert_eq!(
Ok(args.chain.chain),
chain.parse::<reth_primitives::Chain>(),
chain.parse::<reth_chainspec::Chain>(),
"failed to parse chain {chain}"
);
}
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ mod tests {
let args: ImportCommand = ImportCommand::parse_from(["reth", "--chain", chain, "."]);
assert_eq!(
Ok(args.env.chain.chain),
chain.parse::<reth_primitives::Chain>(),
chain.parse::<reth_chainspec::Chain>(),
"failed to parse chain {chain}"
);
}
Expand Down
6 changes: 3 additions & 3 deletions bin/reth/src/commands/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use crate::args::{
RpcServerArgs, TxPoolArgs,
};
use clap::{value_parser, Args, Parser};
use reth_chainspec::ChainSpec;
use reth_cli_runner::CliContext;
use reth_db::{init_db, DatabaseEnv};
use reth_node_builder::{NodeBuilder, WithLaunchContext};
use reth_node_core::{node_config::NodeConfig, version};
use reth_primitives::ChainSpec;
use std::{ffi::OsString, fmt, future::Future, net::SocketAddr, path::PathBuf, sync::Arc};

/// Start the node
Expand Down Expand Up @@ -213,7 +213,7 @@ mod tests {
fn parse_common_node_command_chain_args() {
for chain in SUPPORTED_CHAINS {
let args: NodeCommand = NodeCommand::<NoArgs>::parse_from(["reth", "--chain", chain]);
assert_eq!(args.chain.chain, chain.parse::<reth_primitives::Chain>().unwrap());
assert_eq!(args.chain.chain, chain.parse::<reth_chainspec::Chain>().unwrap());
}
}

Expand Down Expand Up @@ -305,7 +305,7 @@ mod tests {
#[cfg(not(feature = "optimism"))] // dev mode not yet supported in op-reth
fn parse_dev() {
let cmd = NodeCommand::<NoArgs>::parse_from(["reth", "--dev"]);
let chain = reth_primitives::DEV.clone();
let chain = reth_chainspec::DEV.clone();
assert_eq!(cmd.chain.chain, chain.chain);
assert_eq!(cmd.chain.genesis_hash, chain.genesis_hash);
assert_eq!(
Expand Down
3 changes: 2 additions & 1 deletion bin/reth/src/commands/p2p/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ use crate::{
use backon::{ConstantBuilder, Retryable};
use clap::{Parser, Subcommand};
use discv5::ListenConfig;
use reth_chainspec::ChainSpec;
use reth_config::Config;
use reth_db::create_db;
use reth_network::NetworkConfigBuilder;
use reth_network_p2p::bodies::client::BodiesClient;
use reth_node_core::args::DatadirArgs;
use reth_primitives::{BlockHashOrNumber, ChainSpec};
use reth_primitives::BlockHashOrNumber;
use reth_provider::{providers::StaticFileProvider, ProviderFactory};
use std::{
net::{IpAddr, SocketAddrV4, SocketAddrV6},
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use boyer_moore_magiclen::BMByte;
use eyre::Result;
use reth_chainspec::ChainSpec;
use reth_db::{RawTable, TableRawRow};
use reth_db_api::{
cursor::{DbCursorRO, DbDupCursorRO},
Expand All @@ -11,7 +12,6 @@ use reth_db_api::{
DatabaseError,
};
use reth_fs_util as fs;
use reth_primitives::ChainSpec;
use reth_provider::{ChainSpecProvider, ProviderFactory};
use std::{path::Path, rc::Rc, sync::Arc};
use tracing::info;
Expand Down
1 change: 1 addition & 0 deletions crates/blockchain-tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ aquamarine.workspace = true
linked_hash_set.workspace = true

[dev-dependencies]
reth-chainspec.workspace = true
reth-db = { workspace = true, features = ["test-utils"] }
reth-primitives = { workspace = true, features = ["test-utils"] }
reth-provider = { workspace = true, features = ["test-utils"] }
Expand Down
6 changes: 3 additions & 3 deletions crates/blockchain-tree/src/blockchain_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,7 @@ mod tests {
use super::*;
use assert_matches::assert_matches;
use linked_hash_set::LinkedHashSet;
use reth_chainspec::{ChainSpecBuilder, MAINNET};
use reth_consensus::test_utils::TestConsensus;
use reth_db::{tables, test_utils::TempDatabase, DatabaseEnv};
use reth_db_api::transaction::DbTxMut;
Expand All @@ -1385,9 +1386,8 @@ mod tests {
keccak256,
proofs::calculate_transaction_root,
revm_primitives::AccountInfo,
Account, Address, ChainSpecBuilder, Genesis, GenesisAccount, Header, Signature,
Transaction, TransactionSigned, TransactionSignedEcRecovered, TxEip1559, Withdrawals, B256,
MAINNET,
Account, Address, Genesis, GenesisAccount, Header, Signature, Transaction,
TransactionSigned, TransactionSignedEcRecovered, TxEip1559, Withdrawals, B256,
};
use reth_provider::{
test_utils::{blocks::BlockchainTestData, create_test_provider_factory_with_chain_spec},
Expand Down
3 changes: 3 additions & 0 deletions crates/chainspec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ mod spec;
/// Chain specific constants
pub(crate) mod constants;

/// Re-export for convenience
pub use reth_ethereum_forks::*;

#[cfg(test)]
mod tests {
use super::*;
Expand Down
1 change: 1 addition & 0 deletions crates/consensus/auto-seal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ workspace = true

[dependencies]
# reth
reth-chainspec.workspace = true
reth-beacon-consensus.workspace = true
reth-primitives.workspace = true
reth-execution-errors.workspace = true
Expand Down
6 changes: 3 additions & 3 deletions crates/consensus/auto-seal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

use reth_beacon_consensus::BeaconEngineMessage;
use reth_chainspec::ChainSpec;
use reth_consensus::{Consensus, ConsensusError, PostExecutionInput};
use reth_engine_primitives::EngineTypes;
use reth_execution_errors::{BlockExecutionError, BlockValidationError};
use reth_primitives::{
constants::{EMPTY_TRANSACTIONS, ETHEREUM_BLOCK_GAS_LIMIT},
eip4844::calculate_excess_blob_gas,
proofs, Block, BlockBody, BlockHash, BlockHashOrNumber, BlockNumber, BlockWithSenders,
ChainSpec, Header, Requests, SealedBlock, SealedHeader, TransactionSigned, Withdrawals, B256,
U256,
proofs, Block, BlockBody, BlockHash, BlockHashOrNumber, BlockNumber, BlockWithSenders, Header,
Requests, SealedBlock, SealedHeader, TransactionSigned, Withdrawals, B256, U256,
};
use reth_provider::{BlockReaderIdExt, ExecutionOutcome, StateProviderFactory, StateRootProvider};
use reth_revm::database::StateProviderDatabase;
Expand Down
3 changes: 2 additions & 1 deletion crates/consensus/auto-seal/src/task.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use crate::{mode::MiningMode, Storage};
use futures_util::{future::BoxFuture, FutureExt};
use reth_beacon_consensus::{BeaconEngineMessage, ForkchoiceStatus};
use reth_chainspec::ChainSpec;
use reth_engine_primitives::EngineTypes;
use reth_evm::execute::BlockExecutorProvider;
use reth_primitives::{ChainSpec, IntoRecoveredTransaction};
use reth_primitives::IntoRecoveredTransaction;
use reth_provider::{CanonChainTracker, StateProviderFactory};
use reth_rpc_types::engine::ForkchoiceState;
use reth_stages_api::PipelineEvent;
Expand Down
1 change: 1 addition & 0 deletions crates/consensus/beacon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ workspace = true

[dependencies]
# reth
reth-chainspec.workspace = true
reth-ethereum-consensus.workspace = true
reth-blockchain-tree-api.workspace = true
reth-primitives.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1975,7 +1975,7 @@ mod tests {
BeaconForkChoiceUpdateError,
};
use assert_matches::assert_matches;
use reth_primitives::{ChainSpecBuilder, MAINNET};
use reth_chainspec::{ChainSpecBuilder, MAINNET};
use reth_provider::{BlockWriter, ProviderFactory};
use reth_rpc_types::engine::{ForkchoiceState, ForkchoiceUpdated, PayloadStatus};
use reth_rpc_types_compat::engine::payload::block_to_payload_v1;
Expand Down
9 changes: 4 additions & 5 deletions crates/consensus/beacon/src/engine/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ use crate::{
ConsensusEngineLiveSyncProgress, EthBeaconConsensus,
};
use futures::FutureExt;
use reth_chainspec::ChainSpec;
use reth_db_api::database::Database;
use reth_network_p2p::{
bodies::client::BodiesClient,
full_block::{FetchFullBlockFuture, FetchFullBlockRangeFuture, FullBlockClient},
headers::client::HeadersClient,
};
use reth_primitives::{BlockNumber, ChainSpec, SealedBlock, B256};
use reth_primitives::{BlockNumber, SealedBlock, B256};
use reth_stages_api::{ControlFlow, Pipeline, PipelineError, PipelineTarget, PipelineWithResult};
use reth_tasks::TaskSpawner;
use reth_tokio_util::EventSender;
Expand Down Expand Up @@ -413,12 +414,10 @@ mod tests {
use super::*;
use assert_matches::assert_matches;
use futures::poll;
use reth_chainspec::{ChainSpecBuilder, MAINNET};
use reth_db::{mdbx::DatabaseEnv, test_utils::TempDatabase};
use reth_network_p2p::{either::Either, test_utils::TestFullBlockClient};
use reth_primitives::{
constants::ETHEREUM_BLOCK_GAS_LIMIT, BlockBody, ChainSpecBuilder, Header, SealedHeader,
MAINNET,
};
use reth_primitives::{constants::ETHEREUM_BLOCK_GAS_LIMIT, BlockBody, Header, SealedHeader};
use reth_provider::{
test_utils::create_test_provider_factory_with_chain_spec, ExecutionOutcome,
};
Expand Down
3 changes: 2 additions & 1 deletion crates/consensus/beacon/src/engine/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
use reth_blockchain_tree::{
config::BlockchainTreeConfig, externals::TreeExternals, BlockchainTree, ShareableBlockchainTree,
};
use reth_chainspec::ChainSpec;
use reth_config::config::StageConfig;
use reth_consensus::{test_utils::TestConsensus, Consensus};
use reth_db::{test_utils::TempDatabase, DatabaseEnv as DE};
Expand All @@ -22,7 +23,7 @@ use reth_network_p2p::{
test_utils::NoopFullBlockClient,
};
use reth_payload_builder::test_utils::spawn_test_payload_service;
use reth_primitives::{BlockNumber, ChainSpec, B256};
use reth_primitives::{BlockNumber, B256};
use reth_provider::{
providers::BlockchainProvider, test_utils::create_test_provider_factory_with_chain_spec,
ExecutionOutcome,
Expand Down
1 change: 1 addition & 0 deletions crates/consensus/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ workspace = true

[dependencies]
# reth
reth-chainspec.workspace = true
reth-primitives.workspace = true
reth-consensus.workspace = true

Expand Down
8 changes: 5 additions & 3 deletions crates/consensus/common/src/calc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use reth_primitives::{constants::ETH_TO_WEI, BlockNumber, Chain, ChainSpec, Hardfork, U256};
use reth_chainspec::{Chain, ChainSpec, Hardfork};
use reth_primitives::{constants::ETH_TO_WEI, BlockNumber, U256};
/// Calculates the base block reward.
///
/// The base block reward is defined as:
Expand Down Expand Up @@ -45,9 +46,10 @@ pub fn base_block_reward(
/// # Examples
///
/// ```
/// # use reth_chainspec::MAINNET;
/// # use reth_consensus_common::calc::{base_block_reward, block_reward};
/// # use reth_primitives::constants::ETH_TO_WEI;
/// # use reth_primitives::{MAINNET, U256};
/// # use reth_primitives::U256;
/// #
/// // This is block 126 on mainnet.
/// let block_number = 126;
Expand Down Expand Up @@ -102,7 +104,7 @@ pub const fn ommer_reward(
#[cfg(test)]
mod tests {
use super::*;
use reth_primitives::MAINNET;
use reth_chainspec::MAINNET;

#[test]
fn calc_base_block_reward() {
Expand Down
8 changes: 5 additions & 3 deletions crates/consensus/common/src/validation.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
//! Collection of methods for block validation.

use reth_chainspec::ChainSpec;
use reth_consensus::ConsensusError;
use reth_primitives::{
constants::{
eip4844::{DATA_GAS_PER_BLOB, MAX_DATA_GAS_PER_BLOCK},
MAXIMUM_EXTRA_DATA_SIZE,
},
eip4844::calculate_excess_blob_gas,
ChainSpec, GotExpected, Hardfork, Header, SealedBlock, SealedHeader,
GotExpected, Hardfork, Header, SealedBlock, SealedHeader,
};

/// Gas used needs to be less than gas limit. Gas used is going to be checked after execution.
Expand Down Expand Up @@ -270,10 +271,11 @@ mod tests {
use super::*;
use mockall::mock;
use rand::Rng;
use reth_chainspec::ChainSpecBuilder;
use reth_primitives::{
hex_literal::hex, proofs, Account, Address, BlockBody, BlockHash, BlockHashOrNumber,
BlockNumber, Bytes, ChainSpecBuilder, Signature, Transaction, TransactionSigned, TxEip4844,
Withdrawal, Withdrawals, U256,
BlockNumber, Bytes, Signature, Transaction, TransactionSigned, TxEip4844, Withdrawal,
Withdrawals, U256,
};
use reth_storage_api::{
errors::provider::ProviderResult, AccountReader, HeaderProvider, WithdrawalsProvider,
Expand Down
1 change: 1 addition & 0 deletions crates/e2e-test-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ repository.workspace = true

[dependencies]
reth.workspace = true
reth-chainspec.workspace = true
reth-primitives.workspace = true
reth-tracing.workspace = true
reth-db.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/e2e-test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use reth::{
builder::{NodeBuilder, NodeConfig, NodeHandle},
tasks::TaskManager,
};
use reth_chainspec::ChainSpec;
use reth_db::{test_utils::TempDatabase, DatabaseEnv};
use reth_node_builder::{
components::NodeComponentsBuilder, FullNodeTypesAdapter, Node, NodeAdapter, RethFullAdapter,
};
use reth_primitives::ChainSpec;
use reth_provider::providers::BlockchainProvider;
use std::sync::Arc;
use tracing::{span, Level};
Expand Down
2 changes: 1 addition & 1 deletion crates/e2e-test-utils/src/network.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use futures_util::StreamExt;
use reth::network::{NetworkEvent, NetworkEvents, NetworkHandle, PeersInfo};
use reth_primitives::NodeRecord;
use reth_chainspec::net::NodeRecord;
use reth_tokio_util::EventStream;
use reth_tracing::tracing::info;

Expand Down
2 changes: 1 addition & 1 deletion crates/engine-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ workspace = true

[dependencies]
# reth
reth-primitives.workspace = true
reth-chainspec.workspace = true
reth-payload-primitives.workspace = true

# misc
Expand Down
2 changes: 1 addition & 1 deletion crates/engine-primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

use reth_chainspec::ChainSpec;
pub use reth_payload_primitives::{
BuiltPayload, EngineApiMessageVersion, EngineObjectValidationError, PayloadOrAttributes,
PayloadTypes,
};
use reth_primitives::ChainSpec;
use serde::{de::DeserializeOwned, ser::Serialize};

/// This type defines the versioned types of the engine API.
Expand Down
1 change: 1 addition & 0 deletions crates/ethereum/consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ workspace = true

[dependencies]
# reth
reth-chainspec.workspace = true
reth-consensus-common.workspace = true
reth-primitives.workspace = true
reth-consensus.workspace = true
Expand Down
Loading

0 comments on commit fbd0003

Please sign in to comment.