Skip to content

feat: update weak subjectivity calculation for electra #7735

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

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from

Conversation

ensi321
Copy link
Contributor

@ensi321 ensi321 commented Apr 22, 2025

Related spec ethereum/consensus-specs#4243

Closes #7645

@ensi321 ensi321 requested a review from a team as a code owner April 22, 2025 05:12
Copy link

codecov bot commented Apr 22, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 30 lines in your changes missing coverage. Please review.

Project coverage is 50.14%. Comparing base (2a4f1bc) to head (944a590).

Additional details and impacted files
@@            Coverage Diff            @@
##           unstable    #7735   +/-   ##
=========================================
  Coverage     50.14%   50.14%           
=========================================
  Files           605      605           
  Lines         40687    40726   +39     
  Branches       2223     2222    -1     
=========================================
+ Hits          20402    20422   +20     
- Misses        20243    20262   +19     
  Partials         42       42           
🚀 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.

Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 2388e0f Previous: 2a4f1bc Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.0112 ms/op 785.42 us/op 1.29
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 37.813 us/op 31.063 us/op 1.22
BLS verify - blst 921.66 us/op 873.75 us/op 1.05
BLS verifyMultipleSignatures 3 - blst 1.2934 ms/op 1.7279 ms/op 0.75
BLS verifyMultipleSignatures 8 - blst 1.7531 ms/op 2.0562 ms/op 0.85
BLS verifyMultipleSignatures 32 - blst 5.0037 ms/op 4.4582 ms/op 1.12
BLS verifyMultipleSignatures 64 - blst 10.978 ms/op 8.2851 ms/op 1.33
BLS verifyMultipleSignatures 128 - blst 17.853 ms/op 15.776 ms/op 1.13
BLS deserializing 10000 signatures 713.59 ms/op 614.90 ms/op 1.16
BLS deserializing 100000 signatures 7.1986 s/op 6.1574 s/op 1.17
BLS verifyMultipleSignatures - same message - 3 - blst 966.59 us/op 921.16 us/op 1.05
BLS verifyMultipleSignatures - same message - 8 - blst 1.1182 ms/op 1.0614 ms/op 1.05
BLS verifyMultipleSignatures - same message - 32 - blst 1.8036 ms/op 1.6775 ms/op 1.08
BLS verifyMultipleSignatures - same message - 64 - blst 2.7895 ms/op 2.5315 ms/op 1.10
BLS verifyMultipleSignatures - same message - 128 - blst 4.6606 ms/op 4.1401 ms/op 1.13
BLS aggregatePubkeys 32 - blst 20.592 us/op 17.488 us/op 1.18
BLS aggregatePubkeys 128 - blst 73.268 us/op 62.322 us/op 1.18
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 53.374 ms/op 47.794 ms/op 1.12
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 48.924 ms/op 44.273 ms/op 1.11
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 36.845 ms/op 40.944 ms/op 0.90
getSlashingsAndExits - default max 78.033 us/op 47.080 us/op 1.66
getSlashingsAndExits - 2k 294.10 us/op 356.79 us/op 0.82
proposeBlockBody type=full, size=empty 5.4045 ms/op 4.9087 ms/op 1.10
isKnown best case - 1 super set check 198.00 ns/op 400.00 ns/op 0.49
isKnown normal case - 2 super set checks 197.00 ns/op 395.00 ns/op 0.50
isKnown worse case - 16 super set checks 197.00 ns/op 396.00 ns/op 0.50
InMemoryCheckpointStateCache - add get delete 2.4250 us/op 3.2970 us/op 0.74
validate api signedAggregateAndProof - struct 1.3747 ms/op 1.5144 ms/op 0.91
validate gossip signedAggregateAndProof - struct 1.4260 ms/op 1.8374 ms/op 0.78
batch validate gossip attestation - vc 640000 - chunk 32 117.56 us/op 110.02 us/op 1.07
batch validate gossip attestation - vc 640000 - chunk 64 102.55 us/op 90.836 us/op 1.13
batch validate gossip attestation - vc 640000 - chunk 128 96.169 us/op 83.059 us/op 1.16
batch validate gossip attestation - vc 640000 - chunk 256 96.349 us/op 82.589 us/op 1.17
pickEth1Vote - no votes 930.28 us/op 727.94 us/op 1.28
pickEth1Vote - max votes 6.7227 ms/op 4.6556 ms/op 1.44
pickEth1Vote - Eth1Data hashTreeRoot value x2048 12.755 ms/op 9.6239 ms/op 1.33
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 19.085 ms/op 18.427 ms/op 1.04
pickEth1Vote - Eth1Data fastSerialize value x2048 429.17 us/op 328.91 us/op 1.30
pickEth1Vote - Eth1Data fastSerialize tree x2048 2.8616 ms/op 2.7194 ms/op 1.05
bytes32 toHexString 364.00 ns/op 508.00 ns/op 0.72
bytes32 Buffer.toString(hex) 245.00 ns/op 415.00 ns/op 0.59
bytes32 Buffer.toString(hex) from Uint8Array 325.00 ns/op 496.00 ns/op 0.66
bytes32 Buffer.toString(hex) + 0x 247.00 ns/op 408.00 ns/op 0.61
Object access 1 prop 0.11500 ns/op 0.29200 ns/op 0.39
Map access 1 prop 0.12500 ns/op 0.30700 ns/op 0.41
Object get x1000 5.7030 ns/op 4.9860 ns/op 1.14
Map get x1000 6.4460 ns/op 5.8630 ns/op 1.10
Object set x1000 35.225 ns/op 18.686 ns/op 1.89
Map set x1000 19.442 ns/op 16.779 ns/op 1.16
Return object 10000 times 0.28740 ns/op 0.28960 ns/op 0.99
Throw Error 10000 times 4.1302 us/op 3.4157 us/op 1.21
toHex 134.70 ns/op 104.58 ns/op 1.29
Buffer.from 120.96 ns/op 97.440 ns/op 1.24
shared Buffer 96.314 ns/op 65.179 ns/op 1.48
fastMsgIdFn sha256 / 200 bytes 2.1100 us/op 1.9090 us/op 1.11
fastMsgIdFn h32 xxhash / 200 bytes 207.00 ns/op 487.00 ns/op 0.43
fastMsgIdFn h64 xxhash / 200 bytes 276.00 ns/op 432.00 ns/op 0.64
fastMsgIdFn sha256 / 1000 bytes 7.1570 us/op 5.5600 us/op 1.29
fastMsgIdFn h32 xxhash / 1000 bytes 331.00 ns/op 495.00 ns/op 0.67
fastMsgIdFn h64 xxhash / 1000 bytes 347.00 ns/op 512.00 ns/op 0.68
fastMsgIdFn sha256 / 10000 bytes 62.447 us/op 49.027 us/op 1.27
fastMsgIdFn h32 xxhash / 10000 bytes 1.8260 us/op 1.8590 us/op 0.98
fastMsgIdFn h64 xxhash / 10000 bytes 1.2390 us/op 1.3000 us/op 0.95
send data - 1000 256B messages 13.787 ms/op 9.6149 ms/op 1.43
send data - 1000 512B messages 14.563 ms/op 13.710 ms/op 1.06
send data - 1000 1024B messages 25.334 ms/op 21.115 ms/op 1.20
send data - 1000 1200B messages 20.237 ms/op 15.476 ms/op 1.31
send data - 1000 2048B messages 22.650 ms/op 14.038 ms/op 1.61
send data - 1000 4096B messages 24.367 ms/op 18.502 ms/op 1.32
send data - 1000 16384B messages 68.461 ms/op 46.721 ms/op 1.47
send data - 1000 65536B messages 204.86 ms/op 274.78 ms/op 0.75
enrSubnets - fastDeserialize 64 bits 853.00 ns/op 938.00 ns/op 0.91
enrSubnets - ssz BitVector 64 bits 323.00 ns/op 485.00 ns/op 0.67
enrSubnets - fastDeserialize 4 bits 123.00 ns/op 305.00 ns/op 0.40
enrSubnets - ssz BitVector 4 bits 326.00 ns/op 487.00 ns/op 0.67
prioritizePeers score -10:0 att 32-0.1 sync 2-0 113.56 us/op 97.284 us/op 1.17
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 132.77 us/op 117.02 us/op 1.13
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 190.41 us/op 168.51 us/op 1.13
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 360.23 us/op 317.99 us/op 1.13
prioritizePeers score 0:0 att 64-1 sync 4-1 437.15 us/op 368.16 us/op 1.19
array of 16000 items push then shift 1.5524 us/op 1.2093 us/op 1.28
LinkedList of 16000 items push then shift 6.9460 ns/op 7.3260 ns/op 0.95
array of 16000 items push then pop 71.038 ns/op 63.415 ns/op 1.12
LinkedList of 16000 items push then pop 6.6840 ns/op 6.0100 ns/op 1.11
array of 24000 items push then shift 2.2980 us/op 1.7437 us/op 1.32
LinkedList of 24000 items push then shift 6.8210 ns/op 6.6040 ns/op 1.03
array of 24000 items push then pop 95.828 ns/op 87.854 ns/op 1.09
LinkedList of 24000 items push then pop 6.6310 ns/op 5.7890 ns/op 1.15
intersect bitArray bitLen 8 6.1630 ns/op 5.1080 ns/op 1.21
intersect array and set length 8 36.480 ns/op 30.318 ns/op 1.20
intersect bitArray bitLen 128 28.618 ns/op 24.963 ns/op 1.15
intersect array and set length 128 596.47 ns/op 501.67 ns/op 1.19
bitArray.getTrueBitIndexes() bitLen 128 965.00 ns/op 1.1120 us/op 0.87
bitArray.getTrueBitIndexes() bitLen 248 1.7090 us/op 1.8310 us/op 0.93
bitArray.getTrueBitIndexes() bitLen 512 3.4950 us/op 3.5180 us/op 0.99
Buffer.concat 32 items 595.00 ns/op 697.00 ns/op 0.85
Uint8Array.set 32 items 1.8540 us/op 992.00 ns/op 1.87
Buffer.copy 1.9560 us/op 1.7800 us/op 1.10
Uint8Array.set - with subarray 1.5320 us/op 1.5360 us/op 1.00
Uint8Array.set - without subarray 1.7360 us/op 935.00 ns/op 1.86
getUint32 - dataview 187.00 ns/op 358.00 ns/op 0.52
getUint32 - manual 113.00 ns/op 293.00 ns/op 0.39
Set add up to 64 items then delete first 1.9742 us/op 1.6976 us/op 1.16
OrderedSet add up to 64 items then delete first 3.1239 us/op 2.6412 us/op 1.18
Set add up to 64 items then delete last 2.4165 us/op 1.9577 us/op 1.23
OrderedSet add up to 64 items then delete last 3.4583 us/op 3.0650 us/op 1.13
Set add up to 64 items then delete middle 2.3830 us/op 2.0140 us/op 1.18
OrderedSet add up to 64 items then delete middle 4.9778 us/op 4.6583 us/op 1.07
Set add up to 128 items then delete first 4.8607 us/op 3.8692 us/op 1.26
OrderedSet add up to 128 items then delete first 7.5391 us/op 5.9185 us/op 1.27
Set add up to 128 items then delete last 4.7160 us/op 3.8657 us/op 1.22
OrderedSet add up to 128 items then delete last 6.9593 us/op 6.1243 us/op 1.14
Set add up to 128 items then delete middle 4.6637 us/op 3.8442 us/op 1.21
OrderedSet add up to 128 items then delete middle 13.350 us/op 11.529 us/op 1.16
Set add up to 256 items then delete first 9.7789 us/op 7.7057 us/op 1.27
OrderedSet add up to 256 items then delete first 15.170 us/op 11.871 us/op 1.28
Set add up to 256 items then delete last 9.3367 us/op 7.6589 us/op 1.22
OrderedSet add up to 256 items then delete last 14.106 us/op 12.846 us/op 1.10
Set add up to 256 items then delete middle 9.3180 us/op 7.4804 us/op 1.25
OrderedSet add up to 256 items then delete middle 39.824 us/op 33.731 us/op 1.18
transfer serialized Status (84 B) 2.1700 us/op 1.9180 us/op 1.13
copy serialized Status (84 B) 1.1800 us/op 1.1780 us/op 1.00
transfer serialized SignedVoluntaryExit (112 B) 2.2190 us/op 1.9290 us/op 1.15
copy serialized SignedVoluntaryExit (112 B) 1.2280 us/op 1.1980 us/op 1.03
transfer serialized ProposerSlashing (416 B) 2.4720 us/op 1.9490 us/op 1.27
copy serialized ProposerSlashing (416 B) 1.3520 us/op 1.2400 us/op 1.09
transfer serialized Attestation (485 B) 2.5360 us/op 1.9380 us/op 1.31
copy serialized Attestation (485 B) 1.2780 us/op 1.2900 us/op 0.99
transfer serialized AttesterSlashing (33232 B) 2.4320 us/op 2.2590 us/op 1.08
copy serialized AttesterSlashing (33232 B) 3.3960 us/op 3.5320 us/op 0.96
transfer serialized Small SignedBeaconBlock (128000 B) 2.8680 us/op 2.6660 us/op 1.08
copy serialized Small SignedBeaconBlock (128000 B) 9.1180 us/op 8.8380 us/op 1.03
transfer serialized Avg SignedBeaconBlock (200000 B) 3.2650 us/op 2.8280 us/op 1.15
copy serialized Avg SignedBeaconBlock (200000 B) 13.410 us/op 12.577 us/op 1.07
transfer serialized BlobsSidecar (524380 B) 3.4470 us/op 3.1590 us/op 1.09
copy serialized BlobsSidecar (524380 B) 113.26 us/op 52.554 us/op 2.16
transfer serialized Big SignedBeaconBlock (1000000 B) 3.4210 us/op 3.2680 us/op 1.05
copy serialized Big SignedBeaconBlock (1000000 B) 111.51 us/op 120.46 us/op 0.93
pass gossip attestations to forkchoice per slot 2.7785 ms/op 2.3174 ms/op 1.20
forkChoice updateHead vc 100000 bc 64 eq 0 440.73 us/op 334.58 us/op 1.32
forkChoice updateHead vc 600000 bc 64 eq 0 2.7814 ms/op 2.1984 ms/op 1.27
forkChoice updateHead vc 1000000 bc 64 eq 0 4.6277 ms/op 3.9637 ms/op 1.17
forkChoice updateHead vc 600000 bc 320 eq 0 2.7237 ms/op 2.2337 ms/op 1.22
forkChoice updateHead vc 600000 bc 1200 eq 0 2.7594 ms/op 2.2400 ms/op 1.23
forkChoice updateHead vc 600000 bc 7200 eq 0 3.2440 ms/op 2.5836 ms/op 1.26
forkChoice updateHead vc 600000 bc 64 eq 1000 10.208 ms/op 9.2532 ms/op 1.10
forkChoice updateHead vc 600000 bc 64 eq 10000 10.208 ms/op 9.1605 ms/op 1.11
forkChoice updateHead vc 600000 bc 64 eq 300000 13.590 ms/op 11.353 ms/op 1.20
computeDeltas 500000 validators 300 proto nodes 3.8098 ms/op 3.1489 ms/op 1.21
computeDeltas 500000 validators 1200 proto nodes 3.9464 ms/op 3.1812 ms/op 1.24
computeDeltas 500000 validators 7200 proto nodes 4.0836 ms/op 3.0705 ms/op 1.33
computeDeltas 750000 validators 300 proto nodes 5.8131 ms/op 4.8120 ms/op 1.21
computeDeltas 750000 validators 1200 proto nodes 5.7733 ms/op 4.7537 ms/op 1.21
computeDeltas 750000 validators 7200 proto nodes 5.7535 ms/op 4.6739 ms/op 1.23
computeDeltas 1400000 validators 300 proto nodes 10.688 ms/op 8.7589 ms/op 1.22
computeDeltas 1400000 validators 1200 proto nodes 10.688 ms/op 8.9430 ms/op 1.20
computeDeltas 1400000 validators 7200 proto nodes 10.943 ms/op 8.7765 ms/op 1.25
computeDeltas 2100000 validators 300 proto nodes 16.618 ms/op 13.033 ms/op 1.28
computeDeltas 2100000 validators 1200 proto nodes 16.459 ms/op 12.922 ms/op 1.27
computeDeltas 2100000 validators 7200 proto nodes 16.230 ms/op 12.626 ms/op 1.29
altair processAttestation - 250000 vs - 7PWei normalcase 2.0312 ms/op 1.6624 ms/op 1.22
altair processAttestation - 250000 vs - 7PWei worstcase 2.9540 ms/op 2.4651 ms/op 1.20
altair processAttestation - setStatus - 1/6 committees join 128.04 us/op 102.80 us/op 1.25
altair processAttestation - setStatus - 1/3 committees join 241.27 us/op 195.97 us/op 1.23
altair processAttestation - setStatus - 1/2 committees join 338.12 us/op 281.49 us/op 1.20
altair processAttestation - setStatus - 2/3 committees join 457.63 us/op 359.52 us/op 1.27
altair processAttestation - setStatus - 4/5 committees join 610.58 us/op 487.14 us/op 1.25
altair processAttestation - setStatus - 100% committees join 784.97 us/op 583.06 us/op 1.35
altair processBlock - 250000 vs - 7PWei normalcase 7.6400 ms/op 3.6905 ms/op 2.07
altair processBlock - 250000 vs - 7PWei normalcase hashState 34.110 ms/op 31.036 ms/op 1.10
altair processBlock - 250000 vs - 7PWei worstcase 36.801 ms/op 39.735 ms/op 0.93
altair processBlock - 250000 vs - 7PWei worstcase hashState 78.610 ms/op 88.463 ms/op 0.89
phase0 processBlock - 250000 vs - 7PWei normalcase 1.6264 ms/op 1.7734 ms/op 0.92
phase0 processBlock - 250000 vs - 7PWei worstcase 23.008 ms/op 20.497 ms/op 1.12
altair processEth1Data - 250000 vs - 7PWei normalcase 342.96 us/op 286.30 us/op 1.20
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 6.4950 us/op 5.3250 us/op 1.22
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 47.208 us/op 34.062 us/op 1.39
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 12.203 us/op 9.3060 us/op 1.31
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 7.1870 us/op 5.7830 us/op 1.24
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 160.32 us/op 148.87 us/op 1.08
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.8989 ms/op 1.3393 ms/op 1.42
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.4828 ms/op 1.7796 ms/op 1.40
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.5064 ms/op 1.6355 ms/op 1.53
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 5.4747 ms/op 3.3434 ms/op 1.64
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.5999 ms/op 1.8054 ms/op 1.44
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 5.2647 ms/op 3.5929 ms/op 1.47
Tree 40 250000 create 521.65 ms/op 355.33 ms/op 1.47
Tree 40 250000 get(125000) 150.25 ns/op 112.44 ns/op 1.34
Tree 40 250000 set(125000) 1.6742 us/op 1.2430 us/op 1.35
Tree 40 250000 toArray() 20.566 ms/op 9.6628 ms/op 2.13
Tree 40 250000 iterate all - toArray() + loop 22.507 ms/op 9.7497 ms/op 2.31
Tree 40 250000 iterate all - get(i) 60.499 ms/op 40.057 ms/op 1.51
Array 250000 create 4.1066 ms/op 1.9017 ms/op 2.16
Array 250000 clone - spread 1.4480 ms/op 616.30 us/op 2.35
Array 250000 get(125000) 0.42300 ns/op 0.55300 ns/op 0.76
Array 250000 set(125000) 0.44000 ns/op 0.56700 ns/op 0.78
Array 250000 iterate all - loop 85.712 us/op 74.948 us/op 1.14
phase0 afterProcessEpoch - 250000 vs - 7PWei 43.546 ms/op 37.368 ms/op 1.17
Array.fill - length 1000000 3.4913 ms/op 2.4757 ms/op 1.41
Array push - length 1000000 16.634 ms/op 9.5222 ms/op 1.75
Array.get 0.28372 ns/op 0.24700 ns/op 1.15
Uint8Array.get 0.45498 ns/op 0.32396 ns/op 1.40
phase0 beforeProcessEpoch - 250000 vs - 7PWei 19.851 ms/op 15.454 ms/op 1.28
altair processEpoch - mainnet_e81889 256.87 ms/op 258.74 ms/op 0.99
mainnet_e81889 - altair beforeProcessEpoch 19.669 ms/op 15.797 ms/op 1.25
mainnet_e81889 - altair processJustificationAndFinalization 5.3410 us/op 4.3570 us/op 1.23
mainnet_e81889 - altair processInactivityUpdates 4.3450 ms/op 3.4092 ms/op 1.27
mainnet_e81889 - altair processRewardsAndPenalties 35.830 ms/op 41.701 ms/op 0.86
mainnet_e81889 - altair processRegistryUpdates 729.00 ns/op 835.00 ns/op 0.87
mainnet_e81889 - altair processSlashings 182.00 ns/op 384.00 ns/op 0.47
mainnet_e81889 - altair processEth1DataReset 181.00 ns/op 380.00 ns/op 0.48
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2888 ms/op 929.61 us/op 1.39
mainnet_e81889 - altair processSlashingsReset 893.00 ns/op 933.00 ns/op 0.96
mainnet_e81889 - altair processRandaoMixesReset 1.1230 us/op 1.1720 us/op 0.96
mainnet_e81889 - altair processHistoricalRootsUpdate 184.00 ns/op 377.00 ns/op 0.49
mainnet_e81889 - altair processParticipationFlagUpdates 524.00 ns/op 670.00 ns/op 0.78
mainnet_e81889 - altair processSyncCommitteeUpdates 138.00 ns/op 345.00 ns/op 0.40
mainnet_e81889 - altair afterProcessEpoch 45.174 ms/op 39.956 ms/op 1.13
capella processEpoch - mainnet_e217614 835.45 ms/op 929.81 ms/op 0.90
mainnet_e217614 - capella beforeProcessEpoch 60.260 ms/op 56.352 ms/op 1.07
mainnet_e217614 - capella processJustificationAndFinalization 5.1970 us/op 4.1570 us/op 1.25
mainnet_e217614 - capella processInactivityUpdates 14.723 ms/op 10.826 ms/op 1.36
mainnet_e217614 - capella processRewardsAndPenalties 161.97 ms/op 189.82 ms/op 0.85
mainnet_e217614 - capella processRegistryUpdates 6.4660 us/op 5.9050 us/op 1.10
mainnet_e217614 - capella processSlashings 178.00 ns/op 374.00 ns/op 0.48
mainnet_e217614 - capella processEth1DataReset 178.00 ns/op 378.00 ns/op 0.47
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.2126 ms/op 9.8294 ms/op 0.43
mainnet_e217614 - capella processSlashingsReset 887.00 ns/op 952.00 ns/op 0.93
mainnet_e217614 - capella processRandaoMixesReset 1.1750 us/op 1.2050 us/op 0.98
mainnet_e217614 - capella processHistoricalRootsUpdate 181.00 ns/op 375.00 ns/op 0.48
mainnet_e217614 - capella processParticipationFlagUpdates 529.00 ns/op 665.00 ns/op 0.80
mainnet_e217614 - capella afterProcessEpoch 116.31 ms/op 102.84 ms/op 1.13
phase0 processEpoch - mainnet_e58758 252.82 ms/op 289.25 ms/op 0.87
mainnet_e58758 - phase0 beforeProcessEpoch 75.876 ms/op 59.614 ms/op 1.27
mainnet_e58758 - phase0 processJustificationAndFinalization 5.4350 us/op 4.4040 us/op 1.23
mainnet_e58758 - phase0 processRewardsAndPenalties 36.544 ms/op 39.237 ms/op 0.93
mainnet_e58758 - phase0 processRegistryUpdates 3.2100 us/op 2.7030 us/op 1.19
mainnet_e58758 - phase0 processSlashings 173.00 ns/op 388.00 ns/op 0.45
mainnet_e58758 - phase0 processEth1DataReset 174.00 ns/op 383.00 ns/op 0.45
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.1654 ms/op 982.43 us/op 1.19
mainnet_e58758 - phase0 processSlashingsReset 885.00 ns/op 919.00 ns/op 0.96
mainnet_e58758 - phase0 processRandaoMixesReset 1.2400 us/op 1.2050 us/op 1.03
mainnet_e58758 - phase0 processHistoricalRootsUpdate 175.00 ns/op 380.00 ns/op 0.46
mainnet_e58758 - phase0 processParticipationRecordUpdates 907.00 ns/op 1.1210 us/op 0.81
mainnet_e58758 - phase0 afterProcessEpoch 36.848 ms/op 31.796 ms/op 1.16
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.3621 ms/op 920.91 us/op 1.48
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.5159 ms/op 1.3734 ms/op 1.83
altair processInactivityUpdates - 250000 normalcase 18.786 ms/op 16.535 ms/op 1.14
altair processInactivityUpdates - 250000 worstcase 17.658 ms/op 19.627 ms/op 0.90
phase0 processRegistryUpdates - 250000 normalcase 6.7660 us/op 6.5020 us/op 1.04
phase0 processRegistryUpdates - 250000 badcase_full_deposits 256.23 us/op 289.40 us/op 0.89
phase0 processRegistryUpdates - 250000 worstcase 0.5 99.374 ms/op 85.973 ms/op 1.16
altair processRewardsAndPenalties - 250000 normalcase 27.590 ms/op 30.907 ms/op 0.89
altair processRewardsAndPenalties - 250000 worstcase 26.537 ms/op 24.705 ms/op 1.07
phase0 getAttestationDeltas - 250000 normalcase 6.0390 ms/op 4.8508 ms/op 1.24
phase0 getAttestationDeltas - 250000 worstcase 7.5713 ms/op 4.8886 ms/op 1.55
phase0 processSlashings - 250000 worstcase 94.400 us/op 98.979 us/op 0.95
altair processSyncCommitteeUpdates - 250000 11.212 ms/op 9.6631 ms/op 1.16
BeaconState.hashTreeRoot - No change 217.00 ns/op 413.00 ns/op 0.53
BeaconState.hashTreeRoot - 1 full validator 91.632 us/op 81.668 us/op 1.12
BeaconState.hashTreeRoot - 32 full validator 1.0322 ms/op 714.03 us/op 1.45
BeaconState.hashTreeRoot - 512 full validator 11.228 ms/op 7.2296 ms/op 1.55
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 121.12 us/op 77.004 us/op 1.57
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.7457 ms/op 1.0299 ms/op 1.70
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 26.092 ms/op 14.862 ms/op 1.76
BeaconState.hashTreeRoot - 1 balances 73.185 us/op 69.495 us/op 1.05
BeaconState.hashTreeRoot - 32 balances 846.46 us/op 534.56 us/op 1.58
BeaconState.hashTreeRoot - 512 balances 9.7632 ms/op 8.9719 ms/op 1.09
BeaconState.hashTreeRoot - 250000 balances 211.75 ms/op 175.88 ms/op 1.20
aggregationBits - 2048 els - zipIndexesInBitList 22.388 us/op 17.361 us/op 1.29
byteArrayEquals 32 53.899 ns/op 47.151 ns/op 1.14
Buffer.compare 32 17.486 ns/op 17.239 ns/op 1.01
byteArrayEquals 1024 1.6035 us/op 1.2423 us/op 1.29
Buffer.compare 1024 24.903 ns/op 25.578 ns/op 0.97
byteArrayEquals 16384 25.546 us/op 19.748 us/op 1.29
Buffer.compare 16384 201.38 ns/op 194.47 ns/op 1.04
byteArrayEquals 123687377 194.67 ms/op 148.03 ms/op 1.32
Buffer.compare 123687377 8.1196 ms/op 3.5987 ms/op 2.26
byteArrayEquals 32 - diff last byte 54.089 ns/op 45.831 ns/op 1.18
Buffer.compare 32 - diff last byte 17.707 ns/op 17.475 ns/op 1.01
byteArrayEquals 1024 - diff last byte 1.6330 us/op 1.2293 us/op 1.33
Buffer.compare 1024 - diff last byte 27.128 ns/op 24.930 ns/op 1.09
byteArrayEquals 16384 - diff last byte 26.091 us/op 19.536 us/op 1.34
Buffer.compare 16384 - diff last byte 196.52 ns/op 173.97 ns/op 1.13
byteArrayEquals 123687377 - diff last byte 199.24 ms/op 144.52 ms/op 1.38
Buffer.compare 123687377 - diff last byte 8.7959 ms/op 3.9177 ms/op 2.25
byteArrayEquals 32 - random bytes 5.3090 ns/op 4.7420 ns/op 1.12
Buffer.compare 32 - random bytes 17.809 ns/op 17.350 ns/op 1.03
byteArrayEquals 1024 - random bytes 5.3080 ns/op 4.7440 ns/op 1.12
Buffer.compare 1024 - random bytes 17.794 ns/op 17.063 ns/op 1.04
byteArrayEquals 16384 - random bytes 5.3010 ns/op 4.7180 ns/op 1.12
Buffer.compare 16384 - random bytes 17.602 ns/op 16.913 ns/op 1.04
byteArrayEquals 123687377 - random bytes 7.8700 ns/op 7.6500 ns/op 1.03
Buffer.compare 123687377 - random bytes 18.860 ns/op 17.330 ns/op 1.09
regular array get 100000 times 34.287 us/op 28.880 us/op 1.19
wrappedArray get 100000 times 33.951 us/op 28.843 us/op 1.18
arrayWithProxy get 100000 times 18.832 ms/op 8.3697 ms/op 2.25
ssz.Root.equals 47.147 ns/op 41.400 ns/op 1.14
byteArrayEquals 46.697 ns/op 37.913 ns/op 1.23
Buffer.compare 10.588 ns/op 10.523 ns/op 1.01
processSlot - 1 slots 10.648 us/op 8.4430 us/op 1.26
processSlot - 32 slots 2.0504 ms/op 2.0821 ms/op 0.98
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 3.1709 ms/op 1.9872 ms/op 1.60
getCommitteeAssignments - req 1 vs - 250000 vc 2.1610 ms/op 1.6817 ms/op 1.29
getCommitteeAssignments - req 100 vs - 250000 vc 4.1922 ms/op 3.5047 ms/op 1.20
getCommitteeAssignments - req 1000 vs - 250000 vc 4.4381 ms/op 3.6999 ms/op 1.20
findModifiedValidators - 10000 modified validators 722.40 ms/op 745.60 ms/op 0.97
findModifiedValidators - 1000 modified validators 728.15 ms/op 679.53 ms/op 1.07
findModifiedValidators - 100 modified validators 223.30 ms/op 273.85 ms/op 0.82
findModifiedValidators - 10 modified validators 270.81 ms/op 143.06 ms/op 1.89
findModifiedValidators - 1 modified validators 158.81 ms/op 129.60 ms/op 1.23
findModifiedValidators - no difference 168.72 ms/op 225.48 ms/op 0.75
compare ViewDUs 6.3431 s/op 6.0423 s/op 1.05
compare each validator Uint8Array 1.4636 s/op 801.03 ms/op 1.83
compare ViewDU to Uint8Array 1.0019 s/op 866.53 ms/op 1.16
migrate state 1000000 validators, 24 modified, 0 new 808.99 ms/op 771.31 ms/op 1.05
migrate state 1000000 validators, 1700 modified, 1000 new 1.1095 s/op 1.0860 s/op 1.02
migrate state 1000000 validators, 3400 modified, 2000 new 1.3385 s/op 1.3180 s/op 1.02
migrate state 1500000 validators, 24 modified, 0 new 853.98 ms/op 792.55 ms/op 1.08
migrate state 1500000 validators, 1700 modified, 1000 new 1.1118 s/op 1.0461 s/op 1.06
migrate state 1500000 validators, 3400 modified, 2000 new 1.3289 s/op 1.2021 s/op 1.11
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.2700 ns/op 5.8300 ns/op 0.73
state getBlockRootAtSlot - 250000 vs - 7PWei 445.28 ns/op 291.48 ns/op 1.53
naive computeProposerIndex 100000 validators 53.071 ms/op 37.612 ms/op 1.41
computeProposerIndex 100000 validators 1.5120 ms/op 1.2906 ms/op 1.17
naiveGetNextSyncCommitteeIndices 1000 validators 7.3916 s/op 5.8885 s/op 1.26
getNextSyncCommitteeIndices 1000 validators 111.97 ms/op 92.752 ms/op 1.21
naiveGetNextSyncCommitteeIndices 10000 validators 7.4177 s/op 5.9479 s/op 1.25
getNextSyncCommitteeIndices 10000 validators 107.68 ms/op 90.322 ms/op 1.19
naiveGetNextSyncCommitteeIndices 100000 validators 6.7859 s/op 5.6744 s/op 1.20
getNextSyncCommitteeIndices 100000 validators 112.35 ms/op 91.686 ms/op 1.23
naive computeShuffledIndex 100000 validators 25.202 s/op 20.274 s/op 1.24
cached computeShuffledIndex 100000 validators 565.54 ms/op 461.60 ms/op 1.23
naive computeShuffledIndex 2000000 validators 491.43 s/op 390.94 s/op 1.26
cached computeShuffledIndex 2000000 validators 35.719 s/op 15.378 s/op 2.32
computeProposers - vc 250000 613.66 us/op 524.51 us/op 1.17
computeEpochShuffling - vc 250000 43.736 ms/op 36.440 ms/op 1.20
getNextSyncCommittee - vc 250000 10.506 ms/op 8.9480 ms/op 1.17
computeSigningRoot for AttestationData 21.965 us/op 15.816 us/op 1.39
hash AttestationData serialized data then Buffer.toString(base64) 1.6033 us/op 1.1738 us/op 1.37
toHexString serialized data 1.3017 us/op 1.0020 us/op 1.30
Buffer.toString(base64) 173.42 ns/op 112.91 ns/op 1.54
nodejs block root to RootHex using toHex 145.36 ns/op 114.45 ns/op 1.27
nodejs block root to RootHex using toRootHex 87.170 ns/op 71.274 ns/op 1.22
browser block root to RootHex using the deprecated toHexString 223.37 ns/op 183.35 ns/op 1.22
browser block root to RootHex using toHex 179.62 ns/op 149.16 ns/op 1.20
browser block root to RootHex using toRootHex 168.51 ns/op 142.70 ns/op 1.18

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.

just for reference, this ethereum/consensus-specs#4179 is the actual PR

balanceChurnLimit: number, // Note this is not the same as churnLimit in `computeWeakSubjectivityPeriodFromConstituentsPhase0`
minWithdrawabilityDelay: number
): number {
const t = totalBalanceByIncrement; // Keep t as increment for now. Multiply final result by EFFECTIVE_BALANCE_INCREMENT
Copy link
Member

Choose a reason for hiding this comment

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

we should put comments above the variable, not at the end of the line

@@ -97,6 +129,18 @@ export function computeWeakSubjectivityPeriodFromConstituents(
return wsPeriod;
}

export function computeWeakSubjectivityPeriodFromConstituentsElectra(
totalBalanceByIncrement: number,
balanceChurnLimit: number, // Note this is not the same as churnLimit in `computeWeakSubjectivityPeriodFromConstituentsPhase0`
Copy link
Member

Choose a reason for hiding this comment

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

the function signature is really not ideal, it would be better to get it closer to how the spec works but I can see why we do it like this as well

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.

Update weak subjectivity period calculation for Electra
2 participants