Skip to content

fix(chaintracker): track Solana slot instead of block height#2274

Open
NadavLevi wants to merge 1 commit intomainfrom
fix/solana-slot-blockheight-mismatch
Open

fix(chaintracker): track Solana slot instead of block height#2274
NadavLevi wants to merge 1 commit intomainfrom
fix/solana-slot-blockheight-mismatch

Conversation

@NadavLevi
Copy link
Copy Markdown
Collaborator

The SVM chain tracker extracted LastValidBlockHeight into seenBlock, while provider spec parsing (specs/mainnet-1/specs/solana.json) reads context.slot for the same "latest block" signal. On Solana these diverge significantly (slot > block_height by the skip rate, ~22M on mainnet), so the consistency pre-validation in relaycore computed lag = seenBlock - endpointLatestBlock ≈ 22M every time, tripping the 50-slot threshold and returning "No pairings available" to clients.

Track slot on both sides so the comparison is apples-to-apples. Also rename local vars/helper for clarity (blockNum -> slot, tryGetSlotFromCache -> waitForSlotVisible) since on Solana the interface's blockNum arg is semantically a slot.

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • read the contribution guide
  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the main branch
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 24.00000% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
protocol/chaintracker/svm_chain_tracker.go 0.00% 19 Missing ⚠️
Flag Coverage Δ
consensus 8.98% <ø> (ø)
protocol 35.24% <24.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
protocol/chainlib/svm_block_hash_retry.go 94.87% <100.00%> (ø)
protocol/common/svm.go 0.00% <ø> (ø)
protocol/chaintracker/svm_chain_tracker.go 0.00% <0.00%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@NadavLevi NadavLevi force-pushed the fix/solana-slot-blockheight-mismatch branch from 5d33506 to 2a2f52b Compare April 15, 2026 12:01
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 15, 2026

Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
7 files   ±0   0 ❌ ±0 

Results for commit f5c81de. ± Comparison against base commit 2d92617.

♻️ This comment has been updated with latest results.

@NadavLevi NadavLevi requested a review from Tomelia1999 April 15, 2026 12:39
The SVM chain tracker extracted `LastValidBlockHeight` into `seenBlock`,
while provider spec parsing (specs/mainnet-1/specs/solana.json) reads
`context.slot` for the same "latest block" signal. On Solana these
diverge significantly (slot > block_height by the skip rate, ~22M on
mainnet), so the consistency pre-validation in relaycore computed
lag = seenBlock - endpointLatestBlock ≈ 22M every time, tripping the
50-slot threshold and returning "No pairings available" to clients.

Changes:
- SVMChainTracker now tracks slot (context.slot) on both sides so the
  comparison is apples-to-apples. Local vars/helpers renamed for clarity
  (blockNum -> slot, tryGetSlotFromCache -> waitForSlotVisible) since
  on Solana the interface's blockNum arg is semantically a slot.
- Rename chainlib/svm_chain_tracker.go -> svm_block_hash_retry.go
  (file was never a tracker — it's a -32004 retry helper for skipped
  slots; two files with the same basename was misleading).
- Wire IsBlockNotAvailableError through the chain-aware error registry
  (ClassifyError with ChainFamilySolana), replacing the direct numeric
  code check. Eliminates the theoretical chain-blindness noted in the
  helper's own documentation.
- Drop now-unused SolanaBlockNotAvailableCode constant; the registry is
  the single source of truth for this code mapping.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@NadavLevi NadavLevi force-pushed the fix/solana-slot-blockheight-mismatch branch from 2a2f52b to f5c81de Compare April 15, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant