Metadata `.car` output
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
## Abstract
Introduce an output that returns JSON metadata in a [`.car` container](https://ipld.io/specs/transport/car/) to make it unambiguous how to store those files on IPFS and reproduce the hashes we include in [CBOR metadata](https://docs.soliditylang.org/en/develop/metadata.html#encoding-of-the-metadata-hash-in-the-bytecode).
## Motivation
As described in #14389, there are multiple ways to store the same file content on IPFS and the choice affects the CID. There does not even seem to be a common convention. Our implementation follows the defaults established by [Kubo](https://github.com/ipfs/kubo/) (formerly go-ipfs), but they are not universal or even recommended.
In the long term, we should change our chunking algorithm and CID format to make this unambiguous. It is still not clear how to do it, but there is also an easy thing we can do already: expose the information about the exact IPFS blocks our implementation produces. They can then be imported by an IPFS client to ensure that the file content is stored under the same CID and that the links we embed in the bytecode actually work.
The standard way to provide this information is the `.car` format.
## Specification
1. Introduce `--metadata-car`/`metadataCAR` output that returns the `.car` file content.
- The output should include blocks representing the JSON metadata (in a [canonical form](https://github.com/ethereum/solidity/issues/16150)) as well as all the files it links to (i.e. files under `sources`).
1. Officially document how we calculate metadata hashes.
## Backwards Compatibility
Full compatibility, as the new output is optional.
Note that it does *not* depend on the new metadata format to be introduced by #16150.
Contributor guide
Research direction
Start by locating the existing metadata-output entry point and the code that emits source-linked IPFS blocks, then compare their behavior with the linked CAR specification and canonical JSON requirement. Done means the optional --metadata-car/metadataCAR output contains the metadata and linked source blocks, and the metadata-hash calculation is officially documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, json
- Domain
- blockchain, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100