diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 449dfe9..1b3ccda 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -31,7 +31,7 @@ jobs: - name: Increase stack size run: | - echo "Setting stack size to 4MB" + echo "Setting stack size to 8MB" echo "RUST_MIN_STACK=4194304" >> $GITHUB_ENV - name: Run cargo test diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 63cfb55..be6a24c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,8 +34,8 @@ jobs: - name: Increase stack size run: | - echo "Setting stack size to 4MB" - echo "RUST_MIN_STACK=4194304" >> $GITHUB_ENV + echo "Setting stack size to 8MB" + echo "RUST_MIN_STACK=8388608" >> $GITHUB_ENV - name: Run cargo test run: cargo test --all-features @@ -78,8 +78,8 @@ jobs: - name: Increase stack size run: | - echo "Setting stack size to 4MB" - echo "RUST_MIN_STACK=4194304" >> $GITHUB_ENV + echo "Setting stack size to 8MB" + echo "RUST_MIN_STACK=8388608" >> $GITHUB_ENV - name: Run cargo test run: cargo test --all-features diff --git a/tests/cli/tests.sh b/tests/cli/tests.sh old mode 100644 new mode 100755 index a16aa16..4f91653 --- a/tests/cli/tests.sh +++ b/tests/cli/tests.sh @@ -1,4 +1,153 @@ +# Integration tests for the CLI +# tests against +# 1. https://github.com/zksecurity/stark-evm-adapter.git +# 2. https://github.com/HerodotusDev/integrity.git +# 3. https://github.com/zksecurity/integrity-calldata-generator.git -> forked because the CLI implementation also relies on the fork + #!/bin/bash +set -e + +# Set main directory +MAIN_DIR=$(pwd) + +# Install stone-cli +cargo install --path . + +# Create and verify bootloader proof on Ethereum +echo "Creating and verifying bootloader proof on Ethereum" + +stone-cli prove-bootloader \ + --cairo_programs examples/cairo0/array_sum.json \ + --parameter_file ./tests/configs/bootloader_cpu_air_params.json \ + --output bootloader_proof.json +echo "Proof generated" + +stone-cli verify \ + --proof bootloader_proof.json \ + --annotation_file annotation.json \ + --extra_output_file extra_output.json \ + --stone_version v5 +echo "Proof verified" + +stone-cli serialize-proof \ + --proof bootloader_proof.json \ + --annotation_file annotation.json \ + --extra_output_file extra_output.json \ + --network ethereum \ + --output bootloader_serialized_proof.json +echo "Proof serialized" + +git clone https://github.com/zksecurity/stark-evm-adapter.git +cd $MAIN_DIR/stark-evm-adapter/ +URL=https://rpc.tenderly.co/fork/f4839248-30b4-4451-b1da-93ebb124c73f \ +ANNOTATED_PROOF=../bootloader_serialized_proof.json \ +FACT_TOPOLOGIES=../fact_topologies.json \ +cargo run --example verify_stone_proof +echo "Proof verified on Ethereum" + +# Create and verify proof on Starknet +echo "Creating and verifying proof on Starknet" +cd $MAIN_DIR +stone-cli prove \ + --cairo_program tests/resources/integrity-programs/cairo0_fibonacci_recursive_builtins.json \ + --cairo_version cairo0 \ + --layout recursive \ + --output cairo0_fibonacci_recursive_builtins_stone5_keccak_160_lsb.json \ + --stone_version v5 +echo "Proof generated" + +# Serialize proof +stone-cli serialize-proof \ + --proof cairo0_fibonacci_recursive_builtins_stone5_keccak_160_lsb.json \ + --network starknet \ + --serialization_type monolith \ + --output cairo0_fibonacci_recursive_builtins_stone5_keccak_160_lsb +echo "Monolith proof serialized" + +# Clone integrity repo +if [ ! -d "integrity" ]; then + git clone https://github.com/HerodotusDev/integrity.git +fi +cd $MAIN_DIR/integrity/ +echo "Integrity repo cloned" + +# Install sncast if it doesn't exist +if ! command -v sncast &> /dev/null; then + echo "sncast not found, installing snfoundryup..." + curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh + export PATH="/root/.local/bin:$PATH" + source $HOME/.bashrc + snfoundryup + sncast --version + echo "sncast installed" +fi + +# Create starknet accounts directory and file if they don't exist +mkdir -p ~/.starknet_accounts + +# Write account config to file (monolith proof uses `my-sepolia-account` and split proof uses `my_account`) +cat > ~/.starknet_accounts/starknet_open_zeppelin_accounts.json << 'EOL' +{ + "alpha-sepolia": { + "my-sepolia-account": { + "address": "0x5044ea2b88229bb5a1ff5424ee746ed1a12541b9a1ec14e767d02c67ddb1fc1", + "class_hash": "0xe2eb8f5672af4e6a4e8a8f1b44989685e668489b0a25437733756c5a34a1d6", + "deployed": true, + "legacy": false, + "private_key": "0x713504d58868bbbf4b6447842b2e797f1a344a364a5298b07e3b9e93eab06dc", + "public_key": "0x144a636155881974dcc21193786db7d879c6edf4646a17d6a5559034ef7a802", + "salt": "0xd1531c0bb45f4634", + "type": "open_zeppelin" + }, + "my_account": { + "address": "0x5dd7aa049cfd03cc0d95ec6d562dda8321f8681e4a9635c57aefa738c8a3661", + "class_hash": "0xe2eb8f5672af4e6a4e8a8f1b44989685e668489b0a25437733756c5a34a1d6", + "deployed": true, + "legacy": false, + "private_key": "0x5908f00352439ab34724e7d50681fe2303c03ac52d0c2f02e2ac254e05bcd8a", + "public_key": "0x7aa593b1fd343fc8079feee02cd253a10b6efeca294b689d94c474a3a6907b9", + "salt": "0x479a8932e6bc52ad", + "type": "open_zeppelin" + } + } +} +EOL +echo "Starknet accounts file created" + +./verify-on-starknet.sh \ + 0x16409cfef9b6c3e6002133b61c59d09484594b37b8e4daef7dcba5495a0ef1a \ + ../cairo0_fibonacci_recursive_builtins_stone5_keccak_160_lsb \ + recursive \ + keccak_160_lsb \ + stone5 \ + cairo0 +echo "Monolith proof verified on Starknet" + +cd $MAIN_DIR +stone-cli serialize-proof \ + --proof cairo0_fibonacci_recursive_builtins_stone5_keccak_160_lsb.json \ + --network starknet \ + --serialization_type split \ + --output_dir split_proofs \ + --layout recursive +echo "Split proof serialized" + +# Verify split proofs using the integrity-calldata-generator repo +cd $MAIN_DIR +if [ ! -d "integrity-calldata-generator" ]; then + GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/zksecurity/integrity-calldata-generator +fi +echo "integrity-calldata-generator repo cloned" + +# Copy split proofs to integrity-calldata-generator +cp -r $MAIN_DIR/split_proofs/* $MAIN_DIR/integrity-calldata-generator/cli/calldata/ + +# Generate random job id +JOB_ID=$(shuf -i 1-10000000000000 -n 1) +echo "Generated random job id: $JOB_ID" + +# Run verify.sh +cd $MAIN_DIR/integrity-calldata-generator/cli +./verify.sh $JOB_ID recursive keccak_160_lsb stone5 cairo0 -# CLI Integration Tests -# (might take a while) +echo "Split proof verified on Starknet" diff --git a/tests/resources/integrity-programs/cairo0_fibonacci_recursive_builtins.cairo b/tests/resources/integrity-programs/cairo0_fibonacci_recursive_builtins.cairo new file mode 100644 index 0000000..cb54863 --- /dev/null +++ b/tests/resources/integrity-programs/cairo0_fibonacci_recursive_builtins.cairo @@ -0,0 +1,43 @@ +// Copyright 2023 StarkWare Industries Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.starkware.co/open-source-license/ +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions +// and limitations under the License. + +%builtins output pedersen range_check bitwise +func main( + output_ptr: felt*, pedersen_ptr: felt*, range_check_ptr: felt*, bitwise_ptr: felt*) -> ( + output_ptr: felt*, pedersen_ptr: felt*, range_check_ptr: felt*, bitwise_ptr: felt* + ) { + alloc_locals; + + // Copy fibonacci_claim_index to the output segment. + local fibonacci_claim_index = 10000; + + assert output_ptr[0] = fibonacci_claim_index; + let res = fib(1, 1, fibonacci_claim_index); + assert output_ptr[1] = res; + + // Return the updated output_ptr. + return ( + output_ptr=&output_ptr[2], pedersen_ptr=pedersen_ptr, range_check_ptr=range_check_ptr, bitwise_ptr=bitwise_ptr + ); +} + +func fib(first_element: felt, second_element: felt, n: felt) -> felt { + if (n == 0) { + return second_element; + } + + return fib( + first_element=second_element, second_element=first_element + second_element, n=n - 1 + ); +} \ No newline at end of file diff --git a/tests/resources/integrity-programs/cairo0_fibonacci_recursive_builtins.json b/tests/resources/integrity-programs/cairo0_fibonacci_recursive_builtins.json new file mode 100644 index 0000000..df0ea1e --- /dev/null +++ b/tests/resources/integrity-programs/cairo0_fibonacci_recursive_builtins.json @@ -0,0 +1,1094 @@ +{ + "attributes": [], + "builtins": [ + "output", + "pedersen", + "range_check", + "bitwise" + ], + "compiler_version": "0.13.2", + "data": [ + "0x40780017fff7fff", + "0x4", + "0x1104800180018000", + "0x4", + "0x10780017fff7fff", + "0x0", + "0x40780017fff7fff", + "0x1", + "0x400780017fff8000", + "0x2710", + "0x400380007ffa8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x1", + "0x480a80007fff8000", + "0x1104800180018000", + "0x9", + "0x400280017ffa7fff", + "0x482680017ffa8000", + "0x2", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x20780017fff7ffd", + "0x4", + "0x480a7ffc7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffc7fff8000", + "0x482a7ffc7ffb8000", + "0x482680017ffd8000", + "0x800000000000011000000000000000000000000000000000000000000000000", + "0x1104800180018000", + "0x800000000000010fffffffffffffffffffffffffffffffffffffffffffffff9", + "0x208b7fff7fff7ffe" + ], + "debug_info": { + "file_contents": { + "": "__start__:\nap += main.Args.SIZE + main.ImplicitArgs.SIZE;\ncall main;\n\n__end__:\njmp rel 0;\n" + }, + "instruction_locations": { + "0": { + "accessible_scopes": [ + "__main__" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 0, + "offset": 0 + }, + "reference_ids": {} + }, + "hints": [], + "inst": { + "end_col": 46, + "end_line": 2, + "input_file": { + "filename": "" + }, + "start_col": 1, + "start_line": 2 + } + }, + "2": { + "accessible_scopes": [ + "__main__" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 0, + "offset": 4 + }, + "reference_ids": {} + }, + "hints": [], + "inst": { + "end_col": 10, + "end_line": 3, + "input_file": { + "filename": "" + }, + "start_col": 1, + "start_line": 3 + } + }, + "4": { + "accessible_scopes": [ + "__main__" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 1, + "offset": 0 + }, + "reference_ids": {} + }, + "hints": [], + "inst": { + "end_col": 10, + "end_line": 6, + "input_file": { + "filename": "" + }, + "start_col": 1, + "start_line": 6 + } + }, + "6": { + "accessible_scopes": [ + "__main__", + "__main__.main" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 2, + "offset": 0 + }, + "reference_ids": { + "__main__.main.bitwise_ptr": 3, + "__main__.main.output_ptr": 0, + "__main__.main.pedersen_ptr": 1, + "__main__.main.range_check_ptr": 2 + } + }, + "hints": [], + "inst": { + "end_col": 18, + "end_line": 19, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 5, + "start_line": 19 + } + }, + "8": { + "accessible_scopes": [ + "__main__", + "__main__.main" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 2, + "offset": 1 + }, + "reference_ids": { + "__main__.main.bitwise_ptr": 3, + "__main__.main.output_ptr": 0, + "__main__.main.pedersen_ptr": 1, + "__main__.main.range_check_ptr": 2 + } + }, + "hints": [], + "inst": { + "end_col": 41, + "end_line": 22, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 5, + "start_line": 22 + } + }, + "10": { + "accessible_scopes": [ + "__main__", + "__main__.main" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 2, + "offset": 1 + }, + "reference_ids": { + "__main__.main.bitwise_ptr": 3, + "__main__.main.fibonacci_claim_index": 4, + "__main__.main.output_ptr": 0, + "__main__.main.pedersen_ptr": 1, + "__main__.main.range_check_ptr": 2 + } + }, + "hints": [], + "inst": { + "end_col": 50, + "end_line": 24, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 5, + "start_line": 24 + } + }, + "11": { + "accessible_scopes": [ + "__main__", + "__main__.main" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 2, + "offset": 1 + }, + "reference_ids": { + "__main__.main.bitwise_ptr": 3, + "__main__.main.fibonacci_claim_index": 4, + "__main__.main.output_ptr": 0, + "__main__.main.pedersen_ptr": 1, + "__main__.main.range_check_ptr": 2 + } + }, + "hints": [], + "inst": { + "end_col": 20, + "end_line": 25, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 19, + "start_line": 25 + } + }, + "13": { + "accessible_scopes": [ + "__main__", + "__main__.main" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 2, + "offset": 2 + }, + "reference_ids": { + "__main__.main.bitwise_ptr": 3, + "__main__.main.fibonacci_claim_index": 4, + "__main__.main.output_ptr": 0, + "__main__.main.pedersen_ptr": 1, + "__main__.main.range_check_ptr": 2 + } + }, + "hints": [], + "inst": { + "end_col": 23, + "end_line": 25, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 22, + "start_line": 25 + } + }, + "15": { + "accessible_scopes": [ + "__main__", + "__main__.main" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 2, + "offset": 3 + }, + "reference_ids": { + "__main__.main.bitwise_ptr": 3, + "__main__.main.fibonacci_claim_index": 4, + "__main__.main.output_ptr": 0, + "__main__.main.pedersen_ptr": 1, + "__main__.main.range_check_ptr": 2 + } + }, + "hints": [], + "inst": { + "end_col": 32, + "end_line": 22, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "parent_location": [ + { + "end_col": 46, + "end_line": 25, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 25, + "start_line": 25 + }, + "While expanding the reference 'fibonacci_claim_index' in:" + ], + "start_col": 11, + "start_line": 22 + } + }, + "16": { + "accessible_scopes": [ + "__main__", + "__main__.main" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 2, + "offset": 4 + }, + "reference_ids": { + "__main__.main.bitwise_ptr": 3, + "__main__.main.fibonacci_claim_index": 4, + "__main__.main.output_ptr": 0, + "__main__.main.pedersen_ptr": 1, + "__main__.main.range_check_ptr": 2 + } + }, + "hints": [], + "inst": { + "end_col": 47, + "end_line": 25, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 15, + "start_line": 25 + } + }, + "18": { + "accessible_scopes": [ + "__main__", + "__main__.main" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 3, + "offset": 0 + }, + "reference_ids": { + "__main__.main.bitwise_ptr": 3, + "__main__.main.fibonacci_claim_index": 4, + "__main__.main.output_ptr": 0, + "__main__.main.pedersen_ptr": 1, + "__main__.main.range_check_ptr": 2, + "__main__.main.res": 5 + } + }, + "hints": [], + "inst": { + "end_col": 32, + "end_line": 26, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 5, + "start_line": 26 + } + }, + "19": { + "accessible_scopes": [ + "__main__", + "__main__.main" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 3, + "offset": 0 + }, + "reference_ids": { + "__main__.main.bitwise_ptr": 3, + "__main__.main.fibonacci_claim_index": 4, + "__main__.main.output_ptr": 0, + "__main__.main.pedersen_ptr": 1, + "__main__.main.range_check_ptr": 2, + "__main__.main.res": 5 + } + }, + "hints": [], + "inst": { + "end_col": 34, + "end_line": 30, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 21, + "start_line": 30 + } + }, + "21": { + "accessible_scopes": [ + "__main__", + "__main__.main" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 3, + "offset": 1 + }, + "reference_ids": { + "__main__.main.bitwise_ptr": 3, + "__main__.main.fibonacci_claim_index": 4, + "__main__.main.output_ptr": 0, + "__main__.main.pedersen_ptr": 1, + "__main__.main.range_check_ptr": 2, + "__main__.main.res": 5 + } + }, + "hints": [], + "inst": { + "end_col": 49, + "end_line": 16, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "parent_location": [ + { + "end_col": 34, + "end_line": 31, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 22, + "start_line": 31 + }, + "While expanding the reference 'pedersen_ptr' in:" + ], + "start_col": 30, + "start_line": 16 + } + }, + "22": { + "accessible_scopes": [ + "__main__", + "__main__.main" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 3, + "offset": 2 + }, + "reference_ids": { + "__main__.main.bitwise_ptr": 3, + "__main__.main.fibonacci_claim_index": 4, + "__main__.main.output_ptr": 0, + "__main__.main.pedersen_ptr": 1, + "__main__.main.range_check_ptr": 2, + "__main__.main.res": 5 + } + }, + "hints": [], + "inst": { + "end_col": 73, + "end_line": 16, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "parent_location": [ + { + "end_col": 40, + "end_line": 32, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 25, + "start_line": 32 + }, + "While expanding the reference 'range_check_ptr' in:" + ], + "start_col": 51, + "start_line": 16 + } + }, + "23": { + "accessible_scopes": [ + "__main__", + "__main__.main" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 3, + "offset": 3 + }, + "reference_ids": { + "__main__.main.bitwise_ptr": 3, + "__main__.main.fibonacci_claim_index": 4, + "__main__.main.output_ptr": 0, + "__main__.main.pedersen_ptr": 1, + "__main__.main.range_check_ptr": 2, + "__main__.main.res": 5 + } + }, + "hints": [], + "inst": { + "end_col": 93, + "end_line": 16, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "parent_location": [ + { + "end_col": 32, + "end_line": 33, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 21, + "start_line": 33 + }, + "While expanding the reference 'bitwise_ptr' in:" + ], + "start_col": 75, + "start_line": 16 + } + }, + "24": { + "accessible_scopes": [ + "__main__", + "__main__.main" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 3, + "offset": 4 + }, + "reference_ids": { + "__main__.main.bitwise_ptr": 3, + "__main__.main.fibonacci_claim_index": 4, + "__main__.main.output_ptr": 0, + "__main__.main.pedersen_ptr": 1, + "__main__.main.range_check_ptr": 2, + "__main__.main.res": 5 + } + }, + "hints": [], + "inst": { + "end_col": 7, + "end_line": 34, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 5, + "start_line": 29 + } + }, + "25": { + "accessible_scopes": [ + "__main__", + "__main__.fib" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 4, + "offset": 0 + }, + "reference_ids": { + "__main__.fib.first_element": 6, + "__main__.fib.n": 8, + "__main__.fib.second_element": 7 + } + }, + "hints": [], + "inst": { + "end_col": 7, + "end_line": 38, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 5, + "start_line": 38 + } + }, + "27": { + "accessible_scopes": [ + "__main__", + "__main__.fib" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 4, + "offset": 0 + }, + "reference_ids": { + "__main__.fib.first_element": 6, + "__main__.fib.n": 8, + "__main__.fib.second_element": 7 + } + }, + "hints": [], + "inst": { + "end_col": 51, + "end_line": 37, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "parent_location": [ + { + "end_col": 30, + "end_line": 39, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 16, + "start_line": 39 + }, + "While expanding the reference 'second_element' in:" + ], + "start_col": 31, + "start_line": 37 + } + }, + "28": { + "accessible_scopes": [ + "__main__", + "__main__.fib" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 4, + "offset": 1 + }, + "reference_ids": { + "__main__.fib.first_element": 6, + "__main__.fib.n": 8, + "__main__.fib.second_element": 7 + } + }, + "hints": [], + "inst": { + "end_col": 31, + "end_line": 39, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 9, + "start_line": 39 + } + }, + "29": { + "accessible_scopes": [ + "__main__", + "__main__.fib" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 4, + "offset": 0 + }, + "reference_ids": { + "__main__.fib.first_element": 6, + "__main__.fib.n": 8, + "__main__.fib.second_element": 7 + } + }, + "hints": [], + "inst": { + "end_col": 51, + "end_line": 37, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "parent_location": [ + { + "end_col": 37, + "end_line": 43, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 23, + "start_line": 43 + }, + "While expanding the reference 'second_element' in:" + ], + "start_col": 31, + "start_line": 37 + } + }, + "30": { + "accessible_scopes": [ + "__main__", + "__main__.fib" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 4, + "offset": 1 + }, + "reference_ids": { + "__main__.fib.first_element": 6, + "__main__.fib.n": 8, + "__main__.fib.second_element": 7 + } + }, + "hints": [], + "inst": { + "end_col": 84, + "end_line": 43, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 54, + "start_line": 43 + } + }, + "31": { + "accessible_scopes": [ + "__main__", + "__main__.fib" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 4, + "offset": 2 + }, + "reference_ids": { + "__main__.fib.first_element": 6, + "__main__.fib.n": 8, + "__main__.fib.second_element": 7 + } + }, + "hints": [], + "inst": { + "end_col": 93, + "end_line": 43, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 88, + "start_line": 43 + } + }, + "33": { + "accessible_scopes": [ + "__main__", + "__main__.fib" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 4, + "offset": 3 + }, + "reference_ids": { + "__main__.fib.first_element": 6, + "__main__.fib.n": 8, + "__main__.fib.second_element": 7 + } + }, + "hints": [], + "inst": { + "end_col": 6, + "end_line": 44, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 12, + "start_line": 42 + } + }, + "35": { + "accessible_scopes": [ + "__main__", + "__main__.fib" + ], + "flow_tracking_data": { + "ap_tracking": { + "group": 5, + "offset": 0 + }, + "reference_ids": { + "__main__.fib.first_element": 6, + "__main__.fib.n": 8, + "__main__.fib.second_element": 7 + } + }, + "hints": [], + "inst": { + "end_col": 7, + "end_line": 44, + "input_file": { + "filename": "cairo0_fibonacci_recursive_builtins.cairo" + }, + "start_col": 5, + "start_line": 42 + } + } + } + }, + "hints": {}, + "identifiers": { + "__main__.__end__": { + "pc": 4, + "type": "label" + }, + "__main__.__start__": { + "pc": 0, + "type": "label" + }, + "__main__.fib": { + "decorators": [], + "pc": 25, + "type": "function" + }, + "__main__.fib.Args": { + "full_name": "__main__.fib.Args", + "members": { + "first_element": { + "cairo_type": "felt", + "offset": 0 + }, + "n": { + "cairo_type": "felt", + "offset": 2 + }, + "second_element": { + "cairo_type": "felt", + "offset": 1 + } + }, + "size": 3, + "type": "struct" + }, + "__main__.fib.ImplicitArgs": { + "full_name": "__main__.fib.ImplicitArgs", + "members": {}, + "size": 0, + "type": "struct" + }, + "__main__.fib.Return": { + "cairo_type": "felt", + "type": "type_definition" + }, + "__main__.fib.SIZEOF_LOCALS": { + "type": "const", + "value": 0 + }, + "__main__.fib.first_element": { + "cairo_type": "felt", + "full_name": "__main__.fib.first_element", + "references": [ + { + "ap_tracking_data": { + "group": 4, + "offset": 0 + }, + "pc": 25, + "value": "[cast(fp + (-5), felt*)]" + } + ], + "type": "reference" + }, + "__main__.fib.n": { + "cairo_type": "felt", + "full_name": "__main__.fib.n", + "references": [ + { + "ap_tracking_data": { + "group": 4, + "offset": 0 + }, + "pc": 25, + "value": "[cast(fp + (-3), felt*)]" + } + ], + "type": "reference" + }, + "__main__.fib.second_element": { + "cairo_type": "felt", + "full_name": "__main__.fib.second_element", + "references": [ + { + "ap_tracking_data": { + "group": 4, + "offset": 0 + }, + "pc": 25, + "value": "[cast(fp + (-4), felt*)]" + } + ], + "type": "reference" + }, + "__main__.main": { + "decorators": [], + "pc": 6, + "type": "function" + }, + "__main__.main.Args": { + "full_name": "__main__.main.Args", + "members": { + "bitwise_ptr": { + "cairo_type": "felt*", + "offset": 3 + }, + "output_ptr": { + "cairo_type": "felt*", + "offset": 0 + }, + "pedersen_ptr": { + "cairo_type": "felt*", + "offset": 1 + }, + "range_check_ptr": { + "cairo_type": "felt*", + "offset": 2 + } + }, + "size": 4, + "type": "struct" + }, + "__main__.main.ImplicitArgs": { + "full_name": "__main__.main.ImplicitArgs", + "members": {}, + "size": 0, + "type": "struct" + }, + "__main__.main.Return": { + "cairo_type": "(output_ptr: felt*, pedersen_ptr: felt*, range_check_ptr: felt*, bitwise_ptr: felt*)", + "type": "type_definition" + }, + "__main__.main.SIZEOF_LOCALS": { + "type": "const", + "value": 1 + }, + "__main__.main.bitwise_ptr": { + "cairo_type": "felt*", + "full_name": "__main__.main.bitwise_ptr", + "references": [ + { + "ap_tracking_data": { + "group": 2, + "offset": 0 + }, + "pc": 6, + "value": "[cast(fp + (-3), felt**)]" + } + ], + "type": "reference" + }, + "__main__.main.fibonacci_claim_index": { + "cairo_type": "felt", + "full_name": "__main__.main.fibonacci_claim_index", + "references": [ + { + "ap_tracking_data": { + "group": 2, + "offset": 1 + }, + "pc": 10, + "value": "[cast(fp, felt*)]" + } + ], + "type": "reference" + }, + "__main__.main.output_ptr": { + "cairo_type": "felt*", + "full_name": "__main__.main.output_ptr", + "references": [ + { + "ap_tracking_data": { + "group": 2, + "offset": 0 + }, + "pc": 6, + "value": "[cast(fp + (-6), felt**)]" + } + ], + "type": "reference" + }, + "__main__.main.pedersen_ptr": { + "cairo_type": "felt*", + "full_name": "__main__.main.pedersen_ptr", + "references": [ + { + "ap_tracking_data": { + "group": 2, + "offset": 0 + }, + "pc": 6, + "value": "[cast(fp + (-5), felt**)]" + } + ], + "type": "reference" + }, + "__main__.main.range_check_ptr": { + "cairo_type": "felt*", + "full_name": "__main__.main.range_check_ptr", + "references": [ + { + "ap_tracking_data": { + "group": 2, + "offset": 0 + }, + "pc": 6, + "value": "[cast(fp + (-4), felt**)]" + } + ], + "type": "reference" + }, + "__main__.main.res": { + "cairo_type": "felt", + "full_name": "__main__.main.res", + "references": [ + { + "ap_tracking_data": { + "group": 3, + "offset": 0 + }, + "pc": 18, + "value": "[cast(ap + (-1), felt*)]" + } + ], + "type": "reference" + } + }, + "main_scope": "__main__", + "prime": "0x800000000000011000000000000000000000000000000000000000000000001", + "reference_manager": { + "references": [ + { + "ap_tracking_data": { + "group": 2, + "offset": 0 + }, + "pc": 6, + "value": "[cast(fp + (-6), felt**)]" + }, + { + "ap_tracking_data": { + "group": 2, + "offset": 0 + }, + "pc": 6, + "value": "[cast(fp + (-5), felt**)]" + }, + { + "ap_tracking_data": { + "group": 2, + "offset": 0 + }, + "pc": 6, + "value": "[cast(fp + (-4), felt**)]" + }, + { + "ap_tracking_data": { + "group": 2, + "offset": 0 + }, + "pc": 6, + "value": "[cast(fp + (-3), felt**)]" + }, + { + "ap_tracking_data": { + "group": 2, + "offset": 1 + }, + "pc": 10, + "value": "[cast(fp, felt*)]" + }, + { + "ap_tracking_data": { + "group": 3, + "offset": 0 + }, + "pc": 18, + "value": "[cast(ap + (-1), felt*)]" + }, + { + "ap_tracking_data": { + "group": 4, + "offset": 0 + }, + "pc": 25, + "value": "[cast(fp + (-5), felt*)]" + }, + { + "ap_tracking_data": { + "group": 4, + "offset": 0 + }, + "pc": 25, + "value": "[cast(fp + (-4), felt*)]" + }, + { + "ap_tracking_data": { + "group": 4, + "offset": 0 + }, + "pc": 25, + "value": "[cast(fp + (-3), felt*)]" + } + ] + } +}