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

Remove intermediary event ChainEvent.forkChoiceReorg #4972

Merged
merged 1 commit into from
Jan 4, 2023

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented Jan 4, 2023

Motivation

No need for a different event data, as importBlock can compute the API's style event directly.

Description

Remove intermediary event ChainEvent.forkChoiceReorg

@dapplion dapplion requested a review from a team as a code owner January 4, 2023 03:29
@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 969701f Previous: ce33cb5 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.0866 ms/op 1.1609 ms/op 0.94
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 68.031 us/op 76.944 us/op 0.88
BLS verify - blst-native 1.8608 ms/op 2.5555 ms/op 0.73
BLS verifyMultipleSignatures 3 - blst-native 3.8093 ms/op 5.1578 ms/op 0.74
BLS verifyMultipleSignatures 8 - blst-native 8.1998 ms/op 11.052 ms/op 0.74
BLS verifyMultipleSignatures 32 - blst-native 29.761 ms/op 39.840 ms/op 0.75
BLS aggregatePubkeys 32 - blst-native 40.017 us/op 55.126 us/op 0.73
BLS aggregatePubkeys 128 - blst-native 155.83 us/op 214.58 us/op 0.73
getAttestationsForBlock 84.854 ms/op 105.12 ms/op 0.81
isKnown best case - 1 super set check 418.00 ns/op 491.00 ns/op 0.85
isKnown normal case - 2 super set checks 411.00 ns/op 480.00 ns/op 0.86
isKnown worse case - 16 super set checks 410.00 ns/op 475.00 ns/op 0.86
CheckpointStateCache - add get delete 8.3890 us/op 10.458 us/op 0.80
validate gossip signedAggregateAndProof - struct 4.2693 ms/op 6.2982 ms/op 0.68
validate gossip attestation - struct 2.0286 ms/op 2.9500 ms/op 0.69
pickEth1Vote - no votes 2.1059 ms/op 2.5783 ms/op 0.82
pickEth1Vote - max votes 16.157 ms/op 19.622 ms/op 0.82
pickEth1Vote - Eth1Data hashTreeRoot value x2048 11.619 ms/op 15.939 ms/op 0.73
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 20.723 ms/op 26.133 ms/op 0.79
pickEth1Vote - Eth1Data fastSerialize value x2048 1.2414 ms/op 1.3732 ms/op 0.90
pickEth1Vote - Eth1Data fastSerialize tree x2048 9.7509 ms/op 10.017 ms/op 0.97
bytes32 toHexString 970.00 ns/op 1.1440 us/op 0.85
bytes32 Buffer.toString(hex) 531.00 ns/op 619.00 ns/op 0.86
bytes32 Buffer.toString(hex) from Uint8Array 865.00 ns/op 1.0500 us/op 0.82
bytes32 Buffer.toString(hex) + 0x 566.00 ns/op 618.00 ns/op 0.92
Object access 1 prop 0.26900 ns/op 0.30900 ns/op 0.87
Map access 1 prop 0.25100 ns/op 0.28800 ns/op 0.87
Object get x1000 16.723 ns/op 15.837 ns/op 1.06
Map get x1000 0.98300 ns/op 0.89600 ns/op 1.10
Object set x1000 108.56 ns/op 104.99 ns/op 1.03
Map set x1000 65.367 ns/op 68.739 ns/op 0.95
Return object 10000 times 0.36330 ns/op 0.40050 ns/op 0.91
Throw Error 10000 times 6.7022 us/op 7.6278 us/op 0.88
fastMsgIdFn sha256 / 200 bytes 4.1570 us/op 5.2790 us/op 0.79
fastMsgIdFn h32 xxhash / 200 bytes 455.00 ns/op 534.00 ns/op 0.85
fastMsgIdFn h64 xxhash / 200 bytes 628.00 ns/op 716.00 ns/op 0.88
fastMsgIdFn sha256 / 1000 bytes 13.472 us/op 17.084 us/op 0.79
fastMsgIdFn h32 xxhash / 1000 bytes 597.00 ns/op 692.00 ns/op 0.86
fastMsgIdFn h64 xxhash / 1000 bytes 683.00 ns/op 843.00 ns/op 0.81
fastMsgIdFn sha256 / 10000 bytes 116.88 us/op 151.17 us/op 0.77
fastMsgIdFn h32 xxhash / 10000 bytes 2.2980 us/op 2.6180 us/op 0.88
fastMsgIdFn h64 xxhash / 10000 bytes 1.5970 us/op 1.9990 us/op 0.80
enrSubnets - fastDeserialize 64 bits 2.2100 us/op 2.6000 us/op 0.85
enrSubnets - ssz BitVector 64 bits 751.00 ns/op 928.00 ns/op 0.81
enrSubnets - fastDeserialize 4 bits 283.00 ns/op 335.00 ns/op 0.84
enrSubnets - ssz BitVector 4 bits 765.00 ns/op 943.00 ns/op 0.81
prioritizePeers score -10:0 att 32-0.1 sync 2-0 149.67 us/op 192.07 us/op 0.78
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 215.00 us/op 216.16 us/op 0.99
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 309.61 us/op 321.97 us/op 0.96
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 525.58 us/op 568.02 us/op 0.93
prioritizePeers score 0:0 att 64-1 sync 4-1 604.12 us/op 640.19 us/op 0.94
array of 16000 items push then shift 2.8102 us/op 4.9348 us/op 0.57
LinkedList of 16000 items push then shift 17.289 ns/op 17.659 ns/op 0.98
array of 16000 items push then pop 214.36 ns/op 227.89 ns/op 0.94
LinkedList of 16000 items push then pop 16.487 ns/op 17.125 ns/op 0.96
array of 24000 items push then shift 3.9877 us/op 7.2108 us/op 0.55
LinkedList of 24000 items push then shift 19.849 ns/op 18.502 ns/op 1.07
array of 24000 items push then pop 202.79 ns/op 230.17 ns/op 0.88
LinkedList of 24000 items push then pop 17.447 ns/op 17.486 ns/op 1.00
intersect bitArray bitLen 8 28.841 ns/op 27.261 ns/op 1.06
intersect array and set length 8 153.00 ns/op 191.49 ns/op 0.80
intersect bitArray bitLen 128 118.98 ns/op 101.93 ns/op 1.17
intersect array and set length 128 2.2576 us/op 2.3659 us/op 0.95
Buffer.concat 32 items 5.1180 us/op 6.6970 us/op 0.76
Uint8Array.set 32 items 4.0060 us/op 4.5600 us/op 0.88
pass gossip attestations to forkchoice per slot 4.2639 ms/op 4.3719 ms/op 0.98
computeDeltas 5.8960 ms/op 5.0650 ms/op 1.16
computeProposerBoostScoreFromBalances 2.8395 ms/op 2.8462 ms/op 1.00
altair processAttestation - 250000 vs - 7PWei normalcase 3.7175 ms/op 4.4833 ms/op 0.83
altair processAttestation - 250000 vs - 7PWei worstcase 5.7347 ms/op 7.1019 ms/op 0.81
altair processAttestation - setStatus - 1/6 committees join 207.28 us/op 234.63 us/op 0.88
altair processAttestation - setStatus - 1/3 committees join 397.78 us/op 419.56 us/op 0.95
altair processAttestation - setStatus - 1/2 committees join 553.29 us/op 636.90 us/op 0.87
altair processAttestation - setStatus - 2/3 committees join 719.20 us/op 817.67 us/op 0.88
altair processAttestation - setStatus - 4/5 committees join 989.63 us/op 1.2265 ms/op 0.81
altair processAttestation - setStatus - 100% committees join 1.1655 ms/op 1.4572 ms/op 0.80
altair processBlock - 250000 vs - 7PWei normalcase 26.006 ms/op 31.766 ms/op 0.82
altair processBlock - 250000 vs - 7PWei normalcase hashState 34.311 ms/op 41.944 ms/op 0.82
altair processBlock - 250000 vs - 7PWei worstcase 78.013 ms/op 100.35 ms/op 0.78
altair processBlock - 250000 vs - 7PWei worstcase hashState 95.513 ms/op 119.02 ms/op 0.80
phase0 processBlock - 250000 vs - 7PWei normalcase 3.4729 ms/op 4.1186 ms/op 0.84
phase0 processBlock - 250000 vs - 7PWei worstcase 45.221 ms/op 57.245 ms/op 0.79
altair processEth1Data - 250000 vs - 7PWei normalcase 700.32 us/op 979.88 us/op 0.71
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 12.721 us/op 24.071 us/op 0.53
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 52.547 us/op 58.599 us/op 0.90
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 18.550 us/op 31.456 us/op 0.59
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 16.735 us/op 26.854 us/op 0.62
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 165.90 us/op 162.44 us/op 1.02
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 1.2049 ms/op 1.1430 ms/op 1.05
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 1.5151 ms/op 1.5770 ms/op 0.96
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 1.3832 ms/op 1.6364 ms/op 0.85
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 4.4557 ms/op 6.3394 ms/op 0.70
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 2.8302 ms/op 3.1744 ms/op 0.89
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 7.0558 ms/op 8.5279 ms/op 0.83
Tree 40 250000 create 600.13 ms/op 894.97 ms/op 0.67
Tree 40 250000 get(125000) 290.02 ns/op 326.36 ns/op 0.89
Tree 40 250000 set(125000) 1.9075 us/op 2.7797 us/op 0.69
Tree 40 250000 toArray() 31.435 ms/op 34.504 ms/op 0.91
Tree 40 250000 iterate all - toArray() + loop 31.894 ms/op 33.417 ms/op 0.95
Tree 40 250000 iterate all - get(i) 109.33 ms/op 120.83 ms/op 0.90
MutableVector 250000 create 14.183 ms/op 15.964 ms/op 0.89
MutableVector 250000 get(125000) 13.322 ns/op 13.722 ns/op 0.97
MutableVector 250000 set(125000) 544.06 ns/op 719.62 ns/op 0.76
MutableVector 250000 toArray() 6.2990 ms/op 6.4651 ms/op 0.97
MutableVector 250000 iterate all - toArray() + loop 6.4654 ms/op 7.1620 ms/op 0.90
MutableVector 250000 iterate all - get(i) 3.4878 ms/op 4.2111 ms/op 0.83
Array 250000 create 6.0282 ms/op 6.9778 ms/op 0.86
Array 250000 clone - spread 2.5850 ms/op 2.3090 ms/op 1.12
Array 250000 get(125000) 1.0640 ns/op 0.85600 ns/op 1.24
Array 250000 set(125000) 1.0680 ns/op 0.96800 ns/op 1.10
Array 250000 iterate all - loop 168.91 us/op 133.41 us/op 1.27
effectiveBalanceIncrements clone Uint8Array 300000 67.558 us/op 77.775 us/op 0.87
effectiveBalanceIncrements clone MutableVector 300000 730.00 ns/op 506.00 ns/op 1.44
effectiveBalanceIncrements rw all Uint8Array 300000 252.57 us/op 271.93 us/op 0.93
effectiveBalanceIncrements rw all MutableVector 300000 179.68 ms/op 196.32 ms/op 0.92
phase0 afterProcessEpoch - 250000 vs - 7PWei 186.52 ms/op 195.71 ms/op 0.95
phase0 beforeProcessEpoch - 250000 vs - 7PWei 101.61 ms/op 73.496 ms/op 1.38
altair processEpoch - mainnet_e81889 563.14 ms/op 572.77 ms/op 0.98
mainnet_e81889 - altair beforeProcessEpoch 139.81 ms/op 161.67 ms/op 0.86
mainnet_e81889 - altair processJustificationAndFinalization 31.116 us/op 76.994 us/op 0.40
mainnet_e81889 - altair processInactivityUpdates 10.571 ms/op 10.940 ms/op 0.97
mainnet_e81889 - altair processRewardsAndPenalties 90.997 ms/op 98.302 ms/op 0.93
mainnet_e81889 - altair processRegistryUpdates 4.6080 us/op 16.170 us/op 0.28
mainnet_e81889 - altair processSlashings 1.1810 us/op 4.0610 us/op 0.29
mainnet_e81889 - altair processEth1DataReset 768.00 ns/op 4.2420 us/op 0.18
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.3459 ms/op 2.3722 ms/op 0.99
mainnet_e81889 - altair processSlashingsReset 7.4430 us/op 34.048 us/op 0.22
mainnet_e81889 - altair processRandaoMixesReset 5.4790 us/op 28.539 us/op 0.19
mainnet_e81889 - altair processHistoricalRootsUpdate 967.00 ns/op 4.6100 us/op 0.21
mainnet_e81889 - altair processParticipationFlagUpdates 2.9160 us/op 17.215 us/op 0.17
mainnet_e81889 - altair processSyncCommitteeUpdates 871.00 ns/op 4.5790 us/op 0.19
mainnet_e81889 - altair afterProcessEpoch 194.32 ms/op 198.07 ms/op 0.98
phase0 processEpoch - mainnet_e58758 511.55 ms/op 596.57 ms/op 0.86
mainnet_e58758 - phase0 beforeProcessEpoch 219.84 ms/op 270.61 ms/op 0.81
mainnet_e58758 - phase0 processJustificationAndFinalization 30.178 us/op 76.458 us/op 0.39
mainnet_e58758 - phase0 processRewardsAndPenalties 125.74 ms/op 111.78 ms/op 1.12
mainnet_e58758 - phase0 processRegistryUpdates 14.814 us/op 40.941 us/op 0.36
mainnet_e58758 - phase0 processSlashings 1.0920 us/op 3.7860 us/op 0.29
mainnet_e58758 - phase0 processEth1DataReset 1.0600 us/op 2.9960 us/op 0.35
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.9581 ms/op 2.0465 ms/op 0.96
mainnet_e58758 - phase0 processSlashingsReset 6.3120 us/op 14.566 us/op 0.43
mainnet_e58758 - phase0 processRandaoMixesReset 10.053 us/op 24.242 us/op 0.41
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.1490 us/op 3.3270 us/op 0.35
mainnet_e58758 - phase0 processParticipationRecordUpdates 8.0040 us/op 26.434 us/op 0.30
mainnet_e58758 - phase0 afterProcessEpoch 159.68 ms/op 163.81 ms/op 0.97
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.9200 ms/op 2.2881 ms/op 1.28
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.3710 ms/op 2.7854 ms/op 1.21
altair processInactivityUpdates - 250000 normalcase 38.706 ms/op 56.931 ms/op 0.68
altair processInactivityUpdates - 250000 worstcase 38.854 ms/op 45.285 ms/op 0.86
phase0 processRegistryUpdates - 250000 normalcase 12.693 us/op 29.432 us/op 0.43
phase0 processRegistryUpdates - 250000 badcase_full_deposits 570.04 us/op 488.72 us/op 1.17
phase0 processRegistryUpdates - 250000 worstcase 0.5 201.47 ms/op 253.67 ms/op 0.79
altair processRewardsAndPenalties - 250000 normalcase 82.359 ms/op 133.12 ms/op 0.62
altair processRewardsAndPenalties - 250000 worstcase 107.42 ms/op 99.242 ms/op 1.08
phase0 getAttestationDeltas - 250000 normalcase 12.557 ms/op 14.359 ms/op 0.87
phase0 getAttestationDeltas - 250000 worstcase 12.510 ms/op 15.820 ms/op 0.79
phase0 processSlashings - 250000 worstcase 5.8465 ms/op 6.4395 ms/op 0.91
altair processSyncCommitteeUpdates - 250000 264.96 ms/op 306.65 ms/op 0.86
BeaconState.hashTreeRoot - No change 446.00 ns/op 510.00 ns/op 0.87
BeaconState.hashTreeRoot - 1 full validator 59.260 us/op 75.760 us/op 0.78
BeaconState.hashTreeRoot - 32 full validator 723.44 us/op 796.42 us/op 0.91
BeaconState.hashTreeRoot - 512 full validator 6.6199 ms/op 9.5761 ms/op 0.69
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 78.669 us/op 102.02 us/op 0.77
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.1700 ms/op 1.4965 ms/op 0.78
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 14.970 ms/op 18.393 ms/op 0.81
BeaconState.hashTreeRoot - 1 balances 58.893 us/op 75.882 us/op 0.78
BeaconState.hashTreeRoot - 32 balances 556.68 us/op 721.41 us/op 0.77
BeaconState.hashTreeRoot - 512 balances 5.7375 ms/op 6.8469 ms/op 0.84
BeaconState.hashTreeRoot - 250000 balances 86.502 ms/op 113.52 ms/op 0.76
aggregationBits - 2048 els - zipIndexesInBitList 26.389 us/op 29.567 us/op 0.89
regular array get 100000 times 67.258 us/op 54.697 us/op 1.23
wrappedArray get 100000 times 67.291 us/op 54.047 us/op 1.25
arrayWithProxy get 100000 times 27.719 ms/op 31.414 ms/op 0.88
ssz.Root.equals 1.0700 us/op 1.1180 us/op 0.96
byteArrayEquals 1.0680 us/op 1.1550 us/op 0.92
shuffle list - 16384 els 11.244 ms/op 13.394 ms/op 0.84
shuffle list - 250000 els 165.94 ms/op 165.97 ms/op 1.00
processSlot - 1 slots 12.441 us/op 17.440 us/op 0.71
processSlot - 32 slots 1.6829 ms/op 2.4239 ms/op 0.69
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 337.04 us/op 378.62 us/op 0.89
getCommitteeAssignments - req 1 vs - 250000 vc 5.5852 ms/op 5.7500 ms/op 0.97
getCommitteeAssignments - req 100 vs - 250000 vc 7.5245 ms/op 8.5650 ms/op 0.88
getCommitteeAssignments - req 1000 vs - 250000 vc 8.0779 ms/op 9.0703 ms/op 0.89
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 9.7000 ns/op 8.7200 ns/op 1.11
state getBlockRootAtSlot - 250000 vs - 7PWei 1.1228 us/op 1.2933 us/op 0.87
computeProposers - vc 250000 15.755 ms/op 17.625 ms/op 0.89
computeEpochShuffling - vc 250000 171.16 ms/op 171.33 ms/op 1.00
getNextSyncCommittee - vc 250000 262.61 ms/op 299.22 ms/op 0.88

by benchmarkbot/action

@wemeetagain wemeetagain merged commit 8ce256b into unstable Jan 4, 2023
@wemeetagain wemeetagain deleted the dapplion/event-reorg branch January 4, 2023 14:56
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.

2 participants