Skip to content

Commit

Permalink
Add README for cairo verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmilson committed Nov 18, 2024
1 parent 57e9873 commit c6144cb
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
48 changes: 48 additions & 0 deletions stwo_cairo_verifier/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Stwo Cairo Verifier

A [Cairo](https://github.com/starkware-libs/cairo) program that verifies a [Stwo](https://github.com/starkware-libs/stwo) proof.

## Running tests

[Install asdf](https://asdf-vm.com/guide/getting-started.html#_3-install-asdf).

```bash
asdf install
scarb test
```

## Visualising test step counts.

Modify [`Scarb.toml`](./Scarb.toml) to use [Starknet Foundary](https://github.com/foundry-rs/starknet-foundry).

```diff
[dev-dependencies]
- cairo_test = "2.8.0"
+ snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.32.0" }
+ assert_macros = "2.8.0"
+
+ [scripts]
+ test = "snforge test --max-n-steps 100000000"
```

Generate trace for all tests.

> :warning: Get errors with this on Linux.
```bash
scarb test -- --save-trace-data
```

Install [cairo-profiler](https://github.com/software-mansion/cairo-profiler) and run:

```bash
# Replace `TEST_NAME` with the name of the test you want profiled.
cairo-profiler ./snfoundry_trace/TEST_NAME.json
```

Visualise profile in the browser.

```bash
# Once opened navigate to `Sample -> steps`.
go tool pprof -http=":8000" profile.pb.gz
```
2 changes: 1 addition & 1 deletion stwo_cairo_verifier/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ fn main() {}
pub type ColumnArray<T> = Array<T>;

/// An array in which each element relates (by index) to a commitment tree.
pub type TreeArray<T> = Array<T>;
pub type TreeArray<T> = Array<T>;

0 comments on commit c6144cb

Please sign in to comment.