Skip to content

Add field element comparison script#504

Merged
MauroToscano merged 36 commits into
mainfrom
bench_elements_vs
Apr 22, 2026
Merged

Add field element comparison script#504
MauroToscano merged 36 commits into
mainfrom
bench_elements_vs

Conversation

@nicole-graus

Copy link
Copy Markdown
Collaborator

Adds a script to compare the amount of field elements in Lambda VM against SP1 v5 and SP1 v6.

It runs a Fibonacci program of size 100k, 200k, and 400k and counts main-trace field elements (base field, rows × columns across all AIR tables) and auxiliary field elements (extension field, committed interaction columns × rows).

How to run it:

./bench_vs/run_elements.sh                        # default: n = 100k, 200k, 400k
./bench_vs/run_elements.sh -n 100000 1000000      # custom sizes

MauroToscano and others added 27 commits February 25, 2026 19:00
Co-authored-by: Gabriel Bosio <38794644+gabrielbosio@users.noreply.github.com>
  --steps flag for nightly 1M/2M/4M/8M benchmarks
  bench_vs/run.sh by switching to sed
@github-actions

Copy link
Copy Markdown

Codex Code Review

  1. High (Security): Remote script execution via curl | bash on a self-hosted runner.
    • File: .github/workflows/bench-vs-nightly.yml:37
    • Why it matters: This executes mutable remote code without pinning or integrity verification. If the endpoint or transit is compromised, attacker code runs on your self-hosted machine.
    • Action: Replace with a pinned, verified install path (versioned artifact + checksum/signature verification) or preinstall SP1 on the runner image.

No other concrete security/bug/perf issues stood out in the PR diff.

Comment thread .github/workflows/bench-vs-nightly.yml Outdated
Comment thread prover/src/tables/trace_builder.rs
@claude

claude Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Review Summary

Overall: Clean, well-structured addition. No security vulnerabilities or logic bugs in the core prover changes. Two issues worth addressing, both flagged inline.

Issues

Medium – CI supply chain risk (.github/workflows/bench-vs-nightly.yml:36)
SP1 is installed via curl | bash without a version pin or hash check. This means the nightly CI silently runs against a moving target, and any compromise of sp1up.succinct.xyz executes arbitrary code on the self-hosted bench runner. Pin to a specific SP1 release.

Low – Silent element under-count if tables grow (prover/src/tables/trace_builder.rs)
total_field_elements and total_auxiliary_field_elements manually list every table type with no exhaustiveness guard. A new table added to Traces would silently not be counted, making benchmark numbers quietly wrong.

No Issues

  • Core API changes (prover/src/lib.rs): prove_with_inputs, prove_with_options_and_inputs, and count_elements are clean wrappers. Refactoring preserves the existing public API.
  • CLI (bin/cli/src/main.rs): --private-input, --cycles, --elements, and the count-elements subcommand are straightforward. Error handling is consistent throughout.
  • Guest program (bench_vs/lambda/fibonacci/src/main.rs): read_n() correctly skips the 4-byte length prefix prepended by load_private_inputs — the 12-byte buffer and input[4..12] slice are intentional and correct.
  • Benchmark scripts: Shell quoting and arithmetic are safe; set -euo pipefail is set; numeric values are extracted via sed before being passed to awk/python3.

@MauroToscano
MauroToscano added this pull request to the merge queue Apr 22, 2026
Merged via the queue into main with commit 50b8614 Apr 22, 2026
10 checks passed
@MauroToscano
MauroToscano deleted the bench_elements_vs branch April 22, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants