So I work in two projects( lets say Musall and MusicNova), both giving problems locally with II and Ledger wasm on ubuntu and Mac-m1, but installed differently in each. What I described above is for Musall, where I used the dfinity/examples/motoko/defi/ ledger versions repo at: examples/motoko/defi at master · dfinity/examples · GitHub (its up to date). I just copied these and installed as described in the release notes for 0.9.3. I might be wrong but these wasm and their associated .did are legitimate since I checked them line for line with the .did descriptions for II and nns-ledger on canLista. Now for MusicNova the II is installed via curl call in dfx.json as described on GitHub for the official II →
"canisters": {
"internet_identity": {
"__0": "The development build of Internet Identity. For more information, see https://github.com/dfinity/internet-identity#build-features-and-flavors",
"type": "custom",
"candid": "internet_identity.did",
"wasm": "internet_identity.wasm",
"__1": "There is no standard way to pull remote canisters, so instead we have a dummy build script that",
"__2": "simply downloads the Internet Identity canister. See also: https://github.com/dfinity/sdk/issues/2085",
"build": "curl -sSL https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_dev.wasm -o internet_identity.wasm"
},
.....
So I am pretty sure we have the correct II and Ledger wasm.
I have the latest rustup, rustc, cmake, wasm-wasi, they all work individually when tested on a simple hello-world file reader. The MusicNova gives this error exactly when building, please note I do have the ic-cdk-optimizer installed before running dfx …(cargo install ic-cdk-optimizer) →
Building canisters...
Executing: cargo build --target wasm32-unknown-unknown --release -p nova_one
Compiling nova_one v0.1.0 (/Users/lee/dfinity/reward-system/src/nova_one)
Finished release [optimized] target(s) in 5.37s
ic-cdk-optimizer not installed, the output WASM module is not optimized in size.
Run `cargo install ic-cdk-optimizer` to install it.
Building frontend...
Executing 'curl -sSL https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_dev.wasm -o internet_identity.wasm'
/Users/lee/.cache/dfinity/versions/0.10.1/base/Int.mo:65.5-65.18: warning [M0154], field hashNat8 is deprecated:
This function may be removed or changed in future.
/Users/lee/.cache/dfinity/versions/0.10.1/base/Int.mo:78.5-78.18: warning [M0154], field hashNat8 is deprecated:
This function may be removed or changed in future.
/Users/lee/dfinity/reward-system/src/fileupload/main.mo:20.23-20.32: warning [M0154], field hash is deprecated:
For large `Nat` values consider using a bespoke hash function that considers all of the argument's bits.
/Users/lee/dfinity/reward-system/src/fileupload/main.mo:143.39-143.51: warning [M0154], field append is deprecated:
`Array.append` copies its arguments and has linear complexity; when used in a loop, consider using a `Buffer`, and `Buffer.append`, instead.
Creating UI canister on the local network.
Jun 27 09:22:13.269 WARN s:wqsem-lwzmj-wa3ia-y3mqb-axtgs-vohbc-ycl3b-efl3o-aoo5r-e73q3-tae/n:uagvz-aior3-6gydl-qibur-dd6ew-wyipd-k7wk6-egodi-424h2-zrmah-iae/ic_execution_environment/scheduler At Round 67 @ time 2022-06-27 09:22:12.589350 UTC, the resulted state after execution does not hold the in-out cycles invariant: cycles at beginning of round 99595008205052 were fewer than cycles at end of round 199595008205052, messaging: {"round":67,"canister_id":null,"message_id":null}
The UI canister on the "local" network is "rno2w-sqaaa-aaaaa-aaacq-cai"
Installing code for canister fileupload, with canister ID rrkah-fqaaa-aaaaa-aaaaq-cai
Installing code for canister internet_identity, with canister ID ryjl3-tyaaa-aaaaa-aaaba-cai
Error: Failed to install wasm module to canister 'internet_identity'.
Caused by: Failed to install wasm module to canister 'internet_identity'.
Failed to install wasm in canister 'ryjl3-tyaaa-aaaaa-aaaba-cai'.
Failed to install wasm.
The Replica returned an error: code 5, message: "Canister ryjl3-tyaaa-aaaaa-aaaba-cai trapped explicitly: Custom(Cannot parse header
Caused by:
binary parser error: io error)"
…/end of log with errors
Also, I always start with a clean build from scratch, these are my alias from .bashrc:
alias dremove='rm -rf ./.dfx/local/'
alias dkill='killall dfx replica'
alias dst='dfx stop'
alias dd='dfx deploy
alias dsc='dfx start --clean'
alias dca='dfx canister create --all'
alias db='dfx build --all'
alias dci='dfx canister install --all'
alias dcanister='dremove && dsc --background && dca && db && dci && dd'
alias moc="$(dfx cache show)/moc --package base $(dfx cache show)/base"
Sorry for all the logs and commands, I wish to provide more info, as it might help diagnose the error.