What is wrong?
When a contract has an __init__ function defined, we copy the content of the runtime object into the constructor object. This is to ensure that any functions defined within the contract can be called from the __init__ function. This is problematic when creating external contracts, since the contract's code is only added to the runtime object.
How can it be fixed
The simplest way to solve this would be to add any external contract code to the constructor object too. One issue with this, though, is that the Yul optimizer will not remove any unused data objects. These extra data object will not increase the contracts size, but will increase the contract creation calldata size. If there is not much of a cost here, then we could probably just leave them in there, otherwise we'll need to figure out how to optimize this.
What is wrong?
When a contract has an
__init__function defined, we copy the content of the runtime object into the constructor object. This is to ensure that any functions defined within the contract can be called from the__init__function. This is problematic when creating external contracts, since the contract's code is only added to the runtime object.How can it be fixed
The simplest way to solve this would be to add any external contract code to the constructor object too. One issue with this, though, is that the Yul optimizer will not remove any unused data objects. These extra data object will not increase the contracts size, but will increase the contract creation calldata size. If there is not much of a cost here, then we could probably just leave them in there, otherwise we'll need to figure out how to optimize this.