Zondax / ledger-icp

Apache License 2.0
16 stars 9 forks source link

Principals can be up to 29 bytes long #218

Closed lmuntaner closed 11 months ago

lmuntaner commented 11 months ago

A colleague (@dskloetd ) found an issue with ICRC1 transfers.

The transfer doesn't work if the destination principal isn't 29 bytes long.

He points to this line in the code.

Yet, principals can be up to 29 bytes long. See the docs on Principal.

I confirmed the issue.

I created two test vectors. One with the destination that isn't working, and one with a destination where the transfer succeeded.

The principal that wasn't working is "ttwhn-ittl6-fnuml-tqdgz-tbyhu-f7jti-ft2cr-znzsu-biv4l-gpvg4-ba". I also marked the test vector with isWorking to differentiate them.

Could you please fix it? Thanks!

icrc-1-issue.json.txt

Code of the test vectors.

:link: zboto Link

dskloetd commented 11 months ago

The non-working example is 28 bytes. But principals can be much shorter than that. Even "aaaaa-aa" is a valid principal.