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 correct by peer rate limiting on BlobSidecarsByRoot/Range post-electra #7405

Open
wants to merge 4 commits into
base: unstable
Choose a base branch
from

Conversation

nflaig
Copy link
Member

@nflaig nflaig commented Jan 27, 2025

Motivation

The by peer rate limiting needs to be increased post-electra from 768 to 1152 as otherwise we might incorrectly rate limit our peers.

Description

Use correct fork constants to apply by peer rate limiting on BlobSidecarsByRoot/Range

  • makes rateLimitQuotas fork-aware, it will apply the new rate limiting during protocol registration of the next fork
  • pass fork from protocol registration down to rate limiter quotas to allow accessing the fork for which it is registered
  • always apply new rate limits during registration even if protocol is already registered

@nflaig nflaig requested a review from a team as a code owner January 27, 2025 14:38
@nflaig nflaig changed the title fix: use correct fork constants to apply by peer rate limiting on BlobSidecarsByRoot/Range fix: apply correct by peer rate limiting on BlobSidecarsByRoot/Range post-electra Jan 27, 2025
@nflaig nflaig changed the title fix: apply correct by peer rate limiting on BlobSidecarsByRoot/Range post-electra fix: use correct by peer rate limiting on BlobSidecarsByRoot/Range post-electra Jan 27, 2025
@nflaig
Copy link
Member Author

nflaig commented Jan 27, 2025

also it seems like we might not be applying correct rate limit for BeaconBlocksByRange

byPeer: {quota: MAX_REQUEST_BLOCKS, quotaTimeMs: 10_000},

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

Attention: Patch coverage is 22.85714% with 27 lines in your changes missing coverage. Please review.

Project coverage is 48.44%. Comparing base (ee9d4fa) to head (ed9aa8b).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #7405      +/-   ##
============================================
- Coverage     48.45%   48.44%   -0.02%     
============================================
  Files           602      602              
  Lines         40387    40396       +9     
  Branches       2069     2069              
============================================
  Hits          19568    19568              
- Misses        20781    20790       +9     
  Partials         38       38              

wemeetagain
wemeetagain previously approved these changes Jan 27, 2025
@nflaig nflaig marked this pull request as draft January 27, 2025 16:01
@nflaig nflaig marked this pull request as ready for review January 27, 2025 18:25
Copy link
Contributor

github-actions bot commented Jan 27, 2025

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 15ef8c0 Previous: ee9d4fa Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.6411 ms/op 1.7230 ms/op 0.95
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 32.844 us/op 37.800 us/op 0.87
BLS verify - blst 891.41 us/op 966.50 us/op 0.92
BLS verifyMultipleSignatures 3 - blst 1.3204 ms/op 1.2906 ms/op 1.02
BLS verifyMultipleSignatures 8 - blst 2.0179 ms/op 1.8218 ms/op 1.11
BLS verifyMultipleSignatures 32 - blst 4.3047 ms/op 6.1339 ms/op 0.70
BLS verifyMultipleSignatures 64 - blst 8.0098 ms/op 10.490 ms/op 0.76
BLS verifyMultipleSignatures 128 - blst 15.515 ms/op 17.297 ms/op 0.90
BLS deserializing 10000 signatures 610.02 ms/op 679.61 ms/op 0.90
BLS deserializing 100000 signatures 6.1332 s/op 6.7454 s/op 0.91
BLS verifyMultipleSignatures - same message - 3 - blst 966.19 us/op 895.04 us/op 1.08
BLS verifyMultipleSignatures - same message - 8 - blst 1.1004 ms/op 1.1144 ms/op 0.99
BLS verifyMultipleSignatures - same message - 32 - blst 1.6861 ms/op 1.7669 ms/op 0.95
BLS verifyMultipleSignatures - same message - 64 - blst 2.5394 ms/op 2.5913 ms/op 0.98
BLS verifyMultipleSignatures - same message - 128 - blst 4.0756 ms/op 4.2857 ms/op 0.95
BLS aggregatePubkeys 32 - blst 17.815 us/op 19.912 us/op 0.89
BLS aggregatePubkeys 128 - blst 61.579 us/op 69.416 us/op 0.89
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 62.507 ms/op 52.506 ms/op 1.19
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 43.819 ms/op 52.197 ms/op 0.84
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 30.547 ms/op 40.425 ms/op 0.76
getSlashingsAndExits - default max 63.045 us/op 87.288 us/op 0.72
getSlashingsAndExits - 2k 257.68 us/op 375.32 us/op 0.69
proposeBlockBody type=full, size=empty 4.3976 ms/op 5.3109 ms/op 0.83
isKnown best case - 1 super set check 469.00 ns/op 299.00 ns/op 1.57
isKnown normal case - 2 super set checks 441.00 ns/op 272.00 ns/op 1.62
isKnown worse case - 16 super set checks 449.00 ns/op 268.00 ns/op 1.68
InMemoryCheckpointStateCache - add get delete 2.6560 us/op 3.1110 us/op 0.85
validate api signedAggregateAndProof - struct 1.5905 ms/op 2.1636 ms/op 0.74
validate gossip signedAggregateAndProof - struct 1.4986 ms/op 1.3691 ms/op 1.09
batch validate gossip attestation - vc 640000 - chunk 32 122.52 us/op 134.37 us/op 0.91
batch validate gossip attestation - vc 640000 - chunk 64 101.51 us/op 114.11 us/op 0.89
batch validate gossip attestation - vc 640000 - chunk 128 96.769 us/op 113.46 us/op 0.85
batch validate gossip attestation - vc 640000 - chunk 256 91.917 us/op 116.29 us/op 0.79
pickEth1Vote - no votes 839.60 us/op 1.1728 ms/op 0.72
pickEth1Vote - max votes 4.6215 ms/op 7.0117 ms/op 0.66
pickEth1Vote - Eth1Data hashTreeRoot value x2048 12.026 ms/op 13.124 ms/op 0.92
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 19.668 ms/op 19.577 ms/op 1.00
pickEth1Vote - Eth1Data fastSerialize value x2048 382.13 us/op 562.34 us/op 0.68
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.0236 ms/op 2.8686 ms/op 1.05
bytes32 toHexString 590.00 ns/op 513.00 ns/op 1.15
bytes32 Buffer.toString(hex) 422.00 ns/op 254.00 ns/op 1.66
bytes32 Buffer.toString(hex) from Uint8Array 521.00 ns/op 448.00 ns/op 1.16
bytes32 Buffer.toString(hex) + 0x 428.00 ns/op 253.00 ns/op 1.69
Object access 1 prop 0.31600 ns/op 0.18400 ns/op 1.72
Map access 1 prop 0.31600 ns/op 0.14500 ns/op 2.18
Object get x1000 5.1920 ns/op 6.3910 ns/op 0.81
Map get x1000 5.8900 ns/op 6.7860 ns/op 0.87
Object set x1000 22.129 ns/op 43.599 ns/op 0.51
Map set x1000 18.476 ns/op 29.735 ns/op 0.62
Return object 10000 times 0.29590 ns/op 0.31830 ns/op 0.93
Throw Error 10000 times 2.6750 us/op 3.5183 us/op 0.76
toHex 109.66 ns/op 178.38 ns/op 0.61
Buffer.from 101.24 ns/op 160.80 ns/op 0.63
shared Buffer 69.515 ns/op 94.233 ns/op 0.74
fastMsgIdFn sha256 / 200 bytes 1.9920 us/op 2.4410 us/op 0.82
fastMsgIdFn h32 xxhash / 200 bytes 429.00 ns/op 313.00 ns/op 1.37
fastMsgIdFn h64 xxhash / 200 bytes 461.00 ns/op 281.00 ns/op 1.64
fastMsgIdFn sha256 / 1000 bytes 6.0780 us/op 7.7250 us/op 0.79
fastMsgIdFn h32 xxhash / 1000 bytes 597.00 ns/op 461.00 ns/op 1.30
fastMsgIdFn h64 xxhash / 1000 bytes 526.00 ns/op 359.00 ns/op 1.47
fastMsgIdFn sha256 / 10000 bytes 49.884 us/op 68.458 us/op 0.73
fastMsgIdFn h32 xxhash / 10000 bytes 2.0250 us/op 1.9970 us/op 1.01
fastMsgIdFn h64 xxhash / 10000 bytes 1.3520 us/op 1.2860 us/op 1.05
send data - 1000 256B messages 10.883 ms/op 14.896 ms/op 0.73
send data - 1000 512B messages 15.758 ms/op 19.764 ms/op 0.80
send data - 1000 1024B messages 24.358 ms/op 28.746 ms/op 0.85
send data - 1000 1200B messages 22.272 ms/op 29.668 ms/op 0.75
send data - 1000 2048B messages 28.649 ms/op 36.955 ms/op 0.78
send data - 1000 4096B messages 27.348 ms/op 34.462 ms/op 0.79
send data - 1000 16384B messages 62.261 ms/op 71.284 ms/op 0.87
send data - 1000 65536B messages 255.64 ms/op 205.69 ms/op 1.24
enrSubnets - fastDeserialize 64 bits 1.1280 us/op 1.3560 us/op 0.83
enrSubnets - ssz BitVector 64 bits 521.00 ns/op 474.00 ns/op 1.10
enrSubnets - fastDeserialize 4 bits 336.00 ns/op 209.00 ns/op 1.61
enrSubnets - ssz BitVector 4 bits 543.00 ns/op 481.00 ns/op 1.13
prioritizePeers score -10:0 att 32-0.1 sync 2-0 110.02 us/op 204.29 us/op 0.54
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 169.67 us/op 190.70 us/op 0.89
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 233.18 us/op 349.50 us/op 0.67
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 381.63 us/op 511.85 us/op 0.75
prioritizePeers score 0:0 att 64-1 sync 4-1 431.43 us/op 703.48 us/op 0.61
array of 16000 items push then shift 1.2691 us/op 1.7616 us/op 0.72
LinkedList of 16000 items push then shift 7.3270 ns/op 8.4110 ns/op 0.87
array of 16000 items push then pop 104.46 ns/op 133.74 ns/op 0.78
LinkedList of 16000 items push then pop 6.3780 ns/op 7.7800 ns/op 0.82
array of 24000 items push then shift 1.8392 us/op 2.5667 us/op 0.72
LinkedList of 24000 items push then shift 7.4520 ns/op 8.3890 ns/op 0.89
array of 24000 items push then pop 116.55 ns/op 175.26 ns/op 0.67
LinkedList of 24000 items push then pop 6.5910 ns/op 7.6050 ns/op 0.87
intersect bitArray bitLen 8 5.2880 ns/op 6.9150 ns/op 0.76
intersect array and set length 8 38.389 ns/op 53.462 ns/op 0.72
intersect bitArray bitLen 128 25.793 ns/op 32.038 ns/op 0.81
intersect array and set length 128 615.22 ns/op 781.73 ns/op 0.79
bitArray.getTrueBitIndexes() bitLen 128 1.6250 us/op 1.7310 us/op 0.94
bitArray.getTrueBitIndexes() bitLen 248 2.3320 us/op 2.8170 us/op 0.83
bitArray.getTrueBitIndexes() bitLen 512 4.4250 us/op 5.8690 us/op 0.75
Buffer.concat 32 items 999.00 ns/op 876.00 ns/op 1.14
Uint8Array.set 32 items 2.1540 us/op 2.0650 us/op 1.04
Buffer.copy 3.0610 us/op 3.1020 us/op 0.99
Uint8Array.set - with subarray 2.8930 us/op 3.5250 us/op 0.82
Uint8Array.set - without subarray 1.6990 us/op 2.2820 us/op 0.74
getUint32 - dataview 414.00 ns/op 286.00 ns/op 1.45
getUint32 - manual 335.00 ns/op 228.00 ns/op 1.47
Set add up to 64 items then delete first 1.7634 us/op 2.6573 us/op 0.66
OrderedSet add up to 64 items then delete first 2.7315 us/op 3.9839 us/op 0.69
Set add up to 64 items then delete last 2.0134 us/op 2.9122 us/op 0.69
OrderedSet add up to 64 items then delete last 2.8872 us/op 3.9679 us/op 0.73
Set add up to 64 items then delete middle 2.0433 us/op 2.8962 us/op 0.71
OrderedSet add up to 64 items then delete middle 4.4165 us/op 5.7830 us/op 0.76
Set add up to 128 items then delete first 3.9519 us/op 5.2380 us/op 0.75
OrderedSet add up to 128 items then delete first 6.1528 us/op 8.5529 us/op 0.72
Set add up to 128 items then delete last 3.8367 us/op 5.0468 us/op 0.76
OrderedSet add up to 128 items then delete last 5.7534 us/op 7.3649 us/op 0.78
Set add up to 128 items then delete middle 3.8110 us/op 5.0233 us/op 0.76
OrderedSet add up to 128 items then delete middle 11.352 us/op 15.341 us/op 0.74
Set add up to 256 items then delete first 7.8143 us/op 11.523 us/op 0.68
OrderedSet add up to 256 items then delete first 12.152 us/op 17.444 us/op 0.70
Set add up to 256 items then delete last 7.5629 us/op 11.495 us/op 0.66
OrderedSet add up to 256 items then delete last 11.436 us/op 16.077 us/op 0.71
Set add up to 256 items then delete middle 7.5238 us/op 10.130 us/op 0.74
OrderedSet add up to 256 items then delete middle 34.849 us/op 44.747 us/op 0.78
transfer serialized Status (84 B) 2.3610 us/op 2.9170 us/op 0.81
copy serialized Status (84 B) 1.5430 us/op 1.4830 us/op 1.04
transfer serialized SignedVoluntaryExit (112 B) 2.6990 us/op 3.0920 us/op 0.87
copy serialized SignedVoluntaryExit (112 B) 1.5470 us/op 1.6210 us/op 0.95
transfer serialized ProposerSlashing (416 B) 2.9030 us/op 3.5420 us/op 0.82
copy serialized ProposerSlashing (416 B) 1.8050 us/op 2.2840 us/op 0.79
transfer serialized Attestation (485 B) 2.9410 us/op 2.9860 us/op 0.98
copy serialized Attestation (485 B) 1.8870 us/op 1.7280 us/op 1.09
transfer serialized AttesterSlashing (33232 B) 2.6240 us/op 2.6810 us/op 0.98
copy serialized AttesterSlashing (33232 B) 5.0940 us/op 5.6830 us/op 0.90
transfer serialized Small SignedBeaconBlock (128000 B) 3.5260 us/op 3.5100 us/op 1.00
copy serialized Small SignedBeaconBlock (128000 B) 13.293 us/op 16.391 us/op 0.81
transfer serialized Avg SignedBeaconBlock (200000 B) 3.6660 us/op 4.1130 us/op 0.89
copy serialized Avg SignedBeaconBlock (200000 B) 19.346 us/op 24.468 us/op 0.79
transfer serialized BlobsSidecar (524380 B) 4.2070 us/op 4.2540 us/op 0.99
copy serialized BlobsSidecar (524380 B) 66.854 us/op 85.429 us/op 0.78
transfer serialized Big SignedBeaconBlock (1000000 B) 3.8910 us/op 4.8530 us/op 0.80
copy serialized Big SignedBeaconBlock (1000000 B) 217.11 us/op 160.44 us/op 1.35
pass gossip attestations to forkchoice per slot 2.3488 ms/op 2.7705 ms/op 0.85
forkChoice updateHead vc 100000 bc 64 eq 0 370.74 us/op 456.31 us/op 0.81
forkChoice updateHead vc 600000 bc 64 eq 0 2.5923 ms/op 2.8464 ms/op 0.91
forkChoice updateHead vc 1000000 bc 64 eq 0 3.7513 ms/op 5.1362 ms/op 0.73
forkChoice updateHead vc 600000 bc 320 eq 0 2.2607 ms/op 2.8702 ms/op 0.79
forkChoice updateHead vc 600000 bc 1200 eq 0 2.1936 ms/op 2.7934 ms/op 0.79
forkChoice updateHead vc 600000 bc 7200 eq 0 2.6137 ms/op 3.7977 ms/op 0.69
forkChoice updateHead vc 600000 bc 64 eq 1000 9.1333 ms/op 10.565 ms/op 0.86
forkChoice updateHead vc 600000 bc 64 eq 10000 9.2808 ms/op 10.598 ms/op 0.88
forkChoice updateHead vc 600000 bc 64 eq 300000 11.455 ms/op 14.796 ms/op 0.77
computeDeltas 500000 validators 300 proto nodes 3.2524 ms/op 4.0559 ms/op 0.80
computeDeltas 500000 validators 1200 proto nodes 3.2113 ms/op 4.0705 ms/op 0.79
computeDeltas 500000 validators 7200 proto nodes 3.1135 ms/op 4.0609 ms/op 0.77
computeDeltas 750000 validators 300 proto nodes 4.7264 ms/op 6.0921 ms/op 0.78
computeDeltas 750000 validators 1200 proto nodes 4.7351 ms/op 5.9213 ms/op 0.80
computeDeltas 750000 validators 7200 proto nodes 4.9009 ms/op 5.9691 ms/op 0.82
computeDeltas 1400000 validators 300 proto nodes 8.8276 ms/op 10.929 ms/op 0.81
computeDeltas 1400000 validators 1200 proto nodes 8.9467 ms/op 11.149 ms/op 0.80
computeDeltas 1400000 validators 7200 proto nodes 8.9383 ms/op 11.222 ms/op 0.80
computeDeltas 2100000 validators 300 proto nodes 13.551 ms/op 17.184 ms/op 0.79
computeDeltas 2100000 validators 1200 proto nodes 13.396 ms/op 17.223 ms/op 0.78
computeDeltas 2100000 validators 7200 proto nodes 13.351 ms/op 17.577 ms/op 0.76
altair processAttestation - 250000 vs - 7PWei normalcase 1.6725 ms/op 2.2618 ms/op 0.74
altair processAttestation - 250000 vs - 7PWei worstcase 2.4655 ms/op 3.0346 ms/op 0.81
altair processAttestation - setStatus - 1/6 committees join 102.31 us/op 135.92 us/op 0.75
altair processAttestation - setStatus - 1/3 committees join 186.60 us/op 246.82 us/op 0.76
altair processAttestation - setStatus - 1/2 committees join 258.69 us/op 340.43 us/op 0.76
altair processAttestation - setStatus - 2/3 committees join 355.18 us/op 441.52 us/op 0.80
altair processAttestation - setStatus - 4/5 committees join 491.73 us/op 594.89 us/op 0.83
altair processAttestation - setStatus - 100% committees join 585.44 us/op 722.17 us/op 0.81
altair processBlock - 250000 vs - 7PWei normalcase 4.1048 ms/op 6.7356 ms/op 0.61
altair processBlock - 250000 vs - 7PWei normalcase hashState 30.250 ms/op 24.701 ms/op 1.22
altair processBlock - 250000 vs - 7PWei worstcase 34.437 ms/op 45.994 ms/op 0.75
altair processBlock - 250000 vs - 7PWei worstcase hashState 62.528 ms/op 74.926 ms/op 0.83
phase0 processBlock - 250000 vs - 7PWei normalcase 1.3442 ms/op 2.3881 ms/op 0.56
phase0 processBlock - 250000 vs - 7PWei worstcase 20.023 ms/op 25.878 ms/op 0.77
altair processEth1Data - 250000 vs - 7PWei normalcase 311.79 us/op 384.49 us/op 0.81
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 4.4270 us/op 6.0320 us/op 0.73
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 25.973 us/op 37.659 us/op 0.69
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 7.0510 us/op 10.048 us/op 0.70
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 4.5330 us/op 6.7020 us/op 0.68
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 109.39 us/op 154.33 us/op 0.71
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.2473 ms/op 1.1630 ms/op 1.07
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.0632 ms/op 2.6318 ms/op 0.40
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.7809 ms/op 1.5813 ms/op 1.13
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 2.4545 ms/op 3.7051 ms/op 0.66
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.0172 ms/op 1.4146 ms/op 0.72
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 2.5139 ms/op 3.5167 ms/op 0.71
Tree 40 250000 create 346.34 ms/op 444.04 ms/op 0.78
Tree 40 250000 get(125000) 115.72 ns/op 153.63 ns/op 0.75
Tree 40 250000 set(125000) 1.2157 us/op 1.5984 us/op 0.76
Tree 40 250000 toArray() 9.5556 ms/op 21.573 ms/op 0.44
Tree 40 250000 iterate all - toArray() + loop 9.6410 ms/op 20.087 ms/op 0.48
Tree 40 250000 iterate all - get(i) 40.249 ms/op 53.431 ms/op 0.75
Array 250000 create 2.3024 ms/op 3.2535 ms/op 0.71
Array 250000 clone - spread 1.1714 ms/op 1.3742 ms/op 0.85
Array 250000 get(125000) 0.55400 ns/op 0.40900 ns/op 1.35
Array 250000 set(125000) 0.56500 ns/op 0.43000 ns/op 1.31
Array 250000 iterate all - loop 72.572 us/op 104.98 us/op 0.69
phase0 afterProcessEpoch - 250000 vs - 7PWei 42.092 ms/op 51.861 ms/op 0.81
Array.fill - length 1000000 2.5136 ms/op 3.4160 ms/op 0.74
Array push - length 1000000 13.860 ms/op 17.730 ms/op 0.78
Array.get 0.26094 ns/op 0.29011 ns/op 0.90
Uint8Array.get 0.34453 ns/op 0.43871 ns/op 0.79
phase0 beforeProcessEpoch - 250000 vs - 7PWei 12.299 ms/op 18.076 ms/op 0.68
altair processEpoch - mainnet_e81889 276.92 ms/op 306.56 ms/op 0.90
mainnet_e81889 - altair beforeProcessEpoch 17.883 ms/op 20.052 ms/op 0.89
mainnet_e81889 - altair processJustificationAndFinalization 12.937 us/op 16.560 us/op 0.78
mainnet_e81889 - altair processInactivityUpdates 3.7025 ms/op 5.6305 ms/op 0.66
mainnet_e81889 - altair processRewardsAndPenalties 57.586 ms/op 46.478 ms/op 1.24
mainnet_e81889 - altair processRegistryUpdates 2.4220 us/op 2.2130 us/op 1.09
mainnet_e81889 - altair processSlashings 845.00 ns/op 392.00 ns/op 2.16
mainnet_e81889 - altair processEth1DataReset 803.00 ns/op 484.00 ns/op 1.66
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.6214 ms/op 1.7361 ms/op 0.93
mainnet_e81889 - altair processSlashingsReset 2.6360 us/op 3.3170 us/op 0.79
mainnet_e81889 - altair processRandaoMixesReset 1.8650 us/op 4.7990 us/op 0.39
mainnet_e81889 - altair processHistoricalRootsUpdate 844.00 ns/op 922.00 ns/op 0.92
mainnet_e81889 - altair processParticipationFlagUpdates 1.8720 us/op 2.0770 us/op 0.90
mainnet_e81889 - altair processSyncCommitteeUpdates 734.00 ns/op 600.00 ns/op 1.22
mainnet_e81889 - altair afterProcessEpoch 41.400 ms/op 52.040 ms/op 0.80
capella processEpoch - mainnet_e217614 962.96 ms/op 1.0923 s/op 0.88
mainnet_e217614 - capella beforeProcessEpoch 65.919 ms/op 65.986 ms/op 1.00
mainnet_e217614 - capella processJustificationAndFinalization 13.930 us/op 13.286 us/op 1.05
mainnet_e217614 - capella processInactivityUpdates 11.724 ms/op 16.282 ms/op 0.72
mainnet_e217614 - capella processRewardsAndPenalties 217.13 ms/op 232.92 ms/op 0.93
mainnet_e217614 - capella processRegistryUpdates 10.495 us/op 13.810 us/op 0.76
mainnet_e217614 - capella processSlashings 892.00 ns/op 571.00 ns/op 1.56
mainnet_e217614 - capella processEth1DataReset 845.00 ns/op 506.00 ns/op 1.67
mainnet_e217614 - capella processEffectiveBalanceUpdates 3.5270 ms/op 13.895 ms/op 0.25
mainnet_e217614 - capella processSlashingsReset 3.3200 us/op 7.4330 us/op 0.45
mainnet_e217614 - capella processRandaoMixesReset 3.3890 us/op 4.3600 us/op 0.78
mainnet_e217614 - capella processHistoricalRootsUpdate 1.3240 us/op 678.00 ns/op 1.95
mainnet_e217614 - capella processParticipationFlagUpdates 1.5800 us/op 2.3780 us/op 0.66
mainnet_e217614 - capella afterProcessEpoch 104.34 ms/op 126.05 ms/op 0.83
phase0 processEpoch - mainnet_e58758 348.01 ms/op 352.91 ms/op 0.99
mainnet_e58758 - phase0 beforeProcessEpoch 61.468 ms/op 71.945 ms/op 0.85
mainnet_e58758 - phase0 processJustificationAndFinalization 14.654 us/op 14.130 us/op 1.04
mainnet_e58758 - phase0 processRewardsAndPenalties 29.405 ms/op 32.041 ms/op 0.92
mainnet_e58758 - phase0 processRegistryUpdates 6.5750 us/op 7.2810 us/op 0.90
mainnet_e58758 - phase0 processSlashings 672.00 ns/op 525.00 ns/op 1.28
mainnet_e58758 - phase0 processEth1DataReset 759.00 ns/op 403.00 ns/op 1.88
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.3446 ms/op 1.4365 ms/op 0.94
mainnet_e58758 - phase0 processSlashingsReset 2.1500 us/op 2.8210 us/op 0.76
mainnet_e58758 - phase0 processRandaoMixesReset 3.4270 us/op 4.5750 us/op 0.75
mainnet_e58758 - phase0 processHistoricalRootsUpdate 770.00 ns/op 483.00 ns/op 1.59
mainnet_e58758 - phase0 processParticipationRecordUpdates 3.0960 us/op 3.9000 us/op 0.79
mainnet_e58758 - phase0 afterProcessEpoch 33.900 ms/op 43.229 ms/op 0.78
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.6189 ms/op 1.6174 ms/op 1.00
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.4745 ms/op 2.5254 ms/op 0.58
altair processInactivityUpdates - 250000 normalcase 16.554 ms/op 18.340 ms/op 0.90
altair processInactivityUpdates - 250000 worstcase 17.380 ms/op 20.488 ms/op 0.85
phase0 processRegistryUpdates - 250000 normalcase 4.5870 us/op 6.6120 us/op 0.69
phase0 processRegistryUpdates - 250000 badcase_full_deposits 278.99 us/op 306.96 us/op 0.91
phase0 processRegistryUpdates - 250000 worstcase 0.5 108.11 ms/op 110.50 ms/op 0.98
altair processRewardsAndPenalties - 250000 normalcase 45.436 ms/op 46.636 ms/op 0.97
altair processRewardsAndPenalties - 250000 worstcase 46.698 ms/op 39.453 ms/op 1.18
phase0 getAttestationDeltas - 250000 normalcase 5.2437 ms/op 6.8434 ms/op 0.77
phase0 getAttestationDeltas - 250000 worstcase 5.2897 ms/op 6.9884 ms/op 0.76
phase0 processSlashings - 250000 worstcase 83.639 us/op 104.07 us/op 0.80
altair processSyncCommitteeUpdates - 250000 94.243 ms/op 124.74 ms/op 0.76
BeaconState.hashTreeRoot - No change 460.00 ns/op 259.00 ns/op 1.78
BeaconState.hashTreeRoot - 1 full validator 82.911 us/op 106.84 us/op 0.78
BeaconState.hashTreeRoot - 32 full validator 987.84 us/op 1.0432 ms/op 0.95
BeaconState.hashTreeRoot - 512 full validator 8.4486 ms/op 8.7104 ms/op 0.97
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 101.54 us/op 102.14 us/op 0.99
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.1991 ms/op 1.5037 ms/op 0.80
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 17.217 ms/op 17.228 ms/op 1.00
BeaconState.hashTreeRoot - 1 balances 88.524 us/op 78.487 us/op 1.13
BeaconState.hashTreeRoot - 32 balances 1.0558 ms/op 754.23 us/op 1.40
BeaconState.hashTreeRoot - 512 balances 7.7704 ms/op 7.0099 ms/op 1.11
BeaconState.hashTreeRoot - 250000 balances 157.35 ms/op 177.77 ms/op 0.89
aggregationBits - 2048 els - zipIndexesInBitList 18.867 us/op 24.774 us/op 0.76
byteArrayEquals 32 46.559 ns/op 53.177 ns/op 0.88
Buffer.compare 32 15.384 ns/op 16.987 ns/op 0.91
byteArrayEquals 1024 1.2604 us/op 1.5764 us/op 0.80
Buffer.compare 1024 24.097 ns/op 25.383 ns/op 0.95
byteArrayEquals 16384 19.944 us/op 25.074 us/op 0.80
Buffer.compare 16384 201.72 ns/op 196.52 ns/op 1.03
byteArrayEquals 123687377 151.00 ms/op 189.55 ms/op 0.80
Buffer.compare 123687377 4.2826 ms/op 6.4664 ms/op 0.66
byteArrayEquals 32 - diff last byte 46.207 ns/op 52.314 ns/op 0.88
Buffer.compare 32 - diff last byte 16.024 ns/op 17.132 ns/op 0.94
byteArrayEquals 1024 - diff last byte 1.2654 us/op 1.5811 us/op 0.80
Buffer.compare 1024 - diff last byte 24.511 ns/op 25.718 ns/op 0.95
byteArrayEquals 16384 - diff last byte 19.920 us/op 25.232 us/op 0.79
Buffer.compare 16384 - diff last byte 172.11 ns/op 199.29 ns/op 0.86
byteArrayEquals 123687377 - diff last byte 150.97 ms/op 186.73 ms/op 0.81
Buffer.compare 123687377 - diff last byte 5.5804 ms/op 6.5785 ms/op 0.85
byteArrayEquals 32 - random bytes 4.9640 ns/op 5.1080 ns/op 0.97
Buffer.compare 32 - random bytes 15.897 ns/op 18.559 ns/op 0.86
byteArrayEquals 1024 - random bytes 4.9130 ns/op 5.1010 ns/op 0.96
Buffer.compare 1024 - random bytes 15.748 ns/op 16.933 ns/op 0.93
byteArrayEquals 16384 - random bytes 4.9120 ns/op 5.0850 ns/op 0.97
Buffer.compare 16384 - random bytes 15.738 ns/op 17.016 ns/op 0.92
byteArrayEquals 123687377 - random bytes 7.8200 ns/op 6.3500 ns/op 1.23
Buffer.compare 123687377 - random bytes 19.000 ns/op 18.230 ns/op 1.04
regular array get 100000 times 31.257 us/op 42.783 us/op 0.73
wrappedArray get 100000 times 31.176 us/op 32.895 us/op 0.95
arrayWithProxy get 100000 times 9.3267 ms/op 12.509 ms/op 0.75
ssz.Root.equals 42.804 ns/op 46.023 ns/op 0.93
byteArrayEquals 43.195 ns/op 44.848 ns/op 0.96
Buffer.compare 9.1060 ns/op 10.233 ns/op 0.89
processSlot - 1 slots 11.179 us/op 12.918 us/op 0.87
processSlot - 32 slots 1.9467 ms/op 3.2231 ms/op 0.60
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 38.950 ms/op 41.192 ms/op 0.95
getCommitteeAssignments - req 1 vs - 250000 vc 1.8252 ms/op 2.0965 ms/op 0.87
getCommitteeAssignments - req 100 vs - 250000 vc 3.5912 ms/op 4.0336 ms/op 0.89
getCommitteeAssignments - req 1000 vs - 250000 vc 3.8079 ms/op 4.2962 ms/op 0.89
findModifiedValidators - 10000 modified validators 224.51 ms/op 228.99 ms/op 0.98
findModifiedValidators - 1000 modified validators 147.95 ms/op 151.24 ms/op 0.98
findModifiedValidators - 100 modified validators 133.40 ms/op 146.23 ms/op 0.91
findModifiedValidators - 10 modified validators 133.04 ms/op 152.21 ms/op 0.87
findModifiedValidators - 1 modified validators 116.50 ms/op 138.97 ms/op 0.84
findModifiedValidators - no difference 139.76 ms/op 162.60 ms/op 0.86
compare ViewDUs 3.2986 s/op 3.1698 s/op 1.04
compare each validator Uint8Array 1.1949 s/op 1.6132 s/op 0.74
compare ViewDU to Uint8Array 786.65 ms/op 872.48 ms/op 0.90
migrate state 1000000 validators, 24 modified, 0 new 688.75 ms/op 781.07 ms/op 0.88
migrate state 1000000 validators, 1700 modified, 1000 new 961.44 ms/op 1.0372 s/op 0.93
migrate state 1000000 validators, 3400 modified, 2000 new 1.0833 s/op 1.1353 s/op 0.95
migrate state 1500000 validators, 24 modified, 0 new 718.77 ms/op 742.43 ms/op 0.97
migrate state 1500000 validators, 1700 modified, 1000 new 923.11 ms/op 993.61 ms/op 0.93
migrate state 1500000 validators, 3400 modified, 2000 new 1.1102 s/op 1.2144 s/op 0.91
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 6.6400 ns/op 4.9700 ns/op 1.34
state getBlockRootAtSlot - 250000 vs - 7PWei 967.06 ns/op 730.11 ns/op 1.32
computeProposers - vc 250000 6.0535 ms/op 7.2814 ms/op 0.83
computeEpochShuffling - vc 250000 35.794 ms/op 42.763 ms/op 0.84
getNextSyncCommittee - vc 250000 107.91 ms/op 121.78 ms/op 0.89
computeSigningRoot for AttestationData 21.048 us/op 24.257 us/op 0.87
hash AttestationData serialized data then Buffer.toString(base64) 1.1990 us/op 1.7515 us/op 0.68
toHexString serialized data 753.20 ns/op 1.2709 us/op 0.59
Buffer.toString(base64) 132.89 ns/op 229.48 ns/op 0.58
nodejs block root to RootHex using toHex 115.54 ns/op 187.06 ns/op 0.62
nodejs block root to RootHex using toRootHex 75.800 ns/op 116.51 ns/op 0.65
browser block root to RootHex using the deprecated toHexString 203.25 ns/op 293.07 ns/op 0.69
browser block root to RootHex using toHex 162.20 ns/op 245.48 ns/op 0.66
browser block root to RootHex using toRootHex 153.69 ns/op 189.94 ns/op 0.81

by benchmarkbot/action

@nflaig
Copy link
Member Author

nflaig commented Jan 27, 2025

Reworked the branch a bit, also handles updating limit if we register protocol for new hard fork. I confirmed that correct electra rate limits are applied on devnet-5, however it's hard to check if fork transition works correctly there since we are already on electra fork and limits are applied based on clock slot but added a unit test to confirm rate limiter is updated as expected.

@nflaig
Copy link
Member Author

nflaig commented Jan 27, 2025

I am still seeing occasional rate limits on peers, seems to be always Teku

Jan-27 19:30:43.269[sync]          verbose: Batch download error id=Finalized, startEpoch=65, status=Downloading, code=REQUEST_ERROR_INVALID_REQUEST, errorMessage=sNaPpY a0dPeer has been rate limited
Error: REQUEST_ERROR_INVALID_REQUEST: sNaPpY a0dPeer has been rate limite

Edit: these are expected somewhat since I had low peer count and was syncing from far back, rate limiting does not seem to be an issue using this branch as it is less likely to happen

@nflaig nflaig force-pushed the nflaig/electra-rate-limit branch from 191adbc to ed9aa8b Compare January 28, 2025 10:19
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.

3 participants