-
-
Notifications
You must be signed in to change notification settings - Fork 800
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[lang]: add raw_create()
builtin
#4204
base: master
Are you sure you want to change the base?
Conversation
raw_create()
builtin
let's also update the docs please |
vyper/builtins/functions.py
Outdated
ret.append(copy_bytes(buf, bytes_data_ptr(initcode), bytecode_len, maxlen)) | ||
|
||
argbuf = add_ofst(buf, bytecode_len) | ||
argslen = abi_encode(argbuf, to_encode, context, bufsz=bufsz, returns_len=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this reminds of something: #4202
vyper/builtins/functions.py
Outdated
|
||
argbuf = add_ofst(buf, bytecode_len) | ||
argslen = abi_encode(argbuf, to_encode, context, bufsz=bufsz, returns_len=True) | ||
total_len = add_ofst(argbuf, argslen) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this is wrong - isn't the length now absolute wrt 0?
shouldn't it be smth like total_len = ["sub", add_ofst(argbuf, argslen), buf]
bytecode_len = get_bytearray_length(initcode) | ||
|
||
maxlen = initcode.typ.maxlen | ||
ret.append(copy_bytes(buf, bytes_data_ptr(initcode), bytecode_len, maxlen)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it shouldn't be problematic that copy_bytes
might pad to ceil32
, right?
it might copy some dirty data, but if arguments are provided, those should overwrite it
if no args are provided, we still operate with bytecode_len
which will lead to ignoring the dirty data
can we please add tests for the rest of the kws? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4204 +/- ##
==========================================
- Coverage 91.35% 88.79% -2.56%
==========================================
Files 109 109
Lines 15635 15667 +32
Branches 3443 3445 +2
==========================================
- Hits 14283 13912 -371
- Misses 920 1244 +324
- Partials 432 511 +79 ☔ View full report in Codecov by Sentry. |
Can we ship this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR is a good opportunity to discuss the following:
- How do you feel about extending the PR to include my issue here as well: Bubble up revert errors for
create
built-ins #4147? - The built-in is great but to increase the overall devex, we need to bundle it with some type information feature for contracts: i.e.
erc20.creation_code
,erc20.runtime_code
,erc20.interface_id
. Thecreation_code
information can be super useful here.
What I did
implement #3710
How I did it
How to verify it
Commit message
Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)
Description for the changelog
Cute Animal Picture