Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verifyProof function as view as it does not modify storage #20

Merged
merged 4 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
cache-on-failure: true

- name: Install solc
run: (hash svm 2>/dev/null || cargo install svm-rs) && svm install 0.8.21 && solc --version
run: (hash svm 2>/dev/null || cargo install svm-rs@0.5.4) && svm install 0.8.21 && solc --version

- name: Run test
run: cargo test --workspace --all-features --all-targets -- --nocapture
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ let (verifier_solidity, vk_solidity) = generator.render_separately().unwrap();

Check [`examples/separately.rs`](./examples/separately.rs) for more details.

> [!NOTE]
> Currently example run only with rust `1.77.0` version due to a `cargo` update ([rust-lang/rust#123285](https://github.com/rust-lang/rust/issues/123285)).
>
> The `rust` toolchain version is specified in [rust-toolchain.toml](./rust-toolchain.toml) file.

Run example with the following command:

```bash
cargo run --all-features --example separately
```

### Generate verifier and verifying key in a single solidity contract

```rust
Expand All @@ -32,6 +43,20 @@ let calldata = encode_calldata(vk_address, &proof, &instances);

Note that function selector is already included.

## Test

To run tests, use the following command:

```bash
cargo test --workspace --all-features --all-targets -- --nocapture
```

> [!NOTE]
> Currently tests run only with rust `1.77.0` version due to a `cargo` update ([rust-lang/rust#123285](https://github.com/rust-lang/rust/issues/123285)).
>
> The `rust` toolchain version is specified in [rust-toolchain.toml](./rust-toolchain.toml) file.


## Limitations & Caveats

- It only allows circuit with **less or equal than 1 instance column** and **no rotated query to this instance column**.
Expand Down
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.77.0"
2 changes: 1 addition & 1 deletion templates/Halo2Verifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ contract Halo2Verifier {
{%- endmatch %}
bytes calldata proof,
uint256[] calldata instances
) public returns (bool) {
) public view returns (bool) {
assembly {
// Read EC point (x, y) at (proof_cptr, proof_cptr + 0x20),
// and check if the point is on affine plane,
Expand Down
Loading