From aad482f811dcda60eac93a1a594b467f5c46f484 Mon Sep 17 00:00:00 2001 From: Pia Date: Sat, 20 Jul 2024 22:49:24 +0200 Subject: [PATCH 01/39] wip nostd --- Cargo.lock | 69 ++++++++++++++----- Cargo.toml | 4 +- cli/Cargo.toml | 3 +- crates/air/Cargo.toml | 2 +- crates/air/src/fixtures/decommitment.rs | 1 + crates/air/src/fixtures/public_input.rs | 1 + crates/air/src/fixtures/witness.rs | 1 + crates/air/src/layout/dex/mod.rs | 2 + crates/air/src/layout/mod.rs | 2 +- crates/air/src/layout/recursive/mod.rs | 2 + .../src/layout/recursive_with_poseidon/mod.rs | 2 + crates/air/src/layout/small/mod.rs | 2 + crates/air/src/layout/starknet/mod.rs | 2 + .../src/layout/starknet_with_keccak/mod.rs | 2 + crates/air/src/lib.rs | 4 ++ crates/air/src/public_memory.rs | 2 + crates/air/src/trace/config.rs | 2 +- crates/air/src/trace/decommit.rs | 2 +- crates/air/src/types.rs | 4 +- crates/commitment/Cargo.toml | 2 +- crates/commitment/src/lib.rs | 4 ++ crates/commitment/src/table/commit.rs | 1 + crates/commitment/src/table/decommit.rs | 3 +- .../table/tests/table_commitment_commit.rs | 1 + crates/commitment/src/table/types.rs | 1 + crates/commitment/src/vector/config.rs | 2 +- crates/commitment/src/vector/decommit.rs | 3 +- .../vector/tests/vector_commitment_commit.rs | 1 + .../tests/vector_commitment_decommit.rs | 1 + crates/commitment/src/vector/types.rs | 1 + crates/fri/Cargo.toml | 2 +- crates/fri/src/config.rs | 3 +- crates/fri/src/first_layer.rs | 1 + crates/fri/src/fixtures/commitment.rs | 1 + crates/fri/src/fixtures/config.rs | 1 + crates/fri/src/fixtures/decommitment.rs | 1 + .../src/fixtures/last_layer_coefficients.rs | 2 + crates/fri/src/fixtures/queries.rs | 2 + crates/fri/src/fixtures/unsent_commitment.rs | 1 + crates/fri/src/fixtures/witness.rs | 2 +- crates/fri/src/formula.rs | 3 +- crates/fri/src/fri.rs | 12 ++-- crates/fri/src/group.rs | 2 + crates/fri/src/last_layer.rs | 6 +- crates/fri/src/layer.rs | 3 +- crates/fri/src/lib.rs | 4 ++ crates/fri/src/tests/decommit.rs | 1 + crates/fri/src/tests/formula.rs | 1 + crates/fri/src/tests/last_layer.rs | 1 + crates/fri/src/tests/next_layer.rs | 1 + crates/fri/src/types.rs | 1 + crates/pow/Cargo.toml | 2 +- crates/pow/src/config.rs | 2 +- crates/pow/src/lib.rs | 4 ++ crates/pow/src/pow.rs | 3 +- crates/stark/Cargo.toml | 22 +++--- crates/stark/src/commit.rs | 3 +- crates/stark/src/config.rs | 2 +- crates/stark/src/fixtures/commitment.rs | 1 + .../src/fixtures/constraint_coefficients.rs | 2 + crates/stark/src/fixtures/oods_values.rs | 2 + crates/stark/src/fixtures/witness.rs | 1 + crates/stark/src/lib.rs | 4 ++ crates/stark/src/oods.rs | 3 +- crates/stark/src/queries.rs | 1 + crates/stark/src/stark.rs | 2 +- crates/stark/src/types.rs | 1 + crates/stark/src/verify.rs | 19 +++++ crates/transcript/Cargo.toml | 6 +- crates/transcript/src/lib.rs | 4 ++ .../src/tests/random_felts_to_prover.rs | 1 + .../src/tests/read_felt_vector_from_prover.rs | 1 + crates/transcript/src/transcript.rs | 2 + proof-parser/Cargo.toml | 4 +- 74 files changed, 208 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fc17d1a..c3ff4db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -146,7 +146,7 @@ dependencies = [ "serde_with", "starknet-core", "starknet-crypto", - "thiserror", + "thiserror-no-std", ] [[package]] @@ -158,7 +158,6 @@ dependencies = [ "cairovm_verifier_stark", "clap", "starknet-crypto", - "thiserror", ] [[package]] @@ -174,7 +173,7 @@ dependencies = [ "starknet-core", "starknet-crypto", "starknet-types-core", - "thiserror", + "thiserror-no-std", ] [[package]] @@ -189,7 +188,7 @@ dependencies = [ "sha3", "starknet-core", "starknet-crypto", - "thiserror", + "thiserror-no-std", ] [[package]] @@ -203,7 +202,7 @@ dependencies = [ "sha3", "starknet-crypto", "starknet-types-core", - "thiserror", + "thiserror-no-std", ] [[package]] @@ -222,7 +221,7 @@ dependencies = [ "serde", "serde_json", "starknet-types-core", - "thiserror", + "thiserror-no-std", ] [[package]] @@ -240,6 +239,7 @@ dependencies = [ "starknet-core", "starknet-crypto", "thiserror", + "thiserror-no-std", "wasm-bindgen", ] @@ -318,7 +318,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.71", ] [[package]] @@ -400,7 +400,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 2.0.71", ] [[package]] @@ -411,7 +411,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn", + "syn 2.0.71", ] [[package]] @@ -756,7 +756,7 @@ checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.71", ] [[package]] @@ -806,7 +806,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn", + "syn 2.0.71", ] [[package]] @@ -877,7 +877,7 @@ checksum = "2e179dedc3fa6da064e56811d3e05d446aa2f7459e4eb0e3e49378a337235437" dependencies = [ "starknet-curve", "starknet-types-core", - "syn", + "syn 2.0.71", ] [[package]] @@ -915,6 +915,17 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.71" @@ -928,22 +939,42 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.62" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.62" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.71", +] + +[[package]] +name = "thiserror-impl-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "thiserror-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" +dependencies = [ + "thiserror-impl-no-std", ] [[package]] @@ -1028,7 +1059,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.71", "wasm-bindgen-shared", ] @@ -1050,7 +1081,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.71", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/Cargo.toml b/Cargo.toml index a4f49bb..12e9cce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,8 @@ members = [ "crates/pow", "crates/stark", "proof-parser", - "cli", "wasm-binding", + "cli", + "wasm-binding", ] exclude = [] @@ -34,6 +35,7 @@ starknet-core = "0.11.1" starknet-crypto = "0.7.1" starknet-types-core = "0.1.5" crypto-bigint = "0.5.5" +thiserror-no-std = "=2.0.2" thiserror = "1.0.61" num-bigint = { version = "0.4.4", features = ["serde"] } blake2 = "0.10.6" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index e5eeb7b..0885702 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -10,7 +10,6 @@ version.workspace = true [dependencies] clap = { version = "4.4.4", features = ["derive"] } -thiserror.workspace = true starknet-crypto.workspace = true cairovm_verifier_air = { workspace = true, default-features = false } @@ -26,4 +25,4 @@ small = [] starknet = [] starknet_with_keccak = [] keccak = [] -blake2s = [] \ No newline at end of file +blake2s = [] diff --git a/crates/air/Cargo.toml b/crates/air/Cargo.toml index d8b9073..a9998ad 100644 --- a/crates/air/Cargo.toml +++ b/crates/air/Cargo.toml @@ -14,7 +14,7 @@ serde_with.workspace = true serde.workspace = true starknet-core.workspace = true starknet-crypto.workspace = true -thiserror.workspace = true +thiserror-no-std.workspace = true cairovm_verifier_commitment.workspace = true cairovm_verifier_transcript.workspace = true diff --git a/crates/air/src/fixtures/decommitment.rs b/crates/air/src/fixtures/decommitment.rs index bdfe6da..77ba6b6 100644 --- a/crates/air/src/fixtures/decommitment.rs +++ b/crates/air/src/fixtures/decommitment.rs @@ -1,3 +1,4 @@ +use alloc::vec; use cairovm_verifier_commitment::table; use starknet_crypto::Felt; diff --git a/crates/air/src/fixtures/public_input.rs b/crates/air/src/fixtures/public_input.rs index 4951e0f..5d7fe42 100644 --- a/crates/air/src/fixtures/public_input.rs +++ b/crates/air/src/fixtures/public_input.rs @@ -2,6 +2,7 @@ use crate::{ public_memory::PublicInput, types::{AddrValue, Page, SegmentInfo}, }; +use alloc::vec; use starknet_crypto::Felt; pub fn get() -> PublicInput { diff --git a/crates/air/src/fixtures/witness.rs b/crates/air/src/fixtures/witness.rs index cc86fe5..db6543e 100644 --- a/crates/air/src/fixtures/witness.rs +++ b/crates/air/src/fixtures/witness.rs @@ -1,4 +1,5 @@ use crate::trace::Witness; +use alloc::vec; use cairovm_verifier_commitment::{table, vector}; use starknet_crypto::Felt; diff --git a/crates/air/src/layout/dex/mod.rs b/crates/air/src/layout/dex/mod.rs index 873f1c4..7d8dc5b 100644 --- a/crates/air/src/layout/dex/mod.rs +++ b/crates/air/src/layout/dex/mod.rs @@ -6,6 +6,8 @@ use crate::{ periodic_columns::{eval_ecdsa_x, eval_ecdsa_y, eval_pedersen_x, eval_pedersen_y}, public_memory::{PublicInput, INITIAL_PC, MAX_ADDRESS, MAX_LOG_N_STEPS, MAX_RANGE_CHECK}, }; +use alloc::vec; +use alloc::vec::Vec; use bail_out::ensure; use cairovm_verifier_commitment::table::{commit::table_commit, decommit::table_decommit}; use global_values::{EcPoint, EcdsaSigConfig, GlobalValues, InteractionElements}; diff --git a/crates/air/src/layout/mod.rs b/crates/air/src/layout/mod.rs index 96d032c..633a23c 100644 --- a/crates/air/src/layout/mod.rs +++ b/crates/air/src/layout/mod.rs @@ -70,7 +70,7 @@ pub trait LayoutTrait { fn verify_public_input(public_input: &PublicInput) -> Result<(Felt, Felt), PublicInputError>; } -use thiserror::Error; +use thiserror_no_std::Error; #[derive(Error, Debug)] pub enum CompositionPolyEvalError { diff --git a/crates/air/src/layout/recursive/mod.rs b/crates/air/src/layout/recursive/mod.rs index 426612b..6eb0f8e 100644 --- a/crates/air/src/layout/recursive/mod.rs +++ b/crates/air/src/layout/recursive/mod.rs @@ -6,6 +6,8 @@ use crate::{ periodic_columns::{eval_pedersen_x, eval_pedersen_y}, public_memory::{PublicInput, INITIAL_PC, MAX_ADDRESS, MAX_LOG_N_STEPS, MAX_RANGE_CHECK}, }; +use alloc::vec; +use alloc::vec::Vec; use bail_out::ensure; use cairovm_verifier_commitment::table::{commit::table_commit, decommit::table_decommit}; use global_values::{EcPoint, GlobalValues, InteractionElements}; diff --git a/crates/air/src/layout/recursive_with_poseidon/mod.rs b/crates/air/src/layout/recursive_with_poseidon/mod.rs index 84fb424..45f279a 100644 --- a/crates/air/src/layout/recursive_with_poseidon/mod.rs +++ b/crates/air/src/layout/recursive_with_poseidon/mod.rs @@ -10,6 +10,8 @@ use crate::{ }, public_memory::{PublicInput, INITIAL_PC, MAX_ADDRESS, MAX_LOG_N_STEPS, MAX_RANGE_CHECK}, }; +use alloc::vec; +use alloc::vec::Vec; use bail_out::ensure; use cairovm_verifier_commitment::table::{commit::table_commit, decommit::table_decommit}; use global_values::{EcPoint, GlobalValues, InteractionElements}; diff --git a/crates/air/src/layout/small/mod.rs b/crates/air/src/layout/small/mod.rs index f51020c..1ff6633 100644 --- a/crates/air/src/layout/small/mod.rs +++ b/crates/air/src/layout/small/mod.rs @@ -6,6 +6,8 @@ use crate::{ periodic_columns::{eval_ecdsa_x, eval_ecdsa_y, eval_pedersen_x, eval_pedersen_y}, public_memory::{PublicInput, INITIAL_PC, MAX_ADDRESS, MAX_LOG_N_STEPS, MAX_RANGE_CHECK}, }; +use alloc::vec; +use alloc::vec::Vec; use bail_out::ensure; use cairovm_verifier_commitment::table::{commit::table_commit, decommit::table_decommit}; use global_values::{EcPoint, EcdsaSigConfig, GlobalValues, InteractionElements}; diff --git a/crates/air/src/layout/starknet/mod.rs b/crates/air/src/layout/starknet/mod.rs index 8d63c49..8b329b2 100644 --- a/crates/air/src/layout/starknet/mod.rs +++ b/crates/air/src/layout/starknet/mod.rs @@ -12,6 +12,8 @@ use crate::{ }, public_memory::{PublicInput, INITIAL_PC, MAX_ADDRESS, MAX_LOG_N_STEPS, MAX_RANGE_CHECK}, }; +use alloc::vec; +use alloc::vec::Vec; use bail_out::ensure; use cairovm_verifier_commitment::table::{commit::table_commit, decommit::table_decommit}; use global_values::{CurveConfig, EcPoint, EcdsaSigConfig, GlobalValues, InteractionElements}; diff --git a/crates/air/src/layout/starknet_with_keccak/mod.rs b/crates/air/src/layout/starknet_with_keccak/mod.rs index 8f542b3..85088be 100644 --- a/crates/air/src/layout/starknet_with_keccak/mod.rs +++ b/crates/air/src/layout/starknet_with_keccak/mod.rs @@ -14,6 +14,8 @@ use crate::{ }, public_memory::{PublicInput, INITIAL_PC, MAX_ADDRESS, MAX_LOG_N_STEPS, MAX_RANGE_CHECK}, }; +use alloc::vec; +use alloc::vec::Vec; use bail_out::ensure; use cairovm_verifier_commitment::table::{commit::table_commit, decommit::table_decommit}; use global_values::{CurveConfig, EcPoint, EcdsaSigConfig, GlobalValues, InteractionElements}; diff --git a/crates/air/src/lib.rs b/crates/air/src/lib.rs index 33f8329..ae4b722 100644 --- a/crates/air/src/lib.rs +++ b/crates/air/src/lib.rs @@ -1,3 +1,7 @@ +#![no_std] + +extern crate alloc; + pub mod diluted; pub mod domains; pub mod fixtures; diff --git a/crates/air/src/public_memory.rs b/crates/air/src/public_memory.rs index a4ef76e..f12ac1e 100644 --- a/crates/air/src/public_memory.rs +++ b/crates/air/src/public_memory.rs @@ -1,4 +1,6 @@ use crate::types::{ContinuousPageHeader, Page, SegmentInfo}; +use alloc::vec; +use alloc::vec::Vec; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_core::{serde::unsigned_field_element::UfeHex, types::NonZeroFelt}; diff --git a/crates/air/src/trace/config.rs b/crates/air/src/trace/config.rs index b6fedf9..8baf75d 100644 --- a/crates/air/src/trace/config.rs +++ b/crates/air/src/trace/config.rs @@ -57,7 +57,7 @@ impl Config { } } -use thiserror::Error; +use thiserror_no_std::Error; #[derive(Error, Debug)] pub enum Error { diff --git a/crates/air/src/trace/decommit.rs b/crates/air/src/trace/decommit.rs index fd01ccf..b165934 100644 --- a/crates/air/src/trace/decommit.rs +++ b/crates/air/src/trace/decommit.rs @@ -1,5 +1,5 @@ use cairovm_verifier_commitment::table; -use thiserror::Error; +use thiserror_no_std::Error; #[derive(Error, Debug)] pub enum Error { diff --git a/crates/air/src/types.rs b/crates/air/src/types.rs index 8c48688..44d7ecc 100644 --- a/crates/air/src/types.rs +++ b/crates/air/src/types.rs @@ -1,5 +1,5 @@ -use std::ops::Deref; - +use alloc::vec::Vec; +use core::ops::Deref; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_core::serde::unsigned_field_element::UfeHex; diff --git a/crates/commitment/Cargo.toml b/crates/commitment/Cargo.toml index 5b1b014..987f8bb 100644 --- a/crates/commitment/Cargo.toml +++ b/crates/commitment/Cargo.toml @@ -15,7 +15,7 @@ sha3.workspace = true starknet-core.workspace = true starknet-types-core.workspace = true starknet-crypto.workspace = true -thiserror.workspace = true +thiserror-no-std.workspace = true crypto-bigint.workspace = true blake2.workspace = true diff --git a/crates/commitment/src/lib.rs b/crates/commitment/src/lib.rs index 5ac2503..1263a87 100644 --- a/crates/commitment/src/lib.rs +++ b/crates/commitment/src/lib.rs @@ -1,2 +1,6 @@ +#![no_std] + +extern crate alloc; + pub mod table; pub mod vector; diff --git a/crates/commitment/src/table/commit.rs b/crates/commitment/src/table/commit.rs index 5a3d50b..3eb92cd 100644 --- a/crates/commitment/src/table/commit.rs +++ b/crates/commitment/src/table/commit.rs @@ -1,5 +1,6 @@ use super::{config::Config, types::Commitment}; use crate::vector::commit::vector_commit; +use alloc::borrow::ToOwned; use cairovm_verifier_transcript::transcript::Transcript; use starknet_crypto::Felt; diff --git a/crates/commitment/src/table/decommit.rs b/crates/commitment/src/table/decommit.rs index d1b2a4e..8f54898 100644 --- a/crates/commitment/src/table/decommit.rs +++ b/crates/commitment/src/table/decommit.rs @@ -1,6 +1,7 @@ use crate::vector::{decommit::vector_commitment_decommit, types::Query}; +use alloc::vec::Vec; use starknet_crypto::{poseidon_hash_many, Felt}; -use thiserror::Error; +use thiserror_no_std::Error; #[cfg(feature = "blake2s")] use blake2::Blake2s256; diff --git a/crates/commitment/src/table/tests/table_commitment_commit.rs b/crates/commitment/src/table/tests/table_commitment_commit.rs index 7dc8508..1721402 100644 --- a/crates/commitment/src/table/tests/table_commitment_commit.rs +++ b/crates/commitment/src/table/tests/table_commitment_commit.rs @@ -1,3 +1,4 @@ +use alloc::borrow::ToOwned; use cairovm_verifier_transcript::transcript::Transcript; use starknet_crypto::Felt; diff --git a/crates/commitment/src/table/types.rs b/crates/commitment/src/table/types.rs index de70480..1d8b0e0 100644 --- a/crates/commitment/src/table/types.rs +++ b/crates/commitment/src/table/types.rs @@ -1,5 +1,6 @@ use super::config::Config; use crate::vector; +use alloc::vec::Vec; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_core::serde::unsigned_field_element::UfeHex; diff --git a/crates/commitment/src/vector/config.rs b/crates/commitment/src/vector/config.rs index d21b431..5ffdc60 100644 --- a/crates/commitment/src/vector/config.rs +++ b/crates/commitment/src/vector/config.rs @@ -34,7 +34,7 @@ impl Config { } } -use thiserror::Error; +use thiserror_no_std::Error; #[derive(Error, Debug)] pub enum Error { diff --git a/crates/commitment/src/vector/decommit.rs b/crates/commitment/src/vector/decommit.rs index 6f67d1c..31d0cfe 100644 --- a/crates/commitment/src/vector/decommit.rs +++ b/crates/commitment/src/vector/decommit.rs @@ -1,4 +1,5 @@ use super::types::{Commitment, Query, QueryWithDepth, Witness}; +use alloc::vec::Vec; #[cfg(feature = "blake2s")] use blake2::Blake2s256; #[cfg(feature = "blake2s")] @@ -9,7 +10,7 @@ use sha3::Digest; use sha3::Keccak256; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash, Felt}; -use thiserror::Error; +use thiserror_no_std::Error; pub fn vector_commitment_decommit( commitment: Commitment, diff --git a/crates/commitment/src/vector/tests/vector_commitment_commit.rs b/crates/commitment/src/vector/tests/vector_commitment_commit.rs index 8393d8b..03b5d4b 100644 --- a/crates/commitment/src/vector/tests/vector_commitment_commit.rs +++ b/crates/commitment/src/vector/tests/vector_commitment_commit.rs @@ -1,3 +1,4 @@ +use alloc::borrow::ToOwned; use cairovm_verifier_transcript::transcript::Transcript; use starknet_crypto::Felt; diff --git a/crates/commitment/src/vector/tests/vector_commitment_decommit.rs b/crates/commitment/src/vector/tests/vector_commitment_decommit.rs index a853410..8db16f2 100644 --- a/crates/commitment/src/vector/tests/vector_commitment_decommit.rs +++ b/crates/commitment/src/vector/tests/vector_commitment_decommit.rs @@ -1,3 +1,4 @@ +use alloc::vec; use starknet_crypto::Felt; use crate::vector::{ diff --git a/crates/commitment/src/vector/types.rs b/crates/commitment/src/vector/types.rs index bd00b32..ea2a575 100644 --- a/crates/commitment/src/vector/types.rs +++ b/crates/commitment/src/vector/types.rs @@ -1,4 +1,5 @@ use super::config::Config; +use alloc::vec::Vec; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_core::serde::unsigned_field_element::UfeHex; diff --git a/crates/fri/Cargo.toml b/crates/fri/Cargo.toml index 7d94f38..85809a5 100644 --- a/crates/fri/Cargo.toml +++ b/crates/fri/Cargo.toml @@ -14,7 +14,7 @@ serde.workspace = true sha3.workspace = true starknet-core.workspace = true starknet-crypto.workspace = true -thiserror.workspace = true +thiserror-no-std.workspace = true cairovm_verifier_air.workspace = true cairovm_verifier_commitment.workspace = true diff --git a/crates/fri/src/config.rs b/crates/fri/src/config.rs index b1c977d..7bd59cd 100644 --- a/crates/fri/src/config.rs +++ b/crates/fri/src/config.rs @@ -1,3 +1,4 @@ +use alloc::vec::Vec; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_core::serde::unsigned_field_element::UfeHex; @@ -85,7 +86,7 @@ impl Config { } } -use thiserror::Error; +use thiserror_no_std::Error; #[derive(Error, Debug)] pub enum Error { diff --git a/crates/fri/src/first_layer.rs b/crates/fri/src/first_layer.rs index 6c031b8..98be1dc 100644 --- a/crates/fri/src/first_layer.rs +++ b/crates/fri/src/first_layer.rs @@ -1,3 +1,4 @@ +use alloc::vec::Vec; use starknet_core::types::NonZeroFelt; use starknet_crypto::Felt; diff --git a/crates/fri/src/fixtures/commitment.rs b/crates/fri/src/fixtures/commitment.rs index 9acecaf..7716f36 100644 --- a/crates/fri/src/fixtures/commitment.rs +++ b/crates/fri/src/fixtures/commitment.rs @@ -1,3 +1,4 @@ +use alloc::vec; use cairovm_verifier_commitment::{ table::{config::Config as TableCommitmentConfig, types::Commitment as TableCommitment}, vector::{config::Config as VectorCommitmentConfig, types::Commitment as VectorCommitment}, diff --git a/crates/fri/src/fixtures/config.rs b/crates/fri/src/fixtures/config.rs index d4b78b1..9429320 100644 --- a/crates/fri/src/fixtures/config.rs +++ b/crates/fri/src/fixtures/config.rs @@ -1,4 +1,5 @@ use crate::config::Config; +use alloc::vec; use cairovm_verifier_commitment::{table, vector}; use starknet_crypto::Felt; diff --git a/crates/fri/src/fixtures/decommitment.rs b/crates/fri/src/fixtures/decommitment.rs index 5704a1f..be089da 100644 --- a/crates/fri/src/fixtures/decommitment.rs +++ b/crates/fri/src/fixtures/decommitment.rs @@ -1,3 +1,4 @@ +use alloc::vec; use starknet_crypto::Felt; use crate::types::Decommitment as FriDecommitment; diff --git a/crates/fri/src/fixtures/last_layer_coefficients.rs b/crates/fri/src/fixtures/last_layer_coefficients.rs index 82bc841..5375348 100644 --- a/crates/fri/src/fixtures/last_layer_coefficients.rs +++ b/crates/fri/src/fixtures/last_layer_coefficients.rs @@ -1,3 +1,5 @@ +use alloc::vec; +use alloc::vec::Vec; use starknet_crypto::Felt; pub fn get() -> Vec { diff --git a/crates/fri/src/fixtures/queries.rs b/crates/fri/src/fixtures/queries.rs index 8ccf445..342957e 100644 --- a/crates/fri/src/fixtures/queries.rs +++ b/crates/fri/src/fixtures/queries.rs @@ -1,3 +1,5 @@ +use alloc::vec; +use alloc::vec::Vec; use starknet_crypto::Felt; pub fn get() -> Vec { diff --git a/crates/fri/src/fixtures/unsent_commitment.rs b/crates/fri/src/fixtures/unsent_commitment.rs index fcf0283..7ab508f 100644 --- a/crates/fri/src/fixtures/unsent_commitment.rs +++ b/crates/fri/src/fixtures/unsent_commitment.rs @@ -1,3 +1,4 @@ +use alloc::vec; use starknet_crypto::Felt; use super::*; diff --git a/crates/fri/src/fixtures/witness.rs b/crates/fri/src/fixtures/witness.rs index aea8e37..14b069c 100644 --- a/crates/fri/src/fixtures/witness.rs +++ b/crates/fri/src/fixtures/witness.rs @@ -1,4 +1,4 @@ -use std::vec; +use alloc::vec; use crate::types::{LayerWitness, Witness}; use cairovm_verifier_commitment::{ diff --git a/crates/fri/src/formula.rs b/crates/fri/src/formula.rs index b3ebfb4..5980258 100644 --- a/crates/fri/src/formula.rs +++ b/crates/fri/src/formula.rs @@ -1,3 +1,4 @@ +use alloc::vec::Vec; use starknet_crypto::Felt; // Constants representing primitive roots of unity for orders 2, 4, 8, and 16. @@ -91,7 +92,7 @@ pub fn fri_formula( } } -use thiserror::Error; +use thiserror_no_std::Error; #[derive(Error, Debug)] pub enum Error { diff --git a/crates/fri/src/fri.rs b/crates/fri/src/fri.rs index 0454dc1..b6b95e0 100644 --- a/crates/fri/src/fri.rs +++ b/crates/fri/src/fri.rs @@ -1,3 +1,4 @@ +use alloc::{borrow::ToOwned, vec::Vec}; use cairovm_verifier_commitment::table::{ commit::table_commit, config::Config as TableCommitmentConfig, @@ -11,7 +12,7 @@ use crate::{ config::Config as FriConfig, first_layer::gather_first_layer_queries, group::get_fri_group, - last_layer::{self, verify_last_layer}, + last_layer::verify_last_layer, layer::{compute_next_layer, FriLayerComputationParams, FriLayerQuery}, types::{ self, Commitment as FriCommitment, Decommitment as FriDecommitment, LayerWitness, Witness, @@ -175,11 +176,12 @@ pub fn fri_verify( return Err(Error::InvalidValue); }; - verify_last_layer(last_queries, commitment.last_layer_coefficients)?; + verify_last_layer(last_queries, commitment.last_layer_coefficients) + .map_err(|_| Error::LastLayerVerificationError)?; Ok(()) } -use thiserror::Error; +use thiserror_no_std::Error; #[derive(Error, Debug)] pub enum Error { @@ -189,6 +191,6 @@ pub enum Error { #[error("Invalid value")] InvalidValue, - #[error("Last layer verification error: {0}")] - LastLayerVerificationError(#[from] last_layer::Error), + #[error("Last layer verification error")] + LastLayerVerificationError, } diff --git a/crates/fri/src/group.rs b/crates/fri/src/group.rs index 0c08fd9..74933a2 100644 --- a/crates/fri/src/group.rs +++ b/crates/fri/src/group.rs @@ -1,3 +1,5 @@ +use alloc::vec; +use alloc::vec::Vec; use starknet_crypto::Felt; // Returns the elements of the multiplicative subgroup of order 16, in bit-reversed order for the diff --git a/crates/fri/src/last_layer.rs b/crates/fri/src/last_layer.rs index 30ffd84..b91eb39 100644 --- a/crates/fri/src/last_layer.rs +++ b/crates/fri/src/last_layer.rs @@ -1,3 +1,4 @@ +use alloc::vec::Vec; use starknet_core::types::NonZeroFelt; use starknet_crypto::Felt; @@ -33,7 +34,7 @@ fn horner_eval(coefs: &[Felt], point: Felt) -> Felt { result } -use thiserror::Error; +use thiserror_no_std::Error; #[derive(Error, Debug)] pub enum Error { @@ -43,7 +44,8 @@ pub enum Error { #[cfg(test)] mod tests { - use std::vec; + use alloc::vec; + use alloc::vec::Vec; use super::*; diff --git a/crates/fri/src/layer.rs b/crates/fri/src/layer.rs index e7616ac..9574d05 100644 --- a/crates/fri/src/layer.rs +++ b/crates/fri/src/layer.rs @@ -1,3 +1,4 @@ +use alloc::vec::Vec; use starknet_crypto::Felt; pub struct FriLayerComputationParams { @@ -105,7 +106,7 @@ pub fn compute_next_layer( Ok((next_queries, verify_indices, verify_y_values)) } -use thiserror::Error; +use thiserror_no_std::Error; use crate::formula::fri_formula; diff --git a/crates/fri/src/lib.rs b/crates/fri/src/lib.rs index 526ef58..61a9752 100644 --- a/crates/fri/src/lib.rs +++ b/crates/fri/src/lib.rs @@ -1,3 +1,7 @@ +#![no_std] + +extern crate alloc; + pub mod config; pub mod first_layer; pub mod fixtures; diff --git a/crates/fri/src/tests/decommit.rs b/crates/fri/src/tests/decommit.rs index 5704a1f..be089da 100644 --- a/crates/fri/src/tests/decommit.rs +++ b/crates/fri/src/tests/decommit.rs @@ -1,3 +1,4 @@ +use alloc::vec; use starknet_crypto::Felt; use crate::types::Decommitment as FriDecommitment; diff --git a/crates/fri/src/tests/formula.rs b/crates/fri/src/tests/formula.rs index 54f09ef..7d5ecbd 100644 --- a/crates/fri/src/tests/formula.rs +++ b/crates/fri/src/tests/formula.rs @@ -1,4 +1,5 @@ use crate::formula::fri_formula; +use alloc::vec; use starknet_crypto::Felt; #[test] diff --git a/crates/fri/src/tests/last_layer.rs b/crates/fri/src/tests/last_layer.rs index 25b347c..47d59fa 100644 --- a/crates/fri/src/tests/last_layer.rs +++ b/crates/fri/src/tests/last_layer.rs @@ -1,3 +1,4 @@ +use alloc::vec; use starknet_crypto::Felt; use crate::{last_layer::verify_last_layer, layer::FriLayerQuery}; diff --git a/crates/fri/src/tests/next_layer.rs b/crates/fri/src/tests/next_layer.rs index 2376132..43933e8 100644 --- a/crates/fri/src/tests/next_layer.rs +++ b/crates/fri/src/tests/next_layer.rs @@ -1,3 +1,4 @@ +use alloc::vec; use starknet_crypto::Felt; use crate::{ diff --git a/crates/fri/src/types.rs b/crates/fri/src/types.rs index 020b319..6206d99 100644 --- a/crates/fri/src/types.rs +++ b/crates/fri/src/types.rs @@ -1,4 +1,5 @@ use crate::config::Config; +use alloc::vec::Vec; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_core::serde::unsigned_field_element::UfeHex; diff --git a/crates/pow/Cargo.toml b/crates/pow/Cargo.toml index 3e4777f..75ffa45 100644 --- a/crates/pow/Cargo.toml +++ b/crates/pow/Cargo.toml @@ -14,7 +14,7 @@ serde.workspace = true sha3.workspace = true starknet-crypto.workspace = true starknet-types-core.workspace = true -thiserror.workspace = true +thiserror-no-std.workspace = true blake2.workspace = true cairovm_verifier_transcript.workspace = true diff --git a/crates/pow/src/config.rs b/crates/pow/src/config.rs index 7e94956..546d326 100644 --- a/crates/pow/src/config.rs +++ b/crates/pow/src/config.rs @@ -19,7 +19,7 @@ impl Config { } } -use thiserror::Error; +use thiserror_no_std::Error; #[derive(Error, Debug)] pub enum Error { diff --git a/crates/pow/src/lib.rs b/crates/pow/src/lib.rs index 5365410..cf84e49 100644 --- a/crates/pow/src/lib.rs +++ b/crates/pow/src/lib.rs @@ -1,3 +1,7 @@ +#![no_std] + +extern crate alloc; + pub mod config; pub mod fixtures; pub mod pow; diff --git a/crates/pow/src/pow.rs b/crates/pow/src/pow.rs index 4b9de58..7c32f8f 100644 --- a/crates/pow/src/pow.rs +++ b/crates/pow/src/pow.rs @@ -1,3 +1,4 @@ +use alloc::vec::Vec; #[cfg(feature = "blake2s")] use blake2::Blake2s256; #[cfg(feature = "blake2s")] @@ -69,7 +70,7 @@ pub fn verify_pow(digest: [u8; 32], n_bits: u8, nonce: u64) -> Result<(), Error> ) } -use thiserror::Error; +use thiserror_no_std::Error; #[derive(Error, Debug)] pub enum Error { diff --git a/crates/stark/Cargo.toml b/crates/stark/Cargo.toml index b6c37d4..f1965e9 100644 --- a/crates/stark/Cargo.toml +++ b/crates/stark/Cargo.toml @@ -8,13 +8,24 @@ readme.workspace = true repository.workspace = true version.workspace = true +[features] +default = ["std", "recursive"] +std = ["dep:thiserror"] +dex = [] +recursive = [] +recursive_with_poseidon = [] +small = [] +starknet = [] +starknet_with_keccak = [] + [dependencies] bail-out.workspace = true serde_with.workspace = true serde.workspace = true starknet-core.workspace = true starknet-crypto.workspace = true -thiserror.workspace = true +thiserror = { optional = true, workspace = true } +thiserror-no-std.workspace = true wasm-bindgen.workspace = true cairovm_verifier_air.workspace = true @@ -22,12 +33,3 @@ cairovm_verifier_commitment.workspace = true cairovm_verifier_fri.workspace = true cairovm_verifier_pow.workspace = true cairovm_verifier_transcript.workspace = true - -[features] -default = ["recursive"] -dex = [] -recursive = [] -recursive_with_poseidon = [] -small = [] -starknet = [] -starknet_with_keccak = [] diff --git a/crates/stark/src/commit.rs b/crates/stark/src/commit.rs index 1bfb88b..ed75495 100644 --- a/crates/stark/src/commit.rs +++ b/crates/stark/src/commit.rs @@ -1,3 +1,4 @@ +use alloc::{borrow::ToOwned, vec::Vec}; #[cfg(feature = "dex")] use cairovm_verifier_air::layout::dex::{CONSTRAINT_DEGREE, MASK_SIZE, N_CONSTRAINTS}; #[cfg(feature = "recursive")] @@ -95,7 +96,7 @@ fn powers_array(initial: Felt, alpha: Felt, n: u32) -> Vec { array } -use thiserror::Error; +use thiserror_no_std::Error; use crate::{ config::StarkConfig, diff --git a/crates/stark/src/config.rs b/crates/stark/src/config.rs index 0033282..c385887 100644 --- a/crates/stark/src/config.rs +++ b/crates/stark/src/config.rs @@ -51,7 +51,7 @@ impl StarkConfig { } use cairovm_verifier_commitment::vector; -use thiserror::Error; +use thiserror_no_std::Error; #[derive(Error, Debug)] pub enum Error { diff --git a/crates/stark/src/fixtures/commitment.rs b/crates/stark/src/fixtures/commitment.rs index 13d6c7f..b5f31e2 100644 --- a/crates/stark/src/fixtures/commitment.rs +++ b/crates/stark/src/fixtures/commitment.rs @@ -1,3 +1,4 @@ +use alloc::vec; use cairovm_verifier_air::layout::recursive::global_values::InteractionElements; use cairovm_verifier_commitment::{ table::{config::Config as TableCommitmentConfig, types::Commitment as TableCommitment}, diff --git a/crates/stark/src/fixtures/constraint_coefficients.rs b/crates/stark/src/fixtures/constraint_coefficients.rs index 30053d0..aa96eb9 100644 --- a/crates/stark/src/fixtures/constraint_coefficients.rs +++ b/crates/stark/src/fixtures/constraint_coefficients.rs @@ -1,3 +1,5 @@ +use alloc::vec; +use alloc::vec::Vec; use starknet_crypto::Felt; pub fn get() -> Vec { diff --git a/crates/stark/src/fixtures/oods_values.rs b/crates/stark/src/fixtures/oods_values.rs index 53ee14c..9ff6f55 100644 --- a/crates/stark/src/fixtures/oods_values.rs +++ b/crates/stark/src/fixtures/oods_values.rs @@ -1,3 +1,5 @@ +use alloc::vec; +use alloc::vec::Vec; use starknet_crypto::Felt; pub fn get() -> Vec { diff --git a/crates/stark/src/fixtures/witness.rs b/crates/stark/src/fixtures/witness.rs index b3f2371..2f28f1c 100644 --- a/crates/stark/src/fixtures/witness.rs +++ b/crates/stark/src/fixtures/witness.rs @@ -1,3 +1,4 @@ +use alloc::vec; use cairovm_verifier_commitment::{ table::types::{Decommitment as TableDecommitment, Witness as TableCommitmentWitness}, vector::types::Witness as VectorCommitmentWitness, diff --git a/crates/stark/src/lib.rs b/crates/stark/src/lib.rs index fff0957..4d28112 100644 --- a/crates/stark/src/lib.rs +++ b/crates/stark/src/lib.rs @@ -1,3 +1,7 @@ +#![no_std] +#![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + pub mod commit; pub mod config; pub mod fixtures; diff --git a/crates/stark/src/oods.rs b/crates/stark/src/oods.rs index 4e8f598..b646adf 100644 --- a/crates/stark/src/oods.rs +++ b/crates/stark/src/oods.rs @@ -1,3 +1,4 @@ +use alloc::vec::Vec; use bail_out::assure; #[cfg(feature = "dex")] use cairovm_verifier_air::layout::dex::CONSTRAINT_DEGREE; @@ -59,7 +60,7 @@ pub fn verify_oods( ) } -use thiserror::Error; +use thiserror_no_std::Error; #[derive(Error, Debug)] pub enum OodsVerifyError { diff --git a/crates/stark/src/queries.rs b/crates/stark/src/queries.rs index bccb010..62899ab 100644 --- a/crates/stark/src/queries.rs +++ b/crates/stark/src/queries.rs @@ -1,3 +1,4 @@ +use alloc::vec::Vec; use cairovm_verifier_air::domains::StarkDomains; use cairovm_verifier_transcript::transcript::Transcript; use starknet_core::types::NonZeroFelt; diff --git a/crates/stark/src/stark.rs b/crates/stark/src/stark.rs index 193cd77..fd1ac0b 100644 --- a/crates/stark/src/stark.rs +++ b/crates/stark/src/stark.rs @@ -67,7 +67,7 @@ use cairovm_verifier_air::{ }; use cairovm_verifier_transcript::transcript::Transcript; use starknet_crypto::Felt; -use thiserror::Error; +use thiserror_no_std::Error; #[derive(Error, Debug)] pub enum Error { diff --git a/crates/stark/src/types.rs b/crates/stark/src/types.rs index 239c406..13fb7b3 100644 --- a/crates/stark/src/types.rs +++ b/crates/stark/src/types.rs @@ -1,3 +1,4 @@ +use alloc::vec::Vec; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_core::serde::unsigned_field_element::UfeHex; diff --git a/crates/stark/src/verify.rs b/crates/stark/src/verify.rs index 91b9747..ecb6d8f 100644 --- a/crates/stark/src/verify.rs +++ b/crates/stark/src/verify.rs @@ -1,3 +1,4 @@ +use alloc::borrow::ToOwned; use cairovm_verifier_air::{domains::StarkDomains, layout::LayoutTrait}; use cairovm_verifier_commitment::table::decommit::table_decommit; use cairovm_verifier_fri::{ @@ -60,8 +61,26 @@ pub fn stark_verify( Ok(fri_verify(queries, commitment.fri, fri_decommitment, witness.fri_witness.to_owned())?) } +#[cfg(feature = "std")] use thiserror::Error; +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum Error { + #[error("Fri Error")] + FriError(#[from] fri::Error), + + #[error("TraceDecommit Error")] + TraceDecommitError(#[from] cairovm_verifier_air::trace::decommit::Error), + + #[error("TableDecommit Error")] + TableDecommitError(#[from] cairovm_verifier_commitment::table::decommit::Error), +} + +#[cfg(not(feature = "std"))] +use thiserror_no_std::Error; + +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum Error { #[error("Fri Error")] diff --git a/crates/transcript/Cargo.toml b/crates/transcript/Cargo.toml index 44ec0fd..859c8fc 100644 --- a/crates/transcript/Cargo.toml +++ b/crates/transcript/Cargo.toml @@ -9,4 +9,8 @@ repository.workspace = true version.workspace = true [dependencies] -starknet-crypto.workspace = true \ No newline at end of file +starknet-crypto.workspace = true + +[features] +default = ["std"] +std = [] diff --git a/crates/transcript/src/lib.rs b/crates/transcript/src/lib.rs index 11e6ab5..870e3d0 100644 --- a/crates/transcript/src/lib.rs +++ b/crates/transcript/src/lib.rs @@ -1,3 +1,7 @@ +#![no_std] +#![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + pub mod transcript; #[cfg(test)] diff --git a/crates/transcript/src/tests/random_felts_to_prover.rs b/crates/transcript/src/tests/random_felts_to_prover.rs index ec75157..bd9cb9a 100644 --- a/crates/transcript/src/tests/random_felts_to_prover.rs +++ b/crates/transcript/src/tests/random_felts_to_prover.rs @@ -1,3 +1,4 @@ +use alloc::vec; use starknet_crypto::Felt; use crate::transcript::Transcript; diff --git a/crates/transcript/src/tests/read_felt_vector_from_prover.rs b/crates/transcript/src/tests/read_felt_vector_from_prover.rs index 2732ff8..205e32b 100644 --- a/crates/transcript/src/tests/read_felt_vector_from_prover.rs +++ b/crates/transcript/src/tests/read_felt_vector_from_prover.rs @@ -1,4 +1,5 @@ use crate::transcript::Transcript; +use alloc::vec; use starknet_crypto::Felt; #[test] diff --git a/crates/transcript/src/transcript.rs b/crates/transcript/src/transcript.rs index 083e068..edbfc53 100644 --- a/crates/transcript/src/transcript.rs +++ b/crates/transcript/src/transcript.rs @@ -1,3 +1,5 @@ +use alloc::vec; +use alloc::vec::Vec; use starknet_crypto::{poseidon_hash, poseidon_hash_many, Felt}; pub struct Transcript { diff --git a/proof-parser/Cargo.toml b/proof-parser/Cargo.toml index e45fbef..0a5786b 100644 --- a/proof-parser/Cargo.toml +++ b/proof-parser/Cargo.toml @@ -10,7 +10,7 @@ version.workspace = true [dependencies] serde.workspace = true -thiserror.workspace = true +thiserror-no-std.workspace = true starknet-types-core.workspace = true num-bigint.workspace = true anyhow = "1.0.80" @@ -22,4 +22,4 @@ cairovm_verifier_stark.workspace = true cairovm_verifier_commitment.workspace = true cairovm_verifier_fri.workspace = true cairovm_verifier_air.workspace = true -cairovm_verifier_pow.workspace = true \ No newline at end of file +cairovm_verifier_pow.workspace = true From c76092e22c15ee977a66753f2b9fa2364d7e52bb Mon Sep 17 00:00:00 2001 From: Pia Date: Sat, 20 Jul 2024 23:16:52 +0200 Subject: [PATCH 02/39] no std support! --- Cargo.lock | 5 +++ cli/Cargo.toml | 6 ++-- crates/air/Cargo.toml | 20 ++++++----- crates/air/src/layout/mod.rs | 35 +++++++++++++++++++ crates/air/src/lib.rs | 5 ++- crates/air/src/trace/config.rs | 18 ++++++++++ crates/air/src/trace/decommit.rs | 13 +++++++ crates/commitment/Cargo.toml | 13 ++++--- crates/commitment/src/lib.rs | 5 ++- crates/commitment/src/table/decommit.rs | 18 +++++++++- crates/commitment/src/vector/config.rs | 12 +++++++ crates/commitment/src/vector/decommit.rs | 21 ++++++++++- crates/fri/Cargo.toml | 5 +++ crates/fri/src/config.rs | 20 +++++++++++ crates/fri/src/fri.rs | 18 ++++++++++ crates/fri/src/lib.rs | 5 ++- crates/pow/Cargo.toml | 13 ++++--- crates/pow/src/config.rs | 12 +++++++ crates/pow/src/lib.rs | 5 ++- crates/pow/src/pow.rs | 12 +++++++ crates/stark/src/commit.rs | 19 ++++++++-- crates/stark/src/config.rs | 19 ++++++++++ crates/stark/src/lib.rs | 3 ++ crates/stark/src/oods.rs | 14 ++++++++ crates/stark/src/stark.rs | 22 ++++++++++++ crates/stark/src/verify.rs | 6 ++-- proof-parser/Cargo.toml | 5 +++ .../src/annotations/annotation_kind.rs | 4 +++ proof-parser/src/annotations/extract.rs | 2 ++ proof-parser/src/annotations/mod.rs | 1 + proof-parser/src/builtins.rs | 4 +++ proof-parser/src/conversion.rs | 1 + proof-parser/src/json_parser.rs | 1 + proof-parser/src/layout.rs | 4 +++ proof-parser/src/lib.rs | 11 ++++-- proof-parser/src/stark_proof.rs | 1 + 36 files changed, 343 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c3ff4db..0428938 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -146,6 +146,7 @@ dependencies = [ "serde_with", "starknet-core", "starknet-crypto", + "thiserror", "thiserror-no-std", ] @@ -173,6 +174,7 @@ dependencies = [ "starknet-core", "starknet-crypto", "starknet-types-core", + "thiserror", "thiserror-no-std", ] @@ -188,6 +190,7 @@ dependencies = [ "sha3", "starknet-core", "starknet-crypto", + "thiserror", "thiserror-no-std", ] @@ -202,6 +205,7 @@ dependencies = [ "sha3", "starknet-crypto", "starknet-types-core", + "thiserror", "thiserror-no-std", ] @@ -221,6 +225,7 @@ dependencies = [ "serde", "serde_json", "starknet-types-core", + "thiserror", "thiserror-no-std", ] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 0885702..b1bfe23 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -12,9 +12,9 @@ version.workspace = true clap = { version = "4.4.4", features = ["derive"] } starknet-crypto.workspace = true -cairovm_verifier_air = { workspace = true, default-features = false } -cairovm_verifier_stark = { workspace = true, default-features = false } -cairovm_verifier_proof_parser = { workspace = true, default-features = false } +cairovm_verifier_air = { workspace = true, features = ["std"] } +cairovm_verifier_stark = { workspace = true, features = ["std"] } +cairovm_verifier_proof_parser = { workspace = true, features = ["std"] } [features] default = ["recursive", "keccak"] diff --git a/crates/air/Cargo.toml b/crates/air/Cargo.toml index a9998ad..9fd1352 100644 --- a/crates/air/Cargo.toml +++ b/crates/air/Cargo.toml @@ -8,22 +8,24 @@ readme.workspace = true repository.workspace = true version.workspace = true +[features] +default = ["std", "recursive"] +std = ["dep:thiserror"] +dex = [] +recursive = [] +recursive_with_poseidon = [] +small = [] +starknet = [] +starknet_with_keccak = [] + [dependencies] bail-out.workspace = true serde_with.workspace = true serde.workspace = true starknet-core.workspace = true starknet-crypto.workspace = true +thiserror = { optional = true, workspace = true } thiserror-no-std.workspace = true cairovm_verifier_commitment.workspace = true cairovm_verifier_transcript.workspace = true - -[features] -default = ["recursive"] -dex = [] -recursive = [] -recursive_with_poseidon = [] -small = [] -starknet = [] -starknet_with_keccak = [] diff --git a/crates/air/src/layout/mod.rs b/crates/air/src/layout/mod.rs index 633a23c..fb29aa2 100644 --- a/crates/air/src/layout/mod.rs +++ b/crates/air/src/layout/mod.rs @@ -70,14 +70,49 @@ pub trait LayoutTrait { fn verify_public_input(public_input: &PublicInput) -> Result<(Felt, Felt), PublicInputError>; } +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum CompositionPolyEvalError { + #[error("segment not present {segment}")] + SegmentMissing { segment: usize }, +} + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum PublicInputError { + #[error("max steps exceeded")] + MaxSteps, + + #[error("trace length invalid")] + TraceLengthInvalid, + + #[error("segment not present {segment}")] + SegmentMissing { segment: usize }, + + #[error("layout code invalid")] + LayoutCodeInvalid, + + #[error("range_check invalid")] + RangeCheckInvalid, + + #[error("invalid number of builtin uses")] + UsesInvalid, +} + +#[cfg(not(feature = "std"))] use thiserror_no_std::Error; +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum CompositionPolyEvalError { #[error("segment not present {segment}")] SegmentMissing { segment: usize }, } +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum PublicInputError { #[error("max steps exceeded")] diff --git a/crates/air/src/lib.rs b/crates/air/src/lib.rs index ae4b722..c064c7b 100644 --- a/crates/air/src/lib.rs +++ b/crates/air/src/lib.rs @@ -1,7 +1,10 @@ #![no_std] - +#![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; +#[cfg(feature = "std")] +extern crate std; + pub mod diluted; pub mod domains; pub mod fixtures; diff --git a/crates/air/src/trace/config.rs b/crates/air/src/trace/config.rs index 8baf75d..c9f9cd1 100644 --- a/crates/air/src/trace/config.rs +++ b/crates/air/src/trace/config.rs @@ -57,8 +57,26 @@ impl Config { } } +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum Error { + #[error("value out of bounds {min} - {max}")] + OutOfBounds { min: Felt, max: Felt }, + + #[error("wrong numbers of columns")] + ColumnsNumInvalid, + + #[error("Vector Error")] + Vector(#[from] vector::config::Error), +} + +#[cfg(not(feature = "std"))] use thiserror_no_std::Error; +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum Error { #[error("value out of bounds {min} - {max}")] diff --git a/crates/air/src/trace/decommit.rs b/crates/air/src/trace/decommit.rs index b165934..8e5a15b 100644 --- a/crates/air/src/trace/decommit.rs +++ b/crates/air/src/trace/decommit.rs @@ -1,7 +1,20 @@ use cairovm_verifier_commitment::table; + +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum Error { + #[error("Table Error")] + Table(#[from] table::decommit::Error), +} + +#[cfg(not(feature = "std"))] use thiserror_no_std::Error; #[derive(Error, Debug)] +#[cfg(not(feature = "std"))] pub enum Error { #[error("Table Error")] Table(#[from] table::decommit::Error), diff --git a/crates/commitment/Cargo.toml b/crates/commitment/Cargo.toml index 987f8bb..e2f56ea 100644 --- a/crates/commitment/Cargo.toml +++ b/crates/commitment/Cargo.toml @@ -8,6 +8,13 @@ readme.workspace = true repository.workspace = true version.workspace = true +[features] +default = ["std", "keccak"] +std = ["dep:thiserror"] +keccak = [] +blake2s = [] + + [dependencies] serde_with.workspace = true serde.workspace = true @@ -15,13 +22,9 @@ sha3.workspace = true starknet-core.workspace = true starknet-types-core.workspace = true starknet-crypto.workspace = true +thiserror = { optional = true, workspace = true } thiserror-no-std.workspace = true crypto-bigint.workspace = true blake2.workspace = true cairovm_verifier_transcript.workspace = true - -[features] -default = ["keccak"] -keccak = [] -blake2s = [] diff --git a/crates/commitment/src/lib.rs b/crates/commitment/src/lib.rs index 1263a87..1c29b60 100644 --- a/crates/commitment/src/lib.rs +++ b/crates/commitment/src/lib.rs @@ -1,6 +1,9 @@ #![no_std] - +#![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; +#[cfg(feature = "std")] +extern crate std; + pub mod table; pub mod vector; diff --git a/crates/commitment/src/table/decommit.rs b/crates/commitment/src/table/decommit.rs index 8f54898..2361491 100644 --- a/crates/commitment/src/table/decommit.rs +++ b/crates/commitment/src/table/decommit.rs @@ -1,7 +1,6 @@ use crate::vector::{decommit::vector_commitment_decommit, types::Query}; use alloc::vec::Vec; use starknet_crypto::{poseidon_hash_many, Felt}; -use thiserror_no_std::Error; #[cfg(feature = "blake2s")] use blake2::Blake2s256; @@ -86,6 +85,23 @@ fn generate_vector_queries( vector_queries } +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum Error { + #[error("Invalid decommitment length")] + DecommitmentLength, + + #[error("Vector Error")] + Vector(#[from] crate::vector::decommit::Error), +} + +#[cfg(not(feature = "std"))] +use thiserror_no_std::Error; + +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum Error { #[error("Invalid decommitment length")] diff --git a/crates/commitment/src/vector/config.rs b/crates/commitment/src/vector/config.rs index 5ffdc60..ff46b42 100644 --- a/crates/commitment/src/vector/config.rs +++ b/crates/commitment/src/vector/config.rs @@ -34,8 +34,20 @@ impl Config { } } +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum Error { + #[error("mismatch value {value} expected {expected}")] + MisMatch { value: Felt, expected: Felt }, +} + +#[cfg(not(feature = "std"))] use thiserror_no_std::Error; +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum Error { #[error("mismatch value {value} expected {expected}")] diff --git a/crates/commitment/src/vector/decommit.rs b/crates/commitment/src/vector/decommit.rs index 31d0cfe..97d142d 100644 --- a/crates/commitment/src/vector/decommit.rs +++ b/crates/commitment/src/vector/decommit.rs @@ -10,7 +10,6 @@ use sha3::Digest; use sha3::Keccak256; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash, Felt}; -use thiserror_no_std::Error; pub fn vector_commitment_decommit( commitment: Commitment, @@ -126,6 +125,26 @@ fn hash_friendly_unfriendly(x: Felt, y: Felt, is_verifier_friendly: bool) -> Fel } } +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum Error { + #[error("mismatch value {value} expected {expected}")] + MisMatch { value: Felt, expected: Felt }, + #[error("authentications length is invalid")] + AuthenticationInvalid, + #[error("root tree-node error")] + RootInvalid, + #[error("root tree-node error")] + IndexInvalid, +} + +#[cfg(not(feature = "std"))] +use thiserror_no_std::Error; + +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum Error { #[error("mismatch value {value} expected {expected}")] diff --git a/crates/fri/Cargo.toml b/crates/fri/Cargo.toml index 85809a5..1e287cb 100644 --- a/crates/fri/Cargo.toml +++ b/crates/fri/Cargo.toml @@ -8,12 +8,17 @@ readme.workspace = true repository.workspace = true version.workspace = true +[features] +default = ["std"] +std = ["dep:thiserror"] + [dependencies] serde_with.workspace = true serde.workspace = true sha3.workspace = true starknet-core.workspace = true starknet-crypto.workspace = true +thiserror = { optional = true, workspace = true } thiserror-no-std.workspace = true cairovm_verifier_air.workspace = true diff --git a/crates/fri/src/config.rs b/crates/fri/src/config.rs index 7bd59cd..2be013d 100644 --- a/crates/fri/src/config.rs +++ b/crates/fri/src/config.rs @@ -86,8 +86,28 @@ impl Config { } } +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum Error { + #[error("value out of bounds {min} - {max}")] + OutOfBounds { min: u64, max: u64 }, + #[error("invalid first fri step")] + FirstFriStepInvalid, + #[error("invalid value for column count, expected {expected}, got {actual}")] + InvalidColumnCount { expected: Felt, actual: Felt }, + #[error("log input size mismatch, expected {expected}, got {actual}")] + LogInputSizeMismatch { expected: Felt, actual: Felt }, + #[error("vector validation failed: {0}")] + VectorValidationFailed(#[from] cairovm_verifier_commitment::vector::config::Error), +} + +#[cfg(not(feature = "std"))] use thiserror_no_std::Error; +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum Error { #[error("value out of bounds {min} - {max}")] diff --git a/crates/fri/src/fri.rs b/crates/fri/src/fri.rs index b6b95e0..c5477d8 100644 --- a/crates/fri/src/fri.rs +++ b/crates/fri/src/fri.rs @@ -181,8 +181,26 @@ pub fn fri_verify( Ok(()) } +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum Error { + #[error("Invalid length: expected {expected}, actual {actual}")] + InvalidLength { expected: usize, actual: usize }, + + #[error("Invalid value")] + InvalidValue, + + #[error("Last layer verification error")] + LastLayerVerificationError, +} + +#[cfg(not(feature = "std"))] use thiserror_no_std::Error; +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum Error { #[error("Invalid length: expected {expected}, actual {actual}")] diff --git a/crates/fri/src/lib.rs b/crates/fri/src/lib.rs index 61a9752..866d3d9 100644 --- a/crates/fri/src/lib.rs +++ b/crates/fri/src/lib.rs @@ -1,7 +1,10 @@ #![no_std] - +#![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; +#[cfg(feature = "std")] +extern crate std; + pub mod config; pub mod first_layer; pub mod fixtures; diff --git a/crates/pow/Cargo.toml b/crates/pow/Cargo.toml index 75ffa45..2d625e8 100644 --- a/crates/pow/Cargo.toml +++ b/crates/pow/Cargo.toml @@ -8,18 +8,21 @@ readme.workspace = true repository.workspace = true version.workspace = true +[features] +default = ["std", "keccak"] +std = ["dep:thiserror"] +keccak = [] +blake2s = [] + + [dependencies] bail-out.workspace = true serde.workspace = true sha3.workspace = true starknet-crypto.workspace = true starknet-types-core.workspace = true +thiserror = { optional = true, workspace = true } thiserror-no-std.workspace = true blake2.workspace = true cairovm_verifier_transcript.workspace = true - -[features] -default = ["keccak"] -keccak = [] -blake2s = [] diff --git a/crates/pow/src/config.rs b/crates/pow/src/config.rs index 546d326..00dcab3 100644 --- a/crates/pow/src/config.rs +++ b/crates/pow/src/config.rs @@ -19,8 +19,20 @@ impl Config { } } +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum Error { + #[error("value out of bounds {min} - {max}")] + OutOfBounds { min: u8, max: u8 }, +} + +#[cfg(not(feature = "std"))] use thiserror_no_std::Error; +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum Error { #[error("value out of bounds {min} - {max}")] diff --git a/crates/pow/src/lib.rs b/crates/pow/src/lib.rs index cf84e49..c51d57d 100644 --- a/crates/pow/src/lib.rs +++ b/crates/pow/src/lib.rs @@ -1,7 +1,10 @@ #![no_std] - +#![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; +#[cfg(feature = "std")] +extern crate std; + pub mod config; pub mod fixtures; pub mod pow; diff --git a/crates/pow/src/pow.rs b/crates/pow/src/pow.rs index 7c32f8f..863ff65 100644 --- a/crates/pow/src/pow.rs +++ b/crates/pow/src/pow.rs @@ -70,8 +70,20 @@ pub fn verify_pow(digest: [u8; 32], n_bits: u8, nonce: u64) -> Result<(), Error> ) } +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum Error { + #[cfg_attr(feature = "std", error("proof of work verification fail"))] + ProofOfWorkFail, +} + +#[cfg(not(feature = "std"))] use thiserror_no_std::Error; +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum Error { #[error("proof of work verification fail")] diff --git a/crates/stark/src/commit.rs b/crates/stark/src/commit.rs index ed75495..4ce9ba1 100644 --- a/crates/stark/src/commit.rs +++ b/crates/stark/src/commit.rs @@ -96,14 +96,29 @@ fn powers_array(initial: Felt, alpha: Felt, n: u32) -> Vec { array } -use thiserror_no_std::Error; - use crate::{ config::StarkConfig, oods::{self, verify_oods}, types::{StarkCommitment, StarkUnsentCommitment}, }; +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum Error { + #[error("POW Error")] + POW(#[from] pow::Error), + + #[error("OodsVerifyError Error")] + Oods(#[from] oods::OodsVerifyError), +} + +#[cfg(not(feature = "std"))] +use thiserror_no_std::Error; + +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum Error { #[error("POW Error")] diff --git a/crates/stark/src/config.rs b/crates/stark/src/config.rs index c385887..9f2e5a3 100644 --- a/crates/stark/src/config.rs +++ b/crates/stark/src/config.rs @@ -51,8 +51,27 @@ impl StarkConfig { } use cairovm_verifier_commitment::vector; + +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum Error { + #[error("Vector Error")] + Vector(#[from] vector::config::Error), + #[error("Fri Error")] + Fri(#[from] cairovm_verifier_fri::config::Error), + #[error("Pow Error")] + Pow(#[from] cairovm_verifier_pow::config::Error), + #[error("Trace Error")] + Trace(#[from] cairovm_verifier_air::trace::config::Error), +} + +#[cfg(not(feature = "std"))] use thiserror_no_std::Error; +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum Error { #[error("Vector Error")] diff --git a/crates/stark/src/lib.rs b/crates/stark/src/lib.rs index 4d28112..244881f 100644 --- a/crates/stark/src/lib.rs +++ b/crates/stark/src/lib.rs @@ -2,6 +2,9 @@ #![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; +#[cfg(feature = "std")] +extern crate std; + pub mod commit; pub mod config; pub mod fixtures; diff --git a/crates/stark/src/oods.rs b/crates/stark/src/oods.rs index b646adf..b67e27a 100644 --- a/crates/stark/src/oods.rs +++ b/crates/stark/src/oods.rs @@ -60,8 +60,22 @@ pub fn verify_oods( ) } +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum OodsVerifyError { + #[error("oods invalid {expected} - {actual}")] + EvaluationInvalid { expected: Felt, actual: Felt }, + #[error("CompositionPolyEval Error")] + CompositionPolyEvalError(#[from] CompositionPolyEvalError), +} + +#[cfg(not(feature = "std"))] use thiserror_no_std::Error; +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum OodsVerifyError { #[error("oods invalid {expected} - {actual}")] diff --git a/crates/stark/src/stark.rs b/crates/stark/src/stark.rs index fd1ac0b..85e5669 100644 --- a/crates/stark/src/stark.rs +++ b/crates/stark/src/stark.rs @@ -67,8 +67,30 @@ use cairovm_verifier_air::{ }; use cairovm_verifier_transcript::transcript::Transcript; use starknet_crypto::Felt; + +#[cfg(feature = "std")] +use thiserror::Error; + +#[cfg(feature = "std")] +#[derive(Error, Debug)] +pub enum Error { + #[error("Vector Error")] + Validation(#[from] crate::config::Error), + + #[error("PublicInputError Error")] + PublicInputError(#[from] PublicInputError), + + #[error("Commit Error")] + Commit(#[from] crate::commit::Error), + + #[error("Verify Error")] + Verify(#[from] crate::verify::Error), +} + +#[cfg(not(feature = "std"))] use thiserror_no_std::Error; +#[cfg(not(feature = "std"))] #[derive(Error, Debug)] pub enum Error { #[error("Vector Error")] diff --git a/crates/stark/src/verify.rs b/crates/stark/src/verify.rs index ecb6d8f..f397ca7 100644 --- a/crates/stark/src/verify.rs +++ b/crates/stark/src/verify.rs @@ -67,13 +67,13 @@ use thiserror::Error; #[cfg(feature = "std")] #[derive(Error, Debug)] pub enum Error { - #[error("Fri Error")] + #[cfg_attr(feature = "std", error("Fri Error"))] FriError(#[from] fri::Error), - #[error("TraceDecommit Error")] + #[cfg_attr(feature = "std", error("TraceDecommit Error"))] TraceDecommitError(#[from] cairovm_verifier_air::trace::decommit::Error), - #[error("TableDecommit Error")] + #[cfg_attr(feature = "std", error("TableDecommit Error"))] TableDecommitError(#[from] cairovm_verifier_commitment::table::decommit::Error), } diff --git a/proof-parser/Cargo.toml b/proof-parser/Cargo.toml index 0a5786b..3775674 100644 --- a/proof-parser/Cargo.toml +++ b/proof-parser/Cargo.toml @@ -8,8 +8,13 @@ readme.workspace = true repository.workspace = true version.workspace = true +[features] +default = ["std"] +std = ["dep:thiserror"] + [dependencies] serde.workspace = true +thiserror = { optional = true, workspace = true } thiserror-no-std.workspace = true starknet-types-core.workspace = true num-bigint.workspace = true diff --git a/proof-parser/src/annotations/annotation_kind.rs b/proof-parser/src/annotations/annotation_kind.rs index a23794c..3748138 100644 --- a/proof-parser/src/annotations/annotation_kind.rs +++ b/proof-parser/src/annotations/annotation_kind.rs @@ -1,4 +1,8 @@ use super::extract::{extract_annotations, extract_z_and_alpha}; +use alloc::format; +use alloc::string::String; +use alloc::vec; +use alloc::{string::ToString, vec::Vec}; use num_bigint::BigUint; #[derive(Debug, Clone, PartialEq, PartialOrd)] diff --git a/proof-parser/src/annotations/extract.rs b/proof-parser/src/annotations/extract.rs index 6e5040e..c4ca36a 100644 --- a/proof-parser/src/annotations/extract.rs +++ b/proof-parser/src/annotations/extract.rs @@ -1,4 +1,6 @@ use super::annotation_kind::ZAlpha; +use alloc::format; +use alloc::vec::Vec; use num_bigint::BigUint; use regex::Regex; diff --git a/proof-parser/src/annotations/mod.rs b/proof-parser/src/annotations/mod.rs index b8f1384..835d6f1 100644 --- a/proof-parser/src/annotations/mod.rs +++ b/proof-parser/src/annotations/mod.rs @@ -2,6 +2,7 @@ pub mod annotation_kind; pub mod extract; use self::annotation_kind::{Annotation, ZAlpha}; +use alloc::vec::Vec; use num_bigint::BigUint; #[derive(Debug, Clone, PartialEq)] diff --git a/proof-parser/src/builtins.rs b/proof-parser/src/builtins.rs index 57c9aa0..6c8accc 100644 --- a/proof-parser/src/builtins.rs +++ b/proof-parser/src/builtins.rs @@ -1,3 +1,7 @@ +use alloc::string::String; +use alloc::vec; +use alloc::vec::Vec; + use crate::json_parser::MemorySegmentAddress; use std::collections::HashMap; diff --git a/proof-parser/src/conversion.rs b/proof-parser/src/conversion.rs index c403bb1..bc9a4f6 100644 --- a/proof-parser/src/conversion.rs +++ b/proof-parser/src/conversion.rs @@ -1,3 +1,4 @@ +use alloc::vec; use cairovm_verifier_air::{ public_memory::PublicInput as PublicInputVerifier, trace::{ diff --git a/proof-parser/src/json_parser.rs b/proof-parser/src/json_parser.rs index 6545bbb..241c590 100644 --- a/proof-parser/src/json_parser.rs +++ b/proof-parser/src/json_parser.rs @@ -5,6 +5,7 @@ use crate::{ stark_proof::*, utils::log2_if_power_of_2, }; +use alloc::{string::String, vec, vec::Vec}; use num_bigint::BigUint; use serde::Deserialize; use std::{ diff --git a/proof-parser/src/layout.rs b/proof-parser/src/layout.rs index b8979a4..ef80f93 100644 --- a/proof-parser/src/layout.rs +++ b/proof-parser/src/layout.rs @@ -1,3 +1,7 @@ +use alloc::{ + string::{String, ToString}, + vec::Vec, +}; use num_bigint::BigUint; use serde::Deserialize; use std::{collections::BTreeMap, convert::TryInto, fmt::Display}; diff --git a/proof-parser/src/lib.rs b/proof-parser/src/lib.rs index b820a4b..0b9c8cf 100644 --- a/proof-parser/src/lib.rs +++ b/proof-parser/src/lib.rs @@ -1,3 +1,10 @@ +#![no_std] +#![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +#[cfg(feature = "std")] +extern crate std; + mod annotations; mod builtins; mod conversion; @@ -12,6 +19,7 @@ extern crate clap; extern crate num_bigint; extern crate regex; extern crate serde; +use alloc::string::String; use cairovm_verifier_stark::types::StarkProof as StarkProofFromVerifier; pub fn parse(input: String) -> anyhow::Result { @@ -30,7 +38,6 @@ mod tests { let input = include_str!("../../examples/proofs/recursive/cairo0_example_proof.json"); let proof_json = serde_json::from_str::(input).unwrap(); let stark_proof = StarkProof::try_from(proof_json).unwrap(); - let stark_proof_verifier: StarkProofFromVerifier = stark_proof.into(); - println!("{:?}", stark_proof_verifier); + let _: StarkProofFromVerifier = stark_proof.into(); } } diff --git a/proof-parser/src/stark_proof.rs b/proof-parser/src/stark_proof.rs index 980cf69..c39495d 100644 --- a/proof-parser/src/stark_proof.rs +++ b/proof-parser/src/stark_proof.rs @@ -1,3 +1,4 @@ +use alloc::{string::String, vec::Vec}; use num_bigint::BigUint; use std::collections::BTreeMap; From baadc259bf1232ce7378a07afdd4fffee18d9f2d Mon Sep 17 00:00:00 2001 From: Pia Date: Sat, 20 Jul 2024 23:22:27 +0200 Subject: [PATCH 03/39] fix: attr remove --- crates/air/src/lib.rs | 2 +- crates/commitment/src/lib.rs | 2 +- crates/fri/src/lib.rs | 2 +- crates/pow/src/lib.rs | 2 +- crates/stark/src/lib.rs | 2 +- crates/transcript/src/lib.rs | 2 +- proof-parser/src/lib.rs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/air/src/lib.rs b/crates/air/src/lib.rs index c064c7b..44b1578 100644 --- a/crates/air/src/lib.rs +++ b/crates/air/src/lib.rs @@ -1,5 +1,5 @@ #![no_std] -#![cfg_attr(not(feature = "std"), no_std)] + extern crate alloc; #[cfg(feature = "std")] diff --git a/crates/commitment/src/lib.rs b/crates/commitment/src/lib.rs index 1c29b60..1f62160 100644 --- a/crates/commitment/src/lib.rs +++ b/crates/commitment/src/lib.rs @@ -1,5 +1,5 @@ #![no_std] -#![cfg_attr(not(feature = "std"), no_std)] + extern crate alloc; #[cfg(feature = "std")] diff --git a/crates/fri/src/lib.rs b/crates/fri/src/lib.rs index 866d3d9..f88b5b1 100644 --- a/crates/fri/src/lib.rs +++ b/crates/fri/src/lib.rs @@ -1,5 +1,5 @@ #![no_std] -#![cfg_attr(not(feature = "std"), no_std)] + extern crate alloc; #[cfg(feature = "std")] diff --git a/crates/pow/src/lib.rs b/crates/pow/src/lib.rs index c51d57d..566f79e 100644 --- a/crates/pow/src/lib.rs +++ b/crates/pow/src/lib.rs @@ -1,5 +1,5 @@ #![no_std] -#![cfg_attr(not(feature = "std"), no_std)] + extern crate alloc; #[cfg(feature = "std")] diff --git a/crates/stark/src/lib.rs b/crates/stark/src/lib.rs index 244881f..10409b6 100644 --- a/crates/stark/src/lib.rs +++ b/crates/stark/src/lib.rs @@ -1,5 +1,5 @@ #![no_std] -#![cfg_attr(not(feature = "std"), no_std)] + extern crate alloc; #[cfg(feature = "std")] diff --git a/crates/transcript/src/lib.rs b/crates/transcript/src/lib.rs index 870e3d0..df9dc1b 100644 --- a/crates/transcript/src/lib.rs +++ b/crates/transcript/src/lib.rs @@ -1,5 +1,5 @@ #![no_std] -#![cfg_attr(not(feature = "std"), no_std)] + extern crate alloc; pub mod transcript; diff --git a/proof-parser/src/lib.rs b/proof-parser/src/lib.rs index 0b9c8cf..aaab667 100644 --- a/proof-parser/src/lib.rs +++ b/proof-parser/src/lib.rs @@ -1,5 +1,5 @@ #![no_std] -#![cfg_attr(not(feature = "std"), no_std)] + extern crate alloc; #[cfg(feature = "std")] From 70f5b6c3b1e15954d77a70354ee1ab5815d6cea7 Mon Sep 17 00:00:00 2001 From: Pia Date: Sat, 20 Jul 2024 23:26:06 +0200 Subject: [PATCH 04/39] fix:ci --- .github/workflows/ci.yml | 66 ++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b4279f..938302d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: Rust CI on: push: - branches: [ main ] + branches: [main] pull_request: branches: "**" @@ -11,46 +11,54 @@ jobs: runs-on: ubuntu-latest steps: - - name: Check out the repository - uses: actions/checkout@v2 + - name: Check out the repository + uses: actions/checkout@v2 - - name: Setup Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Setup Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Cache Cargo registry - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-registry- + - name: Cache Cargo registry + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- - - name: Cache Cargo build - uses: actions/cache@v2 - with: - path: target - key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-build- + - name: Cache Cargo build + uses: actions/cache@v2 + with: + path: target + key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-build- - - name: Run tests - run: cargo test --verbose + - name: Run tests + run: cargo test --verbose verify-proof: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - layout: ["dex", "recursive", "recursive_with_poseidon", "small", "starknet", "starknet_with_keccak"] + layout: + [ + "dex", + "recursive", + "recursive_with_poseidon", + "small", + "starknet", + "starknet_with_keccak", + ] steps: - name: Checkout repository uses: actions/checkout@v3 - + - name: Setup Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 - + - name: Cache Cargo registry uses: actions/cache@v2 with: @@ -60,7 +68,7 @@ jobs: key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo-registry- - + - name: Cache Cargo build uses: actions/cache@v2 with: @@ -68,6 +76,6 @@ jobs: key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo-build- - + - name: Run verification - run: cargo run --release --bin cairovm_verifier_cli --features ${{ matrix.layout }},keccak --no-default-features -- --proof examples/proofs/${{ matrix.layout }}/cairo0_example_proof.json \ No newline at end of file + run: cargo run --release --bin cairovm_verifier_cli --features ${{ matrix.layout }},keccak,std --no-default-features -- --proof examples/proofs/${{ matrix.layout }}/cairo0_example_proof.json From 44c212f18104926fdb74fb44b67b5f41768b2962 Mon Sep 17 00:00:00 2001 From: Pia Date: Sat, 20 Jul 2024 23:57:04 +0200 Subject: [PATCH 05/39] test init --- .github/workflows/ci.yml | 11 +++++++++++ Cargo.toml | 4 ++-- ensure_no_std/.cargo/config.toml | 2 ++ ensure_no_std/Cargo.toml | 25 +++++++++++++++++++++++++ ensure_no_std/rust-toolchain.toml | 11 +++++++++++ ensure_no_std/src/main.rs | 23 +++++++++++++++++++++++ 6 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 ensure_no_std/.cargo/config.toml create mode 100644 ensure_no_std/Cargo.toml create mode 100644 ensure_no_std/rust-toolchain.toml create mode 100644 ensure_no_std/src/main.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 938302d..3b3d8ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,3 +79,14 @@ jobs: - name: Run verification run: cargo run --release --bin cairovm_verifier_cli --features ${{ matrix.layout }},keccak,std --no-default-features -- --proof examples/proofs/${{ matrix.layout }}/cairo0_example_proof.json + + no-std-build: + name: Test no_std support + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check wasm compatibility + run: |- + cd ensure_no_std + rustup show + cargo build -r diff --git a/Cargo.toml b/Cargo.toml index 12e9cce..5808208 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ members = [ "cli", "wasm-binding", ] -exclude = [] +exclude = ["ensure_no_std"] [workspace.package] description = "" @@ -33,7 +33,7 @@ serde_with = "2.3.2" sha3 = "0.10.8" starknet-core = "0.11.1" starknet-crypto = "0.7.1" -starknet-types-core = "0.1.5" +starknet-types-core = { version = "0.1.5", default-features = false } crypto-bigint = "0.5.5" thiserror-no-std = "=2.0.2" thiserror = "1.0.61" diff --git a/ensure_no_std/.cargo/config.toml b/ensure_no_std/.cargo/config.toml new file mode 100644 index 0000000..f4e8c00 --- /dev/null +++ b/ensure_no_std/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +target = "wasm32-unknown-unknown" diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml new file mode 100644 index 0000000..f9f9c8f --- /dev/null +++ b/ensure_no_std/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "ensure_no_std" +description.workspace = true +edition.workspace = true +homepage.workspace = true +license-file.workspace = true +readme.workspace = true +repository.workspace = true +version.workspace = true + +[dependencies] +cairovm_verifier_air = { workspace = true, default-features = false } +cairovm_verifier_stark = { workspace = true, default-features = false } +cairovm_verifier_proof_parser = { workspace = true, default-features = false } + +[features] +default = ["recursive", "keccak"] +dex = [] +recursive = [] +recursive_with_poseidon = [] +small = [] +starknet = [] +starknet_with_keccak = [] +keccak = [] +blake2s = [] diff --git a/ensure_no_std/rust-toolchain.toml b/ensure_no_std/rust-toolchain.toml new file mode 100644 index 0000000..9a83785 --- /dev/null +++ b/ensure_no_std/rust-toolchain.toml @@ -0,0 +1,11 @@ +[toolchain] +channel = "1.77.2" +components = ["rustfmt", "clippy"] +targets = ["wasm32-unknown-unknown"] +profile = "minimal" + +[profile.dev] +panic = "abort" + +[profile.release] +panic = "abort" diff --git a/ensure_no_std/src/main.rs b/ensure_no_std/src/main.rs new file mode 100644 index 0000000..cc14894 --- /dev/null +++ b/ensure_no_std/src/main.rs @@ -0,0 +1,23 @@ +#![no_std] +#![no_main] + +use core::panic::PanicInfo; + +/// This function is called on panic. +#[panic_handler] +fn panic(_info: &PanicInfo) -> ! { + loop {} +} + +#[no_mangle] +pub extern "C" fn _start() -> ! { + loop {} +} + +#[global_allocator] +static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; + +#[allow(unused_imports)] +use starknet_types_core; +#[allow(unused_imports)] +use starknet_types_rpc; \ No newline at end of file From 7f1304b1f04051043766555d1c3c8a56b36e5c1e Mon Sep 17 00:00:00 2001 From: Pia Date: Sat, 20 Jul 2024 23:57:58 +0200 Subject: [PATCH 06/39] feat: ci update --- .github/workflows/ci.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b3d8ef..b1f00e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,10 +83,22 @@ jobs: no-std-build: name: Test no_std support runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + layout: + [ + "dex", + "recursive", + "recursive_with_poseidon", + "small", + "starknet", + "starknet_with_keccak", + ] steps: - uses: actions/checkout@v3 - name: Check wasm compatibility run: |- cd ensure_no_std rustup show - cargo build -r + cargo build -r --features ${{ matrix.layout }},keccak From 2218cca190e03d0c8faf48b3589d4301ee5775f6 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 00:00:32 +0200 Subject: [PATCH 07/39] cargo toml fix --- ensure_no_std/Cargo.toml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml index f9f9c8f..96bdbc5 100644 --- a/ensure_no_std/Cargo.toml +++ b/ensure_no_std/Cargo.toml @@ -1,12 +1,7 @@ [package] name = "ensure_no_std" -description.workspace = true -edition.workspace = true -homepage.workspace = true -license-file.workspace = true -readme.workspace = true -repository.workspace = true -version.workspace = true +version = "0.1.0" +edition = "2021" [dependencies] cairovm_verifier_air = { workspace = true, default-features = false } From ca8dd35d5ffdad872e2d8bb4a34d9ca932e616c4 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 00:01:55 +0200 Subject: [PATCH 08/39] fix: cargo toml --- ensure_no_std/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml index 96bdbc5..65b3b15 100644 --- a/ensure_no_std/Cargo.toml +++ b/ensure_no_std/Cargo.toml @@ -4,9 +4,9 @@ version = "0.1.0" edition = "2021" [dependencies] -cairovm_verifier_air = { workspace = true, default-features = false } -cairovm_verifier_stark = { workspace = true, default-features = false } -cairovm_verifier_proof_parser = { workspace = true, default-features = false } +cairovm_verifier_air = { path = "crates/air", default-features = false } +cairovm_verifier_stark = { path = "crates/stark", default-features = false } +cairovm_verifier_proof_parser = { path = "proof-parser", default-features = false } [features] default = ["recursive", "keccak"] From 5cedd47658d78ac84ad16da23bcd8f12012914f0 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 00:03:56 +0200 Subject: [PATCH 09/39] fix:cargo.toml --- ensure_no_std/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml index 65b3b15..7b17682 100644 --- a/ensure_no_std/Cargo.toml +++ b/ensure_no_std/Cargo.toml @@ -4,9 +4,9 @@ version = "0.1.0" edition = "2021" [dependencies] -cairovm_verifier_air = { path = "crates/air", default-features = false } -cairovm_verifier_stark = { path = "crates/stark", default-features = false } -cairovm_verifier_proof_parser = { path = "proof-parser", default-features = false } +cairovm_verifier_air = { path = "../crates/air", default-features = false } +cairovm_verifier_stark = { path = "../crates/stark", default-features = false } +cairovm_verifier_proof_parser = { path = "../proof-parser", default-features = false } [features] default = ["recursive", "keccak"] From f475c47bfef7e9c234c40113c19fbba5000efe28 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 00:07:58 +0200 Subject: [PATCH 10/39] see if it works --- ensure_no_std/src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ensure_no_std/src/main.rs b/ensure_no_std/src/main.rs index cc14894..4c107f6 100644 --- a/ensure_no_std/src/main.rs +++ b/ensure_no_std/src/main.rs @@ -18,6 +18,8 @@ pub extern "C" fn _start() -> ! { static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; #[allow(unused_imports)] -use starknet_types_core; +use cairovm_verifier_air; #[allow(unused_imports)] -use starknet_types_rpc; \ No newline at end of file +use cairovm_verifier_proof_parser; +#[allow(unused_imports)] +use cairovm_verifier_stark; From d3fb06fff85f636a3c2ecd70a613a28efd5c33d4 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 00:08:36 +0200 Subject: [PATCH 11/39] cargo toml --- ensure_no_std/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml index 7b17682..6409d9b 100644 --- a/ensure_no_std/Cargo.toml +++ b/ensure_no_std/Cargo.toml @@ -8,6 +8,9 @@ cairovm_verifier_air = { path = "../crates/air", default-features = false } cairovm_verifier_stark = { path = "../crates/stark", default-features = false } cairovm_verifier_proof_parser = { path = "../proof-parser", default-features = false } +[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom = { version = "0.2.15", features = ["js"] } + [features] default = ["recursive", "keccak"] dex = [] From 69e872007452c886ea7c39b927ca4573545024e6 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 15:48:31 +0200 Subject: [PATCH 12/39] please --- .github/workflows/ci.yml | 2 +- ensure_no_std/Cargo.toml | 48 +++++++++++++++++++++++++++++++++------- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1f00e3..56e7a9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,4 +101,4 @@ jobs: run: |- cd ensure_no_std rustup show - cargo build -r --features ${{ matrix.layout }},keccak + cargo build -r --features ${{ matrix.layout }},keccak --no-default-features diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml index 6409d9b..97be568 100644 --- a/ensure_no_std/Cargo.toml +++ b/ensure_no_std/Cargo.toml @@ -13,11 +13,43 @@ getrandom = { version = "0.2.15", features = ["js"] } [features] default = ["recursive", "keccak"] -dex = [] -recursive = [] -recursive_with_poseidon = [] -small = [] -starknet = [] -starknet_with_keccak = [] -keccak = [] -blake2s = [] +dex = [ + "cairovm_verifier_air/dex", + "cairovm_verifier_stark/dex", + "cairovm_verifier_proof_parser/dex", +] +recursive = [ + "cairovm_verifier_air/recursive", + "cairovm_verifier_stark/recursive", + "cairovm_verifier_proof_parser/recursive", +] +recursive_with_poseidon = [ + "cairovm_verifier_air/recursive_with_poseidon", + "cairovm_verifier_stark/recursive_with_poseidon", + "cairovm_verifier_proof_parser/recursive_with_poseidon", +] +small = [ + "cairovm_verifier_air/small", + "cairovm_verifier_stark/small", + "cairovm_verifier_proof_parser/small", +] +starknet = [ + "cairovm_verifier_air/starknet", + "cairovm_verifier_stark/starknet", + "cairovm_verifier_proof_parser/starknet", +] +starknet_with_keccak = [ + "cairovm_verifier_air/starknet_with_keccak", + "cairovm_verifier_stark/starknet_with_keccak", + "cairovm_verifier_proof_parser/starknet_with_keccak", +] +keccak = [ + "cairovm_verifier_air/keccak", + "cairovm_verifier_stark/keccak", + "cairovm_verifier_proof_parser/keccak", +] +blake2s = [ + "cairovm_verifier_air/blake2s", + "cairovm_verifier_stark/blake2s", + "cairovm_verifier_proof_parser/blake2s", +] From 4253bc5d2c0b0b2817360bcd86a3899f14361da2 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 16:33:14 +0200 Subject: [PATCH 13/39] is this working? --- ensure_no_std/Cargo.toml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml index 97be568..e72f518 100644 --- a/ensure_no_std/Cargo.toml +++ b/ensure_no_std/Cargo.toml @@ -43,13 +43,5 @@ starknet_with_keccak = [ "cairovm_verifier_stark/starknet_with_keccak", "cairovm_verifier_proof_parser/starknet_with_keccak", ] -keccak = [ - "cairovm_verifier_air/keccak", - "cairovm_verifier_stark/keccak", - "cairovm_verifier_proof_parser/keccak", -] -blake2s = [ - "cairovm_verifier_air/blake2s", - "cairovm_verifier_stark/blake2s", - "cairovm_verifier_proof_parser/blake2s", -] +keccak = [] +blake2s = [] From 059b24aaa89526b8e12f0639c3f1d17efad4ac87 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 16:34:08 +0200 Subject: [PATCH 14/39] is this? --- ensure_no_std/Cargo.toml | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml index e72f518..e42d0f2 100644 --- a/ensure_no_std/Cargo.toml +++ b/ensure_no_std/Cargo.toml @@ -13,35 +13,20 @@ getrandom = { version = "0.2.15", features = ["js"] } [features] default = ["recursive", "keccak"] -dex = [ - "cairovm_verifier_air/dex", - "cairovm_verifier_stark/dex", - "cairovm_verifier_proof_parser/dex", -] +dex = ["cairovm_verifier_air/dex", "cairovm_verifier_stark/dex"] recursive = [ "cairovm_verifier_air/recursive", "cairovm_verifier_stark/recursive", - "cairovm_verifier_proof_parser/recursive", ] recursive_with_poseidon = [ "cairovm_verifier_air/recursive_with_poseidon", "cairovm_verifier_stark/recursive_with_poseidon", - "cairovm_verifier_proof_parser/recursive_with_poseidon", -] -small = [ - "cairovm_verifier_air/small", - "cairovm_verifier_stark/small", - "cairovm_verifier_proof_parser/small", -] -starknet = [ - "cairovm_verifier_air/starknet", - "cairovm_verifier_stark/starknet", - "cairovm_verifier_proof_parser/starknet", ] +small = ["cairovm_verifier_air/small", "cairovm_verifier_stark/small"] +starknet = ["cairovm_verifier_air/starknet", "cairovm_verifier_stark/starknet"] starknet_with_keccak = [ "cairovm_verifier_air/starknet_with_keccak", "cairovm_verifier_stark/starknet_with_keccak", - "cairovm_verifier_proof_parser/starknet_with_keccak", ] keccak = [] blake2s = [] From 5b53b9f0d8136aca2f5f3776197260f1fe7b4902 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 17:07:09 +0200 Subject: [PATCH 15/39] does this helps? --- crates/fri/Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/fri/Cargo.toml b/crates/fri/Cargo.toml index 1e287cb..b0d277a 100644 --- a/crates/fri/Cargo.toml +++ b/crates/fri/Cargo.toml @@ -11,6 +11,8 @@ version.workspace = true [features] default = ["std"] std = ["dep:thiserror"] +keccak = [] +blake2s = [] [dependencies] serde_with.workspace = true From 5d391897482cadefe60ae821587148819a789788 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 17:14:06 +0200 Subject: [PATCH 16/39] please? --- ensure_no_std/Cargo.toml | 5 +++-- ensure_no_std/src/main.rs | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml index e42d0f2..c3e7c0e 100644 --- a/ensure_no_std/Cargo.toml +++ b/ensure_no_std/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" cairovm_verifier_air = { path = "../crates/air", default-features = false } cairovm_verifier_stark = { path = "../crates/stark", default-features = false } cairovm_verifier_proof_parser = { path = "../proof-parser", default-features = false } +cairovm_verifier_commitment = { path = "../crates/commitment", default-features = false } [target.'cfg(target_arch = "wasm32")'.dependencies] getrandom = { version = "0.2.15", features = ["js"] } @@ -28,5 +29,5 @@ starknet_with_keccak = [ "cairovm_verifier_air/starknet_with_keccak", "cairovm_verifier_stark/starknet_with_keccak", ] -keccak = [] -blake2s = [] +keccak = ["cairovm_verifier_commitment/keccak"] +blake2s = ["cairovm_verifier_commitment/blake2s"] diff --git a/ensure_no_std/src/main.rs b/ensure_no_std/src/main.rs index 4c107f6..2d30542 100644 --- a/ensure_no_std/src/main.rs +++ b/ensure_no_std/src/main.rs @@ -20,6 +20,8 @@ static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; #[allow(unused_imports)] use cairovm_verifier_air; #[allow(unused_imports)] +use cairovm_verifier_commitment; +#[allow(unused_imports)] use cairovm_verifier_proof_parser; #[allow(unused_imports)] use cairovm_verifier_stark; From a9e8cee4992965e0b6f2bc22af4e58fe271c1168 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 17:16:42 +0200 Subject: [PATCH 17/39] feels gmi --- ensure_no_std/Cargo.toml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml index c3e7c0e..95f21e1 100644 --- a/ensure_no_std/Cargo.toml +++ b/ensure_no_std/Cargo.toml @@ -8,6 +8,7 @@ cairovm_verifier_air = { path = "../crates/air", default-features = false } cairovm_verifier_stark = { path = "../crates/stark", default-features = false } cairovm_verifier_proof_parser = { path = "../proof-parser", default-features = false } cairovm_verifier_commitment = { path = "../crates/commitment", default-features = false } +cairovm_verifier_pow = { path = "../crates/pow", default-features = false } [target.'cfg(target_arch = "wasm32")'.dependencies] getrandom = { version = "0.2.15", features = ["js"] } @@ -29,5 +30,8 @@ starknet_with_keccak = [ "cairovm_verifier_air/starknet_with_keccak", "cairovm_verifier_stark/starknet_with_keccak", ] -keccak = ["cairovm_verifier_commitment/keccak"] -blake2s = ["cairovm_verifier_commitment/blake2s"] +keccak = ["cairovm_verifier_commitment/keccak", "cairovm_verifier_pow/keccak"] +blake2s = [ + "cairovm_verifier_commitment/blake2s", + "cairovm_verifier_pow/blake2s", +] From 0c8dc4b4e3cadb0390b14ffe9689d12bcdb5d138 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 18:12:41 +0200 Subject: [PATCH 18/39] think i have one --- Cargo.toml | 8 -------- cli/Cargo.toml | 6 +++--- crates/air/Cargo.toml | 10 +++++++--- crates/commitment/Cargo.toml | 2 +- crates/fri/Cargo.toml | 6 +++--- crates/pow/Cargo.toml | 2 +- crates/stark/Cargo.toml | 18 ++++++++++++------ proof-parser/Cargo.toml | 12 +++++++----- proof-parser/src/lib.rs | 5 ----- wasm-binding/Cargo.toml | 8 ++++---- 10 files changed, 38 insertions(+), 39 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5808208..bc1da15 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,11 +40,3 @@ thiserror = "1.0.61" num-bigint = { version = "0.4.4", features = ["serde"] } blake2 = "0.10.6" wasm-bindgen = "0.2" - -cairovm_verifier_air = { path = "crates/air", default-features = false } -cairovm_verifier_commitment = { path = "crates/commitment", default-features = false } -cairovm_verifier_fri = { path = "crates/fri", default-features = false } -cairovm_verifier_pow = { path = "crates/pow", default-features = false } -cairovm_verifier_stark = { path = "crates/stark", default-features = false } -cairovm_verifier_transcript = { path = "crates/transcript", default-features = false } -cairovm_verifier_proof_parser = { path = "proof-parser", default-features = false } diff --git a/cli/Cargo.toml b/cli/Cargo.toml index b1bfe23..9978d22 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -12,9 +12,9 @@ version.workspace = true clap = { version = "4.4.4", features = ["derive"] } starknet-crypto.workspace = true -cairovm_verifier_air = { workspace = true, features = ["std"] } -cairovm_verifier_stark = { workspace = true, features = ["std"] } -cairovm_verifier_proof_parser = { workspace = true, features = ["std"] } +cairovm_verifier_air = { path = "../crates/air", features = ["std"] } +cairovm_verifier_stark = { path = "../crates/stark", features = ["std"] } +cairovm_verifier_proof_parser = { path = "../proof-parser", features = ["std"] } [features] default = ["recursive", "keccak"] diff --git a/crates/air/Cargo.toml b/crates/air/Cargo.toml index 9fd1352..2c58ec6 100644 --- a/crates/air/Cargo.toml +++ b/crates/air/Cargo.toml @@ -10,7 +10,11 @@ version.workspace = true [features] default = ["std", "recursive"] -std = ["dep:thiserror"] +std = [ + "dep:thiserror", + "cairovm_verifier_commitment/std", + "cairovm_verifier_transcript/std", +] dex = [] recursive = [] recursive_with_poseidon = [] @@ -27,5 +31,5 @@ starknet-crypto.workspace = true thiserror = { optional = true, workspace = true } thiserror-no-std.workspace = true -cairovm_verifier_commitment.workspace = true -cairovm_verifier_transcript.workspace = true +cairovm_verifier_commitment = { path = "../commitment", default-features = false } +cairovm_verifier_transcript = { path = "../transcript", default-features = false } diff --git a/crates/commitment/Cargo.toml b/crates/commitment/Cargo.toml index e2f56ea..3f9821f 100644 --- a/crates/commitment/Cargo.toml +++ b/crates/commitment/Cargo.toml @@ -27,4 +27,4 @@ thiserror-no-std.workspace = true crypto-bigint.workspace = true blake2.workspace = true -cairovm_verifier_transcript.workspace = true +cairovm_verifier_transcript = { path = "../transcript", default-features = false } diff --git a/crates/fri/Cargo.toml b/crates/fri/Cargo.toml index b0d277a..0dc4707 100644 --- a/crates/fri/Cargo.toml +++ b/crates/fri/Cargo.toml @@ -23,6 +23,6 @@ starknet-crypto.workspace = true thiserror = { optional = true, workspace = true } thiserror-no-std.workspace = true -cairovm_verifier_air.workspace = true -cairovm_verifier_commitment.workspace = true -cairovm_verifier_transcript.workspace = true +cairovm_verifier_air = { path = "../air", default-features = false } +cairovm_verifier_commitment = { path = "../commitment", default-features = false } +cairovm_verifier_transcript = { path = "../transcript", default-features = false } diff --git a/crates/pow/Cargo.toml b/crates/pow/Cargo.toml index 2d625e8..38f78eb 100644 --- a/crates/pow/Cargo.toml +++ b/crates/pow/Cargo.toml @@ -25,4 +25,4 @@ thiserror = { optional = true, workspace = true } thiserror-no-std.workspace = true blake2.workspace = true -cairovm_verifier_transcript.workspace = true +cairovm_verifier_transcript = { path = "../transcript", default-features = false } diff --git a/crates/stark/Cargo.toml b/crates/stark/Cargo.toml index f1965e9..8a3148d 100644 --- a/crates/stark/Cargo.toml +++ b/crates/stark/Cargo.toml @@ -10,7 +10,13 @@ version.workspace = true [features] default = ["std", "recursive"] -std = ["dep:thiserror"] +std = [ + "dep:thiserror", + "cairovm_verifier_air/std", + "cairovm_verifier_commitment/std", + "cairovm_verifier_fri/std", + "cairovm_verifier_pow/std", +] dex = [] recursive = [] recursive_with_poseidon = [] @@ -28,8 +34,8 @@ thiserror = { optional = true, workspace = true } thiserror-no-std.workspace = true wasm-bindgen.workspace = true -cairovm_verifier_air.workspace = true -cairovm_verifier_commitment.workspace = true -cairovm_verifier_fri.workspace = true -cairovm_verifier_pow.workspace = true -cairovm_verifier_transcript.workspace = true +cairovm_verifier_air = { path = "../air", default-features = false } +cairovm_verifier_commitment = { path = "../commitment", default-features = false } +cairovm_verifier_fri = { path = "../fri", default-features = false } +cairovm_verifier_pow = { path = "../pow", default-features = false } +cairovm_verifier_transcript = { path = "../transcript", default-features = false } diff --git a/proof-parser/Cargo.toml b/proof-parser/Cargo.toml index 3775674..02fdab3 100644 --- a/proof-parser/Cargo.toml +++ b/proof-parser/Cargo.toml @@ -11,6 +11,8 @@ version.workspace = true [features] default = ["std"] std = ["dep:thiserror"] +keccak = [] +blake2s = [] [dependencies] serde.workspace = true @@ -23,8 +25,8 @@ clap = { version = "4.5.1", features = ["derive"] } regex = "1.10.3" serde_json = "1.0.114" -cairovm_verifier_stark.workspace = true -cairovm_verifier_commitment.workspace = true -cairovm_verifier_fri.workspace = true -cairovm_verifier_air.workspace = true -cairovm_verifier_pow.workspace = true +cairovm_verifier_stark = { path = "../crates/stark", default-features = false } +cairovm_verifier_commitment = { path = "../crates/commitment", default-features = false } +cairovm_verifier_fri = { path = "../crates/fri", default-features = false } +cairovm_verifier_air = { path = "../crates/air", default-features = false } +cairovm_verifier_pow = { path = "../crates/pow", default-features = false } diff --git a/proof-parser/src/lib.rs b/proof-parser/src/lib.rs index aaab667..88cb6b7 100644 --- a/proof-parser/src/lib.rs +++ b/proof-parser/src/lib.rs @@ -14,11 +14,6 @@ mod stark_proof; mod utils; use crate::{json_parser::ProofJSON, stark_proof::StarkProof}; -use std::convert::TryFrom; -extern crate clap; -extern crate num_bigint; -extern crate regex; -extern crate serde; use alloc::string::String; use cairovm_verifier_stark::types::StarkProof as StarkProofFromVerifier; diff --git a/wasm-binding/Cargo.toml b/wasm-binding/Cargo.toml index ebe53aa..be1c8c9 100644 --- a/wasm-binding/Cargo.toml +++ b/wasm-binding/Cargo.toml @@ -12,9 +12,9 @@ version.workspace = true serde_json.workspace = true wasm-bindgen.workspace = true -cairovm_verifier_air = { workspace = true, default-features = false } -cairovm_verifier_stark = { workspace = true, default-features = false } -cairovm_verifier_proof_parser = { workspace = true, default-features = false } +cairovm_verifier_air = { path = "../crates/air", default-features = false } +cairovm_verifier_stark = { path = "../crates/stark", default-features = false } +cairovm_verifier_proof_parser = { path = "../proof-parser", default-features = false } [lib] crate-type = ["cdylib", "rlib"] @@ -31,4 +31,4 @@ small = [] starknet = [] starknet_with_keccak = [] keccak = [] -blake2s = [] \ No newline at end of file +blake2s = [] From 950175cec15fe8ec36857e1d01a97fd6b54003f3 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 18:19:34 +0200 Subject: [PATCH 19/39] cli fix --- cli/Cargo.toml | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 9978d22..3da6890 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -12,17 +12,32 @@ version.workspace = true clap = { version = "4.4.4", features = ["derive"] } starknet-crypto.workspace = true -cairovm_verifier_air = { path = "../crates/air", features = ["std"] } -cairovm_verifier_stark = { path = "../crates/stark", features = ["std"] } -cairovm_verifier_proof_parser = { path = "../proof-parser", features = ["std"] } +cairovm_verifier_air = { path = "../crates/air", features = [ + "std", +], default-features = false } +cairovm_verifier_stark = { path = "../crates/stark", features = [ + "std", +], default-features = false } +cairovm_verifier_proof_parser = { path = "../proof-parser", features = [ + "std", +], default-features = false } [features] default = ["recursive", "keccak"] -dex = [] -recursive = [] -recursive_with_poseidon = [] -small = [] -starknet = [] -starknet_with_keccak = [] +dex = ["cairovm_verifier_air/dex", "cairovm_verifier_stark/dex"] +recursive = [ + "cairovm_verifier_air/recursive", + "cairovm_verifier_stark/recursive", +] +recursive_with_poseidon = [ + "cairovm_verifier_air/recursive_with_poseidon", + "cairovm_verifier_stark/recursive_with_poseidon", +] +small = ["cairovm_verifier_air/small", "cairovm_verifier_stark/small"] +starknet = ["cairovm_verifier_air/starknet", "cairovm_verifier_stark/starknet"] +starknet_with_keccak = [ + "cairovm_verifier_air/starknet_with_keccak", + "cairovm_verifier_stark/starknet_with_keccak", +] keccak = [] blake2s = [] From 86e633cc25b2ccf4aceb955919692095d22c3904 Mon Sep 17 00:00:00 2001 From: Pia Date: Sun, 21 Jul 2024 18:36:01 +0200 Subject: [PATCH 20/39] hope this works --- Cargo.lock | 1 - cli/Cargo.toml | 4 +- ensure_no_std/Cargo.toml | 10 +++- ensure_no_std/src/main.rs | 2 +- proof-parser/Cargo.toml | 48 ++++++++++++++----- .../src/annotations/annotation_kind.rs | 4 -- proof-parser/src/annotations/extract.rs | 2 - proof-parser/src/annotations/mod.rs | 1 - proof-parser/src/builtins.rs | 5 +- proof-parser/src/conversion.rs | 1 - proof-parser/src/json_parser.rs | 1 - proof-parser/src/layout.rs | 4 -- proof-parser/src/lib.rs | 8 ---- proof-parser/src/stark_proof.rs | 1 - 14 files changed, 48 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0428938..e74f681 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -226,7 +226,6 @@ dependencies = [ "serde_json", "starknet-types-core", "thiserror", - "thiserror-no-std", ] [[package]] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 3da6890..27c841c 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -18,9 +18,7 @@ cairovm_verifier_air = { path = "../crates/air", features = [ cairovm_verifier_stark = { path = "../crates/stark", features = [ "std", ], default-features = false } -cairovm_verifier_proof_parser = { path = "../proof-parser", features = [ - "std", -], default-features = false } +cairovm_verifier_proof_parser = { path = "../proof-parser", default-features = false } [features] default = ["recursive", "keccak"] diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml index 95f21e1..7177ac4 100644 --- a/ensure_no_std/Cargo.toml +++ b/ensure_no_std/Cargo.toml @@ -6,9 +6,10 @@ edition = "2021" [dependencies] cairovm_verifier_air = { path = "../crates/air", default-features = false } cairovm_verifier_stark = { path = "../crates/stark", default-features = false } -cairovm_verifier_proof_parser = { path = "../proof-parser", default-features = false } cairovm_verifier_commitment = { path = "../crates/commitment", default-features = false } cairovm_verifier_pow = { path = "../crates/pow", default-features = false } +cairovm_verifier_fri = { path = "../crates/fri", default-features = false } +cairovm_verifier_transcript = { path = "../crates/transcript", default-features = false } [target.'cfg(target_arch = "wasm32")'.dependencies] getrandom = { version = "0.2.15", features = ["js"] } @@ -30,8 +31,13 @@ starknet_with_keccak = [ "cairovm_verifier_air/starknet_with_keccak", "cairovm_verifier_stark/starknet_with_keccak", ] -keccak = ["cairovm_verifier_commitment/keccak", "cairovm_verifier_pow/keccak"] +keccak = [ + "cairovm_verifier_commitment/keccak", + "cairovm_verifier_pow/keccak", + "cairovm_verifier_fri/keccak", +] blake2s = [ "cairovm_verifier_commitment/blake2s", "cairovm_verifier_pow/blake2s", + "cairovm_verifier_fri/blake2s", ] diff --git a/ensure_no_std/src/main.rs b/ensure_no_std/src/main.rs index 2d30542..4849013 100644 --- a/ensure_no_std/src/main.rs +++ b/ensure_no_std/src/main.rs @@ -22,6 +22,6 @@ use cairovm_verifier_air; #[allow(unused_imports)] use cairovm_verifier_commitment; #[allow(unused_imports)] -use cairovm_verifier_proof_parser; +use cairovm_verifier_pow; #[allow(unused_imports)] use cairovm_verifier_stark; diff --git a/proof-parser/Cargo.toml b/proof-parser/Cargo.toml index 02fdab3..5ab6452 100644 --- a/proof-parser/Cargo.toml +++ b/proof-parser/Cargo.toml @@ -9,15 +9,31 @@ repository.workspace = true version.workspace = true [features] -default = ["std"] -std = ["dep:thiserror"] -keccak = [] -blake2s = [] +default = ["keccak", "recursive"] +keccak = ["cairovm_verifier_pow/keccak", "cairovm_verifier_commitment/keccak"] +blake2s = [ + "cairovm_verifier_pow/blake2s", + "cairovm_verifier_commitment/blake2s", +] +dex = ["cairovm_verifier_air/dex", "cairovm_verifier_stark/dex"] +recursive = [ + "cairovm_verifier_air/recursive", + "cairovm_verifier_stark/recursive", +] +recursive_with_poseidon = [ + "cairovm_verifier_air/recursive_with_poseidon", + "cairovm_verifier_stark/recursive_with_poseidon", +] +small = ["cairovm_verifier_air/small", "cairovm_verifier_stark/small"] +starknet = ["cairovm_verifier_air/starknet", "cairovm_verifier_stark/starknet"] +starknet_with_keccak = [ + "cairovm_verifier_air/starknet_with_keccak", + "cairovm_verifier_stark/starknet_with_keccak", +] [dependencies] serde.workspace = true -thiserror = { optional = true, workspace = true } -thiserror-no-std.workspace = true +thiserror.workspace = true starknet-types-core.workspace = true num-bigint.workspace = true anyhow = "1.0.80" @@ -25,8 +41,18 @@ clap = { version = "4.5.1", features = ["derive"] } regex = "1.10.3" serde_json = "1.0.114" -cairovm_verifier_stark = { path = "../crates/stark", default-features = false } -cairovm_verifier_commitment = { path = "../crates/commitment", default-features = false } -cairovm_verifier_fri = { path = "../crates/fri", default-features = false } -cairovm_verifier_air = { path = "../crates/air", default-features = false } -cairovm_verifier_pow = { path = "../crates/pow", default-features = false } +cairovm_verifier_stark = { path = "../crates/stark", features = [ + "std", +], default-features = false } +cairovm_verifier_commitment = { path = "../crates/commitment", features = [ + "std", +], default-features = false } +cairovm_verifier_fri = { path = "../crates/fri", features = [ + "std", +], default-features = false } +cairovm_verifier_air = { path = "../crates/air", features = [ + "std", +], default-features = false } +cairovm_verifier_pow = { path = "../crates/pow", features = [ + "std", +], default-features = false } diff --git a/proof-parser/src/annotations/annotation_kind.rs b/proof-parser/src/annotations/annotation_kind.rs index 3748138..a23794c 100644 --- a/proof-parser/src/annotations/annotation_kind.rs +++ b/proof-parser/src/annotations/annotation_kind.rs @@ -1,8 +1,4 @@ use super::extract::{extract_annotations, extract_z_and_alpha}; -use alloc::format; -use alloc::string::String; -use alloc::vec; -use alloc::{string::ToString, vec::Vec}; use num_bigint::BigUint; #[derive(Debug, Clone, PartialEq, PartialOrd)] diff --git a/proof-parser/src/annotations/extract.rs b/proof-parser/src/annotations/extract.rs index c4ca36a..6e5040e 100644 --- a/proof-parser/src/annotations/extract.rs +++ b/proof-parser/src/annotations/extract.rs @@ -1,6 +1,4 @@ use super::annotation_kind::ZAlpha; -use alloc::format; -use alloc::vec::Vec; use num_bigint::BigUint; use regex::Regex; diff --git a/proof-parser/src/annotations/mod.rs b/proof-parser/src/annotations/mod.rs index 835d6f1..b8f1384 100644 --- a/proof-parser/src/annotations/mod.rs +++ b/proof-parser/src/annotations/mod.rs @@ -2,7 +2,6 @@ pub mod annotation_kind; pub mod extract; use self::annotation_kind::{Annotation, ZAlpha}; -use alloc::vec::Vec; use num_bigint::BigUint; #[derive(Debug, Clone, PartialEq)] diff --git a/proof-parser/src/builtins.rs b/proof-parser/src/builtins.rs index 6c8accc..d62b9d2 100644 --- a/proof-parser/src/builtins.rs +++ b/proof-parser/src/builtins.rs @@ -1,9 +1,6 @@ -use alloc::string::String; -use alloc::vec; -use alloc::vec::Vec; +use std::collections::HashMap; use crate::json_parser::MemorySegmentAddress; -use std::collections::HashMap; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Builtin { diff --git a/proof-parser/src/conversion.rs b/proof-parser/src/conversion.rs index bc9a4f6..c403bb1 100644 --- a/proof-parser/src/conversion.rs +++ b/proof-parser/src/conversion.rs @@ -1,4 +1,3 @@ -use alloc::vec; use cairovm_verifier_air::{ public_memory::PublicInput as PublicInputVerifier, trace::{ diff --git a/proof-parser/src/json_parser.rs b/proof-parser/src/json_parser.rs index 241c590..6545bbb 100644 --- a/proof-parser/src/json_parser.rs +++ b/proof-parser/src/json_parser.rs @@ -5,7 +5,6 @@ use crate::{ stark_proof::*, utils::log2_if_power_of_2, }; -use alloc::{string::String, vec, vec::Vec}; use num_bigint::BigUint; use serde::Deserialize; use std::{ diff --git a/proof-parser/src/layout.rs b/proof-parser/src/layout.rs index ef80f93..b8979a4 100644 --- a/proof-parser/src/layout.rs +++ b/proof-parser/src/layout.rs @@ -1,7 +1,3 @@ -use alloc::{ - string::{String, ToString}, - vec::Vec, -}; use num_bigint::BigUint; use serde::Deserialize; use std::{collections::BTreeMap, convert::TryInto, fmt::Display}; diff --git a/proof-parser/src/lib.rs b/proof-parser/src/lib.rs index 88cb6b7..b1156b9 100644 --- a/proof-parser/src/lib.rs +++ b/proof-parser/src/lib.rs @@ -1,10 +1,3 @@ -#![no_std] - -extern crate alloc; - -#[cfg(feature = "std")] -extern crate std; - mod annotations; mod builtins; mod conversion; @@ -14,7 +7,6 @@ mod stark_proof; mod utils; use crate::{json_parser::ProofJSON, stark_proof::StarkProof}; -use alloc::string::String; use cairovm_verifier_stark::types::StarkProof as StarkProofFromVerifier; pub fn parse(input: String) -> anyhow::Result { diff --git a/proof-parser/src/stark_proof.rs b/proof-parser/src/stark_proof.rs index c39495d..980cf69 100644 --- a/proof-parser/src/stark_proof.rs +++ b/proof-parser/src/stark_proof.rs @@ -1,4 +1,3 @@ -use alloc::{string::String, vec::Vec}; use num_bigint::BigUint; use std::collections::BTreeMap; From fd5f88ec64b8d019dea1376d7c3c4e08f947845a Mon Sep 17 00:00:00 2001 From: Pia Date: Mon, 22 Jul 2024 02:11:01 +0200 Subject: [PATCH 21/39] just to check ci --- wasm-binding/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wasm-binding/README.md b/wasm-binding/README.md index 5557fe6..5c40338 100644 --- a/wasm-binding/README.md +++ b/wasm-binding/README.md @@ -3,9 +3,10 @@ ![Version](https://img.shields.io/badge/v0.0.3-green?style=flat-square&logo=git&logoColor=white&label=version) ![Continuous Integration](https://img.shields.io/github/actions/workflow/status/iosis-tech/cairovm-verifier/ci.yml?style=flat-square&logo=githubactions&logoColor=white&label=Continuous%20Integration) -This is the Rust implementation of the Cairo-VM STARK verifier with layouts. The code is inspired by StarkWare's [Cairo-verifier](https://github.com/starkware-libs/cairo-lang) implementation in Cairo0. +This is the Rust implementation of the Cairo-VM STARK verifier with layouts. The code is inspired by StarkWare's [Cairo-verifier](https://github.com/starkware-libs/cairo-lang) implementation in Cairo0 ### Install wasm-pack + ```sh cargo install wasm-pack ``` @@ -14,4 +15,4 @@ cargo install wasm-pack ```sh wasm-pack build --target bundler --workspace --features starknet_with_keccak,blake2s --no-default-features -``` \ No newline at end of file +``` From 72fe346777991b2dd4bb8bc3da11a8810a677bbe Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Mon, 22 Jul 2024 13:12:34 +0200 Subject: [PATCH 22/39] features deps fixes and refactor --- Cargo.lock | 19 +- Cargo.toml | 18 +- README.md | 4 +- cli/Cargo.toml | 35 +- crates/air/Cargo.toml | 8 +- crates/commitment/Cargo.toml | 5 +- crates/fri/Cargo.toml | 17 +- crates/pow/Cargo.toml | 5 +- crates/stark/Cargo.toml | 26 +- crates/stark/src/verify.rs | 6 +- ensure_no_std/Cargo.toml | 43 - .../no_std}/.cargo/config.toml | 0 examples/no_std/Cargo.lock | 957 ++++++++++++++++++ examples/no_std/Cargo.toml | 43 + .../no_std}/rust-toolchain.toml | 2 +- .../no_std}/src/main.rs | 0 rust-toolchain.toml | 11 +- wasm-binding/Cargo.toml | 35 +- 18 files changed, 1131 insertions(+), 103 deletions(-) delete mode 100644 ensure_no_std/Cargo.toml rename {ensure_no_std => examples/no_std}/.cargo/config.toml (100%) create mode 100644 examples/no_std/Cargo.lock create mode 100644 examples/no_std/Cargo.toml rename {ensure_no_std => examples/no_std}/rust-toolchain.toml (89%) rename {ensure_no_std => examples/no_std}/src/main.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 3f531cc..6173ddb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -790,7 +790,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "swiftness" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "starknet-crypto", @@ -801,7 +801,7 @@ dependencies = [ [[package]] name = "swiftness_air" -version = "0.0.4" +version = "0.0.5" dependencies = [ "bail-out", "serde", @@ -816,7 +816,7 @@ dependencies = [ [[package]] name = "swiftness_commitment" -version = "0.0.4" +version = "0.0.5" dependencies = [ "blake2", "crypto-bigint", @@ -833,14 +833,13 @@ dependencies = [ [[package]] name = "swiftness_fri" -version = "0.0.4" +version = "0.0.5" dependencies = [ "serde", "serde_with", "sha3", "starknet-core", "starknet-crypto", - "swiftness_air", "swiftness_commitment", "swiftness_transcript", "thiserror", @@ -849,7 +848,7 @@ dependencies = [ [[package]] name = "swiftness_pow" -version = "0.0.4" +version = "0.0.5" dependencies = [ "bail-out", "blake2", @@ -864,7 +863,7 @@ dependencies = [ [[package]] name = "swiftness_proof_parser" -version = "0.0.4" +version = "0.0.5" dependencies = [ "anyhow", "clap", @@ -883,7 +882,7 @@ dependencies = [ [[package]] name = "swiftness_stark" -version = "0.0.4" +version = "0.0.5" dependencies = [ "bail-out", "serde", @@ -902,14 +901,14 @@ dependencies = [ [[package]] name = "swiftness_transcript" -version = "0.0.4" +version = "0.0.5" dependencies = [ "starknet-crypto", ] [[package]] name = "swiftness_wasm" -version = "0.0.4" +version = "0.0.5" dependencies = [ "getrandom", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 900f4d0..e0330a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ members = [ "cli", "wasm-binding", ] -exclude = ["ensure_no_std"] +exclude = ["examples/no_std"] [workspace.package] description = "Swiftness - Rust CairoVM Verifier implementation" @@ -22,7 +22,7 @@ edition = "2021" license-file = "LICENSE" readme = "README.md" repository = "https://github.com/iosis-tech/swiftness" -version = "0.0.4" +version = "0.0.5" [workspace.dependencies] bail-out = "0.2.0" @@ -40,10 +40,10 @@ num-bigint = { version = "0.4.4", features = ["serde"] } blake2 = "0.10.6" wasm-bindgen = "0.2" -swiftness_air = { path = "crates/air", default-features = false, version = "0.0.4" } -swiftness_commitment = { path = "crates/commitment", default-features = false, version = "0.0.4" } -swiftness_fri = { path = "crates/fri", default-features = false, version = "0.0.4" } -swiftness_pow = { path = "crates/pow", default-features = false, version = "0.0.4" } -swiftness_stark = { path = "crates/stark", default-features = false, version = "0.0.4" } -swiftness_transcript = { path = "crates/transcript", default-features = false, version = "0.0.4" } -swiftness_proof_parser = { path = "proof-parser", default-features = false, version = "0.0.4" } +swiftness_air = { path = "crates/air", default-features = false, version = "0.0.5" } +swiftness_commitment = { path = "crates/commitment", default-features = false, version = "0.0.5" } +swiftness_fri = { path = "crates/fri", default-features = false, version = "0.0.5" } +swiftness_pow = { path = "crates/pow", default-features = false, version = "0.0.5" } +swiftness_stark = { path = "crates/stark", default-features = false, version = "0.0.5" } +swiftness_transcript = { path = "crates/transcript", default-features = false, version = "0.0.5" } +swiftness_proof_parser = { path = "proof-parser", default-features = false, version = "0.0.5" } diff --git a/README.md b/README.md index 1598c7b..2b1cc65 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This is the Rust implementation of the Cairo-VM STARK verifier with layouts. The ### Verify example proof: ```sh -cargo run --release --bin swiftness --features starknet_with_keccak,keccak --no-default-features -- --proof examples/proofs/starknet_with_keccak/cairo0_example_proof.json +cargo run --release --bin swiftness --features std,starknet_with_keccak,keccak --no-default-features -- --proof examples/proofs/starknet_with_keccak/cairo0_example_proof.json ``` ## Run Tests @@ -25,7 +25,7 @@ cargo install wasm-pack ### Build WASM: ```sh -cd wasm-binding && wasm-pack build --target web --workspace --features starknet_with_keccak,blake2s --no-default-features +cd wasm-binding && wasm-pack build --target web --workspace --features std,starknet_with_keccak,blake2s --no-default-features ``` ## Features diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 0494339..d6eae70 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -16,12 +16,29 @@ swiftness_stark = { workspace = true } swiftness_proof_parser = { workspace = true } [features] -default = ["starknet_with_keccak", "blake2s"] -dex = [] -recursive = [] -recursive_with_poseidon = [] -small = [] -starknet = [] -starknet_with_keccak = [] -keccak = [] -blake2s = [] +default = ["std", "recursive", "keccak"] +std = [ + "swiftness_air/std", + "swiftness_stark/std", +] +dex = ["swiftness_air/dex", "swiftness_stark/dex"] +recursive = [ + "swiftness_air/recursive", + "swiftness_stark/recursive", +] +recursive_with_poseidon = [ + "swiftness_air/recursive_with_poseidon", + "swiftness_stark/recursive_with_poseidon", +] +small = ["swiftness_air/small", "swiftness_stark/small"] +starknet = ["swiftness_air/starknet", "swiftness_stark/starknet"] +starknet_with_keccak = [ + "swiftness_air/starknet_with_keccak", + "swiftness_stark/starknet_with_keccak", +] +keccak = [ + "swiftness_stark/keccak", +] +blake2s = [ + "swiftness_stark/blake2s", +] diff --git a/crates/air/Cargo.toml b/crates/air/Cargo.toml index 195ed92..f65f15b 100644 --- a/crates/air/Cargo.toml +++ b/crates/air/Cargo.toml @@ -8,7 +8,7 @@ repository.workspace = true version.workspace = true [features] -default = ["std", "recursive"] +default = ["std", "recursive", "keccak"] std = [ "dep:thiserror", "swiftness_commitment/std", @@ -20,6 +20,12 @@ recursive_with_poseidon = [] small = [] starknet = [] starknet_with_keccak = [] +keccak = [ + "swiftness_commitment/keccak", +] +blake2s = [ + "swiftness_commitment/blake2s", +] [dependencies] bail-out.workspace = true diff --git a/crates/commitment/Cargo.toml b/crates/commitment/Cargo.toml index 6b718f6..d022e89 100644 --- a/crates/commitment/Cargo.toml +++ b/crates/commitment/Cargo.toml @@ -9,7 +9,10 @@ version.workspace = true [features] default = ["std", "keccak"] -std = ["dep:thiserror"] +std = [ + "dep:thiserror", + "swiftness_transcript/std", +] keccak = [] blake2s = [] diff --git a/crates/fri/Cargo.toml b/crates/fri/Cargo.toml index 786d0f3..351083b 100644 --- a/crates/fri/Cargo.toml +++ b/crates/fri/Cargo.toml @@ -8,10 +8,18 @@ repository.workspace = true version.workspace = true [features] -default = ["std"] -std = ["dep:thiserror"] -keccak = [] -blake2s = [] +default = ["std", "keccak"] +std = [ + "dep:thiserror", + "swiftness_commitment/std", + "swiftness_transcript/std", +] +keccak = [ + "swiftness_commitment/keccak", +] +blake2s = [ + "swiftness_commitment/blake2s", +] [dependencies] serde_with.workspace = true @@ -22,6 +30,5 @@ starknet-crypto.workspace = true thiserror = { optional = true, workspace = true } thiserror-no-std.workspace = true -swiftness_air.workspace = true swiftness_commitment.workspace = true swiftness_transcript.workspace = true diff --git a/crates/pow/Cargo.toml b/crates/pow/Cargo.toml index d72074b..3f4ef11 100644 --- a/crates/pow/Cargo.toml +++ b/crates/pow/Cargo.toml @@ -9,7 +9,10 @@ version.workspace = true [features] default = ["std", "keccak"] -std = ["dep:thiserror"] +std = [ + "dep:thiserror", + "swiftness_transcript/std", +] keccak = [] blake2s = [] diff --git a/crates/stark/Cargo.toml b/crates/stark/Cargo.toml index e1411f3..6c7e690 100644 --- a/crates/stark/Cargo.toml +++ b/crates/stark/Cargo.toml @@ -8,7 +8,7 @@ repository.workspace = true version.workspace = true [features] -default = ["std", "recursive"] +default = ["std", "recursive", "keccak"] std = [ "dep:thiserror", "swiftness_air/std", @@ -16,12 +16,24 @@ std = [ "swiftness_fri/std", "swiftness_pow/std", ] -dex = [] -recursive = [] -recursive_with_poseidon = [] -small = [] -starknet = [] -starknet_with_keccak = [] +dex = ["swiftness_air/dex"] +recursive = [ + "swiftness_air/recursive", +] +recursive_with_poseidon = [ + "swiftness_air/recursive_with_poseidon", +] +small = ["swiftness_air/small"] +starknet = ["swiftness_air/starknet"] +starknet_with_keccak = [ + "swiftness_air/starknet_with_keccak", +] +keccak = [ + "swiftness_commitment/keccak", +] +blake2s = [ + "swiftness_commitment/blake2s", +] [dependencies] bail-out.workspace = true diff --git a/crates/stark/src/verify.rs b/crates/stark/src/verify.rs index e92a46f..f272efd 100644 --- a/crates/stark/src/verify.rs +++ b/crates/stark/src/verify.rs @@ -67,13 +67,13 @@ use thiserror::Error; #[cfg(feature = "std")] #[derive(Error, Debug)] pub enum Error { - #[cfg_attr(feature = "std", error("Fri Error"))] + #[error("Fri Error")] FriError(#[from] fri::Error), - #[cfg_attr(feature = "std", error("TraceDecommit Error"))] + #[error("TraceDecommit Error")] TraceDecommitError(#[from] swiftness_air::trace::decommit::Error), - #[cfg_attr(feature = "std", error("TableDecommit Error"))] + #[error("TableDecommit Error")] TableDecommitError(#[from] swiftness_commitment::table::decommit::Error), } diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml deleted file mode 100644 index 7177ac4..0000000 --- a/ensure_no_std/Cargo.toml +++ /dev/null @@ -1,43 +0,0 @@ -[package] -name = "ensure_no_std" -version = "0.1.0" -edition = "2021" - -[dependencies] -cairovm_verifier_air = { path = "../crates/air", default-features = false } -cairovm_verifier_stark = { path = "../crates/stark", default-features = false } -cairovm_verifier_commitment = { path = "../crates/commitment", default-features = false } -cairovm_verifier_pow = { path = "../crates/pow", default-features = false } -cairovm_verifier_fri = { path = "../crates/fri", default-features = false } -cairovm_verifier_transcript = { path = "../crates/transcript", default-features = false } - -[target.'cfg(target_arch = "wasm32")'.dependencies] -getrandom = { version = "0.2.15", features = ["js"] } - -[features] -default = ["recursive", "keccak"] -dex = ["cairovm_verifier_air/dex", "cairovm_verifier_stark/dex"] -recursive = [ - "cairovm_verifier_air/recursive", - "cairovm_verifier_stark/recursive", -] -recursive_with_poseidon = [ - "cairovm_verifier_air/recursive_with_poseidon", - "cairovm_verifier_stark/recursive_with_poseidon", -] -small = ["cairovm_verifier_air/small", "cairovm_verifier_stark/small"] -starknet = ["cairovm_verifier_air/starknet", "cairovm_verifier_stark/starknet"] -starknet_with_keccak = [ - "cairovm_verifier_air/starknet_with_keccak", - "cairovm_verifier_stark/starknet_with_keccak", -] -keccak = [ - "cairovm_verifier_commitment/keccak", - "cairovm_verifier_pow/keccak", - "cairovm_verifier_fri/keccak", -] -blake2s = [ - "cairovm_verifier_commitment/blake2s", - "cairovm_verifier_pow/blake2s", - "cairovm_verifier_fri/blake2s", -] diff --git a/ensure_no_std/.cargo/config.toml b/examples/no_std/.cargo/config.toml similarity index 100% rename from ensure_no_std/.cargo/config.toml rename to examples/no_std/.cargo/config.toml diff --git a/examples/no_std/Cargo.lock b/examples/no_std/Cargo.lock new file mode 100644 index 0000000..b566571 --- /dev/null +++ b/examples/no_std/Cargo.lock @@ -0,0 +1,957 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "bail-out" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa66d6fe2058f811faa3e6a16e6504d92b23eff948d766c132425d1dc3d51f5c" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "cc" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-targets", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.72", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "ensure_no_std" +version = "0.1.0" +dependencies = [ + "getrandom", + "swiftness_air", + "swiftness_commitment", + "swiftness_fri", + "swiftness_pow", + "swiftness_stark", + "swiftness_transcript", +] + +[[package]] +name = "flate2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", + "serde", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lambdaworks-crypto" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb5d4f22241504f7c7b8d2c3a7d7835d7c07117f10bff2a7d96a9ef6ef217c3" +dependencies = [ + "lambdaworks-math", + "serde", + "sha2", + "sha3", +] + +[[package]] +name = "lambdaworks-math" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "358e172628e713b80a530a59654154bfc45783a6ed70ea284839800cebdf8f97" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "serde" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "serde_json" +version = "1.0.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_json_pythonic" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62212da9872ca2a0cad0093191ee33753eddff9266cbbc1b4a602d13a3a768db" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +dependencies = [ + "base64 0.13.1", + "chrono", + "hex", + "indexmap", + "serde", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "starknet-core" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d506e02a4083290d13b427dfe437fd95aa8b56315c455bb2f9cdeca76620d457" +dependencies = [ + "base64 0.21.7", + "crypto-bigint", + "flate2", + "hex", + "serde", + "serde_json", + "serde_json_pythonic", + "serde_with", + "sha3", + "starknet-crypto", + "starknet-types-core", +] + +[[package]] +name = "starknet-crypto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2a821ad8d98c6c3e4d0e5097f3fe6e2ed120ada9d32be87cd1330c7923a2f0" +dependencies = [ + "crypto-bigint", + "hex", + "hmac", + "num-bigint", + "num-integer", + "num-traits", + "rfc6979", + "sha2", + "starknet-crypto-codegen", + "starknet-curve", + "starknet-types-core", + "zeroize", +] + +[[package]] +name = "starknet-crypto-codegen" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e179dedc3fa6da064e56811d3e05d446aa2f7459e4eb0e3e49378a337235437" +dependencies = [ + "starknet-curve", + "starknet-types-core", + "syn 2.0.72", +] + +[[package]] +name = "starknet-curve" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56935b306dcf0b8f14bb2a1257164b8478bb8be4801dfae0923f5b266d1b457c" +dependencies = [ + "starknet-types-core", +] + +[[package]] +name = "starknet-types-core" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6bacf0ba19bc721e518bc4bf389ff13daa8a7c5db5fd320600473b8aa9fcbd" +dependencies = [ + "lambdaworks-crypto", + "lambdaworks-math", + "num-bigint", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "swiftness_air" +version = "0.0.4" +dependencies = [ + "bail-out", + "serde", + "serde_with", + "starknet-core", + "starknet-crypto", + "swiftness_commitment", + "swiftness_transcript", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_commitment" +version = "0.0.4" +dependencies = [ + "blake2", + "crypto-bigint", + "serde", + "serde_with", + "sha3", + "starknet-core", + "starknet-crypto", + "starknet-types-core", + "swiftness_transcript", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_fri" +version = "0.0.4" +dependencies = [ + "serde", + "serde_with", + "sha3", + "starknet-core", + "starknet-crypto", + "swiftness_commitment", + "swiftness_transcript", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_pow" +version = "0.0.4" +dependencies = [ + "bail-out", + "blake2", + "serde", + "sha3", + "starknet-crypto", + "starknet-types-core", + "swiftness_transcript", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_stark" +version = "0.0.4" +dependencies = [ + "bail-out", + "serde", + "serde_with", + "starknet-core", + "starknet-crypto", + "swiftness_air", + "swiftness_commitment", + "swiftness_fri", + "swiftness_pow", + "swiftness_transcript", + "thiserror-no-std", + "wasm-bindgen", +] + +[[package]] +name = "swiftness_transcript" +version = "0.0.4" +dependencies = [ + "starknet-crypto", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror-impl-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "thiserror-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" +dependencies = [ + "thiserror-impl-no-std", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.72", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/no_std/Cargo.toml b/examples/no_std/Cargo.toml new file mode 100644 index 0000000..a8814ee --- /dev/null +++ b/examples/no_std/Cargo.toml @@ -0,0 +1,43 @@ +[package] +name = "ensure_no_std" +version = "0.1.0" +edition = "2021" + +[dependencies] +swiftness_air = { path = "../../crates/air", default-features = false } +swiftness_stark = { path = "../../crates/stark", default-features = false } +swiftness_commitment = { path = "../../crates/commitment", default-features = false } +swiftness_pow = { path = "../../crates/pow", default-features = false } +swiftness_fri = { path = "../../crates/fri", default-features = false } +swiftness_transcript = { path = "../../crates/transcript", default-features = false } + +[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom = { version = "0.2.15", features = ["js"] } + +[features] +default = ["recursive", "keccak"] +dex = ["swiftness_air/dex", "swiftness_stark/dex"] +recursive = [ + "swiftness_air/recursive", + "swiftness_stark/recursive", +] +recursive_with_poseidon = [ + "swiftness_air/recursive_with_poseidon", + "swiftness_stark/recursive_with_poseidon", +] +small = ["swiftness_air/small", "swiftness_stark/small"] +starknet = ["swiftness_air/starknet", "swiftness_stark/starknet"] +starknet_with_keccak = [ + "swiftness_air/starknet_with_keccak", + "swiftness_stark/starknet_with_keccak", +] +keccak = [ + "swiftness_commitment/keccak", + "swiftness_pow/keccak", + "swiftness_fri/keccak", +] +blake2s = [ + "swiftness_commitment/blake2s", + "swiftness_pow/blake2s", + "swiftness_fri/blake2s", +] \ No newline at end of file diff --git a/ensure_no_std/rust-toolchain.toml b/examples/no_std/rust-toolchain.toml similarity index 89% rename from ensure_no_std/rust-toolchain.toml rename to examples/no_std/rust-toolchain.toml index 9a83785..f5017ef 100644 --- a/ensure_no_std/rust-toolchain.toml +++ b/examples/no_std/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.77.2" +channel = "1.79.0" components = ["rustfmt", "clippy"] targets = ["wasm32-unknown-unknown"] profile = "minimal" diff --git a/ensure_no_std/src/main.rs b/examples/no_std/src/main.rs similarity index 100% rename from ensure_no_std/src/main.rs rename to examples/no_std/src/main.rs diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 4575244..16d70f4 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,10 @@ [toolchain] -channel = "stable" -profile = "minimal" \ No newline at end of file +channel = "1.79.0" +components = ["rustfmt", "clippy"] +profile = "minimal" + +[profile.dev] +panic = "abort" + +[profile.release] +panic = "abort" diff --git a/wasm-binding/Cargo.toml b/wasm-binding/Cargo.toml index 0151c3e..e3a165c 100644 --- a/wasm-binding/Cargo.toml +++ b/wasm-binding/Cargo.toml @@ -22,12 +22,29 @@ crate-type = ["cdylib", "rlib"] getrandom = { version = "0.2.15", features = ["js"] } [features] -default = ["starknet_with_keccak", "blake2s"] -dex = [] -recursive = [] -recursive_with_poseidon = [] -small = [] -starknet = [] -starknet_with_keccak = [] -keccak = [] -blake2s = [] +default = ["std", "recursive", "keccak"] +std = [ + "swiftness_air/std", + "swiftness_stark/std", +] +dex = ["swiftness_air/dex", "swiftness_stark/dex"] +recursive = [ + "swiftness_air/recursive", + "swiftness_stark/recursive", +] +recursive_with_poseidon = [ + "swiftness_air/recursive_with_poseidon", + "swiftness_stark/recursive_with_poseidon", +] +small = ["swiftness_air/small", "swiftness_stark/small"] +starknet = ["swiftness_air/starknet", "swiftness_stark/starknet"] +starknet_with_keccak = [ + "swiftness_air/starknet_with_keccak", + "swiftness_stark/starknet_with_keccak", +] +keccak = [ + "swiftness_stark/keccak", +] +blake2s = [ + "swiftness_stark/blake2s", +] \ No newline at end of file From 90968a07dae54c5db0ac072114c7fabb4100e5ae Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Mon, 22 Jul 2024 13:15:19 +0200 Subject: [PATCH 23/39] ci fix --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dea11a..c8a9093 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,7 +78,7 @@ jobs: ${{ runner.os }}-cargo-build- - name: Run verification - run: cargo run --release --bin swiftness --features ${{ matrix.layout }},keccak,std --no-default-features -- --proof examples/proofs/${{ matrix.layout }}/cairo0_example_proof.json + run: cargo run --release --bin swiftness --features std,${{ matrix.layout }},keccak --no-default-features -- --proof examples/proofs/${{ matrix.layout }}/cairo0_example_proof.json no-std-build: name: Test no_std support @@ -99,6 +99,6 @@ jobs: - uses: actions/checkout@v3 - name: Check wasm compatibility run: |- - cd ensure_no_std + cd examples/no_std rustup show cargo build -r --features ${{ matrix.layout }},keccak --no-default-features From b388defcff914eff0b9efaff98d16bf4017d2d0c Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Mon, 22 Jul 2024 13:19:28 +0200 Subject: [PATCH 24/39] no_std test package name change and import fix --- Cargo.toml | 2 +- examples/{no_std => no_std_example}/.cargo/config.toml | 0 examples/{no_std => no_std_example}/Cargo.lock | 0 examples/{no_std => no_std_example}/Cargo.toml | 2 +- examples/{no_std => no_std_example}/rust-toolchain.toml | 0 examples/{no_std => no_std_example}/src/main.rs | 8 ++++---- 6 files changed, 6 insertions(+), 6 deletions(-) rename examples/{no_std => no_std_example}/.cargo/config.toml (100%) rename examples/{no_std => no_std_example}/Cargo.lock (100%) rename examples/{no_std => no_std_example}/Cargo.toml (98%) rename examples/{no_std => no_std_example}/rust-toolchain.toml (100%) rename examples/{no_std => no_std_example}/src/main.rs (78%) diff --git a/Cargo.toml b/Cargo.toml index e0330a6..183705f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ members = [ "cli", "wasm-binding", ] -exclude = ["examples/no_std"] +exclude = ["examples/no_std_example"] [workspace.package] description = "Swiftness - Rust CairoVM Verifier implementation" diff --git a/examples/no_std/.cargo/config.toml b/examples/no_std_example/.cargo/config.toml similarity index 100% rename from examples/no_std/.cargo/config.toml rename to examples/no_std_example/.cargo/config.toml diff --git a/examples/no_std/Cargo.lock b/examples/no_std_example/Cargo.lock similarity index 100% rename from examples/no_std/Cargo.lock rename to examples/no_std_example/Cargo.lock diff --git a/examples/no_std/Cargo.toml b/examples/no_std_example/Cargo.toml similarity index 98% rename from examples/no_std/Cargo.toml rename to examples/no_std_example/Cargo.toml index a8814ee..b982677 100644 --- a/examples/no_std/Cargo.toml +++ b/examples/no_std_example/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ensure_no_std" +name = "no_std_example" version = "0.1.0" edition = "2021" diff --git a/examples/no_std/rust-toolchain.toml b/examples/no_std_example/rust-toolchain.toml similarity index 100% rename from examples/no_std/rust-toolchain.toml rename to examples/no_std_example/rust-toolchain.toml diff --git a/examples/no_std/src/main.rs b/examples/no_std_example/src/main.rs similarity index 78% rename from examples/no_std/src/main.rs rename to examples/no_std_example/src/main.rs index 4849013..9144f0f 100644 --- a/examples/no_std/src/main.rs +++ b/examples/no_std_example/src/main.rs @@ -18,10 +18,10 @@ pub extern "C" fn _start() -> ! { static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; #[allow(unused_imports)] -use cairovm_verifier_air; +use swiftness_air; #[allow(unused_imports)] -use cairovm_verifier_commitment; +use swiftness_commitment; #[allow(unused_imports)] -use cairovm_verifier_pow; +use swiftness_pow; #[allow(unused_imports)] -use cairovm_verifier_stark; +use swiftness_stark; From 97fd9effba783e87864adb105c48f700f1acfb99 Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Mon, 22 Jul 2024 13:21:14 +0200 Subject: [PATCH 25/39] proof-parser -> proof_parser --- Cargo.toml | 4 ++-- {proof-parser => proof_parser}/Cargo.toml | 0 {proof-parser => proof_parser}/README.md | 0 .../src/annotations/annotation_kind.rs | 0 {proof-parser => proof_parser}/src/annotations/extract.rs | 0 {proof-parser => proof_parser}/src/annotations/mod.rs | 0 {proof-parser => proof_parser}/src/builtins.rs | 0 {proof-parser => proof_parser}/src/conversion.rs | 0 {proof-parser => proof_parser}/src/json_parser.rs | 0 {proof-parser => proof_parser}/src/layout.rs | 0 {proof-parser => proof_parser}/src/lib.rs | 0 {proof-parser => proof_parser}/src/stark_proof.rs | 0 {proof-parser => proof_parser}/src/utils.rs | 0 13 files changed, 2 insertions(+), 2 deletions(-) rename {proof-parser => proof_parser}/Cargo.toml (100%) rename {proof-parser => proof_parser}/README.md (100%) rename {proof-parser => proof_parser}/src/annotations/annotation_kind.rs (100%) rename {proof-parser => proof_parser}/src/annotations/extract.rs (100%) rename {proof-parser => proof_parser}/src/annotations/mod.rs (100%) rename {proof-parser => proof_parser}/src/builtins.rs (100%) rename {proof-parser => proof_parser}/src/conversion.rs (100%) rename {proof-parser => proof_parser}/src/json_parser.rs (100%) rename {proof-parser => proof_parser}/src/layout.rs (100%) rename {proof-parser => proof_parser}/src/lib.rs (100%) rename {proof-parser => proof_parser}/src/stark_proof.rs (100%) rename {proof-parser => proof_parser}/src/utils.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 183705f..6cace06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ members = [ "crates/fri", "crates/pow", "crates/stark", - "proof-parser", + "proof_parser", "cli", "wasm-binding", ] @@ -46,4 +46,4 @@ swiftness_fri = { path = "crates/fri", default-features = false, version = "0.0. swiftness_pow = { path = "crates/pow", default-features = false, version = "0.0.5" } swiftness_stark = { path = "crates/stark", default-features = false, version = "0.0.5" } swiftness_transcript = { path = "crates/transcript", default-features = false, version = "0.0.5" } -swiftness_proof_parser = { path = "proof-parser", default-features = false, version = "0.0.5" } +swiftness_proof_parser = { path = "proof_parser", default-features = false, version = "0.0.5" } diff --git a/proof-parser/Cargo.toml b/proof_parser/Cargo.toml similarity index 100% rename from proof-parser/Cargo.toml rename to proof_parser/Cargo.toml diff --git a/proof-parser/README.md b/proof_parser/README.md similarity index 100% rename from proof-parser/README.md rename to proof_parser/README.md diff --git a/proof-parser/src/annotations/annotation_kind.rs b/proof_parser/src/annotations/annotation_kind.rs similarity index 100% rename from proof-parser/src/annotations/annotation_kind.rs rename to proof_parser/src/annotations/annotation_kind.rs diff --git a/proof-parser/src/annotations/extract.rs b/proof_parser/src/annotations/extract.rs similarity index 100% rename from proof-parser/src/annotations/extract.rs rename to proof_parser/src/annotations/extract.rs diff --git a/proof-parser/src/annotations/mod.rs b/proof_parser/src/annotations/mod.rs similarity index 100% rename from proof-parser/src/annotations/mod.rs rename to proof_parser/src/annotations/mod.rs diff --git a/proof-parser/src/builtins.rs b/proof_parser/src/builtins.rs similarity index 100% rename from proof-parser/src/builtins.rs rename to proof_parser/src/builtins.rs diff --git a/proof-parser/src/conversion.rs b/proof_parser/src/conversion.rs similarity index 100% rename from proof-parser/src/conversion.rs rename to proof_parser/src/conversion.rs diff --git a/proof-parser/src/json_parser.rs b/proof_parser/src/json_parser.rs similarity index 100% rename from proof-parser/src/json_parser.rs rename to proof_parser/src/json_parser.rs diff --git a/proof-parser/src/layout.rs b/proof_parser/src/layout.rs similarity index 100% rename from proof-parser/src/layout.rs rename to proof_parser/src/layout.rs diff --git a/proof-parser/src/lib.rs b/proof_parser/src/lib.rs similarity index 100% rename from proof-parser/src/lib.rs rename to proof_parser/src/lib.rs diff --git a/proof-parser/src/stark_proof.rs b/proof_parser/src/stark_proof.rs similarity index 100% rename from proof-parser/src/stark_proof.rs rename to proof_parser/src/stark_proof.rs diff --git a/proof-parser/src/utils.rs b/proof_parser/src/utils.rs similarity index 100% rename from proof-parser/src/utils.rs rename to proof_parser/src/utils.rs From 2794480f2b954b677a239b14e726ce4eed5c5acf Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Mon, 22 Jul 2024 13:21:51 +0200 Subject: [PATCH 26/39] wasm-binding -> wasm_bindings --- Cargo.toml | 2 +- {wasm-binding => wasm_bindings}/Cargo.toml | 0 {wasm-binding => wasm_bindings}/README.md | 0 {wasm-binding => wasm_bindings}/src/lib.rs | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename {wasm-binding => wasm_bindings}/Cargo.toml (100%) rename {wasm-binding => wasm_bindings}/README.md (100%) rename {wasm-binding => wasm_bindings}/src/lib.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 6cace06..4f4e3aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ members = [ "crates/stark", "proof_parser", "cli", - "wasm-binding", + "wasm_bindings", ] exclude = ["examples/no_std_example"] diff --git a/wasm-binding/Cargo.toml b/wasm_bindings/Cargo.toml similarity index 100% rename from wasm-binding/Cargo.toml rename to wasm_bindings/Cargo.toml diff --git a/wasm-binding/README.md b/wasm_bindings/README.md similarity index 100% rename from wasm-binding/README.md rename to wasm_bindings/README.md diff --git a/wasm-binding/src/lib.rs b/wasm_bindings/src/lib.rs similarity index 100% rename from wasm-binding/src/lib.rs rename to wasm_bindings/src/lib.rs From fb4c05dcf28baa91d029ac19d8c0f6fb4df5eb29 Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Mon, 22 Jul 2024 13:22:36 +0200 Subject: [PATCH 27/39] wasm_bindings ci fix --- .github/workflows/npm_publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm_publish.yaml b/.github/workflows/npm_publish.yaml index 57ace57..5ef0c33 100644 --- a/.github/workflows/npm_publish.yaml +++ b/.github/workflows/npm_publish.yaml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest env: - WORKING_DIR: wasm-binding # define the working directory here + WORKING_DIR: wasm_bindings # define the working directory here strategy: fail-fast: false From 42e8991ebfbad575d2a25b4b869439c920aa68cf Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Mon, 22 Jul 2024 13:23:31 +0200 Subject: [PATCH 28/39] ci fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8a9093..9ff48f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,6 +99,6 @@ jobs: - uses: actions/checkout@v3 - name: Check wasm compatibility run: |- - cd examples/no_std + cd examples/no_std_example rustup show cargo build -r --features ${{ matrix.layout }},keccak --no-default-features From 4b473fd2c16af7185dd3e9de3e4771fd67396433 Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Mon, 22 Jul 2024 13:32:38 +0200 Subject: [PATCH 29/39] minor refactor --- .gitignore | 1 - examples/no_std_example/Cargo.lock | 38 +++++++++++++++--------------- wasm_bindings/.gitignore | 2 ++ wasm_bindings/Cargo.toml | 2 +- 4 files changed, 22 insertions(+), 21 deletions(-) create mode 100644 wasm_bindings/.gitignore diff --git a/.gitignore b/.gitignore index 0b27d31..f315ad9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ # will have compiled files and executables debug/ target/ -pkg/ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html diff --git a/examples/no_std_example/Cargo.lock b/examples/no_std_example/Cargo.lock index b566571..4e430b4 100644 --- a/examples/no_std_example/Cargo.lock +++ b/examples/no_std_example/Cargo.lock @@ -198,19 +198,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "ensure_no_std" -version = "0.1.0" -dependencies = [ - "getrandom", - "swiftness_air", - "swiftness_commitment", - "swiftness_fri", - "swiftness_pow", - "swiftness_stark", - "swiftness_transcript", -] - [[package]] name = "flate2" version = "1.0.30" @@ -378,6 +365,19 @@ dependencies = [ "adler", ] +[[package]] +name = "no_std_example" +version = "0.1.0" +dependencies = [ + "getrandom", + "swiftness_air", + "swiftness_commitment", + "swiftness_fri", + "swiftness_pow", + "swiftness_stark", + "swiftness_transcript", +] + [[package]] name = "num-bigint" version = "0.4.6" @@ -645,7 +645,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "swiftness_air" -version = "0.0.4" +version = "0.0.5" dependencies = [ "bail-out", "serde", @@ -659,7 +659,7 @@ dependencies = [ [[package]] name = "swiftness_commitment" -version = "0.0.4" +version = "0.0.5" dependencies = [ "blake2", "crypto-bigint", @@ -675,7 +675,7 @@ dependencies = [ [[package]] name = "swiftness_fri" -version = "0.0.4" +version = "0.0.5" dependencies = [ "serde", "serde_with", @@ -689,7 +689,7 @@ dependencies = [ [[package]] name = "swiftness_pow" -version = "0.0.4" +version = "0.0.5" dependencies = [ "bail-out", "blake2", @@ -703,7 +703,7 @@ dependencies = [ [[package]] name = "swiftness_stark" -version = "0.0.4" +version = "0.0.5" dependencies = [ "bail-out", "serde", @@ -721,7 +721,7 @@ dependencies = [ [[package]] name = "swiftness_transcript" -version = "0.0.4" +version = "0.0.5" dependencies = [ "starknet-crypto", ] diff --git a/wasm_bindings/.gitignore b/wasm_bindings/.gitignore new file mode 100644 index 0000000..86c3eac --- /dev/null +++ b/wasm_bindings/.gitignore @@ -0,0 +1,2 @@ +pkg/ +LICENSE \ No newline at end of file diff --git a/wasm_bindings/Cargo.toml b/wasm_bindings/Cargo.toml index e3a165c..4dd4f17 100644 --- a/wasm_bindings/Cargo.toml +++ b/wasm_bindings/Cargo.toml @@ -2,7 +2,7 @@ name = "swiftness_wasm" description = "Swiftness CairoVM Verifier | swiftness-{layout}-{commitment hash}" edition.workspace = true -license = "Apache-2.0" +license-file.workspace = true readme = "README.md" repository.workspace = true version.workspace = true From 1990dd694f6e027c51e6c20242e2ef9c9ef3d8e5 Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Mon, 22 Jul 2024 13:45:23 +0200 Subject: [PATCH 30/39] no_std fix --- examples/no_std_example/src/main.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/examples/no_std_example/src/main.rs b/examples/no_std_example/src/main.rs index 9144f0f..816aff8 100644 --- a/examples/no_std_example/src/main.rs +++ b/examples/no_std_example/src/main.rs @@ -14,9 +14,6 @@ pub extern "C" fn _start() -> ! { loop {} } -#[global_allocator] -static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; - #[allow(unused_imports)] use swiftness_air; #[allow(unused_imports)] @@ -24,4 +21,4 @@ use swiftness_commitment; #[allow(unused_imports)] use swiftness_pow; #[allow(unused_imports)] -use swiftness_stark; +use swiftness_stark; \ No newline at end of file From 4ff45aad8706de923ecd18e5a4abf47da3e5a59e Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Mon, 22 Jul 2024 13:58:49 +0200 Subject: [PATCH 31/39] rename mocking no_std build for now more work tbd --- .github/workflows/ci.yml | 44 +++++++-------- Cargo.toml | 9 ++-- crates/air/Cargo.toml | 2 + crates/commitment/Cargo.toml | 1 + crates/fri/Cargo.toml | 2 + crates/pow/Cargo.toml | 1 + crates/stark/Cargo.toml | 2 + crates/transcript/Cargo.toml | 4 +- examples/no_std_build/.cargo/config.toml | 1 + .../Cargo.lock | 54 +------------------ .../Cargo.toml | 2 +- .../rust-toolchain.toml | 1 - .../src/main.rs | 0 examples/no_std_example/.cargo/config.toml | 2 - 14 files changed, 42 insertions(+), 83 deletions(-) create mode 100644 examples/no_std_build/.cargo/config.toml rename examples/{no_std_example => no_std_build}/Cargo.lock (94%) rename examples/{no_std_example => no_std_build}/Cargo.toml (98%) rename examples/{no_std_example => no_std_build}/rust-toolchain.toml (80%) rename examples/{no_std_example => no_std_build}/src/main.rs (100%) delete mode 100644 examples/no_std_example/.cargo/config.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ff48f3..609abfc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,25 +80,25 @@ jobs: - name: Run verification run: cargo run --release --bin swiftness --features std,${{ matrix.layout }},keccak --no-default-features -- --proof examples/proofs/${{ matrix.layout }}/cairo0_example_proof.json - no-std-build: - name: Test no_std support - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - layout: - [ - "dex", - "recursive", - "recursive_with_poseidon", - "small", - "starknet", - "starknet_with_keccak", - ] - steps: - - uses: actions/checkout@v3 - - name: Check wasm compatibility - run: |- - cd examples/no_std_example - rustup show - cargo build -r --features ${{ matrix.layout }},keccak --no-default-features + # no-std-build: + # name: Test no_std support + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # layout: + # [ + # "dex", + # "recursive", + # "recursive_with_poseidon", + # "small", + # "starknet", + # "starknet_with_keccak", + # ] + # steps: + # - uses: actions/checkout@v3 + # - name: Check wasm compatibility + # run: |- + # cd examples/no_std_build + # rustup show + # cargo build -r --features ${{ matrix.layout }},keccak --no-default-features diff --git a/Cargo.toml b/Cargo.toml index 4f4e3aa..2532f99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,10 @@ members = [ "cli", "wasm_bindings", ] -exclude = ["examples/no_std_example"] +exclude = [ + "examples/no_std_build", + "examples/arm_build", +] [workspace.package] description = "Swiftness - Rust CairoVM Verifier implementation" @@ -30,8 +33,8 @@ serde_json = "1.0.114" serde = { version = "1.0", features = ["derive"] } serde_with = "2.3.2" sha3 = "0.10.8" -starknet-core = "0.11.1" -starknet-crypto = "0.7.1" +starknet-core = { version = "0.11.1", default-features = false } +starknet-crypto = { version = "0.7.1", default-features = false } starknet-types-core = { version = "0.1.5", default-features = false } crypto-bigint = "0.5.5" thiserror-no-std = "=2.0.2" diff --git a/crates/air/Cargo.toml b/crates/air/Cargo.toml index f65f15b..cdfde66 100644 --- a/crates/air/Cargo.toml +++ b/crates/air/Cargo.toml @@ -13,6 +13,8 @@ std = [ "dep:thiserror", "swiftness_commitment/std", "swiftness_transcript/std", + "starknet-core/std", + "starknet-crypto/std", ] dex = [] recursive = [] diff --git a/crates/commitment/Cargo.toml b/crates/commitment/Cargo.toml index d022e89..a2a4977 100644 --- a/crates/commitment/Cargo.toml +++ b/crates/commitment/Cargo.toml @@ -12,6 +12,7 @@ default = ["std", "keccak"] std = [ "dep:thiserror", "swiftness_transcript/std", + "starknet-crypto/std", ] keccak = [] blake2s = [] diff --git a/crates/fri/Cargo.toml b/crates/fri/Cargo.toml index 351083b..678de0d 100644 --- a/crates/fri/Cargo.toml +++ b/crates/fri/Cargo.toml @@ -13,6 +13,8 @@ std = [ "dep:thiserror", "swiftness_commitment/std", "swiftness_transcript/std", + "starknet-core/std", + "starknet-crypto/std", ] keccak = [ "swiftness_commitment/keccak", diff --git a/crates/pow/Cargo.toml b/crates/pow/Cargo.toml index 3f4ef11..dded926 100644 --- a/crates/pow/Cargo.toml +++ b/crates/pow/Cargo.toml @@ -12,6 +12,7 @@ default = ["std", "keccak"] std = [ "dep:thiserror", "swiftness_transcript/std", + "starknet-crypto/std", ] keccak = [] blake2s = [] diff --git a/crates/stark/Cargo.toml b/crates/stark/Cargo.toml index 6c7e690..ec5abb1 100644 --- a/crates/stark/Cargo.toml +++ b/crates/stark/Cargo.toml @@ -11,6 +11,8 @@ version.workspace = true default = ["std", "recursive", "keccak"] std = [ "dep:thiserror", + "starknet-core/std", + "starknet-crypto/std", "swiftness_air/std", "swiftness_commitment/std", "swiftness_fri/std", diff --git a/crates/transcript/Cargo.toml b/crates/transcript/Cargo.toml index 0543f67..aadb56e 100644 --- a/crates/transcript/Cargo.toml +++ b/crates/transcript/Cargo.toml @@ -12,4 +12,6 @@ starknet-crypto.workspace = true [features] default = ["std"] -std = [] +std = [ + "starknet-crypto/std", +] diff --git a/examples/no_std_build/.cargo/config.toml b/examples/no_std_build/.cargo/config.toml new file mode 100644 index 0000000..a7b19c9 --- /dev/null +++ b/examples/no_std_build/.cargo/config.toml @@ -0,0 +1 @@ +[build] diff --git a/examples/no_std_example/Cargo.lock b/examples/no_std_build/Cargo.lock similarity index 94% rename from examples/no_std_example/Cargo.lock rename to examples/no_std_build/Cargo.lock index 4e430b4..be0e72d 100644 --- a/examples/no_std_example/Cargo.lock +++ b/examples/no_std_build/Cargo.lock @@ -2,12 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "android-tzdata" version = "0.1.1" @@ -111,15 +105,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - [[package]] name = "crypto-bigint" version = "0.5.5" @@ -198,16 +183,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "flate2" -version = "1.0.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - [[package]] name = "fnv" version = "1.0.7" @@ -322,27 +297,11 @@ dependencies = [ "cpufeatures", ] -[[package]] -name = "lambdaworks-crypto" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fb5d4f22241504f7c7b8d2c3a7d7835d7c07117f10bff2a7d96a9ef6ef217c3" -dependencies = [ - "lambdaworks-math", - "serde", - "sha2", - "sha3", -] - [[package]] name = "lambdaworks-math" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "358e172628e713b80a530a59654154bfc45783a6ed70ea284839800cebdf8f97" -dependencies = [ - "serde", - "serde_json", -] [[package]] name = "libc" @@ -357,16 +316,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", -] - -[[package]] -name = "no_std_example" +name = "no_std_build" version = "0.1.0" dependencies = [ "getrandom", @@ -566,7 +516,6 @@ checksum = "d506e02a4083290d13b427dfe437fd95aa8b56315c455bb2f9cdeca76620d457" dependencies = [ "base64 0.21.7", "crypto-bigint", - "flate2", "hex", "serde", "serde_json", @@ -623,7 +572,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce6bacf0ba19bc721e518bc4bf389ff13daa8a7c5db5fd320600473b8aa9fcbd" dependencies = [ - "lambdaworks-crypto", "lambdaworks-math", "num-bigint", "num-integer", diff --git a/examples/no_std_example/Cargo.toml b/examples/no_std_build/Cargo.toml similarity index 98% rename from examples/no_std_example/Cargo.toml rename to examples/no_std_build/Cargo.toml index b982677..c80aa53 100644 --- a/examples/no_std_example/Cargo.toml +++ b/examples/no_std_build/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "no_std_example" +name = "no_std_build" version = "0.1.0" edition = "2021" diff --git a/examples/no_std_example/rust-toolchain.toml b/examples/no_std_build/rust-toolchain.toml similarity index 80% rename from examples/no_std_example/rust-toolchain.toml rename to examples/no_std_build/rust-toolchain.toml index f5017ef..16d70f4 100644 --- a/examples/no_std_example/rust-toolchain.toml +++ b/examples/no_std_build/rust-toolchain.toml @@ -1,7 +1,6 @@ [toolchain] channel = "1.79.0" components = ["rustfmt", "clippy"] -targets = ["wasm32-unknown-unknown"] profile = "minimal" [profile.dev] diff --git a/examples/no_std_example/src/main.rs b/examples/no_std_build/src/main.rs similarity index 100% rename from examples/no_std_example/src/main.rs rename to examples/no_std_build/src/main.rs diff --git a/examples/no_std_example/.cargo/config.toml b/examples/no_std_example/.cargo/config.toml deleted file mode 100644 index f4e8c00..0000000 --- a/examples/no_std_example/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build] -target = "wasm32-unknown-unknown" From 9ea93d934ec96ece13ea52addeefe50fdec05d04 Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Mon, 22 Jul 2024 23:26:25 +0200 Subject: [PATCH 32/39] almost works --- examples/no_std_build/.cargo/config.toml | 1 + examples/no_std_build/Cargo.lock | 322 +++------------------- examples/no_std_build/Cargo.toml | 3 - examples/no_std_build/rust-toolchain.toml | 1 + 4 files changed, 44 insertions(+), 283 deletions(-) diff --git a/examples/no_std_build/.cargo/config.toml b/examples/no_std_build/.cargo/config.toml index a7b19c9..cdf1cc8 100644 --- a/examples/no_std_build/.cargo/config.toml +++ b/examples/no_std_build/.cargo/config.toml @@ -1 +1,2 @@ [build] +target="x86_64-unknown-none" \ No newline at end of file diff --git a/examples/no_std_build/Cargo.lock b/examples/no_std_build/Cargo.lock index be0e72d..1629091 100644 --- a/examples/no_std_build/Cargo.lock +++ b/examples/no_std_build/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - [[package]] name = "autocfg" version = "1.3.0" @@ -24,10 +9,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] -name = "bail-out" +name = "base16ct" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa66d6fe2058f811faa3e6a16e6504d92b23eff948d766c132425d1dc3d51f5c" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" @@ -59,18 +44,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "cc" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" - [[package]] name = "cfg-if" version = "1.0.0" @@ -83,19 +56,10 @@ version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ - "android-tzdata", - "iana-time-zone", "num-traits", "serde", - "windows-targets", ] -[[package]] -name = "core-foundation-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - [[package]] name = "cpufeatures" version = "0.2.12" @@ -112,7 +76,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "rand_core", + "serdect", "subtle", "zeroize", ] @@ -169,7 +133,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", - "serde", ] [[package]] @@ -199,25 +162,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hex" version = "0.4.3" @@ -233,61 +177,18 @@ dependencies = [ "digest", ] -[[package]] -name = "iana-time-zone" -version = "0.1.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - [[package]] name = "ident_case" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown", - "serde", -] - [[package]] name = "itoa" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" -[[package]] -name = "js-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" -dependencies = [ - "wasm-bindgen", -] - [[package]] name = "keccak" version = "0.1.5" @@ -309,17 +210,10 @@ version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - [[package]] name = "no_std_build" version = "0.1.0" dependencies = [ - "getrandom", "swiftness_air", "swiftness_commitment", "swiftness_fri", @@ -362,12 +256,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - [[package]] name = "powerfmt" version = "0.2.0" @@ -392,15 +280,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - [[package]] name = "rfc6979" version = "0.4.0" @@ -468,13 +347,23 @@ dependencies = [ "base64 0.13.1", "chrono", "hex", - "indexmap", "serde", "serde_json", - "serde_with_macros", + "serde_with_macros 2.3.3", "time", ] +[[package]] +name = "serde_with" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +dependencies = [ + "serde", + "serde_derive", + "serde_with_macros 3.9.0", +] + [[package]] name = "serde_with_macros" version = "2.3.3" @@ -487,6 +376,28 @@ dependencies = [ "syn 2.0.72", ] +[[package]] +name = "serde_with_macros" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "serdect" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" +dependencies = [ + "base16ct", + "serde", +] + [[package]] name = "sha2" version = "0.10.8" @@ -520,7 +431,7 @@ dependencies = [ "serde", "serde_json", "serde_json_pythonic", - "serde_with", + "serde_with 2.3.3", "sha3", "starknet-crypto", "starknet-types-core", @@ -595,9 +506,8 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" name = "swiftness_air" version = "0.0.5" dependencies = [ - "bail-out", "serde", - "serde_with", + "serde_with 3.9.0", "starknet-core", "starknet-crypto", "swiftness_commitment", @@ -612,7 +522,7 @@ dependencies = [ "blake2", "crypto-bigint", "serde", - "serde_with", + "serde_with 3.9.0", "sha3", "starknet-core", "starknet-crypto", @@ -626,7 +536,7 @@ name = "swiftness_fri" version = "0.0.5" dependencies = [ "serde", - "serde_with", + "serde_with 3.9.0", "sha3", "starknet-core", "starknet-crypto", @@ -639,7 +549,6 @@ dependencies = [ name = "swiftness_pow" version = "0.0.5" dependencies = [ - "bail-out", "blake2", "serde", "sha3", @@ -653,9 +562,8 @@ dependencies = [ name = "swiftness_stark" version = "0.0.5" dependencies = [ - "bail-out", "serde", - "serde_with", + "serde_with 3.9.0", "starknet-core", "starknet-crypto", "swiftness_air", @@ -664,7 +572,6 @@ dependencies = [ "swiftness_pow", "swiftness_transcript", "thiserror-no-std", - "wasm-bindgen", ] [[package]] @@ -723,12 +630,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", - "itoa", "num-conv", "powerfmt", "serde", "time-core", - "time-macros", ] [[package]] @@ -737,16 +642,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" -[[package]] -name = "time-macros" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" -dependencies = [ - "num-conv", - "time-core", -] - [[package]] name = "typenum" version = "1.17.0" @@ -765,139 +660,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.72", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - [[package]] name = "zeroize" version = "1.8.1" diff --git a/examples/no_std_build/Cargo.toml b/examples/no_std_build/Cargo.toml index c80aa53..921e2df 100644 --- a/examples/no_std_build/Cargo.toml +++ b/examples/no_std_build/Cargo.toml @@ -11,9 +11,6 @@ swiftness_pow = { path = "../../crates/pow", default-features = false } swiftness_fri = { path = "../../crates/fri", default-features = false } swiftness_transcript = { path = "../../crates/transcript", default-features = false } -[target.'cfg(target_arch = "wasm32")'.dependencies] -getrandom = { version = "0.2.15", features = ["js"] } - [features] default = ["recursive", "keccak"] dex = ["swiftness_air/dex", "swiftness_stark/dex"] diff --git a/examples/no_std_build/rust-toolchain.toml b/examples/no_std_build/rust-toolchain.toml index 16d70f4..dd1e5a3 100644 --- a/examples/no_std_build/rust-toolchain.toml +++ b/examples/no_std_build/rust-toolchain.toml @@ -1,6 +1,7 @@ [toolchain] channel = "1.79.0" components = ["rustfmt", "clippy"] +targets = ["x86_64-unknown-none"] profile = "minimal" [profile.dev] From 15d64ebb8ee840b87d147ddbf3884d9ae801900c Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Mon, 22 Jul 2024 23:26:44 +0200 Subject: [PATCH 33/39] WS to no_std --- Cargo.lock | 536 ++---------------- Cargo.toml | 27 +- cli/Cargo.toml | 4 +- crates/air/Cargo.toml | 1 - crates/air/src/layout/dex/global_values.rs | 141 ++++- crates/air/src/layout/dex/mod.rs | 2 +- .../air/src/layout/recursive/global_values.rs | 166 ++++-- crates/air/src/layout/recursive/mod.rs | 2 +- .../recursive_with_poseidon/global_values.rs | 196 +++++-- .../src/layout/recursive_with_poseidon/mod.rs | 2 +- crates/air/src/layout/small/global_values.rs | 141 ++++- crates/air/src/layout/small/mod.rs | 2 +- .../air/src/layout/starknet/global_values.rs | 236 ++++++-- crates/air/src/layout/starknet/mod.rs | 2 +- .../starknet_with_keccak/global_values.rs | 276 +++++++-- .../src/layout/starknet_with_keccak/mod.rs | 2 +- crates/air/src/public_memory.rs | 37 +- crates/air/src/trace/mod.rs | 11 +- crates/air/src/types.rs | 41 +- crates/commitment/src/table/config.rs | 6 +- crates/commitment/src/table/types.rs | 6 +- crates/commitment/src/vector/config.rs | 11 +- crates/commitment/src/vector/types.rs | 36 +- crates/fri/src/config.rs | 21 +- crates/fri/src/types.rs | 36 +- crates/pow/Cargo.toml | 1 - crates/pow/src/pow.rs | 3 +- crates/stark/Cargo.toml | 2 - crates/stark/src/config.rs | 21 +- crates/stark/src/oods.rs | 2 +- crates/stark/src/types.rs | 26 +- crates/transcript/src/lib.rs | 20 + proof_parser/Cargo.toml | 11 +- wasm_bindings/Cargo.toml | 4 +- 34 files changed, 1209 insertions(+), 822 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6173ddb..abe27b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,85 +8,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anstream" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" - -[[package]] -name = "anstyle-parse" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" -dependencies = [ - "anstyle", - "windows-sys", -] - -[[package]] -name = "anyhow" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" - [[package]] name = "autocfg" version = "1.3.0" @@ -94,10 +15,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] -name = "bail-out" +name = "base16ct" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa66d6fe2058f811faa3e6a16e6504d92b23eff948d766c132425d1dc3d51f5c" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" @@ -129,18 +50,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "cc" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" - [[package]] name = "cfg-if" version = "1.0.0" @@ -153,65 +62,10 @@ version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ - "android-tzdata", - "iana-time-zone", "num-traits", "serde", - "windows-targets", -] - -[[package]] -name = "clap" -version = "4.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" -dependencies = [ - "clap_builder", - "clap_derive", ] -[[package]] -name = "clap_builder" -version = "4.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.72", -] - -[[package]] -name = "clap_lex" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" - -[[package]] -name = "colorchoice" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" - -[[package]] -name = "core-foundation-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - [[package]] name = "cpufeatures" version = "0.2.12" @@ -237,7 +91,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "rand_core", + "serdect", "subtle", "zeroize", ] @@ -294,7 +148,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", - "serde", ] [[package]] @@ -334,31 +187,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - [[package]] name = "hex" version = "0.4.3" @@ -374,67 +202,18 @@ dependencies = [ "digest", ] -[[package]] -name = "iana-time-zone" -version = "0.1.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - [[package]] name = "ident_case" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown", - "serde", -] - -[[package]] -name = "is_terminal_polyfill" -version = "1.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" - [[package]] name = "itoa" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" -[[package]] -name = "js-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" -dependencies = [ - "wasm-bindgen", -] - [[package]] name = "keccak" version = "0.1.5" @@ -472,18 +251,6 @@ version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - [[package]] name = "miniz_oxide" version = "0.7.4" @@ -501,7 +268,6 @@ checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", - "serde", ] [[package]] @@ -528,12 +294,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - [[package]] name = "powerfmt" version = "0.2.0" @@ -558,44 +318,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "regex" -version = "1.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" - [[package]] name = "rfc6979" version = "0.4.0" @@ -663,13 +385,23 @@ dependencies = [ "base64 0.13.1", "chrono", "hex", - "indexmap", "serde", "serde_json", - "serde_with_macros", + "serde_with_macros 2.3.3", "time", ] +[[package]] +name = "serde_with" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +dependencies = [ + "serde", + "serde_derive", + "serde_with_macros 3.9.0", +] + [[package]] name = "serde_with_macros" version = "2.3.3" @@ -682,6 +414,28 @@ dependencies = [ "syn 2.0.72", ] +[[package]] +name = "serde_with_macros" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "serdect" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" +dependencies = [ + "base16ct", + "serde", +] + [[package]] name = "sha2" version = "0.10.8" @@ -716,7 +470,7 @@ dependencies = [ "serde", "serde_json", "serde_json_pythonic", - "serde_with", + "serde_with 2.3.3", "sha3", "starknet-crypto", "starknet-types-core", @@ -788,24 +542,12 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" -[[package]] -name = "swiftness" -version = "0.0.5" -dependencies = [ - "clap", - "starknet-crypto", - "swiftness_air", - "swiftness_proof_parser", - "swiftness_stark", -] - [[package]] name = "swiftness_air" version = "0.0.5" dependencies = [ - "bail-out", "serde", - "serde_with", + "serde_with 3.9.0", "starknet-core", "starknet-crypto", "swiftness_commitment", @@ -821,7 +563,7 @@ dependencies = [ "blake2", "crypto-bigint", "serde", - "serde_with", + "serde_with 3.9.0", "sha3", "starknet-core", "starknet-crypto", @@ -836,7 +578,7 @@ name = "swiftness_fri" version = "0.0.5" dependencies = [ "serde", - "serde_with", + "serde_with 3.9.0", "sha3", "starknet-core", "starknet-crypto", @@ -850,7 +592,6 @@ dependencies = [ name = "swiftness_pow" version = "0.0.5" dependencies = [ - "bail-out", "blake2", "serde", "sha3", @@ -861,32 +602,12 @@ dependencies = [ "thiserror-no-std", ] -[[package]] -name = "swiftness_proof_parser" -version = "0.0.5" -dependencies = [ - "anyhow", - "clap", - "num-bigint", - "regex", - "serde", - "serde_json", - "starknet-types-core", - "swiftness_air", - "swiftness_commitment", - "swiftness_fri", - "swiftness_pow", - "swiftness_stark", - "thiserror", -] - [[package]] name = "swiftness_stark" version = "0.0.5" dependencies = [ - "bail-out", "serde", - "serde_with", + "serde_with 3.9.0", "starknet-core", "starknet-crypto", "swiftness_air", @@ -896,7 +617,6 @@ dependencies = [ "swiftness_transcript", "thiserror", "thiserror-no-std", - "wasm-bindgen", ] [[package]] @@ -906,18 +626,6 @@ dependencies = [ "starknet-crypto", ] -[[package]] -name = "swiftness_wasm" -version = "0.0.5" -dependencies = [ - "getrandom", - "serde_json", - "swiftness_air", - "swiftness_proof_parser", - "swiftness_stark", - "wasm-bindgen", -] - [[package]] name = "syn" version = "1.0.109" @@ -987,12 +695,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", - "itoa", "num-conv", "powerfmt", "serde", "time-core", - "time-macros", ] [[package]] @@ -1001,16 +707,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" -[[package]] -name = "time-macros" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" -dependencies = [ - "num-conv", - "time-core", -] - [[package]] name = "typenum" version = "1.17.0" @@ -1023,160 +719,12 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.72", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - [[package]] name = "zeroize" version = "1.8.1" diff --git a/Cargo.toml b/Cargo.toml index 2532f99..6058503 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,13 +10,12 @@ members = [ "crates/fri", "crates/pow", "crates/stark", - "proof_parser", - "cli", - "wasm_bindings", ] exclude = [ + "cli", + "proof_parser", + "wasm_bindings", "examples/no_std_build", - "examples/arm_build", ] [workspace.package] @@ -28,20 +27,19 @@ repository = "https://github.com/iosis-tech/swiftness" version = "0.0.5" [workspace.dependencies] -bail-out = "0.2.0" -serde_json = "1.0.114" -serde = { version = "1.0", features = ["derive"] } -serde_with = "2.3.2" -sha3 = "0.10.8" +assure = "2.1.0" +blake2 = { version = "0.10.6", default-features = false } +crypto-bigint = { version = "0.5.5", default-features = false, features = ["serde"] } +num-bigint = { version = "0.4.4" } +serde = { version = "1.0", default-features = false, features = ["derive"] } +serde_json = { version = "1.0.114", default-features = false } +serde_with = { version = "3.8.3", default-features = false, features = ["macros"] } +sha3 = { version = "0.10.8", default-features = false } starknet-core = { version = "0.11.1", default-features = false } starknet-crypto = { version = "0.7.1", default-features = false } starknet-types-core = { version = "0.1.5", default-features = false } -crypto-bigint = "0.5.5" -thiserror-no-std = "=2.0.2" thiserror = "1.0.61" -num-bigint = { version = "0.4.4", features = ["serde"] } -blake2 = "0.10.6" -wasm-bindgen = "0.2" +thiserror-no-std = "2.0.2" swiftness_air = { path = "crates/air", default-features = false, version = "0.0.5" } swiftness_commitment = { path = "crates/commitment", default-features = false, version = "0.0.5" } @@ -49,4 +47,3 @@ swiftness_fri = { path = "crates/fri", default-features = false, version = "0.0. swiftness_pow = { path = "crates/pow", default-features = false, version = "0.0.5" } swiftness_stark = { path = "crates/stark", default-features = false, version = "0.0.5" } swiftness_transcript = { path = "crates/transcript", default-features = false, version = "0.0.5" } -swiftness_proof_parser = { path = "proof_parser", default-features = false, version = "0.0.5" } diff --git a/cli/Cargo.toml b/cli/Cargo.toml index d6eae70..a2908cb 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -8,12 +8,12 @@ repository.workspace = true version.workspace = true [dependencies] -clap = { version = "4.4.4", features = ["derive"] } starknet-crypto.workspace = true +clap = { version = "4.4.4", features = ["derive"] } +swiftness_proof_parser = { path = "../proof_parser", default-features = false, version = "0.0.5" } swiftness_air = { workspace = true } swiftness_stark = { workspace = true } -swiftness_proof_parser = { workspace = true } [features] default = ["std", "recursive", "keccak"] diff --git a/crates/air/Cargo.toml b/crates/air/Cargo.toml index cdfde66..98a9053 100644 --- a/crates/air/Cargo.toml +++ b/crates/air/Cargo.toml @@ -30,7 +30,6 @@ blake2s = [ ] [dependencies] -bail-out.workspace = true serde_with.workspace = true serde.workspace = true starknet-core.workspace = true diff --git a/crates/air/src/layout/dex/global_values.rs b/crates/air/src/layout/dex/global_values.rs index 2716518..f8aa21a 100644 --- a/crates/air/src/layout/dex/global_values.rs +++ b/crates/air/src/layout/dex/global_values.rs @@ -1,24 +1,35 @@ use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; use swiftness_transcript::transcript::Transcript; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct EcPoint { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub y: Felt, } #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct EcdsaSigConfig { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub alpha: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub beta: Felt, pub shift_point: EcPoint, } @@ -28,53 +39,116 @@ pub struct EcdsaSigConfig { #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct GlobalValues { // Public input. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub trace_length: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_pc: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub final_pc: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_ap: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub final_ap: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_pedersen_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_range_check_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_ecdsa_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_min: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_max: Felt, // Constants. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub offset_size: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub half_offset_size: Felt, pub pedersen_shift_point: EcPoint, pub ecdsa_sig_config: EcdsaSigConfig, // Periodic columns. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub pedersen_points_x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub pedersen_points_y: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub ecdsa_generator_points_x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub ecdsa_generator_points_y: Felt, // Interaction elements. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_hash_interaction_elm0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_interaction_elm: Felt, // Permutation products. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_public_memory_prod: Felt, } @@ -83,11 +157,20 @@ pub struct GlobalValues { #[serde_as] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct InteractionElements { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_hash_interaction_elm0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_interaction_elm: Felt, } diff --git a/crates/air/src/layout/dex/mod.rs b/crates/air/src/layout/dex/mod.rs index d4a8568..24d110d 100644 --- a/crates/air/src/layout/dex/mod.rs +++ b/crates/air/src/layout/dex/mod.rs @@ -8,11 +8,11 @@ use crate::{ }; use alloc::vec; use alloc::vec::Vec; -use bail_out::ensure; use global_values::{EcPoint, EcdsaSigConfig, GlobalValues, InteractionElements}; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash_many, Felt}; use swiftness_commitment::table::{commit::table_commit, decommit::table_decommit}; +use swiftness_transcript::ensure; use super::{CompositionPolyEvalError, LayoutTrait, PublicInputError}; diff --git a/crates/air/src/layout/recursive/global_values.rs b/crates/air/src/layout/recursive/global_values.rs index e15c969..ad835d7 100644 --- a/crates/air/src/layout/recursive/global_values.rs +++ b/crates/air/src/layout/recursive/global_values.rs @@ -1,15 +1,20 @@ use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; use swiftness_transcript::transcript::Transcript; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct EcPoint { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub y: Felt, } @@ -18,60 +23,135 @@ pub struct EcPoint { #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct GlobalValues { // Public input. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub trace_length: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_pc: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub final_pc: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_ap: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub final_ap: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_pedersen_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_range_check_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_bitwise_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_min: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_max: Felt, // Constants. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub offset_size: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub half_offset_size: Felt, pub pedersen_shift_point: EcPoint, // Periodic columns. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub pedersen_points_x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub pedersen_points_y: Felt, // Interaction elements. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_hash_interaction_elm0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_permutation_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_z: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_alpha: Felt, // Permutation products. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_first_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_permutation_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_final_cum_val: Felt, } @@ -80,17 +160,35 @@ pub struct GlobalValues { #[serde_as] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct InteractionElements { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_hash_interaction_elm0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_permutation_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_z: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_alpha: Felt, } diff --git a/crates/air/src/layout/recursive/mod.rs b/crates/air/src/layout/recursive/mod.rs index 8982c5e..f812586 100644 --- a/crates/air/src/layout/recursive/mod.rs +++ b/crates/air/src/layout/recursive/mod.rs @@ -8,11 +8,11 @@ use crate::{ }; use alloc::vec; use alloc::vec::Vec; -use bail_out::ensure; use global_values::{EcPoint, GlobalValues, InteractionElements}; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash_many, Felt}; use swiftness_commitment::table::{commit::table_commit, decommit::table_decommit}; +use swiftness_transcript::ensure; use super::{CompositionPolyEvalError, LayoutTrait, PublicInputError}; diff --git a/crates/air/src/layout/recursive_with_poseidon/global_values.rs b/crates/air/src/layout/recursive_with_poseidon/global_values.rs index 9b07ff5..795bcde 100644 --- a/crates/air/src/layout/recursive_with_poseidon/global_values.rs +++ b/crates/air/src/layout/recursive_with_poseidon/global_values.rs @@ -1,15 +1,20 @@ use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; use swiftness_transcript::transcript::Transcript; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct EcPoint { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub y: Felt, } @@ -18,72 +23,165 @@ pub struct EcPoint { #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct GlobalValues { // Public input. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub trace_length: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_pc: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub final_pc: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_ap: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub final_ap: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_pedersen_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_range_check_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_bitwise_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_poseidon_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_min: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_max: Felt, // Constants. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub offset_size: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub half_offset_size: Felt, pub pedersen_shift_point: EcPoint, // Periodic columns. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub pedersen_points_x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub pedersen_points_y: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_full_round_key0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_full_round_key1: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_full_round_key2: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_partial_round_key0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_partial_round_key1: Felt, // Interaction elements. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_hash_interaction_elm0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_permutation_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_z: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_alpha: Felt, // Permutation products. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_first_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_permutation_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_final_cum_val: Felt, } @@ -92,17 +190,35 @@ pub struct GlobalValues { #[serde_as] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct InteractionElements { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_hash_interaction_elm0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_permutation_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_z: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_alpha: Felt, } diff --git a/crates/air/src/layout/recursive_with_poseidon/mod.rs b/crates/air/src/layout/recursive_with_poseidon/mod.rs index 6ce3c28..32e502c 100644 --- a/crates/air/src/layout/recursive_with_poseidon/mod.rs +++ b/crates/air/src/layout/recursive_with_poseidon/mod.rs @@ -12,11 +12,11 @@ use crate::{ }; use alloc::vec; use alloc::vec::Vec; -use bail_out::ensure; use global_values::{EcPoint, GlobalValues, InteractionElements}; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash_many, Felt}; use swiftness_commitment::table::{commit::table_commit, decommit::table_decommit}; +use swiftness_transcript::ensure; use super::{CompositionPolyEvalError, LayoutTrait, PublicInputError}; diff --git a/crates/air/src/layout/small/global_values.rs b/crates/air/src/layout/small/global_values.rs index 2716518..f8aa21a 100644 --- a/crates/air/src/layout/small/global_values.rs +++ b/crates/air/src/layout/small/global_values.rs @@ -1,24 +1,35 @@ use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; use swiftness_transcript::transcript::Transcript; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct EcPoint { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub y: Felt, } #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct EcdsaSigConfig { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub alpha: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub beta: Felt, pub shift_point: EcPoint, } @@ -28,53 +39,116 @@ pub struct EcdsaSigConfig { #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct GlobalValues { // Public input. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub trace_length: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_pc: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub final_pc: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_ap: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub final_ap: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_pedersen_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_range_check_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_ecdsa_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_min: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_max: Felt, // Constants. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub offset_size: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub half_offset_size: Felt, pub pedersen_shift_point: EcPoint, pub ecdsa_sig_config: EcdsaSigConfig, // Periodic columns. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub pedersen_points_x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub pedersen_points_y: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub ecdsa_generator_points_x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub ecdsa_generator_points_y: Felt, // Interaction elements. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_hash_interaction_elm0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_interaction_elm: Felt, // Permutation products. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_public_memory_prod: Felt, } @@ -83,11 +157,20 @@ pub struct GlobalValues { #[serde_as] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct InteractionElements { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_hash_interaction_elm0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_interaction_elm: Felt, } diff --git a/crates/air/src/layout/small/mod.rs b/crates/air/src/layout/small/mod.rs index e2ed95e..b3de58b 100644 --- a/crates/air/src/layout/small/mod.rs +++ b/crates/air/src/layout/small/mod.rs @@ -8,11 +8,11 @@ use crate::{ }; use alloc::vec; use alloc::vec::Vec; -use bail_out::ensure; use global_values::{EcPoint, EcdsaSigConfig, GlobalValues, InteractionElements}; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash_many, Felt}; use swiftness_commitment::table::{commit::table_commit, decommit::table_decommit}; +use swiftness_transcript::ensure; use super::{CompositionPolyEvalError, LayoutTrait, PublicInputError}; diff --git a/crates/air/src/layout/starknet/global_values.rs b/crates/air/src/layout/starknet/global_values.rs index a58d0e5..4dbd28e 100644 --- a/crates/air/src/layout/starknet/global_values.rs +++ b/crates/air/src/layout/starknet/global_values.rs @@ -1,33 +1,50 @@ use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; use swiftness_transcript::transcript::Transcript; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct EcPoint { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub y: Felt, } #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct CurveConfig { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub alpha: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub beta: Felt, } #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct EcdsaSigConfig { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub alpha: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub beta: Felt, pub shift_point: EcPoint, } @@ -37,82 +54,187 @@ pub struct EcdsaSigConfig { #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct GlobalValues { // Public input. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub trace_length: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_pc: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub final_pc: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_ap: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub final_ap: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_pedersen_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_range_check_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_ecdsa_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_bitwise_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_ec_op_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_poseidon_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_min: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_max: Felt, // Constants. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub offset_size: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub half_offset_size: Felt, pub pedersen_shift_point: EcPoint, pub ecdsa_sig_config: EcdsaSigConfig, pub ec_op_curve_config: CurveConfig, // Periodic columns. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub pedersen_points_x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub pedersen_points_y: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub ecdsa_generator_points_x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub ecdsa_generator_points_y: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_full_round_key0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_full_round_key1: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_full_round_key2: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_partial_round_key0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_partial_round_key1: Felt, // Interaction elements. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_hash_interaction_elm0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_permutation_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_z: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_alpha: Felt, // Permutation products. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_first_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_permutation_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_final_cum_val: Felt, } @@ -121,17 +243,35 @@ pub struct GlobalValues { #[serde_as] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct InteractionElements { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_hash_interaction_elm0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_permutation_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_z: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_alpha: Felt, } diff --git a/crates/air/src/layout/starknet/mod.rs b/crates/air/src/layout/starknet/mod.rs index 041a0ab..23dca9e 100644 --- a/crates/air/src/layout/starknet/mod.rs +++ b/crates/air/src/layout/starknet/mod.rs @@ -14,11 +14,11 @@ use crate::{ }; use alloc::vec; use alloc::vec::Vec; -use bail_out::ensure; use global_values::{CurveConfig, EcPoint, EcdsaSigConfig, GlobalValues, InteractionElements}; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash_many, Felt}; use swiftness_commitment::table::{commit::table_commit, decommit::table_decommit}; +use swiftness_transcript::ensure; use super::{CompositionPolyEvalError, LayoutTrait, PublicInputError}; diff --git a/crates/air/src/layout/starknet_with_keccak/global_values.rs b/crates/air/src/layout/starknet_with_keccak/global_values.rs index e8f792b..882ece9 100644 --- a/crates/air/src/layout/starknet_with_keccak/global_values.rs +++ b/crates/air/src/layout/starknet_with_keccak/global_values.rs @@ -1,33 +1,50 @@ use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; use swiftness_transcript::transcript::Transcript; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct EcPoint { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub y: Felt, } #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct CurveConfig { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub alpha: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub beta: Felt, } #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct EcdsaSigConfig { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub alpha: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub beta: Felt, pub shift_point: EcPoint, } @@ -37,98 +54,227 @@ pub struct EcdsaSigConfig { #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct GlobalValues { // Public input. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub trace_length: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_pc: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub final_pc: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_ap: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub final_ap: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_pedersen_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_range_check_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_ecdsa_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_bitwise_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_ec_op_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_keccak_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub initial_poseidon_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_min: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_max: Felt, // Constants. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub offset_size: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub half_offset_size: Felt, pub pedersen_shift_point: EcPoint, pub ecdsa_sig_config: EcdsaSigConfig, pub ec_op_curve_config: CurveConfig, // Periodic columns. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub pedersen_points_x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub pedersen_points_y: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub ecdsa_generator_points_x: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub ecdsa_generator_points_y: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub keccak_keccak_keccak_round_key0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub keccak_keccak_keccak_round_key1: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub keccak_keccak_keccak_round_key3: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub keccak_keccak_keccak_round_key7: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub keccak_keccak_keccak_round_key15: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub keccak_keccak_keccak_round_key31: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub keccak_keccak_keccak_round_key63: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_full_round_key0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_full_round_key1: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_full_round_key2: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_partial_round_key0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub poseidon_poseidon_partial_round_key1: Felt, // Interaction elements. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_hash_interaction_elm0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_permutation_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_z: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_alpha: Felt, // Permutation products. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_first_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_permutation_public_memory_prod: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_final_cum_val: Felt, } @@ -137,17 +283,35 @@ pub struct GlobalValues { #[serde_as] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct InteractionElements { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub memory_multi_column_perm_hash_interaction_elm0: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check16_perm_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_permutation_interaction_elm: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_z: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub diluted_check_interaction_alpha: Felt, } diff --git a/crates/air/src/layout/starknet_with_keccak/mod.rs b/crates/air/src/layout/starknet_with_keccak/mod.rs index cf76234..93538a9 100644 --- a/crates/air/src/layout/starknet_with_keccak/mod.rs +++ b/crates/air/src/layout/starknet_with_keccak/mod.rs @@ -16,11 +16,11 @@ use crate::{ }; use alloc::vec; use alloc::vec::Vec; -use bail_out::ensure; use global_values::{CurveConfig, EcPoint, EcdsaSigConfig, GlobalValues, InteractionElements}; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash_many, Felt}; use swiftness_commitment::table::{commit::table_commit, decommit::table_decommit}; +use swiftness_transcript::ensure; use super::{CompositionPolyEvalError, LayoutTrait, PublicInputError}; diff --git a/crates/air/src/public_memory.rs b/crates/air/src/public_memory.rs index f12ac1e..99963af 100644 --- a/crates/air/src/public_memory.rs +++ b/crates/air/src/public_memory.rs @@ -3,7 +3,7 @@ use alloc::vec; use alloc::vec::Vec; use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::{serde::unsigned_field_element::UfeHex, types::NonZeroFelt}; +use starknet_core::types::NonZeroFelt; use starknet_crypto::{pedersen_hash, poseidon_hash_many, Felt}; pub const MAX_LOG_N_STEPS: Felt = Felt::from_hex_unchecked("50"); @@ -14,20 +14,41 @@ pub const INITIAL_PC: Felt = Felt::from_hex_unchecked("0x1"); #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct PublicInput { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub log_n_steps: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_min: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub range_check_max: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub layout: Felt, - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "Vec") + )] pub dynamic_params: Vec, pub segments: Vec, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub padding_addr: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub padding_value: Felt, pub main_page: Page, pub continuous_page_headers: Vec, diff --git a/crates/air/src/trace/mod.rs b/crates/air/src/trace/mod.rs index bbaa610..3feaa86 100644 --- a/crates/air/src/trace/mod.rs +++ b/crates/air/src/trace/mod.rs @@ -3,7 +3,6 @@ pub mod decommit; use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; // Commitment values for the Traces component. Used to generate a commitment by "reading" these @@ -11,9 +10,15 @@ use starknet_crypto::Felt; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct UnsentCommitment { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub original: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub interaction: Felt, } diff --git a/crates/air/src/types.rs b/crates/air/src/types.rs index 44d7ecc..403cd3e 100644 --- a/crates/air/src/types.rs +++ b/crates/air/src/types.rs @@ -2,26 +2,37 @@ use alloc::vec::Vec; use core::ops::Deref; use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct SegmentInfo { // Start address of the memory segment. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub begin_addr: Felt, // Stop pointer of the segment - not necessarily the end of the segment. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub stop_ptr: Felt, } #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct AddrValue { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub address: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub value: Felt, } @@ -65,15 +76,27 @@ impl Page { #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct ContinuousPageHeader { // Start address. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub start_address: Felt, // Size of the page. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub size: Felt, // Hash of the page. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub hash: Felt, // Cumulative product of the page. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub prod: Felt, } diff --git a/crates/commitment/src/table/config.rs b/crates/commitment/src/table/config.rs index d9131d7..5ebab03 100644 --- a/crates/commitment/src/table/config.rs +++ b/crates/commitment/src/table/config.rs @@ -1,13 +1,15 @@ use crate::vector; use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; #[serde_as] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Config { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub n_columns: Felt, pub vector: vector::config::Config, } diff --git a/crates/commitment/src/table/types.rs b/crates/commitment/src/table/types.rs index 1d8b0e0..b6e3798 100644 --- a/crates/commitment/src/table/types.rs +++ b/crates/commitment/src/table/types.rs @@ -3,7 +3,6 @@ use crate::vector; use alloc::vec::Vec; use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; // Commitment for a table (n_rows x n_columns) of field elements in montgomery form. @@ -19,7 +18,10 @@ pub struct Commitment { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Decommitment { // n_columns * n_queries values to decommit. - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub values: Vec, } diff --git a/crates/commitment/src/vector/config.rs b/crates/commitment/src/vector/config.rs index ff46b42..6120ca2 100644 --- a/crates/commitment/src/vector/config.rs +++ b/crates/commitment/src/vector/config.rs @@ -1,14 +1,19 @@ use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; #[serde_as] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Config { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub height: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub n_verifier_friendly_commitment_layers: Felt, } diff --git a/crates/commitment/src/vector/types.rs b/crates/commitment/src/vector/types.rs index ea2a575..8066f66 100644 --- a/crates/commitment/src/vector/types.rs +++ b/crates/commitment/src/vector/types.rs @@ -2,7 +2,6 @@ use super::config::Config; use alloc::vec::Vec; use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; // Commitment for a vector of field elements. @@ -10,7 +9,10 @@ use starknet_crypto::Felt; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Commitment { pub config: Config, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub commitment_hash: Felt, } @@ -18,9 +20,15 @@ pub struct Commitment { #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct Query { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub index: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub value: Felt, } @@ -28,11 +36,20 @@ pub struct Query { #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct QueryWithDepth { - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub index: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub value: Felt, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub depth: Felt, } @@ -42,6 +59,9 @@ pub struct QueryWithDepth { pub struct Witness { // The authentication values: all the siblings of the subtree generated by the queried indices, // bottom layer up, left to right. - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "Vec") + )] pub authentications: Vec, } diff --git a/crates/fri/src/config.rs b/crates/fri/src/config.rs index 2277e8e..47f0e54 100644 --- a/crates/fri/src/config.rs +++ b/crates/fri/src/config.rs @@ -1,7 +1,6 @@ use alloc::vec::Vec; use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; const MAX_LAST_LAYER_LOG_DEGREE_BOUND: u64 = 15; @@ -14,19 +13,31 @@ const MIN_FRI_STEP: u64 = 1; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Config { // Log2 of the size of the input layer to FRI. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub log_input_size: Felt, // Number of layers in the FRI. Inner + last layer. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub n_layers: Felt, // Array of size n_layers - 1, each entry is a configuration of a table commitment for the // corresponding inner layer. pub inner_layers: Vec, // Array of size n_layers, each entry represents the FRI step size, // i.e. the number of FRI-foldings between layer i and i+1. - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "Vec") + )] pub fri_step_sizes: Vec, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub log_last_layer_degree_bound: Felt, } diff --git a/crates/fri/src/types.rs b/crates/fri/src/types.rs index 7c7cd8a..c629b68 100644 --- a/crates/fri/src/types.rs +++ b/crates/fri/src/types.rs @@ -2,7 +2,6 @@ use crate::config::Config; use alloc::vec::Vec; use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; // Commitment values for FRI. Used to generate a commitment by "reading" these values @@ -11,11 +10,17 @@ use starknet_crypto::Felt; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct UnsentCommitment { // Array of size n_layers - 1 containing unsent table commitments for each inner layer. - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "Vec") + )] pub inner_layers: Vec, // Array of size 2**log_last_layer_degree_bound containing coefficients for the last layer // polynomial. - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "Vec") + )] pub last_layer_coefficients: Vec, } @@ -26,11 +31,17 @@ pub struct Commitment { // Array of size n_layers - 1 containing table commitments for each inner layer. pub inner_layers: Vec, // Array of size n_layers, of one evaluation point for each layer. - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "Vec") + )] pub eval_points: Vec, // Array of size 2**log_last_layer_degree_bound containing coefficients for the last layer // polynomial. - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "Vec") + )] pub last_layer_coefficients: Vec, } @@ -38,11 +49,17 @@ pub struct Commitment { #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct Decommitment { // Array of size n_values, containing the values of the input layer at query indices. - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "Vec") + )] pub values: Vec, // Array of size n_values, containing the field elements that correspond to the query indices // (See queries_to_points). - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "Vec") + )] pub points: Vec, } @@ -59,7 +76,10 @@ pub struct Witness { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct LayerWitness { // Values for the sibling leaves required for decommitment. - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "Vec") + )] pub leaves: Vec, // Table commitment witnesses for decommiting all the leaves. pub table_witness: swiftness_commitment::table::types::Witness, diff --git a/crates/pow/Cargo.toml b/crates/pow/Cargo.toml index dded926..07b9eac 100644 --- a/crates/pow/Cargo.toml +++ b/crates/pow/Cargo.toml @@ -18,7 +18,6 @@ keccak = [] blake2s = [] [dependencies] -bail-out.workspace = true serde.workspace = true sha3.workspace = true starknet-crypto.workspace = true diff --git a/crates/pow/src/pow.rs b/crates/pow/src/pow.rs index 754da4c..c056d83 100644 --- a/crates/pow/src/pow.rs +++ b/crates/pow/src/pow.rs @@ -8,10 +8,9 @@ use sha3::Digest; #[cfg(feature = "keccak")] use sha3::Keccak256; -use bail_out::assure; use serde::{Deserialize, Serialize}; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; +use swiftness_transcript::{assure, transcript::Transcript}; use crate::config::Config; diff --git a/crates/stark/Cargo.toml b/crates/stark/Cargo.toml index ec5abb1..4eb04b5 100644 --- a/crates/stark/Cargo.toml +++ b/crates/stark/Cargo.toml @@ -38,14 +38,12 @@ blake2s = [ ] [dependencies] -bail-out.workspace = true serde_with.workspace = true serde.workspace = true starknet-core.workspace = true starknet-crypto.workspace = true thiserror = { optional = true, workspace = true } thiserror-no-std.workspace = true -wasm-bindgen.workspace = true swiftness_air.workspace = true swiftness_commitment.workspace = true diff --git a/crates/stark/src/config.rs b/crates/stark/src/config.rs index 13dda79..0d87ecf 100644 --- a/crates/stark/src/config.rs +++ b/crates/stark/src/config.rs @@ -1,6 +1,5 @@ use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; #[serde_as] @@ -11,17 +10,29 @@ pub struct StarkConfig { pub fri: swiftness_fri::config::Config, pub proof_of_work: swiftness_pow::config::Config, // Log2 of the trace domain size. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub log_trace_domain_size: Felt, // Number of queries to the last component, FRI. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub n_queries: Felt, // Log2 of the number of cosets composing the evaluation domain, where the coset size is the // trace length. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub log_n_cosets: Felt, // Number of layers that use a verifier friendly hash in each commitment. - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub n_verifier_friendly_commitment_layers: Felt, } diff --git a/crates/stark/src/oods.rs b/crates/stark/src/oods.rs index 5ec7d2d..5a70254 100644 --- a/crates/stark/src/oods.rs +++ b/crates/stark/src/oods.rs @@ -1,5 +1,4 @@ use alloc::vec::Vec; -use bail_out::assure; use starknet_crypto::Felt; #[cfg(feature = "dex")] use swiftness_air::layout::dex::CONSTRAINT_DEGREE; @@ -60,6 +59,7 @@ pub fn verify_oods( ) } +use swiftness_transcript::assure; #[cfg(feature = "std")] use thiserror::Error; diff --git a/crates/stark/src/types.rs b/crates/stark/src/types.rs index 5bc31eb..e5fc5a9 100644 --- a/crates/stark/src/types.rs +++ b/crates/stark/src/types.rs @@ -1,7 +1,6 @@ use alloc::vec::Vec; use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; use crate::config; @@ -18,12 +17,18 @@ pub struct StarkProof { #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct StarkUnsentCommitment { pub traces: swiftness_air::trace::UnsentCommitment, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub composition: Felt, // n_oods_values elements. The i-th value is the evaluation of the i-th mask item polynomial at // the OODS point, where the mask item polynomial is the interpolation polynomial of the // corresponding column shifted by the corresponding row_offset. - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "Vec") + )] pub oods_values: Vec, pub fri: swiftness_fri::types::UnsentCommitment, pub proof_of_work: swiftness_pow::pow::UnsentCommitment, @@ -34,11 +39,20 @@ pub struct StarkUnsentCommitment { pub struct StarkCommitment { pub traces: swiftness_air::trace::Commitment, pub composition: swiftness_commitment::table::types::Commitment, - #[serde_as(as = "UfeHex")] + #[cfg_attr( + feature = "std", + serde_as(as = "starknet_core::serde::unsigned_field_element::UfeHex") + )] pub interaction_after_composition: Felt, - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "Vec") + )] pub oods_values: Vec, - #[serde_as(as = "Vec")] + #[cfg_attr( + feature = "std", + serde_as(as = "Vec") + )] pub interaction_after_oods: Vec, pub fri: swiftness_fri::types::Commitment, } diff --git a/crates/transcript/src/lib.rs b/crates/transcript/src/lib.rs index df9dc1b..9ed0638 100644 --- a/crates/transcript/src/lib.rs +++ b/crates/transcript/src/lib.rs @@ -6,3 +6,23 @@ pub mod transcript; #[cfg(test)] pub mod tests; + +#[macro_export] +macro_rules! ensure { + ($condition:expr, $err:expr) => { + if !$condition { + return Err($err); + } + }; +} + +#[macro_export] +macro_rules! assure { + ($condition:expr, $err:expr) => { + if !$condition { + Err($err) + } else { + Ok(()) + } + }; +} diff --git a/proof_parser/Cargo.toml b/proof_parser/Cargo.toml index cd2c178..24548fe 100644 --- a/proof_parser/Cargo.toml +++ b/proof_parser/Cargo.toml @@ -8,7 +8,16 @@ repository.workspace = true version.workspace = true [features] -default = ["keccak", "recursive"] +default = ["std", "keccak", "recursive"] +std = [ + "serde/std", + "starknet-types-core/std", + "num-bigint/std", + "anyhow/std", + "clap/std", + "regex/std", + "serde_json/std", +] dex = [] recursive = [] recursive_with_poseidon = [] diff --git a/wasm_bindings/Cargo.toml b/wasm_bindings/Cargo.toml index 4dd4f17..42b15f7 100644 --- a/wasm_bindings/Cargo.toml +++ b/wasm_bindings/Cargo.toml @@ -8,12 +8,12 @@ repository.workspace = true version.workspace = true [dependencies] +wasm-bindgen = "0.2" serde_json.workspace = true -wasm-bindgen.workspace = true +swiftness_proof_parser = { path = "../proof_parser", default-features = false, version = "0.0.5" } swiftness_air = { workspace = true } swiftness_stark = { workspace = true } -swiftness_proof_parser = { workspace = true } [lib] crate-type = ["cdylib", "rlib"] From 0744ed97d439edf7eebf21bfc56a0e07ab6fa22c Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Mon, 22 Jul 2024 23:49:29 +0200 Subject: [PATCH 34/39] riscv build --- examples/no_std_build/.cargo/config.toml | 2 +- examples/no_std_build/Cargo.lock | 23 +++++++++++++++++++++++ examples/no_std_build/Cargo.toml | 1 + examples/no_std_build/rust-toolchain.toml | 2 +- examples/no_std_build/src/main.rs | 4 ++++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/examples/no_std_build/.cargo/config.toml b/examples/no_std_build/.cargo/config.toml index cdf1cc8..721b3c8 100644 --- a/examples/no_std_build/.cargo/config.toml +++ b/examples/no_std_build/.cargo/config.toml @@ -1,2 +1,2 @@ [build] -target="x86_64-unknown-none" \ No newline at end of file +target="riscv64imac-unknown-none-elf" \ No newline at end of file diff --git a/examples/no_std_build/Cargo.lock b/examples/no_std_build/Cargo.lock index 1629091..be4d108 100644 --- a/examples/no_std_build/Cargo.lock +++ b/examples/no_std_build/Cargo.lock @@ -69,6 +69,12 @@ dependencies = [ "libc", ] +[[package]] +name = "critical-section" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" + [[package]] name = "crypto-bigint" version = "0.5.5" @@ -146,6 +152,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "embedded-alloc" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddae17915accbac2cfbc64ea0ae6e3b330e6ea124ba108dada63646fd3c6f815" +dependencies = [ + "critical-section", + "linked_list_allocator", +] + [[package]] name = "fnv" version = "1.0.7" @@ -210,10 +226,17 @@ version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +[[package]] +name = "linked_list_allocator" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" + [[package]] name = "no_std_build" version = "0.1.0" dependencies = [ + "embedded-alloc", "swiftness_air", "swiftness_commitment", "swiftness_fri", diff --git a/examples/no_std_build/Cargo.toml b/examples/no_std_build/Cargo.toml index 921e2df..8abe763 100644 --- a/examples/no_std_build/Cargo.toml +++ b/examples/no_std_build/Cargo.toml @@ -10,6 +10,7 @@ swiftness_commitment = { path = "../../crates/commitment", default-features = fa swiftness_pow = { path = "../../crates/pow", default-features = false } swiftness_fri = { path = "../../crates/fri", default-features = false } swiftness_transcript = { path = "../../crates/transcript", default-features = false } +embedded-alloc = "0.5.1" [features] default = ["recursive", "keccak"] diff --git a/examples/no_std_build/rust-toolchain.toml b/examples/no_std_build/rust-toolchain.toml index dd1e5a3..02b6d52 100644 --- a/examples/no_std_build/rust-toolchain.toml +++ b/examples/no_std_build/rust-toolchain.toml @@ -1,7 +1,7 @@ [toolchain] channel = "1.79.0" components = ["rustfmt", "clippy"] -targets = ["x86_64-unknown-none"] +targets = ["riscv64imac-unknown-none-elf"] profile = "minimal" [profile.dev] diff --git a/examples/no_std_build/src/main.rs b/examples/no_std_build/src/main.rs index 816aff8..74fe8e4 100644 --- a/examples/no_std_build/src/main.rs +++ b/examples/no_std_build/src/main.rs @@ -2,6 +2,7 @@ #![no_main] use core::panic::PanicInfo; +use embedded_alloc::Heap; /// This function is called on panic. #[panic_handler] @@ -14,6 +15,9 @@ pub extern "C" fn _start() -> ! { loop {} } +#[global_allocator] +static HEAP: Heap = Heap::empty(); + #[allow(unused_imports)] use swiftness_air; #[allow(unused_imports)] From 6b8b4de32162337a83516a52c462ad6806a58cef Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Tue, 23 Jul 2024 00:26:09 +0200 Subject: [PATCH 35/39] no_std builds work && std builds work --- Cargo.lock | 18 - Cargo.toml | 6 +- cli/Cargo.lock | 981 +++++++++++++++ cli/Cargo.toml | 19 +- cli/LICENSE | 201 +++ crates/commitment/Cargo.toml | 1 - crates/stark/Cargo.toml | 2 + examples/arm_build/.cargo/config.toml | 2 + examples/arm_build/Cargo.lock | 672 ++++++++++ .../{no_std_build => arm_build}/Cargo.toml | 4 +- examples/arm_build/rust-toolchain.toml | 11 + .../{no_std_build => arm_build}/src/main.rs | 0 .../.cargo/config.toml | 0 .../{no_std_build => riscv_build}/Cargo.lock | 0 examples/riscv_build/Cargo.toml | 41 + .../rust-toolchain.toml | 0 examples/riscv_build/src/main.rs | 28 + proof_parser/Cargo.toml | 42 +- proof_parser/LICENSE | 201 +++ wasm_bindings/.gitignore | 3 +- wasm_bindings/Cargo.lock | 1083 +++++++++++++++++ wasm_bindings/Cargo.toml | 16 +- wasm_bindings/LICENSE | 201 +++ 23 files changed, 3466 insertions(+), 66 deletions(-) create mode 100644 cli/Cargo.lock create mode 100644 cli/LICENSE create mode 100644 examples/arm_build/.cargo/config.toml create mode 100644 examples/arm_build/Cargo.lock rename examples/{no_std_build => arm_build}/Cargo.toml (95%) create mode 100644 examples/arm_build/rust-toolchain.toml rename examples/{no_std_build => arm_build}/src/main.rs (100%) rename examples/{no_std_build => riscv_build}/.cargo/config.toml (100%) rename examples/{no_std_build => riscv_build}/Cargo.lock (100%) create mode 100644 examples/riscv_build/Cargo.toml rename examples/{no_std_build => riscv_build}/rust-toolchain.toml (100%) create mode 100644 examples/riscv_build/src/main.rs create mode 100644 proof_parser/LICENSE create mode 100644 wasm_bindings/Cargo.lock create mode 100644 wasm_bindings/LICENSE diff --git a/Cargo.lock b/Cargo.lock index abe27b6..77126ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,12 +14,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - [[package]] name = "base64" version = "0.13.1" @@ -91,7 +85,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "serdect", "subtle", "zeroize", ] @@ -426,16 +419,6 @@ dependencies = [ "syn 2.0.72", ] -[[package]] -name = "serdect" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" -dependencies = [ - "base16ct", - "serde", -] - [[package]] name = "sha2" version = "0.10.8" @@ -561,7 +544,6 @@ name = "swiftness_commitment" version = "0.0.5" dependencies = [ "blake2", - "crypto-bigint", "serde", "serde_with 3.9.0", "sha3", diff --git a/Cargo.toml b/Cargo.toml index 6058503..62fa08b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,8 @@ exclude = [ "cli", "proof_parser", "wasm_bindings", - "examples/no_std_build", + "examples/arm_build", + "examples/riscv_build", ] [workspace.package] @@ -27,10 +28,7 @@ repository = "https://github.com/iosis-tech/swiftness" version = "0.0.5" [workspace.dependencies] -assure = "2.1.0" blake2 = { version = "0.10.6", default-features = false } -crypto-bigint = { version = "0.5.5", default-features = false, features = ["serde"] } -num-bigint = { version = "0.4.4" } serde = { version = "1.0", default-features = false, features = ["derive"] } serde_json = { version = "1.0.114", default-features = false } serde_with = { version = "3.8.3", default-features = false, features = ["macros"] } diff --git a/cli/Cargo.lock b/cli/Cargo.lock new file mode 100644 index 0000000..ab1dfd8 --- /dev/null +++ b/cli/Cargo.lock @@ -0,0 +1,981 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "num-traits", + "serde", +] + +[[package]] +name = "clap" +version = "4.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "clap_lex" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" + +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.72", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "flate2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lambdaworks-crypto" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb5d4f22241504f7c7b8d2c3a7d7835d7c07117f10bff2a7d96a9ef6ef217c3" +dependencies = [ + "lambdaworks-math", + "serde", + "sha2", + "sha3", +] + +[[package]] +name = "lambdaworks-math" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "358e172628e713b80a530a59654154bfc45783a6ed70ea284839800cebdf8f97" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "serde" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "serde_json" +version = "1.0.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_json_pythonic" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62212da9872ca2a0cad0093191ee33753eddff9266cbbc1b4a602d13a3a768db" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +dependencies = [ + "base64 0.13.1", + "chrono", + "hex", + "serde", + "serde_json", + "serde_with_macros 2.3.3", + "time", +] + +[[package]] +name = "serde_with" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +dependencies = [ + "serde", + "serde_derive", + "serde_with_macros 3.9.0", +] + +[[package]] +name = "serde_with_macros" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "serde_with_macros" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "starknet-core" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d506e02a4083290d13b427dfe437fd95aa8b56315c455bb2f9cdeca76620d457" +dependencies = [ + "base64 0.21.7", + "crypto-bigint", + "flate2", + "hex", + "serde", + "serde_json", + "serde_json_pythonic", + "serde_with 2.3.3", + "sha3", + "starknet-crypto", + "starknet-types-core", +] + +[[package]] +name = "starknet-crypto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2a821ad8d98c6c3e4d0e5097f3fe6e2ed120ada9d32be87cd1330c7923a2f0" +dependencies = [ + "crypto-bigint", + "hex", + "hmac", + "num-bigint", + "num-integer", + "num-traits", + "rfc6979", + "sha2", + "starknet-crypto-codegen", + "starknet-curve", + "starknet-types-core", + "zeroize", +] + +[[package]] +name = "starknet-crypto-codegen" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e179dedc3fa6da064e56811d3e05d446aa2f7459e4eb0e3e49378a337235437" +dependencies = [ + "starknet-curve", + "starknet-types-core", + "syn 2.0.72", +] + +[[package]] +name = "starknet-curve" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56935b306dcf0b8f14bb2a1257164b8478bb8be4801dfae0923f5b266d1b457c" +dependencies = [ + "starknet-types-core", +] + +[[package]] +name = "starknet-types-core" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6bacf0ba19bc721e518bc4bf389ff13daa8a7c5db5fd320600473b8aa9fcbd" +dependencies = [ + "lambdaworks-crypto", + "lambdaworks-math", + "num-bigint", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "swiftness" +version = "0.0.5" +dependencies = [ + "clap", + "swiftness_air", + "swiftness_proof_parser", + "swiftness_stark", +] + +[[package]] +name = "swiftness_air" +version = "0.0.5" +dependencies = [ + "serde", + "serde_with 3.9.0", + "starknet-core", + "starknet-crypto", + "swiftness_commitment", + "swiftness_transcript", + "thiserror", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_commitment" +version = "0.0.5" +dependencies = [ + "blake2", + "serde", + "serde_with 3.9.0", + "sha3", + "starknet-core", + "starknet-crypto", + "starknet-types-core", + "swiftness_transcript", + "thiserror", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_fri" +version = "0.0.5" +dependencies = [ + "serde", + "serde_with 3.9.0", + "sha3", + "starknet-core", + "starknet-crypto", + "swiftness_commitment", + "swiftness_transcript", + "thiserror", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_pow" +version = "0.0.5" +dependencies = [ + "blake2", + "serde", + "sha3", + "starknet-crypto", + "starknet-types-core", + "swiftness_transcript", + "thiserror", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_proof_parser" +version = "0.0.5" +dependencies = [ + "anyhow", + "clap", + "num-bigint", + "regex", + "serde", + "serde_json", + "starknet-types-core", + "swiftness_air", + "swiftness_commitment", + "swiftness_fri", + "swiftness_pow", + "swiftness_stark", + "swiftness_transcript", + "thiserror", +] + +[[package]] +name = "swiftness_stark" +version = "0.0.5" +dependencies = [ + "serde", + "serde_with 3.9.0", + "starknet-core", + "starknet-crypto", + "swiftness_air", + "swiftness_commitment", + "swiftness_fri", + "swiftness_pow", + "swiftness_transcript", + "thiserror", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_transcript" +version = "0.0.5" +dependencies = [ + "starknet-crypto", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "thiserror-impl-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "thiserror-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" +dependencies = [ + "thiserror-impl-no-std", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde", + "time-core", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index a2908cb..14546a9 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,19 +1,18 @@ [package] name = "swiftness" -description.workspace = true -edition.workspace = true -license-file.workspace = true -readme.workspace = true -repository.workspace = true -version.workspace = true +description = "Swiftness - Rust CairoVM Verifier implementation" +edition = "2021" +license-file = "LICENSE" +readme = "README.md" +repository = "https://github.com/iosis-tech/swiftness" +version = "0.0.5" [dependencies] -starknet-crypto.workspace = true clap = { version = "4.4.4", features = ["derive"] } -swiftness_proof_parser = { path = "../proof_parser", default-features = false, version = "0.0.5" } -swiftness_air = { workspace = true } -swiftness_stark = { workspace = true } +swiftness_air = { path = "../crates/air", default-features = false, version = "0.0.5" } +swiftness_stark = { path = "../crates/stark", default-features = false, version = "0.0.5" } +swiftness_proof_parser = { path = "../proof_parser", default-features = false, version = "0.0.5" } [features] default = ["std", "recursive", "keccak"] diff --git a/cli/LICENSE b/cli/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/cli/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/crates/commitment/Cargo.toml b/crates/commitment/Cargo.toml index a2a4977..480a2d8 100644 --- a/crates/commitment/Cargo.toml +++ b/crates/commitment/Cargo.toml @@ -26,7 +26,6 @@ starknet-types-core.workspace = true starknet-crypto.workspace = true thiserror = { optional = true, workspace = true } thiserror-no-std.workspace = true -crypto-bigint.workspace = true blake2.workspace = true swiftness_transcript.workspace = true diff --git a/crates/stark/Cargo.toml b/crates/stark/Cargo.toml index 4eb04b5..ec82da5 100644 --- a/crates/stark/Cargo.toml +++ b/crates/stark/Cargo.toml @@ -31,9 +31,11 @@ starknet_with_keccak = [ "swiftness_air/starknet_with_keccak", ] keccak = [ + "swiftness_pow/keccak", "swiftness_commitment/keccak", ] blake2s = [ + "swiftness_pow/blake2s", "swiftness_commitment/blake2s", ] diff --git a/examples/arm_build/.cargo/config.toml b/examples/arm_build/.cargo/config.toml new file mode 100644 index 0000000..3ec0b6f --- /dev/null +++ b/examples/arm_build/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +target="armebv7r-none-eabi" \ No newline at end of file diff --git a/examples/arm_build/Cargo.lock b/examples/arm_build/Cargo.lock new file mode 100644 index 0000000..1c0e70a --- /dev/null +++ b/examples/arm_build/Cargo.lock @@ -0,0 +1,672 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "arm_build" +version = "0.1.0" +dependencies = [ + "embedded-alloc", + "swiftness_air", + "swiftness_commitment", + "swiftness_fri", + "swiftness_pow", + "swiftness_stark", + "swiftness_transcript", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "num-traits", + "serde", +] + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "critical-section" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.72", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "embedded-alloc" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddae17915accbac2cfbc64ea0ae6e3b330e6ea124ba108dada63646fd3c6f815" +dependencies = [ + "critical-section", + "linked_list_allocator", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lambdaworks-math" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "358e172628e713b80a530a59654154bfc45783a6ed70ea284839800cebdf8f97" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "linked_list_allocator" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "serde" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "serde_json" +version = "1.0.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_json_pythonic" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62212da9872ca2a0cad0093191ee33753eddff9266cbbc1b4a602d13a3a768db" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +dependencies = [ + "base64 0.13.1", + "chrono", + "hex", + "serde", + "serde_json", + "serde_with_macros 2.3.3", + "time", +] + +[[package]] +name = "serde_with" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +dependencies = [ + "serde", + "serde_derive", + "serde_with_macros 3.9.0", +] + +[[package]] +name = "serde_with_macros" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "serde_with_macros" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "starknet-core" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d506e02a4083290d13b427dfe437fd95aa8b56315c455bb2f9cdeca76620d457" +dependencies = [ + "base64 0.21.7", + "crypto-bigint", + "hex", + "serde", + "serde_json", + "serde_json_pythonic", + "serde_with 2.3.3", + "sha3", + "starknet-crypto", + "starknet-types-core", +] + +[[package]] +name = "starknet-crypto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2a821ad8d98c6c3e4d0e5097f3fe6e2ed120ada9d32be87cd1330c7923a2f0" +dependencies = [ + "crypto-bigint", + "hex", + "hmac", + "num-bigint", + "num-integer", + "num-traits", + "rfc6979", + "sha2", + "starknet-crypto-codegen", + "starknet-curve", + "starknet-types-core", + "zeroize", +] + +[[package]] +name = "starknet-crypto-codegen" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e179dedc3fa6da064e56811d3e05d446aa2f7459e4eb0e3e49378a337235437" +dependencies = [ + "starknet-curve", + "starknet-types-core", + "syn 2.0.72", +] + +[[package]] +name = "starknet-curve" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56935b306dcf0b8f14bb2a1257164b8478bb8be4801dfae0923f5b266d1b457c" +dependencies = [ + "starknet-types-core", +] + +[[package]] +name = "starknet-types-core" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6bacf0ba19bc721e518bc4bf389ff13daa8a7c5db5fd320600473b8aa9fcbd" +dependencies = [ + "lambdaworks-math", + "num-bigint", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "swiftness_air" +version = "0.0.5" +dependencies = [ + "serde", + "serde_with 3.9.0", + "starknet-core", + "starknet-crypto", + "swiftness_commitment", + "swiftness_transcript", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_commitment" +version = "0.0.5" +dependencies = [ + "blake2", + "serde", + "serde_with 3.9.0", + "sha3", + "starknet-core", + "starknet-crypto", + "starknet-types-core", + "swiftness_transcript", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_fri" +version = "0.0.5" +dependencies = [ + "serde", + "serde_with 3.9.0", + "sha3", + "starknet-core", + "starknet-crypto", + "swiftness_commitment", + "swiftness_transcript", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_pow" +version = "0.0.5" +dependencies = [ + "blake2", + "serde", + "sha3", + "starknet-crypto", + "starknet-types-core", + "swiftness_transcript", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_stark" +version = "0.0.5" +dependencies = [ + "serde", + "serde_with 3.9.0", + "starknet-core", + "starknet-crypto", + "swiftness_air", + "swiftness_commitment", + "swiftness_fri", + "swiftness_pow", + "swiftness_transcript", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_transcript" +version = "0.0.5" +dependencies = [ + "starknet-crypto", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror-impl-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "thiserror-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" +dependencies = [ + "thiserror-impl-no-std", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde", + "time-core", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/no_std_build/Cargo.toml b/examples/arm_build/Cargo.toml similarity index 95% rename from examples/no_std_build/Cargo.toml rename to examples/arm_build/Cargo.toml index 8abe763..6521722 100644 --- a/examples/no_std_build/Cargo.toml +++ b/examples/arm_build/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "no_std_build" +name = "arm_build" version = "0.1.0" edition = "2021" @@ -13,7 +13,7 @@ swiftness_transcript = { path = "../../crates/transcript", default-features = fa embedded-alloc = "0.5.1" [features] -default = ["recursive", "keccak"] +default = ["recursive", "blake2s"] dex = ["swiftness_air/dex", "swiftness_stark/dex"] recursive = [ "swiftness_air/recursive", diff --git a/examples/arm_build/rust-toolchain.toml b/examples/arm_build/rust-toolchain.toml new file mode 100644 index 0000000..f05e009 --- /dev/null +++ b/examples/arm_build/rust-toolchain.toml @@ -0,0 +1,11 @@ +[toolchain] +channel = "1.79.0" +components = ["rustfmt", "clippy"] +targets = ["armebv7r-none-eabi"] +profile = "minimal" + +[profile.dev] +panic = "abort" + +[profile.release] +panic = "abort" diff --git a/examples/no_std_build/src/main.rs b/examples/arm_build/src/main.rs similarity index 100% rename from examples/no_std_build/src/main.rs rename to examples/arm_build/src/main.rs diff --git a/examples/no_std_build/.cargo/config.toml b/examples/riscv_build/.cargo/config.toml similarity index 100% rename from examples/no_std_build/.cargo/config.toml rename to examples/riscv_build/.cargo/config.toml diff --git a/examples/no_std_build/Cargo.lock b/examples/riscv_build/Cargo.lock similarity index 100% rename from examples/no_std_build/Cargo.lock rename to examples/riscv_build/Cargo.lock diff --git a/examples/riscv_build/Cargo.toml b/examples/riscv_build/Cargo.toml new file mode 100644 index 0000000..06082d7 --- /dev/null +++ b/examples/riscv_build/Cargo.toml @@ -0,0 +1,41 @@ +[package] +name = "riscv_build" +version = "0.1.0" +edition = "2021" + +[dependencies] +swiftness_air = { path = "../../crates/air", default-features = false } +swiftness_stark = { path = "../../crates/stark", default-features = false } +swiftness_commitment = { path = "../../crates/commitment", default-features = false } +swiftness_pow = { path = "../../crates/pow", default-features = false } +swiftness_fri = { path = "../../crates/fri", default-features = false } +swiftness_transcript = { path = "../../crates/transcript", default-features = false } +embedded-alloc = "0.5.1" + +[features] +default = ["recursive", "blake2s"] +dex = ["swiftness_air/dex", "swiftness_stark/dex"] +recursive = [ + "swiftness_air/recursive", + "swiftness_stark/recursive", +] +recursive_with_poseidon = [ + "swiftness_air/recursive_with_poseidon", + "swiftness_stark/recursive_with_poseidon", +] +small = ["swiftness_air/small", "swiftness_stark/small"] +starknet = ["swiftness_air/starknet", "swiftness_stark/starknet"] +starknet_with_keccak = [ + "swiftness_air/starknet_with_keccak", + "swiftness_stark/starknet_with_keccak", +] +keccak = [ + "swiftness_commitment/keccak", + "swiftness_pow/keccak", + "swiftness_fri/keccak", +] +blake2s = [ + "swiftness_commitment/blake2s", + "swiftness_pow/blake2s", + "swiftness_fri/blake2s", +] \ No newline at end of file diff --git a/examples/no_std_build/rust-toolchain.toml b/examples/riscv_build/rust-toolchain.toml similarity index 100% rename from examples/no_std_build/rust-toolchain.toml rename to examples/riscv_build/rust-toolchain.toml diff --git a/examples/riscv_build/src/main.rs b/examples/riscv_build/src/main.rs new file mode 100644 index 0000000..74fe8e4 --- /dev/null +++ b/examples/riscv_build/src/main.rs @@ -0,0 +1,28 @@ +#![no_std] +#![no_main] + +use core::panic::PanicInfo; +use embedded_alloc::Heap; + +/// This function is called on panic. +#[panic_handler] +fn panic(_info: &PanicInfo) -> ! { + loop {} +} + +#[no_mangle] +pub extern "C" fn _start() -> ! { + loop {} +} + +#[global_allocator] +static HEAP: Heap = Heap::empty(); + +#[allow(unused_imports)] +use swiftness_air; +#[allow(unused_imports)] +use swiftness_commitment; +#[allow(unused_imports)] +use swiftness_pow; +#[allow(unused_imports)] +use swiftness_stark; \ No newline at end of file diff --git a/proof_parser/Cargo.toml b/proof_parser/Cargo.toml index 24548fe..d63f233 100644 --- a/proof_parser/Cargo.toml +++ b/proof_parser/Cargo.toml @@ -1,22 +1,21 @@ [package] name = "swiftness_proof_parser" -description.workspace = true -edition.workspace = true -license-file.workspace = true +description = "Swiftness - Rust CairoVM Verifier implementation" +edition = "2021" +license-file = "LICENSE" readme = "README.md" -repository.workspace = true -version.workspace = true +repository = "https://github.com/iosis-tech/swiftness" +version = "0.0.5" [features] default = ["std", "keccak", "recursive"] std = [ - "serde/std", - "starknet-types-core/std", - "num-bigint/std", - "anyhow/std", - "clap/std", - "regex/std", - "serde_json/std", + "swiftness_air/std", + "swiftness_commitment/std", + "swiftness_fri/std", + "swiftness_pow/std", + "swiftness_stark/std", + "swiftness_transcript/std", ] dex = [] recursive = [] @@ -29,17 +28,18 @@ blake2s = [] [dependencies] -serde.workspace = true -thiserror.workspace = true -starknet-types-core.workspace = true -num-bigint.workspace = true +serde = "1.0" +thiserror = "1.0.61" +starknet-types-core = "0.1.5" +num-bigint = { version = "0.4.4", features = ["serde"] } anyhow = "1.0.80" clap = { version = "4.5.1", features = ["derive"] } regex = "1.10.3" serde_json = "1.0.114" -swiftness_stark.workspace = true -swiftness_commitment.workspace = true -swiftness_fri.workspace = true -swiftness_air.workspace = true -swiftness_pow.workspace = true +swiftness_air = { path = "../crates/air", default-features = false, version = "0.0.5" } +swiftness_commitment = { path = "../crates/commitment", default-features = false, version = "0.0.5" } +swiftness_fri = { path = "../crates/fri", default-features = false, version = "0.0.5" } +swiftness_pow = { path = "../crates/pow", default-features = false, version = "0.0.5" } +swiftness_stark = { path = "../crates/stark", default-features = false, version = "0.0.5" } +swiftness_transcript = { path = "../crates/transcript", default-features = false, version = "0.0.5" } diff --git a/proof_parser/LICENSE b/proof_parser/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/proof_parser/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/wasm_bindings/.gitignore b/wasm_bindings/.gitignore index 86c3eac..b2bcbe8 100644 --- a/wasm_bindings/.gitignore +++ b/wasm_bindings/.gitignore @@ -1,2 +1 @@ -pkg/ -LICENSE \ No newline at end of file +pkg/ \ No newline at end of file diff --git a/wasm_bindings/Cargo.lock b/wasm_bindings/Cargo.lock new file mode 100644 index 0000000..21b3e9b --- /dev/null +++ b/wasm_bindings/Cargo.lock @@ -0,0 +1,1083 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "num-traits", + "serde", +] + +[[package]] +name = "clap" +version = "4.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "clap_lex" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" + +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.72", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "flate2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lambdaworks-crypto" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb5d4f22241504f7c7b8d2c3a7d7835d7c07117f10bff2a7d96a9ef6ef217c3" +dependencies = [ + "lambdaworks-math", + "serde", + "sha2", + "sha3", +] + +[[package]] +name = "lambdaworks-math" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "358e172628e713b80a530a59654154bfc45783a6ed70ea284839800cebdf8f97" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "serde" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "serde_json" +version = "1.0.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_json_pythonic" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62212da9872ca2a0cad0093191ee33753eddff9266cbbc1b4a602d13a3a768db" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +dependencies = [ + "base64 0.13.1", + "chrono", + "hex", + "serde", + "serde_json", + "serde_with_macros 2.3.3", + "time", +] + +[[package]] +name = "serde_with" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +dependencies = [ + "serde", + "serde_derive", + "serde_with_macros 3.9.0", +] + +[[package]] +name = "serde_with_macros" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "serde_with_macros" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "starknet-core" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d506e02a4083290d13b427dfe437fd95aa8b56315c455bb2f9cdeca76620d457" +dependencies = [ + "base64 0.21.7", + "crypto-bigint", + "flate2", + "hex", + "serde", + "serde_json", + "serde_json_pythonic", + "serde_with 2.3.3", + "sha3", + "starknet-crypto", + "starknet-types-core", +] + +[[package]] +name = "starknet-crypto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2a821ad8d98c6c3e4d0e5097f3fe6e2ed120ada9d32be87cd1330c7923a2f0" +dependencies = [ + "crypto-bigint", + "hex", + "hmac", + "num-bigint", + "num-integer", + "num-traits", + "rfc6979", + "sha2", + "starknet-crypto-codegen", + "starknet-curve", + "starknet-types-core", + "zeroize", +] + +[[package]] +name = "starknet-crypto-codegen" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e179dedc3fa6da064e56811d3e05d446aa2f7459e4eb0e3e49378a337235437" +dependencies = [ + "starknet-curve", + "starknet-types-core", + "syn 2.0.72", +] + +[[package]] +name = "starknet-curve" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56935b306dcf0b8f14bb2a1257164b8478bb8be4801dfae0923f5b266d1b457c" +dependencies = [ + "starknet-types-core", +] + +[[package]] +name = "starknet-types-core" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6bacf0ba19bc721e518bc4bf389ff13daa8a7c5db5fd320600473b8aa9fcbd" +dependencies = [ + "lambdaworks-crypto", + "lambdaworks-math", + "num-bigint", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "swiftness_air" +version = "0.0.5" +dependencies = [ + "serde", + "serde_with 3.9.0", + "starknet-core", + "starknet-crypto", + "swiftness_commitment", + "swiftness_transcript", + "thiserror", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_commitment" +version = "0.0.5" +dependencies = [ + "blake2", + "serde", + "serde_with 3.9.0", + "sha3", + "starknet-core", + "starknet-crypto", + "starknet-types-core", + "swiftness_transcript", + "thiserror", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_fri" +version = "0.0.5" +dependencies = [ + "serde", + "serde_with 3.9.0", + "sha3", + "starknet-core", + "starknet-crypto", + "swiftness_commitment", + "swiftness_transcript", + "thiserror", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_pow" +version = "0.0.5" +dependencies = [ + "blake2", + "serde", + "sha3", + "starknet-crypto", + "starknet-types-core", + "swiftness_transcript", + "thiserror", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_proof_parser" +version = "0.0.5" +dependencies = [ + "anyhow", + "clap", + "num-bigint", + "regex", + "serde", + "serde_json", + "starknet-types-core", + "swiftness_air", + "swiftness_commitment", + "swiftness_fri", + "swiftness_pow", + "swiftness_stark", + "swiftness_transcript", + "thiserror", +] + +[[package]] +name = "swiftness_stark" +version = "0.0.5" +dependencies = [ + "serde", + "serde_with 3.9.0", + "starknet-core", + "starknet-crypto", + "swiftness_air", + "swiftness_commitment", + "swiftness_fri", + "swiftness_pow", + "swiftness_transcript", + "thiserror", + "thiserror-no-std", +] + +[[package]] +name = "swiftness_transcript" +version = "0.0.5" +dependencies = [ + "starknet-crypto", +] + +[[package]] +name = "swiftness_wasm" +version = "0.0.5" +dependencies = [ + "getrandom", + "serde_json", + "swiftness_air", + "swiftness_proof_parser", + "swiftness_stark", + "wasm-bindgen", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "thiserror-impl-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "thiserror-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" +dependencies = [ + "thiserror-impl-no-std", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde", + "time-core", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.72", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/wasm_bindings/Cargo.toml b/wasm_bindings/Cargo.toml index 42b15f7..ae04328 100644 --- a/wasm_bindings/Cargo.toml +++ b/wasm_bindings/Cargo.toml @@ -1,19 +1,19 @@ [package] name = "swiftness_wasm" description = "Swiftness CairoVM Verifier | swiftness-{layout}-{commitment hash}" -edition.workspace = true -license-file.workspace = true +edition = "2021" +license-file = "LICENSE" readme = "README.md" -repository.workspace = true -version.workspace = true +repository = "https://github.com/iosis-tech/swiftness" +version = "0.0.5" [dependencies] wasm-bindgen = "0.2" -serde_json.workspace = true -swiftness_proof_parser = { path = "../proof_parser", default-features = false, version = "0.0.5" } +serde_json = "1.0.114" -swiftness_air = { workspace = true } -swiftness_stark = { workspace = true } +swiftness_air = { path = "../crates/air", default-features = false, version = "0.0.5" } +swiftness_stark = { path = "../crates/stark", default-features = false, version = "0.0.5" } +swiftness_proof_parser = { path = "../proof_parser", default-features = false, version = "0.0.5" } [lib] crate-type = ["cdylib", "rlib"] diff --git a/wasm_bindings/LICENSE b/wasm_bindings/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/wasm_bindings/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From 221eff316934f38ce9e4bda9d56941d93813e111 Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Tue, 23 Jul 2024 07:52:19 +0200 Subject: [PATCH 36/39] CI improved --- .github/workflows/ci.yml | 80 ++++++++++++++++++++---------- .github/workflows/npm_publish.yaml | 2 +- README.md | 2 +- 3 files changed, 57 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 609abfc..2d74e53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: ${{ runner.os }}-cargo-build- - name: Run tests - run: cargo test --verbose + run: cargo test -rv verify-proof: runs-on: ubuntu-latest @@ -52,6 +52,11 @@ jobs: "starknet", "starknet_with_keccak", ] + + env: + PROOFS_DIR: examples/proofs + WORKING_DIR: cli + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -78,27 +83,52 @@ jobs: ${{ runner.os }}-cargo-build- - name: Run verification - run: cargo run --release --bin swiftness --features std,${{ matrix.layout }},keccak --no-default-features -- --proof examples/proofs/${{ matrix.layout }}/cairo0_example_proof.json - - # no-std-build: - # name: Test no_std support - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # layout: - # [ - # "dex", - # "recursive", - # "recursive_with_poseidon", - # "small", - # "starknet", - # "starknet_with_keccak", - # ] - # steps: - # - uses: actions/checkout@v3 - # - name: Check wasm compatibility - # run: |- - # cd examples/no_std_build - # rustup show - # cargo build -r --features ${{ matrix.layout }},keccak --no-default-features + run: cargo run -r --bin swiftness --features std,${{ matrix.layout }},keccak --no-default-features -- --proof ${{ env.PROOFS_DIR }}/${{ matrix.layout }}/cairo0_example_proof.json + working-directory: ${{ env.WORKING_DIR }} + + no-std-build: + name: Build no_std examples + runs-on: ubuntu-latest + needs: verify-proof + strategy: + fail-fast: false + matrix: + layout: ["dex", "recursive", "recursive_with_poseidon", "small", "starknet", "starknet_with_keccak"] + hash: ["blake2s", "keccak"] + arch: ["arm", "riscv"] + + env: + WORKING_DIR: examples/${{ matrix.arch }}_build + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Cache Cargo registry + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cache Cargo build + uses: actions/cache@v2 + with: + path: target + key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-build- + + - name: Show rustup + run: rustup show + working-directory: ${{ env.WORKING_DIR }} + + - name: Build project + run: cargo build -r --features ${{ matrix.layout }},${{ matrix.hash }} --no-default-features + working-directory: ${{ env.WORKING_DIR }} diff --git a/.github/workflows/npm_publish.yaml b/.github/workflows/npm_publish.yaml index 5ef0c33..b2391a1 100644 --- a/.github/workflows/npm_publish.yaml +++ b/.github/workflows/npm_publish.yaml @@ -51,7 +51,7 @@ jobs: run: cargo install wasm-pack - name: Build package - run: wasm-pack build --out-dir pkg --target web --workspace --features ${{ matrix.layout }},${{ matrix.hash }} --no-default-features + run: wasm-pack build --out-dir pkg --target web --features std,${{ matrix.layout }},${{ matrix.hash }} --no-default-features working-directory: ${{ env.WORKING_DIR }} - name: Rename package diff --git a/README.md b/README.md index 2b1cc65..01b69a6 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ cargo install wasm-pack ### Build WASM: ```sh -cd wasm-binding && wasm-pack build --target web --workspace --features std,starknet_with_keccak,blake2s --no-default-features +cd wasm-binding && wasm-pack build --target web --features std,starknet_with_keccak,blake2s --no-default-features ``` ## Features From 51a58ad148b9893215ff006291a0b5d5120d6a63 Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Tue, 23 Jul 2024 08:02:14 +0200 Subject: [PATCH 37/39] CI improved --- .github/workflows/ci.yml | 6 +++--- .github/workflows/npm_publish.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d74e53..602520b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,8 +54,8 @@ jobs: ] env: - PROOFS_DIR: examples/proofs - WORKING_DIR: cli + PROOFS_DIR: ${{ github.workspace }}/examples/proofs + WORKING_DIR: ${{ github.workspace }}/cli steps: - name: Checkout repository @@ -98,7 +98,7 @@ jobs: arch: ["arm", "riscv"] env: - WORKING_DIR: examples/${{ matrix.arch }}_build + WORKING_DIR: ${{ github.workspace }}/examples/${{ matrix.arch }}_build steps: - name: Checkout repository diff --git a/.github/workflows/npm_publish.yaml b/.github/workflows/npm_publish.yaml index b2391a1..24c095a 100644 --- a/.github/workflows/npm_publish.yaml +++ b/.github/workflows/npm_publish.yaml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest env: - WORKING_DIR: wasm_bindings # define the working directory here + WORKING_DIR: ${{ github.workspace }}/wasm_bindings strategy: fail-fast: false From 97f225b25bb2b1a4457acc335c7640d9921026bf Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Tue, 23 Jul 2024 08:23:06 +0200 Subject: [PATCH 38/39] refactor --- .github/workflows/ci.yml | 11 +- Cargo.toml | 3 +- examples/arm_build/.cargo/config.toml | 2 - examples/arm_build/Cargo.lock | 672 ----------------- examples/arm_build/Cargo.toml | 41 -- examples/arm_build/rust-toolchain.toml | 11 - .../{riscv_build => no_std_build}/Cargo.toml | 2 +- .../rust-toolchain.toml | 5 +- .../{arm_build => no_std_build}/src/main.rs | 0 examples/riscv_build/.cargo/config.toml | 2 - examples/riscv_build/Cargo.lock | 690 ------------------ examples/riscv_build/src/main.rs | 28 - 12 files changed, 13 insertions(+), 1454 deletions(-) delete mode 100644 examples/arm_build/.cargo/config.toml delete mode 100644 examples/arm_build/Cargo.lock delete mode 100644 examples/arm_build/Cargo.toml delete mode 100644 examples/arm_build/rust-toolchain.toml rename examples/{riscv_build => no_std_build}/Cargo.toml (98%) rename examples/{riscv_build => no_std_build}/rust-toolchain.toml (66%) rename examples/{arm_build => no_std_build}/src/main.rs (100%) delete mode 100644 examples/riscv_build/.cargo/config.toml delete mode 100644 examples/riscv_build/Cargo.lock delete mode 100644 examples/riscv_build/src/main.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 602520b..0f3cfea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,7 +87,6 @@ jobs: working-directory: ${{ env.WORKING_DIR }} no-std-build: - name: Build no_std examples runs-on: ubuntu-latest needs: verify-proof strategy: @@ -95,10 +94,10 @@ jobs: matrix: layout: ["dex", "recursive", "recursive_with_poseidon", "small", "starknet", "starknet_with_keccak"] hash: ["blake2s", "keccak"] - arch: ["arm", "riscv"] + target: ["armebv7r-none-eabi", "riscv64imac-unknown-none-elf"] env: - WORKING_DIR: ${{ github.workspace }}/examples/${{ matrix.arch }}_build + WORKING_DIR: ${{ github.workspace }}/examples/no_std_build steps: - name: Checkout repository @@ -130,5 +129,9 @@ jobs: working-directory: ${{ env.WORKING_DIR }} - name: Build project - run: cargo build -r --features ${{ matrix.layout }},${{ matrix.hash }} --no-default-features + run: cargo build -r --features ${{ matrix.layout }},${{ matrix.hash }} --no-default-features --target ${{ matrix.target }} + working-directory: ${{ env.WORKING_DIR }} + + - name: Print binary metadata + run: file target/${{ matrix.target }}/release/no_std_build working-directory: ${{ env.WORKING_DIR }} diff --git a/Cargo.toml b/Cargo.toml index 62fa08b..47076ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,8 +15,7 @@ exclude = [ "cli", "proof_parser", "wasm_bindings", - "examples/arm_build", - "examples/riscv_build", + "examples/no_std_build", ] [workspace.package] diff --git a/examples/arm_build/.cargo/config.toml b/examples/arm_build/.cargo/config.toml deleted file mode 100644 index 3ec0b6f..0000000 --- a/examples/arm_build/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build] -target="armebv7r-none-eabi" \ No newline at end of file diff --git a/examples/arm_build/Cargo.lock b/examples/arm_build/Cargo.lock deleted file mode 100644 index 1c0e70a..0000000 --- a/examples/arm_build/Cargo.lock +++ /dev/null @@ -1,672 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "arm_build" -version = "0.1.0" -dependencies = [ - "embedded-alloc", - "swiftness_air", - "swiftness_commitment", - "swiftness_fri", - "swiftness_pow", - "swiftness_stark", - "swiftness_transcript", -] - -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "num-traits", - "serde", -] - -[[package]] -name = "cpufeatures" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" -dependencies = [ - "libc", -] - -[[package]] -name = "critical-section" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" - -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "darling" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.72", -] - -[[package]] -name = "darling_macro" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.72", -] - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - -[[package]] -name = "embedded-alloc" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddae17915accbac2cfbc64ea0ae6e3b330e6ea124ba108dada63646fd3c6f815" -dependencies = [ - "critical-section", - "linked_list_allocator", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "keccak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "lambdaworks-math" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "358e172628e713b80a530a59654154bfc45783a6ed70ea284839800cebdf8f97" - -[[package]] -name = "libc" -version = "0.2.155" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" - -[[package]] -name = "linked_list_allocator" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "serde" -version = "1.0.204" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.204" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", -] - -[[package]] -name = "serde_json" -version = "1.0.120" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_json_pythonic" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62212da9872ca2a0cad0093191ee33753eddff9266cbbc1b4a602d13a3a768db" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_with" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" -dependencies = [ - "base64 0.13.1", - "chrono", - "hex", - "serde", - "serde_json", - "serde_with_macros 2.3.3", - "time", -] - -[[package]] -name = "serde_with" -version = "3.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" -dependencies = [ - "serde", - "serde_derive", - "serde_with_macros 3.9.0", -] - -[[package]] -name = "serde_with_macros" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.72", -] - -[[package]] -name = "serde_with_macros" -version = "3.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.72", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest", - "keccak", -] - -[[package]] -name = "starknet-core" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d506e02a4083290d13b427dfe437fd95aa8b56315c455bb2f9cdeca76620d457" -dependencies = [ - "base64 0.21.7", - "crypto-bigint", - "hex", - "serde", - "serde_json", - "serde_json_pythonic", - "serde_with 2.3.3", - "sha3", - "starknet-crypto", - "starknet-types-core", -] - -[[package]] -name = "starknet-crypto" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2a821ad8d98c6c3e4d0e5097f3fe6e2ed120ada9d32be87cd1330c7923a2f0" -dependencies = [ - "crypto-bigint", - "hex", - "hmac", - "num-bigint", - "num-integer", - "num-traits", - "rfc6979", - "sha2", - "starknet-crypto-codegen", - "starknet-curve", - "starknet-types-core", - "zeroize", -] - -[[package]] -name = "starknet-crypto-codegen" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e179dedc3fa6da064e56811d3e05d446aa2f7459e4eb0e3e49378a337235437" -dependencies = [ - "starknet-curve", - "starknet-types-core", - "syn 2.0.72", -] - -[[package]] -name = "starknet-curve" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56935b306dcf0b8f14bb2a1257164b8478bb8be4801dfae0923f5b266d1b457c" -dependencies = [ - "starknet-types-core", -] - -[[package]] -name = "starknet-types-core" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6bacf0ba19bc721e518bc4bf389ff13daa8a7c5db5fd320600473b8aa9fcbd" -dependencies = [ - "lambdaworks-math", - "num-bigint", - "num-integer", - "num-traits", - "serde", -] - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "swiftness_air" -version = "0.0.5" -dependencies = [ - "serde", - "serde_with 3.9.0", - "starknet-core", - "starknet-crypto", - "swiftness_commitment", - "swiftness_transcript", - "thiserror-no-std", -] - -[[package]] -name = "swiftness_commitment" -version = "0.0.5" -dependencies = [ - "blake2", - "serde", - "serde_with 3.9.0", - "sha3", - "starknet-core", - "starknet-crypto", - "starknet-types-core", - "swiftness_transcript", - "thiserror-no-std", -] - -[[package]] -name = "swiftness_fri" -version = "0.0.5" -dependencies = [ - "serde", - "serde_with 3.9.0", - "sha3", - "starknet-core", - "starknet-crypto", - "swiftness_commitment", - "swiftness_transcript", - "thiserror-no-std", -] - -[[package]] -name = "swiftness_pow" -version = "0.0.5" -dependencies = [ - "blake2", - "serde", - "sha3", - "starknet-crypto", - "starknet-types-core", - "swiftness_transcript", - "thiserror-no-std", -] - -[[package]] -name = "swiftness_stark" -version = "0.0.5" -dependencies = [ - "serde", - "serde_with 3.9.0", - "starknet-core", - "starknet-crypto", - "swiftness_air", - "swiftness_commitment", - "swiftness_fri", - "swiftness_pow", - "swiftness_transcript", - "thiserror-no-std", -] - -[[package]] -name = "swiftness_transcript" -version = "0.0.5" -dependencies = [ - "starknet-crypto", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "thiserror-impl-no-std" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "thiserror-no-std" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" -dependencies = [ - "thiserror-impl-no-std", -] - -[[package]] -name = "time" -version = "0.3.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" -dependencies = [ - "deranged", - "num-conv", - "powerfmt", - "serde", - "time-core", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/arm_build/Cargo.toml b/examples/arm_build/Cargo.toml deleted file mode 100644 index 6521722..0000000 --- a/examples/arm_build/Cargo.toml +++ /dev/null @@ -1,41 +0,0 @@ -[package] -name = "arm_build" -version = "0.1.0" -edition = "2021" - -[dependencies] -swiftness_air = { path = "../../crates/air", default-features = false } -swiftness_stark = { path = "../../crates/stark", default-features = false } -swiftness_commitment = { path = "../../crates/commitment", default-features = false } -swiftness_pow = { path = "../../crates/pow", default-features = false } -swiftness_fri = { path = "../../crates/fri", default-features = false } -swiftness_transcript = { path = "../../crates/transcript", default-features = false } -embedded-alloc = "0.5.1" - -[features] -default = ["recursive", "blake2s"] -dex = ["swiftness_air/dex", "swiftness_stark/dex"] -recursive = [ - "swiftness_air/recursive", - "swiftness_stark/recursive", -] -recursive_with_poseidon = [ - "swiftness_air/recursive_with_poseidon", - "swiftness_stark/recursive_with_poseidon", -] -small = ["swiftness_air/small", "swiftness_stark/small"] -starknet = ["swiftness_air/starknet", "swiftness_stark/starknet"] -starknet_with_keccak = [ - "swiftness_air/starknet_with_keccak", - "swiftness_stark/starknet_with_keccak", -] -keccak = [ - "swiftness_commitment/keccak", - "swiftness_pow/keccak", - "swiftness_fri/keccak", -] -blake2s = [ - "swiftness_commitment/blake2s", - "swiftness_pow/blake2s", - "swiftness_fri/blake2s", -] \ No newline at end of file diff --git a/examples/arm_build/rust-toolchain.toml b/examples/arm_build/rust-toolchain.toml deleted file mode 100644 index f05e009..0000000 --- a/examples/arm_build/rust-toolchain.toml +++ /dev/null @@ -1,11 +0,0 @@ -[toolchain] -channel = "1.79.0" -components = ["rustfmt", "clippy"] -targets = ["armebv7r-none-eabi"] -profile = "minimal" - -[profile.dev] -panic = "abort" - -[profile.release] -panic = "abort" diff --git a/examples/riscv_build/Cargo.toml b/examples/no_std_build/Cargo.toml similarity index 98% rename from examples/riscv_build/Cargo.toml rename to examples/no_std_build/Cargo.toml index 06082d7..543a11f 100644 --- a/examples/riscv_build/Cargo.toml +++ b/examples/no_std_build/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "riscv_build" +name = "no_std_build" version = "0.1.0" edition = "2021" diff --git a/examples/riscv_build/rust-toolchain.toml b/examples/no_std_build/rust-toolchain.toml similarity index 66% rename from examples/riscv_build/rust-toolchain.toml rename to examples/no_std_build/rust-toolchain.toml index 02b6d52..854480a 100644 --- a/examples/riscv_build/rust-toolchain.toml +++ b/examples/no_std_build/rust-toolchain.toml @@ -1,7 +1,10 @@ [toolchain] channel = "1.79.0" components = ["rustfmt", "clippy"] -targets = ["riscv64imac-unknown-none-elf"] +targets = [ + "armebv7r-none-eabi", + "riscv64imac-unknown-none-elf" +] profile = "minimal" [profile.dev] diff --git a/examples/arm_build/src/main.rs b/examples/no_std_build/src/main.rs similarity index 100% rename from examples/arm_build/src/main.rs rename to examples/no_std_build/src/main.rs diff --git a/examples/riscv_build/.cargo/config.toml b/examples/riscv_build/.cargo/config.toml deleted file mode 100644 index 721b3c8..0000000 --- a/examples/riscv_build/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build] -target="riscv64imac-unknown-none-elf" \ No newline at end of file diff --git a/examples/riscv_build/Cargo.lock b/examples/riscv_build/Cargo.lock deleted file mode 100644 index be4d108..0000000 --- a/examples/riscv_build/Cargo.lock +++ /dev/null @@ -1,690 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "num-traits", - "serde", -] - -[[package]] -name = "cpufeatures" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" -dependencies = [ - "libc", -] - -[[package]] -name = "critical-section" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" - -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array", - "serdect", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "darling" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.72", -] - -[[package]] -name = "darling_macro" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.72", -] - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - -[[package]] -name = "embedded-alloc" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddae17915accbac2cfbc64ea0ae6e3b330e6ea124ba108dada63646fd3c6f815" -dependencies = [ - "critical-section", - "linked_list_allocator", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "keccak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "lambdaworks-math" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "358e172628e713b80a530a59654154bfc45783a6ed70ea284839800cebdf8f97" - -[[package]] -name = "libc" -version = "0.2.155" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" - -[[package]] -name = "linked_list_allocator" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" - -[[package]] -name = "no_std_build" -version = "0.1.0" -dependencies = [ - "embedded-alloc", - "swiftness_air", - "swiftness_commitment", - "swiftness_fri", - "swiftness_pow", - "swiftness_stark", - "swiftness_transcript", -] - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "serde" -version = "1.0.204" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.204" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", -] - -[[package]] -name = "serde_json" -version = "1.0.120" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_json_pythonic" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62212da9872ca2a0cad0093191ee33753eddff9266cbbc1b4a602d13a3a768db" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_with" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" -dependencies = [ - "base64 0.13.1", - "chrono", - "hex", - "serde", - "serde_json", - "serde_with_macros 2.3.3", - "time", -] - -[[package]] -name = "serde_with" -version = "3.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" -dependencies = [ - "serde", - "serde_derive", - "serde_with_macros 3.9.0", -] - -[[package]] -name = "serde_with_macros" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.72", -] - -[[package]] -name = "serde_with_macros" -version = "3.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.72", -] - -[[package]] -name = "serdect" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" -dependencies = [ - "base16ct", - "serde", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest", - "keccak", -] - -[[package]] -name = "starknet-core" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d506e02a4083290d13b427dfe437fd95aa8b56315c455bb2f9cdeca76620d457" -dependencies = [ - "base64 0.21.7", - "crypto-bigint", - "hex", - "serde", - "serde_json", - "serde_json_pythonic", - "serde_with 2.3.3", - "sha3", - "starknet-crypto", - "starknet-types-core", -] - -[[package]] -name = "starknet-crypto" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2a821ad8d98c6c3e4d0e5097f3fe6e2ed120ada9d32be87cd1330c7923a2f0" -dependencies = [ - "crypto-bigint", - "hex", - "hmac", - "num-bigint", - "num-integer", - "num-traits", - "rfc6979", - "sha2", - "starknet-crypto-codegen", - "starknet-curve", - "starknet-types-core", - "zeroize", -] - -[[package]] -name = "starknet-crypto-codegen" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e179dedc3fa6da064e56811d3e05d446aa2f7459e4eb0e3e49378a337235437" -dependencies = [ - "starknet-curve", - "starknet-types-core", - "syn 2.0.72", -] - -[[package]] -name = "starknet-curve" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56935b306dcf0b8f14bb2a1257164b8478bb8be4801dfae0923f5b266d1b457c" -dependencies = [ - "starknet-types-core", -] - -[[package]] -name = "starknet-types-core" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6bacf0ba19bc721e518bc4bf389ff13daa8a7c5db5fd320600473b8aa9fcbd" -dependencies = [ - "lambdaworks-math", - "num-bigint", - "num-integer", - "num-traits", - "serde", -] - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "swiftness_air" -version = "0.0.5" -dependencies = [ - "serde", - "serde_with 3.9.0", - "starknet-core", - "starknet-crypto", - "swiftness_commitment", - "swiftness_transcript", - "thiserror-no-std", -] - -[[package]] -name = "swiftness_commitment" -version = "0.0.5" -dependencies = [ - "blake2", - "crypto-bigint", - "serde", - "serde_with 3.9.0", - "sha3", - "starknet-core", - "starknet-crypto", - "starknet-types-core", - "swiftness_transcript", - "thiserror-no-std", -] - -[[package]] -name = "swiftness_fri" -version = "0.0.5" -dependencies = [ - "serde", - "serde_with 3.9.0", - "sha3", - "starknet-core", - "starknet-crypto", - "swiftness_commitment", - "swiftness_transcript", - "thiserror-no-std", -] - -[[package]] -name = "swiftness_pow" -version = "0.0.5" -dependencies = [ - "blake2", - "serde", - "sha3", - "starknet-crypto", - "starknet-types-core", - "swiftness_transcript", - "thiserror-no-std", -] - -[[package]] -name = "swiftness_stark" -version = "0.0.5" -dependencies = [ - "serde", - "serde_with 3.9.0", - "starknet-core", - "starknet-crypto", - "swiftness_air", - "swiftness_commitment", - "swiftness_fri", - "swiftness_pow", - "swiftness_transcript", - "thiserror-no-std", -] - -[[package]] -name = "swiftness_transcript" -version = "0.0.5" -dependencies = [ - "starknet-crypto", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "thiserror-impl-no-std" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "thiserror-no-std" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" -dependencies = [ - "thiserror-impl-no-std", -] - -[[package]] -name = "time" -version = "0.3.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" -dependencies = [ - "deranged", - "num-conv", - "powerfmt", - "serde", - "time-core", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/riscv_build/src/main.rs b/examples/riscv_build/src/main.rs deleted file mode 100644 index 74fe8e4..0000000 --- a/examples/riscv_build/src/main.rs +++ /dev/null @@ -1,28 +0,0 @@ -#![no_std] -#![no_main] - -use core::panic::PanicInfo; -use embedded_alloc::Heap; - -/// This function is called on panic. -#[panic_handler] -fn panic(_info: &PanicInfo) -> ! { - loop {} -} - -#[no_mangle] -pub extern "C" fn _start() -> ! { - loop {} -} - -#[global_allocator] -static HEAP: Heap = Heap::empty(); - -#[allow(unused_imports)] -use swiftness_air; -#[allow(unused_imports)] -use swiftness_commitment; -#[allow(unused_imports)] -use swiftness_pow; -#[allow(unused_imports)] -use swiftness_stark; \ No newline at end of file From 261c73fb24c1723a6259ca98708617907e6ab0bf Mon Sep 17 00:00:00 2001 From: Pia Date: Tue, 23 Jul 2024 10:00:51 +0200 Subject: [PATCH 39/39] chore: cli std by default --- .github/workflows/ci.yml | 18 +++++++++++++----- README.md | 20 +++++++++++++++++++- cli/Cargo.toml | 33 ++++++++++++++------------------- proof_parser/Cargo.toml | 2 +- 4 files changed, 47 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f3cfea..7b78328 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,7 @@ jobs: "starknet", "starknet_with_keccak", ] - + env: PROOFS_DIR: ${{ github.workspace }}/examples/proofs WORKING_DIR: ${{ github.workspace }}/cli @@ -83,7 +83,7 @@ jobs: ${{ runner.os }}-cargo-build- - name: Run verification - run: cargo run -r --bin swiftness --features std,${{ matrix.layout }},keccak --no-default-features -- --proof ${{ env.PROOFS_DIR }}/${{ matrix.layout }}/cairo0_example_proof.json + run: cargo run -r --bin swiftness --features ${{ matrix.layout }},keccak --no-default-features -- --proof ${{ env.PROOFS_DIR }}/${{ matrix.layout }}/cairo0_example_proof.json working-directory: ${{ env.WORKING_DIR }} no-std-build: @@ -92,7 +92,15 @@ jobs: strategy: fail-fast: false matrix: - layout: ["dex", "recursive", "recursive_with_poseidon", "small", "starknet", "starknet_with_keccak"] + layout: + [ + "dex", + "recursive", + "recursive_with_poseidon", + "small", + "starknet", + "starknet_with_keccak", + ] hash: ["blake2s", "keccak"] target: ["armebv7r-none-eabi", "riscv64imac-unknown-none-elf"] @@ -102,7 +110,7 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - + - name: Setup Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 @@ -131,7 +139,7 @@ jobs: - name: Build project run: cargo build -r --features ${{ matrix.layout }},${{ matrix.hash }} --no-default-features --target ${{ matrix.target }} working-directory: ${{ env.WORKING_DIR }} - + - name: Print binary metadata run: file target/${{ matrix.target }}/release/no_std_build working-directory: ${{ env.WORKING_DIR }} diff --git a/README.md b/README.md index 01b69a6..d58315b 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,25 @@ This is the Rust implementation of the Cairo-VM STARK verifier with layouts. The ### Verify example proof: +1. Install `swiftness` + +```sh + +# cargo install -f --path cli/ --features {layout},{hash} +cargo install -f --path cli/ --features starknet_with_keccak,keccak +``` + +2. Run the following command to verify the proof: + Note: use proof that is corresponding to layout and hash you built binary + ```sh -cargo run --release --bin swiftness --features std,starknet_with_keccak,keccak --no-default-features -- --proof examples/proofs/starknet_with_keccak/cairo0_example_proof.json +swiftness --proof examples/proofs/starknet_with_keccak/cairo0_example_proof.json +``` + +for local run: + +```sh +cargo run --release --bin swiftness --features starknet_with_keccak,keccak --no-default-features -- --proof examples/proofs/starknet_with_keccak/cairo0_example_proof.json ``` ## Run Tests @@ -18,6 +35,7 @@ cargo test ``` ### Install wasm-pack + ```sh cargo install wasm-pack ``` diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 14546a9..00d653c 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "swiftness" -description = "Swiftness - Rust CairoVM Verifier implementation" +description = "CLI toolkit to use Swiftness - Rust CairoVM Verifier implementation" edition = "2021" license-file = "LICENSE" readme = "README.md" @@ -10,21 +10,20 @@ version = "0.0.5" [dependencies] clap = { version = "4.4.4", features = ["derive"] } -swiftness_air = { path = "../crates/air", default-features = false, version = "0.0.5" } -swiftness_stark = { path = "../crates/stark", default-features = false, version = "0.0.5" } -swiftness_proof_parser = { path = "../proof_parser", default-features = false, version = "0.0.5" } +swiftness_air = { path = "../crates/air", default-features = false, features = [ + "std", +], version = "0.0.5" } +swiftness_stark = { path = "../crates/stark", default-features = false, features = [ + "std", +], version = "0.0.5" } +swiftness_proof_parser = { path = "../proof_parser", default-features = false, features = [ + "std", +], version = "0.0.5" } [features] -default = ["std", "recursive", "keccak"] -std = [ - "swiftness_air/std", - "swiftness_stark/std", -] +default = [] dex = ["swiftness_air/dex", "swiftness_stark/dex"] -recursive = [ - "swiftness_air/recursive", - "swiftness_stark/recursive", -] +recursive = ["swiftness_air/recursive", "swiftness_stark/recursive"] recursive_with_poseidon = [ "swiftness_air/recursive_with_poseidon", "swiftness_stark/recursive_with_poseidon", @@ -35,9 +34,5 @@ starknet_with_keccak = [ "swiftness_air/starknet_with_keccak", "swiftness_stark/starknet_with_keccak", ] -keccak = [ - "swiftness_stark/keccak", -] -blake2s = [ - "swiftness_stark/blake2s", -] +keccak = ["swiftness_stark/keccak"] +blake2s = ["swiftness_stark/blake2s"] diff --git a/proof_parser/Cargo.toml b/proof_parser/Cargo.toml index d63f233..0e58c48 100644 --- a/proof_parser/Cargo.toml +++ b/proof_parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "swiftness_proof_parser" -description = "Swiftness - Rust CairoVM Verifier implementation" +description = "Json Proof Parser for Swiftness - Rust CairoVM Verifier implementation" edition = "2021" license-file = "LICENSE" readme = "README.md"