Skip to content

Conversation

@ensi321
Copy link
Contributor

@ensi321 ensi321 commented Oct 7, 2025

Implement epbs state transition function.

Passes all operations and epoch_transition spec tests on v1.6.0-beta.2

Part of #8439

@ensi321 ensi321 added the spec-gloas Issues targeting the Glamsterdam spec version label Oct 7, 2025
@ensi321 ensi321 changed the title [WIP] feat: implement epbs state transition feat: implement epbs state transition Nov 3, 2025
@ensi321 ensi321 marked this pull request as ready for review November 3, 2025 21:10
@ensi321 ensi321 requested a review from a team as a code owner November 3, 2025 21:10
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

Performance Report

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 6ac9224 Previous: 6832b02 Ratio
phase0 getAttestationDeltas - 250000 normalcase 7.5776 ms/op 23.082 ms/op 0.33
Full benchmark results
Benchmark suite Current: 6ac9224 Previous: 6832b02 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 937.17 us/op 1.0244 ms/op 0.91
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 37.048 us/op 36.965 us/op 1.00
BLS verify - blst 872.97 us/op 906.53 us/op 0.96
BLS verifyMultipleSignatures 3 - blst 1.2871 ms/op 1.3234 ms/op 0.97
BLS verifyMultipleSignatures 8 - blst 1.9735 ms/op 1.7174 ms/op 1.15
BLS verifyMultipleSignatures 32 - blst 5.8107 ms/op 5.0455 ms/op 1.15
BLS verifyMultipleSignatures 64 - blst 11.014 ms/op 9.3483 ms/op 1.18
BLS verifyMultipleSignatures 128 - blst 17.664 ms/op 17.935 ms/op 0.98
BLS deserializing 10000 signatures 706.38 ms/op 724.66 ms/op 0.97
BLS deserializing 100000 signatures 7.1528 s/op 7.1260 s/op 1.00
BLS verifyMultipleSignatures - same message - 3 - blst 942.06 us/op 886.84 us/op 1.06
BLS verifyMultipleSignatures - same message - 8 - blst 1.0861 ms/op 1.0035 ms/op 1.08
BLS verifyMultipleSignatures - same message - 32 - blst 1.7810 ms/op 1.7209 ms/op 1.03
BLS verifyMultipleSignatures - same message - 64 - blst 2.6832 ms/op 2.6353 ms/op 1.02
BLS verifyMultipleSignatures - same message - 128 - blst 4.5096 ms/op 4.4320 ms/op 1.02
BLS aggregatePubkeys 32 - blst 20.008 us/op 19.656 us/op 1.02
BLS aggregatePubkeys 128 - blst 71.616 us/op 70.443 us/op 1.02
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 53.606 ms/op 52.121 ms/op 1.03
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 50.996 ms/op 46.236 ms/op 1.10
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 40.317 ms/op 36.213 ms/op 1.11
getSlashingsAndExits - default max 82.382 us/op 73.103 us/op 1.13
getSlashingsAndExits - 2k 357.31 us/op 288.93 us/op 1.24
isKnown best case - 1 super set check 220.00 ns/op 210.00 ns/op 1.05
isKnown normal case - 2 super set checks 212.00 ns/op 206.00 ns/op 1.03
isKnown worse case - 16 super set checks 213.00 ns/op 211.00 ns/op 1.01
InMemoryCheckpointStateCache - add get delete 2.6250 us/op 2.3280 us/op 1.13
validate api signedAggregateAndProof - struct 1.5206 ms/op 1.3461 ms/op 1.13
validate gossip signedAggregateAndProof - struct 1.5181 ms/op 1.3607 ms/op 1.12
batch validate gossip attestation - vc 640000 - chunk 32 123.68 us/op 116.10 us/op 1.07
batch validate gossip attestation - vc 640000 - chunk 64 110.78 us/op 101.43 us/op 1.09
batch validate gossip attestation - vc 640000 - chunk 128 99.505 us/op 93.822 us/op 1.06
batch validate gossip attestation - vc 640000 - chunk 256 102.84 us/op 96.240 us/op 1.07
pickEth1Vote - no votes 969.84 us/op 942.28 us/op 1.03
pickEth1Vote - max votes 6.3637 ms/op 5.1378 ms/op 1.24
pickEth1Vote - Eth1Data hashTreeRoot value x2048 13.200 ms/op 10.734 ms/op 1.23
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 22.403 ms/op 14.677 ms/op 1.53
pickEth1Vote - Eth1Data fastSerialize value x2048 442.15 us/op 450.47 us/op 0.98
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.6844 ms/op 2.1352 ms/op 1.73
bytes32 toHexString 368.00 ns/op 362.00 ns/op 1.02
bytes32 Buffer.toString(hex) 247.00 ns/op 242.00 ns/op 1.02
bytes32 Buffer.toString(hex) from Uint8Array 344.00 ns/op 324.00 ns/op 1.06
bytes32 Buffer.toString(hex) + 0x 254.00 ns/op 246.00 ns/op 1.03
Object access 1 prop 0.12500 ns/op 0.11700 ns/op 1.07
Map access 1 prop 0.13000 ns/op 0.12600 ns/op 1.03
Object get x1000 5.9700 ns/op 5.8580 ns/op 1.02
Map get x1000 6.6350 ns/op 6.3630 ns/op 1.04
Object set x1000 31.769 ns/op 31.049 ns/op 1.02
Map set x1000 21.126 ns/op 19.869 ns/op 1.06
Return object 10000 times 0.29820 ns/op 0.28550 ns/op 1.04
Throw Error 10000 times 4.5991 us/op 4.1949 us/op 1.10
toHex 137.88 ns/op 140.82 ns/op 0.98
Buffer.from 131.51 ns/op 134.60 ns/op 0.98
shared Buffer 85.389 ns/op 83.510 ns/op 1.02
fastMsgIdFn sha256 / 200 bytes 2.3170 us/op 2.1450 us/op 1.08
fastMsgIdFn h32 xxhash / 200 bytes 207.00 ns/op 304.00 ns/op 0.68
fastMsgIdFn h64 xxhash / 200 bytes 264.00 ns/op 260.00 ns/op 1.02
fastMsgIdFn sha256 / 1000 bytes 7.4340 us/op 7.2880 us/op 1.02
fastMsgIdFn h32 xxhash / 1000 bytes 389.00 ns/op 336.00 ns/op 1.16
fastMsgIdFn h64 xxhash / 1000 bytes 342.00 ns/op 332.00 ns/op 1.03
fastMsgIdFn sha256 / 10000 bytes 68.408 us/op 64.968 us/op 1.05
fastMsgIdFn h32 xxhash / 10000 bytes 1.8460 us/op 1.8510 us/op 1.00
fastMsgIdFn h64 xxhash / 10000 bytes 1.2100 us/op 1.2310 us/op 0.98
100 bytes - compress - snappyjs 1.1544 us/op 1.3242 us/op 0.87
100 bytes - compress - snappy 1.1038 us/op 1.1067 us/op 1.00
100 bytes - compress - #snappy 1.6048 us/op 1.3070 us/op 1.23
200 bytes - compress - snappyjs 1.7733 us/op 1.9305 us/op 0.92
200 bytes - compress - snappy 1.1702 us/op 1.2714 us/op 0.92
200 bytes - compress - #snappy 1.7798 us/op 1.8654 us/op 0.95
300 bytes - compress - snappyjs 2.2535 us/op 2.2527 us/op 1.00
300 bytes - compress - snappy 1.1897 us/op 1.2211 us/op 0.97
300 bytes - compress - #snappy 2.1871 us/op 2.1460 us/op 1.02
400 bytes - compress - snappyjs 2.6349 us/op 2.6232 us/op 1.00
400 bytes - compress - snappy 1.2877 us/op 1.3116 us/op 0.98
400 bytes - compress - #snappy 2.4904 us/op 2.4157 us/op 1.03
500 bytes - compress - snappyjs 3.0391 us/op 2.8273 us/op 1.07
500 bytes - compress - snappy 1.4207 us/op 1.3339 us/op 1.07
500 bytes - compress - #snappy 2.7514 us/op 2.7380 us/op 1.00
1000 bytes - compress - snappyjs 4.4402 us/op 4.1641 us/op 1.07
1000 bytes - compress - snappy 1.8602 us/op 1.7583 us/op 1.06
1000 bytes - compress - #snappy 4.9012 us/op 4.3446 us/op 1.13
10000 bytes - compress - snappyjs 32.574 us/op 30.171 us/op 1.08
10000 bytes - compress - snappy 38.298 us/op 40.049 us/op 0.96
10000 bytes - compress - #snappy 30.605 us/op 30.350 us/op 1.01
100 bytes - uncompress - snappyjs 798.88 ns/op 794.70 ns/op 1.01
100 bytes - uncompress - snappy 994.48 ns/op 1.0323 us/op 0.96
100 bytes - uncompress - #snappy 708.53 ns/op 707.95 ns/op 1.00
200 bytes - uncompress - snappyjs 1.3867 us/op 1.4731 us/op 0.94
200 bytes - uncompress - snappy 1.0511 us/op 1.1917 us/op 0.88
200 bytes - uncompress - #snappy 1.2383 us/op 1.3551 us/op 0.91
300 bytes - uncompress - snappyjs 1.5127 us/op 1.5647 us/op 0.97
300 bytes - uncompress - snappy 1.0635 us/op 1.0631 us/op 1.00
300 bytes - uncompress - #snappy 1.6452 us/op 1.5908 us/op 1.03
400 bytes - uncompress - snappyjs 1.8497 us/op 1.4482 us/op 1.28
400 bytes - uncompress - snappy 1.1994 us/op 1.1310 us/op 1.06
400 bytes - uncompress - #snappy 1.6692 us/op 1.6472 us/op 1.01
500 bytes - uncompress - snappyjs 1.9225 us/op 1.7124 us/op 1.12
500 bytes - uncompress - snappy 1.2829 us/op 1.1647 us/op 1.10
500 bytes - uncompress - #snappy 1.9966 us/op 1.2338 us/op 1.62
1000 bytes - uncompress - snappyjs 2.4547 us/op 2.4596 us/op 1.00
1000 bytes - uncompress - snappy 1.5067 us/op 1.4856 us/op 1.01
1000 bytes - uncompress - #snappy 2.4627 us/op 1.9644 us/op 1.25
10000 bytes - uncompress - snappyjs 14.186 us/op 15.586 us/op 0.91
10000 bytes - uncompress - snappy 28.600 us/op 26.707 us/op 1.07
10000 bytes - uncompress - #snappy 14.518 us/op 16.040 us/op 0.91
send data - 1000 256B messages 17.531 ms/op 16.219 ms/op 1.08
send data - 1000 512B messages 20.550 ms/op 19.743 ms/op 1.04
send data - 1000 1024B messages 29.918 ms/op 28.029 ms/op 1.07
send data - 1000 1200B messages 32.082 ms/op 26.716 ms/op 1.20
send data - 1000 2048B messages 27.450 ms/op 27.893 ms/op 0.98
send data - 1000 4096B messages 32.338 ms/op 30.558 ms/op 1.06
send data - 1000 16384B messages 46.574 ms/op 47.464 ms/op 0.98
send data - 1000 65536B messages 122.50 ms/op 127.16 ms/op 0.96
enrSubnets - fastDeserialize 64 bits 921.00 ns/op 930.00 ns/op 0.99
enrSubnets - ssz BitVector 64 bits 373.00 ns/op 333.00 ns/op 1.12
enrSubnets - fastDeserialize 4 bits 139.00 ns/op 130.00 ns/op 1.07
enrSubnets - ssz BitVector 4 bits 336.00 ns/op 333.00 ns/op 1.01
prioritizePeers score -10:0 att 32-0.1 sync 2-0 249.34 us/op 249.65 us/op 1.00
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 272.82 us/op 270.63 us/op 1.01
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 392.64 us/op 398.62 us/op 0.99
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 719.01 us/op 732.37 us/op 0.98
prioritizePeers score 0:0 att 64-1 sync 4-1 873.50 us/op 899.74 us/op 0.97
array of 16000 items push then shift 1.6402 us/op 1.6499 us/op 0.99
LinkedList of 16000 items push then shift 7.3350 ns/op 7.7470 ns/op 0.95
array of 16000 items push then pop 79.958 ns/op 79.608 ns/op 1.00
LinkedList of 16000 items push then pop 7.2650 ns/op 7.4040 ns/op 0.98
array of 24000 items push then shift 2.5216 us/op 2.4516 us/op 1.03
LinkedList of 24000 items push then shift 7.4820 ns/op 7.4660 ns/op 1.00
array of 24000 items push then pop 103.33 ns/op 111.75 ns/op 0.92
LinkedList of 24000 items push then pop 7.5320 ns/op 7.5530 ns/op 1.00
intersect bitArray bitLen 8 6.4770 ns/op 6.3780 ns/op 1.02
intersect array and set length 8 38.867 ns/op 39.119 ns/op 0.99
intersect bitArray bitLen 128 30.457 ns/op 30.816 ns/op 0.99
intersect array and set length 128 637.37 ns/op 636.75 ns/op 1.00
bitArray.getTrueBitIndexes() bitLen 128 1.0200 us/op 1.0020 us/op 1.02
bitArray.getTrueBitIndexes() bitLen 248 1.7780 us/op 1.7810 us/op 1.00
bitArray.getTrueBitIndexes() bitLen 512 3.6480 us/op 3.6790 us/op 0.99
Full columns - reconstruct all 6 blobs 69.823 us/op 116.87 us/op 0.60
Full columns - reconstruct half of the blobs out of 6 40.702 us/op 46.413 us/op 0.88
Full columns - reconstruct single blob out of 6 18.179 us/op 20.906 us/op 0.87
Half columns - reconstruct all 6 blobs 267.23 ms/op 275.78 ms/op 0.97
Half columns - reconstruct half of the blobs out of 6 135.79 ms/op 142.65 ms/op 0.95
Half columns - reconstruct single blob out of 6 49.658 ms/op 50.305 ms/op 0.99
Full columns - reconstruct all 10 blobs 127.06 us/op 120.16 us/op 1.06
Full columns - reconstruct half of the blobs out of 10 63.442 us/op 67.390 us/op 0.94
Full columns - reconstruct single blob out of 10 19.247 us/op 20.415 us/op 0.94
Half columns - reconstruct all 10 blobs 442.27 ms/op 454.05 ms/op 0.97
Half columns - reconstruct half of the blobs out of 10 225.03 ms/op 231.97 ms/op 0.97
Half columns - reconstruct single blob out of 10 52.920 ms/op 50.672 ms/op 1.04
Full columns - reconstruct all 20 blobs 336.18 us/op 214.35 us/op 1.57
Full columns - reconstruct half of the blobs out of 20 137.44 us/op 104.79 us/op 1.31
Full columns - reconstruct single blob out of 20 20.119 us/op 18.963 us/op 1.06
Half columns - reconstruct all 20 blobs 919.90 ms/op 929.00 ms/op 0.99
Half columns - reconstruct half of the blobs out of 20 458.79 ms/op 457.66 ms/op 1.00
Half columns - reconstruct single blob out of 20 50.687 ms/op 52.105 ms/op 0.97
Buffer.concat 32 items 593.00 ns/op 653.00 ns/op 0.91
Uint8Array.set 32 items 1.3080 us/op 1.0830 us/op 1.21
Buffer.copy 2.5110 us/op 2.1440 us/op 1.17
Uint8Array.set - with subarray 2.0400 us/op 1.5580 us/op 1.31
Uint8Array.set - without subarray 1.0870 us/op 858.00 ns/op 1.27
getUint32 - dataview 199.00 ns/op 196.00 ns/op 1.02
getUint32 - manual 125.00 ns/op 121.00 ns/op 1.03
Set add up to 64 items then delete first 2.2201 us/op 2.4648 us/op 0.90
OrderedSet add up to 64 items then delete first 3.3883 us/op 3.2873 us/op 1.03
Set add up to 64 items then delete last 2.5648 us/op 2.4756 us/op 1.04
OrderedSet add up to 64 items then delete last 3.7328 us/op 4.0686 us/op 0.92
Set add up to 64 items then delete middle 2.6029 us/op 2.5144 us/op 1.04
OrderedSet add up to 64 items then delete middle 5.3829 us/op 6.3582 us/op 0.85
Set add up to 128 items then delete first 5.3422 us/op 5.1870 us/op 1.03
OrderedSet add up to 128 items then delete first 7.9834 us/op 8.5040 us/op 0.94
Set add up to 128 items then delete last 5.1411 us/op 5.9656 us/op 0.86
OrderedSet add up to 128 items then delete last 7.5832 us/op 9.1416 us/op 0.83
Set add up to 128 items then delete middle 5.0430 us/op 5.0739 us/op 0.99
OrderedSet add up to 128 items then delete middle 14.935 us/op 14.489 us/op 1.03
Set add up to 256 items then delete first 10.967 us/op 10.252 us/op 1.07
OrderedSet add up to 256 items then delete first 15.856 us/op 16.006 us/op 0.99
Set add up to 256 items then delete last 11.361 us/op 10.770 us/op 1.05
OrderedSet add up to 256 items then delete last 15.098 us/op 16.227 us/op 0.93
Set add up to 256 items then delete middle 10.354 us/op 9.8667 us/op 1.05
OrderedSet add up to 256 items then delete middle 43.668 us/op 45.464 us/op 0.96
transfer serialized Status (84 B) 2.3390 us/op 2.2460 us/op 1.04
copy serialized Status (84 B) 1.3370 us/op 1.2080 us/op 1.11
transfer serialized SignedVoluntaryExit (112 B) 2.3820 us/op 2.2720 us/op 1.05
copy serialized SignedVoluntaryExit (112 B) 1.2520 us/op 1.2500 us/op 1.00
transfer serialized ProposerSlashing (416 B) 2.4290 us/op 2.3200 us/op 1.05
copy serialized ProposerSlashing (416 B) 1.2880 us/op 1.2920 us/op 1.00
transfer serialized Attestation (485 B) 2.3990 us/op 2.3560 us/op 1.02
copy serialized Attestation (485 B) 1.2640 us/op 1.2820 us/op 0.99
transfer serialized AttesterSlashing (33232 B) 2.4550 us/op 3.1880 us/op 0.77
copy serialized AttesterSlashing (33232 B) 5.2060 us/op 4.3470 us/op 1.20
transfer serialized Small SignedBeaconBlock (128000 B) 3.9790 us/op 3.1790 us/op 1.25
copy serialized Small SignedBeaconBlock (128000 B) 11.994 us/op 14.478 us/op 0.83
transfer serialized Avg SignedBeaconBlock (200000 B) 4.7730 us/op 7.2920 us/op 0.65
copy serialized Avg SignedBeaconBlock (200000 B) 18.461 us/op 21.618 us/op 0.85
transfer serialized BlobsSidecar (524380 B) 5.8990 us/op 4.8480 us/op 1.22
copy serialized BlobsSidecar (524380 B) 68.015 us/op 64.206 us/op 1.06
transfer serialized Big SignedBeaconBlock (1000000 B) 5.2710 us/op 4.7640 us/op 1.11
copy serialized Big SignedBeaconBlock (1000000 B) 143.91 us/op 123.25 us/op 1.17
pass gossip attestations to forkchoice per slot 2.7926 ms/op 3.0526 ms/op 0.91
forkChoice updateHead vc 100000 bc 64 eq 0 488.00 us/op 493.47 us/op 0.99
forkChoice updateHead vc 600000 bc 64 eq 0 2.9155 ms/op 2.9290 ms/op 1.00
forkChoice updateHead vc 1000000 bc 64 eq 0 4.8625 ms/op 4.8172 ms/op 1.01
forkChoice updateHead vc 600000 bc 320 eq 0 2.9224 ms/op 2.8917 ms/op 1.01
forkChoice updateHead vc 600000 bc 1200 eq 0 3.0043 ms/op 4.0157 ms/op 0.75
forkChoice updateHead vc 600000 bc 7200 eq 0 3.2619 ms/op 3.1457 ms/op 1.04
forkChoice updateHead vc 600000 bc 64 eq 1000 2.9229 ms/op 2.8503 ms/op 1.03
forkChoice updateHead vc 600000 bc 64 eq 10000 3.1103 ms/op 2.9651 ms/op 1.05
forkChoice updateHead vc 600000 bc 64 eq 300000 10.272 ms/op 9.8510 ms/op 1.04
computeDeltas 1400000 validators 0% inactive 14.310 ms/op 13.751 ms/op 1.04
computeDeltas 1400000 validators 10% inactive 13.045 ms/op 12.859 ms/op 1.01
computeDeltas 1400000 validators 20% inactive 11.628 ms/op 11.626 ms/op 1.00
computeDeltas 1400000 validators 50% inactive 8.8236 ms/op 8.7441 ms/op 1.01
computeDeltas 2100000 validators 0% inactive 21.563 ms/op 20.463 ms/op 1.05
computeDeltas 2100000 validators 10% inactive 19.510 ms/op 19.097 ms/op 1.02
computeDeltas 2100000 validators 20% inactive 17.767 ms/op 17.524 ms/op 1.01
computeDeltas 2100000 validators 50% inactive 13.462 ms/op 13.276 ms/op 1.01
altair processAttestation - 250000 vs - 7PWei normalcase 2.0946 ms/op 2.5245 ms/op 0.83
altair processAttestation - 250000 vs - 7PWei worstcase 3.0115 ms/op 3.3473 ms/op 0.90
altair processAttestation - setStatus - 1/6 committees join 126.86 us/op 139.43 us/op 0.91
altair processAttestation - setStatus - 1/3 committees join 231.23 us/op 240.85 us/op 0.96
altair processAttestation - setStatus - 1/2 committees join 340.16 us/op 340.35 us/op 1.00
altair processAttestation - setStatus - 2/3 committees join 439.39 us/op 434.24 us/op 1.01
altair processAttestation - setStatus - 4/5 committees join 597.89 us/op 601.51 us/op 0.99
altair processAttestation - setStatus - 100% committees join 698.93 us/op 728.92 us/op 0.96
altair processBlock - 250000 vs - 7PWei normalcase 5.2158 ms/op 4.7155 ms/op 1.11
altair processBlock - 250000 vs - 7PWei normalcase hashState 39.968 ms/op 27.384 ms/op 1.46
altair processBlock - 250000 vs - 7PWei worstcase 41.949 ms/op 31.169 ms/op 1.35
altair processBlock - 250000 vs - 7PWei worstcase hashState 102.06 ms/op 70.807 ms/op 1.44
phase0 processBlock - 250000 vs - 7PWei normalcase 2.6302 ms/op 1.5600 ms/op 1.69
phase0 processBlock - 250000 vs - 7PWei worstcase 33.206 ms/op 21.183 ms/op 1.57
altair processEth1Data - 250000 vs - 7PWei normalcase 355.70 us/op 325.89 us/op 1.09
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 6.0710 us/op 6.1470 us/op 0.99
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 56.903 us/op 43.069 us/op 1.32
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 16.280 us/op 11.160 us/op 1.46
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 10.012 us/op 6.9910 us/op 1.43
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 260.95 us/op 172.16 us/op 1.52
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 2.7702 ms/op 1.8458 ms/op 1.50
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.4984 ms/op 2.4376 ms/op 1.02
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.4482 ms/op 2.4778 ms/op 0.99
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.5033 ms/op 4.8474 ms/op 0.93
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.4974 ms/op 2.4390 ms/op 1.02
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.6367 ms/op 4.9685 ms/op 0.93
Tree 40 250000 create 448.17 ms/op 445.89 ms/op 1.01
Tree 40 250000 get(125000) 144.23 ns/op 139.09 ns/op 1.04
Tree 40 250000 set(125000) 1.4568 us/op 1.4514 us/op 1.00
Tree 40 250000 toArray() 17.146 ms/op 16.559 ms/op 1.04
Tree 40 250000 iterate all - toArray() + loop 16.802 ms/op 19.403 ms/op 0.87
Tree 40 250000 iterate all - get(i) 50.226 ms/op 57.786 ms/op 0.87
Array 250000 create 2.8308 ms/op 3.2638 ms/op 0.87
Array 250000 clone - spread 778.30 us/op 1.4230 ms/op 0.55
Array 250000 get(125000) 0.52000 ns/op 0.42200 ns/op 1.23
Array 250000 set(125000) 0.41900 ns/op 0.43800 ns/op 0.96
Array 250000 iterate all - loop 81.865 us/op 111.43 us/op 0.73
phase0 afterProcessEpoch - 250000 vs - 7PWei 41.084 ms/op 42.099 ms/op 0.98
Array.fill - length 1000000 3.3550 ms/op 3.4215 ms/op 0.98
Array push - length 1000000 17.864 ms/op 15.429 ms/op 1.16
Array.get 0.27112 ns/op 0.27722 ns/op 0.98
Uint8Array.get 0.41620 ns/op 0.44066 ns/op 0.94
phase0 beforeProcessEpoch - 250000 vs - 7PWei 15.944 ms/op 16.685 ms/op 0.96
altair processEpoch - mainnet_e81889 277.52 ms/op 255.06 ms/op 1.09
mainnet_e81889 - altair beforeProcessEpoch 27.890 ms/op 18.485 ms/op 1.51
mainnet_e81889 - altair processJustificationAndFinalization 5.7530 us/op 5.2920 us/op 1.09
mainnet_e81889 - altair processInactivityUpdates 5.5728 ms/op 4.7007 ms/op 1.19
mainnet_e81889 - altair processRewardsAndPenalties 42.462 ms/op 42.358 ms/op 1.00
mainnet_e81889 - altair processRegistryUpdates 676.00 ns/op 748.00 ns/op 0.90
mainnet_e81889 - altair processSlashings 206.00 ns/op 287.00 ns/op 0.72
mainnet_e81889 - altair processEth1DataReset 176.00 ns/op 190.00 ns/op 0.93
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.3555 ms/op 1.3692 ms/op 0.99
mainnet_e81889 - altair processSlashingsReset 1.0030 us/op 1.1520 us/op 0.87
mainnet_e81889 - altair processRandaoMixesReset 1.2370 us/op 1.4320 us/op 0.86
mainnet_e81889 - altair processHistoricalRootsUpdate 194.00 ns/op 245.00 ns/op 0.79
mainnet_e81889 - altair processParticipationFlagUpdates 565.00 ns/op 554.00 ns/op 1.02
mainnet_e81889 - altair processSyncCommitteeUpdates 145.00 ns/op 145.00 ns/op 1.00
mainnet_e81889 - altair afterProcessEpoch 45.444 ms/op 48.178 ms/op 0.94
capella processEpoch - mainnet_e217614 1.0153 s/op 1.0959 s/op 0.93
mainnet_e217614 - capella beforeProcessEpoch 63.346 ms/op 64.623 ms/op 0.98
mainnet_e217614 - capella processJustificationAndFinalization 5.2860 us/op 5.3550 us/op 0.99
mainnet_e217614 - capella processInactivityUpdates 14.796 ms/op 15.089 ms/op 0.98
mainnet_e217614 - capella processRewardsAndPenalties 186.56 ms/op 186.83 ms/op 1.00
mainnet_e217614 - capella processRegistryUpdates 6.4290 us/op 6.6390 us/op 0.97
mainnet_e217614 - capella processSlashings 176.00 ns/op 183.00 ns/op 0.96
mainnet_e217614 - capella processEth1DataReset 174.00 ns/op 182.00 ns/op 0.96
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.2321 ms/op 4.3141 ms/op 0.98
mainnet_e217614 - capella processSlashingsReset 883.00 ns/op 908.00 ns/op 0.97
mainnet_e217614 - capella processRandaoMixesReset 1.7660 us/op 1.2280 us/op 1.44
mainnet_e217614 - capella processHistoricalRootsUpdate 204.00 ns/op 186.00 ns/op 1.10
mainnet_e217614 - capella processParticipationFlagUpdates 535.00 ns/op 605.00 ns/op 0.88
mainnet_e217614 - capella afterProcessEpoch 116.42 ms/op 124.34 ms/op 0.94
phase0 processEpoch - mainnet_e58758 290.26 ms/op 309.47 ms/op 0.94
mainnet_e58758 - phase0 beforeProcessEpoch 76.370 ms/op 97.461 ms/op 0.78
mainnet_e58758 - phase0 processJustificationAndFinalization 6.3720 us/op 6.5250 us/op 0.98
mainnet_e58758 - phase0 processRewardsAndPenalties 37.278 ms/op 40.063 ms/op 0.93
mainnet_e58758 - phase0 processRegistryUpdates 4.4150 us/op 3.3790 us/op 1.31
mainnet_e58758 - phase0 processSlashings 201.00 ns/op 191.00 ns/op 1.05
mainnet_e58758 - phase0 processEth1DataReset 185.00 ns/op 183.00 ns/op 1.01
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.2365 ms/op 1.2644 ms/op 0.98
mainnet_e58758 - phase0 processSlashingsReset 1.0350 us/op 984.00 ns/op 1.05
mainnet_e58758 - phase0 processRandaoMixesReset 1.2260 us/op 1.2100 us/op 1.01
mainnet_e58758 - phase0 processHistoricalRootsUpdate 195.00 ns/op 211.00 ns/op 0.92
mainnet_e58758 - phase0 processParticipationRecordUpdates 998.00 ns/op 896.00 ns/op 1.11
mainnet_e58758 - phase0 afterProcessEpoch 36.185 ms/op 37.058 ms/op 0.98
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.3622 ms/op 1.3745 ms/op 0.99
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.2617 ms/op 2.0562 ms/op 1.10
altair processInactivityUpdates - 250000 normalcase 22.152 ms/op 18.188 ms/op 1.22
altair processInactivityUpdates - 250000 worstcase 19.795 ms/op 18.063 ms/op 1.10
phase0 processRegistryUpdates - 250000 normalcase 7.3270 us/op 6.8440 us/op 1.07
phase0 processRegistryUpdates - 250000 badcase_full_deposits 461.38 us/op 303.32 us/op 1.52
phase0 processRegistryUpdates - 250000 worstcase 0.5 113.00 ms/op 114.90 ms/op 0.98
altair processRewardsAndPenalties - 250000 normalcase 35.128 ms/op 27.181 ms/op 1.29
altair processRewardsAndPenalties - 250000 worstcase 29.300 ms/op 26.786 ms/op 1.09
phase0 getAttestationDeltas - 250000 normalcase 7.5776 ms/op 23.082 ms/op 0.33
phase0 getAttestationDeltas - 250000 worstcase 6.2444 ms/op 5.8840 ms/op 1.06
phase0 processSlashings - 250000 worstcase 101.48 us/op 111.28 us/op 0.91
altair processSyncCommitteeUpdates - 250000 11.128 ms/op 12.034 ms/op 0.92
BeaconState.hashTreeRoot - No change 243.00 ns/op 213.00 ns/op 1.14
BeaconState.hashTreeRoot - 1 full validator 108.28 us/op 75.766 us/op 1.43
BeaconState.hashTreeRoot - 32 full validator 811.59 us/op 816.22 us/op 0.99
BeaconState.hashTreeRoot - 512 full validator 13.543 ms/op 11.628 ms/op 1.16
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 125.06 us/op 93.080 us/op 1.34
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.5719 ms/op 1.4569 ms/op 1.08
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 22.730 ms/op 29.737 ms/op 0.76
BeaconState.hashTreeRoot - 1 balances 90.316 us/op 84.849 us/op 1.06
BeaconState.hashTreeRoot - 32 balances 894.39 us/op 917.14 us/op 0.98
BeaconState.hashTreeRoot - 512 balances 7.6780 ms/op 8.9433 ms/op 0.86
BeaconState.hashTreeRoot - 250000 balances 190.44 ms/op 198.12 ms/op 0.96
aggregationBits - 2048 els - zipIndexesInBitList 26.250 us/op 23.159 us/op 1.13
byteArrayEquals 32 56.420 ns/op 53.863 ns/op 1.05
Buffer.compare 32 17.494 ns/op 17.308 ns/op 1.01
byteArrayEquals 1024 1.6293 us/op 1.6052 us/op 1.02
Buffer.compare 1024 25.569 ns/op 25.884 ns/op 0.99
byteArrayEquals 16384 26.083 us/op 25.586 us/op 1.02
Buffer.compare 16384 202.55 ns/op 200.56 ns/op 1.01
byteArrayEquals 123687377 193.44 ms/op 192.86 ms/op 1.00
Buffer.compare 123687377 6.2230 ms/op 6.2304 ms/op 1.00
byteArrayEquals 32 - diff last byte 52.675 ns/op 52.322 ns/op 1.01
Buffer.compare 32 - diff last byte 17.152 ns/op 17.027 ns/op 1.01
byteArrayEquals 1024 - diff last byte 1.5851 us/op 1.5811 us/op 1.00
Buffer.compare 1024 - diff last byte 26.187 ns/op 25.056 ns/op 1.05
byteArrayEquals 16384 - diff last byte 25.245 us/op 25.221 us/op 1.00
Buffer.compare 16384 - diff last byte 230.55 ns/op 195.71 ns/op 1.18
byteArrayEquals 123687377 - diff last byte 187.66 ms/op 193.03 ms/op 0.97
Buffer.compare 123687377 - diff last byte 6.3290 ms/op 7.1107 ms/op 0.89
byteArrayEquals 32 - random bytes 5.0220 ns/op 5.2270 ns/op 0.96
Buffer.compare 32 - random bytes 17.518 ns/op 17.187 ns/op 1.02
byteArrayEquals 1024 - random bytes 5.0300 ns/op 5.2310 ns/op 0.96
Buffer.compare 1024 - random bytes 17.493 ns/op 17.215 ns/op 1.02
byteArrayEquals 16384 - random bytes 7.7730 ns/op 5.1650 ns/op 1.50
Buffer.compare 16384 - random bytes 18.045 ns/op 17.340 ns/op 1.04
byteArrayEquals 123687377 - random bytes 6.5200 ns/op 6.5000 ns/op 1.00
Buffer.compare 123687377 - random bytes 19.330 ns/op 18.390 ns/op 1.05
regular array get 100000 times 32.960 us/op 33.821 us/op 0.97
wrappedArray get 100000 times 33.895 us/op 33.801 us/op 1.00
arrayWithProxy get 100000 times 13.123 ms/op 13.500 ms/op 0.97
ssz.Root.equals 44.321 ns/op 47.430 ns/op 0.93
byteArrayEquals 43.471 ns/op 46.494 ns/op 0.93
Buffer.compare 10.413 ns/op 10.393 ns/op 1.00
processSlot - 1 slots 11.330 us/op 10.042 us/op 1.13
processSlot - 32 slots 2.9954 ms/op 2.0562 ms/op 1.46
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 2.9491 ms/op 2.9924 ms/op 0.99
getCommitteeAssignments - req 1 vs - 250000 vc 2.0912 ms/op 2.1010 ms/op 1.00
getCommitteeAssignments - req 100 vs - 250000 vc 4.0577 ms/op 4.1211 ms/op 0.98
getCommitteeAssignments - req 1000 vs - 250000 vc 4.3332 ms/op 4.4252 ms/op 0.98
findModifiedValidators - 10000 modified validators 754.15 ms/op 738.69 ms/op 1.02
findModifiedValidators - 1000 modified validators 716.45 ms/op 676.13 ms/op 1.06
findModifiedValidators - 100 modified validators 172.63 ms/op 281.38 ms/op 0.61
findModifiedValidators - 10 modified validators 137.55 ms/op 170.69 ms/op 0.81
findModifiedValidators - 1 modified validators 171.38 ms/op 138.99 ms/op 1.23
findModifiedValidators - no difference 164.13 ms/op 182.93 ms/op 0.90
compare ViewDUs 6.5558 s/op 6.3337 s/op 1.04
compare each validator Uint8Array 1.9982 s/op 1.3261 s/op 1.51
compare ViewDU to Uint8Array 1.1542 s/op 1.2375 s/op 0.93
migrate state 1000000 validators, 24 modified, 0 new 934.07 ms/op 891.28 ms/op 1.05
migrate state 1000000 validators, 1700 modified, 1000 new 1.2756 s/op 1.1475 s/op 1.11
migrate state 1000000 validators, 3400 modified, 2000 new 1.4951 s/op 1.2915 s/op 1.16
migrate state 1500000 validators, 24 modified, 0 new 1.0074 s/op 873.62 ms/op 1.15
migrate state 1500000 validators, 1700 modified, 1000 new 1.2310 s/op 1.0328 s/op 1.19
migrate state 1500000 validators, 3400 modified, 2000 new 1.2984 s/op 1.1721 s/op 1.11
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.5200 ns/op 4.1800 ns/op 1.08
state getBlockRootAtSlot - 250000 vs - 7PWei 506.51 ns/op 567.41 ns/op 0.89
naive computeProposerIndex 100000 validators 65.891 ms/op 52.987 ms/op 1.24
computeProposerIndex 100000 validators 1.5942 ms/op 1.5135 ms/op 1.05
naiveGetNextSyncCommitteeIndices 1000 validators 8.6094 s/op 7.9675 s/op 1.08
getNextSyncCommitteeIndices 1000 validators 120.77 ms/op 121.30 ms/op 1.00
naiveGetNextSyncCommitteeIndices 10000 validators 8.1311 s/op 7.5104 s/op 1.08
getNextSyncCommitteeIndices 10000 validators 128.20 ms/op 117.85 ms/op 1.09
naiveGetNextSyncCommitteeIndices 100000 validators 8.4041 s/op 7.6020 s/op 1.11
getNextSyncCommitteeIndices 100000 validators 131.77 ms/op 120.40 ms/op 1.09
naive computeShuffledIndex 100000 validators 26.745 s/op 26.154 s/op 1.02
cached computeShuffledIndex 100000 validators 563.54 ms/op 583.13 ms/op 0.97
naive computeShuffledIndex 2000000 validators 502.69 s/op 558.68 s/op 0.90
cached computeShuffledIndex 2000000 validators 41.962 s/op 32.063 s/op 1.31
computeProposers - vc 250000 632.49 us/op 635.02 us/op 1.00
computeEpochShuffling - vc 250000 42.497 ms/op 41.939 ms/op 1.01
getNextSyncCommittee - vc 250000 10.610 ms/op 11.635 ms/op 0.91
computeSigningRoot for AttestationData 21.784 us/op 20.657 us/op 1.05
hash AttestationData serialized data then Buffer.toString(base64) 1.6228 us/op 1.6330 us/op 0.99
toHexString serialized data 1.1711 us/op 1.2035 us/op 0.97
Buffer.toString(base64) 158.62 ns/op 170.96 ns/op 0.93
nodejs block root to RootHex using toHex 157.07 ns/op 152.83 ns/op 1.03
nodejs block root to RootHex using toRootHex 93.098 ns/op 92.391 ns/op 1.01
nodejs fromHex(blob) 120.31 us/op 111.92 us/op 1.07
nodejs fromHexInto(blob) 863.85 us/op 845.90 us/op 1.02
nodejs block root to RootHex using the deprecated toHexString 221.88 ns/op 215.82 ns/op 1.03
browser block root to RootHex using toHex 187.22 ns/op 177.61 ns/op 1.05
browser block root to RootHex using toRootHex 172.97 ns/op 174.12 ns/op 0.99
browser fromHex(blob) 822.02 us/op 800.44 us/op 1.03
browser fromHexInto(blob) 843.65 us/op 819.38 us/op 1.03
browser block root to RootHex using the deprecated toHexString 843.10 ns/op 854.77 ns/op 0.99

by benchmarkbot/action

@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

❌ Patch coverage is 13.36478% with 551 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.63%. Comparing base (6832b02) to head (41da814).
⚠️ Report is 4 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #8507      +/-   ##
============================================
- Coverage     51.99%   51.63%   -0.37%     
============================================
  Files           848      855       +7     
  Lines         65857    66463     +606     
  Branches       4808     4814       +6     
============================================
+ Hits          34242    34316      +74     
- Misses        31547    32079     +532     
  Partials         68       68              
🚀 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.

@nflaig
Copy link
Member

nflaig commented Nov 4, 2025

/gemini review

Copy link
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 implements the state transition function for the gloas fork (EPBS). The changes are extensive, touching many parts of the state transition logic to accommodate the new rules for execution payloads, builder payments, and attestations. New processing functions like processExecutionPayloadBid, processExecutionPayloadEnvelope, and processPayloadAttestation have been added, and existing ones like processBlock, processOperations, and processWithdrawals have been updated with gloas-specific logic. The changes appear to be a faithful implementation of the spec. I've found one critical correctness issue and one area for improvement regarding type safety.

verifySignature: boolean
): boolean {
const indices = indexedPayloadAttestation.attestingIndices;
const isSorted = indices.every((val, i, arr) => i === 0 || arr[i - 1] <= val);
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The check for sorted indices arr[i - 1] <= val allows for duplicate validator indices, but the specification requires indices to be strictly increasing, which also implies uniqueness. This could lead to invalid attestations being considered valid.

According to the is_sorted function in the consensus specs, the check should be for strict inequality (<).

Suggested change
const isSorted = indices.every((val, i, arr) => i === 0 || arr[i - 1] <= val);
const isSorted = indices.every((val, i, arr) => i === 0 || arr[i - 1] < val);

Comment on lines +34 to +47
for (const deposit of requests.deposits) {
// TODO GLOAS: Fix type or properly cast it to the correct state type
processDepositRequest(state as unknown as CachedBeaconStateElectra, deposit);
}

for (const withdrawal of requests.withdrawals) {
// TODO GLOAS: Fix type or properly cast it to the correct state type
processWithdrawalRequest(ForkSeq.gloas, state as unknown as CachedBeaconStateElectra, withdrawal);
}

for (const consolidation of requests.consolidations) {
// TODO GLOAS: Fix type or properly cast it to the correct state type
processConsolidationRequest(ForkSeq.gloas, state as unknown as CachedBeaconStateElectra, consolidation);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The state object is cast to unknown as CachedBeaconStateElectra before being passed to processDepositRequest, processWithdrawalRequest, and processConsolidationRequest. This is not type-safe and should be avoided. The TODO comments indicate awareness of this issue.

To improve type safety and maintainability, the signatures of these request processing functions should be updated to accept CachedBeaconStateGloas or a compatible union type, which would eliminate the need for these unsafe casts.

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.

3 participants