Skip to content

fix: harden range sync hashBlocks() - #9686

Merged
twoeths merged 2 commits into
unstablefrom
te/fix_hash_blocks
Aug 11, 2026
Merged

fix: harden range sync hashBlocks()#9686
twoeths merged 2 commits into
unstablefrom
te/fix_hash_blocks

Conversation

@twoeths

@twoeths twoeths commented Jul 21, 2026

Copy link
Copy Markdown
Member

Motivation

  • range sync did not include envelopes as part of its hashBlocks() function, to create an id of downloaded blocks+payloads

Description

  • include blocks + payload envelopes + signatures, allocate a Buffer and hash it
  • cache ExecutionPayloadEnvelope roots for cheaper attempt hashing

part of #9667

AI Assistance Disclosure

  • created with the help of Claude/Codex

@twoeths
twoeths requested a review from a team as a code owner July 21, 2026 08:41

@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 updates the hashBlocks utility to uniquely identify a batch attempt by hashing both blocks and payload envelopes (including their signatures) into a single fixed-size buffer using SHA-256, and adds corresponding unit tests. The review feedback suggests two key improvements: replacing Buffer.allocUnsafe with Buffer.alloc to guarantee deterministic hashing and prevent potential uninitialized memory leaks, and passing ChainForkConfig to dynamically resolve fork-specific SSZ types instead of hardcoding ssz.gloas.ExecutionPayloadEnvelope.

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/beacon-node/src/sync/range/utils/hashBlocks.ts
Comment thread packages/beacon-node/src/sync/range/utils/hashBlocks.ts
Comment thread packages/beacon-node/src/sync/range/batch.ts Outdated
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

鈿狅笍 Performance Alert 鈿狅笍

Possible performance regression was detected for some benchmarks.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold.

Benchmark suite Current: 78015b2 Previous: d9065a2 Ratio
proposeBlockBody type=full, size=empty 3.2120 ms/op 712.89 us/op 4.51
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 4.3041 ms/op 1.2642 ms/op 3.40
Full benchmark results
Benchmark suite Current: 78015b2 Previous: d9065a2 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.1617 ms/op 1.1816 ms/op 0.98
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 39.900 us/op 40.660 us/op 0.98
BLS verify - blst 730.70 us/op 753.88 us/op 0.97
BLS verifyMultipleSignatures 3 - blst 1.3788 ms/op 1.3632 ms/op 1.01
BLS verifyMultipleSignatures 8 - blst 2.1846 ms/op 2.1700 ms/op 1.01
BLS verifyMultipleSignatures 32 - blst 6.9280 ms/op 6.9536 ms/op 1.00
BLS verifyMultipleSignatures 64 - blst 13.786 ms/op 13.400 ms/op 1.03
BLS verifyMultipleSignatures 128 - blst 25.986 ms/op 26.103 ms/op 1.00
BLS deserializing 10000 signatures 651.11 ms/op 632.22 ms/op 1.03
BLS deserializing 100000 signatures 6.6152 s/op 6.3421 s/op 1.04
BLS verifyMultipleSignatures - same message - 3 - blst 822.18 us/op 813.09 us/op 1.01
BLS verifyMultipleSignatures - same message - 8 - blst 889.57 us/op 927.28 us/op 0.96
BLS verifyMultipleSignatures - same message - 32 - blst 1.6535 ms/op 1.5714 ms/op 1.05
BLS verifyMultipleSignatures - same message - 64 - blst 2.5903 ms/op 2.3714 ms/op 1.09
BLS verifyMultipleSignatures - same message - 128 - blst 4.1968 ms/op 4.0171 ms/op 1.04
BLS aggregatePubkeys 32 - blst 18.144 us/op 17.582 us/op 1.03
BLS aggregatePubkeys 128 - blst 64.501 us/op 63.000 us/op 1.02
getSlashingsAndExits - default max 48.926 us/op 53.064 us/op 0.92
getSlashingsAndExits - 2k 467.21 us/op 331.99 us/op 1.41
proposeBlockBody type=full, size=empty 3.2120 ms/op 712.89 us/op 4.51
isKnown best case - 1 super set check 199.00 ns/op 167.00 ns/op 1.19
isKnown normal case - 2 super set checks 170.00 ns/op 162.00 ns/op 1.05
isKnown worse case - 16 super set checks 166.00 ns/op 163.00 ns/op 1.02
validate api signedAggregateAndProof - struct 1.6068 ms/op 1.5082 ms/op 1.07
validate gossip signedAggregateAndProof - struct 1.5989 ms/op 1.5102 ms/op 1.06
batch validate gossip attestation - vc 640000 - chunk 32 117.76 us/op 106.62 us/op 1.10
batch validate gossip attestation - vc 640000 - chunk 64 107.90 us/op 92.681 us/op 1.16
batch validate gossip attestation - vc 640000 - chunk 128 98.390 us/op 89.420 us/op 1.10
batch validate gossip attestation - vc 640000 - chunk 256 101.64 us/op 84.721 us/op 1.20
bytes32 toHexString 296.00 ns/op 289.00 ns/op 1.02
bytes32 Buffer.toString(hex) 172.00 ns/op 174.00 ns/op 0.99
bytes32 Buffer.toString(hex) from Uint8Array 248.00 ns/op 244.00 ns/op 1.02
bytes32 Buffer.toString(hex) + 0x 168.00 ns/op 172.00 ns/op 0.98
Return object 10000 times 0.22120 ns/op 0.21190 ns/op 1.04
Throw Error 10000 times 3.6270 us/op 3.3427 us/op 1.09
toHex 102.02 ns/op 107.85 ns/op 0.95
Buffer.from 89.956 ns/op 91.670 ns/op 0.98
shared Buffer 63.536 ns/op 65.606 ns/op 0.97
fastMsgIdFn sha256 / 200 bytes 1.5820 us/op 1.4700 us/op 1.08
fastMsgIdFn h32 xxhash / 200 bytes 162.00 ns/op 156.00 ns/op 1.04
fastMsgIdFn h64 xxhash / 200 bytes 205.00 ns/op 199.00 ns/op 1.03
fastMsgIdFn sha256 / 1000 bytes 4.9430 us/op 4.7200 us/op 1.05
fastMsgIdFn h32 xxhash / 1000 bytes 254.00 ns/op 243.00 ns/op 1.05
fastMsgIdFn h64 xxhash / 1000 bytes 257.00 ns/op 253.00 ns/op 1.02
fastMsgIdFn sha256 / 10000 bytes 43.186 us/op 41.856 us/op 1.03
fastMsgIdFn h32 xxhash / 10000 bytes 1.2990 us/op 1.2690 us/op 1.02
fastMsgIdFn h64 xxhash / 10000 bytes 842.00 ns/op 818.00 ns/op 1.03
send data - 1000 256B messages 5.9323 ms/op 4.0620 ms/op 1.46
send data - 1000 512B messages 6.5613 ms/op 4.9401 ms/op 1.33
send data - 1000 1024B messages 6.5400 ms/op 5.2797 ms/op 1.24
send data - 1000 1200B messages 7.4572 ms/op 6.0532 ms/op 1.23
send data - 1000 2048B messages 10.533 ms/op 8.3158 ms/op 1.27
send data - 1000 4096B messages 94.907 ms/op 50.031 ms/op 1.90
send data - 1000 16384B messages 445.08 ms/op 329.07 ms/op 1.35
send data - 1000 65536B messages 2.0314 s/op 1.3266 s/op 1.53
enrSubnets - fastDeserialize 64 bits 784.00 ns/op 764.00 ns/op 1.03
enrSubnets - ssz BitVector 64 bits 272.00 ns/op 258.00 ns/op 1.05
enrSubnets - fastDeserialize 4 bits 105.00 ns/op 102.00 ns/op 1.03
enrSubnets - ssz BitVector 4 bits 272.00 ns/op 261.00 ns/op 1.04
prioritizePeers score -10:0 att 32-0.1 sync 2-0 223.56 us/op 204.74 us/op 1.09
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 249.09 us/op 230.65 us/op 1.08
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 359.15 us/op 332.17 us/op 1.08
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 637.73 us/op 587.67 us/op 1.09
prioritizePeers score 0:0 att 64-1 sync 4-1 790.17 us/op 688.27 us/op 1.15
array of 16000 items push then shift 1.3933 us/op 1.2814 us/op 1.09
LinkedList of 16000 items push then shift 8.2830 ns/op 6.6940 ns/op 1.24
array of 16000 items push then pop 78.099 ns/op 62.640 ns/op 1.25
LinkedList of 16000 items push then pop 6.7350 ns/op 5.9580 ns/op 1.13
array of 24000 items push then shift 1.9889 us/op 1.8997 us/op 1.05
LinkedList of 24000 items push then shift 8.6270 ns/op 6.3200 ns/op 1.37
array of 24000 items push then pop 108.16 ns/op 86.000 ns/op 1.26
LinkedList of 24000 items push then pop 7.0230 ns/op 5.9740 ns/op 1.18
intersect bitArray bitLen 8 4.0460 ns/op 3.8450 ns/op 1.05
intersect array and set length 8 31.333 ns/op 29.856 ns/op 1.05
intersect bitArray bitLen 128 24.396 ns/op 23.399 ns/op 1.04
intersect array and set length 128 528.06 ns/op 504.85 ns/op 1.05
bitArray.getTrueBitIndexes() bitLen 128 986.00 ns/op 899.00 ns/op 1.10
bitArray.getTrueBitIndexes() bitLen 248 1.7750 us/op 1.6140 us/op 1.10
bitArray.getTrueBitIndexes() bitLen 512 3.9190 us/op 3.4120 us/op 1.15
Full columns - reconstruct all 6 blobs 138.94 us/op 118.55 us/op 1.17
Full columns - reconstruct half of the blobs out of 6 75.049 us/op 96.816 us/op 0.78
Full columns - reconstruct single blob out of 6 32.107 us/op 34.891 us/op 0.92
Half columns - reconstruct all 6 blobs 415.66 ms/op 381.20 ms/op 1.09
Half columns - reconstruct half of the blobs out of 6 209.99 ms/op 192.78 ms/op 1.09
Half columns - reconstruct single blob out of 6 74.403 ms/op 67.073 ms/op 1.11
Set add up to 64 items then delete first 1.7049 us/op 1.6884 us/op 1.01
OrderedSet add up to 64 items then delete first 2.6352 us/op 2.5372 us/op 1.04
Set add up to 64 items then delete last 1.9249 us/op 1.8966 us/op 1.01
OrderedSet add up to 64 items then delete last 2.9372 us/op 2.7985 us/op 1.05
Set add up to 64 items then delete middle 1.9429 us/op 1.9035 us/op 1.02
OrderedSet add up to 64 items then delete middle 4.4270 us/op 4.2280 us/op 1.05
Set add up to 128 items then delete first 3.8658 us/op 3.7725 us/op 1.02
OrderedSet add up to 128 items then delete first 6.0183 us/op 5.7349 us/op 1.05
Set add up to 128 items then delete last 3.6057 us/op 3.5948 us/op 1.00
OrderedSet add up to 128 items then delete last 5.6456 us/op 5.3932 us/op 1.05
Set add up to 128 items then delete middle 3.6845 us/op 3.5704 us/op 1.03
OrderedSet add up to 128 items then delete middle 11.691 us/op 11.220 us/op 1.04
Set add up to 256 items then delete first 8.0849 us/op 7.6188 us/op 1.06
OrderedSet add up to 256 items then delete first 13.103 us/op 11.809 us/op 1.11
Set add up to 256 items then delete last 7.8891 us/op 7.2389 us/op 1.09
OrderedSet add up to 256 items then delete last 12.325 us/op 11.086 us/op 1.11
Set add up to 256 items then delete middle 7.2092 us/op 7.1829 us/op 1.00
OrderedSet add up to 256 items then delete middle 36.644 us/op 34.523 us/op 1.06
runFastConfirmationRules vc:100000 bc:96 eq:0 4.8269 ms/op 4.6577 ms/op 1.04
runFastConfirmationRules vc:600000 bc:96 eq:0 37.155 ms/op 34.794 ms/op 1.07
runFastConfirmationRules vc:1000000 bc:96 eq:0 61.122 ms/op 58.511 ms/op 1.04
runFastConfirmationRules vc:600000 bc:320 eq:0 36.315 ms/op 34.112 ms/op 1.06
runFastConfirmationRules vc:100000 bc:96 eq:1000 1.1400 s/op 1.0845 s/op 1.05
pass gossip attestations to forkchoice per slot 2.6173 ms/op 2.6195 ms/op 1.00
forkChoice updateHead vc 100000 bc 64 eq 0 404.60 us/op 450.32 us/op 0.90
forkChoice updateHead vc 600000 bc 64 eq 0 2.4135 ms/op 2.6304 ms/op 0.92
forkChoice updateHead vc 1000000 bc 64 eq 0 4.2179 ms/op 4.4507 ms/op 0.95
forkChoice updateHead vc 600000 bc 320 eq 0 2.5202 ms/op 2.6572 ms/op 0.95
forkChoice updateHead vc 600000 bc 1200 eq 0 2.5406 ms/op 2.6934 ms/op 0.94
forkChoice updateHead vc 600000 bc 7200 eq 0 3.0075 ms/op 2.9981 ms/op 1.00
forkChoice updateHead vc 600000 bc 64 eq 1000 2.4818 ms/op 2.6644 ms/op 0.93
forkChoice updateHead vc 600000 bc 64 eq 10000 2.5754 ms/op 2.7489 ms/op 0.94
forkChoice updateHead vc 600000 bc 64 eq 300000 6.7576 ms/op 6.5868 ms/op 1.03
computeDeltas 1400000 validators 0% inactive 12.337 ms/op 12.369 ms/op 1.00
computeDeltas 1400000 validators 10% inactive 11.749 ms/op 11.688 ms/op 1.01
computeDeltas 1400000 validators 20% inactive 11.154 ms/op 11.059 ms/op 1.01
computeDeltas 1400000 validators 50% inactive 8.9359 ms/op 9.0644 ms/op 0.99
computeDeltas 2100000 validators 0% inactive 20.178 ms/op 18.977 ms/op 1.06
computeDeltas 2100000 validators 10% inactive 17.550 ms/op 18.800 ms/op 0.93
computeDeltas 2100000 validators 20% inactive 16.589 ms/op 17.547 ms/op 0.95
computeDeltas 2100000 validators 50% inactive 10.933 ms/op 11.539 ms/op 0.95
altair processAttestation - 250000 vs - 7PWei normalcase 1.8975 ms/op 2.1297 ms/op 0.89
altair processAttestation - 250000 vs - 7PWei worstcase 2.4555 ms/op 2.7387 ms/op 0.90
altair processAttestation - setStatus - 1/6 committees join 97.538 us/op 103.92 us/op 0.94
altair processAttestation - setStatus - 1/3 committees join 194.68 us/op 213.45 us/op 0.91
altair processAttestation - setStatus - 1/2 committees join 296.78 us/op 303.49 us/op 0.98
altair processAttestation - setStatus - 2/3 committees join 377.61 us/op 388.38 us/op 0.97
altair processAttestation - setStatus - 4/5 committees join 514.32 us/op 558.66 us/op 0.92
altair processAttestation - setStatus - 100% committees join 621.76 us/op 622.40 us/op 1.00
altair processBlock - 250000 vs - 7PWei normalcase 3.2950 ms/op 4.8352 ms/op 0.68
altair processBlock - 250000 vs - 7PWei normalcase hashState 12.792 ms/op 15.859 ms/op 0.81
altair processBlock - 250000 vs - 7PWei worstcase 20.999 ms/op 23.242 ms/op 0.90
altair processBlock - 250000 vs - 7PWei worstcase hashState 44.816 ms/op 45.651 ms/op 0.98
phase0 processBlock - 250000 vs - 7PWei normalcase 1.5771 ms/op 1.5099 ms/op 1.04
phase0 processBlock - 250000 vs - 7PWei worstcase 18.632 ms/op 17.901 ms/op 1.04
altair processEth1Data - 250000 vs - 7PWei normalcase 301.88 us/op 301.74 us/op 1.00
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:16 4.3360 us/op 8.1810 us/op 0.53
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:220 21.890 us/op 21.187 us/op 1.03
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:43 6.1380 us/op 6.1020 us/op 1.01
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:19 4.9310 us/op 3.7960 us/op 1.30
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1021 92.127 us/op 93.022 us/op 0.99
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11778 1.3631 ms/op 1.4382 ms/op 0.95
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.8453 ms/op 1.9044 ms/op 0.97
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.7723 ms/op 1.8857 ms/op 0.94
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.6816 ms/op 3.9695 ms/op 0.93
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.9989 ms/op 2.1835 ms/op 0.92
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 5.3618 ms/op 4.1996 ms/op 1.28
Tree 40 250000 create 361.66 ms/op 367.49 ms/op 0.98
Tree 40 250000 get(125000) 92.424 ns/op 99.095 ns/op 0.93
Tree 40 250000 set(125000) 1.0523 us/op 1.0610 us/op 0.99
Tree 40 250000 toArray() 24.316 ms/op 19.409 ms/op 1.25
Tree 40 250000 iterate all - toArray() + loop 20.014 ms/op 19.990 ms/op 1.00
Tree 40 250000 iterate all - get(i) 43.493 ms/op 46.517 ms/op 0.93
Array 250000 create 2.4430 ms/op 2.3570 ms/op 1.04
Array 250000 clone - spread 713.08 us/op 723.38 us/op 0.99
Array 250000 get(125000) 0.29700 ns/op 0.30300 ns/op 0.98
Array 250000 set(125000) 0.30000 ns/op 0.30500 ns/op 0.98
Array 250000 iterate all - loop 58.432 us/op 58.694 us/op 1.00
phase0 afterProcessEpoch - 250000 vs - 7PWei 40.867 ms/op 58.433 ms/op 0.70
Array.fill - length 1000000 2.4825 ms/op 2.2632 ms/op 1.10
Array push - length 1000000 11.370 ms/op 9.3337 ms/op 1.22
Array.get 0.21446 ns/op 0.20942 ns/op 1.02
Uint8Array.get 0.23597 ns/op 0.25004 ns/op 0.94
phase0 beforeProcessEpoch - 250000 vs - 7PWei 15.035 ms/op 16.310 ms/op 0.92
altair processEpoch - mainnet_e81889 358.40 ms/op 305.05 ms/op 1.17
mainnet_e81889 - altair beforeProcessEpoch 20.865 ms/op 17.280 ms/op 1.21
mainnet_e81889 - altair processJustificationAndFinalization 7.8070 us/op 6.4780 us/op 1.21
mainnet_e81889 - altair processInactivityUpdates 3.5504 ms/op 3.6075 ms/op 0.98
mainnet_e81889 - altair processRewardsAndPenalties 20.478 ms/op 21.144 ms/op 0.97
mainnet_e81889 - altair processRegistryUpdates 585.00 ns/op 583.00 ns/op 1.00
mainnet_e81889 - altair processSlashings 142.00 ns/op 145.00 ns/op 0.98
mainnet_e81889 - altair processEth1DataReset 137.00 ns/op 143.00 ns/op 0.96
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.5073 ms/op 1.3525 ms/op 1.11
mainnet_e81889 - altair processSlashingsReset 735.00 ns/op 711.00 ns/op 1.03
mainnet_e81889 - altair processRandaoMixesReset 1.4670 us/op 1.4190 us/op 1.03
mainnet_e81889 - altair processHistoricalRootsUpdate 142.00 ns/op 143.00 ns/op 0.99
mainnet_e81889 - altair processParticipationFlagUpdates 448.00 ns/op 455.00 ns/op 0.98
mainnet_e81889 - altair processSyncCommitteeUpdates 115.00 ns/op 114.00 ns/op 1.01
mainnet_e81889 - altair afterProcessEpoch 43.340 ms/op 43.822 ms/op 0.99
capella processEpoch - mainnet_e217614 1.0509 s/op 887.14 ms/op 1.18
mainnet_e217614 - capella beforeProcessEpoch 69.071 ms/op 76.280 ms/op 0.91
mainnet_e217614 - capella processJustificationAndFinalization 6.0130 us/op 6.8500 us/op 0.88
mainnet_e217614 - capella processInactivityUpdates 12.166 ms/op 15.659 ms/op 0.78
mainnet_e217614 - capella processRewardsAndPenalties 97.695 ms/op 94.296 ms/op 1.04
mainnet_e217614 - capella processRegistryUpdates 4.5490 us/op 4.6780 us/op 0.97
mainnet_e217614 - capella processSlashings 144.00 ns/op 156.00 ns/op 0.92
mainnet_e217614 - capella processEth1DataReset 136.00 ns/op 154.00 ns/op 0.88
mainnet_e217614 - capella processEffectiveBalanceUpdates 5.6223 ms/op 18.690 ms/op 0.30
mainnet_e217614 - capella processSlashingsReset 704.00 ns/op 717.00 ns/op 0.98
mainnet_e217614 - capella processRandaoMixesReset 1.3080 us/op 1.4240 us/op 0.92
mainnet_e217614 - capella processHistoricalRootsUpdate 138.00 ns/op 156.00 ns/op 0.88
mainnet_e217614 - capella processParticipationFlagUpdates 437.00 ns/op 477.00 ns/op 0.92
mainnet_e217614 - capella afterProcessEpoch 108.43 ms/op 111.75 ms/op 0.97
phase0 processEpoch - mainnet_e58758 371.27 ms/op 377.34 ms/op 0.98
mainnet_e58758 - phase0 beforeProcessEpoch 90.238 ms/op 74.650 ms/op 1.21
mainnet_e58758 - phase0 processJustificationAndFinalization 7.4760 us/op 6.6240 us/op 1.13
mainnet_e58758 - phase0 processRewardsAndPenalties 18.382 ms/op 17.604 ms/op 1.04
mainnet_e58758 - phase0 processRegistryUpdates 2.3680 us/op 2.3810 us/op 0.99
mainnet_e58758 - phase0 processSlashings 138.00 ns/op 155.00 ns/op 0.89
mainnet_e58758 - phase0 processEth1DataReset 292.00 ns/op 160.00 ns/op 1.82
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 940.04 us/op 841.10 us/op 1.12
mainnet_e58758 - phase0 processSlashingsReset 976.00 ns/op 972.00 ns/op 1.00
mainnet_e58758 - phase0 processRandaoMixesReset 1.6020 us/op 1.3880 us/op 1.15
mainnet_e58758 - phase0 processHistoricalRootsUpdate 142.00 ns/op 156.00 ns/op 0.91
mainnet_e58758 - phase0 processParticipationRecordUpdates 1.4330 us/op 1.3580 us/op 1.06
mainnet_e58758 - phase0 afterProcessEpoch 35.349 ms/op 35.517 ms/op 1.00
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.4058 ms/op 1.1307 ms/op 1.24
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 4.3041 ms/op 1.2642 ms/op 3.40
altair processInactivityUpdates - 250000 normalcase 13.225 ms/op 12.372 ms/op 1.07
altair processInactivityUpdates - 250000 worstcase 14.210 ms/op 12.932 ms/op 1.10
phase0 processRegistryUpdates - 250000 normalcase 2.3210 us/op 2.5660 us/op 0.90
phase0 processRegistryUpdates - 250000 badcase_full_deposits 144.02 us/op 151.60 us/op 0.95
phase0 processRegistryUpdates - 250000 worstcase 0.5 72.014 ms/op 62.434 ms/op 1.15
altair processRewardsAndPenalties - 250000 normalcase 16.890 ms/op 17.422 ms/op 0.97
altair processRewardsAndPenalties - 250000 worstcase 16.152 ms/op 17.165 ms/op 0.94
phase0 getAttestationDeltas - 250000 normalcase 5.4733 ms/op 5.6740 ms/op 0.96
phase0 getAttestationDeltas - 250000 worstcase 5.5134 ms/op 5.6502 ms/op 0.98
phase0 processSlashings - 250000 worstcase 67.102 us/op 65.708 us/op 1.02
altair processSyncCommitteeUpdates - 250000 14.358 ms/op 10.839 ms/op 1.32
BeaconState.hashTreeRoot - No change 181.00 ns/op 173.00 ns/op 1.05
BeaconState.hashTreeRoot - 1 full validator 121.44 us/op 81.363 us/op 1.49
BeaconState.hashTreeRoot - 32 full validator 1.7329 ms/op 900.70 us/op 1.92
BeaconState.hashTreeRoot - 512 full validator 12.197 ms/op 7.5544 ms/op 1.61
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 151.22 us/op 100.90 us/op 1.50
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.1841 ms/op 1.5253 ms/op 1.43
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 32.575 ms/op 16.678 ms/op 1.95
BeaconState.hashTreeRoot - 1 balances 94.748 us/op 92.121 us/op 1.03
BeaconState.hashTreeRoot - 32 balances 1.3444 ms/op 794.72 us/op 1.69
BeaconState.hashTreeRoot - 512 balances 10.987 ms/op 6.0252 ms/op 1.82
BeaconState.hashTreeRoot - 250000 balances 226.11 ms/op 148.04 ms/op 1.53
aggregationBits - 2048 els - zipIndexesInBitList 21.088 us/op 21.654 us/op 0.97
regular array get 100000 times 23.631 us/op 23.695 us/op 1.00
wrappedArray get 100000 times 23.517 us/op 23.733 us/op 0.99
arrayWithProxy get 100000 times 10.041 ms/op 10.590 ms/op 0.95
ssz.Root.equals 22.020 ns/op 22.069 ns/op 1.00
byteArrayEquals 21.980 ns/op 21.828 ns/op 1.01
Buffer.compare 9.0690 ns/op 9.0520 ns/op 1.00
processSlot - 1 slots 10.968 us/op 10.124 us/op 1.08
processSlot - 32 slots 2.5774 ms/op 2.4247 ms/op 1.06
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 3.8866 ms/op 5.3355 ms/op 0.73
getCommitteeAssignments - req 1 vs - 250000 vc 1.7246 ms/op 1.7276 ms/op 1.00
getCommitteeAssignments - req 100 vs - 250000 vc 3.5428 ms/op 3.5068 ms/op 1.01
getCommitteeAssignments - req 1000 vs - 250000 vc 3.8110 ms/op 3.7793 ms/op 1.01
findModifiedValidators - 10000 modified validators 1.0176 s/op 899.44 ms/op 1.13
findModifiedValidators - 1000 modified validators 681.45 ms/op 595.22 ms/op 1.14
findModifiedValidators - 100 modified validators 399.02 ms/op 339.09 ms/op 1.18
findModifiedValidators - 10 modified validators 380.71 ms/op 323.34 ms/op 1.18
findModifiedValidators - 1 modified validators 278.21 ms/op 306.86 ms/op 0.91
findModifiedValidators - no difference 335.80 ms/op 182.37 ms/op 1.84
migrate state 1500000 validators, 3400 modified, 2000 new 4.4689 s/op 2.6662 s/op 1.68
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 3.7400 ns/op 3.8700 ns/op 0.97
state getBlockRootAtSlot - 250000 vs - 7PWei 550.18 ns/op 309.87 ns/op 1.78
computeProposerIndex 100000 validators 1.5138 ms/op 1.3900 ms/op 1.09
getNextSyncCommitteeIndices 1000 validators 3.0973 ms/op 2.9202 ms/op 1.06
getNextSyncCommitteeIndices 10000 validators 26.820 ms/op 26.265 ms/op 1.02
getNextSyncCommitteeIndices 100000 validators 92.919 ms/op 88.068 ms/op 1.06
computeProposers - vc 250000 571.86 us/op 547.25 us/op 1.04
computeEpochShuffling - vc 250000 41.056 ms/op 38.643 ms/op 1.06
getNextSyncCommittee - vc 250000 9.7575 ms/op 9.4331 ms/op 1.03
nodejs block root to RootHex using toHex 102.43 ns/op 102.99 ns/op 0.99
nodejs block root to RootHex using toRootHex 65.204 ns/op 67.636 ns/op 0.96
nodejs fromHex(blob) 978.56 us/op 731.63 us/op 1.34
nodejs fromHexInto(blob) 650.40 us/op 666.20 us/op 0.98
nodejs block root to RootHex using the deprecated toHexString 466.48 ns/op 472.57 ns/op 0.99
nodejs byteArrayEquals 32 bytes (block root) 26.920 ns/op 25.839 ns/op 1.04
nodejs byteArrayEquals 48 bytes (pubkey) 38.831 ns/op 37.317 ns/op 1.04
nodejs byteArrayEquals 96 bytes (signature) 35.806 ns/op 39.972 ns/op 0.90
nodejs byteArrayEquals 1024 bytes 41.231 ns/op 45.175 ns/op 0.91
nodejs byteArrayEquals 131072 bytes (blob) 1.8396 us/op 1.7571 us/op 1.05
browser block root to RootHex using toHex 147.91 ns/op 145.52 ns/op 1.02
browser block root to RootHex using toRootHex 134.25 ns/op 130.65 ns/op 1.03
browser fromHex(blob) 1.8818 ms/op 1.6415 ms/op 1.15
browser fromHexInto(blob) 648.12 us/op 646.08 us/op 1.00
browser block root to RootHex using the deprecated toHexString 335.38 ns/op 334.32 ns/op 1.00
browser byteArrayEquals 32 bytes (block root) 28.828 ns/op 28.195 ns/op 1.02
browser byteArrayEquals 48 bytes (pubkey) 40.494 ns/op 39.685 ns/op 1.02
browser byteArrayEquals 96 bytes (signature) 75.736 ns/op 74.927 ns/op 1.01
browser byteArrayEquals 1024 bytes 773.84 ns/op 760.51 ns/op 1.02
browser byteArrayEquals 131072 bytes (blob) 97.410 us/op 96.510 us/op 1.01

by benchmarkbot/action

Comment on lines +52 to +53
for (const [, envelope] of envelopes) {
const signedEnvelope = envelope.getPayloadEnvelope();

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.

should the payload envelope hash be added to IPayloadInput? Instead of using cachePermanentRootStruct?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

we already have to compute signing root while verifying signature for all payload envelopes here

return computeSigningRoot(ssz.gloas.ExecutionPayloadEnvelope, envelope, domain);

so using cachePermanentRootStruct ensures we compute it once
it's not convenient to add a rootHex to PayloadEnvelopeInput (of beacon-node) because computeSigningRoot() stays on state-transition
so it's different to IBlockInput

@twoeths
twoeths requested a review from wemeetagain August 8, 2026 08:45
@twoeths
twoeths merged commit a03686d into unstable Aug 11, 2026
18 of 19 checks passed
@twoeths
twoeths deleted the te/fix_hash_blocks branch August 11, 2026 04:20
@wemeetagain

Copy link
Copy Markdown
Member

馃帀 This PR is included in v1.47.0 馃帀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants