diff --git a/Cargo.lock b/Cargo.lock index a22ace0299..ff4153e3dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -112,6 +112,23 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "itertools", + "num-traits 0.2.15", + "zeroize", +] + [[package]] name = "ark-ff" version = "0.3.0" @@ -195,6 +212,30 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-secp256k1" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c02e954eaeb4ddb29613fee20840c2bbc85ca4396d53e33837e11905363c5f2" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + [[package]] name = "ark-serialize" version = "0.3.0" @@ -211,11 +252,23 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" dependencies = [ + "ark-serialize-derive", "ark-std 0.4.0", "digest 0.10.6", "num-bigint", ] +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "ark-std" version = "0.3.0" @@ -299,9 +352,8 @@ dependencies = [ [[package]] name = "bincode" -version = "2.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f11ea1a0346b94ef188834a65c068a03aec181c94896d481d7a0a40d85b0ce95" +version = "2.0.0-rc.2" +source = "git+https://github.com/bincode-org/bincode.git?tag=v2.0.0-rc.2#6c219e9214bda2bdce1327db6ed7f66d2fa4bf02" dependencies = [ "serde", ] @@ -400,10 +452,10 @@ name = "blockifier" version = "0.1.0" dependencies = [ "assert_matches", - "cairo-felt", - "cairo-lang-casm", + "cairo-felt 0.4.0", + "cairo-lang-casm 1.1.0-rc0", "cairo-lang-runner", - "cairo-lang-starknet", + "cairo-lang-starknet 1.1.0-rc0", "cairo-vm", "ctor 0.2.0", "derive_more", @@ -463,13 +515,38 @@ dependencies = [ "serde", ] +[[package]] +name = "cairo-felt" +version = "0.4.0" +source = "git+https://github.com/lambdaclass/cairo-rs?rev=5db2e65#5db2e656d46a97d89563a74f8fc3abd595e8befb" +dependencies = [ + "lazy_static", + "num-bigint", + "num-integer", + "num-traits 0.2.15", + "serde", +] + [[package]] name = "cairo-lang-casm" version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dba9ce4e6940ef254288d052c6e6f243ba98420e8be0966dd3d196a776ff7d2" dependencies = [ - "cairo-lang-utils", + "cairo-lang-utils 1.1.0-alpha0", + "indoc 2.0.1", + "num-bigint", + "num-traits 0.2.15", + "serde", + "thiserror", +] + +[[package]] +name = "cairo-lang-casm" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-utils 1.1.0-rc0", "indoc 2.0.1", "num-bigint", "num-traits 0.2.15", @@ -484,18 +561,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41751d2cb086235cabef8d0f86d081593c8273068a96de20eb2ce0337ba100f2" dependencies = [ "anyhow", - "cairo-lang-defs", - "cairo-lang-diagnostics", - "cairo-lang-filesystem", - "cairo-lang-lowering", - "cairo-lang-parser", - "cairo-lang-plugins", - "cairo-lang-project", - "cairo-lang-semantic", - "cairo-lang-sierra", - "cairo-lang-sierra-generator", - "cairo-lang-syntax", - "cairo-lang-utils", + "cairo-lang-defs 1.1.0-alpha0", + "cairo-lang-diagnostics 1.1.0-alpha0", + "cairo-lang-filesystem 1.1.0-alpha0", + "cairo-lang-lowering 1.1.0-alpha0", + "cairo-lang-parser 1.1.0-alpha0", + "cairo-lang-plugins 1.1.0-alpha0", + "cairo-lang-project 1.1.0-alpha0", + "cairo-lang-semantic 1.1.0-alpha0", + "cairo-lang-sierra 1.1.0-alpha0", + "cairo-lang-sierra-generator 1.1.0-alpha0", + "cairo-lang-syntax 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "clap", + "log", + "salsa", + "smol_str", + "thiserror", +] + +[[package]] +name = "cairo-lang-compiler" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "anyhow", + "cairo-lang-defs 1.1.0-rc0", + "cairo-lang-diagnostics 1.1.0-rc0", + "cairo-lang-filesystem 1.1.0-rc0", + "cairo-lang-lowering 1.1.0-rc0", + "cairo-lang-parser 1.1.0-rc0", + "cairo-lang-plugins 1.1.0-rc0", + "cairo-lang-project 1.1.0-rc0", + "cairo-lang-semantic 1.1.0-rc0", + "cairo-lang-sierra 1.1.0-rc0", + "cairo-lang-sierra-generator 1.1.0-rc0", + "cairo-lang-syntax 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "clap", "log", "salsa", @@ -509,18 +611,43 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf6d2838bf3677a0f6b3812ee404af1dc8b8192e99490c79da02be70788141af" +[[package]] +name = "cairo-lang-debug" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-utils 1.1.0-rc0", +] + [[package]] name = "cairo-lang-defs" version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d7cf2fa4b6a7511e759c8347af489c1901f1721f9c86c8fdeac8a03ce988fa" dependencies = [ - "cairo-lang-debug", - "cairo-lang-diagnostics", - "cairo-lang-filesystem", - "cairo-lang-parser", - "cairo-lang-syntax", - "cairo-lang-utils", + "cairo-lang-debug 1.1.0-alpha0", + "cairo-lang-diagnostics 1.1.0-alpha0", + "cairo-lang-filesystem 1.1.0-alpha0", + "cairo-lang-parser 1.1.0-alpha0", + "cairo-lang-syntax 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "indexmap", + "itertools", + "salsa", + "smol_str", +] + +[[package]] +name = "cairo-lang-defs" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-debug 1.1.0-rc0", + "cairo-lang-diagnostics 1.1.0-rc0", + "cairo-lang-filesystem 1.1.0-rc0", + "cairo-lang-parser 1.1.0-rc0", + "cairo-lang-syntax 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "indexmap", "itertools", "salsa", @@ -533,8 +660,19 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "894d6a7d5f295f086188ee76651c514ab6a49bf1591234322124d8bc7d9b2fbd" dependencies = [ - "cairo-lang-filesystem", - "cairo-lang-utils", + "cairo-lang-filesystem 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "itertools", + "salsa", +] + +[[package]] +name = "cairo-lang-diagnostics" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-filesystem 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "itertools", "salsa", ] @@ -545,7 +683,18 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8842e8cf4dc7ac567cbdf6735258abd79b22c3d2ee982fc81622ce9caecd545" dependencies = [ - "cairo-lang-utils", + "cairo-lang-utils 1.1.0-alpha0", + "good_lp", + "indexmap", + "itertools", +] + +[[package]] +name = "cairo-lang-eq-solver" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-utils 1.1.0-rc0", "good_lp", "indexmap", "itertools", @@ -557,8 +706,21 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7d29b7dc5137e13ca6c8cccbb29f8221519d030322bce6bd8b822451706cb11" dependencies = [ - "cairo-lang-debug", - "cairo-lang-utils", + "cairo-lang-debug 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "path-clean", + "salsa", + "serde", + "smol_str", +] + +[[package]] +name = "cairo-lang-filesystem" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-debug 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "path-clean", "salsa", "serde", @@ -571,15 +733,39 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c081e6ebe47252b64ae0535d425852a3afc6dbc6543aeb44f621b555294afa0e" dependencies = [ - "cairo-lang-debug", - "cairo-lang-defs", - "cairo-lang-diagnostics", - "cairo-lang-filesystem", - "cairo-lang-parser", - "cairo-lang-proc-macros", - "cairo-lang-semantic", - "cairo-lang-syntax", - "cairo-lang-utils", + "cairo-lang-debug 1.1.0-alpha0", + "cairo-lang-defs 1.1.0-alpha0", + "cairo-lang-diagnostics 1.1.0-alpha0", + "cairo-lang-filesystem 1.1.0-alpha0", + "cairo-lang-parser 1.1.0-alpha0", + "cairo-lang-proc-macros 1.1.0-alpha0", + "cairo-lang-semantic 1.1.0-alpha0", + "cairo-lang-syntax 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "id-arena", + "indexmap", + "itertools", + "log", + "num-bigint", + "num-traits 0.2.15", + "salsa", + "smol_str", +] + +[[package]] +name = "cairo-lang-lowering" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-debug 1.1.0-rc0", + "cairo-lang-defs 1.1.0-rc0", + "cairo-lang-diagnostics 1.1.0-rc0", + "cairo-lang-filesystem 1.1.0-rc0", + "cairo-lang-parser 1.1.0-rc0", + "cairo-lang-proc-macros 1.1.0-rc0", + "cairo-lang-semantic 1.1.0-rc0", + "cairo-lang-syntax 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "id-arena", "indexmap", "itertools", @@ -596,11 +782,31 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45a30c90cbc71d242d4cd7feb00ead774c0f1882e47a0ce406f14d31a41c5bba" dependencies = [ - "cairo-lang-diagnostics", - "cairo-lang-filesystem", - "cairo-lang-syntax", - "cairo-lang-syntax-codegen", - "cairo-lang-utils", + "cairo-lang-diagnostics 1.1.0-alpha0", + "cairo-lang-filesystem 1.1.0-alpha0", + "cairo-lang-syntax 1.1.0-alpha0", + "cairo-lang-syntax-codegen 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "colored", + "itertools", + "log", + "num-bigint", + "num-traits 0.2.15", + "salsa", + "smol_str", + "unescaper", +] + +[[package]] +name = "cairo-lang-parser" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-diagnostics 1.1.0-rc0", + "cairo-lang-filesystem 1.1.0-rc0", + "cairo-lang-syntax 1.1.0-rc0", + "cairo-lang-syntax-codegen 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "colored", "itertools", "log", @@ -617,13 +823,31 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e36a6e568569a3a4b660483fe05ba883976a07f114aa040a174616b1dad249e" dependencies = [ - "cairo-lang-defs", - "cairo-lang-diagnostics", - "cairo-lang-filesystem", - "cairo-lang-parser", - "cairo-lang-semantic", - "cairo-lang-syntax", - "cairo-lang-utils", + "cairo-lang-defs 1.1.0-alpha0", + "cairo-lang-diagnostics 1.1.0-alpha0", + "cairo-lang-filesystem 1.1.0-alpha0", + "cairo-lang-parser 1.1.0-alpha0", + "cairo-lang-semantic 1.1.0-alpha0", + "cairo-lang-syntax 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "indoc 2.0.1", + "itertools", + "salsa", + "smol_str", +] + +[[package]] +name = "cairo-lang-plugins" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-defs 1.1.0-rc0", + "cairo-lang-diagnostics 1.1.0-rc0", + "cairo-lang-filesystem 1.1.0-rc0", + "cairo-lang-parser 1.1.0-rc0", + "cairo-lang-semantic 1.1.0-rc0", + "cairo-lang-syntax 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "indoc 2.0.1", "itertools", "salsa", @@ -636,7 +860,17 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b4e305f43e2d38582e38aecd835288837085880b122ce828612b2707620f8b1" dependencies = [ - "cairo-lang-debug", + "cairo-lang-debug 1.1.0-alpha0", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "cairo-lang-proc-macros" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-debug 1.1.0-rc0", "quote", "syn 1.0.109", ] @@ -647,7 +881,20 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5e6527d83a6ab03b2c99ee670a26aefe8b001730565b9eb85a8014e349af02a" dependencies = [ - "cairo-lang-filesystem", + "cairo-lang-filesystem 1.1.0-alpha0", + "serde", + "smol_str", + "thiserror", + "toml", +] + +[[package]] +name = "cairo-lang-project" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-filesystem 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "serde", "smol_str", "thiserror", @@ -656,28 +903,28 @@ dependencies = [ [[package]] name = "cairo-lang-runner" -version = "1.1.0-alpha0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469b8259831b9c3b8d83490c9e54b2ec8c71cbb93d99c13537ad8db93a0400b5" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" dependencies = [ "anyhow", "ark-ff 0.4.2", + "ark-secp256k1", "ark-std 0.3.0", - "cairo-felt", - "cairo-lang-casm", - "cairo-lang-compiler", - "cairo-lang-defs", - "cairo-lang-diagnostics", - "cairo-lang-filesystem", - "cairo-lang-lowering", - "cairo-lang-semantic", - "cairo-lang-sierra", - "cairo-lang-sierra-ap-change", - "cairo-lang-sierra-gas", - "cairo-lang-sierra-generator", - "cairo-lang-sierra-to-casm", - "cairo-lang-starknet", - "cairo-lang-utils", + "cairo-felt 0.4.0", + "cairo-lang-casm 1.1.0-rc0", + "cairo-lang-compiler 1.1.0-rc0", + "cairo-lang-defs 1.1.0-rc0", + "cairo-lang-diagnostics 1.1.0-rc0", + "cairo-lang-filesystem 1.1.0-rc0", + "cairo-lang-lowering 1.1.0-rc0", + "cairo-lang-semantic 1.1.0-rc0", + "cairo-lang-sierra 1.1.0-rc0", + "cairo-lang-sierra-ap-change 1.1.0-rc0", + "cairo-lang-sierra-gas 1.1.0-rc0", + "cairo-lang-sierra-generator 1.1.0-rc0", + "cairo-lang-sierra-to-casm 1.1.0-rc0", + "cairo-lang-starknet 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "cairo-vm", "clap", "itertools", @@ -695,14 +942,36 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b037222c1255fe46eb131f366bed0a938f3c1799185b4c0ae6fef511af828e47" dependencies = [ - "cairo-lang-debug", - "cairo-lang-defs", - "cairo-lang-diagnostics", - "cairo-lang-filesystem", - "cairo-lang-parser", - "cairo-lang-proc-macros", - "cairo-lang-syntax", - "cairo-lang-utils", + "cairo-lang-debug 1.1.0-alpha0", + "cairo-lang-defs 1.1.0-alpha0", + "cairo-lang-diagnostics 1.1.0-alpha0", + "cairo-lang-filesystem 1.1.0-alpha0", + "cairo-lang-parser 1.1.0-alpha0", + "cairo-lang-proc-macros 1.1.0-alpha0", + "cairo-lang-syntax 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "id-arena", + "itertools", + "log", + "num-bigint", + "num-traits 0.2.15", + "salsa", + "smol_str", +] + +[[package]] +name = "cairo-lang-semantic" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-debug 1.1.0-rc0", + "cairo-lang-defs 1.1.0-rc0", + "cairo-lang-diagnostics 1.1.0-rc0", + "cairo-lang-filesystem 1.1.0-rc0", + "cairo-lang-parser 1.1.0-rc0", + "cairo-lang-proc-macros 1.1.0-rc0", + "cairo-lang-syntax 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "id-arena", "itertools", "log", @@ -718,7 +987,29 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48cd48496882a43476e455ef37c68e19a05111f88c9368dd2b457a5e35511e1" dependencies = [ - "cairo-lang-utils", + "cairo-lang-utils 1.1.0-alpha0", + "const-fnv1a-hash", + "convert_case 0.6.0", + "derivative", + "itertools", + "lalrpop", + "lalrpop-util", + "num-bigint", + "num-traits 0.2.15", + "regex", + "salsa", + "serde", + "sha3 0.10.7", + "smol_str", + "thiserror", +] + +[[package]] +name = "cairo-lang-sierra" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-utils 1.1.0-rc0", "const-fnv1a-hash", "convert_case 0.6.0", "derivative", @@ -741,9 +1032,21 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdcf40a4041d9819746c5244d42b32ad556247132f6957c008fed86595508090" dependencies = [ - "cairo-lang-eq-solver", - "cairo-lang-sierra", - "cairo-lang-utils", + "cairo-lang-eq-solver 1.1.0-alpha0", + "cairo-lang-sierra 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "itertools", + "thiserror", +] + +[[package]] +name = "cairo-lang-sierra-ap-change" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-eq-solver 1.1.0-rc0", + "cairo-lang-sierra 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "itertools", "thiserror", ] @@ -754,9 +1057,21 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7c31b8a07db1958903a27f872b39ec58e40b6b5e5d820b88d373da27868bc8f" dependencies = [ - "cairo-lang-eq-solver", - "cairo-lang-sierra", - "cairo-lang-utils", + "cairo-lang-eq-solver 1.1.0-alpha0", + "cairo-lang-sierra 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "itertools", + "thiserror", +] + +[[package]] +name = "cairo-lang-sierra-gas" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-eq-solver 1.1.0-rc0", + "cairo-lang-sierra 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "itertools", "thiserror", ] @@ -767,18 +1082,43 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "031232b0b6d4eb01d8b2dc641c96634ac8fade04e0da7129fa867c4c8932483e" dependencies = [ - "cairo-lang-debug", - "cairo-lang-defs", - "cairo-lang-diagnostics", - "cairo-lang-filesystem", - "cairo-lang-lowering", - "cairo-lang-parser", - "cairo-lang-plugins", - "cairo-lang-proc-macros", - "cairo-lang-semantic", - "cairo-lang-sierra", - "cairo-lang-syntax", - "cairo-lang-utils", + "cairo-lang-debug 1.1.0-alpha0", + "cairo-lang-defs 1.1.0-alpha0", + "cairo-lang-diagnostics 1.1.0-alpha0", + "cairo-lang-filesystem 1.1.0-alpha0", + "cairo-lang-lowering 1.1.0-alpha0", + "cairo-lang-parser 1.1.0-alpha0", + "cairo-lang-plugins 1.1.0-alpha0", + "cairo-lang-proc-macros 1.1.0-alpha0", + "cairo-lang-semantic 1.1.0-alpha0", + "cairo-lang-sierra 1.1.0-alpha0", + "cairo-lang-syntax 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "id-arena", + "indexmap", + "itertools", + "num-bigint", + "salsa", + "smol_str", +] + +[[package]] +name = "cairo-lang-sierra-generator" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-debug 1.1.0-rc0", + "cairo-lang-defs 1.1.0-rc0", + "cairo-lang-diagnostics 1.1.0-rc0", + "cairo-lang-filesystem 1.1.0-rc0", + "cairo-lang-lowering 1.1.0-rc0", + "cairo-lang-parser 1.1.0-rc0", + "cairo-lang-plugins 1.1.0-rc0", + "cairo-lang-proc-macros 1.1.0-rc0", + "cairo-lang-semantic 1.1.0-rc0", + "cairo-lang-sierra 1.1.0-rc0", + "cairo-lang-syntax 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "id-arena", "indexmap", "itertools", @@ -795,12 +1135,34 @@ checksum = "f65d7860fe339a726df3dbeaeefb90da5891532f40499285b53b51e92911c1d1" dependencies = [ "anyhow", "assert_matches", - "cairo-felt", - "cairo-lang-casm", - "cairo-lang-sierra", - "cairo-lang-sierra-ap-change", - "cairo-lang-sierra-gas", - "cairo-lang-utils", + "cairo-felt 0.3.0-rc1", + "cairo-lang-casm 1.1.0-alpha0", + "cairo-lang-sierra 1.1.0-alpha0", + "cairo-lang-sierra-ap-change 1.1.0-alpha0", + "cairo-lang-sierra-gas 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "clap", + "indoc 2.0.1", + "itertools", + "log", + "num-bigint", + "num-traits 0.2.15", + "thiserror", +] + +[[package]] +name = "cairo-lang-sierra-to-casm" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "anyhow", + "assert_matches", + "cairo-felt 0.4.0", + "cairo-lang-casm 1.1.0-rc0", + "cairo-lang-sierra 1.1.0-rc0", + "cairo-lang-sierra-ap-change 1.1.0-rc0", + "cairo-lang-sierra-gas 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "clap", "indoc 2.0.1", "itertools", @@ -817,23 +1179,63 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6078d5873de4a26ded0e257f88d7ef51d896bb59645cbf7388b8794cd982086" dependencies = [ "anyhow", - "cairo-felt", - "cairo-lang-casm", - "cairo-lang-compiler", - "cairo-lang-defs", - "cairo-lang-diagnostics", - "cairo-lang-filesystem", - "cairo-lang-lowering", - "cairo-lang-parser", - "cairo-lang-plugins", - "cairo-lang-semantic", - "cairo-lang-sierra", - "cairo-lang-sierra-ap-change", - "cairo-lang-sierra-gas", - "cairo-lang-sierra-generator", - "cairo-lang-sierra-to-casm", - "cairo-lang-syntax", - "cairo-lang-utils", + "cairo-felt 0.3.0-rc1", + "cairo-lang-casm 1.1.0-alpha0", + "cairo-lang-compiler 1.1.0-alpha0", + "cairo-lang-defs 1.1.0-alpha0", + "cairo-lang-diagnostics 1.1.0-alpha0", + "cairo-lang-filesystem 1.1.0-alpha0", + "cairo-lang-lowering 1.1.0-alpha0", + "cairo-lang-parser 1.1.0-alpha0", + "cairo-lang-plugins 1.1.0-alpha0", + "cairo-lang-semantic 1.1.0-alpha0", + "cairo-lang-sierra 1.1.0-alpha0", + "cairo-lang-sierra-ap-change 1.1.0-alpha0", + "cairo-lang-sierra-gas 1.1.0-alpha0", + "cairo-lang-sierra-generator 1.1.0-alpha0", + "cairo-lang-sierra-to-casm 1.1.0-alpha0", + "cairo-lang-syntax 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "clap", + "convert_case 0.6.0", + "genco", + "indoc 2.0.1", + "itertools", + "log", + "num-bigint", + "num-integer", + "num-traits 0.2.15", + "once_cell", + "serde", + "serde_json", + "sha3 0.10.7", + "smol_str", + "thiserror", +] + +[[package]] +name = "cairo-lang-starknet" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "anyhow", + "cairo-felt 0.4.0", + "cairo-lang-casm 1.1.0-rc0", + "cairo-lang-compiler 1.1.0-rc0", + "cairo-lang-defs 1.1.0-rc0", + "cairo-lang-diagnostics 1.1.0-rc0", + "cairo-lang-filesystem 1.1.0-rc0", + "cairo-lang-lowering 1.1.0-rc0", + "cairo-lang-parser 1.1.0-rc0", + "cairo-lang-plugins 1.1.0-rc0", + "cairo-lang-semantic 1.1.0-rc0", + "cairo-lang-sierra 1.1.0-rc0", + "cairo-lang-sierra-ap-change 1.1.0-rc0", + "cairo-lang-sierra-gas 1.1.0-rc0", + "cairo-lang-sierra-generator 1.1.0-rc0", + "cairo-lang-sierra-to-casm 1.1.0-rc0", + "cairo-lang-syntax 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "clap", "convert_case 0.6.0", "genco", @@ -857,9 +1259,25 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19509c3d3152111a1dfad2dff0ec3f591aaf5231d31d2928d1ce0f2b6dcbe5e5" dependencies = [ - "cairo-lang-debug", - "cairo-lang-filesystem", - "cairo-lang-utils", + "cairo-lang-debug 1.1.0-alpha0", + "cairo-lang-filesystem 1.1.0-alpha0", + "cairo-lang-utils 1.1.0-alpha0", + "num-bigint", + "num-traits 0.2.15", + "salsa", + "smol_str", + "thiserror", + "unescaper", +] + +[[package]] +name = "cairo-lang-syntax" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-debug 1.1.0-rc0", + "cairo-lang-filesystem 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "num-bigint", "num-traits 0.2.15", "salsa", @@ -874,7 +1292,18 @@ version = "1.1.0-alpha0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "385e3393d716a833c37a9b0141cd2da587d0e73d3f06399dbfeac80576707894" dependencies = [ - "cairo-lang-utils", + "cairo-lang-utils 1.1.0-alpha0", + "genco", + "log", + "xshell", +] + +[[package]] +name = "cairo-lang-syntax-codegen" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "cairo-lang-utils 1.1.0-rc0", "genco", "log", "xshell", @@ -897,25 +1326,39 @@ dependencies = [ "time", ] +[[package]] +name = "cairo-lang-utils" +version = "1.1.0-rc0" +source = "git+https://github.com/starkware-libs/cairo?rev=7531601#753160169162784486cab4992fff17b5592a1552" +dependencies = [ + "env_logger", + "indexmap", + "itertools", + "log", + "num-bigint", + "num-integer", + "num-traits 0.2.15", + "serde", + "time", +] + [[package]] name = "cairo-take_until_unbalanced" -version = "0.24.2-rc1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e174056df7cfe9b579376f32de405722e1090c74deb2540bb0cd9e7931772d" +version = "0.25.0" +source = "git+https://github.com/lambdaclass/cairo-rs?rev=5db2e65#5db2e656d46a97d89563a74f8fc3abd595e8befb" dependencies = [ "nom", ] [[package]] name = "cairo-vm" -version = "0.3.0-rc1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f4af8c3e7be5ac46b7da4a3ab551ee4c8c8e2fdb501a4dda4dceef4c66dbcde" +version = "0.4.0" +source = "git+https://github.com/lambdaclass/cairo-rs?rev=5db2e65#5db2e656d46a97d89563a74f8fc3abd595e8befb" dependencies = [ "anyhow", "bincode", "bitvec 1.0.1", - "cairo-felt", + "cairo-felt 0.4.0", "cairo-take_until_unbalanced", "generic-array", "hashbrown 0.13.2", @@ -926,14 +1369,16 @@ dependencies = [ "nom", "num-bigint", "num-integer", + "num-prime", "num-traits 0.2.15", + "rand", "rand_core", "serde", "serde_bytes", "serde_json", "sha2 0.10.6", "sha3 0.10.7", - "starknet-crypto 0.4.3", + "starknet-crypto 0.5.1", "thiserror", "thiserror-no-std", ] @@ -1111,24 +1556,15 @@ dependencies = [ "zeroize", ] -[[package]] -name = "crypto-bigint" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" -dependencies = [ - "generic-array", - "subtle", - "zeroize", -] - [[package]] name = "crypto-bigint" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" dependencies = [ + "generic-array", "subtle", + "zeroize", ] [[package]] @@ -2084,6 +2520,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "lru" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +dependencies = [ + "hashbrown 0.12.3", +] + [[package]] name = "matches" version = "0.1.10" @@ -2200,7 +2645,7 @@ name = "native_blockifier" version = "0.1.0" dependencies = [ "blockifier", - "cairo-lang-starknet", + "cairo-lang-starknet 1.1.0-rc0", "cairo-vm", "hex", "indexmap", @@ -2253,6 +2698,7 @@ dependencies = [ "autocfg", "num-integer", "num-traits 0.2.15", + "rand", "serde", ] @@ -2276,6 +2722,33 @@ dependencies = [ "num-traits 0.2.15", ] +[[package]] +name = "num-modular" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a5fe11d4135c3bcdf3a95b18b194afa9608a5f6ff034f5d857bc9a27fb0119" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits 0.2.15", +] + +[[package]] +name = "num-prime" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f4e3bc495f6e95bc15a6c0c55ac00421504a5a43d09e3cc455d1fea7015581d" +dependencies = [ + "bitvec 1.0.1", + "either", + "lru", + "num-bigint", + "num-integer", + "num-modular", + "num-traits 0.2.15", + "rand", +] + [[package]] name = "num-traits" version = "0.1.43" @@ -2410,12 +2883,12 @@ dependencies = [ [[package]] name = "papyrus_storage" version = "0.1.0" -source = "git+https://github.com/starkware-libs/papyrus?rev=6545673#6545673cf4005e50eb665017879a3eb1cb442a6c" +source = "git+https://github.com/starkware-libs/papyrus?rev=5bb23d6#5bb23d64b1ae611f69a77711fbb392c6049b206c" dependencies = [ "byteorder", - "cairo-lang-casm", - "cairo-lang-starknet", - "cairo-lang-utils", + "cairo-lang-casm 1.1.0-rc0", + "cairo-lang-starknet 1.1.0-rc0", + "cairo-lang-utils 1.1.0-rc0", "flate2", "futures-util", "indexmap", @@ -2963,13 +3436,12 @@ dependencies = [ [[package]] name = "rfc6979" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ - "crypto-bigint 0.4.9", "hmac 0.12.1", - "zeroize", + "subtle", ] [[package]] @@ -3379,20 +3851,20 @@ dependencies = [ [[package]] name = "starknet-crypto" -version = "0.4.3" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8802a516a2556b2ddb9630898d2c8387d928a3e603799b8b2a7dc4018b852c8f" +checksum = "693e6362f150f9276e429a910481fb7f3bcb8d6aa643743f587cfece0b374874" dependencies = [ - "crypto-bigint 0.4.9", + "crypto-bigint 0.5.2", "hex", "hmac 0.12.1", "num-bigint", "num-integer", "num-traits 0.2.15", - "rfc6979 0.3.1", + "rfc6979 0.4.0", "sha2 0.10.6", "starknet-crypto-codegen 0.3.1", - "starknet-curve 0.2.1", + "starknet-curve 0.3.0", "starknet-ff 0.3.2", "zeroize", ] @@ -3428,15 +3900,6 @@ dependencies = [ "starknet-ff 0.2.0", ] -[[package]] -name = "starknet-curve" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0dbde7ef14d54c2117bc6d2efb68c2383005f1cd749b277c11df874d07b7af" -dependencies = [ - "starknet-ff 0.3.2", -] - [[package]] name = "starknet-curve" version = "0.3.0" @@ -3479,7 +3942,7 @@ name = "starknet_api" version = "0.1.0" source = "git+https://github.com/starkware-libs/starknet-api?rev=24a7249#24a7249f907fb3f3194bad23a2342874e27dc575" dependencies = [ - "cairo-lang-starknet", + "cairo-lang-starknet 1.1.0-alpha0", "derive_more", "hex", "indexmap", @@ -3633,7 +4096,7 @@ dependencies = [ [[package]] name = "test_utils" version = "0.1.0" -source = "git+https://github.com/starkware-libs/papyrus?rev=6545673#6545673cf4005e50eb665017879a3eb1cb442a6c" +source = "git+https://github.com/starkware-libs/papyrus?rev=5bb23d6#5bb23d64b1ae611f69a77711fbb392c6049b206c" dependencies = [ "indexmap", "rand", diff --git a/Cargo.toml b/Cargo.toml index 99c92605ae..07cef8e688 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,11 +7,11 @@ members = ["crates/blockifier", "crates/native_blockifier"] [workspace.dependencies] assert_matches = "1.5.0" -cairo-felt = "0.3.0-rc1" -cairo-lang-casm = { version = "1.1.0-alpha0" } -cairo-lang-runner = { version = "1.1.0-alpha0" } -cairo-lang-starknet = { version = "1.1.0-alpha0" } -cairo-vm = "0.3.0-rc1" +cairo-felt = { git = "https://github.com/lambdaclass/cairo-rs", rev = "5db2e65" } +cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo", rev = "7531601" } +cairo-lang-runner = { git = "https://github.com/starkware-libs/cairo", rev = "7531601" } +cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", rev = "7531601" } +cairo-vm = { git = "https://github.com/lambdaclass/cairo-rs", rev = "5db2e65" } ctor = "0.2.0" derive_more = "0.99.17" hex = "0.4.3" @@ -22,7 +22,7 @@ num-bigint = "0.4" num-integer = "0.1.45" num-traits = "0.2" ouroboros = "0.15.6" -papyrus_storage = { git = "https://github.com/starkware-libs/papyrus", rev = "6545673" } +papyrus_storage = { git = "https://github.com/starkware-libs/papyrus", rev = "5bb23d6" } phf = { version = "0.11", features = ["macros"] } pretty_assertions = "1.2.1" serde = "1.0.130" diff --git a/crates/blockifier/feature_contracts/cairo1/compiled/test_contract.casm.json b/crates/blockifier/feature_contracts/cairo1/compiled/test_contract.casm.json index 4cd0c3b01e..2fd9c928e0 100644 --- a/crates/blockifier/feature_contracts/cairo1/compiled/test_contract.casm.json +++ b/crates/blockifier/feature_contracts/cairo1/compiled/test_contract.casm.json @@ -6646,21 +6646,21 @@ "selector": "0x3c118a68e16e12e97ed25cb4901c12f4d3162818669cc44c391d8049924c14", "offset": 556, "builtins": [ - "range_check" + "range_check_builtin" ] }, { "selector": "0xe7510edcf6e9f1b70f7bd1f488767b50f0363422f3c563160ab77adf62467b", "offset": 1328, "builtins": [ - "range_check" + "range_check_builtin" ] }, { "selector": "0x10d2fede95e3ec06a875a67219425c27c5bd734d57f1b221d729a2337b6b556", "offset": 1647, "builtins": [ - "range_check", + "range_check_builtin", "segment_arena" ] }, @@ -6668,49 +6668,49 @@ "selector": "0x169f135eddda5ab51886052d777a57f2ea9c162d713691b5e04a6d4ed71d47f", "offset": 1761, "builtins": [ - "range_check" + "range_check_builtin" ] }, { "selector": "0x27c3334165536f239cfd400ed956eabff55fc60de4fb56728b6a4f6b87db01c", "offset": 167, "builtins": [ - "range_check" + "range_check_builtin" ] }, { "selector": "0x2913ee03e5e3308c41e308bd391ea4faac9b9cb5062c76a6b3ab4f65397e106", "offset": 365, "builtins": [ - "range_check" + "range_check_builtin" ] }, { "selector": "0x2d7cf5d5a324a320f9f37804b1615a533fde487400b41af80f13f7ac5581325", "offset": 1469, "builtins": [ - "range_check" + "range_check_builtin" ] }, { "selector": "0x3604cea1cdb094a73a31144f14a3e5861613c008e1e879939ebc4827d10cd50", "offset": 907, "builtins": [ - "range_check" + "range_check_builtin" ] }, { "selector": "0x3a6a8bae4c51d5959683ae246347ffdd96aa5b2bfa68cc8c3a6a7c2ed0be331", "offset": 1105, "builtins": [ - "range_check" + "range_check_builtin" ] }, { "selector": "0x3b097c62d3e4b85742aadd0dfb823f96134b886ec13bda57b68faf86f294d97", "offset": 0, "builtins": [ - "range_check" + "range_check_builtin" ] } ], @@ -6719,7 +6719,7 @@ "selector": "0x39edbbb129ad752107a94d40c3873cae369a46fd2fc578d075679aa67e85d12", "offset": 1982, "builtins": [ - "range_check" + "range_check_builtin" ] } ], @@ -6728,9 +6728,9 @@ "selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", "offset": 2136, "builtins": [ - "range_check" + "range_check_builtin" ] } ] } -} \ No newline at end of file +} diff --git a/crates/blockifier/src/execution/cairo1_execution.rs b/crates/blockifier/src/execution/cairo1_execution.rs index 843f823d84..12041e5531 100644 --- a/crates/blockifier/src/execution/cairo1_execution.rs +++ b/crates/blockifier/src/execution/cairo1_execution.rs @@ -141,13 +141,13 @@ fn prepare_builtin_costs( // Put a pointer to the builtin cost segment at the end of the program (after the // additional `ret` statement). - let mut ptr = (vm.get_pc() + contract_class.program.data.len())?; + let mut ptr = (vm.get_pc() + contract_class.program.data_len())?; // Push a `ret` opcode. write_stark_felt(vm, &mut ptr, stark_felt!("0x208b7fff7fff7ffe"))?; // Push a pointer to the builtin cost segment. write_maybe_relocatable(vm, &mut ptr, builtin_cost_segment_start)?; - Ok(contract_class.program.data.len() + 2) + Ok(contract_class.program.data_len() + 2) } pub fn prepare_call_arguments( diff --git a/crates/blockifier/src/execution/contract_class.rs b/crates/blockifier/src/execution/contract_class.rs index 3b508727a9..797d7b88ef 100644 --- a/crates/blockifier/src/execution/contract_class.rs +++ b/crates/blockifier/src/execution/contract_class.rs @@ -201,7 +201,6 @@ impl TryFrom for ContractClassV1 { let program = Program::new( builtins, - Felt252::prime().to_str_radix(16), data, main, hints, diff --git a/crates/blockifier/src/execution/entry_point_test.rs b/crates/blockifier/src/execution/entry_point_test.rs index 7e452d3a0d..b9dbffa161 100644 --- a/crates/blockifier/src/execution/entry_point_test.rs +++ b/crates/blockifier/src/execution/entry_point_test.rs @@ -524,17 +524,20 @@ Got an exception while executing a hint. Cairo traceback (most recent call last): Unknown location (pc=0:629) Unknown location (pc=0:612) + Error in the called contract ({}): Error at pc=0:19: Got an exception while executing a hint. Cairo traceback (most recent call last): Unknown location (pc=0:629) Unknown location (pc=0:612) + Error in the called contract ({}): Error at pc=0:58: An ASSERT_EQ instruction failed: 1 != 0. Cairo traceback (most recent call last): -Unknown location (pc=0:62)", +Unknown location (pc=0:62) +", pad_address_to_64(TEST_CONTRACT_ADDRESS), pad_address_to_64(TEST_CONTRACT_ADDRESS_2), pad_address_to_64(SECURITY_TEST_CONTRACT_ADDRESS) diff --git a/crates/blockifier/src/execution/execution_utils.rs b/crates/blockifier/src/execution/execution_utils.rs index bdd5940aa2..42a38dff54 100644 --- a/crates/blockifier/src/execution/execution_utils.rs +++ b/crates/blockifier/src/execution/execution_utils.rs @@ -118,7 +118,6 @@ pub fn sn_api_to_cairo_vm_program(program: DeprecatedProgram) -> Result ResourcesMapping { ResourcesMapping(HashMap::from([ - (String::from("n_steps"), 1800), - (String::from("pedersen"), 10), - (String::from("range_check"), 24), - (String::from("ecdsa"), 1), - (String::from("bitwise"), 1), - (String::from("poseidon"), 1), + (String::from(N_STEPS_RESOURCE), 1800), + (String::from(HASH_BUILTIN_NAME), 10), + (String::from(RANGE_CHECK_BUILTIN_NAME), 24), + (String::from(SIGNATURE_BUILTIN_NAME), 1), + (String::from(BITWISE_BUILTIN_NAME), 1), + (String::from(POSEIDON_BUILTIN_NAME), 1), ])) } @@ -25,7 +30,7 @@ fn test_calculate_l1_gas_by_vm_usage() { // Positive flow. // Verify calculation - in our case, n_steps is the heaviest resource. - let l1_gas_by_vm_usage = vm_resource_usage.0.get("n_steps").unwrap(); + let l1_gas_by_vm_usage = vm_resource_usage.0.get(N_STEPS_RESOURCE).unwrap(); assert_eq!( *l1_gas_by_vm_usage as f64, calculate_l1_gas_by_vm_usage(&block_context, &vm_resource_usage).unwrap() diff --git a/crates/blockifier/src/fee/os_resources.rs b/crates/blockifier/src/fee/os_resources.rs index 374ac20c5e..40adce94d9 100644 --- a/crates/blockifier/src/fee/os_resources.rs +++ b/crates/blockifier/src/fee/os_resources.rs @@ -1,5 +1,7 @@ +use cairo_vm::vm::runners::builtin_runner::{HASH_BUILTIN_NAME, RANGE_CHECK_BUILTIN_NAME}; use serde_json::json; +use crate::abi::constants::N_STEPS_RESOURCE; use crate::fee::os_usage::OsResources; #[ctor::ctor] @@ -13,145 +15,145 @@ fn os_resources() -> serde_json::Value { "execute_syscalls": { "CallContract": { "builtin_instance_counter": { - "range_check": 19 + RANGE_CHECK_BUILTIN_NAME: 19 }, "n_memory_holes": 0, - "n_steps": 690 + N_STEPS_RESOURCE: 690 }, "DelegateCall": { "builtin_instance_counter": { - "range_check": 19 + RANGE_CHECK_BUILTIN_NAME: 19 }, "n_memory_holes": 0, - "n_steps": 712 + N_STEPS_RESOURCE: 712 }, "DelegateL1Handler": { "builtin_instance_counter": { - "range_check": 15 + RANGE_CHECK_BUILTIN_NAME: 15 }, "n_memory_holes": 0, - "n_steps": 691 + N_STEPS_RESOURCE: 691 }, "Deploy": { "builtin_instance_counter": { - "pedersen": 7, - "range_check": 18 + HASH_BUILTIN_NAME: 7, + RANGE_CHECK_BUILTIN_NAME: 18 }, "n_memory_holes": 0, - "n_steps": 936 + N_STEPS_RESOURCE: 936 }, "EmitEvent": { "builtin_instance_counter": {}, "n_memory_holes": 0, - "n_steps": 19 + N_STEPS_RESOURCE: 19 }, "GetBlockNumber": { "builtin_instance_counter": {}, "n_memory_holes": 0, - "n_steps": 40 + N_STEPS_RESOURCE: 40 }, "GetBlockTimestamp": { "builtin_instance_counter": {}, "n_memory_holes": 0, - "n_steps": 38 + N_STEPS_RESOURCE: 38 }, "GetCallerAddress": { "builtin_instance_counter": {}, "n_memory_holes": 0, - "n_steps": 32 + N_STEPS_RESOURCE: 32 }, "GetContractAddress": { "builtin_instance_counter": {}, "n_memory_holes": 0, - "n_steps": 36 + N_STEPS_RESOURCE: 36 }, "GetExecutionInfo": { "builtin_instance_counter": {}, "n_memory_holes": 0, - "n_steps": 29 + N_STEPS_RESOURCE: 29 }, "GetSequencerAddress": { "builtin_instance_counter": {}, "n_memory_holes": 0, - "n_steps": 34 + N_STEPS_RESOURCE: 34 }, "GetTxInfo": { "builtin_instance_counter": {}, "n_memory_holes": 0, - "n_steps": 29 + N_STEPS_RESOURCE: 29 }, "GetTxSignature": { "builtin_instance_counter": {}, "n_memory_holes": 0, - "n_steps": 44 + N_STEPS_RESOURCE: 44 }, "LibraryCall": { "builtin_instance_counter": { - "range_check": 19 + RANGE_CHECK_BUILTIN_NAME: 19 }, "n_memory_holes": 0, - "n_steps": 679 + N_STEPS_RESOURCE: 679 }, "LibraryCallL1Handler": { "builtin_instance_counter": { - "range_check": 15 + RANGE_CHECK_BUILTIN_NAME: 15 }, "n_memory_holes": 0, - "n_steps": 658 + N_STEPS_RESOURCE: 658 }, "ReplaceClass": { "builtin_instance_counter": {}, "n_memory_holes": 0, - "n_steps": 73 + N_STEPS_RESOURCE: 73 }, "SendMessageToL1": { "builtin_instance_counter": {}, "n_memory_holes": 0, - "n_steps": 84 + N_STEPS_RESOURCE: 84 }, "StorageRead": { "builtin_instance_counter": {}, "n_memory_holes": 0, - "n_steps": 44 + N_STEPS_RESOURCE: 44 }, "StorageWrite": { "builtin_instance_counter": {}, "n_memory_holes": 0, - "n_steps": 46 + N_STEPS_RESOURCE: 46 } }, "execute_txs_inner": { "Declare": { "builtin_instance_counter": { - "pedersen": 15, - "range_check": 63 + HASH_BUILTIN_NAME: 15, + RANGE_CHECK_BUILTIN_NAME: 63 }, "n_memory_holes": 0, - "n_steps": 2703 + N_STEPS_RESOURCE: 2703 }, "DeployAccount": { "builtin_instance_counter": { - "pedersen": 23, - "range_check": 83 + HASH_BUILTIN_NAME: 23, + RANGE_CHECK_BUILTIN_NAME: 83 }, "n_memory_holes": 0, - "n_steps": 3612 + N_STEPS_RESOURCE: 3612 }, "InvokeFunction": { "builtin_instance_counter": { - "pedersen": 16, - "range_check": 80, + HASH_BUILTIN_NAME: 16, + RANGE_CHECK_BUILTIN_NAME: 80, }, "n_memory_holes": 0, - "n_steps": 3363 + N_STEPS_RESOURCE: 3363 }, "L1Handler": { "builtin_instance_counter": { - "pedersen": 11, - "range_check": 17 + HASH_BUILTIN_NAME: 11, + RANGE_CHECK_BUILTIN_NAME: 17 }, "n_memory_holes": 0, - "n_steps": 1068 + N_STEPS_RESOURCE: 1068 } } }) diff --git a/crates/blockifier/src/test_utils.rs b/crates/blockifier/src/test_utils.rs index 48f7f09673..87edc1a3ca 100644 --- a/crates/blockifier/src/test_utils.rs +++ b/crates/blockifier/src/test_utils.rs @@ -2,6 +2,10 @@ use std::collections::HashMap; use std::fs; use std::path::PathBuf; +use cairo_vm::vm::runners::builtin_runner::{ + BITWISE_BUILTIN_NAME, EC_OP_BUILTIN_NAME, HASH_BUILTIN_NAME, OUTPUT_BUILTIN_NAME, + POSEIDON_BUILTIN_NAME, RANGE_CHECK_BUILTIN_NAME, SIGNATURE_BUILTIN_NAME, +}; use starknet_api::block::{BlockNumber, BlockTimestamp}; use starknet_api::core::{ calculate_contract_address, ChainId, ClassHash, CompiledClassHash, ContractAddress, @@ -19,6 +23,7 @@ use starknet_api::transaction::{ use starknet_api::{calldata, patricia_key, stark_felt}; use crate::abi::abi_utils::get_storage_var_address; +use crate::abi::constants::N_STEPS_RESOURCE; use crate::block_context::BlockContext; use crate::execution::contract_class::{ContractClass, ContractClassV0, ContractClassV1}; use crate::execution::entry_point::{ @@ -331,14 +336,14 @@ impl BlockContext { pub fn create_for_account_testing() -> BlockContext { let vm_resource_fee_cost = HashMap::from([ - (String::from("n_steps"), 1_f64), - (String::from("pedersen"), 1_f64), - (String::from("range_check"), 1_f64), - (String::from("ecdsa"), 1_f64), - (String::from("bitwise"), 1_f64), - (String::from("poseidon"), 1_f64), - (String::from("output"), 1_f64), - (String::from("ec_op"), 1_f64), + (String::from(N_STEPS_RESOURCE), 1_f64), + (String::from(HASH_BUILTIN_NAME), 1_f64), + (String::from(RANGE_CHECK_BUILTIN_NAME), 1_f64), + (String::from(SIGNATURE_BUILTIN_NAME), 1_f64), + (String::from(BITWISE_BUILTIN_NAME), 1_f64), + (String::from(POSEIDON_BUILTIN_NAME), 1_f64), + (String::from(OUTPUT_BUILTIN_NAME), 1_f64), + (String::from(EC_OP_BUILTIN_NAME), 1_f64), ]); BlockContext { vm_resource_fee_cost, ..BlockContext::create_for_testing() } } diff --git a/crates/blockifier/src/transaction/transactions_test.rs b/crates/blockifier/src/transaction/transactions_test.rs index afdd413eca..b075ba80bf 100644 --- a/crates/blockifier/src/transaction/transactions_test.rs +++ b/crates/blockifier/src/transaction/transactions_test.rs @@ -358,8 +358,8 @@ fn test_invoke_tx() { actual_fee: expected_actual_fee, actual_resources: ResourcesMapping(HashMap::from([ (abi_constants::GAS_USAGE.to_string(), 1224), - ("pedersen".to_string(), 16), - ("range_check".to_string(), 101), + (HASH_BUILTIN_NAME.to_string(), 16), + (RANGE_CHECK_BUILTIN_NAME.to_string(), 101), (abi_constants::N_STEPS_RESOURCE.to_string(), 4135), ])), revert_error: None, @@ -580,8 +580,8 @@ fn test_declare_tx() { actual_fee: expected_actual_fee, actual_resources: ResourcesMapping(HashMap::from([ (abi_constants::GAS_USAGE.to_string(), 1224), - ("pedersen".to_string(), 15), - ("range_check".to_string(), 63), + (HASH_BUILTIN_NAME.to_string(), 15), + (RANGE_CHECK_BUILTIN_NAME.to_string(), 63), (abi_constants::N_STEPS_RESOURCE.to_string(), 2715), ])), revert_error: None, @@ -697,8 +697,8 @@ fn test_deploy_account_tx() { actual_fee: expected_actual_fee, actual_resources: ResourcesMapping(HashMap::from([ (abi_constants::GAS_USAGE.to_string(), 3060), - ("pedersen".to_string(), 23), - ("range_check".to_string(), 83), + (HASH_BUILTIN_NAME.to_string(), 23), + (RANGE_CHECK_BUILTIN_NAME.to_string(), 83), (abi_constants::N_STEPS_RESOURCE.to_string(), 3625), ])), revert_error: None, diff --git a/crates/native_blockifier/src/papyrus_state.rs b/crates/native_blockifier/src/papyrus_state.rs index 8d43ef5067..435de446e8 100644 --- a/crates/native_blockifier/src/papyrus_state.rs +++ b/crates/native_blockifier/src/papyrus_state.rs @@ -83,7 +83,7 @@ impl<'env> StateReader for PapyrusReader<'env> { if class_is_declared { let casm_contract_class = self .contract_classes - .get_casm(*class_hash) + .get_casm(class_hash) .map_err(|err| StateError::StateReadError(err.to_string()))? .expect( "Should be able to fetch a Casm class if its definition exists, database is \ @@ -190,7 +190,7 @@ impl<'env> PapyrusExecutableClassReader<'env> { Self { txn } } - fn get_casm(&self, class_hash: ClassHash) -> StorageResult> { + fn get_casm(&self, class_hash: &ClassHash) -> StorageResult> { self.txn.get_casm(class_hash) } } diff --git a/crates/native_blockifier/src/py_transaction.rs b/crates/native_blockifier/src/py_transaction.rs index a11390b0cc..07370c8b84 100644 --- a/crates/native_blockifier/src/py_transaction.rs +++ b/crates/native_blockifier/src/py_transaction.rs @@ -98,7 +98,7 @@ pub fn py_block_context( starknet_os_config, "fee_token_address", )?)?, - vm_resource_fee_cost: process_cairo_resource_fee_weights(general_config)?, + vm_resource_fee_cost: py_attr(general_config, "cairo_resource_fee_weights")?, gas_price: py_attr(block_info, "gas_price")?, invoke_tx_max_n_steps: py_attr(general_config, "invoke_tx_max_n_steps")?, validate_max_n_steps: py_attr(general_config, "validate_max_n_steps")?, @@ -107,22 +107,6 @@ pub fn py_block_context( Ok(block_context) } -fn process_cairo_resource_fee_weights( - general_config: &PyAny, -) -> Result, NativeBlockifierError> { - let cairo_resource_fee_weights: HashMap = - py_attr(general_config, "cairo_resource_fee_weights")?; - - // Remove the suffix "_builtin" from the keys, if exists. - // FIXME: This should be fixed in python though... - let cairo_resource_fee_weights = cairo_resource_fee_weights - .into_iter() - .map(|(k, v)| (k.trim_end_matches("_builtin").to_string(), v)) - .collect(); - - Ok(cairo_resource_fee_weights) -} - pub fn py_declare( tx: &PyAny, ) -> NativeBlockifierResult { @@ -462,11 +446,11 @@ pub fn into_py_contract_class_sizes_mapping( let sizes = match class { ContractClass::V0(class) => PyContractClassSizes { - bytecode_length: class.program.data.len(), - n_builtins: Some(class.program.builtins.len()), + bytecode_length: class.program.data_len(), + n_builtins: Some(class.program.builtins_len()), }, ContractClass::V1(class) => { - PyContractClassSizes { bytecode_length: class.program.data.len(), n_builtins: None } + PyContractClassSizes { bytecode_length: class.program.data_len(), n_builtins: None } } };