From 2b9d94fb610fbc662880490ff452c331335ad3e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Calv=C3=ADn=20Garc=C3=ADa?= Date: Mon, 13 Nov 2023 22:33:07 +0100 Subject: [PATCH] Update contract caches (#1117) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove `serde_json_pythonic`. (#1047) * Remove `serde_json_pythonic`. * Fix JSON formatter on `deprecated_contract_class.rs`. * Fix hash JSON formatter (non-ascii support). * Add unwrap reasoning comment. * Add debug logging. (#1018) * Add `tracing` and update dependencies. * Configure the example to use tracing logging (and make it work again). * Add tracing logging. * Add error logging. * Fix error logging. * Reduce the amount of spam logged. * Update `README.md`. * Fix `Makefile` dependencies. * Remove `Debug` trait dependency. * Update `Cargo.lock` after merge. * Fix warnings. * Fix formatting. --------- Co-authored-by: Esteve Soler Arderiu * fmt and improvements * Fix skip validate (#1053) * update version * fix skip validation for invoke txs * run fmt * fix clippy suggestion * simplify a bit the execute_tx function variants * Add documentation to transaction/fee module (#889) * added comments to src/transaction/fee.rs * added return and error comments --------- Co-authored-by: fannyguthmann Co-authored-by: Santiago Pittella <87827390+SantiagoPittella@users.noreply.github.com> Co-authored-by: Juan Bono * Add comments to origin/Document-transactionl1_handler module (#888) * added comments to origin/Document-transactionl1_handler-module * modified comments * Test multi syscall (#687) * create multy syscall * remove the replace syscall, it failed because the contract adress didn't match * added library call_syscall * wip * wip * wip * wip * work in progress * remove .sjon files from starknet_programs * finished implemented all the syscalls * reorder code, create one call to syscall * fix pull bug * Update tests/multi_syscall_test.rs Co-authored-by: Matías Ignacio González * Update starknet_programs/cairo1/multi_syscall_test.cairo Co-authored-by: Matías Ignacio González * Update starknet_programs/cairo1/contract_a.cairo Co-authored-by: Matías Ignacio González * Update tests/multi_syscall_test.rs Co-authored-by: Matías Ignacio González * added test syscall for deploy * make format changes * corrected make clippy error * get_caller_address and get_contract_address return a adress * failed of get_contract_address * failed of get_contract_address * wip * modify the selector entrypoint_selector to be function specific * wip * wip * wip * add input to cairo functions * coorect format problem * wip * wip * wip * remove format problem * Fix sierra class hash calculation (#886) * reproduce bug * use pythonic formatter * rename test * fix test * cargo fmt * Fail with an Err transactions whose calculated fee exceed `max_fee` (#892) * Make tx fail when actual_fee exceeds max_fee * Changed test * Formatting * Fix logic * Leave fail only without charging * Change test * Fix test broken by better fee calc * Fixed test fee * Update fee on test_deploy_account * Remove comment --------- Co-authored-by: Juan Bono * Fix test_get_nonce_at (#910) * Fix test_get_nonce_at * Rely on another contract * fix get_sorted_events bug (#912) * fix get_sorted_events bug * fmt * fix clippy --------- Co-authored-by: Estéfano Bargas * Added documentations to syscalls/deprecated_syscall_handler module (#883) * added comments to file syscalls/deprecated_syscall_handler-module' * Update src/syscalls/deprecated_syscall_handler.rs Co-authored-by: Matías Ignacio González * Update src/syscalls/deprecated_syscall_handler.rs Co-authored-by: Matías Ignacio González --------- Co-authored-by: fannyguthmann Co-authored-by: Juan Bono Co-authored-by: Matías Ignacio González * wip * Modify the tests * fixed clippy errors --------- Co-authored-by: fannyguthmann Co-authored-by: Matías Ignacio González Co-authored-by: SantiagoPittella Co-authored-by: Juan Bono Co-authored-by: Estéfano Bargas * Parse internal calls (#915) * Added comments to core/contract_address module (#900) Co-authored-by: fannyguthmann * Add more transaction tests and fee investigation (#914) * add function for getting tx and refactor tests * improve imports * separe tests into 2 groups * fix test * add comments * format * cargo clippy * add details to every test * add fee discrepancy to test doc * cargo fmt * improve imports * added safety element --------- Co-authored-by: fannyguthmann Co-authored-by: Matías Ignacio González Co-authored-by: SantiagoPittella Co-authored-by: Juan Bono Co-authored-by: Estéfano Bargas Co-authored-by: Santiago Pittella <87827390+SantiagoPittella@users.noreply.github.com> * remove transactionalstatereader as it is not needed as-is (#1054) * Fix test (or try to) * Revert "Fix test (or try to)" This reverts commit 423052f341165bb23b473c9231aa68560fb46568. * Implement Clone for CachedState * Fix conflict in Makefile + run clippy-fix * Remove empty line * fmt * Remove unwraps * Add clone_for_testing * Remove clones * Add cairo native (#943) * Added cairo native flag * Added cairo_native as dependency * Partial progress * Progress * Partial progress * Point to newly created branch on cairo native * Use updated version of cairo native and make test pass * Run test with storage_write and storage_read with cairo native * Tidy up code * Start unhardcoding stuff * Handle return values * Tidy up code a little * Added sierra programs cache * Add impl for emit_event and send_l1_message * Fix tests * Install LLVM on CI * Test * Test CI * Fix lint step * Save work in progress * Unhardcode calldata and entry point * Unhardcode more stuff * Fix test * Add basic implementation for call_contract * Add call to get_name to integration test * Make call_contract impl compile * Fix test * Pass the correct amount of builtins for every function * Improve test legibility * Write call_contract test skeleton * Finish writing test, still bugs to fix * implement get_execution_info, make increase_allowance work * More debugging * Basic test for call_contract working * More progress on testing ERC20 * More progress on test * Add caller and callee contracts * Fix call_contract test after merge * Fix callee address in tests * Polish some details * Remove use_cairo_native from TransactionExecutionContext * Write test skeleton * Add test contracts * Fix tests * Readd deleted contracts * Echo contract test passing * Update cairo compiler to version 2.2.0 * Calling another contract with events test is passing * Fix failing tests * Remove internal_calls field TODO in CallInfo returned by native_execute * Add event_emitter contract * Add cairo vm execution to the erc20 test for comparison * Add simple implementation for panics in native execution * Add some documentation in code * Assert equality between events, accessed_storage_keys and l1_l2 messages between native and vm runs * Add event_emitter contract * Remove print * Remove comments * Move native syscall handler to its own file * Add felt decode to string when program panics * Make cairo native an optional dependency behind a feature * Move execution result to cairo native * Add a README section explaining how to setup cairo native * Fix some clippy issues * Fix test compilation * CI test * Revert "CI test" This reverts commit 4631e5e56a46cd0d751ea3a7d10db3541f2fde3d. * CI test * Test * Test * Address comment about multiple cfgs * Remove unnecessary clone * Test * Test * Switch to special workflow for native integration tests * Fix workflow * Fix stuff after merge. * Fix clippy warnings. * Fix after merge. * Fix comments. * Fix `Makefile`. * Remove unused import. * Use transactional state. * update cairo native to llvm 17 and remove nightly requirement * update ci * upd ci * try to fix ci * use ubuntu on native * try to fix ci * not needed? * fix ci * update cairo native * fix nightly usage * try to fix ci * dont need a transactional state reader, simply clone the state reader * try to fix ci * format * fix again * fix if * values * force rebuild * make cache track cairo 2 version to trigger rebuilds * try no restore key * update readme * fix tests on ci * update cairo native commit * fix more tests on ci * fix cairo native interface * try ci without cache * setup rustup home * make param passing to cairo native not obscure * try * try again * remove large packages * remove large dirs * remove android too * polly is needed * needs sudo * fix cov * fix test for now * format * cleanup ci file * use pyenv if available * nightly not needed in readme * add .sierra as generated to gitattributes * fix gitattributes * add casm too --------- Co-authored-by: Javier Chatruc Co-authored-by: Mariano Nicolini Co-authored-by: Esteve Soler Arderiu Co-authored-by: Edgar Luque * add test to check cairo 2 account contract deploy panic failing properly (#1045) * add test for account contract execution with panic * clippy * update cairo native to latest revision, u128 gas, mut self (#1082) Co-authored-by: Juan Bono * Fix `get_execution_info` syscall (#1081) * Mark read-only segments * Move call * Remove debug prints * Remove fn * Add test case * Add comment * Restore newlines * Add function comment * Fix test values * Undo changes to makefile * Undo changes to makefile * clippy * cairo-native: implement testing syscalls (#1084) * cleanup erc20 test (#1087) * Fix `get_onchain_data_segment_length` (#1085) * Fix get_onchain_data_segment_length * Update test values * Update test values * fmt --------- Co-authored-by: Juan Bono * Check that running a declare v1 yields a higher fee than simulating it without validation (#1076) * Reorder DeployAccount::apply * Revert "Reorder DeployAccount::apply" This reverts commit 11b0c39cd9cdd92f5211930e9f36f3840a978ae9. * Add test * Add test * clippy + fmt --------- Co-authored-by: Juan Bono * implement display and debug trait for Address (#1080) * implement display and debug trait for Address * hexa fmt * Add recursive calls tests using `library_call` & `call_contract` syscalls (#1072) * Add recursive library call test * Add test programs * Change base changes * Add recursive test for call_contract * fmt + clippy * Add test for 100 contract calls * clippy + fmt * Update test values --------- Co-authored-by: Juan Bono * Fix/Refactor State::count actual storage changes + Support `DeployAccount` in the RpcStateReader (#1096) * Fix get_onchain_data_segment_length * Update test values * Update test values * fmt * Fix/Refactor `State::count actual storage changes` (#1086) * Add StorageChangesCount struct * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add the ability to execute `DeployAccount` transactions using the `RpcState` (#1089) * Add test case * Fix get_onchain_data_segment_length * Debug setup * Add StorageChangesCount struct * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add note comment * Remove hardcoded contract address * Remove txt files * Remove dbg prints * Remove dbg prints * Format * Restore blockifier version * Restore tests * Restore newlines * Restore newlines * Remove txt file * fmt * Fix bug in `From for CompiledClass` implementation (#1090) * Fix bug in CompiledClass * Add tests --------- Co-authored-by: Juan Bono * fmt * Add test cases for `DeployAccount` with popular account contracts using RpcState (#1104) * Execute `Declare` transactions using the `RpcState` + Various fixes related to `Declare` txs (#1094) * Add test case * Fix get_onchain_data_segment_length * Debug setup * Fix get_onchain_data_segment_length * Add StorageChangesCount struct * Update test values * Update test values * fmt * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add note comment * Remove hardcoded contract address * Remove txt files * Remove dbg prints * Remove dbg prints * Format * Restore blockifier version * Restore tests * Restore newlines * Restore newlines * Remove txt file * fmt * Add test case with declare * Deserialize Declare transactions * Create blockifier Declare transaction * Fix/Refactor `State::count actual storage changes` (#1086) * Add StorageChangesCount struct * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add the ability to execute `DeployAccount` transactions using the `RpcState` (#1089) * Add test case * Fix get_onchain_data_segment_length * Debug setup * Add StorageChangesCount struct * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add note comment * Remove hardcoded contract address * Remove txt files * Remove dbg prints * Remove dbg prints * Format * Restore blockifier version * Restore tests * Restore newlines * Restore newlines * Remove txt file * fmt * Fix bug in `From for CompiledClass` implementation (#1090) * Fix bug in CompiledClass * Add tests * fetch class hash from the next block in declare tx * Return an error if a class_hash is not declared + add tests for declare tx * Fix error msg * Add support for DeclareV0-1 in sir_tests * Make Sierra class optional in declare v2 + other changes * Add support for DeclareV2 * Uncomment test * fix * Use new_with_sierra_class_hash_and_tx_hash * use CompiledClassHash instead of CompiledClass where applicatble * Handle nonce in declare v2 + run fmt * Set casm class before counting state changes in declare v2 * Changes * Make sierra class hash non-optional * fix + clippy * Use state_reader instead of creating a state to fetch the next block s contract classes * Add removed test * Update test values --------- Co-authored-by: Juan Bono * Execute `L1Handler` transactions using the `RpcState` (#1103) * Add test case * Fix get_onchain_data_segment_length * Debug setup * Fix get_onchain_data_segment_length * Add StorageChangesCount struct * Update test values * Update test values * fmt * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add note comment * Remove hardcoded contract address * Remove txt files * Remove dbg prints * Remove dbg prints * Format * Restore blockifier version * Restore tests * Restore newlines * Restore newlines * Remove txt file * fmt * Add test case with declare * Deserialize Declare transactions * Create blockifier Declare transaction * Fix/Refactor `State::count actual storage changes` (#1086) * Add StorageChangesCount struct * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add the ability to execute `DeployAccount` transactions using the `RpcState` (#1089) * Add test case * Fix get_onchain_data_segment_length * Debug setup * Add StorageChangesCount struct * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add note comment * Remove hardcoded contract address * Remove txt files * Remove dbg prints * Remove dbg prints * Format * Restore blockifier version * Restore tests * Restore newlines * Restore newlines * Remove txt file * fmt * Fix bug in `From for CompiledClass` implementation (#1090) * Fix bug in CompiledClass * Add tests * fetch class hash from the next block in declare tx * Return an error if a class_hash is not declared + add tests for declare tx * Fix error msg * Add support for DeclareV0-1 in sir_tests * Make Sierra class optional in declare v2 + other changes * Add support for DeclareV2 * Uncomment test * fix * Use new_with_sierra_class_hash_and_tx_hash * use CompiledClassHash instead of CompiledClass where applicatble * Handle nonce in declare v2 + run fmt * Set casm class before counting state changes in declare v2 * Changes * Make sierra class hash non-optional * fix + clippy * Use state_reader instead of creating a state to fetch the next block s contract classes * Add removed test * Update test values * Make validate_invocation and fee_transfer_info fields optional + add L1_HANDLER transaction RpcState * Add L1Handler to blockifier_tests::execute_tx * Add blockifier test case * Add L1Handler to sir_tests::execute_tx * Add one more test case * fmt --------- Co-authored-by: Juan Bono * Added a usage target to makefile (#1069) * Added a usage target to makefile * Fixed typo * Implement `NativeSyscallHandler::deploy` (#1106) * wip * Minor improvements + add test * Improve make clippy * Clippy + fmt * Update error messages * Add failure flag test * Fix typo * Apply suggestions + run formatter * Add llvm setup so we can run clippy with `cairo-native` feature * Fix * Remove todo * Use a proper class_hash * Fix test assertion --------- Co-authored-by: Juan Bono * update cairo native to use gas consumed (#1102) * update cairo native to use gas consumed * gas consumed * update native rev * fix gas consumed * remove comments * fixes --------- Co-authored-by: Juan Bono * Fix cairo-native feature-gated code * clippy --------- Co-authored-by: MrAzteca Co-authored-by: Esteve Soler Arderiu Co-authored-by: juanbono Co-authored-by: Fanny Guthmann <57538139+fguthmann@users.noreply.github.com> Co-authored-by: fannyguthmann Co-authored-by: Santiago Pittella <87827390+SantiagoPittella@users.noreply.github.com> Co-authored-by: Matías Ignacio González Co-authored-by: SantiagoPittella Co-authored-by: Estéfano Bargas Co-authored-by: Edgar Co-authored-by: Federica Co-authored-by: ElFantasma Co-authored-by: Javier Chatruc Co-authored-by: Mariano Nicolini Co-authored-by: Esteve Soler Arderiu Co-authored-by: fmoletta <99273364+fmoletta@users.noreply.github.com> Co-authored-by: Iñaki Garay --- .gitattributes | 2 + .github/workflows/rust-tests.yml | 297 +- Cargo.lock | 1276 ++++- Cargo.toml | 39 +- Makefile | 52 +- README.md | 20 +- bench/internals.rs | 8 +- cairo_programs/erc20.sierra | 5012 +++++++++++++++++ cairo_programs/wallet.sierra | 1430 +++++ cli/src/main.rs | 2 +- examples/contract_execution/main.rs | 9 + examples/lru_cache/main.rs | 2 +- fuzzer/src/main.rs | 2 +- rpc_state_reader/Cargo.toml | 2 +- rpc_state_reader/src/lib.rs | 43 +- rpc_state_reader/src/rpc_state.rs | 26 +- rpc_state_reader/src/utils.rs | 20 +- rpc_state_reader/tests/blockifier_tests.rs | 134 +- rpc_state_reader/tests/sir_tests.rs | 223 +- rust-toolchain | 2 +- .../contract_address/casm_contract_address.rs | 12 +- .../deprecated_contract_address.rs | 2 +- .../sierra_contract_address.rs | 77 +- src/core/errors/state_errors.rs | 2 + src/definitions/constants.rs | 8 +- src/execution/execution_entry_point.rs | 254 +- src/execution/gas_usage.rs | 49 +- src/execution/mod.rs | 13 +- src/lib.rs | 140 +- .../api/contract_classes/compiled_class.rs | 3 +- src/state/cached_state.rs | 269 +- src/state/mod.rs | 12 +- src/state/state_api.rs | 27 +- src/state/state_cache.rs | 35 +- .../business_logic_syscall_handler.rs | 137 +- ...precated_business_logic_syscall_handler.rs | 5 +- src/syscalls/deprecated_syscall_handler.rs | 2 +- src/syscalls/mod.rs | 2 + src/syscalls/native_syscall_handler.rs | 576 ++ src/syscalls/syscall_handler.rs | 2 +- src/transaction/declare.rs | 156 +- src/transaction/declare_v2.rs | 58 +- src/transaction/deploy.rs | 23 +- src/transaction/deploy_account.rs | 53 +- src/transaction/error.rs | 2 + src/transaction/fee.rs | 14 +- src/transaction/invoke_function.rs | 33 +- src/transaction/l1_handler.rs | 57 +- src/transaction/mod.rs | 1 + src/transaction/verify_version.rs | 8 +- src/utils.rs | 54 +- .../cairo1/square_root_recursive.cairo | 24 + starknet_programs/cairo1/wallet_wrapper.cairo | 9 + starknet_programs/cairo2/account_panic.cairo | 148 + starknet_programs/cairo2/callee.cairo | 22 + starknet_programs/cairo2/caller.cairo | 19 + starknet_programs/cairo2/deploy.cairo | 8 +- starknet_programs/cairo2/echo.cairo | 17 + starknet_programs/cairo2/echo_caller.cairo | 20 + starknet_programs/cairo2/erc20.cairo | 2 +- starknet_programs/cairo2/event_emitter.cairo | 30 + .../cairo2/hello_world_account.cairo | 2 +- .../cairo2/square_root_recursive.cairo | 37 + starknet_programs/cairo2/wallet_wrapper.cairo | 14 +- ...9bd7409f07591f0a04f539bdf56693eaaf3.sierra | 687 +++ ...46e7e79464ad52ecdad80079ddfe486ca5eef.casm | 1429 +++++ ...171713f0e5229a084989d3894c171c160ace2.casm | 524 ++ ...16c42fa9b87c812dc398e49b57bf77930629f.casm | 1097 ++++ ...4f9c6a8d9cc48a59d5f9b3c73432f877f8cf0.casm | 755 +++ ...fa2206d928df5d1fa6b92e4cb41004c7e3f89.casm | 557 ++ ...f33d879f790e202eb2c4b8622005c12252641.casm | 476 ++ .../raw_contract_classes/fibonacci.sierra | 373 ++ tests/account_panic.rs | 117 + tests/cairo_1_syscalls.rs | 593 +- tests/cairo_native.rs | 1001 ++++ tests/complex_contracts/amm_contracts/amm.rs | 20 +- .../amm_contracts/amm_proxy.rs | 40 +- tests/complex_contracts/nft/erc721.rs | 32 +- tests/deploy_account.rs | 26 +- tests/fibonacci.rs | 12 +- tests/increase_balance.rs | 4 +- tests/internals.rs | 122 +- tests/storage.rs | 4 +- tests/syscalls.rs | 53 +- 84 files changed, 17879 insertions(+), 1082 deletions(-) create mode 100644 .gitattributes create mode 100644 cairo_programs/erc20.sierra create mode 100644 cairo_programs/wallet.sierra create mode 100644 src/syscalls/native_syscall_handler.rs create mode 100644 starknet_programs/cairo1/square_root_recursive.cairo create mode 100644 starknet_programs/cairo2/account_panic.cairo create mode 100644 starknet_programs/cairo2/callee.cairo create mode 100644 starknet_programs/cairo2/caller.cairo create mode 100644 starknet_programs/cairo2/echo.cairo create mode 100644 starknet_programs/cairo2/echo_caller.cairo create mode 100644 starknet_programs/cairo2/event_emitter.cairo create mode 100644 starknet_programs/cairo2/square_root_recursive.cairo create mode 100644 starknet_programs/raw_contract_classes/0x113bf26d112a164297e04381212c9bd7409f07591f0a04f539bdf56693eaaf3.sierra create mode 100644 starknet_programs/raw_contract_classes/0x472a8c75c832b112ac174abc3b46e7e79464ad52ecdad80079ddfe486ca5eef.casm create mode 100644 starknet_programs/raw_contract_classes/3010533bd60cb0e70ac1bf776e171713f0e5229a084989d3894c171c160ace2.casm create mode 100644 starknet_programs/raw_contract_classes/321aadcf42b0a4ad905616598d16c42fa9b87c812dc398e49b57bf77930629f.casm create mode 100644 starknet_programs/raw_contract_classes/53ad3bfb13f39cf1a9940108be4f9c6a8d9cc48a59d5f9b3c73432f877f8cf0.casm create mode 100644 starknet_programs/raw_contract_classes/6638ce6c9bf336d1781a388668fa2206d928df5d1fa6b92e4cb41004c7e3f89.casm create mode 100644 starknet_programs/raw_contract_classes/7c48d040ceb3183837a0aff2adf33d879f790e202eb2c4b8622005c12252641.casm create mode 100644 starknet_programs/raw_contract_classes/fibonacci.sierra create mode 100644 tests/account_panic.rs create mode 100644 tests/cairo_native.rs diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..6630a6678 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.sierra linguist-generated +*.casm linguist-generated diff --git a/.github/workflows/rust-tests.yml b/.github/workflows/rust-tests.yml index c1bea663e..52d2dfe0e 100644 --- a/.github/workflows/rust-tests.yml +++ b/.github/workflows/rust-tests.yml @@ -9,211 +9,121 @@ on: env: CARGO_TERM_COLOR: always - RUST_TOOLCHAIN: 1.70.0 - CAIRO_PROGRAMS_PATH: | - cairo_programs/**/*.casm - cairo_programs/**/*.sierra - cairo_programs/**/*.json - starknet_programs/**/*.casm - starknet_programs/**/*.sierra - starknet_programs/**/*.json - !starknet_programs/raw_contract_classes/* + RUST_TOOLCHAIN: '1.72.1' jobs: - build-programs: - strategy: - matrix: - program-target: [ - compile-cairo, - compile-starknet, - compile-cairo-1-casm, - compile-cairo-1-sierra, - compile-cairo-2-casm, - compile-cairo-2-sierra, - ] - name: Build Cairo programs - runs-on: ubuntu-22.04 + build: + name: Build with release profile + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 + - name: Install Rust $RUST_TOOLCHAIN + uses: dtolnay/rust-toolchain@master with: - fetch-depth: 0 - - - name: Fetch from cache - uses: actions/cache@v3 - id: cache-programs - with: - path: ${{ env.CAIRO_PROGRAMS_PATH }} - key: ${{ matrix.program-target }}-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} - restore-keys: ${{ matrix.program-target }}-cache- - - # This is not pretty, but we need `make` to see the compiled programs are - # actually newer than the sources, otherwise it will try to rebuild them - - name: Restore timestamps - uses: chetan/git-restore-mtime-action@v1 - + toolchain: $RUST_TOOLCHAIN + components: rustfmt, clippy - name: Python3 Build - if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }} uses: actions/setup-python@v4 with: python-version: '3.9' cache: 'pip' - - - name: Install deps - if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }} - run: make deps - - - name: Build programs - if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }} - run: make -j ${{ matrix.program-target }} - - # NOTE: used to reduce the amount of cache steps we need in later jobs - # TODO: remove this cache once the workflow finishes - merge-caches: - name: Merge Cairo programs cache - runs-on: ubuntu-22.04 - needs: build-programs - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Fetch from cache (compile-cairo) - uses: actions/cache/restore@v3 - id: cache-programs - with: - path: ${{ env.CAIRO_PROGRAMS_PATH }} - key: compile-cairo-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} - fail-on-cache-miss: true - - - name: Fetch from cache (compile-starknet) - uses: actions/cache/restore@v3 - with: - path: ${{ env.CAIRO_PROGRAMS_PATH }} - key: compile-starknet-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} - fail-on-cache-miss: true - - - name: Fetch from cache (compile-cairo-1-casm) - uses: actions/cache/restore@v3 - with: - path: ${{ env.CAIRO_PROGRAMS_PATH }} - key: compile-cairo-1-casm-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} - fail-on-cache-miss: true - - - name: Fetch from cache (compile-cairo-1-sierra) - uses: actions/cache/restore@v3 - with: - path: ${{ env.CAIRO_PROGRAMS_PATH }} - key: compile-cairo-1-sierra-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} - fail-on-cache-miss: true - - - name: Fetch from cache (compile-cairo-2-casm) - uses: actions/cache/restore@v3 - with: - path: ${{ env.CAIRO_PROGRAMS_PATH }} - key: compile-cairo-2-casm-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} - fail-on-cache-miss: true - - - name: Fetch from cache (compile-cairo-2-sierra) - uses: actions/cache/restore@v3 - with: - path: ${{ env.CAIRO_PROGRAMS_PATH }} - key: compile-cairo-2-sierra-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} - fail-on-cache-miss: true - - - name: Fetch from cache (compile-cairo-2-sierra) - uses: actions/cache/restore@v3 - with: - path: ${{ env.CAIRO_PROGRAMS_PATH }} - key: compile-cairo-2-sierra-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} - fail-on-cache-miss: true - - - name: Merge caches - uses: actions/cache/save@v3 - with: - path: ${{ env.CAIRO_PROGRAMS_PATH }} - key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} - - build: - name: Build with release profile - needs: merge-caches - runs-on: ubuntu-22.04 - steps: - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - components: rustfmt, clippy - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - name: Checkout - uses: actions/checkout@v3 - - name: Fetch programs - uses: actions/cache/restore@v3 - with: - path: ${{ env.CAIRO_PROGRAMS_PATH }} - key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} - fail-on-cache-miss: true + - name: Install deps + run: make deps - name: Build - run: cargo build --release --workspace + run: make build lint: name: Lint with fmt and clippy - needs: merge-caches - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + env: + MLIR_SYS_170_PREFIX: /usr/lib/llvm-17/ + TABLEGEN_170_PREFIX: /usr/lib/llvm-17/ steps: - - name: Install Rust - uses: dtolnay/rust-toolchain@stable + - name: Checkout + uses: actions/checkout@v3 + - name: Install Rust $RUST_TOOLCHAIN + uses: dtolnay/rust-toolchain@master + with: + toolchain: $RUST_TOOLCHAIN + components: rustfmt, clippy + - name: Python3 Build + uses: actions/setup-python@v4 with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - components: rustfmt, clippy + python-version: '3.9' + cache: 'pip' - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - name: Checkout - uses: actions/checkout@v3 - - name: Fetch programs - uses: actions/cache/restore@v3 - with: - path: ${{ env.CAIRO_PROGRAMS_PATH }} - key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} - fail-on-cache-miss: true - + - name: check and free hdd space left + run: | + echo "Listing 20 largest packages" + dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 20 + df -h + sudo apt-get update + sudo apt-get remove -y '^llvm-.*' + sudo apt-get remove -y 'php.*' + sudo apt-get remove -y '^dotnet-.*' + sudo apt-get remove -y '^temurin-.*' + sudo apt-get remove -y azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox powershell mono-devel + sudo apt-get autoremove -y + sudo apt-get clean + df -h + echo "Removing large directories" + # deleting 15GB + sudo rm -rf /usr/share/dotnet/ + sudo rm -rf /usr/local/lib/android + df -h + - name: add llvm deb repository + uses: myci-actions/add-deb-repo@10 + with: + repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main + repo-name: llvm-repo + keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key + - name: Install LLVM + run: sudo apt-get install llvm-17 llvm-17-dev llvm-17-runtime clang-17 clang-tools-17 lld-17 libpolly-17-dev libmlir-17-dev mlir-17-tools + - name: Install deps + run: make deps - name: Format run: cargo fmt --all -- --check - name: Run clippy - run: cargo clippy --workspace --all-targets -- -D warnings + run: make clippy tests: env: INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }} + MLIR_SYS_170_PREFIX: /usr/lib/llvm-17/ + TABLEGEN_170_PREFIX: /usr/lib/llvm-17/ strategy: fail-fast: false matrix: - target: [ test-cairo-1, test-cairo-2, test-doctests ] + target: [ test-cairo-1, test-cairo-2, test-doctests, test-cairo-native ] name: Run tests - needs: merge-caches - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - - name: Install Rust - uses: dtolnay/rust-toolchain@stable + - name: Checkout + uses: actions/checkout@v3 + - name: Install Rust $RUST_TOOLCHAIN + uses: dtolnay/rust-toolchain@master + with: + toolchain: $RUST_TOOLCHAIN + components: rustfmt, clippy + - name: Python3 Build + uses: actions/setup-python@v4 with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - components: rustfmt, clippy + python-version: '3.9' + cache: 'pip' - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - name: Checkout - uses: actions/checkout@v3 - - name: Fetch programs - uses: actions/cache/restore@v3 - with: - path: ${{ env.CAIRO_PROGRAMS_PATH }} - key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} - fail-on-cache-miss: true - + - name: Install deps + run: make deps + - name: Install testing tools # TODO: remove `if` when nextest adds doctests support if: ${{ matrix.target != 'test-doctests' }} @@ -221,28 +131,47 @@ jobs: with: tool: cargo-nextest@0.9.49 + - name: check and free hdd space left + run: | + echo "Listing 20 largest packages" + dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 20 + df -h + sudo apt-get update + sudo apt-get remove -y '^llvm-.*' + sudo apt-get remove -y 'php.*' + sudo apt-get remove -y '^dotnet-.*' + sudo apt-get remove -y '^temurin-.*' + sudo apt-get remove -y azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox powershell mono-devel + sudo apt-get autoremove -y + sudo apt-get clean + df -h + echo "Removing large directories" + # deleting 15GB + sudo rm -rf /usr/share/dotnet/ + sudo rm -rf /usr/local/lib/android + df -h + - name: add llvm deb repository + uses: myci-actions/add-deb-repo@10 + with: + repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main + repo-name: llvm-repo + keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key + - name: Install LLVM + run: sudo apt-get install llvm-17 llvm-17-dev llvm-17-runtime clang-17 clang-tools-17 lld-17 libpolly-17-dev libmlir-17-dev mlir-17-tools - name: Run tests (${{ matrix.target }}) run: make ${{ matrix.target }} coverage: - needs: merge-caches name: Generate and upload coverage report - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - - name: Install Rust - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - - - name: Set nightly as default - run: rustup default nightly - - name: Install testing tools - uses: taiki-e/install-action@v2 + - name: Install Rust nightly + uses: dtolnay/rust-toolchain@master with: - tool: cargo-nextest@0.9.49,cargo-llvm-cov + toolchain: nightly - uses: Swatinem/rust-cache@v2 with: @@ -255,13 +184,17 @@ jobs: path: lcov.info key: coverage-cache-${{ github.sha }} - - name: Fetch programs - if: steps.restore-report.outputs.cache-hit != 'true' - uses: actions/cache/restore@v3 + - name: Python3 Build + uses: actions/setup-python@v4 with: - path: ${{ env.CAIRO_PROGRAMS_PATH }} - key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} - fail-on-cache-miss: true + python-version: '3.9' + cache: 'pip' + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + + - name: Install deps + run: make deps - name: Generate coverage report if: steps.restore-report.outputs.cache-hit != 'true' diff --git a/Cargo.lock b/Cargo.lock index c53120744..6d46e8782 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,7 +30,7 @@ dependencies = [ "actix-service", "actix-utils", "ahash 0.8.3", - "base64 0.21.3", + "base64 0.21.4", "bitflags 2.4.0", "brotli", "bytes", @@ -65,7 +65,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -103,7 +103,7 @@ dependencies = [ "futures-core", "futures-util", "mio", - "socket2 0.5.3", + "socket2 0.5.4", "tokio", "tracing", ] @@ -133,7 +133,7 @@ dependencies = [ "impl-more", "pin-project-lite", "rustls", - "rustls-webpki 0.101.4", + "rustls-webpki", "tokio", "tokio-util", "tracing", @@ -184,7 +184,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "smallvec", - "socket2 0.5.3", + "socket2 0.5.4", "time", "url", ] @@ -198,7 +198,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -252,9 +252,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.5" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -295,11 +295,17 @@ dependencies = [ "libc", ] +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + [[package]] name = "anstream" -version = "0.5.0" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", @@ -311,15 +317,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -335,9 +341,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "2.1.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys", @@ -368,7 +374,7 @@ dependencies = [ "derivative", "hashbrown 0.13.2", "itertools 0.10.5", - "num-traits 0.2.16", + "num-traits 0.2.17", "zeroize", ] @@ -386,7 +392,7 @@ dependencies = [ "digest", "itertools 0.10.5", "num-bigint", - "num-traits 0.2.16", + "num-traits 0.2.17", "paste", "rustc_version", "zeroize", @@ -409,7 +415,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ "num-bigint", - "num-traits 0.2.16", + "num-traits 0.2.17", "proc-macro2", "quote", "syn 1.0.109", @@ -479,7 +485,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" dependencies = [ - "num-traits 0.2.16", + "num-traits 0.2.17", "rand", ] @@ -512,7 +518,7 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -545,7 +551,7 @@ dependencies = [ "actix-service", "actix-tls", "actix-utils", - "base64 0.21.3", + "base64 0.21.4", "bytes", "cfg-if", "cookie", @@ -589,9 +595,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.3" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "bigdecimal" @@ -601,7 +607,16 @@ checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" dependencies = [ "num-bigint", "num-integer", - "num-traits 0.2.16", + "num-traits 0.2.17", + "serde", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ "serde", ] @@ -614,6 +629,52 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.66.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" +dependencies = [ + "bitflags 2.4.0", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.38", + "which", +] + +[[package]] +name = "bindgen" +version = "0.68.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" +dependencies = [ + "bitflags 2.4.0", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.38", + "which", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -684,7 +745,7 @@ dependencies = [ "log", "num-bigint", "num-integer", - "num-traits 0.2.16", + "num-traits 0.2.17", "phf", "serde", "serde_json", @@ -698,9 +759,9 @@ dependencies = [ [[package]] name = "brotli" -version = "3.3.4" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" +checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -709,9 +770,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.3.4" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" +checksum = "da74e2b81409b1b743f8f0c62cc6254afefb8b8e50bbfe3735550f7aeefa3448" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -719,9 +780,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byte-slice-cast" @@ -731,15 +792,15 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "bytestring" @@ -795,7 +856,7 @@ dependencies = [ "lazy_static", "num-bigint", "num-integer", - "num-traits 0.2.16", + "num-traits 0.2.17", "serde", ] @@ -808,7 +869,7 @@ dependencies = [ "cairo-lang-utils", "indoc", "num-bigint", - "num-traits 0.2.16", + "num-traits 0.2.17", "parity-scale-codec", "parity-scale-codec-derive", "schemars", @@ -863,7 +924,7 @@ dependencies = [ "cairo-lang-parser", "cairo-lang-syntax", "cairo-lang-utils", - "indexmap 2.0.0", + "indexmap 2.0.2", "itertools 0.11.0", "salsa", "smol_str", @@ -890,7 +951,7 @@ checksum = "c35dddbc63b2a4870891cc74498726aa32bfaa518596352f9bb101411cc4c584" dependencies = [ "cairo-lang-utils", "good_lp", - "indexmap 2.0.0", + "indexmap 2.0.2", "itertools 0.11.0", ] @@ -924,11 +985,11 @@ dependencies = [ "cairo-lang-syntax", "cairo-lang-utils", "id-arena", - "indexmap 2.0.0", + "indexmap 2.0.2", "itertools 0.11.0", "log", "num-bigint", - "num-traits 0.2.16", + "num-traits 0.2.17", "once_cell", "salsa", "smol_str", @@ -949,7 +1010,7 @@ dependencies = [ "itertools 0.11.0", "log", "num-bigint", - "num-traits 0.2.16", + "num-traits 0.2.17", "salsa", "smol_str", "unescaper", @@ -983,7 +1044,7 @@ checksum = "170838817fc33ddb65e0a9480526df0b226b148a0fca0a5cd7071be4c6683157" dependencies = [ "cairo-lang-debug", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -1032,7 +1093,7 @@ dependencies = [ "keccak", "num-bigint", "num-integer", - "num-traits 0.2.16", + "num-traits 0.2.17", "salsa", "thiserror", ] @@ -1056,7 +1117,7 @@ dependencies = [ "itertools 0.11.0", "log", "num-bigint", - "num-traits 0.2.16", + "num-traits 0.2.17", "once_cell", "salsa", "smol_str", @@ -1076,7 +1137,7 @@ dependencies = [ "lalrpop", "lalrpop-util", "num-bigint", - "num-traits 0.2.16", + "num-traits 0.2.17", "regex", "salsa", "serde", @@ -1132,7 +1193,7 @@ dependencies = [ "cairo-lang-syntax", "cairo-lang-utils", "id-arena", - "indexmap 2.0.0", + "indexmap 2.0.2", "itertools 0.11.0", "num-bigint", "once_cell", @@ -1158,7 +1219,7 @@ dependencies = [ "itertools 0.11.0", "log", "num-bigint", - "num-traits 0.2.16", + "num-traits 0.2.17", "thiserror", ] @@ -1204,7 +1265,7 @@ dependencies = [ "log", "num-bigint", "num-integer", - "num-traits 0.2.16", + "num-traits 0.2.17", "once_cell", "serde", "serde_json", @@ -1223,7 +1284,7 @@ dependencies = [ "cairo-lang-filesystem", "cairo-lang-utils", "num-bigint", - "num-traits 0.2.16", + "num-traits 0.2.17", "salsa", "smol_str", "thiserror", @@ -1246,16 +1307,63 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f974b6e859f0b09c0f13ec8188c96e9e8bbb5da04214f911dbb5bcda67cb812b" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "itertools 0.11.0", "num-bigint", "num-integer", - "num-traits 0.2.16", + "num-traits 0.2.17", "parity-scale-codec", "schemars", "serde", ] +[[package]] +name = "cairo-native" +version = "0.1.0" +source = "git+https://github.com/lambdaclass/cairo_native?rev=03cd09ba3e51852da2234fb32a74056787abba8e#03cd09ba3e51852da2234fb32a74056787abba8e" +dependencies = [ + "bumpalo", + "cairo-felt", + "cairo-lang-compiler", + "cairo-lang-defs", + "cairo-lang-diagnostics", + "cairo-lang-filesystem", + "cairo-lang-lowering", + "cairo-lang-sierra", + "cairo-lang-sierra-ap-change", + "cairo-lang-sierra-gas", + "cairo-lang-sierra-generator", + "cairo-lang-starknet", + "cairo-lang-utils", + "cairo-native-runtime", + "cc", + "clap", + "id-arena", + "itertools 0.11.0", + "lazy_static", + "libc", + "melior", + "mlir-sys", + "num-bigint", + "serde", + "serde_json", + "thiserror", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "cairo-native-runtime" +version = "0.1.0" +source = "git+https://github.com/lambdaclass/cairo_native?rev=03cd09ba3e51852da2234fb32a74056787abba8e#03cd09ba3e51852da2234fb32a74056787abba8e" +dependencies = [ + "cairo-felt", + "cairo-lang-runner", + "libc", + "starknet-crypto 0.6.0", + "starknet-curve 0.4.0", +] + [[package]] name = "cairo-vm" version = "0.8.7" @@ -1265,13 +1373,13 @@ dependencies = [ "anyhow", "ark-ff", "ark-std", - "bincode", + "bincode 2.0.0-rc.3", "bitvec", "cairo-felt", "cairo-lang-casm", "cairo-lang-starknet", "generic-array", - "hashbrown 0.14.0", + "hashbrown 0.14.1", "hex", "keccak", "lazy_static", @@ -1280,7 +1388,7 @@ dependencies = [ "num-bigint", "num-integer", "num-prime", - "num-traits 0.2.16", + "num-traits 0.2.17", "rand", "serde", "serde_json", @@ -1290,6 +1398,12 @@ dependencies = [ "thiserror-no-std", ] +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + [[package]] name = "cc" version = "1.0.83" @@ -1300,6 +1414,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -1308,17 +1431,44 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.28" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ed24df0632f708f5f6d8082675bef2596f7084dee3dd55f632290bf35bfe0f" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", - "num-traits 0.2.16", + "num-traits 0.2.17", "serde", "windows-targets", ] +[[package]] +name = "ciborium" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656" + +[[package]] +name = "ciborium-ll" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b" +dependencies = [ + "ciborium-io", + "half", +] + [[package]] name = "cipher" version = "0.4.4" @@ -1329,11 +1479,22 @@ dependencies = [ "inout", ] +[[package]] +name = "clang-sys" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" -version = "4.4.2" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", "clap_derive", @@ -1341,14 +1502,15 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.2" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", "clap_lex", "strsim", + "terminal_size", ] [[package]] @@ -1360,7 +1522,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -1386,6 +1548,25 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "comrak" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "482aa5695bca086022be453c700a40c02893f1ba7098a2c88351de55341ae894" +dependencies = [ + "clap", + "entities", + "memchr", + "once_cell", + "regex", + "shell-words", + "slug", + "syntect", + "typed-arena", + "unicode_categories", + "xdg", +] + [[package]] name = "const-fnv1a-hash" version = "1.1.0" @@ -1418,6 +1599,16 @@ dependencies = [ "version_check", ] +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.4" @@ -1448,6 +1639,66 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "criterion" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" +dependencies = [ + "anes", + "cast", + "ciborium", + "clap", + "criterion-plot", + "is-terminal", + "itertools 0.10.5", + "num-traits 0.2.17", + "once_cell", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools 0.10.5", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset", + "scopeguard", +] + [[package]] name = "crossbeam-utils" version = "0.8.16" @@ -1465,9 +1716,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" dependencies = [ "generic-array", "subtle", @@ -1486,12 +1737,12 @@ dependencies = [ [[package]] name = "ctor" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f34ba9a9bcb8645379e9de8cb3ecfcf4d1c85ba66d90deb3259206fa5aa193b" +checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" dependencies = [ "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -1548,7 +1799,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -1570,7 +1821,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -1585,6 +1836,19 @@ dependencies = [ "ordered-float", ] +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.1", + "lock_api", + "once_cell", + "parking_lot_core 0.9.8", +] + [[package]] name = "deranged" version = "0.3.8" @@ -1618,6 +1882,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "deunicode" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95203a6a50906215a502507c0f879a0ce7ff205a6111e2db2a5ef8e4bb92e43" + [[package]] name = "diff" version = "0.1.13" @@ -1664,9 +1934,9 @@ checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] name = "dyn-clone" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfc4744c1b8f2a09adc0e55242f60b1af195d88596bd8700be74418c056c555" +checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" [[package]] name = "either" @@ -1692,6 +1962,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "entities" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca" + [[package]] name = "equivalent" version = "1.0.1" @@ -1700,25 +1976,14 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ - "errno-dragonfly", "libc", "windows-sys", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "eth-keystore" version = "0.5.0" @@ -1768,11 +2033,21 @@ dependencies = [ "uint", ] +[[package]] +name = "fancy-regex" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2" +dependencies = [ + "bit-set", + "regex", +] + [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fixed-hash" @@ -1867,7 +2142,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -1903,7 +2178,7 @@ version = "0.4.0" dependencies = [ "cairo-vm", "honggfuzz", - "num-traits 0.2.16", + "num-traits 0.2.17", "serde_json", "starknet_api", "starknet_in_rust", @@ -1912,9 +2187,9 @@ dependencies = [ [[package]] name = "genco" -version = "0.17.5" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6973ce8518068a71d404f428f6a5b563088545546a6bd8f9c0a7f2608149bc8a" +checksum = "c4fd234893ffe9cf5b81224ebb1d21bbe2eeb94d95bac3ea25c97cba7293304d" dependencies = [ "genco-macros", "relative-path", @@ -1923,13 +2198,13 @@ dependencies = [ [[package]] name = "genco-macros" -version = "0.17.5" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2c778cf01917d0fbed53900259d6604a421fab4916a2e738856ead9f1d926a" +checksum = "8e1c8cd3de2f32ee05ba2adaa90f8d0c354ffa0adeb2d186978d7ae70e5025e9" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] @@ -1973,11 +2248,17 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "good_lp" -version = "1.5.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7f3b0e0de4e671b6ffc1274b153a9394cb58bf04ee67505b0cb9915513115f" +checksum = "fa124423ded10046a849fa0ae9747c541895557f1af177e0890b09879e7e9e7d" dependencies = [ "fnv", "minilp", @@ -2002,6 +2283,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" + [[package]] name = "hashbrown" version = "0.12.3" @@ -2022,9 +2309,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" dependencies = [ "ahash 0.8.3", "allocator-api2", @@ -2048,9 +2335,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -2067,6 +2354,15 @@ dependencies = [ "digest", ] +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys", +] + [[package]] name = "honggfuzz" version = "0.5.55" @@ -2268,20 +2564,20 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.1", "serde", ] [[package]] name = "indoc" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c785eefb63ebd0e33416dfcb8d6da0bf27ce752843a45632a67bf10d4d4b5c4" +checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" [[package]] name = "inout" @@ -2385,7 +2681,7 @@ dependencies = [ "petgraph", "pico-args", "regex", - "regex-syntax", + "regex-syntax 0.7.5", "string_cache", "term", "tiny-keccak", @@ -2416,37 +2712,67 @@ dependencies = [ "spin", ] +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" -version = "0.2.147" +version = "0.2.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" + +[[package]] +name = "libloading" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] [[package]] name = "libmimalloc-sys" -version = "0.1.34" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25d058a81af0d1c22d7a1c948576bee6d673f7af3c0f35564abd6c81122f513d" +checksum = "3979b5c37ece694f1f5e51e7ecc871fdb0f517ed04ee45f88d15d6d553cb9664" dependencies = [ "cc", "libc", ] [[package]] -name = "linux-raw-sys" -version = "0.4.5" +name = "line-wrap" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" - +checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" +dependencies = [ + "safemem", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linux-raw-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" + [[package]] name = "local-channel" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f303ec0e94c6c54447f84f3b0ef7af769858a9c4ef56ef2a986d3dcd4c3fc9c" +checksum = "e0a493488de5f18c8ffcba89eebb8532ffc562dc400490eb65b84893fae0b178" dependencies = [ "futures-core", "futures-sink", - "futures-util", "local-waker", ] @@ -2487,7 +2813,16 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a83fb7698b3643a0e34f9ae6f2e8f0178c0fd42f8b59d493aa271ff3a5bf21" dependencies = [ - "hashbrown 0.14.0", + "hashbrown 0.14.1", +] + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", ] [[package]] @@ -2499,11 +2834,41 @@ dependencies = [ "rawpointer", ] +[[package]] +name = "melior" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91ea0e9e00979f692a52fb127a2d352e358535168dece6fd4e7948fd7714db5" +dependencies = [ + "criterion", + "dashmap", + "melior-macro", + "mlir-sys", + "once_cell", +] + +[[package]] +name = "melior-macro" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef4083994160cca85418ff2099183160787db26ab4ef5840bcf73472f678590" +dependencies = [ + "comrak", + "convert_case 0.6.0", + "once_cell", + "proc-macro2", + "quote", + "regex", + "syn 2.0.38", + "tblgen", + "unindent", +] + [[package]] name = "memchr" -version = "2.6.2" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5486aed0026218e61b8a01d5fbd5a0a134649abb71a0e53b7bc088529dced86e" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memmap2" @@ -2514,11 +2879,20 @@ dependencies = [ "libc", ] +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + [[package]] name = "mimalloc" -version = "0.1.38" +version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "972e5f23f6716f62665760b0f4cbf592576a80c7b879ba9beaafc0e558894127" +checksum = "fa01922b5ea280a911e323e4d2fd24b7fe5cc4042e0d2cda3c40775cdc4bdc9c" dependencies = [ "libmimalloc-sys", ] @@ -2566,6 +2940,15 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "mlir-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5e19a5391ed2759fd9060f538330b9b89191e7b13503d7499a4f9580af6699a" +dependencies = [ + "bindgen 0.68.1", +] + [[package]] name = "ndarray" version = "0.13.1" @@ -2575,7 +2958,7 @@ dependencies = [ "matrixmultiply", "num-complex", "num-integer", - "num-traits 0.2.16", + "num-traits 0.2.17", "rawpointer", ] @@ -2595,6 +2978,16 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint" version = "0.4.4" @@ -2603,7 +2996,7 @@ checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", - "num-traits 0.2.16", + "num-traits 0.2.17", "rand", "serde", ] @@ -2615,7 +3008,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" dependencies = [ "autocfg", - "num-traits 0.2.16", + "num-traits 0.2.17", ] [[package]] @@ -2625,7 +3018,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", - "num-traits 0.2.16", + "num-traits 0.2.17", ] [[package]] @@ -2636,7 +3029,7 @@ checksum = "64a5fe11d4135c3bcdf3a95b18b194afa9608a5f6ff034f5d857bc9a27fb0119" dependencies = [ "num-bigint", "num-integer", - "num-traits 0.2.16", + "num-traits 0.2.17", ] [[package]] @@ -2651,7 +3044,7 @@ dependencies = [ "num-bigint", "num-integer", "num-modular", - "num-traits 0.2.16", + "num-traits 0.2.17", "rand", ] @@ -2661,23 +3054,23 @@ version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" dependencies = [ - "num-traits 0.2.16", + "num-traits 0.2.17", ] [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] [[package]] name = "object" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -2688,6 +3081,28 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "onig" +version = "6.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f" +dependencies = [ + "bitflags 1.3.2", + "libc", + "once_cell", + "onig_sys", +] + +[[package]] +name = "onig_sys" +version = "69.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b829e3d7e9cc74c7e315ee8edb185bf4190da5acde74afd7fc59c35b1f086e7" +dependencies = [ + "cc", + "pkg-config", +] + [[package]] name = "oorandom" version = "11.1.3" @@ -2700,9 +3115,15 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" dependencies = [ - "num-traits 0.2.16", + "num-traits 0.2.17", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parity-scale-codec" version = "3.6.4" @@ -2798,6 +3219,12 @@ dependencies = [ "digest", ] +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + [[package]] name = "percent-encoding" version = "2.3.0" @@ -2811,7 +3238,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.0.0", + "indexmap 2.0.2", ] [[package]] @@ -2844,7 +3271,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -2889,6 +3316,48 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +[[package]] +name = "plist" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdc0001cfea3db57a2e24bc0d818e9e20e554b5f97fabb9bc231dc240269ae06" +dependencies = [ + "base64 0.21.4", + "indexmap 1.9.3", + "line-wrap", + "quick-xml", + "serde", + "time", +] + +[[package]] +name = "plotters" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +dependencies = [ + "num-traits 0.2.17", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" + +[[package]] +name = "plotters-svg" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +dependencies = [ + "plotters-backend", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2921,6 +3390,16 @@ dependencies = [ "pretty_assertions", ] +[[package]] +name = "prettyplease" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +dependencies = [ + "proc-macro2", + "syn 2.0.38", +] + [[package]] name = "primitive-types" version = "0.12.1" @@ -2970,13 +3449,22 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] +[[package]] +name = "quick-xml" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" +dependencies = [ + "memchr", +] + [[package]] name = "quote" version = "1.0.33" @@ -3028,6 +3516,26 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" +[[package]] +name = "rayon" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.2.16" @@ -3059,33 +3567,54 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.4" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" +checksum = "d119d7c7ca818f8a53c300863d4f87566aac09943aef5b355bb83969dae75d87" dependencies = [ "aho-corasick", "memchr", - "regex-automata", - "regex-syntax", + "regex-automata 0.4.1", + "regex-syntax 0.8.0", ] [[package]] name = "regex-automata" -version = "0.3.7" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465c6fc0621e4abc4187a2bda0937bfd4f722c2730b29562e19689ea796c9a4b" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.0", ] +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "regex-syntax" version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +[[package]] +name = "regex-syntax" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3cbb081b9784b07cceb8824c8583f86db4814d172ab043f3c23f7dc600bf83d" + [[package]] name = "relative-path" version = "1.9.0" @@ -3094,11 +3623,11 @@ checksum = "c707298afce11da2efef2f600116fa93ffa7a032b5d7b628aa17711ec81383ca" [[package]] name = "reqwest" -version = "0.11.20" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.3", + "base64 0.21.4", "bytes", "encoding_rs", "futures-core", @@ -3120,6 +3649,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "system-configuration", "tokio", "tokio-rustls", "tower-service", @@ -3127,7 +3657,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 0.25.2", + "webpki-roots", "winreg", ] @@ -3217,9 +3747,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.11" +version = "0.38.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0c3dde1fc030af041adc40e79c0e7fbcf431dd24870053d187d7c66e4b87453" +checksum = "5a74ee2d7c2581cd139b42447d7d9389b889bdaad3a73f1ebb16f2a3237bb19c" dependencies = [ "bitflags 2.4.0", "errno", @@ -3236,7 +3766,7 @@ checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", - "rustls-webpki 0.101.4", + "rustls-webpki", "sct", ] @@ -3246,24 +3776,14 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.3", + "base64 0.21.4", ] [[package]] name = "rustls-webpki" -version = "0.100.2" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e98ff011474fa39949b7e5c0428f9b4937eda7da7848bbb947786b7be0b27dab" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "rustls-webpki" -version = "0.101.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ "ring", "untrusted", @@ -3281,6 +3801,12 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + [[package]] name = "salsa" version = "0.16.1" @@ -3319,11 +3845,20 @@ dependencies = [ "cipher", ] +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "schemars" -version = "0.8.13" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763f8cd0d4c71ed8389c90cb8100cba87e763bd01a8e614d4f0af97bcd50a161" +checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c" dependencies = [ "dyn-clone", "indexmap 1.9.3", @@ -3334,9 +3869,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.13" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0f696e21e10fa546b7ffb1c9672c6de8fbc7a81acf59524386d8639bf12737" +checksum = "e85e2a16b12bdb763244c69ab79363d71db2b4b918a2def53f80b02e0574b13c" dependencies = [ "proc-macro2", "quote", @@ -3374,9 +3909,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" @@ -3395,7 +3930,7 @@ checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -3411,9 +3946,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ "itoa", "ryu", @@ -3474,11 +4009,11 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ca3b16a3d82c4088f343b7480a93550b3eabe1a358569c2dfe38bbcead07237" dependencies = [ - "base64 0.21.3", + "base64 0.21.4", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.0.0", + "indexmap 2.0.2", "serde", "serde_json", "serde_with_macros 3.3.0", @@ -3494,7 +4029,7 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -3506,14 +4041,14 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -3522,9 +4057,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -3541,6 +4076,27 @@ dependencies = [ "keccak", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shell-words" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" + +[[package]] +name = "shlex" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -3565,11 +4121,20 @@ dependencies = [ "autocfg", ] +[[package]] +name = "slug" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373" +dependencies = [ + "deunicode", +] + [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "smol_str" @@ -3592,9 +4157,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ "libc", "windows-sys", @@ -3625,7 +4190,7 @@ checksum = "8fcb61961b91757a9bc2d11549067445b2f921bd957f53710db35449767a1ba3" dependencies = [ "starknet-accounts", "starknet-contract", - "starknet-core", + "starknet-core 0.5.1", "starknet-crypto 0.6.0", "starknet-ff", "starknet-macros", @@ -3640,7 +4205,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "111ed887e4db14f0df1f909905e7737e4730770c8ed70997b58a71d5d940daac" dependencies = [ "async-trait", - "starknet-core", + "starknet-core 0.5.1", "starknet-providers", "starknet-signers", "thiserror", @@ -3656,7 +4221,7 @@ dependencies = [ "serde_json", "serde_with 2.3.3", "starknet-accounts", - "starknet-core", + "starknet-core 0.5.1", "starknet-providers", "thiserror", ] @@ -3667,7 +4232,25 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91f89c79b641618de8aa9668d74c6b6634659ceca311c6318a35c025f9d4d969" dependencies = [ - "base64 0.21.3", + "base64 0.21.4", + "flate2", + "hex", + "serde", + "serde_json", + "serde_json_pythonic", + "serde_with 2.3.3", + "sha3", + "starknet-crypto 0.6.0", + "starknet-ff", +] + +[[package]] +name = "starknet-core" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14139b1c39bdc2f1e663c12090ff5108fe50ebe62c09e15e32988dfaf445a7e4" +dependencies = [ + "base64 0.21.4", "flate2", "hex", "serde", @@ -3690,7 +4273,7 @@ dependencies = [ "hmac", "num-bigint", "num-integer", - "num-traits 0.2.16", + "num-traits 0.2.17", "rfc6979", "sha2", "starknet-crypto-codegen", @@ -3710,7 +4293,7 @@ dependencies = [ "hmac", "num-bigint", "num-integer", - "num-traits 0.2.16", + "num-traits 0.2.17", "rfc6979", "sha2", "starknet-crypto-codegen", @@ -3727,7 +4310,7 @@ checksum = "af6527b845423542c8a16e060ea1bc43f67229848e7cd4c4d80be994a84220ce" dependencies = [ "starknet-curve 0.4.0", "starknet-ff", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -3765,12 +4348,12 @@ dependencies = [ [[package]] name = "starknet-macros" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a5865ee0ed22ade86bdf45e7c09c5641f1c59ccae12c21ecde535b2b6bf64a" +checksum = "ef846b6bb48fc8c3e9a2aa9b5b037414f04a908d9db56493a3ae69a857eb2506" dependencies = [ - "starknet-core", - "syn 2.0.29", + "starknet-core 0.6.1", + "syn 2.0.38", ] [[package]] @@ -3788,7 +4371,7 @@ dependencies = [ "serde", "serde_json", "serde_with 2.3.3", - "starknet-core", + "starknet-core 0.5.1", "thiserror", "url", ] @@ -3804,7 +4387,7 @@ dependencies = [ "clap", "coverage-helper", "mimalloc", - "num-traits 0.2.16", + "num-traits 0.2.17", "serde", "starknet_in_rust", ] @@ -3820,7 +4403,7 @@ dependencies = [ "crypto-bigint", "eth-keystore", "rand", - "starknet-core", + "starknet-core 0.5.1", "starknet-crypto 0.6.0", "thiserror", ] @@ -3849,12 +4432,13 @@ version = "0.4.0" dependencies = [ "anyhow", "assert_matches", - "base64 0.21.3", + "base64 0.21.4", "cairo-lang-casm", "cairo-lang-runner", "cairo-lang-sierra", "cairo-lang-starknet", "cairo-lang-utils", + "cairo-native", "cairo-vm", "coverage-helper", "flate2", @@ -3866,7 +4450,7 @@ dependencies = [ "mimalloc", "num-bigint", "num-integer", - "num-traits 0.2.16", + "num-traits 0.2.17", "once_cell", "pretty_assertions_sorted", "serde", @@ -3877,6 +4461,8 @@ dependencies = [ "starknet-crypto 0.5.1", "starknet_api", "thiserror", + "tracing", + "tracing-subscriber", ] [[package]] @@ -3942,21 +4528,76 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "syntect" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e02b4b303bf8d08bfeb0445cba5068a3d306b6baece1d5582171a9bf49188f91" +dependencies = [ + "bincode 1.3.3", + "bitflags 1.3.2", + "fancy-regex", + "flate2", + "fnv", + "once_cell", + "onig", + "plist", + "regex-syntax 0.7.5", + "serde", + "serde_json", + "thiserror", + "walkdir", + "yaml-rust", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tap" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "tblgen" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d19c09266feb8b16718d1183044d14703a0b4b59e55ce8beb4d6e21dd066b1b" +dependencies = [ + "bindgen 0.66.1", + "cc", + "paste", + "thiserror", +] + [[package]] name = "tempfile" version = "3.8.0" @@ -3981,59 +4622,69 @@ dependencies = [ "winapi", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys", +] + [[package]] name = "test-case" -version = "3.1.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a1d6e7bde536b0412f20765b76e921028059adfd1b90d8974d33fd3c91b25df" +checksum = "c8f1e820b7f1d95a0cdbf97a5df9de10e1be731983ab943e56703ac1b8e9d425" dependencies = [ "test-case-macros", ] [[package]] name = "test-case-core" -version = "3.1.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d10394d5d1e27794f772b6fc854c7e91a2dc26e2cbf807ad523370c2a59c0cee" +checksum = "54c25e2cb8f5fcd7318157634e8838aa6f7e4715c96637f969fabaccd1ef5462" dependencies = [ "cfg-if", "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] name = "test-case-macros" -version = "3.1.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb9a44b1c6a54c1ba58b152797739dba2a83ca74e18168a68c980eb142f9404" +checksum = "37cfd7bbc88a0104e304229fba519bdc45501a30b760fb72240342f1289ad257" dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", "test-case-core", ] [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -4056,6 +4707,16 @@ dependencies = [ "thiserror-impl-no-std", ] +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + [[package]] name = "time" version = "0.3.26" @@ -4093,6 +4754,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -4110,9 +4781,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ "backtrace", "bytes", @@ -4121,7 +4792,7 @@ dependencies = [ "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2 0.5.4", "tokio-macros", "windows-sys", ] @@ -4134,7 +4805,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -4149,9 +4820,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -4163,9 +4834,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ "serde", "serde_spanned", @@ -4184,11 +4855,11 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "serde", "serde_spanned", "toml_datetime", @@ -4210,9 +4881,21 @@ dependencies = [ "cfg-if", "log", "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "tracing-core" version = "0.1.31" @@ -4220,6 +4903,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", ] [[package]] @@ -4228,11 +4941,17 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "uint" @@ -4263,9 +4982,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -4288,6 +5007,18 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + +[[package]] +name = "unindent" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" + [[package]] name = "untrusted" version = "0.7.1" @@ -4296,20 +5027,20 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "ureq" -version = "2.7.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b11c96ac7ee530603dcdf68ed1557050f374ce55a5a07193ebf8cbc9f8927e9" +checksum = "f5ccd538d4a604753ebc2f17cd9946e89b77bf87f6a8e2309667c6f2e87855e3" dependencies = [ - "base64 0.21.3", + "base64 0.21.4", "flate2", "log", "once_cell", "rustls", - "rustls-webpki 0.100.2", + "rustls-webpki", "serde", "serde_json", "url", - "webpki-roots 0.23.1", + "webpki-roots", ] [[package]] @@ -4345,12 +5076,28 @@ dependencies = [ "serde", ] +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "walkdir" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" @@ -4387,7 +5134,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -4421,7 +5168,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4444,18 +5191,21 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.23.1" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" -dependencies = [ - "rustls-webpki 0.100.2", -] +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] -name = "webpki-roots" -version = "0.25.2" +name = "which" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] [[package]] name = "winapi" @@ -4473,6 +5223,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -4556,9 +5315,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.15" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +checksum = "037711d82167854aff2018dfd193aa0fef5370f456732f0d5a0c59b0f1b4b907" dependencies = [ "memchr", ] @@ -4582,6 +5341,12 @@ dependencies = [ "tap", ] +[[package]] +name = "xdg" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" + [[package]] name = "xshell" version = "0.2.5" @@ -4597,6 +5362,15 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e2c411759b501fb9501aac2b1b2d287a6e93e5bdcf13c25306b23e1b716dd0e" +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "yansi" version = "0.5.1" @@ -4620,7 +5394,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index ccb77a306..c4b08bf43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,54 +15,57 @@ metrics = [] members = ["cli", "fuzzer", "rpc_state_reader"] [workspace.dependencies] +cairo-lang-casm = "2.2.0" +cairo-lang-runner = "2.2.0" +cairo-lang-sierra = "2.2.0" +cairo-lang-starknet = "2.2.0" +cairo-lang-utils = "2.2.0" cairo-vm = { version = "0.8.5", features = ["cairo-1-hints"] } -starknet_api = "0.4.1" num-traits = "0.2.15" starknet = "0.5.0" +starknet_api = "0.4.1" thiserror = "1.0.32" -cairo-lang-starknet = "2.1.0-rc4" -cairo-lang-casm = "2.1.0-rc4" -cairo-lang-runner = "2.1.0-rc4" -cairo-lang-sierra = "2.1.0-rc4" -cairo-lang-utils = "2.1.0-rc4" [dependencies] -cairo-lang-starknet = { workspace = true } +anyhow = "1.0.66" +base64 = { version = "0.21.0", default-features = false, features = ["alloc"] } cairo-lang-casm = { workspace = true } cairo-lang-runner = { workspace = true } cairo-lang-sierra = { workspace = true } +cairo-lang-starknet = { workspace = true } cairo-lang-utils = { workspace = true } +cairo-native = { git = "https://github.com/lambdaclass/cairo_native", rev = "03cd09ba3e51852da2234fb32a74056787abba8e", optional = true } cairo-vm = { workspace = true, features = ["cairo-1-hints"] } +flate2 = "1.0.25" getset = "0.1.2" +hex = "0.4.3" +# TODO: Replace with sha3. We should look how to integrate it correctly to calculate sn_keccak +keccak = "0.1.3" lazy_static = "1.4.0" +mimalloc = { version = "0.1.29", default-features = false, optional = true } num-bigint = { version = "0.4", features = ["serde"] } num-integer = "0.1.45" num-traits = { workspace = true } +once_cell = "1.17.1" +sha3 = "0.10.1" serde = { version = "1.0.152", features = ["derive"] } serde_json = { version = "1.0", features = [ "arbitrary_precision", "raw_value", ] } -sha3 = "0.10.1" -# TODO: Replace with sha3. We should look how to integrate it correctly to calculate sn_keccak -keccak = "0.1.3" +serde_json_pythonic = "0.1.2" +starknet = { workspace = true } starknet_api = { workspace = true } starknet-crypto = "0.5.1" thiserror = { workspace = true } -mimalloc = { version = "0.1.29", default-features = false, optional = true } -hex = "0.4.3" -anyhow = "1.0.66" -once_cell = "1.17.1" -starknet = { workspace = true } -base64 = { version = "0.21.0", default-features = false, features = ["alloc"] } -flate2 = "1.0.25" -serde_json_pythonic = "0.1.2" +tracing = "0.1.37" [dev-dependencies] assert_matches = "1.5.0" coverage-helper = "0.2.0" lru = "0.11.0" pretty_assertions_sorted = "1.2.3" +tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } [[bench]] path = "bench/internals.rs" diff --git a/Makefile b/Makefile index 689a4695b..61183ab26 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build check clean clippy compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra \ +.PHONY: usage build check clean clippy compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra \ compile-cairo-2-casm compile-cairo-2-sierra coverage deps test heaptrack check-python-version export PATH:=$(shell pyenv root)/shims:$(PATH) @@ -10,7 +10,6 @@ ifeq ($(OS), Darwin) export LDFLAGS += -L/opt/homebrew/opt/gmp/lib endif - CAIRO_SOURCES=$(wildcard cairo_programs/*.cairo) CAIRO_TARGETS=$(patsubst %.cairo,%.json,$(CAIRO_SOURCES)) CAIRO_ABI_TARGETS=$(patsubst %.cairo,%_abi.json,$(CAIRO_SOURCES)) @@ -28,6 +27,24 @@ STARKNET_SIERRA_COMPILE_CAIRO_1:=cairo1/bin/starknet-sierra-compile STARKNET_COMPILE_CAIRO_2:=cairo2/bin/starknet-compile STARKNET_SIERRA_COMPILE_CAIRO_2:=cairo2/bin/starknet-sierra-compile +usage: + @echo 'Usage:' + @echo ' build: Builds the Rust code' + @echo ' check: Runs cargo check' + @echo ' deps: Installs dependencies' + @echo ' deps-macos: Installs depedencies for MacOS' + @echo ' clean: Cleans all build artifacts' + @echo ' clippy: Runs clippy' + @echo ' test: Runs all tests' + @echo ' test-cairo-1: Runs the Cairo 1 tests' + @echo ' test-cairo-2: Runs the Cairo 2 tests' + @echo ' test-doctests: Runs the doctests' + @echo ' coverage: Runs everything necessary to generate the coverage report' + @echo ' coverage-report: Just generates the coverage report' + @echo ' heaptrack: Runs the heaptrack script' + @echo ' flamegraph: Runs cargo flamegraph' + @echo ' benchmark: Runs the benchmarks scripts' + # # VENV rules. # @@ -98,7 +115,7 @@ CAIRO_2_COMPILED_SIERRA_CONTRACTS:=$(patsubst $(CAIRO_2_CONTRACTS_TEST_DIR)/%.ca CAIRO_2_COMPILED_CASM_CONTRACTS:= $(patsubst $(CAIRO_2_CONTRACTS_TEST_DIR)/%.sierra, $(CAIRO_2_CONTRACTS_TEST_DIR)/%.casm, $(CAIRO_2_COMPILED_SIERRA_CONTRACTS)) $(CAIRO_2_CONTRACTS_TEST_DIR)/%.sierra: $(CAIRO_2_CONTRACTS_TEST_DIR)/%.cairo - $(STARKNET_COMPILE_CAIRO_2) $< $@ + $(STARKNET_COMPILE_CAIRO_2) --single-file $< $@ --replace-ids $(CAIRO_2_CONTRACTS_TEST_DIR)/%.casm: $(CAIRO_2_CONTRACTS_TEST_DIR)/%.sierra $(STARKNET_SIERRA_COMPILE_CAIRO_2) --add-pythonic-hints $< $@ @@ -106,8 +123,7 @@ $(CAIRO_2_CONTRACTS_TEST_DIR)/%.casm: $(CAIRO_2_CONTRACTS_TEST_DIR)/%.sierra compile-cairo-2-sierra: $(CAIRO_2_COMPILED_SIERRA_CONTRACTS) compile-cairo-2-casm: $(CAIRO_2_COMPILED_CASM_CONTRACTS) - -CAIRO_2_VERSION=2.0.1 +CAIRO_2_VERSION=2.2.0 cairo-repo-2-dir = cairo2 cairo-repo-2-dir-macos = cairo2-macos @@ -133,20 +149,21 @@ cairo-%-macos.tar: cairo-%.tar: curl -L -o "$@" "https://github.com/starkware-libs/cairo/releases/download/v$*/release-x86_64-unknown-linux-musl.tar.gz" - # ================= # Normal rules. # ================= -build: compile-cairo compile-starknet +build: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra compile-cairo-2-casm compile-cairo-2-sierra cargo build --release --workspace -check: compile-cairo compile-starknet +check: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra compile-cairo-2-casm compile-cairo-2-sierra cargo check --workspace --all-targets deps: check-python-version build-cairo-2-compiler build-cairo-1-compiler cargo install flamegraph --version 0.6.2 cargo install cargo-llvm-cov --version 0.5.14 + -pyenv && pyenv install -s pypy3.9-7.3.9 + -pyenv && pyenv install -s 3.9.15 python3.9 -m venv starknet-venv . starknet-venv/bin/activate && $(MAKE) deps-venv cargo install cargo-nextest --version 0.9.49 @@ -154,6 +171,8 @@ deps: check-python-version build-cairo-2-compiler build-cairo-1-compiler deps-macos: check-python-version build-cairo-2-compiler-macos build-cairo-1-compiler-macos cargo install flamegraph --version 0.6.2 cargo install cargo-llvm-cov --version 0.5.14 + -pyenv install -s pypy3.9-7.3.9 + -pyenv install -s 3.9.15 python3.9 -m venv starknet-venv . starknet-venv/bin/activate && $(MAKE) deps-venv cargo install cargo-nextest @@ -173,8 +192,8 @@ clean: -rm -rf cairo2/ -rm -rf cairo-*.tar -clippy: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-2-casm - cargo clippy --workspace --all-targets -- -D warnings +clippy: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra compile-cairo-2-casm compile-cairo-2-sierra + cargo clippy --workspace --all-targets --all-features -- -D warnings test: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra compile-cairo-2-casm compile-cairo-2-sierra echo "Cairo1 tests" @@ -182,11 +201,14 @@ test: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra echo "Cairo2 tests" $(MAKE) test-cairo-2 -test-cairo-1: - cargo nextest run --workspace --all-targets --features=cairo_1_tests +test-cairo-1: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra compile-cairo-2-casm compile-cairo-2-sierra + cargo nextest run --workspace --all-targets --features=cairo_1_tests,metrics + +test-cairo-2: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra compile-cairo-2-casm compile-cairo-2-sierra + cargo nextest run --workspace --all-targets --features=metrics -test-cairo-2: - cargo nextest run --workspace --all-targets +test-cairo-native: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra compile-cairo-2-casm compile-cairo-2-sierra + cargo nextest run --workspace --test cairo_native --features=cairo-native test-doctests: cargo test --workspace --doc @@ -194,7 +216,7 @@ test-doctests: coverage: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-2-casm $(MAKE) coverage-report -coverage-report: +coverage-report: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra compile-cairo-2-casm compile-cairo-2-sierra cargo +nightly llvm-cov nextest --lcov --ignore-filename-regex 'main.rs' --output-path lcov.info --release heaptrack: diff --git a/README.md b/README.md index b90b9f1e5..43ce64184 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ It makes use of [cairo-vm](https://github.com/lambdaclass/cairo-vm), the Rust im ### Installation +If you run `make` on it's own it will print out the main targets and their description. + Run the following make targets to have a working environment (if in Mac or if you encounter an error, see the subsection below): #### Linux (x86-64) @@ -98,7 +100,19 @@ In Mac you'll also need to tell the script where to find the gmp lib: export CFLAGS=-I/opt/homebrew/opt/gmp/include LDFLAGS=-L/opt/homebrew/opt/gmp/lib ``` +### Cairo Native support + +Starknet in Rust can be integrated with [Cairo Native](https://github.com/lambdaclass/cairo_native), which makes the execution of sierra programs possible through native machine code. To use it, the following needs to be setup: + +- LLVM `17` needs to be installed and the `MLIR_SYS_170_PREFIX` and `TABLEGEN_170_PREFIX` environment variable needs to point to said installation. In macOS, run + ``` + brew install llvm@17 + export MLIR_SYS_170_PREFIX=/opt/homebrew/opt/llvm@17 + export TABLEGEN_170_PREFIX=/opt/homebrew/opt/llvm@17 + ``` + and you're set. +Afterwards, compiling with the feature flag `cairo-native` will enable native execution. You can check out some example test code that uses it under `tests/cairo_native.rs`. ## 🚀 Usage @@ -109,7 +123,6 @@ You can find a tutorial on running contracts [here](/examples/contract_execution ### Using the CLI You can find an example on how to use the CLI [here](/docs/CLI_USAGE_EXAMPLE.md) - ### Customization #### Contract class cache behavior @@ -153,6 +166,11 @@ cache.extend(state1.state.drain_private_contract_class_cache()); cache.extend(state2.state.drain_private_contract_class_cache()); ``` +#### Logging configuration + +This project uses the [`tracing`](https://crates.io/crates/tracing) crate as a library. Check out +its documentation for more information. + ### Testing [Add an Infura API key.](#rpc-state-reader) diff --git a/bench/internals.rs b/bench/internals.rs index abb10cd2e..bc64f8075 100644 --- a/bench/internals.rs +++ b/bench/internals.rs @@ -81,7 +81,7 @@ fn deploy_account() { let block_context = &Default::default(); for _ in 0..RUNS { - let mut state_copy = state.clone(); + let mut state_copy = state.clone_for_testing(); let class_hash = *CLASS_HASH_BYTES; let signature = SIGNATURE.clone(); scope(|| { @@ -116,7 +116,7 @@ fn declare() { let block_context = &Default::default(); for _ in 0..RUNS { - let mut cloned_state = state.clone(); + let mut cloned_state = state.clone_for_testing(); let class = CONTRACT_CLASS.clone(); let address = CONTRACT_ADDRESS.clone(); scope(|| { @@ -158,7 +158,7 @@ fn deploy() { let block_context = &Default::default(); for _ in 0..RUNS { - let mut state_copy = state.clone(); + let mut state_copy = state.clone_for_testing(); let salt = felt_str!( "2669425616857739096022668060305620640217901643963991674344872184515580705509" ); @@ -213,7 +213,7 @@ fn invoke() { let _deploy_exec_info = deploy.execute(&mut state, block_context).unwrap(); for _ in 0..RUNS { - let mut state_copy = state.clone(); + let mut state_copy = state.clone_for_testing(); let address = CONTRACT_ADDRESS.clone(); let selector = VALIDATE_ENTRY_POINT_SELECTOR.clone(); let signature = SIGNATURE.clone(); diff --git a/cairo_programs/erc20.sierra b/cairo_programs/erc20.sierra new file mode 100644 index 000000000..d7a57bf24 --- /dev/null +++ b/cairo_programs/erc20.sierra @@ -0,0 +1,5012 @@ +type RangeCheck = RangeCheck; +type GasBuiltin = GasBuiltin; +type felt252 = felt252; +type Array = Array; +type Snapshot> = Snapshot>; +type core::array::Span:: = Struct>>; +type u32 = u32; +type core::panics::Panic = Struct; +type Tuple> = Struct>; +type Tuple> = Struct>; +type core::panics::PanicResult::<(core::array::Span::,)> = Enum>, Tuple>>; +type System = System; +type BuiltinCosts = BuiltinCosts; +type erc20::erc20::erc_20::name::ContractState = Struct; +type erc20::erc20::erc_20::symbol::ContractState = Struct; +type erc20::erc20::erc_20::decimals::ContractState = Struct; +type erc20::erc20::erc_20::total_supply::ContractState = Struct; +type erc20::erc20::erc_20::balances::ContractState = Struct; +type erc20::erc20::erc_20::allowances::ContractState = Struct; +type erc20::erc20::erc_20::ContractState = Struct; +type Tuple = Struct; +type core::panics::PanicResult::<(core::felt252,)> = Enum, Tuple>>; +type Unit = Struct; +type u8 = u8; +type Tuple = Struct; +type core::panics::PanicResult::<(core::integer::u8,)> = Enum, Tuple>>; +type u128 = u128; +type core::integer::u256 = Struct; +type Tuple = Struct; +type core::panics::PanicResult::<(core::integer::u256,)> = Enum, Tuple>>; +type ContractAddress = ContractAddress; +type core::option::Option:: = Enum; +type Pedersen = Pedersen; +type core::option::Option:: = Enum; +type Tuple = Struct; +type core::panics::PanicResult::<(erc20::erc20::erc_20::ContractState, ())> = Enum, Tuple>>; +type core::option::Option:: = Enum; +type core::option::Option:: = Enum; +type Tuple = Struct; +type core::option::Option:: = Enum; +type Tuple = Struct; +type core::panics::PanicResult::<(core::starknet::contract_address::ContractAddress,)> = Enum, Tuple>>; +type Box = Box; +type core::option::Option::> = Enum, Unit>; +type Tuple = Struct; +type core::panics::PanicResult::<(erc20::erc20::erc_20::name::ContractState, ())> = Enum, Tuple>>; +type Tuple = Struct; +type core::panics::PanicResult::<(erc20::erc20::erc_20::symbol::ContractState, ())> = Enum, Tuple>>; +type Tuple = Struct; +type core::panics::PanicResult::<(erc20::erc20::erc_20::decimals::ContractState, ())> = Enum, Tuple>>; +type NonZero = NonZero; +type core::bool = Enum; +type Tuple = Struct; +type core::panics::PanicResult::<(erc20::erc20::erc_20::total_supply::ContractState, ())> = Enum, Tuple>>; +type Tuple = Struct; +type core::panics::PanicResult::<(erc20::erc20::erc_20::balances::ContractState, ())> = Enum, Tuple>>; +type erc20::erc20::erc_20::Transfer = Struct; +type erc20::erc20::erc_20::Approval = Struct; +type erc20::erc20::erc_20::Event = Enum; +type StorageBaseAddress = StorageBaseAddress; +type StorageAddress = StorageAddress; +type core::result::Result::> = Enum>; +type core::result::Result::> = Enum>; +type Tuple>> = Struct>>; +type core::panics::PanicResult::<(core::result::Result::>,)> = Enum>>, Tuple>>; +type core::result::Result::> = Enum>; +type Tuple>> = Struct>>; +type core::panics::PanicResult::<(core::result::Result::>,)> = Enum>>, Tuple>>; +type u64 = u64; +type core::starknet::info::BlockInfo = Struct; +type Box = Box; +type core::starknet::info::TxInfo = Struct, felt252, felt252, felt252>; +type Box = Box; +type core::starknet::info::ExecutionInfo = Struct, Box, ContractAddress, ContractAddress, felt252>; +type Box = Box; +type Tuple> = Struct>; +type core::panics::PanicResult::<(core::box::Box::,)> = Enum>, Tuple>>; +type Tuple = Struct; +type core::panics::PanicResult::<(erc20::erc20::erc_20::allowances::ContractState, ())> = Enum, Tuple>>; +type core::result::Result::<(), core::array::Array::> = Enum>; +type Tuple = Struct; +type core::panics::PanicResult::<((),)> = Enum, Tuple>>; +type core::result::Result::> = Enum>; +type Tuple>> = Struct>>; +type core::panics::PanicResult::<(core::result::Result::>,)> = Enum>>, Tuple>>; +type core::result::Result::, core::array::Array::> = Enum, Array>; +type Tuple = Struct; +type Tuple = Struct; + +libfunc revoke_ap_tracking = revoke_ap_tracking; +libfunc withdraw_gas = withdraw_gas; +libfunc branch_align = branch_align; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc array_len = array_len; +libfunc snapshot_take = snapshot_take; +libfunc drop = drop; +libfunc u32_const<0> = u32_const<0>; +libfunc rename = rename; +libfunc store_temp = store_temp; +libfunc store_temp = store_temp; +libfunc u32_eq = u32_eq; +libfunc array_new = array_new; +libfunc felt252_const<7733229381460288120802334208475838166080759535023995805565484692595> = felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>; +libfunc store_temp = store_temp; +libfunc array_append = array_append; +libfunc struct_construct = struct_construct; +libfunc struct_construct>> = struct_construct>>; +libfunc enum_init,)>, 1> = enum_init,)>, 1>; +libfunc store_temp = store_temp; +libfunc store_temp = store_temp; +libfunc store_temp,)>> = store_temp,)>>; +libfunc get_builtin_costs = get_builtin_costs; +libfunc store_temp = store_temp; +libfunc withdraw_gas_all = withdraw_gas_all; +libfunc struct_construct = struct_construct; +libfunc struct_construct = struct_construct; +libfunc struct_construct = struct_construct; +libfunc struct_construct = struct_construct; +libfunc struct_construct = struct_construct; +libfunc struct_construct = struct_construct; +libfunc struct_construct = struct_construct; +libfunc snapshot_take = snapshot_take; +libfunc drop = drop; +libfunc store_temp = store_temp; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc snapshot_take = snapshot_take; +libfunc drop = drop; +libfunc store_temp> = store_temp>; +libfunc function_call = function_call; +libfunc drop = drop; +libfunc snapshot_take> = snapshot_take>; +libfunc drop> = drop>; +libfunc struct_construct> = struct_construct>; +libfunc struct_construct>> = struct_construct>>; +libfunc enum_init,)>, 0> = enum_init,)>, 0>; +libfunc felt252_const<375233589013918064796019> = felt252_const<375233589013918064796019>; +libfunc drop> = drop>; +libfunc function_call = function_call; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc snapshot_take = snapshot_take; +libfunc drop = drop; +libfunc store_temp = store_temp; +libfunc function_call = function_call; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc snapshot_take = snapshot_take; +libfunc drop = drop; +libfunc store_temp = store_temp; +libfunc function_call = function_call; +libfunc store_temp> = store_temp>; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc drop = drop; +libfunc store_temp = store_temp; +libfunc store_temp = store_temp; +libfunc function_call = function_call; +libfunc felt252_const<485748461484230571791265682659113160264223489397539653310998840191492913> = felt252_const<485748461484230571791265682659113160264223489397539653310998840191492913>; +libfunc function_call = function_call; +libfunc felt252_const<485748461484230571791265682659113160264223489397539653310998840191492914> = felt252_const<485748461484230571791265682659113160264223489397539653310998840191492914>; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc drop> = drop>; +libfunc function_call = function_call; +libfunc felt252_const<485748461484230571791265682659113160264223489397539653310998840191492915> = felt252_const<485748461484230571791265682659113160264223489397539653310998840191492915>; +libfunc function_call = function_call; +libfunc function_call = function_call; +libfunc function_call = function_call; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc function_call = function_call; +libfunc felt252_const<485748461484230571791265682659113160264223489397539653310998840191492917> = felt252_const<485748461484230571791265682659113160264223489397539653310998840191492917>; +libfunc felt252_const<485748461484230571791265682659113160264223489397539653310998840191492916> = felt252_const<485748461484230571791265682659113160264223489397539653310998840191492916>; +libfunc struct_deconstruct = struct_deconstruct; +libfunc drop = drop; +libfunc drop = drop; +libfunc drop = drop; +libfunc drop = drop; +libfunc drop = drop; +libfunc store_temp = store_temp; +libfunc function_call = function_call; +libfunc struct_construct> = struct_construct>; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc rename = rename; +libfunc struct_construct = struct_construct; +libfunc store_temp = store_temp; +libfunc drop = drop; +libfunc store_temp = store_temp; +libfunc function_call = function_call; +libfunc store_temp = store_temp; +libfunc function_call = function_call; +libfunc struct_construct> = struct_construct>; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc rename = rename; +libfunc u8_to_felt252 = u8_to_felt252; +libfunc store_temp = store_temp; +libfunc function_call = function_call; +libfunc struct_construct> = struct_construct>; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc dup = dup; +libfunc struct_deconstruct = struct_deconstruct; +libfunc drop = drop; +libfunc store_temp = store_temp; +libfunc function_call = function_call; +libfunc rename> = rename>; +libfunc rename = rename; +libfunc contract_address_try_from_felt252 = contract_address_try_from_felt252; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc store_temp = store_temp; +libfunc function_call = function_call; +libfunc struct_construct> = struct_construct>; +libfunc store_temp = store_temp; +libfunc store_temp> = store_temp>; +libfunc function_call = function_call; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc struct_construct = struct_construct; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc function_call = function_call; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc struct_construct> = struct_construct>; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc dup = dup; +libfunc function_call = function_call; +libfunc function_call = function_call; +libfunc snapshot_take = snapshot_take; +libfunc function_call = function_call; +libfunc function_call = function_call; +libfunc array_snapshot_pop_front = array_snapshot_pop_front; +libfunc enum_init>, 0> = enum_init>, 0>; +libfunc store_temp>> = store_temp>>; +libfunc store_temp>> = store_temp>>; +libfunc jump = jump; +libfunc enum_init>, 1> = enum_init>, 1>; +libfunc enum_match>> = enum_match>>; +libfunc unbox = unbox; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc function_call = function_call; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc contract_address_to_felt252 = contract_address_to_felt252; +libfunc felt252_const<0> = felt252_const<0>; +libfunc felt252_sub = felt252_sub; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc felt252_is_zero = felt252_is_zero; +libfunc enum_init = enum_init; +libfunc store_temp = store_temp; +libfunc drop> = drop>; +libfunc enum_init = enum_init; +libfunc bool_not_impl = bool_not_impl; +libfunc enum_match = enum_match; +libfunc felt252_const<7300388948442106731950660484798539862217172507820428101544021685107> = felt252_const<7300388948442106731950660484798539862217172507820428101544021685107>; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc contract_address_const<0> = contract_address_const<0>; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc struct_construct = struct_construct; +libfunc enum_init = enum_init; +libfunc store_temp = store_temp; +libfunc function_call>> = function_call>>; +libfunc drop> = drop>; +libfunc drop> = drop>; +libfunc drop> = drop>; +libfunc storage_base_address_const<1528802474226268325865027367859591458315299653151958663884057507666229546336> = storage_base_address_const<1528802474226268325865027367859591458315299653151958663884057507666229546336>; +libfunc storage_address_from_base = storage_address_from_base; +libfunc store_temp = store_temp; +libfunc storage_read_syscall = storage_read_syscall; +libfunc enum_init>, 0> = enum_init>, 0>; +libfunc store_temp>> = store_temp>>; +libfunc enum_init>, 1> = enum_init>, 1>; +libfunc rename>> = rename>>; +libfunc function_call::unwrap_syscall> = function_call::unwrap_syscall>; +libfunc storage_base_address_const<944713526212149105522785400348068751682982210605126537021911324578866405028> = storage_base_address_const<944713526212149105522785400348068751682982210605126537021911324578866405028>; +libfunc storage_base_address_const<134830404806214277570220174593674215737759987247891306080029841794115377321> = storage_base_address_const<134830404806214277570220174593674215737759987247891306080029841794115377321>; +libfunc store_temp = store_temp; +libfunc function_call = function_call; +libfunc enum_match>,)>> = enum_match>,)>>; +libfunc struct_deconstruct>>> = struct_deconstruct>>>; +libfunc store_temp>> = store_temp>>; +libfunc function_call::unwrap_syscall> = function_call::unwrap_syscall>; +libfunc storage_base_address_const<603278275252936218847294002513349627170936020082667936993356353388973422646> = storage_base_address_const<603278275252936218847294002513349627170936020082667936993356353388973422646>; +libfunc function_call = function_call; +libfunc enum_match>,)>> = enum_match>,)>>; +libfunc struct_deconstruct>>> = struct_deconstruct>>>; +libfunc store_temp>> = store_temp>>; +libfunc function_call::unwrap_syscall> = function_call::unwrap_syscall>; +libfunc rename = rename; +libfunc u128_to_felt252 = u128_to_felt252; +libfunc function_call = function_call; +libfunc function_call = function_call; +libfunc function_call = function_call; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc function_call = function_call; +libfunc enum_match,)>> = enum_match,)>>; +libfunc struct_deconstruct>> = struct_deconstruct>>; +libfunc unbox = unbox; +libfunc struct_deconstruct = struct_deconstruct; +libfunc drop> = drop>; +libfunc drop> = drop>; +libfunc struct_construct> = struct_construct>; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc felt252_const<25936191677694277552149992725516921697451103245639728> = felt252_const<25936191677694277552149992725516921697451103245639728>; +libfunc felt252_const<395754877894504967531585582359572169455970492464> = felt252_const<395754877894504967531585582359572169455970492464>; +libfunc snapshot_take = snapshot_take; +libfunc store_temp = store_temp; +libfunc function_call> = function_call>; +libfunc u128_const<340282366920938463463374607431768211455> = u128_const<340282366920938463463374607431768211455>; +libfunc snapshot_take = snapshot_take; +libfunc u128_eq = u128_eq; +libfunc felt252_const<101313248740993271302566317381896466254801065025584> = felt252_const<101313248740993271302566317381896466254801065025584>; +libfunc function_call = function_call; +libfunc enum_match> = enum_match>; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc struct_construct = struct_construct; +libfunc store_temp = store_temp; +libfunc function_call> = function_call>; +libfunc function_call = function_call; +libfunc felt252_const<39879774624079483812136948410799859986295> = felt252_const<39879774624079483812136948410799859986295>; +libfunc function_call = function_call; +libfunc felt252_const<39879774624085075084607933104993585622903> = felt252_const<39879774624085075084607933104993585622903>; +libfunc u8_try_from_felt252 = u8_try_from_felt252; +libfunc rename = rename; +libfunc rename> = rename>; +libfunc snapshot_take = snapshot_take; +libfunc storage_write_syscall = storage_write_syscall; +libfunc enum_init>, 0> = enum_init>, 0>; +libfunc store_temp>> = store_temp>>; +libfunc enum_init>, 1> = enum_init>, 1>; +libfunc rename>> = rename>>; +libfunc function_call::unwrap_syscall> = function_call::unwrap_syscall>; +libfunc enum_match> = enum_match>; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc struct_construct> = struct_construct>; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc snapshot_take = snapshot_take; +libfunc struct_construct> = struct_construct>; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc snapshot_take = snapshot_take; +libfunc struct_construct> = struct_construct>; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc function_call = function_call; +libfunc snapshot_take = snapshot_take; +libfunc struct_construct> = struct_construct>; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc struct_construct> = struct_construct>; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc function_call::into> = function_call::into>; +libfunc snapshot_take = snapshot_take; +libfunc drop = drop; +libfunc function_call = function_call; +libfunc emit_event_syscall = emit_event_syscall; +libfunc enum_match>> = enum_match>>; +libfunc enum_init>, 0> = enum_init>, 0>; +libfunc struct_construct>>> = struct_construct>>>; +libfunc enum_init>,)>, 0> = enum_init>,)>, 0>; +libfunc store_temp>,)>> = store_temp>,)>>; +libfunc felt252_const<110930490496575599150170734222081291576> = felt252_const<110930490496575599150170734222081291576>; +libfunc enum_init>,)>, 1> = enum_init>,)>, 1>; +libfunc enum_init>, 1> = enum_init>, 1>; +libfunc enum_match>> = enum_match>>; +libfunc dup = dup; +libfunc dup = dup; +libfunc function_call = function_call; +libfunc enum_match>,)>> = enum_match>,)>>; +libfunc struct_deconstruct>>> = struct_deconstruct>>>; +libfunc enum_match>> = enum_match>>; +libfunc u8_const<1> = u8_const<1>; +libfunc storage_address_from_base_and_offset = storage_address_from_base_and_offset; +libfunc enum_init>, 0> = enum_init>, 0>; +libfunc struct_construct>>> = struct_construct>>>; +libfunc enum_init>,)>, 0> = enum_init>,)>, 0>; +libfunc store_temp>,)>> = store_temp>,)>>; +libfunc felt252_const<476442828812030857794232422692155113556837216824> = felt252_const<476442828812030857794232422692155113556837216824>; +libfunc enum_init>,)>, 1> = enum_init>,)>, 1>; +libfunc enum_init>, 1> = enum_init>, 1>; +libfunc drop = drop; +libfunc enum_match>> = enum_match>>; +libfunc felt252_const<1065622543624526936256554561967983185612257046533136611876836524258158810564> = felt252_const<1065622543624526936256554561967983185612257046533136611876836524258158810564>; +libfunc function_call = function_call; +libfunc storage_base_address_from_felt252 = storage_base_address_from_felt252; +libfunc felt252_const<337994139936370667767799129369552596157394447336989834104582481799883947719> = felt252_const<337994139936370667767799129369552596157394447336989834104582481799883947719>; +libfunc function_call::hash> = function_call::hash>; +libfunc u128s_from_felt252 = u128s_from_felt252; +libfunc rename> = rename>; +libfunc get_execution_info_syscall = get_execution_info_syscall; +libfunc enum_init, core::array::Array::>, 0> = enum_init, core::array::Array::>, 0>; +libfunc store_temp, core::array::Array::>> = store_temp, core::array::Array::>>; +libfunc enum_init, core::array::Array::>, 1> = enum_init, core::array::Array::>, 1>; +libfunc rename, core::array::Array::>> = rename, core::array::Array::>>; +libfunc function_call>::unwrap_syscall> = function_call>::unwrap_syscall>; +libfunc struct_construct>> = struct_construct>>; +libfunc enum_init,)>, 0> = enum_init,)>, 0>; +libfunc store_temp,)>> = store_temp,)>>; +libfunc enum_init,)>, 1> = enum_init,)>, 1>; +libfunc function_call = function_call; +libfunc struct_construct> = struct_construct>; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc function_call = function_call; +libfunc function_call = function_call; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc function_call = function_call; +libfunc enum_match>> = enum_match>>; +libfunc struct_construct> = struct_construct>; +libfunc enum_init, 0> = enum_init, 0>; +libfunc store_temp> = store_temp>; +libfunc enum_init, 1> = enum_init, 1>; +libfunc enum_match = enum_match; +libfunc felt252_const<271746229759260285552388728919865295615886751538523744128730118297934206697> = felt252_const<271746229759260285552388728919865295615886751538523744128730118297934206697>; +libfunc function_call = function_call; +libfunc felt252_const<544914742286571513055574265148471203182105283038408585630116262969508767999> = felt252_const<544914742286571513055574265148471203182105283038408585630116262969508767999>; +libfunc function_call = function_call; +libfunc enum_init>, 0> = enum_init>, 0>; +libfunc struct_construct>>> = struct_construct>>>; +libfunc enum_init>,)>, 0> = enum_init>,)>, 0>; +libfunc store_temp>,)>> = store_temp>,)>>; +libfunc enum_init>,)>, 1> = enum_init>,)>, 1>; +libfunc enum_init>, 1> = enum_init>, 1>; +libfunc pedersen = pedersen; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc rename = rename; +libfunc enum_match, core::array::Array::>> = enum_match, core::array::Array::>>; +libfunc enum_init = enum_init; +libfunc u128_overflowing_add = u128_overflowing_add; +libfunc struct_construct> = struct_construct>; +libfunc store_temp> = store_temp>; +libfunc struct_deconstruct> = struct_deconstruct>; +libfunc struct_construct> = struct_construct>; +libfunc store_temp> = store_temp>; +libfunc u128_const<1> = u128_const<1>; +libfunc drop = drop; +libfunc rename> = rename>; +libfunc u128_overflowing_sub = u128_overflowing_sub; +libfunc dup = dup; +libfunc struct_deconstruct = struct_deconstruct; +libfunc function_call = function_call; +libfunc dup = dup; +libfunc struct_deconstruct = struct_deconstruct; +libfunc rename = rename; + +revoke_ap_tracking() -> (); +withdraw_gas([0], [1]) { fallthrough([4], [5]) 87([6], [7]) }; +branch_align() -> (); +struct_deconstruct>([3]) -> ([8]); +array_len([8]) -> ([9]); +snapshot_take([9]) -> ([10], [11]); +drop([10]) -> (); +u32_const<0>() -> ([12]); +snapshot_take([12]) -> ([13], [14]); +drop([13]) -> (); +rename([11]) -> ([15]); +rename([14]) -> ([16]); +store_temp([15]) -> ([15]); +store_temp([4]) -> ([4]); +u32_eq([15], [16]) { fallthrough() 28() }; +branch_align() -> (); +array_new() -> ([17]); +felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>() -> ([18]); +store_temp([18]) -> ([18]); +array_append([17], [18]) -> ([19]); +struct_construct() -> ([20]); +struct_construct>>([20], [19]) -> ([21]); +enum_init,)>, 1>([21]) -> ([22]); +store_temp([4]) -> ([23]); +store_temp([5]) -> ([24]); +store_temp([2]) -> ([25]); +store_temp,)>>([22]) -> ([26]); +return([23], [24], [25], [26]); +branch_align() -> (); +get_builtin_costs() -> ([27]); +store_temp([27]) -> ([27]); +withdraw_gas_all([4], [5], [27]) { fallthrough([28], [29]) 74([30], [31]) }; +branch_align() -> (); +struct_construct() -> ([32]); +struct_construct() -> ([33]); +struct_construct() -> ([34]); +struct_construct() -> ([35]); +struct_construct() -> ([36]); +struct_construct() -> ([37]); +struct_construct([32], [33], [34], [35], [36], [37]) -> ([38]); +snapshot_take([38]) -> ([39], [40]); +drop([39]) -> (); +store_temp([29]) -> ([44]); +store_temp([2]) -> ([45]); +store_temp([40]) -> ([46]); +function_call([44], [45], [46]) -> ([41], [42], [43]); +store_temp([28]) -> ([28]); +enum_match>([43]) { fallthrough([47]) 67([48]) }; +branch_align() -> (); +array_new() -> ([49]); +struct_deconstruct>([47]) -> ([50]); +snapshot_take([50]) -> ([51], [52]); +drop([51]) -> (); +store_temp([52]) -> ([55]); +store_temp>([49]) -> ([56]); +function_call([55], [56]) -> ([53], [54]); +drop([54]) -> (); +snapshot_take>([53]) -> ([57], [58]); +drop>([57]) -> (); +struct_construct>([58]) -> ([59]); +struct_construct>>([59]) -> ([60]); +enum_init,)>, 0>([60]) -> ([61]); +store_temp([28]) -> ([62]); +store_temp([41]) -> ([63]); +store_temp([42]) -> ([64]); +store_temp,)>>([61]) -> ([65]); +return([62], [63], [64], [65]); +branch_align() -> (); +enum_init,)>, 1>([48]) -> ([66]); +store_temp([28]) -> ([67]); +store_temp([41]) -> ([68]); +store_temp([42]) -> ([69]); +store_temp,)>>([66]) -> ([70]); +return([67], [68], [69], [70]); +branch_align() -> (); +array_new() -> ([71]); +felt252_const<375233589013918064796019>() -> ([72]); +store_temp([72]) -> ([72]); +array_append([71], [72]) -> ([73]); +struct_construct() -> ([74]); +struct_construct>>([74], [73]) -> ([75]); +enum_init,)>, 1>([75]) -> ([76]); +store_temp([30]) -> ([77]); +store_temp([31]) -> ([78]); +store_temp([2]) -> ([79]); +store_temp,)>>([76]) -> ([80]); +return([77], [78], [79], [80]); +branch_align() -> (); +drop>([3]) -> (); +array_new() -> ([81]); +felt252_const<375233589013918064796019>() -> ([82]); +store_temp([82]) -> ([82]); +array_append([81], [82]) -> ([83]); +struct_construct() -> ([84]); +struct_construct>>([84], [83]) -> ([85]); +enum_init,)>, 1>([85]) -> ([86]); +store_temp([6]) -> ([87]); +store_temp([7]) -> ([88]); +store_temp([2]) -> ([89]); +store_temp,)>>([86]) -> ([90]); +return([87], [88], [89], [90]); +revoke_ap_tracking() -> (); +withdraw_gas([0], [1]) { fallthrough([4], [5]) 188([6], [7]) }; +branch_align() -> (); +struct_deconstruct>([3]) -> ([8]); +array_len([8]) -> ([9]); +snapshot_take([9]) -> ([10], [11]); +drop([10]) -> (); +u32_const<0>() -> ([12]); +snapshot_take([12]) -> ([13], [14]); +drop([13]) -> (); +rename([11]) -> ([15]); +rename([14]) -> ([16]); +store_temp([15]) -> ([15]); +store_temp([4]) -> ([4]); +u32_eq([15], [16]) { fallthrough() 129() }; +branch_align() -> (); +array_new() -> ([17]); +felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>() -> ([18]); +store_temp([18]) -> ([18]); +array_append([17], [18]) -> ([19]); +struct_construct() -> ([20]); +struct_construct>>([20], [19]) -> ([21]); +enum_init,)>, 1>([21]) -> ([22]); +store_temp([4]) -> ([23]); +store_temp([5]) -> ([24]); +store_temp([2]) -> ([25]); +store_temp,)>>([22]) -> ([26]); +return([23], [24], [25], [26]); +branch_align() -> (); +get_builtin_costs() -> ([27]); +store_temp([27]) -> ([27]); +withdraw_gas_all([4], [5], [27]) { fallthrough([28], [29]) 175([30], [31]) }; +branch_align() -> (); +struct_construct() -> ([32]); +struct_construct() -> ([33]); +struct_construct() -> ([34]); +struct_construct() -> ([35]); +struct_construct() -> ([36]); +struct_construct() -> ([37]); +struct_construct([32], [33], [34], [35], [36], [37]) -> ([38]); +snapshot_take([38]) -> ([39], [40]); +drop([39]) -> (); +store_temp([29]) -> ([44]); +store_temp([2]) -> ([45]); +store_temp([40]) -> ([46]); +function_call([44], [45], [46]) -> ([41], [42], [43]); +store_temp([28]) -> ([28]); +enum_match>([43]) { fallthrough([47]) 168([48]) }; +branch_align() -> (); +array_new() -> ([49]); +struct_deconstruct>([47]) -> ([50]); +snapshot_take([50]) -> ([51], [52]); +drop([51]) -> (); +store_temp([52]) -> ([55]); +store_temp>([49]) -> ([56]); +function_call([55], [56]) -> ([53], [54]); +drop([54]) -> (); +snapshot_take>([53]) -> ([57], [58]); +drop>([57]) -> (); +struct_construct>([58]) -> ([59]); +struct_construct>>([59]) -> ([60]); +enum_init,)>, 0>([60]) -> ([61]); +store_temp([28]) -> ([62]); +store_temp([41]) -> ([63]); +store_temp([42]) -> ([64]); +store_temp,)>>([61]) -> ([65]); +return([62], [63], [64], [65]); +branch_align() -> (); +enum_init,)>, 1>([48]) -> ([66]); +store_temp([28]) -> ([67]); +store_temp([41]) -> ([68]); +store_temp([42]) -> ([69]); +store_temp,)>>([66]) -> ([70]); +return([67], [68], [69], [70]); +branch_align() -> (); +array_new() -> ([71]); +felt252_const<375233589013918064796019>() -> ([72]); +store_temp([72]) -> ([72]); +array_append([71], [72]) -> ([73]); +struct_construct() -> ([74]); +struct_construct>>([74], [73]) -> ([75]); +enum_init,)>, 1>([75]) -> ([76]); +store_temp([30]) -> ([77]); +store_temp([31]) -> ([78]); +store_temp([2]) -> ([79]); +store_temp,)>>([76]) -> ([80]); +return([77], [78], [79], [80]); +branch_align() -> (); +drop>([3]) -> (); +array_new() -> ([81]); +felt252_const<375233589013918064796019>() -> ([82]); +store_temp([82]) -> ([82]); +array_append([81], [82]) -> ([83]); +struct_construct() -> ([84]); +struct_construct>>([84], [83]) -> ([85]); +enum_init,)>, 1>([85]) -> ([86]); +store_temp([6]) -> ([87]); +store_temp([7]) -> ([88]); +store_temp([2]) -> ([89]); +store_temp,)>>([86]) -> ([90]); +return([87], [88], [89], [90]); +revoke_ap_tracking() -> (); +withdraw_gas([0], [1]) { fallthrough([4], [5]) 289([6], [7]) }; +branch_align() -> (); +struct_deconstruct>([3]) -> ([8]); +array_len([8]) -> ([9]); +snapshot_take([9]) -> ([10], [11]); +drop([10]) -> (); +u32_const<0>() -> ([12]); +snapshot_take([12]) -> ([13], [14]); +drop([13]) -> (); +rename([11]) -> ([15]); +rename([14]) -> ([16]); +store_temp([15]) -> ([15]); +store_temp([4]) -> ([4]); +u32_eq([15], [16]) { fallthrough() 230() }; +branch_align() -> (); +array_new() -> ([17]); +felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>() -> ([18]); +store_temp([18]) -> ([18]); +array_append([17], [18]) -> ([19]); +struct_construct() -> ([20]); +struct_construct>>([20], [19]) -> ([21]); +enum_init,)>, 1>([21]) -> ([22]); +store_temp([4]) -> ([23]); +store_temp([5]) -> ([24]); +store_temp([2]) -> ([25]); +store_temp,)>>([22]) -> ([26]); +return([23], [24], [25], [26]); +branch_align() -> (); +get_builtin_costs() -> ([27]); +store_temp([27]) -> ([27]); +withdraw_gas_all([4], [5], [27]) { fallthrough([28], [29]) 276([30], [31]) }; +branch_align() -> (); +struct_construct() -> ([32]); +struct_construct() -> ([33]); +struct_construct() -> ([34]); +struct_construct() -> ([35]); +struct_construct() -> ([36]); +struct_construct() -> ([37]); +struct_construct([32], [33], [34], [35], [36], [37]) -> ([38]); +snapshot_take([38]) -> ([39], [40]); +drop([39]) -> (); +store_temp([28]) -> ([45]); +store_temp([29]) -> ([46]); +store_temp([2]) -> ([47]); +store_temp([40]) -> ([48]); +function_call([45], [46], [47], [48]) -> ([41], [42], [43], [44]); +enum_match>([44]) { fallthrough([49]) 269([50]) }; +branch_align() -> (); +array_new() -> ([51]); +struct_deconstruct>([49]) -> ([52]); +snapshot_take([52]) -> ([53], [54]); +drop([53]) -> (); +store_temp([54]) -> ([57]); +store_temp>([51]) -> ([58]); +function_call([57], [58]) -> ([55], [56]); +drop([56]) -> (); +snapshot_take>([55]) -> ([59], [60]); +drop>([59]) -> (); +struct_construct>([60]) -> ([61]); +struct_construct>>([61]) -> ([62]); +enum_init,)>, 0>([62]) -> ([63]); +store_temp([41]) -> ([64]); +store_temp([42]) -> ([65]); +store_temp([43]) -> ([66]); +store_temp,)>>([63]) -> ([67]); +return([64], [65], [66], [67]); +branch_align() -> (); +enum_init,)>, 1>([50]) -> ([68]); +store_temp([41]) -> ([69]); +store_temp([42]) -> ([70]); +store_temp([43]) -> ([71]); +store_temp,)>>([68]) -> ([72]); +return([69], [70], [71], [72]); +branch_align() -> (); +array_new() -> ([73]); +felt252_const<375233589013918064796019>() -> ([74]); +store_temp([74]) -> ([74]); +array_append([73], [74]) -> ([75]); +struct_construct() -> ([76]); +struct_construct>>([76], [75]) -> ([77]); +enum_init,)>, 1>([77]) -> ([78]); +store_temp([30]) -> ([79]); +store_temp([31]) -> ([80]); +store_temp([2]) -> ([81]); +store_temp,)>>([78]) -> ([82]); +return([79], [80], [81], [82]); +branch_align() -> (); +drop>([3]) -> (); +array_new() -> ([83]); +felt252_const<375233589013918064796019>() -> ([84]); +store_temp([84]) -> ([84]); +array_append([83], [84]) -> ([85]); +struct_construct() -> ([86]); +struct_construct>>([86], [85]) -> ([87]); +enum_init,)>, 1>([87]) -> ([88]); +store_temp([6]) -> ([89]); +store_temp([7]) -> ([90]); +store_temp([2]) -> ([91]); +store_temp,)>>([88]) -> ([92]); +return([89], [90], [91], [92]); +revoke_ap_tracking() -> (); +withdraw_gas([0], [1]) { fallthrough([4], [5]) 390([6], [7]) }; +branch_align() -> (); +struct_deconstruct>([3]) -> ([8]); +array_len([8]) -> ([9]); +snapshot_take([9]) -> ([10], [11]); +drop([10]) -> (); +u32_const<0>() -> ([12]); +snapshot_take([12]) -> ([13], [14]); +drop([13]) -> (); +rename([11]) -> ([15]); +rename([14]) -> ([16]); +store_temp([15]) -> ([15]); +store_temp([4]) -> ([4]); +u32_eq([15], [16]) { fallthrough() 331() }; +branch_align() -> (); +array_new() -> ([17]); +felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>() -> ([18]); +store_temp([18]) -> ([18]); +array_append([17], [18]) -> ([19]); +struct_construct() -> ([20]); +struct_construct>>([20], [19]) -> ([21]); +enum_init,)>, 1>([21]) -> ([22]); +store_temp([4]) -> ([23]); +store_temp([5]) -> ([24]); +store_temp([2]) -> ([25]); +store_temp,)>>([22]) -> ([26]); +return([23], [24], [25], [26]); +branch_align() -> (); +get_builtin_costs() -> ([27]); +store_temp([27]) -> ([27]); +withdraw_gas_all([4], [5], [27]) { fallthrough([28], [29]) 377([30], [31]) }; +branch_align() -> (); +struct_construct() -> ([32]); +struct_construct() -> ([33]); +struct_construct() -> ([34]); +struct_construct() -> ([35]); +struct_construct() -> ([36]); +struct_construct() -> ([37]); +struct_construct([32], [33], [34], [35], [36], [37]) -> ([38]); +snapshot_take([38]) -> ([39], [40]); +drop([39]) -> (); +store_temp([28]) -> ([45]); +store_temp([29]) -> ([46]); +store_temp([2]) -> ([47]); +store_temp([40]) -> ([48]); +function_call([45], [46], [47], [48]) -> ([41], [42], [43], [44]); +enum_match>([44]) { fallthrough([49]) 370([50]) }; +branch_align() -> (); +array_new() -> ([51]); +struct_deconstruct>([49]) -> ([52]); +snapshot_take([52]) -> ([53], [54]); +drop([53]) -> (); +store_temp([54]) -> ([57]); +store_temp>([51]) -> ([58]); +function_call([57], [58]) -> ([55], [56]); +drop([56]) -> (); +snapshot_take>([55]) -> ([59], [60]); +drop>([59]) -> (); +struct_construct>([60]) -> ([61]); +struct_construct>>([61]) -> ([62]); +enum_init,)>, 0>([62]) -> ([63]); +store_temp([41]) -> ([64]); +store_temp([42]) -> ([65]); +store_temp([43]) -> ([66]); +store_temp,)>>([63]) -> ([67]); +return([64], [65], [66], [67]); +branch_align() -> (); +enum_init,)>, 1>([50]) -> ([68]); +store_temp([41]) -> ([69]); +store_temp([42]) -> ([70]); +store_temp([43]) -> ([71]); +store_temp,)>>([68]) -> ([72]); +return([69], [70], [71], [72]); +branch_align() -> (); +array_new() -> ([73]); +felt252_const<375233589013918064796019>() -> ([74]); +store_temp([74]) -> ([74]); +array_append([73], [74]) -> ([75]); +struct_construct() -> ([76]); +struct_construct>>([76], [75]) -> ([77]); +enum_init,)>, 1>([77]) -> ([78]); +store_temp([30]) -> ([79]); +store_temp([31]) -> ([80]); +store_temp([2]) -> ([81]); +store_temp,)>>([78]) -> ([82]); +return([79], [80], [81], [82]); +branch_align() -> (); +drop>([3]) -> (); +array_new() -> ([83]); +felt252_const<375233589013918064796019>() -> ([84]); +store_temp([84]) -> ([84]); +array_append([83], [84]) -> ([85]); +struct_construct() -> ([86]); +struct_construct>>([86], [85]) -> ([87]); +enum_init,)>, 1>([87]) -> ([88]); +store_temp([6]) -> ([89]); +store_temp([7]) -> ([90]); +store_temp([2]) -> ([91]); +store_temp,)>>([88]) -> ([92]); +return([89], [90], [91], [92]); +revoke_ap_tracking() -> (); +withdraw_gas([1], [2]) { fallthrough([5], [6]) 519([7], [8]) }; +branch_align() -> (); +store_temp([5]) -> ([12]); +store_temp>([4]) -> ([13]); +function_call([12], [13]) -> ([9], [10], [11]); +enum_match>([11]) { fallthrough([14]) 503([15]) }; +branch_align() -> (); +struct_deconstruct>([10]) -> ([16]); +array_len([16]) -> ([17]); +snapshot_take([17]) -> ([18], [19]); +drop([18]) -> (); +u32_const<0>() -> ([20]); +snapshot_take([20]) -> ([21], [22]); +drop([21]) -> (); +rename([19]) -> ([23]); +rename([22]) -> ([24]); +store_temp([23]) -> ([23]); +u32_eq([23], [24]) { fallthrough() 438() }; +branch_align() -> (); +drop([14]) -> (); +array_new() -> ([25]); +felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>() -> ([26]); +store_temp([26]) -> ([26]); +array_append([25], [26]) -> ([27]); +struct_construct() -> ([28]); +struct_construct>>([28], [27]) -> ([29]); +enum_init,)>, 1>([29]) -> ([30]); +store_temp([0]) -> ([31]); +store_temp([9]) -> ([32]); +store_temp([6]) -> ([33]); +store_temp([3]) -> ([34]); +store_temp,)>>([30]) -> ([35]); +return([31], [32], [33], [34], [35]); +branch_align() -> (); +get_builtin_costs() -> ([36]); +store_temp([36]) -> ([36]); +withdraw_gas_all([9], [6], [36]) { fallthrough([37], [38]) 488([39], [40]) }; +branch_align() -> (); +struct_construct() -> ([41]); +struct_construct() -> ([42]); +struct_construct() -> ([43]); +struct_construct() -> ([44]); +struct_construct() -> ([45]); +struct_construct() -> ([46]); +struct_construct([41], [42], [43], [44], [45], [46]) -> ([47]); +snapshot_take([47]) -> ([48], [49]); +drop([48]) -> (); +store_temp([37]) -> ([55]); +store_temp([38]) -> ([56]); +store_temp([0]) -> ([57]); +store_temp([3]) -> ([58]); +store_temp([49]) -> ([59]); +store_temp([14]) -> ([60]); +function_call([55], [56], [57], [58], [59], [60]) -> ([50], [51], [52], [53], [54]); +enum_match>([54]) { fallthrough([61]) 480([62]) }; +branch_align() -> (); +array_new() -> ([63]); +struct_deconstruct>([61]) -> ([64]); +snapshot_take([64]) -> ([65], [66]); +drop([65]) -> (); +store_temp([66]) -> ([69]); +store_temp>([63]) -> ([70]); +function_call([69], [70]) -> ([67], [68]); +drop([68]) -> (); +snapshot_take>([67]) -> ([71], [72]); +drop>([71]) -> (); +struct_construct>([72]) -> ([73]); +struct_construct>>([73]) -> ([74]); +enum_init,)>, 0>([74]) -> ([75]); +store_temp([52]) -> ([76]); +store_temp([50]) -> ([77]); +store_temp([51]) -> ([78]); +store_temp([53]) -> ([79]); +store_temp,)>>([75]) -> ([80]); +return([76], [77], [78], [79], [80]); +branch_align() -> (); +enum_init,)>, 1>([62]) -> ([81]); +store_temp([52]) -> ([82]); +store_temp([50]) -> ([83]); +store_temp([51]) -> ([84]); +store_temp([53]) -> ([85]); +store_temp,)>>([81]) -> ([86]); +return([82], [83], [84], [85], [86]); +branch_align() -> (); +drop([14]) -> (); +array_new() -> ([87]); +felt252_const<375233589013918064796019>() -> ([88]); +store_temp([88]) -> ([88]); +array_append([87], [88]) -> ([89]); +struct_construct() -> ([90]); +struct_construct>>([90], [89]) -> ([91]); +enum_init,)>, 1>([91]) -> ([92]); +store_temp([0]) -> ([93]); +store_temp([39]) -> ([94]); +store_temp([40]) -> ([95]); +store_temp([3]) -> ([96]); +store_temp,)>>([92]) -> ([97]); +return([93], [94], [95], [96], [97]); +branch_align() -> (); +drop([15]) -> (); +drop>([10]) -> (); +array_new() -> ([98]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492913>() -> ([99]); +store_temp([99]) -> ([99]); +array_append([98], [99]) -> ([100]); +struct_construct() -> ([101]); +struct_construct>>([101], [100]) -> ([102]); +enum_init,)>, 1>([102]) -> ([103]); +store_temp([0]) -> ([104]); +store_temp([9]) -> ([105]); +store_temp([6]) -> ([106]); +store_temp([3]) -> ([107]); +store_temp,)>>([103]) -> ([108]); +return([104], [105], [106], [107], [108]); +branch_align() -> (); +drop>([4]) -> (); +array_new() -> ([109]); +felt252_const<375233589013918064796019>() -> ([110]); +store_temp([110]) -> ([110]); +array_append([109], [110]) -> ([111]); +struct_construct() -> ([112]); +struct_construct>>([112], [111]) -> ([113]); +enum_init,)>, 1>([113]) -> ([114]); +store_temp([0]) -> ([115]); +store_temp([7]) -> ([116]); +store_temp([8]) -> ([117]); +store_temp([3]) -> ([118]); +store_temp,)>>([114]) -> ([119]); +return([115], [116], [117], [118], [119]); +revoke_ap_tracking() -> (); +withdraw_gas([1], [2]) { fallthrough([5], [6]) 674([7], [8]) }; +branch_align() -> (); +store_temp([5]) -> ([12]); +store_temp>([4]) -> ([13]); +function_call([12], [13]) -> ([9], [10], [11]); +enum_match>([11]) { fallthrough([14]) 658([15]) }; +branch_align() -> (); +store_temp([9]) -> ([19]); +store_temp>([10]) -> ([20]); +function_call([19], [20]) -> ([16], [17], [18]); +enum_match>([18]) { fallthrough([21]) 641([22]) }; +branch_align() -> (); +struct_deconstruct>([17]) -> ([23]); +array_len([23]) -> ([24]); +snapshot_take([24]) -> ([25], [26]); +drop([25]) -> (); +u32_const<0>() -> ([27]); +snapshot_take([27]) -> ([28], [29]); +drop([28]) -> (); +rename([26]) -> ([30]); +rename([29]) -> ([31]); +store_temp([30]) -> ([30]); +u32_eq([30], [31]) { fallthrough() 574() }; +branch_align() -> (); +drop([21]) -> (); +drop([14]) -> (); +array_new() -> ([32]); +felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>() -> ([33]); +store_temp([33]) -> ([33]); +array_append([32], [33]) -> ([34]); +struct_construct() -> ([35]); +struct_construct>>([35], [34]) -> ([36]); +enum_init,)>, 1>([36]) -> ([37]); +store_temp([0]) -> ([38]); +store_temp([16]) -> ([39]); +store_temp([6]) -> ([40]); +store_temp([3]) -> ([41]); +store_temp,)>>([37]) -> ([42]); +return([38], [39], [40], [41], [42]); +branch_align() -> (); +get_builtin_costs() -> ([43]); +store_temp([43]) -> ([43]); +withdraw_gas_all([16], [6], [43]) { fallthrough([44], [45]) 625([46], [47]) }; +branch_align() -> (); +struct_construct() -> ([48]); +struct_construct() -> ([49]); +struct_construct() -> ([50]); +struct_construct() -> ([51]); +struct_construct() -> ([52]); +struct_construct() -> ([53]); +struct_construct([48], [49], [50], [51], [52], [53]) -> ([54]); +snapshot_take([54]) -> ([55], [56]); +drop([55]) -> (); +store_temp([44]) -> ([62]); +store_temp([45]) -> ([63]); +store_temp([0]) -> ([64]); +store_temp([3]) -> ([65]); +store_temp([56]) -> ([66]); +store_temp([14]) -> ([67]); +store_temp([21]) -> ([68]); +function_call([62], [63], [64], [65], [66], [67], [68]) -> ([57], [58], [59], [60], [61]); +enum_match>([61]) { fallthrough([69]) 617([70]) }; +branch_align() -> (); +array_new() -> ([71]); +struct_deconstruct>([69]) -> ([72]); +snapshot_take([72]) -> ([73], [74]); +drop([73]) -> (); +store_temp([74]) -> ([77]); +store_temp>([71]) -> ([78]); +function_call([77], [78]) -> ([75], [76]); +drop([76]) -> (); +snapshot_take>([75]) -> ([79], [80]); +drop>([79]) -> (); +struct_construct>([80]) -> ([81]); +struct_construct>>([81]) -> ([82]); +enum_init,)>, 0>([82]) -> ([83]); +store_temp([59]) -> ([84]); +store_temp([57]) -> ([85]); +store_temp([58]) -> ([86]); +store_temp([60]) -> ([87]); +store_temp,)>>([83]) -> ([88]); +return([84], [85], [86], [87], [88]); +branch_align() -> (); +enum_init,)>, 1>([70]) -> ([89]); +store_temp([59]) -> ([90]); +store_temp([57]) -> ([91]); +store_temp([58]) -> ([92]); +store_temp([60]) -> ([93]); +store_temp,)>>([89]) -> ([94]); +return([90], [91], [92], [93], [94]); +branch_align() -> (); +drop([21]) -> (); +drop([14]) -> (); +array_new() -> ([95]); +felt252_const<375233589013918064796019>() -> ([96]); +store_temp([96]) -> ([96]); +array_append([95], [96]) -> ([97]); +struct_construct() -> ([98]); +struct_construct>>([98], [97]) -> ([99]); +enum_init,)>, 1>([99]) -> ([100]); +store_temp([0]) -> ([101]); +store_temp([46]) -> ([102]); +store_temp([47]) -> ([103]); +store_temp([3]) -> ([104]); +store_temp,)>>([100]) -> ([105]); +return([101], [102], [103], [104], [105]); +branch_align() -> (); +drop([22]) -> (); +drop>([17]) -> (); +drop([14]) -> (); +array_new() -> ([106]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492914>() -> ([107]); +store_temp([107]) -> ([107]); +array_append([106], [107]) -> ([108]); +struct_construct() -> ([109]); +struct_construct>>([109], [108]) -> ([110]); +enum_init,)>, 1>([110]) -> ([111]); +store_temp([0]) -> ([112]); +store_temp([16]) -> ([113]); +store_temp([6]) -> ([114]); +store_temp([3]) -> ([115]); +store_temp,)>>([111]) -> ([116]); +return([112], [113], [114], [115], [116]); +branch_align() -> (); +drop([15]) -> (); +drop>([10]) -> (); +array_new() -> ([117]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492913>() -> ([118]); +store_temp([118]) -> ([118]); +array_append([117], [118]) -> ([119]); +struct_construct() -> ([120]); +struct_construct>>([120], [119]) -> ([121]); +enum_init,)>, 1>([121]) -> ([122]); +store_temp([0]) -> ([123]); +store_temp([9]) -> ([124]); +store_temp([6]) -> ([125]); +store_temp([3]) -> ([126]); +store_temp,)>>([122]) -> ([127]); +return([123], [124], [125], [126], [127]); +branch_align() -> (); +drop>([4]) -> (); +array_new() -> ([128]); +felt252_const<375233589013918064796019>() -> ([129]); +store_temp([129]) -> ([129]); +array_append([128], [129]) -> ([130]); +struct_construct() -> ([131]); +struct_construct>>([131], [130]) -> ([132]); +enum_init,)>, 1>([132]) -> ([133]); +store_temp([0]) -> ([134]); +store_temp([7]) -> ([135]); +store_temp([8]) -> ([136]); +store_temp([3]) -> ([137]); +store_temp,)>>([133]) -> ([138]); +return([134], [135], [136], [137], [138]); +revoke_ap_tracking() -> (); +withdraw_gas([1], [2]) { fallthrough([5], [6]) 821([7], [8]) }; +branch_align() -> (); +store_temp([5]) -> ([12]); +store_temp>([4]) -> ([13]); +function_call([12], [13]) -> ([9], [10], [11]); +enum_match>([11]) { fallthrough([14]) 805([15]) }; +branch_align() -> (); +store_temp([9]) -> ([19]); +store_temp>([10]) -> ([20]); +function_call([19], [20]) -> ([16], [17], [18]); +enum_match>([18]) { fallthrough([21]) 788([22]) }; +branch_align() -> (); +struct_deconstruct>([17]) -> ([23]); +array_len([23]) -> ([24]); +snapshot_take([24]) -> ([25], [26]); +drop([25]) -> (); +u32_const<0>() -> ([27]); +snapshot_take([27]) -> ([28], [29]); +drop([28]) -> (); +rename([26]) -> ([30]); +rename([29]) -> ([31]); +store_temp([30]) -> ([30]); +u32_eq([30], [31]) { fallthrough() 729() }; +branch_align() -> (); +drop([21]) -> (); +drop([14]) -> (); +array_new() -> ([32]); +felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>() -> ([33]); +store_temp([33]) -> ([33]); +array_append([32], [33]) -> ([34]); +struct_construct() -> ([35]); +struct_construct>>([35], [34]) -> ([36]); +enum_init,)>, 1>([36]) -> ([37]); +store_temp([0]) -> ([38]); +store_temp([16]) -> ([39]); +store_temp([6]) -> ([40]); +store_temp([3]) -> ([41]); +store_temp,)>>([37]) -> ([42]); +return([38], [39], [40], [41], [42]); +branch_align() -> (); +get_builtin_costs() -> ([43]); +store_temp([43]) -> ([43]); +withdraw_gas_all([16], [6], [43]) { fallthrough([44], [45]) 772([46], [47]) }; +branch_align() -> (); +struct_construct() -> ([48]); +struct_construct() -> ([49]); +struct_construct() -> ([50]); +struct_construct() -> ([51]); +struct_construct() -> ([52]); +struct_construct() -> ([53]); +struct_construct([48], [49], [50], [51], [52], [53]) -> ([54]); +store_temp([44]) -> ([60]); +store_temp([45]) -> ([61]); +store_temp([0]) -> ([62]); +store_temp([3]) -> ([63]); +store_temp([54]) -> ([64]); +store_temp([14]) -> ([65]); +store_temp([21]) -> ([66]); +function_call([60], [61], [62], [63], [64], [65], [66]) -> ([55], [56], [57], [58], [59]); +enum_match>([59]) { fallthrough([67]) 764([68]) }; +branch_align() -> (); +drop>([67]) -> (); +array_new() -> ([69]); +snapshot_take>([69]) -> ([70], [71]); +drop>([70]) -> (); +struct_construct>([71]) -> ([72]); +struct_construct>>([72]) -> ([73]); +enum_init,)>, 0>([73]) -> ([74]); +store_temp([57]) -> ([75]); +store_temp([55]) -> ([76]); +store_temp([56]) -> ([77]); +store_temp([58]) -> ([78]); +store_temp,)>>([74]) -> ([79]); +return([75], [76], [77], [78], [79]); +branch_align() -> (); +enum_init,)>, 1>([68]) -> ([80]); +store_temp([57]) -> ([81]); +store_temp([55]) -> ([82]); +store_temp([56]) -> ([83]); +store_temp([58]) -> ([84]); +store_temp,)>>([80]) -> ([85]); +return([81], [82], [83], [84], [85]); +branch_align() -> (); +drop([21]) -> (); +drop([14]) -> (); +array_new() -> ([86]); +felt252_const<375233589013918064796019>() -> ([87]); +store_temp([87]) -> ([87]); +array_append([86], [87]) -> ([88]); +struct_construct() -> ([89]); +struct_construct>>([89], [88]) -> ([90]); +enum_init,)>, 1>([90]) -> ([91]); +store_temp([0]) -> ([92]); +store_temp([46]) -> ([93]); +store_temp([47]) -> ([94]); +store_temp([3]) -> ([95]); +store_temp,)>>([91]) -> ([96]); +return([92], [93], [94], [95], [96]); +branch_align() -> (); +drop([22]) -> (); +drop>([17]) -> (); +drop([14]) -> (); +array_new() -> ([97]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492914>() -> ([98]); +store_temp([98]) -> ([98]); +array_append([97], [98]) -> ([99]); +struct_construct() -> ([100]); +struct_construct>>([100], [99]) -> ([101]); +enum_init,)>, 1>([101]) -> ([102]); +store_temp([0]) -> ([103]); +store_temp([16]) -> ([104]); +store_temp([6]) -> ([105]); +store_temp([3]) -> ([106]); +store_temp,)>>([102]) -> ([107]); +return([103], [104], [105], [106], [107]); +branch_align() -> (); +drop([15]) -> (); +drop>([10]) -> (); +array_new() -> ([108]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492913>() -> ([109]); +store_temp([109]) -> ([109]); +array_append([108], [109]) -> ([110]); +struct_construct() -> ([111]); +struct_construct>>([111], [110]) -> ([112]); +enum_init,)>, 1>([112]) -> ([113]); +store_temp([0]) -> ([114]); +store_temp([9]) -> ([115]); +store_temp([6]) -> ([116]); +store_temp([3]) -> ([117]); +store_temp,)>>([113]) -> ([118]); +return([114], [115], [116], [117], [118]); +branch_align() -> (); +drop>([4]) -> (); +array_new() -> ([119]); +felt252_const<375233589013918064796019>() -> ([120]); +store_temp([120]) -> ([120]); +array_append([119], [120]) -> ([121]); +struct_construct() -> ([122]); +struct_construct>>([122], [121]) -> ([123]); +enum_init,)>, 1>([123]) -> ([124]); +store_temp([0]) -> ([125]); +store_temp([7]) -> ([126]); +store_temp([8]) -> ([127]); +store_temp([3]) -> ([128]); +store_temp,)>>([124]) -> ([129]); +return([125], [126], [127], [128], [129]); +revoke_ap_tracking() -> (); +withdraw_gas([1], [2]) { fallthrough([5], [6]) 994([7], [8]) }; +branch_align() -> (); +store_temp([5]) -> ([12]); +store_temp>([4]) -> ([13]); +function_call([12], [13]) -> ([9], [10], [11]); +enum_match>([11]) { fallthrough([14]) 978([15]) }; +branch_align() -> (); +store_temp([9]) -> ([19]); +store_temp>([10]) -> ([20]); +function_call([19], [20]) -> ([16], [17], [18]); +enum_match>([18]) { fallthrough([21]) 961([22]) }; +branch_align() -> (); +store_temp([16]) -> ([26]); +store_temp>([17]) -> ([27]); +function_call([26], [27]) -> ([23], [24], [25]); +enum_match>([25]) { fallthrough([28]) 943([29]) }; +branch_align() -> (); +struct_deconstruct>([24]) -> ([30]); +array_len([30]) -> ([31]); +snapshot_take([31]) -> ([32], [33]); +drop([32]) -> (); +u32_const<0>() -> ([34]); +snapshot_take([34]) -> ([35], [36]); +drop([35]) -> (); +rename([33]) -> ([37]); +rename([36]) -> ([38]); +store_temp([37]) -> ([37]); +u32_eq([37], [38]) { fallthrough() 882() }; +branch_align() -> (); +drop([28]) -> (); +drop([21]) -> (); +drop([14]) -> (); +array_new() -> ([39]); +felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>() -> ([40]); +store_temp([40]) -> ([40]); +array_append([39], [40]) -> ([41]); +struct_construct() -> ([42]); +struct_construct>>([42], [41]) -> ([43]); +enum_init,)>, 1>([43]) -> ([44]); +store_temp([0]) -> ([45]); +store_temp([23]) -> ([46]); +store_temp([6]) -> ([47]); +store_temp([3]) -> ([48]); +store_temp,)>>([44]) -> ([49]); +return([45], [46], [47], [48], [49]); +branch_align() -> (); +get_builtin_costs() -> ([50]); +store_temp([50]) -> ([50]); +withdraw_gas_all([23], [6], [50]) { fallthrough([51], [52]) 926([53], [54]) }; +branch_align() -> (); +struct_construct() -> ([55]); +struct_construct() -> ([56]); +struct_construct() -> ([57]); +struct_construct() -> ([58]); +struct_construct() -> ([59]); +struct_construct() -> ([60]); +struct_construct([55], [56], [57], [58], [59], [60]) -> ([61]); +store_temp([51]) -> ([67]); +store_temp([52]) -> ([68]); +store_temp([0]) -> ([69]); +store_temp([3]) -> ([70]); +store_temp([61]) -> ([71]); +store_temp([14]) -> ([72]); +store_temp([21]) -> ([73]); +store_temp([28]) -> ([74]); +function_call([67], [68], [69], [70], [71], [72], [73], [74]) -> ([62], [63], [64], [65], [66]); +enum_match>([66]) { fallthrough([75]) 918([76]) }; +branch_align() -> (); +drop>([75]) -> (); +array_new() -> ([77]); +snapshot_take>([77]) -> ([78], [79]); +drop>([78]) -> (); +struct_construct>([79]) -> ([80]); +struct_construct>>([80]) -> ([81]); +enum_init,)>, 0>([81]) -> ([82]); +store_temp([64]) -> ([83]); +store_temp([62]) -> ([84]); +store_temp([63]) -> ([85]); +store_temp([65]) -> ([86]); +store_temp,)>>([82]) -> ([87]); +return([83], [84], [85], [86], [87]); +branch_align() -> (); +enum_init,)>, 1>([76]) -> ([88]); +store_temp([64]) -> ([89]); +store_temp([62]) -> ([90]); +store_temp([63]) -> ([91]); +store_temp([65]) -> ([92]); +store_temp,)>>([88]) -> ([93]); +return([89], [90], [91], [92], [93]); +branch_align() -> (); +drop([28]) -> (); +drop([21]) -> (); +drop([14]) -> (); +array_new() -> ([94]); +felt252_const<375233589013918064796019>() -> ([95]); +store_temp([95]) -> ([95]); +array_append([94], [95]) -> ([96]); +struct_construct() -> ([97]); +struct_construct>>([97], [96]) -> ([98]); +enum_init,)>, 1>([98]) -> ([99]); +store_temp([0]) -> ([100]); +store_temp([53]) -> ([101]); +store_temp([54]) -> ([102]); +store_temp([3]) -> ([103]); +store_temp,)>>([99]) -> ([104]); +return([100], [101], [102], [103], [104]); +branch_align() -> (); +drop([29]) -> (); +drop>([24]) -> (); +drop([21]) -> (); +drop([14]) -> (); +array_new() -> ([105]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492915>() -> ([106]); +store_temp([106]) -> ([106]); +array_append([105], [106]) -> ([107]); +struct_construct() -> ([108]); +struct_construct>>([108], [107]) -> ([109]); +enum_init,)>, 1>([109]) -> ([110]); +store_temp([0]) -> ([111]); +store_temp([23]) -> ([112]); +store_temp([6]) -> ([113]); +store_temp([3]) -> ([114]); +store_temp,)>>([110]) -> ([115]); +return([111], [112], [113], [114], [115]); +branch_align() -> (); +drop([22]) -> (); +drop([14]) -> (); +drop>([17]) -> (); +array_new() -> ([116]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492914>() -> ([117]); +store_temp([117]) -> ([117]); +array_append([116], [117]) -> ([118]); +struct_construct() -> ([119]); +struct_construct>>([119], [118]) -> ([120]); +enum_init,)>, 1>([120]) -> ([121]); +store_temp([0]) -> ([122]); +store_temp([16]) -> ([123]); +store_temp([6]) -> ([124]); +store_temp([3]) -> ([125]); +store_temp,)>>([121]) -> ([126]); +return([122], [123], [124], [125], [126]); +branch_align() -> (); +drop([15]) -> (); +drop>([10]) -> (); +array_new() -> ([127]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492913>() -> ([128]); +store_temp([128]) -> ([128]); +array_append([127], [128]) -> ([129]); +struct_construct() -> ([130]); +struct_construct>>([130], [129]) -> ([131]); +enum_init,)>, 1>([131]) -> ([132]); +store_temp([0]) -> ([133]); +store_temp([9]) -> ([134]); +store_temp([6]) -> ([135]); +store_temp([3]) -> ([136]); +store_temp,)>>([132]) -> ([137]); +return([133], [134], [135], [136], [137]); +branch_align() -> (); +drop>([4]) -> (); +array_new() -> ([138]); +felt252_const<375233589013918064796019>() -> ([139]); +store_temp([139]) -> ([139]); +array_append([138], [139]) -> ([140]); +struct_construct() -> ([141]); +struct_construct>>([141], [140]) -> ([142]); +enum_init,)>, 1>([142]) -> ([143]); +store_temp([0]) -> ([144]); +store_temp([7]) -> ([145]); +store_temp([8]) -> ([146]); +store_temp([3]) -> ([147]); +store_temp,)>>([143]) -> ([148]); +return([144], [145], [146], [147], [148]); +revoke_ap_tracking() -> (); +withdraw_gas([1], [2]) { fallthrough([5], [6]) 1141([7], [8]) }; +branch_align() -> (); +store_temp([5]) -> ([12]); +store_temp>([4]) -> ([13]); +function_call([12], [13]) -> ([9], [10], [11]); +enum_match>([11]) { fallthrough([14]) 1125([15]) }; +branch_align() -> (); +store_temp([9]) -> ([19]); +store_temp>([10]) -> ([20]); +function_call([19], [20]) -> ([16], [17], [18]); +enum_match>([18]) { fallthrough([21]) 1108([22]) }; +branch_align() -> (); +struct_deconstruct>([17]) -> ([23]); +array_len([23]) -> ([24]); +snapshot_take([24]) -> ([25], [26]); +drop([25]) -> (); +u32_const<0>() -> ([27]); +snapshot_take([27]) -> ([28], [29]); +drop([28]) -> (); +rename([26]) -> ([30]); +rename([29]) -> ([31]); +store_temp([30]) -> ([30]); +u32_eq([30], [31]) { fallthrough() 1049() }; +branch_align() -> (); +drop([21]) -> (); +drop([14]) -> (); +array_new() -> ([32]); +felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>() -> ([33]); +store_temp([33]) -> ([33]); +array_append([32], [33]) -> ([34]); +struct_construct() -> ([35]); +struct_construct>>([35], [34]) -> ([36]); +enum_init,)>, 1>([36]) -> ([37]); +store_temp([0]) -> ([38]); +store_temp([16]) -> ([39]); +store_temp([6]) -> ([40]); +store_temp([3]) -> ([41]); +store_temp,)>>([37]) -> ([42]); +return([38], [39], [40], [41], [42]); +branch_align() -> (); +get_builtin_costs() -> ([43]); +store_temp([43]) -> ([43]); +withdraw_gas_all([16], [6], [43]) { fallthrough([44], [45]) 1092([46], [47]) }; +branch_align() -> (); +struct_construct() -> ([48]); +struct_construct() -> ([49]); +struct_construct() -> ([50]); +struct_construct() -> ([51]); +struct_construct() -> ([52]); +struct_construct() -> ([53]); +struct_construct([48], [49], [50], [51], [52], [53]) -> ([54]); +store_temp([44]) -> ([60]); +store_temp([45]) -> ([61]); +store_temp([0]) -> ([62]); +store_temp([3]) -> ([63]); +store_temp([54]) -> ([64]); +store_temp([14]) -> ([65]); +store_temp([21]) -> ([66]); +function_call([60], [61], [62], [63], [64], [65], [66]) -> ([55], [56], [57], [58], [59]); +enum_match>([59]) { fallthrough([67]) 1084([68]) }; +branch_align() -> (); +drop>([67]) -> (); +array_new() -> ([69]); +snapshot_take>([69]) -> ([70], [71]); +drop>([70]) -> (); +struct_construct>([71]) -> ([72]); +struct_construct>>([72]) -> ([73]); +enum_init,)>, 0>([73]) -> ([74]); +store_temp([57]) -> ([75]); +store_temp([55]) -> ([76]); +store_temp([56]) -> ([77]); +store_temp([58]) -> ([78]); +store_temp,)>>([74]) -> ([79]); +return([75], [76], [77], [78], [79]); +branch_align() -> (); +enum_init,)>, 1>([68]) -> ([80]); +store_temp([57]) -> ([81]); +store_temp([55]) -> ([82]); +store_temp([56]) -> ([83]); +store_temp([58]) -> ([84]); +store_temp,)>>([80]) -> ([85]); +return([81], [82], [83], [84], [85]); +branch_align() -> (); +drop([21]) -> (); +drop([14]) -> (); +array_new() -> ([86]); +felt252_const<375233589013918064796019>() -> ([87]); +store_temp([87]) -> ([87]); +array_append([86], [87]) -> ([88]); +struct_construct() -> ([89]); +struct_construct>>([89], [88]) -> ([90]); +enum_init,)>, 1>([90]) -> ([91]); +store_temp([0]) -> ([92]); +store_temp([46]) -> ([93]); +store_temp([47]) -> ([94]); +store_temp([3]) -> ([95]); +store_temp,)>>([91]) -> ([96]); +return([92], [93], [94], [95], [96]); +branch_align() -> (); +drop([22]) -> (); +drop>([17]) -> (); +drop([14]) -> (); +array_new() -> ([97]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492914>() -> ([98]); +store_temp([98]) -> ([98]); +array_append([97], [98]) -> ([99]); +struct_construct() -> ([100]); +struct_construct>>([100], [99]) -> ([101]); +enum_init,)>, 1>([101]) -> ([102]); +store_temp([0]) -> ([103]); +store_temp([16]) -> ([104]); +store_temp([6]) -> ([105]); +store_temp([3]) -> ([106]); +store_temp,)>>([102]) -> ([107]); +return([103], [104], [105], [106], [107]); +branch_align() -> (); +drop([15]) -> (); +drop>([10]) -> (); +array_new() -> ([108]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492913>() -> ([109]); +store_temp([109]) -> ([109]); +array_append([108], [109]) -> ([110]); +struct_construct() -> ([111]); +struct_construct>>([111], [110]) -> ([112]); +enum_init,)>, 1>([112]) -> ([113]); +store_temp([0]) -> ([114]); +store_temp([9]) -> ([115]); +store_temp([6]) -> ([116]); +store_temp([3]) -> ([117]); +store_temp,)>>([113]) -> ([118]); +return([114], [115], [116], [117], [118]); +branch_align() -> (); +drop>([4]) -> (); +array_new() -> ([119]); +felt252_const<375233589013918064796019>() -> ([120]); +store_temp([120]) -> ([120]); +array_append([119], [120]) -> ([121]); +struct_construct() -> ([122]); +struct_construct>>([122], [121]) -> ([123]); +enum_init,)>, 1>([123]) -> ([124]); +store_temp([0]) -> ([125]); +store_temp([7]) -> ([126]); +store_temp([8]) -> ([127]); +store_temp([3]) -> ([128]); +store_temp,)>>([124]) -> ([129]); +return([125], [126], [127], [128], [129]); +revoke_ap_tracking() -> (); +withdraw_gas([1], [2]) { fallthrough([5], [6]) 1288([7], [8]) }; +branch_align() -> (); +store_temp([5]) -> ([12]); +store_temp>([4]) -> ([13]); +function_call([12], [13]) -> ([9], [10], [11]); +enum_match>([11]) { fallthrough([14]) 1272([15]) }; +branch_align() -> (); +store_temp([9]) -> ([19]); +store_temp>([10]) -> ([20]); +function_call([19], [20]) -> ([16], [17], [18]); +enum_match>([18]) { fallthrough([21]) 1255([22]) }; +branch_align() -> (); +struct_deconstruct>([17]) -> ([23]); +array_len([23]) -> ([24]); +snapshot_take([24]) -> ([25], [26]); +drop([25]) -> (); +u32_const<0>() -> ([27]); +snapshot_take([27]) -> ([28], [29]); +drop([28]) -> (); +rename([26]) -> ([30]); +rename([29]) -> ([31]); +store_temp([30]) -> ([30]); +u32_eq([30], [31]) { fallthrough() 1196() }; +branch_align() -> (); +drop([21]) -> (); +drop([14]) -> (); +array_new() -> ([32]); +felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>() -> ([33]); +store_temp([33]) -> ([33]); +array_append([32], [33]) -> ([34]); +struct_construct() -> ([35]); +struct_construct>>([35], [34]) -> ([36]); +enum_init,)>, 1>([36]) -> ([37]); +store_temp([0]) -> ([38]); +store_temp([16]) -> ([39]); +store_temp([6]) -> ([40]); +store_temp([3]) -> ([41]); +store_temp,)>>([37]) -> ([42]); +return([38], [39], [40], [41], [42]); +branch_align() -> (); +get_builtin_costs() -> ([43]); +store_temp([43]) -> ([43]); +withdraw_gas_all([16], [6], [43]) { fallthrough([44], [45]) 1239([46], [47]) }; +branch_align() -> (); +struct_construct() -> ([48]); +struct_construct() -> ([49]); +struct_construct() -> ([50]); +struct_construct() -> ([51]); +struct_construct() -> ([52]); +struct_construct() -> ([53]); +struct_construct([48], [49], [50], [51], [52], [53]) -> ([54]); +store_temp([44]) -> ([60]); +store_temp([45]) -> ([61]); +store_temp([0]) -> ([62]); +store_temp([3]) -> ([63]); +store_temp([54]) -> ([64]); +store_temp([14]) -> ([65]); +store_temp([21]) -> ([66]); +function_call([60], [61], [62], [63], [64], [65], [66]) -> ([55], [56], [57], [58], [59]); +enum_match>([59]) { fallthrough([67]) 1231([68]) }; +branch_align() -> (); +drop>([67]) -> (); +array_new() -> ([69]); +snapshot_take>([69]) -> ([70], [71]); +drop>([70]) -> (); +struct_construct>([71]) -> ([72]); +struct_construct>>([72]) -> ([73]); +enum_init,)>, 0>([73]) -> ([74]); +store_temp([57]) -> ([75]); +store_temp([55]) -> ([76]); +store_temp([56]) -> ([77]); +store_temp([58]) -> ([78]); +store_temp,)>>([74]) -> ([79]); +return([75], [76], [77], [78], [79]); +branch_align() -> (); +enum_init,)>, 1>([68]) -> ([80]); +store_temp([57]) -> ([81]); +store_temp([55]) -> ([82]); +store_temp([56]) -> ([83]); +store_temp([58]) -> ([84]); +store_temp,)>>([80]) -> ([85]); +return([81], [82], [83], [84], [85]); +branch_align() -> (); +drop([21]) -> (); +drop([14]) -> (); +array_new() -> ([86]); +felt252_const<375233589013918064796019>() -> ([87]); +store_temp([87]) -> ([87]); +array_append([86], [87]) -> ([88]); +struct_construct() -> ([89]); +struct_construct>>([89], [88]) -> ([90]); +enum_init,)>, 1>([90]) -> ([91]); +store_temp([0]) -> ([92]); +store_temp([46]) -> ([93]); +store_temp([47]) -> ([94]); +store_temp([3]) -> ([95]); +store_temp,)>>([91]) -> ([96]); +return([92], [93], [94], [95], [96]); +branch_align() -> (); +drop([22]) -> (); +drop>([17]) -> (); +drop([14]) -> (); +array_new() -> ([97]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492914>() -> ([98]); +store_temp([98]) -> ([98]); +array_append([97], [98]) -> ([99]); +struct_construct() -> ([100]); +struct_construct>>([100], [99]) -> ([101]); +enum_init,)>, 1>([101]) -> ([102]); +store_temp([0]) -> ([103]); +store_temp([16]) -> ([104]); +store_temp([6]) -> ([105]); +store_temp([3]) -> ([106]); +store_temp,)>>([102]) -> ([107]); +return([103], [104], [105], [106], [107]); +branch_align() -> (); +drop([15]) -> (); +drop>([10]) -> (); +array_new() -> ([108]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492913>() -> ([109]); +store_temp([109]) -> ([109]); +array_append([108], [109]) -> ([110]); +struct_construct() -> ([111]); +struct_construct>>([111], [110]) -> ([112]); +enum_init,)>, 1>([112]) -> ([113]); +store_temp([0]) -> ([114]); +store_temp([9]) -> ([115]); +store_temp([6]) -> ([116]); +store_temp([3]) -> ([117]); +store_temp,)>>([113]) -> ([118]); +return([114], [115], [116], [117], [118]); +branch_align() -> (); +drop>([4]) -> (); +array_new() -> ([119]); +felt252_const<375233589013918064796019>() -> ([120]); +store_temp([120]) -> ([120]); +array_append([119], [120]) -> ([121]); +struct_construct() -> ([122]); +struct_construct>>([122], [121]) -> ([123]); +enum_init,)>, 1>([123]) -> ([124]); +store_temp([0]) -> ([125]); +store_temp([7]) -> ([126]); +store_temp([8]) -> ([127]); +store_temp([3]) -> ([128]); +store_temp,)>>([124]) -> ([129]); +return([125], [126], [127], [128], [129]); +revoke_ap_tracking() -> (); +withdraw_gas([1], [2]) { fallthrough([5], [6]) 1435([7], [8]) }; +branch_align() -> (); +store_temp([5]) -> ([12]); +store_temp>([4]) -> ([13]); +function_call([12], [13]) -> ([9], [10], [11]); +enum_match>([11]) { fallthrough([14]) 1419([15]) }; +branch_align() -> (); +store_temp([9]) -> ([19]); +store_temp>([10]) -> ([20]); +function_call([19], [20]) -> ([16], [17], [18]); +enum_match>([18]) { fallthrough([21]) 1402([22]) }; +branch_align() -> (); +struct_deconstruct>([17]) -> ([23]); +array_len([23]) -> ([24]); +snapshot_take([24]) -> ([25], [26]); +drop([25]) -> (); +u32_const<0>() -> ([27]); +snapshot_take([27]) -> ([28], [29]); +drop([28]) -> (); +rename([26]) -> ([30]); +rename([29]) -> ([31]); +store_temp([30]) -> ([30]); +u32_eq([30], [31]) { fallthrough() 1343() }; +branch_align() -> (); +drop([21]) -> (); +drop([14]) -> (); +array_new() -> ([32]); +felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>() -> ([33]); +store_temp([33]) -> ([33]); +array_append([32], [33]) -> ([34]); +struct_construct() -> ([35]); +struct_construct>>([35], [34]) -> ([36]); +enum_init,)>, 1>([36]) -> ([37]); +store_temp([0]) -> ([38]); +store_temp([16]) -> ([39]); +store_temp([6]) -> ([40]); +store_temp([3]) -> ([41]); +store_temp,)>>([37]) -> ([42]); +return([38], [39], [40], [41], [42]); +branch_align() -> (); +get_builtin_costs() -> ([43]); +store_temp([43]) -> ([43]); +withdraw_gas_all([16], [6], [43]) { fallthrough([44], [45]) 1386([46], [47]) }; +branch_align() -> (); +struct_construct() -> ([48]); +struct_construct() -> ([49]); +struct_construct() -> ([50]); +struct_construct() -> ([51]); +struct_construct() -> ([52]); +struct_construct() -> ([53]); +struct_construct([48], [49], [50], [51], [52], [53]) -> ([54]); +store_temp([44]) -> ([60]); +store_temp([45]) -> ([61]); +store_temp([0]) -> ([62]); +store_temp([3]) -> ([63]); +store_temp([54]) -> ([64]); +store_temp([14]) -> ([65]); +store_temp([21]) -> ([66]); +function_call([60], [61], [62], [63], [64], [65], [66]) -> ([55], [56], [57], [58], [59]); +enum_match>([59]) { fallthrough([67]) 1378([68]) }; +branch_align() -> (); +drop>([67]) -> (); +array_new() -> ([69]); +snapshot_take>([69]) -> ([70], [71]); +drop>([70]) -> (); +struct_construct>([71]) -> ([72]); +struct_construct>>([72]) -> ([73]); +enum_init,)>, 0>([73]) -> ([74]); +store_temp([57]) -> ([75]); +store_temp([55]) -> ([76]); +store_temp([56]) -> ([77]); +store_temp([58]) -> ([78]); +store_temp,)>>([74]) -> ([79]); +return([75], [76], [77], [78], [79]); +branch_align() -> (); +enum_init,)>, 1>([68]) -> ([80]); +store_temp([57]) -> ([81]); +store_temp([55]) -> ([82]); +store_temp([56]) -> ([83]); +store_temp([58]) -> ([84]); +store_temp,)>>([80]) -> ([85]); +return([81], [82], [83], [84], [85]); +branch_align() -> (); +drop([21]) -> (); +drop([14]) -> (); +array_new() -> ([86]); +felt252_const<375233589013918064796019>() -> ([87]); +store_temp([87]) -> ([87]); +array_append([86], [87]) -> ([88]); +struct_construct() -> ([89]); +struct_construct>>([89], [88]) -> ([90]); +enum_init,)>, 1>([90]) -> ([91]); +store_temp([0]) -> ([92]); +store_temp([46]) -> ([93]); +store_temp([47]) -> ([94]); +store_temp([3]) -> ([95]); +store_temp,)>>([91]) -> ([96]); +return([92], [93], [94], [95], [96]); +branch_align() -> (); +drop([22]) -> (); +drop>([17]) -> (); +drop([14]) -> (); +array_new() -> ([97]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492914>() -> ([98]); +store_temp([98]) -> ([98]); +array_append([97], [98]) -> ([99]); +struct_construct() -> ([100]); +struct_construct>>([100], [99]) -> ([101]); +enum_init,)>, 1>([101]) -> ([102]); +store_temp([0]) -> ([103]); +store_temp([16]) -> ([104]); +store_temp([6]) -> ([105]); +store_temp([3]) -> ([106]); +store_temp,)>>([102]) -> ([107]); +return([103], [104], [105], [106], [107]); +branch_align() -> (); +drop([15]) -> (); +drop>([10]) -> (); +array_new() -> ([108]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492913>() -> ([109]); +store_temp([109]) -> ([109]); +array_append([108], [109]) -> ([110]); +struct_construct() -> ([111]); +struct_construct>>([111], [110]) -> ([112]); +enum_init,)>, 1>([112]) -> ([113]); +store_temp([0]) -> ([114]); +store_temp([9]) -> ([115]); +store_temp([6]) -> ([116]); +store_temp([3]) -> ([117]); +store_temp,)>>([113]) -> ([118]); +return([114], [115], [116], [117], [118]); +branch_align() -> (); +drop>([4]) -> (); +array_new() -> ([119]); +felt252_const<375233589013918064796019>() -> ([120]); +store_temp([120]) -> ([120]); +array_append([119], [120]) -> ([121]); +struct_construct() -> ([122]); +struct_construct>>([122], [121]) -> ([123]); +enum_init,)>, 1>([123]) -> ([124]); +store_temp([0]) -> ([125]); +store_temp([7]) -> ([126]); +store_temp([8]) -> ([127]); +store_temp([3]) -> ([128]); +store_temp,)>>([124]) -> ([129]); +return([125], [126], [127], [128], [129]); +revoke_ap_tracking() -> (); +withdraw_gas([1], [2]) { fallthrough([5], [6]) 1662([7], [8]) }; +branch_align() -> (); +store_temp>([4]) -> ([11]); +function_call([11]) -> ([9], [10]); +store_temp([5]) -> ([5]); +enum_match>([10]) { fallthrough([12]) 1646([13]) }; +branch_align() -> (); +store_temp>([9]) -> ([16]); +function_call([16]) -> ([14], [15]); +enum_match>([15]) { fallthrough([17]) 1629([18]) }; +branch_align() -> (); +store_temp([5]) -> ([22]); +store_temp>([14]) -> ([23]); +function_call([22], [23]) -> ([19], [20], [21]); +enum_match>([21]) { fallthrough([24]) 1611([25]) }; +branch_align() -> (); +store_temp([19]) -> ([29]); +store_temp>([20]) -> ([30]); +function_call([29], [30]) -> ([26], [27], [28]); +enum_match>([28]) { fallthrough([31]) 1592([32]) }; +branch_align() -> (); +store_temp([26]) -> ([36]); +store_temp>([27]) -> ([37]); +function_call([36], [37]) -> ([33], [34], [35]); +enum_match>([35]) { fallthrough([38]) 1572([39]) }; +branch_align() -> (); +struct_deconstruct>([34]) -> ([40]); +array_len([40]) -> ([41]); +snapshot_take([41]) -> ([42], [43]); +drop([42]) -> (); +u32_const<0>() -> ([44]); +snapshot_take([44]) -> ([45], [46]); +drop([45]) -> (); +rename([43]) -> ([47]); +rename([46]) -> ([48]); +store_temp([47]) -> ([47]); +u32_eq([47], [48]) { fallthrough() 1507() }; +branch_align() -> (); +drop([38]) -> (); +drop([31]) -> (); +drop([24]) -> (); +drop([17]) -> (); +drop([12]) -> (); +array_new() -> ([49]); +felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>() -> ([50]); +store_temp([50]) -> ([50]); +array_append([49], [50]) -> ([51]); +struct_construct() -> ([52]); +struct_construct>>([52], [51]) -> ([53]); +enum_init,)>, 1>([53]) -> ([54]); +store_temp([0]) -> ([55]); +store_temp([33]) -> ([56]); +store_temp([6]) -> ([57]); +store_temp([3]) -> ([58]); +store_temp,)>>([54]) -> ([59]); +return([55], [56], [57], [58], [59]); +branch_align() -> (); +get_builtin_costs() -> ([60]); +store_temp([60]) -> ([60]); +withdraw_gas_all([33], [6], [60]) { fallthrough([61], [62]) 1553([63], [64]) }; +branch_align() -> (); +struct_construct() -> ([65]); +struct_construct() -> ([66]); +struct_construct() -> ([67]); +struct_construct() -> ([68]); +struct_construct() -> ([69]); +struct_construct() -> ([70]); +struct_construct([65], [66], [67], [68], [69], [70]) -> ([71]); +store_temp([61]) -> ([77]); +store_temp([62]) -> ([78]); +store_temp([0]) -> ([79]); +store_temp([3]) -> ([80]); +store_temp([71]) -> ([81]); +store_temp([12]) -> ([82]); +store_temp([17]) -> ([83]); +store_temp([24]) -> ([84]); +store_temp([31]) -> ([85]); +store_temp([38]) -> ([86]); +function_call([77], [78], [79], [80], [81], [82], [83], [84], [85], [86]) -> ([72], [73], [74], [75], [76]); +enum_match>([76]) { fallthrough([87]) 1545([88]) }; +branch_align() -> (); +drop>([87]) -> (); +array_new() -> ([89]); +snapshot_take>([89]) -> ([90], [91]); +drop>([90]) -> (); +struct_construct>([91]) -> ([92]); +struct_construct>>([92]) -> ([93]); +enum_init,)>, 0>([93]) -> ([94]); +store_temp([74]) -> ([95]); +store_temp([72]) -> ([96]); +store_temp([73]) -> ([97]); +store_temp([75]) -> ([98]); +store_temp,)>>([94]) -> ([99]); +return([95], [96], [97], [98], [99]); +branch_align() -> (); +enum_init,)>, 1>([88]) -> ([100]); +store_temp([74]) -> ([101]); +store_temp([72]) -> ([102]); +store_temp([73]) -> ([103]); +store_temp([75]) -> ([104]); +store_temp,)>>([100]) -> ([105]); +return([101], [102], [103], [104], [105]); +branch_align() -> (); +drop([38]) -> (); +drop([31]) -> (); +drop([24]) -> (); +drop([17]) -> (); +drop([12]) -> (); +array_new() -> ([106]); +felt252_const<375233589013918064796019>() -> ([107]); +store_temp([107]) -> ([107]); +array_append([106], [107]) -> ([108]); +struct_construct() -> ([109]); +struct_construct>>([109], [108]) -> ([110]); +enum_init,)>, 1>([110]) -> ([111]); +store_temp([0]) -> ([112]); +store_temp([63]) -> ([113]); +store_temp([64]) -> ([114]); +store_temp([3]) -> ([115]); +store_temp,)>>([111]) -> ([116]); +return([112], [113], [114], [115], [116]); +branch_align() -> (); +drop([39]) -> (); +drop>([34]) -> (); +drop([31]) -> (); +drop([24]) -> (); +drop([17]) -> (); +drop([12]) -> (); +array_new() -> ([117]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492917>() -> ([118]); +store_temp([118]) -> ([118]); +array_append([117], [118]) -> ([119]); +struct_construct() -> ([120]); +struct_construct>>([120], [119]) -> ([121]); +enum_init,)>, 1>([121]) -> ([122]); +store_temp([0]) -> ([123]); +store_temp([33]) -> ([124]); +store_temp([6]) -> ([125]); +store_temp([3]) -> ([126]); +store_temp,)>>([122]) -> ([127]); +return([123], [124], [125], [126], [127]); +branch_align() -> (); +drop([32]) -> (); +drop([17]) -> (); +drop([12]) -> (); +drop([24]) -> (); +drop>([27]) -> (); +array_new() -> ([128]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492916>() -> ([129]); +store_temp([129]) -> ([129]); +array_append([128], [129]) -> ([130]); +struct_construct() -> ([131]); +struct_construct>>([131], [130]) -> ([132]); +enum_init,)>, 1>([132]) -> ([133]); +store_temp([0]) -> ([134]); +store_temp([26]) -> ([135]); +store_temp([6]) -> ([136]); +store_temp([3]) -> ([137]); +store_temp,)>>([133]) -> ([138]); +return([134], [135], [136], [137], [138]); +branch_align() -> (); +drop([25]) -> (); +drop([17]) -> (); +drop([12]) -> (); +drop>([20]) -> (); +array_new() -> ([139]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492915>() -> ([140]); +store_temp([140]) -> ([140]); +array_append([139], [140]) -> ([141]); +struct_construct() -> ([142]); +struct_construct>>([142], [141]) -> ([143]); +enum_init,)>, 1>([143]) -> ([144]); +store_temp([0]) -> ([145]); +store_temp([19]) -> ([146]); +store_temp([6]) -> ([147]); +store_temp([3]) -> ([148]); +store_temp,)>>([144]) -> ([149]); +return([145], [146], [147], [148], [149]); +branch_align() -> (); +drop([18]) -> (); +drop([12]) -> (); +drop>([14]) -> (); +array_new() -> ([150]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492914>() -> ([151]); +store_temp([151]) -> ([151]); +array_append([150], [151]) -> ([152]); +struct_construct() -> ([153]); +struct_construct>>([153], [152]) -> ([154]); +enum_init,)>, 1>([154]) -> ([155]); +store_temp([0]) -> ([156]); +store_temp([5]) -> ([157]); +store_temp([6]) -> ([158]); +store_temp([3]) -> ([159]); +store_temp,)>>([155]) -> ([160]); +return([156], [157], [158], [159], [160]); +branch_align() -> (); +drop([13]) -> (); +drop>([9]) -> (); +array_new() -> ([161]); +felt252_const<485748461484230571791265682659113160264223489397539653310998840191492913>() -> ([162]); +store_temp([162]) -> ([162]); +array_append([161], [162]) -> ([163]); +struct_construct() -> ([164]); +struct_construct>>([164], [163]) -> ([165]); +enum_init,)>, 1>([165]) -> ([166]); +store_temp([0]) -> ([167]); +store_temp([5]) -> ([168]); +store_temp([6]) -> ([169]); +store_temp([3]) -> ([170]); +store_temp,)>>([166]) -> ([171]); +return([167], [168], [169], [170], [171]); +branch_align() -> (); +drop>([4]) -> (); +array_new() -> ([172]); +felt252_const<375233589013918064796019>() -> ([173]); +store_temp([173]) -> ([173]); +array_append([172], [173]) -> ([174]); +struct_construct() -> ([175]); +struct_construct>>([175], [174]) -> ([176]); +enum_init,)>, 1>([176]) -> ([177]); +store_temp([0]) -> ([178]); +store_temp([7]) -> ([179]); +store_temp([8]) -> ([180]); +store_temp([3]) -> ([181]); +store_temp,)>>([177]) -> ([182]); +return([178], [179], [180], [181], [182]); +struct_deconstruct([2]) -> ([3], [4], [5], [6], [7], [8]); +drop([4]) -> (); +drop([5]) -> (); +drop([6]) -> (); +drop([7]) -> (); +drop([8]) -> (); +store_temp([0]) -> ([12]); +store_temp([1]) -> ([13]); +store_temp([3]) -> ([14]); +function_call([12], [13], [14]) -> ([9], [10], [11]); +enum_match>([11]) { fallthrough([15]) 1696([16]) }; +branch_align() -> (); +struct_deconstruct>([15]) -> ([17]); +struct_construct>([17]) -> ([18]); +enum_init, 0>([18]) -> ([19]); +store_temp([9]) -> ([20]); +store_temp([10]) -> ([21]); +store_temp>([19]) -> ([22]); +return([20], [21], [22]); +branch_align() -> (); +enum_init, 1>([16]) -> ([23]); +store_temp([9]) -> ([24]); +store_temp([10]) -> ([25]); +store_temp>([23]) -> ([26]); +return([24], [25], [26]); +rename([0]) -> ([2]); +array_append([1], [2]) -> ([3]); +struct_construct() -> ([4]); +store_temp>([3]) -> ([5]); +store_temp([4]) -> ([6]); +return([5], [6]); +struct_deconstruct([2]) -> ([3], [4], [5], [6], [7], [8]); +drop([3]) -> (); +drop([5]) -> (); +drop([6]) -> (); +drop([7]) -> (); +drop([8]) -> (); +store_temp([0]) -> ([12]); +store_temp([1]) -> ([13]); +store_temp([4]) -> ([14]); +function_call([12], [13], [14]) -> ([9], [10], [11]); +enum_match>([11]) { fallthrough([15]) 1727([16]) }; +branch_align() -> (); +struct_deconstruct>([15]) -> ([17]); +struct_construct>([17]) -> ([18]); +enum_init, 0>([18]) -> ([19]); +store_temp([9]) -> ([20]); +store_temp([10]) -> ([21]); +store_temp>([19]) -> ([22]); +return([20], [21], [22]); +branch_align() -> (); +enum_init, 1>([16]) -> ([23]); +store_temp([9]) -> ([24]); +store_temp([10]) -> ([25]); +store_temp>([23]) -> ([26]); +return([24], [25], [26]); +struct_deconstruct([3]) -> ([4], [5], [6], [7], [8], [9]); +drop([4]) -> (); +drop([5]) -> (); +drop([7]) -> (); +drop([8]) -> (); +drop([9]) -> (); +store_temp([0]) -> ([14]); +store_temp([1]) -> ([15]); +store_temp([2]) -> ([16]); +store_temp([6]) -> ([17]); +function_call([14], [15], [16], [17]) -> ([10], [11], [12], [13]); +enum_match>([13]) { fallthrough([18]) 1754([19]) }; +branch_align() -> (); +struct_deconstruct>([18]) -> ([20]); +struct_construct>([20]) -> ([21]); +enum_init, 0>([21]) -> ([22]); +store_temp([10]) -> ([23]); +store_temp([11]) -> ([24]); +store_temp([12]) -> ([25]); +store_temp>([22]) -> ([26]); +return([23], [24], [25], [26]); +branch_align() -> (); +enum_init, 1>([19]) -> ([27]); +store_temp([10]) -> ([28]); +store_temp([11]) -> ([29]); +store_temp([12]) -> ([30]); +store_temp>([27]) -> ([31]); +return([28], [29], [30], [31]); +rename([0]) -> ([2]); +u8_to_felt252([2]) -> ([3]); +snapshot_take([3]) -> ([4], [5]); +drop([4]) -> (); +store_temp([5]) -> ([8]); +store_temp>([1]) -> ([9]); +function_call([8], [9]) -> ([6], [7]); +drop([7]) -> (); +struct_construct() -> ([10]); +store_temp>([6]) -> ([11]); +store_temp([10]) -> ([12]); +return([11], [12]); +struct_deconstruct([3]) -> ([4], [5], [6], [7], [8], [9]); +drop([4]) -> (); +drop([5]) -> (); +drop([6]) -> (); +drop([8]) -> (); +drop([9]) -> (); +store_temp([0]) -> ([14]); +store_temp([1]) -> ([15]); +store_temp([2]) -> ([16]); +store_temp([7]) -> ([17]); +function_call([14], [15], [16], [17]) -> ([10], [11], [12], [13]); +enum_match>([13]) { fallthrough([18]) 1794([19]) }; +branch_align() -> (); +struct_deconstruct>([18]) -> ([20]); +struct_construct>([20]) -> ([21]); +enum_init, 0>([21]) -> ([22]); +store_temp([10]) -> ([23]); +store_temp([11]) -> ([24]); +store_temp([12]) -> ([25]); +store_temp>([22]) -> ([26]); +return([23], [24], [25], [26]); +branch_align() -> (); +enum_init, 1>([19]) -> ([27]); +store_temp([10]) -> ([28]); +store_temp([11]) -> ([29]); +store_temp([12]) -> ([30]); +store_temp>([27]) -> ([31]); +return([28], [29], [30], [31]); +dup([0]) -> ([0], [2]); +struct_deconstruct([2]) -> ([3], [4]); +drop([4]) -> (); +store_temp([3]) -> ([7]); +store_temp>([1]) -> ([8]); +function_call([7], [8]) -> ([5], [6]); +drop([6]) -> (); +struct_deconstruct([0]) -> ([9], [10]); +drop([9]) -> (); +store_temp([10]) -> ([13]); +store_temp>([5]) -> ([14]); +function_call([13], [14]) -> ([11], [12]); +rename>([11]) -> ([15]); +rename([12]) -> ([16]); +return([15], [16]); +store_temp>([1]) -> ([4]); +function_call([4]) -> ([2], [3]); +enum_match>([3]) { fallthrough([5]) 1834([6]) }; +branch_align() -> (); +contract_address_try_from_felt252([0], [5]) { fallthrough([7], [8]) 1827([9]) }; +branch_align() -> (); +enum_init, 0>([8]) -> ([10]); +store_temp([7]) -> ([11]); +store_temp>([2]) -> ([12]); +store_temp>([10]) -> ([13]); +return([11], [12], [13]); +branch_align() -> (); +struct_construct() -> ([14]); +enum_init, 1>([14]) -> ([15]); +store_temp([9]) -> ([16]); +store_temp>([2]) -> ([17]); +store_temp>([15]) -> ([18]); +return([16], [17], [18]); +branch_align() -> (); +enum_init, 1>([6]) -> ([19]); +store_temp([0]) -> ([20]); +store_temp>([2]) -> ([21]); +store_temp>([19]) -> ([22]); +return([20], [21], [22]); +struct_deconstruct([4]) -> ([6], [7], [8], [9], [10], [11]); +drop([6]) -> (); +drop([7]) -> (); +drop([8]) -> (); +drop([9]) -> (); +drop([11]) -> (); +store_temp([0]) -> ([17]); +store_temp([1]) -> ([18]); +store_temp([2]) -> ([19]); +store_temp([3]) -> ([20]); +store_temp([10]) -> ([21]); +store_temp([5]) -> ([22]); +function_call([17], [18], [19], [20], [21], [22]) -> ([12], [13], [14], [15], [16]); +enum_match>([16]) { fallthrough([23]) 1864([24]) }; +branch_align() -> (); +struct_deconstruct>([23]) -> ([25]); +struct_construct>([25]) -> ([26]); +enum_init, 0>([26]) -> ([27]); +store_temp([12]) -> ([28]); +store_temp([13]) -> ([29]); +store_temp([14]) -> ([30]); +store_temp([15]) -> ([31]); +store_temp>([27]) -> ([32]); +return([28], [29], [30], [31], [32]); +branch_align() -> (); +enum_init, 1>([24]) -> ([33]); +store_temp([12]) -> ([34]); +store_temp([13]) -> ([35]); +store_temp([14]) -> ([36]); +store_temp([15]) -> ([37]); +store_temp>([33]) -> ([38]); +return([34], [35], [36], [37], [38]); +struct_deconstruct([4]) -> ([7], [8], [9], [10], [11], [12]); +drop([7]) -> (); +drop([8]) -> (); +drop([9]) -> (); +drop([10]) -> (); +drop([11]) -> (); +struct_construct>([5], [6]) -> ([13]); +store_temp([0]) -> ([19]); +store_temp([1]) -> ([20]); +store_temp([2]) -> ([21]); +store_temp([3]) -> ([22]); +store_temp([12]) -> ([23]); +store_temp>([13]) -> ([24]); +function_call([19], [20], [21], [22], [23], [24]) -> ([14], [15], [16], [17], [18]); +enum_match>([18]) { fallthrough([25]) 1897([26]) }; +branch_align() -> (); +struct_deconstruct>([25]) -> ([27]); +struct_construct>([27]) -> ([28]); +enum_init, 0>([28]) -> ([29]); +store_temp([14]) -> ([30]); +store_temp([15]) -> ([31]); +store_temp([16]) -> ([32]); +store_temp([17]) -> ([33]); +store_temp>([29]) -> ([34]); +return([30], [31], [32], [33], [34]); +branch_align() -> (); +enum_init, 1>([26]) -> ([35]); +store_temp([14]) -> ([36]); +store_temp([15]) -> ([37]); +store_temp([16]) -> ([38]); +store_temp([17]) -> ([39]); +store_temp>([35]) -> ([40]); +return([36], [37], [38], [39], [40]); +store_temp([0]) -> ([5]); +store_temp>([1]) -> ([6]); +function_call([5], [6]) -> ([2], [3], [4]); +enum_match>([4]) { fallthrough([7]) 1928([8]) }; +branch_align() -> (); +store_temp([2]) -> ([12]); +store_temp>([3]) -> ([13]); +function_call([12], [13]) -> ([9], [10], [11]); +enum_match>([11]) { fallthrough([14]) 1921([15]) }; +branch_align() -> (); +struct_construct([7], [14]) -> ([16]); +enum_init, 0>([16]) -> ([17]); +store_temp([9]) -> ([18]); +store_temp>([10]) -> ([19]); +store_temp>([17]) -> ([20]); +return([18], [19], [20]); +branch_align() -> (); +drop([7]) -> (); +enum_init, 1>([15]) -> ([21]); +store_temp([9]) -> ([22]); +store_temp>([10]) -> ([23]); +store_temp>([21]) -> ([24]); +return([22], [23], [24]); +branch_align() -> (); +enum_init, 1>([8]) -> ([25]); +store_temp([2]) -> ([26]); +store_temp>([3]) -> ([27]); +store_temp>([25]) -> ([28]); +return([26], [27], [28]); +store_temp([1]) -> ([10]); +store_temp([3]) -> ([11]); +function_call([10], [11]) -> ([7], [8], [9]); +enum_match>([9]) { fallthrough([12]) 1970([13]) }; +branch_align() -> (); +struct_deconstruct>([12]) -> ([14]); +store_temp([0]) -> ([20]); +store_temp([7]) -> ([21]); +store_temp([2]) -> ([22]); +store_temp([8]) -> ([23]); +store_temp([4]) -> ([24]); +store_temp([14]) -> ([25]); +store_temp([5]) -> ([26]); +store_temp([6]) -> ([27]); +function_call([20], [21], [22], [23], [24], [25], [26], [27]) -> ([15], [16], [17], [18], [19]); +enum_match>([19]) { fallthrough([28]) 1962([29]) }; +branch_align() -> (); +struct_deconstruct>([28]) -> ([30], [31]); +drop([31]) -> (); +struct_construct() -> ([32]); +struct_construct>([30], [32]) -> ([33]); +enum_init, 0>([33]) -> ([34]); +store_temp([15]) -> ([35]); +store_temp([16]) -> ([36]); +store_temp([17]) -> ([37]); +store_temp([18]) -> ([38]); +store_temp>([34]) -> ([39]); +return([35], [36], [37], [38], [39]); +branch_align() -> (); +enum_init, 1>([29]) -> ([40]); +store_temp([15]) -> ([41]); +store_temp([16]) -> ([42]); +store_temp([17]) -> ([43]); +store_temp([18]) -> ([44]); +store_temp>([40]) -> ([45]); +return([41], [42], [43], [44], [45]); +branch_align() -> (); +drop([6]) -> (); +drop([5]) -> (); +drop([4]) -> (); +enum_init, 1>([13]) -> ([46]); +store_temp([0]) -> ([47]); +store_temp([7]) -> ([48]); +store_temp([2]) -> ([49]); +store_temp([8]) -> ([50]); +store_temp>([46]) -> ([51]); +return([47], [48], [49], [50], [51]); +store_temp([1]) -> ([11]); +store_temp([3]) -> ([12]); +function_call([11], [12]) -> ([8], [9], [10]); +enum_match>([10]) { fallthrough([13]) 2043([14]) }; +branch_align() -> (); +struct_deconstruct>([13]) -> ([15]); +store_temp([0]) -> ([21]); +store_temp([8]) -> ([22]); +store_temp([2]) -> ([23]); +store_temp([9]) -> ([24]); +store_temp([4]) -> ([25]); +dup([5]) -> ([5], [26]); +store_temp([26]) -> ([26]); +store_temp([15]) -> ([27]); +dup([7]) -> ([7], [28]); +store_temp([28]) -> ([28]); +function_call([21], [22], [23], [24], [25], [26], [27], [28]) -> ([16], [17], [18], [19], [20]); +enum_match>([20]) { fallthrough([29]) 2032([30]) }; +branch_align() -> (); +struct_deconstruct>([29]) -> ([31], [32]); +drop([32]) -> (); +store_temp([16]) -> ([38]); +store_temp([17]) -> ([39]); +store_temp([18]) -> ([40]); +store_temp([19]) -> ([41]); +store_temp([31]) -> ([42]); +store_temp([5]) -> ([43]); +store_temp([6]) -> ([44]); +store_temp([7]) -> ([45]); +function_call([38], [39], [40], [41], [42], [43], [44], [45]) -> ([33], [34], [35], [36], [37]); +enum_match>([37]) { fallthrough([46]) 2024([47]) }; +branch_align() -> (); +struct_deconstruct>([46]) -> ([48], [49]); +drop([49]) -> (); +struct_construct() -> ([50]); +struct_construct>([48], [50]) -> ([51]); +enum_init, 0>([51]) -> ([52]); +store_temp([33]) -> ([53]); +store_temp([34]) -> ([54]); +store_temp([35]) -> ([55]); +store_temp([36]) -> ([56]); +store_temp>([52]) -> ([57]); +return([53], [54], [55], [56], [57]); +branch_align() -> (); +enum_init, 1>([47]) -> ([58]); +store_temp([33]) -> ([59]); +store_temp([34]) -> ([60]); +store_temp([35]) -> ([61]); +store_temp([36]) -> ([62]); +store_temp>([58]) -> ([63]); +return([59], [60], [61], [62], [63]); +branch_align() -> (); +drop([7]) -> (); +drop([6]) -> (); +drop([5]) -> (); +enum_init, 1>([30]) -> ([64]); +store_temp([16]) -> ([65]); +store_temp([17]) -> ([66]); +store_temp([18]) -> ([67]); +store_temp([19]) -> ([68]); +store_temp>([64]) -> ([69]); +return([65], [66], [67], [68], [69]); +branch_align() -> (); +drop([7]) -> (); +drop([6]) -> (); +drop([5]) -> (); +drop([4]) -> (); +enum_init, 1>([14]) -> ([70]); +store_temp([0]) -> ([71]); +store_temp([8]) -> ([72]); +store_temp([2]) -> ([73]); +store_temp([9]) -> ([74]); +store_temp>([70]) -> ([75]); +return([71], [72], [73], [74], [75]); +store_temp([1]) -> ([10]); +store_temp([3]) -> ([11]); +function_call([10], [11]) -> ([7], [8], [9]); +enum_match>([9]) { fallthrough([12]) 2091([13]) }; +branch_align() -> (); +struct_deconstruct>([12]) -> ([14]); +store_temp([0]) -> ([20]); +store_temp([7]) -> ([21]); +store_temp([2]) -> ([22]); +store_temp([8]) -> ([23]); +store_temp([4]) -> ([24]); +store_temp([14]) -> ([25]); +store_temp([5]) -> ([26]); +store_temp([6]) -> ([27]); +function_call([20], [21], [22], [23], [24], [25], [26], [27]) -> ([15], [16], [17], [18], [19]); +enum_match>([19]) { fallthrough([28]) 2083([29]) }; +branch_align() -> (); +struct_deconstruct>([28]) -> ([30], [31]); +drop([31]) -> (); +struct_construct() -> ([32]); +struct_construct>([30], [32]) -> ([33]); +enum_init, 0>([33]) -> ([34]); +store_temp([15]) -> ([35]); +store_temp([16]) -> ([36]); +store_temp([17]) -> ([37]); +store_temp([18]) -> ([38]); +store_temp>([34]) -> ([39]); +return([35], [36], [37], [38], [39]); +branch_align() -> (); +enum_init, 1>([29]) -> ([40]); +store_temp([15]) -> ([41]); +store_temp([16]) -> ([42]); +store_temp([17]) -> ([43]); +store_temp([18]) -> ([44]); +store_temp>([40]) -> ([45]); +return([41], [42], [43], [44], [45]); +branch_align() -> (); +drop([6]) -> (); +drop([5]) -> (); +drop([4]) -> (); +enum_init, 1>([13]) -> ([46]); +store_temp([0]) -> ([47]); +store_temp([7]) -> ([48]); +store_temp([2]) -> ([49]); +store_temp([8]) -> ([50]); +store_temp>([46]) -> ([51]); +return([47], [48], [49], [50], [51]); +store_temp([1]) -> ([10]); +store_temp([3]) -> ([11]); +function_call([10], [11]) -> ([7], [8], [9]); +enum_match>([9]) { fallthrough([12]) 2194([13]) }; +branch_align() -> (); +struct_deconstruct([4]) -> ([14], [15], [16], [17], [18], [19]); +snapshot_take([19]) -> ([20], [21]); +struct_deconstruct>([12]) -> ([22]); +dup([22]) -> ([22], [23]); +dup([5]) -> ([5], [24]); +struct_construct>([23], [24]) -> ([25]); +store_temp([0]) -> ([31]); +store_temp([7]) -> ([32]); +store_temp([2]) -> ([33]); +store_temp([8]) -> ([34]); +store_temp([21]) -> ([35]); +store_temp>([25]) -> ([36]); +function_call([31], [32], [33], [34], [35], [36]) -> ([26], [27], [28], [29], [30]); +enum_match>([30]) { fallthrough([37]) 2177([38]) }; +branch_align() -> (); +struct_deconstruct>([37]) -> ([39]); +store_temp([26]) -> ([42]); +store_temp([39]) -> ([43]); +store_temp([6]) -> ([44]); +function_call([42], [43], [44]) -> ([40], [41]); +enum_match>([41]) { fallthrough([45]) 2161([46]) }; +branch_align() -> (); +struct_deconstruct>([45]) -> ([47]); +struct_construct([14], [15], [16], [17], [18], [20]) -> ([48]); +store_temp([40]) -> ([54]); +store_temp([27]) -> ([55]); +store_temp([28]) -> ([56]); +store_temp([29]) -> ([57]); +store_temp([48]) -> ([58]); +store_temp([22]) -> ([59]); +store_temp([5]) -> ([60]); +store_temp([47]) -> ([61]); +function_call([54], [55], [56], [57], [58], [59], [60], [61]) -> ([49], [50], [51], [52], [53]); +enum_match>([53]) { fallthrough([62]) 2153([63]) }; +branch_align() -> (); +struct_deconstruct>([62]) -> ([64], [65]); +drop([65]) -> (); +struct_construct() -> ([66]); +struct_construct>([64], [66]) -> ([67]); +enum_init, 0>([67]) -> ([68]); +store_temp([49]) -> ([69]); +store_temp([50]) -> ([70]); +store_temp([51]) -> ([71]); +store_temp([52]) -> ([72]); +store_temp>([68]) -> ([73]); +return([69], [70], [71], [72], [73]); +branch_align() -> (); +enum_init, 1>([63]) -> ([74]); +store_temp([49]) -> ([75]); +store_temp([50]) -> ([76]); +store_temp([51]) -> ([77]); +store_temp([52]) -> ([78]); +store_temp>([74]) -> ([79]); +return([75], [76], [77], [78], [79]); +branch_align() -> (); +drop([14]) -> (); +drop([5]) -> (); +drop([22]) -> (); +drop([20]) -> (); +drop([18]) -> (); +drop([17]) -> (); +drop([16]) -> (); +drop([15]) -> (); +enum_init, 1>([46]) -> ([80]); +store_temp([40]) -> ([81]); +store_temp([27]) -> ([82]); +store_temp([28]) -> ([83]); +store_temp([29]) -> ([84]); +store_temp>([80]) -> ([85]); +return([81], [82], [83], [84], [85]); +branch_align() -> (); +drop([14]) -> (); +drop([5]) -> (); +drop([22]) -> (); +drop([15]) -> (); +drop([20]) -> (); +drop([18]) -> (); +drop([17]) -> (); +drop([16]) -> (); +drop([6]) -> (); +enum_init, 1>([38]) -> ([86]); +store_temp([26]) -> ([87]); +store_temp([27]) -> ([88]); +store_temp([28]) -> ([89]); +store_temp([29]) -> ([90]); +store_temp>([86]) -> ([91]); +return([87], [88], [89], [90], [91]); +branch_align() -> (); +drop([4]) -> (); +drop([5]) -> (); +drop([6]) -> (); +enum_init, 1>([13]) -> ([92]); +store_temp([0]) -> ([93]); +store_temp([7]) -> ([94]); +store_temp([2]) -> ([95]); +store_temp([8]) -> ([96]); +store_temp>([92]) -> ([97]); +return([93], [94], [95], [96], [97]); +store_temp([1]) -> ([10]); +store_temp([3]) -> ([11]); +function_call([10], [11]) -> ([7], [8], [9]); +enum_match>([9]) { fallthrough([12]) 2297([13]) }; +branch_align() -> (); +struct_deconstruct([4]) -> ([14], [15], [16], [17], [18], [19]); +snapshot_take([19]) -> ([20], [21]); +struct_deconstruct>([12]) -> ([22]); +dup([22]) -> ([22], [23]); +dup([5]) -> ([5], [24]); +struct_construct>([23], [24]) -> ([25]); +store_temp([0]) -> ([31]); +store_temp([7]) -> ([32]); +store_temp([2]) -> ([33]); +store_temp([8]) -> ([34]); +store_temp([21]) -> ([35]); +store_temp>([25]) -> ([36]); +function_call([31], [32], [33], [34], [35], [36]) -> ([26], [27], [28], [29], [30]); +enum_match>([30]) { fallthrough([37]) 2280([38]) }; +branch_align() -> (); +struct_deconstruct>([37]) -> ([39]); +store_temp([26]) -> ([42]); +store_temp([39]) -> ([43]); +store_temp([6]) -> ([44]); +function_call([42], [43], [44]) -> ([40], [41]); +enum_match>([41]) { fallthrough([45]) 2264([46]) }; +branch_align() -> (); +struct_deconstruct>([45]) -> ([47]); +struct_construct([14], [15], [16], [17], [18], [20]) -> ([48]); +store_temp([40]) -> ([54]); +store_temp([27]) -> ([55]); +store_temp([28]) -> ([56]); +store_temp([29]) -> ([57]); +store_temp([48]) -> ([58]); +store_temp([22]) -> ([59]); +store_temp([5]) -> ([60]); +store_temp([47]) -> ([61]); +function_call([54], [55], [56], [57], [58], [59], [60], [61]) -> ([49], [50], [51], [52], [53]); +enum_match>([53]) { fallthrough([62]) 2256([63]) }; +branch_align() -> (); +struct_deconstruct>([62]) -> ([64], [65]); +drop([65]) -> (); +struct_construct() -> ([66]); +struct_construct>([64], [66]) -> ([67]); +enum_init, 0>([67]) -> ([68]); +store_temp([49]) -> ([69]); +store_temp([50]) -> ([70]); +store_temp([51]) -> ([71]); +store_temp([52]) -> ([72]); +store_temp>([68]) -> ([73]); +return([69], [70], [71], [72], [73]); +branch_align() -> (); +enum_init, 1>([63]) -> ([74]); +store_temp([49]) -> ([75]); +store_temp([50]) -> ([76]); +store_temp([51]) -> ([77]); +store_temp([52]) -> ([78]); +store_temp>([74]) -> ([79]); +return([75], [76], [77], [78], [79]); +branch_align() -> (); +drop([14]) -> (); +drop([5]) -> (); +drop([22]) -> (); +drop([20]) -> (); +drop([18]) -> (); +drop([17]) -> (); +drop([16]) -> (); +drop([15]) -> (); +enum_init, 1>([46]) -> ([80]); +store_temp([40]) -> ([81]); +store_temp([27]) -> ([82]); +store_temp([28]) -> ([83]); +store_temp([29]) -> ([84]); +store_temp>([80]) -> ([85]); +return([81], [82], [83], [84], [85]); +branch_align() -> (); +drop([14]) -> (); +drop([5]) -> (); +drop([22]) -> (); +drop([15]) -> (); +drop([20]) -> (); +drop([18]) -> (); +drop([17]) -> (); +drop([16]) -> (); +drop([6]) -> (); +enum_init, 1>([38]) -> ([86]); +store_temp([26]) -> ([87]); +store_temp([27]) -> ([88]); +store_temp([28]) -> ([89]); +store_temp([29]) -> ([90]); +store_temp>([86]) -> ([91]); +return([87], [88], [89], [90], [91]); +branch_align() -> (); +drop([4]) -> (); +drop([5]) -> (); +drop([6]) -> (); +enum_init, 1>([13]) -> ([92]); +store_temp([0]) -> ([93]); +store_temp([7]) -> ([94]); +store_temp([2]) -> ([95]); +store_temp([8]) -> ([96]); +store_temp>([92]) -> ([97]); +return([93], [94], [95], [96], [97]); +struct_deconstruct>([0]) -> ([1]); +array_snapshot_pop_front([1]) { fallthrough([2], [3]) 2315([4]) }; +branch_align() -> (); +enum_init>, 0>([3]) -> ([5]); +store_temp>>([2]) -> ([6]); +store_temp>>([5]) -> ([7]); +jump() { 2320() }; +branch_align() -> (); +struct_construct() -> ([8]); +enum_init>, 1>([8]) -> ([9]); +store_temp>>([4]) -> ([6]); +store_temp>>([9]) -> ([7]); +struct_construct>([6]) -> ([10]); +store_temp>([10]) -> ([10]); +enum_match>>([7]) { fallthrough([11]) 2330([12]) }; +branch_align() -> (); +unbox([11]) -> ([13]); +rename([13]) -> ([14]); +enum_init, 0>([14]) -> ([15]); +store_temp>([10]) -> ([16]); +store_temp>([15]) -> ([17]); +return([16], [17]); +branch_align() -> (); +drop([12]) -> (); +struct_construct() -> ([18]); +enum_init, 1>([18]) -> ([19]); +store_temp>([10]) -> ([20]); +store_temp>([19]) -> ([21]); +return([20], [21]); +struct_deconstruct>([1]) -> ([2]); +array_snapshot_pop_front([2]) { fallthrough([3], [4]) 2344([5]) }; +branch_align() -> (); +enum_init>, 0>([4]) -> ([6]); +store_temp>>([3]) -> ([7]); +store_temp>>([6]) -> ([8]); +jump() { 2349() }; +branch_align() -> (); +struct_construct() -> ([9]); +enum_init>, 1>([9]) -> ([10]); +store_temp>>([5]) -> ([7]); +store_temp>>([10]) -> ([8]); +struct_construct>([7]) -> ([11]); +store_temp>([11]) -> ([11]); +enum_match>>([8]) { fallthrough([12]) 2371([13]) }; +branch_align() -> (); +unbox([12]) -> ([14]); +rename([14]) -> ([15]); +store_temp([0]) -> ([18]); +store_temp([15]) -> ([19]); +function_call([18], [19]) -> ([16], [17]); +enum_match>([17]) { fallthrough([20]) 2365([21]) }; +branch_align() -> (); +enum_init, 0>([20]) -> ([22]); +store_temp([16]) -> ([23]); +store_temp>([11]) -> ([24]); +store_temp>([22]) -> ([25]); +return([23], [24], [25]); +branch_align() -> (); +enum_init, 1>([21]) -> ([26]); +store_temp([16]) -> ([27]); +store_temp>([11]) -> ([28]); +store_temp>([26]) -> ([29]); +return([27], [28], [29]); +branch_align() -> (); +drop([13]) -> (); +struct_construct() -> ([30]); +enum_init, 1>([30]) -> ([31]); +store_temp([0]) -> ([32]); +store_temp>([11]) -> ([33]); +store_temp>([31]) -> ([34]); +return([32], [33], [34]); +struct_deconstruct([4]) -> ([10], [11], [12], [13], [14], [15]); +store_temp([1]) -> ([19]); +store_temp([3]) -> ([20]); +store_temp([10]) -> ([21]); +store_temp([5]) -> ([22]); +function_call([19], [20], [21], [22]) -> ([16], [17], [18]); +enum_match>([18]) { fallthrough([23]) 2572([24]) }; +branch_align() -> (); +store_temp([16]) -> ([28]); +store_temp([17]) -> ([29]); +store_temp([11]) -> ([30]); +store_temp([6]) -> ([31]); +function_call([28], [29], [30], [31]) -> ([25], [26], [27]); +enum_match>([27]) { fallthrough([32]) 2556([33]) }; +branch_align() -> (); +store_temp([25]) -> ([37]); +store_temp([26]) -> ([38]); +store_temp([12]) -> ([39]); +store_temp([7]) -> ([40]); +function_call([37], [38], [39], [40]) -> ([34], [35], [36]); +enum_match>([36]) { fallthrough([41]) 2541([42]) }; +branch_align() -> (); +dup([9]) -> ([9], [44]); +contract_address_to_felt252([44]) -> ([43]); +snapshot_take([43]) -> ([45], [46]); +drop([45]) -> (); +felt252_const<0>() -> ([47]); +snapshot_take([47]) -> ([48], [49]); +drop([48]) -> (); +rename([46]) -> ([50]); +rename([49]) -> ([51]); +felt252_sub([50], [51]) -> ([52]); +struct_deconstruct>([23]) -> ([53], [54]); +drop([54]) -> (); +struct_deconstruct>([32]) -> ([55], [56]); +drop([56]) -> (); +struct_deconstruct>([41]) -> ([57], [58]); +drop([58]) -> (); +store_temp([52]) -> ([52]); +felt252_is_zero([52]) { fallthrough() 2424([59]) }; +branch_align() -> (); +struct_construct() -> ([60]); +enum_init([60]) -> ([61]); +store_temp([61]) -> ([62]); +jump() { 2429() }; +branch_align() -> (); +drop>([59]) -> (); +struct_construct() -> ([63]); +enum_init([63]) -> ([64]); +store_temp([64]) -> ([62]); +bool_not_impl([62]) -> ([65]); +store_temp([65]) -> ([65]); +enum_match([65]) { fallthrough([66]) 2455([67]) }; +branch_align() -> (); +drop([66]) -> (); +drop([9]) -> (); +drop([55]) -> (); +drop([53]) -> (); +drop([8]) -> (); +drop([57]) -> (); +drop([15]) -> (); +drop([14]) -> (); +drop([13]) -> (); +array_new() -> ([68]); +felt252_const<7300388948442106731950660484798539862217172507820428101544021685107>() -> ([69]); +store_temp([69]) -> ([69]); +array_append([68], [69]) -> ([70]); +struct_construct() -> ([71]); +struct_construct>>([71], [70]) -> ([72]); +enum_init, 1>([72]) -> ([73]); +store_temp([0]) -> ([74]); +store_temp([34]) -> ([75]); +store_temp([2]) -> ([76]); +store_temp([35]) -> ([77]); +store_temp>([73]) -> ([78]); +return([74], [75], [76], [77], [78]); +branch_align() -> (); +drop([67]) -> (); +store_temp([34]) -> ([82]); +store_temp([35]) -> ([83]); +store_temp([13]) -> ([84]); +dup([8]) -> ([8], [85]); +store_temp([85]) -> ([85]); +function_call([82], [83], [84], [85]) -> ([79], [80], [81]); +enum_match>([81]) { fallthrough([86]) 2526([87]) }; +branch_align() -> (); +store_temp([0]) -> ([93]); +store_temp([79]) -> ([94]); +store_temp([2]) -> ([95]); +store_temp([80]) -> ([96]); +store_temp([14]) -> ([97]); +dup([9]) -> ([9], [98]); +store_temp([98]) -> ([98]); +dup([8]) -> ([8], [99]); +store_temp([99]) -> ([99]); +function_call([93], [94], [95], [96], [97], [98], [99]) -> ([88], [89], [90], [91], [92]); +enum_match>([92]) { fallthrough([100]) 2511([101]) }; +branch_align() -> (); +contract_address_const<0>() -> ([102]); +struct_deconstruct>([86]) -> ([103], [104]); +drop([104]) -> (); +struct_deconstruct>([100]) -> ([105], [106]); +drop([106]) -> (); +struct_construct([102], [9], [8]) -> ([107]); +enum_init([107]) -> ([108]); +struct_construct([53], [55], [57], [103], [105], [15]) -> ([109]); +store_temp([89]) -> ([113]); +store_temp([91]) -> ([114]); +store_temp([109]) -> ([115]); +store_temp([108]) -> ([116]); +function_call>>([113], [114], [115], [116]) -> ([110], [111], [112]); +enum_match>([112]) { fallthrough([117]) 2503([118]) }; +branch_align() -> (); +struct_deconstruct>([117]) -> ([119], [120]); +drop([120]) -> (); +struct_construct() -> ([121]); +struct_construct>([119], [121]) -> ([122]); +enum_init, 0>([122]) -> ([123]); +store_temp([88]) -> ([124]); +store_temp([110]) -> ([125]); +store_temp([90]) -> ([126]); +store_temp([111]) -> ([127]); +store_temp>([123]) -> ([128]); +return([124], [125], [126], [127], [128]); +branch_align() -> (); +enum_init, 1>([118]) -> ([129]); +store_temp([88]) -> ([130]); +store_temp([110]) -> ([131]); +store_temp([90]) -> ([132]); +store_temp([111]) -> ([133]); +store_temp>([129]) -> ([134]); +return([130], [131], [132], [133], [134]); +branch_align() -> (); +drop([53]) -> (); +drop([15]) -> (); +drop>([86]) -> (); +drop([9]) -> (); +drop([57]) -> (); +drop([55]) -> (); +drop([8]) -> (); +enum_init, 1>([101]) -> ([135]); +store_temp([88]) -> ([136]); +store_temp([89]) -> ([137]); +store_temp([90]) -> ([138]); +store_temp([91]) -> ([139]); +store_temp>([135]) -> ([140]); +return([136], [137], [138], [139], [140]); +branch_align() -> (); +drop([9]) -> (); +drop([55]) -> (); +drop([53]) -> (); +drop([8]) -> (); +drop([57]) -> (); +drop([15]) -> (); +drop([14]) -> (); +enum_init, 1>([87]) -> ([141]); +store_temp([0]) -> ([142]); +store_temp([79]) -> ([143]); +store_temp([2]) -> ([144]); +store_temp([80]) -> ([145]); +store_temp>([141]) -> ([146]); +return([142], [143], [144], [145], [146]); +branch_align() -> (); +drop([9]) -> (); +drop([13]) -> (); +drop>([32]) -> (); +drop([8]) -> (); +drop>([23]) -> (); +drop([15]) -> (); +drop([14]) -> (); +enum_init, 1>([42]) -> ([147]); +store_temp([0]) -> ([148]); +store_temp([34]) -> ([149]); +store_temp([2]) -> ([150]); +store_temp([35]) -> ([151]); +store_temp>([147]) -> ([152]); +return([148], [149], [150], [151], [152]); +branch_align() -> (); +drop([14]) -> (); +drop([15]) -> (); +drop([9]) -> (); +drop([13]) -> (); +drop([8]) -> (); +drop>([23]) -> (); +drop([7]) -> (); +drop([12]) -> (); +enum_init, 1>([33]) -> ([153]); +store_temp([0]) -> ([154]); +store_temp([25]) -> ([155]); +store_temp([2]) -> ([156]); +store_temp([26]) -> ([157]); +store_temp>([153]) -> ([158]); +return([154], [155], [156], [157], [158]); +branch_align() -> (); +drop([14]) -> (); +drop([15]) -> (); +drop([9]) -> (); +drop([13]) -> (); +drop([12]) -> (); +drop([8]) -> (); +drop([7]) -> (); +drop([6]) -> (); +drop([11]) -> (); +enum_init, 1>([24]) -> ([159]); +store_temp([0]) -> ([160]); +store_temp([16]) -> ([161]); +store_temp([2]) -> ([162]); +store_temp([17]) -> ([163]); +store_temp>([159]) -> ([164]); +return([160], [161], [162], [163], [164]); +drop([2]) -> (); +storage_base_address_const<1528802474226268325865027367859591458315299653151958663884057507666229546336>() -> ([3]); +storage_address_from_base([3]) -> ([4]); +u32_const<0>() -> ([5]); +store_temp([5]) -> ([5]); +store_temp([4]) -> ([4]); +storage_read_syscall([0], [1], [5], [4]) { fallthrough([6], [7], [8]) 2602([9], [10], [11]) }; +branch_align() -> (); +enum_init>, 0>([8]) -> ([12]); +store_temp([6]) -> ([13]); +store_temp([7]) -> ([14]); +store_temp>>([12]) -> ([15]); +jump() { 2607() }; +branch_align() -> (); +enum_init>, 1>([11]) -> ([16]); +store_temp([9]) -> ([13]); +store_temp([10]) -> ([14]); +store_temp>>([16]) -> ([15]); +rename>>([15]) -> ([18]); +function_call::unwrap_syscall>([18]) -> ([17]); +enum_match>([17]) { fallthrough([19]) 2618([20]) }; +branch_align() -> (); +struct_deconstruct>([19]) -> ([21]); +struct_construct>([21]) -> ([22]); +enum_init, 0>([22]) -> ([23]); +store_temp([13]) -> ([24]); +store_temp([14]) -> ([25]); +store_temp>([23]) -> ([26]); +return([24], [25], [26]); +branch_align() -> (); +enum_init, 1>([20]) -> ([27]); +store_temp([13]) -> ([28]); +store_temp([14]) -> ([29]); +store_temp>([27]) -> ([30]); +return([28], [29], [30]); +drop([2]) -> (); +storage_base_address_const<944713526212149105522785400348068751682982210605126537021911324578866405028>() -> ([3]); +storage_address_from_base([3]) -> ([4]); +u32_const<0>() -> ([5]); +store_temp([5]) -> ([5]); +store_temp([4]) -> ([4]); +storage_read_syscall([0], [1], [5], [4]) { fallthrough([6], [7], [8]) 2637([9], [10], [11]) }; +branch_align() -> (); +enum_init>, 0>([8]) -> ([12]); +store_temp([6]) -> ([13]); +store_temp([7]) -> ([14]); +store_temp>>([12]) -> ([15]); +jump() { 2642() }; +branch_align() -> (); +enum_init>, 1>([11]) -> ([16]); +store_temp([9]) -> ([13]); +store_temp([10]) -> ([14]); +store_temp>>([16]) -> ([15]); +rename>>([15]) -> ([18]); +function_call::unwrap_syscall>([18]) -> ([17]); +enum_match>([17]) { fallthrough([19]) 2653([20]) }; +branch_align() -> (); +struct_deconstruct>([19]) -> ([21]); +struct_construct>([21]) -> ([22]); +enum_init, 0>([22]) -> ([23]); +store_temp([13]) -> ([24]); +store_temp([14]) -> ([25]); +store_temp>([23]) -> ([26]); +return([24], [25], [26]); +branch_align() -> (); +enum_init, 1>([20]) -> ([27]); +store_temp([13]) -> ([28]); +store_temp([14]) -> ([29]); +store_temp>([27]) -> ([30]); +return([28], [29], [30]); +drop([3]) -> (); +storage_base_address_const<134830404806214277570220174593674215737759987247891306080029841794115377321>() -> ([4]); +u32_const<0>() -> ([5]); +store_temp([0]) -> ([10]); +store_temp([1]) -> ([11]); +store_temp([2]) -> ([12]); +store_temp([5]) -> ([13]); +store_temp([4]) -> ([14]); +function_call([10], [11], [12], [13], [14]) -> ([6], [7], [8], [9]); +enum_match>,)>>([9]) { fallthrough([15]) 2690([16]) }; +branch_align() -> (); +struct_deconstruct>>>([15]) -> ([17]); +store_temp>>([17]) -> ([19]); +function_call::unwrap_syscall>([19]) -> ([18]); +enum_match>([18]) { fallthrough([20]) 2683([21]) }; +branch_align() -> (); +struct_deconstruct>([20]) -> ([22]); +struct_construct>([22]) -> ([23]); +enum_init, 0>([23]) -> ([24]); +store_temp([6]) -> ([25]); +store_temp([7]) -> ([26]); +store_temp([8]) -> ([27]); +store_temp>([24]) -> ([28]); +return([25], [26], [27], [28]); +branch_align() -> (); +enum_init, 1>([21]) -> ([29]); +store_temp([6]) -> ([30]); +store_temp([7]) -> ([31]); +store_temp([8]) -> ([32]); +store_temp>([29]) -> ([33]); +return([30], [31], [32], [33]); +branch_align() -> (); +enum_init, 1>([16]) -> ([34]); +store_temp([6]) -> ([35]); +store_temp([7]) -> ([36]); +store_temp([8]) -> ([37]); +store_temp>([34]) -> ([38]); +return([35], [36], [37], [38]); +drop([3]) -> (); +storage_base_address_const<603278275252936218847294002513349627170936020082667936993356353388973422646>() -> ([4]); +u32_const<0>() -> ([5]); +store_temp([0]) -> ([10]); +store_temp([1]) -> ([11]); +store_temp([2]) -> ([12]); +store_temp([5]) -> ([13]); +store_temp([4]) -> ([14]); +function_call([10], [11], [12], [13], [14]) -> ([6], [7], [8], [9]); +enum_match>,)>>([9]) { fallthrough([15]) 2728([16]) }; +branch_align() -> (); +struct_deconstruct>>>([15]) -> ([17]); +store_temp>>([17]) -> ([19]); +function_call::unwrap_syscall>([19]) -> ([18]); +enum_match>([18]) { fallthrough([20]) 2721([21]) }; +branch_align() -> (); +struct_deconstruct>([20]) -> ([22]); +struct_construct>([22]) -> ([23]); +enum_init, 0>([23]) -> ([24]); +store_temp([6]) -> ([25]); +store_temp([7]) -> ([26]); +store_temp([8]) -> ([27]); +store_temp>([24]) -> ([28]); +return([25], [26], [27], [28]); +branch_align() -> (); +enum_init, 1>([21]) -> ([29]); +store_temp([6]) -> ([30]); +store_temp([7]) -> ([31]); +store_temp([8]) -> ([32]); +store_temp>([29]) -> ([33]); +return([30], [31], [32], [33]); +branch_align() -> (); +enum_init, 1>([16]) -> ([34]); +store_temp([6]) -> ([35]); +store_temp([7]) -> ([36]); +store_temp([8]) -> ([37]); +store_temp>([34]) -> ([38]); +return([35], [36], [37], [38]); +rename([0]) -> ([2]); +u128_to_felt252([2]) -> ([3]); +snapshot_take([3]) -> ([4], [5]); +drop([4]) -> (); +store_temp([5]) -> ([8]); +store_temp>([1]) -> ([9]); +function_call([8], [9]) -> ([6], [7]); +drop([7]) -> (); +struct_construct() -> ([10]); +store_temp>([6]) -> ([11]); +store_temp([10]) -> ([12]); +return([11], [12]); +store_temp([0]) -> ([9]); +store_temp([2]) -> ([10]); +store_temp([4]) -> ([11]); +store_temp([5]) -> ([12]); +function_call([9], [10], [11], [12]) -> ([6], [7], [8]); +u32_const<0>() -> ([13]); +store_temp([6]) -> ([18]); +store_temp([1]) -> ([19]); +store_temp([3]) -> ([20]); +store_temp([13]) -> ([21]); +store_temp([8]) -> ([22]); +function_call([18], [19], [20], [21], [22]) -> ([14], [15], [16], [17]); +enum_match>,)>>([17]) { fallthrough([23]) 2783([24]) }; +branch_align() -> (); +struct_deconstruct>>>([23]) -> ([25]); +store_temp>>([25]) -> ([27]); +function_call::unwrap_syscall>([27]) -> ([26]); +enum_match>([26]) { fallthrough([28]) 2775([29]) }; +branch_align() -> (); +struct_deconstruct>([28]) -> ([30]); +struct_construct>([30]) -> ([31]); +enum_init, 0>([31]) -> ([32]); +store_temp([14]) -> ([33]); +store_temp([15]) -> ([34]); +store_temp([7]) -> ([35]); +store_temp([16]) -> ([36]); +store_temp>([32]) -> ([37]); +return([33], [34], [35], [36], [37]); +branch_align() -> (); +enum_init, 1>([29]) -> ([38]); +store_temp([14]) -> ([39]); +store_temp([15]) -> ([40]); +store_temp([7]) -> ([41]); +store_temp([16]) -> ([42]); +store_temp>([38]) -> ([43]); +return([39], [40], [41], [42], [43]); +branch_align() -> (); +enum_init, 1>([24]) -> ([44]); +store_temp([14]) -> ([45]); +store_temp([15]) -> ([46]); +store_temp([7]) -> ([47]); +store_temp([16]) -> ([48]); +store_temp>([44]) -> ([49]); +return([45], [46], [47], [48], [49]); +store_temp([0]) -> ([9]); +store_temp([2]) -> ([10]); +store_temp([4]) -> ([11]); +store_temp>([5]) -> ([12]); +function_call([9], [10], [11], [12]) -> ([6], [7], [8]); +u32_const<0>() -> ([13]); +store_temp([6]) -> ([18]); +store_temp([1]) -> ([19]); +store_temp([3]) -> ([20]); +store_temp([13]) -> ([21]); +store_temp([8]) -> ([22]); +function_call([18], [19], [20], [21], [22]) -> ([14], [15], [16], [17]); +enum_match>,)>>([17]) { fallthrough([23]) 2827([24]) }; +branch_align() -> (); +struct_deconstruct>>>([23]) -> ([25]); +store_temp>>([25]) -> ([27]); +function_call::unwrap_syscall>([27]) -> ([26]); +enum_match>([26]) { fallthrough([28]) 2819([29]) }; +branch_align() -> (); +struct_deconstruct>([28]) -> ([30]); +struct_construct>([30]) -> ([31]); +enum_init, 0>([31]) -> ([32]); +store_temp([14]) -> ([33]); +store_temp([15]) -> ([34]); +store_temp([7]) -> ([35]); +store_temp([16]) -> ([36]); +store_temp>([32]) -> ([37]); +return([33], [34], [35], [36], [37]); +branch_align() -> (); +enum_init, 1>([29]) -> ([38]); +store_temp([14]) -> ([39]); +store_temp([15]) -> ([40]); +store_temp([7]) -> ([41]); +store_temp([16]) -> ([42]); +store_temp>([38]) -> ([43]); +return([39], [40], [41], [42], [43]); +branch_align() -> (); +enum_init, 1>([24]) -> ([44]); +store_temp([14]) -> ([45]); +store_temp([15]) -> ([46]); +store_temp([7]) -> ([47]); +store_temp([16]) -> ([48]); +store_temp>([44]) -> ([49]); +return([45], [46], [47], [48], [49]); +struct_deconstruct>([1]) -> ([2]); +array_snapshot_pop_front([2]) { fallthrough([3], [4]) 2842([5]) }; +branch_align() -> (); +enum_init>, 0>([4]) -> ([6]); +store_temp>>([3]) -> ([7]); +store_temp>>([6]) -> ([8]); +jump() { 2847() }; +branch_align() -> (); +struct_construct() -> ([9]); +enum_init>, 1>([9]) -> ([10]); +store_temp>>([5]) -> ([7]); +store_temp>>([10]) -> ([8]); +struct_construct>([7]) -> ([11]); +store_temp>([11]) -> ([11]); +enum_match>>([8]) { fallthrough([12]) 2869([13]) }; +branch_align() -> (); +unbox([12]) -> ([14]); +rename([14]) -> ([15]); +store_temp([0]) -> ([18]); +store_temp([15]) -> ([19]); +function_call([18], [19]) -> ([16], [17]); +enum_match>([17]) { fallthrough([20]) 2863([21]) }; +branch_align() -> (); +enum_init, 0>([20]) -> ([22]); +store_temp([16]) -> ([23]); +store_temp>([11]) -> ([24]); +store_temp>([22]) -> ([25]); +return([23], [24], [25]); +branch_align() -> (); +enum_init, 1>([21]) -> ([26]); +store_temp([16]) -> ([27]); +store_temp>([11]) -> ([28]); +store_temp>([26]) -> ([29]); +return([27], [28], [29]); +branch_align() -> (); +drop([13]) -> (); +struct_construct() -> ([30]); +enum_init, 1>([30]) -> ([31]); +store_temp([0]) -> ([32]); +store_temp>([11]) -> ([33]); +store_temp>([31]) -> ([34]); +return([32], [33], [34]); +store_temp([0]) -> ([5]); +store_temp([1]) -> ([6]); +function_call([5], [6]) -> ([2], [3], [4]); +enum_match,)>>([4]) { fallthrough([7]) 2895([8]) }; +branch_align() -> (); +struct_deconstruct>>([7]) -> ([9]); +unbox([9]) -> ([10]); +struct_deconstruct([10]) -> ([11], [12], [13], [14], [15]); +drop>([11]) -> (); +drop>([12]) -> (); +drop([14]) -> (); +drop([15]) -> (); +struct_construct>([13]) -> ([16]); +enum_init, 0>([16]) -> ([17]); +store_temp([2]) -> ([18]); +store_temp([3]) -> ([19]); +store_temp>([17]) -> ([20]); +return([18], [19], [20]); +branch_align() -> (); +enum_init, 1>([8]) -> ([21]); +store_temp([2]) -> ([22]); +store_temp([3]) -> ([23]); +store_temp>([21]) -> ([24]); +return([22], [23], [24]); +dup([5]) -> ([5], [9]); +contract_address_to_felt252([9]) -> ([8]); +snapshot_take([8]) -> ([10], [11]); +drop([10]) -> (); +felt252_const<0>() -> ([12]); +snapshot_take([12]) -> ([13], [14]); +drop([13]) -> (); +rename([11]) -> ([15]); +rename([14]) -> ([16]); +felt252_sub([15], [16]) -> ([17]); +store_temp([17]) -> ([17]); +felt252_is_zero([17]) { fallthrough() 2918([18]) }; +branch_align() -> (); +struct_construct() -> ([19]); +enum_init([19]) -> ([20]); +store_temp([20]) -> ([21]); +jump() { 2923() }; +branch_align() -> (); +drop>([18]) -> (); +struct_construct() -> ([22]); +enum_init([22]) -> ([23]); +store_temp([23]) -> ([21]); +bool_not_impl([21]) -> ([24]); +store_temp([24]) -> ([24]); +enum_match([24]) { fallthrough([25]) 2945([26]) }; +branch_align() -> (); +drop([25]) -> (); +drop([7]) -> (); +drop([6]) -> (); +drop([5]) -> (); +drop([4]) -> (); +array_new() -> ([27]); +felt252_const<25936191677694277552149992725516921697451103245639728>() -> ([28]); +store_temp([28]) -> ([28]); +array_append([27], [28]) -> ([29]); +struct_construct() -> ([30]); +struct_construct>>([30], [29]) -> ([31]); +enum_init, 1>([31]) -> ([32]); +store_temp([0]) -> ([33]); +store_temp([1]) -> ([34]); +store_temp([2]) -> ([35]); +store_temp([3]) -> ([36]); +store_temp>([32]) -> ([37]); +return([33], [34], [35], [36], [37]); +branch_align() -> (); +drop([26]) -> (); +dup([6]) -> ([6], [39]); +contract_address_to_felt252([39]) -> ([38]); +snapshot_take([38]) -> ([40], [41]); +drop([40]) -> (); +felt252_const<0>() -> ([42]); +snapshot_take([42]) -> ([43], [44]); +drop([43]) -> (); +rename([41]) -> ([45]); +rename([44]) -> ([46]); +felt252_sub([45], [46]) -> ([47]); +store_temp([47]) -> ([47]); +felt252_is_zero([47]) { fallthrough() 2964([48]) }; +branch_align() -> (); +struct_construct() -> ([49]); +enum_init([49]) -> ([50]); +store_temp([50]) -> ([51]); +jump() { 2969() }; +branch_align() -> (); +drop>([48]) -> (); +struct_construct() -> ([52]); +enum_init([52]) -> ([53]); +store_temp([53]) -> ([51]); +bool_not_impl([51]) -> ([54]); +store_temp([54]) -> ([54]); +enum_match([54]) { fallthrough([55]) 2991([56]) }; +branch_align() -> (); +drop([55]) -> (); +drop([7]) -> (); +drop([6]) -> (); +drop([5]) -> (); +drop([4]) -> (); +array_new() -> ([57]); +felt252_const<395754877894504967531585582359572169455970492464>() -> ([58]); +store_temp([58]) -> ([58]); +array_append([57], [58]) -> ([59]); +struct_construct() -> ([60]); +struct_construct>>([60], [59]) -> ([61]); +enum_init, 1>([61]) -> ([62]); +store_temp([0]) -> ([63]); +store_temp([1]) -> ([64]); +store_temp([2]) -> ([65]); +store_temp([3]) -> ([66]); +store_temp>([62]) -> ([67]); +return([63], [64], [65], [66], [67]); +branch_align() -> (); +drop([56]) -> (); +struct_deconstruct([4]) -> ([68], [69], [70], [71], [72], [73]); +snapshot_take([72]) -> ([74], [75]); +store_temp([0]) -> ([81]); +store_temp([1]) -> ([82]); +store_temp([2]) -> ([83]); +store_temp([3]) -> ([84]); +store_temp([75]) -> ([85]); +dup([5]) -> ([5], [86]); +store_temp([86]) -> ([86]); +function_call([81], [82], [83], [84], [85], [86]) -> ([76], [77], [78], [79], [80]); +enum_match>([80]) { fallthrough([87]) 3171([88]) }; +branch_align() -> (); +struct_deconstruct>([87]) -> ([89]); +store_temp([76]) -> ([92]); +store_temp([89]) -> ([93]); +dup([7]) -> ([7], [94]); +store_temp([94]) -> ([94]); +function_call([92], [93], [94]) -> ([90], [91]); +enum_match>([91]) { fallthrough([95]) 3154([96]) }; +branch_align() -> (); +struct_deconstruct>([95]) -> ([97]); +store_temp([90]) -> ([103]); +store_temp([77]) -> ([104]); +store_temp([78]) -> ([105]); +store_temp([79]) -> ([106]); +store_temp([74]) -> ([107]); +dup([5]) -> ([5], [108]); +store_temp([108]) -> ([108]); +store_temp([97]) -> ([109]); +function_call([103], [104], [105], [106], [107], [108], [109]) -> ([98], [99], [100], [101], [102]); +enum_match>([102]) { fallthrough([110]) 3138([111]) }; +branch_align() -> (); +struct_deconstruct>([110]) -> ([112], [113]); +drop([113]) -> (); +snapshot_take([112]) -> ([114], [115]); +store_temp([98]) -> ([121]); +store_temp([99]) -> ([122]); +store_temp([100]) -> ([123]); +store_temp([101]) -> ([124]); +store_temp([115]) -> ([125]); +dup([6]) -> ([6], [126]); +store_temp([126]) -> ([126]); +function_call([121], [122], [123], [124], [125], [126]) -> ([116], [117], [118], [119], [120]); +enum_match>([120]) { fallthrough([127]) 3121([128]) }; +branch_align() -> (); +struct_deconstruct>([127]) -> ([129]); +store_temp([116]) -> ([132]); +store_temp([129]) -> ([133]); +dup([7]) -> ([7], [134]); +store_temp([134]) -> ([134]); +function_call([132], [133], [134]) -> ([130], [131]); +enum_match>([131]) { fallthrough([135]) 3104([136]) }; +branch_align() -> (); +struct_deconstruct>([135]) -> ([137]); +store_temp([130]) -> ([143]); +store_temp([117]) -> ([144]); +store_temp([118]) -> ([145]); +store_temp([119]) -> ([146]); +store_temp([114]) -> ([147]); +dup([6]) -> ([6], [148]); +store_temp([148]) -> ([148]); +store_temp([137]) -> ([149]); +function_call([143], [144], [145], [146], [147], [148], [149]) -> ([138], [139], [140], [141], [142]); +enum_match>([142]) { fallthrough([150]) 3088([151]) }; +branch_align() -> (); +struct_deconstruct>([150]) -> ([152], [153]); +drop([153]) -> (); +struct_construct([5], [6], [7]) -> ([154]); +struct_construct([68], [69], [70], [71], [152], [73]) -> ([155]); +store_temp([139]) -> ([159]); +store_temp([141]) -> ([160]); +store_temp([155]) -> ([161]); +store_temp([154]) -> ([162]); +function_call>([159], [160], [161], [162]) -> ([156], [157], [158]); +enum_match>([158]) { fallthrough([163]) 3080([164]) }; +branch_align() -> (); +struct_deconstruct>([163]) -> ([165], [166]); +drop([166]) -> (); +struct_construct() -> ([167]); +struct_construct>([165], [167]) -> ([168]); +enum_init, 0>([168]) -> ([169]); +store_temp([138]) -> ([170]); +store_temp([156]) -> ([171]); +store_temp([140]) -> ([172]); +store_temp([157]) -> ([173]); +store_temp>([169]) -> ([174]); +return([170], [171], [172], [173], [174]); +branch_align() -> (); +enum_init, 1>([164]) -> ([175]); +store_temp([138]) -> ([176]); +store_temp([156]) -> ([177]); +store_temp([140]) -> ([178]); +store_temp([157]) -> ([179]); +store_temp>([175]) -> ([180]); +return([176], [177], [178], [179], [180]); +branch_align() -> (); +drop([68]) -> (); +drop([73]) -> (); +drop([5]) -> (); +drop([71]) -> (); +drop([70]) -> (); +drop([69]) -> (); +drop([7]) -> (); +drop([6]) -> (); +enum_init, 1>([151]) -> ([181]); +store_temp([138]) -> ([182]); +store_temp([139]) -> ([183]); +store_temp([140]) -> ([184]); +store_temp([141]) -> ([185]); +store_temp>([181]) -> ([186]); +return([182], [183], [184], [185], [186]); +branch_align() -> (); +drop([70]) -> (); +drop([7]) -> (); +drop([68]) -> (); +drop([6]) -> (); +drop([69]) -> (); +drop([73]) -> (); +drop([5]) -> (); +drop([71]) -> (); +drop([114]) -> (); +enum_init, 1>([136]) -> ([187]); +store_temp([130]) -> ([188]); +store_temp([117]) -> ([189]); +store_temp([118]) -> ([190]); +store_temp([119]) -> ([191]); +store_temp>([187]) -> ([192]); +return([188], [189], [190], [191], [192]); +branch_align() -> (); +drop([70]) -> (); +drop([7]) -> (); +drop([68]) -> (); +drop([6]) -> (); +drop([69]) -> (); +drop([73]) -> (); +drop([5]) -> (); +drop([71]) -> (); +drop([114]) -> (); +enum_init, 1>([128]) -> ([193]); +store_temp([116]) -> ([194]); +store_temp([117]) -> ([195]); +store_temp([118]) -> ([196]); +store_temp([119]) -> ([197]); +store_temp>([193]) -> ([198]); +return([194], [195], [196], [197], [198]); +branch_align() -> (); +drop([70]) -> (); +drop([7]) -> (); +drop([68]) -> (); +drop([6]) -> (); +drop([69]) -> (); +drop([73]) -> (); +drop([5]) -> (); +drop([71]) -> (); +enum_init, 1>([111]) -> ([199]); +store_temp([98]) -> ([200]); +store_temp([99]) -> ([201]); +store_temp([100]) -> ([202]); +store_temp([101]) -> ([203]); +store_temp>([199]) -> ([204]); +return([200], [201], [202], [203], [204]); +branch_align() -> (); +drop([70]) -> (); +drop([7]) -> (); +drop([68]) -> (); +drop([6]) -> (); +drop([69]) -> (); +drop([73]) -> (); +drop([5]) -> (); +drop([71]) -> (); +drop([74]) -> (); +enum_init, 1>([96]) -> ([205]); +store_temp([90]) -> ([206]); +store_temp([77]) -> ([207]); +store_temp([78]) -> ([208]); +store_temp([79]) -> ([209]); +store_temp>([205]) -> ([210]); +return([206], [207], [208], [209], [210]); +branch_align() -> (); +drop([70]) -> (); +drop([7]) -> (); +drop([68]) -> (); +drop([6]) -> (); +drop([69]) -> (); +drop([73]) -> (); +drop([5]) -> (); +drop([71]) -> (); +drop([74]) -> (); +enum_init, 1>([88]) -> ([211]); +store_temp([76]) -> ([212]); +store_temp([77]) -> ([213]); +store_temp([78]) -> ([214]); +store_temp([79]) -> ([215]); +store_temp>([211]) -> ([216]); +return([212], [213], [214], [215], [216]); +struct_deconstruct([4]) -> ([8], [9], [10], [11], [12], [13]); +snapshot_take([13]) -> ([14], [15]); +dup([5]) -> ([5], [16]); +dup([6]) -> ([6], [17]); +struct_construct>([16], [17]) -> ([18]); +store_temp([0]) -> ([24]); +store_temp([1]) -> ([25]); +store_temp([2]) -> ([26]); +store_temp([3]) -> ([27]); +store_temp([15]) -> ([28]); +store_temp>([18]) -> ([29]); +function_call([24], [25], [26], [27], [28], [29]) -> ([19], [20], [21], [22], [23]); +enum_match>([23]) { fallthrough([30]) 3312([31]) }; +branch_align() -> (); +u128_const<340282366920938463463374607431768211455>() -> ([32]); +snapshot_take([32]) -> ([33], [34]); +struct_deconstruct>([30]) -> ([35]); +struct_deconstruct([35]) -> ([36], [37]); +snapshot_take([36]) -> ([38], [39]); +rename([39]) -> ([40]); +rename([34]) -> ([41]); +u128_eq([40], [41]) { fallthrough() 3218() }; +branch_align() -> (); +drop([33]) -> (); +struct_construct() -> ([42]); +enum_init([42]) -> ([43]); +struct_construct([38], [37]) -> ([44]); +store_temp([44]) -> ([45]); +store_temp([43]) -> ([46]); +jump() { 3237() }; +branch_align() -> (); +snapshot_take([37]) -> ([47], [48]); +snapshot_take([33]) -> ([49], [50]); +drop([49]) -> (); +rename([48]) -> ([51]); +rename([50]) -> ([52]); +u128_eq([51], [52]) { fallthrough() 3230() }; +branch_align() -> (); +struct_construct() -> ([53]); +enum_init([53]) -> ([54]); +store_temp([54]) -> ([55]); +jump() { 3234() }; +branch_align() -> (); +struct_construct() -> ([56]); +enum_init([56]) -> ([57]); +store_temp([57]) -> ([55]); +struct_construct([38], [47]) -> ([58]); +store_temp([58]) -> ([45]); +store_temp([55]) -> ([46]); +enum_match([46]) { fallthrough([59]) 3291([60]) }; +branch_align() -> (); +drop([59]) -> (); +store_temp([19]) -> ([63]); +store_temp([45]) -> ([64]); +store_temp([7]) -> ([65]); +function_call([63], [64], [65]) -> ([61], [62]); +enum_match>([62]) { fallthrough([66]) 3275([67]) }; +branch_align() -> (); +struct_deconstruct>([66]) -> ([68]); +struct_construct([8], [9], [10], [11], [12], [14]) -> ([69]); +store_temp([61]) -> ([75]); +store_temp([20]) -> ([76]); +store_temp([21]) -> ([77]); +store_temp([22]) -> ([78]); +store_temp([69]) -> ([79]); +store_temp([5]) -> ([80]); +store_temp([6]) -> ([81]); +store_temp([68]) -> ([82]); +function_call([75], [76], [77], [78], [79], [80], [81], [82]) -> ([70], [71], [72], [73], [74]); +enum_match>([74]) { fallthrough([83]) 3267([84]) }; +branch_align() -> (); +struct_deconstruct>([83]) -> ([85], [86]); +drop([86]) -> (); +store_temp([70]) -> ([87]); +store_temp([71]) -> ([88]); +store_temp([72]) -> ([89]); +store_temp([73]) -> ([90]); +store_temp([85]) -> ([91]); +jump() { 3303() }; +branch_align() -> (); +enum_init, 1>([84]) -> ([92]); +store_temp([70]) -> ([93]); +store_temp([71]) -> ([94]); +store_temp([72]) -> ([95]); +store_temp([73]) -> ([96]); +store_temp>([92]) -> ([97]); +return([93], [94], [95], [96], [97]); +branch_align() -> (); +drop([8]) -> (); +drop([6]) -> (); +drop([5]) -> (); +drop([14]) -> (); +drop([12]) -> (); +drop([11]) -> (); +drop([10]) -> (); +drop([9]) -> (); +enum_init, 1>([67]) -> ([98]); +store_temp([61]) -> ([99]); +store_temp([20]) -> ([100]); +store_temp([21]) -> ([101]); +store_temp([22]) -> ([102]); +store_temp>([98]) -> ([103]); +return([99], [100], [101], [102], [103]); +branch_align() -> (); +drop([60]) -> (); +drop([6]) -> (); +drop([5]) -> (); +drop([7]) -> (); +drop([45]) -> (); +struct_construct([8], [9], [10], [11], [12], [14]) -> ([104]); +store_temp([19]) -> ([87]); +store_temp([20]) -> ([88]); +store_temp([21]) -> ([89]); +store_temp([22]) -> ([90]); +store_temp([104]) -> ([91]); +struct_construct() -> ([105]); +struct_construct>([91], [105]) -> ([106]); +enum_init, 0>([106]) -> ([107]); +store_temp([87]) -> ([108]); +store_temp([88]) -> ([109]); +store_temp([89]) -> ([110]); +store_temp([90]) -> ([111]); +store_temp>([107]) -> ([112]); +return([108], [109], [110], [111], [112]); +branch_align() -> (); +drop([8]) -> (); +drop([6]) -> (); +drop([5]) -> (); +drop([9]) -> (); +drop([14]) -> (); +drop([12]) -> (); +drop([11]) -> (); +drop([10]) -> (); +drop([7]) -> (); +enum_init, 1>([31]) -> ([113]); +store_temp([19]) -> ([114]); +store_temp([20]) -> ([115]); +store_temp([21]) -> ([116]); +store_temp([22]) -> ([117]); +store_temp>([113]) -> ([118]); +return([114], [115], [116], [117], [118]); +dup([6]) -> ([6], [9]); +contract_address_to_felt252([9]) -> ([8]); +snapshot_take([8]) -> ([10], [11]); +drop([10]) -> (); +felt252_const<0>() -> ([12]); +snapshot_take([12]) -> ([13], [14]); +drop([13]) -> (); +rename([11]) -> ([15]); +rename([14]) -> ([16]); +felt252_sub([15], [16]) -> ([17]); +store_temp([17]) -> ([17]); +felt252_is_zero([17]) { fallthrough() 3346([18]) }; +branch_align() -> (); +struct_construct() -> ([19]); +enum_init([19]) -> ([20]); +store_temp([20]) -> ([21]); +jump() { 3351() }; +branch_align() -> (); +drop>([18]) -> (); +struct_construct() -> ([22]); +enum_init([22]) -> ([23]); +store_temp([23]) -> ([21]); +bool_not_impl([21]) -> ([24]); +store_temp([24]) -> ([24]); +enum_match([24]) { fallthrough([25]) 3373([26]) }; +branch_align() -> (); +drop([25]) -> (); +drop([7]) -> (); +drop([6]) -> (); +drop([5]) -> (); +drop([4]) -> (); +array_new() -> ([27]); +felt252_const<101313248740993271302566317381896466254801065025584>() -> ([28]); +store_temp([28]) -> ([28]); +array_append([27], [28]) -> ([29]); +struct_construct() -> ([30]); +struct_construct>>([30], [29]) -> ([31]); +enum_init, 1>([31]) -> ([32]); +store_temp([0]) -> ([33]); +store_temp([1]) -> ([34]); +store_temp([2]) -> ([35]); +store_temp([3]) -> ([36]); +store_temp>([32]) -> ([37]); +return([33], [34], [35], [36], [37]); +branch_align() -> (); +drop([26]) -> (); +struct_deconstruct([4]) -> ([38], [39], [40], [41], [42], [43]); +dup([5]) -> ([5], [44]); +dup([6]) -> ([6], [45]); +struct_construct>([44], [45]) -> ([46]); +store_temp([0]) -> ([52]); +store_temp([1]) -> ([53]); +store_temp([2]) -> ([54]); +store_temp([3]) -> ([55]); +store_temp([43]) -> ([56]); +store_temp>([46]) -> ([57]); +dup([7]) -> ([7], [58]); +store_temp([58]) -> ([58]); +function_call([52], [53], [54], [55], [56], [57], [58]) -> ([47], [48], [49], [50], [51]); +enum_match>([51]) { fallthrough([59]) 3420([60]) }; +branch_align() -> (); +struct_deconstruct>([59]) -> ([61], [62]); +drop([62]) -> (); +struct_construct([5], [6], [7]) -> ([63]); +struct_construct([38], [39], [40], [41], [42], [61]) -> ([64]); +store_temp([48]) -> ([68]); +store_temp([50]) -> ([69]); +store_temp([64]) -> ([70]); +store_temp([63]) -> ([71]); +function_call>([68], [69], [70], [71]) -> ([65], [66], [67]); +enum_match>([67]) { fallthrough([72]) 3412([73]) }; +branch_align() -> (); +struct_deconstruct>([72]) -> ([74], [75]); +drop([75]) -> (); +struct_construct() -> ([76]); +struct_construct>([74], [76]) -> ([77]); +enum_init, 0>([77]) -> ([78]); +store_temp([47]) -> ([79]); +store_temp([65]) -> ([80]); +store_temp([49]) -> ([81]); +store_temp([66]) -> ([82]); +store_temp>([78]) -> ([83]); +return([79], [80], [81], [82], [83]); +branch_align() -> (); +enum_init, 1>([73]) -> ([84]); +store_temp([47]) -> ([85]); +store_temp([65]) -> ([86]); +store_temp([49]) -> ([87]); +store_temp([66]) -> ([88]); +store_temp>([84]) -> ([89]); +return([85], [86], [87], [88], [89]); +branch_align() -> (); +drop([38]) -> (); +drop([5]) -> (); +drop([42]) -> (); +drop([41]) -> (); +drop([40]) -> (); +drop([39]) -> (); +drop([7]) -> (); +drop([6]) -> (); +enum_init, 1>([60]) -> ([90]); +store_temp([47]) -> ([91]); +store_temp([48]) -> ([92]); +store_temp([49]) -> ([93]); +store_temp([50]) -> ([94]); +store_temp>([90]) -> ([95]); +return([91], [92], [93], [94], [95]); +store_temp([0]) -> ([5]); +store_temp([1]) -> ([6]); +store_temp([2]) -> ([7]); +function_call([5], [6], [7]) -> ([3], [4]); +enum_match>([4]) { fallthrough([8]) 3447([9]) }; +branch_align() -> (); +struct_construct>([8]) -> ([10]); +enum_init, 0>([10]) -> ([11]); +store_temp([3]) -> ([12]); +store_temp>([11]) -> ([13]); +return([12], [13]); +branch_align() -> (); +drop([9]) -> (); +array_new() -> ([14]); +felt252_const<39879774624079483812136948410799859986295>() -> ([15]); +store_temp([15]) -> ([15]); +array_append([14], [15]) -> ([16]); +struct_construct() -> ([17]); +struct_construct>>([17], [16]) -> ([18]); +enum_init, 1>([18]) -> ([19]); +store_temp([3]) -> ([20]); +store_temp>([19]) -> ([21]); +return([20], [21]); +store_temp([0]) -> ([5]); +store_temp([1]) -> ([6]); +store_temp([2]) -> ([7]); +function_call([5], [6], [7]) -> ([3], [4]); +enum_match>([4]) { fallthrough([8]) 3470([9]) }; +branch_align() -> (); +struct_construct>([8]) -> ([10]); +enum_init, 0>([10]) -> ([11]); +store_temp([3]) -> ([12]); +store_temp>([11]) -> ([13]); +return([12], [13]); +branch_align() -> (); +drop([9]) -> (); +array_new() -> ([14]); +felt252_const<39879774624085075084607933104993585622903>() -> ([15]); +store_temp([15]) -> ([15]); +array_append([14], [15]) -> ([16]); +struct_construct() -> ([17]); +struct_construct>>([17], [16]) -> ([18]); +enum_init, 1>([18]) -> ([19]); +store_temp([3]) -> ([20]); +store_temp>([19]) -> ([21]); +return([20], [21]); +u8_try_from_felt252([0], [1]) { fallthrough([2], [3]) 3488([4]) }; +branch_align() -> (); +enum_init, 0>([3]) -> ([5]); +store_temp([2]) -> ([6]); +store_temp>([5]) -> ([7]); +jump() { 3493() }; +branch_align() -> (); +struct_construct() -> ([8]); +enum_init, 1>([8]) -> ([9]); +store_temp([4]) -> ([6]); +store_temp>([9]) -> ([7]); +rename([6]) -> ([10]); +rename>([7]) -> ([11]); +return([10], [11]); +storage_base_address_const<1528802474226268325865027367859591458315299653151958663884057507666229546336>() -> ([4]); +storage_address_from_base([4]) -> ([5]); +u32_const<0>() -> ([6]); +snapshot_take([2]) -> ([7], [8]); +drop([8]) -> (); +store_temp([6]) -> ([6]); +store_temp([5]) -> ([5]); +storage_write_syscall([0], [1], [6], [5], [3]) { fallthrough([9], [10]) 3511([11], [12], [13]) }; +branch_align() -> (); +struct_construct() -> ([14]); +enum_init>, 0>([14]) -> ([15]); +store_temp([9]) -> ([16]); +store_temp([10]) -> ([17]); +store_temp>>([15]) -> ([18]); +jump() { 3516() }; +branch_align() -> (); +enum_init>, 1>([13]) -> ([19]); +store_temp([11]) -> ([16]); +store_temp([12]) -> ([17]); +store_temp>>([19]) -> ([18]); +rename>>([18]) -> ([21]); +function_call::unwrap_syscall>([21]) -> ([20]); +enum_match>([20]) { fallthrough([22]) 3527([23]) }; +branch_align() -> (); +struct_deconstruct>([22]) -> ([24]); +struct_construct>([7], [24]) -> ([25]); +enum_init, 0>([25]) -> ([26]); +store_temp([16]) -> ([27]); +store_temp([17]) -> ([28]); +store_temp>([26]) -> ([29]); +return([27], [28], [29]); +branch_align() -> (); +drop([7]) -> (); +enum_init, 1>([23]) -> ([30]); +store_temp([16]) -> ([31]); +store_temp([17]) -> ([32]); +store_temp>([30]) -> ([33]); +return([31], [32], [33]); +storage_base_address_const<944713526212149105522785400348068751682982210605126537021911324578866405028>() -> ([4]); +storage_address_from_base([4]) -> ([5]); +u32_const<0>() -> ([6]); +snapshot_take([2]) -> ([7], [8]); +drop([8]) -> (); +store_temp([6]) -> ([6]); +store_temp([5]) -> ([5]); +storage_write_syscall([0], [1], [6], [5], [3]) { fallthrough([9], [10]) 3549([11], [12], [13]) }; +branch_align() -> (); +struct_construct() -> ([14]); +enum_init>, 0>([14]) -> ([15]); +store_temp([9]) -> ([16]); +store_temp([10]) -> ([17]); +store_temp>>([15]) -> ([18]); +jump() { 3554() }; +branch_align() -> (); +enum_init>, 1>([13]) -> ([19]); +store_temp([11]) -> ([16]); +store_temp([12]) -> ([17]); +store_temp>>([19]) -> ([18]); +rename>>([18]) -> ([21]); +function_call::unwrap_syscall>([21]) -> ([20]); +enum_match>([20]) { fallthrough([22]) 3565([23]) }; +branch_align() -> (); +struct_deconstruct>([22]) -> ([24]); +struct_construct>([7], [24]) -> ([25]); +enum_init, 0>([25]) -> ([26]); +store_temp([16]) -> ([27]); +store_temp([17]) -> ([28]); +store_temp>([26]) -> ([29]); +return([27], [28], [29]); +branch_align() -> (); +drop([7]) -> (); +enum_init, 1>([23]) -> ([30]); +store_temp([16]) -> ([31]); +store_temp([17]) -> ([32]); +store_temp>([30]) -> ([33]); +return([31], [32], [33]); +storage_base_address_const<134830404806214277570220174593674215737759987247891306080029841794115377321>() -> ([4]); +u8_to_felt252([3]) -> ([5]); +storage_address_from_base([4]) -> ([6]); +u32_const<0>() -> ([7]); +snapshot_take([2]) -> ([8], [9]); +drop([9]) -> (); +store_temp([7]) -> ([7]); +store_temp([6]) -> ([6]); +storage_write_syscall([0], [1], [7], [6], [5]) { fallthrough([10], [11]) 3588([12], [13], [14]) }; +branch_align() -> (); +struct_construct() -> ([15]); +enum_init>, 0>([15]) -> ([16]); +store_temp([10]) -> ([17]); +store_temp([11]) -> ([18]); +store_temp>>([16]) -> ([19]); +jump() { 3593() }; +branch_align() -> (); +enum_init>, 1>([14]) -> ([20]); +store_temp([12]) -> ([17]); +store_temp([13]) -> ([18]); +store_temp>>([20]) -> ([19]); +rename>>([19]) -> ([22]); +function_call::unwrap_syscall>([22]) -> ([21]); +enum_match>([21]) { fallthrough([23]) 3604([24]) }; +branch_align() -> (); +struct_deconstruct>([23]) -> ([25]); +struct_construct>([8], [25]) -> ([26]); +enum_init, 0>([26]) -> ([27]); +store_temp([17]) -> ([28]); +store_temp([18]) -> ([29]); +store_temp>([27]) -> ([30]); +return([28], [29], [30]); +branch_align() -> (); +drop([8]) -> (); +enum_init, 1>([24]) -> ([31]); +store_temp([17]) -> ([32]); +store_temp([18]) -> ([33]); +store_temp>([31]) -> ([34]); +return([32], [33], [34]); +storage_base_address_const<603278275252936218847294002513349627170936020082667936993356353388973422646>() -> ([4]); +u32_const<0>() -> ([5]); +store_temp([0]) -> ([9]); +store_temp([1]) -> ([10]); +store_temp([5]) -> ([11]); +store_temp([4]) -> ([12]); +store_temp([3]) -> ([13]); +function_call([9], [10], [11], [12], [13]) -> ([6], [7], [8]); +rename>>([8]) -> ([15]); +function_call::unwrap_syscall>([15]) -> ([14]); +enum_match>([14]) { fallthrough([16]) 3632([17]) }; +branch_align() -> (); +snapshot_take([2]) -> ([18], [19]); +drop([19]) -> (); +struct_deconstruct>([16]) -> ([20]); +struct_construct>([18], [20]) -> ([21]); +enum_init, 0>([21]) -> ([22]); +store_temp([6]) -> ([23]); +store_temp([7]) -> ([24]); +store_temp>([22]) -> ([25]); +return([23], [24], [25]); +branch_align() -> (); +drop([2]) -> (); +enum_init, 1>([17]) -> ([26]); +store_temp([6]) -> ([27]); +store_temp([7]) -> ([28]); +store_temp>([26]) -> ([29]); +return([27], [28], [29]); +snapshot_take([4]) -> ([7], [8]); +store_temp([0]) -> ([12]); +store_temp([2]) -> ([13]); +store_temp([8]) -> ([14]); +store_temp([5]) -> ([15]); +function_call([12], [13], [14], [15]) -> ([9], [10], [11]); +u32_const<0>() -> ([16]); +store_temp([1]) -> ([20]); +store_temp([3]) -> ([21]); +store_temp([16]) -> ([22]); +store_temp([11]) -> ([23]); +store_temp([6]) -> ([24]); +function_call([20], [21], [22], [23], [24]) -> ([17], [18], [19]); +rename>>([19]) -> ([26]); +function_call::unwrap_syscall>([26]) -> ([25]); +enum_match>([25]) { fallthrough([27]) 3665([28]) }; +branch_align() -> (); +struct_deconstruct>([27]) -> ([29]); +struct_construct>([7], [29]) -> ([30]); +enum_init, 0>([30]) -> ([31]); +store_temp([9]) -> ([32]); +store_temp([17]) -> ([33]); +store_temp([10]) -> ([34]); +store_temp([18]) -> ([35]); +store_temp>([31]) -> ([36]); +return([32], [33], [34], [35], [36]); +branch_align() -> (); +drop([7]) -> (); +enum_init, 1>([28]) -> ([37]); +store_temp([9]) -> ([38]); +store_temp([17]) -> ([39]); +store_temp([10]) -> ([40]); +store_temp([18]) -> ([41]); +store_temp>([37]) -> ([42]); +return([38], [39], [40], [41], [42]); +store_temp([3]) -> ([5]); +function_call::into>([5]) -> ([4]); +array_new() -> ([6]); +array_new() -> ([7]); +snapshot_take([4]) -> ([8], [9]); +drop([8]) -> (); +store_temp([9]) -> ([13]); +store_temp>([6]) -> ([14]); +store_temp>([7]) -> ([15]); +function_call([13], [14], [15]) -> ([10], [11], [12]); +drop([12]) -> (); +snapshot_take>([10]) -> ([16], [17]); +drop>([16]) -> (); +struct_construct>([17]) -> ([18]); +snapshot_take>([11]) -> ([19], [20]); +drop>([19]) -> (); +struct_construct>([20]) -> ([21]); +store_temp>([18]) -> ([18]); +store_temp>([21]) -> ([21]); +emit_event_syscall([0], [1], [18], [21]) { fallthrough([22], [23]) 3701([24], [25], [26]) }; +branch_align() -> (); +struct_construct() -> ([27]); +enum_init>, 0>([27]) -> ([28]); +store_temp([22]) -> ([29]); +store_temp([23]) -> ([30]); +store_temp>>([28]) -> ([31]); +jump() { 3706() }; +branch_align() -> (); +enum_init>, 1>([26]) -> ([32]); +store_temp([24]) -> ([29]); +store_temp([25]) -> ([30]); +store_temp>>([32]) -> ([31]); +rename>>([31]) -> ([34]); +function_call::unwrap_syscall>([34]) -> ([33]); +enum_match>([33]) { fallthrough([35]) 3717([36]) }; +branch_align() -> (); +struct_deconstruct>([35]) -> ([37]); +struct_construct>([2], [37]) -> ([38]); +enum_init, 0>([38]) -> ([39]); +store_temp([29]) -> ([40]); +store_temp([30]) -> ([41]); +store_temp>([39]) -> ([42]); +return([40], [41], [42]); +branch_align() -> (); +drop([2]) -> (); +enum_init, 1>([36]) -> ([43]); +store_temp([29]) -> ([44]); +store_temp([30]) -> ([45]); +store_temp>([43]) -> ([46]); +return([44], [45], [46]); +enum_match>>([0]) { fallthrough([1]) 3730([2]) }; +branch_align() -> (); +struct_construct>([1]) -> ([3]); +enum_init, 0>([3]) -> ([4]); +store_temp>([4]) -> ([5]); +return([5]); +branch_align() -> (); +struct_construct() -> ([6]); +struct_construct>>([6], [2]) -> ([7]); +enum_init, 1>([7]) -> ([8]); +store_temp>([8]) -> ([9]); +return([9]); +storage_address_from_base([4]) -> ([5]); +storage_read_syscall([1], [2], [3], [5]) { fallthrough([6], [7], [8]) 3768([9], [10], [11]) }; +branch_align() -> (); +store_temp([0]) -> ([14]); +store_temp([8]) -> ([15]); +function_call([14], [15]) -> ([12], [13]); +store_temp([6]) -> ([6]); +store_temp([7]) -> ([7]); +enum_match>([13]) { fallthrough([16]) 3754([17]) }; +branch_align() -> (); +enum_init>, 0>([16]) -> ([18]); +struct_construct>>>([18]) -> ([19]); +enum_init>,)>, 0>([19]) -> ([20]); +store_temp([12]) -> ([21]); +store_temp([6]) -> ([22]); +store_temp([7]) -> ([23]); +store_temp>,)>>([20]) -> ([24]); +return([21], [22], [23], [24]); +branch_align() -> (); +drop([17]) -> (); +array_new() -> ([25]); +felt252_const<110930490496575599150170734222081291576>() -> ([26]); +store_temp([26]) -> ([26]); +array_append([25], [26]) -> ([27]); +struct_construct() -> ([28]); +struct_construct>>([28], [27]) -> ([29]); +enum_init>,)>, 1>([29]) -> ([30]); +store_temp([12]) -> ([31]); +store_temp([6]) -> ([32]); +store_temp([7]) -> ([33]); +store_temp>,)>>([30]) -> ([34]); +return([31], [32], [33], [34]); +branch_align() -> (); +enum_init>, 1>([11]) -> ([35]); +struct_construct>>>([35]) -> ([36]); +enum_init>,)>, 0>([36]) -> ([37]); +store_temp([0]) -> ([38]); +store_temp([9]) -> ([39]); +store_temp([10]) -> ([40]); +store_temp>,)>>([37]) -> ([41]); +return([38], [39], [40], [41]); +enum_match>>([0]) { fallthrough([1]) 3783([2]) }; +branch_align() -> (); +struct_construct>([1]) -> ([3]); +enum_init, 0>([3]) -> ([4]); +store_temp>([4]) -> ([5]); +return([5]); +branch_align() -> (); +struct_construct() -> ([6]); +struct_construct>>([6], [2]) -> ([7]); +enum_init, 1>([7]) -> ([8]); +store_temp>([8]) -> ([9]); +return([9]); +store_temp([0]) -> ([9]); +store_temp([1]) -> ([10]); +store_temp([2]) -> ([11]); +dup([3]) -> ([3], [12]); +store_temp([12]) -> ([12]); +dup([4]) -> ([4], [13]); +store_temp([13]) -> ([13]); +function_call([9], [10], [11], [12], [13]) -> ([5], [6], [7], [8]); +enum_match>,)>>([8]) { fallthrough([14]) 3859([15]) }; +branch_align() -> (); +struct_deconstruct>>>([14]) -> ([16]); +enum_match>>([16]) { fallthrough([17]) 3848([18]) }; +branch_align() -> (); +u8_const<1>() -> ([19]); +storage_address_from_base_and_offset([4], [19]) -> ([20]); +store_temp([20]) -> ([20]); +storage_read_syscall([6], [7], [3], [20]) { fallthrough([21], [22], [23]) 3838([24], [25], [26]) }; +branch_align() -> (); +store_temp([5]) -> ([29]); +store_temp([23]) -> ([30]); +function_call([29], [30]) -> ([27], [28]); +store_temp([21]) -> ([21]); +store_temp([22]) -> ([22]); +enum_match>([28]) { fallthrough([31]) 3823([32]) }; +branch_align() -> (); +struct_construct([17], [31]) -> ([33]); +enum_init>, 0>([33]) -> ([34]); +struct_construct>>>([34]) -> ([35]); +enum_init>,)>, 0>([35]) -> ([36]); +store_temp([27]) -> ([37]); +store_temp([21]) -> ([38]); +store_temp([22]) -> ([39]); +store_temp>,)>>([36]) -> ([40]); +return([37], [38], [39], [40]); +branch_align() -> (); +drop([32]) -> (); +drop([17]) -> (); +array_new() -> ([41]); +felt252_const<476442828812030857794232422692155113556837216824>() -> ([42]); +store_temp([42]) -> ([42]); +array_append([41], [42]) -> ([43]); +struct_construct() -> ([44]); +struct_construct>>([44], [43]) -> ([45]); +enum_init>,)>, 1>([45]) -> ([46]); +store_temp([27]) -> ([47]); +store_temp([21]) -> ([48]); +store_temp([22]) -> ([49]); +store_temp>,)>>([46]) -> ([50]); +return([47], [48], [49], [50]); +branch_align() -> (); +drop([17]) -> (); +enum_init>, 1>([26]) -> ([51]); +struct_construct>>>([51]) -> ([52]); +enum_init>,)>, 0>([52]) -> ([53]); +store_temp([5]) -> ([54]); +store_temp([24]) -> ([55]); +store_temp([25]) -> ([56]); +store_temp>,)>>([53]) -> ([57]); +return([54], [55], [56], [57]); +branch_align() -> (); +drop([4]) -> (); +drop([3]) -> (); +enum_init>, 1>([18]) -> ([58]); +struct_construct>>>([58]) -> ([59]); +enum_init>,)>, 0>([59]) -> ([60]); +store_temp([5]) -> ([61]); +store_temp([6]) -> ([62]); +store_temp([7]) -> ([63]); +store_temp>,)>>([60]) -> ([64]); +return([61], [62], [63], [64]); +branch_align() -> (); +drop([4]) -> (); +drop([3]) -> (); +enum_init>,)>, 1>([15]) -> ([65]); +store_temp([5]) -> ([66]); +store_temp([6]) -> ([67]); +store_temp([7]) -> ([68]); +store_temp>,)>>([65]) -> ([69]); +return([66], [67], [68], [69]); +enum_match>>([0]) { fallthrough([1]) 3874([2]) }; +branch_align() -> (); +struct_construct>([1]) -> ([3]); +enum_init, 0>([3]) -> ([4]); +store_temp>([4]) -> ([5]); +return([5]); +branch_align() -> (); +struct_construct() -> ([6]); +struct_construct>>([6], [2]) -> ([7]); +enum_init, 1>([7]) -> ([8]); +store_temp>([8]) -> ([9]); +return([9]); +drop([2]) -> (); +felt252_const<1065622543624526936256554561967983185612257046533136611876836524258158810564>() -> ([4]); +store_temp([1]) -> ([7]); +store_temp([4]) -> ([8]); +store_temp([3]) -> ([9]); +function_call([7], [8], [9]) -> ([5], [6]); +storage_base_address_from_felt252([0], [6]) -> ([10], [11]); +store_temp([10]) -> ([12]); +store_temp([5]) -> ([13]); +store_temp([11]) -> ([14]); +return([12], [13], [14]); +drop([2]) -> (); +felt252_const<337994139936370667767799129369552596157394447336989834104582481799883947719>() -> ([4]); +store_temp([1]) -> ([7]); +store_temp([4]) -> ([8]); +store_temp>([3]) -> ([9]); +function_call::hash>([7], [8], [9]) -> ([5], [6]); +storage_base_address_from_felt252([0], [6]) -> ([10], [11]); +store_temp([10]) -> ([12]); +store_temp([5]) -> ([13]); +store_temp([11]) -> ([14]); +return([12], [13], [14]); +u128s_from_felt252([0], [1]) { fallthrough([2], [3]) 3908([4], [5], [6]) }; +branch_align() -> (); +enum_init, 0>([3]) -> ([7]); +store_temp([2]) -> ([8]); +store_temp>([7]) -> ([9]); +jump() { 3915() }; +branch_align() -> (); +drop([5]) -> (); +drop([6]) -> (); +struct_construct() -> ([10]); +enum_init, 1>([10]) -> ([11]); +store_temp([4]) -> ([8]); +store_temp>([11]) -> ([9]); +rename([8]) -> ([12]); +rename>([9]) -> ([13]); +return([12], [13]); +get_execution_info_syscall([0], [1]) { fallthrough([2], [3], [4]) 3925([5], [6], [7]) }; +branch_align() -> (); +enum_init, core::array::Array::>, 0>([4]) -> ([8]); +store_temp([2]) -> ([9]); +store_temp([3]) -> ([10]); +store_temp, core::array::Array::>>([8]) -> ([11]); +jump() { 3930() }; +branch_align() -> (); +enum_init, core::array::Array::>, 1>([7]) -> ([12]); +store_temp([5]) -> ([9]); +store_temp([6]) -> ([10]); +store_temp, core::array::Array::>>([12]) -> ([11]); +rename, core::array::Array::>>([11]) -> ([14]); +function_call>::unwrap_syscall>([14]) -> ([13]); +enum_match,)>>([13]) { fallthrough([15]) 3941([16]) }; +branch_align() -> (); +struct_deconstruct>>([15]) -> ([17]); +struct_construct>>([17]) -> ([18]); +enum_init,)>, 0>([18]) -> ([19]); +store_temp([9]) -> ([20]); +store_temp([10]) -> ([21]); +store_temp,)>>([19]) -> ([22]); +return([20], [21], [22]); +branch_align() -> (); +enum_init,)>, 1>([16]) -> ([23]); +store_temp([9]) -> ([24]); +store_temp([10]) -> ([25]); +store_temp,)>>([23]) -> ([26]); +return([24], [25], [26]); +store_temp([3]) -> ([5]); +function_call([5]) -> ([4]); +array_new() -> ([6]); +array_new() -> ([7]); +snapshot_take([4]) -> ([8], [9]); +drop([8]) -> (); +store_temp([9]) -> ([13]); +store_temp>([6]) -> ([14]); +store_temp>([7]) -> ([15]); +function_call([13], [14], [15]) -> ([10], [11], [12]); +drop([12]) -> (); +snapshot_take>([10]) -> ([16], [17]); +drop>([16]) -> (); +struct_construct>([17]) -> ([18]); +snapshot_take>([11]) -> ([19], [20]); +drop>([19]) -> (); +struct_construct>([20]) -> ([21]); +store_temp>([18]) -> ([18]); +store_temp>([21]) -> ([21]); +emit_event_syscall([0], [1], [18], [21]) { fallthrough([22], [23]) 3974([24], [25], [26]) }; +branch_align() -> (); +struct_construct() -> ([27]); +enum_init>, 0>([27]) -> ([28]); +store_temp([22]) -> ([29]); +store_temp([23]) -> ([30]); +store_temp>>([28]) -> ([31]); +jump() { 3979() }; +branch_align() -> (); +enum_init>, 1>([26]) -> ([32]); +store_temp([24]) -> ([29]); +store_temp([25]) -> ([30]); +store_temp>>([32]) -> ([31]); +rename>>([31]) -> ([34]); +function_call::unwrap_syscall>([34]) -> ([33]); +enum_match>([33]) { fallthrough([35]) 3990([36]) }; +branch_align() -> (); +struct_deconstruct>([35]) -> ([37]); +struct_construct>([2], [37]) -> ([38]); +enum_init, 0>([38]) -> ([39]); +store_temp([29]) -> ([40]); +store_temp([30]) -> ([41]); +store_temp>([39]) -> ([42]); +return([40], [41], [42]); +branch_align() -> (); +drop([2]) -> (); +enum_init, 1>([36]) -> ([43]); +store_temp([29]) -> ([44]); +store_temp([30]) -> ([45]); +store_temp>([43]) -> ([46]); +return([44], [45], [46]); +snapshot_take([4]) -> ([7], [8]); +store_temp([0]) -> ([12]); +store_temp([2]) -> ([13]); +store_temp([8]) -> ([14]); +store_temp>([5]) -> ([15]); +function_call([12], [13], [14], [15]) -> ([9], [10], [11]); +u32_const<0>() -> ([16]); +store_temp([1]) -> ([20]); +store_temp([3]) -> ([21]); +store_temp([16]) -> ([22]); +store_temp([11]) -> ([23]); +store_temp([6]) -> ([24]); +function_call([20], [21], [22], [23], [24]) -> ([17], [18], [19]); +rename>>([19]) -> ([26]); +function_call::unwrap_syscall>([26]) -> ([25]); +enum_match>([25]) { fallthrough([27]) 4023([28]) }; +branch_align() -> (); +struct_deconstruct>([27]) -> ([29]); +struct_construct>([7], [29]) -> ([30]); +enum_init, 0>([30]) -> ([31]); +store_temp([9]) -> ([32]); +store_temp([17]) -> ([33]); +store_temp([10]) -> ([34]); +store_temp([18]) -> ([35]); +store_temp>([31]) -> ([36]); +return([32], [33], [34], [35], [36]); +branch_align() -> (); +drop([7]) -> (); +enum_init, 1>([28]) -> ([37]); +store_temp([9]) -> ([38]); +store_temp([17]) -> ([39]); +store_temp([10]) -> ([40]); +store_temp([18]) -> ([41]); +store_temp>([37]) -> ([42]); +return([38], [39], [40], [41], [42]); +store_temp([3]) -> ([5]); +function_call([5]) -> ([4]); +array_new() -> ([6]); +array_new() -> ([7]); +snapshot_take([4]) -> ([8], [9]); +drop([8]) -> (); +store_temp([9]) -> ([13]); +store_temp>([6]) -> ([14]); +store_temp>([7]) -> ([15]); +function_call([13], [14], [15]) -> ([10], [11], [12]); +drop([12]) -> (); +snapshot_take>([10]) -> ([16], [17]); +drop>([16]) -> (); +struct_construct>([17]) -> ([18]); +snapshot_take>([11]) -> ([19], [20]); +drop>([19]) -> (); +struct_construct>([20]) -> ([21]); +store_temp>([18]) -> ([18]); +store_temp>([21]) -> ([21]); +emit_event_syscall([0], [1], [18], [21]) { fallthrough([22], [23]) 4059([24], [25], [26]) }; +branch_align() -> (); +struct_construct() -> ([27]); +enum_init>, 0>([27]) -> ([28]); +store_temp([22]) -> ([29]); +store_temp([23]) -> ([30]); +store_temp>>([28]) -> ([31]); +jump() { 4064() }; +branch_align() -> (); +enum_init>, 1>([26]) -> ([32]); +store_temp([24]) -> ([29]); +store_temp([25]) -> ([30]); +store_temp>>([32]) -> ([31]); +rename>>([31]) -> ([34]); +function_call::unwrap_syscall>([34]) -> ([33]); +enum_match>([33]) { fallthrough([35]) 4075([36]) }; +branch_align() -> (); +struct_deconstruct>([35]) -> ([37]); +struct_construct>([2], [37]) -> ([38]); +enum_init, 0>([38]) -> ([39]); +store_temp([29]) -> ([40]); +store_temp([30]) -> ([41]); +store_temp>([39]) -> ([42]); +return([40], [41], [42]); +branch_align() -> (); +drop([2]) -> (); +enum_init, 1>([36]) -> ([43]); +store_temp([29]) -> ([44]); +store_temp([30]) -> ([45]); +store_temp>([43]) -> ([46]); +return([44], [45], [46]); +store_temp([0]) -> ([5]); +store_temp([1]) -> ([6]); +store_temp([2]) -> ([7]); +function_call([5], [6], [7]) -> ([3], [4]); +struct_deconstruct>([4]) -> ([8], [9]); +enum_match([9]) { fallthrough([10]) 4093([11]) }; +branch_align() -> (); +drop([10]) -> (); +enum_init, 0>([8]) -> ([12]); +store_temp>([12]) -> ([13]); +jump() { 4099() }; +branch_align() -> (); +drop([11]) -> (); +drop([8]) -> (); +struct_construct() -> ([14]); +enum_init, 1>([14]) -> ([15]); +store_temp>([15]) -> ([13]); +store_temp([3]) -> ([16]); +store_temp>([13]) -> ([17]); +return([16], [17]); +store_temp([0]) -> ([5]); +store_temp([1]) -> ([6]); +store_temp([2]) -> ([7]); +function_call([5], [6], [7]) -> ([3], [4]); +struct_deconstruct>([4]) -> ([8], [9]); +enum_match([9]) { fallthrough([10]) 4113([11]) }; +branch_align() -> (); +drop([10]) -> (); +enum_init, 0>([8]) -> ([12]); +store_temp>([12]) -> ([13]); +jump() { 4119() }; +branch_align() -> (); +drop([11]) -> (); +drop([8]) -> (); +struct_construct() -> ([14]); +enum_init, 1>([14]) -> ([15]); +store_temp>([15]) -> ([13]); +store_temp([3]) -> ([16]); +store_temp>([13]) -> ([17]); +return([16], [17]); +enum_match>>([0]) { fallthrough([1]) 4128([2]) }; +branch_align() -> (); +struct_construct>([1]) -> ([3]); +enum_init, 0>([3]) -> ([4]); +store_temp>([4]) -> ([5]); +return([5]); +branch_align() -> (); +struct_construct() -> ([6]); +struct_construct>>([6], [2]) -> ([7]); +enum_init, 1>([7]) -> ([8]); +store_temp>([8]) -> ([9]); +return([9]); +struct_deconstruct([4]) -> ([5], [6]); +u128_to_felt252([5]) -> ([7]); +dup([3]) -> ([3], [9]); +storage_address_from_base([9]) -> ([8]); +dup([2]) -> ([2], [10]); +storage_write_syscall([0], [1], [10], [8], [7]) { fallthrough([11], [12]) 4160([13], [14], [15]) }; +branch_align() -> (); +u128_to_felt252([6]) -> ([16]); +u8_const<1>() -> ([17]); +storage_address_from_base_and_offset([3], [17]) -> ([18]); +store_temp([11]) -> ([11]); +store_temp([18]) -> ([18]); +storage_write_syscall([11], [12], [2], [18], [16]) { fallthrough([19], [20]) 4154([21], [22], [23]) }; +branch_align() -> (); +struct_construct() -> ([24]); +enum_init>, 0>([24]) -> ([25]); +store_temp([19]) -> ([26]); +store_temp([20]) -> ([27]); +store_temp>>([25]) -> ([28]); +return([26], [27], [28]); +branch_align() -> (); +enum_init>, 1>([23]) -> ([29]); +store_temp([21]) -> ([30]); +store_temp([22]) -> ([31]); +store_temp>>([29]) -> ([32]); +return([30], [31], [32]); +branch_align() -> (); +drop([3]) -> (); +drop([6]) -> (); +drop([2]) -> (); +enum_init>, 1>([15]) -> ([33]); +store_temp([13]) -> ([34]); +store_temp([14]) -> ([35]); +store_temp>>([33]) -> ([36]); +return([34], [35], [36]); +store_temp([0]) -> ([1]); +return([1]); +enum_match([0]) { fallthrough([3]) 4184([4]) }; +branch_align() -> (); +felt252_const<271746229759260285552388728919865295615886751538523744128730118297934206697>() -> ([5]); +store_temp([5]) -> ([5]); +array_append([1], [5]) -> ([6]); +store_temp([3]) -> ([10]); +store_temp>([6]) -> ([11]); +store_temp>([2]) -> ([12]); +function_call([10], [11], [12]) -> ([7], [8], [9]); +drop([9]) -> (); +store_temp>([7]) -> ([13]); +store_temp>([8]) -> ([14]); +jump() { 4195() }; +branch_align() -> (); +felt252_const<544914742286571513055574265148471203182105283038408585630116262969508767999>() -> ([15]); +store_temp([15]) -> ([15]); +array_append([1], [15]) -> ([16]); +store_temp([4]) -> ([20]); +store_temp>([16]) -> ([21]); +store_temp>([2]) -> ([22]); +function_call([20], [21], [22]) -> ([17], [18], [19]); +drop([19]) -> (); +store_temp>([17]) -> ([13]); +store_temp>([18]) -> ([14]); +struct_construct() -> ([23]); +rename>([13]) -> ([24]); +rename>([14]) -> ([25]); +store_temp([23]) -> ([26]); +return([24], [25], [26]); +storage_address_from_base([4]) -> ([5]); +storage_read_syscall([1], [2], [3], [5]) { fallthrough([6], [7], [8]) 4232([9], [10], [11]) }; +branch_align() -> (); +store_temp([0]) -> ([14]); +store_temp([8]) -> ([15]); +function_call([14], [15]) -> ([12], [13]); +store_temp([6]) -> ([6]); +store_temp([7]) -> ([7]); +enum_match>([13]) { fallthrough([16]) 4218([17]) }; +branch_align() -> (); +enum_init>, 0>([16]) -> ([18]); +struct_construct>>>([18]) -> ([19]); +enum_init>,)>, 0>([19]) -> ([20]); +store_temp([12]) -> ([21]); +store_temp([6]) -> ([22]); +store_temp([7]) -> ([23]); +store_temp>,)>>([20]) -> ([24]); +return([21], [22], [23], [24]); +branch_align() -> (); +drop([17]) -> (); +array_new() -> ([25]); +felt252_const<476442828812030857794232422692155113556837216824>() -> ([26]); +store_temp([26]) -> ([26]); +array_append([25], [26]) -> ([27]); +struct_construct() -> ([28]); +struct_construct>>([28], [27]) -> ([29]); +enum_init>,)>, 1>([29]) -> ([30]); +store_temp([12]) -> ([31]); +store_temp([6]) -> ([32]); +store_temp([7]) -> ([33]); +store_temp>,)>>([30]) -> ([34]); +return([31], [32], [33], [34]); +branch_align() -> (); +enum_init>, 1>([11]) -> ([35]); +struct_construct>>>([35]) -> ([36]); +enum_init>,)>, 0>([36]) -> ([37]); +store_temp([0]) -> ([38]); +store_temp([9]) -> ([39]); +store_temp([10]) -> ([40]); +store_temp>,)>>([37]) -> ([41]); +return([38], [39], [40], [41]); +contract_address_to_felt252([2]) -> ([3]); +pedersen([0], [1], [3]) -> ([4], [5]); +store_temp([4]) -> ([6]); +store_temp([5]) -> ([7]); +return([6], [7]); +struct_deconstruct>([2]) -> ([3], [4]); +store_temp([0]) -> ([7]); +store_temp([1]) -> ([8]); +store_temp([3]) -> ([9]); +function_call([7], [8], [9]) -> ([5], [6]); +rename([5]) -> ([12]); +rename([6]) -> ([13]); +store_temp([4]) -> ([14]); +function_call([12], [13], [14]) -> ([10], [11]); +rename([10]) -> ([15]); +rename([11]) -> ([16]); +return([15], [16]); +enum_match, core::array::Array::>>([0]) { fallthrough([1]) 4264([2]) }; +branch_align() -> (); +struct_construct>>([1]) -> ([3]); +enum_init,)>, 0>([3]) -> ([4]); +store_temp,)>>([4]) -> ([5]); +return([5]); +branch_align() -> (); +struct_construct() -> ([6]); +struct_construct>>([6], [2]) -> ([7]); +enum_init,)>, 1>([7]) -> ([8]); +store_temp,)>>([8]) -> ([9]); +return([9]); +enum_init([0]) -> ([1]); +store_temp([1]) -> ([2]); +return([2]); +enum_init([0]) -> ([1]); +store_temp([1]) -> ([2]); +return([2]); +struct_deconstruct([1]) -> ([3], [4]); +struct_deconstruct([2]) -> ([5], [6]); +u128_overflowing_add([0], [4], [6]) { fallthrough([7], [8]) 4286([9], [10]) }; +branch_align() -> (); +struct_construct() -> ([11]); +enum_init([11]) -> ([12]); +struct_construct>([8], [12]) -> ([13]); +store_temp([7]) -> ([14]); +store_temp>([13]) -> ([15]); +jump() { 4292() }; +branch_align() -> (); +struct_construct() -> ([16]); +enum_init([16]) -> ([17]); +struct_construct>([10], [17]) -> ([18]); +store_temp([9]) -> ([14]); +store_temp>([18]) -> ([15]); +struct_deconstruct>([15]) -> ([19], [20]); +u128_overflowing_add([14], [3], [5]) { fallthrough([21], [22]) 4300([23], [24]) }; +branch_align() -> (); +struct_construct([22], [19]) -> ([25]); +struct_construct>([25], [20]) -> ([26]); +store_temp([21]) -> ([27]); +store_temp>([26]) -> ([28]); +jump() { 4320() }; +branch_align() -> (); +u128_const<1>() -> ([29]); +store_temp([29]) -> ([29]); +u128_overflowing_add([23], [19], [29]) { fallthrough([30], [31]) 4310([32], [33]) }; +branch_align() -> (); +struct_construct([24], [31]) -> ([34]); +struct_construct>([34], [20]) -> ([35]); +store_temp([30]) -> ([36]); +store_temp>([35]) -> ([37]); +jump() { 4318() }; +branch_align() -> (); +drop([20]) -> (); +struct_construct([24], [33]) -> ([38]); +struct_construct() -> ([39]); +enum_init([39]) -> ([40]); +struct_construct>([38], [40]) -> ([41]); +store_temp([32]) -> ([36]); +store_temp>([41]) -> ([37]); +rename([36]) -> ([27]); +rename>([37]) -> ([28]); +rename([27]) -> ([42]); +rename>([28]) -> ([43]); +return([42], [43]); +struct_deconstruct([1]) -> ([3], [4]); +struct_deconstruct([2]) -> ([5], [6]); +u128_overflowing_sub([0], [4], [6]) { fallthrough([7], [8]) 4333([9], [10]) }; +branch_align() -> (); +struct_construct() -> ([11]); +enum_init([11]) -> ([12]); +struct_construct>([8], [12]) -> ([13]); +store_temp([7]) -> ([14]); +store_temp>([13]) -> ([15]); +jump() { 4339() }; +branch_align() -> (); +struct_construct() -> ([16]); +enum_init([16]) -> ([17]); +struct_construct>([10], [17]) -> ([18]); +store_temp([9]) -> ([14]); +store_temp>([18]) -> ([15]); +struct_deconstruct>([15]) -> ([19], [20]); +u128_overflowing_sub([14], [3], [5]) { fallthrough([21], [22]) 4347([23], [24]) }; +branch_align() -> (); +struct_construct([22], [19]) -> ([25]); +struct_construct>([25], [20]) -> ([26]); +store_temp([21]) -> ([27]); +store_temp>([26]) -> ([28]); +jump() { 4367() }; +branch_align() -> (); +u128_const<1>() -> ([29]); +store_temp([29]) -> ([29]); +u128_overflowing_sub([23], [19], [29]) { fallthrough([30], [31]) 4357([32], [33]) }; +branch_align() -> (); +struct_construct([24], [31]) -> ([34]); +struct_construct>([34], [20]) -> ([35]); +store_temp([30]) -> ([36]); +store_temp>([35]) -> ([37]); +jump() { 4365() }; +branch_align() -> (); +drop([20]) -> (); +struct_construct([24], [33]) -> ([38]); +struct_construct() -> ([39]); +enum_init([39]) -> ([40]); +struct_construct>([38], [40]) -> ([41]); +store_temp([32]) -> ([36]); +store_temp>([41]) -> ([37]); +rename([36]) -> ([27]); +rename>([37]) -> ([28]); +rename([27]) -> ([42]); +rename>([28]) -> ([43]); +return([42], [43]); +dup([0]) -> ([0], [3]); +struct_deconstruct([3]) -> ([4], [5], [6]); +drop([5]) -> (); +drop([6]) -> (); +store_temp([4]) -> ([9]); +store_temp>([2]) -> ([10]); +function_call([9], [10]) -> ([7], [8]); +drop([8]) -> (); +dup([0]) -> ([0], [11]); +struct_deconstruct([11]) -> ([12], [13], [14]); +drop([12]) -> (); +drop([14]) -> (); +store_temp([13]) -> ([17]); +store_temp>([7]) -> ([18]); +function_call([17], [18]) -> ([15], [16]); +drop([16]) -> (); +struct_deconstruct([0]) -> ([19], [20], [21]); +drop([19]) -> (); +drop([20]) -> (); +store_temp([21]) -> ([24]); +store_temp>([15]) -> ([25]); +function_call([24], [25]) -> ([22], [23]); +drop([23]) -> (); +struct_construct() -> ([26]); +store_temp>([1]) -> ([27]); +store_temp>([22]) -> ([28]); +store_temp([26]) -> ([29]); +return([27], [28], [29]); +dup([0]) -> ([0], [3]); +struct_deconstruct([3]) -> ([4], [5], [6]); +drop([5]) -> (); +drop([6]) -> (); +store_temp([4]) -> ([9]); +store_temp>([2]) -> ([10]); +function_call([9], [10]) -> ([7], [8]); +drop([8]) -> (); +dup([0]) -> ([0], [11]); +struct_deconstruct([11]) -> ([12], [13], [14]); +drop([12]) -> (); +drop([14]) -> (); +store_temp([13]) -> ([17]); +store_temp>([7]) -> ([18]); +function_call([17], [18]) -> ([15], [16]); +drop([16]) -> (); +struct_deconstruct([0]) -> ([19], [20], [21]); +drop([19]) -> (); +drop([20]) -> (); +store_temp([21]) -> ([24]); +store_temp>([15]) -> ([25]); +function_call([24], [25]) -> ([22], [23]); +drop([23]) -> (); +struct_construct() -> ([26]); +store_temp>([1]) -> ([27]); +store_temp>([22]) -> ([28]); +store_temp([26]) -> ([29]); +return([27], [28], [29]); +rename([0]) -> ([2]); +contract_address_to_felt252([2]) -> ([3]); +snapshot_take([3]) -> ([4], [5]); +drop([4]) -> (); +store_temp([5]) -> ([8]); +store_temp>([1]) -> ([9]); +function_call([8], [9]) -> ([6], [7]); +drop([7]) -> (); +struct_construct() -> ([10]); +store_temp>([6]) -> ([11]); +store_temp([10]) -> ([12]); +return([11], [12]); + +erc20::erc20::erc_20::__external::get_name@0([0]: RangeCheck, [1]: GasBuiltin, [2]: System, [3]: core::array::Span::) -> (RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::array::Span::,)>); +erc20::erc20::erc_20::__external::get_symbol@101([0]: RangeCheck, [1]: GasBuiltin, [2]: System, [3]: core::array::Span::) -> (RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::array::Span::,)>); +erc20::erc20::erc_20::__external::get_decimals@202([0]: RangeCheck, [1]: GasBuiltin, [2]: System, [3]: core::array::Span::) -> (RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::array::Span::,)>); +erc20::erc20::erc_20::__external::get_total_supply@303([0]: RangeCheck, [1]: GasBuiltin, [2]: System, [3]: core::array::Span::) -> (RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::array::Span::,)>); +erc20::erc20::erc_20::__external::balance_of@404([0]: Pedersen, [1]: RangeCheck, [2]: GasBuiltin, [3]: System, [4]: core::array::Span::) -> (Pedersen, RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::array::Span::,)>); +erc20::erc20::erc_20::__external::allowance@534([0]: Pedersen, [1]: RangeCheck, [2]: GasBuiltin, [3]: System, [4]: core::array::Span::) -> (Pedersen, RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::array::Span::,)>); +erc20::erc20::erc_20::__external::transfer@689([0]: Pedersen, [1]: RangeCheck, [2]: GasBuiltin, [3]: System, [4]: core::array::Span::) -> (Pedersen, RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::array::Span::,)>); +erc20::erc20::erc_20::__external::transfer_from@836([0]: Pedersen, [1]: RangeCheck, [2]: GasBuiltin, [3]: System, [4]: core::array::Span::) -> (Pedersen, RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::array::Span::,)>); +erc20::erc20::erc_20::__external::approve@1009([0]: Pedersen, [1]: RangeCheck, [2]: GasBuiltin, [3]: System, [4]: core::array::Span::) -> (Pedersen, RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::array::Span::,)>); +erc20::erc20::erc_20::__external::increase_allowance@1156([0]: Pedersen, [1]: RangeCheck, [2]: GasBuiltin, [3]: System, [4]: core::array::Span::) -> (Pedersen, RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::array::Span::,)>); +erc20::erc20::erc_20::__external::decrease_allowance@1303([0]: Pedersen, [1]: RangeCheck, [2]: GasBuiltin, [3]: System, [4]: core::array::Span::) -> (Pedersen, RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::array::Span::,)>); +erc20::erc20::erc_20::__constructor::constructor@1450([0]: Pedersen, [1]: RangeCheck, [2]: GasBuiltin, [3]: System, [4]: core::array::Span::) -> (Pedersen, RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::array::Span::,)>); +erc20::erc20::erc_20::IERC20Impl::get_name@1677([0]: GasBuiltin, [1]: System, [2]: erc20::erc20::erc_20::ContractState) -> (GasBuiltin, System, core::panics::PanicResult::<(core::felt252,)>); +core::Felt252Serde::serialize@1702([0]: felt252, [1]: Array) -> (Array, Unit); +erc20::erc20::erc_20::IERC20Impl::get_symbol@1708([0]: GasBuiltin, [1]: System, [2]: erc20::erc20::erc_20::ContractState) -> (GasBuiltin, System, core::panics::PanicResult::<(core::felt252,)>); +erc20::erc20::erc_20::IERC20Impl::get_decimals@1733([0]: RangeCheck, [1]: GasBuiltin, [2]: System, [3]: erc20::erc20::erc_20::ContractState) -> (RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::integer::u8,)>); +core::integer::U8Serde::serialize@1761([0]: u8, [1]: Array) -> (Array, Unit); +erc20::erc20::erc_20::IERC20Impl::get_total_supply@1773([0]: RangeCheck, [1]: GasBuiltin, [2]: System, [3]: erc20::erc20::erc_20::ContractState) -> (RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::integer::u256,)>); +core::integer::u256Serde::serialize@1801([0]: core::integer::u256, [1]: Array) -> (Array, Unit); +core::starknet::contract_address::ContractAddressSerde::deserialize@1816([0]: RangeCheck, [1]: core::array::Span::) -> (RangeCheck, core::array::Span::, core::option::Option::); +erc20::erc20::erc_20::IERC20Impl::balance_of@1840([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::ContractState, [5]: ContractAddress) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(core::integer::u256,)>); +erc20::erc20::erc_20::IERC20Impl::allowance@1872([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::ContractState, [5]: ContractAddress, [6]: ContractAddress) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(core::integer::u256,)>); +core::integer::u256Serde::deserialize@1905([0]: RangeCheck, [1]: core::array::Span::) -> (RangeCheck, core::array::Span::, core::option::Option::); +erc20::erc20::erc_20::IERC20Impl::transfer@1934([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::ContractState, [5]: ContractAddress, [6]: core::integer::u256) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(erc20::erc20::erc_20::ContractState, ())>); +erc20::erc20::erc_20::IERC20Impl::transfer_from@1981([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::ContractState, [5]: ContractAddress, [6]: ContractAddress, [7]: core::integer::u256) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(erc20::erc20::erc_20::ContractState, ())>); +erc20::erc20::erc_20::IERC20Impl::approve@2055([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::ContractState, [5]: ContractAddress, [6]: core::integer::u256) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(erc20::erc20::erc_20::ContractState, ())>); +erc20::erc20::erc_20::IERC20Impl::increase_allowance@2102([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::ContractState, [5]: ContractAddress, [6]: core::integer::u256) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(erc20::erc20::erc_20::ContractState, ())>); +erc20::erc20::erc_20::IERC20Impl::decrease_allowance@2205([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::ContractState, [5]: ContractAddress, [6]: core::integer::u256) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(erc20::erc20::erc_20::ContractState, ())>); +core::Felt252Serde::deserialize@2308([0]: core::array::Span::) -> (core::array::Span::, core::option::Option::); +core::integer::U8Serde::deserialize@2337([0]: RangeCheck, [1]: core::array::Span::) -> (RangeCheck, core::array::Span::, core::option::Option::); +erc20::erc20::erc_20::constructor@2379([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::ContractState, [5]: felt252, [6]: felt252, [7]: u8, [8]: core::integer::u256, [9]: ContractAddress) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(erc20::erc20::erc_20::ContractState, ())>); +erc20::erc20::erc_20::name::InternalContractStateImpl::read@2589([0]: GasBuiltin, [1]: System, [2]: erc20::erc20::erc_20::name::ContractState) -> (GasBuiltin, System, core::panics::PanicResult::<(core::felt252,)>); +erc20::erc20::erc_20::symbol::InternalContractStateImpl::read@2624([0]: GasBuiltin, [1]: System, [2]: erc20::erc20::erc_20::symbol::ContractState) -> (GasBuiltin, System, core::panics::PanicResult::<(core::felt252,)>); +erc20::erc20::erc_20::decimals::InternalContractStateImpl::read@2659([0]: RangeCheck, [1]: GasBuiltin, [2]: System, [3]: erc20::erc20::erc_20::decimals::ContractState) -> (RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::integer::u8,)>); +erc20::erc20::erc_20::total_supply::InternalContractStateImpl::read@2697([0]: RangeCheck, [1]: GasBuiltin, [2]: System, [3]: erc20::erc20::erc_20::total_supply::ContractState) -> (RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::integer::u256,)>); +core::integer::U128Serde::serialize@2735([0]: u128, [1]: Array) -> (Array, Unit); +erc20::erc20::erc_20::balances::InternalContractStateImpl::read@2747([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::balances::ContractState, [5]: ContractAddress) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(core::integer::u256,)>); +erc20::erc20::erc_20::allowances::InternalContractStateImpl::read@2791([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::allowances::ContractState, [5]: Tuple) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(core::integer::u256,)>); +core::integer::U128Serde::deserialize@2835([0]: RangeCheck, [1]: core::array::Span::) -> (RangeCheck, core::array::Span::, core::option::Option::); +core::starknet::info::get_caller_address@2877([0]: GasBuiltin, [1]: System) -> (GasBuiltin, System, core::panics::PanicResult::<(core::starknet::contract_address::ContractAddress,)>); +erc20::erc20::erc_20::StorageImpl::transfer_helper@2901([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::ContractState, [5]: ContractAddress, [6]: ContractAddress, [7]: core::integer::u256) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(erc20::erc20::erc_20::ContractState, ())>); +erc20::erc20::erc_20::StorageImpl::spend_allowance@3188([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::ContractState, [5]: ContractAddress, [6]: ContractAddress, [7]: core::integer::u256) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(erc20::erc20::erc_20::ContractState, ())>); +erc20::erc20::erc_20::StorageImpl::approve_helper@3329([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::ContractState, [5]: ContractAddress, [6]: ContractAddress, [7]: core::integer::u256) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(erc20::erc20::erc_20::ContractState, ())>); +core::integer::U256Add::add@3436([0]: RangeCheck, [1]: core::integer::u256, [2]: core::integer::u256) -> (RangeCheck, core::panics::PanicResult::<(core::integer::u256,)>); +core::integer::U256Sub::sub@3459([0]: RangeCheck, [1]: core::integer::u256, [2]: core::integer::u256) -> (RangeCheck, core::panics::PanicResult::<(core::integer::u256,)>); +core::integer::Felt252TryIntoU8::try_into@3482([0]: RangeCheck, [1]: felt252) -> (RangeCheck, core::option::Option::); +erc20::erc20::erc_20::name::InternalContractStateImpl::write@3496([0]: GasBuiltin, [1]: System, [2]: erc20::erc20::erc_20::name::ContractState, [3]: felt252) -> (GasBuiltin, System, core::panics::PanicResult::<(erc20::erc20::erc_20::name::ContractState, ())>); +erc20::erc20::erc_20::symbol::InternalContractStateImpl::write@3534([0]: GasBuiltin, [1]: System, [2]: erc20::erc20::erc_20::symbol::ContractState, [3]: felt252) -> (GasBuiltin, System, core::panics::PanicResult::<(erc20::erc20::erc_20::symbol::ContractState, ())>); +erc20::erc20::erc_20::decimals::InternalContractStateImpl::write@3572([0]: GasBuiltin, [1]: System, [2]: erc20::erc20::erc_20::decimals::ContractState, [3]: u8) -> (GasBuiltin, System, core::panics::PanicResult::<(erc20::erc20::erc_20::decimals::ContractState, ())>); +erc20::erc20::erc_20::total_supply::InternalContractStateImpl::write@3611([0]: GasBuiltin, [1]: System, [2]: erc20::erc20::erc_20::total_supply::ContractState, [3]: core::integer::u256) -> (GasBuiltin, System, core::panics::PanicResult::<(erc20::erc20::erc_20::total_supply::ContractState, ())>); +erc20::erc20::erc_20::balances::InternalContractStateImpl::write@3639([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::balances::ContractState, [5]: ContractAddress, [6]: core::integer::u256) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(erc20::erc20::erc_20::balances::ContractState, ())>); +erc20::erc20::erc_20::ContractStateEventEmitter::emit::>@3674([0]: GasBuiltin, [1]: System, [2]: erc20::erc20::erc_20::ContractState, [3]: erc20::erc20::erc_20::Event) -> (GasBuiltin, System, core::panics::PanicResult::<(erc20::erc20::erc_20::ContractState, ())>); +core::starknet::SyscallResultTraitImpl::::unwrap_syscall@3724([0]: core::result::Result::>) -> (core::panics::PanicResult::<(core::felt252,)>); +core::starknet::storage_access::StoreU8::read@3736([0]: RangeCheck, [1]: GasBuiltin, [2]: System, [3]: u32, [4]: StorageBaseAddress) -> (RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::result::Result::>,)>); +core::starknet::SyscallResultTraitImpl::::unwrap_syscall@3777([0]: core::result::Result::>) -> (core::panics::PanicResult::<(core::integer::u8,)>); +core::integer::Storeu256::read@3789([0]: RangeCheck, [1]: GasBuiltin, [2]: System, [3]: u32, [4]: StorageBaseAddress) -> (RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::result::Result::>,)>); +core::starknet::SyscallResultTraitImpl::::unwrap_syscall@3868([0]: core::result::Result::>) -> (core::panics::PanicResult::<(core::integer::u256,)>); +erc20::erc20::erc_20::balances::InternalContractStateImpl::address@3880([0]: RangeCheck, [1]: Pedersen, [2]: erc20::erc20::erc_20::balances::ContractState, [3]: ContractAddress) -> (RangeCheck, Pedersen, StorageBaseAddress); +erc20::erc20::erc_20::allowances::InternalContractStateImpl::address@3891([0]: RangeCheck, [1]: Pedersen, [2]: erc20::erc20::erc_20::allowances::ContractState, [3]: Tuple) -> (RangeCheck, Pedersen, StorageBaseAddress); +core::integer::u128_try_from_felt252@3902([0]: RangeCheck, [1]: felt252) -> (RangeCheck, core::option::Option::); +core::starknet::info::get_execution_info@3918([0]: GasBuiltin, [1]: System) -> (GasBuiltin, System, core::panics::PanicResult::<(core::box::Box::,)>); +erc20::erc20::erc_20::ContractStateEventEmitter::emit::@3947([0]: GasBuiltin, [1]: System, [2]: erc20::erc20::erc_20::ContractState, [3]: erc20::erc20::erc_20::Transfer) -> (GasBuiltin, System, core::panics::PanicResult::<(erc20::erc20::erc_20::ContractState, ())>); +erc20::erc20::erc_20::allowances::InternalContractStateImpl::write@3997([0]: RangeCheck, [1]: GasBuiltin, [2]: Pedersen, [3]: System, [4]: erc20::erc20::erc_20::allowances::ContractState, [5]: Tuple, [6]: core::integer::u256) -> (RangeCheck, GasBuiltin, Pedersen, System, core::panics::PanicResult::<(erc20::erc20::erc_20::allowances::ContractState, ())>); +erc20::erc20::erc_20::ContractStateEventEmitter::emit::@4032([0]: GasBuiltin, [1]: System, [2]: erc20::erc20::erc_20::ContractState, [3]: erc20::erc20::erc_20::Approval) -> (GasBuiltin, System, core::panics::PanicResult::<(erc20::erc20::erc_20::ContractState, ())>); +core::integer::u256_checked_add@4082([0]: RangeCheck, [1]: core::integer::u256, [2]: core::integer::u256) -> (RangeCheck, core::option::Option::); +core::integer::u256_checked_sub@4102([0]: RangeCheck, [1]: core::integer::u256, [2]: core::integer::u256) -> (RangeCheck, core::option::Option::); +core::starknet::SyscallResultTraitImpl::<()>::unwrap_syscall@4122([0]: core::result::Result::<(), core::array::Array::>) -> (core::panics::PanicResult::<((),)>); +core::integer::Storeu256::write@4134([0]: GasBuiltin, [1]: System, [2]: u32, [3]: StorageBaseAddress, [4]: core::integer::u256) -> (GasBuiltin, System, core::result::Result::<(), core::array::Array::>); +core::traits::TIntoT::::into@4169([0]: erc20::erc20::erc_20::Event) -> (erc20::erc20::erc_20::Event); +erc20::erc20::erc_20::EventIsEvent::append_keys_and_data@4171([0]: erc20::erc20::erc_20::Event, [1]: Array, [2]: Array) -> (Array, Array, Unit); +core::starknet::storage_access::StoreU128::read@4200([0]: RangeCheck, [1]: GasBuiltin, [2]: System, [3]: u32, [4]: StorageBaseAddress) -> (RangeCheck, GasBuiltin, System, core::panics::PanicResult::<(core::result::Result::>,)>); +core::hash::LegacyHashContractAddress::hash@4241([0]: Pedersen, [1]: felt252, [2]: ContractAddress) -> (Pedersen, felt252); +core::hash::TupleSize2LegacyHash::::hash@4246([0]: Pedersen, [1]: felt252, [2]: Tuple) -> (Pedersen, felt252); +core::starknet::SyscallResultTraitImpl::>::unwrap_syscall@4258([0]: core::result::Result::, core::array::Array::>) -> (core::panics::PanicResult::<(core::box::Box::,)>); +erc20::erc20::erc_20::EventTransferIntoEvent::into@4270([0]: erc20::erc20::erc_20::Transfer) -> (erc20::erc20::erc_20::Event); +erc20::erc20::erc_20::EventApprovalIntoEvent::into@4273([0]: erc20::erc20::erc_20::Approval) -> (erc20::erc20::erc_20::Event); +core::integer::u256_overflowing_add@4276([0]: RangeCheck, [1]: core::integer::u256, [2]: core::integer::u256) -> (RangeCheck, Tuple); +core::integer::u256_overflow_sub@4323([0]: RangeCheck, [1]: core::integer::u256, [2]: core::integer::u256) -> (RangeCheck, Tuple); +erc20::erc20::erc_20::TransferIsEvent::append_keys_and_data@4370([0]: erc20::erc20::erc_20::Transfer, [1]: Array, [2]: Array) -> (Array, Array, Unit); +erc20::erc20::erc_20::ApprovalIsEvent::append_keys_and_data@4398([0]: erc20::erc20::erc_20::Approval, [1]: Array, [2]: Array) -> (Array, Array, Unit); +core::starknet::contract_address::ContractAddressSerde::serialize@4426([0]: ContractAddress, [1]: Array) -> (Array, Unit); diff --git a/cairo_programs/wallet.sierra b/cairo_programs/wallet.sierra new file mode 100644 index 000000000..51f9a924c --- /dev/null +++ b/cairo_programs/wallet.sierra @@ -0,0 +1,1430 @@ +{ + "sierra_program": [ + "0x1", + "0x3", + "0x0", + "0x2", + "0x2", + "0x0", + "0x110", + "0xf0", + "0x25", + "0x52616e6765436865636b", + "0x800000000000000100000000000000000000000000000000", + "0x537472756374", + "0x800000000000000f00000000000000000000000000000001", + "0x0", + "0x2ee1e2b1b89f8c495f200e4956278a4d47395fe262f27b52e5865c9524c08c3", + "0x800000000000000f00000000000000000000000000000002", + "0x1", + "0x16a4c8d7c05909052238a862d8cc3e7975bf05a07b3a69c6b28951083a6d672", + "0x4172726179", + "0x800000000000000300000000000000000000000000000001", + "0x8", + "0x800000000000000300000000000000000000000000000003", + "0x3", + "0x4", + "0x456e756d", + "0xcc5e86243f861d2d64b08c35db21013e773ac5cf10097946fe0011304886d5", + "0x2", + "0x5", + "0x101dc0399934cc08fa0d6f6f2daead4e4a38cabeea1c743e1fc28d2d6e58e99", + "0x66656c74323532", + "0x800000000000000700000000000000000000000000000000", + "0x90d0203c41ad646d024845257a6eceb2f8b59b29ce7420dd518053d2edeedc", + "0x53746f7261676541646472657373", + "0x53746f726167654261736541646472657373", + "0x2633efa4b25602d1290a27d6aeb948fa53ef8a1976814cd1d78ed018207d9cd", + "0x800000000000000f00000000000000000000000000000003", + "0xc", + "0x289f3ec570490cc3a75d679992a6fbe6de8132318d9d268c66b360184dfa286", + "0xd", + "0x75313238", + "0x800000000000000700000000000000000000000000000003", + "0x25e2ca4b84968c2d8b83ef476ca8549410346b00836ce79beaf538155990bb2", + "0xf", + "0x800000000000000700000000000000000000000000000002", + "0x33dd38c898783061cd5539eddd96ee07d9522f364cb597d41a5d52b5c33314d", + "0x10", + "0x38ebd195e334343351be418d9529f6ec84f863f4b4de353979c00728b133d95", + "0x11", + "0x426f78", + "0x800000000000000700000000000000000000000000000001", + "0x29d7d57c04a880978e7b3689f6218e507f3be17588744b58dc17762447ad0e7", + "0x13", + "0x10203be321c62a7bd4c060d69539c1fbe065baa9e253c74d2cc48be163e259", + "0x15", + "0x3520cd02f0e8297127614983b88bdaefde065b3fb4003d1a9d69b11592f6415", + "0x17", + "0x208991af02aa9b701a77c2c14af12d805ccecd643d794ba6794d824caf0095c", + "0x18", + "0x11c6d8087e00642489f92d2821ad6ebd6532ad1a3b6d12833da6d6810391511", + "0x536e617073686f74", + "0x1baeba72e79e9db2587cf44fedb2f3700b2075a5e8e39a562584862c4b71f62", + "0x1b", + "0x1c", + "0x39d7e2f385e5d511ae0a83d1ae4f716c2c908fa7833dd212825a421b655f6c8", + "0x1e", + "0x4275696c74696e436f737473", + "0x53797374656d", + "0x9931c641b913035ae674b400b61a51476d506bbe8bba2ff8a6272790aba9e6", + "0x1d", + "0x753332", + "0x4761734275696c74696e", + "0x92", + "0x7265766f6b655f61705f747261636b696e67", + "0x77697468647261775f676173", + "0x6272616e63685f616c69676e", + "0x7374727563745f6465636f6e737472756374", + "0x61727261795f6c656e", + "0x736e617073686f745f74616b65", + "0x23", + "0x64726f70", + "0x7533325f636f6e7374", + "0x72656e616d65", + "0x73746f72655f74656d70", + "0x7533325f6571", + "0x61727261795f6e6577", + "0x66656c743235325f636f6e7374", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x61727261795f617070656e64", + "0x7374727563745f636f6e737472756374", + "0x656e756d5f696e6974", + "0x22", + "0x24", + "0x21", + "0x6765745f6275696c74696e5f636f737473", + "0x20", + "0x77697468647261775f6761735f616c6c", + "0x66756e6374696f6e5f63616c6c", + "0x656e756d5f6d61746368", + "0x1f", + "0x4f7574206f6620676173", + "0x1a", + "0x6", + "0x19", + "0x4661696c656420746f20646573657269616c697a6520706172616d202331", + "0x7", + "0x16", + "0x61727261795f736e617073686f745f706f705f66726f6e74", + "0x14", + "0x6a756d70", + "0x756e626f78", + "0x753132385f636f6e7374", + "0x12", + "0x9", + "0x66656c743235325f616464", + "0xa", + "0xe", + "0x73746f726167655f626173655f616464726573735f636f6e7374", + "0x206f38f7e4f15e87567361213c28f235cccdaa1d7fd34c9db1dfe9489c6a091", + "0x73746f726167655f616464726573735f66726f6d5f62617365", + "0x73746f726167655f726561645f73797363616c6c", + "0xb", + "0x656d69745f6576656e745f73797363616c6c", + "0x73746f726167655f77726974655f73797363616c6c", + "0x155e08616bcbb7488110b83d2b0fbb666a76c8444c7199784579e8339c7e629", + "0x647570", + "0x753132385f746f5f66656c74323532", + "0x295", + "0xffffffffffffffff", + "0x51", + "0x44", + "0x26", + "0x27", + "0x28", + "0x3d", + "0x29", + "0x2a", + "0x2b", + "0x2c", + "0x2d", + "0x2e", + "0x31", + "0x32", + "0x2f", + "0x30", + "0x33", + "0x34", + "0x35", + "0x36", + "0x37", + "0x38", + "0x39", + "0x3a", + "0x3b", + "0x3c", + "0x3e", + "0x3f", + "0x40", + "0x41", + "0x42", + "0x43", + "0x45", + "0x46", + "0x47", + "0x48", + "0x49", + "0x4a", + "0x4b", + "0x4c", + "0x4d", + "0x4e", + "0x4f", + "0x50", + "0x52", + "0x53", + "0x54", + "0xbf", + "0xb0", + "0x80", + "0xa2", + "0x9b", + "0x55", + "0x56", + "0x57", + "0x58", + "0x59", + "0x5a", + "0x5b", + "0x5c", + "0x12d", + "0x11e", + "0xee", + "0x110", + "0x109", + "0x14b", + "0x15f", + "0x164", + "0x16e", + "0x1ac", + "0x1a4", + "0x19e", + "0x5d", + "0x1c6", + "0x5e", + "0x5f", + "0x60", + "0x61", + "0x1d9", + "0x62", + "0x63", + "0x1de", + "0x64", + "0x65", + "0x66", + "0x1e9", + "0x67", + "0x68", + "0x69", + "0x6a", + "0x6b", + "0x6c", + "0x6d", + "0x6e", + "0x6f", + "0x20a", + "0x70", + "0x71", + "0x20f", + "0x72", + "0x73", + "0x74", + "0x75", + "0x21a", + "0x76", + "0x77", + "0x230", + "0x235", + "0x240", + "0x78", + "0x79", + "0x7a", + "0x7b", + "0x7c", + "0x24d", + "0x7d", + "0x7e", + "0x7f", + "0x81", + "0x26a", + "0x82", + "0x83", + "0x84", + "0x85", + "0x86", + "0x87", + "0x88", + "0x89", + "0x8a", + "0x8b", + "0x8c", + "0x8d", + "0x8e", + "0x8f", + "0x90", + "0x91", + "0xcd", + "0x13b", + "0x152", + "0x158", + "0x175", + "0x1b4", + "0x1cc", + "0x1ef", + "0x221", + "0x247", + "0x253", + "0x255", + "0x264", + "0x270", + "0x27a", + "0x289", + "0x1815", + "0x38100602834060c0402c1409028100608040180a07018180a04018080200", + "0x2018080b8141a100b0541e08040202805068402608090202205068401e08", + "0x583e1304078101d0283420080407010060286c061a0281006160c858300f", + "0x144010060205228138204c05118404a08120144603110204408108144003", + "0x6c061c040b80a070184c102d040b00a0d0803010060288c0608040ac102a", + "0xc1e08148cc1008060206405100402608188206005068401008178200c05", + "0x4c1038040dc0a0d08030102f040180a20018d810060288c0635040d00a23", + "0xd8100821814840520814803f010f82c3d0982078081d8141a10010e82c39", + "0x20104a23020104a230201049028481048230201047230201045060201044", + "0x4c1008280381008280301008278301008251382408268301008260149605", + "0x1400a572b020104a02954a40804128a80804128a608041281012290202451", + "0xbc1008238e010082196810082c8381c082c0bc1008250bc1008280701008", + "0x20104707820104504020104707838105807820104a060201047060201045", + "0xd81008250d810082396c240826814245204048a23c04020a03604020a00f", + "0x3810582f848104d1882010472f02010592e83810582e0201059098381058", + "0x20a02d04020866104020b20c07020b01c04020941c040208a2f040208660", + "0x14018080412410122d02024510e02010472d020104a02848b408091447008", + "0x14c8630402094350402094050918c1012288301008310201008250201008", + "0x2024512e020104a02848b80809144180804194c608041641012318202451", + "0x2094050919c10122889c100828094100828014240833048240833020245c", + "0x2010500f0201043358201059350381058188201043029a4d00e04160ce08", + "0x14dc6d09020d82d040208e0809178101228978100825014245e04048a231", + "0x160d00804124101234020245134020104a02848d008091440a6f35020104a", + "0x701c082c020246104048a261040209405091841012288b41008281c01c08", + "0x20245130020104a02848c008091440a710f0381058338201047338201045", + "0x48a21e04020a0053904810082197410082c9ac1c082c1801008248202460", + "0x128e61204134ce0804164d00804164101235820245135820104a02848d608", + "0x48a25d0402094050917410122884810082818010082c8881c082c09c1008", + "0x20104712820104312820107412838105812820104a13820104304048ba08", + "0x140a053b014ea2204020920804020920f04020922707020b022040209422", + "0x38100e02814ee08028480a602e848f01307848ee1204014240802814ee08", + "0x1dc106a041740a7035048ee0834020260534020ee08060201e0506020ee08", + "0x201805029dc101e041740a6b0f048ee080e02026050e020ee08029800a05", + "0x1dc100f041a80a22041dc1022041a00a25041dc106b040300a22041dc1070", + "0x780a27041dc10050e0140a77040142405028d80a77090944412380141e08", + "0x1dc10051281456083b820ce27090880a67041dc1067041ac0a67041dc1005", + "0xbc10770403c106a029841077040b41067028b41077040acc61213814c608", + "0xbc1e082e020ee08308205a052f020ee0809020c60518820ee08098205605", + "0x3862051a820ee081a8205e051a820ee08029840a053b8200a1202970bc31", + "0x1700a56041dc10052f0140a770401424052d0e024791e0d82477090d4260f", + "0x20a8081a814f4083b82024083181400083b820780815814a8083b820ac08", + "0x14c103c028d81077040d8106a0294c8c52071dc107b3d0001c36029ec1077", + "0x48ee083e02070053f820ee08028700a053b8200a12029f8107d3e020ee12", + "0x1ac0a053b82104082a0150682091dc1081041580a053b82100082d0150280", + "0x20a60543a182477042150812230150a083b820fe082901508083b8210608", + "0x20ee0844820f605029dc1088041e80a8944048ee08430200005029dc1087", + "0xac0a8d041dc1036041a80a8c041dc108b041f80a8b041dc108a041f00a8a", + "0x23d1c8d0782120083b8211808168151e083b8208c08318151c083b820a408", + "0x148102b029f41077040d8106a02a441077041f8106702814ee08028480a90", + "0x152893491f41e084a020ee08488205a0549820ee0823020c60549020ee08", + "0x258107704258106b02a58107704014fe054a820ee08028700a053b8200a12", + "0x19c0a98041dc10973c8484e053c820ee08028940a97041dc10964a8484405", + "0x2024083181536083b820b4081581534083b82070083501532083b8213008", + "0x38108002814ee08028480a9d4e26d340f04274107704264102d02a701077", + "0x880a9f041dc109f041ac0a9f041dc10053f8153c083b8200a1c02814ee08", + "0x288106702a8810770428142121381542083b8200a2502a8010770427d3c12", + "0x20ee0809020c60552020ee083002056053c020ee082e820d40551820ee08", + "0x481005090200a053b8200a0502a994aa43c03c10a6041dc10a3040b40aa5", + "0x20d40841014d4083b8201c08408140a770401424053017424a70983c2477", + "0x200a120287010a838020ee1234021060507820ee0807820d405340302477", + "0x9444123b820d60809814d6083b8203c08078143c083b8201808070140a77", + "0x19c105d028acce123b8204e08098144e083b8200a6002814ee0811020ba05", + "0x18c10770418c1068028b41077040ac100c0298c107704094100c02814ee08", + "0x200a1c02814ee0838020a805029dc1005090140aa9029dc242d31848e005", + "0xc41077040bcc212110145e083b8205e08358145e083b8200a1e029841077", + "0x20d4051a820ee082e020ce052e020ee08189782427029781077040144a05", + "0x1dc1035040b40a38041dc10120418c0a3c041dc1013040ac0a36041dc100f", + "0x1dc1056040bc0a56041dc1005308140a770401424052d0e0783607820b408", + "0x200a5e02814ee08028480a532304954522a048ee122b04c1e0e18814ac08", + "0x2001077040481063029fc107704148102b029e8107704000105c028001077", + "0x1ec1c770420902803f83d0c0541020ee0838020d60540820ee083d0206a05", + "0x14ee08028480a86042ad06083b848fc0843814a8083b820a80835014fc7c", + "0x210107a02a1508123b8210e08000150e083b8200a1c02814ee08418210805", + "0x228107704224107e02a24107704220107c02a20107704214107b02814ee08", + "0x205a0546820ee083e020c60546020ee083d820560545820ee082a020d405", + "0x1a80a8f041dc10860419c0a053b8200a1202a391a8c4583c108e041dc108a", + "0x211e0816814fa083b820f8083181522083b820f6081581520083b820a808", + "0x1dc10050e0140a77041c0105402814ee08028480a923ea45200f042481077", + "0x152a083b8212893090880a94041dc1094041ac0a94041dc10053f8152608", + "0x118106a029e410770425c106702a5c1077042552c12138152c083b8200a25", + "0x20ee083c8205a054d020ee0809020c6054c820ee082982056054c020ee08", + "0x14ee08060210005029dc101c0414c0a053b8200a1202a6d34994c03c109b", + "0x2753812110153a083b8213a08358153a083b8200a8502a701077040143805", + "0x20ee0850020ce0550020ee084f27c242702a7c1077040144a054f020ee08", + "0xb40a78041dc10120418c0aa3041dc1013040ac0aa2041dc100f041a80aa1", + "0x700a053b8201c08400140a77040142405521e146a20782148083b8214208", + "0x1dc10a652848440553020ee0853020d60553020ee08029fc0aa5041dc1005", + "0x155e083b8215c08338155c083b82158ad0909c0aad041dc1005128155808", + "0x2bc102d02ac8107704048106302ac4107704180102b02ac0107704174106a", + "0x2d0260f091dc2408028481005029dc10050281566b258ac01e0859820ee08", + "0x14d00c091dc106a042080a6a041dc100e042040a053b8200a1202980ba12", + "0x201c05029dc10050901438085a9c01077091a010830283c10770403c106a", + "0x2044082e8144a22091dc106b0404c0a6b041dc101e0403c0a1e041dc100c", + "0x300a053b820ce082e8145667091dc10270404c0a27041dc1005300140a77", + "0xb4c61238014c6083b820c608340145a083b820560806014c6083b8204a08", + "0x780a61041dc10050e0140a77041c0105402814ee08028480a055b014ee12", + "0x1dc10051281462083b8205e61090880a2f041dc102f041ac0a2f041dc1005", + "0xd810770403c106a028d41077041701067029701077040c4bc1213814bc08", + "0xd81e082d020ee081a8205a051c020ee0809020c6051e020ee08098205605", + "0x3862052b020ee082b0205e052b020ee08029840a053b8200a1202968703c", + "0x1700a00041dc10052f0140a770401424052991824b729150247709158260f", + "0x20f4081a81500083b820240831814fe083b820a40815814f4083b8200008", + "0x20d4053f1f0f60e3b8210481401fc1e8802a081077041c0106b02a041077", + "0x210608420140a77040142405430217083041dc247e0421c0a54041dc1054", + "0x1ec0a053b82108083d0150a84091dc1087040000a87041dc10050e0140a77", + "0x20a8083501514083b82112083f01512083b82110083e01510083b8210a08", + "0x238107704228102d02a341077041f0106302a301077041ec102b02a2c1077", + "0x20ee082a020d40547820ee0843020ce05029dc1005090151c8d4622c1e08", + "0x3c1092041dc108f040b40a7d041dc107c0418c0a91041dc107b040ac0a90", + "0x14fe0549820ee08028700a053b820e0082a0140a77040142405491f52290", + "0x20ee08028940a95041dc10944984844054a020ee084a020d6054a020ee08", + "0x1530083b8208c0835014f2083b8212e08338152e083b8212a960909c0a96", + "0x265300f0426c1077041e4102d02a68107704048106302a6410770414c102b", + "0x1dc10050e0140a7704030108002814ee080e020a605029dc100509015369a", + "0x153c083b8213a9c090880a9d041dc109d041ac0a9d041dc1005428153808", + "0x3c106a02a84107704280106702a801077042793e12138153e083b8200a25", + "0x20ee08508205a053c020ee0809020c60551820ee0809820560551020ee08", + "0x2941077040143805029dc100e042000a053b8200a1202a90f0a35103c10a4", + "0x144a0556020ee0853294242202a98107704298106b02a98107704014fe05", + "0x1dc105d041a80aaf041dc10ae0419c0aae041dc10ac568484e0556820ee08", + "0x2166083b8215e081681564083b82024083181562083b820c008158156008", + "0x200a0815814260f091dc100e042280a0e041dc1012042240ab3592c5600f", + "0x1dc1070351a01c8c029c010770404c108b029a81077040201063029a01077", + "0x1dc101c042380a053b8200a120287810b90e020ee12060211a0506180ba0e", + "0x9c1077040941090028941077041ac44124781444083b8201e082e014d608", + "0x19c1c0831820ee0813821220515820ee0830020c60533820ee082e8205605", + "0x174102b028b4107704078109202814ee0807820fa05029dc100509014c62b", + "0x24c0a31179841c0818820ee0816821220517820ee0830020c60530820ee08", + "0x201c08290141e083b8200a940283810770404810121101424083b8200a08", + "0x20109602820107704014100e0297426120417410770403c10950284c1077", + "0x2024083c81426083b8201c084b8140a7704014240507821740e09048ee12", + "0x200a9402814ee08028480a055d8200a990298010770404c1098029741077", + "0x1801077041a010980297410770403c1079029a0107704030109a028301077", + "0x7010bc38020ee1230021360535020ee0835021020535020ee082e820f605", + "0x20d6084e814d6083b8203c08498143c083b820e0084e0140a77040142405", + "0x200a120289c4a120409c107704088109e028941077041a81081028881077", + "0x21020515820ee08338213e0533820ee0802a500a053b8203808298140a77", + "0x2280a0f041dc1012042240a2d31848102d041dc102b042780a63041dc106a", + "0x174108b029c01077040201063029a8107704014102b0297426123b8201e08", + "0x1ac10bd0f020ee12340211a0534030c00e3b82038703503918050e020ee08", + "0x1dc102511049440512820ee0802a840a22041dc1005500140a77040142405", + "0x14c6083b82026082e01456083b820ce083c014ce083b8204e08518144e08", + "0xac10a40297010770418c1035029781077040301063028c4107704180102b", + "0x217c36041dc242f0421c0a2f308b41c77040d4b85e1883d4a051a820ee08", + "0x2158052d020ee08070e024a6028e0107704078108e02814ee08028480a3c", + "0x1dc102d040ac0a52041dc1056042240a053b820a80829814a856091dc1036", + "0x14fc083b820b40835814f8083b820a40845814f6083b820c20831814f408", + "0x200a1202a0010bf3f820ee12000215c050014c8c0e3b820fc7c3d9e81ead", + "0x20ee084120c24b002a0c107704204105c02a0902123b820fe08578140a77", + "0x2c80a85041dc10530418c0a84041dc1046040ac0a87041dc1086042c40a86", + "0xac0a89041dc1080042cc0a053b8200a1202a210a840702110083b8210e08", + "0x231168a0702118083b82112085901516083b820a6083181514083b8208c08", + "0x20ee081e0216605029dc100e041500a053b8203c08600140a77040142405", + "0x381090041dc108d042c80a8f041dc10610418c0a8e041dc102d040ac0a8d", + "0x1ac10b302814ee0809820fa05029dc100e041500a053b8200a1202a411e8e", + "0x20ee0848821640549020ee0806020c6053e820ee0830020560548820ee08", + "0x2010083181418083b8200a08158141e083b82024084481526923e8381093", + "0x20e06a340301ead029c0107704038106b029a810770403c108b029a01077", + "0x203808578140a770401424050f021821c041dc2460042b80a602e84c1c77", + "0x144e083b820d6082e0144a083b8200a9402814ee0811020a605111ac2477", + "0x20c60531820ee0809820560515820ee0833821620533820ee081289c24b0", + "0x216605029dc100509014c22d318381061041dc102b042c80a2d041dc105d", + "0x1dc102f042c80a5e041dc105d0418c0a31041dc1013040ac0a2f041dc101e", + "0x1dc100e0430c0a0e041dc1005610140a7704048107d02970bc3107020b808", + "0x3140a0f041dc100f043100a13041dc1013041a00a13041dc1005300141e08", + "0x201808638140a77040142405381a8d00e63030c05d071dc240f098200a0f", + "0x8810770407010c8029ac107704180106302878107704174102b028701077", + "0x20ee0834020560512820ee08380219405029dc1005090140ac9040153205", + "0x3300a67041dc10220432c0a22041dc1025043200a6b041dc106a0418c0a1e", + "0xac108e02814ee08028480a630433456083b8484e08468144e083b820ce08", + "0x20ee080f020560517820ee08308219e0530820ee08168219c0516820ee08", + "0x1dc100509014b85e18838105c041dc102f043400a5e041dc106b0418c0a31", + "0x3400a3c041dc106b0418c0a36041dc101e040ac0a35041dc1063043440a05", + "0x3c10770404c10d20284c10770403810a4028e078360702070083b8206a08", + "0x3010d4029a018123b8201e0869814c0083b8200a1c029741077040143805", + "0x881077041801052029ac1077041741052028781077041a010a402814ee08", + "0x942477041a8100002814ee080e020a6050e1c0d40e3b820446b0f039aa05", + "0x1e80a6315848ee0838020000533820ee0813820f605029dc1025041e80a27", + "0x1dc102d042040a67041dc1067042040a2d041dc1063041ec0a053b8205608", + "0x2500a053b8200a1202970bc310735c5e61091dc242d338200a0f6b0145a08", + "0x1dc102f0418c0a3c041dc1061040ac0a36041dc1035043600a35041dc1005", + "0x20b8086d8140a7704014240502b6810054c814b4083b8206c086c8147008", + "0x16810770415810d9028e01077041781063028f01077040c4102b029581077", + "0x14c10df23020ee122a021bc052a020ee0829021ba0529020ee082d021b805", + "0x1e810b1029e810770400024125801400083b8208c08700140a77040142405", + "0x20ee083d82164053f020ee081c020c6053e020ee081e02056053d820ee08", + "0x20010770414c10b302814ee0809020b405029dc100509014fe7e3e038107f", + "0x2041c0841820ee0840021640541020ee081c020c60540820ee081e0205605", + "0x2114052e820ee08029800a13041dc100f0430c0a0f041dc1005610150682", + "0x1dc1013043100a5d041dc105d041a00a053b82018083e8141860091dc1012", + "0x140a770401424050f070e00e711a8d0123b8481c132e8200a13708142608", + "0x20d408318144a083b820d0081581444083b820d6086c014d6083b8200a94", + "0x7810db02814ee08028480a05718200a990299c10770408810d90289c1077", + "0x20ee0815821b20513820ee080e020c60512820ee0838020560515820ee08", + "0x21c861041dc2463043780a63041dc102d043740a2d041dc1067043700a67", + "0x21cc052f020ee081898024e5028c410770418410e002814ee08028480a2f", + "0x1dc105c0439c0a36041dc10270418c0a35041dc1025040ac0a5c041dc105e", + "0x20ee0817821d005029dc1060041f40a053b8200a12028f06c35070207808", + "0x381054041dc10380439c0a56041dc10270418c0a5a041dc1025040ac0a38", + "0x20ee08040219c05029dc10050901424087502010770901410e902950ac5a", + "0x140a77040142405098201013041dc100f043400a0f041dc100e0433c0a0e", + "0x3010d00283010770418010d102980107704048ba1213814ba083b8200a25", + "0x141c083b8200a087581410080402010770401410a4029a0100834020ee08", + "0x1dc100f04048440507820ee0807820d60507820ee0802bb00a053b8200a12", + "0x14e0083b820240829014d4083b820260829014d0083b8201c08768142608", + "0x1480a1c041dc10054a0140a7704030105302830c05d071dc1070351a01ca9", + "0x88d61e0702044083b82038084a814d6083b820c008290143c083b820ba08", + "0x3c40a0e041dc1008043c00a053b8200a120284810ef04020ee1202821dc05", + "0x200a2502814ee08028480a130402026083b8201e08790141e083b8201c08", + "0x20ee0806021e40506020ee0830021e60530020ee08091742427029741077", + "0x20ee0809020a4052e820ee0807021ea0507020ee0802821e805340201068", + "0x1480a0c041dc10054a0140a770404c10530284c1e123b820c05d093d80a60", + "0x1c0d46807020e0083b82018084a814d4083b8201e0829014d0083b8201008", + "0x3e80a053b8201e087c8141e0e091dc1012043e00a1202848ee0802821ee05", + "0x20a6052e84c247704030c0127d81418083b820100829014c0083b8201c08", + "0x20ee0835021f405029dc1068043e40a6a34048ee0802821f005029dc105d", + "0x881077041c010fc02870e0123b820d61e093ec0a6b041dc1013041480a1e", + "0x20ee0809021fe0509020ee0802821fc0512888240812820ee080e021fa05", + "0x1480a0c041dc1013041ac0a053b8201e082a014260f091dc100e041580a0e", + "0x200a9402814ee0830020a605301742477041a0181223014d0083b8201008", + "0x14c0a0f33870e012040701077041a81095029c01077041741052029a81077", + "0x30c1c1204014a454298141e362a14c0a0f02838240802948a8530283c6c54", + "0x404240802968a853070bca853074001c1204014a454298141e362a14c0a0f", + "0x200a5e2a14c1c0c17950a60f81814b836090d8110204014100f0903c1812", + "0x200a612a14c1c1c2a14c1d050704810052f150a60e060bca85307c101c12", + "0x200a6b2a14c1c0c0e150a60f83838240802978a8530719c5e542983e0c12", + "0x42c2408028201e0f0703c1e67074280a670419c1109029841068044201c12", + "0x43810050403c240f1284a1a1204014100f078381e0f1383a18052e820c008", + "0x10f04014100f0903c4412" + ], + "sierra_program_debug_info": { + "type_names": [ + [ + 0, + "RangeCheck" + ], + [ + 1, + "Unit" + ], + [ + 2, + "Tuple" + ], + [ + 3, + "core::panics::Panic" + ], + [ + 4, + "Array" + ], + [ + 5, + "Tuple>" + ], + [ + 6, + "core::panics::PanicResult::<((),)>" + ], + [ + 7, + "core::result::Result::<(), core::array::Array::>" + ], + [ + 8, + "felt252" + ], + [ + 9, + "core::result::Result::>" + ], + [ + 10, + "StorageAddress" + ], + [ + 11, + "StorageBaseAddress" + ], + [ + 12, + "wallet::wallet::SimpleWallet::balance::ContractMemberState" + ], + [ + 13, + "Tuple" + ], + [ + 14, + "core::panics::PanicResult::<(wallet::wallet::SimpleWallet::balance::ContractMemberState, ())>" + ], + [ + 15, + "u128" + ], + [ + 16, + "core::integer::u256" + ], + [ + 17, + "wallet::wallet::SimpleWallet::DummyEvent" + ], + [ + 18, + "wallet::wallet::SimpleWallet::Event" + ], + [ + 19, + "Box" + ], + [ + 20, + "core::option::Option::>" + ], + [ + 21, + "Tuple" + ], + [ + 22, + "core::panics::PanicResult::<(core::felt252,)>" + ], + [ + 23, + "wallet::wallet::SimpleWallet::ContractState" + ], + [ + 24, + "Tuple" + ], + [ + 25, + "core::panics::PanicResult::<(wallet::wallet::SimpleWallet::ContractState, ())>" + ], + [ + 26, + "core::option::Option::" + ], + [ + 27, + "Snapshot>" + ], + [ + 28, + "core::array::Span::" + ], + [ + 29, + "Tuple>" + ], + [ + 30, + "Tuple" + ], + [ + 31, + "core::panics::PanicResult::<(wallet::wallet::SimpleWallet::ContractState, core::felt252)>" + ], + [ + 32, + "BuiltinCosts" + ], + [ + 33, + "System" + ], + [ + 34, + "core::panics::PanicResult::<(core::array::Span::,)>" + ], + [ + 35, + "u32" + ], + [ + 36, + "GasBuiltin" + ] + ], + "libfunc_names": [ + [ + 0, + "revoke_ap_tracking" + ], + [ + 1, + "withdraw_gas" + ], + [ + 2, + "branch_align" + ], + [ + 3, + "struct_deconstruct>" + ], + [ + 4, + "array_len" + ], + [ + 5, + "snapshot_take" + ], + [ + 6, + "drop" + ], + [ + 7, + "u32_const<0>" + ], + [ + 8, + "rename" + ], + [ + 9, + "store_temp" + ], + [ + 10, + "store_temp" + ], + [ + 11, + "u32_eq" + ], + [ + 12, + "array_new" + ], + [ + 13, + "felt252_const<7733229381460288120802334208475838166080759535023995805565484692595>" + ], + [ + 14, + "store_temp" + ], + [ + 15, + "array_append" + ], + [ + 16, + "struct_construct" + ], + [ + 17, + "struct_construct>>" + ], + [ + 18, + "enum_init,)>, 1>" + ], + [ + 19, + "store_temp" + ], + [ + 20, + "store_temp" + ], + [ + 21, + "store_temp,)>>" + ], + [ + 22, + "get_builtin_costs" + ], + [ + 23, + "store_temp" + ], + [ + 24, + "withdraw_gas_all" + ], + [ + 25, + "struct_construct" + ], + [ + 26, + "struct_construct" + ], + [ + 27, + "store_temp" + ], + [ + 28, + "function_call" + ], + [ + 29, + "enum_match>" + ], + [ + 30, + "struct_deconstruct>" + ], + [ + 31, + "drop" + ], + [ + 32, + "snapshot_take" + ], + [ + 33, + "drop" + ], + [ + 34, + "store_temp>" + ], + [ + 35, + "function_call" + ], + [ + 36, + "drop" + ], + [ + 37, + "snapshot_take>" + ], + [ + 38, + "drop>" + ], + [ + 39, + "struct_construct>" + ], + [ + 40, + "struct_construct>>" + ], + [ + 41, + "enum_init,)>, 0>" + ], + [ + 42, + "felt252_const<375233589013918064796019>" + ], + [ + 43, + "drop>" + ], + [ + 44, + "store_temp>" + ], + [ + 45, + "function_call" + ], + [ + 46, + "enum_match>" + ], + [ + 47, + "function_call" + ], + [ + 48, + "enum_match>" + ], + [ + 49, + "drop>" + ], + [ + 50, + "felt252_const<485748461484230571791265682659113160264223489397539653310998840191492913>" + ], + [ + 51, + "function_call" + ], + [ + 52, + "struct_deconstruct" + ], + [ + 53, + "snapshot_take" + ], + [ + 54, + "store_temp" + ], + [ + 55, + "function_call" + ], + [ + 56, + "enum_match>" + ], + [ + 57, + "struct_deconstruct>" + ], + [ + 58, + "struct_construct>" + ], + [ + 59, + "enum_init, 0>" + ], + [ + 60, + "store_temp>" + ], + [ + 61, + "drop" + ], + [ + 62, + "enum_init, 1>" + ], + [ + 63, + "rename" + ], + [ + 64, + "struct_construct" + ], + [ + 65, + "store_temp" + ], + [ + 66, + "array_snapshot_pop_front" + ], + [ + 67, + "enum_init>, 0>" + ], + [ + 68, + "store_temp>>" + ], + [ + 69, + "store_temp>>" + ], + [ + 70, + "jump" + ], + [ + 71, + "enum_init>, 1>" + ], + [ + 72, + "enum_match>>" + ], + [ + 73, + "unbox" + ], + [ + 74, + "enum_init, 0>" + ], + [ + 75, + "store_temp>" + ], + [ + 76, + "enum_init, 1>" + ], + [ + 77, + "u128_const<2>" + ], + [ + 78, + "u128_const<0>" + ], + [ + 79, + "struct_construct" + ], + [ + 80, + "struct_construct" + ], + [ + 81, + "enum_init" + ], + [ + 82, + "store_temp" + ], + [ + 83, + "function_call>>" + ], + [ + 84, + "felt252_add" + ], + [ + 85, + "struct_deconstruct>" + ], + [ + 86, + "function_call" + ], + [ + 87, + "enum_match>" + ], + [ + 88, + "struct_deconstruct>" + ], + [ + 89, + "struct_construct>" + ], + [ + 90, + "enum_init, 0>" + ], + [ + 91, + "store_temp>" + ], + [ + 92, + "enum_init, 1>" + ], + [ + 93, + "drop>" + ], + [ + 94, + "storage_base_address_const<916907772491729262376534102982219947830828984996257231353398618781993312401>" + ], + [ + 95, + "storage_address_from_base" + ], + [ + 96, + "store_temp" + ], + [ + 97, + "storage_read_syscall" + ], + [ + 98, + "enum_init>, 0>" + ], + [ + 99, + "store_temp>>" + ], + [ + 100, + "enum_init>, 1>" + ], + [ + 101, + "rename>>" + ], + [ + 102, + "function_call::unwrap_syscall>" + ], + [ + 103, + "struct_construct>" + ], + [ + 104, + "enum_init, 0>" + ], + [ + 105, + "store_temp>" + ], + [ + 106, + "enum_init, 1>" + ], + [ + 107, + "function_call::into>" + ], + [ + 108, + "snapshot_take" + ], + [ + 109, + "drop" + ], + [ + 110, + "function_call" + ], + [ + 111, + "emit_event_syscall" + ], + [ + 112, + "enum_init>, 0>" + ], + [ + 113, + "store_temp>>" + ], + [ + 114, + "enum_init>, 1>" + ], + [ + 115, + "rename>>" + ], + [ + 116, + "function_call::unwrap_syscall>" + ], + [ + 117, + "enum_match>" + ], + [ + 118, + "struct_deconstruct>" + ], + [ + 119, + "storage_write_syscall" + ], + [ + 120, + "struct_construct>" + ], + [ + 121, + "enum_init, 0>" + ], + [ + 122, + "store_temp>" + ], + [ + 123, + "enum_init, 1>" + ], + [ + 124, + "enum_match>>" + ], + [ + 125, + "enum_match" + ], + [ + 126, + "felt252_const<604044455298473900658797727502986337863043931241839670982572839358997980713>" + ], + [ + 127, + "store_temp" + ], + [ + 128, + "function_call" + ], + [ + 129, + "enum_match>>" + ], + [ + 130, + "struct_construct>" + ], + [ + 131, + "enum_init, 0>" + ], + [ + 132, + "store_temp>" + ], + [ + 133, + "enum_init, 1>" + ], + [ + 134, + "struct_deconstruct" + ], + [ + 135, + "store_temp" + ], + [ + 136, + "function_call" + ], + [ + 137, + "dup" + ], + [ + 138, + "struct_deconstruct" + ], + [ + 139, + "drop" + ], + [ + 140, + "store_temp" + ], + [ + 141, + "function_call" + ], + [ + 142, + "rename>" + ], + [ + 143, + "rename" + ], + [ + 144, + "rename" + ], + [ + 145, + "u128_to_felt252" + ] + ], + "user_func_names": [ + [ + 0, + "wallet::wallet::SimpleWallet::__wrapper_get_balance" + ], + [ + 1, + "wallet::wallet::SimpleWallet::__wrapper_increase_balance" + ], + [ + 2, + "wallet::wallet::SimpleWallet::__wrapper_constructor" + ], + [ + 3, + "wallet::wallet::SimpleWallet::SimpleWallet::get_balance" + ], + [ + 4, + "core::Felt252Serde::serialize" + ], + [ + 5, + "core::Felt252Serde::deserialize" + ], + [ + 6, + "wallet::wallet::SimpleWallet::SimpleWallet::increase_balance" + ], + [ + 7, + "wallet::wallet::SimpleWallet::constructor" + ], + [ + 8, + "wallet::wallet::SimpleWallet::balance::InternalContractMemberStateImpl::read" + ], + [ + 9, + "wallet::wallet::SimpleWallet::ContractStateEventEmitter::emit::>" + ], + [ + 10, + "wallet::wallet::SimpleWallet::balance::InternalContractMemberStateImpl::write" + ], + [ + 11, + "core::starknet::SyscallResultTraitImpl::::unwrap_syscall" + ], + [ + 12, + "core::traits::TIntoT::::into" + ], + [ + 13, + "wallet::wallet::SimpleWallet::EventIsEvent::append_keys_and_data" + ], + [ + 14, + "core::starknet::SyscallResultTraitImpl::<()>::unwrap_syscall" + ], + [ + 15, + "wallet::wallet::SimpleWallet::DummyEventIsEvent::append_keys_and_data" + ], + [ + 16, + "core::integer::u256Serde::serialize" + ], + [ + 17, + "core::integer::U128Serde::serialize" + ] + ] + }, + "contract_class_version": "0.1.0", + "entry_points_by_type": { + "EXTERNAL": [ + { + "selector": "0x362398bec32bc0ebb411203221a35a0301193a96f317ebe5e40be9f60d15320", + "function_idx": 1 + }, + { + "selector": "0x39e11d48192e4333233c7eb19d10ad67c362bb28580c604d67884c85da39695", + "function_idx": 0 + } + ], + "L1_HANDLER": [], + "CONSTRUCTOR": [ + { + "selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", + "function_idx": 2 + } + ] + }, + "abi": [ + { + "type": "impl", + "name": "SimpleWallet", + "interface_name": "wallet::wallet::ISimpleWallet" + }, + { + "type": "interface", + "name": "wallet::wallet::ISimpleWallet", + "items": [ + { + "type": "function", + "name": "get_balance", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "increase_balance", + "inputs": [ + { + "name": "amount", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "initial_balance", + "type": "core::felt252" + } + ] + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "event", + "name": "wallet::wallet::SimpleWallet::DummyEvent", + "kind": "struct", + "members": [ + { + "name": "value", + "type": "core::integer::u256", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "wallet::wallet::SimpleWallet::Event", + "kind": "enum", + "variants": [ + { + "name": "DummyEvent", + "type": "wallet::wallet::SimpleWallet::DummyEvent", + "kind": "nested" + } + ] + } + ] +} \ No newline at end of file diff --git a/cli/src/main.rs b/cli/src/main.rs index c2dcbe052..177f70f55 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -202,7 +202,7 @@ fn invoke_parser( Some(Felt252::zero()), transaction_hash.unwrap(), )?; - let mut transactional_state = cached_state.create_transactional(); + let mut transactional_state = cached_state.create_transactional()?; let _tx_info = internal_invoke.apply(&mut transactional_state, &BlockContext::default(), 0)?; cached_state.apply_state_update(&StateDiff::from_cached_state(transactional_state)?)?; diff --git a/examples/contract_execution/main.rs b/examples/contract_execution/main.rs index cc7bb8a02..0bea3e760 100644 --- a/examples/contract_execution/main.rs +++ b/examples/contract_execution/main.rs @@ -24,7 +24,16 @@ use starknet_in_rust::{ }; use std::{path::Path, sync::Arc}; +use tracing_subscriber::EnvFilter; + fn main() { + tracing::subscriber::set_global_default( + tracing_subscriber::FmtSubscriber::builder() + .with_env_filter(EnvFilter::from_default_env()) + .finish(), + ) + .unwrap(); + // replace this with the path to your compiled contract let contract_path = "starknet_programs/fibonacci.json"; diff --git a/examples/lru_cache/main.rs b/examples/lru_cache/main.rs index f1ab212ff..266ad1074 100644 --- a/examples/lru_cache/main.rs +++ b/examples/lru_cache/main.rs @@ -96,7 +96,7 @@ fn run_contract( // Store the local cache changes into the shared cache. This updates the shared cache with all // the contracts used on this state. - contract_cache.extend(state.drain_private_contract_class_cache()); + contract_cache.extend(state.drain_private_contract_class_cache().unwrap()); invoke_tx_execution_info.call_info.unwrap().retdata } diff --git a/fuzzer/src/main.rs b/fuzzer/src/main.rs index 8bac1f09e..319652bc3 100644 --- a/fuzzer/src/main.rs +++ b/fuzzer/src/main.rs @@ -176,7 +176,7 @@ fn main() { entry_point_type: Some(EntryPointType::External), calldata, retdata: [Felt252::from_bytes_be(data_to_ascii(data).as_bytes())].to_vec(), - execution_resources: ExecutionResources::default(), + execution_resources: Some(ExecutionResources::default()), class_hash: Some(class_hash), storage_read_values: vec![Felt252::from_bytes_be(data_to_ascii(data).as_bytes())], accessed_storage_keys: expected_accessed_storage_keys, diff --git a/rpc_state_reader/Cargo.toml b/rpc_state_reader/Cargo.toml index 370ee93d4..0cdbbf8ef 100644 --- a/rpc_state_reader/Cargo.toml +++ b/rpc_state_reader/Cargo.toml @@ -21,7 +21,7 @@ flate2 = "1.0.25" serde_with = "3.0.0" dotenv = "0.15.0" cairo-vm = "0.8.5" -blockifier = "0.2.0-rc0" +blockifier = "=0.2.0-rc0" starknet_in_rust = { path = "../", version = "0.4.0" } [dev-dependencies] diff --git a/rpc_state_reader/src/lib.rs b/rpc_state_reader/src/lib.rs index 2ae84fab1..094029c55 100644 --- a/rpc_state_reader/src/lib.rs +++ b/rpc_state_reader/src/lib.rs @@ -138,7 +138,7 @@ mod tests { ); assert_eq!( - tx_trace.validate_invocation.calldata, + tx_trace.validate_invocation.as_ref().unwrap().calldata, Some(vec![ stark_felt!("1"), stark_felt!("690c876e61beda61e994543af68038edac4e1cb1990ab06e52a2d27e56a1232"), @@ -157,9 +157,16 @@ mod tests { stark_felt!("38bd34c31a0a5c"), ]) ); - assert_eq!(tx_trace.validate_invocation.retdata, Some(vec![])); + assert_eq!( + tx_trace.validate_invocation.as_ref().unwrap().retdata, + Some(vec![]) + ); assert_eq_sorted!( - tx_trace.validate_invocation.execution_resources, + tx_trace + .validate_invocation + .as_ref() + .unwrap() + .execution_resources, ExecutionResources { n_steps: 790, n_memory_holes: 51, @@ -170,7 +177,15 @@ mod tests { ]), } ); - assert_eq!(tx_trace.validate_invocation.internal_calls.len(), 1); + assert_eq!( + tx_trace + .validate_invocation + .as_ref() + .unwrap() + .internal_calls + .len(), + 1 + ); assert_eq!( tx_trace.function_invocation.as_ref().unwrap().calldata, @@ -243,7 +258,7 @@ mod tests { ); assert_eq!( - tx_trace.fee_transfer_invocation.calldata, + tx_trace.fee_transfer_invocation.as_ref().unwrap().calldata, Some(vec![ stark_felt!("1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8"), stark_felt!("2b0322a23ba4"), @@ -251,11 +266,15 @@ mod tests { ]) ); assert_eq!( - tx_trace.fee_transfer_invocation.retdata, + tx_trace.fee_transfer_invocation.as_ref().unwrap().retdata, Some(vec![1u128.into()]) ); assert_eq_sorted!( - tx_trace.fee_transfer_invocation.execution_resources, + tx_trace + .fee_transfer_invocation + .as_ref() + .unwrap() + .execution_resources, ExecutionResources { n_steps: 586, n_memory_holes: 42, @@ -265,7 +284,15 @@ mod tests { ]), } ); - assert_eq!(tx_trace.fee_transfer_invocation.internal_calls.len(), 1); + assert_eq!( + tx_trace + .fee_transfer_invocation + .as_ref() + .unwrap() + .internal_calls + .len(), + 1 + ); } #[test] diff --git a/rpc_state_reader/src/rpc_state.rs b/rpc_state_reader/src/rpc_state.rs index 3ff561339..60bfd21b2 100644 --- a/rpc_state_reader/src/rpc_state.rs +++ b/rpc_state_reader/src/rpc_state.rs @@ -11,6 +11,7 @@ use starknet_api::{ state::StorageKey, transaction::{Transaction as SNTransaction, TransactionHash}, }; +use starknet_in_rust::definitions::block_context::StarknetChainId; use std::{collections::HashMap, env, fmt::Display}; use thiserror::Error; @@ -24,6 +25,16 @@ pub enum RpcChain { TestNet2, } +impl From for StarknetChainId { + fn from(network: RpcChain) -> StarknetChainId { + match network { + RpcChain::MainNet => StarknetChainId::MainNet, + RpcChain::TestNet => StarknetChainId::TestNet, + RpcChain::TestNet2 => StarknetChainId::TestNet2, + } + } +} + impl fmt::Display for RpcChain { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { @@ -147,9 +158,9 @@ pub struct RpcResponse { #[derive(Debug, Deserialize, Clone, Eq, PartialEq)] pub struct TransactionTrace { - pub validate_invocation: RpcCallInfo, + pub validate_invocation: Option, pub function_invocation: Option, - pub fee_transfer_invocation: RpcCallInfo, + pub fee_transfer_invocation: Option, pub signature: Vec, pub revert_error: Option, } @@ -390,12 +401,12 @@ impl RpcState { } } - pub fn get_contract_class(&self, class_hash: &ClassHash) -> SNContractClass { + pub fn get_contract_class(&self, class_hash: &ClassHash) -> Option { self.rpc_call_result( "starknet_getClass", &json!([self.block.to_value().unwrap(), class_hash.0.to_string()]), ) - .unwrap() + .ok() } pub fn get_class_hash_at(&self, contract_address: &ContractAddress) -> ClassHash { @@ -407,7 +418,7 @@ impl RpcState { contract_address.0.key().clone().to_string() ]), ) - .unwrap(); + .unwrap_or_default(); ClassHash(hash) } @@ -420,7 +431,8 @@ impl RpcState { contract_address.0.key().clone().to_string() ]), ) - .unwrap() + // When running deploy_account transactions, the nonce doesn't exist on the previous block so we return 0 + .unwrap_or_default() } pub fn get_storage_at( @@ -439,7 +451,7 @@ impl RpcState { self.block.to_value().unwrap() ]), ) - .unwrap() + .unwrap_or_default() } /// Requests the given transaction to the Feeder Gateway API. diff --git a/rpc_state_reader/src/utils.rs b/rpc_state_reader/src/utils.rs index a56d9f3b7..1a5ecffb4 100644 --- a/rpc_state_reader/src/utils.rs +++ b/rpc_state_reader/src/utils.rs @@ -11,7 +11,7 @@ use starknet_api::{ core::EntryPointSelector, deprecated_contract_class::{EntryPoint, EntryPointOffset, EntryPointType}, hash::{StarkFelt, StarkHash}, - transaction::{InvokeTransaction, Transaction}, + transaction::{DeclareTransaction, InvokeTransaction, Transaction}, }; #[derive(Debug, Deserialize)] @@ -82,6 +82,24 @@ pub fn deserialize_transaction_json( "unimplemented invoke version: {x}" ))), }, + "DEPLOY_ACCOUNT" => Ok(Transaction::DeployAccount(serde_json::from_value( + transaction, + )?)), + "DECLARE" => match tx_version.as_str() { + "0x0" => Ok(Transaction::Declare(DeclareTransaction::V0( + serde_json::from_value(transaction)?, + ))), + "0x1" => Ok(Transaction::Declare(DeclareTransaction::V1( + serde_json::from_value(transaction)?, + ))), + "0x2" => Ok(Transaction::Declare(DeclareTransaction::V2( + serde_json::from_value(transaction)?, + ))), + x => Err(serde::de::Error::custom(format!( + "unimplemented declare version: {x}" + ))), + }, + "L1_HANDLER" => Ok(Transaction::L1Handler(serde_json::from_value(transaction)?)), x => Err(serde::de::Error::custom(format!( "unimplemented transaction type deserialization: {x}" ))), diff --git a/rpc_state_reader/tests/blockifier_tests.rs b/rpc_state_reader/tests/blockifier_tests.rs index a32139934..584464929 100644 --- a/rpc_state_reader/tests/blockifier_tests.rs +++ b/rpc_state_reader/tests/blockifier_tests.rs @@ -3,11 +3,16 @@ use blockifier::{ execution::{contract_class::ContractClass, entry_point::CallInfo}, state::{ cached_state::{CachedState, GlobalContractCache}, + errors::StateError, state_api::{StateReader, StateResult}, }, transaction::{ - account_transaction::AccountTransaction, objects::TransactionExecutionInfo, - transactions::ExecutableTransaction, + account_transaction::AccountTransaction, + objects::TransactionExecutionInfo, + transactions::{ + DeclareTransaction, DeployAccountTransaction, ExecutableTransaction, + L1HandlerTransaction, + }, }, }; use blockifier::{ @@ -27,7 +32,10 @@ use starknet::core::types::ContractClass as SNContractClass; use starknet_api::{ block::BlockNumber, contract_address, - core::{ClassHash, CompiledClassHash, ContractAddress, Nonce, PatriciaKey}, + core::{ + calculate_contract_address, ClassHash, CompiledClassHash, ContractAddress, Nonce, + PatriciaKey, + }, hash::{StarkFelt, StarkHash}, patricia_key, stark_felt, state::StorageKey, @@ -62,7 +70,7 @@ impl StateReader for RpcStateReader { class_hash: &ClassHash, ) -> StateResult { Ok(match self.0.get_contract_class(class_hash) { - SNContractClass::Legacy(compressed_legacy_cc) => { + Some(SNContractClass::Legacy(compressed_legacy_cc)) => { let as_str = utils::decode_reader(compressed_legacy_cc.program).unwrap(); let program = Program::from_bytes(as_str.as_bytes(), None).unwrap(); let entry_points_by_type = utils::map_entry_points_by_type_legacy( @@ -74,7 +82,7 @@ impl StateReader for RpcStateReader { }); BlockifierContractClass::V0(ContractClassV0(inner)) } - SNContractClass::Sierra(flattened_sierra_cc) => { + Some(SNContractClass::Sierra(flattened_sierra_cc)) => { let middle_sierra: utils::MiddleSierraContractClass = { let v = serde_json::to_value(flattened_sierra_cc).unwrap(); serde_json::from_value(v).unwrap() @@ -89,6 +97,7 @@ impl StateReader for RpcStateReader { let casm_cc = CasmContractClass::from_contract_class(sierra_cc, false).unwrap(); BlockifierContractClass::V1(casm_cc.try_into().unwrap()) } + None => return Err(StateError::UndeclaredClassHash(*class_hash)), }) } @@ -176,6 +185,46 @@ pub fn execute_tx( let invoke = InvokeTransaction { tx, tx_hash }; AccountTransaction::Invoke(invoke) } + SNTransaction::DeployAccount(tx) => { + let contract_address = calculate_contract_address( + tx.contract_address_salt, + tx.class_hash, + &tx.constructor_calldata, + ContractAddress::default(), + ) + .unwrap(); + AccountTransaction::DeployAccount(DeployAccountTransaction { + tx, + tx_hash, + contract_address, + }) + } + SNTransaction::Declare(tx) => { + // Fetch the contract_class from the next block (as we don't have it in the previous one) + let mut next_block_state_reader = + RpcStateReader(RpcState::new_infura(network, (block_number.next()).into())); + let contract_class = next_block_state_reader + .get_compiled_contract_class(&tx.class_hash()) + .unwrap(); + + let declare = DeclareTransaction::new(tx, tx_hash, contract_class).unwrap(); + AccountTransaction::Declare(declare) + } + SNTransaction::L1Handler(tx) => { + // As L1Hanlder is not an account transaction we execute it here and return the result + let blockifier_tx = L1HandlerTransaction { + tx, + tx_hash, + paid_fee_on_l1: starknet_api::transaction::Fee(u128::MAX), + }; + return ( + blockifier_tx + .execute(&mut state, &block_context, true, true) + .unwrap(), + trace, + receipt, + ); + } _ => unimplemented!(), }; @@ -286,6 +335,46 @@ fn blockifier_test_recent_tx() { 186551, // real block 186552 RpcChain::MainNet )] +#[test_case( + "0x1cbc74e101a1533082a021ce53235cfd744899b0ff948d1949a64646e0f15c2", + 885298, // real block 885299 + RpcChain::TestNet +)] +#[test_case( + "0x5a5de1f42f6005f3511ea6099daed9bcbcf9de334ee714e8563977e25f71601", + 281513, // real block 281514 + RpcChain::MainNet +)] +#[test_case( + "0x26be3e906db66973de1ca5eec1ddb4f30e3087dbdce9560778937071c3d3a83", + 351268, // real block 351269 + RpcChain::MainNet +)] +#[test_case( + "0x4f552c9430bd21ad300db56c8f4cae45d554a18fac20bf1703f180fac587d7e", + 351225, // real block 351226 + RpcChain::MainNet +)] +// DeployAccount for different account providers (as of October 2023): +// All of them were deployed on testnet using starkli +// OpenZeppelin (v0.7.0) +#[test_case( + "0x0012696c03a0f0301af190288d9824583be813b71882308e4c5d686bf5967ec5", + 889866, // real block 889867 + RpcChain::TestNet +)] +// Braavos (v3.21.10) +#[test_case( + "0x04dc838fd4ed265ab2ea5fbab08e67b398e3caaedf75c548113c6b2f995fc9db", + 889858, // real block 889859 + RpcChain::TestNet +)] +// Argent X (v5.7.0) +#[test_case( + "0x01583c47a929f81f6a8c74d31708a7f161603893435d51b6897017fdcdaafee4", + 889897, // real block 889898 + RpcChain::TestNet +)] fn blockifier_test_case_tx(hash: &str, block_number: u64, chain: RpcChain) { let (tx_info, trace, receipt) = execute_tx(hash, chain, BlockNumber(block_number)); @@ -357,3 +446,38 @@ fn blockifier_test_case_reverted_tx(hash: &str, block_number: u64, chain: RpcCha ); } } + +#[test_case( + // Declare tx + "0x60506c49e65d84e2cdd0e9142dc43832a0a59cb6a9cbcce1ab4f57c20ba4afb", + 347899, // real block 347900 + RpcChain::MainNet +)] +#[test_case( + // Declare tx + "0x1088aa18785779e1e8eef406dc495654ad42a9729b57969ad0dbf2189c40bee", + 271887, // real block 271888 + RpcChain::MainNet +)] +fn blockifier_test_case_declare_tx(hash: &str, block_number: u64, chain: RpcChain) { + let (tx_info, _trace, receipt) = execute_tx(hash, chain, BlockNumber(block_number)); + let TransactionExecutionInfo { + execute_call_info, + actual_fee, + .. + } = tx_info; + + assert!(execute_call_info.is_none()); + + let actual_fee = actual_fee.0; + if receipt.actual_fee != actual_fee { + let diff = 100 * receipt.actual_fee.abs_diff(actual_fee) / receipt.actual_fee; + + if diff >= 5 { + assert_eq!( + actual_fee, receipt.actual_fee, + "actual_fee mismatch differs from the baseline by more than 5% ({diff}%)", + ); + } + } +} diff --git a/rpc_state_reader/tests/sir_tests.rs b/rpc_state_reader/tests/sir_tests.rs index 8e49d1aaa..44d480490 100644 --- a/rpc_state_reader/tests/sir_tests.rs +++ b/rpc_state_reader/tests/sir_tests.rs @@ -8,10 +8,10 @@ use starknet_api::{ hash::{StarkFelt, StarkHash}, stark_felt, state::StorageKey, - transaction::{Transaction as SNTransaction, TransactionHash}, + transaction::{Transaction as SNTransaction, TransactionHash, TransactionVersion}, }; use starknet_in_rust::{ - core::errors::state_errors::StateError, + core::{contract_address::compute_casm_class_hash, errors::state_errors::StateError}, definitions::{ block_context::{BlockContext, StarknetChainId, StarknetOsConfig}, constants::{ @@ -26,7 +26,7 @@ use starknet_in_rust::{ cached_state::CachedState, contract_class_cache::PermanentContractClassCache, state_api::StateReader, state_cache::StorageEntry, BlockInfo, }, - transaction::{InvokeFunction, Transaction}, + transaction::{Declare, DeclareV2, DeployAccount, InvokeFunction, L1Handler}, utils::{Address, ClassHash}, }; @@ -34,12 +34,15 @@ use test_case::test_case; use rpc_state_reader::rpc_state::*; +#[derive(Debug)] pub struct RpcStateReader(RpcState); impl StateReader for RpcStateReader { fn get_contract_class(&self, class_hash: &ClassHash) -> Result { let hash = SNClassHash(StarkHash::new(*class_hash).unwrap()); - Ok(CompiledClass::from(self.0.get_contract_class(&hash))) + Ok(CompiledClass::from( + self.0.get_contract_class(&hash).unwrap(), + )) } fn get_class_hash_at(&self, contract_address: &Address) -> Result { @@ -84,10 +87,12 @@ impl StateReader for RpcStateReader { } #[allow(unused)] -pub fn execute_tx( +pub fn execute_tx_configurable( tx_hash: &str, network: RpcChain, block_number: BlockNumber, + skip_validate: bool, + skip_nonce_check: bool, ) -> ( TransactionExecutionInfo, TransactionTrace, @@ -135,9 +140,79 @@ pub fn execute_tx( // Get transaction before giving ownership of the reader let tx_hash = TransactionHash(stark_felt!(tx_hash)); let tx = match rpc_reader.0.get_transaction(&tx_hash) { - SNTransaction::Invoke(tx) => Transaction::InvokeFunction( - InvokeFunction::from_invoke_transaction(tx, chain_id).unwrap(), - ), + SNTransaction::Invoke(tx) => InvokeFunction::from_invoke_transaction(tx, chain_id) + .unwrap() + .create_for_simulation(skip_validate, false, false, false, skip_nonce_check), + SNTransaction::DeployAccount(tx) => { + DeployAccount::from_sn_api_transaction(tx, chain_id.to_felt()) + .unwrap() + .create_for_simulation(skip_validate, false, false, false) + } + SNTransaction::Declare(tx) => { + // Fetch the contract_class from the next block (as we don't have it in the previous one) + let next_block_state_reader = + RpcStateReader(RpcState::new_infura(network, (block_number.next()).into())); + let contract_class = next_block_state_reader + .get_contract_class(tx.class_hash().0.bytes().try_into().unwrap()) + .unwrap(); + + if tx.version() != TransactionVersion(2_u8.into()) { + let contract_class = match contract_class { + CompiledClass::Deprecated(cc) => cc.as_ref().clone(), + _ => unreachable!(), + }; + + let declare = Declare::new_with_tx_and_class_hash( + contract_class, + Address(Felt252::from_bytes_be(tx.sender_address().0.key().bytes())), + tx.max_fee().0, + Felt252::from_bytes_be(tx.version().0.bytes()), + tx.signature() + .0 + .iter() + .map(|f| Felt252::from_bytes_be(f.bytes())) + .collect(), + Felt252::from_bytes_be(tx.nonce().0.bytes()), + Felt252::from_bytes_be(tx_hash.0.bytes()), + tx.class_hash().0.bytes().try_into().unwrap(), + ) + .unwrap(); + declare.create_for_simulation(skip_validate, false, false, false) + } else { + let contract_class = match contract_class { + CompiledClass::Casm(cc) => cc.as_ref().clone(), + _ => unreachable!(), + }; + + let compiled_class_hash = compute_casm_class_hash(&contract_class).unwrap(); + + let declare = DeclareV2::new_with_sierra_class_hash_and_tx_hash( + None, + Felt252::from_bytes_be(tx.class_hash().0.bytes()), + Some(contract_class), + compiled_class_hash, + Address(Felt252::from_bytes_be(tx.sender_address().0.key().bytes())), + tx.max_fee().0, + Felt252::from_bytes_be(tx.version().0.bytes()), + tx.signature() + .0 + .iter() + .map(|f| Felt252::from_bytes_be(f.bytes())) + .collect(), + Felt252::from_bytes_be(tx.nonce().0.bytes()), + Felt252::from_bytes_be(tx_hash.0.bytes()), + ) + .unwrap(); + declare.create_for_simulation(skip_validate, false, false, false) + } + } + SNTransaction::L1Handler(tx) => L1Handler::from_sn_api_tx( + tx, + Felt252::from_bytes_be(tx_hash.0.bytes()), + Some(Felt252::from(u128::MAX)), + ) + .unwrap() + .create_for_simulation(skip_validate, false), _ => unimplemented!(), }; @@ -166,6 +241,30 @@ pub fn execute_tx( ) } +pub fn execute_tx( + tx_hash: &str, + network: RpcChain, + block_number: BlockNumber, +) -> ( + TransactionExecutionInfo, + TransactionTrace, + RpcTransactionReceipt, +) { + execute_tx_configurable(tx_hash, network, block_number, false, false) +} + +pub fn execute_tx_without_validate( + tx_hash: &str, + network: RpcChain, + block_number: BlockNumber, +) -> ( + TransactionExecutionInfo, + TransactionTrace, + RpcTransactionReceipt, +) { + execute_tx_configurable(tx_hash, network, block_number, true, true) +} + #[test] fn test_get_transaction_try_from() { let rpc_state = RpcState::new_infura(RpcChain::MainNet, BlockTag::Latest.into()); @@ -243,6 +342,51 @@ fn test_get_gas_price() { 186551, // real block 186552 RpcChain::MainNet )] +#[test_case( + "0x176a92e8df0128d47f24eebc17174363457a956fa233cc6a7f8561bfbd5023a", + 317092, // real block 317093 + RpcChain::MainNet +)] +#[test_case( + "0x1cbc74e101a1533082a021ce53235cfd744899b0ff948d1949a64646e0f15c2", + 885298, // real block 885299 + RpcChain::TestNet +)] +#[test_case( + "0x5a5de1f42f6005f3511ea6099daed9bcbcf9de334ee714e8563977e25f71601", + 281513, // real block 281514 + RpcChain::MainNet +)] +#[test_case( + "0x26be3e906db66973de1ca5eec1ddb4f30e3087dbdce9560778937071c3d3a83", + 351268, // real block 351269 + RpcChain::MainNet +)] +#[test_case( + "0x4f552c9430bd21ad300db56c8f4cae45d554a18fac20bf1703f180fac587d7e", + 351225, // real block 351226 + RpcChain::MainNet +)] +// DeployAccount for different account providers (as of October 2023): +// All of them were deployed on testnet using starkli +// OpenZeppelin (v0.7.0) +#[test_case( + "0x0012696c03a0f0301af190288d9824583be813b71882308e4c5d686bf5967ec5", + 889866, // real block 889867 + RpcChain::TestNet +)] +// Braavos (v3.21.10) +#[test_case( + "0x04dc838fd4ed265ab2ea5fbab08e67b398e3caaedf75c548113c6b2f995fc9db", + 889858, // real block 889859 + RpcChain::TestNet +)] +// Argent X (v5.7.0) +#[test_case( + "0x01583c47a929f81f6a8c74d31708a7f161603893435d51b6897017fdcdaafee4", + 889897, // real block 889898 + RpcChain::TestNet +)] fn starknet_in_rust_test_case_tx(hash: &str, block_number: u64, chain: RpcChain) { let (tx_info, trace, receipt) = execute_tx(hash, chain, BlockNumber(block_number)); @@ -260,12 +404,14 @@ fn starknet_in_rust_test_case_tx(hash: &str, block_number: u64, chain: RpcChain) // check Cairo VM execution resources assert_eq_sorted!( - execution_resources, - trace - .function_invocation - .as_ref() - .unwrap() - .execution_resources, + execution_resources.as_ref(), + Some( + &trace + .function_invocation + .as_ref() + .unwrap() + .execution_resources + ), "execution resources mismatch" ); @@ -356,3 +502,52 @@ fn starknet_in_rust_test_case_reverted_tx(hash: &str, block_number: u64, chain: ); } } + +#[test_case( + "0x038c307a0a324dc92778820f2c6317f40157c06b12a7e537f7a16b2c015f64e7", + 274333-1, + RpcChain::MainNet +)] +fn test_validate_fee(hash: &str, block_number: u64, chain: RpcChain) { + let (tx_info, _trace, receipt) = execute_tx(hash, chain, BlockNumber(block_number)); + let (tx_info_without_fee, _trace, _receipt) = + execute_tx_without_validate(hash, chain, BlockNumber(block_number)); + + assert_eq!(tx_info.actual_fee, receipt.actual_fee); + assert!(tx_info_without_fee.actual_fee < tx_info.actual_fee); +} + +#[test_case( + // Declare tx + "0x60506c49e65d84e2cdd0e9142dc43832a0a59cb6a9cbcce1ab4f57c20ba4afb", + 347899, // real block 347900 + RpcChain::MainNet +)] +#[test_case( + // Declare tx + "0x1088aa18785779e1e8eef406dc495654ad42a9729b57969ad0dbf2189c40bee", + 271887, // real block 271888 + RpcChain::MainNet +)] +fn starknet_in_rust_test_case_declare_tx(hash: &str, block_number: u64, chain: RpcChain) { + let (tx_info, _trace, receipt) = execute_tx(hash, chain, BlockNumber(block_number)); + let TransactionExecutionInfo { + call_info, + actual_fee, + .. + } = tx_info; + + assert!(call_info.is_none()); + + let actual_fee = actual_fee; + if receipt.actual_fee != actual_fee { + let diff = 100 * receipt.actual_fee.abs_diff(actual_fee) / receipt.actual_fee; + + if diff >= 5 { + assert_eq!( + actual_fee, receipt.actual_fee, + "actual_fee mismatch differs from the baseline by more than 5% ({diff}%)", + ); + } + } +} diff --git a/rust-toolchain b/rust-toolchain index 2d24a1e07..baa36b056 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,4 +1,4 @@ [toolchain] -channel = "1.70.0" +channel = "1.72.1" components = ["rustfmt", "clippy"] profile = "minimal" diff --git a/src/core/contract_address/casm_contract_address.rs b/src/core/contract_address/casm_contract_address.rs index 537146e23..23dc701e8 100644 --- a/src/core/contract_address/casm_contract_address.rs +++ b/src/core/contract_address/casm_contract_address.rs @@ -112,7 +112,7 @@ mod tests { let expected_result; #[cfg(not(feature = "cairo_1_tests"))] { - file = File::open("starknet_programs/cairo2/contract_a.casm").unwrap(); + file = File::open("starknet_programs/raw_contract_classes/321aadcf42b0a4ad905616598d16c42fa9b87c812dc398e49b57bf77930629f.casm").unwrap(); expected_result = felt_str!( "321aadcf42b0a4ad905616598d16c42fa9b87c812dc398e49b57bf77930629f", 16 @@ -144,7 +144,7 @@ mod tests { let expected_result; #[cfg(not(feature = "cairo_1_tests"))] { - file = File::open("starknet_programs/cairo2/deploy.casm").unwrap(); + file = File::open("starknet_programs/raw_contract_classes/53ad3bfb13f39cf1a9940108be4f9c6a8d9cc48a59d5f9b3c73432f877f8cf0.casm").unwrap(); expected_result = felt_str!( "53ad3bfb13f39cf1a9940108be4f9c6a8d9cc48a59d5f9b3c73432f877f8cf0", 16 @@ -177,7 +177,7 @@ mod tests { let expected_result; #[cfg(not(feature = "cairo_1_tests"))] { - file = File::open("starknet_programs/cairo2/fibonacci.casm").unwrap(); + file = File::open("starknet_programs/raw_contract_classes/6638ce6c9bf336d1781a388668fa2206d928df5d1fa6b92e4cb41004c7e3f89.casm").unwrap(); expected_result = felt_str!( "6638ce6c9bf336d1781a388668fa2206d928df5d1fa6b92e4cb41004c7e3f89", 16 @@ -210,7 +210,7 @@ mod tests { let expected_result; #[cfg(not(feature = "cairo_1_tests"))] { - file = File::open("starknet_programs/cairo2/factorial.casm").unwrap(); + file = File::open("starknet_programs/raw_contract_classes/7c48d040ceb3183837a0aff2adf33d879f790e202eb2c4b8622005c12252641.casm").unwrap(); expected_result = felt_str!( "7c48d040ceb3183837a0aff2adf33d879f790e202eb2c4b8622005c12252641", 16 @@ -243,7 +243,7 @@ mod tests { let expected_result; #[cfg(not(feature = "cairo_1_tests"))] { - file = File::open("starknet_programs/cairo2/emit_event.casm").unwrap(); + file = File::open("starknet_programs/raw_contract_classes/3010533bd60cb0e70ac1bf776e171713f0e5229a084989d3894c171c160ace2.casm").unwrap(); expected_result = felt_str!( "3010533bd60cb0e70ac1bf776e171713f0e5229a084989d3894c171c160ace2", 16 @@ -271,7 +271,7 @@ mod tests { #[test] fn test_declare_tx_class_hash() { - let file = File::open("starknet_programs/cairo2/events.casm").unwrap(); + let file = File::open("starknet_programs/raw_contract_classes/0x472a8c75c832b112ac174abc3b46e7e79464ad52ecdad80079ddfe486ca5eef.casm").unwrap(); let reader = BufReader::new(file); let contract_class: CasmContractClass = serde_json::from_reader(reader).unwrap(); diff --git a/src/core/contract_address/deprecated_contract_address.rs b/src/core/contract_address/deprecated_contract_address.rs index 325902d45..07e7e2911 100644 --- a/src/core/contract_address/deprecated_contract_address.rs +++ b/src/core/contract_address/deprecated_contract_address.rs @@ -158,7 +158,7 @@ impl serde_json::ser::Formatter for PythonDefaultFormatter { } else { let buf = c.encode_utf16(&mut buf); for i in buf { - write!(writer, r"\u{:4x}", i)?; + write!(writer, r"\u{:04x}", i)?; } } } diff --git a/src/core/contract_address/sierra_contract_address.rs b/src/core/contract_address/sierra_contract_address.rs index 1bbcfb1e9..a4df995c2 100644 --- a/src/core/contract_address/sierra_contract_address.rs +++ b/src/core/contract_address/sierra_contract_address.rs @@ -4,7 +4,10 @@ use cairo_lang_starknet::{ contract_class::{ContractClass as SierraContractClass, ContractEntryPoint}, }; use cairo_vm::felt::Felt252; +use serde::Serialize; +use serde_json::ser::Formatter; use starknet_crypto::{poseidon_hash_many, FieldElement, PoseidonHasher}; +use std::io::{self, Cursor}; const CONTRACT_CLASS_VERSION: &[u8] = b"CONTRACT_CLASS_V0.1.0"; @@ -60,14 +63,22 @@ pub fn compute_sierra_class_hash( hasher.update(constructors); // Hash abi - let abi = serde_json_pythonic::to_string_pythonic( - &contract_class + let abi = { + let mut buf = Cursor::new(Vec::new()); + let mut fmt = serde_json::Serializer::with_formatter(&mut buf, PythonJsonFormatter); + + contract_class .abi .as_ref() .ok_or(ContractAddressError::MissingAbi)? - .items, - ) - .map_err(|_| ContractAddressError::MissingAbi)?; + .items + .serialize(&mut fmt) + .map_err(|_| ContractAddressError::MissingAbi)?; + + // Note: The following unwrap should never be triggered as long as serde_json generates + // UTF-8 encoded data, which in practice means it should never panic. + String::from_utf8(buf.into_inner()).unwrap() + }; let abi_hash = FieldElement::from_byte_slice_be(&starknet_keccak(abi.as_bytes()).to_bytes_be()) .map_err(|_err| { @@ -126,7 +137,8 @@ mod tests { /// Test the correctness of the compute_sierra_class_hash function for a specific testnet contract. #[test] fn test_declare_tx_from_testnet() { - let file = File::open("starknet_programs/cairo2/events.sierra").unwrap(); + let file = File::open("starknet_programs/raw_contract_classes/0x113bf26d112a164297e04381212c9bd7409f07591f0a04f539bdf56693eaaf3.sierra").unwrap(); + // 0x113bf26d112a164297e04381212c9bd7409f07591f0a04f539bdf56693eaaf3 let reader = BufReader::new(file); let sierra_contract_class: SierraContractClass = serde_json::from_reader(reader).unwrap(); @@ -142,3 +154,56 @@ mod tests { ) } } + +struct PythonJsonFormatter; + +impl Formatter for PythonJsonFormatter { + fn begin_array_value(&mut self, writer: &mut W, first: bool) -> io::Result<()> + where + W: ?Sized + io::Write, + { + if first { + Ok(()) + } else { + writer.write_all(b", ") + } + } + + fn begin_object_key(&mut self, writer: &mut W, first: bool) -> io::Result<()> + where + W: ?Sized + io::Write, + { + if first { + Ok(()) + } else { + writer.write_all(b", ") + } + } + + fn begin_object_value(&mut self, writer: &mut W) -> io::Result<()> + where + W: ?Sized + io::Write, + { + writer.write_all(b": ") + } + + fn write_string_fragment(&mut self, writer: &mut W, fragment: &str) -> io::Result<()> + where + W: ?Sized + io::Write, + { + let mut buf = [0, 0]; + + for c in fragment.chars() { + if c.is_ascii() { + writer.write_all(&[c as u8])?; + } else { + let buf = c.encode_utf16(&mut buf); + for i in buf { + write!(writer, r"\u{i:04x}")?; + } + } + } + + Ok(()) + } +} diff --git a/src/core/errors/state_errors.rs b/src/core/errors/state_errors.rs index 7d6b3aa89..ba09e3e51 100644 --- a/src/core/errors/state_errors.rs +++ b/src/core/errors/state_errors.rs @@ -48,4 +48,6 @@ pub enum StateError { CustomError(String), #[error(transparent)] ByteArray(#[from] FromByteArrayError), + #[error("Failed to read contract class cache")] + FailedToReadContractClassCache, } diff --git a/src/definitions/constants.rs b/src/definitions/constants.rs index 77bf941c9..4087af325 100644 --- a/src/definitions/constants.rs +++ b/src/definitions/constants.rs @@ -7,7 +7,7 @@ use std::collections::HashMap; pub(crate) const L2_TO_L1_MSG_HEADER_SIZE: usize = 3; pub(crate) const L1_TO_L2_MSG_HEADER_SIZE: usize = 5; -pub(crate) const DEPLOYMENT_INFO_SIZE: usize = 2; +pub(crate) const CLASS_UPDATE_SIZE: usize = 1; pub(crate) const CONSUMED_MSG_TO_L2_N_TOPICS: usize = 3; pub(crate) const LOG_MSG_TO_L1_N_TOPICS: usize = 2; pub(crate) const N_DEFAULT_TOPICS: usize = 1; // Events have one default topic. @@ -37,9 +37,9 @@ lazy_static! { 0.into(), 1.into(), 2.into(), - &0.into() | &QUERY_VERSION_BASE.clone(), - &1.into() | &QUERY_VERSION_BASE.clone(), - &2.into() | &QUERY_VERSION_BASE.clone(), + &Into::::into(0) | &QUERY_VERSION_BASE.clone(), + &Into::::into(1) | &QUERY_VERSION_BASE.clone(), + &Into::::into(2) | &QUERY_VERSION_BASE.clone(), ]; } diff --git a/src/execution/execution_entry_point.rs b/src/execution/execution_entry_point.rs index 30c86cc91..c13994ca9 100644 --- a/src/execution/execution_entry_point.rs +++ b/src/execution/execution_entry_point.rs @@ -13,7 +13,7 @@ use crate::{ contract_class_cache::ContractClassCache, contract_storage_state::ContractStorageState, state_api::{State, StateReader}, - ExecutionResourcesManager, + ExecutionResourcesManager, StateDiff, }, syscalls::{ business_logic_syscall_handler::BusinessLogicSyscallHandler, @@ -41,6 +41,16 @@ use cairo_vm::{ }; use std::sync::Arc; +#[cfg(feature = "cairo-native")] +use { + crate::syscalls::native_syscall_handler::NativeSyscallHandler, + cairo_native::{ + context::NativeContext, execution_result::NativeExecutionResult, executor::NativeExecutor, + metadata::syscall_handler::SyscallHandlerMeta, utils::felt252_bigint, + }, + serde_json::Value, +}; + #[derive(Debug, Default)] pub struct ExecutionResult { pub call_info: Option, @@ -146,6 +156,45 @@ impl ExecutionEntryPoint { return Err(e); } + let n_reverted_steps = + (max_steps as usize) - resources_manager.cairo_usage.n_steps; + Ok(ExecutionResult { + call_info: None, + revert_error: Some(e.to_string()), + n_reverted_steps, + }) + } + } + } + CompiledClass::Sierra(sierra_contract_class) => { + let mut transactional_state = state.create_transactional()?; + + match self.native_execute( + &mut transactional_state, + sierra_contract_class, + tx_execution_context, + block_context, + ) { + Ok(call_info) => { + state.apply_state_update(&StateDiff::from_cached_state( + transactional_state, + )?)?; + + Ok(ExecutionResult { + call_info: Some(call_info), + revert_error: None, + n_reverted_steps: 0, + }) + } + Err(e) => { + if !support_reverted { + state.apply_state_update(&StateDiff::from_cached_state( + transactional_state, + )?)?; + + return Err(e); + } + let n_reverted_steps = (max_steps as usize) - resources_manager.cairo_usage.n_steps; Ok(ExecutionResult { @@ -174,15 +223,15 @@ impl ExecutionEntryPoint { let mut default_entry_point = None; let entry_point = entry_points .iter() - .filter_map(|x| { + .filter(|x| { if x.selector() == &*DEFAULT_ENTRY_POINT_SELECTOR { - default_entry_point = Some(x); + default_entry_point = Some(*x); } - (x.selector() == &self.entry_point_selector).then_some(x) + x.selector() == &self.entry_point_selector }) - .fold(Ok(None), |acc, x| match acc { - Ok(None) => Ok(Some(x)), + .try_fold(None, |acc, x| match acc { + None => Ok(Some(x)), _ => Err(TransactionError::NonUniqueEntryPoint), })?; @@ -206,15 +255,15 @@ impl ExecutionEntryPoint { let mut default_entry_point = None; let entry_point = entry_points .iter() - .filter_map(|x| { + .filter(|x| { if x.selector == DEFAULT_ENTRY_POINT_SELECTOR.to_biguint() { - default_entry_point = Some(x); + default_entry_point = Some(*x); } - (x.selector == self.entry_point_selector.to_biguint()).then_some(x) + x.selector == self.entry_point_selector.to_biguint() }) - .fold(Ok(None), |acc, x| match acc { - Ok(None) => Ok(Some(x)), + .try_fold(None, |acc, x| match acc { + None => Ok(Some(x)), _ => Err(TransactionError::NonUniqueEntryPoint), })?; entry_point @@ -245,7 +294,7 @@ impl ExecutionEntryPoint { entry_point_type: Some(self.entry_point_type), calldata: self.calldata.clone(), retdata, - execution_resources: execution_resources.filter_unused_builtins(), + execution_resources: Some(execution_resources.filter_unused_builtins()), events, l2_to_l1_messages, storage_read_values: starknet_storage_state.read_values, @@ -282,7 +331,7 @@ impl ExecutionEntryPoint { .iter() .map(|n| n.get_int_ref().cloned().unwrap_or_default()) .collect(), - execution_resources: execution_resources.filter_unused_builtins(), + execution_resources: Some(execution_resources.filter_unused_builtins()), events, l2_to_l1_messages, storage_read_values: starknet_storage_state.read_values, @@ -569,4 +618,183 @@ impl ExecutionEntryPoint { call_result, ) } + + #[cfg(not(feature = "cairo-native"))] + #[inline(always)] + fn native_execute( + &self, + _state: &mut CachedState, + _contract_class: Arc, + _tx_execution_context: &mut TransactionExecutionContext, + _block_context: &BlockContext, + ) -> Result { + Err(TransactionError::SierraCompileError( + "This version of SiR was compiled without the Cairo Native feature".to_string(), + )) + } + + #[cfg(feature = "cairo-native")] + #[inline(always)] + fn native_execute( + &self, + state: &mut CachedState, + contract_class: Arc, + tx_execution_context: &TransactionExecutionContext, + block_context: &BlockContext, + ) -> Result { + use cairo_lang_sierra::{ + extensions::core::{CoreLibfunc, CoreType, CoreTypeConcrete}, + program_registry::ProgramRegistry, + }; + use serde_json::json; + + use crate::syscalls::business_logic_syscall_handler::SYSCALL_BASE; + + let entry_point = match self.entry_point_type { + EntryPointType::External => contract_class + .entry_points_by_type + .external + .iter() + .find(|entry_point| entry_point.selector == self.entry_point_selector.to_biguint()) + .unwrap(), + EntryPointType::Constructor => contract_class + .entry_points_by_type + .constructor + .iter() + .find(|entry_point| entry_point.selector == self.entry_point_selector.to_biguint()) + .unwrap(), + EntryPointType::L1Handler => contract_class + .entry_points_by_type + .l1_handler + .iter() + .find(|entry_point| entry_point.selector == self.entry_point_selector.to_biguint()) + .unwrap(), + }; + + let sierra_program = contract_class.extract_sierra_program().unwrap(); + let program_registry: ProgramRegistry = + ProgramRegistry::new(&sierra_program).unwrap(); + + let native_context = NativeContext::new(); + let mut native_program = native_context.compile(&sierra_program).unwrap(); + let contract_storage_state = + ContractStorageState::new(state, self.contract_address.clone()); + + let syscall_handler = NativeSyscallHandler { + starknet_storage_state: contract_storage_state, + events: Vec::new(), + l2_to_l1_messages: Vec::new(), + contract_address: self.contract_address.clone(), + internal_calls: Vec::new(), + caller_address: self.caller_address.clone(), + entry_point_selector: self.entry_point_selector.clone(), + tx_execution_context: tx_execution_context.clone(), + block_context: block_context.clone(), + resources_manager: Default::default(), + }; + + native_program + .insert_metadata(SyscallHandlerMeta::new(&syscall_handler)) + .unwrap(); + + let syscall_addr = native_program + .get_metadata::() + .unwrap() + .as_ptr() + .as_ptr() as *const () as usize; + + let entry_point_fn = &sierra_program + .funcs + .iter() + .find(|x| x.id.id == (entry_point.function_idx as u64)) + .unwrap(); + let ret_types: Vec<&CoreTypeConcrete> = entry_point_fn + .signature + .ret_types + .iter() + .map(|x| program_registry.get_type(x).unwrap()) + .collect(); + let entry_point_id = &entry_point_fn.id; + + let required_init_gas = native_program.get_required_init_gas(entry_point_id); + + let calldata: Vec<_> = self + .calldata + .iter() + .map(|felt| felt252_bigint(felt.to_bigint())) + .collect(); + + /* + Below we construct `params`, the Serde value that MLIR expects. It consists of the following: + + - One `null` value for each builtin that is going to be used. + - The maximum amout of gas allowed by the call. + - `syscall_addr`, the address of the syscall handler. + - `calldata`, an array of Felt arguments to the method being called. + */ + + let wrapped_calldata = vec![calldata]; + let params: Vec = sierra_program.funcs[entry_point_id.id as usize] + .params + .iter() + .map(|param| { + match param.ty.debug_name.as_ref().unwrap().as_str() { + "GasBuiltin" => { + json!(self.initial_gas) + } + "Pedersen" | "SegmentArena" | "RangeCheck" | "Bitwise" | "Poseidon" => { + json!(null) + } + "System" => { + json!(syscall_addr) + } + // calldata + "core::array::Span::" => json!(wrapped_calldata), + x => { + unimplemented!("unhandled param type: {:?}", x); + } + } + }) + .collect(); + + let mut writer: Vec = Vec::new(); + let returns = &mut serde_json::Serializer::new(&mut writer); + + let native_executor = NativeExecutor::new(native_program); + + native_executor + .execute(entry_point_id, json!(params), returns, required_init_gas) + .map_err(|e| TransactionError::CustomError(format!("cairo-native error: {:?}", e)))?; + + let value = NativeExecutionResult::deserialize_from_ret_types( + &mut serde_json::Deserializer::from_slice(&writer), + &ret_types, + ) + .expect("failed to serialize starknet execution result"); + + Ok(CallInfo { + caller_address: self.caller_address.clone(), + call_type: Some(self.call_type.clone()), + contract_address: self.contract_address.clone(), + code_address: self.code_address.clone(), + class_hash: Some( + self.get_code_class_hash(syscall_handler.starknet_storage_state.state)?, + ), + entry_point_selector: Some(self.entry_point_selector.clone()), + entry_point_type: Some(self.entry_point_type), + calldata: self.calldata.clone(), + retdata: value.return_values, + execution_resources: None, + events: syscall_handler.events, + storage_read_values: syscall_handler.starknet_storage_state.read_values, + accessed_storage_keys: syscall_handler.starknet_storage_state.accessed_keys, + failure_flag: value.failure_flag, + l2_to_l1_messages: syscall_handler.l2_to_l1_messages, + internal_calls: syscall_handler.internal_calls, + gas_consumed: self + .initial_gas + .saturating_sub(SYSCALL_BASE) + .saturating_sub(value.remaining_gas), + }) + } } diff --git a/src/execution/gas_usage.rs b/src/execution/gas_usage.rs index f0d254dc7..85e26a90a 100644 --- a/src/execution/gas_usage.rs +++ b/src/execution/gas_usage.rs @@ -1,6 +1,7 @@ use crate::definitions::constants::*; use crate::execution::L2toL1MessageInfo; use crate::services::eth_definitions::eth_gas_constants::*; +use crate::state::state_api::StateChangesCount; /// Estimates L1 gas usage by Starknet's update state and the verifier /// @@ -19,16 +20,13 @@ use crate::services::eth_definitions::eth_gas_constants::*; /// The estimation of L1 gas usage as a `usize` value. pub fn calculate_tx_gas_usage( l2_to_l1_messages: Vec, - n_modified_contracts: usize, - n_storage_changes: usize, + state_changes: &StateChangesCount, l1_handler_payload_size: Option, - n_deployments: usize, ) -> usize { let residual_message_segment_length = get_message_segment_lenght(&l2_to_l1_messages, l1_handler_payload_size); - let residual_onchain_data_segment_length = - get_onchain_data_segment_length(n_modified_contracts, n_storage_changes, n_deployments); + let residual_onchain_data_segment_length = get_onchain_data_segment_length(state_changes); let n_l2_to_l1_messages = l2_to_l1_messages.len(); let n_l1_to_l2_messages = match l1_handler_payload_size { @@ -95,22 +93,18 @@ pub fn get_message_segment_lenght( } /// Calculates the amount of `felt252` added to the output message's segment by the given operations. -/// -/// # Parameters: -/// -/// - `n_modified_contracts`: The number of contracts modified by the transaction. -/// - `n_storage_changes`: The number of storage changes made by the transaction. -/// - `n_deployments`: The number of contracts deployed by the transaction. -/// -/// # Returns: -/// -/// The on-chain data segment length -pub const fn get_onchain_data_segment_length( - n_modified_contracts: usize, - n_storage_changes: usize, - n_deployments: usize, -) -> usize { - n_modified_contracts * 2 + n_storage_changes * 2 + n_deployments * DEPLOYMENT_INFO_SIZE +pub const fn get_onchain_data_segment_length(state_changes: &StateChangesCount) -> usize { + // For each newly modified contract: + // contract address (1 word). + // + 1 word with the following info: A flag indicating whether the class hash was updated, the + // number of entry updates, and the new nonce. + state_changes.n_modified_contracts * 2 + // For each class updated (through a deploy or a class replacement). + + state_changes.n_class_hash_updates * CLASS_UPDATE_SIZE + // For each modified storage cell: key, new value. + + state_changes.n_storage_updates * 2 + // For each compiled class updated (through declare): class_hash, compiled_class_hash + + state_changes.n_compiled_class_hash_updates * 2 } /// Calculates the cost of ConsumedMessageToL2 event emissions caused by an L1 handler with the given @@ -261,8 +255,17 @@ mod test { let message2 = L2toL1MessageInfo::new(ord_ev2, Address(1235.into())); assert_eq!( - calculate_tx_gas_usage(vec![message1, message2], 2, 2, Some(2), 1), - 77051 + calculate_tx_gas_usage( + vec![message1, message2], + &StateChangesCount { + n_storage_updates: 2, + n_class_hash_updates: 1, + n_compiled_class_hash_updates: 0, + n_modified_contracts: 2 + }, + Some(2) + ), + 76439 ) } } diff --git a/src/execution/mod.rs b/src/execution/mod.rs index 9fed18a67..5c9774517 100644 --- a/src/execution/mod.rs +++ b/src/execution/mod.rs @@ -43,7 +43,7 @@ pub struct CallInfo { pub entry_point_type: Option, pub calldata: Vec, pub retdata: Vec, - pub execution_resources: ExecutionResources, + pub execution_resources: Option, pub events: Vec, pub l2_to_l1_messages: Vec, pub storage_read_values: Vec, @@ -73,11 +73,11 @@ impl CallInfo { entry_point_type, calldata: Vec::new(), retdata: Vec::new(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 0, builtin_instance_counter: HashMap::new(), n_memory_holes: 0, - }, + }), events: Vec::new(), l2_to_l1_messages: Vec::new(), storage_read_values: Vec::new(), @@ -238,11 +238,11 @@ impl Default for CallInfo { l2_to_l1_messages: Vec::new(), accessed_storage_keys: HashSet::new(), calldata: Vec::new(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 0, n_memory_holes: 0, builtin_instance_counter: HashMap::new(), - }, + }), events: Vec::new(), gas_consumed: 0, failure_flag: false, @@ -291,7 +291,7 @@ impl<'de> Deserialize<'de> for CallInfo { } Ok(CallInfo { - execution_resources, + execution_resources: Some(execution_resources), retdata, calldata, internal_calls, @@ -370,6 +370,7 @@ pub struct TransactionExecutionContext { pub(crate) nonce: Felt252, pub(crate) n_sent_messages: usize, pub(crate) _n_steps: u64, + // pub(crate) use_cairo_native: bool, } impl TransactionExecutionContext { diff --git a/src/lib.rs b/src/lib.rs index b14dfc402..205b218a3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -436,9 +436,10 @@ mod test { let block_context = BlockContext::default(); let Transaction::InvokeFunction(simul_invoke) = - invoke.create_for_simulation(true, false, false, false, false) else { - unreachable!() - }; + invoke.create_for_simulation(true, false, false, false, false) + else { + unreachable!() + }; let call_info = simul_invoke .run_validate_entrypoint( @@ -711,7 +712,7 @@ mod test { simulate_transaction( &[&internal_deploy], - state.clone(), + state.clone_for_testing(), state.contract_class_cache().clone(), block_context, 100_000_000, @@ -752,7 +753,7 @@ mod test { simulate_transaction( &[&declare_tx], - state.clone(), + state.clone_for_testing(), state.contract_class_cache().clone(), block_context, 100_000_000, @@ -820,7 +821,7 @@ mod test { simulate_transaction( &[&invoke_tx], - state.clone(), + state.clone_for_testing(), state.contract_class_cache().clone(), &block_context, 100_000_000, @@ -867,7 +868,7 @@ mod test { simulate_transaction( &[&deploy_account_tx], - state.clone(), + state.clone_for_testing(), state.contract_class_cache().clone(), block_context, 100_000_000, @@ -896,7 +897,7 @@ mod test { nonce: 0.into(), hash_value: 0.into(), compiled_class_hash: TEST_FIB_COMPILED_CONTRACT_CLASS_HASH.clone(), - sierra_contract_class, + sierra_contract_class: Some(sierra_contract_class), sierra_class_hash, casm_class: Default::default(), skip_execute: false, @@ -912,7 +913,7 @@ mod test { simulate_transaction( &[&declare_tx], - state.clone(), + state.clone_for_testing(), state.contract_class_cache().clone(), &block_context, 100_000_000, @@ -981,7 +982,7 @@ mod test { simulate_transaction( &[&l1_handler_tx], - state.clone(), + state.clone_for_testing(), state.contract_class_cache().clone(), &block_context, 100_000_000, @@ -1042,7 +1043,7 @@ mod test { simulate_transaction( &[&deploy, &invoke_tx], - state.clone(), + state.clone_for_testing(), state.contract_class_cache().clone(), block_context, 100_000_000, @@ -1056,7 +1057,7 @@ mod test { assert_eq!( estimate_fee(&[deploy, invoke_tx], state, block_context,).unwrap(), - [(0, 2448), (0, 2448)] + [(0, 1836), (0, 2448)] ); } @@ -1081,4 +1082,119 @@ mod test { ) ); } + + #[test] + fn test_simulate_declare_v1_compare_fees() { + // accounts contract class must be stored before running declaration of fibonacci + let contract_class = ContractClass::from_path("starknet_programs/Account.json").unwrap(); + + // Instantiate CachedState + let contract_class_cache = PermanentContractClassCache::default(); + + // ------------ contract data -------------------- + let hash = compute_deprecated_class_hash(&contract_class).unwrap(); + let class_hash = hash.to_be_bytes(); + + contract_class_cache.set_contract_class( + class_hash, + CompiledClass::Deprecated(Arc::new(contract_class)), + ); + + // store sender_address + let sender_address = Address(1.into()); + // this is not conceptually correct as the sender address would be an + // Account contract (not the contract that we are currently declaring) + // but for testing reasons its ok + + let mut state_reader = InMemoryStateReader::default(); + state_reader + .address_to_class_hash_mut() + .insert(sender_address.clone(), class_hash); + state_reader + .address_to_nonce_mut() + .insert(sender_address.clone(), Felt252::new(1)); + + let mut state = CachedState::new(Arc::new(state_reader), Arc::new(contract_class_cache)); + // Insert pubkey storage var to pass validation + let storage_entry = &( + sender_address, + felt_str!( + "1672321442399497129215646424919402195095307045612040218489019266998007191460" + ) + .to_be_bytes(), + ); + state.set_storage_at( + storage_entry, + felt_str!( + "1735102664668487605176656616876767369909409133946409161569774794110049207117" + ), + ); + + //* --------------------------------------- + //* Test declare with previous data + //* --------------------------------------- + + let fib_contract_class = + ContractClass::from_path("starknet_programs/fibonacci.json").unwrap(); + + let chain_id = StarknetChainId::TestNet.to_felt(); + + // declare tx + // Signature & tx hash values are hand-picked for account validations to pass + let mut declare = Declare::new( + fib_contract_class, + chain_id, + Address(Felt252::one()), + 60000, + 1.into(), + vec![ + felt_str!( + "3086480810278599376317923499561306189851900463386393948998357832163236918254" + ), + felt_str!( + "598673427589502599949712887611119751108407514580626464031881322743364689811" + ), + ], + Felt252::one(), + ) + .unwrap(); + declare.hash_value = felt_str!("2718"); + + let mut block_context = BlockContext::default(); + block_context.starknet_os_config_mut().gas_price = 12; + + let declare_tx = Transaction::Declare(declare); + + let without_validate_fee = simulate_transaction( + &[&declare_tx], + state.clone_for_testing(), + state.clone_for_testing().contract_class_cache().clone(), + &block_context, + 100_000_000, + true, + false, + true, + false, + false, + ) + .unwrap()[0] + .actual_fee; + + let with_validate_fee = simulate_transaction( + &[&declare_tx], + state.clone_for_testing(), + state.contract_class_cache().clone(), + &block_context, + 100_000_000, + false, + false, + true, + false, + false, + ) + .unwrap()[0] + .actual_fee; + + assert!(with_validate_fee > without_validate_fee) + } } diff --git a/src/services/api/contract_classes/compiled_class.rs b/src/services/api/contract_classes/compiled_class.rs index 035a96fbb..26b56281f 100644 --- a/src/services/api/contract_classes/compiled_class.rs +++ b/src/services/api/contract_classes/compiled_class.rs @@ -24,6 +24,7 @@ use starknet::core::types::ContractClass::{Legacy, Sierra}; pub enum CompiledClass { Deprecated(Arc), Casm(Arc), + Sierra(Arc), } impl TryInto for CompiledClass { @@ -129,7 +130,7 @@ impl From for CompiledClass { ) }) .collect::>(); - entry_points_by_type.insert(EntryPointType::Constructor, l1_handler_entries); + entry_points_by_type.insert(EntryPointType::L1Handler, l1_handler_entries); let v = serde_json::to_value(&_deprecated_contract_class.abi).unwrap(); let abi: Option = serde_json::from_value(v).unwrap(); diff --git a/src/state/cached_state.rs b/src/state/cached_state.rs index c453e1a96..1f8394bbb 100644 --- a/src/state/cached_state.rs +++ b/src/state/cached_state.rs @@ -1,6 +1,6 @@ use super::{ contract_class_cache::ContractClassCache, - state_api::{State, StateReader}, + state_api::{State, StateChangesCount, StateReader}, state_cache::{StateCache, StorageEntry}, }; use crate::{ @@ -12,19 +12,19 @@ use crate::{ to_cache_state_storage_mapping, Address, ClassHash, }, }; +use cairo_lang_utils::bigint::BigUintAsHex; use cairo_vm::felt::Felt252; use getset::{Getters, MutGetters}; use num_traits::Zero; use std::{ - cell::RefCell, collections::{HashMap, HashSet}, - sync::Arc, + sync::{Arc, RwLock}, }; pub const UNINITIALIZED_CLASS_HASH: &ClassHash = &[0u8; 32]; /// Represents a cached state of contract classes with optional caches. -#[derive(Default, Clone, Debug, Getters, MutGetters)] +#[derive(Default, Debug, Getters, MutGetters)] pub struct CachedState { pub state_reader: Arc, #[getset(get = "pub", get_mut = "pub")] @@ -32,7 +32,7 @@ pub struct CachedState { #[getset(get = "pub", get_mut = "pub")] pub(crate) contract_class_cache: Arc, - pub(crate) contract_class_cache_private: RefCell>, + pub(crate) contract_class_cache_private: RwLock>, #[cfg(feature = "metrics")] cache_hits: usize, @@ -73,7 +73,7 @@ impl CachedState { cache: StateCache::default(), state_reader, contract_class_cache: contract_classes, - contract_class_cache_private: RefCell::new(HashMap::new()), + contract_class_cache_private: RwLock::new(HashMap::new()), #[cfg(feature = "metrics")] cache_hits: 0, @@ -92,7 +92,7 @@ impl CachedState { cache, state_reader, contract_class_cache: contract_classes, - contract_class_cache_private: RefCell::new(HashMap::new()), + contract_class_cache_private: RwLock::new(HashMap::new()), #[cfg(feature = "metrics")] cache_hits: 0, @@ -101,28 +101,51 @@ impl CachedState { } } + /// Clones a CachedState for testing purposes. + pub fn clone_for_testing(&self) -> Self { + Self { + state_reader: self.state_reader.clone(), + cache: self.cache.clone(), + contract_class_cache: self.contract_class_cache.clone(), + contract_class_cache_private: RwLock::new( + self.contract_class_cache_private.read().unwrap().clone(), + ), + #[cfg(feature = "metrics")] + cache_hits: self.cache_hits, + #[cfg(feature = "metrics")] + cache_misses: self.cache_misses, + } + } + pub fn drain_private_contract_class_cache( &self, - ) -> impl Iterator { - self.contract_class_cache_private.take().into_iter() + ) -> Result, StateError> { + Ok(self + .contract_class_cache_private + .read() + .map_err(|_| StateError::FailedToReadContractClassCache)? + .clone() + .into_iter()) } /// Creates a copy of this state with an empty cache for saving changes and applying them /// later. - pub fn create_transactional(&self) -> TransactionalCachedState { - let state_reader = Arc::new(TransactionalCachedStateReader::new(self)); - CachedState { - state_reader, + pub fn create_transactional(&self) -> Result, StateError> { + Ok(CachedState { + state_reader: self.state_reader.clone(), cache: self.cache.clone(), contract_class_cache: self.contract_class_cache.clone(), - contract_class_cache_private: RefCell::new( - self.contract_class_cache_private.borrow().clone(), + contract_class_cache_private: RwLock::new( + self.contract_class_cache_private + .read() + .map_err(|_| StateError::FailedToReadContractClassCache)? + .clone(), ), #[cfg(feature = "metrics")] cache_hits: 0, #[cfg(feature = "metrics")] cache_misses: 0, - } + }) } } @@ -177,7 +200,10 @@ impl StateReader for CachedState { } // I: FETCHING FROM CACHE - let mut private_cache = self.contract_class_cache_private.borrow_mut(); + let mut private_cache = self + .contract_class_cache_private + .write() + .map_err(|_| StateError::FailedToReadContractClassCache)?; if let Some(compiled_class) = private_cache.get(class_hash) { return Ok(compiled_class.clone()); } else if let Some(compiled_class) = @@ -221,6 +247,7 @@ impl State for CachedState { // have a mutable reference to the `RefCell` available. self.contract_class_cache_private .get_mut() + .map_err(|_| StateError::FailedToReadContractClassCache)? .insert(*class_hash, contract_class.clone()); Ok(()) @@ -294,7 +321,7 @@ impl State for CachedState { let compiled_class_hash = compiled_class_hash.to_be_bytes(); self.cache - .class_hash_to_compiled_class_hash + .compiled_class_hash_writes .insert(class_hash, compiled_class_hash); Ok(()) } @@ -311,10 +338,10 @@ impl State for CachedState { Ok(()) } - fn count_actual_storage_changes( + fn count_actual_state_changes( &mut self, fee_token_and_sender_address: Option<(&Address, &Address)>, - ) -> Result<(usize, usize), StateError> { + ) -> Result { self.update_initial_values_of_write_only_accesses()?; let mut storage_updates = subtract_mappings( @@ -324,9 +351,16 @@ impl State for CachedState { let storage_unique_updates = storage_updates.keys().map(|k| k.0.clone()); - let class_hash_updates = subtract_mappings_keys( + let class_hash_updates: Vec<&Address> = subtract_mappings_keys( &self.cache.class_hash_writes, &self.cache.class_hash_initial_values, + ) + .collect(); + let n_class_hash_updates = class_hash_updates.len(); + + let compiled_class_hash_updates = subtract_mappings_keys( + &self.cache.compiled_class_hash_writes, + &self.cache.compiled_class_hash_initial_values, ); let nonce_updates = @@ -334,7 +368,7 @@ impl State for CachedState { let mut modified_contracts: HashSet
= HashSet::new(); modified_contracts.extend(storage_unique_updates); - modified_contracts.extend(class_hash_updates.cloned()); + modified_contracts.extend(class_hash_updates.into_iter().cloned()); modified_contracts.extend(nonce_updates.cloned()); // Add fee transfer storage update before actually charging it, as it needs to be included in the @@ -348,7 +382,12 @@ impl State for CachedState { modified_contracts.remove(fee_token_address); } - Ok((modified_contracts.len(), storage_updates.len())) + Ok(StateChangesCount { + n_storage_updates: storage_updates.len(), + n_class_hash_updates, + n_compiled_class_hash_updates: compiled_class_hash_updates.count(), + n_modified_contracts: modified_contracts.len(), + }) } /// Returns the class hash for a given contract address. @@ -446,6 +485,7 @@ impl State for CachedState { if let Some(compiled_class) = self .contract_class_cache_private .get_mut() + .map_err(|_| StateError::FailedToReadContractClassCache)? .get(class_hash) .cloned() { @@ -457,6 +497,7 @@ impl State for CachedState { self.add_hit(); self.contract_class_cache_private .get_mut() + .map_err(|_| StateError::FailedToReadContractClassCache)? .insert(*class_hash, compiled_class.clone()); return Ok(compiled_class); } @@ -465,14 +506,14 @@ impl State for CachedState { if let Some(compiled_class_hash) = self.cache.class_hash_to_compiled_class_hash.get(class_hash) { - // `RefCell::get_mut()` provides a mutable reference without the borrowing overhead when - // we have a mutable reference to the `RefCell` available. - if let Some(casm_class) = self + let write_guard = self .contract_class_cache_private .get_mut() - .get(compiled_class_hash) - .cloned() - { + .map_err(|_| StateError::FailedToReadContractClassCache)?; + + // `RefCell::get_mut()` provides a mutable reference without the borrowing overhead when + // we have a mutable reference to the `RefCell` available. + if let Some(casm_class) = write_guard.get(compiled_class_hash).cloned() { self.add_hit(); return Ok(casm_class); } else if let Some(casm_class) = self @@ -482,11 +523,21 @@ impl State for CachedState { self.add_hit(); self.contract_class_cache_private .get_mut() + .map_err(|_| StateError::FailedToReadContractClassCache)? .insert(*class_hash, casm_class.clone()); return Ok(casm_class); } } + // if let Some(sierra_compiled_class) = self + // .sierra_programs + // .as_ref() + // .and_then(|x| x.get(class_hash)) + // { + // return Ok(CompiledClass::Sierra(Arc::new( + // sierra_compiled_class.clone(), + // ))); + // } // II: FETCHING FROM STATE_READER let contract = self.state_reader.get_contract_class(class_hash)?; match contract { @@ -501,137 +552,34 @@ impl State for CachedState { CompiledClass::Deprecated(ref contract) => { self.set_contract_class(class_hash, &CompiledClass::Deprecated(contract.clone()))? } + CompiledClass::Sierra(ref sierra_compiled_class) => self.set_contract_class( + class_hash, + &CompiledClass::Sierra(sierra_compiled_class.clone()), + )?, } Ok(contract) } -} -/// A CachedState which has access to another, "parent" state, used for executing transactions -/// without commiting changes to the parent. -pub type TransactionalCachedState<'a, T, C> = - CachedState, C>; - -/// State reader used for transactional states which allows to check the parent state's cache and -/// state reader if a transactional cache miss happens. -/// -/// In practice this will act as a way to access the parent state's cache and other fields, -/// without referencing the whole parent state, so there's no need to adapt state-modifying -/// functions in the case that a transactional state is needed. -#[derive(Debug, MutGetters, Getters, PartialEq, Clone)] -pub struct TransactionalCachedStateReader<'a, T: StateReader, C: ContractClassCache> { - /// The parent state's state_reader - #[get(get = "pub")] - pub(crate) state_reader: Arc, - /// The parent state's cache - #[get(get = "pub")] - pub(crate) cache: &'a StateCache, - - /// The parent state's contract_classes - #[get(get = "pub")] - pub(crate) contract_class_cache: Arc, - pub(crate) contract_class_cache_private: &'a RefCell>, -} - -impl<'a, T: StateReader, C: ContractClassCache> TransactionalCachedStateReader<'a, T, C> { - fn new(state: &'a CachedState) -> Self { - Self { - state_reader: state.state_reader.clone(), - cache: &state.cache, - contract_class_cache: state.contract_class_cache.clone(), - contract_class_cache_private: &state.contract_class_cache_private, - } - } -} - -impl<'a, T: StateReader, C: ContractClassCache> StateReader - for TransactionalCachedStateReader<'a, T, C> -{ - /// Returns the class hash for a given contract address. - /// Returns zero as default value if missing - fn get_class_hash_at(&self, contract_address: &Address) -> Result { - self.cache - .get_class_hash(contract_address) - .map(|a| Ok(*a)) - .unwrap_or_else(|| self.state_reader.get_class_hash_at(contract_address)) - } - - /// Returns the nonce for a given contract address. - fn get_nonce_at(&self, contract_address: &Address) -> Result { - if self.cache.get_nonce(contract_address).is_none() { - return self.state_reader.get_nonce_at(contract_address); - } - self.cache - .get_nonce(contract_address) - .ok_or_else(|| StateError::NoneNonce(contract_address.clone())) - .cloned() - } - - /// Returns storage data for a given storage entry. - /// Returns zero as default value if missing - fn get_storage_at(&self, storage_entry: &StorageEntry) -> Result { - self.cache - .get_storage(storage_entry) - .map(|v| Ok(v.clone())) - .unwrap_or_else(|| self.state_reader.get_storage_at(storage_entry)) - } + fn set_sierra_program( + &mut self, + compiled_class_hash: &Felt252, + _sierra_program: Vec, + ) -> Result<(), StateError> { + let _compiled_class_hash = compiled_class_hash.to_be_bytes(); - // TODO: check if that the proper way to store it (converting hash to address) - /// Returned the compiled class hash for a given class hash. - fn get_compiled_class_hash(&self, class_hash: &ClassHash) -> Result { - if self - .cache - .class_hash_to_compiled_class_hash - .get(class_hash) - .is_none() - { - return self.state_reader.get_compiled_class_hash(class_hash); - } - self.cache - .class_hash_to_compiled_class_hash - .get(class_hash) - .ok_or_else(|| StateError::NoneCompiledClass(*class_hash)) - .cloned() + // TODO implement + // self.sierra_programs + // .as_mut() + // .ok_or(StateError::MissingSierraProgramsCache)? + // .insert(compiled_class_hash, sierra_program); + Ok(()) } - /// Returns the contract class for a given class hash. - fn get_contract_class(&self, class_hash: &ClassHash) -> Result { - // This method can receive both compiled_class_hash & class_hash and return both casm and deprecated contract classes - //, which can be on the cache or on the state_reader, different cases will be described below: - if class_hash == UNINITIALIZED_CLASS_HASH { - return Err(StateError::UninitiaizedClassHash); - } - - // I: FETCHING FROM CACHE - let mut private_cache = self.contract_class_cache_private.borrow_mut(); - if let Some(compiled_class) = private_cache.get(class_hash) { - return Ok(compiled_class.clone()); - } else if let Some(compiled_class) = - self.contract_class_cache().get_contract_class(*class_hash) - { - private_cache.insert(*class_hash, compiled_class.clone()); - return Ok(compiled_class); - } - - // I: CASM CONTRACT CLASS : CLASS_HASH - if let Some(compiled_class_hash) = - self.cache.class_hash_to_compiled_class_hash.get(class_hash) - { - if let Some(casm_class) = private_cache.get(compiled_class_hash) { - return Ok(casm_class.clone()); - } else if let Some(casm_class) = self - .contract_class_cache() - .get_contract_class(*compiled_class_hash) - { - private_cache.insert(*class_hash, casm_class.clone()); - return Ok(casm_class); - } - } - - // II: FETCHING FROM STATE_READER - let contract_class = self.state_reader.get_contract_class(class_hash)?; - private_cache.insert(*class_hash, contract_class.clone()); - - Ok(contract_class) + fn get_sierra_program( + &mut self, + _class_hash: &ClassHash, + ) -> Result, StateError> { + todo!() } } @@ -979,7 +927,7 @@ mod tests { /// This test calculate the number of actual storage changes. #[test] - fn count_actual_storage_changes_test() { + fn count_actual_state_changes_test() { let state_reader = InMemoryStateReader::default(); let mut cached_state = CachedState::new( Arc::new(state_reader), @@ -1003,14 +951,15 @@ mod tests { let fee_token_address = Address(123.into()); let sender_address = Address(321.into()); - let expected_changes = { - let n_storage_updates = 3 + 1; // + 1 fee transfer balance update - let n_modified_contracts = 2; - - (n_modified_contracts, n_storage_updates) + let expected_changes = StateChangesCount { + n_storage_updates: 3 + 1, // + 1 fee transfer balance update, + n_class_hash_updates: 0, + n_compiled_class_hash_updates: 0, + n_modified_contracts: 2, }; + let changes = cached_state - .count_actual_storage_changes(Some((&fee_token_address, &sender_address))) + .count_actual_state_changes(Some((&fee_token_address, &sender_address))) .unwrap(); assert_eq!(changes, expected_changes); diff --git a/src/state/mod.rs b/src/state/mod.rs index 0c15b6aad..ef6efc242 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -3,10 +3,10 @@ use self::{ }; use crate::{ core::errors::state_errors::StateError, - services::api::contract_classes::compiled_class::CompiledClass, transaction::error::TransactionError, utils::{ - get_keys, to_cache_state_storage_mapping, to_state_diff_storage_mapping, Address, ClassHash, + get_keys, to_cache_state_storage_mapping, to_state_diff_storage_mapping, Address, + ClassHash, CompiledClassHash, }, }; use cairo_vm::{felt::Felt252, vm::runners::cairo_runner::ExecutionResources}; @@ -106,7 +106,7 @@ impl ExecutionResourcesManager { pub struct StateDiff { pub(crate) address_to_class_hash: HashMap, pub(crate) address_to_nonce: HashMap, - pub(crate) class_hash_to_compiled_class: HashMap, + pub(crate) class_hash_to_compiled_class: HashMap, pub(crate) storage_updates: HashMap>, } @@ -114,7 +114,7 @@ impl StateDiff { pub const fn new( address_to_class_hash: HashMap, address_to_nonce: HashMap, - class_hash_to_compiled_class: HashMap, + class_hash_to_compiled_class: HashMap, storage_updates: HashMap>, ) -> Self { StateDiff { @@ -133,7 +133,7 @@ impl StateDiff { let state_cache = cached_state.cache().to_owned(); let substracted_maps = state_cache.storage_writes; - let storage_updates = to_state_diff_storage_mapping(substracted_maps); + let storage_updates = to_state_diff_storage_mapping(&substracted_maps); let address_to_nonce = state_cache.nonce_writes; let class_hash_to_compiled_class = state_cache.compiled_class_hash_writes; @@ -330,7 +330,7 @@ mod test { Arc::new(PermanentContractClassCache::default()), ); - let diff = StateDiff::from_cached_state(cached_state_original.clone()).unwrap(); + let diff = StateDiff::from_cached_state(cached_state_original.clone_for_testing()).unwrap(); let cached_state = diff .to_cached_state::<_, PermanentContractClassCache>( diff --git a/src/state/state_api.rs b/src/state/state_api.rs index ff468671a..4abe12354 100644 --- a/src/state/state_api.rs +++ b/src/state/state_api.rs @@ -5,6 +5,7 @@ use crate::{ state::StateDiff, utils::{Address, ClassHash, CompiledClassHash}, }; +use cairo_lang_utils::bigint::BigUintAsHex; use cairo_vm::felt::Felt252; pub trait StateReader { @@ -25,6 +26,14 @@ pub trait StateReader { ) -> Result; } +#[derive(Debug, Clone, Eq, PartialEq)] +pub struct StateChangesCount { + pub n_storage_updates: usize, + pub n_class_hash_updates: usize, + pub n_compiled_class_hash_updates: usize, + pub n_modified_contracts: usize, +} + pub trait State { fn set_contract_class( &mut self, @@ -53,13 +62,20 @@ pub trait State { class_hash: &Felt252, compiled_class_hash: &Felt252, ) -> Result<(), StateError>; + + fn set_sierra_program( + &mut self, + compiled_class_hash: &Felt252, + sierra_program: Vec, + ) -> Result<(), StateError>; + fn apply_state_update(&mut self, sate_updates: &StateDiff) -> Result<(), StateError>; - /// Counts the amount of modified contracts and the updates to the storage - fn count_actual_storage_changes( + /// Counts the amount of state changes + fn count_actual_state_changes( &mut self, fee_token_and_sender_address: Option<(&Address, &Address)>, - ) -> Result<(usize, usize), StateError>; + ) -> Result; /// Returns the class hash of the contract class at the given address. /// Returns zero by default if the value is not present @@ -75,4 +91,9 @@ pub trait State { fn get_compiled_class_hash(&mut self, class_hash: &ClassHash) -> Result; fn get_contract_class(&mut self, class_hash: &ClassHash) -> Result; + + fn get_sierra_program( + &mut self, + class_hash: &ClassHash, + ) -> Result, StateError>; } diff --git a/src/state/state_cache.rs b/src/state/state_cache.rs index 6238c258d..23a77400c 100644 --- a/src/state/state_cache.rs +++ b/src/state/state_cache.rs @@ -1,6 +1,5 @@ use crate::{ core::errors::state_errors::StateError, - services::api::contract_classes::compiled_class::CompiledClass, utils::{Address, ClassHash, CompiledClassHash}, }; use cairo_vm::felt::Felt252; @@ -18,7 +17,7 @@ pub struct StateCache { #[get_mut = "pub"] pub(crate) class_hash_initial_values: HashMap, #[get_mut = "pub"] - pub(crate) compiled_class_hash_initial_values: HashMap, + pub(crate) compiled_class_hash_initial_values: HashMap, #[getset(get = "pub", get_mut = "pub")] pub(crate) nonce_initial_values: HashMap, #[getset(get = "pub", get_mut = "pub")] @@ -28,7 +27,7 @@ pub struct StateCache { #[get_mut = "pub"] pub(crate) class_hash_writes: HashMap, #[get_mut = "pub"] - pub(crate) compiled_class_hash_writes: HashMap, + pub(crate) compiled_class_hash_writes: HashMap, #[get_mut = "pub"] pub(crate) nonce_writes: HashMap, #[getset(get = "pub", get_mut = "pub")] @@ -43,11 +42,11 @@ impl StateCache { /// Create a new StateCache with given initial and written values for testing pub const fn new( class_hash_initial_values: HashMap, - compiled_class_hash_initial_values: HashMap, + compiled_class_hash_initial_values: HashMap, nonce_initial_values: HashMap, storage_initial_values: HashMap, class_hash_writes: HashMap, - compiled_class_hash_writes: HashMap, + compiled_class_hash_writes: HashMap, nonce_writes: HashMap, storage_writes: HashMap, class_hash_to_compiled_class_hash: HashMap, @@ -84,11 +83,11 @@ impl StateCache { #[allow(clippy::too_many_arguments)] pub const fn new_for_testing( class_hash_initial_values: HashMap, - compiled_class_hash_initial_values: HashMap, + compiled_class_hash_initial_values: HashMap, nonce_initial_values: HashMap, storage_initial_values: HashMap, class_hash_writes: HashMap, - compiled_class_hash_writes: HashMap, + compiled_class_hash_writes: HashMap, nonce_writes: HashMap, storage_writes: HashMap<(Address, [u8; 32]), Felt252>, class_hash_to_compiled_class_hash: HashMap, @@ -116,7 +115,10 @@ impl StateCache { /// Get the compiled hash for a given class hash #[allow(dead_code)] - pub(crate) fn get_compiled_class_hash(&self, class_hash: &ClassHash) -> Option<&CompiledClass> { + pub(crate) fn get_compiled_class_hash( + &self, + class_hash: &ClassHash, + ) -> Option<&CompiledClassHash> { if self.compiled_class_hash_writes.contains_key(class_hash) { return self.compiled_class_hash_writes.get(class_hash); } @@ -143,7 +145,7 @@ impl StateCache { pub(crate) fn update_writes( &mut self, address_to_class_hash: &HashMap, - class_hash_to_compiled_class_hash: &HashMap, + class_hash_to_compiled_class_hash: &HashMap, address_to_nonce: &HashMap, storage_updates: &HashMap, ) { @@ -158,7 +160,7 @@ impl StateCache { pub fn set_initial_values( &mut self, address_to_class_hash: &HashMap, - class_hash_to_compiled_class: &HashMap, + class_hash_to_compiled_class: &HashMap, address_to_nonce: &HashMap, storage_updates: &HashMap, ) -> Result<(), StateError> { @@ -201,8 +203,7 @@ impl StateCache { } for (k, v) in self.compiled_class_hash_writes.iter() { - self.compiled_class_hash_initial_values - .insert(*k, v.clone()); + self.compiled_class_hash_initial_values.insert(*k, *v); } for (k, v) in self.storage_writes.iter() { @@ -219,9 +220,11 @@ impl StateCache { /// Unit tests for StateCache #[cfg(test)] mod tests { - use std::sync::Arc; - use crate::services::api::contract_classes::deprecated_contract_class::ContractClass; + use crate::{ + core::contract_address::compute_deprecated_class_hash, + services::api::contract_classes::deprecated_contract_class::ContractClass, + }; use super::*; @@ -232,7 +235,9 @@ mod tests { let contract_class = ContractClass::from_path("starknet_programs/raw_contract_classes/class_with_abi.json") .unwrap(); - let compiled_class = CompiledClass::Deprecated(Arc::new(contract_class)); + let compiled_class = compute_deprecated_class_hash(&contract_class) + .unwrap() + .to_be_bytes(); let class_hash_to_compiled_class_hash = HashMap::from([([8; 32], compiled_class)]); let address_to_nonce = HashMap::from([(Address(9.into()), 12.into())]); let storage_updates = HashMap::from([((Address(4.into()), [1; 32]), 18.into())]); diff --git a/src/syscalls/business_logic_syscall_handler.rs b/src/syscalls/business_logic_syscall_handler.rs index 5deb7b2ee..42925bf16 100644 --- a/src/syscalls/business_logic_syscall_handler.rs +++ b/src/syscalls/business_logic_syscall_handler.rs @@ -58,9 +58,10 @@ use crate::services::api::contract_classes::deprecated_contract_class::EntryPoin use crate::state::contract_class_cache::ContractClassCache; use num_traits::{One, ToPrimitive, Zero}; -const STEP: u128 = 100; -const SYSCALL_BASE: u128 = 100 * STEP; -const KECCAK_ROUND_COST: u128 = 180000; +pub(crate) const STEP: u128 = 100; +pub(crate) const SYSCALL_BASE: u128 = 100 * STEP; +pub(crate) const KECCAK_ROUND_COST: u128 = 180000; + lazy_static! { /// Felt->syscall map that was extracted from new_syscalls.json (Cairo 1.0 syscalls) static ref SELECTOR_TO_SYSCALL: HashMap = { @@ -92,7 +93,7 @@ lazy_static! { // Taken from starkware/starknet/constants.py in cairo-lang // See further documentation on cairo_programs/constants.cairo /// Maps syscall name to gas costs - static ref SYSCALL_GAS_COST: HashMap<&'static str, u128> = { + pub(crate) static ref SYSCALL_GAS_COST: HashMap<&'static str, u128> = { let mut map = HashMap::new(); map.insert("initial", 100_000_000 * STEP); @@ -134,6 +135,7 @@ pub struct BusinessLogicSyscallHandler<'a, S: StateReader, C: ContractClassCache pub(crate) support_reverted: bool, pub(crate) entry_point_selector: Felt252, pub(crate) selector_to_syscall: &'a HashMap, + pub(crate) execution_info_ptr: Option, } // TODO: execution entry point may no be a parameter field, but there is no way to generate a default for now @@ -172,6 +174,7 @@ impl<'a, S: StateReader, C: ContractClassCache> BusinessLogicSyscallHandler<'a, support_reverted, entry_point_selector, selector_to_syscall: &SELECTOR_TO_SYSCALL, + execution_info_ptr: None, } } @@ -229,6 +232,7 @@ impl<'a, S: StateReader, C: ContractClassCache> BusinessLogicSyscallHandler<'a, support_reverted: false, entry_point_selector, selector_to_syscall: &SELECTOR_TO_SYSCALL, + execution_info_ptr: None, } } @@ -312,6 +316,7 @@ impl<'a, S: StateReader, C: ContractClassCache> BusinessLogicSyscallHandler<'a, .ok_or(ContractClassError::NoneEntryPointType)? .is_empty()), CompiledClass::Casm(class) => Ok(class.entry_points_by_type.constructor.is_empty()), + CompiledClass::Sierra(_) => todo!(), } } @@ -320,7 +325,7 @@ impl<'a, S: StateReader, C: ContractClassCache> BusinessLogicSyscallHandler<'a, contract_address: &Address, class_hash_bytes: ClassHash, constructor_calldata: Vec, - remainig_gas: u128, + remaining_gas: u128, ) -> Result { let compiled_class = if let Ok(compiled_class) = self .starknet_storage_state @@ -359,7 +364,7 @@ impl<'a, S: StateReader, C: ContractClassCache> BusinessLogicSyscallHandler<'a, EntryPointType::Constructor, Some(CallType::Call), None, - remainig_gas, + remaining_gas, ); let ExecutionResult { @@ -534,10 +539,10 @@ impl<'a, S: StateReader, C: ContractClassCache> BusinessLogicSyscallHandler<'a, /// them as accessed. pub(crate) fn validate_read_only_segments( &self, - runner: &mut VirtualMachine, + vm: &mut VirtualMachine, ) -> Result<(), TransactionError> { for (segment_ptr, segment_size) in self.read_only_segments.clone() { - let used_size = runner + let used_size = vm .get_segment_used_size(segment_ptr.segment_index as usize) .ok_or(TransactionError::InvalidSegmentSize)?; @@ -549,7 +554,7 @@ impl<'a, S: StateReader, C: ContractClassCache> BusinessLogicSyscallHandler<'a, if seg_size != used_size.into() { return Err(TransactionError::OutOfBound); } - runner.mark_address_range_as_accessed(segment_ptr, used_size)?; + vm.mark_address_range_as_accessed(segment_ptr, used_size)?; } Ok(()) } @@ -626,63 +631,69 @@ impl<'a, S: StateReader, C: ContractClassCache> BusinessLogicSyscallHandler<'a, }) } + // Returns the pointer to the segment with the execution info if it was already written. + // If it wasn't, it writes the execution info into memory and returns its start address. + fn get_or_allocate_execution_info( + &mut self, + vm: &mut VirtualMachine, + ) -> Result { + if let Some(ptr) = self.execution_info_ptr { + return Ok(ptr); + } + + // Allocate block_info + let block_info = &self.block_context.block_info; + let block_info_data = vec![ + MaybeRelocatable::from(Felt252::from(block_info.block_number)), + MaybeRelocatable::from(Felt252::from(block_info.block_timestamp)), + MaybeRelocatable::from(&block_info.sequencer_address.0), + ]; + let block_info_ptr = self.allocate_segment(vm, block_info_data)?; + + // Allocate signature + let signature: Vec = self + .tx_execution_context + .signature + .iter() + .map(MaybeRelocatable::from) + .collect(); + let signature_start_ptr = self.allocate_segment(vm, signature)?; + let signature_end_ptr = (signature_start_ptr + self.tx_execution_context.signature.len())?; + + // Allocate tx info + let tx_info = &self.tx_execution_context; + let tx_info_data = vec![ + MaybeRelocatable::from(&tx_info.version), + MaybeRelocatable::from(&tx_info.account_contract_address.0), + MaybeRelocatable::from(Felt252::from(tx_info.max_fee)), + signature_start_ptr.into(), + signature_end_ptr.into(), + MaybeRelocatable::from(&tx_info.transaction_hash), + MaybeRelocatable::from(&self.block_context.starknet_os_config.chain_id), + MaybeRelocatable::from(&tx_info.nonce), + ]; + let tx_info_ptr = self.allocate_segment(vm, tx_info_data)?; + + // Allocate execution_info + let execution_info = vec![ + block_info_ptr.into(), + tx_info_ptr.into(), + MaybeRelocatable::from(&self.caller_address.0), + MaybeRelocatable::from(&self.contract_address.0), + MaybeRelocatable::from(&self.entry_point_selector), + ]; + let execution_info_ptr = self.allocate_segment(vm, execution_info)?; + + self.execution_info_ptr = Some(execution_info_ptr); + Ok(execution_info_ptr) + } + fn get_execution_info( - &self, + &mut self, vm: &mut VirtualMachine, remaining_gas: u128, ) -> Result { - let tx_info = &self.tx_execution_context; - let block_info = &self.block_context.block_info; - - let mut res_segment = vm.add_memory_segment(); - - let signature_start = res_segment; - for s in tx_info.signature.iter() { - vm.insert_value(res_segment, s)?; - res_segment = (res_segment + 1)?; - } - let signature_end = res_segment; - - let tx_info_ptr = res_segment; - vm.insert_value::(res_segment, tx_info.version.clone())?; - res_segment = (res_segment + 1)?; - vm.insert_value(res_segment, tx_info.account_contract_address.0.clone())?; - res_segment = (res_segment + 1)?; - vm.insert_value::(res_segment, tx_info.max_fee.into())?; - res_segment = (res_segment + 1)?; - vm.insert_value(res_segment, signature_start)?; - res_segment = (res_segment + 1)?; - vm.insert_value(res_segment, signature_end)?; - res_segment = (res_segment + 1)?; - vm.insert_value(res_segment, tx_info.transaction_hash.clone())?; - res_segment = (res_segment + 1)?; - vm.insert_value::( - res_segment, - self.block_context.starknet_os_config.chain_id.clone(), - )?; - res_segment = (res_segment + 1)?; - vm.insert_value::(res_segment, tx_info.nonce.clone())?; - res_segment = (res_segment + 1)?; - - let block_info_ptr = res_segment; - vm.insert_value::(res_segment, block_info.block_number.into())?; - res_segment = (res_segment + 1)?; - vm.insert_value::(res_segment, block_info.block_timestamp.into())?; - res_segment = (res_segment + 1)?; - vm.insert_value::(res_segment, block_info.sequencer_address.0.clone())?; - res_segment = (res_segment + 1)?; - - let exec_info_ptr = res_segment; - vm.insert_value(res_segment, block_info_ptr)?; - res_segment = (res_segment + 1)?; - vm.insert_value(res_segment, tx_info_ptr)?; - res_segment = (res_segment + 1)?; - vm.insert_value::(res_segment, self.caller_address.0.clone())?; - res_segment = (res_segment + 1)?; - vm.insert_value::(res_segment, self.contract_address.0.clone())?; - res_segment = (res_segment + 1)?; - vm.insert_value::(res_segment, self.entry_point_selector.clone())?; - + let exec_info_ptr = self.get_or_allocate_execution_info(vm)?; Ok(SyscallResponse { gas: remaining_gas, body: Some(ResponseBody::GetExecutionInfo { exec_info_ptr }), @@ -876,7 +887,7 @@ impl<'a, S: StateReader, C: ContractClassCache> BusinessLogicSyscallHandler<'a, fn send_message_to_l1( &mut self, - vm: &mut VirtualMachine, + vm: &VirtualMachine, request: SendMessageToL1Request, remaining_gas: u128, ) -> Result { diff --git a/src/syscalls/deprecated_business_logic_syscall_handler.rs b/src/syscalls/deprecated_business_logic_syscall_handler.rs index 9f0b66e32..56817de19 100644 --- a/src/syscalls/deprecated_business_logic_syscall_handler.rs +++ b/src/syscalls/deprecated_business_logic_syscall_handler.rs @@ -193,6 +193,7 @@ impl<'a, S: StateReader, C: ContractClassCache> DeprecatedBLSyscallHandler<'a, S .ok_or(ContractClassError::NoneEntryPointType)? .is_empty()), CompiledClass::Casm(class) => Ok(class.entry_points_by_type.constructor.is_empty()), + CompiledClass::Sierra(_) => todo!(), } } @@ -596,7 +597,7 @@ impl<'a, S: StateReader, C: ContractClassCache> DeprecatedBLSyscallHandler<'a, S pub(crate) fn storage_write( &mut self, - vm: &mut VirtualMachine, + vm: &VirtualMachine, syscall_ptr: Relocatable, ) -> Result<(), SyscallHandlerError> { let request = @@ -887,7 +888,7 @@ impl<'a, S: StateReader, C: ContractClassCache> DeprecatedBLSyscallHandler<'a, S pub(crate) fn replace_class( &mut self, - vm: &mut VirtualMachine, + vm: &VirtualMachine, syscall_ptr: Relocatable, ) -> Result<(), SyscallHandlerError> { let request = match self.read_and_validate_syscall_request("replace_class", vm, syscall_ptr) diff --git a/src/syscalls/deprecated_syscall_handler.rs b/src/syscalls/deprecated_syscall_handler.rs index eabf9bdfa..997f684df 100644 --- a/src/syscalls/deprecated_syscall_handler.rs +++ b/src/syscalls/deprecated_syscall_handler.rs @@ -1214,7 +1214,7 @@ mod tests { ) .unwrap(); - let mut transactional = state.create_transactional(); + let mut transactional = state.create_transactional().unwrap(); // Invoke result let result = internal_invoke_function .apply(&mut transactional, &BlockContext::default(), 0) diff --git a/src/syscalls/mod.rs b/src/syscalls/mod.rs index 065e31652..48a332316 100644 --- a/src/syscalls/mod.rs +++ b/src/syscalls/mod.rs @@ -4,6 +4,8 @@ pub mod deprecated_syscall_handler; pub mod deprecated_syscall_request; pub mod deprecated_syscall_response; pub mod hint_code; +#[cfg(feature = "cairo-native")] +pub mod native_syscall_handler; pub mod other_syscalls; pub mod syscall_handler; pub mod syscall_handler_errors; diff --git a/src/syscalls/native_syscall_handler.rs b/src/syscalls/native_syscall_handler.rs new file mode 100644 index 000000000..00386eaea --- /dev/null +++ b/src/syscalls/native_syscall_handler.rs @@ -0,0 +1,576 @@ +use crate::ContractClassCache; +use cairo_native::starknet::{ + BlockInfo, ExecutionInfo, StarkNetSyscallHandler, SyscallResult, TxInfo, U256, +}; +use cairo_vm::felt::Felt252; +use num_traits::Zero; + +use crate::definitions::constants::CONSTRUCTOR_ENTRY_POINT_SELECTOR; +use crate::execution::CallResult; +use crate::hash_utils::calculate_contract_address; +use crate::services::api::contract_class_errors::ContractClassError; +use crate::services::api::contract_classes::compiled_class::CompiledClass; +use crate::state::state_api::State; +use crate::utils::felt_to_hash; +use crate::utils::ClassHash; +use crate::{ + core::errors::state_errors::StateError, + definitions::block_context::BlockContext, + execution::{ + execution_entry_point::{ExecutionEntryPoint, ExecutionResult}, + CallInfo, CallType, OrderedEvent, OrderedL2ToL1Message, TransactionExecutionContext, + }, + state::{ + contract_storage_state::ContractStorageState, state_api::StateReader, + ExecutionResourcesManager, + }, + syscalls::business_logic_syscall_handler::{SYSCALL_BASE, SYSCALL_GAS_COST}, + utils::Address, + EntryPointType, +}; + +#[derive(Debug)] +pub struct NativeSyscallHandler<'a, S, C> +where + S: StateReader, + C: ContractClassCache, +{ + pub(crate) starknet_storage_state: ContractStorageState<'a, S, C>, + pub(crate) contract_address: Address, + pub(crate) caller_address: Address, + pub(crate) entry_point_selector: Felt252, + pub(crate) events: Vec, + pub(crate) l2_to_l1_messages: Vec, + pub(crate) tx_execution_context: TransactionExecutionContext, + pub(crate) block_context: BlockContext, + pub(crate) internal_calls: Vec, + pub(crate) resources_manager: ExecutionResourcesManager, +} + +impl<'a, S: StateReader, C: ContractClassCache> NativeSyscallHandler<'a, S, C> { + /// Generic code that needs to be run on all syscalls. + fn handle_syscall_request(&mut self, gas: &mut u128, syscall_name: &str) -> SyscallResult<()> { + let required_gas = SYSCALL_GAS_COST + .get(syscall_name) + .map(|&x| x.saturating_sub(SYSCALL_BASE)) + .unwrap_or(0); + + if *gas < required_gas { + let out_of_gas_felt = Felt252::from_bytes_be("Out of gas".as_bytes()); + println!("out of gas!: {:?} < {:?}", *gas, required_gas); // TODO: remove once all other prints are removed + return Err(vec![out_of_gas_felt.clone()]); + } + + *gas = gas.saturating_sub(required_gas); + + self.resources_manager + .increment_syscall_counter(syscall_name, 1); + + Ok(()) + } +} + +impl<'a, S: StateReader, C: ContractClassCache> StarkNetSyscallHandler + for NativeSyscallHandler<'a, S, C> +{ + fn get_block_hash( + &mut self, + block_number: u64, + gas: &mut u128, + ) -> SyscallResult { + println!("Called `get_block_hash({block_number})` from MLIR."); + + self.handle_syscall_request(gas, "get_block_hash")?; + + Ok(Felt252::from_bytes_be(b"get_block_hash ok")) + } + + fn get_execution_info( + &mut self, + gas: &mut u128, + ) -> SyscallResult { + println!("Called `get_execution_info()` from MLIR."); + + self.handle_syscall_request(gas, "get_execution_info")?; + + Ok(ExecutionInfo { + block_info: BlockInfo { + block_number: self.block_context.block_info.block_number, + block_timestamp: self.block_context.block_info.block_timestamp, + sequencer_address: self.block_context.block_info.sequencer_address.0.clone(), + }, + tx_info: TxInfo { + version: self.tx_execution_context.version.clone(), + account_contract_address: self + .tx_execution_context + .account_contract_address + .0 + .clone(), + max_fee: self.tx_execution_context.max_fee, + signature: self.tx_execution_context.signature.clone(), + transaction_hash: self.tx_execution_context.transaction_hash.clone(), + chain_id: self.block_context.starknet_os_config.chain_id.clone(), + nonce: self.tx_execution_context.nonce.clone(), + }, + caller_address: self.caller_address.0.clone(), + contract_address: self.contract_address.0.clone(), + entry_point_selector: self.entry_point_selector.clone(), + }) + } + + fn deploy( + &mut self, + class_hash: cairo_vm::felt::Felt252, + contract_address_salt: cairo_vm::felt::Felt252, + calldata: &[cairo_vm::felt::Felt252], + deploy_from_zero: bool, + gas: &mut u128, + ) -> SyscallResult<(cairo_vm::felt::Felt252, Vec)> { + self.handle_syscall_request(gas, "deploy")?; + + let deployer_address = if deploy_from_zero { + Address::default() + } else { + self.contract_address.clone() + }; + + let contract_address = Address( + calculate_contract_address( + &contract_address_salt, + &class_hash, + calldata, + deployer_address, + ) + .map_err(|_| { + vec![Felt252::from_bytes_be( + b"FAILED_TO_CALCULATE_CONTRACT_ADDRESS", + )] + })?, + ); + // Initialize the contract. + let class_hash_bytes: ClassHash = felt_to_hash(&class_hash); + + self.starknet_storage_state + .state + .deploy_contract(contract_address.clone(), class_hash_bytes) + .map_err(|_| vec![Felt252::from_bytes_be(b"CONTRACT_ADDRESS_UNAVAILABLE")])?; + + let result = self + .execute_constructor_entry_point( + &contract_address, + class_hash_bytes, + calldata.to_vec(), + *gas, + ) + .map_err(|_| vec![Felt252::from_bytes_be(b"CONSTRUCTOR_ENTRYPOINT_FAILURE")])?; + + *gas = gas.saturating_sub(result.gas_consumed); + + Ok(( + contract_address.0, + result + .retdata + .iter() + .map(|mb| mb.get_int_ref().cloned().unwrap_or_default()) + .collect(), + )) + } + + fn replace_class( + &mut self, + class_hash: cairo_vm::felt::Felt252, + gas: &mut u128, + ) -> SyscallResult<()> { + println!("Called `replace_class({class_hash})` from MLIR."); + + self.handle_syscall_request(gas, "replace_class")?; + Ok(()) + } + + fn library_call( + &mut self, + class_hash: cairo_vm::felt::Felt252, + function_selector: cairo_vm::felt::Felt252, + calldata: &[cairo_vm::felt::Felt252], + gas: &mut u128, + ) -> SyscallResult> { + println!( + "Called `library_call({class_hash}, {function_selector}, {calldata:?})` from MLIR." + ); + + self.handle_syscall_request(gas, "library_call")?; + + Ok(calldata.iter().map(|x| x * &Felt252::new(3)).collect()) + } + + fn call_contract( + &mut self, + address: cairo_vm::felt::Felt252, + entrypoint_selector: cairo_vm::felt::Felt252, + calldata: &[cairo_vm::felt::Felt252], + gas: &mut u128, + ) -> SyscallResult> { + println!( + "Called `call_contract({address}, {entrypoint_selector}, {calldata:?})` from MLIR." + ); + + self.handle_syscall_request(gas, "call_contract")?; + + let address = Address(address); + let exec_entry_point = ExecutionEntryPoint::new( + address, + calldata.to_vec(), + entrypoint_selector, + self.caller_address.clone(), + EntryPointType::External, + Some(CallType::Call), + None, + *gas, + ); + + let ExecutionResult { call_info, .. } = exec_entry_point + .execute( + self.starknet_storage_state.state, + // TODO: This fields dont make much sense in the Cairo Native context, + // they are only dummy values for the `execute` method. + &self.block_context, + &mut self.resources_manager, + &mut self.tx_execution_context, + false, + self.block_context.invoke_tx_max_n_steps, + ) + .unwrap(); + + let call_info = call_info.unwrap(); + + *gas = gas.saturating_sub(call_info.gas_consumed); + + // update syscall handler information + self.starknet_storage_state + .read_values + .extend(call_info.storage_read_values.clone()); + self.starknet_storage_state + .accessed_keys + .extend(call_info.accessed_storage_keys.clone()); + + let retdata = call_info.retdata.clone(); + self.internal_calls.push(call_info); + + Ok(retdata) + } + + fn storage_read( + &mut self, + address_domain: u32, + address: cairo_vm::felt::Felt252, + gas: &mut u128, + ) -> SyscallResult { + println!("Called `storage_read({address_domain}, {address})` from MLIR."); + + self.handle_syscall_request(gas, "storage_read")?; + + let value = match self.starknet_storage_state.read(&address.to_be_bytes()) { + Ok(value) => Ok(value), + Err(_e @ StateError::Io(_)) => todo!(), + Err(_) => Ok(Felt252::zero()), + }; + + println!(" = {value:?}` from MLIR."); + + value + } + + fn storage_write( + &mut self, + address_domain: u32, + address: cairo_vm::felt::Felt252, + value: cairo_vm::felt::Felt252, + gas: &mut u128, + ) -> SyscallResult<()> { + println!("Called `storage_write({address_domain}, {address}, {value})` from MLIR."); + + self.handle_syscall_request(gas, "storage_write")?; + + self.starknet_storage_state + .write(&address.to_be_bytes(), value); + Ok(()) + } + + fn emit_event( + &mut self, + keys: &[cairo_vm::felt::Felt252], + data: &[cairo_vm::felt::Felt252], + gas: &mut u128, + ) -> SyscallResult<()> { + let order = self.tx_execution_context.n_emitted_events; + println!("Called `emit_event(KEYS: {keys:?}, DATA: {data:?})` from MLIR."); + + self.handle_syscall_request(gas, "emit_event")?; + + self.events + .push(OrderedEvent::new(order, keys.to_vec(), data.to_vec())); + self.tx_execution_context.n_emitted_events += 1; + Ok(()) + } + + fn send_message_to_l1( + &mut self, + to_address: cairo_vm::felt::Felt252, + payload: &[cairo_vm::felt::Felt252], + gas: &mut u128, + ) -> SyscallResult<()> { + println!("Called `send_message_to_l1({to_address}, {payload:?})` from MLIR."); + + self.handle_syscall_request(gas, "send_message_to_l1")?; + + let addr = Address(to_address); + self.l2_to_l1_messages.push(OrderedL2ToL1Message::new( + self.tx_execution_context.n_sent_messages, + addr, + payload.to_vec(), + )); + + // Update messages count. + self.tx_execution_context.n_sent_messages += 1; + + Ok(()) + } + + fn keccak( + &mut self, + input: &[u64], + gas: &mut u128, + ) -> SyscallResult { + println!("Called `keccak({input:?})` from MLIR."); + + self.handle_syscall_request(gas, "keccak")?; + + Ok(U256(Felt252::from(1234567890).to_le_bytes())) + } + + fn secp256k1_add( + &mut self, + _p0: cairo_native::starknet::Secp256k1Point, + _p1: cairo_native::starknet::Secp256k1Point, + _gas: &mut u128, + ) -> SyscallResult> { + todo!() + } + + fn secp256k1_get_point_from_x( + &self, + _x: cairo_native::starknet::U256, + _y_parity: bool, + _gas: &mut u128, + ) -> SyscallResult> { + todo!() + } + + fn secp256k1_get_xy( + &self, + _p: cairo_native::starknet::Secp256k1Point, + _gas: &mut u128, + ) -> SyscallResult<(cairo_native::starknet::U256, cairo_native::starknet::U256)> { + todo!() + } + + fn secp256k1_mul( + &self, + _p: cairo_native::starknet::Secp256k1Point, + _m: cairo_native::starknet::U256, + _gas: &mut u128, + ) -> SyscallResult> { + todo!() + } + + fn secp256k1_new( + &self, + _x: cairo_native::starknet::U256, + _y: cairo_native::starknet::U256, + _gas: &mut u128, + ) -> SyscallResult> { + todo!() + } + + fn secp256r1_add( + &self, + _p0: cairo_native::starknet::Secp256k1Point, + _p1: cairo_native::starknet::Secp256k1Point, + _gas: &mut u128, + ) -> SyscallResult> { + todo!() + } + + fn secp256r1_get_point_from_x( + &self, + _x: cairo_native::starknet::U256, + _y_parity: bool, + _gas: &mut u128, + ) -> SyscallResult> { + todo!() + } + + fn secp256r1_get_xy( + &self, + _p: cairo_native::starknet::Secp256k1Point, + _gas: &mut u128, + ) -> SyscallResult<(cairo_native::starknet::U256, cairo_native::starknet::U256)> { + todo!() + } + + fn secp256r1_mul( + &self, + _p: cairo_native::starknet::Secp256k1Point, + _m: cairo_native::starknet::U256, + _gas: &mut u128, + ) -> SyscallResult> { + todo!() + } + + fn secp256r1_new( + &mut self, + _x: cairo_native::starknet::U256, + _y: cairo_native::starknet::U256, + _gas: &mut u128, + ) -> SyscallResult> { + todo!() + } + + fn pop_log(&mut self) { + todo!() + } + + fn set_account_contract_address(&mut self, contract_address: cairo_vm::felt::Felt252) { + self.tx_execution_context.account_contract_address = Address(contract_address); + } + + fn set_block_number(&mut self, block_number: u64) { + self.block_context.block_info.block_number = block_number; + } + + fn set_block_timestamp(&mut self, block_timestamp: u64) { + self.block_context.block_info.block_timestamp = block_timestamp; + } + + fn set_caller_address(&mut self, address: cairo_vm::felt::Felt252) { + self.caller_address = Address(address); + } + + fn set_chain_id(&mut self, chain_id: cairo_vm::felt::Felt252) { + self.block_context.starknet_os_config.chain_id = chain_id; + } + + fn set_contract_address(&mut self, address: cairo_vm::felt::Felt252) { + self.contract_address = Address(address); + } + + fn set_max_fee(&mut self, max_fee: u128) { + self.tx_execution_context.max_fee = max_fee; + } + + fn set_nonce(&mut self, nonce: cairo_vm::felt::Felt252) { + self.tx_execution_context.nonce = nonce; + } + + fn set_sequencer_address(&mut self, _address: cairo_vm::felt::Felt252) { + todo!() + } + + fn set_signature(&mut self, signature: &[cairo_vm::felt::Felt252]) { + self.tx_execution_context.signature = signature.to_vec(); + } + + fn set_transaction_hash(&mut self, transaction_hash: cairo_vm::felt::Felt252) { + self.tx_execution_context.transaction_hash = transaction_hash; + } + + fn set_version(&mut self, version: cairo_vm::felt::Felt252) { + self.tx_execution_context.version = version; + } +} + +impl<'a, S, C> NativeSyscallHandler<'a, S, C> +where + S: StateReader, + C: ContractClassCache, +{ + fn execute_constructor_entry_point( + &mut self, + contract_address: &Address, + class_hash_bytes: ClassHash, + constructor_calldata: Vec, + remaining_gas: u128, + ) -> Result { + let compiled_class = if let Ok(compiled_class) = self + .starknet_storage_state + .state + .get_contract_class(&class_hash_bytes) + { + compiled_class + } else { + return Ok(CallResult { + gas_consumed: 0, + is_success: false, + retdata: vec![Felt252::from_bytes_be(b"CLASS_HASH_NOT_FOUND").into()], + }); + }; + + if self.constructor_entry_points_empty(compiled_class)? { + if !constructor_calldata.is_empty() { + return Err(StateError::ConstructorCalldataEmpty); + } + + let call_info = CallInfo::empty_constructor_call( + contract_address.clone(), + self.contract_address.clone(), + Some(class_hash_bytes), + ); + self.internal_calls.push(call_info.clone()); + + return Ok(call_info.result()); + } + + let call = ExecutionEntryPoint::new( + contract_address.clone(), + constructor_calldata, + CONSTRUCTOR_ENTRY_POINT_SELECTOR.clone(), + self.contract_address.clone(), + EntryPointType::Constructor, + Some(CallType::Call), + None, + remaining_gas, + ); + + let ExecutionResult { call_info, .. } = call + .execute( + self.starknet_storage_state.state, + &self.block_context, + &mut self.resources_manager, + &mut self.tx_execution_context, + false, + u64::MAX, + ) + .map_err(|_| StateError::ExecutionEntryPoint)?; + + let call_info = call_info.ok_or(StateError::CustomError("Execution error".to_string()))?; + + self.internal_calls.push(call_info.clone()); + + Ok(call_info.result()) + } + + fn constructor_entry_points_empty( + &self, + contract_class: CompiledClass, + ) -> Result { + match contract_class { + CompiledClass::Deprecated(class) => Ok(class + .entry_points_by_type + .get(&EntryPointType::Constructor) + .ok_or(ContractClassError::NoneEntryPointType)? + .is_empty()), + CompiledClass::Casm(class) => Ok(class.entry_points_by_type.constructor.is_empty()), + CompiledClass::Sierra(class) => Ok(class.entry_points_by_type.constructor.is_empty()), + } + } +} diff --git a/src/syscalls/syscall_handler.rs b/src/syscalls/syscall_handler.rs index b62fb9b64..679098a02 100644 --- a/src/syscalls/syscall_handler.rs +++ b/src/syscalls/syscall_handler.rs @@ -146,7 +146,7 @@ impl<'a, S: StateReader, C: ContractClassCache> HintProcessorPostRun // TODO: These four functions were copied from cairo-rs in // hint_processor/cairo-1-hint-processor/hint_processor_utils.rs as these functions are private. // They will became public soon and then we have to remove this ones and use the ones in cairo-rs instead -fn as_relocatable(vm: &mut VirtualMachine, value: &ResOperand) -> Result { +fn as_relocatable(vm: &VirtualMachine, value: &ResOperand) -> Result { let (base, offset) = extract_buffer(value)?; get_ptr(vm, base, &offset).map_err(HintError::from) } diff --git a/src/transaction/declare.rs b/src/transaction/declare.rs index 364628bcd..bf173065c 100644 --- a/src/transaction/declare.rs +++ b/src/transaction/declare.rs @@ -32,6 +32,8 @@ use crate::{ }; use cairo_vm::felt::Felt252; use num_traits::Zero; + +use std::fmt::Debug; use std::sync::Arc; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -146,6 +148,44 @@ impl Declare { Ok(internal_declare) } + #[allow(clippy::too_many_arguments)] + pub fn new_with_tx_and_class_hash( + contract_class: ContractClass, + sender_address: Address, + max_fee: u128, + version: Felt252, + signature: Vec, + nonce: Felt252, + hash_value: Felt252, + class_hash: ClassHash, + ) -> Result { + let validate_entry_point_selector = VALIDATE_DECLARE_ENTRY_POINT_SELECTOR.clone(); + + let internal_declare = Declare { + class_hash, + sender_address, + validate_entry_point_selector, + version, + max_fee, + signature, + nonce, + hash_value, + contract_class, + skip_execute: false, + skip_validate: false, + skip_fee_transfer: false, + }; + + verify_version( + &internal_declare.version, + internal_declare.max_fee, + &internal_declare.nonce, + &internal_declare.signature, + )?; + + Ok(internal_declare) + } + pub fn get_calldata(&self) -> Vec { let bytes = Felt252::from_bytes_be(&self.class_hash); Vec::from([bytes]) @@ -167,7 +207,7 @@ impl Declare { } else { self.run_validate_entrypoint(state, &mut resources_manager, block_context)? }; - let changes = state.count_actual_storage_changes(Some(( + let changes = state.count_actual_state_changes(Some(( &block_context.starknet_os_config.fee_token_address, &self.sender_address, )))?; @@ -266,6 +306,14 @@ impl Declare { /// Calculates actual fee used by the transaction using the execution /// info returned by apply(), then updates the transaction execution info with the data of the fee. + #[tracing::instrument(level = "debug", ret, err, skip(self, state, block_context), fields( + tx_type = ?TransactionType::Declare, + self.version = ?self.version, + self.class_hash = ?self.class_hash, + self.hash_value = ?self.hash_value, + self.sender_address = ?self.sender_address, + self.nonce = ?self.nonce, + ))] pub fn execute( &self, state: &mut CachedState, @@ -295,7 +343,7 @@ impl Declare { Ok(tx_exec_info) } - pub(crate) fn create_for_simulation( + pub fn create_for_simulation( &self, skip_validate: bool, skip_execute: bool, @@ -426,10 +474,10 @@ mod tests { entry_point_type: Some(EntryPointType::External), calldata, class_hash: Some(expected_class_hash), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 12, ..Default::default() - }, + }), ..Default::default() }); @@ -888,4 +936,104 @@ mod tests { Err(TransactionError::FeeTransferError(_)) ); } + + #[test] + fn declare_v1_with_validation_fee_higher_than_no_validation() { + // accounts contract class must be stored before running declaration of fibonacci + let contract_class = ContractClass::from_path("starknet_programs/Account.json").unwrap(); + + // Instantiate CachedState + let contract_class_cache = PermanentContractClassCache::default(); + + // ------------ contract data -------------------- + let hash = compute_deprecated_class_hash(&contract_class).unwrap(); + let class_hash = hash.to_be_bytes(); + + contract_class_cache.set_contract_class( + class_hash, + CompiledClass::Deprecated(Arc::new(contract_class)), + ); + + // store sender_address + let sender_address = Address(1.into()); + // this is not conceptually correct as the sender address would be an + // Account contract (not the contract that we are currently declaring) + // but for testing reasons its ok + + let mut state_reader = InMemoryStateReader::default(); + state_reader + .address_to_class_hash_mut() + .insert(sender_address.clone(), class_hash); + state_reader + .address_to_nonce_mut() + .insert(sender_address.clone(), Felt252::new(1)); + + let mut state = CachedState::new(Arc::new(state_reader), Arc::new(contract_class_cache)); + // Insert pubkey storage var to pass validation + let storage_entry = &( + sender_address, + felt_str!( + "1672321442399497129215646424919402195095307045612040218489019266998007191460" + ) + .to_be_bytes(), + ); + state.set_storage_at( + storage_entry, + felt_str!( + "1735102664668487605176656616876767369909409133946409161569774794110049207117" + ), + ); + + //* --------------------------------------- + //* Test declare with previous data + //* --------------------------------------- + + let fib_contract_class = + ContractClass::from_path("starknet_programs/fibonacci.json").unwrap(); + + let chain_id = StarknetChainId::TestNet.to_felt(); + + // declare tx + // Signature & tx hash values are hand-picked for account validations to pass + let mut declare = Declare::new( + fib_contract_class, + chain_id, + Address(Felt252::one()), + 60000, + 1.into(), + vec![ + felt_str!( + "3086480810278599376317923499561306189851900463386393948998357832163236918254" + ), + felt_str!( + "598673427589502599949712887611119751108407514580626464031881322743364689811" + ), + ], + Felt252::one(), + ) + .unwrap(); + declare.skip_fee_transfer = true; + declare.hash_value = felt_str!("2718"); + + let simulate_declare = declare + .clone() + .create_for_simulation(true, false, true, false); + + // --------------------- + // Comparison + // --------------------- + let mut state_copy = state.clone_for_testing(); + let mut bock_context = BlockContext::default(); + bock_context.starknet_os_config.gas_price = 12; + assert!( + declare + .execute(&mut state, &bock_context) + .unwrap() + .actual_fee + > simulate_declare + .execute(&mut state_copy, &bock_context, 0) + .unwrap() + .actual_fee, + ); + } } diff --git a/src/transaction/declare_v2.rs b/src/transaction/declare_v2.rs index a342b9d25..cbcca05cb 100644 --- a/src/transaction/declare_v2.rs +++ b/src/transaction/declare_v2.rs @@ -28,6 +28,7 @@ use cairo_lang_starknet::casm_contract_class::CasmContractClass; use cairo_lang_starknet::contract_class::ContractClass as SierraContractClass; use cairo_vm::felt::Felt252; use num_traits::Zero; +use std::fmt::Debug; use std::sync::Arc; /// Represents a declare transaction in the starknet network. @@ -42,7 +43,7 @@ pub struct DeclareV2 { pub signature: Vec, pub nonce: Felt252, pub compiled_class_hash: Felt252, - pub sierra_contract_class: SierraContractClass, + pub sierra_contract_class: Option, pub sierra_class_hash: Felt252, pub hash_value: Felt252, pub casm_class: Option, @@ -89,7 +90,7 @@ impl DeclareV2 { )?; Self::new_with_sierra_class_hash_and_tx_hash( - sierra_contract_class, + Some(sierra_contract_class.clone()), sierra_class_hash, casm_contract_class, compiled_class_hash, @@ -118,7 +119,7 @@ impl DeclareV2 { /// may not hold. #[allow(clippy::too_many_arguments)] pub fn new_with_sierra_class_hash_and_tx_hash( - sierra_contract_class: &SierraContractClass, + sierra_contract_class: Option, sierra_class_hash: Felt252, casm_contract_class: Option, compiled_class_hash: Felt252, @@ -184,7 +185,7 @@ impl DeclareV2 { let sierra_class_hash = compute_sierra_class_hash(sierra_contract_class)?; Self::new_with_sierra_class_hash_and_tx_hash( - sierra_contract_class, + Some(sierra_contract_class.clone()), sierra_class_hash, casm_contract_class, compiled_class_hash, @@ -211,7 +212,7 @@ impl DeclareV2 { /// - nonce: The nonce of the contract. #[allow(clippy::too_many_arguments)] pub fn new_with_sierra_class_hash( - sierra_contract_class: &SierraContractClass, + sierra_contract_class: Option, sierra_class_hash: Felt252, casm_contract_class: Option, compiled_class_hash: Felt252, @@ -296,11 +297,21 @@ impl DeclareV2 { /// ## Parameter: /// - state: An state that implements the State and StateReader traits. /// - block_context: The block that contains the execution context + #[tracing::instrument(level = "debug", ret, err, skip(self, state, block_context), fields( + tx_type = ?TransactionType::Declare, + self.version = ?self.version, + self.sierra_class_hash = ?self.sierra_class_hash, + self.compiled_class_hash = ?self.compiled_class_hash, + self.hash_value = ?self.hash_value, + self.sender_address = ?self.sender_address, + self.nonce = ?self.nonce, + ))] pub fn execute( &self, state: &mut CachedState, block_context: &BlockContext, ) -> Result { + self.handle_nonce(state)?; verify_version(&self.version, self.max_fee, &self.nonce, &self.signature)?; let initial_gas = INITIAL_GAS_COST; @@ -318,11 +329,13 @@ impl DeclareV2 { )?; (info, gas) }; + self.compile_and_store_casm_class(state)?; - let storage_changes = state.count_actual_storage_changes(Some(( + let storage_changes = state.count_actual_state_changes(Some(( &block_context.starknet_os_config.fee_token_address, &self.sender_address, )))?; + let actual_resources = calculate_tx_resources( resources_manager, &[execution_result.call_info.clone()], @@ -342,7 +355,6 @@ impl DeclareV2 { &mut tx_execution_context, self.skip_fee_transfer, )?; - self.compile_and_store_casm_class(state)?; let mut tx_exec_info = TransactionExecutionInfo::new_without_fee_info( execution_result.call_info, @@ -361,10 +373,13 @@ impl DeclareV2 { state: &mut S, ) -> Result<(), TransactionError> { let casm_class = match &self.casm_class { - None => { - CasmContractClass::from_contract_class(self.sierra_contract_class.clone(), true) - .map_err(|e| TransactionError::SierraCompileError(e.to_string()))? - } + None => CasmContractClass::from_contract_class( + self.sierra_contract_class + .clone() + .ok_or(TransactionError::DeclareV2NoSierraOrCasm)?, + true, + ) + .map_err(|e| TransactionError::SierraCompileError(e.to_string()))?, Some(casm_contract_class) => casm_contract_class.clone(), }; @@ -375,8 +390,11 @@ impl DeclareV2 { self.compiled_class_hash.to_string(), )); } - state.set_compiled_class_hash(&self.sierra_class_hash, &self.compiled_class_hash)?; + if let Some(ref class) = self.sierra_contract_class { + state.set_sierra_program(&self.sierra_class_hash, class.sierra_program.clone())?; + } + state.set_compiled_class_hash(&self.sierra_class_hash, &self.compiled_class_hash)?; state.set_contract_class( &self.compiled_class_hash.to_be_bytes(), &CompiledClass::Casm(Arc::new(casm_class)), @@ -433,7 +451,7 @@ impl DeclareV2 { // --------------- // Simulation // --------------- - pub(crate) fn create_for_simulation( + pub fn create_for_simulation( &self, skip_validate: bool, skip_execute: bool, @@ -527,7 +545,7 @@ mod tests { // test we can retreive the data let expected_casm_class = CasmContractClass::from_contract_class( - internal_declare.sierra_contract_class.clone(), + internal_declare.sierra_contract_class.unwrap().clone(), true, ) .unwrap(); @@ -596,7 +614,7 @@ mod tests { // test we can retreive the data let expected_casm_class = CasmContractClass::from_contract_class( - internal_declare.sierra_contract_class.clone(), + internal_declare.sierra_contract_class.unwrap(), true, ) .unwrap(); @@ -619,13 +637,13 @@ mod tests { let path; #[cfg(not(feature = "cairo_1_tests"))] { - version = &2.into() | &QUERY_VERSION_BASE.clone(); + version = &Into::::into(2) | &QUERY_VERSION_BASE.clone(); path = PathBuf::from("starknet_programs/cairo2/fibonacci.sierra"); } #[cfg(feature = "cairo_1_tests")] { - version = &1.into() | &QUERY_VERSION_BASE.clone(); + version = &Into::::into(1) | &QUERY_VERSION_BASE.clone(); path = PathBuf::from("starknet_programs/cairo1/fibonacci.sierra"); } @@ -642,7 +660,7 @@ mod tests { // create internal declare v2 let internal_declare = DeclareV2::new_with_sierra_class_hash_and_tx_hash( - &sierra_contract_class, + Some(sierra_contract_class), sierra_class_hash, Some(casm_class), casm_class_hash, @@ -667,7 +685,7 @@ mod tests { // test we can retreive the data let expected_casm_class = CasmContractClass::from_contract_class( - internal_declare.sierra_contract_class.clone(), + internal_declare.sierra_contract_class.unwrap(), true, ) .unwrap(); @@ -736,7 +754,7 @@ mod tests { // test we can retreive the data let expected_casm_class = CasmContractClass::from_contract_class( - internal_declare.sierra_contract_class.clone(), + internal_declare.sierra_contract_class.unwrap().clone(), true, ) .unwrap(); diff --git a/src/transaction/deploy.rs b/src/transaction/deploy.rs index 32bf9feb3..47168dfc4 100644 --- a/src/transaction/deploy.rs +++ b/src/transaction/deploy.rs @@ -34,6 +34,8 @@ use cairo_vm::felt::Felt252; use num_traits::Zero; use std::sync::Arc; +use std::fmt::Debug; + /// Represents a Deploy Transaction in the starknet network #[derive(Debug, Clone)] pub struct Deploy { @@ -138,6 +140,7 @@ impl Deploy { .ok_or(ContractClassError::NoneEntryPointType)? .is_empty()), CompiledClass::Casm(class) => Ok(class.entry_points_by_type.constructor.is_empty()), + CompiledClass::Sierra(_) => todo!(), } } /// Deploys the contract in the starknet network and calls its constructor if it has one. @@ -149,7 +152,13 @@ impl Deploy { state: &mut CachedState, block_context: &BlockContext, ) -> Result { - state.set_contract_class(&self.contract_hash, &self.contract_class)?; + match self.contract_class { + CompiledClass::Sierra(_) => todo!(), + _ => { + state.set_contract_class(&self.contract_hash, &self.contract_class)?; + } + } + state.deploy_contract(self.contract_address.clone(), self.contract_hash)?; if self.constructor_entry_points_empty(self.contract_class.clone())? { @@ -180,7 +189,7 @@ impl Deploy { let resources_manager = ExecutionResourcesManager::default(); - let changes = state.count_actual_storage_changes(None)?; + let changes = state.count_actual_state_changes(None)?; let actual_resources = calculate_tx_resources( resources_manager, &[Some(call_info.clone())], @@ -243,7 +252,7 @@ impl Deploy { block_context.validate_max_n_steps, )?; - let changes = state.count_actual_storage_changes(None)?; + let changes = state.count_actual_state_changes(None)?; let actual_resources = calculate_tx_resources( resources_manager, &[call_info.clone()], @@ -267,6 +276,14 @@ impl Deploy { /// ## Parameters /// - state: A state that implements the [`State`] and [`StateReader`] traits. /// - block_context: The block's execution context. + #[tracing::instrument(level = "debug", ret, err, skip(self, state, block_context), fields( + tx_type = ?TransactionType::Deploy, + self.version = ?self.version, + self.contract_hash = ?self.contract_hash, + self.hash_value = ?self.hash_value, + self.contract_address = ?self.contract_address, + self.contract_address_salt = ?self.contract_address_salt, + ))] pub fn execute( &self, state: &mut CachedState, diff --git a/src/transaction/deploy_account.rs b/src/transaction/deploy_account.rs index b537c6f99..978cbcca0 100644 --- a/src/transaction/deploy_account.rs +++ b/src/transaction/deploy_account.rs @@ -40,6 +40,7 @@ use crate::{ use cairo_vm::felt::Felt252; use getset::Getters; use num_traits::Zero; +use std::fmt::Debug; #[derive(Clone, Debug, PartialEq, Eq)] pub struct StateSelector { @@ -156,6 +157,15 @@ impl DeployAccount { } } + #[tracing::instrument(level = "debug", ret, err, skip(self, state, block_context), fields( + tx_type = ?TransactionType::DeployAccount, + self.version = ?self.version, + self.class_hash = ?self.class_hash, + self.hash_value = ?self.hash_value, + self.contract_address = ?self.contract_address, + self.contract_address_salt = ?self.contract_address_salt, + self.nonce = ?self.nonce, + ))] pub fn execute( &self, state: &mut CachedState, @@ -163,7 +173,7 @@ impl DeployAccount { ) -> Result { self.handle_nonce(state)?; - let mut transactional_state = state.create_transactional(); + let mut transactional_state = state.create_transactional()?; let mut tx_exec_info = self.apply(&mut transactional_state, block_context)?; let actual_fee = calculate_tx_fee( @@ -215,6 +225,7 @@ impl DeployAccount { .ok_or(ContractClassError::NoneEntryPointType)? .is_empty()), CompiledClass::Casm(class) => Ok(class.entry_points_by_type.constructor.is_empty()), + CompiledClass::Sierra(_) => todo!(), } } @@ -243,7 +254,7 @@ impl DeployAccount { resources_manager, &[Some(constructor_call_info.clone()), validate_info.clone()], TransactionType::DeployAccount, - state.count_actual_storage_changes(Some(( + state.count_actual_state_changes(Some(( &block_context.starknet_os_config.fee_token_address, &self.contract_address, )))?, @@ -393,7 +404,7 @@ impl DeployAccount { Ok(call_info) } - pub(crate) fn create_for_simulation( + pub fn create_for_simulation( &self, skip_validate: bool, skip_execute: bool, @@ -414,6 +425,42 @@ impl DeployAccount { Transaction::DeployAccount(tx) } + + pub fn from_sn_api_transaction( + value: starknet_api::transaction::DeployAccountTransaction, + chain_id: Felt252, + ) -> Result { + let max_fee = value.max_fee.0; + let version = Felt252::from_bytes_be(value.version.0.bytes()); + let nonce = Felt252::from_bytes_be(value.nonce.0.bytes()); + let class_hash: [u8; 32] = value.class_hash.0.bytes().try_into().unwrap(); + let contract_address_salt = Felt252::from_bytes_be(value.contract_address_salt.0.bytes()); + + let signature = value + .signature + .0 + .iter() + .map(|f| Felt252::from_bytes_be(f.bytes())) + .collect(); + let constructor_calldata = value + .constructor_calldata + .0 + .as_ref() + .iter() + .map(|f| Felt252::from_bytes_be(f.bytes())) + .collect(); + + DeployAccount::new( + class_hash, + max_fee, + version, + nonce, + constructor_calldata, + signature, + contract_address_salt, + chain_id, + ) + } } // ---------------------------------- diff --git a/src/transaction/error.rs b/src/transaction/error.rs index c254dd152..87a1f76a5 100644 --- a/src/transaction/error.rs +++ b/src/transaction/error.rs @@ -147,4 +147,6 @@ pub enum TransactionError { InvalidCompiledClassHash(String, String), #[error(transparent)] FromByteArrayError(#[from] FromByteArrayError), + #[error("DeclareV2 transaction has neither Sierra nor Casm contract class set")] + DeclareV2NoSierraOrCasm, } diff --git a/src/transaction/fee.rs b/src/transaction/fee.rs index 9808591be..aa04a6e38 100644 --- a/src/transaction/fee.rs +++ b/src/transaction/fee.rs @@ -73,11 +73,9 @@ pub(crate) fn execute_fee_transfer( call_info.ok_or(TransactionError::CallInfoIsNone) } -// ---------------------------------------------------------------------------------------- /// Calculates the fee of a transaction given its execution resources. /// We add the l1_gas_usage (which may include, for example, the direct cost of L2-to-L1 /// messages) to the gas consumed by Cairo resource and multiply by the L1 gas price. - pub fn calculate_tx_fee( resources: &HashMap, gas_price: u128, @@ -94,11 +92,9 @@ pub fn calculate_tx_fee( Ok(total_l1_gas_usage.ceil() as u128 * gas_price) } -// ---------------------------------------------------------------------------------------- /// Calculates the L1 gas consumed when submitting the underlying Cairo program to SHARP. /// I.e., returns the heaviest Cairo resource weight (in terms of L1 gas), as the size of /// a proof is determined similarly - by the (normalized) largest segment. - pub(crate) fn calculate_l1_gas_by_cairo_usage( block_context: &BlockContext, cairo_resource_usage: &HashMap, @@ -117,6 +113,7 @@ pub(crate) fn calculate_l1_gas_by_cairo_usage( )) } +/// Calculates the maximum weighted value from a given resource usage mapping. fn max_of_keys(cairo_rsc: &HashMap, weights: &HashMap) -> f64 { let mut max = 0.0_f64; for (k, v) in weights { @@ -136,6 +133,11 @@ fn max_of_keys(cairo_rsc: &HashMap, weights: &HashMap( state: &mut CachedState, resources: &HashMap, @@ -195,6 +197,8 @@ mod tests { }; use std::{collections::HashMap, sync::Arc}; + /// Tests the behavior of the charge_fee function when the actual fee exceeds the maximum fee + /// for version 0. It expects to return an ActualFeeExceedsMaxFee error. #[test] fn charge_fee_v0_max_fee_exceeded_should_charge_nothing() { let mut state = CachedState::new( @@ -224,6 +228,8 @@ mod tests { assert_eq!(result.1, 0); } + /// Tests the behavior of the charge_fee function when the actual fee exceeds the maximum fee + /// for version 1. It expects the function to return the maximum fee. #[test] fn charge_fee_v1_max_fee_exceeded_should_charge_max_fee() { let mut state = CachedState::new( diff --git a/src/transaction/invoke_function.rs b/src/transaction/invoke_function.rs index 877131c0f..1f8a0937c 100644 --- a/src/transaction/invoke_function.rs +++ b/src/transaction/invoke_function.rs @@ -28,6 +28,7 @@ use crate::{ use cairo_vm::felt::Felt252; use getset::Getters; use num_traits::Zero; +use std::fmt::Debug; /// Represents an InvokeFunction transaction in the starknet network. #[derive(Debug, Getters, Clone)] @@ -244,8 +245,12 @@ impl InvokeFunction { remaining_gas: u128, ) -> Result { let mut resources_manager = ExecutionResourcesManager::default(); - let validate_info = - self.run_validate_entrypoint(state, &mut resources_manager, block_context)?; + let validate_info = if self.skip_validation { + None + } else { + self.run_validate_entrypoint(state, &mut resources_manager, block_context)? + }; + // Execute transaction let ExecutionResult { call_info, @@ -261,7 +266,7 @@ impl InvokeFunction { remaining_gas, )? }; - let changes = state.count_actual_storage_changes(Some(( + let changes = state.count_actual_state_changes(Some(( &block_context.starknet_os_config.fee_token_address, &self.contract_address, )))?; @@ -289,6 +294,14 @@ impl InvokeFunction { /// - state: A state that implements the [`State`] and [`StateReader`] traits. /// - block_context: The block's execution context. /// - remaining_gas: The amount of gas that the transaction disposes. + #[tracing::instrument(level = "debug", ret, err, skip(self, state, block_context), fields( + tx_type = ?TransactionType::InvokeFunction, + self.version = ?self.version, + self.hash_value = ?self.hash_value, + self.contract_address = ?self.contract_address, + self.entry_point_selector = ?self.entry_point_selector, + self.entry_point_type = ?self.entry_point_type, + ))] pub fn execute( &self, state: &mut CachedState, @@ -299,7 +312,7 @@ impl InvokeFunction { self.handle_nonce(state)?; } - let mut transactional_state = state.create_transactional(); + let mut transactional_state = state.create_transactional()?; let mut tx_exec_info = self.apply(&mut transactional_state, block_context, remaining_gas)?; @@ -659,7 +672,7 @@ mod tests { ) .unwrap(); - let mut transactional = state.create_transactional(); + let mut transactional = state.create_transactional().unwrap(); // Invoke result let result = internal_invoke_function .apply(&mut transactional, &BlockContext::default(), 0) @@ -804,7 +817,7 @@ mod tests { ) .unwrap(); - let mut transactional = state.create_transactional(); + let mut transactional = state.create_transactional().unwrap(); let expected_error = internal_invoke_function.apply(&mut transactional, &BlockContext::default(), 0); @@ -867,7 +880,7 @@ mod tests { ) .unwrap(); - let mut transactional = state.create_transactional(); + let mut transactional = state.create_transactional().unwrap(); // Invoke result let result = internal_invoke_function .apply(&mut transactional, &BlockContext::default(), 0) @@ -940,7 +953,7 @@ mod tests { ) .unwrap(); - let mut transactional = state.create_transactional(); + let mut transactional = state.create_transactional().unwrap(); // Invoke result let expected_error = internal_invoke_function.apply(&mut transactional, &BlockContext::default(), 0); @@ -1291,7 +1304,7 @@ mod tests { ) .unwrap(), None, - &1.into() | &QUERY_VERSION_BASE.clone(), + &Into::::into(1) | &QUERY_VERSION_BASE.clone(), ); assert!(expected_error.is_err()); } @@ -1342,7 +1355,7 @@ mod tests { let mut state = CachedState::new(Arc::new(state_reader), Arc::new(casm_contract_class_cache)); - let state_before_execution = state.clone(); + let state_before_execution = state.clone_for_testing(); let result = internal_invoke_function .execute(&mut state, &BlockContext::default(), 0) diff --git a/src/transaction/l1_handler.rs b/src/transaction/l1_handler.rs index fbae7e3e6..f01031436 100644 --- a/src/transaction/l1_handler.rs +++ b/src/transaction/l1_handler.rs @@ -7,6 +7,7 @@ use cairo_vm::felt::Felt252; use getset::Getters; use num_traits::Zero; +use super::Transaction; use crate::{ core::transaction_hash::{calculate_transaction_hash_common, TransactionHashPrefix}, definitions::{ @@ -25,10 +26,9 @@ use crate::{ utils::{calculate_tx_resources, Address}, }; -use super::Transaction; - #[allow(dead_code)] #[derive(Debug, Getters, Clone)] +/// Represents an L1Handler transaction in the StarkNet network. pub struct L1Handler { #[getset(get = "pub")] hash_value: Felt252, @@ -43,6 +43,7 @@ pub struct L1Handler { } impl L1Handler { + /// Constructor creates a new [L1Handler] instance. pub fn new( contract_address: Address, entry_point_selector: Felt252, @@ -71,7 +72,12 @@ impl L1Handler { hash_value, ) } - + /// Creates a new [L1Handler] instance with a specified transaction hash. + /// + /// # Safety + /// + /// `tx_hash` will be assumed to be the same as would result from calling + /// `calculate_transaction_hash_common`. Non-compliance will result in silent misbehavior. pub fn new_with_tx_hash( contract_address: Address, entry_point_selector: Felt252, @@ -93,6 +99,13 @@ impl L1Handler { } /// Applies self to 'state' by executing the L1-handler entry point. + #[tracing::instrument(level = "debug", ret, err, skip(self, state, block_context), fields( + tx_type = ?TransactionType::L1Handler, + self.hash_value = ?self.hash_value, + self.contract_address = ?self.contract_address, + self.entry_point_selector = ?self.entry_point_selector, + self.nonce = ?self.nonce, + ))] pub fn execute( &self, state: &mut CachedState, @@ -128,7 +141,7 @@ impl L1Handler { )? }; - let changes = state.count_actual_storage_changes(None)?; + let changes = state.count_actual_state_changes(None)?; let actual_resources = calculate_tx_resources( resources_manager, &[call_info.clone()], @@ -189,11 +202,9 @@ impl L1Handler { L1_HANDLER_VERSION.into(), )) } - pub(crate) fn create_for_simulation( - &self, - skip_validate: bool, - skip_execute: bool, - ) -> Transaction { + + /// Creates a L1Handler for simulation purposes. + pub fn create_for_simulation(&self, skip_validate: bool, skip_execute: bool) -> Transaction { let tx = L1Handler { skip_validate, skip_execute, @@ -202,6 +213,27 @@ impl L1Handler { Transaction::L1Handler(tx) } + + /// Creates a `L1Handler` from a starknet api `L1HandlerTransaction`. + pub fn from_sn_api_tx( + tx: starknet_api::transaction::L1HandlerTransaction, + tx_hash: Felt252, + paid_fee_on_l1: Option, + ) -> Result { + L1Handler::new_with_tx_hash( + Address(Felt252::from_bytes_be(tx.contract_address.0.key().bytes())), + Felt252::from_bytes_be(tx.entry_point_selector.0.bytes()), + tx.calldata + .0 + .as_ref() + .iter() + .map(|f| Felt252::from_bytes_be(f.bytes())) + .collect(), + Felt252::from_bytes_be(tx.nonce.0.bytes()), + paid_fee_on_l1, + tx_hash, + ) + } } #[cfg(test)] @@ -230,6 +262,7 @@ mod test { sync::Arc, }; + /// Test the correct execution of the L1Handler. #[test] fn test_execute_l1_handler() { let l1_handler = L1Handler::new( @@ -289,6 +322,8 @@ mod test { assert_eq!(tx_exec, expected_tx_exec) } + /// Helper function to construct the expected transaction execution info. + /// Expected output of the L1Handler's execution. fn expected_tx_exec_info() -> TransactionExecutionInfo { TransactionExecutionInfo { validate_info: None, @@ -311,14 +346,14 @@ mod test { 10.into(), ], retdata: vec![], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 141, n_memory_holes: 20, builtin_instance_counter: HashMap::from([ ("range_check_builtin".to_string(), 6), ("pedersen_builtin".to_string(), 2), ]), - }, + }), events: vec![], l2_to_l1_messages: vec![], storage_read_values: vec![0.into(), 0.into()], diff --git a/src/transaction/mod.rs b/src/transaction/mod.rs index 5584aa940..3d75e4266 100644 --- a/src/transaction/mod.rs +++ b/src/transaction/mod.rs @@ -82,6 +82,7 @@ impl Transaction { Transaction::L1Handler(tx) => tx.execute(state, block_context, remaining_gas), } } + /// It creates a new transaction structure modificating the skip flags. It is meant to be used only to run a simulation ///## Parameters: ///- skip_validate: the transaction will not be verified. diff --git a/src/transaction/verify_version.rs b/src/transaction/verify_version.rs index 8787b09b9..2f9abecdb 100644 --- a/src/transaction/verify_version.rs +++ b/src/transaction/verify_version.rs @@ -31,6 +31,8 @@ pub fn verify_version( #[cfg(test)] mod test { + use cairo_vm::felt::Felt252; + // TODO: fixture tests would be better here use crate::{definitions::constants::QUERY_VERSION_BASE, transaction::error::TransactionError}; @@ -109,7 +111,7 @@ mod test { #[test] fn version_0_with_max_fee_0_nonce_0_and_empty_signature_and_query_version_set_should_return_ok() { - let version = &0.into() | &QUERY_VERSION_BASE.clone(); + let version = &Into::::into(0) | &QUERY_VERSION_BASE.clone(); let max_fee = 0; let nonce = 0.into(); let signature = vec![]; @@ -119,7 +121,7 @@ mod test { #[test] fn version_1_with_query_version_set_should_return_ok() { - let version = &1.into() | &QUERY_VERSION_BASE.clone(); + let version = &Into::::into(1) | &QUERY_VERSION_BASE.clone(); let max_fee = 2; let nonce = 3.into(); let signature = vec![5.into()]; @@ -129,7 +131,7 @@ mod test { #[test] fn version_2_with_query_version_set_should_return_ok() { - let version = &2.into() | &QUERY_VERSION_BASE.clone(); + let version = &Into::::into(2) | &QUERY_VERSION_BASE.clone(); let max_fee = 43; let nonce = 4.into(); let signature = vec![6.into()]; diff --git a/src/utils.rs b/src/utils.rs index b1736f852..dfa67e6d4 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,6 +1,6 @@ use crate::core::errors::hash_errors::HashError; use crate::services::api::contract_classes::deprecated_contract_class::EntryPointType; -use crate::state::state_api::State; +use crate::state::state_api::{State, StateChangesCount}; use crate::{ definitions::transaction_type::TransactionType, execution::{ @@ -16,6 +16,7 @@ use cairo_vm::{ felt::Felt252, serde::deserialize_program::BuiltinName, vm::runners::builtin_runner, }; use cairo_vm::{types::relocatable::Relocatable, vm::vm_core::VirtualMachine}; +use core::fmt; use num_integer::Integer; use num_traits::{Num, ToPrimitive}; use serde::{Deserialize, Serialize}; @@ -36,9 +37,21 @@ pub type CompiledClassHash = [u8; 32]; //* Address //* ------------------- -#[derive(Debug, Clone, PartialEq, Hash, Eq, Default, Serialize, Deserialize)] +#[derive(Clone, PartialEq, Hash, Eq, Default, Serialize, Deserialize)] pub struct Address(pub Felt252); +impl fmt::Display for Address { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "0x{}", self.0.to_str_radix(16)) + } +} + +impl fmt::Debug for Address { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self) + } +} + //* ------------------- //* Helper Functions //* ------------------- @@ -135,17 +148,17 @@ pub fn string_to_hash(class_string: &String) -> ClassHash { /// Converts CachedState storage mapping to StateDiff storage mapping. pub fn to_state_diff_storage_mapping( - storage_writes: HashMap, + storage_writes: &HashMap, ) -> HashMap> { let mut storage_updates: HashMap> = HashMap::new(); - for ((address, key), value) in storage_writes.into_iter() { + for ((address, key), value) in storage_writes.iter() { storage_updates - .entry(address) + .entry(address.clone()) .and_modify(|updates_for_address: &mut HashMap| { - let key_fe = Felt252::from_bytes_be(&key); + let key_fe = Felt252::from_bytes_be(key); updates_for_address.insert(key_fe, value.clone()); }) - .or_insert_with(|| HashMap::from([(Felt252::from_bytes_be(&key), value)])); + .or_insert_with(|| HashMap::from([(Felt252::from_bytes_be(key), value.clone())])); } storage_updates } @@ -169,14 +182,11 @@ pub fn calculate_tx_resources( resources_manager: ExecutionResourcesManager, call_info: &[Option], tx_type: TransactionType, - storage_changes: (usize, usize), + state_changes: StateChangesCount, l1_handler_payload_size: Option, n_reverted_steps: usize, ) -> Result, TransactionError> { - let (n_modified_contracts, n_storage_changes) = storage_changes; - let non_optional_calls: Vec = call_info.iter().flatten().cloned().collect(); - let n_deployments = non_optional_calls.iter().map(get_call_n_deployments).sum(); let mut l2_to_l1_messages = Vec::new(); @@ -184,13 +194,8 @@ pub fn calculate_tx_resources( l2_to_l1_messages.extend(call_info.get_sorted_l2_to_l1_messages()?) } - let l1_gas_usage = calculate_tx_gas_usage( - l2_to_l1_messages, - n_modified_contracts, - n_storage_changes, - l1_handler_payload_size, - n_deployments, - ); + let l1_gas_usage = + calculate_tx_gas_usage(l2_to_l1_messages, &state_changes, l1_handler_payload_size); let cairo_usage = resources_manager.cairo_usage.clone(); let tx_syscall_counter = resources_manager.syscall_counter; @@ -301,7 +306,7 @@ pub fn get_storage_var_address( let args = args .iter() - .map(|felt| felt_to_field_element(felt)) + .map(felt_to_field_element) .collect::, _>>()?; let storage_var_name_hash = @@ -488,6 +493,7 @@ pub mod test_utils { macro_rules! ids_data { ( $( $name: expr ),* ) => { { + #[allow(clippy::useless_vec)] let ids_names = vec![$( $name ),*]; let references = $crate::utils::test_utils::references!(ids_names.len() as i32); let mut ids_data = HashMap::::new(); @@ -810,7 +816,7 @@ mod test { storage.insert((address1.clone(), key1), value1.clone()); storage.insert((address2.clone(), key2), value2.clone()); - let map = to_state_diff_storage_mapping(storage); + let map = to_state_diff_storage_mapping(&storage); let key1_fe = Felt252::from_bytes_be(key1.as_slice()); let key2_fe = Felt252::from_bytes_be(key2.as_slice()); @@ -881,7 +887,7 @@ mod test { storage.insert((address1.clone(), key1), value1.clone()); storage.insert((address2.clone(), key2), value2.clone()); - let state_dff = to_state_diff_storage_mapping(storage); + let state_dff = to_state_diff_storage_mapping(&storage); let cache_storage = to_cache_state_storage_mapping(&state_dff); let mut expected_res = HashMap::new(); @@ -920,4 +926,10 @@ mod test { ], ); } + + #[test] + fn test_address_display() { + let address = Address(Felt252::from(123456789)); + assert_eq!(format!("{}", address), "0x75bcd15".to_string()); + } } diff --git a/starknet_programs/cairo1/square_root_recursive.cairo b/starknet_programs/cairo1/square_root_recursive.cairo new file mode 100644 index 000000000..a38b7e1fe --- /dev/null +++ b/starknet_programs/cairo1/square_root_recursive.cairo @@ -0,0 +1,24 @@ +#[abi] +trait Math { + #[external] + fn square_root(n: felt252) -> felt252; +} + +#[contract] +mod SquareRoot { + use super::MathDispatcherTrait; + use super::MathLibraryDispatcher; + use starknet::ClassHash; + + #[external] + fn square_root_recursive(n: felt252, math_class_hash: ClassHash, n_iterations: u32) -> felt252 { + square_root_recursive_inner(n, math_class_hash, n_iterations) + } + + fn square_root_recursive_inner(n: felt252, math_class_hash: ClassHash, n_iterations: u32) -> felt252 { + if n_iterations == 0 { + return n; + } + square_root_recursive_inner(MathLibraryDispatcher {class_hash: math_class_hash}.square_root(n), math_class_hash, n_iterations - 1) + } +} diff --git a/starknet_programs/cairo1/wallet_wrapper.cairo b/starknet_programs/cairo1/wallet_wrapper.cairo index d3557a309..ca65cef90 100644 --- a/starknet_programs/cairo1/wallet_wrapper.cairo +++ b/starknet_programs/cairo1/wallet_wrapper.cairo @@ -22,4 +22,13 @@ mod WalletWrapper { fn increase_balance(amount: felt252, simple_wallet_contract_address: ContractAddress) { SimpleWalletDispatcher {contract_address: simple_wallet_contract_address}.increase_balance(amount) } + + #[external] + fn increase_balance_recursive(amount: felt252, simple_wallet_contract_address: ContractAddress) { + if amount == 0 { + return(); + } + SimpleWalletDispatcher {contract_address: simple_wallet_contract_address}.increase_balance(1); + increase_balance_recursive(amount - 1, simple_wallet_contract_address) + } } diff --git a/starknet_programs/cairo2/account_panic.cairo b/starknet_programs/cairo2/account_panic.cairo new file mode 100644 index 000000000..3cb051250 --- /dev/null +++ b/starknet_programs/cairo2/account_panic.cairo @@ -0,0 +1,148 @@ +use starknet::account::Call; + +mod SUPPORTED_TX_VERSION { + const DEPLOY_ACCOUNT: felt252 = 1; + const DECLARE: felt252 = 2; + const INVOKE: felt252 = 1; +} + +#[starknet::interface] +trait IAccount { + fn is_valid_signature(self: @T, hash: felt252, signature: Array) -> felt252; + fn supports_interface(self: @T, interface_id: felt252) -> bool; + fn public_key(self: @T) -> felt252; +} + +#[starknet::contract] +mod Account { + use super::{Call, IAccount, SUPPORTED_TX_VERSION}; + use starknet::{get_caller_address, call_contract_syscall, get_tx_info, VALIDATED}; + use zeroable::Zeroable; + use array::{ArrayTrait, SpanTrait}; + use ecdsa::check_ecdsa_signature; + use box::BoxTrait; + use result::ResultTrait; + + const SIMULATE_TX_VERSION_OFFSET: felt252 = 340282366920938463463374607431768211456; // 2**128 + const SRC6_TRAIT_ID: felt252 = 1270010605630597976495846281167968799381097569185364931397797212080166453709; // hash of SNIP-6 trait + + #[storage] + struct Storage { + public_key: felt252 + } + + #[constructor] + fn constructor(ref self: ContractState, public_key: felt252) { + self.public_key.write(public_key); + } + + #[external(v0)] + impl AccountImpl of IAccount { + fn is_valid_signature(self: @ContractState, hash: felt252, signature: Array) -> felt252 { + let is_valid = self.is_valid_signature_bool(hash, signature.span()); + if is_valid { VALIDATED } else { 0 } + } + + fn supports_interface(self: @ContractState, interface_id: felt252) -> bool { + interface_id == SRC6_TRAIT_ID + } + + fn public_key(self: @ContractState) -> felt252 { + self.public_key.read() + } + } + + #[external(v0)] + #[generate_trait] + impl ProtocolImpl of ProtocolTrait { + fn __execute__(ref self: ContractState, calls: Array) -> Array> { + let arr = ArrayTrait::new(); + panic_with_felt252('panic'); + arr + //self.only_protocol(); + // self.only_supported_tx_version(SUPPORTED_TX_VERSION::INVOKE); + // self.execute_multiple_calls(calls) + } + + fn __validate__(self: @ContractState, calls: Array) -> felt252 { + panic_with_felt252('panic'); + 0 +// self.only_protocol(); +// self.only_supported_tx_version(SUPPORTED_TX_VERSION::INVOKE); +// self.validate_transaction() + } + + fn __validate_declare__(self: @ContractState, class_hash: felt252) -> felt252 { + self.only_protocol(); + self.only_supported_tx_version(SUPPORTED_TX_VERSION::DECLARE); + self.validate_transaction() + } + + fn __validate_deploy__(self: @ContractState, class_hash: felt252, salt: felt252, public_key: felt252) -> felt252 { + self.only_protocol(); + self.only_supported_tx_version(SUPPORTED_TX_VERSION::DEPLOY_ACCOUNT); + self.validate_transaction() + } + } + + #[generate_trait] + impl PrivateImpl of PrivateTrait { + fn only_protocol(self: @ContractState) { + let sender = get_caller_address(); + assert(sender.is_zero(), 'Account: invalid caller'); + } + + fn is_valid_signature_bool(self: @ContractState, hash: felt252, signature: Span) -> bool { + let is_valid_length = signature.len() == 2_u32; + + if !is_valid_length { + return false; + } + + check_ecdsa_signature( + hash, self.public_key.read(), *signature.at(0_u32), *signature.at(1_u32) + ) + } + + fn validate_transaction(self: @ContractState) -> felt252 { + let tx_info = get_tx_info().unbox(); + let tx_hash = tx_info.transaction_hash; + let signature = tx_info.signature; + + let is_valid = self.is_valid_signature_bool(tx_hash, signature); + assert(is_valid, 'Account: Incorrect tx signature'); + VALIDATED + } + + fn execute_single_call(self: @ContractState, call: Call) -> Span { + let Call{to, selector, calldata} = call; + call_contract_syscall(to, selector, calldata.span()).unwrap() + } + + fn execute_multiple_calls(self: @ContractState, mut calls: Array) -> Array> { + let mut res = ArrayTrait::new(); + loop { + match calls.pop_front() { + Option::Some(call) => { + let _res = self.execute_single_call(call); + res.append(_res); + }, + Option::None(_) => { + break (); + }, + }; + }; + res + } + + fn only_supported_tx_version(self: @ContractState, supported_tx_version: felt252) { + let tx_info = get_tx_info().unbox(); + let version = tx_info.version; + assert( + version == supported_tx_version || + version == SIMULATE_TX_VERSION_OFFSET + supported_tx_version, + 'Account: Unsupported tx version' + ); + } + } +} diff --git a/starknet_programs/cairo2/callee.cairo b/starknet_programs/cairo2/callee.cairo new file mode 100644 index 000000000..3a71ab549 --- /dev/null +++ b/starknet_programs/cairo2/callee.cairo @@ -0,0 +1,22 @@ +#[starknet::contract] +mod Callee { + #[storage] + struct Storage { + balance: felt252, + } + + #[constructor] + fn constructor(ref self: ContractState, initial_balance: felt252) { + self.balance.write(initial_balance); + } + + #[external(v0)] + fn return_42(ref self: ContractState) -> felt252 { + 42 + } + + #[external(v0)] + fn return_44(ref self: ContractState) -> felt252 { + 44 + } +} \ No newline at end of file diff --git a/starknet_programs/cairo2/caller.cairo b/starknet_programs/cairo2/caller.cairo new file mode 100644 index 000000000..179478d46 --- /dev/null +++ b/starknet_programs/cairo2/caller.cairo @@ -0,0 +1,19 @@ +#[starknet::contract] +mod Caller { + use starknet::call_contract_syscall; + use core::array; + use core::result::ResultTrait; + + #[storage] + struct Storage { + balance: felt252, + } + + #[external(v0)] + fn call_callee_contract(ref self: ContractState, function_selector: felt252) -> felt252 { + let calldata: Array = ArrayTrait::new(); + let callee_addr = starknet::get_contract_address(); + let return_data = call_contract_syscall(callee_addr, function_selector, calldata.span()).unwrap(); + *return_data.get(0_usize).unwrap().unbox() + } +} diff --git a/starknet_programs/cairo2/deploy.cairo b/starknet_programs/cairo2/deploy.cairo index b773e94bb..8025d11aa 100644 --- a/starknet_programs/cairo2/deploy.cairo +++ b/starknet_programs/cairo2/deploy.cairo @@ -1,6 +1,8 @@ +use starknet::class_hash::ClassHash; + #[starknet::interface] trait IDeployTest { - fn deploy_test(self: @TContractState, class_hash: felt252, contract_address_salt: felt252) -> starknet::contract_address::ContractAddress; + fn deploy_test(self: @TContractState, class_hash: ClassHash, contract_address_salt: felt252) -> starknet::contract_address::ContractAddress; } #[starknet::contract] @@ -21,10 +23,10 @@ mod DeployTest { #[external(v0)] impl DeployTest of super::IDeployTest { - fn deploy_test(self: @ContractState, class_hash: felt252, contract_address_salt: felt252) -> ContractAddress { + fn deploy_test(self: @ContractState, class_hash: ClassHash, contract_address_salt: felt252) -> ContractAddress { let mut calldata = ArrayTrait::new(); calldata.append(100); - let (address0, _) = deploy_syscall(class_hash.try_into().unwrap(), contract_address_salt, calldata.span(), false).unwrap(); + let (address0, _) = deploy_syscall(class_hash, contract_address_salt, calldata.span(), false).unwrap(); address0 } } diff --git a/starknet_programs/cairo2/echo.cairo b/starknet_programs/cairo2/echo.cairo new file mode 100644 index 000000000..1cf32b282 --- /dev/null +++ b/starknet_programs/cairo2/echo.cairo @@ -0,0 +1,17 @@ +#[starknet::contract] +mod Echo { + #[storage] + struct Storage { + balance: felt252, + } + + #[constructor] + fn constructor(ref self: ContractState, initial_balance: felt252) { + self.balance.write(initial_balance); + } + + #[external(v0)] + fn echo(ref self: ContractState, value: felt252) -> felt252 { + value + } +} \ No newline at end of file diff --git a/starknet_programs/cairo2/echo_caller.cairo b/starknet_programs/cairo2/echo_caller.cairo new file mode 100644 index 000000000..80e29eb18 --- /dev/null +++ b/starknet_programs/cairo2/echo_caller.cairo @@ -0,0 +1,20 @@ +#[starknet::contract] +mod EchoCaller { + use starknet::call_contract_syscall; + use core::array; + use core::result::ResultTrait; + + #[storage] + struct Storage { + balance: felt252, + } + + #[external(v0)] + fn call_echo_contract(ref self: ContractState, function_selector: felt252, value: felt252) -> felt252 { + let mut calldata: Array = ArrayTrait::new(); + calldata.append(value); + let callee_addr = starknet::get_contract_address(); + let return_data = call_contract_syscall(callee_addr, function_selector, calldata.span()).unwrap(); + *return_data.get(0_usize).unwrap().unbox() + } +} diff --git a/starknet_programs/cairo2/erc20.cairo b/starknet_programs/cairo2/erc20.cairo index c17e9b2f3..464cf5d7d 100644 --- a/starknet_programs/cairo2/erc20.cairo +++ b/starknet_programs/cairo2/erc20.cairo @@ -67,7 +67,7 @@ mod erc_20 { self.name.write(name); self.symbol.write(symbol); self.decimals.write(decimals); - assert(!recipient.is_zero(), 'ERC20: mint to the 0 address'); + // assert(!recipient.is_zero(), 'ERC20: mint to the 0 address'); self.total_supply.write(initial_supply); self.balances.write(recipient, initial_supply); self diff --git a/starknet_programs/cairo2/event_emitter.cairo b/starknet_programs/cairo2/event_emitter.cairo new file mode 100644 index 000000000..fd5bb8129 --- /dev/null +++ b/starknet_programs/cairo2/event_emitter.cairo @@ -0,0 +1,30 @@ +#[starknet::contract] +mod EventTest { + use starknet::syscalls::emit_event_syscall; + + #[storage] + struct Storage { + balance: felt252, + } + + #[event] + #[derive(Drop, starknet::Event)] + enum Event { + EmitEvent: EmitEvent + } + + #[derive(Drop, starknet::Event)] + struct EmitEvent { + n: u128, + } + + #[external(v0)] + fn trigger_event(ref self: ContractState) -> felt252 { + let mut keys = ArrayTrait::new(); + keys.append('n'); + let mut values = ArrayTrait::new(); + values.append(1); + emit_event_syscall(keys.span(), values.span()).unwrap(); + 1234 + } +} diff --git a/starknet_programs/cairo2/hello_world_account.cairo b/starknet_programs/cairo2/hello_world_account.cairo index c87651795..c98ded486 100644 --- a/starknet_programs/cairo2/hello_world_account.cairo +++ b/starknet_programs/cairo2/hello_world_account.cairo @@ -108,7 +108,7 @@ mod Account { // Call the target contract starknet::call_contract_syscall( address: to, entry_point_selector: selector, calldata: calldata.span() - ).unwrap_syscall() + ).unwrap() } } } diff --git a/starknet_programs/cairo2/square_root_recursive.cairo b/starknet_programs/cairo2/square_root_recursive.cairo new file mode 100644 index 000000000..a960e572e --- /dev/null +++ b/starknet_programs/cairo2/square_root_recursive.cairo @@ -0,0 +1,37 @@ +use starknet::ClassHash; + +#[starknet::interface] +trait Math { + fn square_root(self: @TContractState, n: felt252) -> felt252; +} + +#[starknet::interface] +trait ISquareRoot { + fn square_root(self: @TContractState, n: felt252, math_class_hash: ClassHash, n_iterations: u32) -> felt252; +} + + +#[starknet::contract] +mod SquareRoot { + use super::MathDispatcherTrait; + use super::MathLibraryDispatcher; + use starknet::ClassHash; + + #[storage] + struct Storage{ + } + + #[external(v0)] + impl SquareRoot of super::ISquareRoot { + fn square_root(self: @ContractState, n: felt252, math_class_hash: ClassHash, n_iterations: u32) -> felt252 { + square_root_recursive_inner(n, math_class_hash, n_iterations) + } + } + + fn square_root_recursive_inner(n: felt252, math_class_hash: ClassHash, n_iterations: u32) -> felt252 { + if n_iterations == 0 { + return n; + } + square_root_recursive_inner(MathLibraryDispatcher {class_hash: math_class_hash}.square_root(n), math_class_hash, n_iterations - 1) + } +} diff --git a/starknet_programs/cairo2/wallet_wrapper.cairo b/starknet_programs/cairo2/wallet_wrapper.cairo index 5208f8f73..d4a4a241b 100644 --- a/starknet_programs/cairo2/wallet_wrapper.cairo +++ b/starknet_programs/cairo2/wallet_wrapper.cairo @@ -7,7 +7,8 @@ trait SimpleWallet { #[starknet::interface] trait IWalletWrapper { fn get_balance(self: @TContractState, simple_wallet_contract_address: starknet::ContractAddress) -> felt252; - fn increase_balance(ref self: TContractState, amount: felt252, simple_wallet_contract_address: starknet::ContractAddress); + fn increase_balance(ref self: TContractState, amount: felt252, simple_wallet_contract_address: starknet::ContractAddress); + fn increase_balance_recursive(ref self: TContractState, amount: felt252, simple_wallet_contract_address: starknet::ContractAddress); } #[starknet::contract] @@ -28,5 +29,16 @@ mod WalletWrapper { fn increase_balance(ref self: ContractState, amount: felt252, simple_wallet_contract_address: ContractAddress) { SimpleWalletDispatcher {contract_address: simple_wallet_contract_address}.increase_balance(amount) } + fn increase_balance_recursive(ref self: ContractState, amount: felt252, simple_wallet_contract_address: ContractAddress) { + increase_balance_recursive_inner(amount, simple_wallet_contract_address) + } + } + + fn increase_balance_recursive_inner(amount: felt252, simple_wallet_contract_address: ContractAddress) { + if amount == 0 { + return(); + } + SimpleWalletDispatcher {contract_address: simple_wallet_contract_address}.increase_balance(1); + increase_balance_recursive_inner(amount - 1, simple_wallet_contract_address) } } diff --git a/starknet_programs/raw_contract_classes/0x113bf26d112a164297e04381212c9bd7409f07591f0a04f539bdf56693eaaf3.sierra b/starknet_programs/raw_contract_classes/0x113bf26d112a164297e04381212c9bd7409f07591f0a04f539bdf56693eaaf3.sierra new file mode 100644 index 000000000..0925ceabe --- /dev/null +++ b/starknet_programs/raw_contract_classes/0x113bf26d112a164297e04381212c9bd7409f07591f0a04f539bdf56693eaaf3.sierra @@ -0,0 +1,687 @@ +{ + "sierra_program": [ + "0x1", + "0x2", + "0x0", + "0x2", + "0x0", + "0x0", + "0x13e", + "0xc2", + "0x2a", + "0x52616e6765436865636b", + "0x0", + "0x4761734275696c74696e", + "0x66656c74323532", + "0x4172726179", + "0x1", + "0x2", + "0x536e617073686f74", + "0x3", + "0x537472756374", + "0x1baeba72e79e9db2587cf44fedb2f3700b2075a5e8e39a562584862c4b71f62", + "0x4", + "0x2ee1e2b1b89f8c495f200e4956278a4d47395fe262f27b52e5865c9524c08c3", + "0x456e756d", + "0x3288d594b9a45d15bb2fcb7903f06cdb06b27f0ba88186ec4cfaa98307cb972", + "0x6", + "0x2d7b9ba5597ffc180f5bbd030da76b84ecf1e4f1311043a0a15295f29ccc1b0", + "0x7", + "0x753332", + "0x4275696c74696e436f737473", + "0xa5a3299e5660d06bfa52eacd3a1fcd165ecd6f0cbac6f443fe26f6f68c70f3", + "0x38c95698b12086e50047d206c91c7248ef6f3427861aea1234b080c80fddf35", + "0xb", + "0x53797374656d", + "0xc", + "0x14de46c93830b854d231d540339ee8ae16bb18830a375fe81572a472d5945f1", + "0xf", + "0x3b5488061ac7a66f24fcbc888e7d6d5454df009b3abc2572f25f2400cfac629", + "0xe", + "0x10", + "0x5", + "0x19b3b4955bdcfa379bfc5a4949111c4efdd79128f8676f4d0895419b22e2ad7", + "0x12", + "0x426f78", + "0x29d7d57c04a880978e7b3689f6218e507f3be17588744b58dc17762447ad0e7", + "0x14", + "0x4e6f6e5a65726f", + "0x464c55b21b6d3dadb22fd8587d389a14c0e53182f19e003bdf15db3ecb1676", + "0x75313238", + "0x16c8ea90dd6c64f624ab9863dc00b8f2c35a45fb64a97fa4bac6359fba975ec", + "0x18", + "0x3610c7cf372ee49406b6d03ec0b82f790884fb8652a25c91b2a749ad8982bc5", + "0x19", + "0x17", + "0xcfb175da425fe9834ebf5c4c2342c0507188ad820763d15abada732ab9341a", + "0x1b", + "0x20df6a887dc282129d37d7fa362eda55eb38e5c74604aff8fd97f11e3e79a2f", + "0x1d", + "0x101dc0399934cc08fa0d6f6f2daead4e4a38cabeea1c743e1fc28d2d6e58e99", + "0xd3a26a7712a33547a4a74e7594a446ca400cb36a0c2c307b92eff9ce82ff8", + "0x20", + "0x53746f726167654261736541646472657373", + "0x2cf4ead4392e987c9b56754a10f0a8e0f13776791e096fa6503893f05582c51", + "0x23", + "0x1586938debaf5e59bfb4e9f27763dc7b3da65f9737172ffde9ff9b65b55d857", + "0x24", + "0x1ca27f4a416836d321a19551a437aeb9946fde25373762126dda39b53c0bd11", + "0x53746f7261676541646472657373", + "0x1909a2057b9c1373b889e003e050a09f431d8108e0659d03444ced99a6eea68", + "0xb1", + "0x7265766f6b655f61705f747261636b696e67", + "0x656e61626c655f61705f747261636b696e67", + "0x77697468647261775f676173", + "0x6272616e63685f616c69676e", + "0x73746f72655f74656d70", + "0x66756e6374696f6e5f63616c6c", + "0x656e756d5f6d61746368", + "0x8", + "0x7374727563745f6465636f6e737472756374", + "0x61727261795f6c656e", + "0x736e617073686f745f74616b65", + "0x9", + "0x64726f70", + "0x7533325f636f6e7374", + "0x72656e616d65", + "0x7533325f6571", + "0x7374727563745f636f6e737472756374", + "0x656e756d5f696e6974", + "0x6a756d70", + "0x626f6f6c5f6e6f745f696d706c", + "0x6765745f6275696c74696e5f636f737473", + "0xa", + "0x77697468647261775f6761735f616c6c", + "0x64697361626c655f61705f747261636b696e67", + "0xd", + "0x11", + "0x61727261795f6e6577", + "0x13", + "0x66656c743235325f636f6e7374", + "0x4f7574206f6620676173", + "0x61727261795f617070656e64", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x496e70757420746f6f2073686f727420666f7220617267756d656e7473", + "0x61727261795f736e617073686f745f706f705f66726f6e74", + "0x15", + "0x756e626f78", + "0x66656c743235325f737562", + "0x66656c743235325f69735f7a65726f", + "0x16", + "0x1a", + "0x1c", + "0x753132385f636f6e7374", + "0x1e", + "0x656d69745f6576656e745f73797363616c6c", + "0x1f", + "0x21", + "0x73746f726167655f626173655f616464726573735f636f6e7374", + "0x1afeeaff0ed5cee7d05a21078399c2f56226b0cd5657062500cef4c4e736f85", + "0x22", + "0x25", + "0x753132385f6f766572666c6f77696e675f616464", + "0x26", + "0x753132385f616464204f766572666c6f77", + "0x753132385f746f5f66656c74323532", + "0x73746f726167655f616464726573735f66726f6d5f62617365", + "0x27", + "0x73746f726167655f77726974655f73797363616c6c", + "0x477e157efde59c5531277ede78acb3e03ef69508c6c35fde3495aa0671d227", + "0x1d3bd105efd11cb4e1d188c3f2b302935b4db511160389bd8b0a936ce967708", + "0x73746f726167655f726561645f73797363616c6c", + "0x28", + "0x53746f7261676541636365737355313238202d206e6f6e2075313238", + "0x75313238735f66726f6d5f66656c74323532", + "0x29", + "0x304", + "0xffffffffffffffff", + "0x76", + "0x66", + "0x53", + "0x44", + "0x2b", + "0x2c", + "0x2d", + "0x2e", + "0x3d", + "0x2f", + "0x30", + "0x31", + "0x32", + "0x33", + "0x34", + "0x35", + "0x36", + "0x37", + "0x38", + "0x39", + "0x3a", + "0x3b", + "0x3c", + "0x3e", + "0x3f", + "0x40", + "0x41", + "0x42", + "0x43", + "0x45", + "0x46", + "0x47", + "0x48", + "0x4b", + "0x49", + "0x4a", + "0x4c", + "0x4d", + "0x4e", + "0x4f", + "0x50", + "0x51", + "0x52", + "0x54", + "0x55", + "0x56", + "0x57", + "0x58", + "0x59", + "0x5a", + "0x5b", + "0x5c", + "0x5d", + "0x5e", + "0x5f", + "0x60", + "0x61", + "0x62", + "0x63", + "0x64", + "0x65", + "0x67", + "0x68", + "0x69", + "0xe3", + "0x9a", + "0x9e", + "0xd1", + "0xc4", + "0xbd", + "0xf9", + "0xfe", + "0x124", + "0x11a", + "0x11f", + "0x145", + "0x13e", + "0x17d", + "0x1a3", + "0x19c", + "0x194", + "0x18c", + "0x185", + "0x6a", + "0x6b", + "0x6c", + "0x6d", + "0x6e", + "0x6f", + "0x70", + "0x71", + "0x72", + "0x73", + "0x74", + "0x75", + "0x77", + "0x78", + "0x79", + "0x7a", + "0x7b", + "0x1c2", + "0x1e3", + "0x1e8", + "0x1f3", + "0x219", + "0x212", + "0x226", + "0x7c", + "0x7d", + "0x22a", + "0x7e", + "0x7f", + "0x80", + "0x81", + "0x236", + "0x82", + "0x83", + "0x84", + "0x85", + "0x24b", + "0x250", + "0x25b", + "0x86", + "0x87", + "0x88", + "0x89", + "0x8a", + "0x271", + "0x8b", + "0x8c", + "0x8d", + "0x27c", + "0x8e", + "0x8f", + "0x90", + "0x91", + "0x92", + "0x287", + "0x93", + "0x94", + "0x95", + "0x96", + "0x97", + "0x2ad", + "0x98", + "0x99", + "0x29f", + "0x9b", + "0x9c", + "0x9d", + "0x9f", + "0xa0", + "0xa1", + "0x2bc", + "0xa2", + "0x2c9", + "0xa3", + "0xa4", + "0xa5", + "0xa6", + "0xa7", + "0x2e8", + "0xa8", + "0xa9", + "0x2ef", + "0xaa", + "0xab", + "0xac", + "0xad", + "0xae", + "0xaf", + "0xb0", + "0xf2", + "0x12b", + "0x1ab", + "0x1af", + "0x1c8", + "0x1fa", + "0x220", + "0x23b", + "0x262", + "0x264", + "0x281", + "0x28d", + "0x2b6", + "0x2c2", + "0x2d2", + "0x2dc", + "0x2e2", + "0x2f2", + "0x2fe", + "0x1c1c", + "0x241c0d01018140c0302c0407050240c060401c0c06028080802018080200", + "0x182c02038282a020302804140104c2006090182202048382006080181e02", + "0x700409070240c1b030340409050680406050400c19030340409050083017", + "0x184602048380e06030883c06108184002048383e06068080e0a0f0183a06", + "0xb00c2b030a80409070a40c280101c14021389804060501c0c06128400c24", + "0x185e020483820060b8181a02048283c06170185a02048385206068080e0a", + "0x8681e030cc0c32010241c10030340407050240c10030c40409070780c30", + "0x187202048383c061c0186e02048386c06068080e0a0481852061a808120e", + "0xfc043e010f47829030a40c0d010241410030a40c3b010241c021d0a40c29", + "0x1c0c062307c0c06229100c06218080c062081c12062107c0c06208088002", + "0x138200603134044c240180c41240180c4b0101c0c4a240180c49240180c47", + "0x400c06248480c0621808a006038480c07270089e12030188202038480c07", + "0x104aa06031040c06031043206031342e060313404540114ca406031040451", + "0x240c06248240c062381c0c062b8740c06249580c06218241206210640c06", + "0x180c490301cb00603938b0060310404072c0180e4e108180c4d0f8180c4d", + "0x18b20c04818841e030189a1b030189a0703018b60703018825a03818b212", + "0x180c410101cbe06039380e06031783e0903108ba07031643e0603124b807", + "0x1c0c062381c0c062581c0c063017c0c06218180e5f0301c9c5f03018820c", + "0x1388806031040407220180e4e318180c490118804610101c0c59038180c49", + "0x740c06228401206211900c06208180e640301c9c2c030189a06039100c07", + "0x10c2409031082e06031042e060311c320603114ac06031040c072b0180e4e", + "0x18842903018820603818cc02039900c07270ac0c06268b80c06229940c06", + "0x180c490101cac06039383a0603134600603114ce060310c9009031088809", + "0x188409030188264030189264030188e5204818840203818cc10030188217", + "0x240c42348180c4b0301cd20603938d206031040407348180e4e011a02e09", + "0x18865504818846d03018826c03818d619030189233030188a6a030188619", + "0x180c410101cca06039385c06031343a09031086c0603104700603114dc06", + "0x18b206039c00c07271c00c06208080e700301c9c02378180e650301c9c65", + "0x180e4e180180c4d011d4e806031040473011c8360903108e0060312ce207", + "0x18842b03018827603818b2640301886060399c0c072719c0c06208080e67", + "0x138660603134d2060310c12060312cac0903108580603104ee07031643c09", + "0x1c9c790301886210481884023c0180e6a0301c9c6a030188202039a80c07", + "0x1cdc0603938f40703164dc06031040407370180e4e1c0180c4d0101c6c06", + "0x1601206210ac0c06228a40c06249c00c06218d80c06218180e360301c9c06", + "0x180e4e3e0180c493e0180c4d3c8180c410101cf20603938047b160180c49", + "0x8047e0300804023e8901206210a40c06259e40c06258080c06258180e79", + "0x3004023f01804090104820073f87c18073f01c0c020381c04023f0180406", + "0x1200c12010300c7e030300c100112088073f018a4060f808a4063f0181206", + "0x1f80c55031200455031f80c440311004023f0180409010640c800b818fc07", + "0x1480456031f80c020c808047e0306c0c170107836073f0183a06290083a06", + "0x18b0062a80848063f0183c062a808047e030840c170116042073f018ac06", + "0x8fc0601024040215808fc072f8900e1b010900c7e030900c1d0117c0c7e", + "0x180458010a40c7e030b00c21010b00c7e0318c0c560118c0c7e030083c02", + "0x1900c21011900c7e030ac0c24010ac0c7e030083c02011f80c02048080430", + "0x18fc0717018c60217018fc0617018420217018fc0614818be0214818fc06", + "0x18560233818fc06010a404023f018ca0616008047e030081202180190265", + "0x8047e030081202369a80e82199a40e7e0399c3e0c049900467031f80c67", + "0x18fc063481820021c018fc061b01860021b018fc060119404023f018042e", + "0x840484031f80c38030cc0483031f80c07031a40400031f80c330319c047c", + "0x1f80e79031b404793a1c0dc0c3f0190a8441800f81f350090a063f0182e06", + "0x1b80489031f80c021c008047e032180c3601008fc060102404880321d0c06", + "0x1918063c80918063f01916063a008047e032280c700122d14073f0191206", + "0x2400c7e031c00c670123c0c7e031b80c10012380c7e032340c7c012340c7e", + "0x1f80c020480924914823c180649018fc0647018000248818fc063a018d202", + "0x1a40495031f80c700319c0494031f80c6e030400493031f80c880320c0402", + "0x8047e0300812024b21d2a94060192c063f0192606000090e063f018e806", + "0x930063f01804850125c0c7e030087002011f80c170321004023f018042e", + "0x2680e8a012680c7e0300912024c818fc064c25c0e88012600c7e032600c86", + "0x1f80c6d0319c049c031f80c6a030400482031f80c9b0320c049b031f80c99", + "0x812024fa793a9c060193e063f0190406000093c063f0180e06348093a06", + "0x1c0c6901008fc060b8190802011f80c30030b004023f018042e01008fc06", + "0x28c0c7e030087002011f80ca2030b004a25081cfc0650019160250018fc06", + "0x9120252818fc065228c0e88012900c7e032900c86012900c7e030091802", + "0x1f80c0c0304004a8031f80ca70320c04a7031f80ca55301d140253018fc06", + "0x1956063f01950060000954063f01942063480902063f0183e06338095206", + "0x191a02011f80c19030b004023f018042e01008fc060102404ab55205520c", + "0x95a063f0195a06430095a063f018048e012b00c7e030087002011f80c44", + "0x19060258018fc06572bc0e8a012bc0c7e03009120257018fc0656ab00e88", + "0x1f80c07031a404b3031f80c1f0319c04b2031f80c0c0304004b1031f80cb0", + "0x1f80c0217008047e0300812025aad166b2060196a063f0196206000096806", + "0x196e06430096e063f0180485012d80c7e030087002011f80c09032340402", + "0x18fc065c2e40e8a012e40c7e0300912025c018fc065bad80e88012dc0c7e", + "0x1a404bc031f80c120319c0480031f80c100304004bb031f80cba0320c04ba", + "0x8047e0300804025f2f57880060197c063f0197606000097a063f0180e06", + "0x11004023f01804090104820075f87c18073f01c0c020381c04023f0180406", + "0x1480c170105ca4073f01890062900890063f01888062400888063f0181206", + "0x8047e031540c1701074aa073f01832062900832063f018041901008fc06", + "0x300c100106c0c7e0306c0c1d010780c7e030740c550106c0c7e0305c0c55", + "0x1580c7e030083c02011f80c020480804c0011f80e1e0d81c360206018fc06", + "0x1f80c020480804c103008b0022c018fc0610818420210818fc062b018ac02", + "0x18be022c018fc062f81842022f818fc0612018480212018fc06010780402", + "0x8120214819842c031f80e630318c0463031f80c63030840463031f80c58", + "0xac0c2b010ac0c7e030085202011f80c2c030b004023f018042e01008fc06", + "0x19404023f0180409010c0ca07618b8c8073f01c561f06024c80215818fc06", + "0x1f80c07031a40436031f80c2e0319c0469031f80c67030c00467031f80c02", + "0x18c80608008da6a19824fc06370e06c0947808dc063f018d206198087006", + "0x8fc06380186c02011f80c0204808e806621c00c7e039b40c6d011900c7e", + "0xc7401008fc063e018e002001f00e7e031e40c6e011e40c7e030087002", + "0x18fc0632018200242818fc0642018f80242018fc0641818f20241818fc06", + "0x300c8a031f80c85030000489031f80c6a031a40488031f80c330319c0486", + "0x918063f018c8060800916063f018e80641808047e030081202452251086", + "0x235180c0323c0c7e0322c0c00012380c7e031a80c69012340c7e030cc0c67", + "0x1922064300922063f0180485012400c7e030087002011f80c02048091e8e", + "0x18fc064924c0e8a0124c0c7e03009120249018fc0648a400e88012440c7e", + "0x1a40496031f80c300319c0487031f80c65030400495031f80c940320c0494", + "0x8047e0300812024c25d2c870601930063f0192a06000092e063f0180e06", + "0x1cfc064d81916024d818fc0603818d202011f80c29030b004023f018042e", + "0x2700c86012700c7e03009180241018fc06010e004023f0193406160093499", + "0x1f80c9d4f01d14024f018fc0601224049d031f80c9c4101d10024e018fc06", + "0x940063f0183e063380944063f01818060800942063f0193e06418093e06", + "0x8fc060102404a451a81440c032900c7e032840c000128c0c7e032640c69", + "0x2980c7e030090a0252818fc06010e004023f018120646808047e030085c02", + "0x1d140254018fc060122404a7031f80ca65281d100253018fc06530190c02", + "0x1824063380954063f01820060800902063f01952064180952063f0194ea8", + "0x11004ad562ad540c032b40c7e032040c00012b00c7e0301c0c69012ac0c7e", + "0x192202011f80c02048081806628240e073f01c0c06480080c063f0180406", + "0x98c06011600412031f80c1f0324c0410031f80c0703248041f031f80c09", + "0x1f80c0c032480448031f80c44032500444031f80c020f008047e030081202", + "0x8a4063f018a40606008a4063f01820063a00824063f0189006498082006", + "0x192c022a818fc060b8190e02011f80c020480832066385c0c7e038480c95", + "0x18fc060126404023f01836064c0083c1b039f80c1d0325c041d031f80c55", + "0x25c0424031f80c1e0325804023f01842064c008b021039f80c560325c0456", + "0x1858064b80858063f018b0064b008047e0317c0c980118cbe073f0184806", + "0xb80c7e030ac0c96011900c7e0318c0c9601008fc06148193002158a40e7e", + "0x26c0465031f80c65032180465031f80c2e3201d340232018fc06320190c02", + "0x1f80c67030900467031f80c020f008047e0300812021801990023f01cca06", + "0x18600641008047e030081202013240c022c00866063f018d20610808d206", + "0x17c0433031f80c6d03084046d031f80c6a03158046a031f80c020f008047e", + "0x1870064e808dc063f018a4060600870063f0186c064e0086c063f0186606", + "0x1d00c7e030083c02011f80c19030b004023f0180409011c0dc07031c00c7e", + "0x1f00e0600018fc063c8193a023e018fc062901818023c818fc063a0193c02", + "0x27c04023f0183e0616008047e03008120208019941f031f80e0c0318c0400", + "0x1f80c07031a40419031f80c060319c0444031f80c12032840412031f80c02", + "0x1f80c1b0e954320c5000836063f0188806510083a063f018120619808aa06", + "0x1f80c1e0328c04023f0180409011580ccb0f018fc070b818da020b9489009", + "0x8be063f01890063380848063f018040608008047e031600c2c011604207", + "0x8fc06010240402660180458010b00c7e030840c330118c0c7e031480c69", + "0x18d20232018fc0624018ce0215818fc0601018200214818fc062b0194802", + "0xb004023f0180409011945c64158300c65031f80c2903294042e031f80c52", + "0x18040608008d267039f80c300329c0430031f80c090329804023f0182006", + "0x1d00c7e031a40ca8011c00c7e0301c0c69011b80c7e030180c67010e00c7e", + "0x24047c03334f2063f01c6c06408086c6d350cc187e031d0e06e1c0315202", + "0x18fc0641819580241818fc0600019560200018fc063c8195402011f80c02", + "0xcc048b031f80c6d031a4048a031f80c6a0319c0485031f80c67030c00484", + "0x2251086049f80c8d4622d140c500091a063f01908065100918063f0190a06", + "0x92290039f80c8e0328c04023f01804090123c0cce47018fc0744818da02", + "0xcc0c100125126073f01924065380924063f019200653008047e032440c2c", + "0x18fc064a01950024d018fc0644018d2024c818fc0643018ce024c018fc06", + "0x9380667a080c7e03a5c0c810125d2c874a830fc064da693298062a4049b", + "0x18fc064a81820024f018fc06012b4049d031f80c82032a804023f0180409", + "0x27c0e7e0328d40a204abc04a3031f80c9e032b804a0031f80c9d032b804a2", + "0x94c063f019480655008047e03008120252819a0a4031f80ea10320404a1", + "0x2980cae012ac0c7e0324c0ca8012a80c7e032580c69012040c7e0321c0c67", + "0x19a2ad031f80ea9032c404a95429c127e032b156aa40831600256018fc06", + "0x2bc0c3001008fc06580185802582bc0e7e032b40cb201008fc060102404ae", + "0x18fc0654018d2022f818fc0653818ce0212018fc064f818200258818fc06", + "0x2d004b3031f80cb21601d660259018fc0601078042c031f80cb1030cc0463", + "0x18c606348096c063f018be06338096a063f01848060800968063f0196606", + "0x2b80ca401008fc060102404b85bad96a0c032e00c7e032d00ca5012dc0c7e", + "0x18fc0654018d2025d818fc0653818ce025d018fc064f81820025c818fc06", + "0x1f80c93032d404023f0180409012f100bb5d0300cbc031f80cb9032940480", + "0x1a404d2031f80c870319c04be031f80c9f0304004bd031f80ca5032900402", + "0x8047e0300812026a34da4be06019a8063f0197a0652809a6063f0192c06", + "0x190e0633809ac063f0192a0608009aa063f019380652008047e0324c0cb5", + "0x2404d96c35dac0c033640c7e033540ca5013600c7e032580c690135c0c7e", + "0x18fc0643018ce026d818fc061981820026d018fc06478194802011f80c02", + "0x180409011fdbadc6d8300c7f031f80cda0329404dd031f80c88031a404dc", + "0x19c04df031f80c330304004de031f80c7c0329004023f018ce065a808047e", + "0x385c0df06019c4063f019bc0652809c2063f018da0634809c0063f018d406", + "0x1c0e0604818fc06030196c0203818fc0601018d20203018fc060107804e2", + "0x18d20222018fc0601018ce0206018fc06012dc0409031f80c07032980409", + "0x1489044062c00417031f80c0c032b80452031f80c09032a00448031f80c06", + "0x196402011f80c0204808aa06718640c7e038480cb101048201f049f80c17", + "0x18fc0601078041e031f80c1d030c004023f018360616008361d039f80c19", + "0x848063f0183e0633808b0063f01842065a00842063f018ac1e03acc0456", + "0x8047e0300812023197c48090318c0c7e031600ca50117c0c7e030400c69", + "0xb00ca5010ac0c7e030400c69010a40c7e0307c0c67010b00c7e031540ca4", + "0xe0040c031f80c1f032e0041f031f80c09032880464158a4120632018fc06", + "0x1f80c44032e804482201cfc0606019720209018fc06010e00410031f80c02", + "0x200041b031f80c12032ec041d031f80c10032ec0455031f80c48032880402", + "0x8ac1e039f80c52031b804023f018320616008321729024fc060d874aa09", + "0x1600c7001090b0073f0182e063700842063f018ac063a008047e030780c70", + "0x17c0c7e0317c0c0c010840c7e030840c0c0117c0c7e030900c7401008fc06", + "0x18041e01008fc06010240464158a412e41618c0e7e0397c4206010317802", + "0x19c0c7e030b00c69010c00c7e0318c0c67011940c7e030b80cbd010b80c7e", + "0x18fc0632019a402011f80c020480804e503008b00234818fc06328197c02", + "0x34c0469031f80c33032f80467031f80c2b031a40430031f80c290319c0433", + "0x240438033986c063f01cd4066a808d4063f018da066a008da063f018d206", + "0x1f80c70032d00470031f80c6e0381d660237018fc061b019ac02011f80c02", + "0x1800063f018e80652808f8063f018ce0634808f2063f018600633808e806", + "0x19c0483031f80c380329004023f0180e066b808047e030081202001f0f209", + "0x2190a84048190c063f0190606528090a063f018ce063480908063f0186006", + "0x1f80c0203040041f031f80c020c80818063f01804d801008fc06048196a02", + "0x8aa063f0183e060e80832063f0180e06348082e063f0180c0633808a406", + "0x1c90066d808904409040187e03074aa190b9483eda010740c7e030300cd9", + "0x18fc062b019ba022b018fc060d819b802011f80c02048083c067386c0c7e", + "0x8047e0300812022f819d024031f80e21032040421031f80c58031fc0458", + "0x400c10010a40c7e030b00cdf010b00c7e0318c0cde0118c0c7e030900caa", + "0x18fc0614819c00217018fc0622018d20232018fc0609018ce0215818fc06", + "0x1f80c10030400430031f80c5f0338404023f0180409011945c64158300c65", + "0x18d4063f01860067000866063f018880634808d2063f018240633808ce06", + "0xd80c7e030400c10011b40c7e030780ce101008fc0601024046a199a4ce0c", + "0xd8180638018fc0636819c00237018fc0622018d2021c018fc0609018ce02", + "0x19d402011f80c0204808201f03ba41809039f80e070300812e2011c0dc38", + "0x9d806011600448031f80c12033ac0444031f80c09030400412031f80c0c", + "0x18a4067580888063f0183e0608008a4063f018200676808047e030081202", + "0x83a063f0182e0643008aa063f0189006778082e063f01804ee011200c7e", + "0x2a804023f0180409010780cf10d818fc070c81902020c818fc060e9540ef0", + "0x18880608008b0063f01842066f80842063f018ac066f008ac063f0183606", + "0x1f80c1e0338404023f01804090117c48070317c0c7e031600ce0010900c7e", + "0x180e0653808522c0381852063f018c6067000858063f018880608008c606", + "0x824063f01812067900820063f01804d801008fc060f8196a020f8300e7e", + "0x1888067a00890063f01890060e80890063f0180419011100c7e030400cf3", + "0x8fc0601024041d2a86412f60b9480e7e038488848030083ef5011100c7e", + "0x5c0c69011580c7e031480c67010780c7e0306c0cbd0106c0c7e030083c02", + "0x19a402011f80c020480804f703008b0022c018fc060f0197c0210818fc06", + "0x1f80c24032f80421031f80c55031a40456031f80c190319c0424031f80c1d", + "0x3e058063f01cbe066a808be063f018c6066a008c6063f018b00669808b006", + "0x3e80464031f80c2b0601df20215818fc0616019ac02011f80c02048085206", + "0x185c067d80860063f018420634808ca063f018ac06338085c063f018c806", + "0x1f80c29033f004023f01818065a808047e030081202338c0ca090319c0c7e", + "0x18da063f018d2067d808d4063f01842063480866063f018ac0633808d206", + "0x818067f0240c7e038080cfd010180c0603018fc06010194402369a86609", + "0x1f80c1f0301d10020f818fc060f8190c020f818fc06013fc04023f0180409", + "0x832063f0180e065d8082e063f01820065d808a4063f0181206800082006", + "0x8aa063f01824065d808047e031200c2c011208812049f80c190b9481301", + "0x836063f018050301008fc06010240402810180458010740c7e031100cbb", + "0x19760212018fc060601a08020f018fc060d8180e880106c0c7e0306c0c86", + "0xb0045810958127e0318cbe2404c140463031f80c07032ec045f031f80c1e", + "0x18fc0601078041d031f80c21032ec0455031f80c56032ec04023f018b006", + "0x240c64031f80c2c032d8042b031f80c1d034180429031f80c5503418042c", + "0x18fc060301a1202011f80c02048080e06840180c7e038080d07011905629", + "0x8047e0300812020f8180c1f031f80c0c0342c040c031f80c09034280409", + "0x1100d0b011100c7e030480d0c010480c7e0301c20074500820063f0180489", + "0x4820093f01c3e0903818190d0107c0c7e030300cf3011200c0624018fc06", + "0x18fc06220190c020e818fc06010182002011f80c02048082e52240261c44", + "0x480c7e030480c69010400c7e030400c670115432073f018361d03c3c041b", + "0x4480421031f80c1e0330004023f0180409011580d110f018fc072a81a2002", + "0x18200633808be063f01832060800848063f018b00689808b0063f0184206", + "0x2404291618cbe0c030a40c7e030900d14010b00c7e030480c690118c0c7e", + "0x2180464031f80c026080856063f018043801008fc062b0185802011f80c02", + "0xb8ca0745008ca063f0180489010b80c7e03190560744008c8063f018c806", + "0x18fc0608018ce0234818fc060c818200233818fc061801a2a0218018fc06", + "0x180409011b4d433348300c6d031f80c6703450046a031f80c12031a40433", + "0x8dc063f01870068980870063f0186c06890086c063f0182e068b008047e", + "0x1b80d14011e40c7e031480c69011d00c7e031200c67011c00c7e030080c10", + "0x8fc06010240407034600c063f01c04068b808f8793a1c018063e018fc06", + "0x7c0c060f818fc0606019c00206018fc0604819be0204818fc0603019bc02", + "0x1824067080824063f0180e1003a280410031f80c0244808047e030081202", + "0x240409034680e063f01c04068c8089006031200c7e031100ce0011100c7e", + "0x7c0c7e030300cdf010300c7e0301c0cde01008fc06030193002011f80c02", + "0x87002011f80c090346c04023f0180409010400c0608018fc060f819c002", + "0x1f80c442401d140224018fc06012240444031f80c060901d100209018fc06", + "0x1f80c020347004190301832063f0182e06700082e063f018a40670808a406", + "0x300e7e0304820078e80824063f0180e065d80820063f0181206570081206", + "0x300cbb011200c7e030180cbb011100c7e030083c02011f80c1f030b0041f", + "0x83c02011f80c020347804172912012060b818fc06220196c0229018fc06", + "0x18fc06048196c020f818fc0603819760206018fc0603019760204818fc06", + "0x8fc060102404100f83013200481c0e7e0381804078f808201f060240c10", + "0x8b00224018fc060901a440222018fc0603818200209018fc060481a4202", + "0x7804023f018a40692808a4063f018201f03c9004023f01804090100a4606", + "0x1f80c19034880444031f80c0c030400419031f80c17034980417031f80c02", + "0x180406948083a55038183a063f018900694008aa063f0188806938089006", + "0x8fc060601930020f8300e7e030240c97010240c7e0301c0cf20101c0c7e", + "0x82410039f80c482201e540224018fc0603019760222018fc060f8190c02", + "0x1f80c52032d80417031f80c10032ec0452031f80c020f008047e030480c2c", + "0x18041e010240c7e0301c0c07440080e063f01804064b0083217038183206", + "0x18040c2f8403e07030400c7e030300cb60107c0c7e030240cbb010300c7e", + "0x3d4120703008b05503008181f2a818040c010240e0601160aa06010303e55", + "0x1caa0696030120703008ac550300818120c9540c020fcac04440f81c3e06", + "0x1804562a81812640c9540c0c9701c0c022b1540c090c9540c09968082055", + "0x1804650101c52290102660090381804652a818040c0b9540c02064bc1207", + "0x24120932026660232018c806990240e060119caa06048a42e55030326207", + "0x1c0c02371540c02061b49055030083f35011a80c69034d00e06010401209", + "0x180410048241209048ac133803008ca06039c00f37011940c36034d81809", + "0x1c122903cec0c023c8080e070101e7407030082009048241209160267207", + "0x27a060104012070481c0f3c030082009" + ], + "sierra_program_debug_info": { + "type_names": [], + "libfunc_names": [], + "user_func_names": [] + }, + "contract_class_version": "0.1.0", + "entry_points_by_type": { + "EXTERNAL": [ + { + "selector": "0x966af5d72d3975f70858b044c77785d3710638bbcebbd33cc7001a91025588", + "function_idx": 0 + } + ], + "L1_HANDLER": [], + "CONSTRUCTOR": [ + { + "selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", + "function_idx": 1 + } + ] + }, + "abi": [ + { + "type": "constructor", + "name": "constructor", + "inputs": [] + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "function", + "name": "emit_event", + "inputs": [ + { + "name": "incremental", + "type": "core::bool" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "event", + "name": "events::events::ContractWithEvent::IncrementalEvent", + "kind": "struct", + "members": [ + { + "name": "value", + "type": "core::integer::u128", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "events::events::ContractWithEvent::StaticEvent", + "kind": "struct", + "members": [] + }, + { + "type": "event", + "name": "events::events::ContractWithEvent::Event", + "kind": "enum", + "variants": [ + { + "name": "IncrementalEvent", + "type": "events::events::ContractWithEvent::IncrementalEvent", + "kind": "nested" + }, + { + "name": "StaticEvent", + "type": "events::events::ContractWithEvent::StaticEvent", + "kind": "nested" + } + ] + } + ] +} \ No newline at end of file diff --git a/starknet_programs/raw_contract_classes/0x472a8c75c832b112ac174abc3b46e7e79464ad52ecdad80079ddfe486ca5eef.casm b/starknet_programs/raw_contract_classes/0x472a8c75c832b112ac174abc3b46e7e79464ad52ecdad80079ddfe486ca5eef.casm new file mode 100644 index 000000000..e8527a982 --- /dev/null +++ b/starknet_programs/raw_contract_classes/0x472a8c75c832b112ac174abc3b46e7e79464ad52ecdad80079ddfe486ca5eef.casm @@ -0,0 +1,1429 @@ +{ + "prime": "0x800000000000011000000000000000000000000000000000000000000000001", + "compiler_version": "2.0.0", + "bytecode": [ + "0xa0680017fff8000", + "0x7", + "0x482680017ffa8000", + "0xfffffffffffffffffffffffffffefe08", + "0x400280007ff97fff", + "0x10780017fff7fff", + "0x79", + "0x4825800180007ffa", + "0x101f8", + "0x400280007ff97fff", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0xf9", + "0x482680017ff98000", + "0x1", + "0x20680017fff7ffd", + "0x60", + "0x48307ffb80007ffc", + "0x4824800180007fff", + "0x0", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0x6", + "0x480680017fff8000", + "0x0", + "0x10780017fff7fff", + "0x4", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x1", + "0x48307ffe80007fff", + "0x20680017fff7fff", + "0x3d", + "0x1104800180018000", + "0x354", + "0x482480017fff8000", + "0x353", + "0x480080007fff8000", + "0xa0680017fff8000", + "0x9", + "0x4824800180007fe1", + "0x0", + "0x482480017fff8000", + "0x100000000000000000000000000000000", + "0x400080007ff37fff", + "0x10780017fff7fff", + "0x20", + "0x4824800180007fe1", + "0x0", + "0x400080007ff47fff", + "0x482480017ff48000", + "0x1", + "0x48127ffe7fff8000", + "0x480a7ffb7fff8000", + "0x48127ff07fff8000", + "0x1104800180018000", + "0xfe", + "0x20680017fff7ffd", + "0xc", + "0x40780017fff7fff", + "0x1", + "0x48127ff97fff8000", + "0x48127ff97fff8000", + "0x48127ff97fff8000", + "0x480680017fff8000", + "0x0", + "0x48127ffb7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482480017ff18000", + "0x1", + "0x48127fdc7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x1104800180018000", + "0x15a", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ff47fff8000", + "0x48127fdf7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f2073686f727420666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ffd7fff8000", + "0x48127fe87fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482680017ff98000", + "0x1", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0xa0680017fff8000", + "0x7", + "0x482680017ffa8000", + "0xffffffffffffffffffffffffffffe3b8", + "0x400280007ff97fff", + "0x10780017fff7fff", + "0x64", + "0x4825800180007ffa", + "0x1c48", + "0x400280007ff97fff", + "0x48297ffc80007ffd", + "0x482680017ff98000", + "0x1", + "0x4824800180007ffe", + "0x0", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0x6", + "0x480680017fff8000", + "0x0", + "0x10780017fff7fff", + "0x4", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x1", + "0x48307ffe80007fff", + "0x20680017fff7fff", + "0x3c", + "0x1104800180018000", + "0x2cd", + "0x482480017fff8000", + "0x2cc", + "0x480080007fff8000", + "0xa0680017fff8000", + "0x9", + "0x4824800180007ff4", + "0x0", + "0x482480017fff8000", + "0x100000000000000000000000000000000", + "0x400080007ff47fff", + "0x10780017fff7fff", + "0x1f", + "0x4824800180007ff4", + "0x0", + "0x400080007ff57fff", + "0x48127fff7fff8000", + "0x480a7ffb7fff8000", + "0x1104800180018000", + "0xfe", + "0x482480017fd48000", + "0x1", + "0x20680017fff7ffc", + "0xc", + "0x40780017fff7fff", + "0x1", + "0x48127ffe7fff8000", + "0x48127ff87fff8000", + "0x48127ff87fff8000", + "0x480680017fff8000", + "0x0", + "0x48127ffb7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x48127fff7fff8000", + "0x48127ff97fff8000", + "0x48127ff97fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ff97fff8000", + "0x48127ff97fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482480017ff28000", + "0x1", + "0x48127fef7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x1104800180018000", + "0xd4", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ff57fff8000", + "0x48127ff27fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482680017ff98000", + "0x1", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x48297ffc80007ffd", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0xa", + "0x482680017ffc8000", + "0x1", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x480a7ffc7fff8000", + "0x10780017fff7fff", + "0x8", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x20680017fff7ffc", + "0x15", + "0x480080007ffd8000", + "0x4824800180007fff", + "0x0", + "0x20680017fff7fff", + "0x6", + "0x480680017fff8000", + "0x1", + "0x10780017fff7fff", + "0x4", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x480680017fff8000", + "0x0", + "0x48307ffb80007ffc", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x4", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x20780017fff7ffd", + "0x1d", + "0x40780017fff7fff", + "0x96", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x1104800180018000", + "0x92", + "0x20680017fff7ffd", + "0x7", + "0x480a7ffa7fff8000", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x10780017fff7fff", + "0x35", + "0x40780017fff7fff", + "0x3", + "0x480a7ffa7fff8000", + "0x48127ff77fff8000", + "0x48127ff77fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ff77fff8000", + "0x48127ff77fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x1104800180018000", + "0xc1", + "0x20680017fff7ffd", + "0x56", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x0", + "0x48127ffc7fff8000", + "0x1104800180018000", + "0x73", + "0x20680017fff7ffd", + "0x43", + "0x48127fb17fff8000", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x1104800180018000", + "0xb1", + "0x20680017fff7ffd", + "0x32", + "0x48127ffa7fff8000", + "0x48127ffe7fff8000", + "0x480680017fff8000", + "0x1", + "0x1104800180018000", + "0xd6", + "0x20680017fff7ffd", + "0x20", + "0x48127fe57fff8000", + "0x48127fe57fff8000", + "0x48127ffd7fff8000", + "0x1104800180018000", + "0xf9", + "0x20680017fff7ffd", + "0xf", + "0x48127fe47fff8000", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x48127ffd7fff8000", + "0x48127ffd7fff8000", + "0x48127ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x3", + "0x48127fe17fff8000", + "0x48127ff77fff8000", + "0x48127ff77fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ff77fff8000", + "0x48127ff77fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1b", + "0x48127fe17fff8000", + "0x48127fc97fff8000", + "0x48127fc97fff8000", + "0x480680017fff8000", + "0x1", + "0x48127fdf7fff8000", + "0x48127fdf7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x31", + "0x48127fc97fff8000", + "0x48127fc97fff8000", + "0x48127fc97fff8000", + "0x480680017fff8000", + "0x1", + "0x48127fc97fff8000", + "0x48127fc97fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x65", + "0x48127f4c7fff8000", + "0x48127f957fff8000", + "0x48127f957fff8000", + "0x480680017fff8000", + "0x1", + "0x48127f957fff8000", + "0x48127f957fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0xae", + "0x48127f4c7fff8000", + "0x48127f4c7fff8000", + "0x48127f4c7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127f4c7fff8000", + "0x48127f4c7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x1104800180018000", + "0xb0", + "0x20680017fff7ffd", + "0xb", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0xce", + "0x40780017fff7fff", + "0x1", + "0x40780017fff7fff", + "0x1", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x48127ffa7fff8000", + "0x1104800180018000", + "0xc5", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x480680017fff8000", + "0x456d69744576656e74", + "0x400280007ffb7fff", + "0x400380017ffb7ffa", + "0x400280027ffb7ffb", + "0x400280037ffb7ffc", + "0x400280047ffb7ffd", + "0x400280057ffb7ffe", + "0x480280077ffb8000", + "0x20680017fff7fff", + "0xd", + "0x480280067ffb8000", + "0x482680017ffb8000", + "0x8", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x10780017fff7fff", + "0x9", + "0x480280067ffb8000", + "0x482680017ffb8000", + "0xa", + "0x480680017fff8000", + "0x1", + "0x480280087ffb8000", + "0x480280097ffb8000", + "0x1104800180018000", + "0xc6", + "0x20680017fff7ffd", + "0xb", + "0x48127ff67fff8000", + "0x48127ff67fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x48127ff67fff8000", + "0x48127ff67fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x1afeeaff0ed5cee7d05a21078399c2f56226b0cd5657062500cef4c4e736f85", + "0x1104800180018000", + "0xb9", + "0x20680017fff7ffc", + "0x1a", + "0x48127ffd7fff8000", + "0x48127ffd7fff8000", + "0x48127ffd7fff8000", + "0x1104800180018000", + "0xee", + "0x20680017fff7ffd", + "0xb", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x8", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ff27fff8000", + "0x48127ff27fff8000", + "0x208b7fff7fff7ffe", + "0x482a7ffd7ffc8001", + "0xa0680017fff7fff", + "0x7", + "0x4824800180007fff", + "0x100000000000000000000000000000000", + "0x400280007ffb7fff", + "0x10780017fff7fff", + "0xc", + "0x400280007ffb7fff", + "0x40780017fff7fff", + "0x1", + "0x482680017ffb8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x48127ffc7fff8000", + "0x10780017fff7fff", + "0x7", + "0x482680017ffb8000", + "0x1", + "0x480680017fff8000", + "0x1", + "0x48127ffd7fff8000", + "0x480680017fff8000", + "0x753132385f616464204f766572666c6f77", + "0x1104800180018000", + "0xc3", + "0x20680017fff7ffd", + "0x9", + "0x48127ff67fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x48127ffc7fff8000", + "0x208b7fff7fff7ffe", + "0x48127ff67fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x1afeeaff0ed5cee7d05a21078399c2f56226b0cd5657062500cef4c4e736f85", + "0x480680017fff8000", + "0x53746f726167655772697465", + "0x400280007ffc7fff", + "0x400380017ffc7ffb", + "0x400280027ffc7ffd", + "0x400280037ffc7ffe", + "0x400380047ffc7ffd", + "0x480280067ffc8000", + "0x20680017fff7fff", + "0xd", + "0x480280057ffc8000", + "0x482680017ffc8000", + "0x7", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x10780017fff7fff", + "0x9", + "0x480280057ffc8000", + "0x482680017ffc8000", + "0x9", + "0x480680017fff8000", + "0x1", + "0x480280077ffc8000", + "0x480280087ffc8000", + "0x1104800180018000", + "0x3b", + "0x20680017fff7ffd", + "0xb", + "0x48127ff67fff8000", + "0x48127ff67fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x48127ff67fff8000", + "0x48127ff67fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x20780017fff7ff8", + "0x13", + "0x480680017fff8000", + "0x477e157efde59c5531277ede78acb3e03ef69508c6c35fde3495aa0671d227", + "0x400280007ffb7fff", + "0x480a7ff97fff8000", + "0x480a7ffa7fff8000", + "0x482680017ffb8000", + "0x1", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x83", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x10780017fff7fff", + "0x12", + "0x40780017fff7fff", + "0xf", + "0x480680017fff8000", + "0x1d3bd105efd11cb4e1d188c3f2b302935b4db511160389bd8b0a936ce967708", + "0x400280007ffb7fff", + "0x480a7ffa7fff8000", + "0x482680017ffb8000", + "0x1", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x7b", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x208b7fff7fff7ffe", + "0x20780017fff7ffb", + "0x9", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x1", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x53746f7261676552656164", + "0x400280007ffb7fff", + "0x400380017ffb7ffa", + "0x400380027ffb7ffc", + "0x400380037ffb7ffd", + "0x480280057ffb8000", + "0x20680017fff7fff", + "0x28", + "0x480a7ff97fff8000", + "0x480280067ffb8000", + "0x1104800180018000", + "0x60", + "0x480280047ffb8000", + "0x482680017ffb8000", + "0x7", + "0x20680017fff7ffc", + "0xf", + "0x40780017fff7fff", + "0x2", + "0x48127ff97fff8000", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x48127ff57fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x53746f7261676541636365737355313238202d206e6f6e2075313238", + "0x400080007ffe7fff", + "0x48127ff97fff8000", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x48127ff97fff8000", + "0x482480017ff88000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x11", + "0x480a7ff97fff8000", + "0x480280047ffb8000", + "0x482680017ffb8000", + "0x8", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x1", + "0x480280067ffb8000", + "0x480280077ffb8000", + "0x208b7fff7fff7ffe", + "0x20780017fff7ffb", + "0x8", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x1", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x20780017fff7ffb", + "0xa", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480a7ffc7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x400180007fff7ffd", + "0x480680017fff8000", + "0x1", + "0x48127ffe7fff8000", + "0x482480017ffd8000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480a7ff97fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x33", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0xa0680017fff8000", + "0x16", + "0x480280007ffc8003", + "0x480280017ffc8003", + "0x4844800180017ffe", + "0x100000000000000000000000000000000", + "0x483180017ffd7ffd", + "0x482480017fff7ffd", + "0x800000000000010fffffffffffffffff7ffffffffffffef0000000000000001", + "0x20680017fff7ffc", + "0x6", + "0x402480017fff7ffd", + "0xffffffffffffffffffffffffffffffff", + "0x10780017fff7fff", + "0x4", + "0x402480017ffe7ffd", + "0xf7ffffffffffffef0000000000000000", + "0x400280027ffc7ffd", + "0x20680017fff7ffe", + "0xe", + "0x402780017fff7fff", + "0x1", + "0x400380007ffc7ffd", + "0x40780017fff7fff", + "0x5", + "0x482680017ffc8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x480a7ffd7fff8000", + "0x10780017fff7fff", + "0x8", + "0x482680017ffc8000", + "0x3", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x5", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x208b7fff7fff7ffe", + "0x400380007ffd7ffb", + "0x480a7ffc7fff8000", + "0x482680017ffd8000", + "0x1", + "0x208b7fff7fff7ffe" + ], + "hints": [ + [ + 0, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x101f8" + }, + "rhs": { + "Deref": { + "register": "FP", + "offset": -6 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 41, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x0" + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -30 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 62, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 80, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 98, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 112, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 126, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 141, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x1c48" + }, + "rhs": { + "Deref": { + "register": "FP", + "offset": -6 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 176, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x0" + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -11 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 196, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 214, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 232, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 246, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 472, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 474, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 496, + [ + { + "SystemCall": { + "system": { + "Deref": { + "register": "FP", + "offset": -5 + } + } + } + } + ] + ], + [ + 583, + [ + { + "TestLessThan": { + "lhs": { + "Deref": { + "register": "AP", + "offset": 0 + } + }, + "rhs": { + "Immediate": "0x100000000000000000000000000000000" + }, + "dst": { + "register": "AP", + "offset": -1 + } + } + } + ] + ], + [ + 635, + [ + { + "SystemCall": { + "system": { + "Deref": { + "register": "FP", + "offset": -4 + } + } + } + } + ] + ], + [ + 735, + [ + { + "SystemCall": { + "system": { + "Deref": { + "register": "FP", + "offset": -5 + } + } + } + } + ] + ], + [ + 760, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 812, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 836, + [ + { + "TestLessThan": { + "lhs": { + "Deref": { + "register": "FP", + "offset": -3 + } + }, + "rhs": { + "Immediate": "0x100000000000000000000000000000000" + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 838, + [ + { + "DivMod": { + "lhs": { + "Deref": { + "register": "FP", + "offset": -3 + } + }, + "rhs": { + "Immediate": "0x100000000000000000000000000000000" + }, + "quotient": { + "register": "AP", + "offset": 3 + }, + "remainder": { + "register": "AP", + "offset": 4 + } + } + } + ] + ] + ], + "pythonic_hints": [ + [ + 0, + [ + "memory[ap + 0] = 66040 <= memory[fp + -6]" + ] + ], + [ + 41, + [ + "memory[ap + 0] = 0 <= memory[ap + -30]" + ] + ], + [ + 62, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 80, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 98, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 112, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 126, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 141, + [ + "memory[ap + 0] = 7240 <= memory[fp + -6]" + ] + ], + [ + 176, + [ + "memory[ap + 0] = 0 <= memory[ap + -11]" + ] + ], + [ + 196, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 214, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 232, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 246, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 472, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 474, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 496, + [ + "syscall_handler.syscall(syscall_ptr=memory[fp + -5])" + ] + ], + [ + 583, + [ + "memory[ap + -1] = memory[ap + 0] < 340282366920938463463374607431768211456" + ] + ], + [ + 635, + [ + "syscall_handler.syscall(syscall_ptr=memory[fp + -4])" + ] + ], + [ + 735, + [ + "syscall_handler.syscall(syscall_ptr=memory[fp + -5])" + ] + ], + [ + 760, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 812, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 836, + [ + "memory[ap + 0] = memory[fp + -3] < 340282366920938463463374607431768211456" + ] + ], + [ + 838, + [ + "(memory[ap + 3], memory[ap + 4]) = divmod(memory[fp + -3], 340282366920938463463374607431768211456)" + ] + ] + ], + "entry_points_by_type": { + "EXTERNAL": [ + { + "selector": "0x966af5d72d3975f70858b044c77785d3710638bbcebbd33cc7001a91025588", + "offset": 0, + "builtins": [ + "range_check" + ] + } + ], + "L1_HANDLER": [], + "CONSTRUCTOR": [ + { + "selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", + "offset": 141, + "builtins": [ + "range_check" + ] + } + ] + } +} \ No newline at end of file diff --git a/starknet_programs/raw_contract_classes/3010533bd60cb0e70ac1bf776e171713f0e5229a084989d3894c171c160ace2.casm b/starknet_programs/raw_contract_classes/3010533bd60cb0e70ac1bf776e171713f0e5229a084989d3894c171c160ace2.casm new file mode 100644 index 000000000..a3629918d --- /dev/null +++ b/starknet_programs/raw_contract_classes/3010533bd60cb0e70ac1bf776e171713f0e5229a084989d3894c171c160ace2.casm @@ -0,0 +1,524 @@ +{ + "prime": "0x800000000000011000000000000000000000000000000000000000000000001", + "compiler_version": "2.0.0", + "bytecode": [ + "0xa0680017fff8000", + "0x7", + "0x482680017ffa8000", + "0xffffffffffffffffffffffffffff43f4", + "0x400280007ff97fff", + "0x10780017fff7fff", + "0x68", + "0x4825800180007ffa", + "0xbc0c", + "0x400280007ff97fff", + "0x48297ffc80007ffd", + "0x482680017ff98000", + "0x1", + "0x4824800180007ffe", + "0x0", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0x6", + "0x480680017fff8000", + "0x0", + "0x10780017fff7fff", + "0x4", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x1", + "0x48307ffe80007fff", + "0x20680017fff7fff", + "0x40", + "0x1104800180018000", + "0x118", + "0x482480017fff8000", + "0x117", + "0x480080007fff8000", + "0xa0680017fff8000", + "0x9", + "0x4824800180007ff4", + "0x0", + "0x482480017fff8000", + "0x100000000000000000000000000000000", + "0x400080007ff47fff", + "0x10780017fff7fff", + "0x23", + "0x4824800180007ff4", + "0x0", + "0x400080007ff57fff", + "0x48127fff7fff8000", + "0x480a7ffb7fff8000", + "0x1104800180018000", + "0x4b", + "0x482480017f268000", + "0x1", + "0x20680017fff7ffc", + "0x10", + "0x40780017fff7fff", + "0x1", + "0x48127fff7fff8000", + "0x48127ffe7fff8000", + "0x1104800180018000", + "0x81", + "0x48127ff87fff8000", + "0x48127ff27fff8000", + "0x48127ff27fff8000", + "0x480680017fff8000", + "0x0", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x48127fff7fff8000", + "0x48127ff97fff8000", + "0x48127ff97fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ff97fff8000", + "0x48127ff97fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482480017ff28000", + "0x1", + "0x48127fef7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x1104800180018000", + "0x62", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ff57fff8000", + "0x48127ff27fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482680017ff98000", + "0x1", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x1", + "0x1104800180018000", + "0x3f", + "0x20680017fff7ffd", + "0x2f", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x2", + "0x1104800180018000", + "0x35", + "0x20680017fff7ffd", + "0x1c", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x3", + "0x1104800180018000", + "0x2b", + "0x20680017fff7ffd", + "0xb", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x42", + "0x48127fb97fff8000", + "0x48127fb97fff8000", + "0x480680017fff8000", + "0x1", + "0x48127fb97fff8000", + "0x48127fb97fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x84", + "0x48127f777fff8000", + "0x48127f777fff8000", + "0x480680017fff8000", + "0x1", + "0x48127f777fff8000", + "0x48127f777fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x43", + "0x40780017fff7fff", + "0x1", + "0x40780017fff7fff", + "0x1", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x48127ffa7fff8000", + "0x1104800180018000", + "0x3a", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x480680017fff8000", + "0x456d69744576656e74", + "0x400280007ffb7fff", + "0x400380017ffb7ffa", + "0x400280027ffb7ffb", + "0x400280037ffb7ffc", + "0x400280047ffb7ffd", + "0x400280057ffb7ffe", + "0x480280077ffb8000", + "0x20680017fff7fff", + "0xd", + "0x480280067ffb8000", + "0x482680017ffb8000", + "0x8", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x10780017fff7fff", + "0x9", + "0x480280067ffb8000", + "0x482680017ffb8000", + "0xa", + "0x480680017fff8000", + "0x1", + "0x480280087ffb8000", + "0x480280097ffb8000", + "0x1104800180018000", + "0x27", + "0x20680017fff7ffd", + "0xb", + "0x48127ff67fff8000", + "0x48127ff67fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x48127ff67fff8000", + "0x48127ff67fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x363b90c0b8be133a6373701cce2f678d73ec604cb810f4d8b511c6a3ea4fcfd", + "0x400280007ffb7fff", + "0x480a7ff97fff8000", + "0x480a7ffa7fff8000", + "0x482680017ffb8000", + "0x1", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x15", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x208b7fff7fff7ffe", + "0x20780017fff7ffb", + "0x9", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x1", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ff97fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x7", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x208b7fff7fff7ffe", + "0x400380007ffd7ffb", + "0x480a7ffc7fff8000", + "0x482680017ffd8000", + "0x1", + "0x208b7fff7fff7ffe" + ], + "hints": [ + [ + 0, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0xbc0c" + }, + "rhs": { + "Deref": { + "register": "FP", + "offset": -6 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 35, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x0" + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -11 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 55, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 77, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 95, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 109, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 197, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 199, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 221, + [ + { + "SystemCall": { + "system": { + "Deref": { + "register": "FP", + "offset": -5 + } + } + } + } + ] + ] + ], + "pythonic_hints": [ + [ + 0, + [ + "memory[ap + 0] = 48140 <= memory[fp + -6]" + ] + ], + [ + 35, + [ + "memory[ap + 0] = 0 <= memory[ap + -11]" + ] + ], + [ + 55, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 77, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 95, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 109, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 197, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 199, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 221, + [ + "syscall_handler.syscall(syscall_ptr=memory[fp + -5])" + ] + ] + ], + "entry_points_by_type": { + "EXTERNAL": [ + { + "selector": "0x2e8359222ced3eab92eabe6442847adf1c8234edbdea21c3fa8b2d5573346c4", + "offset": 0, + "builtins": [ + "range_check" + ] + } + ], + "L1_HANDLER": [], + "CONSTRUCTOR": [] + } +} \ No newline at end of file diff --git a/starknet_programs/raw_contract_classes/321aadcf42b0a4ad905616598d16c42fa9b87c812dc398e49b57bf77930629f.casm b/starknet_programs/raw_contract_classes/321aadcf42b0a4ad905616598d16c42fa9b87c812dc398e49b57bf77930629f.casm new file mode 100644 index 000000000..bf0ff34ca --- /dev/null +++ b/starknet_programs/raw_contract_classes/321aadcf42b0a4ad905616598d16c42fa9b87c812dc398e49b57bf77930629f.casm @@ -0,0 +1,1097 @@ +{ + "prime": "0x800000000000011000000000000000000000000000000000000000000000001", + "compiler_version": "2.0.0", + "bytecode": [ + "0xa0680017fff8000", + "0x7", + "0x482680017ffa8000", + "0xffffffffffffffffffffffffffff8a94", + "0x400280007ff97fff", + "0x10780017fff7fff", + "0x7e", + "0x4825800180007ffa", + "0x756c", + "0x400280007ff97fff", + "0x482680017ff98000", + "0x1", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x111", + "0x20680017fff7ffe", + "0x65", + "0x48307ffc80007ffd", + "0x4824800180007fff", + "0x0", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0x6", + "0x480680017fff8000", + "0x0", + "0x10780017fff7fff", + "0x4", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x1", + "0x48307ffe80007fff", + "0x20680017fff7fff", + "0x42", + "0x1104800180018000", + "0x25f", + "0x482480017fff8000", + "0x25e", + "0x480080007fff8000", + "0xa0680017fff8000", + "0x9", + "0x4824800180007fd7", + "0x0", + "0x482480017fff8000", + "0x100000000000000000000000000000000", + "0x400080007fef7fff", + "0x10780017fff7fff", + "0x25", + "0x4824800180007fd7", + "0x0", + "0x400080007ff07fff", + "0x482480017ff08000", + "0x1", + "0x48127ffe7fff8000", + "0x480a7ffb7fff8000", + "0x48127ff17fff8000", + "0x1104800180018000", + "0x11b", + "0x20680017fff7ffd", + "0x11", + "0x40780017fff7fff", + "0x1", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x48127ffd7fff8000", + "0x1104800180018000", + "0x13b", + "0x48127feb7fff8000", + "0x48127feb7fff8000", + "0x48127feb7fff8000", + "0x480680017fff8000", + "0x0", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482480017fed8000", + "0x1", + "0x48127fd27fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x1104800180018000", + "0x121", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ff07fff8000", + "0x48127fd57fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f2073686f727420666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ff97fff8000", + "0x48127fde7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482680017ff98000", + "0x1", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0xa0680017fff8000", + "0x7", + "0x482680017ffa8000", + "0xffffffffffffffffffffffffffffd346", + "0x400280007ff97fff", + "0x10780017fff7fff", + "0x79", + "0x4825800180007ffa", + "0x2cba", + "0x400280007ff97fff", + "0x482680017ff98000", + "0x1", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x7f", + "0x20680017fff7ffe", + "0x60", + "0x48307ffc80007ffd", + "0x4824800180007fff", + "0x0", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0x6", + "0x480680017fff8000", + "0x0", + "0x10780017fff7fff", + "0x4", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x1", + "0x48307ffe80007fff", + "0x20680017fff7fff", + "0x3d", + "0x1104800180018000", + "0x1cd", + "0x482480017fff8000", + "0x1cc", + "0x480080007fff8000", + "0xa0680017fff8000", + "0x9", + "0x4824800180007fd7", + "0x0", + "0x482480017fff8000", + "0x100000000000000000000000000000000", + "0x400080007fef7fff", + "0x10780017fff7fff", + "0x20", + "0x4824800180007fd7", + "0x0", + "0x400080007ff07fff", + "0x48127fff7fff8000", + "0x480a7ffb7fff8000", + "0x48127ff27fff8000", + "0x1104800180018000", + "0xbe", + "0x482480017fce8000", + "0x1", + "0x20680017fff7ffc", + "0xc", + "0x40780017fff7fff", + "0x1", + "0x48127ffe7fff8000", + "0x48127ff87fff8000", + "0x48127ff87fff8000", + "0x480680017fff8000", + "0x0", + "0x48127ffb7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x48127fff7fff8000", + "0x48127ff97fff8000", + "0x48127ff97fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ff97fff8000", + "0x48127ff97fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482480017fed8000", + "0x1", + "0x48127fd27fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x1104800180018000", + "0x94", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ff07fff8000", + "0x48127fd57fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f2073686f727420666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ff97fff8000", + "0x48127fde7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482680017ff98000", + "0x1", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x48297ffc80007ffd", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0xa", + "0x482680017ffc8000", + "0x1", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x480a7ffc7fff8000", + "0x10780017fff7fff", + "0x8", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x20680017fff7ffc", + "0x17", + "0x480a7ffb7fff8000", + "0x480080007ffc8000", + "0x1104800180018000", + "0x67", + "0x20680017fff7ffe", + "0x9", + "0x48127ffd7fff8000", + "0x48127ff07fff8000", + "0x48127ff07fff8000", + "0x480680017fff8000", + "0x0", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0x48127ffd7fff8000", + "0x48127ff07fff8000", + "0x48127ff07fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0xd", + "0x480a7ffb7fff8000", + "0x48127ff07fff8000", + "0x48127ff07fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x1104800180018000", + "0x6e", + "0x20680017fff7ffd", + "0x1a", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x94", + "0x20680017fff7ffd", + "0xb", + "0x48127fe27fff8000", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x48127fe27fff8000", + "0x208b7fff7fff7ffe", + "0x48127fe27fff8000", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x18", + "0x48127fe27fff8000", + "0x48127fe27fff8000", + "0x48127fe27fff8000", + "0x480680017fff8000", + "0x1", + "0x48127fe27fff8000", + "0x48127fe27fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0xa6", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x68", + "0x20680017fff7ffd", + "0xb", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0xa0680017fff8000", + "0x16", + "0x480280007ffc8003", + "0x480280017ffc8003", + "0x4844800180017ffe", + "0x100000000000000000000000000000000", + "0x483180017ffd7ffd", + "0x482480017fff7ffd", + "0x800000000000010fffffffffffffffff7ffffffffffffef0000000000000001", + "0x20680017fff7ffc", + "0x6", + "0x402480017fff7ffd", + "0xffffffffffffffffffffffffffffffff", + "0x10780017fff7fff", + "0x4", + "0x402480017ffe7ffd", + "0xf7ffffffffffffef0000000000000000", + "0x400280027ffc7ffd", + "0x20680017fff7ffe", + "0xe", + "0x402780017fff7fff", + "0x1", + "0x400380007ffc7ffd", + "0x40780017fff7fff", + "0x5", + "0x482680017ffc8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x480a7ffd7fff8000", + "0x10780017fff7fff", + "0x8", + "0x482680017ffc8000", + "0x3", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x1afeeaff0ed5cee7d05a21078399c2f56226b0cd5657062500cef4c4e736f85", + "0x1104800180018000", + "0x5f", + "0x20680017fff7ffc", + "0x1a", + "0x48127ffd7fff8000", + "0x48127ffd7fff8000", + "0x48127ffd7fff8000", + "0x1104800180018000", + "0x94", + "0x20680017fff7ffd", + "0xb", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x8", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ff27fff8000", + "0x48127ff27fff8000", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x1afeeaff0ed5cee7d05a21078399c2f56226b0cd5657062500cef4c4e736f85", + "0x480680017fff8000", + "0x53746f726167655772697465", + "0x400280007ffc7fff", + "0x400380017ffc7ffb", + "0x400280027ffc7ffd", + "0x400280037ffc7ffe", + "0x400380047ffc7ffd", + "0x480280067ffc8000", + "0x20680017fff7fff", + "0xd", + "0x480280057ffc8000", + "0x482680017ffc8000", + "0x7", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x10780017fff7fff", + "0x9", + "0x480280057ffc8000", + "0x482680017ffc8000", + "0x9", + "0x480680017fff8000", + "0x1", + "0x480280077ffc8000", + "0x480280087ffc8000", + "0x1104800180018000", + "0x62", + "0x20680017fff7ffd", + "0xb", + "0x48127ff67fff8000", + "0x48127ff67fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x48127ff67fff8000", + "0x48127ff67fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0x400380007ffd7ffb", + "0x480a7ffc7fff8000", + "0x482680017ffd8000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x53746f7261676552656164", + "0x400280007ffb7fff", + "0x400380017ffb7ffa", + "0x400380027ffb7ffc", + "0x400380037ffb7ffd", + "0x480280057ffb8000", + "0x20680017fff7fff", + "0x28", + "0x480a7ff97fff8000", + "0x480280067ffb8000", + "0x1104800180018000", + "0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffff69", + "0x480280047ffb8000", + "0x482680017ffb8000", + "0x7", + "0x20680017fff7ffc", + "0xf", + "0x40780017fff7fff", + "0x2", + "0x48127ff97fff8000", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x48127ff57fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x53746f7261676541636365737355313238202d206e6f6e2075313238", + "0x400080007ffe7fff", + "0x48127ff97fff8000", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x48127ff97fff8000", + "0x482480017ff88000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x11", + "0x480a7ff97fff8000", + "0x480280047ffb8000", + "0x482680017ffb8000", + "0x8", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x1", + "0x480280067ffb8000", + "0x480280077ffb8000", + "0x208b7fff7fff7ffe", + "0x20780017fff7ffb", + "0x8", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x1", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x20780017fff7ffb", + "0x9", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x1", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe" + ], + "hints": [ + [ + 0, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x756c" + }, + "rhs": { + "Deref": { + "register": "FP", + "offset": -6 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 41, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x0" + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -40 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 62, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 85, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 103, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 117, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 131, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 146, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x2cba" + }, + "rhs": { + "Deref": { + "register": "FP", + "offset": -6 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 187, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x0" + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -40 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 208, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 226, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 244, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 258, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 272, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 415, + [ + { + "TestLessThan": { + "lhs": { + "Deref": { + "register": "FP", + "offset": -3 + } + }, + "rhs": { + "Immediate": "0x100000000000000000000000000000000" + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 417, + [ + { + "DivMod": { + "lhs": { + "Deref": { + "register": "FP", + "offset": -3 + } + }, + "rhs": { + "Immediate": "0x100000000000000000000000000000000" + }, + "quotient": { + "register": "AP", + "offset": 3 + }, + "remainder": { + "register": "AP", + "offset": 4 + } + } + } + ] + ], + [ + 510, + [ + { + "SystemCall": { + "system": { + "Deref": { + "register": "FP", + "offset": -4 + } + } + } + } + ] + ], + [ + 562, + [ + { + "SystemCall": { + "system": { + "Deref": { + "register": "FP", + "offset": -5 + } + } + } + } + ] + ], + [ + 587, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ] + ], + "pythonic_hints": [ + [ + 0, + [ + "memory[ap + 0] = 30060 <= memory[fp + -6]" + ] + ], + [ + 41, + [ + "memory[ap + 0] = 0 <= memory[ap + -40]" + ] + ], + [ + 62, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 85, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 103, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 117, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 131, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 146, + [ + "memory[ap + 0] = 11450 <= memory[fp + -6]" + ] + ], + [ + 187, + [ + "memory[ap + 0] = 0 <= memory[ap + -40]" + ] + ], + [ + 208, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 226, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 244, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 258, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 272, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 415, + [ + "memory[ap + 0] = memory[fp + -3] < 340282366920938463463374607431768211456" + ] + ], + [ + 417, + [ + "(memory[ap + 3], memory[ap + 4]) = divmod(memory[fp + -3], 340282366920938463463374607431768211456)" + ] + ], + [ + 510, + [ + "syscall_handler.syscall(syscall_ptr=memory[fp + -4])" + ] + ], + [ + 562, + [ + "syscall_handler.syscall(syscall_ptr=memory[fp + -5])" + ] + ], + [ + 587, + [ + "memory[ap + 0] = segments.add()" + ] + ] + ], + "entry_points_by_type": { + "EXTERNAL": [ + { + "selector": "0x1b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d", + "offset": 0, + "builtins": [ + "range_check" + ] + } + ], + "L1_HANDLER": [], + "CONSTRUCTOR": [ + { + "selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", + "offset": 146, + "builtins": [ + "range_check" + ] + } + ] + } +} \ No newline at end of file diff --git a/starknet_programs/raw_contract_classes/53ad3bfb13f39cf1a9940108be4f9c6a8d9cc48a59d5f9b3c73432f877f8cf0.casm b/starknet_programs/raw_contract_classes/53ad3bfb13f39cf1a9940108be4f9c6a8d9cc48a59d5f9b3c73432f877f8cf0.casm new file mode 100644 index 000000000..c4da4fc1c --- /dev/null +++ b/starknet_programs/raw_contract_classes/53ad3bfb13f39cf1a9940108be4f9c6a8d9cc48a59d5f9b3c73432f877f8cf0.casm @@ -0,0 +1,755 @@ +{ + "prime": "0x800000000000011000000000000000000000000000000000000000000000001", + "compiler_version": "2.0.0", + "bytecode": [ + "0xa0680017fff8000", + "0x7", + "0x482680017ffa8000", + "0xffffffffffffffffffffffffffffc144", + "0x400280007ff97fff", + "0x10780017fff7fff", + "0x93", + "0x4825800180007ffa", + "0x3ebc", + "0x400280007ff97fff", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x9b", + "0x482680017ff98000", + "0x1", + "0x20680017fff7ffd", + "0x7a", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x1104800180018000", + "0x93", + "0x20680017fff7ffe", + "0x66", + "0x48307ffc80007ffd", + "0x4824800180007fff", + "0x0", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0x6", + "0x480680017fff8000", + "0x0", + "0x10780017fff7fff", + "0x4", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x1", + "0x48307ffe80007fff", + "0x20680017fff7fff", + "0x43", + "0x1104800180018000", + "0x158", + "0x482480017fff8000", + "0x157", + "0x480080007fff8000", + "0xa0680017fff8000", + "0x9", + "0x4824800180007fd6", + "0x0", + "0x482480017fff8000", + "0x100000000000000000000000000000000", + "0x400080007fe47fff", + "0x10780017fff7fff", + "0x26", + "0x4824800180007fd6", + "0x0", + "0x400080007fe57fff", + "0x482480017fe58000", + "0x1", + "0x48127ffe7fff8000", + "0x480a7ffb7fff8000", + "0x48127fe17fff8000", + "0x48127ff07fff8000", + "0x1104800180018000", + "0x8a", + "0x20680017fff7ffd", + "0x11", + "0x40780017fff7fff", + "0x1", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x48127ffd7fff8000", + "0x1104800180018000", + "0xd7", + "0x48127feb7fff8000", + "0x48127feb7fff8000", + "0x48127feb7fff8000", + "0x480680017fff8000", + "0x0", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482480017fe28000", + "0x1", + "0x48127fd17fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x1104800180018000", + "0xbd", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127fe57fff8000", + "0x48127fd47fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f2073686f727420666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127fee7fff8000", + "0x48127fdd7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f2073686f727420666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ffd7fff8000", + "0x48127fec7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482680017ff98000", + "0x1", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x48297ffc80007ffd", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0xa", + "0x482680017ffc8000", + "0x1", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x480a7ffc7fff8000", + "0x10780017fff7fff", + "0x8", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x20680017fff7ffc", + "0x8", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x480680017fff8000", + "0x0", + "0x480080007ffa8000", + "0x208b7fff7fff7ffe", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x64", + "0x400080007ffe7fff", + "0x480a7ff97fff8000", + "0x480a7ffc7fff8000", + "0x1104800180018000", + "0x59", + "0x48127ff17fff8000", + "0x482480017ff08000", + "0x1", + "0x20680017fff7ffc", + "0x3a", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x4465706c6f79", + "0x400280007ffb7fff", + "0x400380017ffb7ffa", + "0x400280027ffb7ff9", + "0x400380037ffb7ffd", + "0x400280047ffb7ffc", + "0x400280057ffb7ffd", + "0x400280067ffb7ffe", + "0x480280087ffb8000", + "0x20680017fff7fff", + "0xc", + "0x480280077ffb8000", + "0x482680017ffb8000", + "0xc", + "0x480680017fff8000", + "0x0", + "0x480280097ffb8000", + "0x4802800a7ffb8000", + "0x4802800b7ffb8000", + "0x10780017fff7fff", + "0xb", + "0x480280077ffb8000", + "0x482680017ffb8000", + "0xb", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x480280097ffb8000", + "0x4802800a7ffb8000", + "0x1104800180018000", + "0x55", + "0x20680017fff7ffc", + "0xb", + "0x48127fde7fff8000", + "0x48127fe77fff8000", + "0x48127fe77fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x48127ff87fff8000", + "0x208b7fff7fff7ffe", + "0x48127fde7fff8000", + "0x48127fe77fff8000", + "0x48127fe77fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1b", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7074696f6e3a3a756e77726170206661696c65642e", + "0x400080007ffe7fff", + "0x48127fde7fff8000", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x44", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0xa0680017fff8004", + "0xe", + "0x4825800180047ffd", + "0x800000000000000000000000000000000000000000000000000000000000000", + "0x484480017ffe8000", + "0x110000000000000000", + "0x48307ffe7fff8002", + "0x480280007ffc7ffc", + "0x480280017ffc7ffc", + "0x402480017ffb7ffd", + "0xffffffffffffffeeffffffffffffffff", + "0x400280027ffc7ffd", + "0x10780017fff7fff", + "0x13", + "0x484480017fff8001", + "0x8000000000000000000000000000000", + "0x48317fff80007ffd", + "0x480280007ffc7ffd", + "0x480280017ffc7ffd", + "0x402480017ffc7ffe", + "0xf8000000000000000000000000000000", + "0x400280027ffc7ffe", + "0x40780017fff7fff", + "0x1", + "0x482680017ffc8000", + "0x3", + "0x480680017fff8000", + "0x0", + "0x480a7ffd7fff8000", + "0x10780017fff7fff", + "0x8", + "0x482680017ffc8000", + "0x3", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x526573756c743a3a756e77726170206661696c65642e", + "0x1104800180018000", + "0x16", + "0x20680017fff7ffc", + "0x8", + "0x480680017fff8000", + "0x0", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x208b7fff7fff7ffe", + "0x400380007ffd7ffb", + "0x480a7ffc7fff8000", + "0x482680017ffd8000", + "0x1", + "0x208b7fff7fff7ffe", + "0x20780017fff7ff9", + "0xa", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x0", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x400180007fff7ffd", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x48127ffd7fff8000", + "0x482480017ffc8000", + "0x1", + "0x208b7fff7fff7ffe" + ], + "hints": [ + [ + 0, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x3ebc" + }, + "rhs": { + "Deref": { + "register": "FP", + "offset": -6 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 47, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x0" + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -41 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 69, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 92, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 110, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 124, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 138, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 152, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 203, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 230, + [ + { + "SystemCall": { + "system": { + "Deref": { + "register": "FP", + "offset": -5 + } + } + } + } + ] + ], + [ + 275, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 299, + [ + { + "TestLessThan": { + "lhs": { + "Deref": { + "register": "FP", + "offset": -3 + } + }, + "rhs": { + "Immediate": "0x800000000000000000000000000000000000000000000000000000000000000" + }, + "dst": { + "register": "AP", + "offset": 4 + } + } + } + ] + ], + [ + 303, + [ + { + "LinearSplit": { + "value": { + "Deref": { + "register": "AP", + "offset": 3 + } + }, + "scalar": { + "Immediate": "0x110000000000000000" + }, + "max_x": { + "Immediate": "0xffffffffffffffffffffffffffffffff" + }, + "x": { + "register": "AP", + "offset": -2 + }, + "y": { + "register": "AP", + "offset": -1 + } + } + } + ] + ], + [ + 313, + [ + { + "LinearSplit": { + "value": { + "Deref": { + "register": "FP", + "offset": -3 + } + }, + "scalar": { + "Immediate": "0x8000000000000000000000000000000" + }, + "max_x": { + "Immediate": "0xffffffffffffffffffffffffffffffff" + }, + "x": { + "register": "AP", + "offset": -1 + }, + "y": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 375, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ] + ], + "pythonic_hints": [ + [ + 0, + [ + "memory[ap + 0] = 16060 <= memory[fp + -6]" + ] + ], + [ + 47, + [ + "memory[ap + 0] = 0 <= memory[ap + -41]" + ] + ], + [ + 69, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 92, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 110, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 124, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 138, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 152, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 203, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 230, + [ + "syscall_handler.syscall(syscall_ptr=memory[fp + -5])" + ] + ], + [ + 275, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 299, + [ + "memory[ap + 4] = memory[fp + -3] < 3618502788666131106986593281521497120414687020801267626233049500247285301248" + ] + ], + [ + 303, + [ + "\n(value, scalar) = (memory[ap + 3], 313594649253062377472)\nx = min(value // scalar, 340282366920938463463374607431768211455)\ny = value - x * scalar\nmemory[ap + -2] = x\nmemory[ap + -1] = y\n" + ] + ], + [ + 313, + [ + "\n(value, scalar) = (memory[fp + -3], 10633823966279326983230456482242756608)\nx = min(value // scalar, 340282366920938463463374607431768211455)\ny = value - x * scalar\nmemory[ap + -1] = x\nmemory[ap + 0] = y\n" + ] + ], + [ + 375, + [ + "memory[ap + 0] = segments.add()" + ] + ] + ], + "entry_points_by_type": { + "EXTERNAL": [ + { + "selector": "0x2f459db2a642c91d279cdbe9185f3934bb1cde01b16f89896c71066cf42bb18", + "offset": 0, + "builtins": [ + "range_check" + ] + } + ], + "L1_HANDLER": [], + "CONSTRUCTOR": [] + } +} \ No newline at end of file diff --git a/starknet_programs/raw_contract_classes/6638ce6c9bf336d1781a388668fa2206d928df5d1fa6b92e4cb41004c7e3f89.casm b/starknet_programs/raw_contract_classes/6638ce6c9bf336d1781a388668fa2206d928df5d1fa6b92e4cb41004c7e3f89.casm new file mode 100644 index 000000000..03cf472ff --- /dev/null +++ b/starknet_programs/raw_contract_classes/6638ce6c9bf336d1781a388668fa2206d928df5d1fa6b92e4cb41004c7e3f89.casm @@ -0,0 +1,557 @@ +{ + "prime": "0x800000000000011000000000000000000000000000000000000000000000001", + "compiler_version": "2.0.0", + "bytecode": [ + "0xa0680017fff8000", + "0x7", + "0x482680017ffa8000", + "0xfffffffffffffffffffffffffffff8ee", + "0x400280007ff97fff", + "0x10780017fff7fff", + "0xa7", + "0x4825800180007ffa", + "0x712", + "0x400280007ff97fff", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0xaf", + "0x482680017ff98000", + "0x1", + "0x20680017fff7ffd", + "0x8e", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x1104800180018000", + "0xa7", + "0x20680017fff7ffe", + "0x7a", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x1104800180018000", + "0xa1", + "0x20680017fff7ffe", + "0x66", + "0x48307ffc80007ffd", + "0x4824800180007fff", + "0x0", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0x6", + "0x480680017fff8000", + "0x0", + "0x10780017fff7fff", + "0x4", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x1", + "0x48307ffe80007fff", + "0x20680017fff7fff", + "0x43", + "0x1104800180018000", + "0xfa", + "0x482480017fff8000", + "0xf9", + "0x480080007fff8000", + "0xa0680017fff8000", + "0x9", + "0x4824800180007fc7", + "0x0", + "0x482480017fff8000", + "0x100000000000000000000000000000000", + "0x400080007fd57fff", + "0x10780017fff7fff", + "0x26", + "0x4824800180007fc7", + "0x0", + "0x400080007fd67fff", + "0x482480017fd68000", + "0x1", + "0x48127ffe7fff8000", + "0x48127fd37fff8000", + "0x48127fe27fff8000", + "0x48127ff07fff8000", + "0x1104800180018000", + "0x98", + "0x20680017fff7ffd", + "0x11", + "0x40780017fff7fff", + "0x1", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x48127ffd7fff8000", + "0x1104800180018000", + "0xd3", + "0x48127ff37fff8000", + "0x48127ff37fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x0", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482480017fd38000", + "0x1", + "0x48127fc27fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x1104800180018000", + "0xb6", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127fd67fff8000", + "0x48127fc57fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f2073686f727420666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127fdf7fff8000", + "0x48127fce7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f2073686f727420666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127fee7fff8000", + "0x48127fdd7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f2073686f727420666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ffd7fff8000", + "0x48127fec7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482680017ff98000", + "0x1", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x48297ffc80007ffd", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0xa", + "0x482680017ffc8000", + "0x1", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x480a7ffc7fff8000", + "0x10780017fff7fff", + "0x8", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x20680017fff7ffc", + "0x8", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x480680017fff8000", + "0x0", + "0x480080007ffa8000", + "0x208b7fff7fff7ffe", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x1104800180018000", + "0x4b", + "0x482480017fff8000", + "0x4a", + "0x480080007fff8000", + "0xa0680017fff8000", + "0x9", + "0x4825800180007ffa", + "0xa0a", + "0x482480017fff8000", + "0x100000000000000000000000000000000", + "0x400280007ff97fff", + "0x10780017fff7fff", + "0x2a", + "0x4825800180007ffa", + "0xa0a", + "0x400280007ff97fff", + "0x482680017ff98000", + "0x1", + "0x20780017fff7ffd", + "0x7", + "0x48127fff7fff8000", + "0x48127ffd7fff8000", + "0x480a7ffb7fff8000", + "0x10780017fff7fff", + "0xf", + "0x48127fff7fff8000", + "0x48127ffd7fff8000", + "0x480a7ffc7fff8000", + "0x482a7ffc7ffb8000", + "0x4825800180007ffd", + "0x1", + "0x1104800180018000", + "0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffffe1", + "0x20680017fff7ffd", + "0xd", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x48127ffd7fff8000", + "0x48127ffd7fff8000", + "0x48127ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482680017ff98000", + "0x1", + "0x480a7ffa7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffb7fff8000", + "0x482480017ffa8000", + "0x1", + "0x208b7fff7fff7ffe", + "0x400380007ffd7ffb", + "0x480a7ffc7fff8000", + "0x482680017ffd8000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe" + ], + "hints": [ + [ + 0, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x712" + }, + "rhs": { + "Deref": { + "register": "FP", + "offset": -6 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 53, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x0" + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -56 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 75, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 98, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 116, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 130, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 144, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 158, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 172, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 228, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0xa0a" + }, + "rhs": { + "Deref": { + "register": "FP", + "offset": -6 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 277, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ] + ], + "pythonic_hints": [ + [ + 0, + [ + "memory[ap + 0] = 1810 <= memory[fp + -6]" + ] + ], + [ + 53, + [ + "memory[ap + 0] = 0 <= memory[ap + -56]" + ] + ], + [ + 75, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 98, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 116, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 130, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 144, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 158, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 172, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 228, + [ + "memory[ap + 0] = 2570 <= memory[fp + -6]" + ] + ], + [ + 277, + [ + "memory[ap + 0] = segments.add()" + ] + ] + ], + "entry_points_by_type": { + "EXTERNAL": [ + { + "selector": "0x112e35f48499939272000bd72eb840e502ca4c3aefa8800992e8defb746e0c9", + "offset": 0, + "builtins": [ + "range_check" + ] + } + ], + "L1_HANDLER": [], + "CONSTRUCTOR": [] + } +} \ No newline at end of file diff --git a/starknet_programs/raw_contract_classes/7c48d040ceb3183837a0aff2adf33d879f790e202eb2c4b8622005c12252641.casm b/starknet_programs/raw_contract_classes/7c48d040ceb3183837a0aff2adf33d879f790e202eb2c4b8622005c12252641.casm new file mode 100644 index 000000000..c2420dff1 --- /dev/null +++ b/starknet_programs/raw_contract_classes/7c48d040ceb3183837a0aff2adf33d879f790e202eb2c4b8622005c12252641.casm @@ -0,0 +1,476 @@ +{ + "prime": "0x800000000000011000000000000000000000000000000000000000000000001", + "compiler_version": "2.0.0", + "bytecode": [ + "0xa0680017fff8000", + "0x7", + "0x482680017ffa8000", + "0x100000000000000000000000000000000", + "0x400280007ff97fff", + "0x10780017fff7fff", + "0x7d", + "0x4825800180007ffa", + "0x0", + "0x400280007ff97fff", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x85", + "0x482680017ff98000", + "0x1", + "0x20680017fff7ffd", + "0x64", + "0x48307ffb80007ffc", + "0x4824800180007fff", + "0x0", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0x6", + "0x480680017fff8000", + "0x0", + "0x10780017fff7fff", + "0x4", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x1", + "0x48307ffe80007fff", + "0x20680017fff7fff", + "0x41", + "0x1104800180018000", + "0xdb", + "0x482480017fff8000", + "0xda", + "0x480080007fff8000", + "0xa0680017fff8000", + "0x9", + "0x4824800180007fe5", + "0x0", + "0x482480017fff8000", + "0x100000000000000000000000000000000", + "0x400080007ff37fff", + "0x10780017fff7fff", + "0x24", + "0x4824800180007fe5", + "0x0", + "0x400080007ff47fff", + "0x482480017ff48000", + "0x1", + "0x48127ffe7fff8000", + "0x48127ff17fff8000", + "0x1104800180018000", + "0x7c", + "0x20680017fff7ffd", + "0x11", + "0x40780017fff7fff", + "0x1", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x48127ffd7fff8000", + "0x1104800180018000", + "0xb6", + "0x48127ff37fff8000", + "0x48127ff37fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x0", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482480017ff18000", + "0x1", + "0x48127fe07fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x1104800180018000", + "0x99", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ff47fff8000", + "0x48127fe37fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f2073686f727420666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ffd7fff8000", + "0x48127fec7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482680017ff98000", + "0x1", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x48297ffc80007ffd", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0xa", + "0x482680017ffc8000", + "0x1", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x480a7ffc7fff8000", + "0x10780017fff7fff", + "0x8", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x48127ffc7fff8000", + "0x48127ffc7fff8000", + "0x20680017fff7ffc", + "0x8", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x480680017fff8000", + "0x0", + "0x480080007ffa8000", + "0x208b7fff7fff7ffe", + "0x48127ffe7fff8000", + "0x48127ffe7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x1104800180018000", + "0x4a", + "0x482480017fff8000", + "0x49", + "0x480080007fff8000", + "0xa0680017fff8000", + "0x9", + "0x4825800180007ffc", + "0x942", + "0x482480017fff8000", + "0x100000000000000000000000000000000", + "0x400280007ffb7fff", + "0x10780017fff7fff", + "0x29", + "0x4825800180007ffc", + "0x942", + "0x400280007ffb7fff", + "0x482680017ffb8000", + "0x1", + "0x20780017fff7ffd", + "0x8", + "0x48127fff7fff8000", + "0x48127ffd7fff8000", + "0x480680017fff8000", + "0x1", + "0x10780017fff7fff", + "0xd", + "0x48127fff7fff8000", + "0x48127ffd7fff8000", + "0x4825800180007ffd", + "0x1", + "0x1104800180018000", + "0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffffe2", + "0x20680017fff7ffd", + "0xd", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x48527ffd7ffd8000", + "0x48127ffd7fff8000", + "0x48127ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482680017ffb8000", + "0x1", + "0x480a7ffc7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffb7fff8000", + "0x482480017ffa8000", + "0x1", + "0x208b7fff7fff7ffe", + "0x400380007ffd7ffb", + "0x480a7ffc7fff8000", + "0x482680017ffd8000", + "0x1", + "0x208b7fff7fff7ffe", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe" + ], + "hints": [ + [ + 0, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x0" + }, + "rhs": { + "Deref": { + "register": "FP", + "offset": -6 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 41, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x0" + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -26 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 61, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 84, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 102, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 116, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 130, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 186, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x942" + }, + "rhs": { + "Deref": { + "register": "FP", + "offset": -4 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 234, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ] + ], + "pythonic_hints": [ + [ + 0, + [ + "memory[ap + 0] = 0 <= memory[fp + -6]" + ] + ], + [ + 41, + [ + "memory[ap + 0] = 0 <= memory[ap + -26]" + ] + ], + [ + 61, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 84, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 102, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 116, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 130, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 186, + [ + "memory[ap + 0] = 2370 <= memory[fp + -4]" + ] + ], + [ + 234, + [ + "memory[ap + 0] = segments.add()" + ] + ] + ], + "entry_points_by_type": { + "EXTERNAL": [ + { + "selector": "0x36fbc999025b89d36d31dc2f9c0a03b4377755e1f27e0e42a385aaba90f61a6", + "offset": 0, + "builtins": [ + "range_check" + ] + } + ], + "L1_HANDLER": [], + "CONSTRUCTOR": [] + } +} \ No newline at end of file diff --git a/starknet_programs/raw_contract_classes/fibonacci.sierra b/starknet_programs/raw_contract_classes/fibonacci.sierra new file mode 100644 index 000000000..8cd932a4e --- /dev/null +++ b/starknet_programs/raw_contract_classes/fibonacci.sierra @@ -0,0 +1,373 @@ +{ + "sierra_program": [ + "0x1", + "0x2", + "0x0", + "0x2", + "0x0", + "0x0", + "0xd5", + "0x2b", + "0x16", + "0x52616e6765436865636b", + "0x0", + "0x4761734275696c74696e", + "0x66656c74323532", + "0x4172726179", + "0x1", + "0x2", + "0x536e617073686f74", + "0x3", + "0x537472756374", + "0x1baeba72e79e9db2587cf44fedb2f3700b2075a5e8e39a562584862c4b71f62", + "0x4", + "0x2ee1e2b1b89f8c495f200e4956278a4d47395fe262f27b52e5865c9524c08c3", + "0x456e756d", + "0x11c6d8087e00642489f92d2821ad6ebd6532ad1a3b6d12833da6d6810391511", + "0x6", + "0x753332", + "0x3288d594b9a45d15bb2fcb7903f06cdb06b27f0ba88186ec4cfaa98307cb972", + "0x4275696c74696e436f737473", + "0x17bc4bcbb517b92736828af382c42b71df97fe5d0a8db42d13069b34a1ddbe9", + "0x14de46c93830b854d231d540339ee8ae16bb18830a375fe81572a472d5945f1", + "0xd", + "0x2f528e3c691e195fca674982b69c0dc4284f206c3ea4d680220e99b59315a92", + "0xc", + "0xe", + "0x5", + "0x19b3b4955bdcfa379bfc5a4949111c4efdd79128f8676f4d0895419b22e2ad7", + "0x10", + "0x53797374656d", + "0x426f78", + "0x29d7d57c04a880978e7b3689f6218e507f3be17588744b58dc17762447ad0e7", + "0x13", + "0x4e6f6e5a65726f", + "0x50", + "0x7265766f6b655f61705f747261636b696e67", + "0x656e61626c655f61705f747261636b696e67", + "0x77697468647261775f676173", + "0x6272616e63685f616c69676e", + "0x73746f72655f74656d70", + "0x66756e6374696f6e5f63616c6c", + "0x656e756d5f6d61746368", + "0x7", + "0x7374727563745f6465636f6e737472756374", + "0x61727261795f6c656e", + "0x736e617073686f745f74616b65", + "0x8", + "0x64726f70", + "0x7533325f636f6e7374", + "0x72656e616d65", + "0x7533325f6571", + "0x7374727563745f636f6e737472756374", + "0x656e756d5f696e6974", + "0x9", + "0x6a756d70", + "0x626f6f6c5f6e6f745f696d706c", + "0x6765745f6275696c74696e5f636f737473", + "0xa", + "0x77697468647261775f6761735f616c6c", + "0x64697361626c655f61705f747261636b696e67", + "0xb", + "0xf", + "0x61727261795f6e6577", + "0x11", + "0x12", + "0x66656c743235325f636f6e7374", + "0x4f7574206f6620676173", + "0x61727261795f617070656e64", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x496e70757420746f6f2073686f727420666f7220617267756d656e7473", + "0x61727261795f736e617073686f745f706f705f66726f6e74", + "0x14", + "0x756e626f78", + "0x647570", + "0x66656c743235325f69735f7a65726f", + "0x15", + "0x66656c743235325f616464", + "0x66656c743235325f737562", + "0x122", + "0xffffffffffffffff", + "0xad", + "0x9d", + "0x8c", + "0x7a", + "0x17", + "0x18", + "0x19", + "0x1a", + "0x1b", + "0x1c", + "0x1d", + "0x1e", + "0x1f", + "0x21", + "0x20", + "0x22", + "0x25", + "0x23", + "0x24", + "0x26", + "0x65", + "0x27", + "0x28", + "0x29", + "0x2a", + "0x54", + "0x2b", + "0x2c", + "0x2d", + "0x2e", + "0x2f", + "0x33", + "0x34", + "0x35", + "0x36", + "0x37", + "0x38", + "0x30", + "0x31", + "0x32", + "0x39", + "0x4d", + "0x3a", + "0x3b", + "0x3c", + "0x3d", + "0x3e", + "0x41", + "0x42", + "0x3f", + "0x40", + "0x43", + "0x44", + "0x45", + "0x46", + "0x47", + "0x48", + "0x49", + "0x4a", + "0x4b", + "0x4c", + "0x4e", + "0x4f", + "0x51", + "0x52", + "0x53", + "0x55", + "0x56", + "0x57", + "0x58", + "0x59", + "0x5a", + "0x5d", + "0x5b", + "0x5c", + "0x5e", + "0x5f", + "0x60", + "0x61", + "0x62", + "0x63", + "0x64", + "0x66", + "0x67", + "0x68", + "0x69", + "0x6a", + "0x6b", + "0x6c", + "0x6d", + "0x6e", + "0x6f", + "0x70", + "0x71", + "0x72", + "0x73", + "0x74", + "0x75", + "0x76", + "0x77", + "0x78", + "0x79", + "0x7b", + "0x7c", + "0x7d", + "0x7e", + "0x7f", + "0x80", + "0x81", + "0x82", + "0x83", + "0x84", + "0x85", + "0x86", + "0x87", + "0x88", + "0x89", + "0x8a", + "0x8b", + "0x8d", + "0x8e", + "0x8f", + "0xc3", + "0xc8", + "0xd2", + "0x108", + "0xe9", + "0xfc", + "0x102", + "0xbc", + "0xd9", + "0x118", + "0x11e", + "0xa93", + "0x7060f02090e0d02060a0c060b02070a090606080706060502040203020100", + "0x2090a1502060a07060d02070a1402060a0213100610061202090e02111006", + "0x61e021d19061c061b02090e1a060d02070a190618061702090e090616060d", + "0x60906281a06062702260225022402232207060621100620061f02090e0706", + "0x60631020706302e06062f2e06062d0706062c1a06062b2a06062902060627", + "0x2370607350607340236350606270207350607341006063302322e0606272e", + "0x273c06062f3c06062d3c060633023b023a3906062702381006062f35060629", + "0x706062d0706063e1806062b3d06062907090628070606273c060627060606", + "0x607341c0606331a0606330906062f0906062d09090628090606270706062f", + "0x63316060633070606434207064106073f0607343f0606274006062702073f", + "0x6062702074706073407060646450706411a06062f440706410c0906281906", + "0x62702072a060734070606310706064847060629060747060734470606270c", + "0x3418060633024d06070641024c4b06062f024a0706064906072a0607342a06", + "0x4f06020602024f060202024e1006062706073d0607343d06062702073d0607", + "0x1a0239064f0609060c02024f060209022a1007501a0c074f07060207070202", + "0x4f060209021806513c064f0735062a020c064f060c061002352e074f063906", + "0x9023f06521c064f0719062a021916074f063d061a023d064f062e060c0202", + "0x6534b064f0720062a022040074f0647061a0247064f0616060c02024f0602", + "0x56074f065506390255064f065406350254064f0640062e02024f0602090200", + "0x24f0659063c025a59074f065806390258064f06021802024f0656063c0257", + "0x4f075c5b073d025b064f065b0619025c064f065a0616025b064f0657061602", + "0x64f065d0640025d064f065e063f025e064f06021c02024f06020902025d02", + "0x6400262064f066106470261064f06021c02024f060209020260060220025f", + "0x66463064f076006000260064f066006400260064f065f064b025f064f0662", + "0x570266064f066606560266064f06025502024f0663065402024f0602090265", + "0x64f06025902024f06025802024f060209026b6a07696867074f07661a0c09", + "0x4f0668065c026f064f0667061002024f066d065b026e6d074f066c065a026c", + "0x64b065d0273064f061c065d0272064f063c065d0271064f066e065e027006", + "0x9027a067978064f0777066102777675094f0674737271706f105f0274064f", + "0x665027e7d074f067b0663027c064f060260027b064f0678066202024f0602", + "0x28281074f06807f07670280064f067c0666027f064f067e065d02024f067d", + "0x285064f0684066b02024f0683066a028483074f0681066802024f06820654", + "0x89064f0676065c0288064f067506100287064f0686066d0286064f0685066c", + "0x67602024f060209028b8a89880c068b064f06870675028a064f0607066e02", + "0x75028e064f0607066e028d064f0676065c0279064f06750610028c064f067a", + "0x24f064b066502024f06025802024f06020902228e8d790c0622064f068c06", + "0x65d0290064f060277028f064f06026002024f063c066502024f061c066502", + "0x292064f06916907710269064f0602700291064f06908f076f0290064f0690", + "0x96064f0607066e0295064f066b065c0294064f066a06100293064f06920676", + "0x665065402024f06025802024f06020902979695940c0697064f0693067502", + "0x98064f0607066e02024f063c066502024f061c066502024f064b066502024f", + "0x29c064f060273029b064f06026002024f069a0654029a99074f0698067202", + "0x64f069d9e0771029e064f060270029d064f069c9b076f029c064f069c065d", + "0x4f0699066e0264064f061a065c02a1064f060c061002a0064f069f0676029f", + "0x65402024f06025802024f06020902a3a264a10c06a3064f06a0067502a206", + "0x64f06026002024f063c066502024f061c066502024f0640067402024f0600", + "0x64f06027002a6064f06a5a4076f02a5064f06a5065d02a5064f06027802a4", + "0x61a065c02aa064f060c061002a9064f06a8067602a8064f06a6a7077102a7", + "0x24f06020902adacabaa0c06ad064f06a9067502ac064f0607066e02ab064f", + "0x6026002024f063c066502024f0616067402024f063f065402024f06025802", + "0x6027002b0064f06afae076f02af064f06af065d02af064f06027802ae064f", + "0x65c02b4064f060c061002b3064f06b2067602b2064f06b0b1077102b1064f", + "0x6020902b653b5b40c06b6064f06b306750253064f0607066e02b5064f061a", + "0x7802b7064f06026002024f062e067402024f0618065402024f06025802024f", + "0x7102ba064f06027002b9064f06b8b7076f02b8064f06b8065d02b8064f0602", + "0xbe064f061a065c02bd064f060c061002bc064f06bb067602bb064f06b9ba07", + "0x25802024f06020902c0bfbebd0c06c0064f06bc067502bf064f0607066e02", + "0x64f06c2065d02c2064f06027702c1064f06026002024f0609067402024f06", + "0x6c5067602c5064f06c3c4077102c4064f06027002c3064f06c2c1076f02c2", + "0xc6067502c8064f0607066e02c7064f062a065c0252064f0610061002c6064f", + "0x20c06ca0907074f0706067a0206064f0602062e02c9c8c7520c06c9064f06", + "0x20022a064f061a067d0210064f0607067c021a064f0609067b02024f060209", + "0x4f060c067c0235064f062e067e022e064f06021c02024f0602090202cb0602", + "0x72a06810239064f0639060c0239064f0610066b022a064f0635067d021006", + "0x6800219064f0616067f0216064f063c068202024f060209021806cc3c064f", + "0x24f060209023f1c07063f064f063d0683021c064f0639060c023d064f0619", + "0x247064f0639060c0220064f064006840240064f06021c02024f0618065402", + "0x64f061006560210064f06025502024f060258024b4707064b064f06200683", + "0x3c1a074f061a068502024f06020902393507cd2e2a074f0710060209570210", + "0x24f061a066502024f060209021806ce024f073c0686022a064f062a061002", + "0x219064f062e065c0216064f062a061002024f0607065b02024f060c066502", + "0x60c068502024f0618068702024f0602090202cf060220023d064f0609065d", + "0x100220064f06401a078a0240064f060289021c064f063f090788023f0c074f", + "0x257064f060c065d0256064f0607065e0255064f062e065c0254064f062a06", + "0x2004b47094f06595857565554105f0259064f0620065d0258064f061c065d", + "0x64f06470610025c064f065a066202024f060209025b06d05a064f07000661", + "0x4f065e068c025e064f063d068b023d064f065c065d0219064f064b065c0216", + "0x62615f090662064f065d06790261064f0619065c025f064f06160610025d06", + "0x265064f064b065c0263064f064706100260064f065b068d02024f06020902", + "0x4f0607065b02024f060c066502024f06020902666563090666064f06600679", + "0x5d0268064f0602770267064f06026002024f061a066502024f060906650202", + "0x6c064f066a6b0771026b064f060270026a064f066867076f0268064f066806", + "0x64f066d06790275064f0639065c026e064f06350610026d064f066c068d02", + "0x20c064f06021c0209064f060706076f0207064f0602067f0276756e090676", + "0x602066e0206064f06021c02101a070610064f060c068e021a064f06090666", + "0x2090706023f4006020c1a4006020c1a0907070609064f0606068e0207064f", + "0x100907090707d21a0c090706023d0602090707073c060210d1022a1a071a06", + "0xd4021040074006d30602" + ], + "sierra_program_debug_info": { + "type_names": [], + "libfunc_names": [], + "user_func_names": [] + }, + "contract_class_version": "0.1.0", + "entry_points_by_type": { + "EXTERNAL": [ + { + "selector": "0x112e35f48499939272000bd72eb840e502ca4c3aefa8800992e8defb746e0c9", + "function_idx": 0 + } + ], + "L1_HANDLER": [], + "CONSTRUCTOR": [] + }, + "abi": [ + { + "type": "impl", + "name": "Fibonacci", + "interface_name": "fibonacci::fibonacci::IFibonacci" + }, + { + "type": "interface", + "name": "fibonacci::fibonacci::IFibonacci", + "items": [ + { + "type": "function", + "name": "fib", + "inputs": [ + { + "name": "a", + "type": "core::felt252" + }, + { + "name": "b", + "type": "core::felt252" + }, + { + "name": "n", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "event", + "name": "fibonacci::fibonacci::Fibonacci::Event", + "kind": "enum", + "variants": [] + } + ] +} \ No newline at end of file diff --git a/tests/account_panic.rs b/tests/account_panic.rs new file mode 100644 index 000000000..195b21d9f --- /dev/null +++ b/tests/account_panic.rs @@ -0,0 +1,117 @@ +use std::sync::Arc; + +use cairo_vm::felt::Felt252; +use starknet_in_rust::{ + core::contract_address::compute_casm_class_hash, + definitions::{block_context::BlockContext, constants::TRANSACTION_VERSION}, + services::api::contract_classes::compiled_class::CompiledClass, + state::{ + cached_state::CachedState, + contract_class_cache::{ContractClassCache, PermanentContractClassCache}, + in_memory_state_reader::InMemoryStateReader, + }, + transaction::{InvokeFunction, Transaction}, + utils::{calculate_sn_keccak, Address}, + CasmContractClass, +}; + +#[test] +fn account_panic() { + let account_data = include_bytes!("../starknet_programs/cairo2/account_panic.casm"); + let contract_data = include_bytes!("../starknet_programs/cairo2/contract_a.casm"); + + let account_contract_class: CasmContractClass = serde_json::from_slice(account_data).unwrap(); + let account_class_hash = compute_casm_class_hash(&account_contract_class) + .unwrap() + .to_be_bytes(); + + let contract_class: CasmContractClass = serde_json::from_slice(contract_data).unwrap(); + let contract_class_hash_felt = compute_casm_class_hash(&contract_class).unwrap(); + let contract_class_hash = contract_class_hash_felt.to_be_bytes(); + + let account_address = Address(1111.into()); + let contract_address = Address(0000.into()); + let nonce = 0.into(); + + let block_context = BlockContext::default(); + + let contract_class_cache = PermanentContractClassCache::default(); + + contract_class_cache.set_contract_class( + account_class_hash, + CompiledClass::Casm(Arc::new(account_contract_class)), + ); + contract_class_cache.set_contract_class( + contract_class_hash, + CompiledClass::Casm(Arc::new(contract_class.clone())), + ); + + let mut state_reader = InMemoryStateReader::default(); + state_reader + .address_to_class_hash_mut() + .insert(account_address.clone(), account_class_hash); + state_reader + .address_to_nonce_mut() + .insert(account_address.clone(), nonce); + state_reader + .address_to_class_hash_mut() + .insert(contract_address.clone(), contract_class_hash); + state_reader + .address_to_nonce_mut() + .insert(contract_address, 1.into()); + let mut state = CachedState::new(Arc::new(state_reader), Arc::new(contract_class_cache)); + + let selector = Felt252::from_bytes_be(&calculate_sn_keccak(b"__execute__")); + + // arguments of contract_a contract + // calldata is a Vec of Call, which is + /* + #[derive(Drop, Serde)] + struct Call { + to: ContractAddress, + selector: felt252, + calldata: Array + } + */ + let selector_contract = &contract_class + .entry_points_by_type + .external + .get(0) + .unwrap() + .selector; + // calldata of contract_a is 1 value. + let calldata: Vec<_> = [ + 1.into(), + contract_class_hash_felt, + selector_contract.into(), + 1.into(), + 2.into(), + ] + .to_vec(); + + // set up remaining structures + + let invoke = InvokeFunction::new( + account_address, + Felt252::new(selector), + 0, + TRANSACTION_VERSION.clone(), + calldata, + vec![], + block_context.starknet_os_config().chain_id().clone(), + Some(0.into()), + ) + .unwrap(); + + let tx = Transaction::InvokeFunction(invoke); + let exec_info = tx + .execute(&mut state, &block_context, u128::MAX) + .expect("failed to invoke"); + let call_info = exec_info.call_info.as_ref().unwrap(); + + assert_eq!(exec_info.revert_error, None); + + // 482670963043u128 == 'panic' + assert_eq!(call_info.retdata[0], 482670963043u128.into()); + assert!(call_info.failure_flag); +} diff --git a/tests/cairo_1_syscalls.rs b/tests/cairo_1_syscalls.rs index e4b542843..c43af7bb6 100644 --- a/tests/cairo_1_syscalls.rs +++ b/tests/cairo_1_syscalls.rs @@ -5,6 +5,8 @@ use cairo_vm::{ }; use num_bigint::BigUint; use num_traits::{Num, One, Zero}; +use pretty_assertions_sorted::{assert_eq, assert_eq_sorted}; +use starknet_in_rust::utils::calculate_sn_keccak; use starknet_in_rust::{ definitions::{block_context::BlockContext, constants::TRANSACTION_VERSION}, execution::{ @@ -276,7 +278,7 @@ fn library_call() { let mut resources_manager = ExecutionResourcesManager::default(); let expected_execution_resources = ExecutionResources { #[cfg(not(feature = "cairo_1_tests"))] - n_steps: 255, + n_steps: 247, #[cfg(feature = "cairo_1_tests")] n_steps: 259, n_memory_holes: 8, @@ -284,7 +286,7 @@ fn library_call() { }; let expected_execution_resources_internal_call = ExecutionResources { #[cfg(not(feature = "cairo_1_tests"))] - n_steps: 84, + n_steps: 80, #[cfg(feature = "cairo_1_tests")] n_steps: 85, n_memory_holes: 5, @@ -300,7 +302,7 @@ fn library_call() { entry_point_type: Some(EntryPointType::External), calldata, retdata: [5.into()].to_vec(), - execution_resources: expected_execution_resources, + execution_resources: Some(expected_execution_resources), class_hash: Some(class_hash), internal_calls: vec![CallInfo { caller_address: Address(0.into()), @@ -316,7 +318,7 @@ fn library_call() { entry_point_type: Some(EntryPointType::External), calldata: vec![25.into()], retdata: [5.into()].to_vec(), - execution_resources: expected_execution_resources_internal_call, + execution_resources: Some(expected_execution_resources_internal_call), class_hash: Some(lib_class_hash), gas_consumed: 0, ..Default::default() @@ -327,13 +329,13 @@ fn library_call() { storage_read_values: vec![], accessed_storage_keys: HashSet::new(), #[cfg(not(feature = "cairo_1_tests"))] - gas_consumed: 78650, + gas_consumed: 78250, #[cfg(feature = "cairo_1_tests")] gas_consumed: 78980, ..Default::default() }; - assert_eq!( + assert_eq_sorted!( exec_entry_point .execute( &mut state, @@ -359,9 +361,10 @@ fn call_contract_storage_write_read() { let program_data = include_bytes!("../starknet_programs/cairo1/wallet_wrapper.casm"); let contract_class: CasmContractClass = serde_json::from_slice(program_data).unwrap(); - let entrypoints = contract_class.clone().entry_points_by_type; - let get_balance_entrypoint_selector = &entrypoints.external.get(1).unwrap().selector; - let increase_balance_entrypoint_selector = &entrypoints.external.get(0).unwrap().selector; + let get_balance_entrypoint_selector = + &BigUint::from_bytes_be(&calculate_sn_keccak("get_balance".as_bytes())); + let increase_balance_entrypoint_selector = + &BigUint::from_bytes_be(&calculate_sn_keccak("increase_balance".as_bytes())); // Create state reader with class hash data let contract_class_cache = PermanentContractClassCache::default(); @@ -742,6 +745,7 @@ fn deploy_cairo1_from_cairo1() { let ret_casm_class = match state.get_contract_class(&ret_class_hash).unwrap() { CompiledClass::Casm(class) => class.as_ref().clone(), CompiledClass::Deprecated(_) => unreachable!(), + CompiledClass::Sierra(_) => unreachable!(), }; assert_eq!(ret_casm_class, test_contract_class); @@ -842,6 +846,7 @@ fn deploy_cairo0_from_cairo1_without_constructor() { let ret_class_hash = state.get_class_hash_at(&ret_address).unwrap(); let ret_casm_class = match state.get_contract_class(&ret_class_hash).unwrap() { CompiledClass::Deprecated(class) => class.as_ref().clone(), + CompiledClass::Sierra(_) => unreachable!(), CompiledClass::Casm(_) => unreachable!(), }; @@ -943,6 +948,7 @@ fn deploy_cairo0_from_cairo1_with_constructor() { let ret_casm_class = match state.get_contract_class(&ret_class_hash).unwrap() { CompiledClass::Deprecated(class) => class.as_ref().clone(), CompiledClass::Casm(_) => unreachable!(), + CompiledClass::Sierra(_) => unreachable!(), }; assert_eq!(ret_casm_class, test_contract_class); @@ -1045,6 +1051,7 @@ fn deploy_cairo0_and_invoke() { let ret_casm_class = match state.get_contract_class(&ret_class_hash).unwrap() { CompiledClass::Deprecated(class) => class.as_ref().clone(), CompiledClass::Casm(_) => unreachable!(), + CompiledClass::Sierra(_) => unreachable!(), }; assert_eq!(ret_casm_class, test_contract_class); @@ -1156,8 +1163,18 @@ fn test_send_message_to_l1_syscall() { payload: vec![555.into(), 666.into()], }]; + #[cfg(not(feature = "cairo_1_tests"))] + let expected_n_steps = 46; + #[cfg(feature = "cairo_1_tests")] + let expected_n_steps = 50; + + #[cfg(not(feature = "cairo_1_tests"))] + let expected_gas_consumed = 9640; + #[cfg(feature = "cairo_1_tests")] + let expected_gas_consumed = 10040; + let expected_execution_resources = ExecutionResources { - n_steps: 50, + n_steps: expected_n_steps, n_memory_holes: 0, builtin_instance_counter: HashMap::from([(RANGE_CHECK_BUILTIN_NAME.to_string(), 2)]), }; @@ -1170,8 +1187,8 @@ fn test_send_message_to_l1_syscall() { entry_point_selector: Some(external_entrypoint_selector.into()), entry_point_type: Some(EntryPointType::External), l2_to_l1_messages, - execution_resources: expected_execution_resources, - gas_consumed: 10040, + execution_resources: Some(expected_execution_resources), + gas_consumed: expected_gas_consumed, ..Default::default() }; @@ -1251,8 +1268,18 @@ fn test_get_execution_info() { address.0.clone(), ]; + #[cfg(not(feature = "cairo_1_tests"))] + let expected_n_steps = 213; + #[cfg(feature = "cairo_1_tests")] + let expected_n_steps = 268; + + #[cfg(not(feature = "cairo_1_tests"))] + let expected_gas_consumed = 22980; + #[cfg(feature = "cairo_1_tests")] + let expected_gas_consumed = 28580; + let expected_execution_resources = ExecutionResources { - n_steps: 268, + n_steps: expected_n_steps, n_memory_holes: 4, builtin_instance_counter: HashMap::from([(RANGE_CHECK_BUILTIN_NAME.to_string(), 4)]), }; @@ -1265,8 +1292,8 @@ fn test_get_execution_info() { entry_point_selector: Some(external_entrypoint_selector.into()), entry_point_type: Some(EntryPointType::External), retdata: expected_ret_data, - execution_resources: expected_execution_resources, - gas_consumed: 28580, + execution_resources: Some(expected_execution_resources), + gas_consumed: expected_gas_consumed, ..Default::default() }; @@ -3044,3 +3071,539 @@ fn keccak_syscall() { assert_eq!(retdata[0], Felt252::one()); } + +#[test] +fn library_call_recursive_50_calls() { + // Create program and entry point types for contract class + #[cfg(not(feature = "cairo_1_tests"))] + let program_data = include_bytes!("../starknet_programs/cairo2/square_root_recursive.casm"); + #[cfg(feature = "cairo_1_tests")] + let program_data = include_bytes!("../starknet_programs/cairo1/square_root_recursive.casm"); + + let contract_class: CasmContractClass = serde_json::from_slice(program_data).unwrap(); + let entrypoints = contract_class.clone().entry_points_by_type; + let entrypoint_selector = &entrypoints.external.get(0).unwrap().selector; + + // Create state reader with class hash data + let contract_class_cache = PermanentContractClassCache::default(); + + let address = Address(1111.into()); + let class_hash: ClassHash = [1; 32]; + let nonce = Felt252::zero(); + + contract_class_cache + .set_contract_class(class_hash, CompiledClass::Casm(Arc::new(contract_class))); + let mut state_reader = InMemoryStateReader::default(); + state_reader + .address_to_class_hash_mut() + .insert(address.clone(), class_hash); + state_reader + .address_to_nonce_mut() + .insert(address.clone(), nonce); + + // Add lib contract to the state + + #[cfg(not(feature = "cairo_1_tests"))] + let lib_program_data = include_bytes!("../starknet_programs/cairo2/math_lib.casm"); + #[cfg(feature = "cairo_1_tests")] + let lib_program_data = include_bytes!("../starknet_programs/cairo1/math_lib.casm"); + + let lib_contract_class: CasmContractClass = serde_json::from_slice(lib_program_data).unwrap(); + + let lib_address = Address(1112.into()); + let lib_class_hash: ClassHash = [2; 32]; + let lib_nonce = Felt252::zero(); + + contract_class_cache.set_contract_class( + lib_class_hash, + CompiledClass::Casm(Arc::new(lib_contract_class)), + ); + state_reader + .address_to_class_hash_mut() + .insert(lib_address.clone(), lib_class_hash); + state_reader + .address_to_nonce_mut() + .insert(lib_address, lib_nonce); + + // Create state from the state_reader and contract cache. + let mut state = CachedState::new(Arc::new(state_reader), Arc::new(contract_class_cache)); + + // Create an execution entry point + let calldata = [ + felt_str!("1125899906842624"), + Felt252::from_bytes_be(&lib_class_hash), + Felt252::from(50), + ] + .to_vec(); + let caller_address = Address(0000.into()); + let entry_point_type = EntryPointType::External; + + let exec_entry_point = ExecutionEntryPoint::new( + address, + calldata, + Felt252::new(entrypoint_selector.clone()), + caller_address, + entry_point_type, + Some(CallType::Delegate), + Some(class_hash), + u128::MAX, + ); + + // Execute the entrypoint + let block_context = BlockContext::default(); + let mut tx_execution_context = TransactionExecutionContext::new( + Address(0.into()), + Felt252::zero(), + Vec::new(), + 0, + 10.into(), + block_context.invoke_tx_max_n_steps(), + TRANSACTION_VERSION.clone(), + ); + let mut resources_manager = ExecutionResourcesManager::default(); + let expected_execution_resources_internal_call = ExecutionResources { + #[cfg(not(feature = "cairo_1_tests"))] + n_steps: 80, + #[cfg(feature = "cairo_1_tests")] + n_steps: 85, + n_memory_holes: 5, + builtin_instance_counter: HashMap::from([(RANGE_CHECK_BUILTIN_NAME.to_string(), 7)]), + }; + + let call_info = exec_entry_point + .execute( + &mut state, + &block_context, + &mut resources_manager, + &mut tx_execution_context, + false, + block_context.invoke_tx_max_n_steps(), + ) + .unwrap() + .call_info + .unwrap(); + + assert_eq!(call_info.internal_calls.len(), 50); + assert_eq!( + call_info.internal_calls[0], + CallInfo { + caller_address: Address(0.into()), + call_type: Some(CallType::Delegate), + contract_address: Address(1111.into()), + entry_point_selector: Some( + Felt252::from_str_radix( + "544923964202674311881044083303061611121949089655923191939299897061511784662", + 10, + ) + .unwrap(), + ), + entry_point_type: Some(EntryPointType::External), + calldata: vec![felt_str!("1125899906842624")], + retdata: [felt_str!("33554432")].to_vec(), + execution_resources: Some(expected_execution_resources_internal_call), + class_hash: Some(lib_class_hash), + gas_consumed: 0, + ..Default::default() + } + ); + assert_eq!(call_info.retdata, [1.into()].to_vec()); + assert!(!call_info.failure_flag); +} + +#[test] +fn call_contract_storage_write_read_recursive_50_calls() { + // Create program and entry point types for contract class + #[cfg(not(feature = "cairo_1_tests"))] + let program_data = include_bytes!("../starknet_programs/cairo2/wallet_wrapper.casm"); + #[cfg(feature = "cairo_1_tests")] + let program_data = include_bytes!("../starknet_programs/cairo1/wallet_wrapper.casm"); + + let contract_class: CasmContractClass = serde_json::from_slice(program_data).unwrap(); + let get_balance_entrypoint_selector = + &BigUint::from_bytes_be(&calculate_sn_keccak("get_balance".as_bytes())); + let increase_balance_entrypoint_selector = &BigUint::from_bytes_be(&calculate_sn_keccak( + "increase_balance_recursive".as_bytes(), + )); + + // Create state reader with class hash data + let contract_class_cache = PermanentContractClassCache::default(); + + let address = Address(1111.into()); + let class_hash: ClassHash = [1; 32]; + let nonce = Felt252::zero(); + + contract_class_cache + .set_contract_class(class_hash, CompiledClass::Casm(Arc::new(contract_class))); + let mut state_reader = InMemoryStateReader::default(); + state_reader + .address_to_class_hash_mut() + .insert(address.clone(), class_hash); + state_reader + .address_to_nonce_mut() + .insert(address.clone(), nonce); + + // Add simple_wallet contract to the state + #[cfg(not(feature = "cairo_1_tests"))] + let simple_wallet_program_data = + include_bytes!("../starknet_programs/cairo2/simple_wallet.casm"); + #[cfg(feature = "cairo_1_tests")] + let simple_wallet_program_data = + include_bytes!("../starknet_programs/cairo1/simple_wallet.casm"); + + let simple_wallet_contract_class: CasmContractClass = + serde_json::from_slice(simple_wallet_program_data).unwrap(); + let simple_wallet_constructor_entrypoint_selector = simple_wallet_contract_class + .entry_points_by_type + .constructor + .get(0) + .unwrap() + .selector + .clone(); + + let simple_wallet_address = Address(1112.into()); + let simple_wallet_class_hash: ClassHash = [2; 32]; + let simple_wallet_nonce = Felt252::zero(); + + contract_class_cache.set_contract_class( + simple_wallet_class_hash, + CompiledClass::Casm(Arc::new(simple_wallet_contract_class)), + ); + state_reader + .address_to_class_hash_mut() + .insert(simple_wallet_address.clone(), simple_wallet_class_hash); + state_reader + .address_to_nonce_mut() + .insert(simple_wallet_address.clone(), simple_wallet_nonce); + + // Create state from the state_reader and contract cache. + let mut state = CachedState::new(Arc::new(state_reader), Arc::new(contract_class_cache)); + + let block_context = BlockContext::default(); + let mut tx_execution_context = TransactionExecutionContext::new( + Address(0.into()), + Felt252::zero(), + Vec::new(), + 0, + 10.into(), + block_context.invoke_tx_max_n_steps(), + TRANSACTION_VERSION.clone(), + ); + + let mut resources_manager = ExecutionResourcesManager::default(); + + let create_execute_extrypoint = |selector: &BigUint, + calldata: Vec, + entry_point_type: EntryPointType, + class_hash: [u8; 32], + address: Address| + -> ExecutionEntryPoint { + ExecutionEntryPoint::new( + address, + calldata, + Felt252::new(selector.clone()), + Address(0000.into()), + entry_point_type, + Some(CallType::Delegate), + Some(class_hash), + u64::MAX.into(), + ) + }; + + // RUN SIMPLE_WALLET CONSTRUCTOR + // Create an execution entry point + let calldata = [25.into()].to_vec(); + let constructor_exec_entry_point = create_execute_extrypoint( + &simple_wallet_constructor_entrypoint_selector, + calldata, + EntryPointType::Constructor, + simple_wallet_class_hash, + simple_wallet_address.clone(), + ); + + // Run constructor entrypoint + constructor_exec_entry_point + .execute( + &mut state, + &block_context, + &mut resources_manager, + &mut tx_execution_context, + false, + block_context.invoke_tx_max_n_steps(), + ) + .unwrap(); + + // RUN GET_BALANCE + // Create an execution entry point + let calldata = [simple_wallet_address.0.clone()].to_vec(); + let get_balance_exec_entry_point = create_execute_extrypoint( + get_balance_entrypoint_selector, + calldata, + EntryPointType::External, + class_hash, + address.clone(), + ); + + // Run get_balance entrypoint + let call_info = get_balance_exec_entry_point + .execute( + &mut state, + &block_context, + &mut resources_manager, + &mut tx_execution_context, + false, + block_context.invoke_tx_max_n_steps(), + ) + .unwrap(); + assert_eq!(call_info.call_info.unwrap().retdata, [25.into()]); + + // RUN INCREASE_BALANCE + // Create an execution entry point + let calldata = [50.into(), simple_wallet_address.0.clone()].to_vec(); + let increase_balance_entry_point = create_execute_extrypoint( + increase_balance_entrypoint_selector, + calldata, + EntryPointType::External, + class_hash, + address.clone(), + ); + + // Run increase_balance entrypoint + let call_info = increase_balance_entry_point + .execute( + &mut state, + &block_context, + &mut resources_manager, + &mut tx_execution_context, + false, + block_context.invoke_tx_max_n_steps(), + ) + .unwrap() + .call_info + .unwrap(); + // Check that the recursive function did in fact call the simple_wallet contract 50 times + assert_eq!(call_info.internal_calls.len(), 50); + assert!(!call_info.failure_flag); + + // RUN GET_BALANCE + // Create an execution entry point + let calldata = [simple_wallet_address.0].to_vec(); + let get_balance_exec_entry_point = create_execute_extrypoint( + get_balance_entrypoint_selector, + calldata, + EntryPointType::External, + class_hash, + address, + ); + + // Run get_balance entrypoint + let call_info = get_balance_exec_entry_point + .execute( + &mut state, + &block_context, + &mut resources_manager, + &mut tx_execution_context, + false, + block_context.invoke_tx_max_n_steps(), + ) + .unwrap(); + assert_eq!(call_info.call_info.unwrap().retdata, [75.into()]) +} + +#[test] +fn call_contract_storage_write_read_recursive_100_calls() { + // Create program and entry point types for contract class + #[cfg(not(feature = "cairo_1_tests"))] + let program_data = include_bytes!("../starknet_programs/cairo2/wallet_wrapper.casm"); + #[cfg(feature = "cairo_1_tests")] + let program_data = include_bytes!("../starknet_programs/cairo1/wallet_wrapper.casm"); + + let contract_class: CasmContractClass = serde_json::from_slice(program_data).unwrap(); + let get_balance_entrypoint_selector = + &BigUint::from_bytes_be(&calculate_sn_keccak("get_balance".as_bytes())); + let increase_balance_entrypoint_selector = &BigUint::from_bytes_be(&calculate_sn_keccak( + "increase_balance_recursive".as_bytes(), + )); + + // Create state reader with class hash data + let contract_class_cache = PermanentContractClassCache::default(); + + let address = Address(1111.into()); + let class_hash: ClassHash = [1; 32]; + let nonce = Felt252::zero(); + + contract_class_cache + .set_contract_class(class_hash, CompiledClass::Casm(Arc::new(contract_class))); + let mut state_reader = InMemoryStateReader::default(); + state_reader + .address_to_class_hash_mut() + .insert(address.clone(), class_hash); + state_reader + .address_to_nonce_mut() + .insert(address.clone(), nonce); + + // Add simple_wallet contract to the state + #[cfg(not(feature = "cairo_1_tests"))] + let simple_wallet_program_data = + include_bytes!("../starknet_programs/cairo2/simple_wallet.casm"); + #[cfg(feature = "cairo_1_tests")] + let simple_wallet_program_data = + include_bytes!("../starknet_programs/cairo1/simple_wallet.casm"); + + let simple_wallet_contract_class: CasmContractClass = + serde_json::from_slice(simple_wallet_program_data).unwrap(); + let simple_wallet_constructor_entrypoint_selector = simple_wallet_contract_class + .entry_points_by_type + .constructor + .get(0) + .unwrap() + .selector + .clone(); + + let simple_wallet_address = Address(1112.into()); + let simple_wallet_class_hash: ClassHash = [2; 32]; + let simple_wallet_nonce = Felt252::zero(); + + contract_class_cache.set_contract_class( + simple_wallet_class_hash, + CompiledClass::Casm(Arc::new(simple_wallet_contract_class)), + ); + state_reader + .address_to_class_hash_mut() + .insert(simple_wallet_address.clone(), simple_wallet_class_hash); + state_reader + .address_to_nonce_mut() + .insert(simple_wallet_address.clone(), simple_wallet_nonce); + + // Create state from the state_reader and contract cache. + let mut state = CachedState::new(Arc::new(state_reader), Arc::new(contract_class_cache)); + + let block_context = BlockContext::default(); + let mut tx_execution_context = TransactionExecutionContext::new( + Address(0.into()), + Felt252::zero(), + Vec::new(), + 0, + 10.into(), + block_context.invoke_tx_max_n_steps(), + TRANSACTION_VERSION.clone(), + ); + + let mut resources_manager = ExecutionResourcesManager::default(); + + let create_execute_extrypoint = |selector: &BigUint, + calldata: Vec, + entry_point_type: EntryPointType, + class_hash: [u8; 32], + address: Address| + -> ExecutionEntryPoint { + ExecutionEntryPoint::new( + address, + calldata, + Felt252::new(selector.clone()), + Address(0000.into()), + entry_point_type, + Some(CallType::Delegate), + Some(class_hash), + u64::MAX.into(), + ) + }; + + // RUN SIMPLE_WALLET CONSTRUCTOR + // Create an execution entry point + let calldata = [25.into()].to_vec(); + let constructor_exec_entry_point = create_execute_extrypoint( + &simple_wallet_constructor_entrypoint_selector, + calldata, + EntryPointType::Constructor, + simple_wallet_class_hash, + simple_wallet_address.clone(), + ); + + // Run constructor entrypoint + constructor_exec_entry_point + .execute( + &mut state, + &block_context, + &mut resources_manager, + &mut tx_execution_context, + false, + block_context.invoke_tx_max_n_steps(), + ) + .unwrap(); + + // RUN GET_BALANCE + // Create an execution entry point + let calldata = [simple_wallet_address.0.clone()].to_vec(); + let get_balance_exec_entry_point = create_execute_extrypoint( + get_balance_entrypoint_selector, + calldata, + EntryPointType::External, + class_hash, + address.clone(), + ); + + // Run get_balance entrypoint + let call_info = get_balance_exec_entry_point + .execute( + &mut state, + &block_context, + &mut resources_manager, + &mut tx_execution_context, + false, + block_context.invoke_tx_max_n_steps(), + ) + .unwrap(); + assert_eq!(call_info.call_info.unwrap().retdata, [25.into()]); + + // RUN INCREASE_BALANCE + // Create an execution entry point + let calldata = [100.into(), simple_wallet_address.0.clone()].to_vec(); + let increase_balance_entry_point = create_execute_extrypoint( + increase_balance_entrypoint_selector, + calldata, + EntryPointType::External, + class_hash, + address.clone(), + ); + + // Run increase_balance entrypoint + let call_info = increase_balance_entry_point + .execute( + &mut state, + &block_context, + &mut resources_manager, + &mut tx_execution_context, + false, + block_context.invoke_tx_max_n_steps(), + ) + .unwrap() + .call_info + .unwrap(); + // Check that the recursive function did in fact call the simple_wallet contract 50 times + assert_eq!(call_info.internal_calls.len(), 100); + assert!(!call_info.failure_flag); + + // RUN GET_BALANCE + // Create an execution entry point + let calldata = [simple_wallet_address.0].to_vec(); + let get_balance_exec_entry_point = create_execute_extrypoint( + get_balance_entrypoint_selector, + calldata, + EntryPointType::External, + class_hash, + address, + ); + + // Run get_balance entrypoint + let call_info = get_balance_exec_entry_point + .execute( + &mut state, + &block_context, + &mut resources_manager, + &mut tx_execution_context, + false, + block_context.invoke_tx_max_n_steps(), + ) + .unwrap(); + assert_eq!(call_info.call_info.unwrap().retdata, [125.into()]) +} diff --git a/tests/cairo_native.rs b/tests/cairo_native.rs new file mode 100644 index 000000000..dfa10b1de --- /dev/null +++ b/tests/cairo_native.rs @@ -0,0 +1,1001 @@ +#![cfg(all(feature = "cairo-native", not(feature = "cairo_1_tests")))] + +use crate::CallType::Call; +use cairo_lang_starknet::casm_contract_class::CasmContractEntryPoints; +use cairo_lang_starknet::contract_class::ContractEntryPoints; +use cairo_vm::felt::Felt252; +use num_bigint::BigUint; +use num_traits::One; +use num_traits::Zero; +use pretty_assertions_sorted::{assert_eq, assert_eq_sorted}; +use starknet_in_rust::definitions::block_context::BlockContext; +use starknet_in_rust::execution::{Event, OrderedEvent}; +use starknet_in_rust::hash_utils::calculate_contract_address; +use starknet_in_rust::services::api::contract_classes::compiled_class::CompiledClass; +use starknet_in_rust::state::contract_class_cache::ContractClassCache; +use starknet_in_rust::state::contract_class_cache::PermanentContractClassCache; +use starknet_in_rust::CasmContractClass; +use starknet_in_rust::EntryPointType::{self, External}; +use starknet_in_rust::{ + definitions::constants::TRANSACTION_VERSION, + execution::{ + execution_entry_point::ExecutionEntryPoint, CallInfo, CallType, TransactionExecutionContext, + }, + state::cached_state::CachedState, + state::{in_memory_state_reader::InMemoryStateReader, ExecutionResourcesManager}, + utils::{Address, ClassHash}, +}; + +use std::collections::HashSet; +use std::sync::Arc; + +#[test] +fn integration_test_erc20() { + let sierra_contract_class: cairo_lang_starknet::contract_class::ContractClass = + serde_json::from_str( + std::fs::read_to_string("starknet_programs/cairo2/erc20.sierra") + .unwrap() + .as_str(), + ) + .unwrap(); + + let casm_data = include_bytes!("../starknet_programs/cairo2/erc20.casm"); + let casm_contract_class: CasmContractClass = serde_json::from_slice(casm_data).unwrap(); + + let native_entrypoints = sierra_contract_class.clone().entry_points_by_type; + let native_constructor_selector = &native_entrypoints.constructor.get(0).unwrap().selector; + + let casm_entrypoints = casm_contract_class.clone().entry_points_by_type; + let casm_constructor_selector = &casm_entrypoints.constructor.get(0).unwrap().selector; + + // Create state reader with class hash data + let contract_class_cache = PermanentContractClassCache::default(); + + static NATIVE_CLASS_HASH: ClassHash = [1; 32]; + static CASM_CLASS_HASH: ClassHash = [2; 32]; + + let caller_address = Address(123456789.into()); + + contract_class_cache.set_contract_class( + NATIVE_CLASS_HASH, + CompiledClass::Sierra(Arc::new(sierra_contract_class)), + ); + contract_class_cache.set_contract_class( + CASM_CLASS_HASH, + CompiledClass::Casm(Arc::new(casm_contract_class)), + ); + let mut state_reader = InMemoryStateReader::default(); + let nonce = Felt252::zero(); + + state_reader + .address_to_class_hash_mut() + .insert(caller_address.clone(), CASM_CLASS_HASH); + state_reader + .address_to_nonce_mut() + .insert(caller_address.clone(), nonce); + + // Create state from the state_reader and contract cache. + let state_reader = Arc::new(state_reader); + let mut state_vm = + CachedState::new(state_reader.clone(), Arc::new(contract_class_cache.clone())); + let mut state_native = CachedState::new(state_reader, Arc::new(contract_class_cache)); + + /* + 1 recipient + 2 name + 3 decimals + 4 initial_supply + 5 symbol + */ + let calldata = [ + caller_address.0.clone(), + 2.into(), + 3.into(), + 4.into(), + 5.into(), + ] + .to_vec(); + + let vm_result = execute( + &mut state_vm, + &caller_address, + &caller_address, + casm_constructor_selector, + &calldata, + EntryPointType::Constructor, + &CASM_CLASS_HASH, + ); + + let native_result = execute( + &mut state_native, + &caller_address, + &caller_address, + native_constructor_selector, + &calldata, + EntryPointType::Constructor, + &NATIVE_CLASS_HASH, + ); + + assert_eq!(vm_result.caller_address, caller_address); + assert_eq!(vm_result.call_type, Some(CallType::Delegate)); + assert_eq!(vm_result.contract_address, caller_address); + assert_eq!( + vm_result.entry_point_selector, + Some(Felt252::new(casm_constructor_selector)) + ); + assert_eq!( + vm_result.entry_point_type, + Some(EntryPointType::Constructor) + ); + assert_eq!(vm_result.calldata, calldata); + assert!(!vm_result.failure_flag); + assert_eq!(vm_result.retdata, [].to_vec()); + assert_eq!(vm_result.class_hash, Some(CASM_CLASS_HASH)); + + assert_eq!(native_result.caller_address, caller_address); + assert_eq!(native_result.call_type, Some(CallType::Delegate)); + assert_eq!(native_result.contract_address, caller_address); + assert_eq!( + native_result.entry_point_selector, + Some(Felt252::new(native_constructor_selector)) + ); + assert_eq!( + native_result.entry_point_type, + Some(EntryPointType::Constructor) + ); + assert_eq!(native_result.calldata, calldata); + assert!(!native_result.failure_flag); + assert_eq!(native_result.retdata, [].to_vec()); + assert_eq!(native_result.execution_resources, None); + assert_eq!(native_result.class_hash, Some(NATIVE_CLASS_HASH)); + + assert_eq!(vm_result.events, native_result.events); + assert_eq!( + vm_result.accessed_storage_keys, + native_result.accessed_storage_keys + ); + assert_eq!(vm_result.l2_to_l1_messages, native_result.l2_to_l1_messages); + assert_eq!(vm_result.gas_consumed, native_result.gas_consumed); + + #[allow(clippy::too_many_arguments)] + fn compare_results( + state_vm: &mut CachedState, + state_native: &mut CachedState, + selector_idx: usize, + native_entrypoints: &ContractEntryPoints, + casm_entrypoints: &CasmContractEntryPoints, + calldata: &[Felt252], + caller_address: &Address, + debug_name: &str, + ) { + let native_selector = &native_entrypoints + .external + .get(selector_idx) + .unwrap() + .selector; + let casm_selector = &casm_entrypoints + .external + .get(selector_idx) + .unwrap() + .selector; + + let vm_result = execute( + state_vm, + caller_address, + caller_address, + casm_selector, + calldata, + EntryPointType::External, + &CASM_CLASS_HASH, + ); + + let native_result = execute( + state_native, + caller_address, + caller_address, + native_selector, + calldata, + EntryPointType::External, + &NATIVE_CLASS_HASH, + ); + + assert_eq!(vm_result.failure_flag, native_result.failure_flag); + assert_eq!(vm_result.retdata, native_result.retdata); + assert_eq!(vm_result.events, native_result.events); + assert_eq!( + vm_result.accessed_storage_keys, + native_result.accessed_storage_keys + ); + assert_eq!(vm_result.l2_to_l1_messages, native_result.l2_to_l1_messages); + + assert_eq!( + vm_result.gas_consumed, native_result.gas_consumed, + "gas consumed mismatch for {debug_name}", + ); + } + + // --------------- GET TOTAL SUPPLY ----------------- + + compare_results( + &mut state_vm, + &mut state_native, + 5, + &native_entrypoints, + &casm_entrypoints, + &[], + &caller_address, + "get total supply 1", + ); + + // ---------------- GET DECIMALS ---------------------- + + compare_results( + &mut state_vm, + &mut state_native, + 1, + &native_entrypoints, + &casm_entrypoints, + &[], + &caller_address, + "get decimals 1", + ); + + // ---------------- GET NAME ---------------------- + + compare_results( + &mut state_vm, + &mut state_native, + 6, + &native_entrypoints, + &casm_entrypoints, + &[], + &caller_address, + "get name", + ); + + // // ---------------- GET SYMBOL ---------------------- + + compare_results( + &mut state_vm, + &mut state_native, + 7, + &native_entrypoints, + &casm_entrypoints, + &[], + &caller_address, + "get symbol", + ); + + // ---------------- GET BALANCE OF CALLER ---------------------- + + compare_results( + &mut state_vm, + &mut state_native, + 8, + &native_entrypoints, + &casm_entrypoints, + &[caller_address.0.clone()], + &caller_address, + "get balance of caller", + ); + + // // ---------------- ALLOWANCE OF ADDRESS 1 ---------------------- + + compare_results( + &mut state_vm, + &mut state_native, + 3, + &native_entrypoints, + &casm_entrypoints, + &[caller_address.0.clone(), 1.into()], + &caller_address, + "get allowance of address 1", + ); + + // // ---------------- INCREASE ALLOWANCE OF ADDRESS 1 by 10_000 ---------------------- + + compare_results( + &mut state_vm, + &mut state_native, + 2, + &native_entrypoints, + &casm_entrypoints, + &[1.into(), 10_000.into()], + &caller_address, + "increase allowance of address 1 by 10000", + ); + + // ---------------- ALLOWANCE OF ADDRESS 1 ---------------------- + + // Checking again because allowance changed with previous call. + compare_results( + &mut state_vm, + &mut state_native, + 3, + &native_entrypoints, + &casm_entrypoints, + &[caller_address.0.clone(), 1.into()], + &caller_address, + "allowance of address 1 part 2", + ); + + // ---------------- APPROVE ADDRESS 1 TO MAKE TRANSFERS ON BEHALF OF THE CALLER ---------------------- + + compare_results( + &mut state_vm, + &mut state_native, + 4, + &native_entrypoints, + &casm_entrypoints, + &[1.into(), 5000.into()], + &caller_address, + "approve address 1 to make transfers", + ); + + // ---------------- TRANSFER 3 TOKENS FROM CALLER TO ADDRESS 2 --------- + + compare_results( + &mut state_vm, + &mut state_native, + 0, + &native_entrypoints, + &casm_entrypoints, + &[2.into(), 3.into()], + &caller_address, + "transfer 3 tokens", + ); + + // // ---------------- GET BALANCE OF CALLER ---------------------- + + compare_results( + &mut state_vm, + &mut state_native, + 8, + &native_entrypoints, + &casm_entrypoints, + &[caller_address.0.clone()], + &caller_address, + "GET BALANCE OF CALLER", + ); + + // // ---------------- GET BALANCE OF ADDRESS 2 ---------------------- + + compare_results( + &mut state_vm, + &mut state_native, + 8, + &native_entrypoints, + &casm_entrypoints, + &[2.into()], + &caller_address, + "GET BALANCE OF ADDRESS 2", + ); + + // // ---------------- TRANSFER 1 TOKEN FROM CALLER TO ADDRESS 2, CALLED FROM ADDRESS 1 ---------------------- + + compare_results( + &mut state_vm, + &mut state_native, + 9, + &native_entrypoints, + &casm_entrypoints, + &[1.into(), 2.into(), 1.into()], + &caller_address, + "TRANSFER 1 TOKEN FROM CALLER TO ADDRESS 2, CALLED FROM ADDRESS 1", + ); + + // // ---------------- GET BALANCE OF ADDRESS 2 ---------------------- + + compare_results( + &mut state_vm, + &mut state_native, + 8, + &native_entrypoints, + &casm_entrypoints, + &[2.into()], + &caller_address, + "GET BALANCE OF ADDRESS 2 part 2", + ); + + // // ---------------- GET BALANCE OF CALLER ---------------------- + + compare_results( + &mut state_vm, + &mut state_native, + 8, + &native_entrypoints, + &casm_entrypoints, + &[caller_address.0.clone()], + &caller_address, + "GET BALANCE OF CALLER last", + ); +} + +#[test] +fn call_contract_test() { + // Caller contract + let caller_contract_class: cairo_lang_starknet::contract_class::ContractClass = + serde_json::from_str( + std::fs::read_to_string("starknet_programs/cairo2/caller.sierra") + .unwrap() + .as_str(), + ) + .unwrap(); + + // Callee contract + let callee_contract_class: cairo_lang_starknet::contract_class::ContractClass = + serde_json::from_str( + std::fs::read_to_string("starknet_programs/cairo2/callee.sierra") + .unwrap() + .as_str(), + ) + .unwrap(); + + // Caller contract entrypoints + let caller_entrypoints = caller_contract_class.clone().entry_points_by_type; + let call_contract_selector = &caller_entrypoints.external.get(0).unwrap().selector; + + // Callee contract entrypoints + let callee_entrypoints = callee_contract_class.clone().entry_points_by_type; + let fn_selector = &callee_entrypoints.external.get(0).unwrap().selector; + + // Create state reader with class hash data + let contract_class_cache = PermanentContractClassCache::default(); + + // Caller contract data + let caller_address = Address(1111.into()); + let caller_class_hash: ClassHash = [1; 32]; + let caller_nonce = Felt252::zero(); + + // Callee contract data + let callee_address = Address(1112.into()); + let callee_class_hash: ClassHash = [2; 32]; + let callee_nonce = Felt252::zero(); + + contract_class_cache.set_contract_class( + caller_class_hash, + CompiledClass::Sierra(Arc::new(caller_contract_class)), + ); + contract_class_cache.set_contract_class( + callee_class_hash, + CompiledClass::Sierra(Arc::new(callee_contract_class)), + ); + + let mut state_reader = InMemoryStateReader::default(); + + // Insert caller contract info into state reader + state_reader + .address_to_class_hash_mut() + .insert(caller_address.clone(), caller_class_hash); + state_reader + .address_to_nonce_mut() + .insert(caller_address.clone(), caller_nonce); + + // Insert callee contract info into state reader + state_reader + .address_to_class_hash_mut() + .insert(callee_address.clone(), callee_class_hash); + state_reader + .address_to_nonce_mut() + .insert(callee_address.clone(), callee_nonce); + + // Create state from the state_reader and contract cache. + let mut state = CachedState::new(Arc::new(state_reader), Arc::new(contract_class_cache)); + + let calldata = [fn_selector.into()].to_vec(); + let result = execute( + &mut state, + &caller_address, + &callee_address, + call_contract_selector, + &calldata, + EntryPointType::External, + &caller_class_hash, + ); + + assert_eq!(result.retdata, [Felt252::new(44)]); +} + +#[test] +fn call_echo_contract_test() { + // Caller contract + let caller_contract_class: cairo_lang_starknet::contract_class::ContractClass = + serde_json::from_str( + std::fs::read_to_string("starknet_programs/cairo2/echo_caller.sierra") + .unwrap() + .as_str(), + ) + .unwrap(); + + // Callee contract + let callee_contract_class: cairo_lang_starknet::contract_class::ContractClass = + serde_json::from_str( + std::fs::read_to_string("starknet_programs/cairo2/echo.sierra") + .unwrap() + .as_str(), + ) + .unwrap(); + + // Caller contract entrypoints + let caller_entrypoints = caller_contract_class.clone().entry_points_by_type; + let call_contract_selector = &caller_entrypoints.external.get(0).unwrap().selector; + + // Callee contract entrypoints + let callee_entrypoints = callee_contract_class.clone().entry_points_by_type; + let fn_selector = &callee_entrypoints.external.get(0).unwrap().selector; + + // Create state reader with class hash data + let contract_class_cache = PermanentContractClassCache::default(); + + // Caller contract data + let caller_address = Address(1111.into()); + let caller_class_hash: ClassHash = [1; 32]; + let caller_nonce = Felt252::zero(); + + // Callee contract data + let callee_address = Address(1112.into()); + let callee_class_hash: ClassHash = [2; 32]; + let callee_nonce = Felt252::zero(); + + contract_class_cache.set_contract_class( + caller_class_hash, + CompiledClass::Sierra(Arc::new(caller_contract_class)), + ); + + contract_class_cache.set_contract_class( + callee_class_hash, + CompiledClass::Sierra(Arc::new(callee_contract_class)), + ); + + let mut state_reader = InMemoryStateReader::default(); + + // Insert caller contract info into state reader + state_reader + .address_to_class_hash_mut() + .insert(caller_address.clone(), caller_class_hash); + state_reader + .address_to_nonce_mut() + .insert(caller_address.clone(), caller_nonce); + + // Insert callee contract info into state reader + state_reader + .address_to_class_hash_mut() + .insert(callee_address.clone(), callee_class_hash); + state_reader + .address_to_nonce_mut() + .insert(callee_address.clone(), callee_nonce); + + // Create state from the state_reader and contract cache. + let mut state = CachedState::new(Arc::new(state_reader), Arc::new(contract_class_cache)); + + let calldata = [fn_selector.into(), 99999999.into()].to_vec(); + let result = execute( + &mut state, + &caller_address, + &callee_address, + call_contract_selector, + &calldata, + EntryPointType::External, + &caller_class_hash, + ); + + assert_eq!(result.retdata, [Felt252::new(99999999)]); + assert_eq!(result.gas_consumed, 89110); +} + +#[test] +#[cfg(feature = "cairo-native")] +fn call_events_contract_test() { + // Caller contract + let caller_contract_class: cairo_lang_starknet::contract_class::ContractClass = + serde_json::from_str( + std::fs::read_to_string("starknet_programs/cairo2/caller.sierra") + .unwrap() + .as_str(), + ) + .unwrap(); + + // Callee contract + let callee_contract_class: cairo_lang_starknet::contract_class::ContractClass = + serde_json::from_str( + std::fs::read_to_string("starknet_programs/cairo2/event_emitter.sierra") + .unwrap() + .as_str(), + ) + .unwrap(); + + // Caller contract entrypoints + let caller_entrypoints = caller_contract_class.clone().entry_points_by_type; + let call_contract_selector = &caller_entrypoints.external.get(0).unwrap().selector; + + // Event emmitter contract entrypoints + let callee_entrypoints = callee_contract_class.clone().entry_points_by_type; + let fn_selector = &callee_entrypoints.external.get(0).unwrap().selector; + + // Create state reader with class hash data + let contract_class_cache = PermanentContractClassCache::default(); + + // Caller contract data + let caller_address = Address(1111.into()); + let caller_class_hash: ClassHash = [1; 32]; + let caller_nonce = Felt252::zero(); + + // Callee contract data + let callee_address = Address(1112.into()); + let callee_class_hash: ClassHash = [2; 32]; + let callee_nonce = Felt252::zero(); + + contract_class_cache.set_contract_class( + caller_class_hash, + CompiledClass::Sierra(Arc::new(caller_contract_class)), + ); + + contract_class_cache.set_contract_class( + callee_class_hash, + CompiledClass::Sierra(Arc::new(callee_contract_class)), + ); + + let mut state_reader = InMemoryStateReader::default(); + + // Insert caller contract info into state reader + state_reader + .address_to_class_hash_mut() + .insert(caller_address.clone(), caller_class_hash); + state_reader + .address_to_nonce_mut() + .insert(caller_address.clone(), caller_nonce); + + // Insert callee contract info into state reader + state_reader + .address_to_class_hash_mut() + .insert(callee_address.clone(), callee_class_hash); + state_reader + .address_to_nonce_mut() + .insert(callee_address.clone(), callee_nonce); + + // Create state from the state_reader and contract cache. + let mut state = CachedState::new(Arc::new(state_reader), Arc::new(contract_class_cache)); + + let calldata = [fn_selector.into()].to_vec(); + let result = execute( + &mut state, + &caller_address, + &callee_address, + call_contract_selector, + &calldata, + EntryPointType::External, + &caller_class_hash, + ); + + let internal_call = CallInfo { + caller_address: Address(1111.into()), + call_type: Some(Call), + contract_address: Address(1112.into()), + code_address: None, + class_hash: Some([ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, + ]), + entry_point_selector: Some(fn_selector.into()), + entry_point_type: Some(External), + calldata: Vec::new(), + retdata: vec![1234.into()], + execution_resources: None, + events: vec![OrderedEvent { + order: 0, + keys: vec![110.into()], + data: vec![1.into()], + }], + l2_to_l1_messages: Vec::new(), + storage_read_values: Vec::new(), + accessed_storage_keys: HashSet::new(), + internal_calls: Vec::new(), + gas_consumed: 9640, + failure_flag: false, + }; + + let event = Event { + from_address: Address(1112.into()), + keys: vec![110.into()], + data: vec![1.into()], + }; + + assert_eq!(result.retdata, [1234.into()]); + assert_eq!(result.events, []); + assert_eq_sorted!(result.internal_calls, [internal_call]); + + let sorted_events = result.get_sorted_events().unwrap(); + assert_eq!(sorted_events, vec![event]); +} + +fn execute( + state: &mut CachedState, + caller_address: &Address, + callee_address: &Address, + selector: &BigUint, + calldata: &[Felt252], + entrypoint_type: EntryPointType, + class_hash: &ClassHash, +) -> CallInfo { + let exec_entry_point = ExecutionEntryPoint::new( + (*callee_address).clone(), + calldata.to_vec(), + Felt252::new(selector), + (*caller_address).clone(), + entrypoint_type, + Some(CallType::Delegate), + Some(*class_hash), + u64::MAX.into(), + ); + + // Execute the entrypoint + let block_context = BlockContext::default(); + let mut tx_execution_context = TransactionExecutionContext::new( + Address(0.into()), + Felt252::zero(), + Vec::new(), + 0, + 10.into(), + block_context.invoke_tx_max_n_steps(), + TRANSACTION_VERSION.clone(), + ); + let mut resources_manager = ExecutionResourcesManager::default(); + + exec_entry_point + .execute( + state, + &block_context, + &mut resources_manager, + &mut tx_execution_context, + false, + block_context.invoke_tx_max_n_steps(), + ) + .unwrap() + .call_info + .unwrap() +} + +fn execute_deploy( + state: &mut CachedState, + caller_address: &Address, + selector: &BigUint, + calldata: &[Felt252], + entrypoint_type: EntryPointType, + class_hash: &ClassHash, +) -> CallInfo { + let exec_entry_point = ExecutionEntryPoint::new( + (*caller_address).clone(), + calldata.to_vec(), + Felt252::new(selector), + (*caller_address).clone(), + entrypoint_type, + Some(CallType::Delegate), + Some(*class_hash), + u64::MAX.into(), + ); + + // Execute the entrypoint + let block_context = BlockContext::default(); + let mut tx_execution_context = TransactionExecutionContext::new( + Address(0.into()), + Felt252::zero(), + Vec::new(), + 0, + 10.into(), + block_context.invoke_tx_max_n_steps(), + TRANSACTION_VERSION.clone(), + ); + let mut resources_manager = ExecutionResourcesManager::default(); + + exec_entry_point + .execute( + state, + &block_context, + &mut resources_manager, + &mut tx_execution_context, + false, + block_context.invoke_tx_max_n_steps(), + ) + .unwrap() + .call_info + .unwrap() +} + +#[test] +#[cfg(feature = "cairo-native")] +fn deploy_syscall_test() { + // Deployer contract + + let deployer_contract_class: cairo_lang_starknet::contract_class::ContractClass = + serde_json::from_str( + std::fs::read_to_string("starknet_programs/cairo2/deploy.sierra") + .unwrap() + .as_str(), + ) + .unwrap(); + + // Deployee contract + let deployee_contract_class: cairo_lang_starknet::contract_class::ContractClass = + serde_json::from_str( + std::fs::read_to_string("starknet_programs/cairo2/echo.sierra") + .unwrap() + .as_str(), + ) + .unwrap(); + + // deployer contract entrypoints + let deployer_entrypoints = deployer_contract_class.clone().entry_points_by_type; + let deploy_contract_selector = &deployer_entrypoints.external.get(0).unwrap().selector; + + // Echo contract entrypoints + let deployee_entrypoints = deployee_contract_class.clone().entry_points_by_type; + let _fn_selector = &deployee_entrypoints.external.get(0).unwrap().selector; + + // Create state reader with class hash data + let contract_class_cache = PermanentContractClassCache::default(); + + // Deployer contract data + let deployer_address = Address(1111.into()); + let deployer_class_hash: ClassHash = [1; 32]; + let deployer_nonce = Felt252::zero(); + + // Deployee contract data + let deployee_class_hash: ClassHash = Felt252::one().to_be_bytes(); + let _deployee_nonce = Felt252::zero(); + + contract_class_cache.set_contract_class( + deployer_class_hash, + CompiledClass::Sierra(Arc::new(deployer_contract_class)), + ); + + contract_class_cache.set_contract_class( + deployee_class_hash, + CompiledClass::Sierra(Arc::new(deployee_contract_class)), + ); + + let mut state_reader = InMemoryStateReader::default(); + + // Insert deployer contract info into state reader + state_reader + .address_to_class_hash_mut() + .insert(deployer_address.clone(), deployer_class_hash); + state_reader + .address_to_nonce_mut() + .insert(deployer_address.clone(), deployer_nonce); + + // Create state from the state_reader and contract cache. + let mut state = CachedState::new(Arc::new(state_reader), Arc::new(contract_class_cache)); + + let calldata = [Felt252::from_bytes_be(&deployee_class_hash), Felt252::one()].to_vec(); + let result = execute_deploy( + &mut state, + &deployer_address, + deploy_contract_selector, + &calldata, + EntryPointType::External, + &deployer_class_hash, + ); + let expected_deployed_contract_address = Address( + calculate_contract_address( + &Felt252::one(), + &Felt252::from_bytes_be(&deployee_class_hash), + &[100.into()], + deployer_address, + ) + .unwrap(), + ); + + assert_eq!(result.retdata, [expected_deployed_contract_address.0]); + assert_eq!(result.events, []); + assert_eq!(result.internal_calls.len(), 1); + + let sorted_events = result.get_sorted_events().unwrap(); + assert_eq!(sorted_events, vec![]); + assert_eq!(result.failure_flag, false) +} + +#[test] +#[cfg(feature = "cairo-native")] +fn deploy_syscall_address_unavailable_test() { + // Deployer contract + + use starknet_in_rust::utils::felt_to_hash; + let deployer_contract_class: cairo_lang_starknet::contract_class::ContractClass = + serde_json::from_str( + std::fs::read_to_string("starknet_programs/cairo2/deploy.sierra") + .unwrap() + .as_str(), + ) + .unwrap(); + + // Deployee contract + let deployee_contract_class: cairo_lang_starknet::contract_class::ContractClass = + serde_json::from_str( + std::fs::read_to_string("starknet_programs/cairo2/echo.sierra") + .unwrap() + .as_str(), + ) + .unwrap(); + + // deployer contract entrypoints + let deployer_entrypoints = deployer_contract_class.clone().entry_points_by_type; + let deploy_contract_selector = &deployer_entrypoints.external.get(0).unwrap().selector; + + // Echo contract entrypoints + let deployee_entrypoints = deployee_contract_class.clone().entry_points_by_type; + let _fn_selector = &deployee_entrypoints.external.get(0).unwrap().selector; + + // Create state reader with class hash data + let contract_class_cache = PermanentContractClassCache::default(); + + // Deployer contract data + let deployer_address = Address(1111.into()); + let deployer_class_hash: ClassHash = [2; 32]; + let deployer_nonce = Felt252::zero(); + + // Deployee contract data + let deployee_class_hash: ClassHash = felt_to_hash(&Felt252::one()); + let deployee_nonce = Felt252::zero(); + let expected_deployed_contract_address = Address( + calculate_contract_address( + &Felt252::one(), + &Felt252::from_bytes_be(&deployee_class_hash), + &[100.into()], + deployer_address.clone(), + ) + .unwrap(), + ); + // Insert contract to be deployed so that its address is taken + let deployee_address = expected_deployed_contract_address; + + contract_class_cache.set_contract_class( + deployer_class_hash, + CompiledClass::Sierra(Arc::new(deployer_contract_class)), + ); + + contract_class_cache.set_contract_class( + deployee_class_hash, + CompiledClass::Sierra(Arc::new(deployee_contract_class)), + ); + + let mut state_reader = InMemoryStateReader::default(); + + // Insert deployer contract info into state reader + state_reader + .address_to_class_hash_mut() + .insert(deployer_address.clone(), deployer_class_hash); + state_reader + .address_to_nonce_mut() + .insert(deployer_address.clone(), deployer_nonce); + + // Insert deployee contract info into state reader + state_reader + .address_to_class_hash_mut() + .insert(deployee_address.clone(), deployee_class_hash); + state_reader + .address_to_nonce_mut() + .insert(deployee_address.clone(), deployee_nonce); + + // Create state from the state_reader and contract cache. + let mut state = CachedState::new(Arc::new(state_reader), Arc::new(contract_class_cache)); + + let calldata = [Felt252::from_bytes_be(&deployee_class_hash), Felt252::one()].to_vec(); + let result = execute_deploy( + &mut state, + &deployer_address, + deploy_contract_selector, + &calldata, + EntryPointType::External, + &deployer_class_hash, + ); + + assert_eq!( + std::str::from_utf8(&result.retdata[0].to_be_bytes()) + .unwrap() + .trim_start_matches('\0'), + "Result::unwrap failed." + ); + assert_eq!(result.events, []); + assert_eq!(result.failure_flag, true); + assert!(result.internal_calls.is_empty()); +} diff --git a/tests/complex_contracts/amm_contracts/amm.rs b/tests/complex_contracts/amm_contracts/amm.rs index 747ddca2c..98653cd58 100644 --- a/tests/complex_contracts/amm_contracts/amm.rs +++ b/tests/complex_contracts/amm_contracts/amm.rs @@ -95,14 +95,14 @@ fn amm_init_pool_test() { entry_point_type: Some(EntryPointType::External), calldata: calldata.clone(), retdata: [].to_vec(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 232, n_memory_holes: 20, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 14), (HASH_BUILTIN_NAME.to_string(), 2), ]), - }, + }), class_hash: Some(class_hash), accessed_storage_keys, storage_read_values: vec![Felt252::zero(), Felt252::zero()], @@ -184,14 +184,14 @@ fn amm_add_demo_tokens_test() { entry_point_selector: Some(add_demo_token_selector), entry_point_type: Some(EntryPointType::External), calldata: calldata_add_demo_token.clone(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 393, n_memory_holes: 44, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 20), (HASH_BUILTIN_NAME.to_string(), 8), ]), - }, + }), class_hash: Some(class_hash), accessed_storage_keys: accessed_storage_keys_add_demo_token, storage_read_values: vec![ @@ -263,14 +263,14 @@ fn amm_get_pool_token_balance() { entry_point_selector: Some(get_pool_balance_selector), entry_point_type: Some(EntryPointType::External), calldata: calldata_get_pool_token_balance.clone(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 84, n_memory_holes: 10, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 3), (HASH_BUILTIN_NAME.to_string(), 1), ]), - }, + }), class_hash: Some(class_hash), accessed_storage_keys: accessed_storage_keys_get_pool_token_balance, storage_read_values: vec![10000.into()], @@ -358,14 +358,14 @@ fn amm_swap_test() { entry_point_type: Some(EntryPointType::External), calldata: calldata_swap.clone(), retdata: expected_return, - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 820, n_memory_holes: 95, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 41), (HASH_BUILTIN_NAME.to_string(), 14), ]), - }, + }), class_hash: Some(class_hash), accessed_storage_keys, storage_read_values: [ @@ -608,14 +608,14 @@ fn amm_get_account_token_balance_test() { entry_point_type: Some(EntryPointType::External), calldata: calldata_get_balance, retdata: expected_return, - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 92, n_memory_holes: 11, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 3), (HASH_BUILTIN_NAME.to_string(), 2), ]), - }, + }), class_hash: Some(class_hash), accessed_storage_keys, storage_read_values: [10.into()].to_vec(), diff --git a/tests/complex_contracts/amm_contracts/amm_proxy.rs b/tests/complex_contracts/amm_contracts/amm_proxy.rs index df8978826..88da2bb2e 100644 --- a/tests/complex_contracts/amm_contracts/amm_proxy.rs +++ b/tests/complex_contracts/amm_contracts/amm_proxy.rs @@ -82,14 +82,14 @@ fn amm_proxy_init_pool_test() { entry_point_type: Some(EntryPointType::External), calldata: calldata.clone()[1..].to_vec(), retdata: [].to_vec(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 232, n_memory_holes: 20, builtin_instance_counter: HashMap::from([ ("pedersen_builtin".to_string(), 2), ("range_check_builtin".to_string(), 14), ]), - }, + }), class_hash: Some(contract_class_hash), accessed_storage_keys, storage_read_values: vec![Felt252::zero(), Felt252::zero()], @@ -104,14 +104,14 @@ fn amm_proxy_init_pool_test() { entry_point_type: Some(EntryPointType::External), calldata: calldata.clone(), retdata: [].to_vec(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 280, n_memory_holes: 20, builtin_instance_counter: HashMap::from([ ("pedersen_builtin".to_string(), 2), ("range_check_builtin".to_string(), 14), ]), - }, + }), class_hash: Some(proxy_class_hash), internal_calls, ..Default::default() @@ -190,14 +190,14 @@ fn amm_proxy_get_pool_token_balance_test() { calldata: calldata.clone()[1..].to_vec(), retdata: [555.into()].to_vec(), storage_read_values: [555.into()].to_vec(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 84, n_memory_holes: 10, builtin_instance_counter: HashMap::from([ ("pedersen_builtin".to_string(), 1), ("range_check_builtin".to_string(), 3), ]), - }, + }), class_hash: Some(contract_class_hash), accessed_storage_keys, ..Default::default() @@ -211,14 +211,14 @@ fn amm_proxy_get_pool_token_balance_test() { entry_point_type: Some(EntryPointType::External), calldata: calldata.clone(), retdata: [555.into()].to_vec(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 140, n_memory_holes: 10, builtin_instance_counter: HashMap::from([ ("pedersen_builtin".to_string(), 1), ("range_check_builtin".to_string(), 3), ]), - }, + }), class_hash: Some(proxy_class_hash), internal_calls, ..Default::default() @@ -304,14 +304,14 @@ fn amm_proxy_add_demo_token_test() { entry_point_type: Some(EntryPointType::External), calldata: calldata.clone()[1..].to_vec(), storage_read_values: vec![0.into(), 0.into(), 0.into(), 0.into()], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 397, n_memory_holes: 42, builtin_instance_counter: HashMap::from([ ("pedersen_builtin".to_string(), 8), ("range_check_builtin".to_string(), 20), ]), - }, + }), class_hash: Some(contract_class_hash), accessed_storage_keys, ..Default::default() @@ -324,14 +324,14 @@ fn amm_proxy_add_demo_token_test() { entry_point_selector: Some(amm_proxy_entrypoint_selector), entry_point_type: Some(EntryPointType::External), calldata: calldata.clone(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 445, n_memory_holes: 42, builtin_instance_counter: HashMap::from([ ("pedersen_builtin".to_string(), 8), ("range_check_builtin".to_string(), 20), ]), - }, + }), class_hash: Some(proxy_class_hash), internal_calls, ..Default::default() @@ -429,14 +429,14 @@ fn amm_proxy_get_account_token_balance() { calldata: calldata.clone()[1..].to_vec(), retdata: [200.into()].to_vec(), storage_read_values: [200.into()].to_vec(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 92, n_memory_holes: 11, builtin_instance_counter: HashMap::from([ ("pedersen_builtin".to_string(), 2), ("range_check_builtin".to_string(), 3), ]), - }, + }), class_hash: Some(contract_class_hash), accessed_storage_keys, ..Default::default() @@ -450,14 +450,14 @@ fn amm_proxy_get_account_token_balance() { entry_point_type: Some(EntryPointType::External), calldata: calldata.clone(), retdata: [200.into()].to_vec(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 151, n_memory_holes: 11, builtin_instance_counter: HashMap::from([ ("pedersen_builtin".to_string(), 2), ("range_check_builtin".to_string(), 3), ]), - }, + }), class_hash: Some(proxy_class_hash), internal_calls, ..Default::default() @@ -572,14 +572,14 @@ fn amm_proxy_swap() { 1000.into(), ] .to_vec(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 826, n_memory_holes: 92, builtin_instance_counter: HashMap::from([ ("pedersen_builtin".to_string(), 14), ("range_check_builtin".to_string(), 41), ]), - }, + }), class_hash: Some(contract_class_hash), accessed_storage_keys, ..Default::default() @@ -593,14 +593,14 @@ fn amm_proxy_swap() { entry_point_type: Some(EntryPointType::External), calldata: calldata.clone(), retdata: expected_result, - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 885, n_memory_holes: 92, builtin_instance_counter: HashMap::from([ ("pedersen_builtin".to_string(), 14), ("range_check_builtin".to_string(), 41), ]), - }, + }), class_hash: Some(proxy_class_hash), internal_calls, ..Default::default() diff --git a/tests/complex_contracts/nft/erc721.rs b/tests/complex_contracts/nft/erc721.rs index 6ae4b4894..de1a8afed 100644 --- a/tests/complex_contracts/nft/erc721.rs +++ b/tests/complex_contracts/nft/erc721.rs @@ -143,14 +143,14 @@ fn erc721_balance_of_test() { entry_point_type: Some(EntryPointType::External), calldata: calldata.clone(), retdata: expected_read_result.clone(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 105, n_memory_holes: 10, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 3), (HASH_BUILTIN_NAME.to_string(), 1), ]), - }, + }), class_hash: Some(class_hash), accessed_storage_keys, storage_read_values: expected_read_result, @@ -225,14 +225,14 @@ fn erc721_test_owner_of() { entry_point_type: Some(EntryPointType::External), calldata: calldata.clone(), retdata: expected_read_result.clone(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 116, n_memory_holes: 10, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 5), (HASH_BUILTIN_NAME.to_string(), 2), ]), - }, + }), class_hash: Some(class_hash), accessed_storage_keys, storage_read_values: expected_read_result, @@ -324,14 +324,14 @@ fn erc721_test_get_approved() { entry_point_type: Some(EntryPointType::External), calldata: calldata.clone(), retdata: expected_read_result, - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 192, n_memory_holes: 20, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 8), (HASH_BUILTIN_NAME.to_string(), 4), ]), - }, + }), class_hash: Some(class_hash), accessed_storage_keys, storage_read_values, @@ -426,14 +426,14 @@ fn erc721_test_is_approved_for_all() { entry_point_type: Some(EntryPointType::External), calldata: calldata.clone(), retdata: expected_read_result, - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 101, n_memory_holes: 10, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 3), (HASH_BUILTIN_NAME.to_string(), 2), ]), - }, + }), class_hash: Some(class_hash), accessed_storage_keys, storage_read_values, @@ -529,14 +529,14 @@ fn erc721_test_approve() { entry_point_type: Some(EntryPointType::External), calldata: calldata.clone(), retdata: expected_read_result, - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 332, n_memory_holes: 30, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 13), (HASH_BUILTIN_NAME.to_string(), 6), ]), - }, + }), class_hash: Some(class_hash), accessed_storage_keys, storage_read_values, @@ -627,14 +627,14 @@ fn erc721_set_approval_for_all() { entry_point_type: Some(EntryPointType::External), calldata: calldata.clone(), retdata: expected_read_result, - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 154, n_memory_holes: 10, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 3), (HASH_BUILTIN_NAME.to_string(), 2), ]), - }, + }), class_hash: Some(class_hash), accessed_storage_keys, storage_read_values, @@ -777,14 +777,14 @@ fn erc721_transfer_from_test() { accessed_storage_keys, storage_read_values: expected_read_values, events: expected_events, - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 1131, n_memory_holes: 117, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 53), (HASH_BUILTIN_NAME.to_string(), 16), ]), - }, + }), ..Default::default() }; @@ -868,14 +868,14 @@ fn erc721_transfer_from_and_get_owner_test() { class_hash: Some(class_hash), accessed_storage_keys, storage_read_values: expected_read_result, - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 116, n_memory_holes: 10, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 5), (HASH_BUILTIN_NAME.to_string(), 2), ]), - }, + }), ..Default::default() }; diff --git a/tests/deploy_account.rs b/tests/deploy_account.rs index 842267831..f6330312c 100644 --- a/tests/deploy_account.rs +++ b/tests/deploy_account.rs @@ -103,7 +103,7 @@ fn internal_deploy_account() { ("n_steps", 3612), ("pedersen_builtin", 23), ("range_check_builtin", 83), - ("l1_gas_usage", 3672) + ("l1_gas_usage", 3060) ] .into_iter() .map(|(k, v)| (k.to_string(), v)) @@ -177,11 +177,11 @@ fn internal_deploy_account_cairo1() { let n_steps; #[cfg(not(feature = "cairo_1_tests"))] { - n_steps = 3948; + n_steps = 3921; } #[cfg(feature = "cairo_1_tests")] { - n_steps = 3952; + n_steps = 3937; } assert_eq!( @@ -195,7 +195,7 @@ fn internal_deploy_account_cairo1() { )), code_address: None, #[cfg(not(feature="cairo_1_tests"))] - gas_consumed: 16440, + gas_consumed: 15540, #[cfg(feature="cairo_1_tests")] gas_consumed: 16770, class_hash: Some([ @@ -212,12 +212,12 @@ fn internal_deploy_account_cairo1() { 2.into() ], retdata: vec![felt_str!("370462705988")], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { #[cfg(not(feature="cairo_1_tests"))] - n_steps: 152, + n_steps: 144, #[cfg(feature="cairo_1_tests")] n_steps: 155, - n_memory_holes: 17, + n_memory_holes: 2, builtin_instance_counter: [ ("range_check_builtin", 2), @@ -225,7 +225,7 @@ fn internal_deploy_account_cairo1() { .into_iter() .map(|(k, v)| (k.to_string(), v)) .collect(), - }, + }), ..Default::default() }), @@ -242,14 +242,14 @@ fn internal_deploy_account_cairo1() { entry_point_selector: Some(felt_str!("1159040026212278395030414237414753050475174923702621880048416706425641521556")), entry_point_type: Some(EntryPointType::Constructor), #[cfg(not(feature="cairo_1_tests"))] - gas_consumed: 14240, + gas_consumed: 13840, #[cfg(feature="cairo_1_tests")] gas_consumed: 14350, calldata: vec![2.into()], accessed_storage_keys: keys, - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { #[cfg(not(feature="cairo_1_tests"))] - n_steps: 92, + n_steps: 88, #[cfg(feature="cairo_1_tests")] n_steps: 93, n_memory_holes: 0, @@ -260,7 +260,7 @@ fn internal_deploy_account_cairo1() { .into_iter() .map(|(k, v)| (k.to_string(), v)) .collect(), - }, + }), ..Default::default() }), None, @@ -270,7 +270,7 @@ fn internal_deploy_account_cairo1() { ("n_steps", n_steps), ("pedersen_builtin", 23), ("range_check_builtin", 87), - ("l1_gas_usage", 4896) + ("l1_gas_usage", 5508) ] .into_iter() .map(|(k, v)| (k.to_string(), v)) diff --git a/tests/fibonacci.rs b/tests/fibonacci.rs index abad548d8..90ef33054 100644 --- a/tests/fibonacci.rs +++ b/tests/fibonacci.rs @@ -117,10 +117,10 @@ fn integration_test() { calldata, retdata: [144.into()].to_vec(), class_hash: Some(class_hash), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 94, ..Default::default() - }, + }), ..Default::default() }; @@ -211,13 +211,13 @@ fn integration_test_cairo1() { entry_point_type: Some(EntryPointType::External), calldata, retdata: [144.into()].to_vec(), - execution_resources: ExecutionResources { - n_steps: 418, + execution_resources: Some(ExecutionResources { + n_steps: 414, n_memory_holes: 0, builtin_instance_counter: HashMap::from([(RANGE_CHECK_BUILTIN_NAME.to_string(), 15)]), - }, + }), class_hash: Some(class_hash), - gas_consumed: 35220, + gas_consumed: 34820, ..Default::default() }; diff --git a/tests/increase_balance.rs b/tests/increase_balance.rs index c5910b321..6808f16de 100644 --- a/tests/increase_balance.rs +++ b/tests/increase_balance.rs @@ -123,10 +123,10 @@ fn hello_starknet_increase_balance() { entry_point_type: Some(EntryPointType::External), calldata, retdata: [].to_vec(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 65, ..Default::default() - }, + }), class_hash: Some(class_hash), accessed_storage_keys: expected_accessed_storage_keys, storage_read_values: expected_storage_read_values, diff --git a/tests/internals.rs b/tests/internals.rs index 5a7443a92..e54d26240 100644 --- a/tests/internals.rs +++ b/tests/internals.rs @@ -406,10 +406,10 @@ fn expected_validate_call_info( // Entries **not** in blockifier. class_hash: Some(felt_to_hash(&TEST_ACCOUNT_CONTRACT_CLASS_HASH)), call_type: Some(CallType::Call), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 13, ..Default::default() - }, + }), ..Default::default() } @@ -476,14 +476,14 @@ fn expected_fee_transfer_call_info( Felt252::zero(), Felt252::zero(), ], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 529, n_memory_holes: 57, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 21), (HASH_BUILTIN_NAME.to_string(), 4), ]), - }, + }), ..Default::default() } } @@ -610,6 +610,20 @@ fn invoke_tx(calldata: Vec, max_fee: u128) -> InvokeFunction { .unwrap() } +fn invoke_tx_with_nonce(calldata: Vec, max_fee: u128, nonce: Felt252) -> InvokeFunction { + InvokeFunction::new( + TEST_ACCOUNT_CONTRACT_ADDRESS.clone(), + EXECUTE_ENTRY_POINT_SELECTOR.clone(), + max_fee, + TRANSACTION_VERSION.clone(), + calldata, + vec![], + StarknetChainId::TestNet.to_felt(), + Some(nonce), + ) + .unwrap() +} + fn expected_fee_transfer_info(fee: u128) -> CallInfo { CallInfo { failure_flag: false, @@ -623,14 +637,14 @@ fn expected_fee_transfer_info(fee: u128) -> CallInfo { entry_point_type: Some(EntryPointType::External), calldata: vec![Felt252::from(4096), Felt252::from(fee), Felt252::zero()], retdata: vec![Felt252::from(1)], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 525, n_memory_holes: 59, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 21), (HASH_BUILTIN_NAME.to_string(), 4), ]), - }, + }), l2_to_l1_messages: vec![], internal_calls: vec![], events: vec![OrderedEvent { @@ -687,14 +701,14 @@ fn expected_fib_fee_transfer_info(fee: u128) -> CallInfo { entry_point_type: Some(EntryPointType::External), calldata: vec![Felt252::from(4096), Felt252::from(fee), Felt252::zero()], retdata: vec![Felt252::from(1)], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 525, n_memory_holes: 59, builtin_instance_counter: HashMap::from([ ("range_check_builtin".to_string(), 21), ("pedersen_builtin".to_string(), 4), ]), - }, + }), l2_to_l1_messages: vec![], internal_calls: vec![], events: vec![OrderedEvent { @@ -708,13 +722,13 @@ fn expected_fib_fee_transfer_info(fee: u128) -> CallInfo { ], }], storage_read_values: vec![ - INITIAL_BALANCE.clone() - Felt252::from(1252), + INITIAL_BALANCE.clone() - Felt252::from(3700), Felt252::zero(), - INITIAL_BALANCE.clone() - Felt252::from(1252), + INITIAL_BALANCE.clone() - Felt252::from(3700), Felt252::zero(), - Felt252::from(1252), + Felt252::from(3700), Felt252::zero(), - Felt252::from(1252), + Felt252::from(3700), Felt252::zero(), ], accessed_storage_keys: HashSet::from([ @@ -757,7 +771,7 @@ fn declare_tx() -> Declare { fn declarev2_tx() -> DeclareV2 { #[cfg(not(feature = "cairo_1_tests"))] - let program_data = include_bytes!("../starknet_programs/cairo2/fibonacci.sierra"); + let program_data = include_bytes!("../starknet_programs/raw_contract_classes/fibonacci.sierra"); #[cfg(feature = "cairo_1_tests")] let program_data = include_bytes!("../starknet_programs/cairo1/fibonacci.sierra"); let sierra_contract_class: SierraContractClass = serde_json::from_slice(program_data).unwrap(); @@ -775,7 +789,7 @@ fn declarev2_tx() -> DeclareV2 { nonce: 0.into(), hash_value: 0.into(), compiled_class_hash: casm_class_hash, - sierra_contract_class, + sierra_contract_class: Some(sierra_contract_class), sierra_class_hash, casm_class: casm_class.into(), skip_execute: false, @@ -871,14 +885,14 @@ fn expected_declare_fee_transfer_info(fee: u128) -> CallInfo { ], ]), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 525, n_memory_holes: 59, builtin_instance_counter: HashMap::from([ (RANGE_CHECK_BUILTIN_NAME.to_string(), 21), (HASH_BUILTIN_NAME.to_string(), 4), ]), - }, + }), ..Default::default() } } @@ -954,10 +968,10 @@ fn test_declare_tx() { entry_point_selector: Some(VALIDATE_DECLARE_ENTRY_POINT_SELECTOR.clone()), entry_point_type: Some(EntryPointType::External), calldata: vec![TEST_EMPTY_CONTRACT_CLASS_HASH.clone()], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 12, ..Default::default() - }, + }), ..Default::default() }), None, @@ -1034,7 +1048,7 @@ fn test_declarev2_tx() { ("n_steps".to_string(), 2715), ("range_check_builtin".to_string(), 63), ("pedersen_builtin".to_string(), 15), - ("l1_gas_usage".to_string(), 1224), + ("l1_gas_usage".to_string(), 3672), ]); let fee = calculate_tx_fee(&resources, *GAS_PRICE, &block_context).unwrap(); @@ -1055,10 +1069,10 @@ fn test_declarev2_tx() { entry_point_selector: Some(VALIDATE_DECLARE_ENTRY_POINT_SELECTOR.clone()), entry_point_type: Some(EntryPointType::External), calldata: vec![contract_hash], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 12, ..Default::default() - }, + }), ..Default::default() }), None, @@ -1112,18 +1126,18 @@ fn expected_execute_call_info() -> CallInfo { internal_calls: vec![], contract_address: TEST_CONTRACT_ADDRESS.clone(), code_address: None, - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 22, ..Default::default() - }, + }), ..Default::default() }], events: vec![], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 61, n_memory_holes: 0, builtin_instance_counter: HashMap::from([(RANGE_CHECK_BUILTIN_NAME.to_string(), 1)]), - }, + }), ..Default::default() } } @@ -1155,14 +1169,14 @@ fn expected_fib_execute_call_info() -> CallInfo { Felt252::from(0), ], retdata: vec![Felt252::from(42)], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { #[cfg(not(feature = "cairo_1_tests"))] - n_steps: 157, + n_steps: 153, #[cfg(feature = "cairo_1_tests")] n_steps: 160, n_memory_holes: 0, builtin_instance_counter: HashMap::from([("range_check_builtin".to_string(), 4)]), - }, + }), l2_to_l1_messages: vec![], internal_calls: vec![CallInfo { caller_address: TEST_ACCOUNT_CONTRACT_ADDRESS.clone(), @@ -1178,17 +1192,17 @@ fn expected_fib_execute_call_info() -> CallInfo { contract_address: TEST_FIB_CONTRACT_ADDRESS.clone(), code_address: None, #[cfg(not(feature = "cairo_1_tests"))] - gas_consumed: 4380, + gas_consumed: 3980, #[cfg(feature = "cairo_1_tests")] gas_consumed: 4710, - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { #[cfg(not(feature = "cairo_1_tests"))] - n_steps: 118, + n_steps: 114, #[cfg(feature = "cairo_1_tests")] n_steps: 121, n_memory_holes: 0, builtin_instance_counter: HashMap::from([("range_check_builtin".to_string(), 3)]), - }, + }), ..Default::default() }], events: vec![], @@ -1214,11 +1228,11 @@ fn expected_validate_call_info_2() -> CallInfo { Felt252::from(1), Felt252::from(2), ], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 21, n_memory_holes: 0, builtin_instance_counter: HashMap::from([(RANGE_CHECK_BUILTIN_NAME.to_string(), 1)]), - }, + }), ..Default::default() } } @@ -1239,11 +1253,11 @@ fn expected_fib_validate_call_info_2() -> CallInfo { Felt252::from(0), Felt252::from(0), ], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 21, n_memory_holes: 0, builtin_instance_counter: HashMap::from([("range_check_builtin".to_string(), 1)]), - }, + }), ..Default::default() } } @@ -1273,7 +1287,7 @@ fn expected_fib_transaction_execution_info( let n_steps; #[cfg(not(feature = "cairo_1_tests"))] { - n_steps = 4231; + n_steps = 4227; } #[cfg(feature = "cairo_1_tests")] { @@ -1281,7 +1295,7 @@ fn expected_fib_transaction_execution_info( } let resources = HashMap::from([ ("n_steps".to_string(), n_steps), - ("l1_gas_usage".to_string(), 4896), + ("l1_gas_usage".to_string(), 6732), ("pedersen_builtin".to_string(), 16), ("range_check_builtin".to_string(), 104), ]); @@ -1504,9 +1518,9 @@ fn test_invoke_with_declarev2_tx() { Felt252::from(0), // b Felt252::from(0), // n ]; - let invoke_tx = invoke_tx(calldata, u128::MAX); + let invoke_tx = invoke_tx_with_nonce(calldata, u128::MAX, Felt252::one()); - let expected_gas_consumed = 4908; + let expected_gas_consumed = 5551; let result = invoke_tx .execute(state, block_context, expected_gas_consumed) .unwrap(); @@ -1519,7 +1533,7 @@ fn test_invoke_with_declarev2_tx() { fn test_deploy_account() { let (block_context, mut state) = create_account_tx_test_state().unwrap(); - let expected_fee = 3709; + let expected_fee = 3097; let deploy_account_tx = DeployAccount::new( felt_to_hash(&TEST_ACCOUNT_CONTRACT_CLASS_HASH), @@ -1597,7 +1611,7 @@ fn test_deploy_account() { ("n_steps".to_string(), 3625), ("range_check_builtin".to_string(), 83), ("pedersen_builtin".to_string(), 23), - ("l1_gas_usage".to_string(), 3672), + ("l1_gas_usage".to_string(), 3060), ]); let fee = calculate_tx_fee(&resources, *GAS_PRICE, &block_context).unwrap(); @@ -1744,12 +1758,12 @@ fn test_deploy_account_revert() { ("n_steps".to_string(), 3625), ("range_check_builtin".to_string(), 83), ("pedersen_builtin".to_string(), 23), - ("l1_gas_usage".to_string(), 3672), + ("l1_gas_usage".to_string(), 3060), ]); let fee = calculate_tx_fee(&resources, *GAS_PRICE, &block_context).unwrap(); - assert_eq!(fee, 3709); + assert_eq!(fee, 3097); let mut expected_execution_info = TransactionExecutionInfo::new( None, @@ -1787,7 +1801,7 @@ fn expected_deploy_account_states() -> ( CachedState, CachedState, ) { - let fee = Felt252::from(3709); + let fee = Felt252::from(3097); let mut state_before = CachedState::new( Arc::new(InMemoryStateReader::new( HashMap::from([ @@ -1838,7 +1852,7 @@ fn expected_deploy_account_states() -> ( INITIAL_BALANCE.clone(), ); - let mut state_after = state_before.clone(); + let mut state_after = state_before.clone_for_testing(); // Make the contract cache independent (otherwise tests will fail because the initial state's // cache will not be empty anymore). @@ -2335,19 +2349,19 @@ fn test_library_call_with_declare_v2() { entry_point_selector: Some(external_entrypoint_selector.into()), entry_point_type: Some(EntryPointType::External), #[cfg(not(feature = "cairo_1_tests"))] - gas_consumed: 30080, + gas_consumed: 29680, #[cfg(feature = "cairo_1_tests")] gas_consumed: 30410, calldata: vec![1.into(), 1.into(), 10.into()], retdata: vec![89.into()], // fib(10) - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { #[cfg(not(feature = "cairo_1_tests"))] - n_steps: 368, + n_steps: 364, #[cfg(feature = "cairo_1_tests")] n_steps: 371, n_memory_holes: 0, builtin_instance_counter: HashMap::from([("range_check_builtin".to_string(), 13)]), - }, + }), ..Default::default() }; @@ -2359,19 +2373,19 @@ fn test_library_call_with_declare_v2() { entry_point_selector: Some(external_entrypoint_selector.into()), entry_point_type: Some(EntryPointType::External), #[cfg(not(feature = "cairo_1_tests"))] - gas_consumed: 112490, + gas_consumed: 111690, #[cfg(feature = "cairo_1_tests")] gas_consumed: 113480, calldata, retdata: vec![89.into()], // fib(10) - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { #[cfg(not(feature = "cairo_1_tests"))] - n_steps: 578, + n_steps: 570, #[cfg(feature = "cairo_1_tests")] n_steps: 587, n_memory_holes: 1, builtin_instance_counter: HashMap::from([("range_check_builtin".to_string(), 16)]), - }, + }), internal_calls: vec![expected_internal_call_info], ..Default::default() }; diff --git a/tests/storage.rs b/tests/storage.rs index 22b87180d..73a092b17 100644 --- a/tests/storage.rs +++ b/tests/storage.rs @@ -120,10 +120,10 @@ fn integration_storage_test() { entry_point_type: Some(EntryPointType::External), calldata, retdata: [42.into()].to_vec(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 68, ..Default::default() - }, + }), class_hash: Some(class_hash), storage_read_values: vec![0.into(), 42.into()], accessed_storage_keys: expected_accessed_storage_keys, diff --git a/tests/syscalls.rs b/tests/syscalls.rs index 4e96b104f..e60ecca52 100644 --- a/tests/syscalls.rs +++ b/tests/syscalls.rs @@ -175,7 +175,7 @@ fn test_contract<'a>( assert_eq!(result.calldata, calldata); assert_eq_sorted!(result.retdata, return_data.into()); assert_eq_sorted!(result.internal_calls, internal_calls.into()); - assert_eq!(result.execution_resources, execution_resources); + assert_eq!(result.execution_resources, Some(execution_resources)); assert_eq!(result.gas_consumed, 0); assert!(!result.failure_flag); @@ -217,10 +217,10 @@ fn call_contract_syscall() { entry_point_type: Some(EntryPointType::External), calldata: vec![21.into(), 2.into()], retdata: vec![42.into()], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 24, ..Default::default() - }, + }), ..Default::default() }, CallInfo { @@ -239,10 +239,10 @@ fn call_contract_syscall() { ]] .into_iter() .collect(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 63, ..Default::default() - }, + }), ..Default::default() }, CallInfo { @@ -256,10 +256,10 @@ fn call_contract_syscall() { entry_point_type: Some(EntryPointType::External), calldata: vec![], retdata: vec![2222.into()], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 26, ..Default::default() - }, + }), ..Default::default() }, ], @@ -709,11 +709,11 @@ fn library_call_syscall() { entry_point_type: Some(EntryPointType::External), calldata: vec![21.into(), 2.into()], retdata: vec![42.into()], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 24, n_memory_holes: 0, builtin_instance_counter: HashMap::default(), - }, + }), ..Default::default() }, CallInfo { @@ -732,11 +732,11 @@ fn library_call_syscall() { ]] .into_iter() .collect(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 63, n_memory_holes: 0, builtin_instance_counter: HashMap::default(), - }, + }), ..Default::default() }, CallInfo { @@ -750,11 +750,11 @@ fn library_call_syscall() { entry_point_type: Some(EntryPointType::External), calldata: vec![], retdata: vec![1111.into()], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 26, n_memory_holes: 0, builtin_instance_counter: HashMap::default(), - }, + }), ..Default::default() }, ], @@ -804,10 +804,10 @@ fn library_call_l1_handler_syscall() { .into_iter() .collect(), storage_read_values: vec![0.into()], - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 40, ..Default::default() - }, + }), ..Default::default() }], [], @@ -949,11 +949,11 @@ fn deploy_with_constructor_syscall() { entry_point_selector: Some(entry_point_selector), entry_point_type: Some(EntryPointType::Constructor), calldata: [550.into()].to_vec(), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 40, n_memory_holes: 0, ..Default::default() - }, + }), accessed_storage_keys: HashSet::<[u8; 32]>::from([[ 2, 63, 76, 85, 114, 157, 43, 172, 36, 175, 107, 126, 158, 121, 114, 77, 194, 27, 162, 147, 169, 199, 107, 53, 94, 246, 206, 221, 169, 114, 215, 255, @@ -1030,10 +1030,10 @@ fn test_deploy_and_call_contract_syscall() { retdata: vec![], storage_read_values: vec![0.into()], accessed_storage_keys: HashSet::from([constant_storage_key]), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 40, ..Default::default() - }, + }), ..Default::default() }, // Invoke storage_var_and_constructor.cairo mult_constant function @@ -1055,10 +1055,10 @@ fn test_deploy_and_call_contract_syscall() { retdata: vec![(constructor_constant.clone() * Felt252::new(4))], storage_read_values: vec![constructor_constant.clone()], accessed_storage_keys: HashSet::from([constant_storage_key]), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 52, ..Default::default() - }, + }), ..Default::default() }, // Invoke storage_var_and_constructor.cairo set_constant function @@ -1080,10 +1080,10 @@ fn test_deploy_and_call_contract_syscall() { retdata: vec![], storage_read_values: vec![constructor_constant], accessed_storage_keys: HashSet::from([constant_storage_key]), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 40, ..Default::default() - }, + }), ..Default::default() }, // Invoke storage_var_and_constructor.cairo get_constant function @@ -1105,10 +1105,10 @@ fn test_deploy_and_call_contract_syscall() { retdata: vec![new_constant.clone()], storage_read_values: vec![new_constant.clone()], accessed_storage_keys: HashSet::from([constant_storage_key]), - execution_resources: ExecutionResources { + execution_resources: Some(ExecutionResources { n_steps: 46, ..Default::default() - }, + }), ..Default::default() } ], @@ -1219,6 +1219,7 @@ fn deploy_cairo1_from_cairo0_with_constructor() { let ret_casm_class = match state.get_contract_class(&ret_class_hash).unwrap() { CompiledClass::Casm(class) => class.as_ref().clone(), CompiledClass::Deprecated(_) => unreachable!(), + CompiledClass::Sierra(_) => unreachable!(), }; assert_eq!(ret_casm_class, test_contract_class); @@ -1323,6 +1324,7 @@ fn deploy_cairo1_from_cairo0_without_constructor() { let ret_casm_class = match state.get_contract_class(&ret_class_hash).unwrap() { CompiledClass::Casm(class) => class.as_ref().clone(), CompiledClass::Deprecated(_) => unreachable!(), + CompiledClass::Sierra(_) => unreachable!(), }; assert_eq!(ret_casm_class, test_contract_class); @@ -1425,6 +1427,7 @@ fn deploy_cairo1_and_invoke() { let ret_casm_class = match state.get_contract_class(&ret_class_hash).unwrap() { CompiledClass::Casm(class) => class.as_ref().clone(), CompiledClass::Deprecated(_) => unreachable!(), + CompiledClass::Sierra(_) => unreachable!(), }; assert_eq!(ret_casm_class, test_contract_class);