From 21e3422b9569f8ac7129fa92f201ab636e15ace1 Mon Sep 17 00:00:00 2001 From: meship-starkware Date: Thu, 2 Jan 2025 13:32:51 +0200 Subject: [PATCH] chore(cairo_native): add cairo version template for native tests --- Cargo.lock | 275 +++++++++--------- Cargo.toml | 1 + crates/blockifier/Cargo.toml | 4 +- .../src/execution/stack_trace_test.rs | 66 +---- crates/blockifier/src/test_utils.rs | 2 + .../src/test_utils/test_templates.rs | 23 ++ 6 files changed, 176 insertions(+), 195 deletions(-) create mode 100644 crates/blockifier/src/test_utils/test_templates.rs diff --git a/Cargo.lock b/Cargo.lock index 780ab3c9672..ed745c2b01b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41056bde53ae10ffbbf11618efbe1e0290859e5eab0fe9ef82ebdb62f12a866f" +checksum = "b0d2ea4d7f220a19c1f8c98822026d1d26a4b75a72e1a7308d02bab1f77c9a00" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -150,7 +150,7 @@ dependencies = [ "itoa", "serde", "serde_json", - "winnow 0.6.20", + "winnow 0.6.21", ] [[package]] @@ -195,9 +195,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c357da577dfb56998d01f574d81ad7a1958d248740a7981b205d69d65a7da404" +checksum = "e79c6b4bcc1067a7394b5b2aec7da1bd829c8c476b796c73eb14da34392a07a7" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -254,9 +254,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6259a506ab13e1d658796c31e6e39d2e2ee89243bcc505ddc613b35732e0a430" +checksum = "0540fd0355d400b59633c27bd4b42173e59943f28e9d3376b77a24771d432d04" dependencies = [ "alloy-rlp", "bytes", @@ -305,7 +305,7 @@ dependencies = [ "futures-utils-wasm", "lru", "pin-project", - "reqwest 0.12.9", + "reqwest 0.12.12", "serde", "serde_json", "thiserror 1.0.69", @@ -333,7 +333,7 @@ checksum = "5a833d97bf8a5f0f878daf2c8451fff7de7f9de38baa5a45d936ec718d81255a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -347,7 +347,7 @@ dependencies = [ "alloy-transport-http", "futures", "pin-project", - "reqwest 0.12.9", + "reqwest 0.12.12", "serde", "serde_json", "tokio", @@ -405,23 +405,23 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9d64f851d95619233f74b310f12bcf16e0cbc27ee3762b6115c14a84809280a" +checksum = "c6d1a14b4a9f6078ad9132775a2ebb465b06b387d60f7413ddc86d7bf7453408" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] name = "alloy-sol-macro-expander" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bf7ed1574b699f48bf17caab4e6e54c6d12bc3c006ab33d58b1e227c1c3559f" +checksum = "4436b4b96d265eb17daea26eb31525c3076d024d10901e446790afbd2f7eeaf5" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", @@ -431,16 +431,16 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c02997ccef5f34f9c099277d4145f183b422938ed5322dc57a089fe9b9ad9ee" +checksum = "e5f58698a18b96faa8513519de112b79a96010b4ff84264ce54a217c52a8e98b" dependencies = [ "alloy-json-abi", "const-hex", @@ -449,25 +449,25 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.91", + "syn 2.0.94", "syn-solidity", ] [[package]] name = "alloy-sol-type-parser" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce13ff37285b0870d0a0746992a4ae48efaf34b766ae4c2640fa15e5305f8e73" +checksum = "1f3d6d2c490f650c5abd65a9a583b09a8c8931c265d3a55b18a8e349dd6d9d84" dependencies = [ "serde", - "winnow 0.6.20", + "winnow 0.6.21", ] [[package]] name = "alloy-sol-types" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1174cafd6c6d810711b4e00383037bdb458efc4fe3dbafafa16567e0320c54d8" +checksum = "c766e4979fc19d70057150befe8e3ea3f0c4cbc6839b8eaaa250803451692305" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -503,7 +503,7 @@ checksum = "a944f5310c690b62bbb3e7e5ce34527cbd36b2d18532a797af123271ce595a49" dependencies = [ "alloy-json-rpc", "alloy-transport", - "reqwest 0.12.9", + "reqwest 0.12.12", "serde_json", "tower 0.5.2", "tracing", @@ -597,7 +597,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -839,7 +839,7 @@ checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", "synstructure", ] @@ -851,7 +851,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -1042,7 +1042,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -1108,7 +1108,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -1125,7 +1125,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -1190,7 +1190,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -1361,7 +1361,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -1383,7 +1383,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.91", + "syn 2.0.94", "which", ] @@ -1404,7 +1404,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -1508,6 +1508,7 @@ dependencies = [ "rand 0.8.5", "regex", "rstest", + "rstest_reuse", "semver 1.0.24", "serde", "serde_json", @@ -1578,9 +1579,9 @@ dependencies = [ [[package]] name = "bon" -version = "3.3.1" +version = "3.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61030e4aaccae9727cc388843dcc7ad1fb9e1ccdef5571e3e8393976b49b74ce" +checksum = "fe7acc34ff59877422326db7d6f2d845a582b16396b6b08194942bf34c6528ab" dependencies = [ "bon-macros", "rustversion", @@ -1588,9 +1589,9 @@ dependencies = [ [[package]] name = "bon-macros" -version = "3.3.1" +version = "3.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67d5d25cc9bd33120702000acc60836db15f06eabc4466230bf79dc80bd0a6ee" +checksum = "4159dd617a7fbc9be6a692fe69dc2954f8e6bb6bb5e4d7578467441390d77fd0" dependencies = [ "darling 0.20.10", "ident_case", @@ -1598,7 +1599,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -1929,7 +1930,7 @@ checksum = "b3c4a161868276ce022c44ac500afbfa0d7d8371106feb40dfca34ea7be97503" dependencies = [ "cairo-lang-debug", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -2410,11 +2411,10 @@ dependencies = [ [[package]] name = "caseless" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808dab3318747be122cb31d36de18d4d1c81277a76f8332a02b81a3d73463d7f" +checksum = "8b6fd507454086c8edfd769ca6ada439193cdb209c7681712ef6275cccbfe5d8" dependencies = [ - "regex", "unicode-normalization", ] @@ -2426,9 +2426,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.5" +version = "1.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e" +checksum = "8d6dbb628b8f8555f86d0323c2eb39e3ec81901f4b83e091db8a6a76d316a333" dependencies = [ "jobserver", "libc", @@ -2575,7 +2575,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -3007,7 +3007,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -3055,7 +3055,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -3077,7 +3077,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -3192,7 +3192,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.1", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -3212,7 +3212,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", "unicode-xid", ] @@ -3308,7 +3308,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -3389,7 +3389,7 @@ dependencies = [ "enum-ordinalize", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -3474,7 +3474,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -3485,7 +3485,7 @@ checksum = "4f4b100e337b021ae69f3e7dd82e230452c54ff833958446c4a3854c66dc9326" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -3505,7 +3505,7 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -3525,7 +3525,7 @@ checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -3701,7 +3701,7 @@ dependencies = [ "reqwest 0.11.27", "serde", "serde_json", - "syn 2.0.91", + "syn 2.0.94", "toml", "walkdir", ] @@ -3719,7 +3719,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -3745,7 +3745,7 @@ dependencies = [ "serde", "serde_json", "strum 0.26.3", - "syn 2.0.91", + "syn 2.0.94", "tempfile", "thiserror 1.0.69", "tiny-keccak", @@ -4220,7 +4220,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -4319,7 +4319,7 @@ checksum = "43eaff6bbc0b3a878361aced5ec6a2818ee7c541c5b33b5880dfa9a86c23e9e7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -4364,9 +4364,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "globset" @@ -4441,9 +4441,9 @@ dependencies = [ [[package]] name = "good_lp" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97630e1e456d7081c524488a87d8f8f7ed0fd3100ba10c55e3cfa7add5ce05c6" +checksum = "10efcd6c7d6f84cb5b4f9155248e0675deab9cfb92d0edbcb25cb81490b65ae7" dependencies = [ "fnv", "microlp", @@ -4461,7 +4461,7 @@ dependencies = [ "google-cloud-token", "home", "jsonwebtoken 9.3.0", - "reqwest 0.12.9", + "reqwest 0.12.12", "serde", "serde_json", "thiserror 1.0.69", @@ -4477,7 +4477,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04f945a208886a13d07636f38fb978da371d0abc3e34bad338124b9f8c135a8f" dependencies = [ - "reqwest 0.12.9", + "reqwest 0.12.12", "thiserror 1.0.69", "tokio", ] @@ -4502,7 +4502,7 @@ dependencies = [ "percent-encoding", "pkcs8", "regex", - "reqwest 0.12.9", + "reqwest 0.12.12", "reqwest-middleware", "ring 0.17.8", "serde", @@ -5142,7 +5142,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -5309,7 +5309,7 @@ checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -6256,7 +6256,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -6540,7 +6540,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.91", + "syn 2.0.94", "tblgen-alt", "unindent 0.2.3", ] @@ -6638,7 +6638,7 @@ checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -6756,7 +6756,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -7262,7 +7262,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -7358,7 +7358,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -7743,7 +7743,7 @@ dependencies = [ "papyrus_test_utils", "prometheus-parse", "quote", - "syn 2.0.91", + "syn 2.0.94", "tracing", ] @@ -8148,7 +8148,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -8192,7 +8192,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -8393,7 +8393,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -8472,7 +8472,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -8527,7 +8527,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -8589,7 +8589,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.91", + "syn 2.0.94", "tempfile", ] @@ -8603,7 +8603,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -8835,9 +8835,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -9192,9 +9192,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.9" +version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" +checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" dependencies = [ "base64 0.22.1", "bytes", @@ -9224,6 +9224,7 @@ dependencies = [ "tokio", "tokio-native-tls", "tokio-util", + "tower 0.5.2", "tower-service", "url", "wasm-bindgen", @@ -9242,7 +9243,7 @@ dependencies = [ "anyhow", "async-trait", "http 1.2.0", - "reqwest 0.12.9", + "reqwest 0.12.12", "serde", "thiserror 1.0.69", "tower-service", @@ -9379,6 +9380,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "rstest_reuse" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a8fb4672e840a587a66fc577a5491375df51ddb88f2a2c2a792598c326fe14" +dependencies = [ + "quote", + "rand 0.8.5", + "syn 2.0.94", +] + [[package]] name = "rtnetlink" version = "0.13.1" @@ -9456,7 +9468,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -9636,9 +9648,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "rusty-fork" @@ -9708,7 +9720,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -9742,7 +9754,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -9851,22 +9863,22 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.216" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -9877,7 +9889,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -9921,7 +9933,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -9969,7 +9981,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -10353,7 +10365,7 @@ checksum = "bbc159a1934c7be9761c237333a57febe060ace2bc9e3b337a59a37af206d19f" dependencies = [ "starknet-curve 0.4.2", "starknet-ff", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -11041,7 +11053,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -11054,7 +11066,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -11096,9 +11108,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.91" +version = "2.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035" +checksum = "987bc0be1cdea8b10216bd06e2ca407d40b9543468fafd3ddfb02f36e77f71f3" dependencies = [ "proc-macro2", "quote", @@ -11107,14 +11119,14 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219389c1ebe89f8333df8bdfb871f6631c552ff399c23cac02480b6088aad8f0" +checksum = "c74af950d86ec0f5b2ae2d7f1590bbfbcf4603a0a15742d8f98132ac4fe3efd4" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -11140,7 +11152,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -11277,7 +11289,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -11288,7 +11300,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", "test-case-core", ] @@ -11311,7 +11323,7 @@ checksum = "5999e24eaa32083191ba4e425deb75cdf25efefabe5aaccb7446dd0d4122a3f5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -11340,7 +11352,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -11351,7 +11363,7 @@ checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -11516,7 +11528,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -11646,7 +11658,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.20", + "winnow 0.6.21", ] [[package]] @@ -11680,6 +11692,7 @@ dependencies = [ "futures-util", "pin-project-lite", "sync_wrapper 1.0.2", + "tokio", "tower-layer", "tower-service", ] @@ -11716,7 +11729,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -11799,7 +11812,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04659ddb06c87d233c566112c1c9c5b9e98256d9af50ec3bc9c8327f873a7568" dependencies = [ "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -12181,7 +12194,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", "wasm-bindgen-shared", ] @@ -12216,7 +12229,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -12637,9 +12650,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.20" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "e6f5bb5257f2407a5425c6e749bfd9692192a73e70a6060516ac04f889087d68" dependencies = [ "memchr", ] @@ -12844,7 +12857,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", "synstructure", ] @@ -12866,7 +12879,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -12886,7 +12899,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", "synstructure", ] @@ -12907,7 +12920,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] @@ -12929,7 +12942,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.94", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 45f967fda7e..46c5612d1dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -202,6 +202,7 @@ reqwest = "0.11" retry = "2.0.0" rlimit = "0.10.2" rstest = "0.17.0" +rstest_reuse = "0.7.0" rustc-hex = "2.1.0" schemars = "0.8.12" semver = "1.0.23" diff --git a/crates/blockifier/Cargo.toml b/crates/blockifier/Cargo.toml index 66b5470e519..5322c6cf845 100644 --- a/crates/blockifier/Cargo.toml +++ b/crates/blockifier/Cargo.toml @@ -14,7 +14,7 @@ cairo_native = ["dep:cairo-native", "dep:stacker", "starknet_sierra_compile/cair jemalloc = ["dep:tikv-jemallocator"] native_blockifier = [] reexecution = ["transaction_serde"] -testing = ["rand", "rstest", "starknet_api/testing"] +testing = ["rand", "rstest","rstest_reuse", "starknet_api/testing"] transaction_serde = [] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -46,6 +46,7 @@ paste.workspace = true phf = { workspace = true, features = ["macros"] } rand = { workspace = true, optional = true } rstest = { workspace = true, optional = true } +rstest_reuse = {workspace = true, optional = true} semver.workspace = true serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true, features = ["arbitrary_precision"] } @@ -70,6 +71,7 @@ pretty_assertions.workspace = true rand.workspace = true regex.workspace = true rstest.workspace = true +rstest_reuse.workspace = true starknet_api = { workspace = true, features = ["testing"] } test-case.workspace = true diff --git a/crates/blockifier/src/execution/stack_trace_test.rs b/crates/blockifier/src/execution/stack_trace_test.rs index 476cf36204a..edc47dcbb95 100644 --- a/crates/blockifier/src/execution/stack_trace_test.rs +++ b/crates/blockifier/src/execution/stack_trace_test.rs @@ -2,6 +2,7 @@ use assert_matches::assert_matches; use pretty_assertions::assert_eq; use regex::Regex; use rstest::rstest; +use rstest_reuse::apply; use starknet_api::abi::abi_utils::selector_from_name; use starknet_api::abi::constants::CONSTRUCTOR_ENTRY_POINT_NAME; use starknet_api::core::{ @@ -44,6 +45,7 @@ use crate::execution::stack_trace::{ use crate::execution::syscalls::hint_processor::ENTRYPOINT_FAILED_ERROR; use crate::test_utils::contracts::FeatureContract; use crate::test_utils::initial_test_state::{fund_account, test_state}; +use crate::test_utils::test_templates::cairo_version; use crate::test_utils::{create_calldata, CairoVersion, RunnableCairo1, BALANCE}; use crate::transaction::account_transaction::{AccountTransaction, ExecutionFlags}; use crate::transaction::test_utils::{ @@ -556,8 +558,7 @@ Error in contract (contract address: {address_felt:#064x}, class hash: {test_con // TODO(Arni, 1/5/2024): Cover version 0 declare transaction. // TODO(Arni, 1/5/2024): Consider version 0 invoke. -#[cfg(not(feature = "cairo_native"))] -#[rstest] +#[apply(cairo_version)] #[case::validate_version_1( TransactionType::InvokeFunction, VALIDATE_ENTRY_POINT_NAME, @@ -597,67 +598,6 @@ fn test_validate_trace( #[case] tx_type: TransactionType, #[case] entry_point_name: &str, #[case] tx_version: TransactionVersion, - #[values(CairoVersion::Cairo0, CairoVersion::Cairo1(RunnableCairo1::Casm))] - cairo_version: CairoVersion, -) { - test_validate_trace_fn(tx_type, entry_point_name, tx_version, cairo_version); -} - -#[cfg(feature = "cairo_native")] -#[rstest] -#[case::validate_version_1( - TransactionType::InvokeFunction, - VALIDATE_ENTRY_POINT_NAME, - TransactionVersion::ONE -)] -#[case::validate_version_3( - TransactionType::InvokeFunction, - VALIDATE_ENTRY_POINT_NAME, - TransactionVersion::THREE -)] -#[case::validate_declare_version_1( - TransactionType::Declare, - VALIDATE_DECLARE_ENTRY_POINT_NAME, - TransactionVersion::ONE -)] -#[case::validate_declare_version_2( - TransactionType::Declare, - VALIDATE_DECLARE_ENTRY_POINT_NAME, - TransactionVersion::TWO -)] -#[case::validate_declare_version_3( - TransactionType::Declare, - VALIDATE_DECLARE_ENTRY_POINT_NAME, - TransactionVersion::THREE -)] -#[case::validate_deploy_version_1( - TransactionType::DeployAccount, - VALIDATE_DEPLOY_ENTRY_POINT_NAME, - TransactionVersion::ONE -)] -#[case::validate_deploy_version_3( - TransactionType::DeployAccount, - VALIDATE_DEPLOY_ENTRY_POINT_NAME, - TransactionVersion::THREE -)] -fn test_validate_trace( - #[case] tx_type: TransactionType, - #[case] entry_point_name: &str, - #[case] tx_version: TransactionVersion, - #[values( - CairoVersion::Cairo0, - CairoVersion::Cairo1(RunnableCairo1::Casm), - CairoVersion::Cairo1(RunnableCairo1::Native) - )] - cairo_version: CairoVersion, -) { - test_validate_trace_fn(tx_type, entry_point_name, tx_version, cairo_version); -} - -fn test_validate_trace_fn( - tx_type: TransactionType, - entry_point_name: &str, - tx_version: TransactionVersion, cairo_version: CairoVersion, ) { let create_for_account_testing = &BlockContext::create_for_account_testing(); diff --git a/crates/blockifier/src/test_utils.rs b/crates/blockifier/src/test_utils.rs index 3c03f63884b..5a97e913ef7 100644 --- a/crates/blockifier/src/test_utils.rs +++ b/crates/blockifier/src/test_utils.rs @@ -6,6 +6,8 @@ pub mod l1_handler; pub mod prices; pub mod struct_impls; pub mod syscall; +#[allow(unused_macros)] +pub mod test_templates; pub mod transfers_generator; use std::collections::HashMap; use std::fs; diff --git a/crates/blockifier/src/test_utils/test_templates.rs b/crates/blockifier/src/test_utils/test_templates.rs new file mode 100644 index 00000000000..9896615b1da --- /dev/null +++ b/crates/blockifier/src/test_utils/test_templates.rs @@ -0,0 +1,23 @@ +use rstest_reuse::template; + +#[cfg(not(feature = "cairo_native"))] +#[template] +#[rstest] +fn cairo_version( + #[values(CairoVersion::Cairo0, CairoVersion::Cairo1(RunnableCairo1::Casm))] + cairo_version: CairoVersion, +) { +} + +#[cfg(feature = "cairo_native")] +#[template] +#[rstest] +fn cairo_version( + #[values( + CairoVersion::Cairo0, + CairoVersion::Cairo1(RunnableCairo1::Casm), + CairoVersion::Cairo1(RunnableCairo1::Native) + )] + cairo_version: CairoVersion, +) { +}