perf(subgraph): remove dead tx-input ABI parsing in handlePiecesAdded

Open Beginner friendly
#137 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Quiet
Tech stack
typescript
Domain
backend

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.

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
Dominant language
TypeScript
Stars
3
Forks
7
Avg merge
1d 4h
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from FilOzone/pdp-explorer

All issues in FilOzone/pdp-explorer

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.