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[tool]: support storage layouts via json and vyz #4370

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

Conversation

tserg
Copy link
Collaborator

@tserg tserg commented Nov 23, 2024

What I did

Resolves #4367

How I did it

  • For solc_json and archive outputs, emit the storage layout as output if it was overriden.
  • Extract a storage layout for solc_json and archive inputs if provided.

How to verify it

See tests.

Commit message

feat[tool]: support storage layouts via json and xyz

This commit adds support for overriding the storage layout
using `solc_json` and archive inputs, and consequently
adding the storage layout if it was provided to these formats 
as output.

Description for the changelog

Cute Animal Picture

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

Copy link

codecov bot commented Nov 24, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 3 lines in your changes missing coverage. Please review.

Project coverage is 88.83%. Comparing base (e98e004) to head (c8f42e1).

Files with missing lines Patch % Lines
vyper/cli/vyper_json.py 84.61% 1 Missing and 1 partial ⚠️
vyper/compiler/output_bundle.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4370      +/-   ##
==========================================
- Coverage   91.31%   88.83%   -2.49%     
==========================================
  Files         113      113              
  Lines       16061    16092      +31     
  Branches     2703     2709       +6     
==========================================
- Hits        14666    14295     -371     
- Misses        964     1286     +322     
- Partials      431      511      +80     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tserg
Copy link
Collaborator Author

tserg commented Nov 24, 2024

@charles-cooper requesting a review before I update the docs

@tserg tserg marked this pull request as ready for review November 24, 2024 09:36
storage_layout_overrides: dict[PurePath, StorageLayout] = {}

for path, value in input_dict.get("storage_layout_overrides", {}).items():
if path not in input_dict["sources"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess we can have contracts which do not have corresponding override files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think that's fine, since each key in "sources" is a compilation target.

Copy link
Member

@charles-cooper charles-cooper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks overall pretty good to me. left a few comments. @cyberthirst could you also take a look?

@@ -12,6 +12,7 @@
from vyper.compiler.settings import Settings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for verification, storage layout override can (and should) affect integrity hash.

@charles-cooper charles-cooper changed the title feat[tool]: support storage layouts via json and xyz feat[tool]: support storage layouts via json and vyz Nov 26, 2024
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.

tool: allow storage layout overrides in standard-json and vyz files
2 participants