test: bifrost and thorchain suites wait for what they assert, no-fsync fixtures, one shared wasmvm
🔎 Visual review ofc2a22d1f(same diff as5d504135): explainer, review flags and prompts to ask an AI about the change
Fifteen test-speed changes from the RSI loop: bifrost and x/thorchain tests wait for the event they assert on instead of sleeping, test fixtures skip fsync or use in-memory LevelDB, and expensive per-test setup (wasmvm, lzma dictionaries, a duplicated gocheck run) happens once. Production behavior is identical. The only production edits are package vars that keep today's values (and that tests override) and one consensus-side memo that develop already uses for the same decode.
Commits
- test(tss): keyshare tests compress at lzma BestSpeed, pin production level (L3-0106). Both encoders read
lzmaLevel, which defaults to the new constantLzmaLevel = lzma.BestCompression, so production output is unchanged. Tests lower the var the way they already lowerageWorkFactor. New tests pin the constant and the default, check that both encoders follow the var, and check that the production stream carries the 2^27 dictionary../bifrost/tss9.1s → 6.4s (−29.8%, p=0.004). - test(monero): payout replay fixture reopens its DBs on in-memory storage (L3-0111). Test-only. Reopening the same
storage.NewMemStoragerecovers the same manifest, journal and tables as a reopen from disk. Giving a reopen fresh storage fails the restart tests../bifrost/pkg/chainclients/monero19.0s → 14.5s (−23.6%, p=0.004). - test(thorchain): setupManagerForTest keepers share one wasmvm (L3-0114). Test-only. The VM's code cache is keyed by checksum, and each keeper finds code through its own per-test store.
TestSharedVMKeepsCodePerTestchecks that a second setup cannot instantiate code stored only through the first. 24.7s → 22.6s (−8.7%, p=0.004). Mutation score 0.6285 → 0.631. - test(solana): TestBroadcastTxError zeroes the broadcast lookup delay (L3-0126). Test-only. The raw bytes in that test carry no signature, so the 3s sleep before the lookup was pure waiting. 10.3s → 7.3s (−29.4%, p=0.004).
- test(p2p): stagger TestNewPartyCoordinator joins by 200ms/300ms, not 1s/2s (L3-0128). Test-only. The leader still joins first or last relative to members staggered under 100ms. Timeouts and assertions are unchanged. 96 runs passed at 32-way
-race. 29.6s → 27.2s (−8.2%, p=0.004). - test(p2p): TestNewPartyCoordinatorTimeOut waits a 2s join timeout, not 3s (L3-0129). Test-only. The same retries, errors and online-peer assertions hold at 2s. 96 runs passed at 32-way
-race. 27.0s → 25.2s (−6.6%, p=0.004). - test(evm): allowance tests switch mimir through a bridge wrapper, not a cache sleep (L3-0132). Test-only. A wrapper answers the overridden mimir, and the disabled-mimir asserts still read through the real bridge. 10.9s → 8.9s (−18.3%, p=0.004).
- test(observer): open observer storage without fsync in tests (L3-0135).
NewObserverStorageopens through a package var that defaults todb.NewLevelDB, so production is unchanged. TestMain swaps in the same opener withNoSync. Write order, write options and reopen-after-Close are unchanged../bifrost/observer63.6s → 50.4s (−20.7%, p=0.004). - test(bifrost): solvency zero-backoff test times the first tick instead of sleeping 3.5s (L3-0143). Test-only. The first tick must land within [ThorchainBlockTime, 2×ThorchainBlockTime), and breaking the default fails either bound. 11.4s → 9.0s (−21.3%, p=0.004).
- test(bifrost): solvency runner tests wait for the tick they assert on (L3-0144). Test-only. The tests poll for the signal of the asserted branch, and
wg.Waitafter stop means the negative asserts still see a completed tick. 32 concurrent-racecopies passed. 9.0s → 6.4s (−29.0%, p=0.004). - test(thorchain): network fee voter checks and counts signers through the signer decode memo (L3-0147).
ObservedNetworkFeeVoter.GetSignersdecodes throughcommon.SignerAddressString. That is develop's memoizedAccAddressFromBech32(keyed on prefix + exact string, results copied), whichObservedTx.GetSignersalready uses on the same consensus path. Results, signer order and store access (gas) are unchanged. When the commit was rebased, develop already routedHasSignedthrough the memo, so that part of the idea was dropped and onlyGetSignersplus a pinning test remain../x/thorchain29.6s → 27.6s (−6.8%, p=0.008). - test(thorchain): guard test runs its scenario at a 20-block grace over 60 blocks (L3-0149). Test-only. The guard is linear in blocks, so a smaller grace walks the same paths, and dropping the same-height check still fails the test. 27.3s → 24.9s (−8.7%, p=0.004).
- test(bifrost): p2p tests wait 20ms between unreachable bootstrap rounds (L3-0158). Test-only. The override lives in a p2p
_test.gofile, so production keeps 5s. Dials to a closed local port are refused at once. 25.3s → 21.5s (−14.9%, p=0.004). - test(thorchain): TestDynamicFeeTypes runs only its own suite (L3-0160). Test-only. All 213
x/thorchain/typesgocheck tests ran twice. Now every test runs exactly once (8 under TestDynamicFeeTypes, 205 under TestPackage). 8.4s → 5.6s (−33.3%, p=0.004). - test(bifrost): event client retry tests wait on the resubscribe, not 1.5s sleeps (L3-0169). The resubscribe backoff is the package var
subscribeRetryBackoff, which defaults totime.Second, so production is identical. The tests set it to 10ms and wait on the mocked call they assert on. Breaking the retry fails all three tests../bifrost/observer57.1s → 52.9s (−7.3%, p=0.004).
Batch verdict
testspeed over all touched packages (./bifrost/observer ./bifrost/p2p ./bifrost/pkg/chainclients/{evm,monero,shared/runners,solana} ./bifrost/tss ./x/thorchain ./x/thorchain/types), base develop 55ac22c7 plus RSI tooling:
testspeed wall median 96.7s -> 71.1s (-26.40%, p=0.004, n=5)
mutation (400 sampled) x/thorchain 0.6361 -> 0.6387 x/thorchain/types 0.5732 -> 0.5783
VERDICT: PASSThe make lint-ci and govulncheck checks found nothing new against develop, and the batch adds no dependencies.
RSI ideas: L3-0106 L3-0111 L3-0114 L3-0126 L3-0128 L3-0129 L3-0132 L3-0135 L3-0143 L3-0144 L3-0147 L3-0149 L3-0158 L3-0160 L3-0169
Published by huginn from the RSI loop (lane L3, ideas: L3-0106, L3-0111, L3-0114, L3-0126, L3-0128, L3-0129, L3-0132, L3-0135, L3-0143, L3-0144, L3-0147, L3-0149, L3-0158, L3-0160, L3-0169). The batch was judged as a whole by the loop's frozen judges, so huginn makes no code changes to it; it only rebases it (without AI) and merges it.