ICRC-1 icon indicating copy to clipboard operation
ICRC-1 copied to clipboard

ICRC-1: specify how to opt-out of deduplication

Open roman-kashitsyn opened this issue 9 months ago • 1 comments

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:

  1. Always return TooOld or CreatedInFuture if the caller specified created_at_time (effectively setting TX_WINDOW and PERMITTED_DRIFT to zero).
  2. Reject the call (e.g., trap) if the caller specified created_at_time.
  3. 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

roman-kashitsyn avatar May 03 '24 06:05 roman-kashitsyn

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.

levifeldman avatar May 06 '24 04:05 levifeldman