Skip to content

feat(joust): joust playground on Yaci DevKit, Connect wallet, settlement and the journal (ADR-0024 M3) - #179

Open
satran004 wants to merge 12 commits into
feat/playground-m2from
feat/playground-m3
Open

satran004 wants to merge 12 commits into
feat/playground-m2from
feat/playground-m3

Conversation

@satran004

Copy link
Copy Markdown
Member

ADR-0024 M3: joust playground on Yaci DevKit, with test identities, Connect wallet (CIP-30), settlement and the per-user journal. Stacked on #178 (M2); the base is feat/playground-m2.

What it adds

  • joust playground --mode devkit [--network <name>] attaches to the network as joust dev does.
    • I4: only a network with an admin API and network id 0 is accepted. Mainnet is impossible, and public testnets are refused in v1 (Q3).
    • It works in npm and Gradle projects, using M2's build source.
  • joust dev serves the playground at /playground/, bound to its network, and never shadows the project's page at /.
    • The playground's routes keep D8's rules under that prefix: token, Host/Origin checks, no CORS, /playground/api/ same-origin only.
    • joust dev logs the path of a private launcher file, not the token.
  • Chain adapter (js/joust/src/playground/devkit.js):
    • chain/read is answered from Yaci Store at one stable chain point (re-read if the tip moves), and now comes from the network clock.
    • Settlement is reported from observed tips: included, then final after settlementSlots (10). A transaction past validTo + 10 is expired; an included one that disappears is rolled back.
    • A node refusal is shown at stage ledger and is not discarded, as the protocol requires.
  • The page shows submitted, included and final separately, and a confirmation timeout fails at stage confirmation (I7).
  • Per-user journal (journal.js, Q6):
    • It lives in ~/.joust/state, overridable with JOUST_STATE_DIR, keyed by project and chain: network id, magic and genesis startTime.
    • The body and the high-water mark are written before the page can sign.
    • A new session restores what is left. A reset DevKit starts empty, and the old chain's journal is reported once and then removed.
    • Directories are 0700 and files 0600, writes are atomic, and a lock allows one playground per project and chain.
  • Identities:
    • DevKit test identities are devWallets over the public DEVKIT_MNEMONIC by index, labelled test-only and topped up by the server from the faucet. Their keys stay in the page.
    • Connect wallet goes through @cardano-foundation/cardano-connect-with-wallet-core 0.2.12, with NetworkType.TESTNET, Yano listed first plus any other injected CIP-30 object. A wallet on another network is refused.
    • The payer is the wallet's change address, and the pre-sign check requires change to come back to exactly that address.
    • Every signature, test identity or wallet, goes through feat(joust): joust playground, offline (ADR-0024 M1) #174's full pre-sign check (verifyHostResult plus verifyPrepared/verifyPublication) and the review/approve step.
  • CI:
    • The engines job runs the fake-chain suite.
    • A new playground-devkit job starts DevKit and runs the e2e suite in Chromium, with DevKit and Chromium required and no skips.
  • Docs: a "DevKit mode" section in js/joust/README.md.

Tests (local, real Yaci DevKit)

Suite Result
playground-devkit.test.js + cli.test.js 29/29
playground-devkit-e2e.test.js (DevKit, Chromium) 5/5
playground-devkit-gradle.test.js (a Gradle Counter over the JVM host on DevKit) 1/1
playground.test.js 22/22
playground-gradle.test.js 19/19
state-client 664/664

playground-devkit-e2e.test.js covers:

  • create, increment, and Bob refused;
  • Connect wallet, then increment;
  • a wrong-network wallet refused;
  • I1;
  • joust dev's /playground/.

The fake-chain suite covers:

  • I4 configs;
  • I7 with inclusion held back;
  • a node refusal and a confirmation timeout at their stages;
  • journal keying, reset and pruning.

Points for review

  • Ogmios is refused in DevKit mode. Settlement needs inclusion slots by transaction hash, which Yaci Store serves and the Ogmios provider does not.
  • A final transaction that is later rolled back is not handled beyond the host's own refusal.
  • There is one DevKit session per server (journal lock). Faucet top-ups are capped at 10,000 ADA per request.
  • No time travel or ledger reset on DevKit: the attack toggle, advance and reset refuse with code devkit.
  • A body handed to a CIP-30 wallet is never discarded, even if the wallet declines; only its expiry frees the inputs.
  • The CF connector moved to the dependencies of @julclang/joust, since the page is built from them.
  • playground-devkit-gradle.test.js runs locally only: no CI job has both a staged Maven repository and DevKit.

🤖 Generated with Claude Code

satran004 and others added 4 commits November 24, 2026 08:54
…ent and the journal (ADR-0024 M3)

- `joust playground --mode devkit [--network <name>]` attaches as joust dev does; only a DevKit is
  accepted (an admin API, network id 0, Yaci Store's API): mainnet never, public testnets not in v1 (I4).
- `joust dev` on a DevKit serves the playground at /playground/ beside the project's page: the same
  handler with its own token, Host/Origin checks and no CORS (server.js is now a mountable handler);
  its page is built when first opened.
- DevKit sessions (devkit.js): the same npm dev host; chain/read from Yaci Store at one chain point
  (script reads as CCL's PlutusScript, unknown stake registration unsupported, map history reads);
  `now` from the network clock; submission through Yaci Store; settlement from observed tips:
  confirmed (shallow) at the inclusion slot, final past settlementSlots (10), expired past
  validTo + settlementSlots, rolled back when an included tx leaves the chain. A node refusal is
  stage ledger and never discarded (handed out: only expiry releases its inputs).
- The journal (journal.js, Q6, ADR-0022 D8): ~/.joust/state (JOUST_STATE_DIR), keyed by project and
  chain (network id, magic, genesis startTime); a body and the high-water mark are persisted before
  the page can sign; a new session restores what is left (bodies that landed meanwhile as shallow);
  lost history waits for the tip to pass the high-water mark; a reset DevKit starts empty and the
  old chain's journal is reported once and removed; 0700/0600, atomic writes, one playground per
  project and chain (a lock).
- The page: DevKit test identities over the public DevKit mnemonic (labelled test-only, faucet
  top-ups by the server), Connect wallet through @cardano-foundation/cardano-connect-with-wallet-core
  0.2.12 (Yano first; a wallet on another network refused), submitted / included / final shown
  apart with a confirmation timeout (I7). The connector moves to dependencies (the page is built
  from the installed package).
- Tests: playground-devkit.test.js (a chain the test holds back or refuses: I7, refusal, expiry,
  discard, restart/restore, lost history, journal keying/pruning/locking, I4, the mounted handler's
  surface) in the engines job; playground-devkit-e2e.test.js on a real DevKit in Chromium (a test
  identity, an injected CIP-30 wallet, a wrong-network wallet, joust dev's /playground/) in a new
  playground-devkit CI job that requires DevKit and Chromium.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd-m3

Conflicts and how they were resolved:
- server.js: the mountable handler (M3) keeps M1's fixes (serial session lifecycle with the `closed`
  flag, own-property routes and assets, the `registered` route) and takes M2's build `source`; DevKit
  sessions get it too. The handler's close() sets `closed`.
- index.js: DevKit mode works for npm and Gradle projects: the network is checked (I4) and attached
  before the Gradle or npm build, gradlePlayground passes mode and the DevKit options; the URL goes
  out through M1's `announce` in every mode. The launcher file is now launcherFile(), shared with
  joust dev.
- main.js: imports merged; DevKit settlement after M1's `report.submitted`. A body handed to a CIP-30
  wallet is never discarded, even when the wallet declines (it was handed out: only its expiry
  releases its inputs); an identity's (in-page keys) still is.
- joust.js usage: both texts.

Follow-ups in this merge:
- devkit.js opens M2's source (npmSource / gradleSource): the snapshot, digest, entries, launch and
  staleness come from it, so a Gradle project's JVM host runs on DevKit; `registered()` answers
  true, false or 'unknown' (Yaci Store cannot tell) for the publication checks; `served` only when
  the host says so; hostPid.
- joust dev no longer prints the playground's token: it names a private launcher file (D8, as M1's
  announce), and the e2e test checks that no log line carries the token.
- The page keeps the chosen wallet when it redraws the wallet list (a refresh had reset the choice).
- playground-devkit-gradle.test.js: a Gradle Counter over the JVM host on a real DevKit, checked with
  check.js and settled from the chain (local only: no CI job has a staged repository and DevKit).
- The native CLI's help names --mode devkit; the README describes Gradle on DevKit, the CIP-30
  change address as the payer, and joust dev's launcher file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd-m3

Conflicts:
- server.js: round 2's cross-site exception (a top-level document navigation for static GETs, the
  file:// launcher) now reads the path under the handler's base, so /playground/api/ stays
  same-origin only when mounted in joust dev, as /api/ does on the playground's own server; the
  mount's redirect comes after that check.
- index.js: round 2's writeLauncher (with `file`, the ten-minute lifetime) is kept; M3's launcherFile
  is gone and joust dev's launcher uses writeLauncher (it lives until joust dev stops).

The page: round 2 releases the reservation after a failed submit. On DevKit a body the node refused
was handed out, so the page marks it submitted and never discards it (ADR-0022 D8: its expiry
releases its inputs; the server refuses that discard too); a failure before the node saw the body
is still released. A body a CIP-30 wallet declined stays undiscarded as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the chain, a verified chain, a safe journal

Codex (11 P1, 1 P2), design (D-1 to D-4) and security (M3-S1, M3-S2), each with a regression test:
- P1-1: what the page is shown comes from the journal and the chain (inclusion slots, tips), never
  the host's reply; the host is told each event and a reply that disagrees fences it (it prepares
  nothing more; the page says so).
- P1-2 / D-1 / D-2 / M3-S1: the chain API's genesis (magic, start) must be the admin API's before
  anything is journaled, funded or submitted (and before joust playground --mode devkit starts);
  the clock is the verified identity's; the public networks' magics (mainnet, 1, 2, 4) are refused;
  another genesis or a tip that goes back ends the session ("the DevKit was reset").
- P1-3: before a CIP-30 wallet sees a body its handoff is journaled (never discarded after); discard,
  handoff and submit (its validFrom wait included) run one at a time per reservation.
- P1-4: a body without a valid, new reservation is never handed out (and fences the host); a restore
  must give one distinct id per body, or the journal stays as it was.
- P1-5 / P1-6: a settlement pass reads every inclusion between two equal chain points (else reads
  again); inclusions are told first, each at its own slot, then depth and expiry at the tip, each
  event on its own (one failure skips nothing).
- P1-7: the submission is recorded before it is sent; its answer never overrides the chain's state;
  no answer (a dropped connection) is followed on the chain, a 4xx is the node's refusal.
- P1-8: the admin faucet only (no payment the server signs), its refusal shown; below 100 ADA only,
  enforced by the server; one top-up per address at a time.
- P1-9: the journal is validated whole (version, each body's hash and bounds): anything invalid is
  lost history behind the high-water mark; invalid with no mark is refused.
- P1-10: the lock is a hard link of a fully written token; a stale one is renamed aside and removed
  only if still the dead token; every write checks the token (one writer, always).
- P1-11: pruning runs one at a time per DevKit, after the served genesis is checked again, keeps
  chains a live playground owns, and persists the notice before deleting.
- P2: before each CIP-30 signature the wallet's network, change address and UTxOs are read again;
  every input it pays from must be one it holds and DevKit shows unspent.
- D-3: ttlSlots at most the stability window 3k/f (admin API; else 300). D-4: a tab whose DevKit
  session another tab took is told so.
- M3-S2: the state and chains directories must be this user's (made 0700 when permissive).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Author reply: round r1 · head 077f6c3

Review round 1 is addressed. Codex and the design reviewer asked for changes; the security reviewer approved, with a P2 and P3s. Every fix has a regression test.

Finding Change
Codex P1: the host could declare an unseen transaction final The page's status comes only from the journal and the chain (inclusion slots, tips). A host reply that disagrees with the chain fences the host: prepare and publish are refused with fenced, and a new session restores into a fresh host
Codex P1 / design D-1, D-2 / security M3-S1: the provider was not tied to the DevKit identity Yaci Store's /genesis (magic, system_start) must equal the admin API's identity before anything is journaled, funded or submitted. The clock comes from that identity. Magics 764824073, 1, 2 and 4 are refused. A changed genesis, or a tip going backwards, ends the session ("the DevKit was reset")
Codex P1: a body handed to a wallet could be discarded A handoff route journals the body before CIP-30 signTx; after that, a discard is refused. Discard, handoff and submit run one at a time per reservation
Codex P1: a body could reach the page without a journal entry Every body needs a valid, new reservation, or it is refused and the host fenced. A restore validates its ids, and the old journal is kept on a mismatch
Codex P1: settling one body could block or expire another Inclusions are read between two identical chain points and reported oldest first, each at its own slot; then rollbacks; then depth and expiry. Each report stands on its own
Codex P1: a late submit answer overwrote the chain's state Submission is journaled before sending, and its answer never overrides the chain. A lost answer is followed on the chain
Codex P1: a dry faucet made the server sign with derived keys The admin faucet only; the genesis fallback is removed. The 100 ADA threshold is enforced on the server, and concurrent top-ups are coalesced
Codex P1: recovery dropped bad journal entries The journal is validated as a whole; anything invalid counts as lost history behind the high-water mark
Codex P1 / security M3-S2: the lock could admit two writers The lock is a hard-linked token file. A stale lock is renamed aside and checked before deletion, and every write re-checks the token. Six-process races are tested
Codex P1: pruning could delete a live chain's journal Pruning runs under a per-DevKit lock, re-checks the served genesis, keeps live owners' chains, and writes its notice before deleting
Codex P2: a wallet following another chain reached the signing prompt Before each signature the wallet's network, change address and UTxOs are re-read; the payer inputs must be the wallet's and unspent on DevKit (e2e test)
Security M3-S2: state directories state and chains must belong to this user. A permissive one of ours is chmodded to 0700; anyone else's is refused
Design D-3 ttlSlots is capped at the stability window 3k/f
Design D-4 A replaced tab says "another tab took this DevKit session"

Local results: the fake-chain suite plus CLI 40/40, DevKit e2e 6/6, Gradle on DevKit 1/1, playground 22/22, Gradle 19/19, state-client 664/664.

Follow-up issue: joust dev's /dev/topup answers any origin (M3-S3). That predates this PR.

satran004 and others added 3 commits November 24, 2026 10:27
…eat/playground-m3

- server.js: the handler mints single-use pairing codes and serves POST /pair under its base, so
  joust dev's /playground/pair pairs a page as /pair does on the playground's own server (S8);
  pairingPath() gives the base with a fresh code; startPlayground's pairingUrl() builds on it.
- dev.js: the launcher file holds a single-use pairing link (removed once spent), never the token;
  no log line or file carries the token.
- index.js: announce() starts the server for DevKit and Gradle modes as for offline.
- main.js: pairing is relative ('pair'), so it works under /playground/; a lost submit answer on
  DevKit is followed on the chain (the server journaled the submission first), offline it is
  reconciled from the session's history as round 3 does; the history keeps settlement states.
- e2e: the pages pair; joust dev's launcher holds a pairing code, spent once, and then removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…no lock takeover, handouts bounded

Codex r2 (7 P1, 2 P2) and the design's P3s, each with a regression test:
- A rewind across settled history: the journal keeps the chain point where bodies left it (final or
  expired); a session of the same genesis that finds the chain below it builds nothing until the
  tip passes the high-water mark (tested through the next session's first prepare).
- The lock is never taken over: a lock whose owner is gone is refused with its path and the command
  to remove it (as git's index.lock); pruning keeps any chain with a lock on it.
- Two journal entries under one reservation id are lost history; chain observations are keyed by
  the transaction hash queried.
- Before handout: the body's window is the one asked (validTo in (now, now + ttlSlots], validFrom
  below validTo), it is not a journaled body again, and it spends no input or collateral a journaled
  body spends; otherwise it is refused before any journal write and the host fenced. Restored
  duplicates keep their handoff and submission flags.
- A discard takes a tip from the chain (never the clock); without one the body is kept and the
  discard can be retried.
- A submit waiting for its window is cancelled by a reset or close; right before sending, the
  session, the served genesis, the reservation and its window are checked again.
- P2: a 4xx for a body the chain already holds answers its inclusion (the refusal a transport
  detail), through the browser path too; the CIP-30 refresh requires every input and collateral to
  resolve before classifying it, and a missing one fails at stage wallet with no signTx (Chromium,
  over the controlled chain).
- D-5: an inclusion is told to the host before the indexes are waited for (the page's state after,
  once the pass is done). D-6: the wallet's UTxOs are read again for a few seconds before an input
  is refused; a changed network or change address says to connect the wallet again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…round-m3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	js/joust/playground/main.js
@satran004

Copy link
Copy Markdown
Member Author

Author reply: round r2 · head ef7015e

Codex's round-2 findings, plus the design reviewer's round-2 P3s. The design and security reviewers approved round 2. This branch also merges #178 and #174 through their round 4. One-time pairing now covers joust dev's /playground/: codes are minted by the handler, /pair is served under the base, and no #token= appears anywhere (security S8).

Finding Change
P1: a restart after a rewind could release live inputs The journal records the chain point where settled history left it. A same-genesis tip below that point fences builds (rewound) until the tip passes the high-water mark; tested through the next session's first prepare
P1: stale-lock recovery could displace a live writer No automatic takeover (git-style): a lock whose owner is gone is refused with its path and the rm hint. Pruning keeps any chain with a lock
P1: duplicate journal ids Counted as lost history; chain observations are keyed by the hash queried
P1: a fresh id could claim inputs already handed to a wallet Before any journal write, refused and the host fenced if the window is outside (now, now + ttl] or empty, if the body is already journaled, or if it overlaps a journaled body's inputs or collateral
P1: discard expired other bodies by wall-clock time Discard needs a chain tip first; without one the entry is kept and the discard can be retried
P1: a waiting submit could send after a reset A reset or close cancels the wait. Liveness, the served genesis, the reservation and its window are re-checked right before sending
P1: an untrusted validity bound could poison recovery Covered by the handout checks above (trusted now and limits)
P2: a late refusal won in the browser A 4xx for a body already on the chain shows its inclusion or finality; tested in Chromium
P2: an unresolved input skipped the wallet check Every spending and collateral reference must resolve first; otherwise the call fails at stage wallet and signTx is never called
Design D-5 The host learns of an inclusion before the indexes are waited for
Design D-6 The wallet's UTxOs are read again for about 4 s before refusing; a changed change address says "connect the wallet again"

Local results: playground plus fake-chain DevKit 58/58, DevKit e2e 6/6, Gradle 33/33, Gradle on DevKit 1/1, state-client 668/668.

This is round 3. From round 4, P2s that the security reviewer judges not security-relevant become follow-up issues.

…and rewinds persisted, one POST per check

Codex r3 (3 P1, 4 P2), each with a regression test:
- A restore that drops settled history (bodies that settled while no playground ran, or history
  lost with the journal) saves its removal point in the same write as the replacement entries.
- A rewind bound is persisted when it is found (at start below the removal point, or a tip that
  goes back while running), loaded on every start, and cleared only after a tip strictly above it.
- One provider attempt per session check: Yaci Store's adapter no longer retries; the session's
  own BadInputsUTxO retry waits cancellably and checks the session, the served genesis, the
  reservation and its window again before every POST.
- An input a journaled body spends is reconciled against the chain before blaming the host: if the
  chain shows that body expired it is settled there and the new body goes out; otherwise the new one
  is refused, retryably ('pending'), and the host is not fenced.
- A failed genesis read before a POST is a retryable chainUnavailable; only a verified mismatch
  resets the session.
- The page's 'final' of an inclusion found already past its margin waits for that body's indexing
  wait (the host is told at once); a restore's newly found finals too.
- The wallet's network and change address are checked on every read, the retries' included.
- A reset session reports the reset before any other refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Author reply: round r3 · head 07acf43

Codex's round-3 findings. Every fix has a regression test.

Finding Change
P1: startup recovery dropped bodies without recording their removal slot journal.replace(entries, slot) saves the removal point in the same write as the replacement entries, after downtime and after journal loss
P1: a reload cleared a detected rewind The rewind bound is saved when found, loaded at every session start, and cleared only after a tip strictly above it
P1: provider retries could submit after close or reset One POST per adapter call. The session's retry waits in a pause that a reset or close cancels. Liveness, genesis, reservation and window are re-checked before every POST
P2: watcher lag could fence a healthy host On an overlap the journaled body is checked against the chain first. An expired one is settled; otherwise the new body is refused as retryable pending
P2: a transient genesis read failure ended the session It is a retryable chainUnavailable; only a verified mismatch ends the session
P2: "final" before the indexes were ready The host is told at once; the page sees "final" only after that body's indexing wait
P2: wallet retries skipped the identity checks The network and change address are checked on every read; tested with a rotated change address

Local results: the fake-chain suite plus CLI 55/55, DevKit e2e 6/6, Gradle on DevKit 1/1, playground 23/23, Gradle 35/35, state-client 669/669.

This is round 4: from here, Codex P2s that are not security-relevant become follow-up issues.

satran004 added a commit that referenced this pull request Nov 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
satran004 and others added 3 commits November 24, 2026 11:40
…ies) into feat/playground-m3

- main.js: imports merged; the new session's contract refresh (round final pass) and the DevKit
  session notes both kept; the banner's fill() with the DevKit banner beside it.
- DevKit test identities follow the final pass too: their address is their payment key's
  enterprise address (where the host pays and spends their key hash), and the faucet tops that
  address up; a CIP-30 wallet keeps its change address as the payer.
- playground.test.js: the escrow payout walkthrough and the D3/I10/I4 tests both kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wind fence, handouts checked and recorded together

Codex r4 (5 P1), simplified to one fence, each with a regression test:
- One persisted fence (journal.fencedUntil = the high-water mark): any stable observation (the
  watcher's or a handout's) below an earlier stable tip or below the removal point is a rewind.
  Builds are blocked at once; the fence is written, and taken in memory only once the write
  succeeded (every journal change now writes first); a failed write is retried every pass, and a
  watcher-found rewind ends the session only once its fence holds (close tries once more).
- Clearing the fence needs a tip strictly above it and moves the removal point to that tip in the
  same write, so a second rewind below the cleared bound is found again.
- Lost history completes its restore only on the stable observation it uses being strictly above
  the high-water mark; below it again, it waits.
- The watcher compares each observation with the removal point as well (a rewind below an expiry a
  handout observed).
- A handout reconciles overlapping bodies first (its awaits), then checks the session's
  eligibility, the body, its reservation and every input against the journal as it is now and
  records it, with no await in between: two concurrent handouts of a shared input cannot both go out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t/playground-m3

Conflict-free.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Author reply: round r4 · head fe8e6b9

Codex's round-4 findings. Every fix has its own test.

Finding Change
P1: clearing a rewind fence lost the point needed to detect the next rewind Simplified to one persisted fence (fencedUntil = the high-water mark). Clearing needs a tip strictly above it and moves removedAt to that tip in the same write. Tested: a second rewind after a cleared fence
P1: lost-journal recovery could commit below the high-water mark It completes only on a stable observation strictly above the mark, and goes back to waiting if a later read falls below
P1: concurrent handouts could reserve the same input After its awaited overlap reconciliation, a handout checks eligibility, body hash, reservation and every input and collateral input against the current journal, then records with no await in between. Tested: two concurrent overlapping handouts give one out and one pending
P1: a failed fence write made a retry skip persistence Every journal change is written first and taken into memory only after the write succeeds. Builds stay blocked and the write is retried each pass. Tested with a failing write
P1: the watcher could miss a rewind below a handout-observed expiry Every stable observation, from the watcher or a handout, goes through one check: below an earlier stable tip, or below removedAt, is a rewind

The branch also merges #178 through 718db28d. DevKit test identities use their payment key's enterprise address (CIP-30 wallets keep their change address).

Local results: fake-chain plus CLI 59/59, DevKit e2e 6/6, Gradle on DevKit 1/1, playground 26/26, Gradle 45/45, state-client 669/669.

This is round 5: from now on only P0/P1 and security-relevant P2s block; other P2s become follow-up issues.

satran004 added a commit that referenced this pull request Nov 24, 2026
…feat/playground-m4

Conflicts:
- devkit.js: M3's re-checked problemOf, with M4's keyed windowProblem in it; the
  session status carries M4's keyedLimits beside M3's fencedUntil.
- main.js: M3's enterprise-address identities (with M4's labelled identities for
  replay; the separate enterprise-holdings line is gone, since the identity's address
  now is its enterprise address), fill and confirmedNotes in M4's approval and signing
  path, both session-start steps, the union of imports.
The keyed operation records stay in the chain's journal beside M3's reservations,
under the same lock and written before the call goes on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rt, every chain point checked, fences kept on close

Codex r5 (4 P1 kept, 1 declined), each with a regression test:
- A start whose tip checks are all inconclusive is refused (chainMoving), never admitted unchecked.
- The restore's stable chain point and every answered host reverse read's tip go through the one
  rewind check; a fence it finds blocks the handout of the body being prepared, until a stable tip
  passes it.
- A close whose fence still cannot be written keeps the journal's lock (in this process the journal
  stays locked; after a restart it is a stale lock to remove by hand) and leaves a marker with the
  bound when it can, which the next open writes as the fence.
- An expiry found during a handout removes the entry only if it is still the body observed (same
  reservation, hash, body, prepared); otherwise the overlaps are reconciled again.
- Declined (the branch is unreleased, no journal carries round 3's field): importing rewoundUntil.
  Instead a journal of another version or with any field this joust does not know is refused
  (journalUnknown), never opened with the unknown part ignored.
- The P2 follow-up, as it is small: a session that started fenced is not ended by the chain
  catching up below the removal point; only a tip going back within the session ends it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Author reply: round r5 · head 4da2dac

Codex's round-5 findings. Every fix has a test.

Finding Change
P1: startup admitted builds when every tip check was inconclusive The session refuses to start with chainMoving; builds are never admitted without a stable tip
P1: restore ignored a rewind it had observed Restore's stable point and every answered host reverse read go through the one rewind check. A fence found during a prepare blocks that body's handout
P1: close could drop a fence that still needed writing If the fence can't be written, close keeps the journal lock and leaves a fence-pending marker, which the next open writes as the fence. The journal is never reopened unfenced
P1: an expiry check could remove a different body under a reused id Before removal, the entry must still be the same body (reservation, hash, body, state); otherwise the overlaps are reconciled again
P1: the old journal format's fence Declined. That format exists only in this unreleased branch. A journal of another version, or with any unknown field, is now refused (journalUnknown) rather than opened with the unknown part ignored

Local results: fake-chain plus CLI 65/65, DevKit e2e 6/6, Gradle on DevKit 1/1, playground 26/26, Gradle 45/45, state-client 669/669.

The final pass (Codex, Fable, Opus) runs on this head. From here on, rewind corner cases that need a same-genesis rewind, which a single-node DevKit does not produce (a reset changes the genesis and is handled), become follow-up issues unless they fail open on a realistic path.

This branch has not been deployed

No deployments
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