Problem
sumTreeAdd / sumTreeRemove run for every piece in handlePiecesAdded (subgraph/src/pdp-verifier.ts:1139-1140) and handlePiecesRemoved (subgraph/src/pdp-verifier.ts:1295-1302). Each call performs O(log n) SumTreeCount entity loads plus at least one write (subgraph/src/sumTree.ts).
Nothing consumes this data today:
- The only reader is
findChallengedRoots in subgraph/src/pdp-service.ts, whose handleFaultRecord is not wired into the manifest — there is no PDPService data source in subgraph.yaml or templates/subgraph.template.yaml.
- The client never queries
sumTreeCounts.
So on the hottest backfill path (piece ingest) we pay O(log n) store reads + writes per piece for state that is never read.
Proposal
- Decide: is FaultRecord / PDPService support coming back?
- No / not soon: delete the
SumTree calls from both handlers, the SumTreeCount entity from schema.graphql, and src/sumTree.ts (git history preserves it).
- Yes: remove the calls now anyway and reintroduce them in the same PR that adds the PDPService data source, so we don't pay the cost while nothing consumes it.
- Update Matchstick tests accordingly.
Acceptance criteria
Notes
Current Heatmap shows no faults at all and this is because FaultRecord/PDPService isn't wired in manifest.
Problem
sumTreeAdd/sumTreeRemoverun for every piece inhandlePiecesAdded(subgraph/src/pdp-verifier.ts:1139-1140) andhandlePiecesRemoved(subgraph/src/pdp-verifier.ts:1295-1302). Each call performs O(log n)SumTreeCountentity loads plus at least one write (subgraph/src/sumTree.ts).Nothing consumes this data today:
findChallengedRootsinsubgraph/src/pdp-service.ts, whosehandleFaultRecordis not wired into the manifest — there is no PDPService data source insubgraph.yamlortemplates/subgraph.template.yaml.sumTreeCounts.So on the hottest backfill path (piece ingest) we pay O(log n) store reads + writes per piece for state that is never read.
Proposal
SumTreecalls from both handlers, theSumTreeCountentity fromschema.graphql, andsrc/sumTree.ts(git history preserves it).Acceptance criteria
SumTreeCountloads/writes duringPiecesAdded/PiecesRemovedhandlinggraph buildfor both networks + tests passNotes
Current Heatmap shows no faults at all and this is because FaultRecord/PDPService isn't wired in manifest.