Skip to content

Comments

feat: use bps instead of INTERVALS_PER_SLOT for deadlines#8091

Merged
ensi321 merged 73 commits intounstablefrom
nc/timing-refactor
Sep 26, 2025
Merged

feat: use bps instead of INTERVALS_PER_SLOT for deadlines#8091
ensi321 merged 73 commits intounstablefrom
nc/timing-refactor

Conversation

@ensi321
Copy link
Contributor

@ensi321 ensi321 commented Jul 29, 2025

Closes #8013

@github-actions
Copy link
Contributor

github-actions bot commented Jul 29, 2025

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 6bde927 Previous: 21ba277 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.1514 ms/op 983.65 us/op 1.17
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 39.363 us/op 36.673 us/op 1.07
BLS verify - blst 1.0266 ms/op 864.34 us/op 1.19
BLS verifyMultipleSignatures 3 - blst 1.5257 ms/op 1.2498 ms/op 1.22
BLS verifyMultipleSignatures 8 - blst 2.1230 ms/op 2.0603 ms/op 1.03
BLS verifyMultipleSignatures 32 - blst 6.0139 ms/op 5.6158 ms/op 1.07
BLS verifyMultipleSignatures 64 - blst 12.170 ms/op 11.821 ms/op 1.03
BLS verifyMultipleSignatures 128 - blst 20.753 ms/op 17.733 ms/op 1.17
BLS deserializing 10000 signatures 804.90 ms/op 715.39 ms/op 1.13
BLS deserializing 100000 signatures 7.6303 s/op 7.1118 s/op 1.07
BLS verifyMultipleSignatures - same message - 3 - blst 1.1229 ms/op 1.1745 ms/op 0.96
BLS verifyMultipleSignatures - same message - 8 - blst 1.2320 ms/op 1.1182 ms/op 1.10
BLS verifyMultipleSignatures - same message - 32 - blst 1.8623 ms/op 1.8218 ms/op 1.02
BLS verifyMultipleSignatures - same message - 64 - blst 2.8207 ms/op 2.7629 ms/op 1.02
BLS verifyMultipleSignatures - same message - 128 - blst 4.8127 ms/op 4.4323 ms/op 1.09
BLS aggregatePubkeys 32 - blst 22.211 us/op 21.414 us/op 1.04
BLS aggregatePubkeys 128 - blst 73.068 us/op 70.046 us/op 1.04
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 60.650 ms/op 58.630 ms/op 1.03
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 52.747 ms/op 60.024 ms/op 0.88
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 46.665 ms/op 39.861 ms/op 1.17
getSlashingsAndExits - default max 79.517 us/op 86.628 us/op 0.92
getSlashingsAndExits - 2k 352.68 us/op 335.48 us/op 1.05
isKnown best case - 1 super set check 220.00 ns/op 195.00 ns/op 1.13
isKnown normal case - 2 super set checks 220.00 ns/op 192.00 ns/op 1.15
isKnown worse case - 16 super set checks 217.00 ns/op 194.00 ns/op 1.12
InMemoryCheckpointStateCache - add get delete 2.4420 us/op 2.3460 us/op 1.04
validate api signedAggregateAndProof - struct 1.7578 ms/op 1.5651 ms/op 1.12
validate gossip signedAggregateAndProof - struct 1.4324 ms/op 2.1265 ms/op 0.67
batch validate gossip attestation - vc 640000 - chunk 32 118.53 us/op 120.49 us/op 0.98
batch validate gossip attestation - vc 640000 - chunk 64 104.76 us/op 105.57 us/op 0.99
batch validate gossip attestation - vc 640000 - chunk 128 95.940 us/op 127.36 us/op 0.75
batch validate gossip attestation - vc 640000 - chunk 256 101.06 us/op 137.82 us/op 0.73
pickEth1Vote - no votes 996.36 us/op 1.1915 ms/op 0.84
pickEth1Vote - max votes 5.4328 ms/op 13.661 ms/op 0.40
pickEth1Vote - Eth1Data hashTreeRoot value x2048 10.807 ms/op 17.079 ms/op 0.63
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 18.891 ms/op 37.388 ms/op 0.51
pickEth1Vote - Eth1Data fastSerialize value x2048 459.87 us/op 683.18 us/op 0.67
pickEth1Vote - Eth1Data fastSerialize tree x2048 2.3007 ms/op 5.8943 ms/op 0.39
bytes32 toHexString 370.00 ns/op 423.00 ns/op 0.87
bytes32 Buffer.toString(hex) 252.00 ns/op 263.00 ns/op 0.96
bytes32 Buffer.toString(hex) from Uint8Array 341.00 ns/op 355.00 ns/op 0.96
bytes32 Buffer.toString(hex) + 0x 260.00 ns/op 412.00 ns/op 0.63
Object access 1 prop 0.12400 ns/op 0.17000 ns/op 0.73
Map access 1 prop 0.12700 ns/op 0.20500 ns/op 0.62
Object get x1000 6.0010 ns/op 6.6720 ns/op 0.90
Map get x1000 6.5220 ns/op 12.091 ns/op 0.54
Object set x1000 28.678 ns/op 47.812 ns/op 0.60
Map set x1000 20.148 ns/op 26.448 ns/op 0.76
Return object 10000 times 0.30290 ns/op 0.32770 ns/op 0.92
Throw Error 10000 times 4.4591 us/op 6.1142 us/op 0.73
toHex 126.10 ns/op 167.82 ns/op 0.75
Buffer.from 123.92 ns/op 200.33 ns/op 0.62
shared Buffer 83.084 ns/op 92.816 ns/op 0.90
fastMsgIdFn sha256 / 200 bytes 2.2010 us/op 2.3970 us/op 0.92
fastMsgIdFn h32 xxhash / 200 bytes 203.00 ns/op 298.00 ns/op 0.68
fastMsgIdFn h64 xxhash / 200 bytes 270.00 ns/op 302.00 ns/op 0.89
fastMsgIdFn sha256 / 1000 bytes 7.1720 us/op 8.2660 us/op 0.87
fastMsgIdFn h32 xxhash / 1000 bytes 347.00 ns/op 424.00 ns/op 0.82
fastMsgIdFn h64 xxhash / 1000 bytes 357.00 ns/op 531.00 ns/op 0.67
fastMsgIdFn sha256 / 10000 bytes 66.452 us/op 71.217 us/op 0.93
fastMsgIdFn h32 xxhash / 10000 bytes 1.8870 us/op 2.0200 us/op 0.93
fastMsgIdFn h64 xxhash / 10000 bytes 1.2610 us/op 1.3680 us/op 0.92
send data - 1000 256B messages 18.184 ms/op 24.175 ms/op 0.75
send data - 1000 512B messages 21.903 ms/op 30.654 ms/op 0.71
send data - 1000 1024B messages 28.036 ms/op 42.177 ms/op 0.66
send data - 1000 1200B messages 22.085 ms/op 35.009 ms/op 0.63
send data - 1000 2048B messages 25.054 ms/op 33.153 ms/op 0.76
send data - 1000 4096B messages 30.845 ms/op 37.726 ms/op 0.82
send data - 1000 16384B messages 44.419 ms/op 65.339 ms/op 0.68
send data - 1000 65536B messages 114.44 ms/op 164.99 ms/op 0.69
enrSubnets - fastDeserialize 64 bits 922.00 ns/op 1.3100 us/op 0.70
enrSubnets - ssz BitVector 64 bits 348.00 ns/op 409.00 ns/op 0.85
enrSubnets - fastDeserialize 4 bits 137.00 ns/op 163.00 ns/op 0.84
enrSubnets - ssz BitVector 4 bits 329.00 ns/op 390.00 ns/op 0.84
prioritizePeers score -10:0 att 32-0.1 sync 2-0 236.75 us/op 323.25 us/op 0.73
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 274.22 us/op 341.89 us/op 0.80
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 386.78 us/op 586.65 us/op 0.66
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 719.18 us/op 930.67 us/op 0.77
prioritizePeers score 0:0 att 64-1 sync 4-1 869.72 us/op 1.1333 ms/op 0.77
array of 16000 items push then shift 1.6331 us/op 1.8645 us/op 0.88
LinkedList of 16000 items push then shift 7.3460 ns/op 10.822 ns/op 0.68
array of 16000 items push then pop 74.973 ns/op 100.62 ns/op 0.75
LinkedList of 16000 items push then pop 7.2030 ns/op 11.033 ns/op 0.65
array of 24000 items push then shift 2.4036 us/op 3.4024 us/op 0.71
LinkedList of 24000 items push then shift 7.3290 ns/op 10.299 ns/op 0.71
array of 24000 items push then pop 102.70 ns/op 137.31 ns/op 0.75
LinkedList of 24000 items push then pop 7.1980 ns/op 10.633 ns/op 0.68
intersect bitArray bitLen 8 6.5760 ns/op 7.1960 ns/op 0.91
intersect array and set length 8 39.277 ns/op 45.367 ns/op 0.87
intersect bitArray bitLen 128 31.853 ns/op 32.865 ns/op 0.97
intersect array and set length 128 694.58 ns/op 705.07 ns/op 0.99
bitArray.getTrueBitIndexes() bitLen 128 1.0300 us/op 1.2830 us/op 0.80
bitArray.getTrueBitIndexes() bitLen 248 1.8520 us/op 2.1810 us/op 0.85
bitArray.getTrueBitIndexes() bitLen 512 3.9240 us/op 4.9160 us/op 0.80
Buffer.concat 32 items 663.00 ns/op 763.00 ns/op 0.87
Uint8Array.set 32 items 1.0320 us/op 2.0250 us/op 0.51
Buffer.copy 2.2870 us/op 3.3240 us/op 0.69
Uint8Array.set - with subarray 2.3140 us/op 2.7270 us/op 0.85
Uint8Array.set - without subarray 900.00 ns/op 1.8520 us/op 0.49
getUint32 - dataview 214.00 ns/op 225.00 ns/op 0.95
getUint32 - manual 130.00 ns/op 136.00 ns/op 0.96
Set add up to 64 items then delete first 2.4952 us/op 2.3258 us/op 1.07
OrderedSet add up to 64 items then delete first 3.7692 us/op 5.2594 us/op 0.72
Set add up to 64 items then delete last 2.7001 us/op 3.4580 us/op 0.78
OrderedSet add up to 64 items then delete last 4.0167 us/op 5.5402 us/op 0.73
Set add up to 64 items then delete middle 2.6003 us/op 3.7463 us/op 0.69
OrderedSet add up to 64 items then delete middle 5.8770 us/op 7.9609 us/op 0.74
Set add up to 128 items then delete first 5.0748 us/op 7.4588 us/op 0.68
OrderedSet add up to 128 items then delete first 7.6865 us/op 12.630 us/op 0.61
Set add up to 128 items then delete last 5.3738 us/op 7.1487 us/op 0.75
OrderedSet add up to 128 items then delete last 8.2740 us/op 11.982 us/op 0.69
Set add up to 128 items then delete middle 5.1739 us/op 7.3166 us/op 0.71
OrderedSet add up to 128 items then delete middle 14.848 us/op 20.922 us/op 0.71
Set add up to 256 items then delete first 10.477 us/op 15.593 us/op 0.67
OrderedSet add up to 256 items then delete first 16.392 us/op 24.111 us/op 0.68
Set add up to 256 items then delete last 10.148 us/op 14.521 us/op 0.70
OrderedSet add up to 256 items then delete last 16.119 us/op 22.359 us/op 0.72
Set add up to 256 items then delete middle 11.326 us/op 14.625 us/op 0.77
OrderedSet add up to 256 items then delete middle 47.563 us/op 52.921 us/op 0.90
transfer serialized Status (84 B) 2.3110 us/op 3.3290 us/op 0.69
copy serialized Status (84 B) 1.1950 us/op 1.8970 us/op 0.63
transfer serialized SignedVoluntaryExit (112 B) 2.3780 us/op 3.1600 us/op 0.75
copy serialized SignedVoluntaryExit (112 B) 1.1910 us/op 2.0320 us/op 0.59
transfer serialized ProposerSlashing (416 B) 2.4010 us/op 3.7480 us/op 0.64
copy serialized ProposerSlashing (416 B) 1.2120 us/op 2.5760 us/op 0.47
transfer serialized Attestation (485 B) 2.4010 us/op 3.6190 us/op 0.66
copy serialized Attestation (485 B) 1.2290 us/op 2.3460 us/op 0.52
transfer serialized AttesterSlashing (33232 B) 2.4800 us/op 3.6530 us/op 0.68
copy serialized AttesterSlashing (33232 B) 3.7060 us/op 6.1970 us/op 0.60
transfer serialized Small SignedBeaconBlock (128000 B) 2.9700 us/op 4.0970 us/op 0.72
copy serialized Small SignedBeaconBlock (128000 B) 10.768 us/op 16.047 us/op 0.67
transfer serialized Avg SignedBeaconBlock (200000 B) 3.3920 us/op 4.5090 us/op 0.75
copy serialized Avg SignedBeaconBlock (200000 B) 17.425 us/op 24.167 us/op 0.72
transfer serialized BlobsSidecar (524380 B) 3.5120 us/op 5.0080 us/op 0.70
copy serialized BlobsSidecar (524380 B) 103.26 us/op 95.831 us/op 1.08
transfer serialized Big SignedBeaconBlock (1000000 B) 3.7620 us/op 5.3550 us/op 0.70
copy serialized Big SignedBeaconBlock (1000000 B) 126.43 us/op 159.66 us/op 0.79
pass gossip attestations to forkchoice per slot 2.8195 ms/op 3.1062 ms/op 0.91
forkChoice updateHead vc 100000 bc 64 eq 0 515.03 us/op 507.06 us/op 1.02
forkChoice updateHead vc 600000 bc 64 eq 0 3.0615 ms/op 3.9137 ms/op 0.78
forkChoice updateHead vc 1000000 bc 64 eq 0 5.4113 ms/op 5.8148 ms/op 0.93
forkChoice updateHead vc 600000 bc 320 eq 0 3.1310 ms/op 3.0583 ms/op 1.02
forkChoice updateHead vc 600000 bc 1200 eq 0 3.0660 ms/op 3.0407 ms/op 1.01
forkChoice updateHead vc 600000 bc 7200 eq 0 3.2108 ms/op 3.4217 ms/op 0.94
forkChoice updateHead vc 600000 bc 64 eq 1000 10.820 ms/op 11.494 ms/op 0.94
forkChoice updateHead vc 600000 bc 64 eq 10000 10.977 ms/op 11.694 ms/op 0.94
forkChoice updateHead vc 600000 bc 64 eq 300000 14.183 ms/op 19.519 ms/op 0.73
computeDeltas 500000 validators 300 proto nodes 4.5551 ms/op 4.1802 ms/op 1.09
computeDeltas 500000 validators 1200 proto nodes 4.5283 ms/op 4.3935 ms/op 1.03
computeDeltas 500000 validators 7200 proto nodes 4.7091 ms/op 4.5289 ms/op 1.04
computeDeltas 750000 validators 300 proto nodes 6.6325 ms/op 6.6714 ms/op 0.99
computeDeltas 750000 validators 1200 proto nodes 6.6293 ms/op 6.0376 ms/op 1.10
computeDeltas 750000 validators 7200 proto nodes 6.7475 ms/op 6.2138 ms/op 1.09
computeDeltas 1400000 validators 300 proto nodes 12.432 ms/op 11.215 ms/op 1.11
computeDeltas 1400000 validators 1200 proto nodes 12.288 ms/op 11.184 ms/op 1.10
computeDeltas 1400000 validators 7200 proto nodes 11.593 ms/op 10.780 ms/op 1.08
computeDeltas 2100000 validators 300 proto nodes 17.915 ms/op 17.084 ms/op 1.05
computeDeltas 2100000 validators 1200 proto nodes 17.993 ms/op 17.494 ms/op 1.03
computeDeltas 2100000 validators 7200 proto nodes 18.439 ms/op 19.168 ms/op 0.96
altair processAttestation - 250000 vs - 7PWei normalcase 2.4371 ms/op 3.8691 ms/op 0.63
altair processAttestation - 250000 vs - 7PWei worstcase 3.3066 ms/op 3.8588 ms/op 0.86
altair processAttestation - setStatus - 1/6 committees join 133.71 us/op 144.40 us/op 0.93
altair processAttestation - setStatus - 1/3 committees join 261.53 us/op 270.87 us/op 0.97
altair processAttestation - setStatus - 1/2 committees join 375.07 us/op 401.46 us/op 0.93
altair processAttestation - setStatus - 2/3 committees join 469.96 us/op 468.56 us/op 1.00
altair processAttestation - setStatus - 4/5 committees join 722.65 us/op 693.03 us/op 1.04
altair processAttestation - setStatus - 100% committees join 759.74 us/op 757.08 us/op 1.00
altair processBlock - 250000 vs - 7PWei normalcase 5.0283 ms/op 9.1578 ms/op 0.55
altair processBlock - 250000 vs - 7PWei normalcase hashState 29.922 ms/op 33.674 ms/op 0.89
altair processBlock - 250000 vs - 7PWei worstcase 38.972 ms/op 40.861 ms/op 0.95
altair processBlock - 250000 vs - 7PWei worstcase hashState 81.683 ms/op 95.969 ms/op 0.85
phase0 processBlock - 250000 vs - 7PWei normalcase 1.9008 ms/op 2.0166 ms/op 0.94
phase0 processBlock - 250000 vs - 7PWei worstcase 28.612 ms/op 27.786 ms/op 1.03
altair processEth1Data - 250000 vs - 7PWei normalcase 373.01 us/op 560.74 us/op 0.67
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 6.7970 us/op 7.7310 us/op 0.88
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 42.079 us/op 51.116 us/op 0.82
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 11.173 us/op 13.728 us/op 0.81
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 8.6960 us/op 10.311 us/op 0.84
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 180.12 us/op 216.69 us/op 0.83
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 2.3175 ms/op 2.4100 ms/op 0.96
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.6158 ms/op 2.5322 ms/op 1.03
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.5665 ms/op 2.7220 ms/op 0.94
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 5.0657 ms/op 5.2187 ms/op 0.97
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.6079 ms/op 2.6772 ms/op 0.97
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 5.0044 ms/op 5.1218 ms/op 0.98
Tree 40 250000 create 494.19 ms/op 494.88 ms/op 1.00
Tree 40 250000 get(125000) 148.12 ns/op 147.18 ns/op 1.01
Tree 40 250000 set(125000) 1.5171 us/op 1.5757 us/op 0.96
Tree 40 250000 toArray() 19.658 ms/op 16.228 ms/op 1.21
Tree 40 250000 iterate all - toArray() + loop 19.704 ms/op 16.318 ms/op 1.21
Tree 40 250000 iterate all - get(i) 59.347 ms/op 52.313 ms/op 1.13
Array 250000 create 2.7505 ms/op 2.5517 ms/op 1.08
Array 250000 clone - spread 1.4995 ms/op 1.6818 ms/op 0.89
Array 250000 get(125000) 0.42900 ns/op 0.41500 ns/op 1.03
Array 250000 set(125000) 0.50000 ns/op 0.43800 ns/op 1.14
Array 250000 iterate all - loop 116.34 us/op 100.29 us/op 1.16
phase0 afterProcessEpoch - 250000 vs - 7PWei 43.516 ms/op 40.258 ms/op 1.08
Array.fill - length 1000000 3.5651 ms/op 3.3530 ms/op 1.06
Array push - length 1000000 16.145 ms/op 17.397 ms/op 0.93
Array.get 0.29039 ns/op 0.27240 ns/op 1.07
Uint8Array.get 0.45975 ns/op 0.43888 ns/op 1.05
phase0 beforeProcessEpoch - 250000 vs - 7PWei 19.979 ms/op 15.618 ms/op 1.28
altair processEpoch - mainnet_e81889 329.50 ms/op 298.15 ms/op 1.11
mainnet_e81889 - altair beforeProcessEpoch 20.749 ms/op 19.324 ms/op 1.07
mainnet_e81889 - altair processJustificationAndFinalization 8.6880 us/op 5.5280 us/op 1.57
mainnet_e81889 - altair processInactivityUpdates 5.6535 ms/op 4.4273 ms/op 1.28
mainnet_e81889 - altair processRewardsAndPenalties 42.997 ms/op 40.724 ms/op 1.06
mainnet_e81889 - altair processRegistryUpdates 821.00 ns/op 755.00 ns/op 1.09
mainnet_e81889 - altair processSlashings 216.00 ns/op 186.00 ns/op 1.16
mainnet_e81889 - altair processEth1DataReset 207.00 ns/op 177.00 ns/op 1.17
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.3089 ms/op 1.2230 ms/op 1.07
mainnet_e81889 - altair processSlashingsReset 996.00 ns/op 1.0890 us/op 0.91
mainnet_e81889 - altair processRandaoMixesReset 1.3110 us/op 1.2920 us/op 1.01
mainnet_e81889 - altair processHistoricalRootsUpdate 191.00 ns/op 202.00 ns/op 0.95
mainnet_e81889 - altair processParticipationFlagUpdates 591.00 ns/op 605.00 ns/op 0.98
mainnet_e81889 - altair processSyncCommitteeUpdates 161.00 ns/op 159.00 ns/op 1.01
mainnet_e81889 - altair afterProcessEpoch 61.246 ms/op 46.110 ms/op 1.33
capella processEpoch - mainnet_e217614 980.23 ms/op 927.39 ms/op 1.06
mainnet_e217614 - capella beforeProcessEpoch 67.425 ms/op 68.720 ms/op 0.98
mainnet_e217614 - capella processJustificationAndFinalization 8.1650 us/op 6.6100 us/op 1.24
mainnet_e217614 - capella processInactivityUpdates 15.894 ms/op 15.913 ms/op 1.00
mainnet_e217614 - capella processRewardsAndPenalties 205.36 ms/op 186.79 ms/op 1.10
mainnet_e217614 - capella processRegistryUpdates 7.9250 us/op 7.3120 us/op 1.08
mainnet_e217614 - capella processSlashings 213.00 ns/op 204.00 ns/op 1.04
mainnet_e217614 - capella processEth1DataReset 181.00 ns/op 192.00 ns/op 0.94
mainnet_e217614 - capella processEffectiveBalanceUpdates 14.231 ms/op 7.0586 ms/op 2.02
mainnet_e217614 - capella processSlashingsReset 1.1130 us/op 1000.0 ns/op 1.11
mainnet_e217614 - capella processRandaoMixesReset 1.4600 us/op 1.3810 us/op 1.06
mainnet_e217614 - capella processHistoricalRootsUpdate 216.00 ns/op 196.00 ns/op 1.10
mainnet_e217614 - capella processParticipationFlagUpdates 577.00 ns/op 547.00 ns/op 1.05
mainnet_e217614 - capella afterProcessEpoch 134.30 ms/op 123.00 ms/op 1.09
phase0 processEpoch - mainnet_e58758 328.65 ms/op 353.18 ms/op 0.93
mainnet_e58758 - phase0 beforeProcessEpoch 88.778 ms/op 100.00 ms/op 0.89
mainnet_e58758 - phase0 processJustificationAndFinalization 8.7760 us/op 6.2290 us/op 1.41
mainnet_e58758 - phase0 processRewardsAndPenalties 41.234 ms/op 40.578 ms/op 1.02
mainnet_e58758 - phase0 processRegistryUpdates 3.9030 us/op 3.3990 us/op 1.15
mainnet_e58758 - phase0 processSlashings 210.00 ns/op 193.00 ns/op 1.09
mainnet_e58758 - phase0 processEth1DataReset 187.00 ns/op 191.00 ns/op 0.98
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.4020 ms/op 1.3042 ms/op 1.07
mainnet_e58758 - phase0 processSlashingsReset 1.0320 us/op 1.3280 us/op 0.78
mainnet_e58758 - phase0 processRandaoMixesReset 1.4110 us/op 1.4730 us/op 0.96
mainnet_e58758 - phase0 processHistoricalRootsUpdate 200.00 ns/op 190.00 ns/op 1.05
mainnet_e58758 - phase0 processParticipationRecordUpdates 980.00 ns/op 1.0660 us/op 0.92
mainnet_e58758 - phase0 afterProcessEpoch 39.587 ms/op 38.115 ms/op 1.04
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.4438 ms/op 1.4197 ms/op 1.02
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.1308 ms/op 3.2650 ms/op 0.65
altair processInactivityUpdates - 250000 normalcase 21.380 ms/op 22.314 ms/op 0.96
altair processInactivityUpdates - 250000 worstcase 20.793 ms/op 20.364 ms/op 1.02
phase0 processRegistryUpdates - 250000 normalcase 7.9160 us/op 8.4130 us/op 0.94
phase0 processRegistryUpdates - 250000 badcase_full_deposits 330.30 us/op 286.43 us/op 1.15
phase0 processRegistryUpdates - 250000 worstcase 0.5 117.82 ms/op 115.03 ms/op 1.02
altair processRewardsAndPenalties - 250000 normalcase 30.509 ms/op 29.440 ms/op 1.04
altair processRewardsAndPenalties - 250000 worstcase 36.121 ms/op 29.498 ms/op 1.22
phase0 getAttestationDeltas - 250000 normalcase 8.6186 ms/op 8.0722 ms/op 1.07
phase0 getAttestationDeltas - 250000 worstcase 7.1579 ms/op 6.3892 ms/op 1.12
phase0 processSlashings - 250000 worstcase 105.08 us/op 128.47 us/op 0.82
altair processSyncCommitteeUpdates - 250000 13.543 ms/op 11.869 ms/op 1.14
BeaconState.hashTreeRoot - No change 256.00 ns/op 241.00 ns/op 1.06
BeaconState.hashTreeRoot - 1 full validator 111.76 us/op 103.78 us/op 1.08
BeaconState.hashTreeRoot - 32 full validator 1.5220 ms/op 1.4322 ms/op 1.06
BeaconState.hashTreeRoot - 512 full validator 14.531 ms/op 13.362 ms/op 1.09
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 183.16 us/op 106.17 us/op 1.73
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.9583 ms/op 1.8530 ms/op 1.06
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 35.516 ms/op 27.346 ms/op 1.30
BeaconState.hashTreeRoot - 1 balances 91.151 us/op 75.236 us/op 1.21
BeaconState.hashTreeRoot - 32 balances 1.0339 ms/op 873.19 us/op 1.18
BeaconState.hashTreeRoot - 512 balances 10.582 ms/op 9.9433 ms/op 1.06
BeaconState.hashTreeRoot - 250000 balances 215.63 ms/op 144.28 ms/op 1.49
aggregationBits - 2048 els - zipIndexesInBitList 25.761 us/op 24.259 us/op 1.06
byteArrayEquals 32 63.423 ns/op 55.548 ns/op 1.14
Buffer.compare 32 21.223 ns/op 17.908 ns/op 1.19
byteArrayEquals 1024 1.8774 us/op 1.6506 us/op 1.14
Buffer.compare 1024 29.102 ns/op 25.612 ns/op 1.14
byteArrayEquals 16384 28.159 us/op 26.480 us/op 1.06
Buffer.compare 16384 230.54 ns/op 200.25 ns/op 1.15
byteArrayEquals 123687377 221.69 ms/op 197.37 ms/op 1.12
Buffer.compare 123687377 8.3928 ms/op 7.6471 ms/op 1.10
byteArrayEquals 32 - diff last byte 59.393 ns/op 54.356 ns/op 1.09
Buffer.compare 32 - diff last byte 19.813 ns/op 17.969 ns/op 1.10
byteArrayEquals 1024 - diff last byte 1.7941 us/op 1.6409 us/op 1.09
Buffer.compare 1024 - diff last byte 29.276 ns/op 27.698 ns/op 1.06
byteArrayEquals 16384 - diff last byte 28.719 us/op 26.109 us/op 1.10
Buffer.compare 16384 - diff last byte 238.35 ns/op 202.42 ns/op 1.18
byteArrayEquals 123687377 - diff last byte 215.64 ms/op 204.93 ms/op 1.05
Buffer.compare 123687377 - diff last byte 7.3993 ms/op 8.8098 ms/op 0.84
byteArrayEquals 32 - random bytes 5.9350 ns/op 5.3460 ns/op 1.11
Buffer.compare 32 - random bytes 19.393 ns/op 18.847 ns/op 1.03
byteArrayEquals 1024 - random bytes 5.7950 ns/op 5.4140 ns/op 1.07
Buffer.compare 1024 - random bytes 19.075 ns/op 18.527 ns/op 1.03
byteArrayEquals 16384 - random bytes 5.6740 ns/op 5.3420 ns/op 1.06
Buffer.compare 16384 - random bytes 19.118 ns/op 19.392 ns/op 0.99
byteArrayEquals 123687377 - random bytes 7.9700 ns/op 6.5200 ns/op 1.22
Buffer.compare 123687377 - random bytes 20.710 ns/op 19.800 ns/op 1.05
regular array get 100000 times 35.073 us/op 37.996 us/op 0.92
wrappedArray get 100000 times 34.784 us/op 46.098 us/op 0.75
arrayWithProxy get 100000 times 12.747 ms/op 13.130 ms/op 0.97
ssz.Root.equals 50.101 ns/op 47.756 ns/op 1.05
byteArrayEquals 49.232 ns/op 47.288 ns/op 1.04
Buffer.compare 11.289 ns/op 10.905 ns/op 1.04
processSlot - 1 slots 13.792 us/op 11.436 us/op 1.21
processSlot - 32 slots 3.6400 ms/op 3.0015 ms/op 1.21
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 3.4300 ms/op 3.5580 ms/op 0.96
getCommitteeAssignments - req 1 vs - 250000 vc 2.3399 ms/op 2.2358 ms/op 1.05
getCommitteeAssignments - req 100 vs - 250000 vc 4.6554 ms/op 4.2466 ms/op 1.10
getCommitteeAssignments - req 1000 vs - 250000 vc 5.1728 ms/op 4.6049 ms/op 1.12
findModifiedValidators - 10000 modified validators 813.92 ms/op 738.85 ms/op 1.10
findModifiedValidators - 1000 modified validators 755.25 ms/op 721.83 ms/op 1.05
findModifiedValidators - 100 modified validators 316.29 ms/op 267.30 ms/op 1.18
findModifiedValidators - 10 modified validators 155.00 ms/op 206.56 ms/op 0.75
findModifiedValidators - 1 modified validators 179.55 ms/op 200.02 ms/op 0.90
findModifiedValidators - no difference 208.75 ms/op 146.57 ms/op 1.42
compare ViewDUs 6.7629 s/op 6.6064 s/op 1.02
compare each validator Uint8Array 1.9498 s/op 1.6382 s/op 1.19
compare ViewDU to Uint8Array 1.4224 s/op 1.3668 s/op 1.04
migrate state 1000000 validators, 24 modified, 0 new 967.79 ms/op 925.71 ms/op 1.05
migrate state 1000000 validators, 1700 modified, 1000 new 1.2212 s/op 1.2300 s/op 0.99
migrate state 1000000 validators, 3400 modified, 2000 new 1.3844 s/op 1.3134 s/op 1.05
migrate state 1500000 validators, 24 modified, 0 new 857.36 ms/op 920.11 ms/op 0.93
migrate state 1500000 validators, 1700 modified, 1000 new 1.1597 s/op 1.2334 s/op 0.94
migrate state 1500000 validators, 3400 modified, 2000 new 1.4184 s/op 1.5005 s/op 0.95
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.5500 ns/op 4.9500 ns/op 0.92
state getBlockRootAtSlot - 250000 vs - 7PWei 573.49 ns/op 552.60 ns/op 1.04
naive computeProposerIndex 100000 validators 58.457 ms/op 64.051 ms/op 0.91
computeProposerIndex 100000 validators 1.6308 ms/op 1.5798 ms/op 1.03
naiveGetNextSyncCommitteeIndices 1000 validators 8.5272 s/op 9.6285 s/op 0.89
getNextSyncCommitteeIndices 1000 validators 116.81 ms/op 129.40 ms/op 0.90
naiveGetNextSyncCommitteeIndices 10000 validators 8.3298 s/op 10.718 s/op 0.78
getNextSyncCommitteeIndices 10000 validators 113.66 ms/op 138.10 ms/op 0.82
naiveGetNextSyncCommitteeIndices 100000 validators 7.5325 s/op 8.2060 s/op 0.92
getNextSyncCommitteeIndices 100000 validators 111.85 ms/op 120.25 ms/op 0.93
naive computeShuffledIndex 100000 validators 24.460 s/op 26.375 s/op 0.93
cached computeShuffledIndex 100000 validators 542.37 ms/op 579.30 ms/op 0.94
naive computeShuffledIndex 2000000 validators 515.99 s/op 531.95 s/op 0.97
cached computeShuffledIndex 2000000 validators 33.658 s/op 39.899 s/op 0.84
computeProposers - vc 250000 652.42 us/op 662.56 us/op 0.98
computeEpochShuffling - vc 250000 43.033 ms/op 43.207 ms/op 1.00
getNextSyncCommittee - vc 250000 10.521 ms/op 11.776 ms/op 0.89
computeSigningRoot for AttestationData 21.816 us/op 27.339 us/op 0.80
hash AttestationData serialized data then Buffer.toString(base64) 1.6949 us/op 1.6670 us/op 1.02
toHexString serialized data 1.1535 us/op 1.2355 us/op 0.93
Buffer.toString(base64) 167.27 ns/op 155.57 ns/op 1.08
nodejs block root to RootHex using toHex 151.91 ns/op 154.66 ns/op 0.98
nodejs block root to RootHex using toRootHex 92.853 ns/op 90.999 ns/op 1.02
nodejs fromhex(blob) 114.53 ms/op 113.75 ms/op 1.01
nodejs fromHexInto(blob) 97.740 ms/op 96.066 ms/op 1.02
browser block root to RootHex using the deprecated toHexString 215.04 ns/op 215.24 ns/op 1.00
browser block root to RootHex using toHex 174.98 ns/op 175.41 ns/op 1.00
browser block root to RootHex using toRootHex 165.60 ns/op 162.15 ns/op 1.02
browser fromHexInto(blob) 857.87 us/op 841.61 us/op 1.02
browser fromHex(blob) 811.47 ms/op 799.91 ms/op 1.01

by benchmarkbot/action

@ensi321 ensi321 changed the title feat: use ms instead of INTERVALS_PER_SLOT for deadlines feat: use bps instead of INTERVALS_PER_SLOT for deadlines Aug 11, 2025
@codecov
Copy link

codecov bot commented Aug 12, 2025

Codecov Report

❌ Patch coverage is 61.05769% with 81 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.26%. Comparing base (21ba277) to head (299c283).
⚠️ Report is 1 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #8091      +/-   ##
============================================
+ Coverage     52.22%   52.26%   +0.03%     
============================================
  Files           852      852              
  Lines         64895    64976      +81     
  Branches       4767     4770       +3     
============================================
+ Hits          33893    33957      +64     
- Misses        30932    30950      +18     
+ Partials         70       69       -1     
🚀 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 ensi321 marked this pull request as ready for review August 14, 2025 00:13
@ensi321 ensi321 requested a review from a team as a code owner August 14, 2025 00:13
@ensi321 ensi321 requested a review from nazarhussain August 19, 2025 07:02
nazarhussain
nazarhussain previously approved these changes Aug 20, 2025
@nflaig
Copy link
Member

nflaig commented Sep 24, 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 introduces a significant and valuable refactoring by replacing hardcoded time-based deadlines (using INTERVALS_PER_SLOT) with configurable basis points (BPS) values. This greatly improves the flexibility and clarity of the codebase.

The changes are extensive and have been applied consistently across configuration, core logic, tests, and metrics. The introduction of SLOT_DURATION_MS and new ForkConfig getters for deadlines is well-executed.

I've found a couple of minor spots where the old hardcoded logic remains, and I've left suggestions to align them with the new BPS-based approach for full consistency.

Overall, this is an excellent contribution that enhances the maintainability of the project.

@nflaig
Copy link
Member

nflaig commented Sep 25, 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 introduces a significant and well-executed refactoring to replace hardcoded slot interval timings with a more flexible and precise system based on basis points (BPS). The changes are systematic across the codebase, introducing new configuration constants for deadlines, deprecating SECONDS_PER_SLOT in favor of SLOT_DURATION_MS for better precision, and adding helper methods to centralize timing calculations. This improves the configurability and maintainability of the timing-sensitive logic. The updates to tests, metrics, and comments are consistent with these changes. Overall, this is a high-quality improvement with no apparent issues.

const src = OpSource.gossip;
const data = indexedAttestation.data;
const epoch = computeEpochAtSlot(data.slot);
const fork = config.getForkName(data.slot);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Determining hard fork based on data.slot could potentially have issue at fork boundary.

So when we switch over to 6s slot, we will need to revisit all these timings.

Copy link
Member

@nflaig nflaig Sep 26, 2025

Choose a reason for hiding this comment

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

In this case it's what we want since we evaluate the attestation based on the fork it belongs to, we also use data.slot in the calculation to determine the delay.

@ensi321 ensi321 merged commit 39be8f0 into unstable Sep 26, 2025
20 checks passed
@ensi321 ensi321 deleted the nc/timing-refactor branch September 26, 2025 02:01
nflaig added a commit that referenced this pull request Sep 26, 2025
Follow up on #8091 to clean up
remaining usage of `SECONDS_PER_SLOT`.

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.35.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.

Define duty due time in bps instead of fraction of SECONDS_PER_SLOT

4 participants