FilOzone / FilOzone/pdp-explorer
perf(subgraph): remove dead tx-input ABI parsing in handlePiecesAdded
- Dominant language
- TypeScript
- Stars
- 3
- Forks
- 7
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 4
Description
## Problem
`handlePiecesAdded` manually ABI-decodes the full transaction input (`subgraph/src/pdp-verifier.ts:1032-1099`): setId, tuple-array offset, length, and a per-piece struct offset via `readUint256` (32-byte slice + reverse per word).
None of the decoded values are used for entity data — piece CID bytes come from `event.params.pieceCids` (`pdp-verifier.ts:1103`) and piece IDs from `event.params.pieceIds`. The decoded values only feed warning logs and a bounds check whose `continue` can wrongly skip creating a Root that the event params fully describe.
This is CPU burned per piece on the hottest backfill path, plus a correctness smell.
## Proposal
- Delete the parsing block (`pdp-verifier.ts:1032-1099`, keeping the loop body that builds Roots from event params) and the now-unused `readUint256` helper (`pdp-verifier.ts:1431-1446`).
## Acceptance criteria
- [ ] `handlePiecesAdded` builds Roots purely from event params; no tx-input access
- [ ] `readUint256` removed (or confirmed still used elsewhere)
- [ ] Tests pass; piece counts/sizes unchanged for existing test fixtures
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in subgraph/src/pdp-verifier.ts at handlePiecesAdded, especially lines 1032-1099, and inspect the loop that builds Roots from event.params.pieceCids and event.params.pieceIds. Confirm whether readUint256 at lines 1431-1446 is used elsewhere, then remove only the dead transaction-input parsing and helper. Run the existing test suite and verify piece counts and sizes remain unchanged for the fixtures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100