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

feat: add raw_args kwarg to create_from_blueprint #2996

Merged
merged 3 commits into from
Jul 29, 2022

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Jul 27, 2022

What I did

How I did it

How to verify it

@external
def foo(addr: address, argdata: Bytes[1024]) -> address:
    return create_from_blueprint(addr, argdata, raw_args=True)

Commit message

this commit adds a `raw_args` kwarg to `create_from_blueprint`, allowing
the user to append arbitrary data to the initcode after extcodecopy
(instead of ABI encoding the provided varargs). this is important for
a variety of use cases:

- generic create (where the initcode args cannot be specialized at
  compile time)
- custom arg decoders in the initcode (which may for instance be written
  in assembly)
- other use cases for arbitrary auxdata which haven't been thought of
  yet :)

Description for the changelog

Cute Animal Picture

image

@banteg
Copy link

banteg commented Jul 27, 2022

example where it's useful

# @version 0.3.4
event Built:
    user: indexed(address)
    blueprint: indexed(address)
    instance: indexed(address)
    args: Bytes[1024]


@external
def build(blueprint: address, args: Bytes[1024]) -> address:
    instance: address = create_from_blueprint(blueprint, args, raw_args=True)
    log Built(msg.sender, blueprint, instance, args)
    return instance

@codecov-commenter
Copy link

codecov-commenter commented Jul 27, 2022

Codecov Report

Merging #2996 (81fc6d3) into master (f31f0ec) will decrease coverage by 0.01%.
The diff coverage is 81.81%.

@@            Coverage Diff             @@
##           master    #2996      +/-   ##
==========================================
- Coverage   88.29%   88.28%   -0.02%     
==========================================
  Files          97       97              
  Lines       10919    10925       +6     
  Branches     2583     2585       +2     
==========================================
+ Hits         9641     9645       +4     
- Misses        830      831       +1     
- Partials      448      449       +1     
Impacted Files Coverage Δ
vyper/builtin_functions/functions.py 90.28% <81.81%> (-0.12%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us.

@charles-cooper charles-cooper added this to the v0.3.5 milestone Jul 28, 2022
@charles-cooper charles-cooper merged commit 7180ddd into vyperlang:master Jul 29, 2022
@charles-cooper charles-cooper deleted the feat/create_raw_args branch July 29, 2022 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants