feat: add modexp example guest program and benchmark (#1067)#1308
Open
RajeshRk18 wants to merge 2 commits intoa16z:mainfrom
Open
feat: add modexp example guest program and benchmark (#1067)#1308RajeshRk18 wants to merge 2 commits intoa16z:mainfrom
RajeshRk18 wants to merge 2 commits intoa16z:mainfrom
Conversation
Add examples/modexp/ performing chained modular exponentiation (base^exp mod modulus) using num-bigint BigUint::modpow with configurable bit lengths and iteration count. Add Modexp variant to e2e_profiling.rs benchmark.
moodlezoup
requested changes
Mar 9, 2026
Collaborator
moodlezoup
left a comment
There was a problem hiding this comment.
cargo run --release -p modexp fails (need to increase max_trace_length and CYCLES_PER_MODEXP_256 is inaccurate
Collaborator
|
also, could you address the machete failure in CI? |
- Switch modexp-guest to no-std with fixed [u8; 32] arrays - Remove unused num-traits dep (fixes machete CI) - Remove num-bigint from host (no longer needed) - Increase max_trace_length to 2^26 (67M) - Set CYCLES_PER_MODEXP_256 to 883493 (empirically measured)
0xAndoroid
reviewed
Mar 11, 2026
| let prover_preprocessing = guest::preprocess_prover_modexp(shared_preprocessing.clone()); | ||
| let verifier_setup = prover_preprocessing.generators.to_verifier_setup(); | ||
| let verifier_preprocessing = | ||
| guest::preprocess_verifier_modexp(shared_preprocessing, verifier_setup); |
Collaborator
There was a problem hiding this comment.
Suggested change
| guest::preprocess_verifier_modexp(shared_preprocessing, verifier_setup); | |
| guest::preprocess_verifier_modexp(shared_preprocessing, verifier_setup, None); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add examples/modexp/ performing chained modular exponentiation (base^exp mod modulus) using num-bigint BigUint::modpow with configurable bit lengths and iteration count.
Add Modexp variant to e2e_profiling.rs benchmark.