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