Skip to content

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

Description

@silent-cipher

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

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