Skip to content

test(dlv): a fresh two-asset market runs its whole lifecycle with every step admitted - #866

Merged
cryptskii merged 1 commit into
mainfrom
test/fresh-two-asset-lifecycle
Sep 11, 2026
Merged

test(dlv): a fresh two-asset market runs its whole lifecycle with every step admitted#866
cryptskii merged 1 commit into
mainfrom
test/fresh-two-asset-lifecycle

Conversation

@cryptskii

Copy link
Copy Markdown
Collaborator

What

One route test, a_fresh_two_asset_market_runs_its_whole_lifecycle_with_every_step_admitted, chains the whole sovereign-finance lifecycle on fresh identities. Every step goes through the real routes, and every step is admitted. Before this, each step was covered only by its own test; none ran them in sequence.

The test is additive. No production path changes.

The run

  • Assets: the owner gets two assets through the real admitted origins: the ERA faucet (0x0030), then two user tokens created and minted under 0x0029.
  • Traders: four fresh traders are funded by admitted owner→trader transfers.

Steps:

  1. Create: an admitted funded create, then an advertisement.
  2. Owner away: three traders settle while the owner is offline. The settles are admitted and the folds certified.
  3. Stranger, from birth: a stranger composes the vault from birth (3 folded parents).
  4. Owner sync: the owner's storage.sync catches up all three, oldest first, as admitted applies. It anchors a fresh baseline at V_3 and moves the advertisement to it.
  5. Stranger, from the new baseline: the stranger composes from V_3 (no folded history) to the identical (sequence, c_n). A fourth trader then settles off V_3.
  6. Close: a second sync re-anchors at V_4. The admitted close drains exactly the reserves the market reached, and the leaves become (0, 0, 5).
  7. Proceeds: the close's proceeds fund a second admitted create. Its B leg is the owner's pre-close B balance + 1, an amount only an admitted close can fund.

What it asserts at every checkpoint

  • Conservation: both assets sum exactly to what was minted. The sum covers the owner's spendable balance, every live vault's reserves, and every trader.
  • No head-only value: every participant's admitted economic balances, recomputed from the admitted root, equal its head's balances.

Control

  • Step 7 sizing: the second create's B leg was mutated to the post-close balance + 1. It is refused with insufficient … to encumber (need 19038, have 19037 admitted). So the create's sufficiency check reads the admitted post-close balance, and step 7's amount is bounded by exactly what the close returned. The file was restored from a byte copy, and cmp confirms it is identical.

Verification

  • The test runs on the release lib profile with --test-threads=1: 1 passed.
  • make lint exit 0.
  • bash ci/production_safety_checks.sh exit 0.
  • Toolchain: RUSTUP_TOOLCHAIN=1.98.0.

Not covered

  • Hardware: no devices were attached. The on-device form (scripts/rig_dlv_market.py + scripts/dlv_market_rig_proof.sh) is still owed.

…ry step admitted

One route test chains the sovereign-finance lifecycle on fresh identities:
the owner is funded through the real admitted origins (ERA faucet, two
0x0029-minted tokens), four traders by admitted transfers; an admitted create
and advertisement; three settles while the owner is away and a stranger
composing from birth; the owner's storage.sync catching up, anchoring V_3 and
moving the advertisement; the stranger recomposing from V_3 to the same
frontier and a fourth settle off it; a second sync re-anchoring V_4; the
admitted close draining exactly the frontier reserves; and the proceeds
funding a second admitted create whose B leg exceeds the pre-close balance.

At every checkpoint both assets are conserved exactly across the owner, the
live vaults and every trader, and every participant's admitted balances equal
its head's.

Control: the second create sized one above the post-close balance is refused
("need 19038, have 19037 admitted").
@cryptskii
cryptskii merged commit 9d81b7a into main Sep 11, 2026
18 of 19 checks passed
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.

2 participants