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

Add feerecipient and gas_limit routes #4511

Merged
merged 17 commits into from Sep 12, 2022
Merged

Conversation

g11tech
Copy link
Contributor

@g11tech g11tech commented Sep 6, 2022

Add feerecipient and gas_limit routes

Passes the oapi spec test checker locally (since the opai release json is not available, constructed it locally, have asked for an alpha release on keymanager api so the api spec tests check can be enabled)
image

Closes #4392 Closes #4393

TODO:
- [ ] Enable oapi spec tests (once the keymanager alpha release is done making the json asset avaiilable to be fetched) can be followed up in a separate PR as not show stopper

  • Add persisting strategy (complexity is how to handle collisions with proposerSettingFile config, especially on restart
    • not allow keymanager proposer updates if proposerSettingsFile provided
    • update to keymanager should also persist configs in the validators dir (add a seprate topfolder for storing these)
    • not let validator start with proposerSettingsFile if there is proposer data saved in the keymanagar proposer dir unless provided with a flush flag: --flushKeymanagerProposerConfigs in which case the directory is deleted at startup
    • add e2e tests

@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2022

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 3fbbf88 Previous: 80a1437 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.5860 ms/op 1.9321 ms/op 1.34
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 74.856 us/op 69.380 us/op 1.08
BLS verify - blst-native 1.8636 ms/op 1.8551 ms/op 1.00
BLS verifyMultipleSignatures 3 - blst-native 3.8088 ms/op 3.7999 ms/op 1.00
BLS verifyMultipleSignatures 8 - blst-native 8.1908 ms/op 8.1930 ms/op 1.00
BLS verifyMultipleSignatures 32 - blst-native 29.958 ms/op 29.699 ms/op 1.01
BLS aggregatePubkeys 32 - blst-native 39.992 us/op 39.123 us/op 1.02
BLS aggregatePubkeys 128 - blst-native 152.84 us/op 152.74 us/op 1.00
getAttestationsForBlock 163.45 ms/op 168.03 ms/op 0.97
isKnown best case - 1 super set check 441.00 ns/op 425.00 ns/op 1.04
isKnown normal case - 2 super set checks 430.00 ns/op 417.00 ns/op 1.03
isKnown worse case - 16 super set checks 427.00 ns/op 420.00 ns/op 1.02
CheckpointStateCache - add get delete 8.7820 us/op 8.6810 us/op 1.01
validate gossip signedAggregateAndProof - struct 4.2638 ms/op 4.2738 ms/op 1.00
validate gossip attestation - struct 2.0319 ms/op 2.0301 ms/op 1.00
pickEth1Vote - no votes 2.2454 ms/op 2.1699 ms/op 1.03
pickEth1Vote - max votes 20.069 ms/op 18.196 ms/op 1.10
pickEth1Vote - Eth1Data hashTreeRoot value x2048 11.438 ms/op 10.772 ms/op 1.06
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 21.289 ms/op 19.917 ms/op 1.07
pickEth1Vote - Eth1Data fastSerialize value x2048 1.6690 ms/op 1.5937 ms/op 1.05
pickEth1Vote - Eth1Data fastSerialize tree x2048 13.451 ms/op 12.640 ms/op 1.06
bytes32 toHexString 1.0830 us/op 1.0220 us/op 1.06
bytes32 Buffer.toString(hex) 708.00 ns/op 700.00 ns/op 1.01
bytes32 Buffer.toString(hex) from Uint8Array 945.00 ns/op 932.00 ns/op 1.01
bytes32 Buffer.toString(hex) + 0x 722.00 ns/op 677.00 ns/op 1.07
Object access 1 prop 0.36300 ns/op 0.33800 ns/op 1.07
Map access 1 prop 0.29800 ns/op 0.28900 ns/op 1.03
Object get x1000 18.397 ns/op 17.795 ns/op 1.03
Map get x1000 0.98100 ns/op 0.98300 ns/op 1.00
Object set x1000 122.99 ns/op 111.35 ns/op 1.10
Map set x1000 72.681 ns/op 67.052 ns/op 1.08
Return object 10000 times 0.36630 ns/op 0.37670 ns/op 0.97
Throw Error 10000 times 5.9607 us/op 5.8348 us/op 1.02
enrSubnets - fastDeserialize 64 bits 2.7110 us/op 2.5470 us/op 1.06
enrSubnets - ssz BitVector 64 bits 752.00 ns/op 756.00 ns/op 0.99
enrSubnets - fastDeserialize 4 bits 393.00 ns/op 393.00 ns/op 1.00
enrSubnets - ssz BitVector 4 bits 774.00 ns/op 757.00 ns/op 1.02
prioritizePeers score -10:0 att 32-0.1 sync 2-0 96.292 us/op 94.356 us/op 1.02
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 125.15 us/op 122.85 us/op 1.02
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 221.81 us/op 210.15 us/op 1.06
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 479.29 us/op 451.69 us/op 1.06
prioritizePeers score 0:0 att 64-1 sync 4-1 463.84 us/op 461.72 us/op 1.00
RateTracker 1000000 limit, 1 obj count per request 191.63 ns/op 185.25 ns/op 1.03
RateTracker 1000000 limit, 2 obj count per request 144.20 ns/op 141.15 ns/op 1.02
RateTracker 1000000 limit, 4 obj count per request 124.06 ns/op 118.98 ns/op 1.04
RateTracker 1000000 limit, 8 obj count per request 108.20 ns/op 108.08 ns/op 1.00
RateTracker with prune 4.5410 us/op 4.1710 us/op 1.09
array of 16000 items push then shift 3.1902 us/op 3.0813 us/op 1.04
LinkedList of 16000 items push then shift 19.107 ns/op 17.239 ns/op 1.11
array of 16000 items push then pop 264.08 ns/op 241.07 ns/op 1.10
LinkedList of 16000 items push then pop 17.776 ns/op 16.388 ns/op 1.08
array of 24000 items push then shift 4.5597 us/op 4.5404 us/op 1.00
LinkedList of 24000 items push then shift 22.614 ns/op 19.891 ns/op 1.14
array of 24000 items push then pop 212.97 ns/op 209.56 ns/op 1.02
LinkedList of 24000 items push then pop 20.071 ns/op 17.631 ns/op 1.14
intersect bitArray bitLen 8 11.748 ns/op 11.748 ns/op 1.00
intersect array and set length 8 174.36 ns/op 160.17 ns/op 1.09
intersect bitArray bitLen 128 62.266 ns/op 62.102 ns/op 1.00
intersect array and set length 128 2.4924 us/op 2.2420 us/op 1.11
Buffer.concat 32 items 1.9900 ns/op 1.9170 ns/op 1.04
pass gossip attestations to forkchoice per slot 5.9123 ms/op 5.3543 ms/op 1.10
computeDeltas 4.1406 ms/op 3.5300 ms/op 1.17
computeProposerBoostScoreFromBalances 907.71 us/op 921.13 us/op 0.99
altair processAttestation - 250000 vs - 7PWei normalcase 3.8974 ms/op 3.7529 ms/op 1.04
altair processAttestation - 250000 vs - 7PWei worstcase 6.6120 ms/op 6.1400 ms/op 1.08
altair processAttestation - setStatus - 1/6 committees join 210.53 us/op 219.89 us/op 0.96
altair processAttestation - setStatus - 1/3 committees join 404.86 us/op 415.46 us/op 0.97
altair processAttestation - setStatus - 1/2 committees join 571.78 us/op 583.85 us/op 0.98
altair processAttestation - setStatus - 2/3 committees join 736.95 us/op 751.17 us/op 0.98
altair processAttestation - setStatus - 4/5 committees join 1.0087 ms/op 1.0279 ms/op 0.98
altair processAttestation - setStatus - 100% committees join 1.1994 ms/op 1.2255 ms/op 0.98
altair processBlock - 250000 vs - 7PWei normalcase 30.040 ms/op 26.308 ms/op 1.14
altair processBlock - 250000 vs - 7PWei normalcase hashState 42.739 ms/op 41.135 ms/op 1.04
altair processBlock - 250000 vs - 7PWei worstcase 75.361 ms/op 80.386 ms/op 0.94
altair processBlock - 250000 vs - 7PWei worstcase hashState 102.17 ms/op 106.67 ms/op 0.96
phase0 processBlock - 250000 vs - 7PWei normalcase 3.9080 ms/op 3.3045 ms/op 1.18
phase0 processBlock - 250000 vs - 7PWei worstcase 47.679 ms/op 44.588 ms/op 1.07
altair processEth1Data - 250000 vs - 7PWei normalcase 950.60 us/op 765.02 us/op 1.24
Tree 40 250000 create 892.35 ms/op 747.33 ms/op 1.19
Tree 40 250000 get(125000) 302.88 ns/op 282.01 ns/op 1.07
Tree 40 250000 set(125000) 2.9966 us/op 2.4763 us/op 1.21
Tree 40 250000 toArray() 34.827 ms/op 35.280 ms/op 0.99
Tree 40 250000 iterate all - toArray() + loop 35.088 ms/op 34.999 ms/op 1.00
Tree 40 250000 iterate all - get(i) 116.24 ms/op 109.13 ms/op 1.07
MutableVector 250000 create 18.896 ms/op 14.314 ms/op 1.32
MutableVector 250000 get(125000) 14.773 ns/op 14.989 ns/op 0.99
MutableVector 250000 set(125000) 704.77 ns/op 626.47 ns/op 1.12
MutableVector 250000 toArray() 8.1209 ms/op 12.023 ms/op 0.68
MutableVector 250000 iterate all - toArray() + loop 8.2514 ms/op 6.5081 ms/op 1.27
MutableVector 250000 iterate all - get(i) 3.4416 ms/op 3.4371 ms/op 1.00
Array 250000 create 7.6404 ms/op 6.0654 ms/op 1.26
Array 250000 clone - spread 4.2616 ms/op 2.5064 ms/op 1.70
Array 250000 get(125000) 1.6840 ns/op 1.1040 ns/op 1.53
Array 250000 set(125000) 1.7180 ns/op 1.0930 ns/op 1.57
Array 250000 iterate all - loop 167.85 us/op 170.54 us/op 0.98
effectiveBalanceIncrements clone Uint8Array 300000 86.454 us/op 60.585 us/op 1.43
effectiveBalanceIncrements clone MutableVector 300000 1.2310 us/op 730.00 ns/op 1.69
effectiveBalanceIncrements rw all Uint8Array 300000 252.64 us/op 254.15 us/op 0.99
effectiveBalanceIncrements rw all MutableVector 300000 227.11 ms/op 155.41 ms/op 1.46
phase0 afterProcessEpoch - 250000 vs - 7PWei 189.26 ms/op 179.60 ms/op 1.05
phase0 beforeProcessEpoch - 250000 vs - 7PWei 77.590 ms/op 71.367 ms/op 1.09
altair processEpoch - mainnet_e81889 599.43 ms/op 573.72 ms/op 1.04
mainnet_e81889 - altair beforeProcessEpoch 163.43 ms/op 151.44 ms/op 1.08
mainnet_e81889 - altair processJustificationAndFinalization 23.620 us/op 36.416 us/op 0.65
mainnet_e81889 - altair processInactivityUpdates 11.550 ms/op 10.408 ms/op 1.11
mainnet_e81889 - altair processRewardsAndPenalties 93.968 ms/op 90.495 ms/op 1.04
mainnet_e81889 - altair processRegistryUpdates 4.4980 us/op 3.4130 us/op 1.32
mainnet_e81889 - altair processSlashings 1.2040 us/op 797.00 ns/op 1.51
mainnet_e81889 - altair processEth1DataReset 1.2180 us/op 807.00 ns/op 1.51
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.2553 ms/op 2.2550 ms/op 1.00
mainnet_e81889 - altair processSlashingsReset 5.4340 us/op 8.0860 us/op 0.67
mainnet_e81889 - altair processRandaoMixesReset 5.2950 us/op 7.3020 us/op 0.73
mainnet_e81889 - altair processHistoricalRootsUpdate 889.00 ns/op 924.00 ns/op 0.96
mainnet_e81889 - altair processParticipationFlagUpdates 3.0110 us/op 3.8370 us/op 0.78
mainnet_e81889 - altair processSyncCommitteeUpdates 1.0650 us/op 843.00 ns/op 1.26
mainnet_e81889 - altair afterProcessEpoch 197.13 ms/op 192.20 ms/op 1.03
phase0 processEpoch - mainnet_e58758 546.57 ms/op 523.16 ms/op 1.04
mainnet_e58758 - phase0 beforeProcessEpoch 249.06 ms/op 223.73 ms/op 1.11
mainnet_e58758 - phase0 processJustificationAndFinalization 25.313 us/op 19.323 us/op 1.31
mainnet_e58758 - phase0 processRewardsAndPenalties 143.96 ms/op 116.16 ms/op 1.24
mainnet_e58758 - phase0 processRegistryUpdates 9.5390 us/op 9.4990 us/op 1.00
mainnet_e58758 - phase0 processSlashings 771.00 ns/op 743.00 ns/op 1.04
mainnet_e58758 - phase0 processEth1DataReset 869.00 ns/op 774.00 ns/op 1.12
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.3652 ms/op 2.2768 ms/op 1.04
mainnet_e58758 - phase0 processSlashingsReset 5.4320 us/op 4.7260 us/op 1.15
mainnet_e58758 - phase0 processRandaoMixesReset 6.2030 us/op 5.4850 us/op 1.13
mainnet_e58758 - phase0 processHistoricalRootsUpdate 815.00 ns/op 848.00 ns/op 0.96
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.6470 us/op 4.6860 us/op 0.99
mainnet_e58758 - phase0 afterProcessEpoch 161.55 ms/op 157.66 ms/op 1.02
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.6321 ms/op 2.6286 ms/op 1.00
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.4298 ms/op 3.4782 ms/op 0.99
altair processInactivityUpdates - 250000 normalcase 43.181 ms/op 40.804 ms/op 1.06
altair processInactivityUpdates - 250000 worstcase 48.482 ms/op 49.429 ms/op 0.98
phase0 processRegistryUpdates - 250000 normalcase 10.019 us/op 8.0510 us/op 1.24
phase0 processRegistryUpdates - 250000 badcase_full_deposits 575.53 us/op 407.29 us/op 1.41
phase0 processRegistryUpdates - 250000 worstcase 0.5 221.14 ms/op 207.26 ms/op 1.07
altair processRewardsAndPenalties - 250000 normalcase 132.40 ms/op 127.14 ms/op 1.04
altair processRewardsAndPenalties - 250000 worstcase 88.715 ms/op 85.238 ms/op 1.04
phase0 getAttestationDeltas - 250000 normalcase 13.896 ms/op 13.274 ms/op 1.05
phase0 getAttestationDeltas - 250000 worstcase 13.880 ms/op 13.435 ms/op 1.03
phase0 processSlashings - 250000 worstcase 5.5964 ms/op 5.3181 ms/op 1.05
altair processSyncCommitteeUpdates - 250000 282.13 ms/op 280.52 ms/op 1.01
BeaconState.hashTreeRoot - No change 517.00 ns/op 472.00 ns/op 1.10
BeaconState.hashTreeRoot - 1 full validator 62.267 us/op 61.596 us/op 1.01
BeaconState.hashTreeRoot - 32 full validator 1.1040 ms/op 703.25 us/op 1.57
BeaconState.hashTreeRoot - 512 full validator 6.6103 ms/op 6.8897 ms/op 0.96
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 73.383 us/op 78.519 us/op 0.93
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.1630 ms/op 1.1671 ms/op 1.00
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 15.761 ms/op 15.668 ms/op 1.01
BeaconState.hashTreeRoot - 1 balances 58.310 us/op 63.303 us/op 0.92
BeaconState.hashTreeRoot - 32 balances 561.63 us/op 576.71 us/op 0.97
BeaconState.hashTreeRoot - 512 balances 5.9028 ms/op 5.9953 ms/op 0.98
BeaconState.hashTreeRoot - 250000 balances 97.619 ms/op 87.169 ms/op 1.12
aggregationBits - 2048 els - zipIndexesInBitList 30.565 us/op 29.773 us/op 1.03
regular array get 100000 times 67.429 us/op 67.529 us/op 1.00
wrappedArray get 100000 times 67.425 us/op 67.416 us/op 1.00
arrayWithProxy get 100000 times 28.771 ms/op 28.832 ms/op 1.00
ssz.Root.equals 471.00 ns/op 477.00 ns/op 0.99
byteArrayEquals 452.00 ns/op 468.00 ns/op 0.97
shuffle list - 16384 els 11.238 ms/op 10.962 ms/op 1.03
shuffle list - 250000 els 165.41 ms/op 162.36 ms/op 1.02
processSlot - 1 slots 12.097 us/op 12.251 us/op 0.99
processSlot - 32 slots 1.7248 ms/op 1.7459 ms/op 0.99
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 415.02 us/op 374.04 us/op 1.11
getCommitteeAssignments - req 1 vs - 250000 vc 5.3408 ms/op 5.2909 ms/op 1.01
getCommitteeAssignments - req 100 vs - 250000 vc 7.3540 ms/op 7.3369 ms/op 1.00
getCommitteeAssignments - req 1000 vs - 250000 vc 7.7661 ms/op 7.7867 ms/op 1.00
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 9.8600 ns/op 10.190 ns/op 0.97
state getBlockRootAtSlot - 250000 vs - 7PWei 1.1728 us/op 1.1049 us/op 1.06
computeProposers - vc 250000 16.559 ms/op 16.643 ms/op 0.99
computeEpochShuffling - vc 250000 170.36 ms/op 165.36 ms/op 1.03
getNextSyncCommittee - vc 250000 271.90 ms/op 273.94 ms/op 0.99

by benchmarkbot/action

@philknows philknows added this to the v1.1.0 milestone Sep 6, 2022
@g11tech g11tech marked this pull request as ready for review September 7, 2022 17:20
@g11tech g11tech requested a review from a team as a code owner September 7, 2022 17:20
@@ -152,6 +161,12 @@ export const validatorOptions: ICliCommandOptions<IValidatorCliArgs> = {
type: "string",
},

flushKeymanagerProposerConfigs: {
description: "If keymanager's persisted proposer configs are found, delete them all!",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a very strange flag, is this really necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this to to clear keymanager proposer configs, although name can be better 🙂 , any suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the usecase? There's the delete API for that right?

Copy link
Contributor Author

@g11tech g11tech Sep 9, 2022

Choose a reason for hiding this comment

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

the use case is you used keymanager api to make proposer data updates, and now want to discard it and switch to proposerFileConfig. Since now proposerFileConfig flag will error since we don't accept proposerFileConfig if there is keymanager persisted proposer data, this flag can be used to discard and clean keymanagaer persisted configs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed the flag! and recommended manual deletion in case of conflict 👍

builder.enabled !== undefined ||
builder.gasLimit !== undefined
) {
proposerConfig = {graffiti, strictFeeRecipientCheck, feeRecipient, builder};
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the ValidatorStore really need to know about the idea of a proposerConfig? Feels like it's the API role to construct this object from the other methods

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ummm i don't find the idea of ValidatorStore knowing about the proposer config odd as we also pass proposer data in the addSigner now.
Other getters anyway return defaults if the that particular property is not assigned.

valProposerConfig = parseProposerConfig(args.proposerSettingsFile, defaultConfig);
} else {
valProposerConfig = {defaultConfig} as ValidatorProposerConfig;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider moving to a function below the handler getValProposerConfig(args): ValidatorProposerConfig

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you mean separate out this parseProposerConfig section from getProposerConfigFromArgs?

@g11tech g11tech enabled auto-merge (squash) September 12, 2022 12:05
Copy link
Contributor

@dapplion dapplion left a comment

Choose a reason for hiding this comment

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

Looks good thanks for those sweet e2e tests ❤️

Some comments that are addressable post merge:

  • Should builder.enabled and builder.gasLimit be flattened in ProposerConfig?
  • The logic of getProposerConfig says that if some property is set everything else won't be applied defaults. Is that expected behaviour? This function is only used in the API but not in the validator store to perform duties right?

@g11tech g11tech merged commit 2c41af0 into unstable Sep 12, 2022
@g11tech g11tech deleted the g11tech/keymanager-fee-gas branch September 12, 2022 16:12
@g11tech
Copy link
Contributor Author

g11tech commented Sep 12, 2022

Looks good thanks for those sweet e2e tests heart

Some comments that are addressable post merge:

* Should builder.enabled and builder.gasLimit be flattened in ProposerConfig?

* The logic of getProposerConfig says that if some property is set everything else won't be applied defaults. Is that expected behaviour? This function is only used in the API but not in the validator store to perform duties right?

ummm actually, i should rename getProposerConfig to getOverrideProposerConfig, this is to only get the overrides to persist for keymanager.

Else, individual gets of feeRecipient, gasLimit which is what we actually use are backed by defaults

I like your idea idea on flattening the builder params 👍 , how about builder.enabled and builder.gasLimit?

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.

Feature: Implement keymanager API feerecipient Feature: Implement key manager API gas_limit
4 participants