Outputting the CBOR Metadata positions in the bytecode #14827
Labels
feature
high impact
Changes are very prominent and affect users or the project in a major way.
low effort
There is not much implementation work to be done. The task is very easy or tiny.
must have
Something we consider an essential part of Solidity 1.0.
In compiler's output bytecode, some values need special attention during source code verification. These fields can be different between the compiled bytecode vs the on-chain bytecode. Still, they shouldn't break the verification because they are typically filled/assigned after compilation or the changes are not because of a change in the executed code (but comments etc.)
--link
or in JSON-inputlibraries:
. This would replace the placeholder in format__$53aea86b7d70b31448b230b20ae141a537$__
with the library address in the bytecode.000000...
in the bytecode in compilation and only assigned a value in the constructor during deployment.It is trivial to find libraries and immutables in a compiled bytecode because the former has special
__$
placeholders and the latter's indexes are output inimmutableReferences
in the compiler.However, the CBOR metadata part is not trivial to find:
That's why verifiers typically use workarounds to find the exact positions such as adding whitespaces to all sources to change the metadata hashes. That requires recompiling the contract and is an expensive operation.
I suggest the compiler outputs the bytecode positions of the CBOR encoded metadata parts of the contracts, similar to how it's done in
immutableReferences
. This would make the source-code verification processes easier and also extracting the CBOR parts for other purposes.Edit: Wrote an article about this, for some context: https://docs.sourcify.dev/blog/finding-auxdatas-in-bytecode/
The text was updated successfully, but these errors were encountered: