witnet-solidity-bridge icon indicating copy to clipboard operation
witnet-solidity-bridge copied to clipboard

Feat: Improve Witnet errors decoding

Open guidiaz opened this issue 3 years ago • 5 comments

WitnetParserLib is currently unable to decode Witnet errors containing float values. For instance: d827831851fb3fe6666666666666fb3fe6666666666666

guidiaz avatar Dec 17 '21 19:12 guidiaz

It's the node who, in first place, maybe shouldn't be encoding floats :thinking:

aesedepece avatar Dec 27 '21 17:12 aesedepece

Perhaps not when encoding errored results. For sure it would make life easier for WitnetParserLib, as it could assume (as it currently does) that parameterized errors would always be encoded as an array of unsigned 64-bit integers.

However, Witnet Explorer seems to handle correctly errors with float parameters, so changing the node to avoid encoding floats could require changes in the Witnet Explorer side.

guidiaz avatar Dec 29 '21 10:12 guidiaz

However, Witnet Explorer seems to handle correctly errors with float parameters, so changing the node to avoid encoding floats could require changes in the Witnet Explorer side.

Actually not. If we commit to using uint64 it will be able to decode it anyway, because it is using a generic CBOR decoder, and not expecting any specific types for the elements of the array.

aesedepece avatar Dec 29 '21 12:12 aesedepece

In such case, +1 to force the node to encode error parameters as array of unsigned integers.

guidiaz avatar Dec 29 '21 13:12 guidiaz

Actually sounds like this topic could use a WIP better specifying encoding of errors.

aesedepece avatar Dec 30 '21 10:12 aesedepece