Repository navigation
fix(deploy): record production's canister ids, and never create on mainnet - #15
Merged
Merged
Conversation
…innet `.gitignore` left out all of `.icp/`, so the mainnet canister ids lived only on the machine that deployed. From any other clone, `icp deploy -e production` finds no ids and creates new canisters. So does `-e ic`, icp-cli's built-in mainnet environment, which is what happened on 2026-10-27: it stopped only because the cycles balance was below the 2 T a creation asks for. A new frontend is a new origin, which gives every user a new principal. - Commit `.icp/data/mappings/production.ids.json`, written by `icp canister link` (icp-cli 1.6.0), and ignore only `.icp/cache/`, as icp-cli's docs advise and b3pay-hub does. - Deploy with `--no-create` in the README, `icp.yaml`'s header and `pnpm deploy:production`, so a missing id stops the deploy, and say why not to use `-e ic`. - `tests/production.test.ts` checks the recorded ids against `origins.ts`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017cSwEz3Q2o3DpuJ8qSQzY5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
icp deploy -e productionupgrades B3Note's mainnet canisters only on the machine that first deployed them..gitignoreleft out all of.icp/, where icp-cli records each environment's canister ids, so from any other clone the same command finds no ids and creates new canisters. So does-e ic, icp-cli's built-in mainnet environment, which has none of B3Note's ids anywhere.A new frontend is a new origin, so Internet Identity gives every user a new principal, and note.b3pay.net still points at the old canister.
Changes
.icp/data/mappings/production.ids.json: backendxeka7-ryaaa-aaaal-qb57a-cai, frontend4lidq-zqaaa-aaaap-abkbq-cai. Written byicp canister link(icp-cli 1.6.0), so it is exactly what icp-cli writes..gitignore: ignore only.icp/cache/(local network state), as icp-cli's docs advise and b3pay-hub does.--no-createin the README's "Deploying to mainnet",icp.yaml's header comment andpnpm deploy:production, so a missing id stops the deploy instead of creating a canister. The README says why not to use-e ic.frontend/tests/production.test.ts: the recorded ids must equal the onesorigins.tssigns in for and calls.scripts/migrate-mainnet.shstill links both ids with--forcebefore it reinstalls; with the file committed, that rewrites the same ids.Evidence
icp deploy frontend -e icon main bc3d6b5 printed "Creating canisters: [frontend] ✘ failed to create canister: Insufficient cycles. Requested: 2000000000000 cycles, available balance: 1_481_753_760_859 cycles". With more than 2 T cycles on the deploying identity, it would have created a new frontend.icp environment listprintsic,productionandlocal.icp deploy --helplists--no-create: "If any canisters do not exist, error instead of creating them".icp canister linkwrites.icp/data/mappings/<env>.ids.json.docs/concepts/project-model.mdsays to gitignore.icp/cache/and to consider tracking.icp/data/, anddocs/migration/from-dfx.mdsays.icp/data/"should be committed to version control".ic_envcookie listsPUBLIC_CANISTER_ID:backend=xeka7-ryaaa-aaaal-qb57a-caiandPUBLIC_CANISTER_ID:frontend=4lidq-zqaaa-aaaap-abkbq-cai, the ids recorded here.git pullof this kind of change into a clone that already had the (until now ignored) file succeeded and left the committed copy in place.pnpm format:check,pnpm typecheckandpnpm test(61 tests) pass. Four faults each failed the new test and were reverted: a wrong frontend id, a renamed canister, the file missing, and a different backend id inorigins.ts.Generated by Claude Code