Skip to content

Commit

Permalink
fix format to output dict
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed May 9, 2024
1 parent a84aacc commit aa341c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions tests/unit/cli/vyper_json/test_compile_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,17 @@ def test_compile_json(input_json, input_bundle):
"userdoc": data["userdoc"],
"metadata": data["metadata"],
"evm": {
"bytecode": {"object": data["bytecode"], "opcodes": data["opcodes"]},
"bytecode": {
"object": data["bytecode"],
"opcodes": data["opcodes"],
"sourceMap": data["source_map"]["pc_pos_map_compressed"],
"sourceMapFull": data["source_map_full"],
},
"deployedBytecode": {
"object": data["bytecode_runtime"],
"opcodes": data["opcodes_runtime"],
"sourceMap": data["source_map"]["pc_pos_map_compressed"],
"sourceMapFull": data["source_map_full"],
"sourceMap": data["source_map_runtime"]["pc_pos_map_compressed"],
"sourceMapFull": data["source_map_full_runtime"],
},
"methodIdentifiers": data["method_identifiers"],
},
Expand Down
4 changes: 2 additions & 2 deletions vyper/cli/vyper_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def format_to_output_dict(compiler_data: dict) -> dict:

evm_keys = ("bytecode", "opcodes")
pc_maps_keys = ("source_map", "source_map_full")
if any(i in data for i in evm_keys) or any(i in data for i in pc_maps_keys):
if any(i in data for i in evm_keys + pc_maps_keys):
evm = output_contracts.setdefault("evm", {}).setdefault("bytecode", {})
if "bytecode" in data:
evm["object"] = data["bytecode"]
Expand All @@ -355,7 +355,7 @@ def format_to_output_dict(compiler_data: dict) -> dict:
if "source_map_full" in data:
evm["sourceMapFull"] = data["source_map_full"]

if any(i + "_runtime" in data for i in evm_keys):
if any(i + "_runtime" in data for i in evm_keys + pc_maps_keys):
evm = output_contracts.setdefault("evm", {}).setdefault("deployedBytecode", {})
if "bytecode_runtime" in data:
evm["object"] = data["bytecode_runtime"]
Expand Down

0 comments on commit aa341c1

Please sign in to comment.