Skip to content
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

feat: cairo_run for functions in namespaces #220

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cairo/ethereum/rlp.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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*)),
Expand All @@ -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*)),
Expand Down
2 changes: 1 addition & 1 deletion cairo/tests/fixtures/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 4 additions & 3 deletions cairo/tests/fixtures/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
Loading