Skip to content

Fix uniqueness check for firehose.firstStreamableBlock.id - #261

Merged
YaroShkvorets merged 1 commit into
graphprotocol:mainfrom
hey-research-lab:fix-unique-genesis-check
Nov 6, 2026
Merged

YaroShkvorets merged 1 commit into
graphprotocol:mainfrom
hey-research-lab:fix-unique-genesis-check

Conversation

@hey-research-lab

Copy link
Copy Markdown
Contributor

Problem

validateUniqueness in src/validate_logic.ts resolves a dotted field with field.split(".") and only keeps the first two parts. For firehose.firstStreamableBlock.id that reads n.firehose.firstStreamableBlock, the { id, height } object, not its id. Duplicates are then found with values.indexOf(v) !== i, and two different objects are never equal, so this check never reports anything. The ALLOWED_DUPLICATES list (avalanche/fuji, the zkSync-stack chains, solana/solana-accounts) holds genesis block ids, which shows the check was meant to compare ids.

Reproduction on main (bf74250):

cp -r registry /tmp/reg-dup
# give robinhood-sepolia the genesis id of robinhood (0xaad15f3d…305c)
bun run ./src/validate_logic.ts /tmp/reg-dup

Result: no error, exit code 0. The duplicated genesis id goes through.

Fix

Add a small valuesAtPath helper. It resolves a dotted path of any depth and descends into arrays at every level. validateUniqueness now uses it for every field. Falsy values are still dropped, as before.

Validation

  • With the reproduction above, bun run ./src/validate_logic.ts /tmp/reg-dup now fails with exit 1: Duplicate field: "firehose.firstStreamableBlock.id = 0xaad15f3d702aaea00caf3e9bb56395efe9127bc3b31b24921abf1eee3409305c".
  • bun validate:networks on the real registry/ still passes (exit 0, warnings unchanged). The existing allowed duplicates are the only shared genesis ids today.
  • For every field in the list, I compared the values the old and new code extract across all 160 networks. They are identical, except firehose.firstStreamableBlock.id, which now yields 159 id strings instead of 159 objects.
  • bun validate:schema, bun generate:registry and bun validate:registry pass.

Notes

The file was not Prettier-clean before this change (it uses tabs), so I did not reformat it. The diff only touches the uniqueness check.

@YaroShkvorets
YaroShkvorets self-requested a review November 6, 2026 18:04
validateUniqueness split each field path on the first dot only, so the
three-level path firehose.firstStreamableBlock.id compared the
firstStreamableBlock objects instead of their ids. Distinct objects are
never equal, so a duplicated genesis block id was never reported.

Resolve dotted paths of any depth, descending into arrays at every
level.
@YaroShkvorets
YaroShkvorets force-pushed the fix-unique-genesis-check branch from 46131e9 to a501a44 Compare November 6, 2026 18:12
@YaroShkvorets
YaroShkvorets merged commit 5955a10 into graphprotocol:main Nov 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants