Add the factory that creates self-owned wallets (step 12) #14
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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 #14"
general
weight: 0.35
b3hr4d
<!-- claude-projects-attribution: {"github_login":"b3hr4d"} -->
_Requested by Behrad · project thread_
Before: there was no factory, only its draft interface. A wallet was installed by hand, so its deployer stayed its controller until someone added the wallet as a controller of itself.
After: the factory's
create_walletcreates a wallet for its caller and leaves the wallet its own only controller, with no rights left to the factory. The creator pays: under an allowance the creator gave the factory, the cycles ledger'screate_canister_fromtakes the wallet's cycles from the creator's account and has the cycles minting canister create the canister, so the factory never holds a creator's cycles. Before anyone pays, the factory checks the arguments and that two of the three signer keys it pins signed the channel's release. It then stages the release's chunks in the new canister's own chunk store, each checked against the signed manifest, installs the wallet withInitArgsnaming the channel, the signer keys and the factory, empties the chunk store and hands the canister over. If the release does not install, the call fails withInstallFailedand the creator becomes the canister's only controller, with the cycles left in it.current_releaseshows the release a wallet created now gets.How: until it hands a canister over, the factory keeps a record of it in stable memory 1, written in the same message that learns the canister's id. A hand-over that fails, or a creation whose callback traps, leaves the record for the IC's global timer (exported by hand, as in the wallet), which tries again five minutes later, a deadline later creations never push back: a canister whose module is its release's goes to itself, any other to its creator, and one the factory no longer controls (read with
canister_info) only leaves the record.post_upgradesets the timer again while a canister waits. The factory's interface types live inrelease::factory, shared with its clients; a test binary that linked two canister crates got duplicate exported symbols.Worth your review
factory.didchanges:FactoryArg(Initwith the channel, signer keys and threshold;Upgradekeeps or replaces them),CreateWalletArgsgainsclaim_expires_at_ns,versionandfrom_subaccount,CreatedWallet.cyclesis what the creator paid (the wallet'sstatusshows what is left), the errors areInvalidArgument,InsufficientAllowance,InsufficientFunds,ReleaseUnavailable,ReleaseRejected,CreateFailedandInstallFailed, andcurrent_releaseis an update, since it reads the channel.icp.yamlnames the factory, and the README has a "Creating a wallet" section.scripts/try-local.shstill installs its wallet by hand, so its wallets still need the controller step to upgrade; moving it onto the factory would mean signing and publishing a local release in the script.Tests. 5 new PocketIC tests in
tests/integration/tests/factory.rs, with the real wallet, channel and factory Wasm on PocketIC's own cycles minting canister and cycles ledger: the factory creates a wallet that owns itself, is claimed, and upgrades itself to a release signed by keys 2 and 3, and creates wallets of the latest release or of the version asked for; it takes nothing for a wallet it cannot create (no release, unknown version, no or too small allowance, too few cycles, bad arguments, a release with too few signatures); a release that does not install leaves the canister to its creator with an empty chunk store; the timer hands over a wallet whose hand-over failed while the factory was frozen, though another wallet was created in between; and an upgrade keeps the configuration or replaces it, and refusesInitor a bad one. 10 new unit tests check the configuration and the arguments, who gets a canister, that a refused attempt to mark a busy canister leaves it busy, that a retry already set keeps its deadline, the cycles ledger's id, and the factory's interface and its wallet install argument againstfactory.didandwallet.did. The busy-canister and retry-deadline fixes answer the Codex review, and their tests fail without them.I injected 15 faults, one at a time, and each failed at least one test: signatures not checked, payment before the release check, the chunk store left full, the factory left a controller, a failed install handed to the wallet, a timer that does nothing, a timer never armed, no record before the install, no minimum cycles, no minimum claim window, anonymous creators, a wallet install argument that drifts from
wallet.did, an upgrade that takesInit, an upgrade whose configuration goes unchecked, and an allowance error reported as another. Not covered by a test: the per-chunk check against the manifest and the check that the channel answered the version asked for, since the real channel never serves anything else; the IC also checks the module hash at install.The whole CI battery passes locally: 115 wallet unit tests, the interface check (18 of 23 methods), 10 factory unit tests, and 76 PocketIC tests (55 for the wallet, with the upgrade from
mainand regtest Bitcoin, 11 for the channel, 5 for the self-upgrade and the 5 above). I also ran the README's "Publishing a release" and "Creating a wallet" commands on a local icp-cli 1.7 network: the wallet came back as its own only controller, running the release's module, and took the claim.🤖 Generated with Claude Code
https://claude.ai/code/session_013Vgh2De8Zarye1iDyGSRbe