Skip to content

perf(subgraph): stop materializing ProvingWindow entities #136

Description

@silent-cipher

Problem

ProvingWindow entities are written on every NextProvingPeriod event — up to MaxProvingWindowsPerEvent = 50 per event when a stale dataset resumes (subgraph/src/pdp-verifier.ts:849-865) — and loaded + updated on every PossessionProven (subgraph/src/pdp-verifier.ts:687-699).

The client never queries provingWindows (no reference anywhere in subgraph-client/src). All of this is write volume with no consumer.

Skipped windows are also fully derivable client-side: deadline = firstDeadline + deadlineCount × maxProvingPeriod, proofSubmitted = false, and DataSet.totalFaultedPeriods already carries the fault counts.

Proposal

Remove the ProvingWindow entity, the creation loop in handleNextProvingPeriod, the update in handlePossessionProven, and MaxProvingWindowsPerEvent from subgraph/utils/index.ts.

Acceptance criteria

  • No ProvingWindow writes on NextProvingPeriod
  • graph build for both networks + tests pass

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