Skip to content
New issue

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

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

Already on GitHub? # to your account

Remove ssz as dependency to lodestar-utils #3623

Merged
merged 3 commits into from
Jan 17, 2022
Merged

Conversation

dapplion
Copy link
Contributor

Motivation

SSZ needs to import lodestar-utils as dev dependency which causes circular dependency problems when SSZ changes significantly, for example with ChainSafe/ssz#223

SSZ is really not a required dependency to lodestar-utils which should have minimal dependencies

Description

Remove ssz as dependency to lodestar-utils

@codeclimate
Copy link

codeclimate bot commented Jan 14, 2022

Code Climate has analyzed commit 27599cb and detected 0 issues on this pull request.

View more on Code Climate.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2022

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: b6dd4a1 Previous: b19c291 Ratio
BeaconState.hashTreeRoot - No change 671.00 ns/op 543.00 ns/op 1.24
BeaconState.hashTreeRoot - 1 full validator 156.27 us/op 125.09 us/op 1.25
BeaconState.hashTreeRoot - 32 full validator 2.5673 ms/op 1.9522 ms/op 1.32
BeaconState.hashTreeRoot - 512 full validator 32.690 ms/op 24.453 ms/op 1.34
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 156.80 us/op 125.37 us/op 1.25
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.3971 ms/op 2.1145 ms/op 1.13
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 30.805 ms/op 28.853 ms/op 1.07
BeaconState.hashTreeRoot - 1 balances 111.21 us/op 94.754 us/op 1.17
BeaconState.hashTreeRoot - 32 balances 851.54 us/op 739.41 us/op 1.15
BeaconState.hashTreeRoot - 512 balances 8.5363 ms/op 7.8715 ms/op 1.08
BeaconState.hashTreeRoot - 250000 balances 160.53 ms/op 138.72 ms/op 1.16
processSlot - 1 slots 68.950 us/op 47.981 us/op 1.44
processSlot - 32 slots 3.9353 ms/op 3.1885 ms/op 1.23
getCommitteeAssignments - req 1 vs - 250000 vc 5.6310 ms/op 5.3674 ms/op 1.05
getCommitteeAssignments - req 100 vs - 250000 vc 7.6958 ms/op 7.5121 ms/op 1.02
getCommitteeAssignments - req 1000 vs - 250000 vc 8.5292 ms/op 8.0073 ms/op 1.07
computeProposers - vc 250000 24.694 ms/op 21.506 ms/op 1.15
computeEpochShuffling - vc 250000 192.43 ms/op 185.71 ms/op 1.04
getNextSyncCommittee - vc 250000 393.05 ms/op 348.90 ms/op 1.13
altair processAttestation - 250000 vs - 7PWei normalcase 53.356 ms/op 42.730 ms/op 1.25
altair processAttestation - 250000 vs - 7PWei worstcase 48.108 ms/op 46.179 ms/op 1.04
altair processAttestation - setStatus - 1/6 committees join 13.937 ms/op 12.949 ms/op 1.08
altair processAttestation - setStatus - 1/3 committees join 27.351 ms/op 27.659 ms/op 0.99
altair processAttestation - setStatus - 1/2 committees join 45.349 ms/op 41.075 ms/op 1.10
altair processAttestation - setStatus - 2/3 committees join 64.145 ms/op 55.067 ms/op 1.16
altair processAttestation - setStatus - 4/5 committees join 78.717 ms/op 63.902 ms/op 1.23
altair processAttestation - setStatus - 100% committees join 101.95 ms/op 80.295 ms/op 1.27
altair processAttestation - updateEpochParticipants - 1/6 committees join 17.782 ms/op 13.836 ms/op 1.29
altair processAttestation - updateEpochParticipants - 1/3 committees join 35.322 ms/op 28.686 ms/op 1.23
altair processAttestation - updateEpochParticipants - 1/2 committees join 61.997 ms/op 26.468 ms/op 2.34
altair processAttestation - updateEpochParticipants - 2/3 committees join 28.905 ms/op 29.648 ms/op 0.97
altair processAttestation - updateEpochParticipants - 4/5 committees join 34.699 ms/op 38.824 ms/op 0.89
altair processAttestation - updateEpochParticipants - 100% committees join 35.221 ms/op 34.944 ms/op 1.01
altair processAttestation - updateAllStatus 23.585 ms/op 23.116 ms/op 1.02
altair processBlock - 250000 vs - 7PWei normalcase 58.246 ms/op 46.462 ms/op 1.25
altair processBlock - 250000 vs - 7PWei worstcase 151.89 ms/op 140.60 ms/op 1.08
altair processEpoch - mainnet_e81889 1.1838 s/op 1.0242 s/op 1.16
mainnet_e81889 - altair beforeProcessEpoch 427.78 ms/op 362.63 ms/op 1.18
mainnet_e81889 - altair processJustificationAndFinalization 131.27 us/op 54.486 us/op 2.41
mainnet_e81889 - altair processInactivityUpdates 21.168 ms/op 18.528 ms/op 1.14
mainnet_e81889 - altair processRewardsAndPenalties 165.61 ms/op 142.32 ms/op 1.16
mainnet_e81889 - altair processRegistryUpdates 23.479 us/op 6.5850 us/op 3.57
mainnet_e81889 - altair processSlashings 5.5950 us/op 1.3400 us/op 4.18
mainnet_e81889 - altair processEth1DataReset 6.3590 us/op 1.7150 us/op 3.71
mainnet_e81889 - altair processEffectiveBalanceUpdates 12.028 ms/op 12.727 ms/op 0.95
mainnet_e81889 - altair processSlashingsReset 36.487 us/op 10.187 us/op 3.58
mainnet_e81889 - altair processRandaoMixesReset 44.810 us/op 13.438 us/op 3.33
mainnet_e81889 - altair processHistoricalRootsUpdate 9.3060 us/op 2.0120 us/op 4.63
mainnet_e81889 - altair processParticipationFlagUpdates 117.64 ms/op 106.25 ms/op 1.11
mainnet_e81889 - altair processSyncCommitteeUpdates 5.0930 us/op 1.4180 us/op 3.59
mainnet_e81889 - altair afterProcessEpoch 253.57 ms/op 243.23 ms/op 1.04
altair processInactivityUpdates - 250000 normalcase 82.794 ms/op 91.197 ms/op 0.91
altair processInactivityUpdates - 250000 worstcase 101.01 ms/op 76.743 ms/op 1.32
altair processParticipationFlagUpdates - 250000 anycase 122.19 ms/op 107.90 ms/op 1.13
altair processRewardsAndPenalties - 250000 normalcase 140.96 ms/op 123.99 ms/op 1.14
altair processRewardsAndPenalties - 250000 worstcase 163.97 ms/op 123.84 ms/op 1.32
altair processSyncCommitteeUpdates - 250000 446.95 ms/op 363.54 ms/op 1.23
Tree 40 250000 create 1.0704 s/op 900.89 ms/op 1.19
Tree 40 250000 get(125000) 322.80 ns/op 322.24 ns/op 1.00
Tree 40 250000 set(125000) 3.0128 us/op 2.0808 us/op 1.45
Tree 40 250000 toArray() 55.910 ms/op 40.927 ms/op 1.37
Tree 40 250000 iterate all - toArray() + loop 46.422 ms/op 48.385 ms/op 0.96
Tree 40 250000 iterate all - get(i) 133.67 ms/op 119.85 ms/op 1.12
MutableVector 250000 create 30.412 ms/op 26.596 ms/op 1.14
MutableVector 250000 get(125000) 30.819 ns/op 13.664 ns/op 2.26
MutableVector 250000 set(125000) 747.97 ns/op 617.03 ns/op 1.21
MutableVector 250000 toArray() 10.622 ms/op 8.6676 ms/op 1.23
MutableVector 250000 iterate all - toArray() + loop 10.584 ms/op 9.5646 ms/op 1.11
MutableVector 250000 iterate all - get(i) 3.6933 ms/op 3.3951 ms/op 1.09
Array 250000 create 6.6929 ms/op 5.8496 ms/op 1.14
Array 250000 clone - spread 2.6681 ms/op 2.4082 ms/op 1.11
Array 250000 get(125000) 1.2190 ns/op 1.0590 ns/op 1.15
Array 250000 set(125000) 1.2200 ns/op 1.0440 ns/op 1.17
Array 250000 iterate all - loop 153.48 us/op 148.22 us/op 1.04
aggregationBits - 2048 els - readonlyValues 268.37 us/op 232.94 us/op 1.15
aggregationBits - 2048 els - zipIndexesInBitList 42.589 us/op 55.512 us/op 0.77
regular array get 100000 times 58.446 us/op 67.525 us/op 0.87
wrappedArray get 100000 times 57.450 us/op 67.974 us/op 0.85
arrayWithProxy get 100000 times 34.177 ms/op 28.501 ms/op 1.20
ssz.Root.equals 1.5080 us/op 1.2800 us/op 1.18
ssz.Root.equals with valueOf() 1.6330 us/op 1.4270 us/op 1.14
byteArrayEquals with valueOf() 1.5530 us/op 1.4060 us/op 1.10
phase0 processBlock - 250000 vs - 7PWei normalcase 12.953 ms/op 10.565 ms/op 1.23
phase0 processBlock - 250000 vs - 7PWei worstcase 93.052 ms/op 74.768 ms/op 1.24
phase0 afterProcessEpoch - 250000 vs - 7PWei 227.05 ms/op 190.53 ms/op 1.19
phase0 beforeProcessEpoch - 250000 vs - 7PWei 718.46 ms/op 584.92 ms/op 1.23
phase0 processEpoch - mainnet_e58758 880.42 ms/op 785.41 ms/op 1.12
mainnet_e58758 - phase0 beforeProcessEpoch 549.61 ms/op 449.89 ms/op 1.22
mainnet_e58758 - phase0 processJustificationAndFinalization 117.58 us/op 55.270 us/op 2.13
mainnet_e58758 - phase0 processRewardsAndPenalties 154.67 ms/op 99.000 ms/op 1.56
mainnet_e58758 - phase0 processRegistryUpdates 86.380 us/op 36.154 us/op 2.39
mainnet_e58758 - phase0 processSlashings 6.5480 us/op 1.5350 us/op 4.27
mainnet_e58758 - phase0 processEth1DataReset 6.2120 us/op 1.4970 us/op 4.15
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 10.949 ms/op 9.3891 ms/op 1.17
mainnet_e58758 - phase0 processSlashingsReset 30.322 us/op 8.3150 us/op 3.65
mainnet_e58758 - phase0 processRandaoMixesReset 39.283 us/op 11.373 us/op 3.45
mainnet_e58758 - phase0 processHistoricalRootsUpdate 7.2700 us/op 1.8830 us/op 3.86
mainnet_e58758 - phase0 processParticipationRecordUpdates 28.800 us/op 8.5730 us/op 3.36
mainnet_e58758 - phase0 afterProcessEpoch 197.77 ms/op 178.17 ms/op 1.11
phase0 processEffectiveBalanceUpdates - 250000 normalcase 11.920 ms/op 10.019 ms/op 1.19
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.4254 s/op 1.4109 s/op 1.01
phase0 processRegistryUpdates - 250000 normalcase 89.457 us/op 35.973 us/op 2.49
phase0 processRegistryUpdates - 250000 badcase_full_deposits 3.4972 ms/op 3.0747 ms/op 1.14
phase0 processRegistryUpdates - 250000 worstcase 0.5 2.0597 s/op 1.6295 s/op 1.26
phase0 getAttestationDeltas - 250000 normalcase 32.454 ms/op 31.704 ms/op 1.02
phase0 getAttestationDeltas - 250000 worstcase 32.169 ms/op 32.215 ms/op 1.00
phase0 processSlashings - 250000 worstcase 40.835 ms/op 45.394 ms/op 0.90
shuffle list - 16384 els 12.861 ms/op 13.107 ms/op 0.98
shuffle list - 250000 els 160.85 ms/op 186.99 ms/op 0.86
getEffectiveBalances - 250000 vs - 7PWei 10.594 ms/op 13.261 ms/op 0.80
pass gossip attestations to forkchoice per slot 24.473 ms/op 15.889 ms/op 1.54
computeDeltas 2.9546 ms/op 3.4984 ms/op 0.84
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.2410 ms/op 2.5995 ms/op 0.86
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 733.48 us/op 732.85 us/op 1.00
BLS verify - blst-native 1.8471 ms/op 1.8599 ms/op 0.99
BLS verifyMultipleSignatures 3 - blst-native 3.9735 ms/op 3.8203 ms/op 1.04
BLS verifyMultipleSignatures 8 - blst-native 8.3814 ms/op 8.2327 ms/op 1.02
BLS verifyMultipleSignatures 32 - blst-native 29.664 ms/op 29.873 ms/op 0.99
BLS aggregatePubkeys 32 - blst-native 45.604 us/op 39.579 us/op 1.15
BLS aggregatePubkeys 128 - blst-native 190.65 us/op 154.15 us/op 1.24
getAttestationsForBlock 91.779 ms/op 93.689 ms/op 0.98
CheckpointStateCache - add get delete 20.493 us/op 18.619 us/op 1.10
validate gossip signedAggregateAndProof - struct 4.8871 ms/op 4.4611 ms/op 1.10
validate gossip signedAggregateAndProof - treeBacked 5.1459 ms/op 4.4023 ms/op 1.17
validate gossip attestation - struct 2.4448 ms/op 2.0910 ms/op 1.17
validate gossip attestation - treeBacked 2.3045 ms/op 2.1022 ms/op 1.10
bytes32 toHexString 2.0100 us/op 1.9620 us/op 1.02
bytes32 Buffer.toString(hex) 797.00 ns/op 692.00 ns/op 1.15
bytes32 Buffer.toString(hex) from Uint8Array 1.0330 us/op 902.00 ns/op 1.15
bytes32 Buffer.toString(hex) + 0x 735.00 ns/op 706.00 ns/op 1.04
Object access 1 prop 0.35700 ns/op 0.35700 ns/op 1.00
Map access 1 prop 0.31700 ns/op 0.28400 ns/op 1.12
Object get x1000 15.881 ns/op 17.895 ns/op 0.89
Map get x1000 0.99800 ns/op 0.97000 ns/op 1.03
Object set x1000 99.494 ns/op 118.61 ns/op 0.84
Map set x1000 62.236 ns/op 70.223 ns/op 0.89
Return object 10000 times 0.36290 ns/op 0.36660 ns/op 0.99
Throw Error 10000 times 5.9275 us/op 5.9084 us/op 1.00
enrSubnets - fastDeserialize 64 bits 1.2070 us/op 1.3150 us/op 0.92
enrSubnets - ssz BitVector 64 bits 15.791 us/op 16.826 us/op 0.94
enrSubnets - fastDeserialize 4 bits 463.00 ns/op 470.00 ns/op 0.99
enrSubnets - ssz BitVector 4 bits 2.9050 us/op 3.0420 us/op 0.95
RateTracker 1000000 limit, 1 obj count per request 170.82 ns/op 188.28 ns/op 0.91
RateTracker 1000000 limit, 2 obj count per request 129.60 ns/op 142.35 ns/op 0.91
RateTracker 1000000 limit, 4 obj count per request 108.15 ns/op 118.98 ns/op 0.91
RateTracker 1000000 limit, 8 obj count per request 103.33 ns/op 107.68 ns/op 0.96
RateTracker with prune 4.8100 us/op 4.6090 us/op 1.04

by benchmarkbot/action

@dapplion dapplion force-pushed the dapplion/remove-ssz-utils branch from 291a343 to 27599cb Compare January 14, 2022 18:42
@codecov
Copy link

codecov bot commented Jan 14, 2022

Codecov Report

Merging #3623 (b6dd4a1) into master (1bd730a) will not change coverage.
The diff coverage is n/a.

❗ Current head b6dd4a1 differs from pull request most recent head 27599cb. Consider uploading reports for the commit 27599cb to get more accurate results

@@           Coverage Diff           @@
##           master    #3623   +/-   ##
=======================================
  Coverage   37.40%   37.40%           
=======================================
  Files         311      311           
  Lines        8374     8374           
  Branches     1299     1299           
=======================================
  Hits         3132     3132           
  Misses       5093     5093           
  Partials      149      149           

@dapplion dapplion merged commit c581c18 into master Jan 17, 2022
@dapplion dapplion deleted the dapplion/remove-ssz-utils branch January 17, 2022 07:15
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants