oasisprotocol / sapphire-paratime

The Sapphire ParaTime monorepo.
https://oasisprotocol.org/sapphire
Apache License 2.0
34 stars 24 forks source link

`_parseCBORUint` failing in `_decodeReceiptUndelegateStart` #323

Closed CedarMist closed 3 weeks ago

CedarMist commented 1 month ago

The consensusTakeReceiptUndelegateStart function in Subcall.sol is failing on testnet with the InvalidLength error.

CedarMist commented 1 month ago

The problem it seems was that integers changed from being returned as a bytes array to being an integer.

kostko commented 1 month ago

Not sure which fields you mean here, but it depends on how big the integers are. For 128-bit integers (e.g. u128) we use byte array encoding (as there is no native support), the same as quantities in the consensus layer. Others (e.g. u64) are encoded natively using compact encoding.

CedarMist commented 1 month ago

That'd be the 'epoch' and 'receipt' fields. of delegation & undelegation.

Either way, adding support for uint8, uint16, uint32 & uint64 when decoding has fixed this. If they haven't been changed, then no idea why I only just ran into this now.

Yup, it seems that my tests didn't try decoding the receipts returned from subcall for ReceiptUndelegateStart.