Skip to content

feat: add EIP-7917 deterministic proposer lookahead#7902

Merged
nflaig merged 18 commits into
unstablefrom
nc/eip-7917
Jun 9, 2025
Merged

feat: add EIP-7917 deterministic proposer lookahead#7902
nflaig merged 18 commits into
unstablefrom
nc/eip-7917

Conversation

@ensi321

@ensi321 ensi321 commented Jun 2, 2025

Copy link
Copy Markdown
Contributor

This is the first implementation of EIP-7917.

We will want to have a plan deprecate proposer caches in EpochCache since Fulu beacon state will carry those information. This will be addressed in a later PR.

Pending spec release for spec test

Spec PR ethereum/consensus-specs#4190

@github-actions

github-actions Bot commented Jun 2, 2025

Copy link
Copy Markdown
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 9e26261 Previous: 6a4314c Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 990.76 us/op 1.3638 ms/op 0.73
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 43.834 us/op 50.524 us/op 0.87
BLS verify - blst 1.1806 ms/op 950.83 us/op 1.24
BLS verifyMultipleSignatures 3 - blst 1.2407 ms/op 1.4631 ms/op 0.85
BLS verifyMultipleSignatures 8 - blst 2.1306 ms/op 2.4843 ms/op 0.86
BLS verifyMultipleSignatures 32 - blst 5.5081 ms/op 7.9731 ms/op 0.69
BLS verifyMultipleSignatures 64 - blst 10.567 ms/op 10.835 ms/op 0.98
BLS verifyMultipleSignatures 128 - blst 17.205 ms/op 20.610 ms/op 0.83
BLS deserializing 10000 signatures 691.97 ms/op 763.35 ms/op 0.91
BLS deserializing 100000 signatures 6.9785 s/op 7.3793 s/op 0.95
BLS verifyMultipleSignatures - same message - 3 - blst 924.38 us/op 901.29 us/op 1.03
BLS verifyMultipleSignatures - same message - 8 - blst 1.0915 ms/op 1.0290 ms/op 1.06
BLS verifyMultipleSignatures - same message - 32 - blst 1.7522 ms/op 1.8357 ms/op 0.95
BLS verifyMultipleSignatures - same message - 64 - blst 2.7784 ms/op 2.6626 ms/op 1.04
BLS verifyMultipleSignatures - same message - 128 - blst 4.4659 ms/op 4.8731 ms/op 0.92
BLS aggregatePubkeys 32 - blst 19.715 us/op 19.808 us/op 1.00
BLS aggregatePubkeys 128 - blst 84.162 us/op 71.229 us/op 1.18
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 55.788 ms/op 49.929 ms/op 1.12
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 56.998 ms/op 50.002 ms/op 1.14
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 42.739 ms/op 36.320 ms/op 1.18
getSlashingsAndExits - default max 73.990 us/op 73.020 us/op 1.01
getSlashingsAndExits - 2k 324.67 us/op 295.77 us/op 1.10
proposeBlockBody type=full, size=empty 5.9476 ms/op 6.0075 ms/op 0.99
isKnown best case - 1 super set check 209.00 ns/op 200.00 ns/op 1.04
isKnown normal case - 2 super set checks 205.00 ns/op 194.00 ns/op 1.06
isKnown worse case - 16 super set checks 205.00 ns/op 197.00 ns/op 1.04
InMemoryCheckpointStateCache - add get delete 2.7900 us/op 2.2910 us/op 1.22
validate api signedAggregateAndProof - struct 1.4084 ms/op 1.3733 ms/op 1.03
validate gossip signedAggregateAndProof - struct 1.6484 ms/op 1.3481 ms/op 1.22
batch validate gossip attestation - vc 640000 - chunk 32 117.59 us/op 113.73 us/op 1.03
batch validate gossip attestation - vc 640000 - chunk 64 104.29 us/op 100.34 us/op 1.04
batch validate gossip attestation - vc 640000 - chunk 128 98.122 us/op 92.863 us/op 1.06
batch validate gossip attestation - vc 640000 - chunk 256 101.97 us/op 94.451 us/op 1.08
pickEth1Vote - no votes 1.0598 ms/op 936.06 us/op 1.13
pickEth1Vote - max votes 6.5773 ms/op 5.4028 ms/op 1.22
pickEth1Vote - Eth1Data hashTreeRoot value x2048 12.176 ms/op 10.117 ms/op 1.20
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 20.288 ms/op 13.762 ms/op 1.47
pickEth1Vote - Eth1Data fastSerialize value x2048 441.27 us/op 428.81 us/op 1.03
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.4580 ms/op 2.1300 ms/op 1.62
bytes32 toHexString 364.00 ns/op 359.00 ns/op 1.01
bytes32 Buffer.toString(hex) 277.00 ns/op 237.00 ns/op 1.17
bytes32 Buffer.toString(hex) from Uint8Array 332.00 ns/op 331.00 ns/op 1.00
bytes32 Buffer.toString(hex) + 0x 287.00 ns/op 246.00 ns/op 1.17
Object access 1 prop 0.12600 ns/op 0.11700 ns/op 1.08
Map access 1 prop 0.14100 ns/op 0.12200 ns/op 1.16
Object get x1000 5.9840 ns/op 5.9320 ns/op 1.01
Map get x1000 6.7190 ns/op 6.2420 ns/op 1.08
Object set x1000 32.433 ns/op 27.774 ns/op 1.17
Map set x1000 20.677 ns/op 19.493 ns/op 1.06
Return object 10000 times 0.30580 ns/op 0.28590 ns/op 1.07
Throw Error 10000 times 4.5531 us/op 4.2407 us/op 1.07
toHex 145.09 ns/op 143.08 ns/op 1.01
Buffer.from 136.75 ns/op 121.88 ns/op 1.12
shared Buffer 86.977 ns/op 77.301 ns/op 1.13
fastMsgIdFn sha256 / 200 bytes 2.2250 us/op 2.1450 us/op 1.04
fastMsgIdFn h32 xxhash / 200 bytes 237.00 ns/op 206.00 ns/op 1.15
fastMsgIdFn h64 xxhash / 200 bytes 299.00 ns/op 265.00 ns/op 1.13
fastMsgIdFn sha256 / 1000 bytes 7.2440 us/op 7.2670 us/op 1.00
fastMsgIdFn h32 xxhash / 1000 bytes 363.00 ns/op 334.00 ns/op 1.09
fastMsgIdFn h64 xxhash / 1000 bytes 444.00 ns/op 337.00 ns/op 1.32
fastMsgIdFn sha256 / 10000 bytes 66.153 us/op 64.736 us/op 1.02
fastMsgIdFn h32 xxhash / 10000 bytes 1.8580 us/op 1.7990 us/op 1.03
fastMsgIdFn h64 xxhash / 10000 bytes 1.2270 us/op 1.1850 us/op 1.04
send data - 1000 256B messages 11.547 ms/op 11.898 ms/op 0.97
send data - 1000 512B messages 16.641 ms/op 15.837 ms/op 1.05
send data - 1000 1024B messages 25.404 ms/op 25.682 ms/op 0.99
send data - 1000 1200B messages 26.143 ms/op 21.128 ms/op 1.24
send data - 1000 2048B messages 25.643 ms/op 22.578 ms/op 1.14
send data - 1000 4096B messages 23.419 ms/op 22.746 ms/op 1.03
send data - 1000 16384B messages 70.789 ms/op 73.192 ms/op 0.97
send data - 1000 65536B messages 226.71 ms/op 213.68 ms/op 1.06
enrSubnets - fastDeserialize 64 bits 961.00 ns/op 859.00 ns/op 1.12
enrSubnets - ssz BitVector 64 bits 335.00 ns/op 323.00 ns/op 1.04
enrSubnets - fastDeserialize 4 bits 146.00 ns/op 126.00 ns/op 1.16
enrSubnets - ssz BitVector 4 bits 391.00 ns/op 335.00 ns/op 1.17
prioritizePeers score -10:0 att 32-0.1 sync 2-0 144.86 us/op 115.94 us/op 1.25
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 194.81 us/op 136.22 us/op 1.43
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 273.80 us/op 194.87 us/op 1.41
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 498.52 us/op 365.83 us/op 1.36
prioritizePeers score 0:0 att 64-1 sync 4-1 571.10 us/op 447.43 us/op 1.28
array of 16000 items push then shift 1.6998 us/op 1.5826 us/op 1.07
LinkedList of 16000 items push then shift 8.2360 ns/op 6.9490 ns/op 1.19
array of 16000 items push then pop 82.754 ns/op 73.296 ns/op 1.13
LinkedList of 16000 items push then pop 7.4870 ns/op 6.7670 ns/op 1.11
array of 24000 items push then shift 2.4447 us/op 2.3030 us/op 1.06
LinkedList of 24000 items push then shift 9.1660 ns/op 6.7820 ns/op 1.35
array of 24000 items push then pop 124.52 ns/op 96.427 ns/op 1.29
LinkedList of 24000 items push then pop 7.7550 ns/op 6.5710 ns/op 1.18
intersect bitArray bitLen 8 6.4760 ns/op 6.1000 ns/op 1.06
intersect array and set length 8 40.749 ns/op 36.261 ns/op 1.12
intersect bitArray bitLen 128 30.103 ns/op 28.493 ns/op 1.06
intersect array and set length 128 643.34 ns/op 596.59 ns/op 1.08
bitArray.getTrueBitIndexes() bitLen 128 1.3080 us/op 977.00 ns/op 1.34
bitArray.getTrueBitIndexes() bitLen 248 2.1120 us/op 1.7430 us/op 1.21
bitArray.getTrueBitIndexes() bitLen 512 4.3040 us/op 3.5160 us/op 1.22
Buffer.concat 32 items 728.00 ns/op 607.00 ns/op 1.20
Uint8Array.set 32 items 1.3470 us/op 1.9810 us/op 0.68
Buffer.copy 3.0990 us/op 2.8230 us/op 1.10
Uint8Array.set - with subarray 3.1510 us/op 2.8330 us/op 1.11
Uint8Array.set - without subarray 1.7050 us/op 1.9680 us/op 0.87
getUint32 - dataview 208.00 ns/op 202.00 ns/op 1.03
getUint32 - manual 139.00 ns/op 122.00 ns/op 1.14
Set add up to 64 items then delete first 2.2280 us/op 2.1155 us/op 1.05
OrderedSet add up to 64 items then delete first 3.4634 us/op 3.1247 us/op 1.11
Set add up to 64 items then delete last 2.8505 us/op 2.4387 us/op 1.17
OrderedSet add up to 64 items then delete last 4.6641 us/op 3.7503 us/op 1.24
Set add up to 64 items then delete middle 2.6494 us/op 2.4658 us/op 1.07
OrderedSet add up to 64 items then delete middle 6.0115 us/op 5.1959 us/op 1.16
Set add up to 128 items then delete first 5.7862 us/op 4.8711 us/op 1.19
OrderedSet add up to 128 items then delete first 8.6609 us/op 7.2015 us/op 1.20
Set add up to 128 items then delete last 6.0848 us/op 5.4176 us/op 1.12
OrderedSet add up to 128 items then delete last 7.9686 us/op 7.9812 us/op 1.00
Set add up to 128 items then delete middle 5.5874 us/op 5.3725 us/op 1.04
OrderedSet add up to 128 items then delete middle 14.958 us/op 13.928 us/op 1.07
Set add up to 256 items then delete first 12.258 us/op 9.6920 us/op 1.26
OrderedSet add up to 256 items then delete first 17.877 us/op 14.967 us/op 1.19
Set add up to 256 items then delete last 10.396 us/op 9.5964 us/op 1.08
OrderedSet add up to 256 items then delete last 15.866 us/op 14.954 us/op 1.06
Set add up to 256 items then delete middle 12.036 us/op 9.5174 us/op 1.26
OrderedSet add up to 256 items then delete middle 45.659 us/op 39.730 us/op 1.15
transfer serialized Status (84 B) 2.3560 us/op 2.2330 us/op 1.06
copy serialized Status (84 B) 1.2540 us/op 1.2070 us/op 1.04
transfer serialized SignedVoluntaryExit (112 B) 2.3750 us/op 2.2850 us/op 1.04
copy serialized SignedVoluntaryExit (112 B) 1.2750 us/op 1.2440 us/op 1.02
transfer serialized ProposerSlashing (416 B) 2.3890 us/op 2.3560 us/op 1.01
copy serialized ProposerSlashing (416 B) 1.4610 us/op 1.4130 us/op 1.03
transfer serialized Attestation (485 B) 2.5260 us/op 2.3470 us/op 1.08
copy serialized Attestation (485 B) 1.4870 us/op 2.1730 us/op 0.68
transfer serialized AttesterSlashing (33232 B) 2.7780 us/op 2.5780 us/op 1.08
copy serialized AttesterSlashing (33232 B) 4.2110 us/op 3.5840 us/op 1.17
transfer serialized Small SignedBeaconBlock (128000 B) 3.1780 us/op 3.3970 us/op 0.94
copy serialized Small SignedBeaconBlock (128000 B) 9.8530 us/op 9.0830 us/op 1.08
transfer serialized Avg SignedBeaconBlock (200000 B) 3.7420 us/op 3.8030 us/op 0.98
copy serialized Avg SignedBeaconBlock (200000 B) 15.962 us/op 13.380 us/op 1.19
transfer serialized BlobsSidecar (524380 B) 4.1740 us/op 3.9070 us/op 1.07
copy serialized BlobsSidecar (524380 B) 64.350 us/op 60.359 us/op 1.07
transfer serialized Big SignedBeaconBlock (1000000 B) 4.6610 us/op 3.8510 us/op 1.21
copy serialized Big SignedBeaconBlock (1000000 B) 125.15 us/op 324.71 us/op 0.39
pass gossip attestations to forkchoice per slot 2.7189 ms/op 2.6826 ms/op 1.01
forkChoice updateHead vc 100000 bc 64 eq 0 458.17 us/op 446.39 us/op 1.03
forkChoice updateHead vc 600000 bc 64 eq 0 3.3444 ms/op 2.7432 ms/op 1.22
forkChoice updateHead vc 1000000 bc 64 eq 0 5.4756 ms/op 4.7332 ms/op 1.16
forkChoice updateHead vc 600000 bc 320 eq 0 3.6224 ms/op 2.7674 ms/op 1.31
forkChoice updateHead vc 600000 bc 1200 eq 0 3.0776 ms/op 2.8206 ms/op 1.09
forkChoice updateHead vc 600000 bc 7200 eq 0 3.6782 ms/op 3.0611 ms/op 1.20
forkChoice updateHead vc 600000 bc 64 eq 1000 10.911 ms/op 10.315 ms/op 1.06
forkChoice updateHead vc 600000 bc 64 eq 10000 11.318 ms/op 10.278 ms/op 1.10
forkChoice updateHead vc 600000 bc 64 eq 300000 14.289 ms/op 13.901 ms/op 1.03
computeDeltas 500000 validators 300 proto nodes 4.1965 ms/op 3.8002 ms/op 1.10
computeDeltas 500000 validators 1200 proto nodes 4.4377 ms/op 3.8087 ms/op 1.17
computeDeltas 500000 validators 7200 proto nodes 4.4917 ms/op 3.8198 ms/op 1.18
computeDeltas 750000 validators 300 proto nodes 6.5098 ms/op 5.6442 ms/op 1.15
computeDeltas 750000 validators 1200 proto nodes 7.0317 ms/op 5.7427 ms/op 1.22
computeDeltas 750000 validators 7200 proto nodes 6.8449 ms/op 5.6259 ms/op 1.22
computeDeltas 1400000 validators 300 proto nodes 13.816 ms/op 10.613 ms/op 1.30
computeDeltas 1400000 validators 1200 proto nodes 16.735 ms/op 10.577 ms/op 1.58
computeDeltas 1400000 validators 7200 proto nodes 14.516 ms/op 10.510 ms/op 1.38
computeDeltas 2100000 validators 300 proto nodes 26.908 ms/op 15.997 ms/op 1.68
computeDeltas 2100000 validators 1200 proto nodes 25.921 ms/op 16.337 ms/op 1.59
computeDeltas 2100000 validators 7200 proto nodes 22.518 ms/op 16.076 ms/op 1.40
altair processAttestation - 250000 vs - 7PWei normalcase 2.3884 ms/op 2.9269 ms/op 0.82
altair processAttestation - 250000 vs - 7PWei worstcase 3.8067 ms/op 4.5440 ms/op 0.84
altair processAttestation - setStatus - 1/6 committees join 143.59 us/op 164.61 us/op 0.87
altair processAttestation - setStatus - 1/3 committees join 277.05 us/op 285.16 us/op 0.97
altair processAttestation - setStatus - 1/2 committees join 480.37 us/op 386.05 us/op 1.24
altair processAttestation - setStatus - 2/3 committees join 475.74 us/op 471.46 us/op 1.01
altair processAttestation - setStatus - 4/5 committees join 720.12 us/op 701.62 us/op 1.03
altair processAttestation - setStatus - 100% committees join 770.43 us/op 863.25 us/op 0.89
altair processBlock - 250000 vs - 7PWei normalcase 9.3844 ms/op 10.971 ms/op 0.86
altair processBlock - 250000 vs - 7PWei normalcase hashState 32.131 ms/op 36.689 ms/op 0.88
altair processBlock - 250000 vs - 7PWei worstcase 40.698 ms/op 43.276 ms/op 0.94
altair processBlock - 250000 vs - 7PWei worstcase hashState 85.529 ms/op 94.808 ms/op 0.90
phase0 processBlock - 250000 vs - 7PWei normalcase 1.7924 ms/op 1.8846 ms/op 0.95
phase0 processBlock - 250000 vs - 7PWei worstcase 26.437 ms/op 26.671 ms/op 0.99
altair processEth1Data - 250000 vs - 7PWei normalcase 356.85 us/op 368.07 us/op 0.97
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 6.4580 us/op 7.2890 us/op 0.89
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 46.053 us/op 52.791 us/op 0.87
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 11.992 us/op 13.031 us/op 0.92
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 7.2980 us/op 7.8620 us/op 0.93
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 220.31 us/op 174.59 us/op 1.26
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.9289 ms/op 1.9404 ms/op 0.99
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.4369 ms/op 2.8082 ms/op 0.87
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.5080 ms/op 2.6601 ms/op 0.94
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 5.1157 ms/op 6.1991 ms/op 0.83
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.4994 ms/op 3.4251 ms/op 0.73
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.7153 ms/op 6.7652 ms/op 0.70
Tree 40 250000 create 438.77 ms/op 625.76 ms/op 0.70
Tree 40 250000 get(125000) 147.71 ns/op 151.21 ns/op 0.98
Tree 40 250000 set(125000) 1.8310 us/op 1.7866 us/op 1.02
Tree 40 250000 toArray() 22.457 ms/op 24.095 ms/op 0.93
Tree 40 250000 iterate all - toArray() + loop 22.221 ms/op 26.164 ms/op 0.85
Tree 40 250000 iterate all - get(i) 61.707 ms/op 67.045 ms/op 0.92
Array 250000 create 2.6300 ms/op 3.1440 ms/op 0.84
Array 250000 clone - spread 839.96 us/op 1.8491 ms/op 0.45
Array 250000 get(125000) 0.44900 ns/op 0.42600 ns/op 1.05
Array 250000 set(125000) 0.44200 ns/op 0.45400 ns/op 0.97
Array 250000 iterate all - loop 113.83 us/op 111.74 us/op 1.02
phase0 afterProcessEpoch - 250000 vs - 7PWei 43.985 ms/op 44.216 ms/op 0.99
Array.fill - length 1000000 3.8604 ms/op 4.7149 ms/op 0.82
Array push - length 1000000 18.875 ms/op 21.719 ms/op 0.87
Array.get 0.28502 ns/op 0.28214 ns/op 1.01
Uint8Array.get 0.45404 ns/op 0.45962 ns/op 0.99
phase0 beforeProcessEpoch - 250000 vs - 7PWei 19.846 ms/op 30.417 ms/op 0.65
altair processEpoch - mainnet_e81889 318.64 ms/op 360.79 ms/op 0.88
mainnet_e81889 - altair beforeProcessEpoch 18.360 ms/op 26.725 ms/op 0.69
mainnet_e81889 - altair processJustificationAndFinalization 6.2060 us/op 7.6200 us/op 0.81
mainnet_e81889 - altair processInactivityUpdates 4.4453 ms/op 6.5182 ms/op 0.68
mainnet_e81889 - altair processRewardsAndPenalties 40.582 ms/op 47.334 ms/op 0.86
mainnet_e81889 - altair processRegistryUpdates 752.00 ns/op 821.00 ns/op 0.92
mainnet_e81889 - altair processSlashings 195.00 ns/op 197.00 ns/op 0.99
mainnet_e81889 - altair processEth1DataReset 208.00 ns/op 194.00 ns/op 1.07
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2492 ms/op 1.3154 ms/op 0.95
mainnet_e81889 - altair processSlashingsReset 906.00 ns/op 966.00 ns/op 0.94
mainnet_e81889 - altair processRandaoMixesReset 1.4540 us/op 1.4120 us/op 1.03
mainnet_e81889 - altair processHistoricalRootsUpdate 187.00 ns/op 204.00 ns/op 0.92
mainnet_e81889 - altair processParticipationFlagUpdates 530.00 ns/op 628.00 ns/op 0.84
mainnet_e81889 - altair processSyncCommitteeUpdates 170.00 ns/op 186.00 ns/op 0.91
mainnet_e81889 - altair afterProcessEpoch 45.198 ms/op 47.391 ms/op 0.95
capella processEpoch - mainnet_e217614 946.53 ms/op 1.0069 s/op 0.94
mainnet_e217614 - capella beforeProcessEpoch 64.741 ms/op 63.587 ms/op 1.02
mainnet_e217614 - capella processJustificationAndFinalization 6.9770 us/op 5.5540 us/op 1.26
mainnet_e217614 - capella processInactivityUpdates 17.595 ms/op 17.035 ms/op 1.03
mainnet_e217614 - capella processRewardsAndPenalties 197.82 ms/op 185.32 ms/op 1.07
mainnet_e217614 - capella processRegistryUpdates 12.968 us/op 6.8850 us/op 1.88
mainnet_e217614 - capella processSlashings 208.00 ns/op 186.00 ns/op 1.12
mainnet_e217614 - capella processEth1DataReset 183.00 ns/op 182.00 ns/op 1.01
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.1961 ms/op 4.3372 ms/op 0.97
mainnet_e217614 - capella processSlashingsReset 910.00 ns/op 900.00 ns/op 1.01
mainnet_e217614 - capella processRandaoMixesReset 1.8390 us/op 1.4420 us/op 1.28
mainnet_e217614 - capella processHistoricalRootsUpdate 199.00 ns/op 187.00 ns/op 1.06
mainnet_e217614 - capella processParticipationFlagUpdates 565.00 ns/op 537.00 ns/op 1.05
mainnet_e217614 - capella afterProcessEpoch 115.90 ms/op 118.48 ms/op 0.98
phase0 processEpoch - mainnet_e58758 279.14 ms/op 338.87 ms/op 0.82
mainnet_e58758 - phase0 beforeProcessEpoch 78.422 ms/op 88.797 ms/op 0.88
mainnet_e58758 - phase0 processJustificationAndFinalization 8.4760 us/op 7.6130 us/op 1.11
mainnet_e58758 - phase0 processRewardsAndPenalties 37.593 ms/op 35.159 ms/op 1.07
mainnet_e58758 - phase0 processRegistryUpdates 3.3410 us/op 3.1610 us/op 1.06
mainnet_e58758 - phase0 processSlashings 192.00 ns/op 200.00 ns/op 0.96
mainnet_e58758 - phase0 processEth1DataReset 239.00 ns/op 244.00 ns/op 0.98
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.2228 ms/op 4.6271 ms/op 0.26
mainnet_e58758 - phase0 processSlashingsReset 985.00 ns/op 1.0140 us/op 0.97
mainnet_e58758 - phase0 processRandaoMixesReset 1.3310 us/op 1.2240 us/op 1.09
mainnet_e58758 - phase0 processHistoricalRootsUpdate 207.00 ns/op 185.00 ns/op 1.12
mainnet_e58758 - phase0 processParticipationRecordUpdates 1.0430 us/op 932.00 ns/op 1.12
mainnet_e58758 - phase0 afterProcessEpoch 36.282 ms/op 36.523 ms/op 0.99
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.3035 ms/op 1.3328 ms/op 0.98
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.5069 ms/op 4.2079 ms/op 0.60
altair processInactivityUpdates - 250000 normalcase 23.898 ms/op 17.227 ms/op 1.39
altair processInactivityUpdates - 250000 worstcase 21.704 ms/op 19.375 ms/op 1.12
phase0 processRegistryUpdates - 250000 normalcase 8.3440 us/op 9.5220 us/op 0.88
phase0 processRegistryUpdates - 250000 badcase_full_deposits 277.96 us/op 302.05 us/op 0.92
phase0 processRegistryUpdates - 250000 worstcase 0.5 120.17 ms/op 101.81 ms/op 1.18
altair processRewardsAndPenalties - 250000 normalcase 32.619 ms/op 25.726 ms/op 1.27
altair processRewardsAndPenalties - 250000 worstcase 34.116 ms/op 26.189 ms/op 1.30
phase0 getAttestationDeltas - 250000 normalcase 6.0727 ms/op 6.2020 ms/op 0.98
phase0 getAttestationDeltas - 250000 worstcase 6.0521 ms/op 6.3261 ms/op 0.96
phase0 processSlashings - 250000 worstcase 78.601 us/op 108.02 us/op 0.73
altair processSyncCommitteeUpdates - 250000 10.947 ms/op 11.638 ms/op 0.94
BeaconState.hashTreeRoot - No change 223.00 ns/op 231.00 ns/op 0.97
BeaconState.hashTreeRoot - 1 full validator 82.122 us/op 76.859 us/op 1.07
BeaconState.hashTreeRoot - 32 full validator 967.13 us/op 790.11 us/op 1.22
BeaconState.hashTreeRoot - 512 full validator 9.4388 ms/op 10.104 ms/op 0.93
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 95.822 us/op 91.673 us/op 1.05
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.6864 ms/op 1.3081 ms/op 1.29
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 17.312 ms/op 19.584 ms/op 0.88
BeaconState.hashTreeRoot - 1 balances 86.197 us/op 74.099 us/op 1.16
BeaconState.hashTreeRoot - 32 balances 669.57 us/op 841.49 us/op 0.80
BeaconState.hashTreeRoot - 512 balances 6.9174 ms/op 8.9465 ms/op 0.77
BeaconState.hashTreeRoot - 250000 balances 156.06 ms/op 161.32 ms/op 0.97
aggregationBits - 2048 els - zipIndexesInBitList 22.470 us/op 33.808 us/op 0.66
byteArrayEquals 32 56.086 ns/op 59.546 ns/op 0.94
Buffer.compare 32 19.330 ns/op 19.572 ns/op 0.99
byteArrayEquals 1024 1.6647 us/op 1.7693 us/op 0.94
Buffer.compare 1024 25.758 ns/op 29.180 ns/op 0.88
byteArrayEquals 16384 26.289 us/op 29.298 us/op 0.90
Buffer.compare 16384 206.55 ns/op 201.10 ns/op 1.03
byteArrayEquals 123687377 198.10 ms/op 212.45 ms/op 0.93
Buffer.compare 123687377 7.1636 ms/op 8.6840 ms/op 0.82
byteArrayEquals 32 - diff last byte 54.362 ns/op 58.035 ns/op 0.94
Buffer.compare 32 - diff last byte 17.814 ns/op 18.341 ns/op 0.97
byteArrayEquals 1024 - diff last byte 1.6047 us/op 2.9417 us/op 0.55
Buffer.compare 1024 - diff last byte 25.416 ns/op 50.226 ns/op 0.51
byteArrayEquals 16384 - diff last byte 25.463 us/op 39.679 us/op 0.64
Buffer.compare 16384 - diff last byte 198.65 ns/op 218.40 ns/op 0.91
byteArrayEquals 123687377 - diff last byte 200.47 ms/op 247.65 ms/op 0.81
Buffer.compare 123687377 - diff last byte 9.5353 ms/op 8.6540 ms/op 1.10
byteArrayEquals 32 - random bytes 5.6910 ns/op 5.3530 ns/op 1.06
Buffer.compare 32 - random bytes 17.695 ns/op 17.838 ns/op 0.99
byteArrayEquals 1024 - random bytes 5.3090 ns/op 5.3350 ns/op 1.00
Buffer.compare 1024 - random bytes 17.649 ns/op 17.879 ns/op 0.99
byteArrayEquals 16384 - random bytes 5.2240 ns/op 5.3010 ns/op 0.99
Buffer.compare 16384 - random bytes 17.584 ns/op 17.887 ns/op 0.98
byteArrayEquals 123687377 - random bytes 6.5600 ns/op 10.940 ns/op 0.60
Buffer.compare 123687377 - random bytes 21.790 ns/op 23.510 ns/op 0.93
regular array get 100000 times 34.581 us/op 93.984 us/op 0.37
wrappedArray get 100000 times 47.072 us/op 93.243 us/op 0.50
arrayWithProxy get 100000 times 13.547 ms/op 14.449 ms/op 0.94
ssz.Root.equals 49.782 ns/op 80.530 ns/op 0.62
byteArrayEquals 48.737 ns/op 77.537 ns/op 0.63
Buffer.compare 11.013 ns/op 19.752 ns/op 0.56
processSlot - 1 slots 11.040 us/op 18.269 us/op 0.60
processSlot - 32 slots 2.7305 ms/op 3.9817 ms/op 0.69
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 4.1470 ms/op 4.7408 ms/op 0.87
getCommitteeAssignments - req 1 vs - 250000 vc 2.2748 ms/op 3.0800 ms/op 0.74
getCommitteeAssignments - req 100 vs - 250000 vc 4.3424 ms/op 4.5366 ms/op 0.96
getCommitteeAssignments - req 1000 vs - 250000 vc 4.7130 ms/op 5.3482 ms/op 0.88
findModifiedValidators - 10000 modified validators 848.68 ms/op 877.23 ms/op 0.97
findModifiedValidators - 1000 modified validators 803.37 ms/op 688.21 ms/op 1.17
findModifiedValidators - 100 modified validators 226.62 ms/op 196.54 ms/op 1.15
findModifiedValidators - 10 modified validators 161.30 ms/op 159.09 ms/op 1.01
findModifiedValidators - 1 modified validators 162.66 ms/op 273.39 ms/op 0.59
findModifiedValidators - no difference 206.23 ms/op 276.55 ms/op 0.75
compare ViewDUs 7.3155 s/op 6.8796 s/op 1.06
compare each validator Uint8Array 1.3252 s/op 1.8986 s/op 0.70
compare ViewDU to Uint8Array 1.3381 s/op 1.2158 s/op 1.10
migrate state 1000000 validators, 24 modified, 0 new 1.0614 s/op 835.32 ms/op 1.27
migrate state 1000000 validators, 1700 modified, 1000 new 1.3817 s/op 1.1267 s/op 1.23
migrate state 1000000 validators, 3400 modified, 2000 new 1.5992 s/op 1.1330 s/op 1.41
migrate state 1500000 validators, 24 modified, 0 new 906.74 ms/op 769.85 ms/op 1.18
migrate state 1500000 validators, 1700 modified, 1000 new 1.2719 s/op 966.10 ms/op 1.32
migrate state 1500000 validators, 3400 modified, 2000 new 1.4986 s/op 1.2763 s/op 1.17
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.2300 ns/op 4.1300 ns/op 1.27
state getBlockRootAtSlot - 250000 vs - 7PWei 718.39 ns/op 601.23 ns/op 1.19
naive computeProposerIndex 100000 validators 61.336 ms/op 49.958 ms/op 1.23
computeProposerIndex 100000 validators 1.5980 ms/op 1.4770 ms/op 1.08
naiveGetNextSyncCommitteeIndices 1000 validators 8.3729 s/op 7.3953 s/op 1.13
getNextSyncCommitteeIndices 1000 validators 115.86 ms/op 109.96 ms/op 1.05
naiveGetNextSyncCommitteeIndices 10000 validators 8.1420 s/op 7.6368 s/op 1.07
getNextSyncCommitteeIndices 10000 validators 109.06 ms/op 109.09 ms/op 1.00
naiveGetNextSyncCommitteeIndices 100000 validators 7.5567 s/op 7.6243 s/op 0.99
getNextSyncCommitteeIndices 100000 validators 112.40 ms/op 118.85 ms/op 0.95
naive computeShuffledIndex 100000 validators 26.025 s/op 24.578 s/op 1.06
cached computeShuffledIndex 100000 validators 565.91 ms/op 549.86 ms/op 1.03
naive computeShuffledIndex 2000000 validators 524.56 s/op 497.02 s/op 1.06
cached computeShuffledIndex 2000000 validators 35.714 s/op 28.612 s/op 1.25
computeProposers - vc 250000 609.73 us/op 606.38 us/op 1.01
computeEpochShuffling - vc 250000 42.961 ms/op 40.568 ms/op 1.06
getNextSyncCommittee - vc 250000 10.558 ms/op 10.081 ms/op 1.05
computeSigningRoot for AttestationData 22.373 us/op 20.106 us/op 1.11
hash AttestationData serialized data then Buffer.toString(base64) 1.5902 us/op 1.5170 us/op 1.05
toHexString serialized data 1.2296 us/op 1.0896 us/op 1.13
Buffer.toString(base64) 150.09 ns/op 153.71 ns/op 0.98
nodejs block root to RootHex using toHex 144.28 ns/op 146.56 ns/op 0.98
nodejs block root to RootHex using toRootHex 88.012 ns/op 87.290 ns/op 1.01
browser block root to RootHex using the deprecated toHexString 213.40 ns/op 206.38 ns/op 1.03
browser block root to RootHex using toHex 172.77 ns/op 166.94 ns/op 1.03
browser block root to RootHex using toRootHex 159.67 ns/op 157.61 ns/op 1.01

by benchmarkbot/action

@codecov

codecov Bot commented Jun 2, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 36.08247% with 62 lines in your changes missing coverage. Please review.

Project coverage is 55.73%. Comparing base (9330899) to head (cb0e5ab).
Report is 9 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #7902      +/-   ##
============================================
- Coverage     55.77%   55.73%   -0.04%     
============================================
  Files           830      832       +2     
  Lines         59228    59332     +104     
  Branches       4562     4571       +9     
============================================
+ Hits          33033    33070      +37     
- Misses        26128    26195      +67     
  Partials         67       67              
🚀 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.

ensi321 added a commit that referenced this pull request Jun 5, 2025
There are several changes in spec test v1.6.0-alpha.1.
- Introduce eip7805 spec test
- Add `pre_epoch` and `post_epoch` definition in epoch processing.


This PR adds code in preparation for v1.6.0-alpha.1 to minimize changes
needs to be made in #7902


Partially resolve #7918
@ensi321 ensi321 marked this pull request as ready for review June 9, 2025 07:28
@ensi321 ensi321 requested a review from a team as a code owner June 9, 2025 07:28
@ensi321 ensi321 mentioned this pull request Jun 9, 2025
@nflaig nflaig merged commit b2b1a6d into unstable Jun 9, 2025
19 checks passed
@nflaig nflaig deleted the nc/eip-7917 branch June 9, 2025 19:55
{},
e as Error
);
state.commit();

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.

no need state.commit() here

e as Error
);
state.commit();
shuffling = computeEpochShuffling(state, getActiveValidatorIndices(state, epoch), epoch);

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.

@ensi321 @nflaig we already have nextShufflingActiveIndices after beforeProcessEpoch so only need to get it from epoch transition cache
the idea is only to do state.validators loop once per epoch

// EpochCache needs to cache shuffling for nextEpoch + 1 too.
let shuffling: EpochShuffling;
try {
shuffling = state.epochCtx.getShufflingAtEpoch(epoch);

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.

this is not correct because shuffling of epoch + 2 is not available at this time so this line will always fail
we should do the query from shufflingCache similar to https://github.com/ChainSafe/lodestar/blob/v1.31.0/packages/state-transition/src/cache/epochCache.ts#L656

need to add a metric of number of times of hit/miss or see if it's available in the shuffling cache
hopefully most of the time shuffling of epoch + 2 is ready

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.

lodestar_shuffling_cache_miss_count shows that most of the time we don't miss shuffling of epoch + 2, this is on one of lido node
Screenshot 2025-06-10 at 09 07 16

I think there is a tiny difference querying shuffling at this place (the end of processEpoch) vs afterProcessEpoch so expect it's not an issue most of the time

nflaig added a commit that referenced this pull request Jun 12, 2025
**Motivation**

Bring proposer lookahead fixes to unstable branch, does not include
shuffling calculation changes from
#7945 yet.

**Description**

- only use proposer lookahead from state if epoch is post fulu
- track epoch transition step time for proposer lookahead


Related #7902
KatyaRyazantseva pushed a commit to KatyaRyazantseva/lodestar that referenced this pull request Jun 19, 2025
This is the first implementation of EIP-7917. 

We will want to have a plan deprecate proposer caches in `EpochCache`
since Fulu beacon state will carry those information. This will be
addressed in a later PR.

Pending spec release for spec test

Spec PR ethereum/consensus-specs#4190

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
KatyaRyazantseva pushed a commit to KatyaRyazantseva/lodestar that referenced this pull request Jun 19, 2025
**Motivation**

Bring proposer lookahead fixes to unstable branch, does not include
shuffling calculation changes from
ChainSafe#7945 yet.

**Description**

- only use proposer lookahead from state if epoch is post fulu
- track epoch transition step time for proposer lookahead


Related ChainSafe#7902
@wemeetagain

Copy link
Copy Markdown
Member

🎉 This PR is included in v1.32.0 🎉

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants