From 34a46107d0b1265632136f5d48e9b69a8efd0fa6 Mon Sep 17 00:00:00 2001 From: PangZhi <1611805+PangZhi@users.noreply.github.com> Date: Sun, 15 Dec 2024 23:51:24 -0800 Subject: [PATCH] docs: merge verify and onchain-verify --- book/src/advanced-usage/sdk.md | 2 +- book/src/writing-apps/onchain-verify.md | 29 ------------------------- book/src/writing-apps/verify.md | 18 +++++++++++---- 3 files changed, 15 insertions(+), 34 deletions(-) delete mode 100644 book/src/writing-apps/onchain-verify.md diff --git a/book/src/advanced-usage/sdk.md b/book/src/advanced-usage/sdk.md index 39d6d1fc5a..da21629b2c 100644 --- a/book/src/advanced-usage/sdk.md +++ b/book/src/advanced-usage/sdk.md @@ -147,7 +147,7 @@ assert!(success); > ⚠️ **WARNING** > The aggregation proving key `agg_pk` above is large. Avoid cloning it if possible. -Note that `DEFAULT_PARAMS_DIR` is the directory where Halo2 parameters are stored by the `cargo openvm setup` CLI command. For more information on the setup process, see the [onchain verify](../writing-apps/onchain-verify.md) doc. +Note that `DEFAULT_PARAMS_DIR` is the directory where Halo2 parameters are stored by the `cargo openvm setup` CLI command. For more information on the setup process, see the `EVM Level` section of the [verify](../writing-apps/verify.md) doc. > ⚠️ **WARNING** > `cargo openvm setup` requires very large amounts of computation and memory (~200 GB). diff --git a/book/src/writing-apps/onchain-verify.md b/book/src/writing-apps/onchain-verify.md deleted file mode 100644 index 60a0398552..0000000000 --- a/book/src/writing-apps/onchain-verify.md +++ /dev/null @@ -1,29 +0,0 @@ -# Onchain Verification - -## Generating the Aggregation Proving Key and EVM Verifier Contract - -The workflow for generating an end-to-end EVM proof requires first generating an aggregation proving key and EVM verifier contract. This can be done by running the following command: - -```bash -cargo openvm setup -``` -> ⚠️ **WARNING** -> This command requires very large amounts of computation and memory (~200 GB). - -Upon a successful run, the command will write `agg.pk` and `verifier.sol` to `~/.openvm/`, where `~` is the directory specified by environment variable `$HOME`. Every command that requires these files will look for them in this directory. - -> ⚠️ **WARNING** -> If the `$HOME` environment variable is not set, this command may fail. - -Note that `cargo openvm setup` may attempt to download other files (i.e. KZG parameters) from an AWS S3 bucket into `~/.openvm/`. - -## Generating and Verifying an EVM Proof - -To generate and verify an EVM proof, you need to run the following commands: - -```bash -cargo openvm prove evm --input -cargo openvm verify evm -``` - -These commands are very similar to their `app` subcommand counterparts. For more information on the `prove` and `verify` commands, see the [prove](./prove.md) and [verify](./verify.md) docs. diff --git a/book/src/writing-apps/verify.md b/book/src/writing-apps/verify.md index ee98dcc730..8577a5e234 100644 --- a/book/src/writing-apps/verify.md +++ b/book/src/writing-apps/verify.md @@ -31,7 +31,8 @@ svm use 0.8.19 ``` ### Generating the Aggregation Proving Key and EVM Verifier Contract -Generate the aggregation proving key and verifier contract at `~/.openvm/agg.pk` and `~/.openvm/verifier.sol` respectively by running + +The workflow for generating an end-to-end EVM proof requires first generating an aggregation proving key and EVM verifier contract. This can be done by running the following command: ```bash cargo openvm setup @@ -39,13 +40,22 @@ cargo openvm setup > ⚠️ **WARNING** > This command requires very large amounts of computation and memory (~200 GB). +Upon a successful run, the command will write `agg.pk` and `verifier.sol` to `~/.openvm/`, where `~` is the directory specified by environment variable `$HOME`. Every command that requires these files will look for them in this directory. + +> ⚠️ **WARNING** +> If the `$HOME` environment variable is not set, this command may fail. + +Note that `cargo openvm setup` may attempt to download other files (i.e. KZG parameters) from an AWS S3 bucket into `~/.openvm/`. + This command can take ~20mins on a `m6a.16xlarge` instance due to the keygen time. -### Verify proof -Verifying a proof at the EVM level requires just the proof, as the command uses the verifier generated when `cargo openvm setup` was called. +## Generating and Verifying an EVM Proof + +To generate and verify an EVM proof, you need to run the following commands: ```bash +cargo openvm prove evm --input cargo openvm verify evm --proof ``` -If `proof` is omitted, the command will search for the proof at `./openvm/evm.proof`. +If `proof` is omitted, the `verify` command will search for the proof at `./openvm/evm.proof`.