Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: timeUntilNext calculation before genesis #7372

Merged
merged 1 commit into from
Jan 17, 2025
Merged

Conversation

ensi321
Copy link
Contributor

@ensi321 ensi321 commented Jan 17, 2025

Description

Currently Clock.runEverySlot() and Clock.runEveryEpoch() will run at odd timing during epoch 0 due to calculation of timeUntilNext before genesis being incorrect.

Fixing the calculation ensures both functions will execute at t=0 in epoch 0.

Example 1

Suppose current time is 7 seconds before genesis, we want to sleep for 7 seconds before we run the next execution of per-slot and per-epoch task.

In current calculation, next per-slot execution will happen in 5s, which is still 2s before genesis. And next per-epoch execution will happen in 377s, which is 370s after genesis (or 10s into slot 30).

msFromGenesis = -7000
Math.abs(msFromGenesis % milliSecondsPerSlot) = Math.abs(-7000 % 12000) = 5000 // TimeItem.Slot - before
Math.abs(msFromGenesis % milliSecondsPerEpoch) = Math.abs(-7000 % 384000) = 377000 // TimeItem.Epoch - before
Math.abs(msFromGenesis) % milliSecondsPerSlot = Math.abs(-7000) % 12000 = 7000 // TimeItem.Slot - after
Math.abs(msFromGenesis) % milliSecondsPerEpoch = Math.abs(-7000) % 384000 = 7000 // TimeItem.Epoch - after

Example 2

Following the per-slot execution in the previous example, if we are at 2s before genesis, we want to sleep for 2s.

However current calculation wants us to sleep for 10s:

msFromGenesis = -2000
Math.abs(msFromGenesis % milliSecondsPerSlot) = Math.abs(-2000 % 12000) = 10000 // TimeItem.Slot - before
Math.abs(msFromGenesis) % milliSecondsPerSlot = Math.abs(-2000) % 12000 = 2000 // TimeItem.Slot - after

Example 3

Current time 864s (2.25 epoch) before genesis. We want next execution to be at t=-768 by waiting for 96s:

msFromGenesis = -960000
Math.abs(msFromGenesis % milliSecondsPerSlot) = Math.abs(-864000 % 384000) = 288000 // TimeItem.Epoch - before
Math.abs(msFromGenesis) % milliSecondsPerSlot = Math.abs(-864000) % 384000 = 96000 // TimeItem.Epoch - after

@ensi321 ensi321 requested a review from a team as a code owner January 17, 2025 03:08
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.76%. Comparing base (0ac8bb9) to head (336f4d9).
Report is 30 commits behind head on unstable.

Additional details and impacted files
@@            Coverage Diff            @@
##           unstable    #7372   +/-   ##
=========================================
  Coverage     48.76%   48.76%           
=========================================
  Files           601      601           
  Lines         40243    40243           
  Branches       2067     2067           
=========================================
  Hits          19626    19626           
  Misses        20579    20579           
  Partials         38       38           

Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: fa61960 Previous: 0ac8bb9 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.8409 ms/op 1.6295 ms/op 1.13
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 60.335 us/op 38.977 us/op 1.55
BLS verify - blst 893.50 us/op 912.46 us/op 0.98
BLS verifyMultipleSignatures 3 - blst 1.2657 ms/op 1.2973 ms/op 0.98
BLS verifyMultipleSignatures 8 - blst 1.9370 ms/op 2.0414 ms/op 0.95
BLS verifyMultipleSignatures 32 - blst 5.8102 ms/op 4.4501 ms/op 1.31
BLS verifyMultipleSignatures 64 - blst 10.995 ms/op 8.3028 ms/op 1.32
BLS verifyMultipleSignatures 128 - blst 24.263 ms/op 16.014 ms/op 1.52
BLS deserializing 10000 signatures 727.52 ms/op 617.13 ms/op 1.18
BLS deserializing 100000 signatures 7.3161 s/op 6.2899 s/op 1.16
BLS verifyMultipleSignatures - same message - 3 - blst 1.0641 ms/op 955.43 us/op 1.11
BLS verifyMultipleSignatures - same message - 8 - blst 1.1849 ms/op 1.0562 ms/op 1.12
BLS verifyMultipleSignatures - same message - 32 - blst 1.8159 ms/op 1.6789 ms/op 1.08
BLS verifyMultipleSignatures - same message - 64 - blst 2.7212 ms/op 2.4570 ms/op 1.11
BLS verifyMultipleSignatures - same message - 128 - blst 5.1305 ms/op 4.2130 ms/op 1.22
BLS aggregatePubkeys 32 - blst 20.446 us/op 18.404 us/op 1.11
BLS aggregatePubkeys 128 - blst 72.136 us/op 67.332 us/op 1.07
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 72.932 ms/op 49.202 ms/op 1.48
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 62.654 ms/op 56.200 ms/op 1.11
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 47.506 ms/op 44.685 ms/op 1.06
getSlashingsAndExits - default max 101.33 us/op 98.676 us/op 1.03
getSlashingsAndExits - 2k 535.23 us/op 528.89 us/op 1.01
proposeBlockBody type=full, size=empty 6.9534 ms/op 7.3906 ms/op 0.94
isKnown best case - 1 super set check 398.00 ns/op 347.00 ns/op 1.15
isKnown normal case - 2 super set checks 322.00 ns/op 294.00 ns/op 1.10
isKnown worse case - 16 super set checks 450.00 ns/op 235.00 ns/op 1.91
InMemoryCheckpointStateCache - add get delete 2.9120 us/op 3.5930 us/op 0.81
validate api signedAggregateAndProof - struct 1.4289 ms/op 1.7795 ms/op 0.80
validate gossip signedAggregateAndProof - struct 1.5256 ms/op 1.5528 ms/op 0.98
batch validate gossip attestation - vc 640000 - chunk 32 132.10 us/op 130.76 us/op 1.01
batch validate gossip attestation - vc 640000 - chunk 64 118.09 us/op 123.79 us/op 0.95
batch validate gossip attestation - vc 640000 - chunk 128 108.05 us/op 108.23 us/op 1.00
batch validate gossip attestation - vc 640000 - chunk 256 103.15 us/op 105.67 us/op 0.98
pickEth1Vote - no votes 1.0121 ms/op 928.59 us/op 1.09
pickEth1Vote - max votes 6.4459 ms/op 4.6495 ms/op 1.39
pickEth1Vote - Eth1Data hashTreeRoot value x2048 13.864 ms/op 10.591 ms/op 1.31
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 23.847 ms/op 19.435 ms/op 1.23
pickEth1Vote - Eth1Data fastSerialize value x2048 468.27 us/op 358.33 us/op 1.31
pickEth1Vote - Eth1Data fastSerialize tree x2048 2.5781 ms/op 3.2022 ms/op 0.81
bytes32 toHexString 426.00 ns/op 372.00 ns/op 1.15
bytes32 Buffer.toString(hex) 251.00 ns/op 205.00 ns/op 1.22
bytes32 Buffer.toString(hex) from Uint8Array 360.00 ns/op 303.00 ns/op 1.19
bytes32 Buffer.toString(hex) + 0x 252.00 ns/op 202.00 ns/op 1.25
Object access 1 prop 0.14800 ns/op 0.12400 ns/op 1.19
Map access 1 prop 0.13400 ns/op 0.10300 ns/op 1.30
Object get x1000 5.7000 ns/op 4.9280 ns/op 1.16
Map get x1000 6.8370 ns/op 5.7310 ns/op 1.19
Object set x1000 40.159 ns/op 22.889 ns/op 1.75
Map set x1000 22.773 ns/op 18.866 ns/op 1.21
Return object 10000 times 0.28730 ns/op 0.28550 ns/op 1.01
Throw Error 10000 times 3.3442 us/op 2.7948 us/op 1.20
toHex 151.08 ns/op 113.07 ns/op 1.34
Buffer.from 128.14 ns/op 106.42 ns/op 1.20
shared Buffer 88.487 ns/op 68.469 ns/op 1.29
fastMsgIdFn sha256 / 200 bytes 2.2130 us/op 1.7730 us/op 1.25
fastMsgIdFn h32 xxhash / 200 bytes 253.00 ns/op 193.00 ns/op 1.31
fastMsgIdFn h64 xxhash / 200 bytes 262.00 ns/op 222.00 ns/op 1.18
fastMsgIdFn sha256 / 1000 bytes 7.2820 us/op 6.0230 us/op 1.21
fastMsgIdFn h32 xxhash / 1000 bytes 377.00 ns/op 357.00 ns/op 1.06
fastMsgIdFn h64 xxhash / 1000 bytes 323.00 ns/op 285.00 ns/op 1.13
fastMsgIdFn sha256 / 10000 bytes 61.995 us/op 49.956 us/op 1.24
fastMsgIdFn h32 xxhash / 10000 bytes 1.7740 us/op 1.7630 us/op 1.01
fastMsgIdFn h64 xxhash / 10000 bytes 1.1320 us/op 1.1070 us/op 1.02
send data - 1000 256B messages 12.214 ms/op 13.437 ms/op 0.91
send data - 1000 512B messages 17.530 ms/op 15.832 ms/op 1.11
send data - 1000 1024B messages 24.161 ms/op 24.216 ms/op 1.00
send data - 1000 1200B messages 17.527 ms/op 21.954 ms/op 0.80
send data - 1000 2048B messages 32.034 ms/op 29.272 ms/op 1.09
send data - 1000 4096B messages 30.541 ms/op 28.103 ms/op 1.09
send data - 1000 16384B messages 72.378 ms/op 65.198 ms/op 1.11
send data - 1000 65536B messages 209.03 ms/op 204.44 ms/op 1.02
enrSubnets - fastDeserialize 64 bits 989.00 ns/op 881.00 ns/op 1.12
enrSubnets - ssz BitVector 64 bits 332.00 ns/op 308.00 ns/op 1.08
enrSubnets - fastDeserialize 4 bits 143.00 ns/op 141.00 ns/op 1.01
enrSubnets - ssz BitVector 4 bits 334.00 ns/op 294.00 ns/op 1.14
prioritizePeers score -10:0 att 32-0.1 sync 2-0 132.06 us/op 109.25 us/op 1.21
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 152.21 us/op 155.21 us/op 0.98
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 228.03 us/op 241.05 us/op 0.95
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 392.96 us/op 393.50 us/op 1.00
prioritizePeers score 0:0 att 64-1 sync 4-1 495.51 us/op 419.82 us/op 1.18
array of 16000 items push then shift 1.6144 us/op 1.3436 us/op 1.20
LinkedList of 16000 items push then shift 6.9130 ns/op 6.3490 ns/op 1.09
array of 16000 items push then pop 100.67 ns/op 105.98 ns/op 0.95
LinkedList of 16000 items push then pop 6.9360 ns/op 5.9550 ns/op 1.16
array of 24000 items push then shift 2.3990 us/op 1.9565 us/op 1.23
LinkedList of 24000 items push then shift 7.3680 ns/op 6.0260 ns/op 1.22
array of 24000 items push then pop 136.47 ns/op 125.84 ns/op 1.08
LinkedList of 24000 items push then pop 7.1890 ns/op 5.8940 ns/op 1.22
intersect bitArray bitLen 8 6.3040 ns/op 5.3420 ns/op 1.18
intersect array and set length 8 43.144 ns/op 37.303 ns/op 1.16
intersect bitArray bitLen 128 29.430 ns/op 26.585 ns/op 1.11
intersect array and set length 128 649.06 ns/op 571.03 ns/op 1.14
bitArray.getTrueBitIndexes() bitLen 128 1.3360 us/op 1.1520 us/op 1.16
bitArray.getTrueBitIndexes() bitLen 248 2.1960 us/op 1.9480 us/op 1.13
bitArray.getTrueBitIndexes() bitLen 512 4.1330 us/op 3.9790 us/op 1.04
Buffer.concat 32 items 735.00 ns/op 789.00 ns/op 0.93
Uint8Array.set 32 items 1.4950 us/op 1.9630 us/op 0.76
Buffer.copy 2.6800 us/op 2.5410 us/op 1.05
Uint8Array.set - with subarray 2.3230 us/op 2.8080 us/op 0.83
Uint8Array.set - without subarray 1.5650 us/op 2.0020 us/op 0.78
getUint32 - dataview 225.00 ns/op 218.00 ns/op 1.03
getUint32 - manual 146.00 ns/op 195.00 ns/op 0.75
Set add up to 64 items then delete first 2.0822 us/op 2.1919 us/op 0.95
OrderedSet add up to 64 items then delete first 3.0291 us/op 3.2600 us/op 0.93
Set add up to 64 items then delete last 2.3141 us/op 2.2908 us/op 1.01
OrderedSet add up to 64 items then delete last 3.3741 us/op 3.2655 us/op 1.03
Set add up to 64 items then delete middle 2.3113 us/op 2.1960 us/op 1.05
OrderedSet add up to 64 items then delete middle 5.1172 us/op 5.0648 us/op 1.01
Set add up to 128 items then delete first 4.9645 us/op 4.5083 us/op 1.10
OrderedSet add up to 128 items then delete first 7.4992 us/op 7.0471 us/op 1.06
Set add up to 128 items then delete last 4.7588 us/op 4.1707 us/op 1.14
OrderedSet add up to 128 items then delete last 7.0694 us/op 6.7155 us/op 1.05
Set add up to 128 items then delete middle 4.6634 us/op 4.5561 us/op 1.02
OrderedSet add up to 128 items then delete middle 13.074 us/op 13.359 us/op 0.98
Set add up to 256 items then delete first 9.8270 us/op 9.9047 us/op 0.99
OrderedSet add up to 256 items then delete first 15.094 us/op 14.156 us/op 1.07
Set add up to 256 items then delete last 8.9066 us/op 7.7128 us/op 1.15
OrderedSet add up to 256 items then delete last 13.597 us/op 12.041 us/op 1.13
Set add up to 256 items then delete middle 8.9177 us/op 7.4642 us/op 1.19
OrderedSet add up to 256 items then delete middle 39.237 us/op 35.765 us/op 1.10
transfer serialized Status (84 B) 2.4450 us/op 2.1550 us/op 1.13
copy serialized Status (84 B) 1.2730 us/op 1.2360 us/op 1.03
transfer serialized SignedVoluntaryExit (112 B) 2.5880 us/op 2.2930 us/op 1.13
copy serialized SignedVoluntaryExit (112 B) 1.4010 us/op 1.2150 us/op 1.15
transfer serialized ProposerSlashing (416 B) 3.1740 us/op 2.9450 us/op 1.08
copy serialized ProposerSlashing (416 B) 1.9420 us/op 1.7650 us/op 1.10
transfer serialized Attestation (485 B) 2.9600 us/op 2.7360 us/op 1.08
copy serialized Attestation (485 B) 2.1800 us/op 2.0760 us/op 1.05
transfer serialized AttesterSlashing (33232 B) 3.2910 us/op 2.6890 us/op 1.22
copy serialized AttesterSlashing (33232 B) 5.7200 us/op 4.7480 us/op 1.20
transfer serialized Small SignedBeaconBlock (128000 B) 4.2650 us/op 2.7830 us/op 1.53
copy serialized Small SignedBeaconBlock (128000 B) 13.875 us/op 8.0910 us/op 1.71
transfer serialized Avg SignedBeaconBlock (200000 B) 4.6150 us/op 2.5040 us/op 1.84
copy serialized Avg SignedBeaconBlock (200000 B) 21.123 us/op 11.991 us/op 1.76
transfer serialized BlobsSidecar (524380 B) 4.2350 us/op 3.4770 us/op 1.22
copy serialized BlobsSidecar (524380 B) 85.016 us/op 76.853 us/op 1.11
transfer serialized Big SignedBeaconBlock (1000000 B) 4.1820 us/op 4.3270 us/op 0.97
copy serialized Big SignedBeaconBlock (1000000 B) 142.45 us/op 130.21 us/op 1.09
pass gossip attestations to forkchoice per slot 2.7408 ms/op 2.3411 ms/op 1.17
forkChoice updateHead vc 100000 bc 64 eq 0 486.77 us/op 440.74 us/op 1.10
forkChoice updateHead vc 600000 bc 64 eq 0 2.8538 ms/op 2.9104 ms/op 0.98
forkChoice updateHead vc 1000000 bc 64 eq 0 4.8531 ms/op 3.7613 ms/op 1.29
forkChoice updateHead vc 600000 bc 320 eq 0 2.8192 ms/op 2.1231 ms/op 1.33
forkChoice updateHead vc 600000 bc 1200 eq 0 2.8244 ms/op 2.2213 ms/op 1.27
forkChoice updateHead vc 600000 bc 7200 eq 0 3.6327 ms/op 2.8441 ms/op 1.28
forkChoice updateHead vc 600000 bc 64 eq 1000 9.7429 ms/op 9.3538 ms/op 1.04
forkChoice updateHead vc 600000 bc 64 eq 10000 9.6847 ms/op 9.2632 ms/op 1.05
forkChoice updateHead vc 600000 bc 64 eq 300000 13.336 ms/op 12.018 ms/op 1.11
computeDeltas 500000 validators 300 proto nodes 3.8874 ms/op 3.2596 ms/op 1.19
computeDeltas 500000 validators 1200 proto nodes 3.9821 ms/op 3.2967 ms/op 1.21
computeDeltas 500000 validators 7200 proto nodes 3.9112 ms/op 3.2451 ms/op 1.21
computeDeltas 750000 validators 300 proto nodes 5.8932 ms/op 4.9180 ms/op 1.20
computeDeltas 750000 validators 1200 proto nodes 5.8851 ms/op 4.9235 ms/op 1.20
computeDeltas 750000 validators 7200 proto nodes 6.0497 ms/op 5.0734 ms/op 1.19
computeDeltas 1400000 validators 300 proto nodes 11.287 ms/op 9.4249 ms/op 1.20
computeDeltas 1400000 validators 1200 proto nodes 11.165 ms/op 9.4310 ms/op 1.18
computeDeltas 1400000 validators 7200 proto nodes 11.319 ms/op 10.104 ms/op 1.12
computeDeltas 2100000 validators 300 proto nodes 17.070 ms/op 14.909 ms/op 1.14
computeDeltas 2100000 validators 1200 proto nodes 16.890 ms/op 13.672 ms/op 1.24
computeDeltas 2100000 validators 7200 proto nodes 17.322 ms/op 13.541 ms/op 1.28
altair processAttestation - 250000 vs - 7PWei normalcase 2.4582 ms/op 1.5673 ms/op 1.57
altair processAttestation - 250000 vs - 7PWei worstcase 3.0238 ms/op 2.8512 ms/op 1.06
altair processAttestation - setStatus - 1/6 committees join 134.91 us/op 86.398 us/op 1.56
altair processAttestation - setStatus - 1/3 committees join 249.90 us/op 176.79 us/op 1.41
altair processAttestation - setStatus - 1/2 committees join 387.22 us/op 262.64 us/op 1.47
altair processAttestation - setStatus - 2/3 committees join 522.39 us/op 351.13 us/op 1.49
altair processAttestation - setStatus - 4/5 committees join 635.84 us/op 498.61 us/op 1.28
altair processAttestation - setStatus - 100% committees join 722.57 us/op 590.74 us/op 1.22
altair processBlock - 250000 vs - 7PWei normalcase 5.7986 ms/op 4.1471 ms/op 1.40
altair processBlock - 250000 vs - 7PWei normalcase hashState 28.848 ms/op 28.693 ms/op 1.01
altair processBlock - 250000 vs - 7PWei worstcase 41.202 ms/op 37.470 ms/op 1.10
altair processBlock - 250000 vs - 7PWei worstcase hashState 78.182 ms/op 75.439 ms/op 1.04
phase0 processBlock - 250000 vs - 7PWei normalcase 2.6094 ms/op 1.4999 ms/op 1.74
phase0 processBlock - 250000 vs - 7PWei worstcase 27.443 ms/op 24.683 ms/op 1.11
altair processEth1Data - 250000 vs - 7PWei normalcase 364.24 us/op 277.43 us/op 1.31
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 8.3700 us/op 7.3830 us/op 1.13
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 53.487 us/op 56.523 us/op 0.95
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 13.952 us/op 13.568 us/op 1.03
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 10.879 us/op 8.2450 us/op 1.32
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 215.60 us/op 165.16 us/op 1.31
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.3280 ms/op 892.18 us/op 1.49
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.8335 ms/op 1.1307 ms/op 1.62
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.8212 ms/op 1.0971 ms/op 1.66
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.3280 ms/op 3.0835 ms/op 1.40
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.9184 ms/op 1.3606 ms/op 1.41
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.2509 ms/op 3.1772 ms/op 1.34
Tree 40 250000 create 249.86 ms/op 178.70 ms/op 1.40
Tree 40 250000 get(125000) 161.03 ns/op 116.38 ns/op 1.38
Tree 40 250000 set(125000) 744.19 ns/op 557.77 ns/op 1.33
Tree 40 250000 toArray() 20.906 ms/op 13.867 ms/op 1.51
Tree 40 250000 iterate all - toArray() + loop 20.801 ms/op 11.372 ms/op 1.83
Tree 40 250000 iterate all - get(i) 59.138 ms/op 40.240 ms/op 1.47
Array 250000 create 3.7981 ms/op 2.3176 ms/op 1.64
Array 250000 clone - spread 1.5495 ms/op 1.1758 ms/op 1.32
Array 250000 get(125000) 0.42400 ns/op 0.37000 ns/op 1.15
Array 250000 set(125000) 0.45600 ns/op 0.40500 ns/op 1.13
Array 250000 iterate all - loop 90.326 us/op 76.332 us/op 1.18
phase0 afterProcessEpoch - 250000 vs - 7PWei 53.733 ms/op 41.628 ms/op 1.29
Array.fill - length 1000000 3.6673 ms/op 2.4316 ms/op 1.51
Array push - length 1000000 19.325 ms/op 14.128 ms/op 1.37
Array.get 0.28929 ns/op 0.25498 ns/op 1.13
Uint8Array.get 0.45557 ns/op 0.34019 ns/op 1.34
phase0 beforeProcessEpoch - 250000 vs - 7PWei 20.287 ms/op 13.085 ms/op 1.55
altair processEpoch - mainnet_e81889 315.13 ms/op 254.82 ms/op 1.24
mainnet_e81889 - altair beforeProcessEpoch 19.432 ms/op 20.780 ms/op 0.94
mainnet_e81889 - altair processJustificationAndFinalization 18.547 us/op 14.201 us/op 1.31
mainnet_e81889 - altair processInactivityUpdates 5.7595 ms/op 4.3521 ms/op 1.32
mainnet_e81889 - altair processRewardsAndPenalties 48.075 ms/op 52.173 ms/op 0.92
mainnet_e81889 - altair processRegistryUpdates 2.4780 us/op 2.1580 us/op 1.15
mainnet_e81889 - altair processSlashings 429.00 ns/op 572.00 ns/op 0.75
mainnet_e81889 - altair processEth1DataReset 543.00 ns/op 465.00 ns/op 1.17
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.4318 ms/op 1.0547 ms/op 1.36
mainnet_e81889 - altair processSlashingsReset 3.3110 us/op 2.6170 us/op 1.27
mainnet_e81889 - altair processRandaoMixesReset 4.4730 us/op 4.1250 us/op 1.08
mainnet_e81889 - altair processHistoricalRootsUpdate 587.00 ns/op 397.00 ns/op 1.48
mainnet_e81889 - altair processParticipationFlagUpdates 2.7590 us/op 1.2450 us/op 2.22
mainnet_e81889 - altair processSyncCommitteeUpdates 844.00 ns/op 999.00 ns/op 0.84
mainnet_e81889 - altair afterProcessEpoch 53.345 ms/op 42.479 ms/op 1.26
capella processEpoch - mainnet_e217614 986.30 ms/op 992.10 ms/op 0.99
mainnet_e217614 - capella beforeProcessEpoch 71.779 ms/op 63.877 ms/op 1.12
mainnet_e217614 - capella processJustificationAndFinalization 17.571 us/op 9.5410 us/op 1.84
mainnet_e217614 - capella processInactivityUpdates 16.505 ms/op 14.763 ms/op 1.12
mainnet_e217614 - capella processRewardsAndPenalties 238.76 ms/op 221.21 ms/op 1.08
mainnet_e217614 - capella processRegistryUpdates 25.185 us/op 16.319 us/op 1.54
mainnet_e217614 - capella processSlashings 511.00 ns/op 606.00 ns/op 0.84
mainnet_e217614 - capella processEth1DataReset 558.00 ns/op 459.00 ns/op 1.22
mainnet_e217614 - capella processEffectiveBalanceUpdates 15.100 ms/op 5.0901 ms/op 2.97
mainnet_e217614 - capella processSlashingsReset 6.1880 us/op 2.0710 us/op 2.99
mainnet_e217614 - capella processRandaoMixesReset 5.2190 us/op 2.9570 us/op 1.76
mainnet_e217614 - capella processHistoricalRootsUpdate 951.00 ns/op 755.00 ns/op 1.26
mainnet_e217614 - capella processParticipationFlagUpdates 3.3040 us/op 1.4410 us/op 2.29
mainnet_e217614 - capella afterProcessEpoch 118.99 ms/op 106.03 ms/op 1.12
phase0 processEpoch - mainnet_e58758 333.16 ms/op 305.85 ms/op 1.09
mainnet_e58758 - phase0 beforeProcessEpoch 84.365 ms/op 79.077 ms/op 1.07
mainnet_e58758 - phase0 processJustificationAndFinalization 17.515 us/op 10.013 us/op 1.75
mainnet_e58758 - phase0 processRewardsAndPenalties 27.988 ms/op 30.375 ms/op 0.92
mainnet_e58758 - phase0 processRegistryUpdates 16.095 us/op 7.3220 us/op 2.20
mainnet_e58758 - phase0 processSlashings 700.00 ns/op 379.00 ns/op 1.85
mainnet_e58758 - phase0 processEth1DataReset 693.00 ns/op 333.00 ns/op 2.08
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.5313 ms/op 1.4065 ms/op 1.09
mainnet_e58758 - phase0 processSlashingsReset 3.0010 us/op 2.2010 us/op 1.36
mainnet_e58758 - phase0 processRandaoMixesReset 4.6250 us/op 3.0030 us/op 1.54
mainnet_e58758 - phase0 processHistoricalRootsUpdate 462.00 ns/op 456.00 ns/op 1.01
mainnet_e58758 - phase0 processParticipationRecordUpdates 8.0610 us/op 2.9930 us/op 2.69
mainnet_e58758 - phase0 afterProcessEpoch 45.434 ms/op 37.783 ms/op 1.20
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.2720 ms/op 1.0197 ms/op 2.23
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.9454 ms/op 1.7674 ms/op 1.10
altair processInactivityUpdates - 250000 normalcase 19.391 ms/op 17.161 ms/op 1.13
altair processInactivityUpdates - 250000 worstcase 19.720 ms/op 16.922 ms/op 1.17
phase0 processRegistryUpdates - 250000 normalcase 7.1360 us/op 7.6050 us/op 0.94
phase0 processRegistryUpdates - 250000 badcase_full_deposits 426.01 us/op 357.62 us/op 1.19
phase0 processRegistryUpdates - 250000 worstcase 0.5 101.52 ms/op 108.68 ms/op 0.93
altair processRewardsAndPenalties - 250000 normalcase 40.912 ms/op 38.679 ms/op 1.06
altair processRewardsAndPenalties - 250000 worstcase 37.053 ms/op 40.956 ms/op 0.90
phase0 getAttestationDeltas - 250000 normalcase 7.8139 ms/op 5.7435 ms/op 1.36
phase0 getAttestationDeltas - 250000 worstcase 7.1436 ms/op 5.8009 ms/op 1.23
phase0 processSlashings - 250000 worstcase 124.04 us/op 88.061 us/op 1.41
altair processSyncCommitteeUpdates - 250000 117.68 ms/op 90.948 ms/op 1.29
BeaconState.hashTreeRoot - No change 263.00 ns/op 189.00 ns/op 1.39
BeaconState.hashTreeRoot - 1 full validator 96.985 us/op 75.226 us/op 1.29
BeaconState.hashTreeRoot - 32 full validator 1.0539 ms/op 705.20 us/op 1.49
BeaconState.hashTreeRoot - 512 full validator 9.1476 ms/op 7.1476 ms/op 1.28
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 108.55 us/op 88.251 us/op 1.23
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.6591 ms/op 1.2537 ms/op 1.32
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 21.217 ms/op 14.695 ms/op 1.44
BeaconState.hashTreeRoot - 1 balances 84.556 us/op 67.109 us/op 1.26
BeaconState.hashTreeRoot - 32 balances 779.13 us/op 621.50 us/op 1.25
BeaconState.hashTreeRoot - 512 balances 6.8849 ms/op 5.6583 ms/op 1.22
BeaconState.hashTreeRoot - 250000 balances 157.12 ms/op 140.77 ms/op 1.12
aggregationBits - 2048 els - zipIndexesInBitList 25.047 us/op 21.257 us/op 1.18
byteArrayEquals 32 55.006 ns/op 48.385 ns/op 1.14
Buffer.compare 32 17.664 ns/op 15.098 ns/op 1.17
byteArrayEquals 1024 1.6402 us/op 1.2226 us/op 1.34
Buffer.compare 1024 26.003 ns/op 21.742 ns/op 1.20
byteArrayEquals 16384 25.852 us/op 19.428 us/op 1.33
Buffer.compare 16384 316.93 ns/op 170.65 ns/op 1.86
byteArrayEquals 123687377 193.09 ms/op 153.82 ms/op 1.26
Buffer.compare 123687377 8.3625 ms/op 4.0856 ms/op 2.05
byteArrayEquals 32 - diff last byte 55.139 ns/op 48.143 ns/op 1.15
Buffer.compare 32 - diff last byte 18.040 ns/op 15.924 ns/op 1.13
byteArrayEquals 1024 - diff last byte 1.6555 us/op 1.3596 us/op 1.22
Buffer.compare 1024 - diff last byte 28.107 ns/op 23.378 ns/op 1.20
byteArrayEquals 16384 - diff last byte 26.287 us/op 21.662 us/op 1.21
Buffer.compare 16384 - diff last byte 197.64 ns/op 187.24 ns/op 1.06
byteArrayEquals 123687377 - diff last byte 201.27 ms/op 153.60 ms/op 1.31
Buffer.compare 123687377 - diff last byte 9.4226 ms/op 6.1870 ms/op 1.52
byteArrayEquals 32 - random bytes 5.5440 ns/op 4.6440 ns/op 1.19
Buffer.compare 32 - random bytes 18.329 ns/op 15.134 ns/op 1.21
byteArrayEquals 1024 - random bytes 5.4820 ns/op 4.6280 ns/op 1.18
Buffer.compare 1024 - random bytes 18.275 ns/op 14.911 ns/op 1.23
byteArrayEquals 16384 - random bytes 5.4540 ns/op 4.6150 ns/op 1.18
Buffer.compare 16384 - random bytes 18.286 ns/op 14.982 ns/op 1.22
byteArrayEquals 123687377 - random bytes 6.9800 ns/op 5.5400 ns/op 1.26
Buffer.compare 123687377 - random bytes 19.570 ns/op 15.860 ns/op 1.23
regular array get 100000 times 37.215 us/op 30.133 us/op 1.24
wrappedArray get 100000 times 34.337 us/op 30.246 us/op 1.14
arrayWithProxy get 100000 times 13.616 ms/op 8.7781 ms/op 1.55
ssz.Root.equals 48.240 ns/op 42.909 ns/op 1.12
byteArrayEquals 47.685 ns/op 42.526 ns/op 1.12
Buffer.compare 11.048 ns/op 8.7290 ns/op 1.27
processSlot - 1 slots 14.272 us/op 12.152 us/op 1.17
processSlot - 32 slots 2.7188 ms/op 2.4475 ms/op 1.11
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 38.604 ms/op 38.943 ms/op 0.99
getCommitteeAssignments - req 1 vs - 250000 vc 2.1671 ms/op 1.8274 ms/op 1.19
getCommitteeAssignments - req 100 vs - 250000 vc 4.1985 ms/op 3.6195 ms/op 1.16
getCommitteeAssignments - req 1000 vs - 250000 vc 4.5727 ms/op 3.9273 ms/op 1.16
findModifiedValidators - 10000 modified validators 263.35 ms/op 230.45 ms/op 1.14
findModifiedValidators - 1000 modified validators 210.44 ms/op 150.64 ms/op 1.40
findModifiedValidators - 100 modified validators 155.22 ms/op 152.05 ms/op 1.02
findModifiedValidators - 10 modified validators 186.54 ms/op 146.30 ms/op 1.28
findModifiedValidators - 1 modified validators 175.21 ms/op 155.16 ms/op 1.13
findModifiedValidators - no difference 166.71 ms/op 152.86 ms/op 1.09
compare ViewDUs 3.2104 s/op 3.1786 s/op 1.01
compare each validator Uint8Array 1.2503 s/op 1.6562 s/op 0.75
compare ViewDU to Uint8Array 1.0656 s/op 843.45 ms/op 1.26
migrate state 1000000 validators, 24 modified, 0 new 751.38 ms/op 683.10 ms/op 1.10
migrate state 1000000 validators, 1700 modified, 1000 new 996.42 ms/op 900.47 ms/op 1.11
migrate state 1000000 validators, 3400 modified, 2000 new 1.2296 s/op 1.1173 s/op 1.10
migrate state 1500000 validators, 24 modified, 0 new 791.47 ms/op 716.91 ms/op 1.10
migrate state 1500000 validators, 1700 modified, 1000 new 1.0266 s/op 948.49 ms/op 1.08
migrate state 1500000 validators, 3400 modified, 2000 new 1.2296 s/op 1.0978 s/op 1.12
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.4100 ns/op 3.8200 ns/op 1.15
state getBlockRootAtSlot - 250000 vs - 7PWei 827.12 ns/op 528.13 ns/op 1.57
computeProposers - vc 250000 7.3070 ms/op 5.5096 ms/op 1.33
computeEpochShuffling - vc 250000 42.027 ms/op 34.784 ms/op 1.21
getNextSyncCommittee - vc 250000 125.58 ms/op 109.39 ms/op 1.15
computeSigningRoot for AttestationData 26.638 us/op 22.340 us/op 1.19
hash AttestationData serialized data then Buffer.toString(base64) 1.5023 us/op 1.1606 us/op 1.29
toHexString serialized data 841.97 ns/op 779.60 ns/op 1.08
Buffer.toString(base64) 160.53 ns/op 144.04 ns/op 1.11
nodejs block root to RootHex using toHex 145.23 ns/op 107.70 ns/op 1.35
nodejs block root to RootHex using toRootHex 88.422 ns/op 72.053 ns/op 1.23
browser block root to RootHex using the deprecated toHexString 215.55 ns/op 203.45 ns/op 1.06
browser block root to RootHex using toHex 172.31 ns/op 177.12 ns/op 0.97
browser block root to RootHex using toRootHex 155.38 ns/op 168.60 ns/op 0.92

by benchmarkbot/action

Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

LGTM

@nflaig nflaig merged commit 06831cf into unstable Jan 17, 2025
20 checks passed
@nflaig nflaig deleted the nc/before-genesis branch January 17, 2025 20:09
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.

2 participants