From 79bf41af8631284ac45ced04c3346c961ef400cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Walter?= Date: Fri, 6 Dec 2024 17:11:57 +0100 Subject: [PATCH] Don't prune unused deps in tests and cairo_run accepts paths --- cairo/ethereum/rlp.cairo | 4 ++-- cairo/tests/fixtures/compiler.py | 2 +- cairo/tests/fixtures/runner.py | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cairo/ethereum/rlp.cairo b/cairo/ethereum/rlp.cairo index bd56ff67..c79872d4 100644 --- a/cairo/ethereum/rlp.cairo +++ b/cairo/ethereum/rlp.cairo @@ -121,7 +121,7 @@ namespace ExtendedImpl { return extended; } - func uint(value: Uint) -> Extended { + func uint(value: Uint*) -> Extended { tempvar extended = Extended( new ExtendedEnum( sequence=SequenceExtended(cast(0, SequenceExtendedStruct*)), @@ -136,7 +136,7 @@ namespace ExtendedImpl { return extended; } - func fixed_uint(value: Uint) -> Extended { + func fixed_uint(value: Uint*) -> Extended { tempvar extended = Extended( new ExtendedEnum( sequence=SequenceExtended(cast(0, SequenceExtendedStruct*)), diff --git a/cairo/tests/fixtures/compiler.py b/cairo/tests/fixtures/compiler.py index 0573e7f6..558d3ce1 100644 --- a/cairo/tests/fixtures/compiler.py +++ b/cairo/tests/fixtures/compiler.py @@ -19,7 +19,7 @@ def cairo_compile(path): module_reader = get_module_reader(cairo_path=[str(Path(__file__).parents[2])]) pass_manager = default_pass_manager( - prime=DEFAULT_PRIME, read_module=module_reader.read + prime=DEFAULT_PRIME, read_module=module_reader.read, opt_unused_functions=False ) return compile_cairo( diff --git a/cairo/tests/fixtures/runner.py b/cairo/tests/fixtures/runner.py index c66114a7..4723421f 100644 --- a/cairo/tests/fixtures/runner.py +++ b/cairo/tests/fixtures/runner.py @@ -58,19 +58,20 @@ def cairo_run(request, cairo_program, cairo_file, main_path): """ def _factory(entrypoint, *args, **kwargs): + entrypoint_path = ("__main__", *entrypoint.split(".")) implicit_args = list( cairo_program.identifiers.get_by_full_name( - ScopedName(path=("__main__", entrypoint, "ImplicitArgs")) + ScopedName(path=entrypoint_path + ("ImplicitArgs",)) ).members.keys() ) _args = { k: to_python_type(resolve_main_path(main_path)(v.cairo_type)) for k, v in cairo_program.identifiers.get_by_full_name( - ScopedName(path=("__main__", entrypoint, "Args")) + ScopedName(path=entrypoint_path + ("Args",)) ).members.items() } return_data = cairo_program.identifiers.get_by_full_name( - ScopedName(path=("__main__", entrypoint, "Return")) + ScopedName(path=entrypoint_path + ("Return",)) ) # Fix builtins runner based on the implicit args since the compiler doesn't find them cairo_program.builtins = [