test: run mimir gates both ways and observe through the quorum path
🔎 Visual review: building it foraec0b730; the link appears here.
What and why
The retrospective of 322 bug fixes found 42 (13%) missed because a feature interaction was never tested, 14 of them mainnet incidents. Two shapes repeat: the second state of a flag that nobody runs, and the second entry path a message arrives by.
- !4277 (merged) and !4286 (merged) (chain halts, October 2025): with
EnableAdvSwapQueueoff, the legacy queue updated a StreamingSwap record the handler no longer created for limit swaps; Interval=0 panicked the next block. Every suite ran limit swaps with the queue on (mocknet defaults it to 1). - !4631 (merged): a fix required an active-node signer on MsgNoOp. Real
noop:novaultarrives through Enshrined Bifrost as MsgObservedTxQuorum with a module signer, so every one was rejected. The noop suite that fix added still observes throughtx-observed-in, a node-signed MsgObservedTxIn, so it would not catch the bug again. - Also gate-related: !4182 (merged) (EnableAdvSwapQueue default flipped inside a 201-file MR; tests pass either way), !4057 (merged) (queue wiring broken behind a disabled mimir, no suite ran it), !4948 (merged) (ragnarok under the advanced queue).
This MR:
tools/mimir-gates, run byscripts/lint.shand by its own unit test. It finds every boolean-style mimir gate read underx/(Enable*,*Enabled,Halt*,Pause*,*Guardand similar, default -1, 0 or 1; 38 today), and every value regression suites give them (tx-mimir, genesismimirs,env). The mocknet default counts as covered; the other state needs a suite that sets it. It fails for a gate missing a state unless the gap is intools/mimir-gates/baseline.txt, which the tool generates (-write), and fails when a listed gap closes, so the list only shrinks.-reportprints every gate, its mocknet and mainnet defaults and the suites per state. The baseline records 17 gates that no suite runs in one state today, for exampleHaltChurning,HaltChainGlobal,PauseBond,DisableTSSSignerFiltering(never on) andLUVIGuard,TradeAccountsEnabled(never off).tx-observed-quorum-in, a regtest operation that signs attestations with node keys and sends the QuorumTx to the node's ebifrost, which injects MsgObservedTxQuorum the way production does.noop/noop-quorum.yamlruns the noop suite's authorized, unauthorized and plain noops through it.adv-swap-queue/queue-matrix/: four pairs of suites, each sending the same txs withEnableAdvSwapQueue0 and 1: a streaming market swap, limit swaps with streaming parameters (the !4277 (merged)/!4286 (merged) shape), a limit swap with a ttl, and modify and cancel of limit swaps. They also pin down where one memo means different things to the two queues (interval vs ttl, refund at once vs resting order, modify failing vs applying).
No production code changes.
Bug found on develop (not fixed here)
With EnableAdvSwapQueue = 0, a limit swap that fills and carries streaming parameters with quantity >= 1 (memo =<:ETH.ETH:<addr>:1/1/3) swaps in the pool but gets no outbound: the user is never paid, and the vault holds more than the pools. handler_swap.go skips the StreamingSwap record for limit swaps, swap_current.go skips TryAddTxOutItem because swp.Valid() == nil ("streaming swap outbounds are handled in the swap queue manager"), and manager_swap_queue_current.go only settles streaming swaps when !IsLimitSwap() (the !4286 (merged) fix). Mainnet has ENABLEADVSWAPQUEUE=1 today, so it is latent until the queue is switched off. The harness has no expected-failure mechanism, so the case is left out of streaming-limit-swap-legacy.yaml (a comment there says why) and the repro suite is attached separately (drop it in test/regression/suites/; on develop its outbound check fails with an empty queue while the ETH pool has paid out).
How it was tested
go test ./tools/mimir-gates/(with and without-tags=mocknet): scanner, suite parser, coverage, baseline check on a fixture tree, plus the real repo against the baseline.make test-regression RUN='noop-quorum|queue-matrix' CI=1 EXPORT=1 DEBUG=1: 9 new suites pass; their fixtures are new files only. No existing fixture changed.- Mutation check (production code edited locally, not committed): re-adding the active-node signer check to
NoOpHandler.validate(!4631 (merged)) failsnoop-quorum.yamlwhilenoop.yamlstill passes; dropping!IsLimitSwap()in the legacy queue manager (the !4286 (merged) hollow record) failsstreaming-limit-swap-legacy.yaml. make lint-ci.
What it does not cover
- The gate check shows that some suite runs each state, not that the suites for a feature run both states.
EnableAdvSwapQueuewas already "covered" before this MR; only the paired suites cover the flows. Suites still need to be written per feature. - Gates whose keys are built at runtime (
Halt<Chain>Chain,HaltSigning<Chain>,AllowNoVault-<Chain>,PauseLP<Chain>) and gates read only by bifrost are not enumerated. A gate-named constant referenced inx/counts as read even when it is read withGetConstants()rather than as a mimir. EnableAdvSwapQueuemode 2 (market only) is not part of the matrix; existing suites set it.- Entry-path coverage (item 3 of the plan) is not built; see follow-ups.
Follow-ups
- Fix the legacy-queue lost output above, then add the filled
1/1/3case to bothstreaming-limit-swap-*suites. - Close baseline gaps, highest value first: kill switches never exercised on (
HaltChurning,HaltChainGlobal,HALTSIGNING,HaltMemoless,DisableTSSSignerFiltering,PauseBond,PauseUnbond) and guards never run off (LUVIGuard,LUVIOverhangGuard). - Entry-path coverage check. Design:
- Entry paths:
deposit(MsgDeposit memo, user signer),observed-node(tx-observed-in),observed-quorum(tx-observed-quorum-in, ebifrost module signer),msg(direct Msg service tx),authz(MsgExec),wasm(contract execute/sudo dispatching a Msg). - Memo-reachable messages: classify each suite operation's memo with
memo.StringToTxTypeon the first:field (the suite parser intools/mimir-gatesalready renders suites), giving a TxType x entry-path table of suites. A table in code marks combinations that cannot occur (RUNE-only memos from L1, outbound-only memos such asout/refund/migrate) with a reason. - Msg-service messages: list
msg_server.gomethods and the ante cases inante.go; for each Msg gated in the ante handler, require a unit or regression test that sends it through MsgExec and through wasm (the !5097 (merged) shape), found by a// entrypath:<Msg>:<path>marker in tests, since dispatch tests are Go, not YAML. - Same ratchet as the gate check: a generated baseline of missing (type, path) pairs, failing on new gaps and on closed gaps still listed. Start with
observed-quorum, which today only noop has.
- Entry paths:
- Consider making
tx-observed-inroute through the quorum path by default (with an opt-out for suites that test MsgObservedTxIn itself), since that is the production path.