feat: EVM verify optionally verifies app commit + CLI vk paths#2884
Conversation
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
|
@claude can you check if any docs need to be updated |
|
Claude finished @shuklaayush's task in 2m 21s —— View job Checking if docs need updating
FindingsI found two doc files with text that should be updated to reflect the changes in this PR: 1.
|
| } | ||
|
|
||
| pub fn default_internal_recursive_vk_path() -> String { | ||
| env::var("HOME").unwrap() + "/.openvm/internal_recursive.vk" |
There was a problem hiding this comment.
will this change, if say we do openvm 2.1 release? how will we know if we need to regenerate this
There was a problem hiding this comment.
Should probably always re-keygen on any major release, ex. 2.0 -> 2.1 (but probably not 2.0.0 -> 2.0.1, as this wouldn't require a circuit change)
There was a problem hiding this comment.
ok so setup is actually per machine / per openvm minor version right
| #[arg( | ||
| long, | ||
| num_args = 0..=1, | ||
| help = "Check the commit embedded in the proof against an expected app commit. With no value, uses the default commit path for the target; or pass an explicit path to a .commit.json", |
There was a problem hiding this comment.
can you explain the difference in meaning between Some(None) v.s. None
There was a problem hiding this comment.
None doesn't do the check, Some(None) does the check using the default app_commit path, Some(Some(path_to_app_commit)) does the check using path_to_app_commit
There was a problem hiding this comment.
yea, i meant updating the help text there
There was a problem hiding this comment.
Ah shoot, somehow these responses didn't buffer on my browser and I merged… will add this in a future PR
Note: cells_used metrics omitted because CUDA tracegen does not expose unpadded trace heights. Commit: a8a5a80 |
Resolves INT-5100 and INT-4826.
Overview
This PR adds two related capabilities:
Optional app-commit checking during EVM verification.
Sdk::verify_evm_halo2_proofnow takes an optional expectedAppExecutionCommit. When provided, it asserts the commit embedded in the proof matches the expected app/exe commits before running the on-chain verifier. The CLI'sverify evmsubcommand exposes this via a new--app-commitflag.Decoupling CLI verification from proving keys.
cargo openvm setupnow also writes the standalone internal-recursive verifying key, andverify starkreads that vk directly (via a new--agg-vkflag) instead of loading the much larger proving key just to derive the vk. Theverify evmsubcommand also gains an--evm-verifierflag to point at a custom verifier directory.The change is split across the SDK (
openvm-sdk) and the CLI (cargo-openvm), plus mechanical call-site updates in benchmarks/examples/tests for the newverify_evm_halo2_proofsignature.SDK changes (
crates/sdk)New
Sdk::app_commithelper —src/lib.rsAdds a public method that produces the
AppExecutionCommit(theapp_exe_commit+app_vm_commitpair) for a given executable, generating the app proving key if needed. This gives callers a convenient way to obtain the expected commit to pass into verification.verify_evm_halo2_proofsignature —src/lib.rsAdds an
expected_app_commit: Option<AppExecutionCommit>parameter. WhenSome, it compares againstevm_proof.app_commitand returns an error ("mismatching app commits") on mismatch before delegating to the existing solidity verifier path.Nonepreserves the old behavior.AppExecutionCommitnow comparable —src/types.rsDerives
PartialEq, Eqso the equality check above is possible.Error message cleanup —
src/solidity.rsRenames the internal verification error prefix from
"Sdk::verify_openvm_evm_proof"to the user-facing"EVM proof verification failed".Updated call sites (signature change)
src/examples/sdk_evm.rs— passesNone, with a comment showing how to passSome(sdk.app_commit(elf)?).src/tests.rs—test_sdk_fibonaccinow computessdk.app_commit(...)and passesSome(app_commit), exercising the new path.CLI changes (
crates/cli)New default vk path —
src/default.rsAdds
default_internal_recursive_vk_path()→~/.openvm/internal_recursive.vk.setupalso writes the vk —src/commands/setup.rsAfter writing the internal-recursive proving key,
setupnow also extracts its verifying key and writes it to the new.vkpath. This is what letsverify starkavoid loading the full proving key.verify stark—src/commands/verify.rs--agg-vk <PATH>flag. Defaults to thedefault_internal_recursive_vk_path()written bysetup..get_vk()on it. (Removes theMultiStarkProvingKey/SCimports that were only needed for that.)verify evm—src/commands/verify.rs--evm-verifier <PATH>flag to override the default~/.openvm/halo2/verifier directory.--app-commit [<PATH>]flag (0-or-1 value):None);.commit.jsonpath for the cargo target;.commit.json.AppExecutionCommitis passed intoSdk::verify_evm_halo2_proof.#[command(flatten)] cargo_args: SingleTargetCargoArgsso the target can be located for the default commit-path resolution.cargo openvm setup --evm.