Blob arguments for for init and post_upgrade come in as an empty array

I have the following rust canister

#[ic_cdk::init]
fn my_init(param: Vec<u8>) {
    ic_cdk::println!("INIT: {:?}", param)
}

#[ic_cdk::post_upgrade]
fn my_post(param: Vec<u8>) {
    ic_cdk::println!("POST: {:?}", param)
}

Which I am trying to build with this following command

dfx deploy init_blob --argument '(vec {185; 204})'

But I get the following output

[Canister bkyz2-fmaaa-aaaaa-qaaaq-cai] INIT: []

I started seeing this issue on dfx version 0.15.3-largewasm.0 and I am still seeing it on 0.16.0
Version 0.15.3 and earlier works fine.

Any ideas what’s going on?

1 Like

Could this be a subnet issue?

@Severin we found this problem while running the Azle test suite, seems to be a major regression in dfx.

IIRC we moved to Candid 0.10 with this version bump. I’ll investigate

2 Likes

I can reproduce this locally, probably some changes in Candid 0.10 caused this.

Here is what I found so far: --argument '(vec {185:nat8; 204:nat8})' and --argument 'blob "\be\ef"' works.

I will report back when I know more.

1 Like

It should be fixed here: fix IDLValue blob conversion by chenyan-dfinity · Pull Request #517 · dfinity/candid · GitHub

Before that lands in dfx, I would suggest to use the blob "\xx\xx" syntax for vec nat8 type.

2 Likes