Seedelf-Wallet

Chunk 42 · Lovejoin, verified

Branch lovejoin-verification, from verification at 63cdb465. It stayed local until the fix was public: the xor32 fix merged into Lovejoin’s main as 29573c5 (PRs #165 and #166, 2026-11-05), and the branch went to main after it. The owner, 2026-11-03: “A lot of the seedelf web wallet depends on lovejoin working as well. Trickier and if something is found wrong then it would be bad for us to push it into this branch so maybe a local only branch until we prove it good?”

Status: ✅ done. Archived in 1.8.1’s release review, with what its PRs did at the end. What we claim from it, and where the claim stops, is CLAIMS.md; its rule for a property that comes back Falsified is in seedelf-verification’s README.

The work goes in seedelf-verification/Lovejoin/, beside Seedelf/, on the same pinned forks (chunk 41). The README’s rules for writing a property hold here.

Step Status
1 · Setup, reference_holder and mix_box ✅ 30 theorems (2026-11-03), every module in seconds, at most 525 MB
2 · mix_logic’s easy parts ✅ 6 theorems (2026-11-03)
3 · serialise_data behind an opaque alias ✅ #27’s commit on the fork (0a25f13, Rob van Leeuwen’s), in seedelf at 7fc0aa3, pinned on this branch; the Seedelf baseline unchanged
4 · mix_logic, Owner ✅ owner_withdraws_iff_proof (2026-11-03): the Lean vector’s z is Aiken’s, and a real proof halts after 3099 steps. Withdrawals of 1 to 3 boxes, every field symbolic (OwnClassic*, 9, on 68c5399): 1.8.0’s returns
5 · mix_logic, Mix ⬜ on v2 instead (step 8): the wallet moves to v2 alone, and the classic pool keeps only its Owner
6 · fee_contract and one_shot_mint ✅ on their templates, for every pool (step 8): OneShotMint (5) and FeeContract (5) (2026-11-03)
7 · The token-pool templates ✅ on v2 instead (step 8): the Mix for any token pool at n = 2 to 4. 8131b1d’s only mainnet pool (5 ₳) is empty
8 · v2: the templates with xor32’s fix ✅ (2026-11-03, PlutusCoreBlaster 68c5399), 230 theorems. On the test launch: MixChallenges (1), MixOutputs (4), MixDatums (3), Owner (1), the Mix iff at n = 2 (7) and n = 3 (13), and the templates for every pool (mix_box 29, one_shot_mint 5, fee_contract 5): 68. On mix_logic’s template, so for every pool: the Mix for any ADA or token pool at n = 2 to 4 (82), what it must pay (66), and Owner withdrawals of 1 to 4 boxes (OwnAny*, 14)
9 · The wallet on v2 alone ✅ 1.8.0, with chunk 44 (#363, #364); mainnet’s v2 5 ₳ pool (fcb3f5ec…) is live
10 · Every transaction (the owner’s bar, 2026-11-04) ✅ Seedelf, all three scripts (2026-11-05): the wallet with none to 128 signatories, always_false, the policy in every context, and kernel-checked covers (seedelf-verification’s README). v2 ✅: every script’s other purposes, mix_logic’s publish and reference_holder, 17 (./check.sh lovejoin-any-tx); mix_box’s spend (BoxPurposesAll.every_context_iff); mix_logic’s Owner and Mix withdrawals and one_shot_mint’s launch, kernel-checked, any list length (chunk 45, ./check.sh lovejoin-every)

Next session, in order

  1. ✅ The PR (2026-11-05): Lovejoin #165 into dev and #166 into main, 29573c5. The owner: the old pools hold 3 UTxOs and their users were told to leave, so the disclosure is fine. Lovejoin’s E2E job fails at installing Chromium on the runner’s Ubuntu 26.04, which the owner accepts (Lovejoin’s front end isn’t worked on).
  2. ✅ Publishing the proofs (2026-11-05, #362): the aliases on the public PlutusCoreBlaster fork (opaque-xor 68c5399, opaque-slice 96261cc), both pins on GitHub, and this branch into main, so the Seedelf work can branch from it.
  3. ✅ Then the v2 launch (the new 5 ₳ pool, fcb3f5ec…): the template theorems already hold for it.
  4. ✅ Then step 9, the wallet on v2 alone (1.8.0).

Every transaction (2026-11-04): the same properties, with every field a script doesn’t read left as any Data (Seedelf’s AnyTx.lean, and AnyTxCover’s rfls for every V3 spend).

What a Mix must pay, for every pool (2026-11-03, 68c5399): ./check.sh lovejoin-v2-outputs 24 ok, 66 theorems, the slowest module 61 s at 704 MB (MixTok4Outputs), the most memory 816 MB (MixTok4Datums). Each …OutSteps: honest halts after the general Mix’s own KAT count (11497, 19204 and 29007 for ADA at n = 2 to 4; 11798, 19505 and 29308 for tokens), and each of the eight changed outputs errors, long before the proofs are read.

What the claim can say: CLAIMS.md, with where it stops. This plan’s draft of 2026-11-03 limited it to Mixes and withdrawals of up to 4 boxes and to the scenarios’ layouts; chunk 45’s kernel-checked theorems lift both.

The wallet’s own code isn’t covered, but what a wrong Mix does is, for every pool (2026-11-03): V2/MixOutputs and V2/MixDatums hold at the test launch with two boxes alone, and the general Mix’s scenario fixes every box out as it should be, so it couldn’t say what a wrong one does. gen-lovejoin-mix-outputs.py takes them to mix_logic’s template, for the six families of the general Mix (ADA and token pools, n = 2 to 4), with the pool’s parameters, every box’s points and every proof field symbolic. It’s walk_outputs, so a Mix fails if:

v2’s general Mix (2026-11-03, 68c5399): ./check.sh lovejoin-v2-pools 42 ok: 82 theorems on mix_logic’s template, ADA pools at n = 2, 3 and 4 and token pools at n = 2, 3 and 4. Every pool parameter, box point and proof field is symbolic. The slowest module was 13 s at 740 MB (token pools at n = 4). Each family’s Steps: the KAT halts (11497, 19204 and 29007 steps for ADA at n = 2 to 4; 11798, 19505 and 29308 for tokens) with the spec true. Its first box’s or last box’s z changed errors with the spec false, and so does n = 2’s ADA KAT in a 5 ₳ pool.

Owner withdrawals of several boxes (2026-11-03, 68c5399): ./check.sh lovejoin-owner 35 ok, 23 theorems, the slowest module 9 s at 458 MB. The wallet withdraws one box a transaction (seedelf-wasm’s withdraw_in), but a withdrawal’s safety is about what anyone can build.

Everything on 68c5399 (2026-11-03): ./check.sh lovejoin 10 ok, ./check.sh lovejoin-v2 29 ok, 105 ✅: the classic pool’s 37 and v2’s 68. Every Steps line as before. V2/Mix3Steps: the KAT halts after 19204 steps, mixAccepts3 is true, and z11 or z33 changed errors (after 11486 and 18882 steps) with the spec false. The n = 3 theorems each solved in 0.02 s, at most 412 MB; (verbose: 1) is out.

Step 8’s Mix iff at n = 2, on 68c5399 (2026-11-03): MixFirst’ 3, MixSecond’s 3 and MixPasses’ 1 ✅, each solve 0.02 s and each module under 10 s at 366 MB, after the dependencies’ rebuild (93 s). V2/Steps unchanged on the new pin. The three tie-in lemmas elaborated. So a Mix of two moves boxes iff each box’s sigma-OR proof verifies against the boxes it pays, with every field of both proofs symbolic. (verbose: 1) is out.

V2/MixBranch, the diagnostic (2026-11-03): every uncompression (a constant input point, a constant output point, a symbolic t0) and z’s checks ✅; both equations ❌. The compiled UPLC (aiken uplc decode) shows why. DHTupleStatementPt is Data-encoded, so walk_outputs stores each box out’s point as bData(compress(uncompress a')), and each branch uncompresses it again. The script’s statement point is uncompress(compress(uncompress a')), the spec’s was uncompress a', and the solver can’t equate them over opaque builtins. branchHolds now takes the script’s form, and MixBranch is deleted.

MixFirst’s second build (2026-11-03): mix_needs_the_first_challenge ✅ in 0.02 s, so the literal zero32 closed that gap. V2/Steps’ all-zero run errors after 7869 steps, spec false. Both branch theorems ❌ Falsified in under a second, so branchHolds and the script’s branch still differ somewhere. Each equation has the Owner’s shape (Valid on v2), and the stdlib’s from_int (n % field_prime), scale, add and equal match the spec. What the Owner never had is a constant point: there a and b are symbolic, while every Mix point is the KAT’s. V2/MixBranch (a diagnostic, run by name) takes box in 1’s first branch condition by condition: a constant point, a symbolic one, z’s checks, each equation. MixSecond didn’t finish in its first minutes, likely its own copy of the gap; it waits on this.

MixFirst’s first build (2026-11-03): ❌ Falsified in 0.6 s (Optimization 1.55 s), every field 32 zero bytes. With the real builtins that fails, since a 32-byte string isn’t a G1 point (V2/Steps now runs it): the solver passed it by its choice of the opaque functions. The likely cause: the spec’s zero32 was ofHex "00…", a recursive parser, where the script has a literal constant, so the xor folds started from different terms. Every other ofHex term is the scenario’s, on both sides. zero32 is a literal now, and each half is three theorems, so a second gap would name its check. The 85 ✅ stand: a term the solver can’t reduce only gives it more freedom, which can make a false Falsified, never a false Valid.

Step 8’s third build (2026-11-03): 18 ok, 1 TIMEOUT, every ok module in seconds, at most 523 MB.

Step 8’s second build (2026-11-03): MixOutputs’ 4 and MixDatums’ 3 Valid, in 10 s and 7 s at most 356 MB. V2/Logic failed on import Lovejoin.Scripts: #import_uplc and #prep_uplc names are global, whatever the namespace, so v2’s mixLogic met the classic pool’s (and appliedAmount Seedelf’s policy one). Now mixLogicV2 and appliedBoxValue; no bare mixLogic is left in V2/.

Step 8’s first build (2026-11-03): four ok. The KAT’s Mix halts after 11497 steps, and with its first box a lovelace over errors after 4802. mix_refuses_a_challenge_not_32_bytes is Valid in 3 s, peaking at 340 MB. The step 4 run in the same session: ten ok, 37 ✅.

Step 4’s first build (2026-11-03) failed on a name. toData is a class method, IsData.toData, so open CardanoLedgerApi.IsData.Class (toData) can’t name it. Fixed by opening (IsData). The second build was ✅.

Where everything was (chunk 41’s plan has where upstream stands since):

Steps 2 and 3’s run (2026-11-03): eight ok, 36 ✅. mix_logic errors after 216 steps on minting, and on publish halts after 290 for its registration and errors after 290 for an unregistration. The Seedelf baseline was unchanged with #27’s alias pinned.

Step 1’s run (2026-11-03): seven ok, 30 ✅.

When a property comes back Falsified

The rule is in seedelf-verification’s README (When a Lovejoin property comes back Falsified). This branch merged into main with the owner’s word, as #362.

Targets

  1. The classic mainnet pool, first. It’s the live ADA pool, 10 ₳ a box.
    • Its bytes are Lovejoin c1239fb’s artifacts/mainnet/, from the 2026-09-26 deployment (Aiken v1.1.24), fully applied.
    • extract-lovejoin.sh checks each against the hash seedelf-core pins (lovejoin::Protocol::of, mainnet). It checks mix_box and mix_logic against the reference scripts seedelf-core holds as they sit on chain (references.rs), the bytes the wallet spends against.
    • All five matched on 2026-11-03: mix_box c145c10f…, mix_logic 0dad3046…, fee_contract a072c7e8…, one_shot_mint f5592689… (the NFT policy), reference_holder 288fea77….
  2. The token-pool templates later: Lovejoin 8131b1d, seedelf-core’s templates.rs.
    • They differ from the classic pool’s sources (2,226 lines across 12 files), so they’re a second target, not a re-run.
    • They’re templates, so the theorems take a launched pool’s parameters: the 5 ₳ pool’s, or the wallet’s own launch.
    • Commit 8131b1d was fetched into ../lovejoin on 2026-11-03 to read it. That checkout stays on its own branch.
  3. The preprod pool isn’t a target: its scripts are recompiled and hash differently.

Step 1 · Setup, reference_holder and mix_box ✅

Step 2 · mix_logic’s easy parts ✅

Step 3 · serialise_data behind an opaque alias ✅

Step 4 · mix_logic, Owner ✅

Step 5 · mix_logic, Mix ⬜

Step 6 · fee_contract and one_shot_mint ✅ (on their templates, step 8)

Step 7 · The token-pool templates ✅ (on v2, step 8)

Step 8 · v2: the templates with xor32’s fix ✅

Step 9 · The wallet on v2 alone ✅ (1.8.0, chunk 44)

The owner, 2026-11-03: “if we did fix this and its formally verified then we could update lovejoin to only use this new contract since I think we almost already cleared out the old pools”.

The owner’s decisions

What its PRs did