Skip to content

Beacon events report execution_optimistic: false for every gloas head and block #844

Open

Description

@MegaRedHand

Problem. The head, head_v2, block and finalized_checkpoint events take execution_optimistic from Store::is_beacon_optimistic, i.e. the store's optimistic_roots set:

  • crates/blockchain/src/events.rs:806 (block);
  • events.rs:1162 (head, head_v2, chain_reorg);
  • events.rs:1249 (the second head_v2);
  • events.rs:1313 (finalized_checkpoint).

Only pre-gloas blocks ever enter that set. beacon_engine::new_payload_request returns None for a gloas block (crates/blockchain/src/beacon_engine.rs:134), so its import is PayloadValidity::NotRequired, and fork_choice::on_block adds a root only on Optimistic (crates/blockchain/state_transition/src/beacon/fork_choice.rs:5198-5203). From gloas on, every one of these events therefore reports execution_optimistic: false, even when the chain rests on a payload the execution client answered SYNCING. A consumer that holds off on optimistic heads (lighthouse suppresses those head events) is told the head is validated when it is not.

The Beacon API responses already get this right. crates/net/rpc/src/shared/optimistic.rs has block_is_optimistic (line 113), which walks back to the latest FULL payload a block builds on and reads its recorded verdict, and envelope_is_optimistic (line 100). docs/rpc.md ("execution_optimistic under gloas") describes the rule.

Why not in #748. That PR fixed the one event it added whose verdict is in hand, execution_payload, by passing the import's own verdict in. The other topics predate it on main (head_v2 inherits head's value), and the fix needs the walk in shared/optimistic.rs, which lives in ethlambda-rpc, a crate ethlambda-blockchain cannot depend on.

Fix. Move payload_link, payload_is_not_valid, block_is_optimistic and envelope_is_optimistic down to a crate both can use (ethlambda-storage, next to the maps they read, or ethlambda-state-transition), and have the events call block_is_optimistic where they now call is_beacon_optimistic. Pre-gloas results are unchanged, since the walk reads the optimistic set for a pre-gloas block. A test: a gloas head whose parent payload is recorded Syncing emits head/head_v2 with execution_optimistic: true.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions