The invocation to the wallet call forward method failed with the error: An error happened during the call: 5: Canister l6zhh-7aaaa-aaaaa-aacxq-cai trapped explicitly: Panicked at 'Deserialization Failed:

I’m trying to run the ledger canister locally, when I run dfx deploy, I get the following error message:

The invocation to the wallet call forward method failed with the error: An error happened during the call: 5: Canister l6zhh-7aaaa-aaaaa-aacxq-cai trapped explicitly: Panicked at 'Deserialization Failed: "No more values on the wire, the expected type record {\n send_whitelist : vec principal;\n minting_account : text;\n transaction_window : opt record { secs : nat64; nanos : nat32 };\n max_message_size_bytes : opt nat64;\n archive_options : opt record {\n num_blocks_to_archive : nat64;\n trigger_threshold : nat64;\n max_message_size_bytes : opt nat64;\n node_max_memory_size_bytes : opt nat64;\n controller_id : principal;\n };\n initial_values : vec record { text; record { e8s : nat64 } };\n} is not opt, reserved or null"', /ic/rs/rust_canisters/dfn_core/src/endpoint.rs:50:41

does anyone know how to resolve this issue? Thanks In advance!

My backend is written in motoko if thats helpful to know at all.

1 Like

Hi @Jesse!

No more values on the wire

The installation error looks as if you used ledger.public.did instead of ledger.private.did to install the canister (I’m assuming that you followed this instruction: https://github.com/dfinity/ic/tree/master/rs/rosetta-api/ledger_canister#deploying-locally).

Could you please double check which interface you use when you deploy the ledger locally?

I was indeed using ledger.public.did instead of using ledger.private.did. I changed the interface to private, and that error is no longer showing. now I’m getting the following error:

import error [M0153], file .../.dfx/local/canisters/idl/ihjg5-viaaa-aaaaa-aac6a-cai.did uses Candid types without corresponding Motoko type
ihjg5-viaaa-aaaaa-aac6a-cai.did:95.10-99.2: import error [M0163], cannot import a Candid service constructor

I suspect there’s something off with how I’m importing the ledger canister. here is what the import call looks like:

import Ledger "canister:ledger";

@roman-kashitsyn I think i see the issue. The ledger.public.did and ledger.private.did interfaces diverge quite a bit. For example: in ledger.private.did, within the Ledger.transfer() function, the to argument is of type Text, whereas in ledger.public.did the to argument is of type Blob. there’s several more cases of divergence between the two candid files. I wrote my code to adhere to the types and structures expected in the ledger.public.did interface, but since I’m using the ledger.private.did interface to test locally and the two interfaces are so different, I’m running into build errors. I may have the wrong ledger.private.did file. Do you know where I might be able to find the correct ledger.private.did interface?

1 Like

You only need the private interface for the first ledger installation. Once the ledger is installed, you should switch to the public interface and develop against it. This is mentioned in the step 10 of the Ledger setup instruction:

  1. Update the canister definition in the dfx.json file to use the public Candid interface:

{
“canisters”: {
“ledger”: {
“type”: “custom”,
“wasm”: “ledger.wasm”,
“candid”: “ledger.public.did”
}
}

2 Likes

Got it!. I’ll give it another shot. Thanks for your help!

1 Like

@roman-kashitsyn, I gave it another shot. I tried putting the ledger.wasm, ledger.private.did, and ledger.public.did file in the root directory of my project, and I’m able to get the ledger canister deployed, however, when I go to deploy the canister’s that I’ve built, the build fails at the portion when it’s building the ledger canister. so I made an entirely different project directory strictly for the ledger canister, and deployed the ledger canister there. again, I’m able to deploy the ledger canister, but when I go to deploy the canisters in my project, I’m getting the following import error:
import error [M0011], canister alias "ledger" not defined.

My canister that’s importing the ledger canister isn’t able to find the ledge canister with it now being in another project directory, even though the canister has been deployed. below is how I’m importing the ledger canister:

import Ledger "canister:ledger";

I should be able to import the canister into my canister, even with the ledger canister being in a different project, but still deployed locally, right? and if so, am i importing it correctly? are there some additional configurations that I should know about?

Thanks in advance!

@roman-kashitsyn , correction: it fails with the following error:

The post-build step failed for canister 'faqvn-yaaaa-aaaaa-aadvq-cai' with an embedded error: No such file or directory (os error 2)

I was able to get the csnister running locally. I’m trying to post the exact steps that i performed to get it running locally, but for whatever reason, when I attempt to do so, The forum doesn’t let me post the message. it says “draft offline”

Hi @Jesse,

That’s not the case, DFX projects are isolated from one another by design. DFX maintains a separate replica state for each project, and the Motoko compiler doesn’t see canisters defined in other projects.

You’ll have to place the Ledger canister and your canister in the same project.

1 Like

I was actually able to get my project to import the ledger canister even with the ledger canister being in a different project directory. I did so by changing the

"ledger": {
    "local": "gfeog-fiaaa-aaaaa-aad6a-cai"
  }

in the .dfx/local/canister_ids.json file within my project. I set the "local" property to the canister_id of the ledger canister that I deployed within a separate project directory. Everything has compiled properly so far with no errors, so I’m assuming the ledger canister was imported properly. Do you see any reason why my canisters would deploy properly, and it not be the case that the ledger canister was properly imported?

Do you see any reason why my canisters would deploy properly, and it not be the case that the ledger canister was properly imported?

When you write import Ledger "canister:ledger"; in Motoko, the compiler replaces name Ledger with a specific canister ID. DFX passes this canister ID based on the project configuration. Your code didn’t compile before because DFX didn’t know the canister ID of the local ledger, because you never created the canister in that project.

When you added

"ledger": {
    "local": "gfeog-fiaaa-aaaaa-aad6a-cai"
  }

to canister_ids.json, you tricked DFX into thinking that the Ledger canister is installed in this project, and now the compilation works fine because DFX knows the canister ID it should use for Ledger. Note the compilation doesn’t depend on the fact that you have another project with the Ledger installed, you can use almost any canister id in canisters_ids.json for Ledger, it will still compile.

I’d still recommend to keep the ledger canister definition and your canister code in the same project, and run dfx start in the same project

1 Like

OK. I’ll take your recommendation. Thanks for the explanation.