Skip to content

feat: implement chain tracker interface and WhatsOnChain#126

Merged
sgbett merged 4 commits intomasterfrom
feature/93-chain-tracker
Mar 7, 2026
Merged

feat: implement chain tracker interface and WhatsOnChain#126
sgbett merged 4 commits intomasterfrom
feature/93-chain-tracker

Conversation

@sgbett
Copy link
Copy Markdown
Owner

@sgbett sgbett commented Mar 7, 2026

Summary

Implements the chain tracker abstraction for SPV merkle root verification (HLR #93):

601 lines added across 9 files. Full test suite: 1400 examples, 0 failures.

Closes #93, closes #122, closes #123, closes #124, closes #125

Test plan

  • 5 ChainTracker base class specs pass
  • 13 WhatsOnChain unit specs pass (mocked HTTP)
  • 3 MerklePath#verify specs pass
  • 16 conformance specs pass (Go SDK patterns, SPV end-to-end)
  • Full suite: 1400 examples, 0 failures
  • RuboCop clean on all changed files

🤖 Generated with Claude Code

sgbett and others added 4 commits March 7, 2026 00:37
Define BSV::Transaction::ChainTracker with valid_root_for_height? and
current_height contract. Subclasses must implement both methods.

Implements sub-task #122 of HLR #93.

Co-Authored-By: Claude <noreply@anthropic.com>
Implements BSV::Transaction::ChainTrackers::WhatsOnChain that queries the
WoC block header endpoint to verify merkle roots. Supports mainnet, testnet,
and STN networks with optional API key and injectable HTTP client.

Implements sub-task #123 of HLR #93.

Co-Authored-By: Claude <noreply@anthropic.com>
Computes merkle root from path and txid, then validates against a
ChainTracker. Completes the SPV verification chain: tx → merkle path →
root → chain tracker → confirmed.

Implements sub-task #124 of HLR #93.

Co-Authored-By: Claude <noreply@anthropic.com>
16 specs validating against Go SDK test patterns, genesis block data,
end-to-end SPV verification via MerklePath#verify, and URL construction.

Implements sub-task #125 of HLR #93.

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 7, 2026

Codecov Report

❌ Patch coverage is 96.29630% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...b/bsv/transaction/chain_trackers/whats_on_chain.rb 94.73% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@sgbett sgbett merged commit b15655c into master Mar 7, 2026
7 checks passed
@sgbett sgbett deleted the feature/93-chain-tracker branch March 24, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant