Skip to content

parameters for chain exercises - #122

Open
n13 wants to merge 3 commits into
mainfrom
parameter-for-chain-exercises
Open

parameters for chain exercises#122
n13 wants to merge 3 commits into
mainfrom
parameter-for-chain-exercises

Conversation

@n13

@n13 n13 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds two parameters to quantus exercise so the suite can run against any funded account — e.g. a public testnet — instead of requiring the genesis-funded crystal_alice dev account and ~4000 tokens.

What's new

  • --root-account <NAME> (+ --root-password / --root-password-file) — the wallet that funds the run. Defaults to the built-in crystal_alice dev account, so existing --dev usage is unchanged. Threaded through the funding step and the wormhole scenario.
  • --total-amount <TOKENS> (default 40) — total budget drawn from the root account, split evenly across the ephemeral test accounts.

How it works

  • Discretionary test amounts (transfers, multisig funding, reversible, fuzz, …) are scaled down by a fixed DISCRETIONARY_SCALE = 100 via a new ctx.test_unit = unit / 100, so the suite needs ~tens of tokens instead of ~4000.
  • Fixed, chain-imposed amounts are never scaled — existential deposit and the multisig / preimage / governance deposits are read from the chain, so they stay covered. That's why the practical floor is ~40 tokens, not ~1.
  • Preflight + guards replace the old cryptic mid-run failure (Inability to pay some fees) with fast, actionable errors:
    • root-account balance check before any funding,
    • "budget too low to cover deposits" guard,
    • existential-deposit floor guard on the scale (a fresh account funded with test_unit/2 must stay above ED).
  • The wormhole amount is intentionally left unscaled (50.0): it round-trips back to the wallet and draws from the separately-funded root account, so shrinking it saves nothing — and small per-proof amounts round below the on-chain minimum in later rounds (No transfer event found).

Caveat

The governance phase still relies on the dev genesis accounts (tech-collective membership), so pass --skip governance when using a custom root account on a public testnet. This is documented in --help.

Testing

  • Local --dev node (spec 135 / tx 3): full suite 62/62 passing with --root-account crystal_alice --total-amount 40 — funds 4 ephemeral accounts at 10 DEV each; multisig, governance, preimage (all deposit-bearing) and wormhole all green.
  • Live Planck testnet: preflight balance check, budget-too-low guard, and custom-root wallet loading all verified.
quantus exercise --skip governance \
  --root-account <wallet> --root-password <pw> \
  --total-amount 40 --node-url <ws-url>

Docs

quantus exercise was previously undocumented — added a Chain Exercise Suite section to the README (phases, dev-node vs. testnet usage, and a flag table). All new flags are also self-documented in --help.

n13 and others added 3 commits July 24, 2026 21:59
so this can also be run on testnet
The wormhole round-trips its amount back to the funding wallet and draws
it from the root account, which is funded independently of --total-amount,
so scaling it down saves nothing. Worse, each round re-partitions the
amount across num_proofs and deducts fees, so a scaled-down amount rounds
an output below the on-chain minimum in a later round and emits no
transfer event ("No transfer event found"). Restore the proven 50.0.

Verified on a local --dev node: full `quantus exercise` suite now passes
62/62 with --root-account crystal_alice --total-amount 40.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nt flags

The exercise command was undocumented in the README. Add a Command Reference
section covering the phases, usage (dev node vs. public testnet), and a flag
table for the new --root-account / --total-amount options and the existing
--phases/--skip/--seed/--json flags.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant