mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: rm chainspec max gas limit (#13308)
This commit is contained in:
@ -1376,7 +1376,10 @@ where
|
||||
mod tests {
|
||||
use super::*;
|
||||
use alloy_consensus::{Header, TxEip1559, EMPTY_ROOT_HASH};
|
||||
use alloy_eips::{eip1559::INITIAL_BASE_FEE, eip4895::Withdrawals};
|
||||
use alloy_eips::{
|
||||
eip1559::{ETHEREUM_BLOCK_GAS_LIMIT, INITIAL_BASE_FEE},
|
||||
eip4895::Withdrawals,
|
||||
};
|
||||
use alloy_genesis::{Genesis, GenesisAccount};
|
||||
use alloy_primitives::{keccak256, Address, PrimitiveSignature as Signature, B256};
|
||||
use assert_matches::assert_matches;
|
||||
@ -1618,7 +1621,7 @@ mod tests {
|
||||
number,
|
||||
parent_hash: parent.unwrap_or_default(),
|
||||
gas_used: body.len() as u64 * MIN_TRANSACTION_GAS,
|
||||
gas_limit: chain_spec.max_gas_limit,
|
||||
gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||
mix_hash: B256::random(),
|
||||
base_fee_per_gas: Some(INITIAL_BASE_FEE),
|
||||
transactions_root,
|
||||
|
||||
@ -5,7 +5,10 @@ use crate::{
|
||||
CanonStateSubscriptions,
|
||||
};
|
||||
use alloy_consensus::{Header, Transaction as _, TxEip1559, EMPTY_ROOT_HASH};
|
||||
use alloy_eips::{eip1559::INITIAL_BASE_FEE, eip7685::Requests};
|
||||
use alloy_eips::{
|
||||
eip1559::{ETHEREUM_BLOCK_GAS_LIMIT, INITIAL_BASE_FEE},
|
||||
eip7685::Requests,
|
||||
};
|
||||
use alloy_primitives::{Address, BlockNumber, B256, U256};
|
||||
use alloy_signer::SignerSync;
|
||||
use alloy_signer_local::PrivateKeySigner;
|
||||
@ -137,8 +140,8 @@ impl TestBlockBuilder {
|
||||
number,
|
||||
parent_hash,
|
||||
gas_used: transactions.len() as u64 * MIN_TRANSACTION_GAS,
|
||||
gas_limit: self.chain_spec.max_gas_limit,
|
||||
mix_hash: B256::random(),
|
||||
gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||
base_fee_per_gas: Some(INITIAL_BASE_FEE),
|
||||
transactions_root: calculate_transaction_root(
|
||||
&transactions.clone().into_iter().map(|tx| tx.into_signed()).collect::<Vec<_>>(),
|
||||
|
||||
@ -49,9 +49,6 @@ pub trait EthChainSpec: Send + Sync + Unpin + Debug {
|
||||
/// The genesis block specification.
|
||||
fn genesis(&self) -> &Genesis;
|
||||
|
||||
/// The block gas limit.
|
||||
fn max_gas_limit(&self) -> u64;
|
||||
|
||||
/// The bootnodes for the chain, if any.
|
||||
fn bootnodes(&self) -> Option<Vec<NodeRecord>>;
|
||||
|
||||
@ -105,10 +102,6 @@ impl EthChainSpec for ChainSpec {
|
||||
self.genesis()
|
||||
}
|
||||
|
||||
fn max_gas_limit(&self) -> u64 {
|
||||
self.max_gas_limit
|
||||
}
|
||||
|
||||
fn bootnodes(&self) -> Option<Vec<NodeRecord>> {
|
||||
self.bootnodes()
|
||||
}
|
||||
|
||||
@ -1,8 +1,15 @@
|
||||
pub use alloy_eips::eip1559::BaseFeeParams;
|
||||
|
||||
use crate::{constants::MAINNET_DEPOSIT_CONTRACT, once_cell_set, EthChainSpec, LazyLock, OnceLock};
|
||||
use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
||||
use alloy_chains::{Chain, NamedChain};
|
||||
use alloy_consensus::constants::EMPTY_WITHDRAWALS;
|
||||
use alloy_consensus::{
|
||||
constants::{
|
||||
DEV_GENESIS_HASH, EMPTY_WITHDRAWALS, HOLESKY_GENESIS_HASH, MAINNET_GENESIS_HASH,
|
||||
SEPOLIA_GENESIS_HASH,
|
||||
},
|
||||
Header,
|
||||
};
|
||||
use alloy_eips::{
|
||||
eip1559::INITIAL_BASE_FEE, eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS,
|
||||
eip7685::EMPTY_REQUESTS_HASH,
|
||||
@ -10,14 +17,6 @@ use alloy_eips::{
|
||||
use alloy_genesis::Genesis;
|
||||
use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256};
|
||||
use derive_more::From;
|
||||
|
||||
use alloy_consensus::{
|
||||
constants::{
|
||||
DEV_GENESIS_HASH, HOLESKY_GENESIS_HASH, MAINNET_GENESIS_HASH, SEPOLIA_GENESIS_HASH,
|
||||
},
|
||||
Header,
|
||||
};
|
||||
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,
|
||||
@ -29,8 +28,6 @@ use reth_network_peers::{
|
||||
use reth_primitives_traits::SealedHeader;
|
||||
use reth_trie_common::root::state_root_ref_unhashed;
|
||||
|
||||
use crate::{constants::MAINNET_DEPOSIT_CONTRACT, once_cell_set, EthChainSpec, LazyLock, OnceLock};
|
||||
|
||||
/// The Ethereum mainnet spec
|
||||
pub static MAINNET: LazyLock<Arc<ChainSpec>> = LazyLock::new(|| {
|
||||
let mut spec = ChainSpec {
|
||||
@ -52,7 +49,6 @@ pub static MAINNET: LazyLock<Arc<ChainSpec>> = LazyLock::new(|| {
|
||||
b256!("649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5"),
|
||||
)),
|
||||
base_fee_params: BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
|
||||
max_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||
prune_delete_limit: 20000,
|
||||
};
|
||||
spec.genesis.config.dao_fork_support = true;
|
||||
@ -77,7 +73,6 @@ pub static SEPOLIA: LazyLock<Arc<ChainSpec>> = LazyLock::new(|| {
|
||||
b256!("649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5"),
|
||||
)),
|
||||
base_fee_params: BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
|
||||
max_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||
prune_delete_limit: 10000,
|
||||
};
|
||||
spec.genesis.config.dao_fork_support = true;
|
||||
@ -100,7 +95,6 @@ pub static HOLESKY: LazyLock<Arc<ChainSpec>> = LazyLock::new(|| {
|
||||
b256!("649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5"),
|
||||
)),
|
||||
base_fee_params: BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
|
||||
max_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||
prune_delete_limit: 10000,
|
||||
};
|
||||
spec.genesis.config.dao_fork_support = true;
|
||||
@ -208,9 +202,6 @@ pub struct ChainSpec {
|
||||
/// The parameters that configure how a block's base fee is computed
|
||||
pub base_fee_params: BaseFeeParamsKind,
|
||||
|
||||
/// The maximum gas limit
|
||||
pub max_gas_limit: u64,
|
||||
|
||||
/// The delete limit for pruner, per run.
|
||||
pub prune_delete_limit: usize,
|
||||
}
|
||||
@ -226,7 +217,6 @@ impl Default for ChainSpec {
|
||||
hardforks: Default::default(),
|
||||
deposit_contract: Default::default(),
|
||||
base_fee_params: BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
|
||||
max_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||
prune_delete_limit: MAINNET.prune_delete_limit,
|
||||
}
|
||||
}
|
||||
|
||||
@ -427,6 +427,7 @@ impl<N: ProviderNodeTypes> PipelineState<N> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use alloy_consensus::Header;
|
||||
use alloy_eips::eip1559::ETHEREUM_BLOCK_GAS_LIMIT;
|
||||
use assert_matches::assert_matches;
|
||||
use futures::poll;
|
||||
use reth_chainspec::{ChainSpec, ChainSpecBuilder, MAINNET};
|
||||
@ -633,7 +634,7 @@ mod tests {
|
||||
let client = TestFullBlockClient::default();
|
||||
let header = Header {
|
||||
base_fee_per_gas: Some(7),
|
||||
gas_limit: chain_spec.max_gas_limit,
|
||||
gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||
..Default::default()
|
||||
};
|
||||
let header = SealedHeader::seal(header);
|
||||
|
||||
@ -231,6 +231,7 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::test_utils::{insert_headers_into_client, TestPipelineBuilder};
|
||||
use alloy_consensus::Header;
|
||||
use alloy_eips::eip1559::ETHEREUM_BLOCK_GAS_LIMIT;
|
||||
use alloy_primitives::{BlockNumber, B256};
|
||||
use assert_matches::assert_matches;
|
||||
use futures::poll;
|
||||
@ -264,13 +265,13 @@ mod tests {
|
||||
checkpoint: StageCheckpoint::new(BlockNumber::from(pipeline_done_after)),
|
||||
done: true,
|
||||
})]))
|
||||
.build(chain_spec.clone());
|
||||
.build(chain_spec);
|
||||
|
||||
let pipeline_sync = PipelineSync::new(pipeline, Box::<TokioTaskExecutor>::default());
|
||||
let client = TestFullBlockClient::default();
|
||||
let header = Header {
|
||||
base_fee_per_gas: Some(7),
|
||||
gas_limit: chain_spec.max_gas_limit,
|
||||
gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||
..Default::default()
|
||||
};
|
||||
let header = SealedHeader::seal(header);
|
||||
|
||||
@ -321,6 +321,7 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::test_utils::insert_headers_into_client;
|
||||
use alloy_consensus::Header;
|
||||
use alloy_eips::eip1559::ETHEREUM_BLOCK_GAS_LIMIT;
|
||||
use assert_matches::assert_matches;
|
||||
use reth_beacon_consensus::EthBeaconConsensus;
|
||||
use reth_chainspec::{ChainSpecBuilder, MAINNET};
|
||||
@ -346,7 +347,7 @@ mod tests {
|
||||
let client = TestFullBlockClient::default();
|
||||
let header = Header {
|
||||
base_fee_per_gas: Some(7),
|
||||
gas_limit: chain_spec.max_gas_limit,
|
||||
gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||
..Default::default()
|
||||
};
|
||||
let header = SealedHeader::seal(header);
|
||||
|
||||
@ -29,8 +29,6 @@ pub static BASE_MAINNET: LazyLock<Arc<OpChainSpec>> = LazyLock::new(|| {
|
||||
]
|
||||
.into(),
|
||||
),
|
||||
max_gas_limit: crate::constants::BASE_MAINNET_MAX_GAS_LIMIT,
|
||||
prune_delete_limit: 10000,
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
|
||||
@ -29,7 +29,6 @@ pub static BASE_SEPOLIA: LazyLock<Arc<OpChainSpec>> = LazyLock::new(|| {
|
||||
]
|
||||
.into(),
|
||||
),
|
||||
max_gas_limit: crate::constants::BASE_SEPOLIA_MAX_GAS_LIMIT,
|
||||
prune_delete_limit: 10000,
|
||||
..Default::default()
|
||||
},
|
||||
|
||||
@ -317,10 +317,6 @@ impl EthChainSpec for OpChainSpec {
|
||||
self.inner.genesis()
|
||||
}
|
||||
|
||||
fn max_gas_limit(&self) -> u64 {
|
||||
self.inner.max_gas_limit()
|
||||
}
|
||||
|
||||
fn bootnodes(&self) -> Option<Vec<NodeRecord>> {
|
||||
self.inner.bootnodes()
|
||||
}
|
||||
@ -1079,7 +1075,6 @@ mod tests {
|
||||
paris_block_and_final_difficulty: Some((0, U256::from(0))),
|
||||
hardforks,
|
||||
base_fee_params: BASE_SEPOLIA.inner.base_fee_params.clone(),
|
||||
max_gas_limit: crate::constants::BASE_SEPOLIA_MAX_GAS_LIMIT,
|
||||
prune_delete_limit: 10000,
|
||||
..Default::default()
|
||||
},
|
||||
|
||||
@ -1,16 +1,13 @@
|
||||
//! Chain specification for the Optimism Mainnet network.
|
||||
|
||||
use crate::{LazyLock, OpChainSpec};
|
||||
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::OpHardfork;
|
||||
|
||||
use crate::{LazyLock, OpChainSpec};
|
||||
|
||||
/// The Optimism Mainnet spec
|
||||
pub static OP_MAINNET: LazyLock<Arc<OpChainSpec>> = LazyLock::new(|| {
|
||||
OpChainSpec {
|
||||
@ -32,7 +29,6 @@ pub static OP_MAINNET: LazyLock<Arc<OpChainSpec>> = LazyLock::new(|| {
|
||||
]
|
||||
.into(),
|
||||
),
|
||||
max_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||
prune_delete_limit: 10000,
|
||||
..Default::default()
|
||||
},
|
||||
|
||||
@ -1,16 +1,13 @@
|
||||
//! Chain specification for the Optimism Sepolia testnet network.
|
||||
|
||||
use crate::{LazyLock, OpChainSpec};
|
||||
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::OpHardfork;
|
||||
|
||||
use crate::{LazyLock, OpChainSpec};
|
||||
|
||||
/// The OP Sepolia spec
|
||||
pub static OP_SEPOLIA: LazyLock<Arc<OpChainSpec>> = LazyLock::new(|| {
|
||||
OpChainSpec {
|
||||
@ -30,7 +27,6 @@ pub static OP_SEPOLIA: LazyLock<Arc<OpChainSpec>> = LazyLock::new(|| {
|
||||
]
|
||||
.into(),
|
||||
),
|
||||
max_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||
prune_delete_limit: 10000,
|
||||
..Default::default()
|
||||
},
|
||||
|
||||
@ -212,7 +212,6 @@ mod test {
|
||||
.paris_block_and_final_difficulty,
|
||||
hardforks,
|
||||
base_fee_params: BASE_SEPOLIA.inner.base_fee_params.clone(),
|
||||
max_gas_limit: BASE_SEPOLIA.inner.max_gas_limit,
|
||||
prune_delete_limit: 10000,
|
||||
..Default::default()
|
||||
},
|
||||
|
||||
@ -5,8 +5,8 @@ use crate::{AsEthApiError, FromEthApiError, IntoEthApiError};
|
||||
use alloy_primitives::U256;
|
||||
use alloy_rpc_types_eth::{state::StateOverride, transaction::TransactionRequest, BlockId};
|
||||
use futures::Future;
|
||||
use reth_chainspec::{EthChainSpec, MIN_TRANSACTION_GAS};
|
||||
use reth_provider::{ChainSpecProvider, StateProvider};
|
||||
use reth_chainspec::MIN_TRANSACTION_GAS;
|
||||
use reth_provider::StateProvider;
|
||||
use reth_revm::{
|
||||
database::StateProviderDatabase,
|
||||
db::CacheDB,
|
||||
@ -116,9 +116,7 @@ pub trait EstimateCall: Call {
|
||||
}
|
||||
|
||||
// We can now normalize the highest gas limit to a u64
|
||||
let mut highest_gas_limit: u64 = highest_gas_limit
|
||||
.try_into()
|
||||
.unwrap_or_else(|_| self.provider().chain_spec().max_gas_limit());
|
||||
let mut highest_gas_limit = highest_gas_limit.saturating_to::<u64>();
|
||||
|
||||
// If the provided gas limit is less than computed cap, use that
|
||||
env.tx.gas_limit = env.tx.gas_limit.min(highest_gas_limit);
|
||||
|
||||
@ -452,12 +452,13 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::EthApi;
|
||||
use alloy_consensus::Header;
|
||||
use alloy_eips::BlockNumberOrTag;
|
||||
use alloy_primitives::{PrimitiveSignature as Signature, B256, U64};
|
||||
use alloy_rpc_types::FeeHistory;
|
||||
use jsonrpsee_types::error::INVALID_PARAMS_CODE;
|
||||
use reth_chainspec::{BaseFeeParams, ChainSpec, EthChainSpec};
|
||||
use reth_chainspec::{BaseFeeParams, ChainSpec};
|
||||
use reth_evm_ethereum::EthEvmConfig;
|
||||
use reth_network_api::noop::NoopNetwork;
|
||||
use reth_primitives::{Block, BlockBody, TransactionSigned};
|
||||
@ -467,7 +468,7 @@ mod tests {
|
||||
};
|
||||
use reth_rpc_eth_api::EthApiServer;
|
||||
use reth_rpc_eth_types::{
|
||||
EthStateCache, FeeHistoryCache, FeeHistoryCacheConfig, GasPriceOracle,
|
||||
EthStateCache, FeeHistoryCache, FeeHistoryCacheConfig, GasCap, GasPriceOracle,
|
||||
};
|
||||
use reth_rpc_server_types::constants::{
|
||||
DEFAULT_ETH_PROOF_WINDOW, DEFAULT_MAX_SIMULATE_BLOCKS, DEFAULT_PROOF_PERMITS,
|
||||
@ -476,8 +477,6 @@ mod tests {
|
||||
use reth_testing_utils::{generators, generators::Rng};
|
||||
use reth_transaction_pool::test_utils::{testing_pool, TestPool};
|
||||
|
||||
use crate::EthApi;
|
||||
|
||||
fn build_test_eth_api<
|
||||
P: BlockReaderIdExt<
|
||||
Block = reth_primitives::Block,
|
||||
@ -497,14 +496,13 @@ mod tests {
|
||||
let cache = EthStateCache::spawn(provider.clone(), Default::default());
|
||||
let fee_history_cache = FeeHistoryCache::new(FeeHistoryCacheConfig::default());
|
||||
|
||||
let gas_cap = provider.chain_spec().max_gas_limit();
|
||||
EthApi::new(
|
||||
provider.clone(),
|
||||
testing_pool(),
|
||||
NoopNetwork::default(),
|
||||
cache.clone(),
|
||||
GasPriceOracle::new(provider, Default::default(), cache),
|
||||
gas_cap,
|
||||
GasCap::default(),
|
||||
DEFAULT_MAX_SIMULATE_BLOCKS,
|
||||
DEFAULT_ETH_PROOF_WINDOW,
|
||||
BlockingTaskPool::build().expect("failed to build tracing pool"),
|
||||
|
||||
@ -18,7 +18,10 @@ use alloy_consensus::{
|
||||
},
|
||||
BlockHeader,
|
||||
};
|
||||
use alloy_eips::eip4844::{env_settings::EnvKzgSettings, MAX_BLOBS_PER_BLOCK};
|
||||
use alloy_eips::{
|
||||
eip1559::ETHEREUM_BLOCK_GAS_LIMIT,
|
||||
eip4844::{env_settings::EnvKzgSettings, MAX_BLOBS_PER_BLOCK},
|
||||
};
|
||||
use reth_chainspec::{ChainSpec, EthereumHardforks};
|
||||
use reth_primitives::{InvalidTransactionError, SealedBlock};
|
||||
use reth_primitives_traits::GotExpected;
|
||||
@ -530,7 +533,7 @@ impl EthTransactionValidatorBuilder {
|
||||
/// - EIP-4844
|
||||
pub fn new(chain_spec: Arc<ChainSpec>) -> Self {
|
||||
Self {
|
||||
block_gas_limit: chain_spec.max_gas_limit,
|
||||
block_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||
chain_spec,
|
||||
minimum_priority_fee: None,
|
||||
additional_tasks: 1,
|
||||
|
||||
@ -23,7 +23,6 @@ pub(crate) fn bsc_chain_spec() -> Arc<ChainSpec> {
|
||||
)]),
|
||||
deposit_contract: None,
|
||||
base_fee_params: reth_chainspec::BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
|
||||
max_gas_limit: 140_000_000,
|
||||
prune_delete_limit: 0,
|
||||
}
|
||||
.into()
|
||||
|
||||
@ -29,7 +29,6 @@ pub(crate) fn polygon_chain_spec() -> Arc<ChainSpec> {
|
||||
]),
|
||||
deposit_contract: None,
|
||||
base_fee_params: reth_chainspec::BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
|
||||
max_gas_limit: 30_000_000,
|
||||
prune_delete_limit: 0,
|
||||
}
|
||||
.into()
|
||||
|
||||
Reference in New Issue
Block a user