Skip to content

Commit b48f63b

Browse files
committed
feat: hash executionRequestsRoot with gloas container in gloas paths
The gloas bid and envelope carry an `ExecutionRequests` extended with `builder_deposits` (0x03) and `builder_exits` (0x04) per ethereum/consensus-specs#5359. Using `ssz.electra.ExecutionRequests.hashTreeRoot` in the gloas-only code paths produced a root over the electra-shaped container — wrong even when both builder lists are empty, because the gloas container has two additional zero-hash leaves. Switch the four gloas-only call sites to `ssz.gloas.ExecutionRequests`: * `produceBlockBody.ts` self-build bid construction * `verifyExecutionPayloadEnvelope.ts` bid↔envelope cross-check * `executionPayloadEnvelope.ts` gossip validation * `upgradeStateToGloas.ts` genesis bid default-value root Refs: ethereum/consensus-specs#5359, ethereum/EIPs#11760 🤖 Generated with AI assistance
1 parent 52d2b0a commit b48f63b

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

packages/beacon-node/src/chain/blocks/verifyExecutionPayloadEnvelope.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function verifyExecutionPayloadEnvelope(
7474
// Verify execution_requests_root matches bid commitment.
7575
// Can be skipped if already verified during gossip validation.
7676
if (verifyExecutionRequestsRoot) {
77-
const requestsRoot = ssz.electra.ExecutionRequests.hashTreeRoot(envelope.executionRequests);
77+
const requestsRoot = ssz.gloas.ExecutionRequests.hashTreeRoot(envelope.executionRequests);
7878
if (!byteArrayEquals(requestsRoot, bid.executionRequestsRoot)) {
7979
throw new Error(
8080
`Execution requests root mismatch envelope=${toRootHex(requestsRoot)} bid=${toRootHex(bid.executionRequestsRoot)}`

packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ export async function produceBlockBody<T extends BlockType>(
350350
value: 0,
351351
executionPayment: 0,
352352
blobKzgCommitments: blobsBundle.commitments,
353-
executionRequestsRoot: ssz.electra.ExecutionRequests.hashTreeRoot(executionRequests),
353+
executionRequestsRoot: ssz.gloas.ExecutionRequests.hashTreeRoot(executionRequests as gloas.ExecutionRequests),
354354
};
355355
const signedBid: gloas.SignedExecutionPayloadBid = {
356356
message: bid,

packages/beacon-node/src/chain/validation/executionPayloadEnvelope.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async function validateExecutionPayloadEnvelope(
106106
}
107107

108108
// [REJECT] `hash_tree_root(envelope.execution_requests) == bid.execution_requests_root`
109-
const requestsRoot = ssz.electra.ExecutionRequests.hashTreeRoot(envelope.executionRequests);
109+
const requestsRoot = ssz.gloas.ExecutionRequests.hashTreeRoot(envelope.executionRequests);
110110
if (!byteArrayEquals(requestsRoot, payloadInput.getBid().executionRequestsRoot)) {
111111
throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
112112
code: ExecutionPayloadEnvelopeErrorCode.EXECUTION_REQUESTS_ROOT_MISMATCH,

packages/state-transition/src/slot/upgradeStateToGloas.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ export function upgradeStateToGloas(stateFulu: CachedBeaconStateFulu): CachedBea
4949
stateGloasView.nextSyncCommittee = stateGloasCloned.nextSyncCommittee;
5050
stateGloasView.latestExecutionPayloadBid.blockHash = stateFulu.latestExecutionPayloadHeader.blockHash;
5151
stateGloasView.latestExecutionPayloadBid.gasLimit = BigInt(stateFulu.latestExecutionPayloadHeader.gasLimit);
52-
stateGloasView.latestExecutionPayloadBid.executionRequestsRoot = ssz.electra.ExecutionRequests.hashTreeRoot(
53-
ssz.electra.ExecutionRequests.defaultValue()
52+
stateGloasView.latestExecutionPayloadBid.executionRequestsRoot = ssz.gloas.ExecutionRequests.hashTreeRoot(
53+
ssz.gloas.ExecutionRequests.defaultValue()
5454
);
5555
stateGloasView.nextWithdrawalIndex = stateGloasCloned.nextWithdrawalIndex;
5656
stateGloasView.nextWithdrawalValidatorIndex = stateGloasCloned.nextWithdrawalValidatorIndex;

0 commit comments

Comments
 (0)