diff --git a/Cargo.lock b/Cargo.lock index 5abbe52af..a56fd4acb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -554,7 +554,7 @@ dependencies = [ [[package]] name = "cairo-lang-casm" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-utils", "indoc", @@ -567,7 +567,7 @@ dependencies = [ [[package]] name = "cairo-lang-compiler" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "anyhow", "cairo-lang-defs", @@ -589,7 +589,7 @@ dependencies = [ [[package]] name = "cairo-lang-debug" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-utils", ] @@ -597,7 +597,7 @@ dependencies = [ [[package]] name = "cairo-lang-defs" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-debug", "cairo-lang-diagnostics", @@ -613,7 +613,7 @@ dependencies = [ [[package]] name = "cairo-lang-diagnostics" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -624,7 +624,7 @@ dependencies = [ [[package]] name = "cairo-lang-eq-solver" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-utils", "good_lp", @@ -633,7 +633,7 @@ dependencies = [ [[package]] name = "cairo-lang-filesystem" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-debug", "cairo-lang-utils", @@ -646,7 +646,7 @@ dependencies = [ [[package]] name = "cairo-lang-formatter" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "anyhow", "cairo-lang-diagnostics", @@ -666,7 +666,7 @@ dependencies = [ [[package]] name = "cairo-lang-language-server" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "anyhow", "cairo-lang-compiler", @@ -696,7 +696,7 @@ dependencies = [ [[package]] name = "cairo-lang-lowering" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -745,7 +745,7 @@ version = "1.0.0" [[package]] name = "cairo-lang-parser" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-diagnostics", "cairo-lang-filesystem", @@ -764,7 +764,7 @@ dependencies = [ [[package]] name = "cairo-lang-plugins" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-defs", "cairo-lang-diagnostics", @@ -782,7 +782,7 @@ dependencies = [ [[package]] name = "cairo-lang-proc-macros" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-debug", "quote", @@ -792,7 +792,7 @@ dependencies = [ [[package]] name = "cairo-lang-project" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-filesystem", "cairo-lang-utils", @@ -805,7 +805,7 @@ dependencies = [ [[package]] name = "cairo-lang-runner" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "ark-ff", "ark-secp256k1", @@ -827,6 +827,7 @@ dependencies = [ "num-bigint", "num-integer", "num-traits 0.2.18", + "sha2", "smol_str", "starknet-crypto", "thiserror", @@ -835,7 +836,7 @@ dependencies = [ [[package]] name = "cairo-lang-semantic" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -859,7 +860,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "anyhow", "cairo-felt", @@ -884,7 +885,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-ap-change" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -898,7 +899,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-gas" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -912,7 +913,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-generator" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -928,13 +929,15 @@ dependencies = [ "num-traits 0.2.18", "once_cell", "salsa", + "serde", + "serde_json", "smol_str", ] [[package]] name = "cairo-lang-sierra-to-casm" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "assert_matches", "cairo-felt", @@ -954,7 +957,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-type-size" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-sierra", "cairo-lang-utils", @@ -963,7 +966,7 @@ dependencies = [ [[package]] name = "cairo-lang-starknet" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "anyhow", "cairo-felt", @@ -993,7 +996,7 @@ dependencies = [ [[package]] name = "cairo-lang-starknet-classes" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-felt", "cairo-lang-casm", @@ -1017,7 +1020,7 @@ dependencies = [ [[package]] name = "cairo-lang-syntax" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -1032,7 +1035,7 @@ dependencies = [ [[package]] name = "cairo-lang-syntax-codegen" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "genco", "xshell", @@ -1041,7 +1044,7 @@ dependencies = [ [[package]] name = "cairo-lang-test-plugin" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "anyhow", "cairo-felt", @@ -1068,7 +1071,7 @@ dependencies = [ [[package]] name = "cairo-lang-test-runner" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "anyhow", "cairo-felt", @@ -1090,7 +1093,7 @@ dependencies = [ [[package]] name = "cairo-lang-utils" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" +source = "git+https://github.com/starkware-libs/cairo?rev=c064d5e789d5bf194691eca9bd0f3b508caf83fc#c064d5e789d5bf194691eca9bd0f3b508caf83fc" dependencies = [ "env_logger", "hashbrown 0.14.3", @@ -4480,6 +4483,7 @@ dependencies = [ "cairo-lang-macro", "cairo-lang-macro-stable", "cairo-lang-semantic", + "cairo-lang-sierra", "cairo-lang-sierra-to-casm", "cairo-lang-starknet", "cairo-lang-starknet-classes", diff --git a/Cargo.toml b/Cargo.toml index 0ad908279..b91cc7ef9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,28 +35,28 @@ assert_fs = "1" async-trait = "0.1" axum = { version = "0.6", features = ["http2"] } cairo-felt = "0.9.1" -cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-compiler = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-debug = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-defs = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-diagnostics = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-filesystem = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-formatter = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-language-server = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-lowering = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-project = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-runner = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-semantic = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-sierra = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-sierra-generator = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-sierra-to-casm = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-sierra-type-size = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-starknet-classes = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-syntax = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-test-plugin = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-test-runner = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } -cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1", features = ["env_logger"] } +cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-compiler = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-debug = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-defs = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-diagnostics = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-filesystem = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-formatter = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-language-server = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-lowering = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-project = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-runner = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-semantic = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-sierra = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-sierra-generator = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-sierra-to-casm = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-sierra-type-size = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-starknet-classes = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-syntax = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-test-plugin = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-test-runner = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc" } +cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "c064d5e789d5bf194691eca9bd0f3b508caf83fc", features = ["env_logger"] } camino = { version = "1", features = ["serde1"] } cargo_metadata = ">=0.18" clap = { version = "4", features = ["derive", "env", "string"] } diff --git a/extensions/scarb-snforge-test-collector/src/compilation/test_collector/config.rs b/extensions/scarb-snforge-test-collector/src/compilation/test_collector/config.rs index 6d6b0772b..290b5b9cb 100644 --- a/extensions/scarb-snforge-test-collector/src/compilation/test_collector/config.rs +++ b/extensions/scarb-snforge-test-collector/src/compilation/test_collector/config.rs @@ -6,6 +6,7 @@ use cairo_lang_syntax::attribute::structured::{Attribute, AttributeArg, Attribut use cairo_lang_syntax::node::ast::{ArgClause, Expr, PathSegment}; use cairo_lang_syntax::node::db::SyntaxGroup; use cairo_lang_syntax::node::helpers::GetIdentifier; +use cairo_lang_syntax::node::TypedStablePtr; use cairo_lang_test_plugin::test_config::{PanicExpectation, TestExpectation}; use cairo_lang_test_plugin::{try_extract_test_config, TestConfig}; use cairo_lang_utils::OptionHelper; diff --git a/scarb/Cargo.toml b/scarb/Cargo.toml index 8588535f5..c5673c212 100644 --- a/scarb/Cargo.toml +++ b/scarb/Cargo.toml @@ -24,6 +24,7 @@ cairo-lang-formatter.workspace = true cairo-lang-macro = { path = "../plugins/cairo-lang-macro" } cairo-lang-macro-stable = { path = "../plugins/cairo-lang-macro-stable" } cairo-lang-semantic.workspace = true +cairo-lang-sierra.workspace = true cairo-lang-sierra-to-casm.workspace = true cairo-lang-starknet-classes.workspace = true cairo-lang-starknet.workspace = true @@ -83,7 +84,7 @@ zip.workspace = true zstd.workspace = true [target.'cfg(not(target_os = "linux"))'.dependencies] -reqwest = { workspace = true, default-features = true} +reqwest = { workspace = true, default-features = true } [target.'cfg(target_os = "linux")'.dependencies] reqwest = { workspace = true, features = ["rustls-tls-native-roots"] } diff --git a/scarb/src/compiler/compilers/lib.rs b/scarb/src/compiler/compilers/lib.rs index 6981e4d0e..8792be82d 100644 --- a/scarb/src/compiler/compilers/lib.rs +++ b/scarb/src/compiler/compilers/lib.rs @@ -1,5 +1,6 @@ use anyhow::{Context, Result}; use cairo_lang_compiler::db::RootDatabase; +use cairo_lang_sierra::program::VersionedProgram; use cairo_lang_sierra_to_casm::compiler::SierraToCasmConfig; use cairo_lang_sierra_to_casm::metadata::{calc_metadata, calc_metadata_ap_change_only}; use serde::{Deserialize, Serialize}; @@ -56,11 +57,14 @@ impl Compiler for LibCompiler { let main_crate_ids = collect_main_crate_ids(&unit, db); - let sierra_program = { + let sierra_program: VersionedProgram = { let _ = trace_span!("compile_sierra").enter(); - cairo_lang_compiler::compile_prepared_db(db, main_crate_ids, compiler_config)? - .program - .into_artifact() + let program_artifact = cairo_lang_compiler::compile_prepared_db_program_artifact( + db, + main_crate_ids, + compiler_config, + )?; + program_artifact.into() }; if props.sierra { diff --git a/scarb/src/compiler/helpers.rs b/scarb/src/compiler/helpers.rs index b41179c7d..49a740b70 100644 --- a/scarb/src/compiler/helpers.rs +++ b/scarb/src/compiler/helpers.rs @@ -39,6 +39,9 @@ pub fn build_compiler_config<'c>( diagnostics_reporter }, replace_ids: unit.compiler_config.sierra_replace_ids, + add_statements_functions: unit + .compiler_config + .unstable_add_statements_functions_debug_info, ..CompilerConfig::default() } } diff --git a/scarb/src/compiler/plugin/proc_macro/host.rs b/scarb/src/compiler/plugin/proc_macro/host.rs index 3eed010d8..9634683fa 100644 --- a/scarb/src/compiler/plugin/proc_macro/host.rs +++ b/scarb/src/compiler/plugin/proc_macro/host.rs @@ -14,7 +14,7 @@ use cairo_lang_semantic::plugin::PluginSuite; use cairo_lang_syntax::attribute::structured::AttributeListStructurize; use cairo_lang_syntax::node::db::SyntaxGroup; use cairo_lang_syntax::node::ids::SyntaxStablePtrId; -use cairo_lang_syntax::node::{ast, TypedSyntaxNode}; +use cairo_lang_syntax::node::{ast, TypedStablePtr, TypedSyntaxNode}; use itertools::Itertools; use scarb_stable_hash::short_hash; use std::any::Any; diff --git a/scarb/src/core/manifest/compiler_config.rs b/scarb/src/core/manifest/compiler_config.rs index 4cb2609e6..9a2db87c6 100644 --- a/scarb/src/core/manifest/compiler_config.rs +++ b/scarb/src/core/manifest/compiler_config.rs @@ -19,6 +19,11 @@ pub struct ManifestCompilerConfig { pub allow_warnings: bool, /// Enable auto gas withdrawal and gas usage check. pub enable_gas: bool, + /// Add a mapping between sierra statement indexes and fully qualified paths of cairo functions + /// to debug info. A statement index maps to a function which caused the statement to be + /// generated. Used by [cairo-profiler](https://github.com/software-mansion/cairo-profiler). + /// This feature is unstable and is subject to change. + pub unstable_add_statements_functions_debug_info: bool, } impl DefaultForProfile for ManifestCompilerConfig { @@ -27,6 +32,7 @@ impl DefaultForProfile for ManifestCompilerConfig { sierra_replace_ids: profile.is_dev(), allow_warnings: true, enable_gas: true, + unstable_add_statements_functions_debug_info: false, } } } @@ -37,6 +43,9 @@ impl From for TomlCairo { sierra_replace_ids: Some(config.sierra_replace_ids), allow_warnings: Some(config.allow_warnings), enable_gas: Some(config.enable_gas), + unstable_add_statements_functions_debug_info: Some( + config.unstable_add_statements_functions_debug_info, + ), } } } diff --git a/scarb/src/core/manifest/toml_manifest.rs b/scarb/src/core/manifest/toml_manifest.rs index 5b1d60a4d..df9465340 100644 --- a/scarb/src/core/manifest/toml_manifest.rs +++ b/scarb/src/core/manifest/toml_manifest.rs @@ -313,6 +313,11 @@ pub struct TomlCairo { pub allow_warnings: Option, /// Enable auto gas withdrawal and gas usage check. pub enable_gas: Option, + /// Add a mapping between sierra statement indexes and fully qualified paths of cairo functions + /// to debug info. A statement index maps to a function which caused the statement to be + /// generated. Used by [cairo-profiler](https://github.com/software-mansion/cairo-profiler). + /// This feature is unstable and is subject to change. + pub unstable_add_statements_functions_debug_info: Option, } #[derive(Debug, Default, Deserialize, Serialize, Clone)] @@ -821,6 +826,12 @@ impl TomlManifest { if let Some(enable_gas) = cairo.enable_gas { compiler_config.enable_gas = enable_gas; } + if let Some(unstable_add_statements_functions_debug_info) = + cairo.unstable_add_statements_functions_debug_info + { + compiler_config.unstable_add_statements_functions_debug_info = + unstable_add_statements_functions_debug_info; + } } Ok(compiler_config) } diff --git a/scarb/tests/build.rs b/scarb/tests/build.rs index f0c27401a..7cb0a6d67 100644 --- a/scarb/tests/build.rs +++ b/scarb/tests/build.rs @@ -2,6 +2,8 @@ use std::fs; use assert_fs::prelude::*; use assert_fs::TempDir; +use cairo_lang_sierra::program::VersionedProgram; +use cairo_lang_starknet_classes::contract_class::ContractClass; use indoc::indoc; use predicates::prelude::*; @@ -977,3 +979,106 @@ fn cannot_disable_gas_for_starknet_contract() { error: could not compile `hello` due to previous error "#}); } + +#[test] +fn add_statements_functions_debug_info() { + let t = TempDir::new().unwrap(); + ProjectBuilder::start() + .name("hello") + .lib_cairo(indoc! {r##" + #[starknet::interface] + pub trait IHelloStarknet { + fn increase_balance(ref self: TContractState, amount: felt252); + fn get_balance(self: @TContractState) -> felt252; + } + + #[starknet::contract] + mod HelloStarknet { + #[storage] + struct Storage { + balance: felt252, + } + + #[abi(embed_v0)] + impl HelloStarknetImpl of super::IHelloStarknet { + fn increase_balance(ref self: ContractState, amount: felt252) { + assert(amount != 0, 'Amount cannot be 0'); + self.balance.write(self.balance.read() + amount); + } + + fn get_balance(self: @ContractState) -> felt252 { + self.balance.read() + } + } + } + + fn foo(mut shape: Span) -> usize { + let mut result: usize = 1; + + loop { + match shape.pop_front() { + Option::Some(item) => { result *= *item; }, + Option::None => { break; } + }; + }; + + result + } + + fn main() -> usize { + foo(array![1, 2].span()) + } + "##}) + .manifest_extra(indoc! {r#" + [lib] + casm = true + + [[target.starknet-contract]] + casm = true + + [cairo] + unstable-add-statements-functions-debug-info = true + "#}) + .dep_starknet() + .build(&t); + Scarb::quick_snapbox() + .arg("build") + .current_dir(&t) + .assert() + .success(); + + let lib_sierra_string = t.child("target/dev/hello.sierra.json").read_to_string(); + let contract_sierra_string = t + .child("target/dev/hello_HelloStarknet.contract_class.json") + .read_to_string(); + let lib_sierra = serde_json::from_str::(&lib_sierra_string).unwrap(); + let contract_sierra = serde_json::from_str::(&contract_sierra_string).unwrap(); + + assert!( + lib_sierra + .into_v1() + .unwrap() + .debug_info + .expect("Expected debug info to exist") + .annotations + .get("github.com/software-mansion/cairo-profiler") + .expect("Expected cairo-profiler annotations to exist") + .get("statements_functions") + .expect("Expected statements_functions info to exist") + .is_object(), + "Expected statements_functions info to be a map" + ); + + assert!( + contract_sierra + .sierra_program_debug_info + .expect("Expected debug info to exist") + .annotations + .get("github.com/software-mansion/cairo-profiler") + .expect("Expected cairo-profiler annotations to exist") + .get("statements_functions") + .expect("Expected statements_functions info to exist") + .is_object(), + "Expected statements_functions info to be a map" + ); +} diff --git a/website/docs/reference/manifest.md b/website/docs/reference/manifest.md index 80c857597..4d9083708 100644 --- a/website/docs/reference/manifest.md +++ b/website/docs/reference/manifest.md @@ -33,7 +33,8 @@ If publishing to a registry, it's recommended to fill in additional fields: - [`repository`](#repository) - [`readme`](#readme) -It would also be a good idea to include some [`keywords`](#keywords) and [`categories`](#ca), though they are not required. +It would also be a good idea to include some [`keywords`](#keywords) and [`categories`](#ca), though they are not +required. ### `name` @@ -128,10 +129,11 @@ information about the package. readme = "README.md" ``` -If no value is specified for this field, and a file named `README.md`, `README.txt` or `README` exists in the package root, -then the name of that file will be used. +If no value is specified for this field, and a file named `README.md`, `README.txt` or `README` exists in the package +root, then the name of that file will be used. You can suppress this behavior by setting this field to false. -If the field is set to true, a default value of `README.md` will be assumed, unless file named `README.txt` or `README` exists in the package root, in which case it will be used instead. +If the field is set to true, a default value of `README.md` will be assumed, unless file named `README.txt` or `README` +exists in the package root, in which case it will be used instead. ### `homepage` @@ -275,6 +277,23 @@ enable-gas = false This flag cannot be disabled while compiling the `starknet-contract` target. +### `unstable-add-statements-functions-debug-info` + +> [!WARNING] +> This is highly experimental and unstable feature intended to be used +> by [cairo-profiler](https://github.com/software-mansion/cairo-profiler). +> It may slow down the compilation - it is advised not to use it for other purposes than mentioned in +> [cairo-profiler](https://github.com/software-mansion/cairo-profiler) documentation. + +If enabled, during the project compilation Scarb will add mapping between Sierra statement indexes and fully qualified +paths of Cairo functions to debug info. A statement index maps to a function which caused the statement to be generated. +By default, this flag is disabled. + +```toml +[cairo] +unstable-add-statements-functions-debug-info = true +``` + ## `[profile]` See [Profiles](./profiles) page.