diff --git a/.circleci/config.yml b/.circleci/config.yml index 94cf68887..7e30fe6cf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -354,7 +354,7 @@ jobs: executor: linux steps: - setup: - scarb_version: 0.5.0-alpha.0 + scarb_version: 0.5.0-alpha.4 - lint_rust_runner rust_runner_tests: @@ -366,7 +366,7 @@ jobs: steps: - setup: platform: << parameters.platform >> - scarb_version: 0.5.0-alpha.1 + scarb_version: 0.5.0-alpha.4 - run: name: Set git config command: git config --global protocol.file.allow always diff --git a/cairo b/cairo index fdfcfce9d..f1ddb4427 160000 --- a/cairo +++ b/cairo @@ -1 +1 @@ -Subproject commit fdfcfce9d0bbff5c081dd4fdd6f27cf9e23d7ac8 +Subproject commit f1ddb44272086133826afe2c4572987e1c81afbd diff --git a/protostar-rust/Cargo.lock b/protostar-rust/Cargo.lock index 48f68b7ca..6632ea04c 100644 --- a/protostar-rust/Cargo.lock +++ b/protostar-rust/Cargo.lock @@ -518,9 +518,9 @@ dependencies = [ [[package]] name = "cairo-felt" -version = "0.5.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451a9144bbe8bf0b351672fa0bf34e6dcc8733e2ff3a3201c8f7480fe7eb68a6" +checksum = "edaee21a254b549dd00ecb5db15399c8d03b663ddb5a659f7c62ea7e16a3ed85" dependencies = [ "lazy_static", "num-bigint", @@ -545,9 +545,9 @@ dependencies = [ [[package]] name = "cairo-lang-casm" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", "indoc", "num-bigint", "num-traits 0.2.15", @@ -586,21 +586,21 @@ dependencies = [ [[package]] name = "cairo-lang-compiler" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "anyhow", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-lowering 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-plugins 2.0.0-rc2", - "cairo-lang-project 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-sierra-generator 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-lowering 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-plugins 2.0.0-rc5", + "cairo-lang-project 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-sierra-generator 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "log", "salsa", "smol_str", @@ -615,9 +615,9 @@ checksum = "65999f741e714e9b3605bae54fbf3816bcc085a68c365132dc944cf3b9603c82" [[package]] name = "cairo-lang-debug" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", ] [[package]] @@ -640,14 +640,14 @@ dependencies = [ [[package]] name = "cairo-lang-defs" -version = "2.0.0-rc2" -dependencies = [ - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", +version = "2.0.0-rc5" +dependencies = [ + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "indexmap", "itertools", "salsa", @@ -668,10 +668,10 @@ dependencies = [ [[package]] name = "cairo-lang-diagnostics" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "itertools", "salsa", ] @@ -690,9 +690,9 @@ dependencies = [ [[package]] name = "cairo-lang-eq-solver" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", "good_lp", "indexmap", "itertools", @@ -714,10 +714,10 @@ dependencies = [ [[package]] name = "cairo-lang-filesystem" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "path-clean", "salsa", "serde", @@ -751,17 +751,17 @@ dependencies = [ [[package]] name = "cairo-lang-lowering" -version = "2.0.0-rc2" -dependencies = [ - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-proc-macros 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", +version = "2.0.0-rc5" +dependencies = [ + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-proc-macros 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "id-arena", "indexmap", "itertools", @@ -795,13 +795,13 @@ dependencies = [ [[package]] name = "cairo-lang-parser" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-syntax-codegen 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-syntax-codegen 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "colored", "itertools", "log", @@ -833,15 +833,15 @@ dependencies = [ [[package]] name = "cairo-lang-plugins" -version = "2.0.0-rc2" -dependencies = [ - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", +version = "2.0.0-rc5" +dependencies = [ + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "indoc", "itertools", "num-bigint", @@ -862,9 +862,9 @@ dependencies = [ [[package]] name = "cairo-lang-proc-macros" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-debug 2.0.0-rc2", + "cairo-lang-debug 2.0.0-rc5", "quote", "syn 1.0.109", ] @@ -884,10 +884,10 @@ dependencies = [ [[package]] name = "cairo-lang-project" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "serde", "smol_str", "thiserror", @@ -931,7 +931,7 @@ dependencies = [ [[package]] name = "cairo-lang-runner" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "anyhow", "ark-ff 0.4.2", @@ -939,23 +939,23 @@ dependencies = [ "ark-secp256r1", "ark-std 0.3.0", "blockifier", - "cairo-felt 0.5.2", - "cairo-lang-casm 2.0.0-rc2", - "cairo-lang-compiler 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-lowering 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-sierra-ap-change 2.0.0-rc2", - "cairo-lang-sierra-gas 2.0.0-rc2", - "cairo-lang-sierra-generator 2.0.0-rc2", - "cairo-lang-sierra-to-casm 2.0.0-rc2", + "cairo-felt 0.6.1", + "cairo-lang-casm 2.0.0-rc5", + "cairo-lang-compiler 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-lowering 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-sierra-ap-change 2.0.0-rc5", + "cairo-lang-sierra-gas 2.0.0-rc5", + "cairo-lang-sierra-generator 2.0.0-rc5", + "cairo-lang-sierra-to-casm 2.0.0-rc5", "cairo-lang-sierra-type-size", - "cairo-lang-starknet 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", - "cairo-vm 0.5.2", + "cairo-lang-starknet 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", + "cairo-vm 0.6.1", "itertools", "keccak", "num-bigint", @@ -964,7 +964,6 @@ dependencies = [ "salsa", "serde_json", "smol_str", - "snapbox", "starknet_api", "thiserror", ] @@ -994,16 +993,16 @@ dependencies = [ [[package]] name = "cairo-lang-semantic" -version = "2.0.0-rc2" -dependencies = [ - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-proc-macros 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", +version = "2.0.0-rc5" +dependencies = [ + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-proc-macros 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "id-arena", "itertools", "log", @@ -1038,9 +1037,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", "const-fnv1a-hash", "convert_case 0.6.0", "derivative", @@ -1072,12 +1071,12 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-ap-change" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-eq-solver 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", + "cairo-lang-eq-solver 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", "cairo-lang-sierra-type-size", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", "itertools", "thiserror", ] @@ -1097,12 +1096,12 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-gas" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-eq-solver 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", + "cairo-lang-eq-solver 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", "cairo-lang-sierra-type-size", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", "itertools", "thiserror", ] @@ -1135,20 +1134,20 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-generator" -version = "2.0.0-rc2" -dependencies = [ - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-lowering 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-plugins 2.0.0-rc2", - "cairo-lang-proc-macros 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", +version = "2.0.0-rc5" +dependencies = [ + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-lowering 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-plugins 2.0.0-rc5", + "cairo-lang-proc-macros 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "id-arena", "indexmap", "itertools", @@ -1182,16 +1181,16 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-to-casm" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "assert_matches", - "cairo-felt 0.5.2", - "cairo-lang-casm 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-sierra-ap-change 2.0.0-rc2", - "cairo-lang-sierra-gas 2.0.0-rc2", + "cairo-felt 0.6.1", + "cairo-lang-casm 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-sierra-ap-change 2.0.0-rc5", + "cairo-lang-sierra-gas 2.0.0-rc5", "cairo-lang-sierra-type-size", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", "indoc", "itertools", "log", @@ -1202,10 +1201,10 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-type-size" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", ] [[package]] @@ -1251,26 +1250,26 @@ dependencies = [ [[package]] name = "cairo-lang-starknet" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "anyhow", - "cairo-felt 0.5.2", - "cairo-lang-casm 2.0.0-rc2", - "cairo-lang-compiler 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-lowering 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-plugins 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-sierra-ap-change 2.0.0-rc2", - "cairo-lang-sierra-gas 2.0.0-rc2", - "cairo-lang-sierra-generator 2.0.0-rc2", - "cairo-lang-sierra-to-casm 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-felt 0.6.1", + "cairo-lang-casm 2.0.0-rc5", + "cairo-lang-compiler 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-lowering 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-plugins 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-sierra-ap-change 2.0.0-rc5", + "cairo-lang-sierra-gas 2.0.0-rc5", + "cairo-lang-sierra-generator 2.0.0-rc5", + "cairo-lang-sierra-to-casm 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "convert_case 0.6.0", "genco", "indoc", @@ -1306,11 +1305,11 @@ dependencies = [ [[package]] name = "cairo-lang-syntax" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "num-bigint", "num-traits 0.2.15", "salsa", @@ -1333,7 +1332,7 @@ dependencies = [ [[package]] name = "cairo-lang-syntax-codegen" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "genco", "xshell", @@ -1341,28 +1340,28 @@ dependencies = [ [[package]] name = "cairo-lang-test-runner" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "anyhow", - "cairo-felt 0.5.2", - "cairo-lang-casm 2.0.0-rc2", - "cairo-lang-compiler 2.0.0-rc2", - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-lowering 2.0.0-rc2", - "cairo-lang-plugins 2.0.0-rc2", - "cairo-lang-project 2.0.0-rc2", - "cairo-lang-runner 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-sierra-generator 2.0.0-rc2", - "cairo-lang-sierra-to-casm 2.0.0-rc2", - "cairo-lang-starknet 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", - "cairo-vm 0.5.2", + "cairo-felt 0.6.1", + "cairo-lang-casm 2.0.0-rc5", + "cairo-lang-compiler 2.0.0-rc5", + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-lowering 2.0.0-rc5", + "cairo-lang-plugins 2.0.0-rc5", + "cairo-lang-project 2.0.0-rc5", + "cairo-lang-runner 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-sierra-generator 2.0.0-rc5", + "cairo-lang-sierra-to-casm 2.0.0-rc5", + "cairo-lang-starknet 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", + "cairo-vm 0.6.1", "colored", "itertools", "num-bigint", @@ -1391,7 +1390,7 @@ dependencies = [ [[package]] name = "cairo-lang-utils" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "indexmap", "itertools", @@ -1414,9 +1413,9 @@ dependencies = [ [[package]] name = "cairo-take_until_unbalanced" -version = "0.28.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec66f846411e5fdecd2527d429135fd39ca98ef46b0df3f1558cc272b596a30" +checksum = "32c366b2a52b63db19fcc20a761ea37aa9f5fdce1723016c458e3990ef4fdf2c" dependencies = [ "nom", ] @@ -1455,15 +1454,15 @@ dependencies = [ [[package]] name = "cairo-vm" -version = "0.5.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c73ed69023e595a18799552803550fe0a3af83713f1fc97f9edaaa677f59a8" +checksum = "8be504f2684bab154d3bd45257c847db6fb450333305f162600dc497687d87d2" dependencies = [ "anyhow", "bincode", "bitvec 1.0.1", - "cairo-felt 0.5.2", - "cairo-take_until_unbalanced 0.28.0", + "cairo-felt 0.6.1", + "cairo-take_until_unbalanced 0.30.0", "generic-array", "hashbrown 0.13.2", "hex", @@ -3487,15 +3486,15 @@ dependencies = [ "ark-std 0.3.0", "assert_fs", "blockifier", - "cairo-felt 0.5.2", - "cairo-lang-casm 2.0.0-rc2", - "cairo-lang-runner 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-sierra-to-casm 2.0.0-rc2", - "cairo-lang-starknet 2.0.0-rc2", + "cairo-felt 0.6.1", + "cairo-lang-casm 2.0.0-rc5", + "cairo-lang-runner 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-sierra-to-casm 2.0.0-rc5", + "cairo-lang-starknet 2.0.0-rc5", "cairo-lang-test-runner", - "cairo-lang-utils 2.0.0-rc2", - "cairo-vm 0.5.2", + "cairo-lang-utils 2.0.0-rc5", + "cairo-vm 0.6.1", "camino", "clap", "console", @@ -4253,29 +4252,29 @@ name = "test-collector" version = "1.0.0" dependencies = [ "anyhow", - "cairo-felt 0.5.2", - "cairo-lang-casm 2.0.0-rc2", - "cairo-lang-compiler 2.0.0-rc2", - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-lowering 2.0.0-rc2", - "cairo-lang-plugins 2.0.0-rc2", - "cairo-lang-project 2.0.0-rc2", - "cairo-lang-runner 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-sierra-ap-change 2.0.0-rc2", - "cairo-lang-sierra-gas 2.0.0-rc2", - "cairo-lang-sierra-generator 2.0.0-rc2", - "cairo-lang-sierra-to-casm 2.0.0-rc2", + "cairo-felt 0.6.1", + "cairo-lang-casm 2.0.0-rc5", + "cairo-lang-compiler 2.0.0-rc5", + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-lowering 2.0.0-rc5", + "cairo-lang-plugins 2.0.0-rc5", + "cairo-lang-project 2.0.0-rc5", + "cairo-lang-runner 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-sierra-ap-change 2.0.0-rc5", + "cairo-lang-sierra-gas 2.0.0-rc5", + "cairo-lang-sierra-generator 2.0.0-rc5", + "cairo-lang-sierra-to-casm 2.0.0-rc5", "cairo-lang-sierra-type-size", - "cairo-lang-starknet 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", + "cairo-lang-starknet 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", "cairo-lang-test-runner", - "cairo-lang-utils 2.0.0-rc2", - "cairo-vm 0.5.2", + "cairo-lang-utils 2.0.0-rc5", + "cairo-vm 0.6.1", "itertools", "num-bigint", "num-integer", diff --git a/protostar-rust/Cargo.toml b/protostar-rust/Cargo.toml index 8ee91748c..c86fe1685 100644 --- a/protostar-rust/Cargo.toml +++ b/protostar-rust/Cargo.toml @@ -8,19 +8,19 @@ edition = "2021" [dependencies] anyhow = "1.0.66" test-collector = { path = "./test-collector" } -cairo-lang-test-runner = { path = "../cairo/crates/cairo-lang-test-runner", version = "2.0.0-rc2" } -cairo-lang-runner = { path = "../cairo/crates/cairo-lang-runner", version = "2.0.0-rc2" } -cairo-lang-sierra-to-casm = { path = "../cairo/crates/cairo-lang-sierra-to-casm", version = "2.0.0-rc2" } -cairo-lang-sierra = { path = "../cairo/crates/cairo-lang-sierra", version = "2.0.0-rc2" } -cairo-lang-utils = { path = "../cairo/crates/cairo-lang-utils", version = "2.0.0-rc2" } -cairo-lang-casm = { path = "../cairo/crates/cairo-lang-casm", version = "2.0.0-rc2" } -cairo-lang-starknet = { path = "../cairo/crates/cairo-lang-starknet", version = "2.0.0-rc2" } +cairo-lang-test-runner = { path = "../cairo/crates/cairo-lang-test-runner", version = "2.0.0-rc5" } +cairo-lang-runner = { path = "../cairo/crates/cairo-lang-runner", version = "2.0.0-rc5" } +cairo-lang-sierra-to-casm = { path = "../cairo/crates/cairo-lang-sierra-to-casm", version = "2.0.0-rc5" } +cairo-lang-sierra = { path = "../cairo/crates/cairo-lang-sierra", version = "2.0.0-rc5" } +cairo-lang-utils = { path = "../cairo/crates/cairo-lang-utils", version = "2.0.0-rc5" } +cairo-lang-casm = { path = "../cairo/crates/cairo-lang-casm", version = "2.0.0-rc5" } +cairo-lang-starknet = { path = "../cairo/crates/cairo-lang-starknet", version = "2.0.0-rc5" } blockifier = { git = "https://github.com/software-mansion-labs/blockifier.git", branch="kb/use-in-protostar" } starknet_api = { git = "https://github.com/starkware-libs/starknet-api", rev = "24a7249" } schemars = { version = "0.8.12", features = ["preserve_order"] } parity-scale-codec = "3.5.0" parity-scale-codec-derive = "3.1.4" -cairo-felt = "0.5.2" +cairo-felt = "0.6" clap = { version = "4.2.7", features = ["derive"] } serde_json = "1.0.96" serde = { version = "1.0.163", features = ["derive"] } @@ -36,7 +36,7 @@ once_cell = "1.18.0" indoc = "2.0.1" include_dir = "0.7.3" tempfile = "3.6.0" -cairo-vm = "0.5.2" +cairo-vm = "0.6" ark-ff = "0.4.0-alpha.7" ark-std = "0.3.0" ark-secp256k1 = "0.4.0" diff --git a/protostar-rust/src/cheatcodes_hint_processor.rs b/protostar-rust/src/cheatcodes_hint_processor.rs index 5c695bb36..68c1df06d 100644 --- a/protostar-rust/src/cheatcodes_hint_processor.rs +++ b/protostar-rust/src/cheatcodes_hint_processor.rs @@ -21,16 +21,6 @@ use blockifier::transaction::account_transaction::AccountTransaction; use blockifier::transaction::transaction_utils_for_protostar::declare_tx_default; use blockifier::transaction::transactions::{DeclareTransaction, ExecutableTransaction}; use cairo_felt::Felt252; -use cairo_lang_casm::hints::ProtostarHint; -use cairo_lang_casm::hints::{Hint, StarknetHint}; -use cairo_lang_casm::operand::ResOperand; -use cairo_lang_runner::short_string::as_cairo_short_string; -use cairo_lang_runner::{ - casm_run::{cell_ref_to_relocatable, extract_buffer, get_ptr, get_val}, - insert_value_to_cellref, CairoHintProcessor as OriginalCairoHintProcessor, -}; -use cairo_lang_starknet::casm_contract_class::CasmContractClass; -use cairo_lang_starknet::contract_class::ContractClass; use cairo_vm::hint_processor::hint_processor_definition::HintProcessor; use cairo_vm::hint_processor::hint_processor_definition::HintReference; use cairo_vm::serde::deserialize_program::ApTracking; @@ -38,6 +28,7 @@ use cairo_vm::types::exec_scope::ExecutionScopes; use cairo_vm::types::relocatable::{MaybeRelocatable, Relocatable}; use cairo_vm::vm::errors::hint_errors::HintError; use cairo_vm::vm::errors::vm_errors::VirtualMachineError; +use cairo_vm::vm::runners::cairo_runner::RunResources; use cairo_vm::vm::vm_core::VirtualMachine; use num_traits::{Num, ToPrimitive}; use serde::Deserialize; @@ -50,6 +41,17 @@ use starknet_api::transaction::{ }; use starknet_api::{patricia_key, stark_felt}; +use cairo_lang_casm::hints::{Hint, StarknetHint}; +use cairo_lang_casm::operand::{CellRef, ResOperand}; +use cairo_lang_runner::short_string::as_cairo_short_string; +use cairo_lang_runner::{ + casm_run::{cell_ref_to_relocatable, extract_buffer, get_ptr}, + insert_value_to_cellref, CairoHintProcessor as OriginalCairoHintProcessor, +}; +use cairo_lang_starknet::casm_contract_class::CasmContractClass; +use cairo_lang_starknet::contract_class::ContractClass; +use cairo_lang_utils::bigint::BigIntAsHex; + pub struct CairoHintProcessor<'a> { pub original_cairo_hint_processor: OriginalCairoHintProcessor<'a>, pub blockifier_state: Option>, @@ -62,20 +64,42 @@ impl HintProcessor for CairoHintProcessor<'_> { exec_scopes: &mut ExecutionScopes, hint_data: &Box, constants: &HashMap, + run_resources: &mut RunResources, ) -> Result<(), HintError> { let maybe_extended_hint = hint_data.downcast_ref::(); let blockifier_state = self .blockifier_state .as_mut() .expect("blockifier state is needed for executing hints"); - if let Some(Hint::Protostar(hint)) = maybe_extended_hint { - return execute_cheatcode_hint(vm, exec_scopes, hint, blockifier_state); + if let Some(Hint::Starknet(StarknetHint::Cheatcode { + selector, + input_start, + input_end, + output_start, + output_end, + })) = maybe_extended_hint + { + return execute_cheatcode_hint( + vm, + exec_scopes, + blockifier_state, + selector, + input_start, + input_end, + output_start, + output_end, + ); } if let Some(Hint::Starknet(StarknetHint::SystemCall { system })) = maybe_extended_hint { return execute_syscall(system, vm, blockifier_state); } - self.original_cairo_hint_processor - .execute_hint(vm, exec_scopes, hint_data, constants) + self.original_cairo_hint_processor.execute_hint( + vm, + exec_scopes, + hint_data, + constants, + run_resources, + ) } /// Trait function to store hint in the hint processor by string. @@ -84,7 +108,7 @@ impl HintProcessor for CairoHintProcessor<'_> { hint_code: &str, _ap_tracking_data: &ApTracking, _reference_ids: &HashMap, - _references: &HashMap, + _references: &[HintReference], ) -> Result, VirtualMachineError> { Ok(Box::new( self.original_cairo_hint_processor.string_to_hint[hint_code].clone(), @@ -202,212 +226,257 @@ fn call_contract( Ok(return_data) } -#[allow(unused, clippy::too_many_lines)] +#[allow(clippy::trivially_copy_pass_by_ref, clippy::too_many_arguments)] fn execute_cheatcode_hint( vm: &mut VirtualMachine, - exec_scopes: &mut ExecutionScopes, - hint: &ProtostarHint, + _exec_scopes: &mut ExecutionScopes, blockifier_state: &mut CachedState, + selector: &BigIntAsHex, + input_start: &ResOperand, + input_end: &ResOperand, + output_start: &CellRef, + output_end: &CellRef, ) -> Result<(), HintError> { - match hint { - &ProtostarHint::StartRoll { .. } => todo!(), - &ProtostarHint::StopRoll { .. } => todo!(), - &ProtostarHint::StartWarp { .. } => todo!(), - &ProtostarHint::StopWarp { .. } => todo!(), - ProtostarHint::Declare { - contract, - result, - err_code, - } => { - let contract_value = get_val(vm, contract)?; - - let contract_value_as_short_str = as_cairo_short_string(&contract_value) - .expect("Converting contract name to short string failed"); - let current_dir = std::env::current_dir() - .expect("Failed to get current directory") - .join("target/dev"); - - let mut paths = std::fs::read_dir(¤t_dir) - .expect("Failed to read ./target/dev, scarb build probably failed"); - - let starknet_artifacts_entry = &paths - .find_map(|path| match path { - Ok(path) => { - let name = path.file_name().into_string().ok()?; - name.contains("starknet_artifacts").then_some(path) - } - Err(_) => None, - }) - .expect("Failed to find starknet_artifacts.json file"); - let starknet_artifacts = fs::read_to_string(starknet_artifacts_entry.path()) - .unwrap_or_else(|_| { - panic!( - "Failed to read {:?} contents", - starknet_artifacts_entry.file_name() - ) - }); - let starknet_artifacts: ScarbStarknetArtifacts = - serde_json::from_str(starknet_artifacts.as_str()).unwrap_or_else(|_| { - panic!( - "Failed to parse {:?} contents", - starknet_artifacts_entry.file_name() - ) - }); - - let sierra_path = starknet_artifacts.contracts.iter().find_map(|contract| { - if contract.contract_name == contract_value_as_short_str { - return Some(contract.artifacts.sierra.clone()); - } - None - }).unwrap_or_else(|| panic!("Failed to find contract {contract_value_as_short_str} in starknet_artifacts.json")); - let sierra_path = current_dir.join(sierra_path); - - let file = std::fs::File::open(&sierra_path) - .unwrap_or_else(|_| panic!("Failed to open file at path = {:?}", &sierra_path)); - let sierra_contract_class: ContractClass = serde_json::from_reader(&file) - .unwrap_or_else(|_| panic!("File to parse json from file = {file:?}")); - - let casm_contract_class = - CasmContractClass::from_contract_class(sierra_contract_class, true) - .expect("sierra to casm failed"); - let casm_serialized = serde_json::to_string_pretty(&casm_contract_class) - .expect("Failed to serialize contract to casm"); - - let contract_class = ContractClassV1::try_from_json_string(&casm_serialized) - .expect("Failed to read contract class from json"); - let contract_class = BlockifierContractClass::V1(contract_class); - - // TODO(#2134) replace this. Hash should be calculated in the correct manner. This is just a workaround. - let mut hasher = DefaultHasher::new(); - casm_serialized.hash(&mut hasher); - let class_hash = hasher.finish(); - let class_hash = ClassHash(stark_felt!(class_hash)); - - let nonce = blockifier_state - .get_nonce_at(ContractAddress(patricia_key!( - TEST_ACCOUNT_CONTRACT_ADDRESS - ))) - .expect("Failed to get nonce"); - - let declare_tx = DeclareTransactionV0V1 { - nonce, - class_hash, - ..declare_tx_default() - }; - let tx = DeclareTransaction { - tx: starknet_api::transaction::DeclareTransaction::V1(declare_tx), - contract_class, - }; - let account_tx = AccountTransaction::Declare(tx); - let block_context = &BlockContext::create_for_account_testing(); - let tx_result = account_tx - .execute(blockifier_state, block_context) - .expect("Failed to execute declare transaction"); - - insert_value_to_cellref!( - vm, - result, - felt252_from_hex_string(&class_hash.to_string()).unwrap() - )?; - // TODO https://github.com/software-mansion/protostar/issues/2024 - // in case of errors above, consider not panicking, set an error and return it here - // instead - insert_value_to_cellref!(vm, err_code, Felt252::from(0))?; - Ok(()) - } - &ProtostarHint::DeclareCairo0 { .. } => todo!(), - &ProtostarHint::StartPrank { .. } => todo!(), - &ProtostarHint::StopPrank { .. } => todo!(), - &ProtostarHint::Invoke { .. } => todo!(), - &ProtostarHint::MockCall { .. } => todo!(), - ProtostarHint::Deploy { - prepared_contract_address, - prepared_class_hash, - prepared_constructor_calldata_start, - prepared_constructor_calldata_end, - deployed_contract_address, - panic_data_start, - panic_data_end, - } => { - let contract_address = get_val(vm, prepared_contract_address)?; - // TODO(#1991) deploy should fail if contract address provided doesn't match calculated - // or not accept this address as argument at all. - let class_hash = get_val(vm, prepared_class_hash)?; - let as_relocatable = |vm, value| { - let (base, offset) = extract_buffer(value); - get_ptr(vm, base, &offset) - }; - let mut curr = as_relocatable(vm, prepared_constructor_calldata_start)?; - let end = as_relocatable(vm, prepared_constructor_calldata_end)?; - let calldata = read_data_from_range(vm, curr, end).unwrap(); - - // Deploy a contract using syscall deploy. - let account_address = ContractAddress(patricia_key!(TEST_ACCOUNT_CONTRACT_ADDRESS)); - let block_context = &BlockContext::create_for_account_testing(); - let entry_point_selector = selector_from_name("deploy_contract"); - let salt = ContractAddressSalt::default(); - let class_hash = ClassHash(StarkFelt::new(class_hash.to_be_bytes()).unwrap()); - - let execute_calldata = create_execute_calldata( - &calldata, - &class_hash, - &account_address, - &entry_point_selector, - &salt, - ); + // Parse the selector. + let selector = &selector.value.to_bytes_be().1; + let selector = std::str::from_utf8(selector).map_err(|_| { + HintError::CustomHint(Box::from( + "Failed to parse the cheatcode selector".to_string(), + )) + })?; + + // Extract the inputs. + let input_start = extract_relocatable(vm, input_start)?; + let input_end = extract_relocatable(vm, input_end)?; + let inputs = read_data_from_range(vm, input_start, input_end) + .map_err(|_| HintError::CustomHint(Box::from("Failed to read input data".to_string())))?; + + match_cheatcode_by_selector( + vm, + blockifier_state, + selector, + inputs, + output_start, + output_end, + ) +} + +#[allow(unused, clippy::too_many_lines, clippy::trivially_copy_pass_by_ref)] +fn match_cheatcode_by_selector( + vm: &mut VirtualMachine, + blockifier_state: &mut CachedState, + selector: &str, + inputs: Vec, + output_start: &CellRef, + output_end: &CellRef, +) -> Result<(), HintError> { + let mut result_segment_ptr = vm.add_memory_segment(); + let result_start = result_segment_ptr; + + match selector { + "prepare" => todo!(), + "start_roll" => todo!(), + "stop_roll" => todo!(), + "start_warp" => todo!(), + "stop_warp" => todo!(), + "start_prank" => todo!(), + "stop_prank" => todo!(), + "mock_call" => todo!(), + "declare_cairo0" => todo!(), + "declare" => declare(vm, blockifier_state, &inputs, &mut result_segment_ptr), + "deploy" => deploy(vm, blockifier_state, &inputs, &mut result_segment_ptr), + "print" => print(inputs), + _ => Err(HintError::CustomHint(Box::from(format!( + "Unknown cheatcode selector: {selector}" + ))))?, + } + + let result_end = result_segment_ptr; + insert_value_to_cellref!(vm, output_start, result_start)?; + insert_value_to_cellref!(vm, output_end, result_end)?; + + Ok(()) +} - let nonce = blockifier_state - .get_nonce_at(account_address) - .expect("Failed to get nonce"); - let tx = invoke_tx(execute_calldata, account_address, Fee(MAX_FEE), None); - let account_tx = - AccountTransaction::Invoke(InvokeTransaction::V1(InvokeTransactionV1 { - nonce, - ..tx - })); - let tx_result = account_tx.execute(blockifier_state, block_context).unwrap(); - let return_data = tx_result - .execute_call_info - .expect("Failed to get execution data from method") - .execution - .retdata; - let contract_address = return_data - .0 - .get(0) - .expect("Failed to get contract_address from return_data"); - let contract_address = Felt252::from_bytes_be(contract_address.bytes()); - - insert_value_to_cellref!(vm, deployed_contract_address, contract_address)?; - // todo in case of error, consider filling the panic data instead of packing in rust - insert_value_to_cellref!(vm, panic_data_start, Felt252::from(0))?; - insert_value_to_cellref!(vm, panic_data_end, Felt252::from(0))?; - - Ok(()) +fn print(inputs: Vec) { + for value in inputs { + if let Some(short_string) = as_cairo_short_string(&value) { + println!("original value: [{value}], converted to a string: [{short_string}]",); + } else { + println!("original value: [{value}]"); } - &ProtostarHint::Prepare { .. } => todo!(), - &ProtostarHint::Call { .. } => todo!(), - ProtostarHint::Print { start, end } => { - let as_relocatable = |vm, value| { - let (base, offset) = extract_buffer(value); - get_ptr(vm, base, &offset) - }; - - let mut curr = as_relocatable(vm, start)?; - let end = as_relocatable(vm, end)?; - - while curr != end { - let value = vm.get_integer(curr)?; - if let Some(shortstring) = as_cairo_short_string(&value) { - println!("original value: [{value}], converted to a string: [{shortstring}]",); - } else { - println!("original value: [{value}]"); - } - curr += 1; + } +} + +fn declare( + vm: &mut VirtualMachine, + blockifier_state: &mut CachedState, + inputs: &[Felt252], + result_segment_ptr: &mut Relocatable, +) { + let contract_value = inputs[0].clone(); + + let contract_value_as_short_str = as_cairo_short_string(&contract_value) + .expect("Converting contract name to short string failed"); + let current_dir = std::env::current_dir() + .expect("Failed to get current directory") + .join("target/dev"); + + let mut paths = fs::read_dir(¤t_dir) + .expect("Failed to read ./target/dev, scarb build probably failed"); + + let starknet_artifacts_entry = &paths + .find_map(|path| match path { + Ok(path) => { + let name = path.file_name().into_string().ok()?; + name.contains("starknet_artifacts").then_some(path) } + Err(_) => None, + }) + .expect("Failed to find starknet_artifacts.json file"); + let starknet_artifacts = + fs::read_to_string(starknet_artifacts_entry.path()).unwrap_or_else(|_| { + panic!( + "Failed to read {:?} contents", + starknet_artifacts_entry.file_name() + ) + }); + let starknet_artifacts: ScarbStarknetArtifacts = + serde_json::from_str(starknet_artifacts.as_str()).unwrap_or_else(|_| { + panic!( + "Failed to parse {:?} contents", + starknet_artifacts_entry.file_name() + ) + }); + + let sierra_path = starknet_artifacts + .contracts + .iter() + .find_map(|contract| { + if contract.contract_name == contract_value_as_short_str { + return Some(contract.artifacts.sierra.clone()); + } + None + }) + .unwrap_or_else(|| { + panic!( + "Failed to find contract {contract_value_as_short_str} in starknet_artifacts.json" + ) + }); + let sierra_path = current_dir.join(sierra_path); + + let file = fs::File::open(&sierra_path) + .unwrap_or_else(|_| panic!("Failed to open file at path = {:?}", &sierra_path)); + let sierra_contract_class: ContractClass = serde_json::from_reader(&file) + .unwrap_or_else(|_| panic!("File to parse json from file = {file:?}")); + + let casm_contract_class = CasmContractClass::from_contract_class(sierra_contract_class, true) + .expect("sierra to casm failed"); + let casm_serialized = serde_json::to_string_pretty(&casm_contract_class) + .expect("Failed to serialize contract to casm"); + + let contract_class = ContractClassV1::try_from_json_string(&casm_serialized) + .expect("Failed to read contract class from json"); + let contract_class = BlockifierContractClass::V1(contract_class); + + // TODO(#2134) replace this. Hash should be calculated in the correct manner. This is just a workaround. + let mut hasher = DefaultHasher::new(); + casm_serialized.hash(&mut hasher); + let class_hash = hasher.finish(); + let class_hash = ClassHash(stark_felt!(class_hash)); + + let nonce = blockifier_state + .get_nonce_at(ContractAddress(patricia_key!( + TEST_ACCOUNT_CONTRACT_ADDRESS + ))) + .expect("Failed to get nonce"); + + let declare_tx = DeclareTransactionV0V1 { + nonce, + class_hash, + ..declare_tx_default() + }; + let tx = DeclareTransaction { + tx: starknet_api::transaction::DeclareTransaction::V1(declare_tx), + contract_class, + }; + let account_tx = AccountTransaction::Declare(tx); + let block_context = &BlockContext::create_for_account_testing(); + let _tx_result = account_tx + .execute(blockifier_state, block_context) + .expect("Failed to execute declare transaction"); + // result_segment. + let felt_class_hash = felt252_from_hex_string(&class_hash.to_string()).unwrap(); + + // TODO https://github.com/software-mansion/protostar/issues/2024 + // in case of errors above, consider not panicking, + // set an error and return it here instead + insert_at_pointer(vm, result_segment_ptr, Felt252::from(0)).unwrap(); + insert_at_pointer(vm, result_segment_ptr, felt_class_hash).unwrap(); +} - Ok(()) - } +fn deploy( + vm: &mut VirtualMachine, + blockifier_state: &mut CachedState, + inputs: &[Felt252], + result_segment_ptr: &mut Relocatable, +) { + let _contract_address = inputs[0].clone(); + // TODO(#1991) deploy should fail if contract address provided doesn't match calculated + // or not accept this address as argument at all. + let class_hash = inputs[1].clone(); + + let calldata_length = inputs[2].to_usize().unwrap(); + let mut calldata = vec![]; + for felt in inputs.iter().skip(3).take(calldata_length) { + calldata.push(felt.clone()); } + + // Deploy a contract using syscall deploy. + let account_address = ContractAddress(patricia_key!(TEST_ACCOUNT_CONTRACT_ADDRESS)); + let block_context = &BlockContext::create_for_account_testing(); + let entry_point_selector = selector_from_name("deploy_contract"); + let salt = ContractAddressSalt::default(); + let class_hash = ClassHash(StarkFelt::new(class_hash.to_be_bytes()).unwrap()); + + let execute_calldata = create_execute_calldata( + &calldata, + &class_hash, + &account_address, + &entry_point_selector, + &salt, + ); + + let nonce = blockifier_state + .get_nonce_at(account_address) + .expect("Failed to get nonce"); + let tx = invoke_tx(execute_calldata, account_address, Fee(MAX_FEE), None); + let account_tx = + AccountTransaction::Invoke(InvokeTransaction::V1(InvokeTransactionV1 { nonce, ..tx })); + let tx_result = account_tx.execute(blockifier_state, block_context).unwrap(); + let return_data = tx_result + .execute_call_info + .expect("Failed to get execution data from method") + .execution + .retdata; + let contract_address = return_data + .0 + .get(0) + .expect("Failed to get contract_address from return_data"); + let contract_address = Felt252::from_bytes_be(contract_address.bytes()); + + // TODO(#2152): in case of error, consider filling the panic data instead of packing in rust + insert_at_pointer(vm, result_segment_ptr, Felt252::from(0)).unwrap(); + insert_at_pointer(vm, result_segment_ptr, contract_address).unwrap(); +} + +// TODO(#2164): remove this when extract_relocatable is pub in cairo +fn extract_relocatable( + vm: &VirtualMachine, + buffer: &ResOperand, +) -> Result { + let (base, offset) = extract_buffer(buffer); + get_ptr(vm, base, &offset) } fn create_execute_calldata( @@ -486,9 +555,10 @@ fn felt252_from_hex_string(value: &str) -> Result { #[cfg(test)] mod test { - use super::*; use cairo_felt::Felt252; + use super::*; + #[test] fn felt_2525_from_prefixed_hex() { assert_eq!( diff --git a/protostar-rust/src/running.rs b/protostar-rust/src/running.rs index 30a11ab5b..64b0c48cf 100644 --- a/protostar-rust/src/running.rs +++ b/protostar-rust/src/running.rs @@ -27,7 +27,7 @@ fn build_hints_dict<'b>( if !instruction.hints.is_empty() { // Register hint with string for the hint processor. for hint in &instruction.hints { - string_to_hint.insert(hint.to_string(), hint.clone()); + string_to_hint.insert(format!("{hint:?}"), hint.clone()); } // Add hint, associated with the instruction offset. hints_dict.insert( diff --git a/protostar-rust/test-collector/Cargo.lock b/protostar-rust/test-collector/Cargo.lock index fc04b1007..10a22861c 100644 --- a/protostar-rust/test-collector/Cargo.lock +++ b/protostar-rust/test-collector/Cargo.lock @@ -484,9 +484,9 @@ dependencies = [ [[package]] name = "cairo-felt" -version = "0.5.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451a9144bbe8bf0b351672fa0bf34e6dcc8733e2ff3a3201c8f7480fe7eb68a6" +checksum = "edaee21a254b549dd00ecb5db15399c8d03b663ddb5a659f7c62ea7e16a3ed85" dependencies = [ "lazy_static", "num-bigint", @@ -511,9 +511,9 @@ dependencies = [ [[package]] name = "cairo-lang-casm" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", "indoc", "num-bigint", "num-traits 0.2.15", @@ -552,21 +552,21 @@ dependencies = [ [[package]] name = "cairo-lang-compiler" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "anyhow", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-lowering 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-plugins 2.0.0-rc2", - "cairo-lang-project 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-sierra-generator 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-lowering 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-plugins 2.0.0-rc5", + "cairo-lang-project 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-sierra-generator 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "log", "salsa", "smol_str", @@ -581,9 +581,9 @@ checksum = "65999f741e714e9b3605bae54fbf3816bcc085a68c365132dc944cf3b9603c82" [[package]] name = "cairo-lang-debug" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", ] [[package]] @@ -606,14 +606,14 @@ dependencies = [ [[package]] name = "cairo-lang-defs" -version = "2.0.0-rc2" -dependencies = [ - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", +version = "2.0.0-rc5" +dependencies = [ + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "indexmap", "itertools", "salsa", @@ -634,10 +634,10 @@ dependencies = [ [[package]] name = "cairo-lang-diagnostics" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "itertools", "salsa", ] @@ -656,9 +656,9 @@ dependencies = [ [[package]] name = "cairo-lang-eq-solver" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", "good_lp", "indexmap", "itertools", @@ -680,10 +680,10 @@ dependencies = [ [[package]] name = "cairo-lang-filesystem" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "path-clean", "salsa", "serde", @@ -717,17 +717,17 @@ dependencies = [ [[package]] name = "cairo-lang-lowering" -version = "2.0.0-rc2" -dependencies = [ - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-proc-macros 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", +version = "2.0.0-rc5" +dependencies = [ + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-proc-macros 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "id-arena", "indexmap", "itertools", @@ -761,13 +761,13 @@ dependencies = [ [[package]] name = "cairo-lang-parser" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-syntax-codegen 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-syntax-codegen 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "colored", "itertools", "log", @@ -799,15 +799,15 @@ dependencies = [ [[package]] name = "cairo-lang-plugins" -version = "2.0.0-rc2" -dependencies = [ - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", +version = "2.0.0-rc5" +dependencies = [ + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "indoc", "itertools", "num-bigint", @@ -828,9 +828,9 @@ dependencies = [ [[package]] name = "cairo-lang-proc-macros" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-debug 2.0.0-rc2", + "cairo-lang-debug 2.0.0-rc5", "quote", "syn 1.0.109", ] @@ -850,10 +850,10 @@ dependencies = [ [[package]] name = "cairo-lang-project" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "serde", "smol_str", "thiserror", @@ -897,7 +897,7 @@ dependencies = [ [[package]] name = "cairo-lang-runner" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "anyhow", "ark-ff 0.4.2", @@ -905,23 +905,23 @@ dependencies = [ "ark-secp256r1", "ark-std 0.3.0", "blockifier", - "cairo-felt 0.5.2", - "cairo-lang-casm 2.0.0-rc2", - "cairo-lang-compiler 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-lowering 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-sierra-ap-change 2.0.0-rc2", - "cairo-lang-sierra-gas 2.0.0-rc2", - "cairo-lang-sierra-generator 2.0.0-rc2", - "cairo-lang-sierra-to-casm 2.0.0-rc2", + "cairo-felt 0.6.1", + "cairo-lang-casm 2.0.0-rc5", + "cairo-lang-compiler 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-lowering 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-sierra-ap-change 2.0.0-rc5", + "cairo-lang-sierra-gas 2.0.0-rc5", + "cairo-lang-sierra-generator 2.0.0-rc5", + "cairo-lang-sierra-to-casm 2.0.0-rc5", "cairo-lang-sierra-type-size", - "cairo-lang-starknet 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", - "cairo-vm 0.5.2", + "cairo-lang-starknet 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", + "cairo-vm 0.6.1", "itertools", "keccak", "num-bigint", @@ -930,7 +930,6 @@ dependencies = [ "salsa", "serde_json", "smol_str", - "snapbox", "starknet_api", "thiserror", ] @@ -960,16 +959,16 @@ dependencies = [ [[package]] name = "cairo-lang-semantic" -version = "2.0.0-rc2" -dependencies = [ - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-proc-macros 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", +version = "2.0.0-rc5" +dependencies = [ + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-proc-macros 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "id-arena", "itertools", "log", @@ -1004,9 +1003,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", "const-fnv1a-hash", "convert_case 0.6.0", "derivative", @@ -1038,12 +1037,12 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-ap-change" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-eq-solver 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", + "cairo-lang-eq-solver 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", "cairo-lang-sierra-type-size", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", "itertools", "thiserror", ] @@ -1063,12 +1062,12 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-gas" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-eq-solver 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", + "cairo-lang-eq-solver 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", "cairo-lang-sierra-type-size", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", "itertools", "thiserror", ] @@ -1101,20 +1100,20 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-generator" -version = "2.0.0-rc2" -dependencies = [ - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-lowering 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-plugins 2.0.0-rc2", - "cairo-lang-proc-macros 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", +version = "2.0.0-rc5" +dependencies = [ + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-lowering 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-plugins 2.0.0-rc5", + "cairo-lang-proc-macros 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "id-arena", "indexmap", "itertools", @@ -1148,16 +1147,16 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-to-casm" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "assert_matches", - "cairo-felt 0.5.2", - "cairo-lang-casm 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-sierra-ap-change 2.0.0-rc2", - "cairo-lang-sierra-gas 2.0.0-rc2", + "cairo-felt 0.6.1", + "cairo-lang-casm 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-sierra-ap-change 2.0.0-rc5", + "cairo-lang-sierra-gas 2.0.0-rc5", "cairo-lang-sierra-type-size", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-utils 2.0.0-rc5", "indoc", "itertools", "log", @@ -1168,10 +1167,10 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-type-size" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", ] [[package]] @@ -1217,26 +1216,26 @@ dependencies = [ [[package]] name = "cairo-lang-starknet" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "anyhow", - "cairo-felt 0.5.2", - "cairo-lang-casm 2.0.0-rc2", - "cairo-lang-compiler 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-lowering 2.0.0-rc2", - "cairo-lang-parser 2.0.0-rc2", - "cairo-lang-plugins 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-sierra-ap-change 2.0.0-rc2", - "cairo-lang-sierra-gas 2.0.0-rc2", - "cairo-lang-sierra-generator 2.0.0-rc2", - "cairo-lang-sierra-to-casm 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-felt 0.6.1", + "cairo-lang-casm 2.0.0-rc5", + "cairo-lang-compiler 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-lowering 2.0.0-rc5", + "cairo-lang-parser 2.0.0-rc5", + "cairo-lang-plugins 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-sierra-ap-change 2.0.0-rc5", + "cairo-lang-sierra-gas 2.0.0-rc5", + "cairo-lang-sierra-generator 2.0.0-rc5", + "cairo-lang-sierra-to-casm 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "convert_case 0.6.0", "genco", "indoc", @@ -1272,11 +1271,11 @@ dependencies = [ [[package]] name = "cairo-lang-syntax" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", "num-bigint", "num-traits 0.2.15", "salsa", @@ -1299,7 +1298,7 @@ dependencies = [ [[package]] name = "cairo-lang-syntax-codegen" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "genco", "xshell", @@ -1307,28 +1306,28 @@ dependencies = [ [[package]] name = "cairo-lang-test-runner" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "anyhow", - "cairo-felt 0.5.2", - "cairo-lang-casm 2.0.0-rc2", - "cairo-lang-compiler 2.0.0-rc2", - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-lowering 2.0.0-rc2", - "cairo-lang-plugins 2.0.0-rc2", - "cairo-lang-project 2.0.0-rc2", - "cairo-lang-runner 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-sierra-generator 2.0.0-rc2", - "cairo-lang-sierra-to-casm 2.0.0-rc2", - "cairo-lang-starknet 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", - "cairo-lang-utils 2.0.0-rc2", - "cairo-vm 0.5.2", + "cairo-felt 0.6.1", + "cairo-lang-casm 2.0.0-rc5", + "cairo-lang-compiler 2.0.0-rc5", + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-lowering 2.0.0-rc5", + "cairo-lang-plugins 2.0.0-rc5", + "cairo-lang-project 2.0.0-rc5", + "cairo-lang-runner 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-sierra-generator 2.0.0-rc5", + "cairo-lang-sierra-to-casm 2.0.0-rc5", + "cairo-lang-starknet 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", + "cairo-lang-utils 2.0.0-rc5", + "cairo-vm 0.6.1", "colored", "itertools", "num-bigint", @@ -1357,7 +1356,7 @@ dependencies = [ [[package]] name = "cairo-lang-utils" -version = "2.0.0-rc2" +version = "2.0.0-rc5" dependencies = [ "indexmap", "itertools", @@ -1380,9 +1379,9 @@ dependencies = [ [[package]] name = "cairo-take_until_unbalanced" -version = "0.28.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec66f846411e5fdecd2527d429135fd39ca98ef46b0df3f1558cc272b596a30" +checksum = "32c366b2a52b63db19fcc20a761ea37aa9f5fdce1723016c458e3990ef4fdf2c" dependencies = [ "nom", ] @@ -1421,15 +1420,15 @@ dependencies = [ [[package]] name = "cairo-vm" -version = "0.5.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c73ed69023e595a18799552803550fe0a3af83713f1fc97f9edaaa677f59a8" +checksum = "8be504f2684bab154d3bd45257c847db6fb450333305f162600dc497687d87d2" dependencies = [ "anyhow", "bincode", "bitvec 1.0.1", - "cairo-felt 0.5.2", - "cairo-take_until_unbalanced 0.28.0", + "cairo-felt 0.6.1", + "cairo-take_until_unbalanced 0.30.0", "generic-array", "hashbrown 0.13.2", "hex", @@ -2657,12 +2656,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "normalize-line-endings" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" - [[package]] name = "num-bigint" version = "0.4.3" @@ -3640,12 +3633,6 @@ dependencies = [ "libc", ] -[[package]] -name = "similar" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" - [[package]] name = "siphasher" version = "0.3.10" @@ -3676,28 +3663,6 @@ dependencies = [ "serde", ] -[[package]] -name = "snapbox" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6bccd62078347f89a914e3004d94582e13824d4e3d8a816317862884c423835" -dependencies = [ - "anstream", - "anstyle", - "normalize-line-endings", - "similar", - "snapbox-macros", -] - -[[package]] -name = "snapbox-macros" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaaf09df9f0eeae82be96290918520214530e738a7fe5a351b0f24cf77c0ca31" -dependencies = [ - "anstream", -] - [[package]] name = "socket2" version = "0.4.9" @@ -4012,29 +3977,29 @@ name = "test-collector" version = "1.0.0" dependencies = [ "anyhow", - "cairo-felt 0.5.2", - "cairo-lang-casm 2.0.0-rc2", - "cairo-lang-compiler 2.0.0-rc2", - "cairo-lang-debug 2.0.0-rc2", - "cairo-lang-defs 2.0.0-rc2", - "cairo-lang-diagnostics 2.0.0-rc2", - "cairo-lang-filesystem 2.0.0-rc2", - "cairo-lang-lowering 2.0.0-rc2", - "cairo-lang-plugins 2.0.0-rc2", - "cairo-lang-project 2.0.0-rc2", - "cairo-lang-runner 2.0.0-rc2", - "cairo-lang-semantic 2.0.0-rc2", - "cairo-lang-sierra 2.0.0-rc2", - "cairo-lang-sierra-ap-change 2.0.0-rc2", - "cairo-lang-sierra-gas 2.0.0-rc2", - "cairo-lang-sierra-generator 2.0.0-rc2", - "cairo-lang-sierra-to-casm 2.0.0-rc2", + "cairo-felt 0.6.1", + "cairo-lang-casm 2.0.0-rc5", + "cairo-lang-compiler 2.0.0-rc5", + "cairo-lang-debug 2.0.0-rc5", + "cairo-lang-defs 2.0.0-rc5", + "cairo-lang-diagnostics 2.0.0-rc5", + "cairo-lang-filesystem 2.0.0-rc5", + "cairo-lang-lowering 2.0.0-rc5", + "cairo-lang-plugins 2.0.0-rc5", + "cairo-lang-project 2.0.0-rc5", + "cairo-lang-runner 2.0.0-rc5", + "cairo-lang-semantic 2.0.0-rc5", + "cairo-lang-sierra 2.0.0-rc5", + "cairo-lang-sierra-ap-change 2.0.0-rc5", + "cairo-lang-sierra-gas 2.0.0-rc5", + "cairo-lang-sierra-generator 2.0.0-rc5", + "cairo-lang-sierra-to-casm 2.0.0-rc5", "cairo-lang-sierra-type-size", - "cairo-lang-starknet 2.0.0-rc2", - "cairo-lang-syntax 2.0.0-rc2", + "cairo-lang-starknet 2.0.0-rc5", + "cairo-lang-syntax 2.0.0-rc5", "cairo-lang-test-runner", - "cairo-lang-utils 2.0.0-rc2", - "cairo-vm 0.5.2", + "cairo-lang-utils 2.0.0-rc5", + "cairo-vm 0.6.1", "itertools", "num-bigint", "num-integer", diff --git a/protostar-rust/test-collector/Cargo.toml b/protostar-rust/test-collector/Cargo.toml index 210d7c874..73f3a5f75 100644 --- a/protostar-rust/test-collector/Cargo.toml +++ b/protostar-rust/test-collector/Cargo.toml @@ -7,33 +7,33 @@ edition = "2021" testing = [] [dependencies] -cairo-lang-casm = { path = "../../cairo/crates/cairo-lang-casm", version = "2.0.0-rc2" } -cairo-lang-compiler = { path = "../../cairo/crates/cairo-lang-compiler", version = "2.0.0-rc2" } -cairo-lang-debug = { path = "../../cairo/crates/cairo-lang-debug", version = "2.0.0-rc2" } -cairo-lang-defs = { path = "../../cairo/crates/cairo-lang-defs", version = "2.0.0-rc2" } -cairo-lang-diagnostics = { path = "../../cairo/crates/cairo-lang-diagnostics", version = "2.0.0-rc2" } -cairo-lang-filesystem = { path = "../../cairo/crates/cairo-lang-filesystem", version = "2.0.0-rc2" } -cairo-lang-lowering = { path = "../../cairo/crates/cairo-lang-lowering", version = "2.0.0-rc2" } -cairo-lang-test-runner = { path = "../../cairo/crates/cairo-lang-test-runner", version = "2.0.0-rc2" } -cairo-lang-plugins = { path = "../../cairo/crates/cairo-lang-plugins", version = "2.0.0-rc2" } -cairo-lang-project = { path = "../../cairo/crates/cairo-lang-project", version = "2.0.0-rc2" } -cairo-lang-sierra-ap-change = { path = "../../cairo/crates/cairo-lang-sierra-ap-change", version = "2.0.0-rc2" } -cairo-lang-sierra-gas = { path = "../../cairo/crates/cairo-lang-sierra-gas", version = "2.0.0-rc2" } -cairo-lang-runner = { path = "../../cairo/crates/cairo-lang-runner", version = "2.0.0-rc2" } -cairo-lang-semantic = { path = "../../cairo/crates/cairo-lang-semantic", version = "2.0.0-rc2" } -cairo-lang-sierra = { path = "../../cairo/crates/cairo-lang-sierra", version = "2.0.0-rc2" } -cairo-lang-sierra-generator = { path = "../../cairo/crates/cairo-lang-sierra-generator", version = "2.0.0-rc2" } -cairo-lang-sierra-to-casm = { path = "../../cairo/crates/cairo-lang-sierra-to-casm", version = "2.0.0-rc2" } -cairo-lang-starknet = { path = "../../cairo/crates/cairo-lang-starknet", version = "2.0.0-rc2" } -cairo-lang-syntax = { path = "../../cairo/crates/cairo-lang-syntax", version = "2.0.0-rc2" } -cairo-lang-utils = { path = "../../cairo/crates/cairo-lang-utils", version = "2.0.0-rc2" } -cairo-lang-sierra-type-size = { path = "../../cairo/crates/cairo-lang-sierra-type-size", version = "2.0.0-rc2" } +cairo-lang-casm = { path = "../../cairo/crates/cairo-lang-casm", version = "2.0.0-rc5" } +cairo-lang-compiler = { path = "../../cairo/crates/cairo-lang-compiler", version = "2.0.0-rc5" } +cairo-lang-debug = { path = "../../cairo/crates/cairo-lang-debug", version = "2.0.0-rc5" } +cairo-lang-defs = { path = "../../cairo/crates/cairo-lang-defs", version = "2.0.0-rc5" } +cairo-lang-diagnostics = { path = "../../cairo/crates/cairo-lang-diagnostics", version = "2.0.0-rc5" } +cairo-lang-filesystem = { path = "../../cairo/crates/cairo-lang-filesystem", version = "2.0.0-rc5" } +cairo-lang-lowering = { path = "../../cairo/crates/cairo-lang-lowering", version = "2.0.0-rc5" } +cairo-lang-test-runner = { path = "../../cairo/crates/cairo-lang-test-runner", version = "2.0.0-rc5" } +cairo-lang-plugins = { path = "../../cairo/crates/cairo-lang-plugins", version = "2.0.0-rc5" } +cairo-lang-project = { path = "../../cairo/crates/cairo-lang-project", version = "2.0.0-rc5" } +cairo-lang-sierra-ap-change = { path = "../../cairo/crates/cairo-lang-sierra-ap-change", version = "2.0.0-rc5" } +cairo-lang-sierra-gas = { path = "../../cairo/crates/cairo-lang-sierra-gas", version = "2.0.0-rc5" } +cairo-lang-runner = { path = "../../cairo/crates/cairo-lang-runner", version = "2.0.0-rc5" } +cairo-lang-semantic = { path = "../../cairo/crates/cairo-lang-semantic", version = "2.0.0-rc5" } +cairo-lang-sierra = { path = "../../cairo/crates/cairo-lang-sierra", version = "2.0.0-rc5" } +cairo-lang-sierra-generator = { path = "../../cairo/crates/cairo-lang-sierra-generator", version = "2.0.0-rc5" } +cairo-lang-sierra-to-casm = { path = "../../cairo/crates/cairo-lang-sierra-to-casm", version = "2.0.0-rc5" } +cairo-lang-starknet = { path = "../../cairo/crates/cairo-lang-starknet", version = "2.0.0-rc5" } +cairo-lang-syntax = { path = "../../cairo/crates/cairo-lang-syntax", version = "2.0.0-rc5" } +cairo-lang-utils = { path = "../../cairo/crates/cairo-lang-utils", version = "2.0.0-rc5" } +cairo-lang-sierra-type-size = { path = "../../cairo/crates/cairo-lang-sierra-type-size", version = "2.0.0-rc5" } anyhow = "1.0.66" smol_str = { version = "0.2.0", features = ["serde"] } itertools = "0.10.3" -cairo-vm = "0.5.2" -cairo-felt = "0.5.2" +cairo-vm = "0.6" +cairo-felt = "0.6" num-bigint = "0.4" num-integer = "0.1" num-traits = "0.2" diff --git a/protostar-rust/tests/data/declare_test/src/lib.cairo b/protostar-rust/tests/data/declare_test/src/lib.cairo index 3ca8bb2f5..0c0b582f0 100644 --- a/protostar-rust/tests/data/declare_test/src/lib.cairo +++ b/protostar-rust/tests/data/declare_test/src/lib.cairo @@ -1,5 +1,11 @@ mod contract1; +#[starknet::interface] +trait IHelloStarknet { + fn increase_balance(ref self: TContractState, amount: felt252); + fn decrease_balance(ref self: TContractState, amount: felt252); +} + #[starknet::contract] mod HelloStarknet { #[storage] @@ -7,15 +13,16 @@ mod HelloStarknet { balance: felt252, } - // Increases the balance by the given amount. - #[external] - fn increase_balance(ref self: ContractState, amount: felt252) { - self.balance.write(self.balance.read() + amount); - } + #[external(v0)] + impl HelloStarknetImpl of super::IHelloStarknet { + // Increases the balance by the given amount. + fn increase_balance(ref self: ContractState, amount: felt252) { + self.balance.write(self.balance.read() + amount); + } - // Decreases the balance by the given amount. - #[external] - fn decrease_balance(ref self: ContractState, amount: felt252) { - self.balance.write(self.balance.read() - amount); + // Decreases the balance by the given amount. + fn decrease_balance(ref self: ContractState, amount: felt252) { + self.balance.write(self.balance.read() - amount); + } } } diff --git a/protostar-rust/tests/data/dispatchers/src/hello_starknet.cairo b/protostar-rust/tests/data/dispatchers/src/hello_starknet.cairo index 50cb7d25f..0dfd8d943 100644 --- a/protostar-rust/tests/data/dispatchers/src/hello_starknet.cairo +++ b/protostar-rust/tests/data/dispatchers/src/hello_starknet.cairo @@ -23,14 +23,4 @@ mod HelloStarknet { self.balance.read() } } - - #[external(v0)] - fn __validate_deploy__( - self: @ContractState, - class_hash: felt252, - contract_address_salt: felt252, - public_key_: felt252 - ) -> felt252 { - starknet::VALIDATED - } }