Skip to content

wip: FRI higher arity in recursion #1240

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

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

OsamaAlkhodairy
Copy link
Contributor

No description provided.

@OsamaAlkhodairy OsamaAlkhodairy marked this pull request as draft January 19, 2025 21:20
OsamaAlkhodairy and others added 20 commits March 12, 2025 23:38
`cargo openvm build` will use `rustup` to check if the required nightly
toolchain and `rust-src` component are installed, and will install them
if they are not. If this step fails, then the entire build process
errors (I wasn't sure if this was the preferred behavior or if we should
let the rest of the cargo build attempt continue, but it felt like for
earlier stopping and debugging it's better to fail the process).

Updated only the cli workflow because in multithreaded tests, I don't
want it to try to install the toolchain in multiple threads
simultaneously.

closes INT-2911
This fix only affects logging and segmentation logic during execution
under certain misconfigured parameter settings. It does not affect any
circuit soundness.

Fixes two separate issues around segmentation with respect to fixed-size
traces: the first being that `constant_trace_height` was not implemented
for some wrapper types, and the second being that
`VmChipComplex::current_trace_cells` did not check if a chip had
constant trace height.
The symbolic expression multiplication unit test was being run with an
incorrect expected result. The test became out-of-date after #1473
changed the `max_abs` method.

This PR updates the test with the correct expected result and adds the
Mod Builder crate's unit tests to the CI workflow.

This change has no impact on the functionality of the Mod Builder crate
as it only updates the tests.
- use absolute paths for structs used only in the derive macro
This adds the ability to use different engines for proving.
- Not a soundness issue. Just an issue of `RootVerifierLocalProver`
implementation in SDK.
- In some edge cases, the trace heights of the root verifier circuit are
less than the required heights. In this case, `RootVerifierLocalProver`
should pad its traces to the required heights.
- [Breaking change] Add a new field `internal_heights` into
`RootVerifierProvingKey`.
Closes INT-3706

- Moved existing benchmarks to `benchmarks/prove` crate
- Added a new `benchmarks/execute` binary crate that runs execution for
a list of guest programs
- Added programs for benchmarking in `benchmarks/guest`
- Added a ci workflow to run execution benchmarks
- Note: Timing metrics for summary are currently being parsed from logs.
I'll change it to use proper metrics in a follow up
This PR adds a new verifier contract generation that wraps the original
`snark-verifier` output (via inheritance). The goal of this wrapper
`OpenVmHalo2Verifier` is to expose a more friendly interface to users
that cleanly separates out the guest program public values.
`OpenVmHalo2Verifier` exposes the following interface:

```solidity
interface IOpenVmHalo2Verifier {
    function verify(bytes calldata publicValues, bytes calldata proofData, bytes32 appExeCommit, bytes32 appVmCommit)
        external
        view;
}
```

- `publicValues`: The bytes revealed in the OpenVM guest program packed
together.
- `proofData`: Defined as `abi.encodePacked(KZG accumulators,
publicValuesSuffix)`
- `appExeCommit`: The commitment to the OpenVM application executable
whose execution is being verified.
- `appVmCommit`: The commitment to the VM configuration (aka
`leaf_exe_commit`)

Once received, the proof is constructed into the format expected by
`snark-verifier`. The expected format is
`abi.encodePacked(proofData[0:0x180], appExeCommit, appVmExeCommit,
publicValuesPayload, proofData[0x180:])` where `publicValuesPayload` is
a memory payload with each byte in `publicValues` separated into its own
`bytes32` word.

Since `OpenVmHalo2Verifier` inherits the `snark-verifier` output, the
proof is forwarded via self-call.

## Verifier Generation

The smart contract is written as a template that does not compile in
isolation. During generation, the OpenVM SDK will fill out the maximum
amount of public values and the OpenVM version with which the generation
happened.

Given an output folder, the relevant contracts are written into the
following folder structure:

```
halo2/
├── interfaces/
│   └── IOpenVmHalo2Verifier.sol
├── OpenVmHalo2Verifier.sol
├── Halo2Verifier.sol
```

`cargo openvm setup` will now generate this output directly into the
`~/.openvm/` dir.

Closes INT-3710
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.43.0 to 1.43.1.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/tokio-rs/tokio/commit/a7b658c35bd40f6811e557aeb97cbb361b612c56"><code>a7b658c</code></a>
chore: prepare Tokio v1.43.1 release</li>
<li><a
href="https://github.com/tokio-rs/tokio/commit/c1c8d1033d637d7027fdc137ec8008c5801cbc0d"><code>c1c8d10</code></a>
Merge remote-tracking branch 'origin/tokio-1.38.x' into
forward-port-1.38.x</li>
<li><a
href="https://github.com/tokio-rs/tokio/commit/aa303bc2051f7c21b48bb7bfcafe8fd4f39afd21"><code>aa303bc</code></a>
chore: prepare Tokio v1.38.2 release</li>
<li><a
href="https://github.com/tokio-rs/tokio/commit/7b6ccb515ff067151ed62db835f735e5653f8784"><code>7b6ccb5</code></a>
chore: backport CI fixes</li>
<li><a
href="https://github.com/tokio-rs/tokio/commit/4b174ce2c95fe1d1a217917db93fcc935e17e0da"><code>4b174ce</code></a>
sync: fix cloning value when receiving from broadcast channel</li>
<li>See full diff in <a
href="https://github.com/tokio-rs/tokio/compare/tokio-1.43.0...tokio-1.43.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tokio&package-manager=cargo&previous-version=1.43.0&new-version=1.43.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/openvm-org/openvm/network/alerts).

</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Copy link

github-actions bot commented Apr 9, 2025

Your PR title doesn't follow the Conventional Commit guidelines.

Example of valid titles:

  • feat: add new user login
  • fix: correct button size
  • docs: update README

Usage:

  • feat: Introduces a new feature
  • fix: Patches a bug
  • chore: General maintenance tasks or updates
  • test: Adding new tests or modifying existing tests
  • perf: Performance improvements
  • refactor: Changes to improve code structure
  • docs: Documentation updates
  • ci: Changes to CI/CD configurations

Breaking Changes

Breaking changes are noted by using an exclamation mark. For example:

  • feat!: changed the API
  • chore(node)!: Removed unused public function

Help

For more information, follow the guidelines here: https://www.conventionalcommits.org/en/v1.0.0/

This comment has been minimized.

@jonathanpwang jonathanpwang added the run-benchmark triggers benchmark workflows on the pr label Apr 10, 2025

This comment has been minimized.

Copy link

group app.proof_time_ms app.cycles app.cells_used leaf.proof_time_ms leaf.cycles leaf.cells_used
verify_fibair (+1600 [+124.0%]) 2,890 (+1093448 [+327.2%]) 1,427,590 (+31582954 [+178.7%]) 49,260,252 - - -
fibonacci_program (-27 [-1.0%]) 2,664 1,500,277 50,589,503 (+2301 [+60.9%]) 6,082 (+1808040 [+143.1%]) 3,071,313 (+52803235 [+75.1%]) 123,086,547
regex_program (+164 [+2.0%]) 8,286 4,165,226 166,511,152 (+5292 [+36.1%]) 19,940 (+3589086 [+90.1%]) 7,571,175 (+104811742 [+34.4%]) 409,368,540
ecrecover_program (-47 [-3.3%]) 1,383 289,447 14,470,186 (+2402 [+18.8%]) 15,149 (+1790235 [+59.9%]) 4,778,806 (+52968163 [+21.7%]) 297,221,021
pairing (+8 [+0.2%]) 4,917 1,820,436 95,832,407 (+1847 [+13.0%]) 16,002 (+1842225 [+56.4%]) 5,109,733 (+53998055 [+19.7%]) 327,855,995

Commit: 12476fc

Benchmark Workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-benchmark triggers benchmark workflows on the pr
Projects
None yet
Development

Successfully merging this pull request may close these issues.