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

Consistent use of RootHex in notifyForkchoiceUpdate #4308

Merged
merged 1 commit into from Jul 17, 2022

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented Jul 17, 2022

Motivation

No necessary to support a mix of Root and Root | RooHex of parameters in notifyForkchoiceUpdate()

This caused an type issue not guarded by Typescript:

  • An interface defines method fn(arg: Root | RootHex)
  • An implementer class uses fn(arg: RootHex), which compiles fine
  • Then fn() is called with RootHex = TypeError

Description

Consistent use of RootHex in notifyForkchoiceUpdate

@dapplion dapplion requested a review from a team as a code owner July 17, 2022 07:34
Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

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

LGTM!

@github-actions
Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: b3e6c4e Previous: 2f0641a Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.2390 ms/op 2.3542 ms/op 0.95
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 78.911 us/op 82.106 us/op 0.96
BLS verify - blst-native 1.8659 ms/op 2.7083 ms/op 0.69
BLS verifyMultipleSignatures 3 - blst-native 3.8220 ms/op 5.5896 ms/op 0.68
BLS verifyMultipleSignatures 8 - blst-native 8.2205 ms/op 12.024 ms/op 0.68
BLS verifyMultipleSignatures 32 - blst-native 29.858 ms/op 43.519 ms/op 0.69
BLS aggregatePubkeys 32 - blst-native 39.364 us/op 59.852 us/op 0.66
BLS aggregatePubkeys 128 - blst-native 153.13 us/op 232.13 us/op 0.66
getAttestationsForBlock 48.664 ms/op 52.448 ms/op 0.93
isKnown best case - 1 super set check 428.00 ns/op 513.00 ns/op 0.83
isKnown normal case - 2 super set checks 415.00 ns/op 511.00 ns/op 0.81
isKnown worse case - 16 super set checks 416.00 ns/op 501.00 ns/op 0.83
CheckpointStateCache - add get delete 11.811 us/op 13.974 us/op 0.85
validate gossip signedAggregateAndProof - struct 4.3119 ms/op 6.3443 ms/op 0.68
validate gossip attestation - struct 2.0445 ms/op 2.9894 ms/op 0.68
altair verifyImport mainnet_s3766816:31 12.590 s/op 16.008 s/op 0.79
pickEth1Vote - no votes 2.2067 ms/op 2.4991 ms/op 0.88
pickEth1Vote - max votes 29.484 ms/op 27.880 ms/op 1.06
pickEth1Vote - Eth1Data hashTreeRoot value x2048 12.852 ms/op 14.629 ms/op 0.88
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 24.724 ms/op 25.045 ms/op 0.99
pickEth1Vote - Eth1Data fastSerialize value x2048 1.6083 ms/op 1.8912 ms/op 0.85
pickEth1Vote - Eth1Data fastSerialize tree x2048 20.463 ms/op 19.271 ms/op 1.06
bytes32 toHexString 1.2560 us/op 1.2800 us/op 0.98
bytes32 Buffer.toString(hex) 729.00 ns/op 819.00 ns/op 0.89
bytes32 Buffer.toString(hex) from Uint8Array 937.00 ns/op 1.1520 us/op 0.81
bytes32 Buffer.toString(hex) + 0x 720.00 ns/op 821.00 ns/op 0.88
Object access 1 prop 0.43600 ns/op 0.41700 ns/op 1.05
Map access 1 prop 0.29600 ns/op 0.33400 ns/op 0.89
Object get x1000 17.183 ns/op 16.818 ns/op 1.02
Map get x1000 1.0370 ns/op 0.95900 ns/op 1.08
Object set x1000 130.45 ns/op 118.51 ns/op 1.10
Map set x1000 80.110 ns/op 81.455 ns/op 0.98
Return object 10000 times 0.36610 ns/op 0.41700 ns/op 0.88
Throw Error 10000 times 5.9124 us/op 7.2433 us/op 0.82
enrSubnets - fastDeserialize 64 bits 3.1910 us/op 3.1900 us/op 1.00
enrSubnets - ssz BitVector 64 bits 812.00 ns/op 862.00 ns/op 0.94
enrSubnets - fastDeserialize 4 bits 442.00 ns/op 435.00 ns/op 1.02
enrSubnets - ssz BitVector 4 bits 814.00 ns/op 888.00 ns/op 0.92
prioritizePeers score -10:0 att 32-0.1 sync 2-0 103.64 us/op 110.74 us/op 0.94
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 142.18 us/op 167.41 us/op 0.85
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 252.85 us/op 297.10 us/op 0.85
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 390.18 us/op 557.12 us/op 0.70
prioritizePeers score 0:0 att 64-1 sync 4-1 462.61 us/op 657.76 us/op 0.70
RateTracker 1000000 limit, 1 obj count per request 215.20 ns/op 211.74 ns/op 1.02
RateTracker 1000000 limit, 2 obj count per request 167.60 ns/op 159.76 ns/op 1.05
RateTracker 1000000 limit, 4 obj count per request 143.16 ns/op 135.99 ns/op 1.05
RateTracker 1000000 limit, 8 obj count per request 131.03 ns/op 121.64 ns/op 1.08
RateTracker with prune 5.4320 us/op 5.4130 us/op 1.00
array of 16000 items push then shift 3.2135 us/op 5.3747 us/op 0.60
LinkedList of 16000 items push then shift 24.940 ns/op 26.461 ns/op 0.94
array of 16000 items push then pop 252.15 ns/op 256.57 ns/op 0.98
LinkedList of 16000 items push then pop 21.441 ns/op 24.544 ns/op 0.87
array of 24000 items push then shift 4.5840 us/op 7.9119 us/op 0.58
LinkedList of 24000 items push then shift 25.761 ns/op 27.142 ns/op 0.95
array of 24000 items push then pop 218.83 ns/op 209.62 ns/op 1.04
LinkedList of 24000 items push then pop 21.706 ns/op 24.195 ns/op 0.90
intersect bitArray bitLen 8 11.505 ns/op 12.911 ns/op 0.89
intersect array and set length 8 193.48 ns/op 196.67 ns/op 0.98
intersect bitArray bitLen 128 72.175 ns/op 72.085 ns/op 1.00
intersect array and set length 128 2.4057 us/op 2.4379 us/op 0.99
pass gossip attestations to forkchoice per slot 3.1836 ms/op 5.8652 ms/op 0.54
computeDeltas 3.5237 ms/op 3.5795 ms/op 0.98
computeProposerBoostScoreFromBalances 923.58 us/op 898.53 us/op 1.03
altair processAttestation - 250000 vs - 7PWei normalcase 4.6152 ms/op 5.0247 ms/op 0.92
altair processAttestation - 250000 vs - 7PWei worstcase 6.4420 ms/op 7.5004 ms/op 0.86
altair processAttestation - setStatus - 1/6 committees join 215.15 us/op 247.01 us/op 0.87
altair processAttestation - setStatus - 1/3 committees join 404.71 us/op 450.49 us/op 0.90
altair processAttestation - setStatus - 1/2 committees join 574.60 us/op 668.86 us/op 0.86
altair processAttestation - setStatus - 2/3 committees join 736.75 us/op 853.37 us/op 0.86
altair processAttestation - setStatus - 4/5 committees join 1.0183 ms/op 1.1954 ms/op 0.85
altair processAttestation - setStatus - 100% committees join 1.2122 ms/op 1.4466 ms/op 0.84
altair processBlock - 250000 vs - 7PWei normalcase 27.711 ms/op 30.671 ms/op 0.90
altair processBlock - 250000 vs - 7PWei normalcase hashState 33.626 ms/op 51.008 ms/op 0.66
altair processBlock - 250000 vs - 7PWei worstcase 80.963 ms/op 104.56 ms/op 0.77
altair processBlock - 250000 vs - 7PWei worstcase hashState 99.919 ms/op 123.39 ms/op 0.81
phase0 processBlock - 250000 vs - 7PWei normalcase 5.4622 ms/op 5.1262 ms/op 1.07
phase0 processBlock - 250000 vs - 7PWei worstcase 48.488 ms/op 64.405 ms/op 0.75
altair processEth1Data - 250000 vs - 7PWei normalcase 936.91 us/op 1.1697 ms/op 0.80
Tree 40 250000 create 1.0781 s/op 955.07 ms/op 1.13
Tree 40 250000 get(125000) 300.02 ns/op 332.45 ns/op 0.90
Tree 40 250000 set(125000) 3.5991 us/op 3.3343 us/op 1.08
Tree 40 250000 toArray() 33.792 ms/op 35.882 ms/op 0.94
Tree 40 250000 iterate all - toArray() + loop 35.680 ms/op 35.453 ms/op 1.01
Tree 40 250000 iterate all - get(i) 110.70 ms/op 134.38 ms/op 0.82
MutableVector 250000 create 12.962 ms/op 17.032 ms/op 0.76
MutableVector 250000 get(125000) 13.232 ns/op 15.682 ns/op 0.84
MutableVector 250000 set(125000) 660.95 ns/op 928.24 ns/op 0.71
MutableVector 250000 toArray() 7.2780 ms/op 7.7022 ms/op 0.94
MutableVector 250000 iterate all - toArray() + loop 7.3476 ms/op 6.4811 ms/op 1.13
MutableVector 250000 iterate all - get(i) 3.4593 ms/op 3.5050 ms/op 0.99
Array 250000 create 6.5744 ms/op 5.6331 ms/op 1.17
Array 250000 clone - spread 3.5004 ms/op 2.7653 ms/op 1.27
Array 250000 get(125000) 1.4260 ns/op 1.3390 ns/op 1.06
Array 250000 set(125000) 1.4080 ns/op 1.3500 ns/op 1.04
Array 250000 iterate all - loop 170.54 us/op 149.71 us/op 1.14
effectiveBalanceIncrements clone Uint8Array 300000 88.275 us/op 89.478 us/op 0.99
effectiveBalanceIncrements clone MutableVector 300000 1.0160 us/op 871.00 ns/op 1.17
effectiveBalanceIncrements rw all Uint8Array 300000 253.49 us/op 305.17 us/op 0.83
effectiveBalanceIncrements rw all MutableVector 300000 202.79 ms/op 220.55 ms/op 0.92
phase0 afterProcessEpoch - 250000 vs - 7PWei 185.39 ms/op 203.09 ms/op 0.91
phase0 beforeProcessEpoch - 250000 vs - 7PWei 85.337 ms/op 88.628 ms/op 0.96
altair processEpoch - mainnet_e81889 510.81 ms/op 650.46 ms/op 0.79
mainnet_e81889 - altair beforeProcessEpoch 119.68 ms/op 149.06 ms/op 0.80
mainnet_e81889 - altair processJustificationAndFinalization 20.867 us/op 67.078 us/op 0.31
mainnet_e81889 - altair processInactivityUpdates 12.247 ms/op 12.709 ms/op 0.96
mainnet_e81889 - altair processRewardsAndPenalties 96.288 ms/op 102.03 ms/op 0.94
mainnet_e81889 - altair processRegistryUpdates 3.6390 us/op 12.251 us/op 0.30
mainnet_e81889 - altair processSlashings 758.00 ns/op 3.4810 us/op 0.22
mainnet_e81889 - altair processEth1DataReset 850.00 ns/op 2.5850 us/op 0.33
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.2651 ms/op 2.5170 ms/op 0.90
mainnet_e81889 - altair processSlashingsReset 5.9670 us/op 19.124 us/op 0.31
mainnet_e81889 - altair processRandaoMixesReset 5.8110 us/op 21.602 us/op 0.27
mainnet_e81889 - altair processHistoricalRootsUpdate 904.00 ns/op 3.6780 us/op 0.25
mainnet_e81889 - altair processParticipationFlagUpdates 2.8950 us/op 16.141 us/op 0.18
mainnet_e81889 - altair processSyncCommitteeUpdates 700.00 ns/op 3.2370 us/op 0.22
mainnet_e81889 - altair afterProcessEpoch 195.29 ms/op 214.18 ms/op 0.91
phase0 processEpoch - mainnet_e58758 538.43 ms/op 610.14 ms/op 0.88
mainnet_e58758 - phase0 beforeProcessEpoch 236.93 ms/op 269.91 ms/op 0.88
mainnet_e58758 - phase0 processJustificationAndFinalization 23.662 us/op 48.074 us/op 0.49
mainnet_e58758 - phase0 processRewardsAndPenalties 140.55 ms/op 154.04 ms/op 0.91
mainnet_e58758 - phase0 processRegistryUpdates 10.419 us/op 30.687 us/op 0.34
mainnet_e58758 - phase0 processSlashings 792.00 ns/op 3.8670 us/op 0.20
mainnet_e58758 - phase0 processEth1DataReset 800.00 ns/op 3.4380 us/op 0.23
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.3017 ms/op 2.4429 ms/op 0.94
mainnet_e58758 - phase0 processSlashingsReset 5.0590 us/op 16.581 us/op 0.31
mainnet_e58758 - phase0 processRandaoMixesReset 6.7680 us/op 23.617 us/op 0.29
mainnet_e58758 - phase0 processHistoricalRootsUpdate 887.00 ns/op 2.6020 us/op 0.34
mainnet_e58758 - phase0 processParticipationRecordUpdates 5.4090 us/op 18.308 us/op 0.30
mainnet_e58758 - phase0 afterProcessEpoch 160.60 ms/op 179.11 ms/op 0.90
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.5713 ms/op 2.5363 ms/op 1.01
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.0291 ms/op 2.9187 ms/op 1.04
altair processInactivityUpdates - 250000 normalcase 39.436 ms/op 48.908 ms/op 0.81
altair processInactivityUpdates - 250000 worstcase 40.529 ms/op 57.418 ms/op 0.71
phase0 processRegistryUpdates - 250000 normalcase 8.7450 us/op 23.495 us/op 0.37
phase0 processRegistryUpdates - 250000 badcase_full_deposits 401.50 us/op 475.55 us/op 0.84
phase0 processRegistryUpdates - 250000 worstcase 0.5 196.67 ms/op 230.74 ms/op 0.85
altair processRewardsAndPenalties - 250000 normalcase 92.015 ms/op 147.69 ms/op 0.62
altair processRewardsAndPenalties - 250000 worstcase 131.15 ms/op 96.277 ms/op 1.36
phase0 getAttestationDeltas - 250000 normalcase 14.832 ms/op 14.692 ms/op 1.01
phase0 getAttestationDeltas - 250000 worstcase 14.047 ms/op 14.443 ms/op 0.97
phase0 processSlashings - 250000 worstcase 5.4655 ms/op 6.3063 ms/op 0.87
altair processSyncCommitteeUpdates - 250000 286.86 ms/op 331.90 ms/op 0.86
BeaconState.hashTreeRoot - No change 466.00 ns/op 573.00 ns/op 0.81
BeaconState.hashTreeRoot - 1 full validator 55.037 us/op 76.264 us/op 0.72
BeaconState.hashTreeRoot - 32 full validator 563.56 us/op 769.78 us/op 0.73
BeaconState.hashTreeRoot - 512 full validator 6.3227 ms/op 7.8795 ms/op 0.80
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 70.028 us/op 98.392 us/op 0.71
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.0691 ms/op 1.3751 ms/op 0.78
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 13.436 ms/op 16.892 ms/op 0.80
BeaconState.hashTreeRoot - 1 balances 55.170 us/op 73.143 us/op 0.75
BeaconState.hashTreeRoot - 32 balances 468.73 us/op 663.65 us/op 0.71
BeaconState.hashTreeRoot - 512 balances 4.5954 ms/op 5.8864 ms/op 0.78
BeaconState.hashTreeRoot - 250000 balances 83.397 ms/op 101.80 ms/op 0.82
aggregationBits - 2048 els - zipIndexesInBitList 39.347 us/op 32.433 us/op 1.21
regular array get 100000 times 67.748 us/op 58.696 us/op 1.15
wrappedArray get 100000 times 67.663 us/op 58.592 us/op 1.15
arrayWithProxy get 100000 times 28.949 ms/op 35.847 ms/op 0.81
ssz.Root.equals 538.00 ns/op 585.00 ns/op 0.92
byteArrayEquals 545.00 ns/op 556.00 ns/op 0.98
shuffle list - 16384 els 11.086 ms/op 12.554 ms/op 0.88
shuffle list - 250000 els 166.30 ms/op 181.77 ms/op 0.91
processSlot - 1 slots 13.097 us/op 16.153 us/op 0.81
processSlot - 32 slots 1.8266 ms/op 2.3331 ms/op 0.78
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 381.75 us/op 440.72 us/op 0.87
getCommitteeAssignments - req 1 vs - 250000 vc 5.3300 ms/op 5.5199 ms/op 0.97
getCommitteeAssignments - req 100 vs - 250000 vc 7.3678 ms/op 7.8185 ms/op 0.94
getCommitteeAssignments - req 1000 vs - 250000 vc 7.7841 ms/op 8.4727 ms/op 0.92
computeProposers - vc 250000 19.035 ms/op 21.642 ms/op 0.88
computeEpochShuffling - vc 250000 168.45 ms/op 185.23 ms/op 0.91
getNextSyncCommittee - vc 250000 280.63 ms/op 322.20 ms/op 0.87

by benchmarkbot/action

@g11tech g11tech merged commit 23d1e21 into unstable Jul 17, 2022
@g11tech g11tech deleted the dapplion/notifyForkchoiceUpdate-roothex branch July 17, 2022 08:09
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

2 participants