-
-
Notifications
You must be signed in to change notification settings - Fork 812
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
fix[tool]: fix output formats for .vyz files #4338
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the should be correct, but would like to explore this before approving
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i suspect that has to do with codegen.reset_names(), which was fixed in 8f433f8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cf. as well: vyper/ir/compile_ir.py:_next_symbol
may need to be reset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 other
edit: update formatting
these should have been failing before, but --debug was not getting passed correctly to compiler phases
run the format name through the translate map. for instance,
-f annotated_ast
was not working for.vyz
files.What I did
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