Skip to content

Commit

Permalink
Merge pull request #36 from iosis-tech/dynamic_layout_support
Browse files Browse the repository at this point in the history
Dynamic layout
  • Loading branch information
Okm165 authored Sep 6, 2024
2 parents cb9c15c + 46552c7 commit ba4542a
Show file tree
Hide file tree
Showing 65 changed files with 35,813 additions and 1,505 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ starknet-crypto = { version = "0.7.1", default-features = false }
starknet-types-core = { version = "0.1.5", default-features = false }
thiserror = "1.0.61"
thiserror-no-std = "2.0.2"
num-bigint = "0.4.6"

swiftness_air = { path = "crates/air", default-features = false, version = "0.0.8" }
swiftness_commitment = { path = "crates/commitment", default-features = false, version = "0.0.8" }
Expand Down
15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ cargo test
- [x] small
- [x] starknet
- [x] starknet_with_keccak
- [x] dynamic

### Commitment Hashes

Expand All @@ -83,19 +84,7 @@ cargo test

- [x] WASM support
- [x] [Web Demo](https://demo.swiftness.iosis.tech/)
- [x] NPM packages:
- [swiftness-dex-blake2s](https://www.npmjs.com/package/swiftness-dex-blake2s)
- [swiftness-dex-keccak](https://www.npmjs.com/package/swiftness-dex-keccak)
- [swiftness-recursive-blake2s](https://www.npmjs.com/package/swiftness-recursive-blake2s)
- [swiftness-recursive-keccak](https://www.npmjs.com/package/swiftness-recursive-keccak)
- [swiftness-recursive-with-poseidon-blake2s](https://www.npmjs.com/package/swiftness-recursive-with-poseidon-blake2s)
- [swiftness-recursive-with-poseidon-keccak](https://www.npmjs.com/package/swiftness-recursive-with-poseidon-keccak)
- [swiftness-small-blake2s](https://www.npmjs.com/package/swiftness-small-blake2s)
- [swiftness-small-keccak](https://www.npmjs.com/package/swiftness-small-keccak)
- [swiftness-starknet-blake2s](https://www.npmjs.com/package/swiftness-starknet-blake2s)
- [swiftness-starknet-keccak](https://www.npmjs.com/package/swiftness-starknet-keccak)
- [swiftness-starknet-with-keccak-blake2s](https://www.npmjs.com/package/swiftness-starknet-with-keccak-blake2s)
- [swiftness-starknet-with-keccak-keccak](https://www.npmjs.com/package/swiftness-starknet-with-keccak-keccak)
- [x] [NPM packages](https://www.npmjs.com/search?q=swiftness)

### Other Platforms Support

Expand Down
14 changes: 8 additions & 6 deletions cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ clap = { version = "4.4.4", features = ["derive"] }
swiftness_air = { path = "../crates/air", default-features = false, features = [
"std",
], version = "0.0.8" }
swiftness_stark = { path = "../crates/stark", default-features = false, features = [
swiftness_commitment = { path = "../crates/commitment", default-features = false, features = [
"std",
], version = "0.0.8" }
swiftness_fri = { path = "../crates/fri", default-features = false, features = [
"std",
], version = "0.0.8" }
swiftness_proof_parser = { path = "../proof_parser", default-features = false, features = [
swiftness_pow = { path = "../crates/pow", default-features = false, features = [
"std",
], version = "0.0.8" }
swiftness_stark = { path = "../crates/stark", default-features = false, features = [
"std",
], version = "0.0.8" }
swiftness_proof_parser = { path = "../proof_parser", version = "0.0.8" }

[features]
default = ["recursive", "keccak_160_lsb"]
Expand All @@ -34,23 +41,23 @@ starknet_with_keccak = [
"swiftness_air/starknet_with_keccak",
"swiftness_stark/starknet_with_keccak",
]
dynamic = [
"swiftness_air/dynamic",
"swiftness_stark/dynamic",
]
keccak_160_lsb = [
"swiftness_air/keccak_160_lsb",
"swiftness_stark/keccak_160_lsb",
"swiftness_proof_parser/keccak_160_lsb",
]
keccak_248_lsb = [
"swiftness_air/keccak_248_lsb",
"swiftness_stark/keccak_248_lsb",
"swiftness_proof_parser/keccak_248_lsb",
]
blake2s_160_lsb = [
"swiftness_air/blake2s_160_lsb",
"swiftness_stark/blake2s_160_lsb",
"swiftness_proof_parser/blake2s_160_lsb",
]
blake2s_248_lsb = [
"swiftness_air/blake2s_248_lsb",
"swiftness_stark/blake2s_248_lsb",
"swiftness_proof_parser/blake2s_248_lsb",
]
3 changes: 3 additions & 0 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
pub mod transform;

pub use swiftness_proof_parser::*;
pub use swiftness_stark::*;
pub use transform::TransformTo;
10 changes: 7 additions & 3 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
pub mod transform;

use clap::Parser;
use std::path::PathBuf;
pub use swiftness_proof_parser::*;
pub use swiftness_stark::*;
pub use transform::TransformTo;

#[cfg(feature = "dex")]
use swiftness_air::layout::dex::Layout;
#[cfg(feature = "dynamic")]
use swiftness_air::layout::dynamic::Layout;
#[cfg(feature = "recursive")]
use swiftness_air::layout::recursive::Layout;
#[cfg(feature = "recursive_with_poseidon")]
Expand All @@ -15,8 +21,6 @@ use swiftness_air::layout::starknet::Layout;
#[cfg(feature = "starknet_with_keccak")]
use swiftness_air::layout::starknet_with_keccak::Layout;

use clap::Parser;

#[derive(Parser)]
#[command(author, version, about)]
struct CairoVMVerifier {
Expand All @@ -27,7 +31,7 @@ struct CairoVMVerifier {

fn main() -> Result<(), Box<dyn std::error::Error>> {
let cli = CairoVMVerifier::parse();
let stark_proof = parse(std::fs::read_to_string(cli.proof)?)?;
let stark_proof = parse(std::fs::read_to_string(cli.proof)?)?.transform_to();
let security_bits = stark_proof.config.security_bits();
let result = stark_proof.verify::<Layout>(security_bits)?;
println!("{:?}", result);
Expand Down
Loading

0 comments on commit ba4542a

Please sign in to comment.