Skip to content

Commit

Permalink
feat: integrate w payload builder
Browse files Browse the repository at this point in the history
  • Loading branch information
onbjerg committed Apr 29, 2024
1 parent e1c2c34 commit 6949878
Showing 1 changed file with 21 additions and 1 deletion.
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

0 comments on commit 6949878

Please sign in to comment.