Skip to content

feat: add cached PTC window to the state#9211

Merged
wemeetagain merged 16 commits intounstablefrom
nflaig/alpha4-spec-4979
Apr 21, 2026
Merged

feat: add cached PTC window to the state#9211
wemeetagain merged 16 commits intounstablefrom
nflaig/alpha4-spec-4979

Conversation

@nflaig
Copy link
Copy Markdown
Member

@nflaig nflaig commented Apr 13, 2026

This implements minimal changes to pass alpha.4 spec tests

  • adds ptc_window to state based on #4979
  • bump spec to v1.7.0-alpha.4
  • update ethspecify
  • misc changes to pass spec tests

NOTE: this does not implement any other changes from alpha.4 besides ethereum/consensus-specs#4979

@nflaig nflaig requested a review from a team as a code owner April 13, 2026 15:26
Comment thread packages/beacon-node/test/spec/presets/sanity.test.ts Outdated
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 updates the implementation to align with Ethereum consensus-specs v1.7.0-alpha.4, primarily focusing on the introduction and management of the Payload Timeliness Committee (PTC) window for the Gloas fork. Key changes include the addition of the ptcWindow field to the BeaconState, the implementation of logic to initialize and rotate this window during epoch transitions, and updates to the EpochCache to support PTC lookups for the previous, current, and next epochs. Feedback focuses on potential performance optimizations regarding the use of toValue() on large SSZ views during PTC window processing.

Comment thread packages/state-transition/src/util/gloas.ts Outdated
Comment thread packages/state-transition/src/util/gloas.ts Outdated
Comment thread packages/beacon-node/test/spec/utils/specTestIterator.ts Outdated
Comment thread packages/state-transition/src/util/genesis.ts
Comment thread packages/state-transition/src/util/gloas.ts
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: 27a2075434

ℹ️ 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/state-transition/src/util/genesis.ts Outdated
Comment thread packages/state-transition/src/cache/epochCache.ts
Comment thread packages/state-transition/src/util/gloas.ts Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 13, 2026

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 5d6a71b Previous: 9fa9f08 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.2536 ms/op 929.91 us/op 1.35
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 40.041 us/op 41.543 us/op 0.96
BLS verify - blst 722.94 us/op 751.11 us/op 0.96
BLS verifyMultipleSignatures 3 - blst 1.2968 ms/op 1.3677 ms/op 0.95
BLS verifyMultipleSignatures 8 - blst 2.0610 ms/op 2.2017 ms/op 0.94
BLS verifyMultipleSignatures 32 - blst 6.5662 ms/op 7.0473 ms/op 0.93
BLS verifyMultipleSignatures 64 - blst 12.671 ms/op 13.393 ms/op 0.95
BLS verifyMultipleSignatures 128 - blst 25.035 ms/op 25.969 ms/op 0.96
BLS deserializing 10000 signatures 632.32 ms/op 650.84 ms/op 0.97
BLS deserializing 100000 signatures 6.3052 s/op 6.3681 s/op 0.99
BLS verifyMultipleSignatures - same message - 3 - blst 735.35 us/op 829.19 us/op 0.89
BLS verifyMultipleSignatures - same message - 8 - blst 913.97 us/op 957.32 us/op 0.95
BLS verifyMultipleSignatures - same message - 32 - blst 1.4997 ms/op 1.5721 ms/op 0.95
BLS verifyMultipleSignatures - same message - 64 - blst 2.3310 ms/op 2.3808 ms/op 0.98
BLS verifyMultipleSignatures - same message - 128 - blst 3.9523 ms/op 4.0055 ms/op 0.99
BLS aggregatePubkeys 32 - blst 17.188 us/op 17.903 us/op 0.96
BLS aggregatePubkeys 128 - blst 61.903 us/op 63.824 us/op 0.97
getSlashingsAndExits - default max 64.663 us/op 46.958 us/op 1.38
getSlashingsAndExits - 2k 350.10 us/op 329.96 us/op 1.06
proposeBlockBody type=full, size=empty 595.99 us/op 698.68 us/op 0.85
isKnown best case - 1 super set check 167.00 ns/op 170.00 ns/op 0.98
isKnown normal case - 2 super set checks 173.00 ns/op 164.00 ns/op 1.05
isKnown worse case - 16 super set checks 167.00 ns/op 166.00 ns/op 1.01
validate api signedAggregateAndProof - struct 1.4432 ms/op 1.5420 ms/op 0.94
validate gossip signedAggregateAndProof - struct 1.4369 ms/op 1.5316 ms/op 0.94
batch validate gossip attestation - vc 640000 - chunk 32 103.49 us/op 105.73 us/op 0.98
batch validate gossip attestation - vc 640000 - chunk 64 91.067 us/op 92.963 us/op 0.98
batch validate gossip attestation - vc 640000 - chunk 128 85.736 us/op 86.012 us/op 1.00
batch validate gossip attestation - vc 640000 - chunk 256 85.001 us/op 82.120 us/op 1.04
bytes32 toHexString 294.00 ns/op 308.00 ns/op 0.95
bytes32 Buffer.toString(hex) 174.00 ns/op 174.00 ns/op 1.00
bytes32 Buffer.toString(hex) from Uint8Array 233.00 ns/op 240.00 ns/op 0.97
bytes32 Buffer.toString(hex) + 0x 175.00 ns/op 173.00 ns/op 1.01
Return object 10000 times 0.20680 ns/op 0.21010 ns/op 0.98
Throw Error 10000 times 3.2071 us/op 3.2741 us/op 0.98
toHex 93.137 ns/op 97.173 ns/op 0.96
Buffer.from 88.930 ns/op 88.814 ns/op 1.00
shared Buffer 60.778 ns/op 60.318 ns/op 1.01
fastMsgIdFn sha256 / 200 bytes 1.5230 us/op 1.5290 us/op 1.00
fastMsgIdFn h32 xxhash / 200 bytes 155.00 ns/op 152.00 ns/op 1.02
fastMsgIdFn h64 xxhash / 200 bytes 206.00 ns/op 205.00 ns/op 1.00
fastMsgIdFn sha256 / 1000 bytes 4.8090 us/op 5.0310 us/op 0.96
fastMsgIdFn h32 xxhash / 1000 bytes 251.00 ns/op 242.00 ns/op 1.04
fastMsgIdFn h64 xxhash / 1000 bytes 256.00 ns/op 251.00 ns/op 1.02
fastMsgIdFn sha256 / 10000 bytes 42.420 us/op 44.907 us/op 0.94
fastMsgIdFn h32 xxhash / 10000 bytes 1.3010 us/op 1.2620 us/op 1.03
fastMsgIdFn h64 xxhash / 10000 bytes 845.00 ns/op 816.00 ns/op 1.04
send data - 1000 256B messages 5.1010 ms/op 3.9097 ms/op 1.30
send data - 1000 512B messages 5.0666 ms/op 3.9822 ms/op 1.27
send data - 1000 1024B messages 5.7687 ms/op 4.1178 ms/op 1.40
send data - 1000 1200B messages 5.6899 ms/op 4.3661 ms/op 1.30
send data - 1000 2048B messages 5.9493 ms/op 4.6082 ms/op 1.29
send data - 1000 4096B messages 5.9047 ms/op 5.2712 ms/op 1.12
send data - 1000 16384B messages 19.018 ms/op 12.759 ms/op 1.49
send data - 1000 65536B messages 120.33 ms/op 241.95 ms/op 0.50
enrSubnets - fastDeserialize 64 bits 737.00 ns/op 744.00 ns/op 0.99
enrSubnets - ssz BitVector 64 bits 247.00 ns/op 261.00 ns/op 0.95
enrSubnets - fastDeserialize 4 bits 97.000 ns/op 97.000 ns/op 1.00
enrSubnets - ssz BitVector 4 bits 252.00 ns/op 266.00 ns/op 0.95
prioritizePeers score -10:0 att 32-0.1 sync 2-0 196.92 us/op 206.73 us/op 0.95
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 245.70 us/op 246.62 us/op 1.00
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 337.76 us/op 343.29 us/op 0.98
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 581.81 us/op 603.17 us/op 0.96
prioritizePeers score 0:0 att 64-1 sync 4-1 682.49 us/op 700.08 us/op 0.97
array of 16000 items push then shift 1.1969 us/op 1.2808 us/op 0.93
LinkedList of 16000 items push then shift 7.3110 ns/op 6.6570 ns/op 1.10
array of 16000 items push then pop 64.936 ns/op 63.167 ns/op 1.03
LinkedList of 16000 items push then pop 5.7430 ns/op 5.9480 ns/op 0.97
array of 24000 items push then shift 1.7864 us/op 1.8974 us/op 0.94
LinkedList of 24000 items push then shift 7.3200 ns/op 6.3350 ns/op 1.16
array of 24000 items push then pop 92.907 ns/op 90.224 ns/op 1.03
LinkedList of 24000 items push then pop 5.9210 ns/op 5.9460 ns/op 1.00
intersect bitArray bitLen 8 4.6040 ns/op 4.7200 ns/op 0.98
intersect array and set length 8 28.245 ns/op 31.745 ns/op 0.89
intersect bitArray bitLen 128 24.145 ns/op 24.707 ns/op 0.98
intersect array and set length 128 474.15 ns/op 514.42 ns/op 0.92
bitArray.getTrueBitIndexes() bitLen 128 1.0790 us/op 1.0150 us/op 1.06
bitArray.getTrueBitIndexes() bitLen 248 1.9430 us/op 1.7150 us/op 1.13
bitArray.getTrueBitIndexes() bitLen 512 3.9490 us/op 3.4940 us/op 1.13
Full columns - reconstruct all 6 blobs 295.32 us/op 115.81 us/op 2.55
Full columns - reconstruct half of the blobs out of 6 97.956 us/op 69.165 us/op 1.42
Full columns - reconstruct single blob out of 6 32.891 us/op 34.355 us/op 0.96
Half columns - reconstruct all 6 blobs 377.32 ms/op 397.59 ms/op 0.95
Half columns - reconstruct half of the blobs out of 6 187.11 ms/op 200.23 ms/op 0.93
Half columns - reconstruct single blob out of 6 66.436 ms/op 71.367 ms/op 0.93
Full columns - reconstruct all 10 blobs 282.86 us/op 191.74 us/op 1.48
Full columns - reconstruct half of the blobs out of 10 157.47 us/op 148.38 us/op 1.06
Full columns - reconstruct single blob out of 10 34.110 us/op 31.647 us/op 1.08
Half columns - reconstruct all 10 blobs 620.06 ms/op 643.80 ms/op 0.96
Half columns - reconstruct half of the blobs out of 10 313.47 ms/op 320.68 ms/op 0.98
Half columns - reconstruct single blob out of 10 66.776 ms/op 66.557 ms/op 1.00
Full columns - reconstruct all 20 blobs 584.86 us/op 517.30 us/op 1.13
Full columns - reconstruct half of the blobs out of 20 253.03 us/op 267.44 us/op 0.95
Full columns - reconstruct single blob out of 20 57.575 us/op 31.022 us/op 1.86
Half columns - reconstruct all 20 blobs 1.2462 s/op 1.2639 s/op 0.99
Half columns - reconstruct half of the blobs out of 20 627.78 ms/op 644.43 ms/op 0.97
Half columns - reconstruct single blob out of 20 68.350 ms/op 70.039 ms/op 0.98
Set add up to 64 items then delete first 2.0744 us/op 2.1325 us/op 0.97
OrderedSet add up to 64 items then delete first 3.3491 us/op 3.3934 us/op 0.99
Set add up to 64 items then delete last 2.0580 us/op 2.2001 us/op 0.94
OrderedSet add up to 64 items then delete last 3.4433 us/op 3.5039 us/op 0.98
Set add up to 64 items then delete middle 2.1260 us/op 2.2285 us/op 0.95
OrderedSet add up to 64 items then delete middle 4.6181 us/op 4.9760 us/op 0.93
Set add up to 128 items then delete first 4.7462 us/op 4.3431 us/op 1.09
OrderedSet add up to 128 items then delete first 6.5406 us/op 6.4957 us/op 1.01
Set add up to 128 items then delete last 4.1128 us/op 4.1522 us/op 0.99
OrderedSet add up to 128 items then delete last 6.4608 us/op 6.2591 us/op 1.03
Set add up to 128 items then delete middle 4.2339 us/op 4.0712 us/op 1.04
OrderedSet add up to 128 items then delete middle 13.080 us/op 12.147 us/op 1.08
Set add up to 256 items then delete first 9.5620 us/op 8.0633 us/op 1.19
OrderedSet add up to 256 items then delete first 14.311 us/op 12.032 us/op 1.19
Set add up to 256 items then delete last 7.7608 us/op 7.9750 us/op 0.97
OrderedSet add up to 256 items then delete last 13.231 us/op 12.320 us/op 1.07
Set add up to 256 items then delete middle 8.8177 us/op 7.9579 us/op 1.11
OrderedSet add up to 256 items then delete middle 39.670 us/op 35.906 us/op 1.10
pass gossip attestations to forkchoice per slot 2.5996 ms/op 2.5087 ms/op 1.04
forkChoice updateHead vc 100000 bc 64 eq 0 386.48 us/op 473.57 us/op 0.82
forkChoice updateHead vc 600000 bc 64 eq 0 2.3074 ms/op 2.9030 ms/op 0.79
forkChoice updateHead vc 1000000 bc 64 eq 0 3.8310 ms/op 4.7755 ms/op 0.80
forkChoice updateHead vc 600000 bc 320 eq 0 2.3439 ms/op 2.8800 ms/op 0.81
forkChoice updateHead vc 600000 bc 1200 eq 0 2.3648 ms/op 2.9014 ms/op 0.82
forkChoice updateHead vc 600000 bc 7200 eq 0 3.2922 ms/op 3.2128 ms/op 1.02
forkChoice updateHead vc 600000 bc 64 eq 1000 2.8826 ms/op 3.5144 ms/op 0.82
forkChoice updateHead vc 600000 bc 64 eq 10000 2.9944 ms/op 3.5836 ms/op 0.84
forkChoice updateHead vc 600000 bc 64 eq 300000 7.5074 ms/op 8.2167 ms/op 0.91
computeDeltas 1400000 validators 0% inactive 12.462 ms/op 11.374 ms/op 1.10
computeDeltas 1400000 validators 10% inactive 11.593 ms/op 15.494 ms/op 0.75
computeDeltas 1400000 validators 20% inactive 10.558 ms/op 9.3260 ms/op 1.13
computeDeltas 1400000 validators 50% inactive 8.1821 ms/op 7.1456 ms/op 1.15
computeDeltas 2100000 validators 0% inactive 18.304 ms/op 17.150 ms/op 1.07
computeDeltas 2100000 validators 10% inactive 17.550 ms/op 16.002 ms/op 1.10
computeDeltas 2100000 validators 20% inactive 15.655 ms/op 14.353 ms/op 1.09
computeDeltas 2100000 validators 50% inactive 12.046 ms/op 10.629 ms/op 1.13
altair processAttestation - 250000 vs - 7PWei normalcase 2.3607 ms/op 1.7701 ms/op 1.33
altair processAttestation - 250000 vs - 7PWei worstcase 3.2095 ms/op 2.4469 ms/op 1.31
altair processAttestation - setStatus - 1/6 committees join 101.06 us/op 112.56 us/op 0.90
altair processAttestation - setStatus - 1/3 committees join 201.27 us/op 201.24 us/op 1.00
altair processAttestation - setStatus - 1/2 committees join 276.71 us/op 283.59 us/op 0.98
altair processAttestation - setStatus - 2/3 committees join 385.74 us/op 370.77 us/op 1.04
altair processAttestation - setStatus - 4/5 committees join 536.43 us/op 525.84 us/op 1.02
altair processAttestation - setStatus - 100% committees join 607.92 us/op 622.09 us/op 0.98
altair processBlock - 250000 vs - 7PWei normalcase 4.4730 ms/op 3.4119 ms/op 1.31
altair processBlock - 250000 vs - 7PWei normalcase hashState 17.173 ms/op 13.664 ms/op 1.26
altair processBlock - 250000 vs - 7PWei worstcase 24.380 ms/op 21.119 ms/op 1.15
altair processBlock - 250000 vs - 7PWei worstcase hashState 50.087 ms/op 41.071 ms/op 1.22
phase0 processBlock - 250000 vs - 7PWei normalcase 1.5229 ms/op 1.3355 ms/op 1.14
phase0 processBlock - 250000 vs - 7PWei worstcase 17.565 ms/op 18.175 ms/op 0.97
altair processEth1Data - 250000 vs - 7PWei normalcase 298.03 us/op 298.13 us/op 1.00
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:16 3.4150 us/op 7.1520 us/op 0.48
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:220 37.545 us/op 21.198 us/op 1.77
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:43 6.2840 us/op 5.8930 us/op 1.07
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:19 3.7670 us/op 3.8670 us/op 0.97
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1021 94.004 us/op 95.635 us/op 0.98
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11778 1.4388 ms/op 1.4312 ms/op 1.01
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.8918 ms/op 1.8603 ms/op 1.02
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.7865 ms/op 1.8854 ms/op 0.95
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 5.2884 ms/op 3.7379 ms/op 1.41
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.9899 ms/op 2.1337 ms/op 0.93
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 5.0065 ms/op 3.9999 ms/op 1.25
Tree 40 250000 create 343.77 ms/op 335.35 ms/op 1.03
Tree 40 250000 get(125000) 89.421 ns/op 103.92 ns/op 0.86
Tree 40 250000 set(125000) 968.68 ns/op 1.0568 us/op 0.92
Tree 40 250000 toArray() 16.245 ms/op 15.904 ms/op 1.02
Tree 40 250000 iterate all - toArray() + loop 16.454 ms/op 15.630 ms/op 1.05
Tree 40 250000 iterate all - get(i) 39.790 ms/op 44.220 ms/op 0.90
Array 250000 create 2.1877 ms/op 2.3790 ms/op 0.92
Array 250000 clone - spread 671.93 us/op 689.20 us/op 0.97
Array 250000 get(125000) 0.28600 ns/op 0.29700 ns/op 0.96
Array 250000 set(125000) 0.28600 ns/op 0.30000 ns/op 0.95
Array 250000 iterate all - loop 55.817 us/op 57.257 us/op 0.97
phase0 afterProcessEpoch - 250000 vs - 7PWei 38.915 ms/op 40.325 ms/op 0.97
Array.fill - length 1000000 2.3260 ms/op 2.1306 ms/op 1.09
Array push - length 1000000 9.2334 ms/op 9.6101 ms/op 0.96
Array.get 0.20205 ns/op 0.21007 ns/op 0.96
Uint8Array.get 0.23204 ns/op 0.24712 ns/op 0.94
phase0 beforeProcessEpoch - 250000 vs - 7PWei 15.582 ms/op 17.669 ms/op 0.88
altair processEpoch - mainnet_e81889 288.90 ms/op 264.54 ms/op 1.09
mainnet_e81889 - altair beforeProcessEpoch 16.907 ms/op 15.838 ms/op 1.07
mainnet_e81889 - altair processJustificationAndFinalization 6.4370 us/op 6.0950 us/op 1.06
mainnet_e81889 - altair processInactivityUpdates 6.9725 ms/op 3.5498 ms/op 1.96
mainnet_e81889 - altair processRewardsAndPenalties 20.696 ms/op 20.016 ms/op 1.03
mainnet_e81889 - altair processRegistryUpdates 548.00 ns/op 526.00 ns/op 1.04
mainnet_e81889 - altair processSlashings 147.00 ns/op 135.00 ns/op 1.09
mainnet_e81889 - altair processEth1DataReset 139.00 ns/op 128.00 ns/op 1.09
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.5692 ms/op 1.8687 ms/op 0.84
mainnet_e81889 - altair processSlashingsReset 705.00 ns/op 698.00 ns/op 1.01
mainnet_e81889 - altair processRandaoMixesReset 1.3590 us/op 1.3010 us/op 1.04
mainnet_e81889 - altair processHistoricalRootsUpdate 143.00 ns/op 134.00 ns/op 1.07
mainnet_e81889 - altair processParticipationFlagUpdates 437.00 ns/op 457.00 ns/op 0.96
mainnet_e81889 - altair processSyncCommitteeUpdates 120.00 ns/op 105.00 ns/op 1.14
mainnet_e81889 - altair afterProcessEpoch 40.263 ms/op 42.739 ms/op 0.94
capella processEpoch - mainnet_e217614 831.47 ms/op 815.96 ms/op 1.02
mainnet_e217614 - capella beforeProcessEpoch 63.430 ms/op 57.873 ms/op 1.10
mainnet_e217614 - capella processJustificationAndFinalization 5.9440 us/op 5.8650 us/op 1.01
mainnet_e217614 - capella processInactivityUpdates 17.860 ms/op 13.070 ms/op 1.37
mainnet_e217614 - capella processRewardsAndPenalties 93.534 ms/op 92.656 ms/op 1.01
mainnet_e217614 - capella processRegistryUpdates 4.4530 us/op 4.4850 us/op 0.99
mainnet_e217614 - capella processSlashings 137.00 ns/op 134.00 ns/op 1.02
mainnet_e217614 - capella processEth1DataReset 144.00 ns/op 129.00 ns/op 1.12
mainnet_e217614 - capella processEffectiveBalanceUpdates 13.394 ms/op 6.2391 ms/op 2.15
mainnet_e217614 - capella processSlashingsReset 670.00 ns/op 742.00 ns/op 0.90
mainnet_e217614 - capella processRandaoMixesReset 1.1440 us/op 1.0140 us/op 1.13
mainnet_e217614 - capella processHistoricalRootsUpdate 140.00 ns/op 132.00 ns/op 1.06
mainnet_e217614 - capella processParticipationFlagUpdates 431.00 ns/op 415.00 ns/op 1.04
mainnet_e217614 - capella afterProcessEpoch 104.23 ms/op 108.86 ms/op 0.96
phase0 processEpoch - mainnet_e58758 317.29 ms/op 281.98 ms/op 1.13
mainnet_e58758 - phase0 beforeProcessEpoch 65.277 ms/op 57.968 ms/op 1.13
mainnet_e58758 - phase0 processJustificationAndFinalization 6.2540 us/op 5.7420 us/op 1.09
mainnet_e58758 - phase0 processRewardsAndPenalties 16.553 ms/op 15.886 ms/op 1.04
mainnet_e58758 - phase0 processRegistryUpdates 2.2850 us/op 2.2380 us/op 1.02
mainnet_e58758 - phase0 processSlashings 144.00 ns/op 132.00 ns/op 1.09
mainnet_e58758 - phase0 processEth1DataReset 137.00 ns/op 133.00 ns/op 1.03
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 800.45 us/op 884.51 us/op 0.90
mainnet_e58758 - phase0 processSlashingsReset 904.00 ns/op 1.0760 us/op 0.84
mainnet_e58758 - phase0 processRandaoMixesReset 1.3370 us/op 1.0200 us/op 1.31
mainnet_e58758 - phase0 processHistoricalRootsUpdate 283.00 ns/op 139.00 ns/op 2.04
mainnet_e58758 - phase0 processParticipationRecordUpdates 1.1390 us/op 1.0090 us/op 1.13
mainnet_e58758 - phase0 afterProcessEpoch 32.199 ms/op 33.373 ms/op 0.96
phase0 processEffectiveBalanceUpdates - 250000 normalcase 955.90 us/op 1.0308 ms/op 0.93
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5071 ms/op 1.6587 ms/op 0.91
altair processInactivityUpdates - 250000 normalcase 14.856 ms/op 10.900 ms/op 1.36
altair processInactivityUpdates - 250000 worstcase 12.908 ms/op 10.713 ms/op 1.20
phase0 processRegistryUpdates - 250000 normalcase 3.3580 us/op 2.2160 us/op 1.52
phase0 processRegistryUpdates - 250000 badcase_full_deposits 140.17 us/op 145.64 us/op 0.96
phase0 processRegistryUpdates - 250000 worstcase 0.5 54.055 ms/op 65.609 ms/op 0.82
altair processRewardsAndPenalties - 250000 normalcase 16.819 ms/op 17.015 ms/op 0.99
altair processRewardsAndPenalties - 250000 worstcase 16.304 ms/op 17.465 ms/op 0.93
phase0 getAttestationDeltas - 250000 normalcase 5.2377 ms/op 5.4637 ms/op 0.96
phase0 getAttestationDeltas - 250000 worstcase 5.3865 ms/op 5.6055 ms/op 0.96
phase0 processSlashings - 250000 worstcase 59.619 us/op 63.695 us/op 0.94
altair processSyncCommitteeUpdates - 250000 10.821 ms/op 11.153 ms/op 0.97
BeaconState.hashTreeRoot - No change 202.00 ns/op 169.00 ns/op 1.20
BeaconState.hashTreeRoot - 1 full validator 90.395 us/op 86.246 us/op 1.05
BeaconState.hashTreeRoot - 32 full validator 970.39 us/op 859.95 us/op 1.13
BeaconState.hashTreeRoot - 512 full validator 9.2958 ms/op 9.2630 ms/op 1.00
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 120.06 us/op 105.84 us/op 1.13
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.5778 ms/op 1.5675 ms/op 1.01
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 22.747 ms/op 21.836 ms/op 1.04
BeaconState.hashTreeRoot - 1 balances 87.706 us/op 86.204 us/op 1.02
BeaconState.hashTreeRoot - 32 balances 819.14 us/op 729.32 us/op 1.12
BeaconState.hashTreeRoot - 512 balances 7.1495 ms/op 7.7510 ms/op 0.92
BeaconState.hashTreeRoot - 250000 balances 135.71 ms/op 143.32 ms/op 0.95
aggregationBits - 2048 els - zipIndexesInBitList 19.256 us/op 20.726 us/op 0.93
regular array get 100000 times 22.445 us/op 23.123 us/op 0.97
wrappedArray get 100000 times 22.381 us/op 23.116 us/op 0.97
arrayWithProxy get 100000 times 9.4274 ms/op 10.170 ms/op 0.93
ssz.Root.equals 20.877 ns/op 21.596 ns/op 0.97
byteArrayEquals 20.557 ns/op 21.305 ns/op 0.96
Buffer.compare 9.0200 ns/op 8.9230 ns/op 1.01
processSlot - 1 slots 9.7120 us/op 10.839 us/op 0.90
processSlot - 32 slots 2.3771 ms/op 2.0690 ms/op 1.15
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 5.2221 ms/op 5.6813 ms/op 0.92
getCommitteeAssignments - req 1 vs - 250000 vc 1.6452 ms/op 1.6713 ms/op 0.98
getCommitteeAssignments - req 100 vs - 250000 vc 3.4094 ms/op 3.4331 ms/op 0.99
getCommitteeAssignments - req 1000 vs - 250000 vc 3.6632 ms/op 3.7270 ms/op 0.98
findModifiedValidators - 10000 modified validators 598.87 ms/op 834.89 ms/op 0.72
findModifiedValidators - 1000 modified validators 414.75 ms/op 583.13 ms/op 0.71
findModifiedValidators - 100 modified validators 286.14 ms/op 338.96 ms/op 0.84
findModifiedValidators - 10 modified validators 219.54 ms/op 275.74 ms/op 0.80
findModifiedValidators - 1 modified validators 165.11 ms/op 230.09 ms/op 0.72
findModifiedValidators - no difference 176.35 ms/op 205.33 ms/op 0.86
migrate state 1500000 validators, 3400 modified, 2000 new 3.0755 s/op 3.4932 s/op 0.88
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 3.6900 ns/op 3.7400 ns/op 0.99
state getBlockRootAtSlot - 250000 vs - 7PWei 404.35 ns/op 420.84 ns/op 0.96
computeProposerIndex 100000 validators 1.3078 ms/op 1.3857 ms/op 0.94
getNextSyncCommitteeIndices 1000 validators 2.8615 ms/op 2.9188 ms/op 0.98
getNextSyncCommitteeIndices 10000 validators 24.690 ms/op 25.545 ms/op 0.97
getNextSyncCommitteeIndices 100000 validators 82.142 ms/op 89.577 ms/op 0.92
computeProposers - vc 250000 553.15 us/op 575.95 us/op 0.96
computeEpochShuffling - vc 250000 38.117 ms/op 40.208 ms/op 0.95
getNextSyncCommittee - vc 250000 9.3240 ms/op 9.6300 ms/op 0.97
nodejs block root to RootHex using toHex 93.306 ns/op 102.08 ns/op 0.91
nodejs block root to RootHex using toRootHex 57.859 ns/op 61.734 ns/op 0.94
nodejs fromHex(blob) 688.94 us/op 851.41 us/op 0.81
nodejs fromHexInto(blob) 647.08 us/op 674.23 us/op 0.96
nodejs block root to RootHex using the deprecated toHexString 377.36 ns/op 485.59 ns/op 0.78
nodejs byteArrayEquals 32 bytes (block root) 25.945 ns/op 25.994 ns/op 1.00
nodejs byteArrayEquals 48 bytes (pubkey) 37.307 ns/op 37.502 ns/op 0.99
nodejs byteArrayEquals 96 bytes (signature) 33.206 ns/op 36.336 ns/op 0.91
nodejs byteArrayEquals 1024 bytes 39.750 ns/op 44.895 ns/op 0.89
nodejs byteArrayEquals 131072 bytes (blob) 1.7161 us/op 1.7596 us/op 0.98
browser block root to RootHex using toHex 142.76 ns/op 145.61 ns/op 0.98
browser block root to RootHex using toRootHex 129.68 ns/op 131.42 ns/op 0.99
browser fromHex(blob) 1.4817 ms/op 1.8491 ms/op 0.80
browser fromHexInto(blob) 637.09 us/op 663.96 us/op 0.96
browser block root to RootHex using the deprecated toHexString 493.30 ns/op 344.39 ns/op 1.43
browser byteArrayEquals 32 bytes (block root) 28.389 ns/op 27.960 ns/op 1.02
browser byteArrayEquals 48 bytes (pubkey) 39.738 ns/op 39.453 ns/op 1.01
browser byteArrayEquals 96 bytes (signature) 75.564 ns/op 74.193 ns/op 1.02
browser byteArrayEquals 1024 bytes 769.50 ns/op 758.95 ns/op 1.01
browser byteArrayEquals 131072 bytes (blob) 95.825 us/op 95.788 us/op 1.00

by benchmarkbot/action

// processPtcWindow() already rotated the canonical state field earlier in process_epoch.
// Copy the previous/current epoch slices into epochCtx so validation stays on cached arrays.
({
previousPayloadTimelinessCommittees: this.previousPayloadTimelinessCommittees,
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.

shifting previous + current payloadTimelinessComimittees should be cheaper, especially in terms of memory allocation
only extract the nextPayloadTimelinessCommittees

// PTC for current epoch, computed eagerly at epoch transition
payloadTimelinessCommittees: Uint32Array[];
// PTC for next epoch, precomputed from the ptc window for future duty serving
nextPayloadTimelinessCommittees: Uint32Array[];
Copy link
Copy Markdown
Contributor

@ensi321 ensi321 Apr 19, 2026

Choose a reason for hiding this comment

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

I think this is a fragile approach because spec says we now store 2 + MIN_SEED_LOOKAHEAD epochs of ptc committees in the state. If MIN_SEED_LOOKAHEAD increases in the future, we would need to add more fields here.

But for now, it is fine.

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.

yeah was thinking about that too, it seems fine as is for now, at least in the state-transition we should handle it like we do in processProposerLookahead but I don't wanna deal with that now

@wemeetagain wemeetagain added the spec-gloas Issues targeting the Glamsterdam spec version label Apr 20, 2026
// `meta` is typed as `any` so SSZ `Type<T>.deserialize(data, opts?)` satisfies the shape.
// Route-specific deserializers (e.g. `WithVersion`) cast to their expected meta internally.
// biome-ignore lint/suspicious/noExplicitAny: contravariant workaround for ssz Type.deserialize(opts?)
deserialize: (data: Uint8Array, meta: any) => T; // client
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 is due to ChainSafe/ssz#503 which we aren't even making use of but this is not a big deal, we can revisit this later cc @wemeetagain

Copy link
Copy Markdown
Member Author

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

lgtm

@wemeetagain wemeetagain merged commit 9c8beca into unstable Apr 21, 2026
19 of 20 checks passed
@wemeetagain wemeetagain deleted the nflaig/alpha4-spec-4979 branch April 21, 2026 17:45
@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 (9fa9f08) to head (0517ca3).
⚠️ Report is 1 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #9211      +/-   ##
============================================
- Coverage     52.53%   52.53%   -0.01%     
============================================
  Files           848      848              
  Lines         61405    61402       -3     
  Branches       4525     4525              
============================================
- Hits          32259    32256       -3     
  Misses        29081    29081              
  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.

4 participants