Quill TransferSnsTreasuryFunds to_subaccount always null

When I call the TransferSnsTreasuryFunds call with a subaccount defined, I always receive to_subaccount=null from my test call.

Here is my call

quill sns  --canister-ids-file "canister-ids.json" --pem-file "tmp.pem" make-proposal $NEURON_ID --proposal "(
    record {
        title = \"Transfer ICP from SNS treasury.\";
        url = \"example.com\";
        summary = \"\";
        action = opt variant {
            TransferSnsTreasuryFunds = record {
              from_treasury = 1 : int32;
              to_principal = opt principal \"rrkah-fqaaa-aaaaa-aaaaq-cai\";
              to_subaccount = opt record { subaccount = vec {0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1} };
              memo = null;
              amount_e8s = 1_000_000_000: nat64
            }
        };
    }
)" > message.json

quill send message.json --dry-run

with an example canister_ids.json defined like this

{
  "governance_canister_id": "tr3th-kiaaa-aaaaq-aab6q-cai",
  "ledger_canister_id": "tyyy3-4aaaa-aaaaq-aab7a-cai",
  "root_canister_id": "tw2vt-hqaaa-aaaaq-aab6a-cai",
  "index_canister_id": "efv5g-kqaaa-aaaaq-aacaa-cai",
  "swap_canister_id": "t7z6p-ryaaa-aaaaq-aab7q-cai"
}

The action part of the return is always defining the to_subaccount as `null``

action = opt variant {
          TransferSnsTreasuryFunds = record {
            from_treasury = 1 : int32;
            to_principal = opt principal "rrkah-fqaaa-aaaaa-aaaaq-cai";
            to_subaccount = null;
            memo = null;
            amount_e8s = 1_000_000_000 : nat64;
          }
        };

I’m using quill version 0.4.3.

Is there an issue with how I’m defining the to_subaccount field?

1 Like

Ok, by downgrading to version 0.4.2 I was getting an error message in my definition and was able to figure out that I need to add : vec nat8 to the end of the subaccount defintion. However, this leads to a weird subaccount encryption which doesn’t match what I’m expecting. Further fiddling let me find out that adding :nat8 to each individual value in my subaccount leads to a result that I’m expected, but only in quill version 0.4.3. Adding : vec nat8 to quill version 0.4.3 however again leads to an empty blob.

So, taking an example subaccount that is defined with the following bytes { 161; 104; 39; 29 }, I get these different results

With quill version 0.4.2:

  1. Defining with : vec nat8 :
    to_subaccount = opt record { subaccount = vec { 161; 104; 39; 29 } : vec nat8}
    results in
    to_subaccount = opt record { subaccount = blob "\a1h\27\1d" };

  2. Defining with :nat8 :
    to_subaccount = opt record { subaccount = vec { 161: nat8; 104: nat8; 39: nat8; 29: nat8 } }
    results in
    to_subaccount = opt record { subaccount = blob "\a1h\27\1d" };

With quill version 0.4.3:

  1. Defining with : vec nat8 :
    to_subaccount = opt record { subaccount = vec { 161; 104; 39; 29 } : vec nat8}
    results in
    to_subaccount = opt record { subaccount = blob "" };

  2. Defining with :nat8 :
    to_subaccount = opt record { subaccount = vec { 161: nat8; 104: nat8; 39: nat8; 29: nat8 } }
    results also in
    to_subaccount = opt record { subaccount = blob "\a1\68\27\1d" };

So summarising, with quill v0.4.2 it produces the wrong subaccount blob with both definitions and with quill v0.4.3 it produces only the correct result if each value is defined individually.

I would highly appreciate some feedback from someone from the team if this is only an issue on my end and how it can be fixed.

Thanks for the report. There was a Candid bug that caused this. Quill needs to bump the Candid version to fix this.

Meanwhile, I suggest you to use the blob syntax instead of vec, e.g., subaccount = blob "\00\00\00\00\00\00\00\00\01"

1 Like

This has been fixed in quill v0.4.4.

1 Like