deployedBytecode
output is empty in Yul mode for contracts with bytecode dependencies
#15745
Labels
bug 🐛
low effort
There is not much implementation work to be done. The task is very easy or tiny.
low impact
Changes are not very noticeable or potential benefits are limited.
must have eventually
Something we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.
Description
The
evm.deployedBytecode
output in Standard JSON is available both for Yul and Solidity, but works reliably only for Solidity. In Yul a heuristic is used to find the runtime object and the presence of more than one nested object is enough to confuse it. The result is that for contracts with bytecode dependencies the output is empty. This makes the result of two-stage compilation via Yul different than single-step compilation.The heuristic is inconsistent with Specification of Yul Object, which documents the
_deployed
suffix as the factor determining the runtime object.The problem exists only in the Standard JSON interface because CLI does not provide outputs for the deployed bytecode.
Environment
Steps to Reproduce
Single-step compilation
step1.json
Deployed bytecode is present as expected. The compiler selects the right nested object for
D
because it relies on the_deployed
suffix:solidity/libsolidity/interface/CompilerStack.cpp
Lines 1592 to 1594 in 7893614
Two-step compilation
step2.json
null
Deployed bytecode is missing even though we're compiling the same exact contract, just in two steps. This is because in Yul mode the name of the nested object is not given and we fall back to the simplistic heuristic:
solidity/libsolidity/interface/StandardCompiler.cpp
Line 1659 in 7893614
The text was updated successfully, but these errors were encountered: