Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XTC is not compatible with DIP20 #53

Open
seniorjoinu opened this issue Jan 28, 2022 · 2 comments
Open

XTC is not compatible with DIP20 #53

seniorjoinu opened this issue Jan 28, 2022 · 2 comments

Comments

@seniorjoinu
Copy link

seniorjoinu commented Jan 28, 2022

DIP20 has errors defined like this

pub enum Dip20TxError {
    InsufficientAllowance,
    InsufficientBalance,
    ErrorOperationStyle,
    Unauthorized,
    LedgerTrap,
    ErrorTo,
    Other,
    BlockUsed,
    AmountTooSmall,
}

While XTC's errors are defined like this

pub enum TxError {
    InsufficientAllowance,
    InsufficientBalance,
    ErrorOperationStyle,
    Unauthorized,
    LedgerTrap,
    ErrorTo,
    Other,
    BlockUsed,
    FetchRateFailed,
    NotifyDfxFailed,
    UnexpectedCyclesResponse,
    AmountTooSmall,
    InsufficientXTCFee,
}

As you can see, XTC has more enum entries.
When trying to use DIP20 types against XTC canister and bump into an error, one would get an error message like:

The Replica returned an error: code 5, message: "Canister knhk5-cyaaa-aaaak-aagoq-cai trapped explicitly: Custom(Fail to decode argument 0 from table0 to variant {
  Ok : nat;
  Err : variant {
    InsufficientAllowance;
    InsufficientBalance;
    ErrorOperationStyle;
    Unauthorized;
    LedgerTrap;
    ErrorTo;
    Other;
    BlockUsed;
    AmountTooSmall;
  };
}

Caused by:
    0: input: 4449444c026b02bc8a017dc5fed201016b0dea99f1497fb5da9aa3037fffcc9bc5057fb9d6c894067fa2dab8d7077fd292d883087fd4b4c59a097fd6e89efe097fc3feeeba0b7fb0ad8fcd0c7ff7c295940e7f8afcbca80f7fabb7cef40f7f0100_00dbb301
       table: type table0 = variant { 17_724 : nat; 3_456_837 : table1 }
       type table1 = variant {
         154_946_794;
         879_144_245;
         1_487_332_991;
         1_653_746_489;
         2_062_429_474;
         2_155_219_282;
         2_471_582_292;
         2_680_665_174;
         3_076_243_267;
         3_382_957_744;
         3_800_392_055;
         4_111_416_842;
         4_271_086_507;
       }
       wire_type: table0, expect_type: variant {
         Ok : nat;
         Err : variant {
           InsufficientAllowance;
           InsufficientBalance;
           ErrorOperationStyle;
           Unauthorized;
           LedgerTrap;
           ErrorTo;
           Other;
           BlockUsed;
           AmountTooSmall;
         };
       }
    1: table0 is not a subtype of variant {
         Ok : nat;
         Err : variant {
           InsufficientAllowance;
           InsufficientBalance;
           ErrorOperationStyle;
           Unauthorized;
           LedgerTrap;
           ErrorTo;
           Other;
           BlockUsed;
           AmountTooSmall;
         };
       }
    2: Variant field 3_456_837: table1 is not a subtype of variant {
         InsufficientAllowance;
         InsufficientBalance;
         ErrorOperationStyle;
         Unauthorized;
         LedgerTrap;
         ErrorTo;
         Other;
         BlockUsed;
         AmountTooSmall;
       }
    3: Variant field 154_946_794 not found in the expected type)"

Please, make them compatible. Otherwise, what's the point of the standard?

@tarek-eg
Copy link

Hello,
I have also ran to the same issue, are you planning to keep it that way or you will fix it in the future?

@qti3e
Copy link
Contributor

qti3e commented Mar 11, 2022

This can be fixed in the future, thanks for pointing it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants