ICRC-1
ICRC-1 copied to clipboard
ICRC-1: specify how to opt-out of deduplication
I noticed that at least one production implementation of ICRC-1 ledger (link) ignores the deduplication part of the spec; it only records the created_at_time
field in a block.
We should specify how a ledger opts out of the deduplication mechanism. I see at least three options:
- Always return
TooOld
orCreatedInFuture
if the caller specifiedcreated_at_time
(effectively settingTX_WINDOW
andPERMITTED_DRIFT
to zero). - Reject the call (e.g.,
trap
) if the caller specifiedcreated_at_time
. - Introduce our first generic error
{ error_code = 1; message = "ICRC-1: deduplication not supported"}
.
I prefer the last option with the generic error because it’s the most explicit one. On the other hand, the test suite expects the first option: https://github.com/dfinity/ICRC-1/blob/af20f05117222c066b0c52711715ccd43bee3592/test/suite/lib.rs#L723
Hey Roman! Due to prioritization factors, the cts cycles-bank ICRC-1 ledger did not implement the transaction-deduplication part of the spec, however this is temporary, and when the schedule permits, we will implement it. Due to the concern of callers possibly relying on the transaction-deduplication mechanics when calling the cycles-bank before the feature is implemented, for now we will upgrade the ledger to return TooOld
if the caller sets the created_at_time
field - option 1, thereby making sure callers do not lose track of their tokens.