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

chore: remove now useless bls init #6513

Merged
merged 2 commits into from Mar 13, 2024

Conversation

jeluard
Copy link
Member

@jeluard jeluard commented Mar 6, 2024

Motivation

Remove bls init code previously required for karma.

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

Merging #6513 (bd3e29e) into unstable (10c1b11) will decrease coverage by 0.18%.
Report is 3 commits behind head on unstable.
The diff coverage is n/a.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #6513      +/-   ##
============================================
- Coverage     61.72%   61.55%   -0.18%     
============================================
  Files           555      556       +1     
  Lines         58302    58586     +284     
  Branches       1846     1847       +1     
============================================
+ Hits          35985    36060      +75     
- Misses        22277    22486     +209     
  Partials         40       40              

@jeluard jeluard marked this pull request as ready for review March 6, 2024 10:44
@jeluard jeluard requested a review from a team as a code owner March 6, 2024 10:44
Copy link
Contributor

github-actions bot commented Mar 6, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: da38fa3 Previous: 8ad2cb0 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.0457 ms/op 1.2561 ms/op 0.83
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 88.229 us/op 150.26 us/op 0.59
BLS verify - blst-native 1.1084 ms/op 1.3881 ms/op 0.80
BLS verifyMultipleSignatures 3 - blst-native 2.4506 ms/op 3.0346 ms/op 0.81
BLS verifyMultipleSignatures 8 - blst-native 5.4525 ms/op 6.6251 ms/op 0.82
BLS verifyMultipleSignatures 32 - blst-native 19.779 ms/op 23.541 ms/op 0.84
BLS verifyMultipleSignatures 64 - blst-native 39.177 ms/op 45.409 ms/op 0.86
BLS verifyMultipleSignatures 128 - blst-native 82.189 ms/op 95.649 ms/op 0.86
BLS deserializing 10000 signatures 829.47 ms/op 940.75 ms/op 0.88
BLS deserializing 100000 signatures 8.5757 s/op 9.1622 s/op 0.94
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.1522 ms/op 1.4252 ms/op 0.81
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.4618 ms/op 1.5697 ms/op 0.93
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.0637 ms/op 2.4063 ms/op 0.86
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.6819 ms/op 3.5166 ms/op 1.05
BLS verifyMultipleSignatures - same message - 128 - blst-native 5.1345 ms/op 5.9984 ms/op 0.86
BLS aggregatePubkeys 32 - blst-native 22.969 us/op 27.244 us/op 0.84
BLS aggregatePubkeys 128 - blst-native 93.318 us/op 107.59 us/op 0.87
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 50.941 ms/op 68.758 ms/op 0.74
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 60.923 ms/op 62.602 ms/op 0.97
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 29.485 ms/op 53.084 ms/op 0.56
getSlashingsAndExits - default max 221.53 us/op 175.88 us/op 1.26
getSlashingsAndExits - 2k 441.62 us/op 751.53 us/op 0.59
proposeBlockBody type=full, size=empty 3.9409 ms/op 7.8166 ms/op 0.50
isKnown best case - 1 super set check 346.00 ns/op 777.00 ns/op 0.45
isKnown normal case - 2 super set checks 366.00 ns/op 744.00 ns/op 0.49
isKnown worse case - 16 super set checks 361.00 ns/op 799.00 ns/op 0.45
CheckpointStateCache - add get delete 6.3630 us/op 9.2510 us/op 0.69
validate api signedAggregateAndProof - struct 2.4100 ms/op 3.5870 ms/op 0.67
validate gossip signedAggregateAndProof - struct 2.4430 ms/op 2.9441 ms/op 0.83
validate gossip attestation - vc 640000 1.1701 ms/op 1.4366 ms/op 0.81
batch validate gossip attestation - vc 640000 - chunk 32 144.18 us/op 186.08 us/op 0.77
batch validate gossip attestation - vc 640000 - chunk 64 128.76 us/op 165.24 us/op 0.78
batch validate gossip attestation - vc 640000 - chunk 128 124.09 us/op 157.22 us/op 0.79
batch validate gossip attestation - vc 640000 - chunk 256 121.31 us/op 132.75 us/op 0.91
pickEth1Vote - no votes 945.84 us/op 1.2594 ms/op 0.75
pickEth1Vote - max votes 6.6584 ms/op 8.4609 ms/op 0.79
pickEth1Vote - Eth1Data hashTreeRoot value x2048 14.163 ms/op 16.314 ms/op 0.87
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 28.031 ms/op 21.815 ms/op 1.28
pickEth1Vote - Eth1Data fastSerialize value x2048 497.43 us/op 601.64 us/op 0.83
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.5045 ms/op 4.5315 ms/op 0.77
bytes32 toHexString 456.00 ns/op 566.00 ns/op 0.81
bytes32 Buffer.toString(hex) 343.00 ns/op 310.00 ns/op 1.11
bytes32 Buffer.toString(hex) from Uint8Array 575.00 ns/op 444.00 ns/op 1.30
bytes32 Buffer.toString(hex) + 0x 386.00 ns/op 296.00 ns/op 1.30
Object access 1 prop 0.25400 ns/op 0.17000 ns/op 1.49
Map access 1 prop 0.21400 ns/op 0.14500 ns/op 1.48
Object get x1000 5.2290 ns/op 7.4910 ns/op 0.70
Map get x1000 0.82800 ns/op 0.82100 ns/op 1.01
Object set x1000 33.215 ns/op 56.978 ns/op 0.58
Map set x1000 19.150 ns/op 41.590 ns/op 0.46
Return object 10000 times 0.23250 ns/op 0.24740 ns/op 0.94
Throw Error 10000 times 2.6717 us/op 3.8433 us/op 0.70
fastMsgIdFn sha256 / 200 bytes 2.1220 us/op 3.2880 us/op 0.65
fastMsgIdFn h32 xxhash / 200 bytes 369.00 ns/op 297.00 ns/op 1.24
fastMsgIdFn h64 xxhash / 200 bytes 397.00 ns/op 349.00 ns/op 1.14
fastMsgIdFn sha256 / 1000 bytes 6.3460 us/op 11.487 us/op 0.55
fastMsgIdFn h32 xxhash / 1000 bytes 489.00 ns/op 415.00 ns/op 1.18
fastMsgIdFn h64 xxhash / 1000 bytes 462.00 ns/op 424.00 ns/op 1.09
fastMsgIdFn sha256 / 10000 bytes 53.625 us/op 103.89 us/op 0.52
fastMsgIdFn h32 xxhash / 10000 bytes 1.8950 us/op 1.9340 us/op 0.98
fastMsgIdFn h64 xxhash / 10000 bytes 1.2980 us/op 1.3690 us/op 0.95
send data - 1000 256B messages 15.228 ms/op 16.607 ms/op 0.92
send data - 1000 512B messages 18.599 ms/op 27.338 ms/op 0.68
send data - 1000 1024B messages 33.202 ms/op 44.630 ms/op 0.74
send data - 1000 1200B messages 38.244 ms/op 39.117 ms/op 0.98
send data - 1000 2048B messages 38.027 ms/op 50.302 ms/op 0.76
send data - 1000 4096B messages 37.474 ms/op 34.471 ms/op 1.09
send data - 1000 16384B messages 107.15 ms/op 116.04 ms/op 0.92
send data - 1000 65536B messages 435.29 ms/op 508.30 ms/op 0.86
enrSubnets - fastDeserialize 64 bits 1.0480 us/op 1.6670 us/op 0.63
enrSubnets - ssz BitVector 64 bits 490.00 ns/op 557.00 ns/op 0.88
enrSubnets - fastDeserialize 4 bits 217.00 ns/op 239.00 ns/op 0.91
enrSubnets - ssz BitVector 4 bits 450.00 ns/op 554.00 ns/op 0.81
prioritizePeers score -10:0 att 32-0.1 sync 2-0 73.432 us/op 119.43 us/op 0.61
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 93.451 us/op 143.11 us/op 0.65
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 116.83 us/op 206.94 us/op 0.56
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 187.87 us/op 340.58 us/op 0.55
prioritizePeers score 0:0 att 64-1 sync 4-1 206.66 us/op 381.71 us/op 0.54
array of 16000 items push then shift 1.3973 us/op 1.7168 us/op 0.81
LinkedList of 16000 items push then shift 6.8160 ns/op 9.8880 ns/op 0.69
array of 16000 items push then pop 100.88 ns/op 114.03 ns/op 0.88
LinkedList of 16000 items push then pop 5.9100 ns/op 8.9450 ns/op 0.66
array of 24000 items push then shift 1.9647 us/op 2.5704 us/op 0.76
LinkedList of 24000 items push then shift 6.2920 ns/op 9.0880 ns/op 0.69
array of 24000 items push then pop 119.36 ns/op 167.01 ns/op 0.71
LinkedList of 24000 items push then pop 5.7910 ns/op 8.8170 ns/op 0.66
intersect bitArray bitLen 8 4.9190 ns/op 5.9540 ns/op 0.83
intersect array and set length 8 52.033 ns/op 74.236 ns/op 0.70
intersect bitArray bitLen 128 29.824 ns/op 35.951 ns/op 0.83
intersect array and set length 128 794.96 ns/op 1.0922 us/op 0.73
bitArray.getTrueBitIndexes() bitLen 128 1.7230 us/op 1.9260 us/op 0.89
bitArray.getTrueBitIndexes() bitLen 248 2.8270 us/op 3.0790 us/op 0.92
bitArray.getTrueBitIndexes() bitLen 512 5.9830 us/op 6.5150 us/op 0.92
Buffer.concat 32 items 986.00 ns/op 1.0750 us/op 0.92
Uint8Array.set 32 items 2.1590 us/op 2.0430 us/op 1.06
Set add up to 64 items then delete first 1.8121 us/op 4.9938 us/op 0.36
OrderedSet add up to 64 items then delete first 2.7763 us/op 6.9411 us/op 0.40
Set add up to 64 items then delete last 2.2023 us/op 5.5027 us/op 0.40
OrderedSet add up to 64 items then delete last 3.1138 us/op 7.2344 us/op 0.43
Set add up to 64 items then delete middle 2.0394 us/op 5.2546 us/op 0.39
OrderedSet add up to 64 items then delete middle 4.5985 us/op 8.3500 us/op 0.55
Set add up to 128 items then delete first 4.2503 us/op 11.009 us/op 0.39
OrderedSet add up to 128 items then delete first 6.5492 us/op 15.522 us/op 0.42
Set add up to 128 items then delete last 4.2919 us/op 10.783 us/op 0.40
OrderedSet add up to 128 items then delete last 5.9446 us/op 14.312 us/op 0.42
Set add up to 128 items then delete middle 3.9442 us/op 10.788 us/op 0.37
OrderedSet add up to 128 items then delete middle 11.764 us/op 19.768 us/op 0.60
Set add up to 256 items then delete first 8.0261 us/op 22.312 us/op 0.36
OrderedSet add up to 256 items then delete first 12.464 us/op 30.538 us/op 0.41
Set add up to 256 items then delete last 7.6751 us/op 21.526 us/op 0.36
OrderedSet add up to 256 items then delete last 11.521 us/op 28.300 us/op 0.41
Set add up to 256 items then delete middle 7.4437 us/op 21.543 us/op 0.35
OrderedSet add up to 256 items then delete middle 31.185 us/op 52.324 us/op 0.60
transfer serialized Status (84 B) 1.4760 us/op 2.0180 us/op 0.73
copy serialized Status (84 B) 1.2300 us/op 1.4720 us/op 0.84
transfer serialized SignedVoluntaryExit (112 B) 1.6360 us/op 2.1210 us/op 0.77
copy serialized SignedVoluntaryExit (112 B) 1.3910 us/op 1.5130 us/op 0.92
transfer serialized ProposerSlashing (416 B) 2.6310 us/op 3.1510 us/op 0.83
copy serialized ProposerSlashing (416 B) 2.7660 us/op 2.4770 us/op 1.12
transfer serialized Attestation (485 B) 2.8970 us/op 2.9120 us/op 0.99
copy serialized Attestation (485 B) 1.6670 us/op 2.2530 us/op 0.74
transfer serialized AttesterSlashing (33232 B) 1.8030 us/op 2.9930 us/op 0.60
copy serialized AttesterSlashing (33232 B) 3.5260 us/op 10.249 us/op 0.34
transfer serialized Small SignedBeaconBlock (128000 B) 1.7600 us/op 4.2870 us/op 0.41
copy serialized Small SignedBeaconBlock (128000 B) 8.7990 us/op 30.733 us/op 0.29
transfer serialized Avg SignedBeaconBlock (200000 B) 1.8290 us/op 4.8420 us/op 0.38
copy serialized Avg SignedBeaconBlock (200000 B) 12.665 us/op 38.986 us/op 0.32
transfer serialized BlobsSidecar (524380 B) 2.3730 us/op 6.2220 us/op 0.38
copy serialized BlobsSidecar (524380 B) 76.748 us/op 169.54 us/op 0.45
transfer serialized Big SignedBeaconBlock (1000000 B) 2.4230 us/op 5.9560 us/op 0.41
copy serialized Big SignedBeaconBlock (1000000 B) 149.52 us/op 344.33 us/op 0.43
pass gossip attestations to forkchoice per slot 2.9743 ms/op 6.0412 ms/op 0.49
forkChoice updateHead vc 100000 bc 64 eq 0 493.66 us/op 715.89 us/op 0.69
forkChoice updateHead vc 600000 bc 64 eq 0 3.3318 ms/op 5.5089 ms/op 0.60
forkChoice updateHead vc 1000000 bc 64 eq 0 5.2988 ms/op 8.7823 ms/op 0.60
forkChoice updateHead vc 600000 bc 320 eq 0 3.1662 ms/op 4.4398 ms/op 0.71
forkChoice updateHead vc 600000 bc 1200 eq 0 2.8719 ms/op 4.6683 ms/op 0.62
forkChoice updateHead vc 600000 bc 7200 eq 0 3.7599 ms/op 5.6812 ms/op 0.66
forkChoice updateHead vc 600000 bc 64 eq 1000 10.933 ms/op 11.437 ms/op 0.96
forkChoice updateHead vc 600000 bc 64 eq 10000 10.352 ms/op 12.615 ms/op 0.82
forkChoice updateHead vc 600000 bc 64 eq 300000 13.116 ms/op 21.315 ms/op 0.62
computeDeltas 500000 validators 300 proto nodes 3.7845 ms/op 7.0809 ms/op 0.53
computeDeltas 500000 validators 1200 proto nodes 3.5134 ms/op 6.9186 ms/op 0.51
computeDeltas 500000 validators 7200 proto nodes 3.6553 ms/op 7.0137 ms/op 0.52
computeDeltas 750000 validators 300 proto nodes 4.9843 ms/op 10.952 ms/op 0.46
computeDeltas 750000 validators 1200 proto nodes 5.3540 ms/op 10.297 ms/op 0.52
computeDeltas 750000 validators 7200 proto nodes 5.3501 ms/op 10.032 ms/op 0.53
computeDeltas 1400000 validators 300 proto nodes 9.4251 ms/op 21.220 ms/op 0.44
computeDeltas 1400000 validators 1200 proto nodes 10.036 ms/op 22.709 ms/op 0.44
computeDeltas 1400000 validators 7200 proto nodes 9.4851 ms/op 21.420 ms/op 0.44
computeDeltas 2100000 validators 300 proto nodes 14.351 ms/op 32.692 ms/op 0.44
computeDeltas 2100000 validators 1200 proto nodes 14.574 ms/op 31.774 ms/op 0.46
computeDeltas 2100000 validators 7200 proto nodes 14.256 ms/op 33.561 ms/op 0.42
altair processAttestation - 250000 vs - 7PWei normalcase 2.5046 ms/op 4.2631 ms/op 0.59
altair processAttestation - 250000 vs - 7PWei worstcase 2.3629 ms/op 5.8521 ms/op 0.40
altair processAttestation - setStatus - 1/6 committees join 81.632 us/op 229.34 us/op 0.36
altair processAttestation - setStatus - 1/3 committees join 169.36 us/op 490.32 us/op 0.35
altair processAttestation - setStatus - 1/2 committees join 224.04 us/op 586.20 us/op 0.38
altair processAttestation - setStatus - 2/3 committees join 288.34 us/op 703.95 us/op 0.41
altair processAttestation - setStatus - 4/5 committees join 441.29 us/op 1.0132 ms/op 0.44
altair processAttestation - setStatus - 100% committees join 581.11 us/op 1.1059 ms/op 0.53
altair processBlock - 250000 vs - 7PWei normalcase 8.9379 ms/op 15.173 ms/op 0.59
altair processBlock - 250000 vs - 7PWei normalcase hashState 33.369 ms/op 40.144 ms/op 0.83
altair processBlock - 250000 vs - 7PWei worstcase 33.458 ms/op 46.008 ms/op 0.73
altair processBlock - 250000 vs - 7PWei worstcase hashState 101.83 ms/op 131.84 ms/op 0.77
phase0 processBlock - 250000 vs - 7PWei normalcase 2.9460 ms/op 3.4748 ms/op 0.85
phase0 processBlock - 250000 vs - 7PWei worstcase 36.102 ms/op 37.404 ms/op 0.97
altair processEth1Data - 250000 vs - 7PWei normalcase 811.83 us/op 765.10 us/op 1.06
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 18.303 us/op 26.633 us/op 0.69
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 42.569 us/op 95.494 us/op 0.45
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 19.714 us/op 31.751 us/op 0.62
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 20.059 us/op 17.766 us/op 1.13
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 158.64 us/op 212.30 us/op 0.75
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.1281 ms/op 1.4092 ms/op 0.80
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.4459 ms/op 1.9643 ms/op 0.74
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.5606 ms/op 1.7949 ms/op 0.87
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.6296 ms/op 3.6723 ms/op 0.99
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.8037 ms/op 2.6251 ms/op 0.69
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.0111 ms/op 5.6445 ms/op 0.71
Tree 40 250000 create 358.63 ms/op 394.75 ms/op 0.91
Tree 40 250000 get(125000) 142.19 ns/op 201.80 ns/op 0.70
Tree 40 250000 set(125000) 790.71 ns/op 997.04 ns/op 0.79
Tree 40 250000 toArray() 22.632 ms/op 21.546 ms/op 1.05
Tree 40 250000 iterate all - toArray() + loop 23.408 ms/op 20.149 ms/op 1.16
Tree 40 250000 iterate all - get(i) 60.797 ms/op 65.380 ms/op 0.93
MutableVector 250000 create 10.256 ms/op 14.403 ms/op 0.71
MutableVector 250000 get(125000) 6.3920 ns/op 6.5080 ns/op 0.98
MutableVector 250000 set(125000) 334.47 ns/op 295.83 ns/op 1.13
MutableVector 250000 toArray() 2.6062 ms/op 3.7699 ms/op 0.69
MutableVector 250000 iterate all - toArray() + loop 2.8297 ms/op 3.8328 ms/op 0.74
MutableVector 250000 iterate all - get(i) 1.3717 ms/op 1.5311 ms/op 0.90
Array 250000 create 2.5718 ms/op 3.4024 ms/op 0.76
Array 250000 clone - spread 1.2809 ms/op 1.4357 ms/op 0.89
Array 250000 get(125000) 1.0830 ns/op 1.1790 ns/op 0.92
Array 250000 set(125000) 1.3040 ns/op 4.8960 ns/op 0.27
Array 250000 iterate all - loop 164.08 us/op 167.57 us/op 0.98
effectiveBalanceIncrements clone Uint8Array 300000 47.789 us/op 46.675 us/op 1.02
effectiveBalanceIncrements clone MutableVector 300000 525.00 ns/op 440.00 ns/op 1.19
effectiveBalanceIncrements rw all Uint8Array 300000 188.43 us/op 204.55 us/op 0.92
effectiveBalanceIncrements rw all MutableVector 300000 71.543 ms/op 103.22 ms/op 0.69
phase0 afterProcessEpoch - 250000 vs - 7PWei 89.092 ms/op 124.36 ms/op 0.72
phase0 beforeProcessEpoch - 250000 vs - 7PWei 59.634 ms/op 39.154 ms/op 1.52
altair processEpoch - mainnet_e81889 448.97 ms/op 490.77 ms/op 0.91
mainnet_e81889 - altair beforeProcessEpoch 88.208 ms/op 87.913 ms/op 1.00
mainnet_e81889 - altair processJustificationAndFinalization 15.093 us/op 17.726 us/op 0.85
mainnet_e81889 - altair processInactivityUpdates 5.7347 ms/op 5.7287 ms/op 1.00
mainnet_e81889 - altair processRewardsAndPenalties 66.631 ms/op 70.567 ms/op 0.94
mainnet_e81889 - altair processRegistryUpdates 3.1250 us/op 2.9740 us/op 1.05
mainnet_e81889 - altair processSlashings 834.00 ns/op 510.00 ns/op 1.64
mainnet_e81889 - altair processEth1DataReset 937.00 ns/op 713.00 ns/op 1.31
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.4003 ms/op 1.4476 ms/op 0.97
mainnet_e81889 - altair processSlashingsReset 7.3920 us/op 4.5780 us/op 1.61
mainnet_e81889 - altair processRandaoMixesReset 10.164 us/op 5.7050 us/op 1.78
mainnet_e81889 - altair processHistoricalRootsUpdate 1.4280 us/op 645.00 ns/op 2.21
mainnet_e81889 - altair processParticipationFlagUpdates 3.8910 us/op 1.8850 us/op 2.06
mainnet_e81889 - altair processSyncCommitteeUpdates 1.5590 us/op 764.00 ns/op 2.04
mainnet_e81889 - altair afterProcessEpoch 92.640 ms/op 123.86 ms/op 0.75
capella processEpoch - mainnet_e217614 2.4633 s/op 2.4542 s/op 1.00
mainnet_e217614 - capella beforeProcessEpoch 500.25 ms/op 539.41 ms/op 0.93
mainnet_e217614 - capella processJustificationAndFinalization 15.728 us/op 25.768 us/op 0.61
mainnet_e217614 - capella processInactivityUpdates 17.739 ms/op 21.672 ms/op 0.82
mainnet_e217614 - capella processRewardsAndPenalties 450.29 ms/op 429.49 ms/op 1.05
mainnet_e217614 - capella processRegistryUpdates 22.321 us/op 29.541 us/op 0.76
mainnet_e217614 - capella processSlashings 885.00 ns/op 821.00 ns/op 1.08
mainnet_e217614 - capella processEth1DataReset 805.00 ns/op 736.00 ns/op 1.09
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.3298 ms/op 6.5698 ms/op 0.66
mainnet_e217614 - capella processSlashingsReset 3.7710 us/op 6.1350 us/op 0.61
mainnet_e217614 - capella processRandaoMixesReset 6.9880 us/op 8.7350 us/op 0.80
mainnet_e217614 - capella processHistoricalRootsUpdate 1.0440 us/op 1.2220 us/op 0.85
mainnet_e217614 - capella processParticipationFlagUpdates 2.0090 us/op 3.2190 us/op 0.62
mainnet_e217614 - capella afterProcessEpoch 221.15 ms/op 322.33 ms/op 0.69
phase0 processEpoch - mainnet_e58758 467.23 ms/op 649.97 ms/op 0.72
mainnet_e58758 - phase0 beforeProcessEpoch 147.28 ms/op 217.46 ms/op 0.68
mainnet_e58758 - phase0 processJustificationAndFinalization 16.031 us/op 36.095 us/op 0.44
mainnet_e58758 - phase0 processRewardsAndPenalties 60.874 ms/op 79.224 ms/op 0.77
mainnet_e58758 - phase0 processRegistryUpdates 14.273 us/op 22.448 us/op 0.64
mainnet_e58758 - phase0 processSlashings 793.00 ns/op 1.5630 us/op 0.51
mainnet_e58758 - phase0 processEth1DataReset 903.00 ns/op 1.3190 us/op 0.68
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.7031 ms/op 2.2271 ms/op 0.76
mainnet_e58758 - phase0 processSlashingsReset 5.5080 us/op 8.2830 us/op 0.66
mainnet_e58758 - phase0 processRandaoMixesReset 6.6240 us/op 10.942 us/op 0.61
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.3210 us/op 1.2190 us/op 1.08
mainnet_e58758 - phase0 processParticipationRecordUpdates 5.1720 us/op 10.363 us/op 0.50
mainnet_e58758 - phase0 afterProcessEpoch 78.978 ms/op 119.78 ms/op 0.66
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.0446 ms/op 2.6981 ms/op 0.39
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.2039 ms/op 3.0778 ms/op 0.39
altair processInactivityUpdates - 250000 normalcase 27.727 ms/op 44.924 ms/op 0.62
altair processInactivityUpdates - 250000 worstcase 24.245 ms/op 40.686 ms/op 0.60
phase0 processRegistryUpdates - 250000 normalcase 16.029 us/op 25.488 us/op 0.63
phase0 processRegistryUpdates - 250000 badcase_full_deposits 480.78 us/op 553.73 us/op 0.87
phase0 processRegistryUpdates - 250000 worstcase 0.5 155.33 ms/op 188.46 ms/op 0.82
altair processRewardsAndPenalties - 250000 normalcase 52.967 ms/op 64.070 ms/op 0.83
altair processRewardsAndPenalties - 250000 worstcase 53.172 ms/op 61.500 ms/op 0.86
phase0 getAttestationDeltas - 250000 normalcase 11.216 ms/op 12.868 ms/op 0.87
phase0 getAttestationDeltas - 250000 worstcase 10.455 ms/op 12.920 ms/op 0.81
phase0 processSlashings - 250000 worstcase 104.98 us/op 108.45 us/op 0.97
altair processSyncCommitteeUpdates - 250000 126.30 ms/op 164.19 ms/op 0.77
BeaconState.hashTreeRoot - No change 628.00 ns/op 687.00 ns/op 0.91
BeaconState.hashTreeRoot - 1 full validator 157.78 us/op 138.20 us/op 1.14
BeaconState.hashTreeRoot - 32 full validator 1.2259 ms/op 1.4746 ms/op 0.83
BeaconState.hashTreeRoot - 512 full validator 12.318 ms/op 17.632 ms/op 0.70
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 138.59 us/op 209.81 us/op 0.66
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.6500 ms/op 2.8129 ms/op 0.59
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 26.879 ms/op 30.242 ms/op 0.89
BeaconState.hashTreeRoot - 1 balances 141.42 us/op 136.39 us/op 1.04
BeaconState.hashTreeRoot - 32 balances 1.0223 ms/op 1.2654 ms/op 0.81
BeaconState.hashTreeRoot - 512 balances 12.669 ms/op 15.563 ms/op 0.81
BeaconState.hashTreeRoot - 250000 balances 210.08 ms/op 243.31 ms/op 0.86
aggregationBits - 2048 els - zipIndexesInBitList 14.493 us/op 29.420 us/op 0.49
byteArrayEquals 32 67.133 ns/op 80.909 ns/op 0.83
Buffer.compare 32 39.255 ns/op 57.456 ns/op 0.68
byteArrayEquals 1024 1.8773 us/op 2.2399 us/op 0.84
Buffer.compare 1024 50.776 ns/op 72.905 ns/op 0.70
byteArrayEquals 16384 31.415 us/op 34.596 us/op 0.91
Buffer.compare 16384 241.68 ns/op 265.28 ns/op 0.91
byteArrayEquals 123687377 227.41 ms/op 255.15 ms/op 0.89
Buffer.compare 123687377 6.7864 ms/op 8.4592 ms/op 0.80
byteArrayEquals 32 - diff last byte 69.581 ns/op 75.766 ns/op 0.92
Buffer.compare 32 - diff last byte 41.803 ns/op 57.248 ns/op 0.73
byteArrayEquals 1024 - diff last byte 1.8543 us/op 2.1277 us/op 0.87
Buffer.compare 1024 - diff last byte 50.568 ns/op 74.335 ns/op 0.68
byteArrayEquals 16384 - diff last byte 32.376 us/op 33.031 us/op 0.98
Buffer.compare 16384 - diff last byte 229.01 ns/op 284.07 ns/op 0.81
byteArrayEquals 123687377 - diff last byte 218.56 ms/op 250.14 ms/op 0.87
Buffer.compare 123687377 - diff last byte 6.7239 ms/op 8.7137 ms/op 0.77
byteArrayEquals 32 - random bytes 5.7230 ns/op 6.3310 ns/op 0.90
Buffer.compare 32 - random bytes 38.895 ns/op 71.510 ns/op 0.54
byteArrayEquals 1024 - random bytes 5.6470 ns/op 6.2630 ns/op 0.90
Buffer.compare 1024 - random bytes 38.232 ns/op 66.367 ns/op 0.58
byteArrayEquals 16384 - random bytes 5.7080 ns/op 7.2220 ns/op 0.79
Buffer.compare 16384 - random bytes 38.000 ns/op 70.479 ns/op 0.54
byteArrayEquals 123687377 - random bytes 8.7400 ns/op 10.040 ns/op 0.87
Buffer.compare 123687377 - random bytes 42.540 ns/op 79.910 ns/op 0.53
regular array get 100000 times 44.081 us/op 48.724 us/op 0.90
wrappedArray get 100000 times 43.647 us/op 48.920 us/op 0.89
arrayWithProxy get 100000 times 10.814 ms/op 18.150 ms/op 0.60
ssz.Root.equals 57.786 ns/op 61.483 ns/op 0.94
byteArrayEquals 57.018 ns/op 58.809 ns/op 0.97
Buffer.compare 10.444 ns/op 12.371 ns/op 0.84
shuffle list - 16384 els 4.9298 ms/op 7.4902 ms/op 0.66
shuffle list - 250000 els 71.651 ms/op 114.72 ms/op 0.62
processSlot - 1 slots 15.200 us/op 21.667 us/op 0.70
processSlot - 32 slots 2.5041 ms/op 3.7702 ms/op 0.66
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 57.570 ms/op 65.818 ms/op 0.87
getCommitteeAssignments - req 1 vs - 250000 vc 2.3574 ms/op 2.7769 ms/op 0.85
getCommitteeAssignments - req 100 vs - 250000 vc 3.5852 ms/op 4.0424 ms/op 0.89
getCommitteeAssignments - req 1000 vs - 250000 vc 4.0768 ms/op 4.7065 ms/op 0.87
findModifiedValidators - 10000 modified validators 464.70 ms/op 685.22 ms/op 0.68
findModifiedValidators - 1000 modified validators 341.60 ms/op 491.34 ms/op 0.70
findModifiedValidators - 100 modified validators 361.10 ms/op 447.16 ms/op 0.81
findModifiedValidators - 10 modified validators 299.18 ms/op 470.66 ms/op 0.64
findModifiedValidators - 1 modified validators 313.11 ms/op 484.50 ms/op 0.65
findModifiedValidators - no difference 305.97 ms/op 508.03 ms/op 0.60
compare ViewDUs 4.0296 s/op 5.9696 s/op 0.68
compare each validator Uint8Array 1.3434 s/op 1.7851 s/op 0.75
compare ViewDU to Uint8Array 1.0362 s/op 1.4219 s/op 0.73
migrate state 1000000 validators, 24 modified, 0 new 713.01 ms/op 978.47 ms/op 0.73
migrate state 1000000 validators, 1700 modified, 1000 new 893.90 ms/op 1.1923 s/op 0.75
migrate state 1000000 validators, 3400 modified, 2000 new 1.1975 s/op 1.2829 s/op 0.93
migrate state 1500000 validators, 24 modified, 0 new 793.34 ms/op 720.96 ms/op 1.10
migrate state 1500000 validators, 1700 modified, 1000 new 914.81 ms/op 1.0827 s/op 0.84
migrate state 1500000 validators, 3400 modified, 2000 new 1.2545 s/op 1.3160 s/op 0.95
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.6000 ns/op 6.1500 ns/op 0.75
state getBlockRootAtSlot - 250000 vs - 7PWei 736.21 ns/op 965.02 ns/op 0.76
computeProposers - vc 250000 6.4008 ms/op 9.8828 ms/op 0.65
computeEpochShuffling - vc 250000 70.003 ms/op 105.44 ms/op 0.66
getNextSyncCommittee - vc 250000 102.68 ms/op 165.46 ms/op 0.62
computeSigningRoot for AttestationData 24.472 us/op 27.087 us/op 0.90
hash AttestationData serialized data then Buffer.toString(base64) 1.2514 us/op 2.3230 us/op 0.54
toHexString serialized data 808.46 ns/op 1.1221 us/op 0.72
Buffer.toString(base64) 153.24 ns/op 234.48 ns/op 0.65

by benchmarkbot/action

@@ -149,15 +150,16 @@ export class Lightclient {
static async initializeFromCheckpointRoot(
args: Omit<LightclientInitArgs, "bootstrap"> & {
checkpointRoot: phase0.Checkpoint["root"];
blsImplementation?: Implementation;
Copy link
Member

@nflaig nflaig Mar 6, 2024

Choose a reason for hiding this comment

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

Having an internal implementation as part of arguments seems bit strange to me, if this is really required can't we follow same approach used in ssz and discv5, i.e. using a setter function

another example

setHasher(hasher);

Copy link
Member Author

Choose a reason for hiding this comment

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

setHasher is setting some global then? I think we should move away from those, they introduce fragility and break expectations.

e.g. setImplementation could be called after the init is done, making it void.

There is a similar issue with the active preset, where you have to do things in the right order or it breaks. It also introduces coupling (or forces lack of coupling) between dependencies.

In general I fell like explicit is better over implicit (env variable, global variable), and letting user decide of implementation sounds like it.

Copy link
Member

@nflaig nflaig Mar 6, 2024

Choose a reason for hiding this comment

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

they introduce fragility and break expectations.

How does this change expectations though? From the code I would expect now I can do this

lc1.initializeFromCheckpointRoot({blsImplementation: "herumi"})

// this light client instance will use different bls implementation
lc2.initializeFromCheckpointRoot({blsImplementation: "blst-native"})

but does this actually work and it that the intended use case?

There is a similar issue with the active preset, where you have to do things in the right order or it breaks. It also introduces coupling (or forces lack of coupling) between dependencies.

This is a protection that ensures preset values can't be modified after those are loaded, much better to throw an error explicitly than to risk inconsistencies.

Copy link
Member Author

Choose a reason for hiding this comment

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

How does this change expectations though? From the code I would expect now I can do this

It looks marginally better to me but indeed there is still room to shoot yourself in the foot.

Your comment made me realize that having explicit init specifically here is probably wrong (and hopefully not required anymore as related to karma). Indeed, some code changes might force init to be already done before this code is reached.

A better solution might be:

  • to removeinit code from light-client
  • to address configurability directly in bls library

Copy link
Member

Choose a reason for hiding this comment

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

I see two patterns we can follow here

  • either use dependency injection
  • or load and set internally

If we wanna use dependency injection, the whole implementation should be passed imo and not just a name which then causing the library to be loaded internally.

I feel like the change in this PR was mixing both concepts.

they introduce fragility and break expectations.

I think the safest approach is to allow setter to be called exactly once to ensure same implementation is used globally. Dependency injection gives more flexibility but also has the risk that you have to pass the implementation in possibly multiple places and you might accidentally miss one and it implicitly uses a default / fallback implementation.

That's how setHasher works and I think it's good for this use case as you would usually wanna use same hashing implementation across the whole project.

maybe @wemeetagain can give some more insights on this

Copy link
Member Author

Choose a reason for hiding this comment

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

I shared some ideas here: ChainSafe/bls#157

Copy link
Member Author

Choose a reason for hiding this comment

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

With setHasher, user must ensure that the call is made at the right moment or there is a risk of having some default implementation being used (the one that kicks in when setHasher is not called).
Combined with other libs being intertwined, this looks a bit fragile to me (and hard to know for sure the call has been properly taken into consideration).

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed the implementation selection, this code was specific to karma anyway.

@jeluard jeluard changed the title feat: allow to select bls implementation chore: remove now useless bls init Mar 6, 2024
@jeluard jeluard requested a review from nflaig March 13, 2024 19:44
@jeluard jeluard merged commit 87f07fe into unstable Mar 13, 2024
21 of 22 checks passed
@jeluard jeluard deleted the jeluard/light-client-switchable-bls branch March 13, 2024 19:58
@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.

None yet

3 participants