Skip to content

"missing data object" when compiling a contract with both an __init__ and create statement. #284

Description

@g-r-a-n-t

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions