Skip to content

addPayloadEnvelope should be idempotent for API/gossip race #9071

Description

@lodekeeper

Context

In PayloadEnvelopeInput.addPayloadEnvelope(), a second call throws "Payload envelope already set". This is reachable from external input paths when API and gossip race:

  1. API handler receives envelope, sleeps for slot boundary alignment
  2. Gossip envelope arrives during the sleep, gets added first
  3. API handler wakes up and calls addPayloadEnvelope() → throws → 500 error to the VC

This is relevant in multi-node or DVT setups where the proposer's envelope arrives via gossip before the API call completes (similar to #8849).

Proposed fix

Make addPayloadEnvelope() idempotent — silently return (or log) if the envelope is already set, matching the dedup semantics of shouldImport(). At minimum, the API handler should catch this gracefully instead of returning a 500.

References

/cc @nflaig @twoeths

Metadata

Metadata

Assignees

No one assigned

    Labels

    spec-gloasIssues targeting the Glamsterdam spec version

    Type

    No type

    Projects

    Status
    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions