Skip to content

Add retry mechanism for payload envelope DB persistenceΒ #9072

@lodekeeper

Description

@lodekeeper

Context

In persistPayloadEnvelopeInput(), a DB write failure causes the in-memory PayloadEnvelopeInput to be pruned via .finally(), losing data from both DB and memory with no recovery path. This is the same pattern as persistBlockInput().

Current behavior

await writePayloadEnvelopeInputToDb.call(this, payloadInput)
  .catch((e) => {
    this.logger.error("Error persisting payload envelope in hot db", {...}, e);
  })
  .finally(() => {
    this.seenPayloadEnvelopeInput.prune(payloadInput.blockRootHex);
    // ...
  });

On a transient DB error (disk full, I/O timeout), .catch() logs the error but .finally() still prunes the in-memory data. The envelope is now gone from both DB and memory β€” irrecoverable.

Proposed fix

  1. Only prune on success (move prune from .finally() to .then())
  2. Add a retry mechanism for transient failures (exponential backoff, bounded retries)
  3. Apply the same fix to persistBlockInput() which has the identical pattern

References

/cc @nflaig @twoeths

Metadata

Metadata

Assignees

No one assigned

    Labels

    spec-gloasIssues targeting the Glamsterdam spec version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions