Skip to content

Conversation

@ensi321
Copy link
Contributor

@ensi321 ensi321 commented Nov 17, 2025

Depends on #8507

@ensi321 ensi321 requested a review from a team as a code owner November 17, 2025 19:33
@ensi321 ensi321 marked this pull request as draft November 17, 2025 19:34
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ensi321, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request lays the groundwork for implementing the ePBS (enshrined Proposer-Builder Separation) networking specification, likely for an upcoming Ethereum fork referred to as "Gloas." It introduces new data structures and validation rules for execution payload bids, envelopes, and payload attestations, and integrates these new message types into the beacon node's gossip network for propagation and processing. This is a Work In Progress, building upon a previous PR.

Highlights

  • New Error Definitions for ePBS: Introduced specific error codes and types for ExecutionPayloadBid, ExecutionPayloadEnvelope, and PayloadAttestation to support the new ePBS networking specification.
  • Attestation Validation Updates: Modified existing attestation validation logic in aggregateAndProof.ts and attestation.ts to incorporate "Gloas" fork-specific rules, particularly concerning attestation.data.index values.
  • Block Validation Adjustments: Updated block validation in block.ts to conditionally apply existing checks (e.g., blobKzgCommitments length, execution payload timestamp) based on the "Gloas" fork, indicating a new phase in block processing.
  • New ePBS Validation Functions: Added dedicated validation functions for ExecutionPayloadBid, ExecutionPayloadEnvelope, and PayloadAttestationMessage to ensure compliance with the ePBS specification.
  • Gossip Network Integration: Expanded the gossip network interface and handlers to support new message types (execution_payload, payload_attestation_message, execution_payload_bid), enabling the beacon node to process ePBS-related gossip.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces networking specifications for ePBS, including new gossip message types, error codes, and validation logic. The changes are extensive and touch upon core validation and networking components. My review has identified a critical logic error in attestation validation, several typos in new error codes that should be corrected for consistency, and some areas for code improvement regarding duplication and import consistency. Overall, the changes are a good step towards implementing the ePBS spec, but the identified issues, especially the critical one, should be addressed.

Comment on lines +309 to +311
if (block.slot === attSlot && attData.index === 0) {
throw new AttestationError(GossipAction.REJECT, {code: AttestationErrorCode.PREMATURELY_INDICATE_PAYLOAD_PRESENT});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The validation logic here appears to be incorrect. The comment and the error code PREMATURELY_INDICATE_PAYLOAD_PRESENT suggest that an attestation for the current slot should not indicate that the payload is present. In gloas, an index of 1 means the payload is present, while 0 means it is not. Therefore, you should reject if attData.index === 1 (or attData.index !== 0 since valid values are 0 and 1). The current code rejects if attData.index === 0, which is the opposite of the intended logic.

Suggested change
if (block.slot === attSlot && attData.index === 0) {
throw new AttestationError(GossipAction.REJECT, {code: AttestationErrorCode.PREMATURELY_INDICATE_PAYLOAD_PRESENT});
}
if (block.slot === attSlot && attData.index !== 0) {
throw new AttestationError(GossipAction.REJECT, {code: AttestationErrorCode.PREMATURELY_INDICATE_PAYLOAD_PRESENT});
}

BID_TOO_LOW = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_LOW",
BID_TOO_HIGH = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_HIGH",
UNKNOWN_PARENT_BLOCK_HASH = "EXECUTION_PAYLOAD_BID_ERROR_UNKNOWN_PARENT_BLOCK_HASH",
UNKNWON_BLOCK_ROOT = "EXECUTION_PAYLOAD_BID_ERROR_UNKNWON_BLOCK_ROOT",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a typo in the enum member name. "UNKNWON" should be "UNKNOWN".

Suggested change
UNKNWON_BLOCK_ROOT = "EXECUTION_PAYLOAD_BID_ERROR_UNKNWON_BLOCK_ROOT",
UNKNOWN_BLOCK_ROOT = "EXECUTION_PAYLOAD_BID_ERROR_UNKNOWN_BLOCK_ROOT",

| {code: ExecutionPayloadBidErrorCode.BID_TOO_LOW; bidValue: bigint; currentHighestBid: bigint}
| {code: ExecutionPayloadBidErrorCode.BID_TOO_HIGH; bidValue: bigint; builderBalance: bigint}
| {code: ExecutionPayloadBidErrorCode.UNKNOWN_PARENT_BLOCK_HASH; parentBlockHash: RootHex}
| {code: ExecutionPayloadBidErrorCode.UNKNWON_BLOCK_ROOT; parentBlockRoot: RootHex}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line uses the misspelled enum member UNKNWON_BLOCK_ROOT. It should be UNKNOWN_BLOCK_ROOT.

Suggested change
| {code: ExecutionPayloadBidErrorCode.UNKNWON_BLOCK_ROOT; parentBlockRoot: RootHex}
| {code: ExecutionPayloadBidErrorCode.UNKNOWN_BLOCK_ROOT; parentBlockRoot: RootHex}

BLOCK_ROOT_UNKNOWN = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BLOCK_ROOT_UNKNOWN",
ENVELOPE_ALREADY_KNOWN = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_ALREADY_KNOWN",
INVALID_BLOCK = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_BLOCK",
SLOT_MISTACH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_SLOT_MISTACH",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a typo in the enum member name. "SLOT_MISTACH" should be "SLOT_MISMATCH".

Suggested change
SLOT_MISTACH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_SLOT_MISTACH",
SLOT_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_SLOT_MISMATCH",

| {code: ExecutionPayloadEnvelopeErrorCode.BLOCK_ROOT_UNKNOWN, blockRoot: RootHex}
| {code: ExecutionPayloadEnvelopeErrorCode.ENVELOPE_ALREADY_KNOWN, blockRoot: RootHex, slot: Slot, builderIndex: ValidatorIndex}
| {code: ExecutionPayloadEnvelopeErrorCode.INVALID_BLOCK, blockRoot: RootHex}
| {code: ExecutionPayloadEnvelopeErrorCode.SLOT_MISTACH, envelopeSlot: Slot, blockSlot: Slot}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line uses the misspelled enum member SLOT_MISTACH. It should be SLOT_MISMATCH.

Suggested change
| {code: ExecutionPayloadEnvelopeErrorCode.SLOT_MISTACH, envelopeSlot: Slot, blockSlot: Slot}
| {code: ExecutionPayloadEnvelopeErrorCode.SLOT_MISMATCH, envelopeSlot: Slot, blockSlot: Slot}

export type PayloadAttestationErrorType =
| {code: PayloadAttestationErrorCode.NOT_CURRENT_SLOT; currentSlot: Slot; slot: Slot}
| {code: PayloadAttestationErrorCode.PAYLOAD_ATTESTATION_ALREADY_KNOWN; validatorIndex: ValidatorIndex; slot: Slot; blockRoot: RootHex}
| {code: PayloadAttestationErrorCode.UNKNWON_BLOCK_ROOT; blockRoot: RootHex}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line uses the misspelled enum member UNKNWON_BLOCK_ROOT. It should be UNKNOWN_BLOCK_ROOT.

Suggested change
| {code: PayloadAttestationErrorCode.UNKNWON_BLOCK_ROOT; blockRoot: RootHex}
| {code: PayloadAttestationErrorCode.UNKNOWN_BLOCK_ROOT; blockRoot: RootHex}

Comment on lines +90 to +94
// [REJECT] len(committee_indices) == 1, where committee_indices = get_committee_indices(aggregate)
attIndex = (aggregate as electra.Attestation).committeeBits.getSingleTrueBit();
if (attIndex === null) {
throw new AttestationError(GossipAction.REJECT, {code: AttestationErrorCode.NOT_EXACTLY_ONE_COMMITTEE_BIT_SET});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This check for committeeBits is duplicated. The same check exists in the electra fork logic below (lines 97-101). Since gloas is a fork after electra, the electra block will also be executed, making this check redundant. Please remove this duplicated block of code.

@@ -0,0 +1,76 @@
import {gloas} from "@lodestar/types";
import {ExecutionPayloadBidError, ExecutionPayloadBidErrorCode, GossipAction, PayloadAttestationError, PayloadAttestationErrorCode} from "../errors/index.ts";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The imports PayloadAttestationError and PayloadAttestationErrorCode are not used in this file and can be removed.

Suggested change
import {ExecutionPayloadBidError, ExecutionPayloadBidErrorCode, GossipAction, PayloadAttestationError, PayloadAttestationErrorCode} from "../errors/index.ts";
import {ExecutionPayloadBidError, ExecutionPayloadBidErrorCode, GossipAction} from "../errors/index.ts";

computeStartSlotAtEpoch,
} from "@lodestar/state-transition";
import {gloas} from "@lodestar/types";
import {ExecutionPayloadEnvelopeError, ExecutionPayloadEnvelopeErrorCode, GossipAction} from "../errors/index.js";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This file imports from ../errors/index.js with a .js extension, while other new files in this PR (e.g., executionPayloadBid.ts) import from .ts files. Please ensure consistency in import extensions across the project to avoid potential module resolution issues. It seems .ts is used in other new validation files.

Suggested change
import {ExecutionPayloadEnvelopeError, ExecutionPayloadEnvelopeErrorCode, GossipAction} from "../errors/index.js";
import {ExecutionPayloadEnvelopeError, ExecutionPayloadEnvelopeErrorCode, GossipAction} from "../errors/index.ts";


async function validateExecutionPayloadEnvelope(
chain: IBeaconChain,
exeuctionPayloadEnvelope: gloas.SignedExecutionPayloadEnvelope,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a typo in the parameter name exeuctionPayloadEnvelope. It should be executionPayloadEnvelope.

Suggested change
exeuctionPayloadEnvelope: gloas.SignedExecutionPayloadEnvelope,
executionPayloadEnvelope: gloas.SignedExecutionPayloadEnvelope,

@gemini-code-assist
Copy link
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants