From 194d545fae41c1942a1c04ffc519f408cf9d29b1 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Thu, 11 Dec 2025 20:07:43 +0100 Subject: [PATCH] feat(engine): Add BAL stub methods to ExecutionPayload and BlockOrPayload (#20311) Co-authored-by: Matthias Seitz --- Cargo.lock | 13 +++++++++++++ Cargo.toml | 1 + crates/engine/tree/Cargo.toml | 1 + crates/engine/tree/src/tree/payload_validator.rs | 7 +++++++ crates/payload/primitives/src/payload.rs | 15 ++++++++++++++- examples/custom-node/src/engine.rs | 5 +++++ 6 files changed, 41 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 5dad314b1d..3eaec41f8c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -238,6 +238,18 @@ dependencies = [ "thiserror 2.0.17", ] +[[package]] +name = "alloy-eip7928" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "926b2c0d34e641cf8b17bf54ce50fda16715b9f68ad878fa6128bae410c6f890" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "borsh", + "serde", +] + [[package]] name = "alloy-eips" version = "1.1.3" @@ -8208,6 +8220,7 @@ name = "reth-engine-tree" version = "1.9.3" dependencies = [ "alloy-consensus", + "alloy-eip7928", "alloy-eips", "alloy-evm", "alloy-primitives", diff --git a/Cargo.toml b/Cargo.toml index 5b85b059e6..cbf1f64e87 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -487,6 +487,7 @@ revm-inspectors = "0.33.1" alloy-chains = { version = "0.2.5", default-features = false } alloy-dyn-abi = "1.4.1" alloy-eip2124 = { version = "0.2.0", default-features = false } +alloy-eip7928 = { version = "0.1.0" } alloy-evm = { version = "0.25.1", default-features = false } alloy-primitives = { version = "1.4.1", default-features = false, features = ["map-foldhash"] } alloy-rlp = { version = "0.3.10", default-features = false, features = ["core-net"] } diff --git a/crates/engine/tree/Cargo.toml b/crates/engine/tree/Cargo.toml index ba99898a84..2b281b90b2 100644 --- a/crates/engine/tree/Cargo.toml +++ b/crates/engine/tree/Cargo.toml @@ -39,6 +39,7 @@ reth-trie.workspace = true alloy-evm.workspace = true alloy-consensus.workspace = true alloy-eips.workspace = true +alloy-eip7928.workspace = true alloy-primitives.workspace = true alloy-rlp.workspace = true alloy-rpc-types-engine.workspace = true diff --git a/crates/engine/tree/src/tree/payload_validator.rs b/crates/engine/tree/src/tree/payload_validator.rs index f5cd58dcb8..be3de53695 100644 --- a/crates/engine/tree/src/tree/payload_validator.rs +++ b/crates/engine/tree/src/tree/payload_validator.rs @@ -11,6 +11,7 @@ use crate::tree::{ StateProviderDatabase, TreeConfig, }; use alloy_consensus::transaction::Either; +use alloy_eip7928::BlockAccessList; use alloy_eips::{eip1898::BlockWithParent, NumHash}; use alloy_evm::Evm; use alloy_primitives::B256; @@ -1243,4 +1244,10 @@ impl BlockOrPayload { Self::Block(_) => "block", } } + + /// Returns the block access list if available. + pub const fn block_access_list(&self) -> Option> { + // TODO decode and return `BlockAccessList` + None + } } diff --git a/crates/payload/primitives/src/payload.rs b/crates/payload/primitives/src/payload.rs index 709a37768f..37edaaae39 100644 --- a/crates/payload/primitives/src/payload.rs +++ b/crates/payload/primitives/src/payload.rs @@ -3,7 +3,7 @@ use crate::{MessageValidationKind, PayloadAttributes}; use alloc::vec::Vec; use alloy_eips::{eip1898::BlockWithParent, eip4895::Withdrawal, eip7685::Requests, BlockNumHash}; -use alloy_primitives::B256; +use alloy_primitives::{Bytes, B256}; use alloy_rpc_types_engine::ExecutionData; use core::fmt::Debug; use serde::{de::DeserializeOwned, Serialize}; @@ -40,6 +40,11 @@ pub trait ExecutionPayload: /// Returns `None` for pre-Shanghai blocks. fn withdrawals(&self) -> Option<&Vec>; + /// Returns the access list included in this payload. + /// + /// Returns `None` for pre-Amsterdam blocks. + fn block_access_list(&self) -> Option<&Bytes>; + /// Returns the beacon block root associated with this payload. /// /// Returns `None` for pre-merge payloads. @@ -69,6 +74,10 @@ impl ExecutionPayload for ExecutionData { self.payload.withdrawals() } + fn block_access_list(&self) -> Option<&Bytes> { + None + } + fn parent_beacon_block_root(&self) -> Option { self.sidecar.parent_beacon_block_root() } @@ -172,6 +181,10 @@ impl ExecutionPayload for op_alloy_rpc_types_engine::OpExecutionData { self.payload.as_v2().map(|p| &p.withdrawals) } + fn block_access_list(&self) -> Option<&Bytes> { + None + } + fn parent_beacon_block_root(&self) -> Option { self.sidecar.parent_beacon_block_root() } diff --git a/examples/custom-node/src/engine.rs b/examples/custom-node/src/engine.rs index fceace2d2e..3db35bb363 100644 --- a/examples/custom-node/src/engine.rs +++ b/examples/custom-node/src/engine.rs @@ -5,6 +5,7 @@ use crate::{ CustomNode, }; use alloy_eips::eip2718::WithEncoded; +use alloy_primitives::Bytes; use op_alloy_rpc_types_engine::{OpExecutionData, OpExecutionPayload}; use reth_engine_primitives::EngineApiValidator; use reth_ethereum::{ @@ -54,6 +55,10 @@ impl ExecutionPayload for CustomExecutionData { None } + fn block_access_list(&self) -> Option<&Bytes> { + None + } + fn parent_beacon_block_root(&self) -> Option { self.inner.parent_beacon_block_root() }