From a44413e118c1d5eca58553c607267b896790e96c Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Thu, 25 Apr 2024 16:46:28 +0200 Subject: [PATCH] scarb struct return --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- .../recursive_with_poseidon/run_simple_bootloader.cairo | 4 ++++ cairo1/src/lib.cairo | 8 ++++++-- runner/src/main.rs | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 420c43c..3e7a409 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -721,7 +721,7 @@ dependencies = [ [[package]] name = "cairo-vm" version = "1.0.0-rc1" -source = "git+https://github.com/lambdaclass/cairo-vm#3f1f9ecfffcc52e6d30ce3254b55a7b7cb94eb7f" +source = "git+https://github.com/Okm165/cairo-vm.git#5a910f8c65d35b6d206e78912768a2186b81a2c0" dependencies = [ "anyhow", "ark-ff", @@ -755,7 +755,7 @@ dependencies = [ [[package]] name = "cairo1-run" version = "1.0.0-rc1" -source = "git+https://github.com/lambdaclass/cairo-vm#3f1f9ecfffcc52e6d30ce3254b55a7b7cb94eb7f" +source = "git+https://github.com/Okm165/cairo-vm.git#5a910f8c65d35b6d206e78912768a2186b81a2c0" dependencies = [ "assert_matches", "bincode", diff --git a/Cargo.toml b/Cargo.toml index da28865..5298077 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ version = "0.1.0" [workspace.dependencies] cairo-lang-compiler = { version = "2.5.4", default-features = false } cairo-lang-sierra = { version = "2.5.4", default-features = false } -cairo-vm = { git = "https://github.com/lambdaclass/cairo-vm", features = ["std"] } -cairo1-run = { git = "https://github.com/lambdaclass/cairo-vm" } +cairo-vm = { git = "https://github.com/Okm165/cairo-vm.git" } +cairo1-run = { git = "https://github.com/Okm165/cairo-vm.git" } clap = { version = "4.3.10", features = ["derive"] } serde_json = "1" \ No newline at end of file diff --git a/cairo0-bootloader/bootloader/recursive_with_poseidon/run_simple_bootloader.cairo b/cairo0-bootloader/bootloader/recursive_with_poseidon/run_simple_bootloader.cairo index 4c6cc9d..35742e3 100644 --- a/cairo0-bootloader/bootloader/recursive_with_poseidon/run_simple_bootloader.cairo +++ b/cairo0-bootloader/bootloader/recursive_with_poseidon/run_simple_bootloader.cairo @@ -124,6 +124,8 @@ struct Input { } struct Output { + a_2: felt, + b_2: felt, c_2: felt, } @@ -176,6 +178,8 @@ func execute_tasks{builtin_ptrs: BuiltinData*, self_range_check_ptr}( let output = cast(builtin_ptrs.output - Output.SIZE, Output*); %{ + print(ids.output.a_2) + print(ids.output.b_2) print(ids.output.c_2) %} diff --git a/cairo1/src/lib.cairo b/cairo1/src/lib.cairo index 3587b86..0352d5e 100644 --- a/cairo1/src/lib.cairo +++ b/cairo1/src/lib.cairo @@ -11,7 +11,7 @@ struct Output { c_2: u32, } -fn main(input: Array) -> u32 { +fn main(input: Array) -> Output { let mut input_span = input.span(); let input = Serde::::deserialize(ref input_span).unwrap(); @@ -20,5 +20,9 @@ fn main(input: Array) -> u32 { let c_2 = input.c * input.c; assert (a_2 + b_2 == c_2, 'invalid value'); - c_2*5 + Output { + a_2, + b_2, + c_2, + } } \ No newline at end of file diff --git a/runner/src/main.rs b/runner/src/main.rs index 20df37f..72deb95 100644 --- a/runner/src/main.rs +++ b/runner/src/main.rs @@ -31,7 +31,7 @@ fn main() -> std::io::Result<()> { &sierra_program, Cairo1RunConfig { args: &args.args.0, - layout: LayoutName::recursive_with_poseidon, + layout: LayoutName::all_cairo, finalize_builtins: true, serialize_output: true, append_return_values: true,