Skip to content

[P1] Verifier: remove duplicate ev-node call and cache Celestia lookups per DA height #40

Closed

Description

@auricom

Priority: P1 (performance) · Effort: M

Problem

Per verification attempt (verifier.go:verifyAttempt):

  • evnodeClient.GetBlock is called, then GetBlockWithBlobs, which calls GetBlock again (internal/clients/evnode/client.go:68). That's two identical ev-node RPCs.
  • celestiaClient.GetBlockTimestamp(daHeight) runs once per block. ev-node batches many blocks into one DA height, so the same timestamp is fetched N times.
  • Data path: GetBlobsAtHeight downloads all blobs at (daHeight, dataNS) once per block, so a 100-block batch downloads the same blobs 100 times. Header path: GetIDs once per block.

Proposed fix

  1. Pass the already-fetched *GetBlockResponse into the blob-marshalling helper, or call only GetBlockWithBlobs. This saves one RPC per attempt.
  2. Add a small memoization map in celestia.Client keyed by (daHeight, ns) for the timestamp, IDs and blobs, protected by a mutex and with a ~2 min TTL that's checked on insert. Use golang.org/x/sync/singleflight (already in go.mod) so concurrent workers share one in-flight fetch. Add a simplify: comment noting there's no LRU and the upgrade path.

Pros / Cons

  • ✅ Cuts Celestia load and bandwidth by roughly the batch size (often 10-100×), lowers latency, and reduces timeouts on public nodes.
  • ⚠️ Memory for cached blobs (up to ~2MB each), so keep the TTL short. Never cache negative or "not found" results; otherwise blocks that land later would fail.

Acceptance criteria

  • Test: N blocks at the same DA height cause exactly one blob fetch.
  • Test: a "not found" result is not cached.

Activity

  1. auricom commented on Oct 20, 2026

    @auricom
    CollaboratorAuthor

    Scope update after #33 (ev-node v1.0.0 upgrade):

    • Header path is mostly solved by fix(deps): upgrade ev-node to v1.0.0 and fix broken metrics #33. The commitment is now computed locally (jsonrpc.NewBlobV0) and checked with a single Blob.Get(height, ns, commitment), replacing the remote DA.Commit + GetIDs.
    • Still valid: the duplicate ev-node GetBlock call, GetBlockTimestamp once per block, and the data path downloading every blob at the DA height once per block (Blob.GetAll).

    Implement this on top of #33.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions