← Back to Pull requests

Step 10: the release channel and the release signing tool #12

Closed
unknown closed this pull request without merging on Oct 21, 2026 13:13 UTC
View on GitHub
unknown unknown commented on Oct 21, 2026 12:25 UTC
Author

<!-- claude-projects-attribution: {"github_login":"b3hr4d"} -->
_Requested by Behrad · project thread_

Before: a release manifest was only a type in candid/common.did. Nothing published releases, and nothing signed them.

After: a release channel canister keeps signed wallet releases and serves them in 1 MiB chunks. A publisher stages a release's chunks, then publishes its manifest, and the channel refuses the manifest unless two of its three signer keys signed it ([decision 0004](docs/decisions/0004-release-signers.md), "2 of 3 keys") and every staged chunk matches its hash and together they are the Wasm the manifest names. Nothing of a release is served until then, and a published version never changes. release-tool makes a manifest from a Wasm, signs it with an Ed25519 key in PEM, checks it, and writes the publish_chunk arguments that icp-cli sends. The README's new "Publishing a release" section is the whole flow.

How: crates/release holds the manifest, the hash its signers sign, and the form, signature and chunk checks, so the channel, the tool and later the wallet run the same code. A key counts once however often it signed, and a signature by another key or one that fails Ed25519's strict check counts for nothing. The channel stores its config, releases, publish order and chunks in four stable memories, listed in docs/design.md. Its inspect_message drops publish messages from anyone but a publisher before they run, so a stranger's megabyte costs it no cycles, and a guard refuses the same calls from other canisters, which skip that check. An upgrade keeps the config or replaces it, so the signer keys can be rotated without touching published releases. tests/caller is a small canister that lets the PocketIC tests call as a canister. CI now lints and unit-tests every crate, builds the channel and caller Wasm next to the wallet's, and its PocketIC step includes the 100 MiB release, about 40 seconds more.

Worth your review

  • The release channel's interface changed. It takes ChannelArg (Init with publishers, signer keys and threshold, or Upgrade with an optional new config). ChannelError lost NotPublisher (the guard rejects instead, as in the wallet) and UnknownVersion (a chunk of an unknown version answers null), and gained Invalid : text, MissingChunk and WasmMismatch.

  • New limits, written as comments in common.did: versions of 1 to 64 letters, digits and . + - _; at most 100 MiB, cut every 1 MiB so one Wasm has exactly one list of chunk hashes; at most 64 tested_from hashes; an https notes_url of at most 512 characters; at most 16 signatures and 16 signer keys.

  • The signing hash depends on the encoder. The JS Candid encoder (@icp-sdk/core) writes the test vector's manifest with its type table in another order, so its hash differs (73f087… against 8bd9e0…). Signers must therefore sign with release-tool or the release crate, and a test pins the bytes. OpenSSL signs the same signing hash to the same signature, byte for byte, so the keys themselves can live anywhere. A fixed byte layout instead of Candid would remove the dependence on one encoder, but it changes what common.did defines.

  • New dependency, for the tool only: ed25519-dalek's pem feature (pkcs8, der, spki, pem-rfc7468, base64ct, const-oid), to read keys from openssl genpkey. The canisters do not get it, and the wallet Wasm is byte-identical built alone or together with the channel.

  • sha2 now builds at opt-level 3 in release builds. SHA-256 drops from 127 to 75 instructions a byte, which brings publishing a 100 MiB release from 27.2 billion instructions to 16.4 billion, of the 40 billion an update may use. The wallet Wasm grows by 3.5 KB.

  • latest is the release published last, not the highest version.

  • Staged chunks of a version that never publishes stay in stable memory; there is no method to drop them.

  • The wallet still has its own Ed25519 checks and no cap of 16 on its release signers. Step 11 moves it onto the release crate.
  • Tests. crates/release: 16 unit tests, with the signing hash's input bytes and output pinned, a property test that any changed byte fails the chunk check, and a check that a Wasm with bytes past its size is refused. release-tool: 6 unit tests and 8 that run the binary: two of three signers sign, a manifest for another Wasm, or for the same Wasm with bytes appended, is refused and the file left untouched, a signature by another key or over edited text counts for nothing, a 17th signature is refused, and bad input exits 2 with the usage. The channel's interface test checks all six methods and the install argument against candid/release_channel.did. 11 PocketIC tests send the channel the tool's own files: publishing by 2 of 3; refusing no signature, one signer, one signer twice, an unpinned key, a changed signature and a signature over another manifest; a wrong chunk, a missing one, a Wasm hash that does not match and chunks cut at another place; a published release that cannot change; out-of-form chunks and manifests; strangers dropped by inspect_message and, calling through a canister, refused by the guard; bad install configs; upgrades that keep releases and rotate the signers; and a 100 MiB release.

    I injected 20 faults, one at a time, and each failed at least one test: a threshold of one, a key counted once per signature, any signature accepted, no chunk hash, size or Wasm hash check, no form check at publish, no guard, an inspect_message that accepts everyone, staged chunks served, a published chunk or manifest replaced, extra chunks kept, an upgrade that ignores a new config, an install that takes a bad one, a changed interface, and in the tool, signing without the Wasm check or its size check, past 16 signatures, or with a chunk hash dropped from the text.

    The whole CI battery passes locally, the wallet's 106 unit and 55 PocketIC tests included, with the upgrade from main and regtest.

    By hand, on a local network with icp-cli 1.7.0, I ran the README's steps with three keys from openssl genpkey: the channel answered NotEnoughSignatures = record { have = 1; need = 2 } with one signature, published the wallet's own 3.7 MB Wasm with two, answered AlreadyPublished the second time, refused the anonymous identity's chunk, and served four chunks whose SHA-256 is the Wasm's.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_013Vgh2De8Zarye1iDyGSRbe

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: b3hr4d Review duration: 47m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.57 · 650 lines diff across 8 files
    0.57
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #12"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 57% (MEDIUM) · Higher = larger blast radius
    57%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%