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: use right slot number for future epoch of proposers duties #6545

Merged
merged 4 commits into from
Mar 15, 2024

Conversation

nazarhussain
Copy link
Contributor

Motivation

Fix the block proper duties slot numbers.

Description

When the proposer duties API is called with future epoch, the wrong slot index was used. As given below we are calling for epoch 1, so the slot should start from 8, not for 0. (with minimal preset).

fetched                                  
url=http://host.docker.internal:5002/eth/v1/validator/duties/proposer/1 
res="&{Data:[{PubkeyHex:0xb89bebc699769726a318c8e9971bd3171297c61aea4a6578a7a4f94b547dcba5bac16a89108b6b6a1fe3695d1a874a0b Slot:0} 
{PubkeyHex:0x9977f1c8b731a8d5558146bfb86caea26434f3c5878b589bf280a42c9159e700e9df0e4086296c20b011d2e78c27d373 Slot:1} 
{PubkeyHex:0xaec922bd7a9b7b1dc21993133b586b0c3041c1e2e04b513e862227b9d7aecaf9444222f7e78282a449622ffc6278915d Slot:2} 
{PubkeyHex:0x84398f539a64cbe01cfcd8c485ea51cd6657b94df93ee9b5dc61e1f18f69da6ca9d4dba63c956a81c68d5d4d4277a60f Slot:3} 
{PubkeyHex:0xa3a32b0f8b4ddb83f1a0a853d81dd725dfe577d4f4c3db8ece52ce2b026eca84815c1a7e8e92a4de3d755733bf7e4a9b Slot:4} 
{PubkeyHex:0x876dd4705157eb66dc71bc2e07fb151ea53e1a62a0bb980a7ce72d15f58944a8a3752d754f52f4a60dbfc7b18169f268 Slot:5} 
{PubkeyHex:0x84398f539a64cbe01cfcd8c485ea51cd6657b94df93ee9b5dc61e1f18f69da6ca9d4dba63c956a81c68d5d4d4277a60f Slot:6} 
{PubkeyHex:0x9893413c00283a3f9ed9fd9845dda1cea38228d22567f9541dccc357e54a2d6a6e204103c92564cbc05f4905ac7c493a Slot:7}]}"

Steps to test or reproduce

  • Run unit tests.

@nazarhussain nazarhussain requested a review from a team as a code owner March 15, 2024 07:09
@nazarhussain nazarhussain self-assigned this Mar 15, 2024
@nazarhussain nazarhussain changed the title bug: fix the slot number for future epoch for proposers duties bug: fix the slot number for future epoch of proposers duties Mar 15, 2024
@nazarhussain nazarhussain changed the title bug: fix the slot number for future epoch of proposers duties fix: use right slot number for future epoch of proposers duties Mar 15, 2024
Copy link

codecov bot commented Mar 15, 2024

Codecov Report

Merging #6545 (3e39f61) into unstable (30d347d) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff            @@
##           unstable    #6545   +/-   ##
=========================================
  Coverage     61.46%   61.46%           
=========================================
  Files           556      556           
  Lines         58652    58652           
  Branches       1848     1848           
=========================================
  Hits          36051    36051           
  Misses        22561    22561           
  Partials         40       40           

twoeths
twoeths previously approved these changes Mar 15, 2024
Copy link
Contributor

@twoeths twoeths left a comment

Choose a reason for hiding this comment

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

looks good to me

Copy link
Contributor

Performance Report

✔️ no performance regression detected

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 8eddd6d Previous: 30d347d Ratio
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 7.9710 us/op 24.640 us/op 0.32
Full benchmark results
Benchmark suite Current: 8eddd6d Previous: 30d347d Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 562.06 us/op 613.34 us/op 0.92
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 119.28 us/op 135.55 us/op 0.88
BLS verify - blst-native 1.3544 ms/op 1.4424 ms/op 0.94
BLS verifyMultipleSignatures 3 - blst-native 2.9150 ms/op 3.1719 ms/op 0.92
BLS verifyMultipleSignatures 8 - blst-native 6.1785 ms/op 6.3607 ms/op 0.97
BLS verifyMultipleSignatures 32 - blst-native 23.435 ms/op 23.896 ms/op 0.98
BLS verifyMultipleSignatures 64 - blst-native 44.452 ms/op 48.418 ms/op 0.92
BLS verifyMultipleSignatures 128 - blst-native 98.157 ms/op 104.92 ms/op 0.94
BLS deserializing 10000 signatures 972.22 ms/op 1.0126 s/op 0.96
BLS deserializing 100000 signatures 9.0269 s/op 9.6155 s/op 0.94
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.3260 ms/op 1.3965 ms/op 0.95
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.5027 ms/op 1.6346 ms/op 0.92
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.3641 ms/op 2.4605 ms/op 0.96
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.5246 ms/op 3.6875 ms/op 0.96
BLS verifyMultipleSignatures - same message - 128 - blst-native 5.9294 ms/op 5.9505 ms/op 1.00
BLS aggregatePubkeys 32 - blst-native 27.051 us/op 27.117 us/op 1.00
BLS aggregatePubkeys 128 - blst-native 102.33 us/op 105.74 us/op 0.97
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 55.844 ms/op 79.504 ms/op 0.70
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 73.361 ms/op 65.196 ms/op 1.13
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 43.370 ms/op 53.384 ms/op 0.81
getSlashingsAndExits - default max 205.13 us/op 342.71 us/op 0.60
getSlashingsAndExits - 2k 488.05 us/op 647.92 us/op 0.75
proposeBlockBody type=full, size=empty 5.9142 ms/op 6.7986 ms/op 0.87
isKnown best case - 1 super set check 343.00 ns/op 634.00 ns/op 0.54
isKnown normal case - 2 super set checks 318.00 ns/op 625.00 ns/op 0.51
isKnown worse case - 16 super set checks 314.00 ns/op 748.00 ns/op 0.42
CheckpointStateCache - add get delete 6.3650 us/op 8.8930 us/op 0.72
validate api signedAggregateAndProof - struct 2.7812 ms/op 3.0011 ms/op 0.93
validate gossip signedAggregateAndProof - struct 2.8509 ms/op 2.9346 ms/op 0.97
validate gossip attestation - vc 640000 1.3782 ms/op 1.4825 ms/op 0.93
batch validate gossip attestation - vc 640000 - chunk 32 162.99 us/op 181.28 us/op 0.90
batch validate gossip attestation - vc 640000 - chunk 64 141.38 us/op 155.18 us/op 0.91
batch validate gossip attestation - vc 640000 - chunk 128 136.15 us/op 156.22 us/op 0.87
batch validate gossip attestation - vc 640000 - chunk 256 129.42 us/op 162.55 us/op 0.80
pickEth1Vote - no votes 1.4126 ms/op 1.4471 ms/op 0.98
pickEth1Vote - max votes 11.203 ms/op 12.410 ms/op 0.90
pickEth1Vote - Eth1Data hashTreeRoot value x2048 19.153 ms/op 24.653 ms/op 0.78
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 30.313 ms/op 35.233 ms/op 0.86
pickEth1Vote - Eth1Data fastSerialize value x2048 636.67 us/op 953.66 us/op 0.67
pickEth1Vote - Eth1Data fastSerialize tree x2048 6.0648 ms/op 6.0002 ms/op 1.01
bytes32 toHexString 494.00 ns/op 929.00 ns/op 0.53
bytes32 Buffer.toString(hex) 294.00 ns/op 339.00 ns/op 0.87
bytes32 Buffer.toString(hex) from Uint8Array 472.00 ns/op 579.00 ns/op 0.82
bytes32 Buffer.toString(hex) + 0x 291.00 ns/op 353.00 ns/op 0.82
Object access 1 prop 0.17100 ns/op 0.24000 ns/op 0.71
Map access 1 prop 0.15300 ns/op 0.18400 ns/op 0.83
Object get x1000 7.6430 ns/op 8.3970 ns/op 0.91
Map get x1000 0.77000 ns/op 0.99800 ns/op 0.77
Object set x1000 50.237 ns/op 84.033 ns/op 0.60
Map set x1000 41.910 ns/op 66.266 ns/op 0.63
Return object 10000 times 0.23910 ns/op 0.28890 ns/op 0.83
Throw Error 10000 times 3.7686 us/op 4.5554 us/op 0.83
fastMsgIdFn sha256 / 200 bytes 3.3100 us/op 4.0910 us/op 0.81
fastMsgIdFn h32 xxhash / 200 bytes 324.00 ns/op 427.00 ns/op 0.76
fastMsgIdFn h64 xxhash / 200 bytes 380.00 ns/op 456.00 ns/op 0.83
fastMsgIdFn sha256 / 1000 bytes 11.468 us/op 13.102 us/op 0.88
fastMsgIdFn h32 xxhash / 1000 bytes 453.00 ns/op 543.00 ns/op 0.83
fastMsgIdFn h64 xxhash / 1000 bytes 442.00 ns/op 598.00 ns/op 0.74
fastMsgIdFn sha256 / 10000 bytes 105.07 us/op 120.35 us/op 0.87
fastMsgIdFn h32 xxhash / 10000 bytes 2.0360 us/op 2.5050 us/op 0.81
fastMsgIdFn h64 xxhash / 10000 bytes 1.3700 us/op 1.6780 us/op 0.82
send data - 1000 256B messages 20.939 ms/op 25.991 ms/op 0.81
send data - 1000 512B messages 25.443 ms/op 33.049 ms/op 0.77
send data - 1000 1024B messages 38.755 ms/op 53.948 ms/op 0.72
send data - 1000 1200B messages 25.474 ms/op 61.253 ms/op 0.42
send data - 1000 2048B messages 48.134 ms/op 62.167 ms/op 0.77
send data - 1000 4096B messages 41.291 ms/op 49.412 ms/op 0.84
send data - 1000 16384B messages 111.94 ms/op 121.59 ms/op 0.92
send data - 1000 65536B messages 460.24 ms/op 520.54 ms/op 0.88
enrSubnets - fastDeserialize 64 bits 1.2730 us/op 1.2280 us/op 1.04
enrSubnets - ssz BitVector 64 bits 450.00 ns/op 417.00 ns/op 1.08
enrSubnets - fastDeserialize 4 bits 185.00 ns/op 173.00 ns/op 1.07
enrSubnets - ssz BitVector 4 bits 416.00 ns/op 419.00 ns/op 0.99
prioritizePeers score -10:0 att 32-0.1 sync 2-0 100.65 us/op 98.789 us/op 1.02
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 129.58 us/op 134.98 us/op 0.96
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 165.21 us/op 173.45 us/op 0.95
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 288.59 us/op 295.58 us/op 0.98
prioritizePeers score 0:0 att 64-1 sync 4-1 343.23 us/op 356.23 us/op 0.96
array of 16000 items push then shift 1.6548 us/op 1.6319 us/op 1.01
LinkedList of 16000 items push then shift 9.0760 ns/op 8.9200 ns/op 1.02
array of 16000 items push then pop 93.086 ns/op 90.828 ns/op 1.02
LinkedList of 16000 items push then pop 8.8910 ns/op 9.2550 ns/op 0.96
array of 24000 items push then shift 2.4637 us/op 2.4847 us/op 0.99
LinkedList of 24000 items push then shift 9.0460 ns/op 9.1470 ns/op 0.99
array of 24000 items push then pop 118.12 ns/op 129.00 ns/op 0.92
LinkedList of 24000 items push then pop 8.6940 ns/op 8.7920 ns/op 0.99
intersect bitArray bitLen 8 5.7890 ns/op 5.8950 ns/op 0.98
intersect array and set length 8 64.968 ns/op 64.757 ns/op 1.00
intersect bitArray bitLen 128 35.434 ns/op 35.996 ns/op 0.98
intersect array and set length 128 884.64 ns/op 863.34 ns/op 1.02
bitArray.getTrueBitIndexes() bitLen 128 1.5870 us/op 1.4130 us/op 1.12
bitArray.getTrueBitIndexes() bitLen 248 2.7510 us/op 2.5060 us/op 1.10
bitArray.getTrueBitIndexes() bitLen 512 5.0690 us/op 4.7650 us/op 1.06
Buffer.concat 32 items 1.0050 us/op 992.00 ns/op 1.01
Uint8Array.set 32 items 1.9340 us/op 1.7360 us/op 1.11
Set add up to 64 items then delete first 4.3829 us/op 4.4206 us/op 0.99
OrderedSet add up to 64 items then delete first 5.4912 us/op 5.6065 us/op 0.98
Set add up to 64 items then delete last 4.8194 us/op 4.9519 us/op 0.97
OrderedSet add up to 64 items then delete last 6.1408 us/op 6.4759 us/op 0.95
Set add up to 64 items then delete middle 4.8653 us/op 5.4119 us/op 0.90
OrderedSet add up to 64 items then delete middle 7.1145 us/op 8.4436 us/op 0.84
Set add up to 128 items then delete first 9.6195 us/op 10.974 us/op 0.88
OrderedSet add up to 128 items then delete first 11.770 us/op 13.468 us/op 0.87
Set add up to 128 items then delete last 8.7483 us/op 10.613 us/op 0.82
OrderedSet add up to 128 items then delete last 11.022 us/op 15.037 us/op 0.73
Set add up to 128 items then delete middle 8.8563 us/op 10.414 us/op 0.85
OrderedSet add up to 128 items then delete middle 16.036 us/op 18.050 us/op 0.89
Set add up to 256 items then delete first 17.872 us/op 19.689 us/op 0.91
OrderedSet add up to 256 items then delete first 23.946 us/op 24.834 us/op 0.96
Set add up to 256 items then delete last 18.281 us/op 19.965 us/op 0.92
OrderedSet add up to 256 items then delete last 22.089 us/op 24.946 us/op 0.89
Set add up to 256 items then delete middle 17.948 us/op 20.911 us/op 0.86
OrderedSet add up to 256 items then delete middle 45.387 us/op 48.036 us/op 0.94
transfer serialized Status (84 B) 1.6110 us/op 1.8120 us/op 0.89
copy serialized Status (84 B) 1.2880 us/op 1.3780 us/op 0.93
transfer serialized SignedVoluntaryExit (112 B) 1.9110 us/op 1.9420 us/op 0.98
copy serialized SignedVoluntaryExit (112 B) 1.4590 us/op 1.5460 us/op 0.94
transfer serialized ProposerSlashing (416 B) 3.0270 us/op 2.4210 us/op 1.25
copy serialized ProposerSlashing (416 B) 2.7830 us/op 2.0530 us/op 1.36
transfer serialized Attestation (485 B) 3.1260 us/op 3.2260 us/op 0.97
copy serialized Attestation (485 B) 2.8480 us/op 2.2870 us/op 1.25
transfer serialized AttesterSlashing (33232 B) 3.0350 us/op 2.6490 us/op 1.15
copy serialized AttesterSlashing (33232 B) 6.5040 us/op 7.1250 us/op 0.91
transfer serialized Small SignedBeaconBlock (128000 B) 3.1210 us/op 3.4820 us/op 0.90
copy serialized Small SignedBeaconBlock (128000 B) 15.027 us/op 19.771 us/op 0.76
transfer serialized Avg SignedBeaconBlock (200000 B) 2.6860 us/op 3.6770 us/op 0.73
copy serialized Avg SignedBeaconBlock (200000 B) 21.425 us/op 30.664 us/op 0.70
transfer serialized BlobsSidecar (524380 B) 2.7670 us/op 3.6960 us/op 0.75
copy serialized BlobsSidecar (524380 B) 81.214 us/op 96.083 us/op 0.85
transfer serialized Big SignedBeaconBlock (1000000 B) 2.9800 us/op 3.5370 us/op 0.84
copy serialized Big SignedBeaconBlock (1000000 B) 224.30 us/op 181.27 us/op 1.24
pass gossip attestations to forkchoice per slot 3.7594 ms/op 4.7464 ms/op 0.79
forkChoice updateHead vc 100000 bc 64 eq 0 678.54 us/op 754.80 us/op 0.90
forkChoice updateHead vc 600000 bc 64 eq 0 4.8110 ms/op 6.8560 ms/op 0.70
forkChoice updateHead vc 1000000 bc 64 eq 0 6.8548 ms/op 8.3082 ms/op 0.83
forkChoice updateHead vc 600000 bc 320 eq 0 4.1022 ms/op 4.6675 ms/op 0.88
forkChoice updateHead vc 600000 bc 1200 eq 0 4.2563 ms/op 4.8891 ms/op 0.87
forkChoice updateHead vc 600000 bc 7200 eq 0 5.2862 ms/op 7.0563 ms/op 0.75
forkChoice updateHead vc 600000 bc 64 eq 1000 11.027 ms/op 12.766 ms/op 0.86
forkChoice updateHead vc 600000 bc 64 eq 10000 11.905 ms/op 13.263 ms/op 0.90
forkChoice updateHead vc 600000 bc 64 eq 300000 15.245 ms/op 21.063 ms/op 0.72
computeDeltas 500000 validators 300 proto nodes 6.6145 ms/op 7.5273 ms/op 0.88
computeDeltas 500000 validators 1200 proto nodes 6.5125 ms/op 7.4067 ms/op 0.88
computeDeltas 500000 validators 7200 proto nodes 6.4248 ms/op 6.8944 ms/op 0.93
computeDeltas 750000 validators 300 proto nodes 9.4619 ms/op 10.672 ms/op 0.89
computeDeltas 750000 validators 1200 proto nodes 9.5797 ms/op 10.378 ms/op 0.92
computeDeltas 750000 validators 7200 proto nodes 9.4600 ms/op 10.189 ms/op 0.93
computeDeltas 1400000 validators 300 proto nodes 18.396 ms/op 21.615 ms/op 0.85
computeDeltas 1400000 validators 1200 proto nodes 18.433 ms/op 21.533 ms/op 0.86
computeDeltas 1400000 validators 7200 proto nodes 17.880 ms/op 22.253 ms/op 0.80
computeDeltas 2100000 validators 300 proto nodes 26.941 ms/op 32.441 ms/op 0.83
computeDeltas 2100000 validators 1200 proto nodes 27.887 ms/op 31.957 ms/op 0.87
computeDeltas 2100000 validators 7200 proto nodes 27.121 ms/op 34.114 ms/op 0.80
altair processAttestation - 250000 vs - 7PWei normalcase 2.1722 ms/op 3.4623 ms/op 0.63
altair processAttestation - 250000 vs - 7PWei worstcase 3.2338 ms/op 5.0574 ms/op 0.64
altair processAttestation - setStatus - 1/6 committees join 175.29 us/op 214.05 us/op 0.82
altair processAttestation - setStatus - 1/3 committees join 349.42 us/op 438.67 us/op 0.80
altair processAttestation - setStatus - 1/2 committees join 471.42 us/op 633.90 us/op 0.74
altair processAttestation - setStatus - 2/3 committees join 589.06 us/op 707.69 us/op 0.83
altair processAttestation - setStatus - 4/5 committees join 793.66 us/op 1.0624 ms/op 0.75
altair processAttestation - setStatus - 100% committees join 925.71 us/op 1.1025 ms/op 0.84
altair processBlock - 250000 vs - 7PWei normalcase 9.9675 ms/op 12.780 ms/op 0.78
altair processBlock - 250000 vs - 7PWei normalcase hashState 34.574 ms/op 42.296 ms/op 0.82
altair processBlock - 250000 vs - 7PWei worstcase 39.569 ms/op 51.156 ms/op 0.77
altair processBlock - 250000 vs - 7PWei worstcase hashState 90.266 ms/op 125.16 ms/op 0.72
phase0 processBlock - 250000 vs - 7PWei normalcase 2.3898 ms/op 4.4179 ms/op 0.54
phase0 processBlock - 250000 vs - 7PWei worstcase 28.377 ms/op 41.948 ms/op 0.68
altair processEth1Data - 250000 vs - 7PWei normalcase 511.57 us/op 789.68 us/op 0.65
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 13.122 us/op 21.420 us/op 0.61
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 55.217 us/op 70.533 us/op 0.78
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 16.002 us/op 30.090 us/op 0.53
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 7.9710 us/op 24.640 us/op 0.32
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 132.06 us/op 201.81 us/op 0.65
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.1300 ms/op 1.6953 ms/op 0.67
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.6311 ms/op 2.7625 ms/op 0.59
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.5271 ms/op 2.2803 ms/op 0.67
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.8905 ms/op 5.5456 ms/op 0.70
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.3360 ms/op 3.0996 ms/op 0.75
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 5.2066 ms/op 7.0466 ms/op 0.74
Tree 40 250000 create 362.91 ms/op 598.16 ms/op 0.61
Tree 40 250000 get(125000) 190.49 ns/op 230.75 ns/op 0.83
Tree 40 250000 set(125000) 980.59 ns/op 1.5979 us/op 0.61
Tree 40 250000 toArray() 20.308 ms/op 26.490 ms/op 0.77
Tree 40 250000 iterate all - toArray() + loop 18.274 ms/op 29.353 ms/op 0.62
Tree 40 250000 iterate all - get(i) 63.997 ms/op 83.643 ms/op 0.77
MutableVector 250000 create 12.823 ms/op 17.584 ms/op 0.73
MutableVector 250000 get(125000) 6.3910 ns/op 7.1030 ns/op 0.90
MutableVector 250000 set(125000) 266.77 ns/op 547.36 ns/op 0.49
MutableVector 250000 toArray() 3.1119 ms/op 4.3912 ms/op 0.71
MutableVector 250000 iterate all - toArray() + loop 3.8556 ms/op 4.7697 ms/op 0.81
MutableVector 250000 iterate all - get(i) 1.5021 ms/op 1.6118 ms/op 0.93
Array 250000 create 2.7217 ms/op 3.9774 ms/op 0.68
Array 250000 clone - spread 1.3345 ms/op 1.4693 ms/op 0.91
Array 250000 get(125000) 1.1110 ns/op 1.2850 ns/op 0.86
Array 250000 set(125000) 4.2720 ns/op 4.9820 ns/op 0.86
Array 250000 iterate all - loop 167.50 us/op 180.43 us/op 0.93
effectiveBalanceIncrements clone Uint8Array 300000 32.981 us/op 51.058 us/op 0.65
effectiveBalanceIncrements clone MutableVector 300000 401.00 ns/op 468.00 ns/op 0.86
effectiveBalanceIncrements rw all Uint8Array 300000 198.06 us/op 210.10 us/op 0.94
effectiveBalanceIncrements rw all MutableVector 300000 84.902 ms/op 101.05 ms/op 0.84
phase0 afterProcessEpoch - 250000 vs - 7PWei 112.59 ms/op 124.54 ms/op 0.90
phase0 beforeProcessEpoch - 250000 vs - 7PWei 50.384 ms/op 68.793 ms/op 0.73
altair processEpoch - mainnet_e81889 496.46 ms/op 498.69 ms/op 1.00
mainnet_e81889 - altair beforeProcessEpoch 85.577 ms/op 93.002 ms/op 0.92
mainnet_e81889 - altair processJustificationAndFinalization 14.574 us/op 20.016 us/op 0.73
mainnet_e81889 - altair processInactivityUpdates 6.2224 ms/op 8.1375 ms/op 0.76
mainnet_e81889 - altair processRewardsAndPenalties 67.299 ms/op 67.131 ms/op 1.00
mainnet_e81889 - altair processRegistryUpdates 2.0570 us/op 6.6160 us/op 0.31
mainnet_e81889 - altair processSlashings 510.00 ns/op 920.00 ns/op 0.55
mainnet_e81889 - altair processEth1DataReset 401.00 ns/op 1.1240 us/op 0.36
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.4357 ms/op 1.8321 ms/op 0.78
mainnet_e81889 - altair processSlashingsReset 4.0140 us/op 8.6520 us/op 0.46
mainnet_e81889 - altair processRandaoMixesReset 4.9210 us/op 7.9730 us/op 0.62
mainnet_e81889 - altair processHistoricalRootsUpdate 635.00 ns/op 1.1150 us/op 0.57
mainnet_e81889 - altair processParticipationFlagUpdates 1.6600 us/op 4.8380 us/op 0.34
mainnet_e81889 - altair processSyncCommitteeUpdates 773.00 ns/op 1.4610 us/op 0.53
mainnet_e81889 - altair afterProcessEpoch 121.32 ms/op 130.21 ms/op 0.93
capella processEpoch - mainnet_e217614 1.8445 s/op 2.1085 s/op 0.87
mainnet_e217614 - capella beforeProcessEpoch 452.34 ms/op 595.45 ms/op 0.76
mainnet_e217614 - capella processJustificationAndFinalization 14.194 us/op 23.846 us/op 0.60
mainnet_e217614 - capella processInactivityUpdates 16.614 ms/op 32.287 ms/op 0.51
mainnet_e217614 - capella processRewardsAndPenalties 360.40 ms/op 433.80 ms/op 0.83
mainnet_e217614 - capella processRegistryUpdates 19.851 us/op 37.533 us/op 0.53
mainnet_e217614 - capella processSlashings 466.00 ns/op 1.0630 us/op 0.44
mainnet_e217614 - capella processEth1DataReset 409.00 ns/op 1.0240 us/op 0.40
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.8289 ms/op 10.447 ms/op 0.46
mainnet_e217614 - capella processSlashingsReset 3.4130 us/op 4.1340 us/op 0.83
mainnet_e217614 - capella processRandaoMixesReset 3.7380 us/op 8.9350 us/op 0.42
mainnet_e217614 - capella processHistoricalRootsUpdate 561.00 ns/op 1.0490 us/op 0.53
mainnet_e217614 - capella processParticipationFlagUpdates 2.0560 us/op 2.4780 us/op 0.83
mainnet_e217614 - capella afterProcessEpoch 294.69 ms/op 329.74 ms/op 0.89
phase0 processEpoch - mainnet_e58758 475.14 ms/op 599.64 ms/op 0.79
mainnet_e58758 - phase0 beforeProcessEpoch 151.34 ms/op 190.45 ms/op 0.79
mainnet_e58758 - phase0 processJustificationAndFinalization 14.295 us/op 31.475 us/op 0.45
mainnet_e58758 - phase0 processRewardsAndPenalties 33.448 ms/op 67.400 ms/op 0.50
mainnet_e58758 - phase0 processRegistryUpdates 9.1930 us/op 18.779 us/op 0.49
mainnet_e58758 - phase0 processSlashings 479.00 ns/op 1.1000 us/op 0.44
mainnet_e58758 - phase0 processEth1DataReset 393.00 ns/op 989.00 ns/op 0.40
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.0941 ms/op 1.4040 ms/op 0.78
mainnet_e58758 - phase0 processSlashingsReset 2.3660 us/op 5.7510 us/op 0.41
mainnet_e58758 - phase0 processRandaoMixesReset 3.7150 us/op 7.0910 us/op 0.52
mainnet_e58758 - phase0 processHistoricalRootsUpdate 448.00 ns/op 801.00 ns/op 0.56
mainnet_e58758 - phase0 processParticipationRecordUpdates 3.1580 us/op 9.4400 us/op 0.33
mainnet_e58758 - phase0 afterProcessEpoch 103.67 ms/op 110.67 ms/op 0.94
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.3573 ms/op 1.6310 ms/op 0.83
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5315 ms/op 1.8752 ms/op 0.82
altair processInactivityUpdates - 250000 normalcase 29.372 ms/op 41.438 ms/op 0.71
altair processInactivityUpdates - 250000 worstcase 26.789 ms/op 39.676 ms/op 0.68
phase0 processRegistryUpdates - 250000 normalcase 8.9660 us/op 12.499 us/op 0.72
phase0 processRegistryUpdates - 250000 badcase_full_deposits 444.34 us/op 428.95 us/op 1.04
phase0 processRegistryUpdates - 250000 worstcase 0.5 136.19 ms/op 150.81 ms/op 0.90
altair processRewardsAndPenalties - 250000 normalcase 44.991 ms/op 67.928 ms/op 0.66
altair processRewardsAndPenalties - 250000 worstcase 56.517 ms/op 63.856 ms/op 0.89
phase0 getAttestationDeltas - 250000 normalcase 9.2109 ms/op 12.111 ms/op 0.76
phase0 getAttestationDeltas - 250000 worstcase 9.1910 ms/op 11.825 ms/op 0.78
phase0 processSlashings - 250000 worstcase 88.677 us/op 112.72 us/op 0.79
altair processSyncCommitteeUpdates - 250000 150.80 ms/op 182.77 ms/op 0.83
BeaconState.hashTreeRoot - No change 362.00 ns/op 901.00 ns/op 0.40
BeaconState.hashTreeRoot - 1 full validator 116.24 us/op 178.00 us/op 0.65
BeaconState.hashTreeRoot - 32 full validator 1.1857 ms/op 1.7865 ms/op 0.66
BeaconState.hashTreeRoot - 512 full validator 12.759 ms/op 20.213 ms/op 0.63
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 139.53 us/op 195.21 us/op 0.71
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.9708 ms/op 2.5414 ms/op 0.78
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 24.929 ms/op 31.721 ms/op 0.79
BeaconState.hashTreeRoot - 1 balances 111.97 us/op 145.49 us/op 0.77
BeaconState.hashTreeRoot - 32 balances 1.0090 ms/op 1.2485 ms/op 0.81
BeaconState.hashTreeRoot - 512 balances 9.9685 ms/op 13.550 ms/op 0.74
BeaconState.hashTreeRoot - 250000 balances 205.85 ms/op 223.96 ms/op 0.92
aggregationBits - 2048 els - zipIndexesInBitList 28.876 us/op 34.626 us/op 0.83
byteArrayEquals 32 79.207 ns/op 81.127 ns/op 0.98
Buffer.compare 32 59.487 ns/op 60.817 ns/op 0.98
byteArrayEquals 1024 2.2257 us/op 2.1930 us/op 1.01
Buffer.compare 1024 73.082 ns/op 75.575 ns/op 0.97
byteArrayEquals 16384 35.541 us/op 34.530 us/op 1.03
Buffer.compare 16384 255.10 ns/op 283.78 ns/op 0.90
byteArrayEquals 123687377 249.75 ms/op 267.32 ms/op 0.93
Buffer.compare 123687377 7.0303 ms/op 9.5739 ms/op 0.73
byteArrayEquals 32 - diff last byte 75.111 ns/op 93.648 ns/op 0.80
Buffer.compare 32 - diff last byte 57.948 ns/op 64.079 ns/op 0.90
byteArrayEquals 1024 - diff last byte 2.0481 us/op 2.2746 us/op 0.90
Buffer.compare 1024 - diff last byte 72.171 ns/op 82.480 ns/op 0.88
byteArrayEquals 16384 - diff last byte 32.725 us/op 36.225 us/op 0.90
Buffer.compare 16384 - diff last byte 258.83 ns/op 302.64 ns/op 0.86
byteArrayEquals 123687377 - diff last byte 250.30 ms/op 302.20 ms/op 0.83
Buffer.compare 123687377 - diff last byte 7.3896 ms/op 9.3600 ms/op 0.79
byteArrayEquals 32 - random bytes 5.5400 ns/op 7.0160 ns/op 0.79
Buffer.compare 32 - random bytes 61.648 ns/op 67.647 ns/op 0.91
byteArrayEquals 1024 - random bytes 5.6320 ns/op 7.0150 ns/op 0.80
Buffer.compare 1024 - random bytes 61.457 ns/op 75.458 ns/op 0.81
byteArrayEquals 16384 - random bytes 5.8200 ns/op 6.9890 ns/op 0.83
Buffer.compare 16384 - random bytes 63.698 ns/op 74.911 ns/op 0.85
byteArrayEquals 123687377 - random bytes 8.7700 ns/op 16.540 ns/op 0.53
Buffer.compare 123687377 - random bytes 64.530 ns/op 86.900 ns/op 0.74
regular array get 100000 times 45.750 us/op 51.543 us/op 0.89
wrappedArray get 100000 times 45.367 us/op 57.112 us/op 0.79
arrayWithProxy get 100000 times 15.376 ms/op 15.807 ms/op 0.97
ssz.Root.equals 55.537 ns/op 62.478 ns/op 0.89
byteArrayEquals 54.816 ns/op 61.535 ns/op 0.89
Buffer.compare 12.064 ns/op 13.573 ns/op 0.89
shuffle list - 16384 els 8.8073 ms/op 9.7446 ms/op 0.90
shuffle list - 250000 els 126.20 ms/op 139.82 ms/op 0.90
processSlot - 1 slots 17.641 us/op 23.728 us/op 0.74
processSlot - 32 slots 3.4799 ms/op 3.8091 ms/op 0.91
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 61.449 ms/op 61.862 ms/op 0.99
getCommitteeAssignments - req 1 vs - 250000 vc 2.8220 ms/op 2.8629 ms/op 0.99
getCommitteeAssignments - req 100 vs - 250000 vc 3.8950 ms/op 4.2981 ms/op 0.91
getCommitteeAssignments - req 1000 vs - 250000 vc 4.2488 ms/op 4.5547 ms/op 0.93
findModifiedValidators - 10000 modified validators 594.92 ms/op 634.80 ms/op 0.94
findModifiedValidators - 1000 modified validators 427.35 ms/op 465.23 ms/op 0.92
findModifiedValidators - 100 modified validators 425.82 ms/op 440.70 ms/op 0.97
findModifiedValidators - 10 modified validators 458.71 ms/op 456.84 ms/op 1.00
findModifiedValidators - 1 modified validators 418.71 ms/op 441.75 ms/op 0.95
findModifiedValidators - no difference 449.63 ms/op 450.12 ms/op 1.00
compare ViewDUs 4.6477 s/op 6.3048 s/op 0.74
compare each validator Uint8Array 1.9943 s/op 1.8497 s/op 1.08
compare ViewDU to Uint8Array 1.2096 s/op 1.5313 s/op 0.79
migrate state 1000000 validators, 24 modified, 0 new 848.32 ms/op 835.10 ms/op 1.02
migrate state 1000000 validators, 1700 modified, 1000 new 1.0877 s/op 1.1160 s/op 0.97
migrate state 1000000 validators, 3400 modified, 2000 new 1.3870 s/op 1.3660 s/op 1.02
migrate state 1500000 validators, 24 modified, 0 new 920.20 ms/op 848.13 ms/op 1.08
migrate state 1500000 validators, 1700 modified, 1000 new 1.2342 s/op 1.2125 s/op 1.02
migrate state 1500000 validators, 3400 modified, 2000 new 1.4615 s/op 1.4029 s/op 1.04
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.5100 ns/op 4.7400 ns/op 1.16
state getBlockRootAtSlot - 250000 vs - 7PWei 909.15 ns/op 993.60 ns/op 0.92
computeProposers - vc 250000 10.953 ms/op 10.159 ms/op 1.08
computeEpochShuffling - vc 250000 128.97 ms/op 129.98 ms/op 0.99
getNextSyncCommittee - vc 250000 198.09 ms/op 176.26 ms/op 1.12
computeSigningRoot for AttestationData 33.552 us/op 25.973 us/op 1.29
hash AttestationData serialized data then Buffer.toString(base64) 2.3759 us/op 2.3719 us/op 1.00
toHexString serialized data 1.1639 us/op 1.1286 us/op 1.03
Buffer.toString(base64) 243.64 ns/op 259.31 ns/op 0.94

by benchmarkbot/action

const clk =
clock === "real"
? new Clock({config, genesisTime: 0, signal: new AbortController().signal})
: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Introducing a small utility function to create this dummy Clock would improve readability.

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 probably look into reusing ClockMock from validator client

export class ClockMock implements IClock {

currentSlotWithGossipDisparity: undefined,
isCurrentSlotGivenGossipDisparity: vi.fn(),
},
clock: clk,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: could we possibly rename clk to clock, and the previous clock to something else?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe clock should be a parameter to this function, with a default value to the most common one.

@@ -912,7 +912,7 @@ export function getValidatorApi({
// TODO: Add a flag to just send 0x00 as pubkeys since the Lodestar validator does not need them.
const pubkeys = getPubkeysForIndices(state.validators, indexes);

const startSlot = computeStartSlotAtEpoch(stateEpoch);
const startSlot = computeStartSlotAtEpoch(epoch);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the fix, right? Maybe it would be worth adding a comment clarifying what is done here?

Copy link
Member

@nflaig nflaig Mar 15, 2024

Choose a reason for hiding this comment

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

The previous code would have deserved a comment on why we use the stateEpoch instead of actual requested epoch which didn't make sense of course. But it makes sense now, shouldn't require a comment imo

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.

Looks good, could apply some refactoring in tests as suggested by @jeluard

@@ -912,7 +912,7 @@ export function getValidatorApi({
// TODO: Add a flag to just send 0x00 as pubkeys since the Lodestar validator does not need them.
const pubkeys = getPubkeysForIndices(state.validators, indexes);

const startSlot = computeStartSlotAtEpoch(stateEpoch);
const startSlot = computeStartSlotAtEpoch(epoch);
Copy link
Member

@nflaig nflaig Mar 15, 2024

Choose a reason for hiding this comment

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

The previous code would have deserved a comment on why we use the stateEpoch instead of actual requested epoch which didn't make sense of course. But it makes sense now, shouldn't require a comment imo

const clk =
clock === "real"
? new Clock({config, genesisTime: 0, signal: new AbortController().signal})
: {
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 probably look into reusing ClockMock from validator client

export class ClockMock implements IClock {

jeluard
jeluard previously approved these changes Mar 15, 2024
nflaig
nflaig previously approved these changes Mar 15, 2024
@nazarhussain nazarhussain dismissed stale reviews from nflaig and jeluard via 3e39f61 March 15, 2024 15:09
@nazarhussain nazarhussain merged commit 9e5864d into unstable Mar 15, 2024
17 of 20 checks passed
@nazarhussain nazarhussain deleted the nh/proposer-duties-fix branch March 15, 2024 16:22
@wemeetagain
Copy link
Member

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

5 participants