Skip to content

perf(point_evaluation): rearrange KZG verifier to use G1 scalar mul#660

Open
0xVolosnikov wants to merge 1 commit into
draft-0.4.0from
vv/kzg-rearranged-verifier
Open

perf(point_evaluation): rearrange KZG verifier to use G1 scalar mul#660
0xVolosnikov wants to merge 1 commit into
draft-0.4.0from
vv/kzg-rearranged-verifier

Conversation

@0xVolosnikov
Copy link
Copy Markdown
Contributor

What ❔

Rearranges the KZG point-evaluation verifier so the scalar multiplication by z lives in G1 instead of G2:

  • Before: e(y·G1 − P, G2) · e(proof, τ·G2 − z·G2) == 1
  • After: e(y·G1 − P − z·proof, G2) · e(proof, τ·G2) == 1

Algebraically equivalent by bilinearity. The rearrangement trades one G2 scalar-mul + G2 subtraction + G2 into_affine (Montgomery inversion) for one G1 scalar-mul + G1 subtraction; G2 lives in Fq² so every G2 op is materially more expensive than its G1 equivalent.

The new verify_kzg_proof is defined locally in basic_system::system_functions::point_evaluation, in parallel with the existing reference at crypto::bls12_381::verify_kzg_proof (kept upstream and used by the new matches-reference test). Wired into both call sites — the EIP-4844 point-evaluation precompile and blob_commitment_generator::blob_versioned_hash_with_advisor.

Why ❔

KZG verification is one of the heaviest BLS12-381 paths in the prover. The rearranged form makes the dominant scalar-mul cheaper without changing any external semantics or pricing.

Benchmark — test_kzg_regression under ZKSYNC_RISC_V_RUN=true with the for-tests-benchmarking RISC-V binary, A/B at the same parent commit:

Metric Baseline Head Δ%
point_evaluation raw cycles 38,992,778 31,791,155 −18.5%
point_evaluation bigint delegations 3,087,009 2,513,437 −18.6%
point_evaluation effective (raw + 4·bigint) 51,340,814 41,844,903 −18.5%
process_transaction raw 39,268,249 32,065,745 −18.3%
process_block raw 78,945,544 64,534,918 −18.3%
dist/for_tests/app.bin size 1,353,100 B 1,337,196 B −1.18%

Tx- and block-level deltas track the marker delta — the saving is fully attributable to point_evaluation. Binary size decreases, so no RISC-V I-cache regression risk even with #[inline(always)] on the new function.

Is this a breaking change?

  • Yes
  • No

Checklist

  • PR title corresponds to the body of PR.
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted.

Stacked on

Based on vv-jump-inline-riscv-draft. The bootloader call site lives at a path (basic_bootloader/.../blob_commitment_generator/mod.rs) that does not exist on main yet, so the diff cannot rebase cleanly onto main. Once vv-jump-inline-riscv-draft lands (or merges through), this PR auto-retargets.

Follow-ups not in this PR

  • Add a randomized matches-reference test (~dozens of random (commitment, proof, z, y) tuples) — current coverage is 3 explicit inputs plus a z=0/y=0 edge.
  • Upstream a PREPARED_G2_BY_TAU const in airbender-crypto next to PREPARED_G2_GENERATOR; today the G2Prepared conversion for τ·G2 is done at every call, but the value is a fixed setup constant and can be precomputed at compile time for further savings.
  • Eventually adopt the rearranged form upstream in crypto::bls12_381::verify_kzg_proof so the two copies do not drift.

🤖 Generated with Claude Code

@0xVolosnikov 0xVolosnikov force-pushed the vv/kzg-rearranged-verifier branch from ff58d23 to 4e6a520 Compare May 15, 2026 16:26
@0xVolosnikov 0xVolosnikov changed the base branch from vv-jump-inline-riscv-draft to vv/bench-precompiles May 15, 2026 16:26
@0xVolosnikov 0xVolosnikov reopened this May 15, 2026
@0xVolosnikov 0xVolosnikov force-pushed the vv/bench-precompiles branch 2 times, most recently from f58aaf1 to 8b5affe Compare May 18, 2026 13:41
Base automatically changed from vv/bench-precompiles to draft-0.4.0 May 18, 2026 14:51
@0xVolosnikov 0xVolosnikov force-pushed the vv/kzg-rearranged-verifier branch from 4e6a520 to a6b35e7 Compare May 19, 2026 13:33
@0xVolosnikov 0xVolosnikov requested a review from Copilot May 19, 2026 13:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes the BLS12-381 KZG point-evaluation verification path by algebraically rearranging the pairing equation to move the z scalar multiplication from G2 into G1, reducing expensive G2 operations while preserving verification semantics. It introduces a local verify_kzg_proof implementation in the point-evaluation system function module and wires it into both the EIP-4844 point-evaluation precompile path and the blob commitment generator code path, with a test that checks equivalence against the existing reference verifier.

Changes:

  • Add a locally defined verify_kzg_proof that verifies KZG proofs via e(y·G1 − P − z·proof, G2) · e(proof, τ·G2) == 1.
  • Switch point-evaluation precompile verification to use the new local verifier.
  • Switch blob commitment verification in the bootloader to use the same local verifier and add a matches-reference test.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
basic_system/src/system_functions/point_evaluation.rs Adds the rearranged KZG verifier and uses it in the point-evaluation system function; adds a test comparing against the reference implementation.
basic_bootloader/src/bootloader/block_flow/zk/post_tx_op/da_commitment_generator/blob_commitment_generator/mod.rs Replaces the reference KZG verifier call with the new local verifier for blob proof checking.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +234 to +252
assert!(verify_kzg_proof(commitment, proof, z, y));
assert_eq!(
verify_kzg_proof(commitment, proof, z, y),
crypto::bls12_381::verify_kzg_proof(commitment, proof, z, y)
);

let unrelated_128_bit_z =
hex!("000000000000000000000000000000000123456789abcdef0123456789abcdef");
let unrelated_128_bit_z = parse_scalar(&unrelated_128_bit_z).unwrap();
assert_eq!(
verify_kzg_proof(commitment, proof, unrelated_128_bit_z, y),
crypto::bls12_381::verify_kzg_proof(commitment, proof, unrelated_128_bit_z, y)
);

let zero_y = parse_scalar(&[0u8; 32]).unwrap();
assert_eq!(
verify_kzg_proof(commitment, proof, z, zero_y),
crypto::bls12_381::verify_kzg_proof(commitment, proof, z, zero_y)
);
@0xVolosnikov 0xVolosnikov requested a review from AntonD3 May 19, 2026 15:05
@0xVolosnikov 0xVolosnikov marked this pull request as ready for review May 19, 2026 15:05
Move the scalar multiplication by z from G2 to G1:

  before: e(yG1 - P, G2) · e(proof, τG2 - zG2)  == 1
  after:  e(yG1 - P - z·proof, G2) · e(proof, τG2) == 1

Algebraically equivalent by bilinearity. G2 lives in Fq², so a G2
scalar mul is materially more expensive than the G1 equivalent; the
rearranged form also eliminates one G2 subtraction and one G2
into_affine (Montgomery inversion).

Implemented as a local function in basic_system::system_functions::
point_evaluation, parallel to the existing crypto::bls12_381::
verify_kzg_proof (kept upstream as the reference). Wired into both
the EIP-4844 point-evaluation precompile and the bootloader's blob
commitment generator post-tx-op.

Bench (test_kzg_regression under ZKSYNC_RISC_V_RUN=true,
for-tests-benchmarking RISC-V binary, A/B at same parent commit):

  point_evaluation raw cycles       38,992,778 → 31,791,155  −18.5%
  point_evaluation bigint delegations 3,087,009 → 2,513,437  −18.6%
  effective (raw + 4·bigint)        51,340,814 → 41,844,903  −18.5%
  dist/for_tests/app.bin size        1,353,100 → 1,337,196   −1.18%

Binary shrinks, so no RISC-V I-cache regression risk despite
#[inline(always)] on the new function.

Includes test_rearranged_kzg_verifier_matches_reference that
asserts byte-equal output vs crypto::bls12_381::verify_kzg_proof
on a valid proof, an unrelated 128-bit z, and a zero y.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@0xVolosnikov 0xVolosnikov force-pushed the vv/kzg-rearranged-verifier branch from a6b35e7 to 7e05a97 Compare May 29, 2026 20:27
@github-actions
Copy link
Copy Markdown
Contributor

Block-level effective cycles

Average across all block fixtures (process_block). Per-block breakdown below.

Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%) Base Keccak Head Keccak (%)
all blocks (keccak DA) process_block 653,615,266 645,510,860 (-1.24%) 521,930,182 515,778,805 (-1.18%) 781,526 781,526 (+0.00%) 23,323,469 22,835,212 (-2.09%) 6,471,698 6,471,698 (+0.00%)
all blocks (blobs DA) process_block 701,866,111 689,562,976 (-1.75%) 559,084,359 549,739,513 (-1.67%) 791,605 791,605 (+0.00%) 26,365,011 25,625,438 (-2.81%) 6,164,007 6,164,007 (+0.00%)
Per-block effective cycles
Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%) Base Keccak Head Keccak (%)
block_25188855 (keccak DA) process_block 237,657,747 237,657,747 (+0.00%) 184,564,543 184,564,543 (+0.00%) 498,230 498,230 (+0.00%) 8,457,231 8,457,231 (+0.00%) 2,823,150 2,823,150 (+0.00%)
block_25188855 (blobs DA) process_block 286,593,796 282,353,306 (-1.48%) 221,896,328 218,677,686 (-1.45%) 502,810 502,810 (+0.00%) 11,479,512 11,224,050 (-2.23%) 2,683,615 2,683,615 (+0.00%)
block_25188862 (keccak DA) process_block 549,525,194 549,525,194 (+0.00%) 421,362,246 421,362,246 (+0.00%) 831,340 831,340 (+0.00%) 22,892,549 22,892,549 (+0.00%) 5,822,828 5,822,828 (+0.00%)
block_25188862 (blobs DA) process_block 598,065,527 593,636,955 (-0.74%) 458,731,071 455,355,139 (-0.74%) 841,550 841,550 (+0.00%) 25,956,106 25,692,946 (-1.01%) 5,511,308 5,511,308 (+0.00%)
block_25188863 (keccak DA) process_block 229,913,146 229,913,146 (+0.00%) 177,029,506 177,029,506 (+0.00%) 419,790 419,790 (+0.00%) 8,150,725 8,150,725 (+0.00%) 3,391,025 3,391,025 (+0.00%)
block_25188863 (blobs DA) process_block 279,011,984 274,591,426 (-1.58%) 214,500,872 211,147,226 (-1.56%) 424,750 424,750 (+0.00%) 11,188,970 10,922,242 (-2.38%) 3,239,808 3,239,808 (+0.00%)
block_25188937 (keccak DA) process_block 720,636,582 720,636,582 (+0.00%) 566,510,310 566,510,310 (+0.00%) 1,209,910 1,209,910 (+0.00%) 21,884,022 21,884,022 (+0.00%) 11,807,906 11,807,906 (+0.00%)
block_25188937 (blobs DA) process_block 767,802,154 764,000,556 (-0.50%) 603,146,270 600,263,640 (-0.48%) 1,224,860 1,224,860 (+0.00%) 24,913,521 24,683,779 (-0.92%) 11,351,010 11,351,010 (+0.00%)
block_25188945 (keccak DA) process_block 421,930,894 421,930,894 (+0.00%) 341,291,474 341,291,474 (+0.00%) 930,920 930,920 (+0.00%) 11,233,142 11,233,142 (+0.00%) 5,203,033 5,203,033 (+0.00%)
block_25188945 (blobs DA) process_block 469,735,767 465,575,574 (-0.89%) 378,396,423 375,219,942 (-0.84%) 945,470 945,470 (+0.00%) 14,294,488 14,048,560 (-1.72%) 4,758,468 4,758,468 (+0.00%)
block_25188950 (keccak DA) process_block 538,248,623 529,834,412 (-1.56%) 433,143,227 426,760,996 (-1.47%) 659,000 659,000 (+0.00%) 19,210,924 18,702,929 (-2.64%) 4,429,425 4,429,425 (+0.00%)
block_25188950 (blobs DA) process_block 587,289,794 574,413,357 (-2.19%) 470,656,926 460,876,253 (-2.08%) 665,270 665,270 (+0.00%) 22,259,167 21,485,226 (-3.48%) 4,237,970 4,237,970 (+0.00%)
block_25189014 (keccak DA) process_block 379,907,714 379,907,714 (+0.00%) 296,127,822 296,127,822 (+0.00%) 577,680 577,680 (+0.00%) 13,434,465 13,434,465 (+0.00%) 5,199,788 5,199,788 (+0.00%)
block_25189014 (blobs DA) process_block 428,986,903 424,686,075 (-1.00%) 333,597,727 330,320,999 (-0.98%) 582,880 582,880 (+0.00%) 16,474,342 16,218,317 (-1.55%) 5,041,432 5,041,432 (+0.00%)
block_25189128 (keccak DA) process_block 426,196,711 426,196,711 (+0.00%) 342,425,715 342,425,715 (+0.00%) 773,970 773,970 (+0.00%) 11,463,305 11,463,305 (+0.00%) 6,383,564 6,383,564 (+0.00%)
block_25189128 (blobs DA) process_block 474,334,839 470,036,988 (-0.91%) 379,623,879 376,349,584 (-0.86%) 786,150 786,150 (+0.00%) 14,521,453 14,265,564 (-1.76%) 6,011,687 6,011,687 (+0.00%)
block_25189151 (keccak DA) process_block 732,173,781 732,173,781 (+0.00%) 556,213,169 556,213,169 (+0.00%) 1,085,470 1,085,470 (+0.00%) 29,031,931 29,031,931 (+0.00%) 10,616,342 10,616,342 (+0.00%)
block_25189151 (blobs DA) process_block 779,212,290 775,055,786 (-0.53%) 592,997,650 589,836,190 (-0.53%) 1,104,220 1,104,220 (+0.00%) 32,092,856 31,844,095 (-0.78%) 10,043,924 10,043,924 (+0.00%)
block_25189153 (keccak DA) process_block 2,299,962,265 2,227,332,417 (-3.16%) 1,900,633,813 1,845,502,269 (-2.90%) 828,950 828,950 (+0.00%) 87,476,392 83,101,816 (-5.00%) 9,039,921 9,039,921 (+0.00%)
block_25189153 (blobs DA) process_block 2,347,628,053 2,271,279,738 (-3.25%) 1,937,296,445 1,879,348,470 (-2.99%) 838,090 838,090 (+0.00%) 90,469,691 85,869,606 (-5.08%) 8,760,851 8,760,851 (+0.00%)
Block-level sub-phases
Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%) Base Keccak Head Keccak (%)
block_25188855 (blobs DA) blob_versioned_hash 49,929,644 45,689,154 (-8.49%) 37,767,240 34,548,598 (-8.52%) 4,580 4,580 (+0.00%) 3,022,281 2,766,819 (-8.45%) 0 0 (+0.00%)
block_25188862 (blobs DA) blob_versioned_hash 50,786,889 46,358,317 (-8.72%) 38,369,301 34,993,369 (-8.80%) 10,210 10,210 (+0.00%) 3,063,557 2,800,397 (-8.59%) 0 0 (+0.00%)
block_25188863 (blobs DA) blob_versioned_hash 50,175,573 45,755,015 (-8.81%) 37,943,233 34,589,587 (-8.84%) 4,960 4,960 (+0.00%) 3,038,245 2,771,517 (-8.78%) 0 0 (+0.00%)
block_25188937 (blobs DA) blob_versioned_hash 50,405,427 46,603,829 (-7.54%) 38,048,231 35,165,601 (-7.58%) 14,950 14,950 (+0.00%) 3,029,499 2,799,757 (-7.58%) 0 0 (+0.00%)
block_25188945 (blobs DA) blob_versioned_hash 50,921,583 46,761,390 (-8.17%) 38,443,399 35,266,918 (-8.26%) 14,550 14,550 (+0.00%) 3,061,346 2,815,418 (-8.03%) 0 0 (+0.00%)
block_25188950 (blobs DA) blob_versioned_hash 50,411,534 45,949,308 (-8.85%) 38,118,242 34,719,800 (-8.92%) 6,270 6,270 (+0.00%) 3,048,243 2,782,297 (-8.72%) 0 0 (+0.00%)
block_25189014 (blobs DA) blob_versioned_hash 50,211,526 45,910,698 (-8.57%) 37,968,818 34,692,090 (-8.63%) 5,200 5,200 (+0.00%) 3,039,877 2,783,852 (-8.42%) 0 0 (+0.00%)
block_25189128 (blobs DA) blob_versioned_hash 50,778,496 46,480,645 (-8.46%) 38,351,024 35,076,729 (-8.54%) 12,180 12,180 (+0.00%) 3,058,148 2,802,259 (-8.37%) 0 0 (+0.00%)
block_25189151 (blobs DA) blob_versioned_hash 51,110,387 46,953,883 (-8.13%) 38,566,687 35,405,227 (-8.20%) 18,750 18,750 (+0.00%) 3,060,925 2,812,164 (-8.13%) 0 0 (+0.00%)
block_25189153 (blobs DA) blob_versioned_hash 49,654,213 45,935,746 (-7.49%) 37,534,777 34,718,346 (-7.50%) 9,140 9,140 (+0.00%) 2,993,299 2,767,790 (-7.53%) 0 0 (+0.00%)
block_25188855 (blobs DA) da_commitment 2,520,840 2,520,840 (+0.00%) 2,408,840 2,408,840 (+0.00%) 7,000 7,000 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188855 (keccak DA) da_commitment 3,513,442 3,513,442 (+0.00%) 2,845,898 2,845,898 (+0.00%) 7,000 7,000 (+0.00%) 0 0 (+0.00%) 138,886 138,886 (+0.00%)
block_25188862 (blobs DA) da_commitment 5,542,919 5,542,919 (+0.00%) 5,290,119 5,290,119 (+0.00%) 15,800 15,800 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188862 (keccak DA) da_commitment 7,785,080 7,785,080 (+0.00%) 6,288,796 6,288,796 (+0.00%) 15,800 15,800 (+0.00%) 0 0 (+0.00%) 310,871 310,871 (+0.00%)
block_25188863 (blobs DA) da_commitment 2,557,099 2,557,099 (+0.00%) 2,441,579 2,441,579 (+0.00%) 7,220 7,220 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188863 (keccak DA) da_commitment 3,629,435 3,629,435 (+0.00%) 2,911,643 2,911,643 (+0.00%) 7,220 7,220 (+0.00%) 0 0 (+0.00%) 150,568 150,568 (+0.00%)
block_25188937 (blobs DA) da_commitment 7,684,897 7,684,897 (+0.00%) 7,328,897 7,328,897 (+0.00%) 22,250 22,250 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188937 (keccak DA) da_commitment 10,920,391 10,920,391 (+0.00%) 8,739,403 8,739,403 (+0.00%) 22,250 22,250 (+0.00%) 0 0 (+0.00%) 456,247 456,247 (+0.00%)
block_25188945 (blobs DA) da_commitment 6,766,623 6,766,623 (+0.00%) 6,450,463 6,450,463 (+0.00%) 19,760 19,760 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188945 (keccak DA) da_commitment 9,878,984 9,878,984 (+0.00%) 7,787,160 7,787,160 (+0.00%) 19,760 19,760 (+0.00%) 0 0 (+0.00%) 443,916 443,916 (+0.00%)
block_25188950 (blobs DA) da_commitment 3,338,915 3,338,915 (+0.00%) 3,188,995 3,188,995 (+0.00%) 9,370 9,370 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188950 (keccak DA) da_commitment 4,700,642 4,700,642 (+0.00%) 3,787,498 3,787,498 (+0.00%) 9,370 9,370 (+0.00%) 0 0 (+0.00%) 190,806 190,806 (+0.00%)
block_25189014 (blobs DA) da_commitment 2,978,030 2,978,030 (+0.00%) 2,850,670 2,850,670 (+0.00%) 7,960 7,960 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189014 (keccak DA) da_commitment 4,106,010 4,106,010 (+0.00%) 3,347,822 3,347,822 (+0.00%) 7,960 7,960 (+0.00%) 0 0 (+0.00%) 157,707 157,707 (+0.00%)
block_25189128 (blobs DA) da_commitment 6,135,237 6,135,237 (+0.00%) 5,844,517 5,844,517 (+0.00%) 18,170 18,170 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189128 (keccak DA) da_commitment 8,771,258 8,771,258 (+0.00%) 6,995,626 6,995,626 (+0.00%) 18,170 18,170 (+0.00%) 0 0 (+0.00%) 371,228 371,228 (+0.00%)
block_25189151 (blobs DA) da_commitment 8,058,835 8,058,835 (+0.00%) 7,691,795 7,691,795 (+0.00%) 22,940 22,940 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189151 (keccak DA) da_commitment 12,126,349 12,126,349 (+0.00%) 9,472,233 9,472,233 (+0.00%) 22,940 22,940 (+0.00%) 0 0 (+0.00%) 571,769 571,769 (+0.00%)
block_25189153 (blobs DA) da_commitment 4,816,784 4,816,784 (+0.00%) 4,587,984 4,587,984 (+0.00%) 14,300 14,300 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189153 (keccak DA) da_commitment 6,800,863 6,800,863 (+0.00%) 5,458,379 5,458,379 (+0.00%) 14,300 14,300 (+0.00%) 0 0 (+0.00%) 278,421 278,421 (+0.00%)
block_25188855 (keccak DA) run_tx_loop 212,949,827 212,949,827 (+0.00%) 162,437,559 162,437,559 (+0.00%) 373,590 373,590 (+0.00%) 8,457,231 8,457,231 (+0.00%) 2,676,476 2,676,476 (+0.00%)
block_25188862 (keccak DA) run_tx_loop 500,660,710 500,660,710 (+0.00%) 377,720,718 377,720,718 (+0.00%) 584,570 584,570 (+0.00%) 22,892,549 22,892,549 (+0.00%) 5,504,169 5,504,169 (+0.00%)
block_25188863 (keccak DA) run_tx_loop 205,441,519 205,441,519 (+0.00%) 155,175,303 155,175,303 (+0.00%) 295,790 295,790 (+0.00%) 8,150,725 8,150,725 (+0.00%) 3,232,669 3,232,669 (+0.00%)
block_25188937 (keccak DA) run_tx_loop 646,275,755 646,275,755 (+0.00%) 499,927,863 499,927,863 (+0.00%) 839,770 839,770 (+0.00%) 21,884,022 21,884,022 (+0.00%) 11,343,871 11,343,871 (+0.00%)
block_25188945 (keccak DA) run_tx_loop 370,090,278 370,090,278 (+0.00%) 295,673,194 295,673,194 (+0.00%) 654,950 654,950 (+0.00%) 11,233,142 11,233,142 (+0.00%) 4,751,329 4,751,329 (+0.00%)
block_25188950 (keccak DA) run_tx_loop 505,472,781 497,058,570 (-1.66%) 403,796,161 397,413,930 (-1.58%) 494,350 494,350 (+0.00%) 19,210,924 18,702,929 (-2.64%) 4,230,831 4,230,831 (+0.00%)
block_25189014 (keccak DA) run_tx_loop 348,919,029 348,919,029 (+0.00%) 268,259,997 268,259,997 (+0.00%) 424,000 424,000 (+0.00%) 13,434,465 13,434,465 (+0.00%) 5,034,293 5,034,293 (+0.00%)
block_25189128 (keccak DA) run_tx_loop 374,412,182 374,412,182 (+0.00%) 296,517,090 296,517,090 (+0.00%) 501,480 501,480 (+0.00%) 11,463,305 11,463,305 (+0.00%) 6,004,548 6,004,548 (+0.00%)
block_25189151 (keccak DA) run_tx_loop 664,400,608 664,400,608 (+0.00%) 496,277,104 496,277,104 (+0.00%) 740,540 740,540 (+0.00%) 29,031,931 29,031,931 (+0.00%) 10,036,785 10,036,785 (+0.00%)
block_25189153 (keccak DA) run_tx_loop 2,252,330,275 2,179,700,427 (-3.22%) 1,857,998,019 1,802,866,475 (-2.97%) 588,240 588,240 (+0.00%) 87,476,392 83,101,816 (-5.00%) 8,753,712 8,753,712 (+0.00%)
block_25188855 (blobs DA) state_commitment_update 17,558,979 17,558,979 (+0.00%) 16,023,619 16,023,619 (+0.00%) 95,960 95,960 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188855 (keccak DA) state_commitment_update 17,555,562 17,555,562 (+0.00%) 16,020,202 16,020,202 (+0.00%) 95,960 95,960 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188862 (blobs DA) state_commitment_update 32,412,499 32,412,499 (+0.00%) 29,506,419 29,506,419 (+0.00%) 181,630 181,630 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188862 (keccak DA) state_commitment_update 32,412,499 32,412,499 (+0.00%) 29,506,419 29,506,419 (+0.00%) 181,630 181,630 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188863 (blobs DA) state_commitment_update 16,942,399 16,942,399 (+0.00%) 15,443,519 15,443,519 (+0.00%) 93,680 93,680 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188863 (keccak DA) state_commitment_update 16,942,399 16,942,399 (+0.00%) 15,443,519 15,443,519 (+0.00%) 93,680 93,680 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188937 (blobs DA) state_commitment_update 53,739,347 53,739,347 (+0.00%) 49,136,947 49,136,947 (+0.00%) 287,650 287,650 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188937 (keccak DA) state_commitment_update 53,739,347 53,739,347 (+0.00%) 49,136,947 49,136,947 (+0.00%) 287,650 287,650 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188945 (blobs DA) state_commitment_update 31,127,413 31,127,413 (+0.00%) 28,100,053 28,100,053 (+0.00%) 189,210 189,210 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188945 (keccak DA) state_commitment_update 31,127,413 31,127,413 (+0.00%) 28,100,053 28,100,053 (+0.00%) 189,210 189,210 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188950 (blobs DA) state_commitment_update 23,369,260 23,369,260 (+0.00%) 21,334,060 21,334,060 (+0.00%) 127,200 127,200 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188950 (keccak DA) state_commitment_update 23,373,478 23,373,478 (+0.00%) 21,338,278 21,338,278 (+0.00%) 127,200 127,200 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189014 (blobs DA) state_commitment_update 23,000,664 23,000,664 (+0.00%) 21,036,504 21,036,504 (+0.00%) 122,760 122,760 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189014 (keccak DA) state_commitment_update 23,000,666 23,000,666 (+0.00%) 21,036,506 21,036,506 (+0.00%) 122,760 122,760 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189128 (blobs DA) state_commitment_update 34,326,398 34,326,398 (+0.00%) 31,148,158 31,148,158 (+0.00%) 198,640 198,640 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189128 (keccak DA) state_commitment_update 34,326,398 34,326,398 (+0.00%) 31,148,158 31,148,158 (+0.00%) 198,640 198,640 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189151 (blobs DA) state_commitment_update 44,869,541 44,869,541 (+0.00%) 40,801,861 40,801,861 (+0.00%) 254,230 254,230 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189151 (keccak DA) state_commitment_update 44,869,541 44,869,541 (+0.00%) 40,801,861 40,801,861 (+0.00%) 254,230 254,230 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189153 (blobs DA) state_commitment_update 34,928,995 34,928,995 (+0.00%) 31,910,595 31,910,595 (+0.00%) 188,650 188,650 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189153 (keccak DA) state_commitment_update 34,928,995 34,928,995 (+0.00%) 31,910,595 31,910,595 (+0.00%) 188,650 188,650 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188855 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188862 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188863 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188937 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188945 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25188950 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189014 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189128 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189151 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
block_25189153 (keccak DA) system_init 48,086 48,086 (+0.00%) 48,086 48,086 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
Precompiles test-crate bench (synthetic workload, all labels)
Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%) Base Keccak Head Keccak (%)
precompiles bn254_ecadd 53,340 53,340 (+0.00%) 47,888 47,888 (+0.00%) 0 0 (+0.00%) 1,363 1,363 (+0.00%) 0 0 (+0.00%)
precompiles bn254_ecmul 732,100 732,100 (+0.00%) 567,912 567,912 (+0.00%) 0 0 (+0.00%) 41,047 41,047 (+0.00%) 0 0 (+0.00%)
precompiles bn254_pairing 71,722,248 71,722,248 (+0.00%) 57,194,104 57,194,104 (+0.00%) 0 0 (+0.00%) 3,632,036 3,632,036 (+0.00%) 0 0 (+0.00%)
precompiles da_commitment 16,711 16,711 (+0.00%) 13,635 13,635 (+0.00%) 30 30 (+0.00%) 0 0 (+0.00%) 649 649 (+0.00%)
precompiles ecrecover 372,969 371,933 (-0.28%) 243,357 242,753 (-0.25%) 0 0 (+0.00%) 31,754 31,646 (-0.34%) 649 649 (+0.00%)
precompiles id 925 925 (+0.00%) 925 925 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles keccak 31,678 31,678 (+0.00%) 10,906 10,906 (+0.00%) 0 0 (+0.00%) 1 1 (+0.00%) 5,192 5,192 (+0.00%)
precompiles modexp 31,947,552 31,947,552 (+0.00%) 21,289,732 21,289,732 (+0.00%) 0 0 (+0.00%) 2,664,455 2,664,455 (+0.00%) 0 0 (+0.00%)
precompiles p256_verify 747,503 747,503 (+0.00%) 468,811 468,811 (+0.00%) 0 0 (+0.00%) 69,673 69,673 (+0.00%) 0 0 (+0.00%)
precompiles process_block 145,049,942 145,039,945 (-0.01%) 115,456,182 115,435,729 (-0.02%) 5,370 5,370 (+0.00%) 7,325,040 7,327,654 (+0.04%) 51,920 51,920 (+0.00%)
precompiles process_transaction 72,308,658 72,304,466 (-0.01%) 57,565,858 57,563,086 (-0.00%) 160 160 (+0.00%) 3,662,994 3,662,639 (-0.01%) 22,066 22,066 (+0.00%)
precompiles ripemd 8,015 8,015 (+0.00%) 8,015 8,015 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles run_tx_loop 144,569,489 144,562,157 (-0.01%) 115,077,781 115,086,153 (+0.01%) 180 180 (+0.00%) 7,328,724 7,324,798 (-0.05%) 43,483 43,483 (+0.00%)
precompiles sha256 13,319 13,319 (+0.00%) 13,319 13,319 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles state_commitment_update 183,227 183,227 (+0.00%) 143,547 143,547 (+0.00%) 2,480 2,480 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles system_init 49,856 49,856 (+0.00%) 49,856 49,856 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
FRI precompile bench (FriProofTx + sidecar + contract call)
Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%) Base Keccak Head Keccak (%)
fri_precompile da_commitment 11,354 11,354 (+0.00%) 11,034 11,034 (+0.00%) 20 20 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
fri_precompile ecrecover 365,314 367,324 (+0.55%) 238,626 239,848 (+0.51%) 0 0 (+0.00%) 31,023 31,220 (+0.64%) 649 649 (+0.00%)
fri_precompile keccak 4,700 4,700 (+0.00%) 2,100 2,100 (+0.00%) 0 0 (+0.00%) 1 1 (+0.00%) 649 649 (+0.00%)
fri_precompile process_block 17,011,753 17,013,444 (+0.01%) 11,163,049 11,164,508 (+0.01%) 354,210 354,190 (-0.01%) 31,707 31,845 (+0.44%) 13,629 13,629 (+0.00%)
fri_precompile process_transaction 16,536,787 16,540,180 (+0.02%) 10,802,631 10,805,472 (+0.03%) 349,160 349,160 (+0.00%) 31,707 31,845 (+0.44%) 5,192 5,192 (+0.00%)
fri_precompile run_tx_loop 16,546,509 16,549,942 (+0.02%) 10,809,757 10,812,638 (+0.03%) 349,160 349,160 (+0.00%) 31,707 31,845 (+0.44%) 5,841 5,841 (+0.00%)
fri_precompile state_commitment_update 163,237 163,215 (-0.01%) 125,637 125,615 (-0.02%) 2,350 2,350 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
fri_precompile system_init 50,176 50,176 (+0.00%) 50,176 50,176 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)

Per-precompile

Per-precompile per-execution ratios (head)
cycles = effective (raw + Blake×16 + BigInt×4 + Keccak×4)
precompile                count    med c/g    p95 c/g    p99 c/g    max c/g    med n/g    p95 n/g    p99 n/g    max n/g
------------------------------------------------------------------------------------------------------------------------
keccak                    42872      111.9      126.7      209.2     4295.9      478.8      478.8      626.8      681.4
modexp                     2501       63.3       63.5      187.0     2877.1      500.0      500.0      500.0     4814.0
bls12_g1add                  12      895.0      896.6      896.6      896.6        0.0        0.0        0.0        0.0
point_eval                   11      842.0      842.0      842.0      842.0     1262.1     1262.1     1262.1     1262.1
blake2f                       2      803.7      803.7      803.7      803.7        0.0        0.0        0.0        0.0
bls12_pairing_check           4      217.7      427.5      427.5      427.5        0.0        0.0        0.0        0.0
ecadd                       617      352.1      360.8      364.2      368.1      350.7      350.7      350.7      350.7
bls12_g1msm                  12      157.9      318.7      318.7      318.7        0.0        0.0        0.0        0.0
ecpairing                    40      169.1      186.3      186.3      186.3      398.2      428.6      428.6      428.6
sha256                       28       96.4      143.6      143.6      143.6      104.2      148.9      148.9      148.9
ecmul                       597      120.9      125.3      126.5      128.6      127.3      127.3      127.3      127.3
ecrecover                   713      119.7      121.9      123.2      123.6      174.0      174.0      174.0      174.0
p256_verify                  22      107.7      108.3      108.4      108.4      113.6      113.6      113.6      113.6
bls12_g2msm                   2       88.4       88.4       88.4       88.4        0.0        0.0        0.0        0.0
identity                    292       29.2       41.7       44.4       50.8       40.8       59.0       62.8       72.2
bls12_g2add                   2       46.0       46.0       46.0       46.0        0.0        0.0        0.0        0.0
ripemd160                     4        4.4        7.4        7.4        7.4        8.1       13.1       13.1       13.1

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