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[lang]: add raw_create() builtin #4204

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Aug 8, 2024

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

Put a link to a cute animal picture inside the parenthesis-->

@charles-cooper charles-cooper marked this pull request as draft August 8, 2024 14:01
@charles-cooper charles-cooper added this to the v0.4.1 milestone Aug 8, 2024
@charles-cooper charles-cooper changed the title feat: implement raw_create feat[lang]: add raw_create() builtin Aug 8, 2024
@cyberthirst
Copy link
Collaborator

let's also update the docs please

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)
Copy link
Collaborator

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


argbuf = add_ofst(buf, bytecode_len)
argslen = abi_encode(argbuf, to_encode, context, bufsz=bufsz, returns_len=True)
total_len = add_ofst(argbuf, argslen)
Copy link
Collaborator

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]

@charles-cooper charles-cooper marked this pull request as ready for review August 27, 2024 14:58
bytecode_len = get_bytearray_length(initcode)

maxlen = initcode.typ.maxlen
ret.append(copy_bytes(buf, bytes_data_ptr(initcode), bytecode_len, maxlen))
Copy link
Collaborator

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

@cyberthirst
Copy link
Collaborator

can we please add tests for the rest of the kws?

Copy link

codecov bot commented Sep 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.79%. Comparing base (f909d6e) to head (8a07ccb).
Report is 5 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

@pcaversaccio
Copy link
Collaborator

Can we ship this PR?

Copy link
Collaborator

@pcaversaccio pcaversaccio left a 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. The creation_code information can be super useful here.

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