mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add max_gas_limit to ChainSpec (#9473)
This commit is contained in:
@ -1380,7 +1380,7 @@ mod tests {
|
|||||||
#[cfg(feature = "optimism")]
|
#[cfg(feature = "optimism")]
|
||||||
use reth_primitives::proofs::calculate_receipt_root_optimism;
|
use reth_primitives::proofs::calculate_receipt_root_optimism;
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
constants::{EIP1559_INITIAL_BASE_FEE, EMPTY_ROOT_HASH, ETHEREUM_BLOCK_GAS_LIMIT},
|
constants::{EIP1559_INITIAL_BASE_FEE, EMPTY_ROOT_HASH},
|
||||||
keccak256,
|
keccak256,
|
||||||
proofs::calculate_transaction_root,
|
proofs::calculate_transaction_root,
|
||||||
revm_primitives::AccountInfo,
|
revm_primitives::AccountInfo,
|
||||||
@ -1599,7 +1599,7 @@ mod tests {
|
|||||||
number,
|
number,
|
||||||
parent_hash: parent.unwrap_or_default(),
|
parent_hash: parent.unwrap_or_default(),
|
||||||
gas_used: body.len() as u64 * 21_000,
|
gas_used: body.len() as u64 * 21_000,
|
||||||
gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
gas_limit: chain_spec.max_gas_limit,
|
||||||
mix_hash: B256::random(),
|
mix_hash: B256::random(),
|
||||||
base_fee_per_gas: Some(EIP1559_INITIAL_BASE_FEE),
|
base_fee_per_gas: Some(EIP1559_INITIAL_BASE_FEE),
|
||||||
transactions_root,
|
transactions_root,
|
||||||
|
|||||||
@ -7,3 +7,11 @@ pub(crate) const MAINNET_DEPOSIT_CONTRACT: DepositContract = DepositContract::ne
|
|||||||
11052984,
|
11052984,
|
||||||
b256!("649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5"),
|
b256!("649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5"),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// Max gas limit on Base Sepolia: <https://sepolia.basescan.org/block/12506483>
|
||||||
|
#[cfg(feature = "optimism")]
|
||||||
|
pub(crate) const BASE_SEPOLIA_MAX_GAS_LIMIT: u64 = 45_000_000;
|
||||||
|
|
||||||
|
/// Max gas limit on Base: <https://basescan.org/block/16995982>
|
||||||
|
#[cfg(feature = "optimism")]
|
||||||
|
pub(crate) const BASE_MAINNET_MAX_GAS_LIMIT: u64 = 97_500_000;
|
||||||
|
|||||||
@ -14,8 +14,8 @@ use reth_ethereum_forks::{
|
|||||||
use reth_network_peers::NodeRecord;
|
use reth_network_peers::NodeRecord;
|
||||||
use reth_primitives_traits::{
|
use reth_primitives_traits::{
|
||||||
constants::{
|
constants::{
|
||||||
DEV_GENESIS_HASH, EIP1559_INITIAL_BASE_FEE, EMPTY_WITHDRAWALS, HOLESKY_GENESIS_HASH,
|
DEV_GENESIS_HASH, EIP1559_INITIAL_BASE_FEE, EMPTY_WITHDRAWALS, ETHEREUM_BLOCK_GAS_LIMIT,
|
||||||
MAINNET_GENESIS_HASH, SEPOLIA_GENESIS_HASH,
|
HOLESKY_GENESIS_HASH, MAINNET_GENESIS_HASH, SEPOLIA_GENESIS_HASH,
|
||||||
},
|
},
|
||||||
Header, SealedHeader,
|
Header, SealedHeader,
|
||||||
};
|
};
|
||||||
@ -51,6 +51,7 @@ pub static MAINNET: Lazy<Arc<ChainSpec>> = Lazy::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;
|
||||||
@ -74,6 +75,7 @@ pub static SEPOLIA: Lazy<Arc<ChainSpec>> = Lazy::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;
|
||||||
@ -95,6 +97,7 @@ pub static HOLESKY: Lazy<Arc<ChainSpec>> = Lazy::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;
|
||||||
@ -141,6 +144,7 @@ pub static OP_MAINNET: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
|||||||
]
|
]
|
||||||
.into(),
|
.into(),
|
||||||
),
|
),
|
||||||
|
max_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||||
prune_delete_limit: 10000,
|
prune_delete_limit: 10000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
@ -166,6 +170,7 @@ pub static OP_SEPOLIA: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
|||||||
]
|
]
|
||||||
.into(),
|
.into(),
|
||||||
),
|
),
|
||||||
|
max_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
||||||
prune_delete_limit: 10000,
|
prune_delete_limit: 10000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
@ -191,6 +196,7 @@ pub static BASE_SEPOLIA: Lazy<Arc<ChainSpec>> = Lazy::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()
|
||||||
}
|
}
|
||||||
@ -216,6 +222,7 @@ pub static BASE_MAINNET: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
|||||||
]
|
]
|
||||||
.into(),
|
.into(),
|
||||||
),
|
),
|
||||||
|
max_gas_limit: crate::constants::BASE_MAINNET_MAX_GAS_LIMIT,
|
||||||
prune_delete_limit: 10000,
|
prune_delete_limit: 10000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
@ -298,6 +305,9 @@ 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,
|
||||||
}
|
}
|
||||||
@ -312,6 +322,7 @@ 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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,9 +22,9 @@ use reth_engine_primitives::EngineTypes;
|
|||||||
use reth_execution_errors::{BlockExecutionError, BlockValidationError};
|
use reth_execution_errors::{BlockExecutionError, BlockValidationError};
|
||||||
use reth_execution_types::ExecutionOutcome;
|
use reth_execution_types::ExecutionOutcome;
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
constants::ETHEREUM_BLOCK_GAS_LIMIT, eip4844::calculate_excess_blob_gas, proofs, Block,
|
eip4844::calculate_excess_blob_gas, proofs, Block, BlockBody, BlockHash, BlockHashOrNumber,
|
||||||
BlockBody, BlockHash, BlockHashOrNumber, BlockNumber, BlockWithSenders, Bloom, Header,
|
BlockNumber, BlockWithSenders, Bloom, Header, Requests, SealedBlock, SealedHeader,
|
||||||
Requests, SealedBlock, SealedHeader, TransactionSigned, Withdrawals, B256, U256,
|
TransactionSigned, Withdrawals, B256, U256,
|
||||||
};
|
};
|
||||||
use reth_provider::{BlockReaderIdExt, StateProviderFactory, StateRootProvider};
|
use reth_provider::{BlockReaderIdExt, StateProviderFactory, StateRootProvider};
|
||||||
use reth_revm::database::StateProviderDatabase;
|
use reth_revm::database::StateProviderDatabase;
|
||||||
@ -293,7 +293,7 @@ impl StorageInner {
|
|||||||
logs_bloom: Default::default(),
|
logs_bloom: Default::default(),
|
||||||
difficulty: U256::from(2),
|
difficulty: U256::from(2),
|
||||||
number: self.best_block + 1,
|
number: self.best_block + 1,
|
||||||
gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
gas_limit: chain_spec.max_gas_limit,
|
||||||
gas_used: 0,
|
gas_used: 0,
|
||||||
timestamp,
|
timestamp,
|
||||||
mix_hash: Default::default(),
|
mix_hash: Default::default(),
|
||||||
|
|||||||
@ -417,7 +417,7 @@ mod tests {
|
|||||||
use reth_chainspec::{ChainSpecBuilder, MAINNET};
|
use reth_chainspec::{ChainSpecBuilder, MAINNET};
|
||||||
use reth_db::{mdbx::DatabaseEnv, test_utils::TempDatabase};
|
use reth_db::{mdbx::DatabaseEnv, test_utils::TempDatabase};
|
||||||
use reth_network_p2p::{either::Either, test_utils::TestFullBlockClient};
|
use reth_network_p2p::{either::Either, test_utils::TestFullBlockClient};
|
||||||
use reth_primitives::{constants::ETHEREUM_BLOCK_GAS_LIMIT, BlockBody, Header, SealedHeader};
|
use reth_primitives::{BlockBody, Header, SealedHeader};
|
||||||
use reth_provider::{
|
use reth_provider::{
|
||||||
test_utils::create_test_provider_factory_with_chain_spec, ExecutionOutcome,
|
test_utils::create_test_provider_factory_with_chain_spec, ExecutionOutcome,
|
||||||
};
|
};
|
||||||
@ -618,7 +618,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: ETHEREUM_BLOCK_GAS_LIMIT,
|
gas_limit: chain_spec.max_gas_limit,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
.seal_slow();
|
.seal_slow();
|
||||||
|
|||||||
@ -212,7 +212,7 @@ mod tests {
|
|||||||
use reth_chainspec::{ChainSpecBuilder, MAINNET};
|
use reth_chainspec::{ChainSpecBuilder, MAINNET};
|
||||||
use reth_db::{mdbx::DatabaseEnv, test_utils::TempDatabase};
|
use reth_db::{mdbx::DatabaseEnv, test_utils::TempDatabase};
|
||||||
use reth_network_p2p::test_utils::TestFullBlockClient;
|
use reth_network_p2p::test_utils::TestFullBlockClient;
|
||||||
use reth_primitives::{constants::ETHEREUM_BLOCK_GAS_LIMIT, BlockNumber, Header, B256};
|
use reth_primitives::{BlockNumber, Header, B256};
|
||||||
use reth_stages::ExecOutput;
|
use reth_stages::ExecOutput;
|
||||||
use reth_stages_api::StageCheckpoint;
|
use reth_stages_api::StageCheckpoint;
|
||||||
use reth_tasks::TokioTaskExecutor;
|
use reth_tasks::TokioTaskExecutor;
|
||||||
@ -239,13 +239,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);
|
.build(chain_spec.clone());
|
||||||
|
|
||||||
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: ETHEREUM_BLOCK_GAS_LIMIT,
|
gas_limit: chain_spec.max_gas_limit,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
.seal_slow();
|
.seal_slow();
|
||||||
|
|||||||
@ -274,7 +274,7 @@ mod tests {
|
|||||||
use reth_beacon_consensus::EthBeaconConsensus;
|
use reth_beacon_consensus::EthBeaconConsensus;
|
||||||
use reth_chainspec::{ChainSpecBuilder, MAINNET};
|
use reth_chainspec::{ChainSpecBuilder, MAINNET};
|
||||||
use reth_network_p2p::test_utils::TestFullBlockClient;
|
use reth_network_p2p::test_utils::TestFullBlockClient;
|
||||||
use reth_primitives::{constants::ETHEREUM_BLOCK_GAS_LIMIT, Header};
|
use reth_primitives::Header;
|
||||||
use std::{future::poll_fn, sync::Arc};
|
use std::{future::poll_fn, sync::Arc};
|
||||||
|
|
||||||
struct TestHarness {
|
struct TestHarness {
|
||||||
@ -295,7 +295,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: ETHEREUM_BLOCK_GAS_LIMIT,
|
gas_limit: chain_spec.max_gas_limit,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
.seal_slow();
|
.seal_slow();
|
||||||
|
|||||||
@ -113,7 +113,8 @@ where
|
|||||||
|
|
||||||
let base_fee = initialized_block_env.basefee.to::<u64>();
|
let base_fee = initialized_block_env.basefee.to::<u64>();
|
||||||
let block_number = initialized_block_env.number.to::<u64>();
|
let block_number = initialized_block_env.number.to::<u64>();
|
||||||
let block_gas_limit = initialized_block_env.gas_limit.try_into().unwrap_or(u64::MAX);
|
let block_gas_limit =
|
||||||
|
initialized_block_env.gas_limit.try_into().unwrap_or(chain_spec.max_gas_limit);
|
||||||
|
|
||||||
// apply eip-4788 pre block contract call
|
// apply eip-4788 pre block contract call
|
||||||
pre_block_beacon_root_contract_call(
|
pre_block_beacon_root_contract_call(
|
||||||
@ -280,7 +281,8 @@ where
|
|||||||
debug!(target: "payload_builder", id=%attributes.id, parent_hash = ?parent_block.hash(), parent_number = parent_block.number, "building new payload");
|
debug!(target: "payload_builder", id=%attributes.id, parent_hash = ?parent_block.hash(), parent_number = parent_block.number, "building new payload");
|
||||||
let mut cumulative_gas_used = 0;
|
let mut cumulative_gas_used = 0;
|
||||||
let mut sum_blob_gas_used = 0;
|
let mut sum_blob_gas_used = 0;
|
||||||
let block_gas_limit: u64 = initialized_block_env.gas_limit.try_into().unwrap_or(u64::MAX);
|
let block_gas_limit: u64 =
|
||||||
|
initialized_block_env.gas_limit.try_into().unwrap_or(chain_spec.max_gas_limit);
|
||||||
let base_fee = initialized_block_env.basefee.to::<u64>();
|
let base_fee = initialized_block_env.basefee.to::<u64>();
|
||||||
|
|
||||||
let mut executed_txs = Vec::new();
|
let mut executed_txs = Vec::new();
|
||||||
|
|||||||
@ -111,7 +111,8 @@ where
|
|||||||
|
|
||||||
let base_fee = initialized_block_env.basefee.to::<u64>();
|
let base_fee = initialized_block_env.basefee.to::<u64>();
|
||||||
let block_number = initialized_block_env.number.to::<u64>();
|
let block_number = initialized_block_env.number.to::<u64>();
|
||||||
let block_gas_limit: u64 = initialized_block_env.gas_limit.try_into().unwrap_or(u64::MAX);
|
let block_gas_limit: u64 =
|
||||||
|
initialized_block_env.gas_limit.try_into().unwrap_or(chain_spec.max_gas_limit);
|
||||||
|
|
||||||
// apply eip-4788 pre block contract call
|
// apply eip-4788 pre block contract call
|
||||||
pre_block_beacon_root_contract_call(
|
pre_block_beacon_root_contract_call(
|
||||||
@ -255,9 +256,9 @@ where
|
|||||||
debug!(target: "payload_builder", id=%attributes.payload_attributes.payload_id(), parent_hash = ?parent_block.hash(), parent_number = parent_block.number, "building new payload");
|
debug!(target: "payload_builder", id=%attributes.payload_attributes.payload_id(), parent_hash = ?parent_block.hash(), parent_number = parent_block.number, "building new payload");
|
||||||
|
|
||||||
let mut cumulative_gas_used = 0;
|
let mut cumulative_gas_used = 0;
|
||||||
let block_gas_limit: u64 = attributes
|
let block_gas_limit: u64 = attributes.gas_limit.unwrap_or_else(|| {
|
||||||
.gas_limit
|
initialized_block_env.gas_limit.try_into().unwrap_or(chain_spec.max_gas_limit)
|
||||||
.unwrap_or_else(|| initialized_block_env.gas_limit.try_into().unwrap_or(u64::MAX));
|
});
|
||||||
let base_fee = initialized_block_env.basefee.to::<u64>();
|
let base_fee = initialized_block_env.basefee.to::<u64>();
|
||||||
|
|
||||||
let mut executed_txs = Vec::with_capacity(attributes.transactions.len());
|
let mut executed_txs = Vec::with_capacity(attributes.transactions.len());
|
||||||
|
|||||||
@ -126,7 +126,7 @@ impl<Eth: Call> Call for OpEthApi<Eth> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<Eth: LoadState> LoadState for OpEthApi<Eth> {
|
impl<Eth: LoadState> LoadState for OpEthApi<Eth> {
|
||||||
fn provider(&self) -> impl StateProviderFactory {
|
fn provider(&self) -> impl StateProviderFactory + ChainSpecProvider {
|
||||||
LoadState::provider(&self.inner)
|
LoadState::provider(&self.inner)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ use reth_primitives::{
|
|||||||
},
|
},
|
||||||
Bytes, TransactionSignedEcRecovered, TxKind, B256, U256,
|
Bytes, TransactionSignedEcRecovered, TxKind, B256, U256,
|
||||||
};
|
};
|
||||||
use reth_provider::StateProvider;
|
use reth_provider::{ChainSpecProvider, StateProvider};
|
||||||
use reth_revm::{database::StateProviderDatabase, db::CacheDB, DatabaseRef};
|
use reth_revm::{database::StateProviderDatabase, db::CacheDB, DatabaseRef};
|
||||||
use reth_rpc_eth_types::{
|
use reth_rpc_eth_types::{
|
||||||
cache::db::{StateCacheDbRefMutWrapper, StateProviderTraitObjWrapper},
|
cache::db::{StateCacheDbRefMutWrapper, StateProviderTraitObjWrapper},
|
||||||
@ -572,7 +572,8 @@ pub trait Call: LoadState + SpawnBlocking {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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.try_into().unwrap_or(u64::MAX);
|
let mut highest_gas_limit: u64 =
|
||||||
|
highest_gas_limit.try_into().unwrap_or(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);
|
||||||
|
|||||||
@ -5,7 +5,9 @@ use futures::Future;
|
|||||||
use reth_errors::RethError;
|
use reth_errors::RethError;
|
||||||
use reth_evm::ConfigureEvmEnv;
|
use reth_evm::ConfigureEvmEnv;
|
||||||
use reth_primitives::{Address, BlockId, Bytes, Header, B256, U256};
|
use reth_primitives::{Address, BlockId, Bytes, Header, B256, U256};
|
||||||
use reth_provider::{BlockIdReader, StateProvider, StateProviderBox, StateProviderFactory};
|
use reth_provider::{
|
||||||
|
BlockIdReader, ChainSpecProvider, StateProvider, StateProviderBox, StateProviderFactory,
|
||||||
|
};
|
||||||
use reth_rpc_eth_types::{
|
use reth_rpc_eth_types::{
|
||||||
EthApiError, EthResult, EthStateCache, PendingBlockEnv, RpcInvalidTransactionError,
|
EthApiError, EthResult, EthStateCache, PendingBlockEnv, RpcInvalidTransactionError,
|
||||||
};
|
};
|
||||||
@ -126,7 +128,7 @@ pub trait LoadState {
|
|||||||
/// Returns a handle for reading state from database.
|
/// Returns a handle for reading state from database.
|
||||||
///
|
///
|
||||||
/// Data access in default trait method implementations.
|
/// Data access in default trait method implementations.
|
||||||
fn provider(&self) -> impl StateProviderFactory;
|
fn provider(&self) -> impl StateProviderFactory + ChainSpecProvider;
|
||||||
|
|
||||||
/// Returns a handle for reading data from memory.
|
/// Returns a handle for reading data from memory.
|
||||||
///
|
///
|
||||||
|
|||||||
@ -315,10 +315,7 @@ mod tests {
|
|||||||
use reth_chainspec::BaseFeeParams;
|
use reth_chainspec::BaseFeeParams;
|
||||||
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::{
|
use reth_primitives::{Block, BlockNumberOrTag, Header, TransactionSigned, B256, U64};
|
||||||
constants::ETHEREUM_BLOCK_GAS_LIMIT, Block, BlockNumberOrTag, Header, TransactionSigned,
|
|
||||||
B256, U64,
|
|
||||||
};
|
|
||||||
use reth_provider::{
|
use reth_provider::{
|
||||||
test_utils::{MockEthProvider, NoopProvider},
|
test_utils::{MockEthProvider, NoopProvider},
|
||||||
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, StateProviderFactory,
|
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, StateProviderFactory,
|
||||||
@ -352,13 +349,14 @@ mod tests {
|
|||||||
let fee_history_cache =
|
let fee_history_cache =
|
||||||
FeeHistoryCache::new(cache.clone(), FeeHistoryCacheConfig::default());
|
FeeHistoryCache::new(cache.clone(), 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),
|
||||||
ETHEREUM_BLOCK_GAS_LIMIT,
|
gas_cap,
|
||||||
DEFAULT_ETH_PROOF_WINDOW,
|
DEFAULT_ETH_PROOF_WINDOW,
|
||||||
BlockingTaskPool::build().expect("failed to build tracing pool"),
|
BlockingTaskPool::build().expect("failed to build tracing pool"),
|
||||||
fee_history_cache,
|
fee_history_cache,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//! Contains RPC handler implementations specific to state.
|
//! Contains RPC handler implementations specific to state.
|
||||||
|
|
||||||
use reth_provider::StateProviderFactory;
|
use reth_provider::{ChainSpecProvider, StateProviderFactory};
|
||||||
use reth_transaction_pool::TransactionPool;
|
use reth_transaction_pool::TransactionPool;
|
||||||
|
|
||||||
use reth_rpc_eth_api::helpers::{EthState, LoadState, SpawnBlocking};
|
use reth_rpc_eth_api::helpers::{EthState, LoadState, SpawnBlocking};
|
||||||
@ -19,11 +19,11 @@ where
|
|||||||
|
|
||||||
impl<Provider, Pool, Network, EvmConfig> LoadState for EthApi<Provider, Pool, Network, EvmConfig>
|
impl<Provider, Pool, Network, EvmConfig> LoadState for EthApi<Provider, Pool, Network, EvmConfig>
|
||||||
where
|
where
|
||||||
Provider: StateProviderFactory,
|
Provider: StateProviderFactory + ChainSpecProvider,
|
||||||
Pool: TransactionPool,
|
Pool: TransactionPool,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn provider(&self) -> impl StateProviderFactory {
|
fn provider(&self) -> impl StateProviderFactory + ChainSpecProvider {
|
||||||
self.inner.provider()
|
self.inner.provider()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,9 +11,9 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use reth_chainspec::{ChainSpec, EthereumHardforks};
|
use reth_chainspec::{ChainSpec, EthereumHardforks};
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
constants::{eip4844::MAX_BLOBS_PER_BLOCK, ETHEREUM_BLOCK_GAS_LIMIT},
|
constants::eip4844::MAX_BLOBS_PER_BLOCK, GotExpected, InvalidTransactionError, SealedBlock,
|
||||||
GotExpected, InvalidTransactionError, SealedBlock, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID,
|
EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
|
||||||
EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID, LEGACY_TX_TYPE_ID,
|
LEGACY_TX_TYPE_ID,
|
||||||
};
|
};
|
||||||
use reth_provider::{AccountReader, BlockReaderIdExt, StateProviderFactory};
|
use reth_provider::{AccountReader, BlockReaderIdExt, StateProviderFactory};
|
||||||
use reth_tasks::TaskSpawner;
|
use reth_tasks::TaskSpawner;
|
||||||
@ -479,8 +479,8 @@ 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,
|
||||||
chain_spec,
|
chain_spec,
|
||||||
block_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
|
|
||||||
minimum_priority_fee: None,
|
minimum_priority_fee: None,
|
||||||
additional_tasks: 1,
|
additional_tasks: 1,
|
||||||
kzg_settings: EnvKzgSettings::Default,
|
kzg_settings: EnvKzgSettings::Default,
|
||||||
|
|||||||
@ -22,6 +22,7 @@ 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()
|
||||||
|
|||||||
@ -27,6 +27,7 @@ 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