Skip to content

test(e2e): a lifecycle suite, from a pause's thaw to a consumer's deletion - #113

Open
giunatale wants to merge 12 commits into
giunatale/fix/punishment-holesfrom
giunatale/test/lifecycle-suite
Open

giunatale wants to merge 12 commits into
giunatale/fix/punishment-holesfrom
giunatale/test/lifecycle-suite

Conversation

@giunatale

@giunatale giunatale commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Proves #86's thaw and #98's evidence rules end to end; the rest of the suite proves behaviour of main that had unit or app-level tests only.

A third suite, TestLifecycleIntegrationTestSuite, on its own ports (the +400 block, 27057 and up) and chain ids, with a short provider unbonding period (300 s), a short max_pause_duration (150 s), 60-block epochs and a 90 s downtime challenge window, so that every clock the lifecycle runs on elapses inside the run. Nine scenarios, in the order the state allows:

  • The fee pool funded, the sweep locked while launched. The owner funds the pool, and a sweep is refused while the consumer is LAUNCHED.
  • A pending punishment moves past a pause. A second validator bonds and double-signs (a fabricated vote, as the main suite does), which jails it and queues a punishment with its executes_at. The bonded validator's refusal pauses the consumer; in the first block at or past the original maturity (read at that height) the entry is still pending and untouched; the refusal is withdrawn and governance resumes. The suite reads the pause and resume times from the chain (the first block in each phase) and asserts executes_at moved by exactly that span, then that the entry executes in the first block at or past the moved time: the execution event, the tombstone, the slash.
  • The withheld-fee record, required. A permanently silent validator bonds; the first accepted accusation leaves its stake alone, and at the next epoch boundary its share is withheld: the suite finds the record's first write by bisection over heights, asserts it is a boundary after the acceptance, that its expiry trails the last boundary by the challenge window, and that its amount is one share per boundary since. The first slash executes with the record still standing (later windows keep it alive) and the validator's fee balance unchanged since the first withholding.
  • The record's lapse on a launched consumer. Right after a boundary, the silent validator undelegates down to a remainder under one unit of power, which takes it out of the bonded set without a jail. The boundary that follows neither pays it nor refreshes the record, and the consumer drops it from its set. The record lapses in the first block at or past its expiry, one challenge window after the last boundary that withheld, with accusations accepted after that boundary still pending (so the sweep removed it, not the execution-time deletion, which only runs for a pair with nothing pending): no vaas_withheld_fee_paid event in that block, the validator's fee balance at its baseline, the pool unchanged across the block. Those accusations then mature and execute against the unbonding entry, which reads slashed, and the record stays gone.
  • A pause that outlives max_pause_duration stops the consumer. A third silent validator bonds first, so a record is live when the pause begins; paused again by refusal, with that record frozen in place (read at the last paused block); double-voting evidence submitted during the pause is accepted and queues a punishment whose clock starts at the pause; the consumer never leaves the pause early and is STOPPED in the first block at or past the deadline, the punishment moved to exactly one delay after the stop; the pending accusations are cancelled, the record lapses and is swept with nothing paid, and a resume proposal fails.
  • Evidence on the stopped consumer. The punishment queued during the pause executes in the first block at or past one delay after the stop (a lapsed pause is not a verdict). A second validator's double vote is accepted against the STOPPED consumer; a governance MsgRemoveConsumer proposal against it passes and cancels that punishment in its tally block, which reports vaas_remove_consumer with phase STOPPED; fresh evidence is then refused. It runs inside the wait for the deletion.
  • The sweep. Refused while launched and while paused; once stopped a non-owner's is refused and the owner's empties the pool into the owner's balance, to the unit.
  • STOPPED to DELETED. In the first block at or past the stop plus the provider's unbonding period; the consumer query reports DELETED with no chain id, and a new consumer registers under the released id.
  • Pre-launch removal. The registered consumer is funded and removed by its owner: deleted, the pool returned. Registered and funded again, removed by a governance proposal: the same.

make test-e2e runs the three suites in sequence, about 75 minutes, so its timeout goes from 60 to 120 minutes, leaving room for the scenarios other open PRs add; the suite joins #90's CI matrix when it rebases onto it.

Harness: the refusal, resume-proposal, fee pool, withheld-record and validator-address helpers move from the main suite to the base suite, with height-aware variants, the proposal helper splits into submit-and-vote and wait-for-status, the pending-downtime-slash and unbonding-entry queries get height-aware variants, and requireTxCommitted returns the height its transaction landed at, which the undelegation helper passes on; extractProposalID takes the first proposal_id that parses. The suite's chain-data helpers (block times, first height in a phase, block events) sit with it.

The suite's clocks were widened after its first runs: the downtime challenge window and evidence max age are 120 s over a 400 s unbonding on both chains, so the relayer-derived trusting period (two thirds, about 265 s) clears the 240 s horizon and the lapse scenario keeps a 30 s margin at 1.5 s per block. The auto-stop watch reads a failed phase query as "no change", and the polling conditions use error-returning helpers so a transient query failure retries instead of stalling to the timeout. The suite takes about 30 minutes.

@giunatale
giunatale added this pull request to stack #112 November 11, 2026 16:44
@giunatale
giunatale force-pushed the giunatale/test/lifecycle-suite branch 2 times, most recently from 23c0914 to 691a9b7 Compare November 12, 2026 14:54
…pers to the base e2e suite, with height-aware variants and a split proposal helper
…op, stopped sweep, deletion and pre-launch removal
…with the auto-stop bonding its own silent validator
…20 minutes, and correct the suite's timing notes

The suite took the host ports of the four-validator suite; it now sits at 27057/9490/1717/27056 and 27067/9492/1727/27066. The parameter rationale states that the lapse scenario needs blocks averaging under 1.5s, the README the four downtime windows per epoch the withheld record's determinism rests on, the measured run time, and the test-e2e target by name.
…nd assert the thaw exactly

The still-paused checks at the thaw's original maturity read the first block at or past that maturity, and the frozen record is read at the last paused block once the auto-stop has landed, so neither depends on how fast the queries return. The thaw moves executes_at by exactly the pause's block-time span, which the scenario now asserts with equality.
…proposal id that parses

unbondFrom polled query tx twice, once to require the commit and once for the height; requireTxCommitted now returns the height it already reads, and mustTxHeight goes. extractProposalID returns the first submit_proposal.proposal_id attribute that parses as a number instead of giving up on the first one found.
…and the removal verdict, end to end

During the auto-stop's pause an equivocating validator's double vote is accepted and queues a punishment whose clock starts at the pause; the lapse moves it to exactly one delay after the stop, and it executes in the first block at or past that time, since a lapsed pause is not a verdict. A new scenario then has a second validator's double vote accepted against the STOPPED consumer, passes a governance MsgRemoveConsumer against it, which cancels that punishment in its tally block with vaas_remove_consumer reporting phase STOPPED, and finds fresh evidence refused. It runs inside the wait for the deletion, whose time is still counted from the auto-stop.
…and let the polling conditions retry

The lapse scenario requires the withheld record to stand at the boundary
after the silent validator left, 60 blocks past the boundary that last
withheld, while the record expires one challenge window after that
boundary's block time: at 90s the two met at 1.5s per block. The window
and the evidence max age it also sets are 120s, so blocks may average
under 2s over that epoch. The challenge horizon is then 240s, and the
declared consumer client's trusting period (two thirds of the consumer's
unbonding, which may not exceed the provider's) must exceed it, so both
unbondings are 400s; the header comment re-derives every clock that
follows from them and the README carries the longer run.

The auto-stop watch no longer counts a failed phase query, which reads
back "", as the consumer leaving the pause.

The waits on a validator's tokens and bond status and on a pending
punishment poll through error-returning helpers (tryProviderValidator,
tryValidatorTokens, queryPendingEquivocations), so a transient query
failure retries at the next tick instead of stalling the wait to its
timeout.
@giunatale
giunatale force-pushed the giunatale/test/lifecycle-suite branch from 691a9b7 to 1b6e0bc Compare November 13, 2026 17:46
@giunatale

Copy link
Copy Markdown
Contributor Author

Rebase checklist, from a local merge of the open PRs in the planned order (this branch lands after #90, #99 and #115):

  • Makefile: the suite-by-suite runner from test: run the e2e harness on four validators #90, not the single 120-minute run.
  • .github/workflows/ci.yml: add TestLifecycleIntegrationTestSuite to the e2e matrix (make check-e2e-matrix).
  • tests/e2e/README.md: both suite sections and file rows; the lifecycle suite in the test-e2e-suite examples.
  • e2e_downtime_slash_test.go, e2e_refusal_and_deferral_test.go, query_test.go: this branch's height-aware variants, directive and phaseRegistered. The merged submitProposalAndVote votes from every node.
  • setGovVotingPeriod in base_suite_test.go is a copy of fix(x/provider): export the consumer validator sets and make genesis validate pass on real exports #99's helper: keep one. providerBlockTime is also defined on test(e2e): harden the four-validator and forge suites #130: keep one.
  • The //nolint:unparam on setConsumerRefusal becomes unused once the suites converge (nolintlint): drop it. declareConsumerClients then always receives "0" (unparam): whichever calling branch lands last adds a one-consumer directive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant