Skip to content

perf(kzg): execute test vectors instead of proving each one#672

Open
shuklaayush wants to merge 5 commits into
develop-v2.1.0from
ayush/kzg-tests-execute-vectors
Open

perf(kzg): execute test vectors instead of proving each one#672
shuklaayush wants to merge 5 commits into
develop-v2.1.0from
ayush/kzg-tests-execute-vectors

Conversation

@shuklaayush

@shuklaayush shuklaayush commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Why

The tests-kzg workflow takes 25–29 min per run, ~24 min of which is test_multiple_valid_verify_kzg: it generated a full app proof for each of the 54 valid KZG vectors, recreating the Sdk (guest build + app keygen) per vector on top of the ~25s/vector proving cost.

Proving is the irreducible cost — measurement shows keygen+build is only a few seconds while each proof takes ~25s on the 64-core runner — so the fix is to not prove every vector on every PR, while keeping full proving coverage available.

What

  • test_multiple_valid_verify_kzg builds and compiles the guest once, then runs each vector through the SDK's pure-execution path (sdk.compile + sdk.execute) instead of proving. The guest assert!s the verification result, so execution carries the per-vector pass/fail signal for guest logic. 1438s → 4.1s.
  • New test_prove_multiple_valid_verify_kzg (#[ignore]d by default) proves all 54 valid vectors with a shared prover, so keygen runs once. This covers what execution alone cannot: circuit trace generation and proving over the full input range, which can fail on operand edge cases that execute fine. Verified passing locally over all 54 vectors.
  • A prove-all job runs this test on pushes to main and on PRs carrying the run-kzg-proving label. Following the openvm label-overrides pattern, a new label-overrides.yml fires on labeled events and invokes tests-kzg.yml via workflow_call, so adding the label starts the proving job immediately (the fast test job is skipped on label events, and unrelated labels don't re-trigger anything).
  • test_single_valid_verify_kzg still proves one vector on every PR, keeping the proving pipeline smoke-tested.
  • Invalid-vector tests assert an execution error (guest trap) instead of wrapping a proving panic in catch_unwind; this made test_multiple_invalid_verify_kzg — previously #[ignore = "takes too long"] — cheap enough to un-ignore, so all 68 invalid vectors now run in CI (42s).

Expected CI time: ~6 min on PRs (vs ~25 min), with full 54-vector proving on main pushes and label-opted PRs.

🤖 Generated with Claude Code

shuklaayush and others added 2 commits July 22, 2026 20:14
test_multiple_valid_verify_kzg proved all 54 vectors end-to-end,
rebuilding the guest and regenerating the app proving key per vector
(~24 min in CI). The guest asserts the verification result, so pure
execution carries the same pass/fail signal per vector; the proving
pipeline stays covered by test_single_valid_verify_kzg.

Build and compile the guest once per test, run each vector through
sdk.execute, and assert invalid vectors fail via execution error. This
makes test_multiple_invalid_verify_kzg cheap enough to un-ignore, so
all 68 invalid vectors now run in CI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Executing the vectors covers guest logic but not the circuits: trace
generation and proving can fail on operand edge cases that execute
fine. Add test_prove_multiple_valid_verify_kzg, which proves all 54
valid vectors with a shared prover (keygen once). Proving costs ~25s
per vector on the 64-core runner, so the test is ignored by default
and CI runs it on pushes to main and on PRs with the
run-kzg-prove-all label.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Crate-agnostic name so the same label can gate ignored proving tests
in other workflows.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shuklaayush shuklaayush added run-kzg-proving Run the ignored full KZG proving test on this PR and removed run-full-proving labels Jul 22, 2026
shuklaayush and others added 2 commits July 22, 2026 21:33
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adding the run-kzg-proving label invokes tests-kzg.yml via
workflow_call, starting only the prove-all job. Other label additions
no longer re-run the workflow, and the fast test job is skipped on
label events.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shuklaayush shuklaayush added run-kzg-proving Run the ignored full KZG proving test on this PR and removed run-kzg-proving Run the ignored full KZG proving test on this PR labels Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-kzg-proving Run the ignored full KZG proving test on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant