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

create_forwarder_to does not revert on creation failure #2890

Closed
Tracked by #2857
charles-cooper opened this issue Jun 3, 2022 · 2 comments · Fixed by #2895
Closed
Tracked by #2857

create_forwarder_to does not revert on creation failure #2890

charles-cooper opened this issue Jun 3, 2022 · 2 comments · Fixed by #2895
Labels
codegen issue with codegen

Comments

@charles-cooper
Copy link
Member

charles-cooper commented Jun 3, 2022

Version Information

  • vyper Version (output of vyper --version): 90e3d20
  • Python Version (output of python --version): v3.8.10

What's your issue about?

while implementing create() and create_copy_of() (see #2889), i realized that CREATE and CREATE2 opcodes don't bubble up failure of the initcode, instead they return a zero address. for safety, i decided the implementation should check the zero address case. but, the existing implementation of create_forwarder_to() (see below) does not check for the zero case. i'm actually not sure what the ideal behavior here is, because if there is a collision, it most likely means that the code you intended to deploy is already deployed.

return IRnode.from_list(
[
"seq",
["mstore", placeholder, forwarder_preamble],
["mstore", ["add", placeholder, preamble_length], target_address],
["mstore", ["add", placeholder, preamble_length + 20], forwarder_post],
[op, *op_args],
],
typ=BaseType("address"),
add_gas_estimate=11000,
)

How can it be fixed?

@charles-cooper charles-cooper added the codegen issue with codegen label Jun 3, 2022
@charles-cooper
Copy link
Member Author

meeting notes: should revert

@charles-cooper
Copy link
Member Author

todo: add allow_failure= flag of some sort to allow customization of the behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codegen issue with codegen
Projects
None yet
1 participant