fix[tool]: fix output formats for .vyz files#4338
fix[tool]: fix output formats for .vyz files#4338charles-cooper merged 25 commits intovyperlang:masterfrom
Conversation
run the format name through the translate map. for instance, `-f annotated_ast` was not working for `.vyz` files.
|
let's add this def test_archive_compile_options(input_files):
tmpdir, _, _, contract_file = input_files
search_paths = [".", tmpdir]
options = ["abi_python", "json", "ast", "annotated_ast", "ir_json"]
for option in options:
out = compile_files([contract_file], ["archive_b64", option], paths=search_paths)
archive_b64 = out[contract_file].pop("archive_b64")
archive_path = Path("foo.zip.b64")
with archive_path.open("w") as f:
f.write(archive_b64)
# compare compiling the two input bundles
out2 = compile_files([archive_path], [option])
if option in ["ast", "annotated_ast"]:
# would have to normalize paths and imports, so just verify it compiles
continue
assert out[contract_file] == out2[archive_path] |
…ormats add test for archive compile options
| continue | ||
|
|
||
| if option in ["ir_runtime", "ir", "asm", "archive", "solc_json"]: | ||
| # TODO investigate why these don't pass the assert |
There was a problem hiding this comment.
the should be correct, but would like to explore this before approving
There was a problem hiding this comment.
i suspect that has to do with codegen.reset_names(), which was fixed in 8f433f8
There was a problem hiding this comment.
cf. as well: vyper/ir/compile_ir.py:_next_symbol may need to be reset.
There was a problem hiding this comment.
the assembly one should be fixed here: e09f589
the others might need a bit more investigation. but i think the important thing here is that the bytecode output and integrity hashes are the same; if some metadata is different that is not such a big deal.
There was a problem hiding this comment.
debugged this a bit further and got the following:
def _eq_helper(ir1, ir2):
assert isinstance(ir1, IRnode) and isinstance(ir2, IRnode)
for n1, n2 in zip(ir1.args, ir2.args):
if n1 != n2:
if isinstance(n1, IRnode) and n1.value == "external_contract":
print("value comparison:", n1.value == n2.value)
print("args comparison:", n1.args == n2.args)
print("typ comparison:", n1.typ == n2.typ)
print("location comparison:", n1.location == n2.location)
print("mutable comparison:", n1.mutable == n2.mutable)
print("add_gas_estimate comparison:", n1.add_gas_estimate == n2.add_gas_estimate)
if isinstance(n1, IRnode):
_eq_helper(n1, n2
_eq_helper(out[contract_file]['ir_runtime'], out2[archive_path]['ir_runtime'])output:
value comparison: True
args comparison: True
typ comparison: False
location comparison: True
mutable comparison: True
add_gas_estimate comparison: True
typ is InterfaceT where we don't have def __eq__(self, other): method but inherit from _UserType which defines:
def __eq__(self, other):
return self is otheredit: update formatting
these should have been failing before, but --debug was not getting passed correctly to compiler phases
| if debug and optimize == OptimizationLevel.CODESIZE: | ||
| # FIXME: some round-trips fail when debug is enabled due to labels | ||
| # not getting pinned | ||
| request.node.add_marker(pytest.mark.xfail(strict=False)) |
There was a problem hiding this comment.
to extract this to a new issue
What I did
How I did it
How to verify it
Commit message
Description for the changelog
Cute Animal Picture