chore(vetkeys): split basic_bls_signing into self-contained motoko + rust examples#1444
chore(vetkeys): split basic_bls_signing into self-contained motoko + rust examples#1444marc0olo wants to merge 8 commits into
Conversation
…rust examples Same split as basic_ibe (#1443): move the Motoko variant to motoko/vetkeys/basic_bls_signing and flatten the Rust variant to rust/vetkeys/basic_bls_signing, each self-contained with its own frontend copy (previously a shared frontend symlinked into motoko/ and rust/ subdirs). - Frontend: per-language copy; bindings via the @icp-sdk/bindgen Vite plugin from the committed backend/backend.did (replaces scripts/gen_bindings.sh); dropped eslint; root workspace package.json so `npm run dev` runs from the example root. - Motoko: idiomatic camelCase interface (signMessage, getMySignatures, getMyVerificationKey); moc 1.11.0 + --default-persistent-actors (dropped `persistent`); dropped unused sha2 dep; committed backend/backend.did. - Rust: unchanged (snake_case), relocated to the flattened layout. - READMEs split per language (linked prerequisites); test.sh added (query method called with --query); CI split into motoko + rust jobs on the new paths. Baked in the two Copilot fixes from #1443 (error message names `backend`; --query for the query method). CODEOWNERS unchanged: /motoko/vetkeys/ and /rust/vetkeys/ both map to @dfinity/core-protocol. Verified: Motoko deploy + test.sh + signature survives an upgrade; Rust cargo build + deploy + test.sh; both frontends build/typecheck/serve. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…p Makefile - Bump the Rust recipe to @dfinity/rust@v3.3.0 and rename the Cargo package to `backend`, so the recipe no longer needs a custom `package:` in its configuration (matches daily_planner and the other migrated rust examples). - Drop backend/Makefile; advertise candid regeneration directly in the README via `icp build backend && candid-extractor … > backend/backend.did` (the Makefile's `rm -rf .icp` clean target was also wrong — only .icp/cache should ever be wiped, and that isn't advertised elsewhere anyway). Verified: rust deploy + test.sh pass; `icp build backend` produces backend.wasm. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR restructures the vetkeys/basic_bls_signing example into two fully self-contained examples (Motoko + Rust), each with its own frontend, backend config, and build/test entrypoints—mirroring the earlier basic_ibe split and removing the prior shared-frontend/symlink workflow.
Changes:
- Split the example into
motoko/vetkeys/basic_bls_signingandrust/vetkeys/basic_bls_signing, each with independent frontend + project root workspacepackage.json. - Replaced the legacy bindings generation script with
@icp-sdk/bindgenvia the Vite plugin, generating bindings from committedbackend/backend.did. - Updated CI workflow to run deploy +
test.shfor both language variants on the new paths.
Reviewed changes
Copilot reviewed 31 out of 38 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| rust/vetkeys/basic_bls_signing/test.sh | Adds a basic CLI test script for the Rust variant. |
| rust/vetkeys/basic_bls_signing/rust/backend/Makefile | Removes legacy wasm build / candid extraction Make targets. |
| rust/vetkeys/basic_bls_signing/rust-toolchain.toml | Adds wasm32 target configuration for the Rust toolchain. |
| rust/vetkeys/basic_bls_signing/README.md | Updates Rust README for the new self-contained layout, workflow, and bindgen approach. |
| rust/vetkeys/basic_bls_signing/package.json | Adds a root workspace package.json to run frontend scripts from the example root. |
| rust/vetkeys/basic_bls_signing/motoko/mops.toml | Removes the old Motoko config from the former shared Rust directory layout. |
| rust/vetkeys/basic_bls_signing/icp.yaml | Renames canisters to backend/frontend, updates rust recipe version, and updates frontend build dir/commands. |
| rust/vetkeys/basic_bls_signing/frontend/vite.config.ts | Switches dev/build flow to @icp-sdk/bindgen and simplifies dev-server wiring for local deploys. |
| rust/vetkeys/basic_bls_signing/frontend/src/main.ts | Updates frontend bindings import path and canister env key from basic_bls_signing to backend. |
| rust/vetkeys/basic_bls_signing/frontend/scripts/gen_bindings.sh | Removes legacy binding generation script. |
| rust/vetkeys/basic_bls_signing/frontend/package.json | Simplifies frontend package scripts/deps and adds @icp-sdk/bindgen. |
| rust/vetkeys/basic_bls_signing/frontend/eslint.config.mjs | Removes ESLint config as part of frontend slimming. |
| rust/vetkeys/basic_bls_signing/frontend/.gitignore | Adds ignores for node_modules, dist, and generated bindings. |
| rust/vetkeys/basic_bls_signing/Cargo.toml | Adds a workspace root and release profile settings for the Rust example. |
| rust/vetkeys/basic_bls_signing/backend/src/types.rs | Adds backend type definitions and stable-structure serialization for signatures. |
| rust/vetkeys/basic_bls_signing/backend/src/lib.rs | Adds the Rust canister implementation in the flattened backend/ layout. |
| rust/vetkeys/basic_bls_signing/backend/Cargo.toml | Renames the crate to backend for the new layout. |
| rust/vetkeys/basic_bls_signing/backend/backend.did | Adds committed Candid interface for the Rust backend. |
| motoko/vetkeys/basic_bls_signing/test.sh | Adds a basic CLI test script for the Motoko variant. |
| motoko/vetkeys/basic_bls_signing/README.md | Adds Motoko README aligned with the new self-contained structure and tooling. |
| motoko/vetkeys/basic_bls_signing/package.json | Adds a root workspace package.json to run frontend scripts from the example root. |
| motoko/vetkeys/basic_bls_signing/mops.toml | Adds Motoko toolchain/deps and candid configuration for the Motoko variant. |
| motoko/vetkeys/basic_bls_signing/icp.yaml | Adds Motoko icp.yaml with backend/frontend canisters and asset build steps. |
| motoko/vetkeys/basic_bls_signing/frontend/vite.config.ts | Adds Vite config with bindgen plugin and local-dev cookie/proxy wiring. |
| motoko/vetkeys/basic_bls_signing/frontend/tsconfig.json | Adds TypeScript configuration for the Motoko frontend. |
| motoko/vetkeys/basic_bls_signing/frontend/src/vite-end.d.ts | Adds Vite client type reference. |
| motoko/vetkeys/basic_bls_signing/frontend/src/style.css | Adds frontend styling. |
| motoko/vetkeys/basic_bls_signing/frontend/src/main.ts | Adds the Motoko frontend app using generated bindings and II auth client wiring. |
| motoko/vetkeys/basic_bls_signing/frontend/public/.ic-assets.json5 | Adds hardened asset canister security policy headers. |
| motoko/vetkeys/basic_bls_signing/frontend/package.json | Adds Motoko frontend package scripts/deps and bindgen devDependency. |
| motoko/vetkeys/basic_bls_signing/frontend/index.html | Adds Vite entry HTML. |
| motoko/vetkeys/basic_bls_signing/frontend/.gitignore | Adds ignores for node_modules, dist, and generated bindings. |
| motoko/vetkeys/basic_bls_signing/backend/backend.did | Adds committed Candid interface for the Motoko backend (camelCase API). |
| motoko/vetkeys/basic_bls_signing/backend/app.mo | Adds Motoko canister implementation with camelCase API surface. |
| .github/workflows/vetkeys-basic-bls-signing.yml | Updates CI to run separate Motoko + Rust jobs on the new paths, including test.sh. |
Comments suppressed due to low confidence (1)
motoko/vetkeys/basic_bls_signing/backend/app.mo:13
shared actor classrelies on--default-persistent-actors, but per AGENTS.md:226 that flag does not makeactor classpersistent. Since this actor class stores mutable state insignatures, upgrades may lose user signatures unless the class is explicitlypersistent.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… test.sh Address Copilot review: - Use `persistent actor class` explicitly (drop the redundant class-level `shared` and the `--default-persistent-actors` mops arg). Empirically the flag DID persist this main-canister actor class across upgrades — AGENTS.md's caveat is about actor classes spawned as sub-WASMs, not a main canister that is an actor class for its init arg — but explicit `persistent` is unambiguous and matches AGENTS.md's literal guidance. Verified: state survives an upgrade. - Drop test.sh (motoko + rust) and run deploy-only CI. The example never had a test.sh on master; the deploy itself verifies build + install. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…edundant `shared`
Revert the explicit `persistent` detour: keep `--default-persistent-actors`
(no `persistent` keyword) — the flag is required today (moc 1.11.0 errors M0219
otherwise) and is the forward-compatible choice, and it provably persists this
main-canister actor class across upgrades. Keep the actor class as a plain
`actor class` (the previous class-level `shared` was unnecessary — the `shared`
that matters is on the `public shared ({ caller })` methods).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Addressed the Copilot review:
|
"ask the canister (IC smart contract) to produce" -> "ask the canister to produce". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace "dapp" with "app" in READMEs and code comments and normalize the security best-practices link to https://docs.internetcomputer.org/guides/security/overview/. The functional vetKD domain-separator string ("basic_bls_signing_dapp") is left unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ology The `signatures` field is retained across upgrades because it is not declared `transient` — there is no `stable` keyword in use. Update the comment to describe this accurately. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…"dapp" Change the vetKD domain-separator string from "basic_bls_signing_dapp" to "basic_bls_signing_app" in both backends (Rust array length 22 -> 21). These are fresh examples with no previously derived keys to stay compatible with, so the change is safe. Both backends compile. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 36 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
motoko/vetkeys/basic_bls_signing/backend/app.mo:13
- The canister is defined as a non-persistent
actor class, but later comments (and the example’s intended behavior) assumesignaturessurvives upgrades. With--default-persistent-actors, the top-level actor is made persistent by default, butactor classdeclarations still need to be explicitlypersistentto retain state across upgrades.
rust/vetkeys/basic_bls_signing/icp.yaml:6 - The Rust canister recipe’s
configurationblock is missingpackage: backend. Most Rust examples in this repo specify the Cargo package explicitly; without it the build can fail or select the wrong crate when using a workspace layout.
Summary
Splits the vetkeys
basic_bls_signingexample into two self-contained examples (one per language) — the same restructure as #1443 (basic_ibe). Previously it lived only underrust/vetkeys/basic_bls_signing/with a sharedfrontend/symlinked intomotoko/andrust/subdirs.Frontend
@icp-sdk/bindgenVite plugin from the committedbackend/backend.did(replaces the sharedscripts/gen_bindings.sh).eslint/gen_bindings.shand theBACKEND-env dev logic); added a root workspacepackage.jsonsonpm run dev/npm run buildrun from the example root.Backend
signMessage,getMySignatures,getMyVerificationKey). moc 1.11.0 +--default-persistent-actors(dropped the redundantpersistentkeyword); dropped unusedsha2. Committedbackend/backend.did.Each frontend matches its own backend (Motoko camelCase / Rust snake_case).
Docs & CI
vetkeys-basic-bls-signing.yml:motoko+rustjobs on the new paths, watching both, runningtest.sh.main.ts"Canister ID not set" error namesbackend, andtest.shcalls the query method with--query.CODEOWNERS
Unchanged —
/motoko/vetkeys/and/rust/vetkeys/both map to @dfinity/core-protocol.Verification (local)
tsc --noEmitclean,icp deploy,test.shPASS, and a signed message survives an upgrade.icp deploy,test.shPASS.🤖 Generated with Claude Code