From 70265f9c19509fb617354b12be14ad235e603e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1?= <47506558+MegaRedHand@users.noreply.github.com> Date: Tue, 27 Jun 2023 19:04:26 -0300 Subject: [PATCH 1/7] Ensure no-std for new lambdaworks backend --- .github/workflows/rust.yml | 1 + ensure-no_std/Cargo.toml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c7b9870c02..ece68f79d2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -163,6 +163,7 @@ jobs: - name: Check no-std run: | cd ensure-no_std + cargo build --release --no-default-features cargo build --release tests: diff --git a/ensure-no_std/Cargo.toml b/ensure-no_std/Cargo.toml index aa44835c2a..bc1ee914f5 100644 --- a/ensure-no_std/Cargo.toml +++ b/ensure-no_std/Cargo.toml @@ -11,6 +11,10 @@ cairo-vm = { path = "../vm", default-features = false } wee_alloc = "0.4.5" +[features] +default = ["lambdaworks-felt"] +lambdaworks-felt = ["cairo-felt/lambdaworks-felt"] + [profile.dev] panic = "abort" From e881d245c2a760ec4b4cd623b95c35a90f8df553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1?= <47506558+MegaRedHand@users.noreply.github.com> Date: Tue, 27 Jun 2023 19:10:02 -0300 Subject: [PATCH 2/7] Fix: use correct matrix var name in job --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ece68f79d2..c3e91db408 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -171,7 +171,7 @@ jobs: strategy: fail-fast: false matrix: - special-features: ["", "lambdaworks-felt"] + special_features: ["", "lambdaworks-felt"] target: [ test, test-no_std, test-wasm ] # TODO: features name: Run tests From 2587b4b49f8b03153d3401f3b5599eb6a9b30148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1?= <47506558+MegaRedHand@users.noreply.github.com> Date: Tue, 27 Jun 2023 19:22:10 -0300 Subject: [PATCH 3/7] Remove --release flag in ensure-no_std build --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c3e91db408..3bfbbcd115 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -163,8 +163,8 @@ jobs: - name: Check no-std run: | cd ensure-no_std - cargo build --release --no-default-features - cargo build --release + cargo build --no-default-features + cargo build tests: needs: build-programs From c38ab4ec157f814ac78626dc0a4e68cbd72ca279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1?= <47506558+MegaRedHand@users.noreply.github.com> Date: Wed, 28 Jun 2023 11:30:19 -0300 Subject: [PATCH 4/7] Update lambdaworks to fix-no-std commit --- Cargo.lock | 117 +++++++++++++++++++++--------------------------- felt/Cargo.toml | 2 +- 2 files changed, 53 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 06d004a299..4ec062ea3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -303,9 +303,9 @@ dependencies = [ [[package]] name = "cairo-lang-casm" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "609d537551d96f322307b63863025e939ea87463dc3bb216a9d12dfb6bb4ceea" +checksum = "076a07a68b7f4b3f04e0e23f1e4bee42358abab54929b7842b42108bdb76a164" dependencies = [ "cairo-lang-utils", "indoc", @@ -317,9 +317,9 @@ dependencies = [ [[package]] name = "cairo-lang-compiler" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aac8f0065a777d7b6591956dc238108b873f5c8155c6daa36808679b8407a08" +checksum = "f4b80473e78f8977409c49102727adc3c67a88caed8f3b29b26cf1083cd46456" dependencies = [ "anyhow", "cairo-lang-defs", @@ -334,7 +334,7 @@ dependencies = [ "cairo-lang-sierra-generator", "cairo-lang-syntax", "cairo-lang-utils", - "clap 4.3.8", + "clap 4.3.9", "log", "salsa", "smol_str", @@ -343,15 +343,15 @@ dependencies = [ [[package]] name = "cairo-lang-debug" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65999f741e714e9b3605bae54fbf3816bcc085a68c365132dc944cf3b9603c82" +checksum = "c99d41a14f98521c617c0673a0faa41fd00029d32106a4643e1291a1813340a7" [[package]] name = "cairo-lang-defs" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1905ad17cd5bdc511ec64767bd3b1e187bfd428c8a62928e8c5e87ee3b0bad70" +checksum = "cb26826a8e6f941e0fc8e6193f16607c8042f806232c70c68c91074db30db1b4" dependencies = [ "cairo-lang-debug", "cairo-lang-diagnostics", @@ -367,9 +367,9 @@ dependencies = [ [[package]] name = "cairo-lang-diagnostics" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12338363df11e798507658e7de4d0e9afe7c45db6c411fa7390bad8a12456d83" +checksum = "28403df8c2a71b4a6843ebdb4dc5638f83f33502ac582ee0aa2cda6159ff6fe3" dependencies = [ "cairo-lang-filesystem", "cairo-lang-utils", @@ -379,9 +379,9 @@ dependencies = [ [[package]] name = "cairo-lang-eq-solver" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6de967ad85f599670b636ee955e1554597fba178b133b0dbe38f45d7c477456c" +checksum = "88b9e490c6cd8982f64f854729f311e0ac9e771f34db326e5f7ca94c6113eb12" dependencies = [ "cairo-lang-utils", "good_lp", @@ -391,9 +391,9 @@ dependencies = [ [[package]] name = "cairo-lang-filesystem" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8697f7ada715a7eb2ffbec70ffdeccaa50b37231931c430467d12de0d1d5bf98" +checksum = "a7c753b25ea52163e003e45b169a1bbee4e088e652a7842e839a23d4db41555a" dependencies = [ "cairo-lang-debug", "cairo-lang-utils", @@ -405,9 +405,9 @@ dependencies = [ [[package]] name = "cairo-lang-lowering" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f386695a21ba59a3ed2bb9871e946936d67cd1f0493b6b7e336a47cbdc031d" +checksum = "760f8a8671da260c25e0a9a9576021fa0429de510464a88cf0a59cfd99684270" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -430,9 +430,9 @@ dependencies = [ [[package]] name = "cairo-lang-parser" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85d617fd0b9e85d66ba8cec10ddbfb6842495355f6086f84ae3bb5cacbe6cb35" +checksum = "362f8b3e69398bda34da89a390503d6f760b872071756fab1523ce95f8901612" dependencies = [ "cairo-lang-diagnostics", "cairo-lang-filesystem", @@ -451,9 +451,9 @@ dependencies = [ [[package]] name = "cairo-lang-plugins" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd5daa572e1689c89d889040cda5a1ee769a859d1d30199ec098228eec890d8c" +checksum = "f34a794ce790f1665f1dfb09df3a338460a71f56c29743058f0133954d7ce041" dependencies = [ "cairo-lang-defs", "cairo-lang-diagnostics", @@ -470,9 +470,9 @@ dependencies = [ [[package]] name = "cairo-lang-proc-macros" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2de917c241cf3b9043490412ec4d93c471def7f86fcc72c4f2a06f4f9c2a37b8" +checksum = "9b4db7eb05048fc3150f5be9240aab57f37accc037f0559254421a7c1030fc91" dependencies = [ "cairo-lang-debug", "quote", @@ -481,9 +481,9 @@ dependencies = [ [[package]] name = "cairo-lang-project" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2db21302fa5f00c1951e2e9c14c57ac1f1fa925d1853efdfc43095ae77674daa" +checksum = "c63ecef0c51e853a1c266153941cb027be5c9f6d0ee648b0ba34d1021196b877" dependencies = [ "cairo-lang-filesystem", "serde", @@ -494,9 +494,9 @@ dependencies = [ [[package]] name = "cairo-lang-semantic" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1a77a240188ac3ef5139a7f8f10fd879dcacf205c26ba7708999d8728f0d17d" +checksum = "7628de01172b6f03cd549f9383abb71b94aa5936cfec608a71f2d70c09864f06" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -517,9 +517,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b170053511656c68ce4a1947d3736d7e1008e8031559727017d70661ab9d779" +checksum = "291aac6f05aaec89e8917aec27dada0a949521175508de9a84a690d339f5f366" dependencies = [ "cairo-lang-utils", "const-fnv1a-hash", @@ -540,9 +540,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-ap-change" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ec23f4d6d05e79262873758b09cdcabb323ae4f4ae0dfd6749237a9aee435c7" +checksum = "3f6877217287749828c1c83080aae725ce9e3b9688785d2fbf07ebcf48d49d2a" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -553,9 +553,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-gas" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "757224b576923627d60c74b14993c0d4a9d84118aee5fbcdbd1602a4ec532986" +checksum = "79769f420d004068cb684070d57a08fbdca6f21659b187e025820875f6eb45b6" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -566,9 +566,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-generator" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab0598f66d5866853512ab8e64abc745892d0a1002940845adf132ea2b9b126" +checksum = "47ead862c3fb3c6222e1f49a51e66b0a999a3e9ad8f8ad386d8ed581ddb17228" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -592,9 +592,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-to-casm" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abba31b7e9b78dd2d891b5f12954882ad8080fd9071fd346f8720050e00d0588" +checksum = "41215d5effabb1e1a7760df8fc543077c3344290c26b30ebc03725d501ff88f6" dependencies = [ "anyhow", "assert_matches", @@ -604,7 +604,7 @@ dependencies = [ "cairo-lang-sierra-ap-change", "cairo-lang-sierra-gas", "cairo-lang-utils", - "clap 4.3.8", + "clap 4.3.9", "indoc", "itertools", "log", @@ -615,9 +615,9 @@ dependencies = [ [[package]] name = "cairo-lang-starknet" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b08babd653ecad37e051ad0812b1a7e035cb8dd9e1ae07a2470378ee73acd84" +checksum = "b3f9c68d8ae88af019653816b8da77c634340fb1bdef2c5e39504ef36fe38533" dependencies = [ "anyhow", "cairo-felt 0.3.0-rc1", @@ -637,7 +637,7 @@ dependencies = [ "cairo-lang-sierra-to-casm", "cairo-lang-syntax", "cairo-lang-utils", - "clap 4.3.8", + "clap 4.3.9", "convert_case", "genco", "indoc", @@ -656,9 +656,9 @@ dependencies = [ [[package]] name = "cairo-lang-syntax" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d41c12845b03cb80e99cd6738da254bb504b03acafd1cfa6e32c246ada73358" +checksum = "873cc3224ac5feff1d572897eb6bc137a1faa9826570c3b39f44985b17be3e36" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -673,9 +673,9 @@ dependencies = [ [[package]] name = "cairo-lang-syntax-codegen" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40c7cab29886a9473ede4d07e779597e0892644b85884ce7e419b59b5b4ccd48" +checksum = "c9bbfda9a61c4875a4e487cbf78bbae983a0b18adaaf6c8356ade9f128bbb91f" dependencies = [ "cairo-lang-utils", "genco", @@ -685,9 +685,9 @@ dependencies = [ [[package]] name = "cairo-lang-utils" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36a6e61704fd937cfffe8536cf13739ae772fc0afe118c4105ce2de5780505ae" +checksum = "af180baa613acd5b03179f8766a50087d44702b78c0b49a887fdb06d40226064" dependencies = [ "env_logger", "indexmap", @@ -813,9 +813,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.8" +version = "4.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9394150f5b4273a1763355bd1c2ec54cc5a2593f790587bcd6b2c947cfa9211" +checksum = "bba77a07e4489fb41bd90e8d4201c3eb246b3c2c9ea2ba0bddd6c1d1df87db7d" dependencies = [ "clap_builder", "clap_derive 4.3.2", @@ -824,9 +824,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.8" +version = "4.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a78fbdd3cc2914ddf37ba444114bc7765bbdcb55ec9cbe6fa054f0137400717" +checksum = "2c9b4a88bb4bc35d3d6f65a21b0f0bafe9c894fa00978de242c555ec28bea1c0" dependencies = [ "anstream", "anstyle", @@ -1600,26 +1600,13 @@ dependencies = [ "regex", ] -[[package]] -name = "lambdaworks-gpu" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b233fcb8213965c77f67c07c3e8294539701a2b5fd55a4e05b48ab2210098063" -dependencies = [ - "rand", - "thiserror", -] - [[package]] name = "lambdaworks-math" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000838fc32d61770baebf9e3068606722258cee1490c43f72b1d751bc3c8994d" +source = "git+https://github.com/lambdaclass/lambdaworks.git?rev=4cffcf2#4cffcf26c1e01e24456f4f02178c4c90621ad5f3" dependencies = [ "heapless", - "lambdaworks-gpu", "rand", - "thiserror", ] [[package]] diff --git a/felt/Cargo.toml b/felt/Cargo.toml index 3ec81bc973..3ff3f9a298 100644 --- a/felt/Cargo.toml +++ b/felt/Cargo.toml @@ -19,7 +19,7 @@ lazy_static = { version = "1.4.0", default-features = false, features = [ "spin_no_std", ] } serde = { version = "1.0", features = ["derive"], default-features = false } -lambdaworks-math = { version = "0.1.1", default-features = false, optional=true } +lambdaworks-math = { git = "https://github.com/lambdaclass/lambdaworks.git", rev = "4cffcf2", default-features = false, optional = true } [dev-dependencies] proptest = "1.1.0" From d6eb7e644c1612142ba85659891de600bc0e36cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1?= <47506558+MegaRedHand@users.noreply.github.com> Date: Wed, 28 Jun 2023 11:33:20 -0300 Subject: [PATCH 5/7] Update commit to main --- Cargo.lock | 2 +- felt/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4ec062ea3a..8bb5b74199 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1603,7 +1603,7 @@ dependencies = [ [[package]] name = "lambdaworks-math" version = "0.1.1" -source = "git+https://github.com/lambdaclass/lambdaworks.git?rev=4cffcf2#4cffcf26c1e01e24456f4f02178c4c90621ad5f3" +source = "git+https://github.com/lambdaclass/lambdaworks.git?rev=0a0c7e1#0a0c7e12ab3d0a66aa355b018f138ccd9db1048d" dependencies = [ "heapless", "rand", diff --git a/felt/Cargo.toml b/felt/Cargo.toml index 3ff3f9a298..4ed09bed39 100644 --- a/felt/Cargo.toml +++ b/felt/Cargo.toml @@ -19,7 +19,7 @@ lazy_static = { version = "1.4.0", default-features = false, features = [ "spin_no_std", ] } serde = { version = "1.0", features = ["derive"], default-features = false } -lambdaworks-math = { git = "https://github.com/lambdaclass/lambdaworks.git", rev = "4cffcf2", default-features = false, optional = true } +lambdaworks-math = { git = "https://github.com/lambdaclass/lambdaworks.git", rev = "0a0c7e1", default-features = false, optional = true } [dev-dependencies] proptest = "1.1.0" From 5d4099c206b42d2bbf7e9e9c614c4b4eca0904fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1?= <47506558+MegaRedHand@users.noreply.github.com> Date: Wed, 28 Jun 2023 13:16:49 -0300 Subject: [PATCH 6/7] Bump lambdaworks-math version --- felt/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/felt/Cargo.toml b/felt/Cargo.toml index 1229aad703..00c8e7097e 100644 --- a/felt/Cargo.toml +++ b/felt/Cargo.toml @@ -19,7 +19,7 @@ lazy_static = { version = "1.4.0", default-features = false, features = [ "spin_no_std", ] } serde = { version = "1.0", features = ["derive"], default-features = false } -lambdaworks-math = { version = "0.1.1", default-features = false, optional = true } +lambdaworks-math = { version = "0.1.2", default-features = false, optional = true } [dev-dependencies] proptest = "1.1.0" From 3b7be30ef7872adc6dc8052f1172975fb0fa18bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1?= <47506558+MegaRedHand@users.noreply.github.com> Date: Wed, 28 Jun 2023 13:18:54 -0300 Subject: [PATCH 7/7] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94e9ce7cba..f75ea196f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ #### Upcoming Changes +* fix: bump *lambdaworks-math* to latest version, that fixes no-std support [#1293](https://github.com/lambdaclass/cairo-vm/pull/1293) + * build: remove dependecy to `thiserror` (use `thiserror-no-std/std` instead) * chore: use LambdaWorks' implementation of bit operations for `Felt252` [#1291](https://github.com/lambdaclass/cairo-rs/pull/1291)