Skip to content

[sdk]: skip live tests with a warning when the test wallet can't pay - #1420

Merged
seunlanlege merged 1 commit into
mainfrom
fix/sdk-live-tests-skip-unfunded
Oct 19, 2026
Merged

seunlanlege merged 1 commit into
mainfrom
fix/sdk-live-tests-skip-unfunded

Conversation

@seunlanlege

Copy link
Copy Markdown
Member

This PR makes the sdk's live testnet tests skip, with a visible warning, when the shared CI test account can't pay, instead of failing as if the code were broken. It changes test code only.

Why: the @hyperbridge/sdk workflow's live job runs src/tests/sequential/* against Polygon Amoy, BSC Chapel and Hyperbridge Gargantua from one PRIVATE_KEY account. On #1414 it failed in intentGatewayCancel with viem's InsufficientFundsError: the account held 1.62 POL and the cancel needed 1.83. Nothing in that PR was involved; the testnet account ran low.

Change (src/tests/sequential/funding.ts, used by every spending live test):

  • Upfront check: requireFunded(ctx, account, requirements) reads each balance a test is about to spend (native gas and tokens, per chain) before its first transaction. If any is below that test's named minimum, the test skips. The cancel tests check this before placing an order, so a short wallet doesn't leave a testnet escrow behind unrefunded.
  • Backstop: skipIfUnfunded(ctx, account, native, step) wraps the spending steps. Gas prices and relayer fees drift, so a transaction can still be rejected with InsufficientFundsError anywhere in its cause chain; when that happens, the test skips. Any other error still fails it.
  • Visibility: every skip prints a GitHub Actions ::warning title=Unfunded live test::<test>: <account> holds <balance> on <chain>, needs at least <min>. Fund it to run this test. annotation, plus the same text to stderr.
  • Missing secrets: a missing secret is still a hard error, since that's a CI misconfiguration.
  • Coprocessor test: in intentsCoprocessor, the tests that read or retract the bid skip when the bid was never placed.

The minimums per test are listed in docs/ai/changelog/2026-10-16-live-tests-skip-when-the-wallet-is-unfunded.md. For the cancel test from its source, that's 5 POL plus 10 fee token and 0.1 USDC on Amoy.

Validation

  • Offline tests: src/tests/liveTestFunding.test.ts (4 tests, run by the normal offline test) covers:
    • a balance below the minimum skips with the annotation;
    • a funded wallet runs;
    • an InsufficientFundsError wrapped in a TransactionExecutionError skips;
    • any other error is rethrown.
  • Static checks: tsc is clean on the package and prettier is clean. Biome reports only the 4 errors that already exist in these files on main.
  • Live tests: not run here, since they need the CI secrets. CI's live job on this PR is the real check.

The CI account still needs topping up for the cancel test to run rather than skip. The annotation names the balance to fund.

@seunlanlege
seunlanlege merged commit 1672308 into main Oct 19, 2026
2 checks passed
@seunlanlege
seunlanlege deleted the fix/sdk-live-tests-skip-unfunded branch October 19, 2026 15:06
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