Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
g-r-a-n-t opened this issue Mar 3, 2021 · 0 comments · Fixed by #304

Comments

@g-r-a-n-t
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant