ABI decoder does not allow zero-length arrays
https://github.com/algorand/js-algorand-sdk/blob/develop/src/abi/abi_type.ts#L31
but
https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0004.md#types --- "<type>[<N>]: A fixed-length array of length N, where N >= 0. type can be any other type."
([1-9][\d]*) should just be [\d]+
We can't use [\d]+ with the code as is, since it would make things like uint64[0000000001] appear as a valid type. And we don't want this because method signatures need to have consistent hashes -- the ARC should probably clarify this.
But we could modify the regex in another way to support a single 0. Though it's worth noting this type is essentially a noop since you can't store anything in a 0 length static array.
Just made this: https://github.com/fabrice102/ARCs/pull/2
Good point!
https://en.wikipedia.org/wiki/Robustness_principle --- I think you should accept uint64[00001] but never generate it =)
This is still not fixed. You should change the regexp:
const staticArrayRegexp = /^([a-z\d[\](),]+)\[(0|[1-9][\d]*)]$/;
need to look at the other SDKs as well, probably same issue & fix.
Thank you! We should also reference #698
oops github is acting smart here and closed the ticket 😅