Repository navigation
Conversation
test_msm now checks 14, 15, 25, 31, 32 and 33 bases, on each side of batched::msm's switch from double-and-add (below 15) and its single-bit window (below 32). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017omPAWn5XC7EA2aMFGn7FC
batched::msm gave 15 to 31 bases a single-bit window: 253 windows, each paying for its own batched inversions over a handful of points. At 25 bases that took 11.1 ms on one core, against 1.8 ms for double-and-add, which batched::msm already uses below 15 bases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017omPAWn5XC7EA2aMFGn7FC
This branch has not been deployed
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.
Motivation
batched::msmuses double-and-add below 15 bases.From 15 to 31 bases, it uses the bucket method with a window of one bit.
That is 253 windows, and each window does its own batched inversions over a few points.
At 32 bases and above, the window grows, and the cost drops again.
Verification of a private fee does one G1 MSM of 25 bases, for the record's inclusion circuit.
A public fee and a
transfer_publicexecution do G1 MSMs of 13 bases or fewer.This PR uses double-and-add below 32 bases. The bucket method with a one-bit window is then not reachable, so the PR removes it.
Commits:
test: cover MSM sizes at the batched path's thresholdsadds 14, 15, 25, 31, 32 and 33 bases totest_msm. The test passes before and after the change.perf: use double-and-add for MSMs below 32 basesraises the cutoff from 15 to 32.One G1 MSM, one core (
taskset,RAYON_NUM_THREADS=1), median of 300 interleaved repetitions. Host: Intel Xeon w9-3475X.stagingstandard::msmcheck_transactionof acredits.aleo/transfer_publicatConsensusVersion::V22(Varuna V3), with the verified-transaction cache cleared before each call, one core, pinned. Both arms include #3591. Each row is 6 interleaved blocks.check_fee, private feecheck_transaction, private feecheck_fee, public feecheck_transaction, public feeOn 72 threads, each iteration checks 72 transactions in parallel. Each row is 6 interleaved blocks.
The public-fee rows do no MSM in the changed range.
Test Plan
cargo test --release -p snarkvm-algorithms(115 passed)cargo clippy -p snarkvm-algorithms --all-targets [--features serial] -- -D warningscargo +nightly-2026-04-02 fmt --all -- --checkledger/benches/verify_transaction.rsfrom bench: measure transaction verification without the verified-transaction cache #3592:cargo bench -p snarkvm-ledger --bench verify_transaction --features test_consensus_heights.Documentation
None.
Backwards compatibility
No consensus change. An MSM returns the same group element;
test_msmcompares both paths with a naive MSM at every size above.🤖 Generated with Claude Code
https://claude.ai/code/session_017omPAWn5XC7EA2aMFGn7FC