Repository navigation
node(svm): regression tests for SVM watcher - #4924
Open
johnsaigle wants to merge 24 commits into
Open
johnsaigle wants to merge 24 commits into
johnsaigle wants to merge 24 commits into
Conversation
johnsaigle
force-pushed
the
feat-svm-watcher-regression-tests
branch
from
August 4, 2026 11:59
a68c3a1 to
76b1003
Compare
Fix compile errors after the rebase onto main. - Serialize test data with gagliardetto/binary. Main removed near/borsh-go. - Write the message account with the current layout: VaaTime and VaaSignatureAccount replace MessageStatus, Gap and EmitterAuthority. - Remove the pm_reliable_not_finalized case. It depended on the removed MessageStatus and Gap fields. - Use rpc.CompiledInstruction for inner instructions and *big.Int for RentEpoch, as in the solana-go version on main. - Run the transaction v1 lookup table test against the RPC client mock. - Add testgen to the spellcheck dictionary and reword one README sentence.
johnsaigle
force-pushed
the
feat-svm-watcher-regression-tests
branch
from
November 4, 2026 19:05
76b1003 to
f447165
Compare
Fix the alerts that CodeQL raised on this pull request. - `solana-message-account-validation`: buildMessagePublicationFromAccountData takes raw account bytes. It creates the MessageAccountData with NewMessageAccountData and rejects the error before parsing. A new test covers the rejection. - `solana-require-successful-transaction-meta`: testgen live collection calls validateTransactionMeta and rejects the error before it parses the transaction or reads metadata. Helpers now receive the validated fields. - `canonical-vaa-address-parsing`: testgen converts the emitter with vaa.BytesToAddress. This replaces a local copy helper. Run the three rules against a fresh database of the Solana watcher. They report no results.
Remove TestFigureOutTestData from the EVM watcher tests. The test computes two hashes for one Solana message. It does not test EVM code, and the Solana replay tests already cover the digests.
Restore the watcher logic from main wherever the regression tests do not need a change. The replay tests pass against the unmodified main logic plus the RPC interface. - Remove `observations.go` and the shim PostMessage parse reorder. No test uses them, and they changed the order of the shim checks. - Take `shim.go`, `shim_test.go`, `tx_for_addr.go` and `client_test.go` from main again. - Remove `routines.go`. The run loops and retry bodies stay as named methods in `client.go`, next to the code that starts them. Each body moved without a change. - Add tests for `runWatcher` and `runDataPump`. The tests check that the loops stop on cancel and record the slot on each tick. They also check a bad observation request, a full error channel, and a consumer that stops reading.
johnsaigle
marked this pull request as ready for review
November 6, 2026 21:24
johnsaigle
requested review from
SEJeff,
bemic,
djb15,
evan-gray,
kcsongor,
mdulin2,
panoel and
pleasew8t
as code owners
November 6, 2026 21:24
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds regression tests for the Solana (SVM) watcher. #4931 is the EVM counterpart.
What the tests check
TestReplayGeneratedBundlesreplays 355 recorded transactions: 235 synthetic cases and 120 from mainnet. Each transaction runs through four watcher paths. The fixtures name themreobservation,observation,pollingandaccount. The test compares the digest that each path emits for guardians to sign with a baseline intestdata/.The baseline records what the watcher does today for these inputs. It does not prove that the watcher is correct, and it does not cover transactions outside this set. A change to the baseline needs a careful review of the diff.
The
testgenpackage generates the synthetic data and fetches the mainnet data.testgen/README.mddescribes how to regenerate the fixtures.Production code changes
The watcher logic is the same as on
main. The PR makes two mechanical edits inclient.goandreobserve.go. Most of the changed lines only move code that is already there.solanaRPCClientinterface replaces*rpc.Client. Tests supply a mock. The interface lists only methods that the watcher already calls.runDataPump,runWatcher,runSlotFetcher,runRetryFetchBlock,runDelayedFetchBlock,runInitialFetchMessageAccountandrunRetryFetchMessageAccount. Each body keeps its code. The moved code keeps the channelcheck edits frommain.The PR leaves
shim.go,tx_for_addr.go, the Solana transaction v1 code (#4961) and the borsh code (#4892) untouched.Tests of the moved code
watcher_loops_test.gotestsrunWatcherandrunDataPumpwith a mock RPC client and a local websocket server.The
runWatchertests cover a stop on cancel, the slot update on each tick, and a bad observation request. They also cover aGetSloterror and a full error channel. TherunDataPumptests check that messages arrive. They also check that the pump stops on cancel when its consumer has gone.Two tests guard the channelcheck edits from
main: the full error channel test and the stuck consumer test. Each one fails if the old plain channel send returns.Checks
mainlogic with only the interface change. A scratch worktree confirmed this, so the baseline does not depend on the moved code.make lintandgo test -racepass for the Solana packages.codeql/return no results for the Solana watcher.Not covered
testgen liveneeds a network RPC. CI does not run it.