Skip to content

Commit

Permalink
Merge pull request #32 from iosis-tech/stone6
Browse files Browse the repository at this point in the history
new stone version & dynamic layout - support
  • Loading branch information
Okm165 committed Sep 9, 2024
2 parents 5760f1a + 4c2d254 commit 1d46e21
Show file tree
Hide file tree
Showing 82 changed files with 36,833 additions and 1,660 deletions.
52 changes: 46 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Run tests
run: cargo test -rv

verify-proof:
verify-proofs-stone5-keccak-160-lsb:
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -83,17 +83,57 @@ jobs:
${{ runner.os }}-cargo-build-
- name: Run verification
run: cargo run -r --bin swiftness --features ${{ 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 }},stone5,keccak_160_lsb --no-default-features -- --proof ${{ env.PROOFS_DIR }}/${{ matrix.layout }}/cairo0_stone5_example_proof.json
working-directory: ${{ env.WORKING_DIR }}

verify-proof-stone6-blake2s-248-lsb:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
layout: [ "dynamic" ]

env:
PROOFS_DIR: ${{ github.workspace }}/examples/proofs
WORKING_DIR: ${{ github.workspace }}/cli

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: Run verification
run: cargo run -r --bin swiftness --features ${{ matrix.layout }},stone6,blake2s_248_lsb --no-default-features -- --proof ${{ env.PROOFS_DIR }}/${{ matrix.layout }}/cairo0_stone6_example_proof.json
working-directory: ${{ env.WORKING_DIR }}

no-std-build:
runs-on: ubuntu-latest
needs: verify-proof
strategy:
fail-fast: false
matrix:
layout: ["starknet_with_keccak",]
hash: ["blake2s", "keccak"]
layout: ["dynamic"]
hash: ["blake2s_248_lsb"]
stone: ["stone5"]
target: ["armebv7r-none-eabi", "riscv64imac-unknown-none-elf", "aarch64-unknown-none-softfloat", "aarch64-unknown-none"]

env:
Expand Down Expand Up @@ -129,7 +169,7 @@ jobs:
working-directory: ${{ env.WORKING_DIR }}

- name: Build project
run: cargo build -r --features ${{ matrix.layout }},${{ matrix.hash }} --no-default-features --target ${{ matrix.target }}
run: cargo build -r --features ${{ matrix.layout }},${{ matrix.hash }},${{ matrix.stone }} --no-default-features --target ${{ matrix.target }}
working-directory: ${{ env.WORKING_DIR }}

- name: Print binary metadata
Expand Down
16 changes: 10 additions & 6 deletions Cargo.lock

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

15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ edition = "2021"
license-file = "LICENSE"
readme = "README.md"
repository = "https://github.com/iosis-tech/swiftness"
version = "0.0.8"
version = "0.0.9"

[workspace.dependencies]
blake2 = { version = "0.10.6", default-features = false }
num-bigint = { version = "0.4.6", default-features = false }
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"] }
Expand All @@ -38,9 +39,9 @@ starknet-types-core = { version = "0.1.5", default-features = false }
thiserror = "1.0.61"
thiserror-no-std = "2.0.2"

swiftness_air = { path = "crates/air", default-features = false, version = "0.0.8" }
swiftness_commitment = { path = "crates/commitment", default-features = false, version = "0.0.8" }
swiftness_fri = { path = "crates/fri", default-features = false, version = "0.0.8" }
swiftness_pow = { path = "crates/pow", default-features = false, version = "0.0.8" }
swiftness_stark = { path = "crates/stark", default-features = false, version = "0.0.8" }
swiftness_transcript = { path = "crates/transcript", default-features = false, version = "0.0.8" }
swiftness_air = { path = "crates/air", default-features = false, version = "0.0.9" }
swiftness_commitment = { path = "crates/commitment", default-features = false, version = "0.0.9" }
swiftness_fri = { path = "crates/fri", default-features = false, version = "0.0.9" }
swiftness_pow = { path = "crates/pow", default-features = false, version = "0.0.9" }
swiftness_stark = { path = "crates/stark", default-features = false, version = "0.0.9" }
swiftness_transcript = { path = "crates/transcript", default-features = false, version = "0.0.9" }
54 changes: 15 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div align="center">

![Version](https://img.shields.io/badge/v0.0.8-green?style=flat-square&logo=git&logoColor=white&label=version)
![Version](https://img.shields.io/badge/v0.0.9-green?style=flat-square&logo=git&logoColor=white&label=version)
![Continuous Integration](https://img.shields.io/github/actions/workflow/status/iosis-tech/swiftness/ci.yml?style=flat-square&logo=githubactions&logoColor=white&label=Continuous%20Integration)

[![Crates.io Version](https://img.shields.io/crates/v/swiftness?style=flat-square&logo=lootcrate)](https://crates.io/crates/swiftness)
Expand All @@ -16,25 +16,8 @@ Swiftness is a Rust implementation of the Cairo-VM STARK verifier with layouts,
## Getting Started

### Verify an Example Proof

1. **Install `swiftness`:**

```sh
cargo install -f --path cli/ --features starknet_with_keccak,keccak --no-default-features
```

2. **Verify the proof:**

Ensure you use a proof corresponding to the layout and hash used to build the binary.

```sh
swiftness --proof examples/proofs/starknet_with_keccak/cairo0_example_proof.json
```

3. **Local Run:**

```sh
cd cli && cargo run --release --bin swiftness --features starknet_with_keccak,keccak --no-default-features -- --proof ../examples/proofs/starknet_with_keccak/cairo0_example_proof.json
cd cli && cargo run --release --bin swiftness --features starknet_with_keccak,keccak_160_lsb,stone5 --no-default-features -- --proof ../examples/proofs/starknet_with_keccak/cairo0_stone5_example_proof.json
```

## Running Tests
Expand All @@ -54,15 +37,11 @@ cargo test
2. **Build WASM:**

```sh
cd wasm_bindings && wasm-pack build --target web --features starknet_with_keccak,blake2s --no-default-features
cd wasm_bindings && wasm-pack build --target web --features recursive_with_poseidon,blake2s_248_lsb,stone5 --no-default-features
```

## Features

### Usage

- [x] CLI

### Implemented Layouts

- [x] dex
Expand All @@ -71,29 +50,26 @@ cargo test
- [x] small
- [x] starknet
- [x] starknet_with_keccak
- [x] dynamic

### Commitment Hashes

- [x] keccak
- [x] blake2s
- [x] keccak_160_lsb
- [x] keccak_248_lsb
- [x] blake2s_160_lsb
- [x] blake2s_248_lsb

### Stone Prover versions

- [x] Stone5
- [x] Stone6

### Web Support

- [x] WASM support
- [x] NO_STD 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
30 changes: 16 additions & 14 deletions cli/Cargo.lock

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

Loading

0 comments on commit 1d46e21

Please sign in to comment.