Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/ethereum/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ use reth_revm::{
eth_dao_fork::{DAO_HARDFORK_BENEFICIARY, DAO_HARDKFORK_ACCOUNTS},
processor::verify_receipt,
stack::InspectorStack,
state_change::{apply_beacon_root_contract_call, post_block_balance_increments},
state_change::{
apply_beacon_root_contract_call, apply_blockhashes_update, post_block_balance_increments,
},
Evm, State,
};
use revm_primitives::{
Expand Down Expand Up @@ -152,6 +154,7 @@ where
block.parent_beacon_block_root,
&mut evm,
)?;
apply_blockhashes_update(&self.chain_spec, block.timestamp, block.number, evm.db_mut())?;

// execute transactions
let mut cumulative_gas_used = 0;
Expand Down
13 changes: 12 additions & 1 deletion crates/interfaces/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,25 @@ pub enum BlockValidationError {
/// The beacon block root
parent_beacon_block_root: B256,
},
/// EVM error during beacon root contract call
/// EVM error during [EIP-4788] beacon root contract call.
///
/// [EIP-4788]: https://eips.ethereum.org/EIPS/eip-4788
#[error("failed to apply beacon root contract call at {parent_beacon_block_root}: {message}")]
BeaconRootContractCall {
/// The beacon block root
parent_beacon_block_root: Box<B256>,
/// The error message.
message: String,
},
/// EVM error during [EIP-2935] pre-block state transition.
///
/// [EIP-2935]: https://eips.ethereum.org/EIPS/eip-2935
#[error("failed to apply EIP-2935 pre-block state transition: {message}")]
// todo: better variant name
Eip2935StateTransition {
/// The error message.
message: String,
},
}

/// BlockExecutor Errors
Expand Down
22 changes: 21 additions & 1 deletion crates/payload/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use reth_primitives::{
Block, Header, IntoRecoveredTransaction, Receipt, Receipts, EMPTY_OMMER_ROOT_HASH, U256,
};
use reth_provider::{BundleStateWithReceipts, StateProviderFactory};
use reth_revm::database::StateProviderDatabase;
use reth_revm::{database::StateProviderDatabase, state_change::apply_blockhashes_update};
use reth_transaction_pool::{BestTransactionsAttributes, TransactionPool};
use revm::{
db::states::bundle_state::BundleRetention,
Expand Down Expand Up @@ -98,6 +98,17 @@ where
err
})?;

// apply eip-2935 blockhashes update
apply_blockhashes_update(
&chain_spec,
initialized_block_env.timestamp.to::<u64>(),
block_number,
&mut db,
).map_err(|err| {
warn!(target: "payload_builder", parent_hash=%parent_block.hash(), %err, "failed to update blockhashes for empty payload");
PayloadBuilderError::Internal(err.into())
})?;

let WithdrawalsOutcome { withdrawals_root, withdrawals } =
commit_withdrawals(&mut db, &chain_spec, attributes.timestamp, attributes.withdrawals.clone()).map_err(|err| {
warn!(target: "payload_builder", parent_hash=%parent_block.hash(), %err, "failed to commit withdrawals for empty payload");
Expand Down Expand Up @@ -218,6 +229,15 @@ where
&attributes,
)?;

// apply eip-2935 blockhashes update
apply_blockhashes_update(
&chain_spec,
initialized_block_env.timestamp.to::<u64>(),
block_number,
&mut db,
)
.map_err(|err| PayloadBuilderError::Internal(err.into()))?;

let mut receipts = Vec::new();
while let Some(pool_tx) = best_txs.next() {
// ensure we still have capacity for this transaction
Expand Down
Loading