feat(primitives): add Receipts to encapsulate Vec<Vec<Option<Receipt>> (#4626)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Thomas Coratger
2023-09-27 20:11:19 +02:00
committed by GitHub
parent 61a1ac95ad
commit 2138a8b587
11 changed files with 153 additions and 70 deletions

View File

@ -25,7 +25,7 @@ use reth_primitives::{
EMPTY_WITHDRAWALS, ETHEREUM_BLOCK_GAS_LIMIT, RETH_CLIENT_VERSION, SLOT_DURATION,
},
proofs, Block, BlockNumberOrTag, ChainSpec, Header, IntoRecoveredTransaction, Receipt,
SealedBlock, Withdrawal, EMPTY_OMMER_ROOT, H256, U256,
Receipts, SealedBlock, Withdrawal, EMPTY_OMMER_ROOT, H256, U256,
};
use reth_provider::{BlockReaderIdExt, BlockSource, BundleStateWithReceipts, StateProviderFactory};
use reth_revm::{
@ -787,7 +787,11 @@ where
// 4788 contract call
db.merge_transitions(BundleRetention::PlainState);
let bundle = BundleStateWithReceipts::new(db.take_bundle(), vec![receipts], block_number);
let bundle = BundleStateWithReceipts::new(
db.take_bundle(),
Receipts::from_vec(vec![receipts]),
block_number,
);
let receipts_root = bundle.receipts_root_slow(block_number).expect("Number is in range");
let logs_bloom = bundle.block_logs_bloom(block_number).expect("Number is in range");
@ -907,7 +911,8 @@ where
db.merge_transitions(BundleRetention::PlainState);
// calculate the state root
let bundle_state = BundleStateWithReceipts::new(db.take_bundle(), vec![], block_number);
let bundle_state =
BundleStateWithReceipts::new(db.take_bundle(), Receipts::new(), block_number);
let state_root = state.state_root(&bundle_state)?;
let header = Header {