Skip to content

Commit

Permalink
fix(payload): calculate withdrawal requests in empty payload (#8243)
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed May 29, 2024
1 parent 9675e4c commit 9320863
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions crates/payload/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ use reth_payload_builder::{
};
use reth_primitives::{
constants::{
eip4844::MAX_DATA_GAS_PER_BLOCK, BEACON_NONCE, EMPTY_RECEIPTS, EMPTY_ROOT_HASH,
EMPTY_TRANSACTIONS,
eip4844::MAX_DATA_GAS_PER_BLOCK, BEACON_NONCE, EMPTY_RECEIPTS, EMPTY_TRANSACTIONS,
},
eip4844::calculate_excess_blob_gas,
proofs::{self, calculate_requests_root},
revm::env::tx_env_with_recovered,
Block, Header, IntoRecoveredTransaction, Receipt, Receipts, Requests, EMPTY_OMMER_ROOT_HASH,
U256,
Block, Header, IntoRecoveredTransaction, Receipt, Receipts, EMPTY_OMMER_ROOT_HASH, U256,
};
use reth_provider::{BundleStateWithReceipts, StateProviderFactory};
use reth_revm::database::StateProviderDatabase;
Expand Down Expand Up @@ -183,6 +181,26 @@ where
blob_gas_used = Some(0);
}

// Calculate the requests and the requests root.
let (requests, requests_root) =
if chain_spec.is_prague_active_at_timestamp(attributes.timestamp) {
// We do not calculate the EIP-6110 deposit requests because there are no
// transactions in an empty payload.
let withdrawal_requests = post_block_withdrawal_requests_contract_call(
&mut db,
&chain_spec,
&initialized_cfg,
&initialized_block_env,
&attributes,
)?;

let requests = withdrawal_requests;
let requests_root = calculate_requests_root(&requests);
(Some(requests.into()), Some(requests_root))
} else {
(None, None)
};

let header = Header {
parent_hash: parent_block.hash(),
ommers_hash: EMPTY_OMMER_ROOT_HASH,
Expand Down

0 comments on commit 9320863

Please sign in to comment.