dfinity / dfinity/sdk

Wrong canister principals are generated by `dfx generate` and other

Open
#3,733 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-triage
Dominant language
Rust
Stars
204
Forks
98
PR merge metrics
No merged PRs in 30d

Description

Wrong canister principals are generated by dfx generate, if canisters were not created/deployed before calling generate. For more details see here.

The bug seems repeatable by DFX 0.19.0.

The bug also appears in my PR https://github.com/dfinity/sdk/pull/3710. After this PR, the bug appears not only in dfx generate, but also in dfx deploy (and probably dfx build). Meanwhile, if I did testing right, in 0.19.0 it appears only for dfx generate.

I tried the following:

  1. Start DFX
  2. run dfx generate in an ICP software folder.

I expected to see this happen: dfx generate to bail out like dfx build does in this situation.

Instead, this happened: Wrong canister principals are put into .dfx/local/lsp/.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing dfx generate in an ICP software folder without creating or deploying canisters, then inspect the generated principals under .dfx/local/lsp/. Compare the behavior with dfx build and verify whether dfx deploy is also affected; done means generation fails instead of writing incorrect principals, without introducing the reported regressions.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.