primitives: use alloy Header struct (#10691)

This commit is contained in:
Thomas Coratger
2024-09-23 14:53:43 +02:00
committed by GitHub
parent 7529d36515
commit ed1de8996d
85 changed files with 826 additions and 991 deletions

View File

@ -9,10 +9,11 @@ use rand::{thread_rng, Rng};
use reth_chainspec::{ChainSpec, EthereumHardfork, MIN_TRANSACTION_GAS};
use reth_execution_types::{Chain, ExecutionOutcome};
use reth_primitives::{
alloy_primitives::Sealable,
constants::{EIP1559_INITIAL_BASE_FEE, EMPTY_ROOT_HASH},
proofs::{calculate_receipt_root, calculate_transaction_root, calculate_withdrawals_root},
Header, Receipt, Receipts, Requests, SealedBlock, SealedBlockWithSenders, Signature,
Transaction, TransactionSigned, TransactionSignedEcRecovered, TxEip1559,
Header, Receipt, Receipts, Requests, SealedBlock, SealedBlockWithSenders, SealedHeader,
Signature, Transaction, TransactionSigned, TransactionSignedEcRecovered, TxEip1559,
};
use reth_trie::{root::state_root_unhashed, updates::TrieUpdates, HashedPostState};
use revm::{db::BundleState, primitives::AccountInfo};
@ -138,10 +139,10 @@ impl TestBlockBuilder {
let header = Header {
number,
parent_hash,
gas_used: transactions.len() as u64 * MIN_TRANSACTION_GAS,
gas_limit: self.chain_spec.max_gas_limit,
gas_used: transactions.len() as u128 * MIN_TRANSACTION_GAS as u128,
gas_limit: self.chain_spec.max_gas_limit.into(),
mix_hash: B256::random(),
base_fee_per_gas: Some(EIP1559_INITIAL_BASE_FEE),
base_fee_per_gas: Some(EIP1559_INITIAL_BASE_FEE.into()),
transactions_root: calculate_transaction_root(&transactions),
receipts_root: calculate_receipt_root(&receipts),
beneficiary: Address::random(),
@ -166,8 +167,11 @@ impl TestBlockBuilder {
..Default::default()
};
let sealed = header.seal_slow();
let (header, seal) = sealed.into_parts();
let block = SealedBlock {
header: header.seal_slow(),
header: SealedHeader::new(header, seal),
body: transactions.into_iter().map(|tx| tx.into_signed()).collect(),
ommers: Vec::new(),
withdrawals: Some(vec![].into()),