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

EIP-3540: Clarify contract creation failure #5878

Closed
wants to merge 1 commit into from

Conversation

chfast
Copy link
Member

@chfast chfast commented Nov 5, 2022

Clarify that in case of any of the new contract creation failure conditions all gas provided to the create instruction/transaction is consumed.

Current implementations do not consume all gas for the first condition but do for the second so this is a functional change.

@github-actions github-actions bot added c-update Modifies an existing proposal s-review This EIP is in Review t-core labels Nov 5, 2022
@eth-bot
Copy link
Collaborator

eth-bot commented Nov 5, 2022

All tests passed; auto-merging...

(pass) eip-3540.md

classification
updateEIP
  • passed!

@jochem-brouwer
Copy link
Member

What is the motivation that all gas has to be consumed?

@chfast
Copy link
Member Author

chfast commented Nov 7, 2022

If you consider the initcode validation is part of initcode execution then this is consistent (because any other failure in initcode execution fails the contract creation and consumes all gas provided).
Moreover, after initcode execution there is runtime code validation and it must consume all gas in case of failure.

@chfast
Copy link
Member Author

chfast commented Nov 7, 2022

For the reference, the EIP-3670: EOF - Code Validation has this situation clarified and it proposes not consuming all the gas. I wasn't aware of this when proposing this change.
Also in EIP-3860: Limit and meter initcode similar check result in "light" failure not consuming all the gas.

Nevertheless, we should discuss it and pick better variant.

@chfast
Copy link
Member Author

chfast commented Nov 7, 2022

There is also performance aspect of this: for initcode execution we need to validate the code and "load" it into internal representation. It may be more efficient to do both in single pass. This do not prevent implementing it with "light" failure, but is strong indicator that initcode validation is part of execution.

@gumb0
Copy link
Member

gumb0 commented Nov 7, 2022

It was originally motivated by suggestions in 3860 discussion, for failures in case initcode larger than limit: ethereum/tests#990 (comment)

So I think arguments in favor not consuming gas for invalid initcode were like:

  • no other error checked before initcode execution consumes all gas (maybe not a very big deal still to add one)
  • it's arguably better UX - don't burn all gas if we don't have to. (might be especially painful for creation transactions - easy to make mistake in initcode and all your max gas is burnt)

@chfast
Copy link
Member Author

chfast commented Nov 9, 2022

Abandoned. We decided to do it the old way, so not functional change is needed.

@chfast chfast closed this Nov 9, 2022
@chfast chfast deleted the eip-3540 branch November 9, 2022 21:45
@chfast
Copy link
Member Author

chfast commented Nov 10, 2022

See #5907

@ethereum ethereum deleted a comment from Cryptonics1 Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-update Modifies an existing proposal s-review This EIP is in Review t-core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants