witnet / witnet-solidity-bridge

Witnet Bridge for EVM-compatible blockchains
MIT License
60 stars 24 forks source link

Feat: Improve Witnet errors decoding #215

Open guidiaz opened 2 years ago

guidiaz commented 2 years ago

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

aesedepece commented 2 years ago

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

guidiaz commented 2 years ago

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.

aesedepece commented 2 years ago

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.

guidiaz commented 2 years ago

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

aesedepece commented 2 years ago

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