Skip to content

Complete integration of Mavros (including lookups)#443

Open
veljkovranic wants to merge 5 commits into
mainfrom
mavros_integrations
Open

Complete integration of Mavros (including lookups)#443
veljkovranic wants to merge 5 commits into
mainfrom
mavros_integrations

Conversation

@veljkovranic
Copy link
Copy Markdown
Collaborator

Adds a new test for sha256_35 (35 rounds).

The initial integration contained a few issues:

  • WHIR parameters for Mavros were not configured properly
  • The Mavros version is pushed up to the latest commit hash

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

CSP benchmarks

Metric Value
Workflow status [PASS] success
Commit b6ff0aa1e021
Run #26030300174
Circuits benchmarked 21
Iterations averaged per circuit 3

Prover time, peak RSS, peak heap, and verifier time are arithmetic means across the iterations. Peak heap comes from the largest peak memory entry in provekit-cli prove's tracing output; peak RSS is reported by /usr/bin/time -v (max-resident-set-size).

No baseline available yet — deltas will appear once this workflow has produced at least one successful main run.

Results
Circuit Constraints Witnesses Prover time Peak RSS Peak heap Verifier time Proof size PKP size
ecdsa_p256 143,282 258,158 3.73 s 256 MB 225 MB 347 ms 2.80 MB 810 KB
keccak_1024 822,870 1,543,366 6.35 s 985 MB 953 MB 847 ms 3.16 MB 6.07 MB
keccak_128 163,058 313,707 2.11 s 273 MB 242 MB 367 ms 2.79 MB 1.22 MB
keccak_2048 1,575,606 2,945,822 11.84 s 1.81 GB 1.80 GB 1.43 s 3.27 MB 12.36 MB
keccak_256 256,206 487,012 2.31 s 328 MB 290 MB 410 ms 2.85 MB 1.97 MB
keccak_512 445,094 839,130 3.63 s 594 MB 509 MB 550 ms 2.95 MB 3.40 MB
poseidon2_12 479 563 350 ms 23.98 MB 14.69 MB 103 ms 1.01 MB 436 KB
poseidon2_16 556 719 353 ms 24.27 MB 14.88 MB 103 ms 1.03 MB 530 KB
poseidon2_2 231 278 347 ms 23.11 MB 14.11 MB 100 ms 1.03 MB 108 KB
poseidon2_4 529 535 347 ms 23.41 MB 14.31 MB 100 ms 1.05 MB 31.67 KB
poseidon2_8 363 423 347 ms 24.12 MB 14.50 MB 100 ms 1.04 MB 365 KB
poseidon_12 504 524 350 ms 24.20 MB 14.69 MB 100 ms 1.02 MB 410 KB
poseidon_16 609 633 353 ms 24.18 MB 14.97 MB 107 ms 1.06 MB 536 KB
poseidon_2 240 249 347 ms 22.95 MB 14.02 MB 100 ms 1.03 MB 53.79 KB
poseidon_4 297 309 343 ms 23.48 MB 14.31 MB 100 ms 1.04 MB 210 KB
poseidon_8 402 418 350 ms 23.46 MB 14.50 MB 100 ms 1.03 MB 305 KB
sha256_1024 196,940 339,764 2.20 s 305 MB 274 MB 417 ms 2.81 MB 1.90 MB
sha256_128 46,398 80,974 1.09 s 99.59 MB 83.51 MB 260 ms 2.52 MB 505 KB
sha256_2048 345,399 612,724 3.58 s 548 MB 484 MB 600 ms 2.97 MB 3.12 MB
sha256_256 67,904 117,944 1.38 s 149 MB 130 MB 290 ms 2.66 MB 718 KB
sha256_512 110,916 191,884 1.50 s 181 MB 158 MB 320 ms 2.67 MB 1.10 MB

@veljkovranic veljkovranic requested a review from Bisht13 May 18, 2026 09:51
Comment thread provekit/prover/src/lib.rs Outdated
// Public re-exports for items used by integration tests and benchmarks.
pub use {ec_arith::ec_scalar_mul, r1cs::solve_witness_vec};

fn log_commit_input(label: &str, values: &[FieldElement], scheme_domain_len: usize) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have this in something like tracing.rs and if needed at multiple places then can put it in common?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O(n) is_zero() scan on the prove hot path at info level. Drop nonzero_entries, or gate on tracing::enabled!(Level::DEBUG), or move the whole call to debug!.

Comment thread provekit/prover/src/lib.rs Outdated
.collect::<Result<Vec<_>>>()?
};

log_commit_input("noir_w1", &w1, 1usize << self.whir_for_witness.m);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these debug logs?

Comment thread provekit/prover/src/lib.rs Outdated
);

let mut phase1 = phase1;
let w1 = take(&mut phase1.out_wit_pre_comm);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This take() is unsafe with Mavros lookup tables. Phase1Result.tables stores raw multiplicities_wit pointers into out_wit_pre_comm; commit() pads/resizes the moved vector before run_phase2, so those pointers can become stale if the Vec reallocates. Please keep phase1.out_wit_pre_comm owned by phase1 until after run_phase2 (e.g. clone for the commitment), or change Mavros to store offsets instead of raw pointers.

);
}

#[test]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add cases for w1_size == num_witnesses (w2=0), w1_size == 0, and an exact-power-of-two pair that exercises the (1<<m) - w1_size < 4*m_0 bump. Also cover the analogous path in new_for_r1cs.

@veljkovranic
Copy link
Copy Markdown
Collaborator Author

Leaving the mavros compile step standalone for now. Opened an issue to track this: #444

#[cfg(not(target_arch = "wasm32"))]
pub mod input_utils;
pub(crate) mod r1cs;
mod tracing;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mod tracing; shadows the extern tracing crate, forcing ::tracing::{...} at every import site (lib.rs:8, r1cs.rs:3, whir_r1cs.rs:2). Rename to mod logging / mod trace_utils.

pub lookups_data_size: usize,
}

impl WitnessLayout {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new size() / pre_commitment_size() / post_commitment_size() methods are pub but have no /// docs. Workspace lints cargo doc -D warnings, so one-liners each.

.instance(&instance);
let mut merlin = ProverState::new(&ds, TranscriptSponge::from_config(self.hash_config));

info!(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this 11-field info! can collapse to info!(?self.witness_layout, ?self.constraints_layout, scheme_domain_len = ..., "Mavros witness layout"); WitnessLayout/ConstraintsLayout already derive Debug.

total_witness_size = self.witness_layout.size(),
constraints_algebraic_size = self.constraints_layout.algebraic_size,
constraints_total_size = self.constraints_layout.size(),
scheme_domain_len = 1usize << self.whir_for_witness.m,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 1usize << self.whir_for_witness.m repeats at :314, :322, :352 (and :188, :226 in NoirProver). Add a const fn WhirR1CSScheme::domain_size(&self) -> usize.

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.

2 participants