Skip to content

Commit

Permalink
add multiple layouts for json input
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Dec 18, 2024
1 parent b693b5c commit f640b3e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/unit/cli/vyper_json/test_compile_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,19 @@ def baz() -> uint256:
implements: IBar
c: uint256
d: uint256
@external
def bar(a: uint256) -> bool:
return True
"""

BAR_STORAGE_LAYOUT_OVERRIDES = {
"c": {"type": "uint256", "n_slots": 1, "slot": 13},
"d": {"type": "uint256", "n_slots": 1, "slot": 7},
}

BAR_VYI = """
@external
def bar(a: uint256) -> bool:
Expand Down Expand Up @@ -96,7 +104,10 @@ def input_json(optimize, evm_version, experimental_codegen):
"evmVersion": evm_version,
"experimentalCodegen": experimental_codegen,
},
"storage_layout_overrides": {"contracts/foo.vy": FOO_STORAGE_LAYOUT_OVERRIDES},
"storage_layout_overrides": {
"contracts/foo.vy": FOO_STORAGE_LAYOUT_OVERRIDES,
"contracts/bar.vy": BAR_STORAGE_LAYOUT_OVERRIDES,
},
}


Expand Down Expand Up @@ -149,7 +160,10 @@ def test_compile_json(input_json, input_bundle):

bar_input = input_bundle.load_file("contracts/bar.vy")
bar = compile_from_file_input(
bar_input, output_formats=output_formats, input_bundle=input_bundle
bar_input,
output_formats=output_formats,
input_bundle=input_bundle,
storage_layout_override=BAR_STORAGE_LAYOUT_OVERRIDES,
)

compile_code_results = {
Expand Down

0 comments on commit f640b3e

Please sign in to comment.