Skip to content

feat: implement forkchoice is_head_weak() and is_parent_strong() - #9654

Merged
wemeetagain merged 11 commits into
unstablefrom
te/is_head_weak
Jul 24, 2026
Merged

feat: implement forkchoice is_head_weak() and is_parent_strong()#9654
wemeetagain merged 11 commits into
unstablefrom
te/is_head_weak

Conversation

@twoeths

@twoeths twoeths commented Jul 14, 2026

Copy link
Copy Markdown
Member

Motivation

Description

  • implement cross-fork is_head_weak() spec api and use it in getProposerHead()
  • track attestation weight in ProtoNode separately, weight still means total weight
  • back propagate boost deltas and attestation deltas separately
  • also implement is_parent_strong()

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 the fork choice implementation to support the Gloas fork's modified is_head_weak specification. It splits the tracking of node weights into two separate components: attestationScore (representing attester votes only) and weight (which includes proposer boost). The isHeadWeak logic is extracted into a private helper method in ForkChoice that handles both pre-Gloas and post-Gloas specifications, including adding back the weight of equivocating validators for post-Gloas blocks. Additionally, deltas has been renamed to attestationDeltas across the codebase for clarity, and comprehensive unit tests have been added to verify the new behavior. I have no feedback to provide.

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.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Performance Report

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: e3055e3 Previous: 4606097 Ratio
send data - 1000 2048B messages 7.9566 ms/op 25.252 ms/op 0.32
Full benchmark results
Benchmark suite Current: e3055e3 Previous: 4606097 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.0366 ms/op 1.3772 ms/op 0.75
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 41.065 us/op 41.123 us/op 1.00
BLS verify - blst 727.94 us/op 740.92 us/op 0.98
BLS verifyMultipleSignatures 3 - blst 1.3876 ms/op 1.3312 ms/op 1.04
BLS verifyMultipleSignatures 8 - blst 2.2011 ms/op 2.1256 ms/op 1.04
BLS verifyMultipleSignatures 32 - blst 6.9754 ms/op 6.7018 ms/op 1.04
BLS verifyMultipleSignatures 64 - blst 13.945 ms/op 13.603 ms/op 1.03
BLS verifyMultipleSignatures 128 - blst 26.197 ms/op 24.972 ms/op 1.05
BLS deserializing 10000 signatures 633.87 ms/op 617.23 ms/op 1.03
BLS deserializing 100000 signatures 6.3185 s/op 6.2087 s/op 1.02
BLS verifyMultipleSignatures - same message - 3 - blst 720.35 us/op 680.86 us/op 1.06
BLS verifyMultipleSignatures - same message - 8 - blst 853.91 us/op 901.09 us/op 0.95
BLS verifyMultipleSignatures - same message - 32 - blst 1.5993 ms/op 1.5302 ms/op 1.05
BLS verifyMultipleSignatures - same message - 64 - blst 2.4446 ms/op 2.3541 ms/op 1.04
BLS verifyMultipleSignatures - same message - 128 - blst 3.9485 ms/op 3.9236 ms/op 1.01
BLS aggregatePubkeys 32 - blst 17.394 us/op 17.150 us/op 1.01
BLS aggregatePubkeys 128 - blst 61.444 us/op 61.382 us/op 1.00
getSlashingsAndExits - default max 53.058 us/op 50.077 us/op 1.06
getSlashingsAndExits - 2k 322.60 us/op 429.60 us/op 0.75
proposeBlockBody type=full, size=empty 736.12 us/op 615.84 us/op 1.20
isKnown best case - 1 super set check 187.00 ns/op 179.00 ns/op 1.04
isKnown normal case - 2 super set checks 170.00 ns/op 175.00 ns/op 0.97
isKnown worse case - 16 super set checks 169.00 ns/op 177.00 ns/op 0.95
validate api signedAggregateAndProof - struct 1.5718 ms/op 1.5037 ms/op 1.05
validate gossip signedAggregateAndProof - struct 1.5570 ms/op 1.5029 ms/op 1.04
batch validate gossip attestation - vc 640000 - chunk 32 112.82 us/op 107.35 us/op 1.05
batch validate gossip attestation - vc 640000 - chunk 64 100.20 us/op 95.605 us/op 1.05
batch validate gossip attestation - vc 640000 - chunk 128 90.711 us/op 87.073 us/op 1.04
batch validate gossip attestation - vc 640000 - chunk 256 84.563 us/op 84.228 us/op 1.00
bytes32 toHexString 298.00 ns/op 274.00 ns/op 1.09
bytes32 Buffer.toString(hex) 169.00 ns/op 162.00 ns/op 1.04
bytes32 Buffer.toString(hex) from Uint8Array 236.00 ns/op 233.00 ns/op 1.01
bytes32 Buffer.toString(hex) + 0x 173.00 ns/op 166.00 ns/op 1.04
Return object 10000 times 0.20930 ns/op 0.21530 ns/op 0.97
Throw Error 10000 times 3.2685 us/op 3.7524 us/op 0.87
toHex 94.794 ns/op 106.17 ns/op 0.89
Buffer.from 85.149 ns/op 94.464 ns/op 0.90
shared Buffer 58.221 ns/op 58.173 ns/op 1.00
fastMsgIdFn sha256 / 200 bytes 1.4580 us/op 1.4880 us/op 0.98
fastMsgIdFn h32 xxhash / 200 bytes 154.00 ns/op 151.00 ns/op 1.02
fastMsgIdFn h64 xxhash / 200 bytes 211.00 ns/op 204.00 ns/op 1.03
fastMsgIdFn sha256 / 1000 bytes 4.7380 us/op 4.7110 us/op 1.01
fastMsgIdFn h32 xxhash / 1000 bytes 242.00 ns/op 237.00 ns/op 1.02
fastMsgIdFn h64 xxhash / 1000 bytes 257.00 ns/op 256.00 ns/op 1.00
fastMsgIdFn sha256 / 10000 bytes 41.284 us/op 41.965 us/op 0.98
fastMsgIdFn h32 xxhash / 10000 bytes 1.2430 us/op 1.3160 us/op 0.94
fastMsgIdFn h64 xxhash / 10000 bytes 807.00 ns/op 854.00 ns/op 0.94
send data - 1000 256B messages 4.2614 ms/op 4.5293 ms/op 0.94
send data - 1000 512B messages 5.6363 ms/op 5.6685 ms/op 0.99
send data - 1000 1024B messages 5.7424 ms/op 5.6613 ms/op 1.01
send data - 1000 1200B messages 6.3436 ms/op 6.5586 ms/op 0.97
send data - 1000 2048B messages 7.9566 ms/op 25.252 ms/op 0.32
send data - 1000 4096B messages 58.529 ms/op 38.055 ms/op 1.54
send data - 1000 16384B messages 379.83 ms/op 251.37 ms/op 1.51
send data - 1000 65536B messages 1.5041 s/op 1.2544 s/op 1.20
enrSubnets - fastDeserialize 64 bits 744.00 ns/op 788.00 ns/op 0.94
enrSubnets - ssz BitVector 64 bits 270.00 ns/op 256.00 ns/op 1.05
enrSubnets - fastDeserialize 4 bits 100.00 ns/op 97.000 ns/op 1.03
enrSubnets - ssz BitVector 4 bits 272.00 ns/op 249.00 ns/op 1.09
prioritizePeers score -10:0 att 32-0.1 sync 2-0 205.02 us/op 204.06 us/op 1.00
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 244.52 us/op 235.11 us/op 1.04
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 339.50 us/op 343.03 us/op 0.99
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 598.50 us/op 589.24 us/op 1.02
prioritizePeers score 0:0 att 64-1 sync 4-1 715.94 us/op 726.83 us/op 0.99
array of 16000 items push then shift 1.3479 us/op 1.2437 us/op 1.08
LinkedList of 16000 items push then shift 7.5390 ns/op 7.8670 ns/op 0.96
array of 16000 items push then pop 79.875 ns/op 77.891 ns/op 1.03
LinkedList of 16000 items push then pop 6.3190 ns/op 5.9720 ns/op 1.06
array of 24000 items push then shift 1.9970 us/op 1.8463 us/op 1.08
LinkedList of 24000 items push then shift 7.1040 ns/op 7.6330 ns/op 0.93
array of 24000 items push then pop 110.37 ns/op 109.23 ns/op 1.01
LinkedList of 24000 items push then pop 6.1290 ns/op 6.0300 ns/op 1.02
intersect bitArray bitLen 8 4.8710 ns/op 4.6960 ns/op 1.04
intersect array and set length 8 30.404 ns/op 28.993 ns/op 1.05
intersect bitArray bitLen 128 24.637 ns/op 23.575 ns/op 1.05
intersect array and set length 128 510.86 ns/op 486.37 ns/op 1.05
bitArray.getTrueBitIndexes() bitLen 128 972.00 ns/op 925.00 ns/op 1.05
bitArray.getTrueBitIndexes() bitLen 248 1.7010 us/op 1.6600 us/op 1.02
bitArray.getTrueBitIndexes() bitLen 512 3.5680 us/op 3.4950 us/op 1.02
Full columns - reconstruct all 6 blobs 113.08 us/op 189.24 us/op 0.60
Full columns - reconstruct half of the blobs out of 6 65.436 us/op 88.236 us/op 0.74
Full columns - reconstruct single blob out of 6 32.953 us/op 31.913 us/op 1.03
Half columns - reconstruct all 6 blobs 401.76 ms/op 386.94 ms/op 1.04
Half columns - reconstruct half of the blobs out of 6 201.81 ms/op 195.33 ms/op 1.03
Half columns - reconstruct single blob out of 6 72.247 ms/op 70.093 ms/op 1.03
Set add up to 64 items then delete first 1.6059 us/op 1.6177 us/op 0.99
OrderedSet add up to 64 items then delete first 2.4975 us/op 2.4882 us/op 1.00
Set add up to 64 items then delete last 1.8294 us/op 1.8435 us/op 0.99
OrderedSet add up to 64 items then delete last 2.9115 us/op 2.7584 us/op 1.06
Set add up to 64 items then delete middle 1.9038 us/op 1.8380 us/op 1.04
OrderedSet add up to 64 items then delete middle 4.4022 us/op 4.2189 us/op 1.04
Set add up to 128 items then delete first 3.6634 us/op 3.6883 us/op 0.99
OrderedSet add up to 128 items then delete first 5.5818 us/op 5.6611 us/op 0.99
Set add up to 128 items then delete last 3.6002 us/op 3.5433 us/op 1.02
OrderedSet add up to 128 items then delete last 5.5059 us/op 5.3183 us/op 1.04
Set add up to 128 items then delete middle 3.5488 us/op 3.5199 us/op 1.01
OrderedSet add up to 128 items then delete middle 11.335 us/op 11.129 us/op 1.02
Set add up to 256 items then delete first 7.3706 us/op 7.4335 us/op 0.99
OrderedSet add up to 256 items then delete first 12.313 us/op 12.848 us/op 0.96
Set add up to 256 items then delete last 7.6209 us/op 7.1283 us/op 1.07
OrderedSet add up to 256 items then delete last 11.714 us/op 12.028 us/op 0.97
Set add up to 256 items then delete middle 7.1078 us/op 7.0911 us/op 1.00
OrderedSet add up to 256 items then delete middle 36.108 us/op 35.060 us/op 1.03
runFastConfirmationRules vc:100000 bc:96 eq:0 4.4831 ms/op 4.4268 ms/op 1.01
runFastConfirmationRules vc:600000 bc:96 eq:0 35.834 ms/op 36.084 ms/op 0.99
runFastConfirmationRules vc:1000000 bc:96 eq:0 58.185 ms/op 59.945 ms/op 0.97
runFastConfirmationRules vc:600000 bc:320 eq:0 36.043 ms/op 36.487 ms/op 0.99
runFastConfirmationRules vc:100000 bc:96 eq:1000 1.1381 s/op 1.3795 s/op 0.82
pass gossip attestations to forkchoice per slot 2.5833 ms/op 2.5570 ms/op 1.01
forkChoice updateHead vc 100000 bc 64 eq 0 405.55 us/op 394.52 us/op 1.03
forkChoice updateHead vc 600000 bc 64 eq 0 2.3904 ms/op 2.3851 ms/op 1.00
forkChoice updateHead vc 1000000 bc 64 eq 0 4.3536 ms/op 4.5882 ms/op 0.95
forkChoice updateHead vc 600000 bc 320 eq 0 2.7070 ms/op 2.3624 ms/op 1.15
forkChoice updateHead vc 600000 bc 1200 eq 0 2.7682 ms/op 2.4023 ms/op 1.15
forkChoice updateHead vc 600000 bc 7200 eq 0 2.7715 ms/op 2.9318 ms/op 0.95
forkChoice updateHead vc 600000 bc 64 eq 1000 2.3748 ms/op 2.3458 ms/op 1.01
forkChoice updateHead vc 600000 bc 64 eq 10000 2.4229 ms/op 2.4208 ms/op 1.00
forkChoice updateHead vc 600000 bc 64 eq 300000 6.4396 ms/op 6.4043 ms/op 1.01
computeDeltas 1400000 validators 0% inactive 11.890 ms/op 11.755 ms/op 1.01
computeDeltas 1400000 validators 10% inactive 11.088 ms/op 11.119 ms/op 1.00
computeDeltas 1400000 validators 20% inactive 10.547 ms/op 10.398 ms/op 1.01
computeDeltas 1400000 validators 50% inactive 8.5536 ms/op 8.5370 ms/op 1.00
computeDeltas 2100000 validators 0% inactive 17.559 ms/op 17.435 ms/op 1.01
computeDeltas 2100000 validators 10% inactive 16.652 ms/op 16.603 ms/op 1.00
computeDeltas 2100000 validators 20% inactive 15.646 ms/op 15.702 ms/op 1.00
computeDeltas 2100000 validators 50% inactive 10.439 ms/op 10.434 ms/op 1.00
altair processAttestation - 250000 vs - 7PWei normalcase 2.0274 ms/op 2.2510 ms/op 0.90
altair processAttestation - 250000 vs - 7PWei worstcase 2.4730 ms/op 3.3455 ms/op 0.74
altair processAttestation - setStatus - 1/6 committees join 102.26 us/op 101.38 us/op 1.01
altair processAttestation - setStatus - 1/3 committees join 209.91 us/op 202.26 us/op 1.04
altair processAttestation - setStatus - 1/2 committees join 289.95 us/op 279.08 us/op 1.04
altair processAttestation - setStatus - 2/3 committees join 362.20 us/op 361.02 us/op 1.00
altair processAttestation - setStatus - 4/5 committees join 503.46 us/op 525.48 us/op 0.96
altair processAttestation - setStatus - 100% committees join 587.89 us/op 618.22 us/op 0.95
altair processBlock - 250000 vs - 7PWei normalcase 3.7155 ms/op 4.0564 ms/op 0.92
altair processBlock - 250000 vs - 7PWei normalcase hashState 13.545 ms/op 17.020 ms/op 0.80
altair processBlock - 250000 vs - 7PWei worstcase 21.266 ms/op 22.325 ms/op 0.95
altair processBlock - 250000 vs - 7PWei worstcase hashState 41.241 ms/op 42.941 ms/op 0.96
phase0 processBlock - 250000 vs - 7PWei normalcase 1.4261 ms/op 1.4844 ms/op 0.96
phase0 processBlock - 250000 vs - 7PWei worstcase 16.737 ms/op 17.321 ms/op 0.97
altair processEth1Data - 250000 vs - 7PWei normalcase 275.17 us/op 301.49 us/op 0.91
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:16 2.9410 us/op 3.4380 us/op 0.86
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:220 19.718 us/op 20.017 us/op 0.99
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:43 5.5790 us/op 6.9880 us/op 0.80
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:19 3.4990 us/op 4.1600 us/op 0.84
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1021 99.351 us/op 91.289 us/op 1.09
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11778 1.4223 ms/op 1.4212 ms/op 1.00
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.8758 ms/op 1.8262 ms/op 1.03
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.8625 ms/op 1.8444 ms/op 1.01
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.6525 ms/op 3.7313 ms/op 0.98
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.1203 ms/op 2.0654 ms/op 1.03
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.8217 ms/op 4.6928 ms/op 0.81
Tree 40 250000 create 359.97 ms/op 348.59 ms/op 1.03
Tree 40 250000 get(125000) 93.283 ns/op 91.632 ns/op 1.02
Tree 40 250000 set(125000) 952.48 ns/op 988.44 ns/op 0.96
Tree 40 250000 toArray() 13.967 ms/op 17.630 ms/op 0.79
Tree 40 250000 iterate all - toArray() + loop 12.021 ms/op 17.133 ms/op 0.70
Tree 40 250000 iterate all - get(i) 36.365 ms/op 40.029 ms/op 0.91
Array 250000 create 2.2969 ms/op 2.5266 ms/op 0.91
Array 250000 clone - spread 706.79 us/op 778.52 us/op 0.91
Array 250000 get(125000) 0.28200 ns/op 0.29000 ns/op 0.97
Array 250000 set(125000) 0.28300 ns/op 0.29400 ns/op 0.96
Array 250000 iterate all - loop 55.072 us/op 57.212 us/op 0.96
phase0 afterProcessEpoch - 250000 vs - 7PWei 63.063 ms/op 40.411 ms/op 1.56
Array.fill - length 1000000 2.3032 ms/op 2.4380 ms/op 0.94
Array push - length 1000000 8.0722 ms/op 10.467 ms/op 0.77
Array.get 0.20927 ns/op 0.20282 ns/op 1.03
Uint8Array.get 0.23019 ns/op 0.26211 ns/op 0.88
phase0 beforeProcessEpoch - 250000 vs - 7PWei 14.105 ms/op 16.467 ms/op 0.86
altair processEpoch - mainnet_e81889 330.00 ms/op 269.34 ms/op 1.23
mainnet_e81889 - altair beforeProcessEpoch 21.491 ms/op 15.224 ms/op 1.41
mainnet_e81889 - altair processJustificationAndFinalization 6.4100 us/op 17.142 us/op 0.37
mainnet_e81889 - altair processInactivityUpdates 3.3127 ms/op 4.6256 ms/op 0.72
mainnet_e81889 - altair processRewardsAndPenalties 18.813 ms/op 21.148 ms/op 0.89
mainnet_e81889 - altair processRegistryUpdates 506.00 ns/op 549.00 ns/op 0.92
mainnet_e81889 - altair processSlashings 126.00 ns/op 133.00 ns/op 0.95
mainnet_e81889 - altair processEth1DataReset 139.00 ns/op 126.00 ns/op 1.10
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.7436 ms/op 2.5875 ms/op 0.67
mainnet_e81889 - altair processSlashingsReset 673.00 ns/op 777.00 ns/op 0.87
mainnet_e81889 - altair processRandaoMixesReset 1.3640 us/op 1.1000 us/op 1.24
mainnet_e81889 - altair processHistoricalRootsUpdate 125.00 ns/op 128.00 ns/op 0.98
mainnet_e81889 - altair processParticipationFlagUpdates 422.00 ns/op 436.00 ns/op 0.97
mainnet_e81889 - altair processSyncCommitteeUpdates 116.00 ns/op 105.00 ns/op 1.10
mainnet_e81889 - altair afterProcessEpoch 41.613 ms/op 42.083 ms/op 0.99
capella processEpoch - mainnet_e217614 957.25 ms/op 940.80 ms/op 1.02
mainnet_e217614 - capella beforeProcessEpoch 59.406 ms/op 60.966 ms/op 0.97
mainnet_e217614 - capella processJustificationAndFinalization 6.3410 us/op 6.6230 us/op 0.96
mainnet_e217614 - capella processInactivityUpdates 12.153 ms/op 15.426 ms/op 0.79
mainnet_e217614 - capella processRewardsAndPenalties 95.137 ms/op 100.96 ms/op 0.94
mainnet_e217614 - capella processRegistryUpdates 4.4140 us/op 4.4420 us/op 0.99
mainnet_e217614 - capella processSlashings 131.00 ns/op 133.00 ns/op 0.98
mainnet_e217614 - capella processEth1DataReset 125.00 ns/op 128.00 ns/op 0.98
mainnet_e217614 - capella processEffectiveBalanceUpdates 17.095 ms/op 18.594 ms/op 0.92
mainnet_e217614 - capella processSlashingsReset 681.00 ns/op 685.00 ns/op 0.99
mainnet_e217614 - capella processRandaoMixesReset 1.4700 us/op 1.4170 us/op 1.04
mainnet_e217614 - capella processHistoricalRootsUpdate 128.00 ns/op 125.00 ns/op 1.02
mainnet_e217614 - capella processParticipationFlagUpdates 423.00 ns/op 442.00 ns/op 0.96
mainnet_e217614 - capella afterProcessEpoch 113.04 ms/op 108.50 ms/op 1.04
phase0 processEpoch - mainnet_e58758 365.20 ms/op 322.94 ms/op 1.13
mainnet_e58758 - phase0 beforeProcessEpoch 71.504 ms/op 73.085 ms/op 0.98
mainnet_e58758 - phase0 processJustificationAndFinalization 7.1860 us/op 6.7810 us/op 1.06
mainnet_e58758 - phase0 processRewardsAndPenalties 16.661 ms/op 17.420 ms/op 0.96
mainnet_e58758 - phase0 processRegistryUpdates 2.2000 us/op 2.2780 us/op 0.97
mainnet_e58758 - phase0 processSlashings 131.00 ns/op 129.00 ns/op 1.02
mainnet_e58758 - phase0 processEth1DataReset 207.00 ns/op 125.00 ns/op 1.66
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 861.31 us/op 828.68 us/op 1.04
mainnet_e58758 - phase0 processSlashingsReset 966.00 ns/op 990.00 ns/op 0.98
mainnet_e58758 - phase0 processRandaoMixesReset 1.5570 us/op 1.4060 us/op 1.11
mainnet_e58758 - phase0 processHistoricalRootsUpdate 150.00 ns/op 132.00 ns/op 1.14
mainnet_e58758 - phase0 processParticipationRecordUpdates 1.3750 us/op 1.2400 us/op 1.11
mainnet_e58758 - phase0 afterProcessEpoch 35.004 ms/op 32.808 ms/op 1.07
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.0011 ms/op 996.74 us/op 1.00
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5984 ms/op 1.6101 ms/op 0.99
altair processInactivityUpdates - 250000 normalcase 11.433 ms/op 12.857 ms/op 0.89
altair processInactivityUpdates - 250000 worstcase 10.934 ms/op 12.938 ms/op 0.85
phase0 processRegistryUpdates - 250000 normalcase 2.1140 us/op 2.3380 us/op 0.90
phase0 processRegistryUpdates - 250000 badcase_full_deposits 136.99 us/op 152.94 us/op 0.90
phase0 processRegistryUpdates - 250000 worstcase 0.5 67.654 ms/op 67.121 ms/op 1.01
altair processRewardsAndPenalties - 250000 normalcase 14.463 ms/op 17.045 ms/op 0.85
altair processRewardsAndPenalties - 250000 worstcase 14.374 ms/op 16.485 ms/op 0.87
phase0 getAttestationDeltas - 250000 normalcase 5.6184 ms/op 5.6672 ms/op 0.99
phase0 getAttestationDeltas - 250000 worstcase 6.5865 ms/op 5.5789 ms/op 1.18
phase0 processSlashings - 250000 worstcase 58.300 us/op 64.242 us/op 0.91
altair processSyncCommitteeUpdates - 250000 10.162 ms/op 10.109 ms/op 1.01
BeaconState.hashTreeRoot - No change 178.00 ns/op 170.00 ns/op 1.05
BeaconState.hashTreeRoot - 1 full validator 79.361 us/op 81.044 us/op 0.98
BeaconState.hashTreeRoot - 32 full validator 1.0579 ms/op 872.95 us/op 1.21
BeaconState.hashTreeRoot - 512 full validator 7.7594 ms/op 9.4269 ms/op 0.82
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 120.52 us/op 116.60 us/op 1.03
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.6646 ms/op 1.4977 ms/op 1.11
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 13.890 ms/op 23.621 ms/op 0.59
BeaconState.hashTreeRoot - 1 balances 73.738 us/op 82.861 us/op 0.89
BeaconState.hashTreeRoot - 32 balances 915.71 us/op 859.91 us/op 1.06
BeaconState.hashTreeRoot - 512 balances 4.9648 ms/op 7.9575 ms/op 0.62
BeaconState.hashTreeRoot - 250000 balances 121.95 ms/op 142.85 ms/op 0.85
aggregationBits - 2048 els - zipIndexesInBitList 18.778 us/op 21.283 us/op 0.88
regular array get 100000 times 22.171 us/op 23.169 us/op 0.96
wrappedArray get 100000 times 22.158 us/op 23.146 us/op 0.96
arrayWithProxy get 100000 times 9.5760 ms/op 10.127 ms/op 0.95
ssz.Root.equals 20.719 ns/op 21.535 ns/op 0.96
byteArrayEquals 20.461 ns/op 21.410 ns/op 0.96
Buffer.compare 8.4720 ns/op 8.8910 ns/op 0.95
processSlot - 1 slots 10.800 us/op 10.708 us/op 1.01
processSlot - 32 slots 2.4964 ms/op 2.0633 ms/op 1.21
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 5.2354 ms/op 6.0375 ms/op 0.87
getCommitteeAssignments - req 1 vs - 250000 vc 1.7113 ms/op 1.6773 ms/op 1.02
getCommitteeAssignments - req 100 vs - 250000 vc 3.4988 ms/op 3.4000 ms/op 1.03
getCommitteeAssignments - req 1000 vs - 250000 vc 3.7097 ms/op 3.6777 ms/op 1.01
findModifiedValidators - 10000 modified validators 721.18 ms/op 780.69 ms/op 0.92
findModifiedValidators - 1000 modified validators 414.87 ms/op 583.64 ms/op 0.71
findModifiedValidators - 100 modified validators 231.75 ms/op 380.44 ms/op 0.61
findModifiedValidators - 10 modified validators 156.60 ms/op 285.13 ms/op 0.55
findModifiedValidators - 1 modified validators 152.22 ms/op 179.12 ms/op 0.85
findModifiedValidators - no difference 140.48 ms/op 192.06 ms/op 0.73
migrate state 1500000 validators, 3400 modified, 2000 new 3.4467 s/op 3.3961 s/op 1.01
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 3.7600 ns/op 3.7400 ns/op 1.01
state getBlockRootAtSlot - 250000 vs - 7PWei 388.09 ns/op 405.51 ns/op 0.96
computeProposerIndex 100000 validators 1.3561 ms/op 1.3584 ms/op 1.00
getNextSyncCommitteeIndices 1000 validators 2.8744 ms/op 2.9458 ms/op 0.98
getNextSyncCommitteeIndices 10000 validators 25.325 ms/op 25.959 ms/op 0.98
getNextSyncCommitteeIndices 100000 validators 85.204 ms/op 90.959 ms/op 0.94
computeProposers - vc 250000 557.07 us/op 566.70 us/op 0.98
computeEpochShuffling - vc 250000 39.869 ms/op 39.700 ms/op 1.00
getNextSyncCommittee - vc 250000 9.4095 ms/op 10.082 ms/op 0.93
nodejs block root to RootHex using toHex 104.05 ns/op 96.697 ns/op 1.08
nodejs block root to RootHex using toRootHex 67.376 ns/op 62.513 ns/op 1.08
nodejs fromHex(blob) 839.73 us/op 827.41 us/op 1.01
nodejs fromHexInto(blob) 678.09 us/op 619.80 us/op 1.09
nodejs block root to RootHex using the deprecated toHexString 504.68 ns/op 506.98 ns/op 1.00
nodejs byteArrayEquals 32 bytes (block root) 25.841 ns/op 25.704 ns/op 1.01
nodejs byteArrayEquals 48 bytes (pubkey) 37.510 ns/op 37.317 ns/op 1.01
nodejs byteArrayEquals 96 bytes (signature) 40.435 ns/op 33.295 ns/op 1.21
nodejs byteArrayEquals 1024 bytes 45.008 ns/op 41.283 ns/op 1.09
nodejs byteArrayEquals 131072 bytes (blob) 1.7928 us/op 1.7403 us/op 1.03
browser block root to RootHex using toHex 146.82 ns/op 144.11 ns/op 1.02
browser block root to RootHex using toRootHex 132.06 ns/op 128.58 ns/op 1.03
browser fromHex(blob) 1.6895 ms/op 1.6287 ms/op 1.04
browser fromHexInto(blob) 601.07 us/op 622.43 us/op 0.97
browser block root to RootHex using the deprecated toHexString 309.20 ns/op 338.59 ns/op 0.91
browser byteArrayEquals 32 bytes (block root) 26.801 ns/op 27.613 ns/op 0.97
browser byteArrayEquals 48 bytes (pubkey) 37.633 ns/op 38.996 ns/op 0.97
browser byteArrayEquals 96 bytes (signature) 70.541 ns/op 73.209 ns/op 0.96
browser byteArrayEquals 1024 bytes 721.50 ns/op 747.69 ns/op 0.96
browser byteArrayEquals 131072 bytes (blob) 91.142 us/op 93.961 us/op 0.97

by benchmarkbot/action

@twoeths
twoeths marked this pull request as ready for review July 14, 2026 11:05
@twoeths
twoeths requested a review from a team as a code owner July 14, 2026 11:05
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.48%. Comparing base (242f99e) to head (6e4cd4e).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #9654      +/-   ##
============================================
- Coverage     52.49%   52.48%   -0.02%     
============================================
  Files           848      848              
  Lines         60485    60458      -27     
  Branches       4466     4459       -7     
============================================
- Hits          31754    31732      -22     
+ Misses        28670    28665       -5     
  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.

@twoeths
twoeths requested review from ensi321 and wemeetagain July 14, 2026 11:49
Comment thread packages/fork-choice/src/forkChoice/forkChoice.ts
Comment thread packages/fork-choice/src/forkChoice/forkChoice.ts Outdated
Comment thread packages/fork-choice/src/forkChoice/forkChoice.ts Outdated
Comment thread packages/fork-choice/src/protoArray/protoArray.ts
Comment thread packages/fork-choice/src/forkChoice/forkChoice.ts
@twoeths twoeths changed the title feat: implement forkchoice is_head_weak() feat: implement forkchoice is_head_weak() and is_parent_strong() Jul 22, 2026
@ensi321 ensi321 mentioned this pull request Jul 22, 2026
32 tasks
Comment thread packages/fork-choice/src/forkChoice/forkChoice.ts Outdated
@wemeetagain
wemeetagain merged commit bcf03e7 into unstable Jul 24, 2026
19 checks passed
@wemeetagain
wemeetagain deleted the te/is_head_weak branch July 24, 2026 16:37
ensi321 added a commit that referenced this pull request Jul 25, 2026
…ProposerBoost

is_head_weak() landed via #9654 with the exact gloas semantics (boost-excluded
attestation score + committee-scoped equivocator balance add-back), so the
weak-parent check can call it directly instead of approximating with raw
node.weight against the reorg threshold.

Also adapt findEquivocatingBlocks to the current VariantIndices layout via
getDefaultNodeIndex, and add the new ProtoBlock fields to test fixtures that
were added on unstable since the last merge.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@wemeetagain

Copy link
Copy Markdown
Member

🎉 This PR is included in v1.46.0 🎉

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.

7 participants