Skip to content

perf: improve process_attestation() for gloas#9664

Open
twoeths wants to merge 2 commits into
unstablefrom
te/improve_process_attestation_gloas
Open

perf: improve process_attestation() for gloas#9664
twoeths wants to merge 2 commits into
unstablefrom
te/improve_process_attestation_gloas

Conversation

@twoeths

@twoeths twoeths commented Jul 16, 2026

Copy link
Copy Markdown
Member

Motivation

  • I noticed this in glamsterdam-devnet-7 by panda tool, hope this fixes it
Screenshot 2026-07-16 at 10 51 40

Description

  • compute isAttestationSameSlotRootCache() once per block transition
  • remove the naive version, we should not need it

AI Assistance Disclosure

  • created with the help of Claude

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors getAttestationParticipationStatus to return both flags and isSameSlotAttestation, allowing the removal of the isAttestationSameSlot function and avoiding redundant state root lookups. Feedback suggests further optimizing this hot path by caching and reusing the isMatchingBlockRoot computation to avoid duplicate byteArrayEquals and isAttestationSameSlotRootCache calls.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/state-transition/src/block/processAttestationsAltair.ts
The gloas is_attestation_same_slot implementation was renamed to
isAttestationSameSlotRootCache; point the ethspecify search string at
the new name so the spec-refs check passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 71a4293 Previous: ea1ba2d Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 837.06 us/op 1.9443 ms/op 0.43
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 38.040 us/op 45.800 us/op 0.83
BLS verify - blst 614.47 us/op 769.01 us/op 0.80
BLS verifyMultipleSignatures 3 - blst 1.2543 ms/op 1.3775 ms/op 0.91
BLS verifyMultipleSignatures 8 - blst 1.9910 ms/op 2.2079 ms/op 0.90
BLS verifyMultipleSignatures 32 - blst 6.3272 ms/op 7.3129 ms/op 0.87
BLS verifyMultipleSignatures 64 - blst 12.155 ms/op 13.846 ms/op 0.88
BLS verifyMultipleSignatures 128 - blst 23.763 ms/op 26.387 ms/op 0.90
BLS deserializing 10000 signatures 595.88 ms/op 653.82 ms/op 0.91
BLS deserializing 100000 signatures 5.9967 s/op 6.4407 s/op 0.93
BLS verifyMultipleSignatures - same message - 3 - blst 661.04 us/op 812.29 us/op 0.81
BLS verifyMultipleSignatures - same message - 8 - blst 832.42 us/op 941.51 us/op 0.88
BLS verifyMultipleSignatures - same message - 32 - blst 1.4459 ms/op 1.5040 ms/op 0.96
BLS verifyMultipleSignatures - same message - 64 - blst 2.2113 ms/op 2.3712 ms/op 0.93
BLS verifyMultipleSignatures - same message - 128 - blst 3.8066 ms/op 4.0764 ms/op 0.93
BLS aggregatePubkeys 32 - blst 16.661 us/op 17.787 us/op 0.94
BLS aggregatePubkeys 128 - blst 59.315 us/op 63.452 us/op 0.93
getSlashingsAndExits - default max 43.067 us/op 56.158 us/op 0.77
getSlashingsAndExits - 2k 337.44 us/op 383.98 us/op 0.88
proposeBlockBody type=full, size=empty 570.89 us/op 677.34 us/op 0.84
isKnown best case - 1 super set check 158.00 ns/op 163.00 ns/op 0.97
isKnown normal case - 2 super set checks 158.00 ns/op 162.00 ns/op 0.98
isKnown worse case - 16 super set checks 165.00 ns/op 162.00 ns/op 1.02
validate api signedAggregateAndProof - struct 1.3911 ms/op 1.5232 ms/op 0.91
validate gossip signedAggregateAndProof - struct 1.3968 ms/op 1.5203 ms/op 0.92
batch validate gossip attestation - vc 640000 - chunk 32 100.16 us/op 109.17 us/op 0.92
batch validate gossip attestation - vc 640000 - chunk 64 87.823 us/op 94.840 us/op 0.93
batch validate gossip attestation - vc 640000 - chunk 128 82.147 us/op 89.233 us/op 0.92
batch validate gossip attestation - vc 640000 - chunk 256 79.093 us/op 88.745 us/op 0.89
bytes32 toHexString 267.00 ns/op 292.00 ns/op 0.91
bytes32 Buffer.toString(hex) 165.00 ns/op 163.00 ns/op 1.01
bytes32 Buffer.toString(hex) from Uint8Array 229.00 ns/op 237.00 ns/op 0.97
bytes32 Buffer.toString(hex) + 0x 167.00 ns/op 166.00 ns/op 1.01
Return object 10000 times 0.20080 ns/op 0.21220 ns/op 0.95
Throw Error 10000 times 3.1185 us/op 3.3829 us/op 0.92
toHex 95.799 ns/op 98.014 ns/op 0.98
Buffer.from 88.427 ns/op 89.752 ns/op 0.99
shared Buffer 54.240 ns/op 63.822 ns/op 0.85
fastMsgIdFn sha256 / 200 bytes 1.3800 us/op 1.4600 us/op 0.95
fastMsgIdFn h32 xxhash / 200 bytes 146.00 ns/op 150.00 ns/op 0.97
fastMsgIdFn h64 xxhash / 200 bytes 199.00 ns/op 209.00 ns/op 0.95
fastMsgIdFn sha256 / 1000 bytes 4.4240 us/op 4.7100 us/op 0.94
fastMsgIdFn h32 xxhash / 1000 bytes 230.00 ns/op 241.00 ns/op 0.95
fastMsgIdFn h64 xxhash / 1000 bytes 253.00 ns/op 256.00 ns/op 0.99
fastMsgIdFn sha256 / 10000 bytes 38.725 us/op 41.641 us/op 0.93
fastMsgIdFn h32 xxhash / 10000 bytes 1.2310 us/op 1.2780 us/op 0.96
fastMsgIdFn h64 xxhash / 10000 bytes 803.00 ns/op 841.00 ns/op 0.95
send data - 1000 256B messages 3.9957 ms/op 4.5833 ms/op 0.87
send data - 1000 512B messages 5.1168 ms/op 5.4926 ms/op 0.93
send data - 1000 1024B messages 5.5107 ms/op 5.7289 ms/op 0.96
send data - 1000 1200B messages 6.2075 ms/op 6.3928 ms/op 0.97
send data - 1000 2048B messages 11.294 ms/op 12.096 ms/op 0.93
send data - 1000 4096B messages 22.414 ms/op 53.073 ms/op 0.42
send data - 1000 16384B messages 216.99 ms/op 337.64 ms/op 0.64
send data - 1000 65536B messages 815.03 ms/op 1.1146 s/op 0.73
enrSubnets - fastDeserialize 64 bits 700.00 ns/op 751.00 ns/op 0.93
enrSubnets - ssz BitVector 64 bits 251.00 ns/op 267.00 ns/op 0.94
enrSubnets - fastDeserialize 4 bits 100.00 ns/op 101.00 ns/op 0.99
enrSubnets - ssz BitVector 4 bits 251.00 ns/op 268.00 ns/op 0.94
prioritizePeers score -10:0 att 32-0.1 sync 2-0 193.00 us/op 206.41 us/op 0.94
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 219.92 us/op 235.44 us/op 0.93
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 316.98 us/op 340.19 us/op 0.93
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 568.65 us/op 602.94 us/op 0.94
prioritizePeers score 0:0 att 64-1 sync 4-1 657.92 us/op 695.72 us/op 0.95
array of 16000 items push then shift 1.1729 us/op 1.2866 us/op 0.91
LinkedList of 16000 items push then shift 7.0850 ns/op 6.8730 ns/op 1.03
array of 16000 items push then pop 65.632 ns/op 66.622 ns/op 0.99
LinkedList of 16000 items push then pop 5.6960 ns/op 5.9440 ns/op 0.96
array of 24000 items push then shift 1.7388 us/op 1.9030 us/op 0.91
LinkedList of 24000 items push then shift 7.1660 ns/op 6.6690 ns/op 1.07
array of 24000 items push then pop 94.390 ns/op 94.775 ns/op 1.00
LinkedList of 24000 items push then pop 5.6680 ns/op 5.9750 ns/op 0.95
intersect bitArray bitLen 8 4.4680 ns/op 4.6960 ns/op 0.95
intersect array and set length 8 27.533 ns/op 29.546 ns/op 0.93
intersect bitArray bitLen 128 22.548 ns/op 23.934 ns/op 0.94
intersect array and set length 128 463.27 ns/op 495.62 ns/op 0.93
bitArray.getTrueBitIndexes() bitLen 128 1.0100 us/op 971.00 ns/op 1.04
bitArray.getTrueBitIndexes() bitLen 248 1.6590 us/op 1.7240 us/op 0.96
bitArray.getTrueBitIndexes() bitLen 512 3.3850 us/op 3.5660 us/op 0.95
Full columns - reconstruct all 6 blobs 123.47 us/op 112.06 us/op 1.10
Full columns - reconstruct half of the blobs out of 6 88.248 us/op 62.559 us/op 1.41
Full columns - reconstruct single blob out of 6 27.677 us/op 36.690 us/op 0.75
Half columns - reconstruct all 6 blobs 367.46 ms/op 392.39 ms/op 0.94
Half columns - reconstruct half of the blobs out of 6 184.31 ms/op 194.85 ms/op 0.95
Half columns - reconstruct single blob out of 6 65.608 ms/op 68.553 ms/op 0.96
Set add up to 64 items then delete first 1.5175 us/op 1.6743 us/op 0.91
OrderedSet add up to 64 items then delete first 2.3545 us/op 2.5369 us/op 0.93
Set add up to 64 items then delete last 1.7449 us/op 1.9367 us/op 0.90
OrderedSet add up to 64 items then delete last 2.5937 us/op 2.8008 us/op 0.93
Set add up to 64 items then delete middle 1.7467 us/op 1.9200 us/op 0.91
OrderedSet add up to 64 items then delete middle 4.0088 us/op 4.2991 us/op 0.93
Set add up to 128 items then delete first 3.4866 us/op 3.8459 us/op 0.91
OrderedSet add up to 128 items then delete first 5.3249 us/op 5.7834 us/op 0.92
Set add up to 128 items then delete last 3.3690 us/op 3.7476 us/op 0.90
OrderedSet add up to 128 items then delete last 4.9727 us/op 5.4552 us/op 0.91
Set add up to 128 items then delete middle 3.3559 us/op 3.6696 us/op 0.91
OrderedSet add up to 128 items then delete middle 10.508 us/op 11.253 us/op 0.93
Set add up to 256 items then delete first 6.8722 us/op 7.5473 us/op 0.91
OrderedSet add up to 256 items then delete first 11.179 us/op 11.925 us/op 0.94
Set add up to 256 items then delete last 6.6893 us/op 7.4801 us/op 0.89
OrderedSet add up to 256 items then delete last 10.676 us/op 11.336 us/op 0.94
Set add up to 256 items then delete middle 6.6186 us/op 7.2424 us/op 0.91
OrderedSet add up to 256 items then delete middle 33.574 us/op 34.757 us/op 0.97
runFastConfirmationRules vc:100000 bc:96 eq:0 4.1897 ms/op 4.9622 ms/op 0.84
runFastConfirmationRules vc:600000 bc:96 eq:0 33.580 ms/op 34.829 ms/op 0.96
runFastConfirmationRules vc:1000000 bc:96 eq:0 55.609 ms/op 57.172 ms/op 0.97
runFastConfirmationRules vc:600000 bc:320 eq:0 32.739 ms/op 34.692 ms/op 0.94
runFastConfirmationRules vc:100000 bc:96 eq:1000 1.0190 s/op 1.0897 s/op 0.94
pass gossip attestations to forkchoice per slot 2.4122 ms/op 2.5593 ms/op 0.94
forkChoice updateHead vc 100000 bc 64 eq 0 381.27 us/op 447.85 us/op 0.85
forkChoice updateHead vc 600000 bc 64 eq 0 2.2872 ms/op 2.6317 ms/op 0.87
forkChoice updateHead vc 1000000 bc 64 eq 0 3.8498 ms/op 4.3943 ms/op 0.88
forkChoice updateHead vc 600000 bc 320 eq 0 2.2990 ms/op 2.6803 ms/op 0.86
forkChoice updateHead vc 600000 bc 1200 eq 0 2.3426 ms/op 2.7279 ms/op 0.86
forkChoice updateHead vc 600000 bc 7200 eq 0 2.9783 ms/op 3.0089 ms/op 0.99
forkChoice updateHead vc 600000 bc 64 eq 1000 2.2629 ms/op 2.7078 ms/op 0.84
forkChoice updateHead vc 600000 bc 64 eq 10000 2.3485 ms/op 2.7550 ms/op 0.85
forkChoice updateHead vc 600000 bc 64 eq 300000 6.0244 ms/op 6.6388 ms/op 0.91
computeDeltas 1400000 validators 0% inactive 11.272 ms/op 13.290 ms/op 0.85
computeDeltas 1400000 validators 10% inactive 10.608 ms/op 12.482 ms/op 0.85
computeDeltas 1400000 validators 20% inactive 10.091 ms/op 11.619 ms/op 0.87
computeDeltas 1400000 validators 50% inactive 8.2028 ms/op 9.3103 ms/op 0.88
computeDeltas 2100000 validators 0% inactive 16.782 ms/op 19.561 ms/op 0.86
computeDeltas 2100000 validators 10% inactive 15.957 ms/op 17.988 ms/op 0.89
computeDeltas 2100000 validators 20% inactive 15.050 ms/op 17.535 ms/op 0.86
computeDeltas 2100000 validators 50% inactive 9.9483 ms/op 13.680 ms/op 0.73
altair processAttestation - 250000 vs - 7PWei normalcase 2.3279 ms/op 1.7050 ms/op 1.37
altair processAttestation - 250000 vs - 7PWei worstcase 2.9183 ms/op 2.4994 ms/op 1.17
altair processAttestation - setStatus - 1/6 committees join 91.641 us/op 101.16 us/op 0.91
altair processAttestation - setStatus - 1/3 committees join 191.50 us/op 202.16 us/op 0.95
altair processAttestation - setStatus - 1/2 committees join 276.06 us/op 281.06 us/op 0.98
altair processAttestation - setStatus - 2/3 committees join 355.68 us/op 370.19 us/op 0.96
altair processAttestation - setStatus - 4/5 committees join 495.91 us/op 512.44 us/op 0.97
altair processAttestation - setStatus - 100% committees join 698.07 us/op 601.54 us/op 1.16
altair processBlock - 250000 vs - 7PWei normalcase 6.0995 ms/op 2.8397 ms/op 2.15
altair processBlock - 250000 vs - 7PWei normalcase hashState 19.146 ms/op 11.314 ms/op 1.69
altair processBlock - 250000 vs - 7PWei worstcase 24.174 ms/op 18.742 ms/op 1.29
altair processBlock - 250000 vs - 7PWei worstcase hashState 53.016 ms/op 38.269 ms/op 1.39
phase0 processBlock - 250000 vs - 7PWei normalcase 2.0146 ms/op 1.2984 ms/op 1.55
phase0 processBlock - 250000 vs - 7PWei worstcase 20.801 ms/op 17.332 ms/op 1.20
altair processEth1Data - 250000 vs - 7PWei normalcase 302.97 us/op 294.38 us/op 1.03
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:16 5.1300 us/op 3.6070 us/op 1.42
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:220 23.021 us/op 23.045 us/op 1.00
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:43 6.8630 us/op 6.1350 us/op 1.12
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:19 4.8920 us/op 3.6150 us/op 1.35
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1021 99.543 us/op 98.315 us/op 1.01
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11778 1.3793 ms/op 1.3511 ms/op 1.02
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.8466 ms/op 1.8043 ms/op 1.02
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.9981 ms/op 1.7746 ms/op 1.13
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.6498 ms/op 3.5217 ms/op 1.32
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.1086 ms/op 2.0242 ms/op 1.04
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 5.3200 ms/op 3.8673 ms/op 1.38
Tree 40 250000 create 351.22 ms/op 308.72 ms/op 1.14
Tree 40 250000 get(125000) 90.558 ns/op 99.066 ns/op 0.91
Tree 40 250000 set(125000) 981.93 ns/op 1.0680 us/op 0.92
Tree 40 250000 toArray() 17.682 ms/op 9.4700 ms/op 1.87
Tree 40 250000 iterate all - toArray() + loop 17.714 ms/op 10.071 ms/op 1.76
Tree 40 250000 iterate all - get(i) 40.364 ms/op 33.897 ms/op 1.19
Array 250000 create 2.2867 ms/op 2.0171 ms/op 1.13
Array 250000 clone - spread 695.31 us/op 648.03 us/op 1.07
Array 250000 get(125000) 0.28600 ns/op 0.28800 ns/op 0.99
Array 250000 set(125000) 0.28700 ns/op 0.30100 ns/op 0.95
Array 250000 iterate all - loop 55.738 us/op 55.464 us/op 1.00
phase0 afterProcessEpoch - 250000 vs - 7PWei 38.760 ms/op 37.797 ms/op 1.03
Array.fill - length 1000000 2.3961 ms/op 1.8990 ms/op 1.26
Array push - length 1000000 10.263 ms/op 7.1925 ms/op 1.43
Array.get 0.20411 ns/op 0.20054 ns/op 1.02
Uint8Array.get 0.24020 ns/op 0.25027 ns/op 0.96
phase0 beforeProcessEpoch - 250000 vs - 7PWei 19.665 ms/op 13.033 ms/op 1.51
altair processEpoch - mainnet_e81889 291.60 ms/op 245.85 ms/op 1.19
mainnet_e81889 - altair beforeProcessEpoch 37.657 ms/op 14.053 ms/op 2.68
mainnet_e81889 - altair processJustificationAndFinalization 6.8960 us/op 4.9080 us/op 1.41
mainnet_e81889 - altair processInactivityUpdates 7.2601 ms/op 3.5498 ms/op 2.05
mainnet_e81889 - altair processRewardsAndPenalties 20.877 ms/op 17.134 ms/op 1.22
mainnet_e81889 - altair processRegistryUpdates 534.00 ns/op 512.00 ns/op 1.04
mainnet_e81889 - altair processSlashings 135.00 ns/op 134.00 ns/op 1.01
mainnet_e81889 - altair processEth1DataReset 133.00 ns/op 124.00 ns/op 1.07
mainnet_e81889 - altair processEffectiveBalanceUpdates 6.8266 ms/op 1.7247 ms/op 3.96
mainnet_e81889 - altair processSlashingsReset 693.00 ns/op 691.00 ns/op 1.00
mainnet_e81889 - altair processRandaoMixesReset 1.3960 us/op 1.0580 us/op 1.32
mainnet_e81889 - altair processHistoricalRootsUpdate 133.00 ns/op 126.00 ns/op 1.06
mainnet_e81889 - altair processParticipationFlagUpdates 430.00 ns/op 508.00 ns/op 0.85
mainnet_e81889 - altair processSyncCommitteeUpdates 107.00 ns/op 103.00 ns/op 1.04
mainnet_e81889 - altair afterProcessEpoch 40.641 ms/op 40.252 ms/op 1.01
capella processEpoch - mainnet_e217614 819.11 ms/op 835.54 ms/op 0.98
mainnet_e217614 - capella beforeProcessEpoch 68.594 ms/op 58.158 ms/op 1.18
mainnet_e217614 - capella processJustificationAndFinalization 6.0670 us/op 5.5080 us/op 1.10
mainnet_e217614 - capella processInactivityUpdates 15.588 ms/op 13.590 ms/op 1.15
mainnet_e217614 - capella processRewardsAndPenalties 96.255 ms/op 94.604 ms/op 1.02
mainnet_e217614 - capella processRegistryUpdates 4.3320 us/op 4.4830 us/op 0.97
mainnet_e217614 - capella processSlashings 128.00 ns/op 133.00 ns/op 0.96
mainnet_e217614 - capella processEth1DataReset 124.00 ns/op 128.00 ns/op 0.97
mainnet_e217614 - capella processEffectiveBalanceUpdates 21.310 ms/op 7.0944 ms/op 3.00
mainnet_e217614 - capella processSlashingsReset 674.00 ns/op 689.00 ns/op 0.98
mainnet_e217614 - capella processRandaoMixesReset 1.4300 us/op 1.1910 us/op 1.20
mainnet_e217614 - capella processHistoricalRootsUpdate 130.00 ns/op 128.00 ns/op 1.02
mainnet_e217614 - capella processParticipationFlagUpdates 431.00 ns/op 432.00 ns/op 1.00
mainnet_e217614 - capella afterProcessEpoch 107.93 ms/op 111.73 ms/op 0.97
phase0 processEpoch - mainnet_e58758 328.03 ms/op 281.80 ms/op 1.16
mainnet_e58758 - phase0 beforeProcessEpoch 70.024 ms/op 54.915 ms/op 1.28
mainnet_e58758 - phase0 processJustificationAndFinalization 6.2550 us/op 5.5380 us/op 1.13
mainnet_e58758 - phase0 processRewardsAndPenalties 15.644 ms/op 15.622 ms/op 1.00
mainnet_e58758 - phase0 processRegistryUpdates 2.1110 us/op 2.2700 us/op 0.93
mainnet_e58758 - phase0 processSlashings 126.00 ns/op 136.00 ns/op 0.93
mainnet_e58758 - phase0 processEth1DataReset 120.00 ns/op 125.00 ns/op 0.96
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 918.73 us/op 1.0019 ms/op 0.92
mainnet_e58758 - phase0 processSlashingsReset 844.00 ns/op 884.00 ns/op 0.95
mainnet_e58758 - phase0 processRandaoMixesReset 1.0820 us/op 1.1550 us/op 0.94
mainnet_e58758 - phase0 processHistoricalRootsUpdate 140.00 ns/op 129.00 ns/op 1.09
mainnet_e58758 - phase0 processParticipationRecordUpdates 1.1280 us/op 1.1870 us/op 0.95
mainnet_e58758 - phase0 afterProcessEpoch 33.441 ms/op 34.342 ms/op 0.97
phase0 processEffectiveBalanceUpdates - 250000 normalcase 960.78 us/op 1.0179 ms/op 0.94
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5301 ms/op 1.6334 ms/op 0.94
altair processInactivityUpdates - 250000 normalcase 10.094 ms/op 10.675 ms/op 0.95
altair processInactivityUpdates - 250000 worstcase 12.792 ms/op 11.357 ms/op 1.13
phase0 processRegistryUpdates - 250000 normalcase 3.1680 us/op 2.5520 us/op 1.24
phase0 processRegistryUpdates - 250000 badcase_full_deposits 131.00 us/op 147.03 us/op 0.89
phase0 processRegistryUpdates - 250000 worstcase 0.5 78.281 ms/op 62.244 ms/op 1.26
altair processRewardsAndPenalties - 250000 normalcase 16.920 ms/op 13.869 ms/op 1.22
altair processRewardsAndPenalties - 250000 worstcase 15.899 ms/op 15.337 ms/op 1.04
phase0 getAttestationDeltas - 250000 normalcase 5.1115 ms/op 5.4385 ms/op 0.94
phase0 getAttestationDeltas - 250000 worstcase 5.1222 ms/op 5.9912 ms/op 0.85
phase0 processSlashings - 250000 worstcase 60.127 us/op 62.355 us/op 0.96
altair processSyncCommitteeUpdates - 250000 10.270 ms/op 10.387 ms/op 0.99
BeaconState.hashTreeRoot - No change 174.00 ns/op 172.00 ns/op 1.01
BeaconState.hashTreeRoot - 1 full validator 82.279 us/op 72.347 us/op 1.14
BeaconState.hashTreeRoot - 32 full validator 831.12 us/op 850.03 us/op 0.98
BeaconState.hashTreeRoot - 512 full validator 8.1097 ms/op 7.6666 ms/op 1.06
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 102.28 us/op 87.817 us/op 1.16
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.4207 ms/op 1.1324 ms/op 1.25
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 18.492 ms/op 16.611 ms/op 1.11
BeaconState.hashTreeRoot - 1 balances 80.281 us/op 86.681 us/op 0.93
BeaconState.hashTreeRoot - 32 balances 715.41 us/op 805.91 us/op 0.89
BeaconState.hashTreeRoot - 512 balances 6.4104 ms/op 5.9733 ms/op 1.07
BeaconState.hashTreeRoot - 250000 balances 138.84 ms/op 108.51 ms/op 1.28
aggregationBits - 2048 els - zipIndexesInBitList 19.625 us/op 19.879 us/op 0.99
regular array get 100000 times 22.239 us/op 23.404 us/op 0.95
wrappedArray get 100000 times 22.259 us/op 23.335 us/op 0.95
arrayWithProxy get 100000 times 14.325 ms/op 10.712 ms/op 1.34
ssz.Root.equals 20.601 ns/op 21.686 ns/op 0.95
byteArrayEquals 20.425 ns/op 21.530 ns/op 0.95
Buffer.compare 8.4100 ns/op 8.9580 ns/op 0.94
processSlot - 1 slots 10.130 us/op 7.9750 us/op 1.27
processSlot - 32 slots 2.0266 ms/op 1.8668 ms/op 1.09
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 4.8276 ms/op 3.9693 ms/op 1.22
getCommitteeAssignments - req 1 vs - 250000 vc 1.6006 ms/op 1.6799 ms/op 0.95
getCommitteeAssignments - req 100 vs - 250000 vc 3.2859 ms/op 3.4313 ms/op 0.96
getCommitteeAssignments - req 1000 vs - 250000 vc 3.5249 ms/op 3.6797 ms/op 0.96
findModifiedValidators - 10000 modified validators 724.45 ms/op 744.57 ms/op 0.97
findModifiedValidators - 1000 modified validators 510.85 ms/op 646.44 ms/op 0.79
findModifiedValidators - 100 modified validators 291.98 ms/op 299.67 ms/op 0.97
findModifiedValidators - 10 modified validators 145.06 ms/op 245.77 ms/op 0.59
findModifiedValidators - 1 modified validators 207.58 ms/op 212.26 ms/op 0.98
findModifiedValidators - no difference 165.09 ms/op 200.97 ms/op 0.82
migrate state 1500000 validators, 3400 modified, 2000 new 3.0582 s/op 2.6453 s/op 1.16
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 3.5500 ns/op 3.8000 ns/op 0.93
state getBlockRootAtSlot - 250000 vs - 7PWei 379.96 ns/op 359.27 ns/op 1.06
computeProposerIndex 100000 validators 1.2425 ms/op 1.3134 ms/op 0.95
getNextSyncCommitteeIndices 1000 validators 2.7057 ms/op 2.8707 ms/op 0.94
getNextSyncCommitteeIndices 10000 validators 23.656 ms/op 25.065 ms/op 0.94
getNextSyncCommitteeIndices 100000 validators 79.495 ms/op 82.997 ms/op 0.96
computeProposers - vc 250000 520.82 us/op 560.33 us/op 0.93
computeEpochShuffling - vc 250000 37.805 ms/op 41.287 ms/op 0.92
getNextSyncCommittee - vc 250000 8.9985 ms/op 9.5593 ms/op 0.94
nodejs block root to RootHex using toHex 100.45 ns/op 102.74 ns/op 0.98
nodejs block root to RootHex using toRootHex 58.305 ns/op 65.219 ns/op 0.89
nodejs fromHex(blob) 717.63 us/op 745.88 us/op 0.96
nodejs fromHexInto(blob) 582.69 us/op 661.40 us/op 0.88
nodejs block root to RootHex using the deprecated toHexString 434.27 ns/op 540.41 ns/op 0.80
nodejs byteArrayEquals 32 bytes (block root) 24.206 ns/op 25.925 ns/op 0.93
nodejs byteArrayEquals 48 bytes (pubkey) 35.086 ns/op 37.255 ns/op 0.94
nodejs byteArrayEquals 96 bytes (signature) 32.314 ns/op 37.709 ns/op 0.86
nodejs byteArrayEquals 1024 bytes 39.185 ns/op 47.529 ns/op 0.82
nodejs byteArrayEquals 131072 bytes (blob) 1.6505 us/op 1.7672 us/op 0.93
browser block root to RootHex using toHex 133.97 ns/op 145.83 ns/op 0.92
browser block root to RootHex using toRootHex 120.02 ns/op 131.28 ns/op 0.91
browser fromHex(blob) 1.4456 ms/op 1.6866 ms/op 0.86
browser fromHexInto(blob) 586.13 us/op 656.61 us/op 0.89
browser block root to RootHex using the deprecated toHexString 434.31 ns/op 367.07 ns/op 1.18
browser byteArrayEquals 32 bytes (block root) 26.293 ns/op 27.928 ns/op 0.94
browser byteArrayEquals 48 bytes (pubkey) 37.017 ns/op 39.410 ns/op 0.94
browser byteArrayEquals 96 bytes (signature) 69.533 ns/op 73.994 ns/op 0.94
browser byteArrayEquals 1024 bytes 705.30 ns/op 756.61 ns/op 0.93
browser byteArrayEquals 131072 bytes (blob) 89.153 us/op 94.782 us/op 0.94

by benchmarkbot/action

@lodekeeper-z lodekeeper-z moved this to Todo in Lodestar PM Jul 16, 2026
@twoeths
twoeths marked this pull request as ready for review July 16, 2026 06:31
@twoeths
twoeths requested a review from a team as a code owner July 16, 2026 06:31
@twoeths
twoeths requested review from ensi321 and wemeetagain July 16, 2026 06:32
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.50%. Comparing base (ea1ba2d) to head (a56aba3).

Additional details and impacted files
@@            Coverage Diff            @@
##           unstable    #9664   +/-   ##
=========================================
  Coverage     52.49%   52.50%           
=========================================
  Files           848      848           
  Lines         60485    60480    -5     
  Branches       4466     4466           
=========================================
- Hits          31754    31753    -1     
+ Misses        28670    28666    -4     
  Partials         61       61           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a56aba338c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

rootCache: RootCache,
executionPayloadAvailability: BitArray | null
): number {
): {flags: number; isSameSlotAttestation: boolean} {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the numeric participation return value

This function is exported from the package root (src/index.ts), so changing it from returning the participation bitfield to returning an object is a breaking runtime change for consumers that do const flags = getAttestationParticipationStatus(...) and then apply bitwise checks; in JavaScript, flags & TIMELY_SOURCE on this object evaluates as 0, silently dropping all rewards/flags. Please keep the public function returning the numeric flags and add a separate helper/option for the same-slot boolean.

Useful? React with 👍 / 👎.

/**
* Use cached block roots to avoid repeated state root lookups while matching the spec's is_attestation_same_slot behavior.
*/
export function isAttestationSameSlotRootCache(rootCache: RootCache, data: AttestationData): boolean {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the exported same-slot helper available

Renaming the exported isAttestationSameSlot helper removes it from @lodestar/state-transition because util/index.ts re-exports gloas.ts and the root index re-exports util; downstream users importing the spec-shaped helper will fail at module/type resolution even though this perf change only needs an additional RootCache-based variant internally. Please retain a compatibility wrapper with the original name/signature while using the cached helper in the hot path.

Useful? React with 👍 / 👎.

@ensi321 ensi321 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good. no comment to add

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.

3 participants