Hi there, resurrecting this thread as it seems to be the only result on the interweb for the problem I’m experiencing. Hopefully its something simple.
I have a doubly wrapped Principal. We wrap all the third party types once to standardise things like Display, Serialize, etc. Then we wrap them again inside the ORM so they can benefit from Storable and all the other ORM-specific traits. This allows seamless integration of all types into our ORM so they can be used as keys, values etc.
My issue is that I can’t seem to send this doubly wrapped Principal via the ic_cdk::call command.
This is calling with the doubly-wrapped type, and returning the newly inserted row.
It’s calling init_player on our Player canister. All the types match up. Here’s the error I’m getting.
adam@Alien:~/projects/dragginz/backend$ dfx canister call main register_player 'principal "aaaaa-aa"'
(
variant {
Err = variant {
Canister = "IC0503: Canister ahw5u-keaaa-aaaaa-qaaha-cai trapped explicitly: failed to decode call arguments: Custom(Fail to decode argument 0 from principal to principal\n\nCaused by:\n 0: input: 4449444c000168_3f7132706a652d68686e63712d756f6b346c2d616e3577662d73357365362d676e6134322d6a336371752d726b7262362d69616169352d7035376c672d627165\n wire_type: principal, expect_type: principal\n 1: Deserialize error: binary parser error: Opaque reference not supported at byte offset 7) (CanisterError)"
}
},
)
dont worry about the aaaaa-aa bit, that argument is overridden by the first code block.
This works if I change both the send and receive arguments to just plain Principal.
Here are the debug messages
2023-08-22 08:26:21.629880878 UTC: [Canister b77ix-eeaaa-aaaaa-qaada-cai] can : ahw5u-keaaa-aaaaa-qaaha-cai
2023-08-22 08:26:21.629880878 UTC: [Canister b77ix-eeaaa-aaaaa-qaada-cai] can dbg : Principal { len: 10, bytes: [128, 0, 0, 0, 0, 16, 0, 14, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }
2023-08-22 08:26:21.629880878 UTC: [Canister b77ix-eeaaa-aaaaa-qaada-cai] player : q2pje-hhncq-uok4l-an5wf-s5se6-gna42-j3cqu-rkrb6-iaai5-p57lg-bqe
2023-08-22 08:26:21.629880878 UTC: [Canister b77ix-eeaaa-aaaaa-qaada-cai] player dbg : Principal(Principal(Principal { len: 29, bytes: [237, 20, 40, 229, 113, 96, 111, 108, 89, 118, 68, 241, 154, 14, 105, 59, 20, 41, 21, 68, 62, 64, 0, 142, 191, 191, 89, 131, 2] }))
2023-08-22 08:26:21.629880878 UTC: [Canister b77ix-eeaaa-aaaaa-qaada-cai] args : (Principal(Principal(Principal { len: 29, bytes: [237, 20, 40, 229, 113, 96, 111, 108, 89, 118, 68, 241, 154, 14, 105, 59, 20, 41, 21, 68, 62, 64, 0, 142, 191, 191, 89, 131, 2] })),)