Skip to content

refactor: reorder payload status constants#9176

Open
nflaig wants to merge 2 commits intounstablefrom
nflaig/payload-status-reorder
Open

refactor: reorder payload status constants#9176
nflaig wants to merge 2 commits intounstablefrom
nflaig/payload-status-reorder

Conversation

@nflaig
Copy link
Copy Markdown
Member

@nflaig nflaig commented Apr 4, 2026

@nflaig nflaig requested a review from a team as a code owner April 4, 2026 12:28
Copy link
Copy Markdown

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

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: aa6c1bb31a

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/fork-choice/src/protoArray/interface.ts
Comment thread packages/fork-choice/src/protoArray/interface.ts
Copy link
Copy Markdown
Contributor

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

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 reorders the PayloadStatus enum and refactors the ProtoArray to use these enum values as indices for block variants, replacing hardcoded numeric values. A significant issue was noted where this reordering breaks the tie-breaker logic in getPayloadStatusTiebreaker, which depends on the specific numeric values of the enum to function correctly.

Comment thread packages/fork-choice/src/protoArray/interface.ts
@nflaig nflaig marked this pull request as draft April 4, 2026 12:47
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 4, 2026

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 5fe44bb Previous: f866249 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.3371 ms/op 893.05 us/op 1.50
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 40.666 us/op 38.415 us/op 1.06
BLS verify - blst 664.16 us/op 693.57 us/op 0.96
BLS verifyMultipleSignatures 3 - blst 1.3777 ms/op 1.3078 ms/op 1.05
BLS verifyMultipleSignatures 8 - blst 2.1999 ms/op 2.0628 ms/op 1.07
BLS verifyMultipleSignatures 32 - blst 6.9411 ms/op 6.8791 ms/op 1.01
BLS verifyMultipleSignatures 64 - blst 13.589 ms/op 12.540 ms/op 1.08
BLS verifyMultipleSignatures 128 - blst 26.239 ms/op 24.404 ms/op 1.08
BLS deserializing 10000 signatures 651.52 ms/op 624.69 ms/op 1.04
BLS deserializing 100000 signatures 6.3161 s/op 6.2284 s/op 1.01
BLS verifyMultipleSignatures - same message - 3 - blst 810.46 us/op 783.37 us/op 1.03
BLS verifyMultipleSignatures - same message - 8 - blst 939.75 us/op 809.42 us/op 1.16
BLS verifyMultipleSignatures - same message - 32 - blst 1.5156 ms/op 1.4841 ms/op 1.02
BLS verifyMultipleSignatures - same message - 64 - blst 2.4284 ms/op 2.2910 ms/op 1.06
BLS verifyMultipleSignatures - same message - 128 - blst 4.0303 ms/op 3.8881 ms/op 1.04
BLS aggregatePubkeys 32 - blst 17.352 us/op 17.248 us/op 1.01
BLS aggregatePubkeys 128 - blst 62.136 us/op 61.787 us/op 1.01
getSlashingsAndExits - default max 50.158 us/op 46.194 us/op 1.09
getSlashingsAndExits - 2k 369.66 us/op 341.61 us/op 1.08
proposeBlockBody type=full, size=empty 650.00 us/op 592.10 us/op 1.10
isKnown best case - 1 super set check 179.00 ns/op 183.00 ns/op 0.98
isKnown normal case - 2 super set checks 171.00 ns/op 191.00 ns/op 0.90
isKnown worse case - 16 super set checks 165.00 ns/op 184.00 ns/op 0.90
validate api signedAggregateAndProof - struct 1.5178 ms/op 1.4921 ms/op 1.02
validate gossip signedAggregateAndProof - struct 1.5158 ms/op 1.4835 ms/op 1.02
batch validate gossip attestation - vc 640000 - chunk 32 105.77 us/op 104.41 us/op 1.01
batch validate gossip attestation - vc 640000 - chunk 64 92.442 us/op 93.355 us/op 0.99
batch validate gossip attestation - vc 640000 - chunk 128 85.079 us/op 88.363 us/op 0.96
batch validate gossip attestation - vc 640000 - chunk 256 81.275 us/op 86.583 us/op 0.94
bytes32 toHexString 283.00 ns/op 302.00 ns/op 0.94
bytes32 Buffer.toString(hex) 172.00 ns/op 191.00 ns/op 0.90
bytes32 Buffer.toString(hex) from Uint8Array 257.00 ns/op 271.00 ns/op 0.95
bytes32 Buffer.toString(hex) + 0x 174.00 ns/op 193.00 ns/op 0.90
Return object 10000 times 0.20800 ns/op 0.21640 ns/op 0.96
Throw Error 10000 times 3.2570 us/op 3.3296 us/op 0.98
toHex 112.45 ns/op 107.60 ns/op 1.05
Buffer.from 104.20 ns/op 87.879 ns/op 1.19
shared Buffer 64.212 ns/op 59.493 ns/op 1.08
fastMsgIdFn sha256 / 200 bytes 1.4780 us/op 1.5030 us/op 0.98
fastMsgIdFn h32 xxhash / 200 bytes 156.00 ns/op 173.00 ns/op 0.90
fastMsgIdFn h64 xxhash / 200 bytes 196.00 ns/op 226.00 ns/op 0.87
fastMsgIdFn sha256 / 1000 bytes 4.7440 us/op 4.6950 us/op 1.01
fastMsgIdFn h32 xxhash / 1000 bytes 242.00 ns/op 261.00 ns/op 0.93
fastMsgIdFn h64 xxhash / 1000 bytes 242.00 ns/op 266.00 ns/op 0.91
fastMsgIdFn sha256 / 10000 bytes 41.879 us/op 41.541 us/op 1.01
fastMsgIdFn h32 xxhash / 10000 bytes 1.3000 us/op 1.2570 us/op 1.03
fastMsgIdFn h64 xxhash / 10000 bytes 847.00 ns/op 816.00 ns/op 1.04
send data - 1000 256B messages 3.9525 ms/op 4.2544 ms/op 0.93
send data - 1000 512B messages 4.1657 ms/op 4.4394 ms/op 0.94
send data - 1000 1024B messages 4.2139 ms/op 4.4547 ms/op 0.95
send data - 1000 1200B messages 4.3408 ms/op 5.0626 ms/op 0.86
send data - 1000 2048B messages 4.4605 ms/op 5.0141 ms/op 0.89
send data - 1000 4096B messages 5.3444 ms/op 5.7487 ms/op 0.93
send data - 1000 16384B messages 17.566 ms/op 25.322 ms/op 0.69
send data - 1000 65536B messages 142.65 ms/op 152.49 ms/op 0.94
enrSubnets - fastDeserialize 64 bits 732.00 ns/op 769.00 ns/op 0.95
enrSubnets - ssz BitVector 64 bits 258.00 ns/op 280.00 ns/op 0.92
enrSubnets - fastDeserialize 4 bits 100.00 ns/op 125.00 ns/op 0.80
enrSubnets - ssz BitVector 4 bits 259.00 ns/op 272.00 ns/op 0.95
prioritizePeers score -10:0 att 32-0.1 sync 2-0 204.70 us/op 203.27 us/op 1.01
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 244.48 us/op 235.94 us/op 1.04
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 353.53 us/op 337.67 us/op 1.05
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 595.52 us/op 607.70 us/op 0.98
prioritizePeers score 0:0 att 64-1 sync 4-1 683.50 us/op 693.53 us/op 0.99
array of 16000 items push then shift 1.3122 us/op 1.2611 us/op 1.04
LinkedList of 16000 items push then shift 6.7080 ns/op 7.2710 ns/op 0.92
array of 16000 items push then pop 64.598 ns/op 65.184 ns/op 0.99
LinkedList of 16000 items push then pop 5.8730 ns/op 5.7710 ns/op 1.02
array of 24000 items push then shift 1.9135 us/op 1.8202 us/op 1.05
LinkedList of 24000 items push then shift 6.4670 ns/op 6.7620 ns/op 0.96
array of 24000 items push then pop 93.983 ns/op 90.037 ns/op 1.04
LinkedList of 24000 items push then pop 5.9100 ns/op 5.7900 ns/op 1.02
intersect bitArray bitLen 8 4.6850 ns/op 4.5920 ns/op 1.02
intersect array and set length 8 29.557 ns/op 28.541 ns/op 1.04
intersect bitArray bitLen 128 23.714 ns/op 23.189 ns/op 1.02
intersect array and set length 128 496.28 ns/op 475.06 ns/op 1.04
bitArray.getTrueBitIndexes() bitLen 128 1.0480 us/op 1.0540 us/op 0.99
bitArray.getTrueBitIndexes() bitLen 248 1.7520 us/op 1.7290 us/op 1.01
bitArray.getTrueBitIndexes() bitLen 512 3.5340 us/op 3.4340 us/op 1.03
Full columns - reconstruct all 6 blobs 190.43 us/op 190.66 us/op 1.00
Full columns - reconstruct half of the blobs out of 6 65.347 us/op 73.470 us/op 0.89
Full columns - reconstruct single blob out of 6 35.396 us/op 31.208 us/op 1.13
Half columns - reconstruct all 6 blobs 378.88 ms/op 379.75 ms/op 1.00
Half columns - reconstruct half of the blobs out of 6 190.56 ms/op 191.08 ms/op 1.00
Half columns - reconstruct single blob out of 6 66.332 ms/op 68.134 ms/op 0.97
Full columns - reconstruct all 10 blobs 250.81 us/op 320.45 us/op 0.78
Full columns - reconstruct half of the blobs out of 10 207.28 us/op 133.19 us/op 1.56
Full columns - reconstruct single blob out of 10 69.713 us/op 31.830 us/op 2.19
Half columns - reconstruct all 10 blobs 625.68 ms/op 631.97 ms/op 0.99
Half columns - reconstruct half of the blobs out of 10 315.95 ms/op 318.45 ms/op 0.99
Half columns - reconstruct single blob out of 10 66.578 ms/op 70.081 ms/op 0.95
Full columns - reconstruct all 20 blobs 1.6112 ms/op 1.8523 ms/op 0.87
Full columns - reconstruct half of the blobs out of 20 222.16 us/op 228.53 us/op 0.97
Full columns - reconstruct single blob out of 20 30.888 us/op 29.403 us/op 1.05
Half columns - reconstruct all 20 blobs 1.2498 s/op 1.2149 s/op 1.03
Half columns - reconstruct half of the blobs out of 20 626.46 ms/op 610.80 ms/op 1.03
Half columns - reconstruct single blob out of 20 66.840 ms/op 66.591 ms/op 1.00
Set add up to 64 items then delete first 2.1963 us/op 1.9609 us/op 1.12
OrderedSet add up to 64 items then delete first 3.4276 us/op 3.1491 us/op 1.09
Set add up to 64 items then delete last 2.4251 us/op 2.1073 us/op 1.15
OrderedSet add up to 64 items then delete last 3.4475 us/op 3.1741 us/op 1.09
Set add up to 64 items then delete middle 2.2065 us/op 2.0189 us/op 1.09
OrderedSet add up to 64 items then delete middle 4.8804 us/op 4.4835 us/op 1.09
Set add up to 128 items then delete first 4.2447 us/op 4.0364 us/op 1.05
OrderedSet add up to 128 items then delete first 6.3140 us/op 6.0489 us/op 1.04
Set add up to 128 items then delete last 4.0570 us/op 3.7659 us/op 1.08
OrderedSet add up to 128 items then delete last 6.0867 us/op 5.5836 us/op 1.09
Set add up to 128 items then delete middle 4.0334 us/op 3.6755 us/op 1.10
OrderedSet add up to 128 items then delete middle 12.022 us/op 11.131 us/op 1.08
Set add up to 256 items then delete first 7.9255 us/op 7.5028 us/op 1.06
OrderedSet add up to 256 items then delete first 11.695 us/op 11.523 us/op 1.01
Set add up to 256 items then delete last 8.0007 us/op 7.4708 us/op 1.07
OrderedSet add up to 256 items then delete last 12.136 us/op 10.997 us/op 1.10
Set add up to 256 items then delete middle 7.9053 us/op 7.2479 us/op 1.09
OrderedSet add up to 256 items then delete middle 35.420 us/op 33.049 us/op 1.07
pass gossip attestations to forkchoice per slot 2.5424 ms/op 2.4734 ms/op 1.03
forkChoice updateHead vc 100000 bc 64 eq 0 440.12 us/op 369.65 us/op 1.19
forkChoice updateHead vc 600000 bc 64 eq 0 2.6347 ms/op 2.2074 ms/op 1.19
forkChoice updateHead vc 1000000 bc 64 eq 0 4.3405 ms/op 3.6922 ms/op 1.18
forkChoice updateHead vc 600000 bc 320 eq 0 2.6794 ms/op 2.2071 ms/op 1.21
forkChoice updateHead vc 600000 bc 1200 eq 0 2.6593 ms/op 2.2758 ms/op 1.17
forkChoice updateHead vc 600000 bc 7200 eq 0 2.9439 ms/op 2.5051 ms/op 1.18
forkChoice updateHead vc 600000 bc 64 eq 1000 3.2003 ms/op 2.7538 ms/op 1.16
forkChoice updateHead vc 600000 bc 64 eq 10000 3.2944 ms/op 2.9527 ms/op 1.12
forkChoice updateHead vc 600000 bc 64 eq 300000 8.9184 ms/op 7.1601 ms/op 1.25
computeDeltas 1400000 validators 0% inactive 13.445 ms/op 11.794 ms/op 1.14
computeDeltas 1400000 validators 10% inactive 12.533 ms/op 11.117 ms/op 1.13
computeDeltas 1400000 validators 20% inactive 11.660 ms/op 10.129 ms/op 1.15
computeDeltas 1400000 validators 50% inactive 8.5509 ms/op 7.8241 ms/op 1.09
computeDeltas 2100000 validators 0% inactive 20.208 ms/op 17.657 ms/op 1.14
computeDeltas 2100000 validators 10% inactive 18.783 ms/op 16.790 ms/op 1.12
computeDeltas 2100000 validators 20% inactive 17.262 ms/op 15.057 ms/op 1.15
computeDeltas 2100000 validators 50% inactive 10.417 ms/op 11.705 ms/op 0.89
altair processAttestation - 250000 vs - 7PWei normalcase 1.6744 ms/op 1.8455 ms/op 0.91
altair processAttestation - 250000 vs - 7PWei worstcase 2.4442 ms/op 2.5884 ms/op 0.94
altair processAttestation - setStatus - 1/6 committees join 96.657 us/op 93.820 us/op 1.03
altair processAttestation - setStatus - 1/3 committees join 199.81 us/op 191.04 us/op 1.05
altair processAttestation - setStatus - 1/2 committees join 283.10 us/op 270.37 us/op 1.05
altair processAttestation - setStatus - 2/3 committees join 362.40 us/op 351.93 us/op 1.03
altair processAttestation - setStatus - 4/5 committees join 507.90 us/op 481.77 us/op 1.05
altair processAttestation - setStatus - 100% committees join 586.54 us/op 572.82 us/op 1.02
altair processBlock - 250000 vs - 7PWei normalcase 2.8384 ms/op 3.7840 ms/op 0.75
altair processBlock - 250000 vs - 7PWei normalcase hashState 14.264 ms/op 14.451 ms/op 0.99
altair processBlock - 250000 vs - 7PWei worstcase 18.298 ms/op 20.824 ms/op 0.88
altair processBlock - 250000 vs - 7PWei worstcase hashState 38.928 ms/op 40.204 ms/op 0.97
phase0 processBlock - 250000 vs - 7PWei normalcase 1.3047 ms/op 1.5243 ms/op 0.86
phase0 processBlock - 250000 vs - 7PWei worstcase 16.877 ms/op 18.888 ms/op 0.89
altair processEth1Data - 250000 vs - 7PWei normalcase 301.57 us/op 284.17 us/op 1.06
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:16 4.8640 us/op 4.0810 us/op 1.19
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:220 29.329 us/op 20.656 us/op 1.42
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:43 10.707 us/op 8.0080 us/op 1.34
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:19 6.9280 us/op 3.9420 us/op 1.76
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1021 100.82 us/op 103.48 us/op 0.97
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11778 1.3514 ms/op 1.4054 ms/op 0.96
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.7996 ms/op 1.7933 ms/op 1.00
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.7946 ms/op 1.7805 ms/op 1.01
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.6528 ms/op 4.8461 ms/op 0.75
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.0340 ms/op 2.3810 ms/op 0.85
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.0154 ms/op 4.3870 ms/op 0.92
Tree 40 250000 create 309.10 ms/op 420.49 ms/op 0.74
Tree 40 250000 get(125000) 99.461 ns/op 92.734 ns/op 1.07
Tree 40 250000 set(125000) 1.0586 us/op 1.1302 us/op 0.94
Tree 40 250000 toArray() 9.1291 ms/op 22.570 ms/op 0.40
Tree 40 250000 iterate all - toArray() + loop 9.2670 ms/op 25.351 ms/op 0.37
Tree 40 250000 iterate all - get(i) 33.967 ms/op 43.767 ms/op 0.78
Array 250000 create 1.9476 ms/op 2.5750 ms/op 0.76
Array 250000 clone - spread 622.43 us/op 841.12 us/op 0.74
Array 250000 get(125000) 0.29300 ns/op 0.29500 ns/op 0.99
Array 250000 set(125000) 0.29500 ns/op 0.29800 ns/op 0.99
Array 250000 iterate all - loop 55.806 us/op 58.260 us/op 0.96
phase0 afterProcessEpoch - 250000 vs - 7PWei 46.017 ms/op 42.281 ms/op 1.09
Array.fill - length 1000000 2.2451 ms/op 6.6628 ms/op 0.34
Array push - length 1000000 7.4821 ms/op 13.797 ms/op 0.54
Array.get 0.20134 ns/op 0.20772 ns/op 0.97
Uint8Array.get 0.23576 ns/op 0.23314 ns/op 1.01
phase0 beforeProcessEpoch - 250000 vs - 7PWei 12.507 ms/op 22.844 ms/op 0.55
altair processEpoch - mainnet_e81889 233.34 ms/op 297.57 ms/op 0.78
mainnet_e81889 - altair beforeProcessEpoch 14.118 ms/op 21.744 ms/op 0.65
mainnet_e81889 - altair processJustificationAndFinalization 4.7970 us/op 6.7930 us/op 0.71
mainnet_e81889 - altair processInactivityUpdates 3.5191 ms/op 5.3338 ms/op 0.66
mainnet_e81889 - altair processRewardsAndPenalties 16.357 ms/op 20.125 ms/op 0.81
mainnet_e81889 - altair processRegistryUpdates 522.00 ns/op 574.00 ns/op 0.91
mainnet_e81889 - altair processSlashings 132.00 ns/op 155.00 ns/op 0.85
mainnet_e81889 - altair processEth1DataReset 130.00 ns/op 156.00 ns/op 0.83
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.6720 ms/op 5.4794 ms/op 0.31
mainnet_e81889 - altair processSlashingsReset 682.00 ns/op 725.00 ns/op 0.94
mainnet_e81889 - altair processRandaoMixesReset 995.00 ns/op 1.4590 us/op 0.68
mainnet_e81889 - altair processHistoricalRootsUpdate 133.00 ns/op 160.00 ns/op 0.83
mainnet_e81889 - altair processParticipationFlagUpdates 419.00 ns/op 498.00 ns/op 0.84
mainnet_e81889 - altair processSyncCommitteeUpdates 112.00 ns/op 127.00 ns/op 0.88
mainnet_e81889 - altair afterProcessEpoch 41.678 ms/op 41.846 ms/op 1.00
capella processEpoch - mainnet_e217614 750.93 ms/op 854.81 ms/op 0.88
mainnet_e217614 - capella beforeProcessEpoch 58.942 ms/op 64.235 ms/op 0.92
mainnet_e217614 - capella processJustificationAndFinalization 5.3670 us/op 6.6550 us/op 0.81
mainnet_e217614 - capella processInactivityUpdates 11.332 ms/op 17.545 ms/op 0.65
mainnet_e217614 - capella processRewardsAndPenalties 85.451 ms/op 97.715 ms/op 0.87
mainnet_e217614 - capella processRegistryUpdates 4.5490 us/op 4.4960 us/op 1.01
mainnet_e217614 - capella processSlashings 131.00 ns/op 154.00 ns/op 0.85
mainnet_e217614 - capella processEth1DataReset 133.00 ns/op 153.00 ns/op 0.87
mainnet_e217614 - capella processEffectiveBalanceUpdates 5.1285 ms/op 19.076 ms/op 0.27
mainnet_e217614 - capella processSlashingsReset 691.00 ns/op 706.00 ns/op 0.98
mainnet_e217614 - capella processRandaoMixesReset 1.0530 us/op 1.4400 us/op 0.73
mainnet_e217614 - capella processHistoricalRootsUpdate 127.00 ns/op 151.00 ns/op 0.84
mainnet_e217614 - capella processParticipationFlagUpdates 416.00 ns/op 470.00 ns/op 0.89
mainnet_e217614 - capella afterProcessEpoch 106.17 ms/op 107.26 ms/op 0.99
phase0 processEpoch - mainnet_e58758 244.90 ms/op 327.55 ms/op 0.75
mainnet_e58758 - phase0 beforeProcessEpoch 47.930 ms/op 71.564 ms/op 0.67
mainnet_e58758 - phase0 processJustificationAndFinalization 5.3320 us/op 6.6420 us/op 0.80
mainnet_e58758 - phase0 processRewardsAndPenalties 14.956 ms/op 16.608 ms/op 0.90
mainnet_e58758 - phase0 processRegistryUpdates 2.2810 us/op 2.2460 us/op 1.02
mainnet_e58758 - phase0 processSlashings 124.00 ns/op 219.00 ns/op 0.57
mainnet_e58758 - phase0 processEth1DataReset 130.00 ns/op 150.00 ns/op 0.87
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 827.77 us/op 821.01 us/op 1.01
mainnet_e58758 - phase0 processSlashingsReset 852.00 ns/op 918.00 ns/op 0.93
mainnet_e58758 - phase0 processRandaoMixesReset 1.1350 us/op 1.3440 us/op 0.84
mainnet_e58758 - phase0 processHistoricalRootsUpdate 133.00 ns/op 154.00 ns/op 0.86
mainnet_e58758 - phase0 processParticipationRecordUpdates 1.1050 us/op 1.2020 us/op 0.92
mainnet_e58758 - phase0 afterProcessEpoch 34.114 ms/op 32.482 ms/op 1.05
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.0956 ms/op 1.5169 ms/op 0.72
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5912 ms/op 1.8855 ms/op 0.84
altair processInactivityUpdates - 250000 normalcase 10.645 ms/op 11.266 ms/op 0.94
altair processInactivityUpdates - 250000 worstcase 10.639 ms/op 11.214 ms/op 0.95
phase0 processRegistryUpdates - 250000 normalcase 2.1590 us/op 2.4640 us/op 0.88
phase0 processRegistryUpdates - 250000 badcase_full_deposits 147.40 us/op 138.70 us/op 1.06
phase0 processRegistryUpdates - 250000 worstcase 0.5 60.638 ms/op 58.342 ms/op 1.04
altair processRewardsAndPenalties - 250000 normalcase 13.116 ms/op 15.721 ms/op 0.83
altair processRewardsAndPenalties - 250000 worstcase 13.058 ms/op 15.370 ms/op 0.85
phase0 getAttestationDeltas - 250000 normalcase 12.749 ms/op 5.1237 ms/op 2.49
phase0 getAttestationDeltas - 250000 worstcase 5.5117 ms/op 5.3249 ms/op 1.04
phase0 processSlashings - 250000 worstcase 61.910 us/op 59.488 us/op 1.04
altair processSyncCommitteeUpdates - 250000 10.174 ms/op 10.173 ms/op 1.00
BeaconState.hashTreeRoot - No change 182.00 ns/op 186.00 ns/op 0.98
BeaconState.hashTreeRoot - 1 full validator 68.005 us/op 76.174 us/op 0.89
BeaconState.hashTreeRoot - 32 full validator 687.37 us/op 847.60 us/op 0.81
BeaconState.hashTreeRoot - 512 full validator 6.2326 ms/op 7.4864 ms/op 0.83
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 73.100 us/op 96.901 us/op 0.75
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.0939 ms/op 1.4030 ms/op 0.78
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 13.654 ms/op 15.659 ms/op 0.87
BeaconState.hashTreeRoot - 1 balances 57.167 us/op 75.997 us/op 0.75
BeaconState.hashTreeRoot - 32 balances 598.06 us/op 701.90 us/op 0.85
BeaconState.hashTreeRoot - 512 balances 4.9110 ms/op 5.7724 ms/op 0.85
BeaconState.hashTreeRoot - 250000 balances 112.79 ms/op 136.43 ms/op 0.83
aggregationBits - 2048 els - zipIndexesInBitList 19.467 us/op 19.528 us/op 1.00
regular array get 100000 times 22.977 us/op 22.288 us/op 1.03
wrappedArray get 100000 times 22.970 us/op 22.208 us/op 1.03
arrayWithProxy get 100000 times 10.541 ms/op 9.3311 ms/op 1.13
ssz.Root.equals 21.553 ns/op 20.653 ns/op 1.04
byteArrayEquals 21.390 ns/op 20.420 ns/op 1.05
Buffer.compare 8.8880 ns/op 8.4650 ns/op 1.05
processSlot - 1 slots 8.1590 us/op 8.6080 us/op 0.95
processSlot - 32 slots 1.6312 ms/op 1.7962 ms/op 0.91
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 2.9613 ms/op 5.6614 ms/op 0.52
getCommitteeAssignments - req 1 vs - 250000 vc 1.6640 ms/op 1.6177 ms/op 1.03
getCommitteeAssignments - req 100 vs - 250000 vc 3.3957 ms/op 3.3229 ms/op 1.02
getCommitteeAssignments - req 1000 vs - 250000 vc 3.6353 ms/op 3.5965 ms/op 1.01
findModifiedValidators - 10000 modified validators 732.65 ms/op 627.39 ms/op 1.17
findModifiedValidators - 1000 modified validators 405.00 ms/op 447.92 ms/op 0.90
findModifiedValidators - 100 modified validators 281.11 ms/op 295.70 ms/op 0.95
findModifiedValidators - 10 modified validators 229.91 ms/op 221.11 ms/op 1.04
findModifiedValidators - 1 modified validators 178.94 ms/op 158.10 ms/op 1.13
findModifiedValidators - no difference 171.14 ms/op 154.94 ms/op 1.10
migrate state 1500000 validators, 3400 modified, 2000 new 2.6726 s/op 2.9887 s/op 0.89
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 3.7000 ns/op 3.5600 ns/op 1.04
state getBlockRootAtSlot - 250000 vs - 7PWei 273.11 ns/op 361.19 ns/op 0.76
computeProposerIndex 100000 validators 1.3058 ms/op 1.2896 ms/op 1.01
getNextSyncCommitteeIndices 1000 validators 2.8571 ms/op 2.7291 ms/op 1.05
getNextSyncCommitteeIndices 10000 validators 25.025 ms/op 24.165 ms/op 1.04
getNextSyncCommitteeIndices 100000 validators 86.413 ms/op 83.871 ms/op 1.03
computeProposers - vc 250000 541.22 us/op 527.49 us/op 1.03
computeEpochShuffling - vc 250000 38.380 ms/op 38.289 ms/op 1.00
getNextSyncCommittee - vc 250000 9.3845 ms/op 9.4313 ms/op 1.00
nodejs block root to RootHex using toHex 122.07 ns/op 104.18 ns/op 1.17
nodejs block root to RootHex using toRootHex 76.531 ns/op 65.775 ns/op 1.16
nodejs fromHex(blob) 723.51 us/op 700.82 us/op 1.03
nodejs fromHexInto(blob) 643.35 us/op 600.69 us/op 1.07
nodejs block root to RootHex using the deprecated toHexString 512.93 ns/op 443.78 ns/op 1.16
nodejs byteArrayEquals 32 bytes (block root) 26.196 ns/op 24.682 ns/op 1.06
nodejs byteArrayEquals 48 bytes (pubkey) 37.982 ns/op 35.757 ns/op 1.06
nodejs byteArrayEquals 96 bytes (signature) 36.945 ns/op 31.083 ns/op 1.19
nodejs byteArrayEquals 1024 bytes 42.776 ns/op 36.856 ns/op 1.16
nodejs byteArrayEquals 131072 bytes (blob) 1.7656 us/op 1.6818 us/op 1.05
browser block root to RootHex using toHex 146.25 ns/op 136.91 ns/op 1.07
browser block root to RootHex using toRootHex 131.10 ns/op 124.08 ns/op 1.06
browser fromHex(blob) 1.5527 ms/op 1.4550 ms/op 1.07
browser fromHexInto(blob) 658.99 us/op 598.68 us/op 1.10
browser block root to RootHex using the deprecated toHexString 350.96 ns/op 440.68 ns/op 0.80
browser byteArrayEquals 32 bytes (block root) 27.503 ns/op 26.756 ns/op 1.03
browser byteArrayEquals 48 bytes (pubkey) 38.770 ns/op 37.511 ns/op 1.03
browser byteArrayEquals 96 bytes (signature) 72.734 ns/op 70.408 ns/op 1.03
browser byteArrayEquals 1024 bytes 740.27 ns/op 724.13 ns/op 1.02
browser byteArrayEquals 131072 bytes (blob) 93.326 us/op 91.694 us/op 1.02

by benchmarkbot/action

@nflaig nflaig marked this pull request as ready for review April 4, 2026 13:31
Copy link
Copy Markdown
Member

@matthewkeil matthewkeil left a comment

Choose a reason for hiding this comment

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

Mostly its the comments. There were a lot of, what feel like, important comments that were updated/deleted/added in this PR. Maybe put them in their own PR or easier can just change the name of the PR to add that scope so these comment changes don't get buried in here.

Comment on lines +44 to +46
EMPTY = 0,
FULL = 1,
PENDING = 2,
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.

I tend to prefer PascalCase for these but not a hill I'm willing to die on

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.

these are spec constants, I'd rather keep them as is

| `PAYLOAD_STATUS_EMPTY`               | `PayloadStatus(0)`      |
| `PAYLOAD_STATUS_FULL`                | `PayloadStatus(1)`      |
| `PAYLOAD_STATUS_PENDING`             | `PayloadStatus(2)`      |

we just defined them as a single enum

* For PENDING or not-previous-slot: returns node.payloadStatus
* For EMPTY/FULL from slot n-1: returns hardcoded tiebreaker values per spec
* - EMPTY → 1, FULL+extend → 2, FULL+!extend → 0
*
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.

This comment change seems important and non-relevant to the PR. Same with the comment on L#949 and L#954-L#955

Copy link
Copy Markdown
Member Author

@nflaig nflaig Apr 6, 2026

Choose a reason for hiding this comment

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

yeah this is strange I agree, it seems like the tiebreaker uses different values, maybe @ensi321 can take a look at this, it's bit strange

I think the constant values for EMPTY, PENDING, FULL, were initially chosen so they match the tiebreaker, but now they no longer do

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.

Yes, they were chosen because they are in lexicographical order for tiebreaker. Now we change it to be aligned with data.index value.

Copy link
Copy Markdown
Contributor

@ensi321 ensi321 Apr 9, 2026

Choose a reason for hiding this comment

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

EMPTY → 1, FULL+extend → 2, FULL+!extend → 0

I think this comment is too detailed and can cause a lot overthinking.

Just think about 0 < 1 < 2 when comparing two nodes.

1 means EMPTY
2 means we prefer this over EMPTY because should_extend_payload is true
0 means ineligible for comparison. For example the node is PENDING, or the node's slot is outside of tiebreaker comparison window (too old or too new).

These numbers are not 1:1 mapped to PayloadStatus

// Spec: return 1 for EMPTY, 2 for FULL+extend, 0 for FULL+!extend
if (node.payloadStatus === PayloadStatus.EMPTY) {
return PayloadStatus.EMPTY;
return 1;
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.

Feels weird to not be returning the enum here when the value will be the number at runtime. Same with line L#960

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.

this.indices.set(block.blockRoot, [pendingIndex, emptyIndex]);
// Store variants indexed by PayloadStatus enum values
// [EMPTY=0, FULL=1(undefined), PENDING=2] - FULL set when payload arrives
this.indices.set(block.blockRoot, [emptyIndex, undefined, pendingIndex]);
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.

what if the spec changes the constant again?
maybe create an array of size 3 and set by constant instead

variants[EMPTY] = emptyIndex;
variants[PENDING] = pendingIndex;

@wemeetagain wemeetagain added the spec-gloas Issues targeting the Glamsterdam spec version label Apr 21, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.53%. Comparing base (f866249) to head (352cdf2).
⚠️ Report is 31 commits behind head on unstable.

Additional details and impacted files
@@            Coverage Diff            @@
##           unstable    #9176   +/-   ##
=========================================
  Coverage     52.53%   52.53%           
=========================================
  Files           848      848           
  Lines         61429    61429           
  Branches       4528     4528           
=========================================
  Hits          32270    32270           
  Misses        29094    29094           
  Partials         65       65           
🚀 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.

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

Labels

spec-gloas Issues targeting the Glamsterdam spec version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants