test(solvency): regression test for halt/unhalt oscillation

🔎 Visual review of 1ecb08ba: explainer, review flags and prompts to ask an AI about the change

Summary

The fix this MR originally carried — stopping a chain from oscillating between halted and unhalted when one vault is insolvent and another vault on the same chain is solvent — already landed in develop via 86fad734 (processSolvencyAttestation in x/thorchain/handler_solvency_helpers.go):

  • an insolvent vault refreshes SolvencyHalt<Chain>Chain to the current block, so a solvent vault reporting in the same block cannot unhalt
  • a solvent vault only unhalts when the halt height is from an earlier block
  • a manual indefinite halt (1) is left alone

develop has no test for this behaviour, so this MR is now reduced to only the regression test. It changes no production code.

Changes

  • x/thorchain/handler_solvency_test.go: adds TestSolvencyOscillationPrevention (two ETH vaults, 4 active nodes):
    • insolvent vault halts the chain, then refreshes the halt height each block
    • solvent vault in the same block does not unhalt
    • solvent vault reporting first in a new block unhalts; the insolvent vault re-halts
    • repeated blocks with insolvent-then-solvent reports stay halted
    • chain unhalts once the insolvent vault reports solvent
    • manual halt 1 is neither overwritten by an insolvent vault nor lifted by a solvent one

Test plan

  • go test -tags=mocknet ./x/thorchain/ -check.f HandlerSolvencyTestSuite passes on top of develop
  • Mutation check: develop protects a manual halt with two layers, the haltChain == 1 early return and the haltChain > 1 guards. Removing either layer alone leaves the test passing because the other still protects the halt; removing both makes the new manual-halt step fail

🤖 Generated with Claude Code

Edited by Huginn Ai

Merge request reports

Loading
Loading