mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: use MIN_TRANSACTION_GAS replace magic number (#10910)
This commit is contained in:
@ -5,7 +5,7 @@ use crate::{
|
||||
use alloy_signer::SignerSync;
|
||||
use alloy_signer_local::PrivateKeySigner;
|
||||
use rand::{thread_rng, Rng};
|
||||
use reth_chainspec::{ChainSpec, EthereumHardfork};
|
||||
use reth_chainspec::{ChainSpec, EthereumHardfork, MIN_TRANSACTION_GAS};
|
||||
use reth_execution_types::{Chain, ExecutionOutcome};
|
||||
use reth_primitives::{
|
||||
constants::{EIP1559_INITIAL_BASE_FEE, EMPTY_ROOT_HASH},
|
||||
@ -72,7 +72,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 * 21_000)
|
||||
U256::from(EIP1559_INITIAL_BASE_FEE * MIN_TRANSACTION_GAS)
|
||||
}
|
||||
|
||||
/// Generates a random [`SealedBlockWithSenders`].
|
||||
@ -87,7 +87,7 @@ impl TestBlockBuilder {
|
||||
let tx = Transaction::Eip1559(TxEip1559 {
|
||||
chain_id: self.chain_spec.chain.id(),
|
||||
nonce,
|
||||
gas_limit: 21_000,
|
||||
gas_limit: MIN_TRANSACTION_GAS as u128,
|
||||
to: Address::random().into(),
|
||||
max_fee_per_gas: EIP1559_INITIAL_BASE_FEE as u128,
|
||||
max_priority_fee_per_gas: 1,
|
||||
@ -125,7 +125,7 @@ impl TestBlockBuilder {
|
||||
Receipt {
|
||||
tx_type: tx.tx_type(),
|
||||
success: true,
|
||||
cumulative_gas_used: (idx as u64 + 1) * 21_000,
|
||||
cumulative_gas_used: (idx as u64 + 1) * MIN_TRANSACTION_GAS,
|
||||
..Default::default()
|
||||
}
|
||||
.with_bloom()
|
||||
@ -137,7 +137,7 @@ impl TestBlockBuilder {
|
||||
let header = Header {
|
||||
number,
|
||||
parent_hash,
|
||||
gas_used: transactions.len() as u64 * 21_000,
|
||||
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),
|
||||
@ -261,7 +261,7 @@ impl TestBlockBuilder {
|
||||
.map(|(idx, tx)| Receipt {
|
||||
tx_type: tx.tx_type(),
|
||||
success: true,
|
||||
cumulative_gas_used: (idx as u64 + 1) * 21_000,
|
||||
cumulative_gas_used: (idx as u64 + 1) * MIN_TRANSACTION_GAS,
|
||||
..Default::default()
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
Reference in New Issue
Block a user