Skip to content

perf(subgraph): slim EventLog/Transaction entities and drop unused counters #140

Description

@silent-cipher

Problem

Every event writes an EventLog (and usually a Transaction). They're immutable (good), but each write carries avoidable weight:

  • eventLog.data is a hand-built JSON string (e.g. the challenges loop in subgraph/src/pdp-verifier.ts:605-613) — arbitrary-precision toString() calls per event, stored as text that duplicates on-chain data.
  • Duplicated fields: EventLog.transactionHash duplicates the id prefix, Transaction.hash duplicates the id, setId/dataSetId duplicate the proofSet relation.
  • DataSet.totalEventLogs / totalTransactions counters are updated in every handler, widening the hottest mutable row.

The client does query transactions and eventLogs (subgraph-clien utility/queries.ts:185,197), so these entities stay — this issue is about shrinking them, not removing them.

Proposal

  • Audit which EventLog/Transaction fields and which DataSet counters the UI actually renders; drop the rest (data JSON is the main candidate — the name + linked entities may already cover the UI's needs).
  • Where data is genuinely displayed, consider keeping only the minimal fields the UI formats, rather than pre-rendered JSON. OR completely eliminate data field and redirect users to block-explorer where contract is verified to see data.

Acceptance criteria

  • Field-usage audit of the client documented in this issue
  • Unused fields removed from schema.graphql + mappings; client queries updated
  • Tests pass; affected UI pages verified

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

    Fields

    No fields configured for issues without a type.

    Projects

    • Status
      🐱 Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions