Skip to content

fix: harden range sync hashBlocks() - #9686

Open
twoeths wants to merge 1 commit into
unstablefrom
te/fix_hash_blocks
Open

fix: harden range sync hashBlocks()#9686
twoeths wants to merge 1 commit 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
@github-actions

Copy link
Copy Markdown
Contributor

Performance Report

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 98494ab Previous: 17a4805 Ratio
enrSubnets - fastDeserialize 64 bits 788.00 ns/op 2.4030 us/op 0.33
Full benchmark results
Benchmark suite Current: 98494ab Previous: 17a4805 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.2563 ms/op 942.18 us/op 1.33
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 44.066 us/op 37.078 us/op 1.19
BLS verify - blst 741.12 us/op 708.48 us/op 1.05
BLS verifyMultipleSignatures 3 - blst 1.4014 ms/op 1.2569 ms/op 1.11
BLS verifyMultipleSignatures 8 - blst 2.2067 ms/op 2.0040 ms/op 1.10
BLS verifyMultipleSignatures 32 - blst 7.0519 ms/op 6.2567 ms/op 1.13
BLS verifyMultipleSignatures 64 - blst 13.554 ms/op 12.316 ms/op 1.10
BLS verifyMultipleSignatures 128 - blst 25.975 ms/op 23.811 ms/op 1.09
BLS deserializing 10000 signatures 634.50 ms/op 605.74 ms/op 1.05
BLS deserializing 100000 signatures 6.5219 s/op 6.1010 s/op 1.07
BLS verifyMultipleSignatures - same message - 3 - blst 796.71 us/op 771.88 us/op 1.03
BLS verifyMultipleSignatures - same message - 8 - blst 885.21 us/op 803.01 us/op 1.10
BLS verifyMultipleSignatures - same message - 32 - blst 1.5595 ms/op 1.4995 ms/op 1.04
BLS verifyMultipleSignatures - same message - 64 - blst 2.3559 ms/op 2.2035 ms/op 1.07
BLS verifyMultipleSignatures - same message - 128 - blst 4.0915 ms/op 3.9092 ms/op 1.05
BLS aggregatePubkeys 32 - blst 17.394 us/op 16.879 us/op 1.03
BLS aggregatePubkeys 128 - blst 62.449 us/op 60.667 us/op 1.03
getSlashingsAndExits - default max 57.121 us/op 44.572 us/op 1.28
getSlashingsAndExits - 2k 437.38 us/op 323.74 us/op 1.35
proposeBlockBody type=full, size=empty 910.76 us/op 556.87 us/op 1.64
isKnown best case - 1 super set check 172.00 ns/op 158.00 ns/op 1.09
isKnown normal case - 2 super set checks 164.00 ns/op 158.00 ns/op 1.04
isKnown worse case - 16 super set checks 160.00 ns/op 156.00 ns/op 1.03
validate api signedAggregateAndProof - struct 1.5356 ms/op 1.4083 ms/op 1.09
validate gossip signedAggregateAndProof - struct 1.5339 ms/op 1.4169 ms/op 1.08
batch validate gossip attestation - vc 640000 - chunk 32 114.64 us/op 101.26 us/op 1.13
batch validate gossip attestation - vc 640000 - chunk 64 105.68 us/op 88.194 us/op 1.20
batch validate gossip attestation - vc 640000 - chunk 128 102.95 us/op 82.042 us/op 1.25
batch validate gossip attestation - vc 640000 - chunk 256 94.451 us/op 78.766 us/op 1.20
bytes32 toHexString 299.00 ns/op 262.00 ns/op 1.14
bytes32 Buffer.toString(hex) 176.00 ns/op 173.00 ns/op 1.02
bytes32 Buffer.toString(hex) from Uint8Array 240.00 ns/op 241.00 ns/op 1.00
bytes32 Buffer.toString(hex) + 0x 173.00 ns/op 175.00 ns/op 0.99
Return object 10000 times 0.21360 ns/op 0.19940 ns/op 1.07
Throw Error 10000 times 3.5009 us/op 3.1418 us/op 1.11
toHex 107.84 ns/op 87.840 ns/op 1.23
Buffer.from 90.250 ns/op 79.857 ns/op 1.13
shared Buffer 57.387 ns/op 54.433 ns/op 1.05
fastMsgIdFn sha256 / 200 bytes 1.4620 us/op 1.3840 us/op 1.06
fastMsgIdFn h32 xxhash / 200 bytes 159.00 ns/op 152.00 ns/op 1.05
fastMsgIdFn h64 xxhash / 200 bytes 212.00 ns/op 202.00 ns/op 1.05
fastMsgIdFn sha256 / 1000 bytes 4.6750 us/op 4.4490 us/op 1.05
fastMsgIdFn h32 xxhash / 1000 bytes 252.00 ns/op 233.00 ns/op 1.08
fastMsgIdFn h64 xxhash / 1000 bytes 258.00 ns/op 245.00 ns/op 1.05
fastMsgIdFn sha256 / 10000 bytes 41.207 us/op 39.478 us/op 1.04
fastMsgIdFn h32 xxhash / 10000 bytes 1.2640 us/op 1.2040 us/op 1.05
fastMsgIdFn h64 xxhash / 10000 bytes 814.00 ns/op 791.00 ns/op 1.03
send data - 1000 256B messages 4.5845 ms/op 4.0394 ms/op 1.13
send data - 1000 512B messages 5.4941 ms/op 5.3268 ms/op 1.03
send data - 1000 1024B messages 6.1714 ms/op 5.6754 ms/op 1.09
send data - 1000 1200B messages 6.9869 ms/op 5.9514 ms/op 1.17
send data - 1000 2048B messages 16.511 ms/op 18.358 ms/op 0.90
send data - 1000 4096B messages 65.348 ms/op 46.963 ms/op 1.39
send data - 1000 16384B messages 192.68 ms/op 207.13 ms/op 0.93
send data - 1000 65536B messages 1.2291 s/op 999.63 ms/op 1.23
enrSubnets - fastDeserialize 64 bits 788.00 ns/op 2.4030 us/op 0.33
enrSubnets - ssz BitVector 64 bits 261.00 ns/op 252.00 ns/op 1.04
enrSubnets - fastDeserialize 4 bits 104.00 ns/op 105.00 ns/op 0.99
enrSubnets - ssz BitVector 4 bits 259.00 ns/op 255.00 ns/op 1.02
prioritizePeers score -10:0 att 32-0.1 sync 2-0 204.60 us/op 193.89 us/op 1.06
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 226.46 us/op 220.75 us/op 1.03
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 341.83 us/op 315.34 us/op 1.08
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 597.71 us/op 563.86 us/op 1.06
prioritizePeers score 0:0 att 64-1 sync 4-1 718.49 us/op 652.56 us/op 1.10
array of 16000 items push then shift 1.2151 us/op 1.1935 us/op 1.02
LinkedList of 16000 items push then shift 8.4300 ns/op 7.1270 ns/op 1.18
array of 16000 items push then pop 74.831 ns/op 67.096 ns/op 1.12
LinkedList of 16000 items push then pop 6.8100 ns/op 5.7160 ns/op 1.19
array of 24000 items push then shift 1.8315 us/op 1.7586 us/op 1.04
LinkedList of 24000 items push then shift 7.7870 ns/op 6.6750 ns/op 1.17
array of 24000 items push then pop 98.271 ns/op 93.368 ns/op 1.05
LinkedList of 24000 items push then pop 5.9850 ns/op 5.6670 ns/op 1.06
intersect bitArray bitLen 8 4.5330 ns/op 4.5230 ns/op 1.00
intersect array and set length 8 30.108 ns/op 27.477 ns/op 1.10
intersect bitArray bitLen 128 22.732 ns/op 22.782 ns/op 1.00
intersect array and set length 128 468.30 ns/op 465.67 ns/op 1.01
bitArray.getTrueBitIndexes() bitLen 128 899.00 ns/op 872.00 ns/op 1.03
bitArray.getTrueBitIndexes() bitLen 248 1.5940 us/op 1.5750 us/op 1.01
bitArray.getTrueBitIndexes() bitLen 512 3.3740 us/op 3.2950 us/op 1.02
Full columns - reconstruct all 6 blobs 156.59 us/op 155.94 us/op 1.00
Full columns - reconstruct half of the blobs out of 6 107.95 us/op 106.98 us/op 1.01
Full columns - reconstruct single blob out of 6 31.601 us/op 31.286 us/op 1.01
Half columns - reconstruct all 6 blobs 369.35 ms/op 356.22 ms/op 1.04
Half columns - reconstruct half of the blobs out of 6 184.18 ms/op 179.50 ms/op 1.03
Half columns - reconstruct single blob out of 6 66.042 ms/op 63.565 ms/op 1.04
Set add up to 64 items then delete first 1.5917 us/op 1.5007 us/op 1.06
OrderedSet add up to 64 items then delete first 2.4076 us/op 2.3260 us/op 1.04
Set add up to 64 items then delete last 1.7763 us/op 1.7406 us/op 1.02
OrderedSet add up to 64 items then delete last 2.7218 us/op 2.5700 us/op 1.06
Set add up to 64 items then delete middle 1.8233 us/op 1.7337 us/op 1.05
OrderedSet add up to 64 items then delete middle 4.2347 us/op 3.9867 us/op 1.06
Set add up to 128 items then delete first 3.5029 us/op 3.4490 us/op 1.02
OrderedSet add up to 128 items then delete first 5.2515 us/op 5.3697 us/op 0.98
Set add up to 128 items then delete last 3.5341 us/op 3.3543 us/op 1.05
OrderedSet add up to 128 items then delete last 5.3276 us/op 5.1277 us/op 1.04
Set add up to 128 items then delete middle 3.5063 us/op 3.3531 us/op 1.05
OrderedSet add up to 128 items then delete middle 10.927 us/op 10.655 us/op 1.03
Set add up to 256 items then delete first 6.8449 us/op 7.0402 us/op 0.97
OrderedSet add up to 256 items then delete first 10.757 us/op 11.116 us/op 0.97
Set add up to 256 items then delete last 7.1743 us/op 6.7746 us/op 1.06
OrderedSet add up to 256 items then delete last 11.682 us/op 10.505 us/op 1.11
Set add up to 256 items then delete middle 7.0449 us/op 6.7151 us/op 1.05
OrderedSet add up to 256 items then delete middle 34.758 us/op 32.989 us/op 1.05
runFastConfirmationRules vc:100000 bc:96 eq:0 4.3452 ms/op 4.2483 ms/op 1.02
runFastConfirmationRules vc:600000 bc:96 eq:0 33.955 ms/op 32.605 ms/op 1.04
runFastConfirmationRules vc:1000000 bc:96 eq:0 55.847 ms/op 54.530 ms/op 1.02
runFastConfirmationRules vc:600000 bc:320 eq:0 33.987 ms/op 32.570 ms/op 1.04
runFastConfirmationRules vc:100000 bc:96 eq:1000 1.0315 s/op 1.0323 s/op 1.00
pass gossip attestations to forkchoice per slot 2.4884 ms/op 2.4300 ms/op 1.02
forkChoice updateHead vc 100000 bc 64 eq 0 380.66 us/op 382.01 us/op 1.00
forkChoice updateHead vc 600000 bc 64 eq 0 2.2916 ms/op 2.2998 ms/op 1.00
forkChoice updateHead vc 1000000 bc 64 eq 0 3.8445 ms/op 3.7653 ms/op 1.02
forkChoice updateHead vc 600000 bc 320 eq 0 2.3110 ms/op 2.2794 ms/op 1.01
forkChoice updateHead vc 600000 bc 1200 eq 0 2.4060 ms/op 2.3203 ms/op 1.04
forkChoice updateHead vc 600000 bc 7200 eq 0 3.1660 ms/op 2.7312 ms/op 1.16
forkChoice updateHead vc 600000 bc 64 eq 1000 2.2971 ms/op 2.2805 ms/op 1.01
forkChoice updateHead vc 600000 bc 64 eq 10000 2.4108 ms/op 2.3460 ms/op 1.03
forkChoice updateHead vc 600000 bc 64 eq 300000 6.1676 ms/op 5.9797 ms/op 1.03
computeDeltas 1400000 validators 0% inactive 11.407 ms/op 11.305 ms/op 1.01
computeDeltas 1400000 validators 10% inactive 10.871 ms/op 10.720 ms/op 1.01
computeDeltas 1400000 validators 20% inactive 10.313 ms/op 10.208 ms/op 1.01
computeDeltas 1400000 validators 50% inactive 8.5873 ms/op 8.3424 ms/op 1.03
computeDeltas 2100000 validators 0% inactive 17.291 ms/op 17.445 ms/op 0.99
computeDeltas 2100000 validators 10% inactive 16.467 ms/op 16.406 ms/op 1.00
computeDeltas 2100000 validators 20% inactive 15.569 ms/op 15.437 ms/op 1.01
computeDeltas 2100000 validators 50% inactive 10.365 ms/op 10.301 ms/op 1.01
altair processAttestation - 250000 vs - 7PWei normalcase 2.1925 ms/op 2.4927 ms/op 0.88
altair processAttestation - 250000 vs - 7PWei worstcase 2.9654 ms/op 3.3092 ms/op 0.90
altair processAttestation - setStatus - 1/6 committees join 96.870 us/op 100.44 us/op 0.96
altair processAttestation - setStatus - 1/3 committees join 198.16 us/op 184.64 us/op 1.07
altair processAttestation - setStatus - 1/2 committees join 273.10 us/op 265.52 us/op 1.03
altair processAttestation - setStatus - 2/3 committees join 347.37 us/op 354.54 us/op 0.98
altair processAttestation - setStatus - 4/5 committees join 487.03 us/op 489.02 us/op 1.00
altair processAttestation - setStatus - 100% committees join 571.35 us/op 574.50 us/op 0.99
altair processBlock - 250000 vs - 7PWei normalcase 4.2113 ms/op 4.5303 ms/op 0.93
altair processBlock - 250000 vs - 7PWei normalcase hashState 13.980 ms/op 16.339 ms/op 0.86
altair processBlock - 250000 vs - 7PWei worstcase 21.040 ms/op 20.812 ms/op 1.01
altair processBlock - 250000 vs - 7PWei worstcase hashState 41.030 ms/op 37.257 ms/op 1.10
phase0 processBlock - 250000 vs - 7PWei normalcase 1.3860 ms/op 1.4210 ms/op 0.98
phase0 processBlock - 250000 vs - 7PWei worstcase 16.461 ms/op 17.760 ms/op 0.93
altair processEth1Data - 250000 vs - 7PWei normalcase 312.50 us/op 266.43 us/op 1.17
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:16 4.9360 us/op 3.1030 us/op 1.59
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:220 20.361 us/op 19.752 us/op 1.03
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:43 5.3160 us/op 5.2670 us/op 1.01
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:19 3.4660 us/op 4.1240 us/op 0.84
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1021 85.958 us/op 85.352 us/op 1.01
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11778 1.3186 ms/op 1.2693 ms/op 1.04
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.6934 ms/op 1.6577 ms/op 1.02
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.6965 ms/op 1.6578 ms/op 1.02
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.5056 ms/op 3.3169 ms/op 1.06
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.9100 ms/op 1.9006 ms/op 1.00
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.7056 ms/op 3.7226 ms/op 1.00
Tree 40 250000 create 300.03 ms/op 300.28 ms/op 1.00
Tree 40 250000 get(125000) 89.274 ns/op 86.686 ns/op 1.03
Tree 40 250000 set(125000) 949.07 ns/op 927.35 ns/op 1.02
Tree 40 250000 toArray() 11.005 ms/op 11.951 ms/op 0.92
Tree 40 250000 iterate all - toArray() + loop 11.574 ms/op 11.022 ms/op 1.05
Tree 40 250000 iterate all - get(i) 35.000 ms/op 32.338 ms/op 1.08
Array 250000 create 2.1217 ms/op 2.0486 ms/op 1.04
Array 250000 clone - spread 655.19 us/op 640.81 us/op 1.02
Array 250000 get(125000) 0.28600 ns/op 0.27600 ns/op 1.04
Array 250000 set(125000) 0.29000 ns/op 0.27700 ns/op 1.05
Array 250000 iterate all - loop 56.095 us/op 53.986 us/op 1.04
phase0 afterProcessEpoch - 250000 vs - 7PWei 40.287 ms/op 37.641 ms/op 1.07
Array.fill - length 1000000 2.0407 ms/op 2.0124 ms/op 1.01
Array push - length 1000000 8.7517 ms/op 8.2604 ms/op 1.06
Array.get 0.19624 ns/op 0.19253 ns/op 1.02
Uint8Array.get 0.22017 ns/op 0.22586 ns/op 0.97
phase0 beforeProcessEpoch - 250000 vs - 7PWei 14.442 ms/op 13.599 ms/op 1.06
altair processEpoch - mainnet_e81889 276.78 ms/op 275.07 ms/op 1.01
mainnet_e81889 - altair beforeProcessEpoch 15.090 ms/op 15.758 ms/op 0.96
mainnet_e81889 - altair processJustificationAndFinalization 6.1310 us/op 6.4910 us/op 0.94
mainnet_e81889 - altair processInactivityUpdates 4.6343 ms/op 3.7004 ms/op 1.25
mainnet_e81889 - altair processRewardsAndPenalties 20.827 ms/op 19.429 ms/op 1.07
mainnet_e81889 - altair processRegistryUpdates 535.00 ns/op 528.00 ns/op 1.01
mainnet_e81889 - altair processSlashings 132.00 ns/op 133.00 ns/op 0.99
mainnet_e81889 - altair processEth1DataReset 129.00 ns/op 131.00 ns/op 0.98
mainnet_e81889 - altair processEffectiveBalanceUpdates 7.5085 ms/op 2.7860 ms/op 2.70
mainnet_e81889 - altair processSlashingsReset 679.00 ns/op 688.00 ns/op 0.99
mainnet_e81889 - altair processRandaoMixesReset 1.3710 us/op 1.1290 us/op 1.21
mainnet_e81889 - altair processHistoricalRootsUpdate 133.00 ns/op 127.00 ns/op 1.05
mainnet_e81889 - altair processParticipationFlagUpdates 454.00 ns/op 413.00 ns/op 1.10
mainnet_e81889 - altair processSyncCommitteeUpdates 110.00 ns/op 111.00 ns/op 0.99
mainnet_e81889 - altair afterProcessEpoch 40.588 ms/op 39.589 ms/op 1.03
capella processEpoch - mainnet_e217614 818.56 ms/op 770.25 ms/op 1.06
mainnet_e217614 - capella beforeProcessEpoch 57.174 ms/op 54.020 ms/op 1.06
mainnet_e217614 - capella processJustificationAndFinalization 6.2590 us/op 5.7900 us/op 1.08
mainnet_e217614 - capella processInactivityUpdates 15.629 ms/op 13.821 ms/op 1.13
mainnet_e217614 - capella processRewardsAndPenalties 93.263 ms/op 84.358 ms/op 1.11
mainnet_e217614 - capella processRegistryUpdates 4.4910 us/op 4.2820 us/op 1.05
mainnet_e217614 - capella processSlashings 128.00 ns/op 127.00 ns/op 1.01
mainnet_e217614 - capella processEth1DataReset 125.00 ns/op 120.00 ns/op 1.04
mainnet_e217614 - capella processEffectiveBalanceUpdates 13.257 ms/op 12.144 ms/op 1.09
mainnet_e217614 - capella processSlashingsReset 650.00 ns/op 655.00 ns/op 0.99
mainnet_e217614 - capella processRandaoMixesReset 1.2380 us/op 1.0880 us/op 1.14
mainnet_e217614 - capella processHistoricalRootsUpdate 125.00 ns/op 128.00 ns/op 0.98
mainnet_e217614 - capella processParticipationFlagUpdates 428.00 ns/op 410.00 ns/op 1.04
mainnet_e217614 - capella afterProcessEpoch 107.16 ms/op 101.83 ms/op 1.05
phase0 processEpoch - mainnet_e58758 323.68 ms/op 289.79 ms/op 1.12
mainnet_e58758 - phase0 beforeProcessEpoch 66.523 ms/op 60.424 ms/op 1.10
mainnet_e58758 - phase0 processJustificationAndFinalization 6.6420 us/op 5.9900 us/op 1.11
mainnet_e58758 - phase0 processRewardsAndPenalties 61.527 ms/op 15.466 ms/op 3.98
mainnet_e58758 - phase0 processRegistryUpdates 2.1910 us/op 2.1340 us/op 1.03
mainnet_e58758 - phase0 processSlashings 129.00 ns/op 204.00 ns/op 0.63
mainnet_e58758 - phase0 processEth1DataReset 124.00 ns/op 127.00 ns/op 0.98
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 782.88 us/op 971.26 us/op 0.81
mainnet_e58758 - phase0 processSlashingsReset 867.00 ns/op 842.00 ns/op 1.03
mainnet_e58758 - phase0 processRandaoMixesReset 1.2780 us/op 1.1940 us/op 1.07
mainnet_e58758 - phase0 processHistoricalRootsUpdate 130.00 ns/op 135.00 ns/op 0.96
mainnet_e58758 - phase0 processParticipationRecordUpdates 1.1250 us/op 1.0700 us/op 1.05
mainnet_e58758 - phase0 afterProcessEpoch 32.529 ms/op 31.745 ms/op 1.02
phase0 processEffectiveBalanceUpdates - 250000 normalcase 963.86 us/op 937.20 us/op 1.03
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5785 ms/op 1.5004 ms/op 1.05
altair processInactivityUpdates - 250000 normalcase 10.343 ms/op 9.8960 ms/op 1.05
altair processInactivityUpdates - 250000 worstcase 10.447 ms/op 9.9768 ms/op 1.05
phase0 processRegistryUpdates - 250000 normalcase 2.1080 us/op 3.3400 us/op 0.63
phase0 processRegistryUpdates - 250000 badcase_full_deposits 139.43 us/op 132.48 us/op 1.05
phase0 processRegistryUpdates - 250000 worstcase 0.5 62.450 ms/op 56.755 ms/op 1.10
altair processRewardsAndPenalties - 250000 normalcase 15.882 ms/op 15.593 ms/op 1.02
altair processRewardsAndPenalties - 250000 worstcase 15.841 ms/op 15.034 ms/op 1.05
phase0 getAttestationDeltas - 250000 normalcase 5.3060 ms/op 5.1632 ms/op 1.03
phase0 getAttestationDeltas - 250000 worstcase 5.2353 ms/op 5.1901 ms/op 1.01
phase0 processSlashings - 250000 worstcase 57.339 us/op 57.130 us/op 1.00
altair processSyncCommitteeUpdates - 250000 9.7668 ms/op 9.8189 ms/op 0.99
BeaconState.hashTreeRoot - No change 163.00 ns/op 166.00 ns/op 0.98
BeaconState.hashTreeRoot - 1 full validator 72.043 us/op 73.275 us/op 0.98
BeaconState.hashTreeRoot - 32 full validator 801.52 us/op 838.88 us/op 0.96
BeaconState.hashTreeRoot - 512 full validator 6.5360 ms/op 7.9905 ms/op 0.82
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 86.940 us/op 95.453 us/op 0.91
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.3041 ms/op 1.3661 ms/op 0.95
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 14.446 ms/op 16.504 ms/op 0.88
BeaconState.hashTreeRoot - 1 balances 69.324 us/op 68.164 us/op 1.02
BeaconState.hashTreeRoot - 32 balances 687.32 us/op 709.34 us/op 0.97
BeaconState.hashTreeRoot - 512 balances 5.4906 ms/op 5.8114 ms/op 0.94
BeaconState.hashTreeRoot - 250000 balances 122.56 ms/op 137.03 ms/op 0.89
aggregationBits - 2048 els - zipIndexesInBitList 18.978 us/op 18.583 us/op 1.02
regular array get 100000 times 22.301 us/op 21.819 us/op 1.02
wrappedArray get 100000 times 22.207 us/op 21.750 us/op 1.02
arrayWithProxy get 100000 times 9.7368 ms/op 10.424 ms/op 0.93
ssz.Root.equals 20.816 ns/op 20.356 ns/op 1.02
byteArrayEquals 20.554 ns/op 20.481 ns/op 1.00
Buffer.compare 9.5310 ns/op 8.3320 ns/op 1.14
processSlot - 1 slots 8.9760 us/op 9.5810 us/op 0.94
processSlot - 32 slots 2.1897 ms/op 2.0460 ms/op 1.07
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 5.2698 ms/op 3.4416 ms/op 1.53
getCommitteeAssignments - req 1 vs - 250000 vc 1.6256 ms/op 1.6064 ms/op 1.01
getCommitteeAssignments - req 100 vs - 250000 vc 3.3778 ms/op 3.2923 ms/op 1.03
getCommitteeAssignments - req 1000 vs - 250000 vc 3.6634 ms/op 3.5133 ms/op 1.04
findModifiedValidators - 10000 modified validators 748.61 ms/op 728.90 ms/op 1.03
findModifiedValidators - 1000 modified validators 503.12 ms/op 536.49 ms/op 0.94
findModifiedValidators - 100 modified validators 359.97 ms/op 289.60 ms/op 1.24
findModifiedValidators - 10 modified validators 334.79 ms/op 158.47 ms/op 2.11
findModifiedValidators - 1 modified validators 370.26 ms/op 184.58 ms/op 2.01
findModifiedValidators - no difference 253.60 ms/op 156.69 ms/op 1.62
migrate state 1500000 validators, 3400 modified, 2000 new 3.1627 s/op 2.7869 s/op 1.13
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 3.6500 ns/op 3.4800 ns/op 1.05
state getBlockRootAtSlot - 250000 vs - 7PWei 411.55 ns/op 314.15 ns/op 1.31
computeProposerIndex 100000 validators 1.2950 ms/op 1.2777 ms/op 1.01
getNextSyncCommitteeIndices 1000 validators 2.7704 ms/op 2.7292 ms/op 1.02
getNextSyncCommitteeIndices 10000 validators 24.948 ms/op 23.883 ms/op 1.04
getNextSyncCommitteeIndices 100000 validators 82.293 ms/op 84.161 ms/op 0.98
computeProposers - vc 250000 525.10 us/op 530.53 us/op 0.99
computeEpochShuffling - vc 250000 38.238 ms/op 38.926 ms/op 0.98
getNextSyncCommittee - vc 250000 11.048 ms/op 9.0377 ms/op 1.22
nodejs block root to RootHex using toHex 98.215 ns/op 89.074 ns/op 1.10
nodejs block root to RootHex using toRootHex 59.817 ns/op 58.464 ns/op 1.02
nodejs fromHex(blob) 841.78 us/op 714.55 us/op 1.18
nodejs fromHexInto(blob) 595.00 us/op 611.94 us/op 0.97
nodejs block root to RootHex using the deprecated toHexString 484.87 ns/op 349.79 ns/op 1.39
nodejs byteArrayEquals 32 bytes (block root) 24.630 ns/op 25.376 ns/op 0.97
nodejs byteArrayEquals 48 bytes (pubkey) 35.930 ns/op 36.569 ns/op 0.98
nodejs byteArrayEquals 96 bytes (signature) 32.849 ns/op 33.211 ns/op 0.99
nodejs byteArrayEquals 1024 bytes 39.867 ns/op 39.770 ns/op 1.00
nodejs byteArrayEquals 131072 bytes (blob) 1.6935 us/op 1.7087 us/op 0.99
browser block root to RootHex using toHex 137.88 ns/op 137.91 ns/op 1.00
browser block root to RootHex using toRootHex 125.25 ns/op 125.00 ns/op 1.00
browser fromHex(blob) 1.5019 ms/op 1.5074 ms/op 1.00
browser fromHexInto(blob) 604.05 us/op 606.18 us/op 1.00
browser block root to RootHex using the deprecated toHexString 336.90 ns/op 451.56 ns/op 0.75
browser byteArrayEquals 32 bytes (block root) 26.916 ns/op 27.012 ns/op 1.00
browser byteArrayEquals 48 bytes (pubkey) 38.186 ns/op 38.410 ns/op 0.99
browser byteArrayEquals 96 bytes (signature) 70.711 ns/op 71.484 ns/op 0.99
browser byteArrayEquals 1024 bytes 724.38 ns/op 731.05 ns/op 0.99
browser byteArrayEquals 131072 bytes (blob) 90.921 us/op 92.472 us/op 0.98

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

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants