Zondax / filecoin-solidity

Filecoin Solidity API Library
Apache License 2.0
93 stars 43 forks source link

FilecoinCBOR: fix writeCid and add readCid. #334

Closed raulk closed 1 year ago

raulk commented 1 year ago

For historical reasons, the (DAG-)CBOR encoding of CID types includes a fixed 0x00 leading byte in the bytes portion. This also adds a readCid function.

I wasn't able to find nicer Solidity to slice a byte array, since the slicing syntax is only available for calldata params.

TODO

Unit tests. Can we add simple unit tests that don't involve Rust integration tests?

:link: zboto Link

emmanuelm41 commented 1 year ago

@raulk I think we could use custom user errors as we are using on other files (instead of the basic require with custom messages)

emmanuelm41 commented 1 year ago

Merging this as it is and I will fix tests on another PR