Zondax / filecoin-solidity

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

Unmarshalling CIDs seems to be inconsistent across the library #365

Closed nonsense closed 1 year ago

nonsense commented 1 year ago

At the moment there appear to be two ways to unmarshal CIDs in this library:

  1. readCid and writeCid at https://github.com/Zondax/filecoin-solidity/blob/master/contracts/v0.8/cbor/FilecoinCbor.sol#L49-L77 which prepend and also drop the 0x00 byte prefix.
  2. deserializeDealProposal (and maybe other functions?) that do not prepend on write (or drop on read) the 0x00 byte prefix -- https://github.com/Zondax/filecoin-solidity/blob/master/contracts/v0.8/cbor/MarketCbor.sol#L280-L281

This results in compatibility issues with other CBOR encoding libraries.

:link: zboto Link