Skip to content

e2e/qa: fix withdraw accounting invariant for free-seat override#3561

Merged
packethog merged 2 commits intomainfrom
ss/pedantic-diffie-ecfef2
Apr 21, 2026
Merged

e2e/qa: fix withdraw accounting invariant for free-seat override#3561
packethog merged 2 commits intomainfrom
ss/pedantic-diffie-ecfef2

Conversation

@packethog
Copy link
Copy Markdown
Contributor

Summary

  • Mainnet QA run malbeclabs/infra/actions/runs/24744408505 failed in TestQA_MulticastSettlement/validate_balance_after_withdraw because the selected seat had a zero USDC price override (effective_price = 0) while the client still paid parsedAmount = 30_000_000 at pay time and got it all back on withdraw. The accounting invariant refund + retained == effective_price evaluated to 30_000_000 == 0 and failed.
  • Tie the money-conservation invariant to parsedAmount (what was actually debited) instead of effectivePrice. Holds regardless of prorating or zero-override seats.
  • Skip the prorating partial-refund invariants when effectivePrice == 0 (nothing meaningful to assert about a free seat under prorating).
  • Fix the partial-refund assertion direction: the test was checking refund < effective_price, which is the wrong way around. The correct invariant is retained < effective_price — the program kept less than a full epoch because the client left early.

Testing Verification

  • Reproduced the failing invariant against the observed mainnet telemetry (paid=30_000_000, refund=30_000_000, retained=0, effective_price=0) and confirmed the new invariant parsedAmount == refund + retained holds (30M == 30M + 0).
  • On the testnet path (prorating on, effective_price > 0), the partial-refund invariants still exercise: refund > 0, retained > 0, retained < effective_price.

The money-conservation invariant was tied to effective_price, which
breaks on mainnet where the selected seat has a zero price override:
we still pay parsedAmount at FeedSeatPay (debit = epochPrice) and
get it all back on withdraw, but effective_price = 0, so
refund + retained (30M + 0) != effective_price (0).

Switch the invariant to parsedAmount (what we actually paid), and
guard the prorating-only partial-refund checks against the zero
effective_price case. Also tweak the partial-refund check to assert
retained < effective_price (kept less than a full epoch) instead of
refund < effective_price, which was the wrong direction.
doublezero-shreds moved go.mod from e2e/ to the repo root (PR #287 / #288
landed the account-side Go SDK and collapsed the e2e subdir module into
the main module). The shreds-e2e workflow still referenced e2e/go.mod
for setup-go, failing with "specified go version file at: e2e/go.mod
does not exist". Update both go-version-file references. Working
directory and ./cmd/devnet paths are unchanged since test files stay
under e2e/.
@packethog packethog enabled auto-merge (squash) April 21, 2026 20:42
@packethog packethog merged commit 79d4567 into main Apr 21, 2026
40 of 42 checks passed
@packethog packethog deleted the ss/pedantic-diffie-ecfef2 branch April 21, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants