Skip to content

fix(squid-sdk): strip vote transactions in the Solana RPC source, matching Portal numbering - #558

Open
abernatskiy wants to merge 1 commit into
masterfrom
fix/solana-rpc-vote-parity
Open

fix(squid-sdk): strip vote transactions in the Solana RPC source, matching Portal numbering#558
abernatskiy wants to merge 1 commit into
masterfrom
fix/solana-rpc-vote-parity

Conversation

@abernatskiy

Copy link
Copy Markdown
Contributor

Problem

The Portal Solana dataset producers (solana-ingest --no-votes, solana-data-service) call removeVoteTransactions() before mapRpcBlock(): vote transactions are dropped, and the surviving transactions keep their original getBlock positions via the stamped _index, which normalization adopts as transactionIndex. This is also the contract encoded in solana-normalization's LFS conformance fixtures.

The solana/rpc adapter fed raw blocks straight into normalization, so its transactionIndex counted vote transactions — and every item id embedding the index disagreed with Portal-sourced data whenever a vote preceded the transaction in the raw block order. A fallback switching between portal and rpc sources would emit different ids for the same on-chain event.

Fix

  • Apply removeVoteTransactions() before normalization in the adapter's block mapping (extracted as mapRawBlock for testability, mirroring the exported coarseRequest).
  • Declare @subsquid/solana-rpc-data ^1.0.0 as an optional peer + devDep. It is a hard dependency of @subsquid/solana-rpc, so it is always installed whenever the RPC path is usable; the missing-peer translation covers it.

Testing

  • New regression test: a vote transaction preceding a payload transaction must not shift the payload's transactionIndex (asserts index 1, not a post-filter 0) — fails without the fix.
  • Full megapackage suite: 175 passed.
  • E2E: the standard Whirlpool USDC-SOL example squid run twice over the same slot range — once on the Portal source, once on the fixed RPC source against a mainnet archive node — produces byte-identical rows including ids. Before the fix, ids diverged in the transactionIndex component on every block where votes precede the matched transaction.

🤖 Generated with Claude Code

https://claude.ai/code/session_01S2n1VHrhUa2szzVMW3mrkY

…ching Portal numbering

The Portal dataset producers (solana-ingest --no-votes, solana-data-service)
call removeVoteTransactions() BEFORE mapRpcBlock(): vote transactions are
dropped and the survivors keep their original getBlock positions via the
stamped _index, which becomes transactionIndex. The RPC adapter fed raw
blocks straight into normalization, so its transactionIndex counted votes
and every item id embedding it disagreed with Portal-sourced data whenever
a vote preceded the transaction in the block.

- apply removeVoteTransactions() before normalization in the adapter's
  block mapping (extracted as mapRawBlock for testability)
- declare @subsquid/solana-rpc-data ^1.0.0 as an optional peer (it is a
  hard dependency of @subsquid/solana-rpc, so it is always present when
  the RPC path is usable) and include it in the missing-peer translation
- regression test: a vote preceding a payload transaction must not shift
  the payload's transactionIndex

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S2n1VHrhUa2szzVMW3mrkY
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.

1 participant