Bug in TCYCLES ledger implementing ICRC-1

The ICRC-1 spec says:

If the fee argument does not agree with the ledger fee, the ledger MUST return variant { BadFee = record { expected_fee = … } } error.

This sounds like the BadFee error takes precedence over the InsufficientFunds error. The ICRC-1 standard should be clearer about this.

To illustrate the difference, say I have 1 ICP in an account and transfer 1 ICP out with a fee of 0. Then I will get a BadFee error and not InsufficientFunds. The same happens if I transfer any amount larger than 1 ICP and a wrong fee. This means BadFee takes precedence over InsufficientFunds. It makes sense that way.

However, TCYCLES is an exception in that it does not follow this rule. The TCYCLES ledger will return InsufficientFunds in the above cases. It’s a bug in TCYCLES.

Thanks for the report! I can reproduce it myself. (Note to self: internal ticket)

I’d treat this as relatively low prio since it’s just a different error being returned. Do you have a good reason to treat this as more urgent?

I have already put a work-around in my code for TCYCLES so I am fine with that.

1 Like

What is important is that TCYCLES does not change its ledger fee before fixing this. My code, for example, would break if that happened.