Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
686b481
feat(p2p): refuse execution payloads whose block hash is not their he…
MegaRedHand Nov 3, 2026
19dedb3
Merge main into feat/gossip-payload-block-hash
MegaRedHand Nov 11, 2026
e456a3d
Merge main into feat/gossip-payload-block-hash
MegaRedHand Nov 18, 2026
a01c0f6
Merge main into feat/gossip-payload-block-hash
MegaRedHand Nov 18, 2026
5331be7
Merge main into feat/gossip-payload-block-hash
MegaRedHand Nov 18, 2026
650e78e
Merge main into feat/gossip-payload-block-hash
MegaRedHand Nov 18, 2026
10a506e
fix(p2p): skip only the default bellatrix payload
MegaRedHand Nov 19, 2026
f24dde2
refactor(p2p): one arm per deneb-shaped block, and name keccak256
MegaRedHand Nov 19, 2026
5211db6
fix(p2p): check a payload's block hash after its signature, and IGNOR…
MegaRedHand Nov 19, 2026
e6abca5
test(p2p): pin two-byte transaction keys and real requests on mainnet
MegaRedHand Nov 19, 2026
926a6cd
test(p2p): time verify_block on the mainnet vector and at the size limit
MegaRedHand Nov 19, 2026
063105b
docs: describe the payload block hash rule as what it is
MegaRedHand Nov 19, 2026
b0d2c77
test(p2p): pin that a payload hash mismatch is not imported from gossip
MegaRedHand Nov 19, 2026
7568028
test(p2p): pin the empty transactions, requests and withdrawals roots
MegaRedHand Nov 19, 2026
57197a2
docs: say an ignored block can come back by root, and qualify equival…
MegaRedHand Nov 19, 2026
2b2d2e3
fix(p2p): mark a block ignored for its payload hash as seen
MegaRedHand Nov 19, 2026
46fa59f
fix(p2p): assert the header's optional fields only extend its tail
MegaRedHand Nov 19, 2026
adc00e2
docs: say what the payload hash rule changes before the early import
MegaRedHand Nov 19, 2026
d38e786
fix(p2p): report a mismatch that lost the seen race as already seen
MegaRedHand Nov 19, 2026
a726ddd
refactor(p2p): keep the payload hash checks crate-private
MegaRedHand Nov 19, 2026
e1f1b2c
docs: bound the payload hash cost for concurrent equivocations
MegaRedHand Nov 19, 2026
8e0d90d
fix(p2p): log fetched envelope mismatches at debug, name the proposer
MegaRedHand Nov 19, 2026
17b4e41
docs: say which topics share the payload hash's permit pool
MegaRedHand Nov 19, 2026
1ee4e4b
Merge main into feat/gossip-payload-block-hash
MegaRedHand Nov 20, 2026
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions crates/blockchain/state_transition/src/beacon/gossip/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ pub enum IgnoreReason {
AlreadyExiting,
/// The head state's sync committees cannot answer for the message's period.
SyncCommitteeUnavailable,
/// A signed block's execution payload `block_hash` is not the hash of the
/// execution block header rebuilt from the payload's own fields. A rule
/// the specification does not have, run in p2p once the proposer's
/// signature has verified: see `docs/spec_deviations.md`. IGNORE rather
/// than REJECT because other clients forward such a block, and a REJECT
/// would score every honest peer that relayed it.
PayloadBlockHashMismatch,
}

impl IgnoreReason {
Expand Down Expand Up @@ -238,6 +245,7 @@ impl IgnoreReason {
Self::BeforeFork => "before_fork",
Self::AlreadyExiting => "already_exiting",
Self::SyncCommitteeUnavailable => "sync_committee_unavailable",
Self::PayloadBlockHashMismatch => "payload_block_hash_mismatch",
}
}
}
Expand Down
62 changes: 34 additions & 28 deletions crates/common/types/src/beacon/containers/bellatrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,34 @@ pub struct ExecutionPayload {
pub transactions: Transactions,
}

/// The specification's `ExecutionPayload()`: every field zero or empty, which
/// is what a bellatrix block proposed before the merge carries.
///
/// Written out rather than derived because `logs_bloom` is an [`SszVector`],
/// which libssz gives no `Default` (a vector can never validly be empty), so
/// its all-zero value is built at its exact length.
impl Default for ExecutionPayload {
fn default() -> Self {
Self {
parent_hash: ExecutionBlockHash::ZERO,
fee_recipient: ExecutionAddress::ZERO,
state_root: Bytes32::ZERO,
receipts_root: Bytes32::ZERO,
logs_bloom: LogsBloom::try_from(vec![0u8; preset::BYTES_PER_LOGS_BLOOM])
.expect("BYTES_PER_LOGS_BLOOM zeros fit LogsBloom's exact length"),
prev_randao: Bytes32::ZERO,
block_number: 0,
gas_limit: 0,
gas_used: 0,
timestamp: 0,
extra_data: Default::default(),
base_fee_per_gas: Uint256::ZERO,
block_hash: ExecutionBlockHash::ZERO,
transactions: Default::default(),
}
}
}

/// An [`ExecutionPayload`] with its transaction list replaced by a merkle
/// root, so [`BeaconState::latest_execution_payload_header`] can commit to
/// the previous payload without the state growing with every transaction
Expand Down Expand Up @@ -197,17 +225,11 @@ pub struct BeaconBlockBody {
}

impl BeaconBlockBody {
/// An empty body: no operations of any kind, and an all-zero execution
/// payload.
///
/// Not `#[derive(Default)]`, unlike phase0's and altair's bodies (which
/// have no execution payload to build): `execution_payload.logs_bloom` is
/// an [`SszVector`], and unlike a list, a vector can never validly be
/// empty, so libssz gives it no `Default` impl. Its all-zero value is
/// built explicitly at its exact length instead, the same construction
/// `state_transition::beacon::upgrade`'s
/// `empty_bellatrix_execution_payload_header` uses for the header shape
/// of the same payload.
/// An empty body: no operations of any kind, and the all-zero execution
/// payload ([`ExecutionPayload`]'s `Default`, what a pre-merge block
/// carries; `state_transition::beacon::upgrade`'s
/// `empty_bellatrix_execution_payload_header` builds the header shape of
/// the same value).
pub fn empty() -> Self {
Self {
randao_reveal: Default::default(),
Expand All @@ -219,23 +241,7 @@ impl BeaconBlockBody {
deposits: Default::default(),
voluntary_exits: Default::default(),
sync_aggregate: Default::default(),
execution_payload: ExecutionPayload {
parent_hash: ExecutionBlockHash::ZERO,
fee_recipient: ExecutionAddress::ZERO,
state_root: Bytes32::ZERO,
receipts_root: Bytes32::ZERO,
logs_bloom: LogsBloom::try_from(vec![0u8; preset::BYTES_PER_LOGS_BLOOM])
.expect("BYTES_PER_LOGS_BLOOM zeros fit LogsBloom's exact length"),
prev_randao: Bytes32::ZERO,
block_number: 0,
gas_limit: 0,
gas_used: 0,
timestamp: 0,
extra_data: Default::default(),
base_fee_per_gas: Uint256::ZERO,
block_hash: ExecutionBlockHash::ZERO,
transactions: Default::default(),
},
execution_payload: ExecutionPayload::default(),
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions crates/net/p2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ rand = "0.8"
# against with nothing in the manifest saying so.
ethrex-p2p = { git = "https://github.com/lambdaclass/ethrex", tag = "v25.0.0" }
ethrex-rlp = { git = "https://github.com/lambdaclass/ethrex", tag = "v25.0.0" }
# The ordered trie behind a payload's transactions root, which `ethrex-common`
# only builds from decoded transactions, not the raw bytes a payload carries.
ethrex-trie = { git = "https://github.com/lambdaclass/ethrex", tag = "v25.0.0" }
ethrex-common = { git = "https://github.com/lambdaclass/ethrex", tag = "v25.0.0" }

# `rand` seeds the throwaway signing keys the ENR tests build records with.
Expand Down
10 changes: 7 additions & 3 deletions crates/net/p2p/src/beacon/envelope_checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use ethlambda_types::beacon::containers::gloas::SignedExecutionPayloadEnvelope;
use tracing::{debug, error, warn};

use crate::P2PServer;
use crate::beacon::payload_hash::{self, EnvelopeSource};

/// Whether a fetched envelope goes to the chain actor.
pub(crate) fn forwards(outcome: &Outcome) -> bool {
Expand All @@ -48,10 +49,13 @@ fn judge(store: &Store, envelope: &SignedExecutionPayloadEnvelope) -> Outcome {
// A fresh, empty cache: a fetched envelope is not a gossip duplicate of
// anything, so the cache's one rule never fires.
let seen = SeenEnvelopes::new(NonZeroUsize::MIN);
match cheap_checks(&seen, store, envelope) {
Ok(()) => stateful_checks(store, envelope),
Err(outcome) => outcome,
if let Err(outcome) = cheap_checks(&seen, store, envelope) {
return outcome;
}
// The payload block hash rule the gossip topic runs too, after the
// builder's signature verified. Counted, never refused, for gloas.
let outcome = stateful_checks(store, envelope);
payload_hash::envelope_verdict(outcome, envelope, EnvelopeSource::Fetch)
}

/// Run the gossip rules on `envelopes` and send the chain actor the ones that
Expand Down
1 change: 1 addition & 0 deletions crates/net/p2p/src/beacon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub mod envelope_checks;
pub mod fork_schedule;
pub mod handler;
pub mod messages;
pub mod payload_hash;
pub mod protocols;
pub mod scoring;
pub mod subnets;
Expand Down
Loading
Loading