Skip to content

Commit

Permalink
chore: cli std by default
Browse files Browse the repository at this point in the history
  • Loading branch information
rkdud007 committed Jul 23, 2024
1 parent 20dc157 commit 261c73f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 26 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
"starknet",
"starknet_with_keccak",
]

env:
PROOFS_DIR: ${{ github.workspace }}/examples/proofs
WORKING_DIR: ${{ github.workspace }}/cli
Expand Down Expand Up @@ -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:
Expand All @@ -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"]

Expand All @@ -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

Expand Down Expand Up @@ -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 }}
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -18,6 +35,7 @@ cargo test
```

### Install wasm-pack

```sh
cargo install wasm-pack
```
Expand Down
33 changes: 14 additions & 19 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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",
Expand All @@ -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"]
2 changes: 1 addition & 1 deletion proof_parser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 261c73f

Please sign in to comment.