FilOzone / FilOzone/pdp-explorer
perf(subgraph): stop materializing ProvingWindow entities
- Dominant language
- TypeScript
- Stars
- 3
- Forks
- 7
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 4
Description
## 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
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in subgraph/src/pdp-verifier.ts at handleNextProvingPeriod (849-865) and handlePossessionProven (687-699), then inspect subgraph/utils/index.ts for MaxProvingWindowsPerEvent and the ProvingWindow entity references. Remove the listed writes, updates, and constant, then run graph build for both networks and the tests. Done means no ProvingWindow writes occur on NextProvingPeriod and builds and tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100