primitive-traits: use alloy INITIAL_BASE_FEE constant (#12022)

This commit is contained in:
Thomas Coratger
2024-10-24 11:53:15 +02:00
committed by GitHub
parent 0df3148357
commit 84a30b0404
8 changed files with 16 additions and 18 deletions

View File

@ -3,7 +3,7 @@ use crate::{
CanonStateSubscriptions,
};
use alloy_consensus::{Transaction as _, TxEip1559, EMPTY_ROOT_HASH};
use alloy_eips::eip7685::Requests;
use alloy_eips::{eip1559::INITIAL_BASE_FEE, eip7685::Requests};
use alloy_primitives::{Address, BlockNumber, Sealable, B256, U256};
use alloy_signer::SignerSync;
use alloy_signer_local::PrivateKeySigner;
@ -11,7 +11,6 @@ use rand::{thread_rng, Rng};
use reth_chainspec::{ChainSpec, EthereumHardfork, MIN_TRANSACTION_GAS};
use reth_execution_types::{Chain, ExecutionOutcome};
use reth_primitives::{
constants::EIP1559_INITIAL_BASE_FEE,
proofs::{calculate_receipt_root, calculate_transaction_root, calculate_withdrawals_root},
BlockBody, Header, Receipt, Receipts, SealedBlock, SealedBlockWithSenders, SealedHeader,
Transaction, TransactionSigned, TransactionSignedEcRecovered,
@ -75,7 +74,7 @@ impl TestBlockBuilder {
/// Gas cost of a single transaction generated by the block builder.
pub fn single_tx_cost() -> U256 {
U256::from(EIP1559_INITIAL_BASE_FEE * MIN_TRANSACTION_GAS)
U256::from(INITIAL_BASE_FEE * MIN_TRANSACTION_GAS)
}
/// Generates a random [`SealedBlockWithSenders`].
@ -92,7 +91,7 @@ impl TestBlockBuilder {
nonce,
gas_limit: MIN_TRANSACTION_GAS,
to: Address::random().into(),
max_fee_per_gas: EIP1559_INITIAL_BASE_FEE as u128,
max_fee_per_gas: INITIAL_BASE_FEE as u128,
max_priority_fee_per_gas: 1,
..Default::default()
});
@ -136,7 +135,7 @@ impl TestBlockBuilder {
gas_used: transactions.len() as u64 * MIN_TRANSACTION_GAS,
gas_limit: self.chain_spec.max_gas_limit,
mix_hash: B256::random(),
base_fee_per_gas: Some(EIP1559_INITIAL_BASE_FEE),
base_fee_per_gas: Some(INITIAL_BASE_FEE),
transactions_root: calculate_transaction_root(&transactions),
receipts_root: calculate_receipt_root(&receipts),
beneficiary: Address::random(),