BackfillSync: Transform roots with toHexString for logging
Motivation Some of the roots in the backfillsync that were being logged were in raw format, transforming them to hex for better readability and UX.
- Transforms the roots with toHexString for logging/errors
- Also relaxes/fixes the weak subjectivity checkpoint error validation scenario as the epoch of checkpoint provided could sometimes also be the floor of slot/SLOTS_PER_EPOCH Description Closes #3640
Steps to test or reproduce
Code Climate has analyzed commit 6fa638a1 and detected 2 issues on this pull request.
Here's the issue category breakdown:
| Category | Count |
|---|---|
| Complexity | 2 |
View more on Code Climate.
Codecov Report
Merging #3643 (7e36f38) into master (9be6d13) will not change coverage. The diff coverage is
n/a.
:exclamation: Current head 7e36f38 differs from pull request most recent head 6fa638a. Consider uploading reports for the commit 6fa638a to get more accurate results
@@ Coverage Diff @@
## master #3643 +/- ##
=======================================
Coverage 37.18% 37.18%
=======================================
Files 320 320
Lines 8629 8629
Branches 1336 1336
=======================================
Hits 3209 3209
Misses 5272 5272
Partials 148 148
Performance Report
✔️ no performance regression detected
Full benchmark results
| Benchmark suite | Current: 7e36f3890cda09b22fbf31601a4e8e17e11796ec | Previous: 9be6d13474b985ce4a735a6070ee08a972801041 | Ratio |
|---|---|---|---|
| BeaconState.hashTreeRoot - No change | 641.00 ns/op | 571.00 ns/op | 1.12 |
| BeaconState.hashTreeRoot - 1 full validator | 146.80 us/op | 144.75 us/op | 1.01 |
| BeaconState.hashTreeRoot - 32 full validator | 2.2139 ms/op | 2.2395 ms/op | 0.99 |
| BeaconState.hashTreeRoot - 512 full validator | 30.385 ms/op | 28.441 ms/op | 1.07 |
| BeaconState.hashTreeRoot - 1 validator.effectiveBalance | 149.50 us/op | 150.50 us/op | 0.99 |
| BeaconState.hashTreeRoot - 32 validator.effectiveBalance | 2.4196 ms/op | 2.3597 ms/op | 1.03 |
| BeaconState.hashTreeRoot - 512 validator.effectiveBalance | 32.593 ms/op | 32.556 ms/op | 1.00 |
| BeaconState.hashTreeRoot - 1 balances | 109.14 us/op | 105.29 us/op | 1.04 |
| BeaconState.hashTreeRoot - 32 balances | 898.37 us/op | 899.13 us/op | 1.00 |
| BeaconState.hashTreeRoot - 512 balances | 8.7153 ms/op | 8.3303 ms/op | 1.05 |
| BeaconState.hashTreeRoot - 250000 balances | 156.05 ms/op | 155.37 ms/op | 1.00 |
| processSlot - 1 slots | 56.164 us/op | 62.949 us/op | 0.89 |
| processSlot - 32 slots | 3.3257 ms/op | 3.4824 ms/op | 0.96 |
| getCommitteeAssignments - req 1 vs - 250000 vc | 5.9080 ms/op | 5.3394 ms/op | 1.11 |
| getCommitteeAssignments - req 100 vs - 250000 vc | 8.5462 ms/op | 8.0560 ms/op | 1.06 |
| getCommitteeAssignments - req 1000 vs - 250000 vc | 9.1119 ms/op | 8.4440 ms/op | 1.08 |
| computeProposers - vc 250000 | 23.602 ms/op | 23.184 ms/op | 1.02 |
| computeEpochShuffling - vc 250000 | 208.25 ms/op | 175.25 ms/op | 1.19 |
| getNextSyncCommittee - vc 250000 | 387.79 ms/op | 379.38 ms/op | 1.02 |
| altair processAttestation - 250000 vs - 7PWei normalcase | 49.942 ms/op | 45.850 ms/op | 1.09 |
| altair processAttestation - 250000 vs - 7PWei worstcase | 50.164 ms/op | 50.397 ms/op | 1.00 |
| altair processAttestation - setStatus - 1/6 committees join | 14.851 ms/op | 13.742 ms/op | 1.08 |
| altair processAttestation - setStatus - 1/3 committees join | 25.431 ms/op | 24.688 ms/op | 1.03 |
| altair processAttestation - setStatus - 1/2 committees join | 35.426 ms/op | 38.624 ms/op | 0.92 |
| altair processAttestation - setStatus - 2/3 committees join | 54.603 ms/op | 52.304 ms/op | 1.04 |
| altair processAttestation - setStatus - 4/5 committees join | 55.892 ms/op | 64.974 ms/op | 0.86 |
| altair processAttestation - setStatus - 100% committees join | 73.186 ms/op | 74.613 ms/op | 0.98 |
| altair processAttestation - updateEpochParticipants - 1/6 committees join | 14.221 ms/op | 14.247 ms/op | 1.00 |
| altair processAttestation - updateEpochParticipants - 1/3 committees join | 25.625 ms/op | 29.456 ms/op | 0.87 |
| altair processAttestation - updateEpochParticipants - 1/2 committees join | 33.591 ms/op | 29.658 ms/op | 1.13 |
| altair processAttestation - updateEpochParticipants - 2/3 committees join | 29.838 ms/op | 33.687 ms/op | 0.89 |
| altair processAttestation - updateEpochParticipants - 4/5 committees join | 32.085 ms/op | 31.029 ms/op | 1.03 |
| altair processAttestation - updateEpochParticipants - 100% committees join | 32.785 ms/op | 31.743 ms/op | 1.03 |
| altair processAttestation - updateAllStatus | 24.007 ms/op | 22.912 ms/op | 1.05 |
| altair processBlock - 250000 vs - 7PWei normalcase | 48.592 ms/op | 48.755 ms/op | 1.00 |
| altair processBlock - 250000 vs - 7PWei worstcase | 128.19 ms/op | 156.22 ms/op | 0.82 |
| altair processEpoch - mainnet_e81889 | 1.2095 s/op | 1.0885 s/op | 1.11 |
| mainnet_e81889 - altair beforeProcessEpoch | 320.93 ms/op | 304.52 ms/op | 1.05 |
| mainnet_e81889 - altair processJustificationAndFinalization | 68.236 us/op | 120.69 us/op | 0.57 |
| mainnet_e81889 - altair processInactivityUpdates | 20.493 ms/op | 17.390 ms/op | 1.18 |
| mainnet_e81889 - altair processRewardsAndPenalties | 243.89 ms/op | 180.61 ms/op | 1.35 |
| mainnet_e81889 - altair processRegistryUpdates | 9.3510 us/op | 19.272 us/op | 0.49 |
| mainnet_e81889 - altair processSlashings | 3.7160 us/op | 6.5510 us/op | 0.57 |
| mainnet_e81889 - altair processEth1DataReset | 3.7440 us/op | 7.0000 us/op | 0.53 |
| mainnet_e81889 - altair processEffectiveBalanceUpdates | 13.004 ms/op | 10.959 ms/op | 1.19 |
| mainnet_e81889 - altair processSlashingsReset | 20.449 us/op | 38.702 us/op | 0.53 |
| mainnet_e81889 - altair processRandaoMixesReset | 20.465 us/op | 41.934 us/op | 0.49 |
| mainnet_e81889 - altair processHistoricalRootsUpdate | 4.5230 us/op | 9.2440 us/op | 0.49 |
| mainnet_e81889 - altair processParticipationFlagUpdates | 113.76 ms/op | 112.69 ms/op | 1.01 |
| mainnet_e81889 - altair processSyncCommitteeUpdates | 3.6600 us/op | 6.4510 us/op | 0.57 |
| mainnet_e81889 - altair afterProcessEpoch | 246.77 ms/op | 225.40 ms/op | 1.09 |
| altair processInactivityUpdates - 250000 normalcase | 78.194 ms/op | 76.241 ms/op | 1.03 |
| altair processInactivityUpdates - 250000 worstcase | 78.806 ms/op | 80.279 ms/op | 0.98 |
| altair processParticipationFlagUpdates - 250000 anycase | 99.914 ms/op | 95.046 ms/op | 1.05 |
| altair processRewardsAndPenalties - 250000 normalcase | 173.73 ms/op | 175.85 ms/op | 0.99 |
| altair processRewardsAndPenalties - 250000 worstcase | 140.03 ms/op | 128.52 ms/op | 1.09 |
| altair processSyncCommitteeUpdates - 250000 | 394.25 ms/op | 394.38 ms/op | 1.00 |
| Tree 40 250000 create | 697.84 ms/op | 710.49 ms/op | 0.98 |
| Tree 40 250000 get(125000) | 386.35 ns/op | 314.60 ns/op | 1.23 |
| Tree 40 250000 set(125000) | 2.2500 us/op | 2.2564 us/op | 1.00 |
| Tree 40 250000 toArray() | 45.504 ms/op | 45.474 ms/op | 1.00 |
| Tree 40 250000 iterate all - toArray() + loop | 44.917 ms/op | 43.080 ms/op | 1.04 |
| Tree 40 250000 iterate all - get(i) | 142.77 ms/op | 119.14 ms/op | 1.20 |
| MutableVector 250000 create | 24.132 ms/op | 24.773 ms/op | 0.97 |
| MutableVector 250000 get(125000) | 15.777 ns/op | 13.754 ns/op | 1.15 |
| MutableVector 250000 set(125000) | 569.75 ns/op | 616.75 ns/op | 0.92 |
| MutableVector 250000 toArray() | 10.591 ms/op | 7.8062 ms/op | 1.36 |
| MutableVector 250000 iterate all - toArray() + loop | 10.093 ms/op | 8.5786 ms/op | 1.18 |
| MutableVector 250000 iterate all - get(i) | 3.9315 ms/op | 3.2959 ms/op | 1.19 |
| Array 250000 create | 6.2137 ms/op | 4.9944 ms/op | 1.24 |
| Array 250000 clone - spread | 2.7574 ms/op | 2.5596 ms/op | 1.08 |
| Array 250000 get(125000) | 1.2860 ns/op | 1.1830 ns/op | 1.09 |
| Array 250000 set(125000) | 1.2950 ns/op | 1.1780 ns/op | 1.10 |
| Array 250000 iterate all - loop | 197.70 us/op | 129.82 us/op | 1.52 |
| aggregationBits - 2048 els - readonlyValues | 281.67 us/op | 261.76 us/op | 1.08 |
| aggregationBits - 2048 els - zipIndexesInBitList | 63.189 us/op | 45.412 us/op | 1.39 |
| regular array get 100000 times | 80.624 us/op | 53.264 us/op | 1.51 |
| wrappedArray get 100000 times | 80.748 us/op | 50.868 us/op | 1.59 |
| arrayWithProxy get 100000 times | 39.397 ms/op | 30.723 ms/op | 1.28 |
| ssz.Root.equals | 1.5090 us/op | 1.2180 us/op | 1.24 |
| ssz.Root.equals with valueOf() | 1.6060 us/op | 1.3740 us/op | 1.17 |
| byteArrayEquals with valueOf() | 1.6590 us/op | 1.3700 us/op | 1.21 |
| phase0 processBlock - 250000 vs - 7PWei normalcase | 12.095 ms/op | 15.182 ms/op | 0.80 |
| phase0 processBlock - 250000 vs - 7PWei worstcase | 87.238 ms/op | 90.250 ms/op | 0.97 |
| phase0 afterProcessEpoch - 250000 vs - 7PWei | 236.09 ms/op | 203.07 ms/op | 1.16 |
| phase0 beforeProcessEpoch - 250000 vs - 7PWei | 598.91 ms/op | 699.70 ms/op | 0.86 |
| phase0 processEpoch - mainnet_e58758 | 974.61 ms/op | 992.42 ms/op | 0.98 |
| mainnet_e58758 - phase0 beforeProcessEpoch | 464.50 ms/op | 561.10 ms/op | 0.83 |
| mainnet_e58758 - phase0 processJustificationAndFinalization | 90.222 us/op | 132.80 us/op | 0.68 |
| mainnet_e58758 - phase0 processRewardsAndPenalties | 164.04 ms/op | 109.08 ms/op | 1.50 |
| mainnet_e58758 - phase0 processRegistryUpdates | 53.759 us/op | 86.903 us/op | 0.62 |
| mainnet_e58758 - phase0 processSlashings | 4.2550 us/op | 7.1610 us/op | 0.59 |
| mainnet_e58758 - phase0 processEth1DataReset | 3.7790 us/op | 5.8740 us/op | 0.64 |
| mainnet_e58758 - phase0 processEffectiveBalanceUpdates | 10.626 ms/op | 9.4928 ms/op | 1.12 |
| mainnet_e58758 - phase0 processSlashingsReset | 16.590 us/op | 28.893 us/op | 0.57 |
| mainnet_e58758 - phase0 processRandaoMixesReset | 24.108 us/op | 36.847 us/op | 0.65 |
| mainnet_e58758 - phase0 processHistoricalRootsUpdate | 5.1780 us/op | 7.5780 us/op | 0.68 |
| mainnet_e58758 - phase0 processParticipationRecordUpdates | 17.720 us/op | 31.751 us/op | 0.56 |
| mainnet_e58758 - phase0 afterProcessEpoch | 199.94 ms/op | 185.49 ms/op | 1.08 |
| phase0 processEffectiveBalanceUpdates - 250000 normalcase | 13.036 ms/op | 11.117 ms/op | 1.17 |
| phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 | 1.2894 s/op | 1.5961 s/op | 0.81 |
| phase0 processRegistryUpdates - 250000 normalcase | 41.263 us/op | 91.328 us/op | 0.45 |
| phase0 processRegistryUpdates - 250000 badcase_full_deposits | 3.6590 ms/op | 3.8568 ms/op | 0.95 |
| phase0 processRegistryUpdates - 250000 worstcase 0.5 | 1.8497 s/op | 1.9299 s/op | 0.96 |
| phase0 getAttestationDeltas - 250000 normalcase | 40.686 ms/op | 35.774 ms/op | 1.14 |
| phase0 getAttestationDeltas - 250000 worstcase | 40.574 ms/op | 35.285 ms/op | 1.15 |
| phase0 processSlashings - 250000 worstcase | 40.717 ms/op | 39.933 ms/op | 1.02 |
| shuffle list - 16384 els | 15.049 ms/op | 13.175 ms/op | 1.14 |
| shuffle list - 250000 els | 216.51 ms/op | 176.87 ms/op | 1.22 |
| getEffectiveBalances - 250000 vs - 7PWei | 12.219 ms/op | 10.942 ms/op | 1.12 |
| pass gossip attestations to forkchoice per slot | 17.303 ms/op | 18.268 ms/op | 0.95 |
| computeDeltas | 3.6671 ms/op | 2.9901 ms/op | 1.23 |
| getPubkeys - index2pubkey - req 1000 vs - 250000 vc | 2.3002 ms/op | 2.4936 ms/op | 0.92 |
| getPubkeys - validatorsArr - req 1000 vs - 250000 vc | 814.83 us/op | 701.33 us/op | 1.16 |
| BLS verify - blst-native | 2.1912 ms/op | 2.0476 ms/op | 1.07 |
| BLS verifyMultipleSignatures 3 - blst-native | 4.5004 ms/op | 4.3209 ms/op | 1.04 |
| BLS verifyMultipleSignatures 8 - blst-native | 9.7308 ms/op | 9.7445 ms/op | 1.00 |
| BLS verifyMultipleSignatures 32 - blst-native | 35.348 ms/op | 33.055 ms/op | 1.07 |
| BLS aggregatePubkeys 32 - blst-native | 46.032 us/op | 43.691 us/op | 1.05 |
| BLS aggregatePubkeys 128 - blst-native | 180.80 us/op | 164.28 us/op | 1.10 |
| getAttestationsForBlock | 102.50 ms/op | 98.273 ms/op | 1.04 |
| CheckpointStateCache - add get delete | 20.790 us/op | 22.480 us/op | 0.92 |
| validate gossip signedAggregateAndProof - struct | 5.1618 ms/op | 5.2223 ms/op | 0.99 |
| validate gossip signedAggregateAndProof - treeBacked | 5.0150 ms/op | 4.7972 ms/op | 1.05 |
| validate gossip attestation - struct | 2.5316 ms/op | 2.1985 ms/op | 1.15 |
| validate gossip attestation - treeBacked | 2.4230 ms/op | 2.4584 ms/op | 0.99 |
| bytes32 toHexString | 1.9740 us/op | 1.6570 us/op | 1.19 |
| bytes32 Buffer.toString(hex) | 838.00 ns/op | 682.00 ns/op | 1.23 |
| bytes32 Buffer.toString(hex) from Uint8Array | 1.1140 us/op | 931.00 ns/op | 1.20 |
| bytes32 Buffer.toString(hex) + 0x | 827.00 ns/op | 726.00 ns/op | 1.14 |
| Object access 1 prop | 0.39100 ns/op | 0.36800 ns/op | 1.06 |
| Map access 1 prop | 0.33100 ns/op | 0.31900 ns/op | 1.04 |
| Object get x1000 | 21.009 ns/op | 15.597 ns/op | 1.35 |
| Map get x1000 | 1.2490 ns/op | 0.88600 ns/op | 1.41 |
| Object set x1000 | 127.09 ns/op | 100.16 ns/op | 1.27 |
| Map set x1000 | 73.146 ns/op | 67.459 ns/op | 1.08 |
| Return object 10000 times | 0.44630 ns/op | 0.40640 ns/op | 1.10 |
| Throw Error 10000 times | 6.7504 us/op | 6.6374 us/op | 1.02 |
| enrSubnets - fastDeserialize 64 bits | 1.3910 us/op | 1.3960 us/op | 1.00 |
| enrSubnets - ssz BitVector 64 bits | 19.379 us/op | 17.217 us/op | 1.13 |
| enrSubnets - fastDeserialize 4 bits | 519.00 ns/op | 443.00 ns/op | 1.17 |
| enrSubnets - ssz BitVector 4 bits | 3.2350 us/op | 3.0610 us/op | 1.06 |
| RateTracker 1000000 limit, 1 obj count per request | 200.22 ns/op | 187.12 ns/op | 1.07 |
| RateTracker 1000000 limit, 2 obj count per request | 154.52 ns/op | 142.58 ns/op | 1.08 |
| RateTracker 1000000 limit, 4 obj count per request | 127.45 ns/op | 113.94 ns/op | 1.12 |
| RateTracker 1000000 limit, 8 obj count per request | 110.27 ns/op | 100.39 ns/op | 1.10 |
| RateTracker with prune | 4.2600 us/op | 4.2600 us/op | 1.00 |
by benchmarkbot/action
Should you use the LodestarError pattern instead? To render error nicely you can also use the pattern to be used in this PR https://github.com/ChainSafe/lodestar/pull/3595/files#diff-5b8cfb1ff2e4749b7113246ddbe1feaa9810ae7bfbc1a7f460d671e74900045fR158
makes sense! :heart: will update :+1:
Closing, can be added in a future PR that reviews backfill sync