Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions crates/chainspec/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions crates/node/core/src/args/payload_builder.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion crates/node/core/src/args/txpool.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand Down
22 changes: 12 additions & 10 deletions crates/optimism/chainspec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
]
2 changes: 1 addition & 1 deletion crates/optimism/chainspec/src/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/chainspec/src/op_sepolia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
3 changes: 0 additions & 3 deletions crates/primitives-traits/src/constants/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions crates/rpc/rpc-server-types/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/eth/helpers/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/eth/helpers/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
3 changes: 2 additions & 1 deletion crates/transaction-pool/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions crates/transaction-pool/src/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
5 changes: 2 additions & 3 deletions crates/transaction-pool/src/pool/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
3 changes: 2 additions & 1 deletion crates/transaction-pool/tests/it/evict.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down
Loading