chore: improve Withdrawals interface (#6401)

This commit is contained in:
Roman Krasiuk
2024-02-05 12:42:22 +01:00
committed by GitHub
parent 2c867d77da
commit 62303cb06f
4 changed files with 19 additions and 8 deletions

View File

@ -9,7 +9,7 @@ use reth_node_api::EvmEnvConfig;
use reth_primitives::{
Address, Block, BlockNumber, BlockWithSenders, Bloom, ChainSpec, GotExpected, Hardfork, Header,
PruneMode, PruneModes, PruneSegmentError, Receipt, ReceiptWithBloom, Receipts,
TransactionSigned, B256, MINIMUM_PRUNING_DISTANCE, U256,
TransactionSigned, Withdrawals, B256, MINIMUM_PRUNING_DISTANCE, U256,
};
use reth_provider::{
BlockExecutor, BlockExecutorStats, ProviderError, PrunableBlockExecutor, StateProvider,
@ -213,7 +213,7 @@ where
block.timestamp,
total_difficulty,
&block.ommers,
block.withdrawals.as_ref(),
block.withdrawals.as_ref().map(Withdrawals::as_ref),
);
// Irregular state change at Ethereum DAO hardfork

View File

@ -2,7 +2,7 @@ use reth_consensus_common::calc;
use reth_interfaces::executor::{BlockExecutionError, BlockValidationError};
use reth_primitives::{
constants::SYSTEM_ADDRESS, revm::env::fill_tx_env_with_beacon_root_contract_call, Address,
ChainSpec, Header, Withdrawals, B256, U256,
ChainSpec, Header, Withdrawal, B256, U256,
};
use revm::{Database, DatabaseCommit, EVM};
use std::collections::HashMap;
@ -21,7 +21,7 @@ pub fn post_block_balance_increments(
block_timestamp: u64,
total_difficulty: U256,
ommers: &[Header],
withdrawals: Option<&Withdrawals>,
withdrawals: Option<&[Withdrawal]>,
) -> HashMap<Address, u128> {
let mut balance_increments = HashMap::new();
@ -124,7 +124,7 @@ where
pub fn post_block_withdrawals_balance_increments(
chain_spec: &ChainSpec,
block_timestamp: u64,
withdrawals: &Withdrawals,
withdrawals: &[Withdrawal],
) -> HashMap<Address, u128> {
let mut balance_increments = HashMap::with_capacity(withdrawals.len());
insert_post_block_withdrawals_balance_increments(
@ -144,7 +144,7 @@ pub fn post_block_withdrawals_balance_increments(
pub fn insert_post_block_withdrawals_balance_increments(
chain_spec: &ChainSpec,
block_timestamp: u64,
withdrawals: Option<&Withdrawals>,
withdrawals: Option<&[Withdrawal]>,
balance_increments: &mut HashMap<Address, u128>,
) {
// Process withdrawals