refactor(primitive-traits): use alloy ETHEREUM_BLOCK_GAS_LIMIT constant (#12019)

This commit is contained in:
Thomas Coratger
2024-10-24 01:15:15 +02:00
committed by GitHub
parent 2fb63b0491
commit 565e4b400d
15 changed files with 32 additions and 34 deletions

1
Cargo.lock generated
View File

@ -8060,6 +8060,7 @@ version = "1.1.0"
dependencies = [
"alloy-chains",
"alloy-consensus",
"alloy-eips",
"alloy-genesis",
"alloy-primitives",
"derive_more 1.0.0",

View File

@ -9,6 +9,7 @@ use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256};
use derive_more::From;
use alloy_consensus::constants::{DEV_GENESIS_HASH, MAINNET_GENESIS_HASH};
use alloy_eips::eip1559::ETHEREUM_BLOCK_GAS_LIMIT;
use reth_ethereum_forks::{
ChainHardforks, DisplayHardforks, EthereumHardfork, EthereumHardforks, ForkCondition,
ForkFilter, ForkFilterKey, ForkHash, ForkId, Hardfork, Hardforks, Head, DEV_HARDFORKS,
@ -18,10 +19,7 @@ use reth_network_peers::{
sepolia_nodes, NodeRecord,
};
use reth_primitives_traits::{
constants::{
EIP1559_INITIAL_BASE_FEE, ETHEREUM_BLOCK_GAS_LIMIT, HOLESKY_GENESIS_HASH,
SEPOLIA_GENESIS_HASH,
},
constants::{EIP1559_INITIAL_BASE_FEE, HOLESKY_GENESIS_HASH, SEPOLIA_GENESIS_HASH},
Header, SealedHeader,
};
use reth_trie_common::root::state_root_ref_unhashed;

View File

@ -1,12 +1,11 @@
use crate::{cli::config::PayloadBuilderConfig, version::default_extradata};
use alloy_consensus::constants::MAXIMUM_EXTRA_DATA_SIZE;
use alloy_eips::merge::SLOT_DURATION;
use alloy_eips::{eip1559::ETHEREUM_BLOCK_GAS_LIMIT, merge::SLOT_DURATION};
use clap::{
builder::{RangedU64ValueParser, TypedValueParser},
Arg, Args, Command,
};
use reth_cli_util::{parse_duration_from_secs, parse_duration_from_secs_or_ms};
use reth_primitives::constants::ETHEREUM_BLOCK_GAS_LIMIT;
use std::{borrow::Cow, ffi::OsStr, time::Duration};
/// Parameters for configuring the Payload Builder

View File

@ -1,9 +1,10 @@
//! Transaction pool arguments
use crate::cli::config::RethTransactionPoolConfig;
use alloy_eips::eip1559::ETHEREUM_BLOCK_GAS_LIMIT;
use alloy_primitives::Address;
use clap::Args;
use reth_primitives::constants::{ETHEREUM_BLOCK_GAS_LIMIT, MIN_PROTOCOL_BASE_FEE};
use reth_primitives::constants::MIN_PROTOCOL_BASE_FEE;
use reth_transaction_pool::{
blobstore::disk::DEFAULT_MAX_CACHED_BLOBS,
pool::{NEW_TX_LISTENER_BUFFER_SIZE, PENDING_TX_LISTENER_BUFFER_SIZE},

View File

@ -26,6 +26,7 @@ alloy-chains.workspace = true
alloy-genesis.workspace = true
alloy-primitives.workspace = true
alloy-consensus.workspace = true
alloy-eips.workspace = true
# op
op-alloy-rpc-types.workspace = true
@ -45,14 +46,15 @@ op-alloy-rpc-types.workspace = true
[features]
default = ["std"]
std = [
"alloy-chains/std",
"alloy-genesis/std",
"alloy-primitives/std",
"op-alloy-rpc-types/std",
"reth-chainspec/std",
"reth-ethereum-forks/std",
"reth-primitives-traits/std",
"reth-optimism-forks/std",
"alloy-consensus/std",
"once_cell/std"
"alloy-chains/std",
"alloy-genesis/std",
"alloy-primitives/std",
"alloy-eips/std",
"op-alloy-rpc-types/std",
"reth-chainspec/std",
"reth-ethereum-forks/std",
"reth-primitives-traits/std",
"reth-optimism-forks/std",
"alloy-consensus/std",
"once_cell/std",
]

View File

@ -3,11 +3,11 @@
use alloc::{sync::Arc, vec};
use alloy_chains::Chain;
use alloy_eips::eip1559::ETHEREUM_BLOCK_GAS_LIMIT;
use alloy_primitives::{b256, U256};
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};
use reth_ethereum_forks::EthereumHardfork;
use reth_optimism_forks::OptimismHardfork;
use reth_primitives_traits::constants::ETHEREUM_BLOCK_GAS_LIMIT;
use crate::{LazyLock, OpChainSpec};

View File

@ -3,11 +3,11 @@
use alloc::{sync::Arc, vec};
use alloy_chains::{Chain, NamedChain};
use alloy_eips::eip1559::ETHEREUM_BLOCK_GAS_LIMIT;
use alloy_primitives::{b256, U256};
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};
use reth_ethereum_forks::EthereumHardfork;
use reth_optimism_forks::OptimismHardfork;
use reth_primitives_traits::constants::ETHEREUM_BLOCK_GAS_LIMIT;
use crate::{LazyLock, OpChainSpec};

View File

@ -15,9 +15,6 @@ pub const EPOCH_SLOTS: u64 = 32;
/// The default block nonce in the beacon consensus
pub const BEACON_NONCE: u64 = 0u64;
/// The default Ethereum block gas limit.
pub const ETHEREUM_BLOCK_GAS_LIMIT: u64 = 30_000_000;
/// The minimum tx fee below which the txpool will reject the transaction.
///
/// Configured to `7` WEI which is the lowest possible value of base fee under mainnet EIP-1559

View File

@ -80,9 +80,8 @@ pub mod gas_oracle {
/// The default gas limit for `eth_call` and adjacent calls.
///
/// This is different from the default to regular 30M block gas limit
/// [`ETHEREUM_BLOCK_GAS_LIMIT`](reth_primitives::constants::ETHEREUM_BLOCK_GAS_LIMIT) to allow
/// for more complex calls.
/// This is different from the default to regular 30M block gas limit `ETHEREUM_BLOCK_GAS_LIMIT`
/// to allow for more complex calls.
pub const RPC_DEFAULT_GAS_CAP: u64 = 50_000_000;
/// Allowed error ratio for gas estimation

View File

@ -45,11 +45,11 @@ where
#[cfg(test)]
mod tests {
use super::*;
use alloy_eips::eip1559::ETHEREUM_BLOCK_GAS_LIMIT;
use alloy_primitives::{Address, StorageKey, StorageValue, U256};
use reth_chainspec::MAINNET;
use reth_evm_ethereum::EthEvmConfig;
use reth_network_api::noop::NoopNetwork;
use reth_primitives::constants::ETHEREUM_BLOCK_GAS_LIMIT;
use reth_provider::test_utils::{ExtendedAccount, MockEthProvider, NoopProvider};
use reth_rpc_eth_api::helpers::EthState;
use reth_rpc_eth_types::{

View File

@ -55,11 +55,11 @@ where
#[cfg(test)]
mod tests {
use alloy_eips::eip1559::ETHEREUM_BLOCK_GAS_LIMIT;
use alloy_primitives::{hex_literal::hex, Bytes};
use reth_chainspec::ChainSpecProvider;
use reth_evm_ethereum::EthEvmConfig;
use reth_network_api::noop::NoopNetwork;
use reth_primitives::constants::ETHEREUM_BLOCK_GAS_LIMIT;
use reth_provider::test_utils::NoopProvider;
use reth_rpc_eth_api::helpers::EthTransactions;
use reth_rpc_eth_types::{

View File

@ -3,8 +3,9 @@ use crate::{
PoolSize, TransactionOrigin,
};
use alloy_consensus::constants::EIP4844_TX_TYPE_ID;
use alloy_eips::eip1559::ETHEREUM_BLOCK_GAS_LIMIT;
use alloy_primitives::Address;
use reth_primitives::constants::{ETHEREUM_BLOCK_GAS_LIMIT, MIN_PROTOCOL_BASE_FEE};
use reth_primitives::constants::MIN_PROTOCOL_BASE_FEE;
use std::{collections::HashSet, ops::Mul};
/// Guarantees max transactions for one sender, compatible with geth/erigon

View File

@ -16,10 +16,10 @@ use crate::{
PooledTransactionsElement, PropagatedTransactions, TransactionEvents, TransactionOrigin,
TransactionPool, TransactionValidationOutcome, TransactionValidator, ValidPoolTransaction,
};
use alloy_eips::eip4844::BlobAndProofV1;
use alloy_eips::{eip1559::ETHEREUM_BLOCK_GAS_LIMIT, eip4844::BlobAndProofV1};
use alloy_primitives::{Address, TxHash, B256, U256};
use reth_eth_wire_types::HandleMempoolData;
use reth_primitives::{constants::ETHEREUM_BLOCK_GAS_LIMIT, BlobTransactionSidecar};
use reth_primitives::BlobTransactionSidecar;
use std::{collections::HashSet, marker::PhantomData, sync::Arc};
use tokio::sync::{mpsc, mpsc::Receiver};

View File

@ -22,10 +22,9 @@ use alloy_consensus::constants::{
EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
LEGACY_TX_TYPE_ID,
};
use alloy_eips::eip1559::ETHEREUM_BLOCK_GAS_LIMIT;
use alloy_primitives::{Address, TxHash, B256};
use reth_primitives::constants::{
eip4844::BLOB_TX_MIN_BLOB_GASPRICE, ETHEREUM_BLOCK_GAS_LIMIT, MIN_PROTOCOL_BASE_FEE,
};
use reth_primitives::constants::{eip4844::BLOB_TX_MIN_BLOB_GASPRICE, MIN_PROTOCOL_BASE_FEE};
use rustc_hash::FxHashMap;
use smallvec::SmallVec;
use std::{

View File

@ -1,8 +1,9 @@
//! Transaction pool eviction tests.
use alloy_eips::eip1559::ETHEREUM_BLOCK_GAS_LIMIT;
use alloy_primitives::{Address, B256};
use rand::distributions::Uniform;
use reth_primitives::constants::{ETHEREUM_BLOCK_GAS_LIMIT, MIN_PROTOCOL_BASE_FEE};
use reth_primitives::constants::MIN_PROTOCOL_BASE_FEE;
use reth_transaction_pool::{
error::PoolErrorKind,
test_utils::{