Skip to content

feat(canton-create): keep the ledger across a Splice bump and add a reset command - #269

Merged
fernandomg merged 11 commits into
mainfrom
feat/localnet-reset-after-splice-bump
Nov 12, 2026
Merged

fernandomg merged 11 commits into
mainfrom
feat/localnet-reset-after-splice-bump

Conversation

@fernandomg

@fernandomg fernandomg commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

No related issue.

Upgraded in place to a new Splice release, an existing LocalNet keeps the Amulet its DSO voted in last, while build-dar built the contract against the release's newest one, so the amulet example broke on that ledger. #260's bump to Splice 0.9.4 is such a bump.

build-dar now builds against the Amulet the LocalNet runs, so up keeps working on the old ledger. It then ends with a warning that links splice-upgrade.md, which moves the ledger to the new Amulet with one DSO vote. A new reset starts over on a fresh ledger instead.

Changes

  • build-dar asks the LocalNet's Scan which Amulet it runs and builds against that one; with no LocalNet answering, it builds on the release's newest DARs, as before;
  • up builds the DAR once Scan answers, no longer before the LocalNet starts;
  • after a Splice bump over a ledger still in Docker, up ends with a warning that links splice-upgrade.md;
  • new splice-upgrade.md: moves the ledger to the new release's Amulet with one DSO vote;
  • the amulet example exercises AmuletRules by package name, so the Tap and grants keep working once Splice unvets the old Amulet;
  • new reset: stops the dApp, the app's own services and the Wallet Gateway, drops the LocalNet with its volumes, and deletes the gateway's stores;
  • the dev-stack menu gains "Stack reset", which asks y/N first.

Acceptance criteria

  • After a Splice bump, up starts on the old ledger, deploys the contract built against the Amulet that ledger runs, and ends with a warning that links splice-upgrade.md;
  • following splice-upgrade.md moves the ledger to the new Amulet with one vote, and the amulet example keeps working after Splice unvets the old one;
  • with no ledger left, up starts on the new Splice with no warning;
  • reset drops the ledger and the Wallet Gateway's stores, without a prompt from the command line and after y/N from the menu;
  • reset and the warning apply to every app.

Test plan

Automated tests

  1. Run node --test "canton-create/scaffold/*/scripts/*.test.mjs" and pnpm -C example-dapps/amulet-vesting test;
  2. Expect 34 and 225 passing tests.

Manual verification

  1. Run pnpm dev:amulet-vesting up once, then pnpm dev:amulet-vesting down;
  2. In .canton-localnet/canton-barebones.config.json, set splice.tag to 0.9.4, which up takes for a Splice bump;
  3. Run pnpm dev:amulet-vesting up: expect the config back on the pinned 0.8.1, the stack up on the same ledger, and a closing warning that links splice-upgrade.md;
  4. Run pnpm dev:amulet-vesting reset, then pnpm dev:amulet-vesting up;
  5. Expect the stack up on a fresh ledger, with no warning.

A real bump ran end to end with #260's changes, on a ledger born on Splice 0.8.1: up kept the ledger and redeployed the same DAR, the guide's one vote moved it to the new Amulet, and the vesting flow passed before the vote, after it, and after Splice unvetted the old Amulet.

Breaking changes

None.

Checklist

  • Self-reviewed my own diff
  • Tests added or updated
  • Docs updated (if applicable)
  • No unrelated changes bundled in

Screenshots

An existing LocalNet once #260 moves it to Splice 0.9.4, recorded from this branch's scripts with Docker, canton-barebones, Scan and the services faked, so waits take seconds.

up keeps the old ledger and ends with a warning that links splice-upgrade.md
up-after-splice-bump
reset, with no prompt
reset
The menu asks first; n drops nothing
menu-reset
After reset, up starts on a fresh ledger, with no warning
up-after-reset

- down stops the dApp, the app's own services and the Wallet Gateway through stop_services;
- what down does is unchanged; the script header already says Docker itself is left running.
…the gateway's stores

- reset stops the services, then drops the LocalNet with its volumes;
- it deletes .wallet-gateway/, whose parties and sessions only the dropped ledger had;
- the usage text, the docs and the token PROVENANCE recipe name it.
- the menu gains Stack reset;
- it asks y/N before dropping anything.
Copilot AI balanced review requested due to automatic review settings November 5, 2026 18:53
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
components.canton-dappbooster Ready Ready Preview Nov 12, 2026 5:26pm UTC
demo.canton-dappbooster Ready Ready Preview Nov 12, 2026 5:26pm UTC

Request Review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

🟡 Changes recommended

The change still has unresolved review findings: a user-facing script message uses confusing internal subcommand names, and the localnet config now hard-fails with an unhandled Docker/daemon error that produces a stack trace instead of a clear actionable message.

2 open issues
What changed in this PR

This pull request updates the canton-create LocalNet workflow to prevent broken starts after a pinned Splice bump when an older ledger is still present in Docker, and adds a dedicated reset command (plus menu entry) to fully drop the ledger and Wallet Gateway state. Documentation and tests are updated to reflect the new workflow.

Changes:

  • Make up stop early after a Splice tag change if old LocalNet volumes still exist, and direct users to reset.
  • Add reset to stop relevant services, drop the LocalNet (including volumes), and delete Wallet Gateway stores; add an interactive “Stack reset” menu option with confirmation.
  • Update docs and tests around the new Splice-bump guard and reset flow.

This pull request requires changes.

Unresolved review comments:

  • (moderate, votes: 2) localnet-config.mjs: Docker volume probing during config prep should handle “Docker not installed/daemon unavailable” more gracefully (avoid stack traces; emit an actionable message).
  • (moderate, votes: 1) dev-stack.sh: reset is destructive but isn’t meaningfully exercised by automated tests beyond argument parsing; add a small test that fakes docker/canton-barebones and covers the y/N confirmation path.
  • (nit, votes: 2) dev-stack.sh: error messaging should prefer the user-facing pnpm stack ... commands rather than internal subcommand names (up/reset) to avoid confusion.
File Summary
example-dapps/​token-vesting/​vendor/​PROVENANCE.md Update LocalNet reset/recovery instructions to use pnpm stack reset.
example-dapps/​amulet-vesting/​daml/​README.md Document the Splice-bump refusal behavior and updated reset guidance.
CONTRIBUTING.md Document the new reset command in local dev workflows.
CLAUDE.md Record the operational rule: Splice bump + old ledger requires reset.
canton-create/​scaffold/​localnet/​scripts/​localnet-config.test.mjs Add coverage for Splice-bump detection and refusal when old volumes exist.
canton-create/​scaffold/​localnet/​scripts/​localnet-config.mjs Implement Splice-move detection and Docker volume check; return a dedicated status for up to handle.
canton-create/​scaffold/​localnet/​scripts/​dev-stack.test.mjs Extend argument parsing tests to include the new reset action.
canton-create/​scaffold/​localnet/​scripts/​dev-stack.sh Add reset, wire up behavior to the new exit status, and add menu option with confirmation.
canton-create/​scaffold/​localnet/​README.md Explain pnpm stack reset and the new “stop after Splice bump” behavior.
architecture.md Update repo-level command documentation to include reset and the new guard behavior.

Review effort: Balanced

@fernandomg fernandomg moved this from Backlog to In review in Canton - dAppBooster (#390) Nov 6, 2026
@fernandomg fernandomg changed the title feat(canton-create): stop up after a Splice bump and add a reset command feat(canton-create): stop up after a Splice bump and add a reset command Nov 6, 2026
- after a Splice bump, the LocalNet runs the new release on the old ledger, upgraded in place;
- that ledger keeps the Amulet its DSO voted in last, but build-dar took the release's newest;
- so up stopped at deploy-dar (KNOWN_PACKAGE_VERSION), and a new version failed at prepare;
- build-dar now asks the LocalNet's Scan for the Amulet it runs and builds against that one;
- with no LocalNet answering, it still builds on the release's newest DARs;
- up builds once Scan answers, no longer before the LocalNet starts;
- when the Splice tag moves while the old ledger is still in Docker, up ends with a warning;
- the warning links splice-upgrade.md, which moves the ledger to the new Amulet with one DSO vote.
- the Tap and the Amulet split before a grant named AmuletRules by the package id Scan returns;
- that id pins the Amulet package the contract was created on;
- a DSO vote on a new Amulet re-creates AmuletRules, but still on the old package;
- within 24 h Splice unvets the old package, and the participant then refuses both commands;
- so moving a LocalNet to a new Amulet took a second vote to keep the Tap and grants working;
- by package name, the participant runs the Amulet it vets and upgrades the contract on use;
- the disclosed contract keeps Scan's template id, the one its blob was created with;
- tested live on a fresh ledger, and in place before the vote, after it and after the unvet.
@fernandomg
fernandomg force-pushed the feat/localnet-reset-after-splice-bump branch from 780ca0c to 812bcb2 Compare November 10, 2026 18:39
@fernandomg fernandomg changed the title feat(canton-create): stop up after a Splice bump and add a reset command feat(canton-create): keep the ledger across a Splice bump and add a reset command Nov 10, 2026

@gabitoesmiapodo gabitoesmiapodo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I discarded most things from an "adversarial review", but this could be worth addressing before merge, or maybe an issue created for it.

  • The upgrade warning prints once, at the end of up. If any step fails first, it never shows again. It also never shows up in the --json output.

- localnet-config.mjs settles the marker in the LocalNet dir before it moves the config
- Docker reporting no volumes drops it; Docker not answering keeps it
- only a move to a newer Splice tag marks; an older one does not
- dev-stack.sh reads the marker, not exit status 3, so every error of an up carries the warning
- the first up that finishes shows it and removes the marker; reset removes it too
- the --json error and done events carry it in warnings
- the warning names the contract only when the project has one
- warn records each warning, and the error and done events list them in the order given
- the upgrade warning stays last, where the human log prints it
- without warnings the list stays absent, so the stream is unchanged
- an EXIT trap reports the stop the way die does, naming the exit status when bash gives one
- the run still ends with its own status, a signal included; die and done disarm the trap
- bash 3.2 gives an unbound variable status 0 in the trap, so the trap exits 1 then
- json_string escapes tab, carriage return and newline as JSON does
- every other control character gets a \u escape, built with printf -v so no fork runs
- a reset that succeeds removes the Wallet Gateway's stores
- a reset that fails keeps them
- the localnet layer row lists the splice-upgrade.md it ships
- build-dar falls back to the release's newest DARs when no LocalNet Scan answers
@fernandomg
fernandomg merged commit 35dee3e into main Nov 12, 2026
9 checks passed
@fernandomg
fernandomg deleted the feat/localnet-reset-after-splice-bump branch November 12, 2026 17:28
@github-project-automation github-project-automation Bot moved this from In review to Done in Canton - dAppBooster (#390) Nov 12, 2026
fernandomg added a commit that referenced this pull request Nov 13, 2026
…example up to main

- daml/README.md matches amulet-vesting's again; #269 changed that one after the PR copied it;
- .env.example names Splice 0.9.4, as main's 46de001 does for amulet-vesting.

This branch was successfully deployed

2 active deployments
Preview – components.canton-dappbooster — f9c3fe23 Deployed Nov 12, 2026 by vercel[bot]
Preview – demo.canton-dappbooster — f9c3fe23 Deployed Nov 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants