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

exchangeTransitionConfiguration heartbeat implementation #3785

Closed
wants to merge 1 commit into from

Conversation

g11tech
Copy link
Contributor

@g11tech g11tech commented Feb 24, 2022

Motivation
Execution engines will now hosts an api to specify and match transition configuration ethereum/execution-apis#172, which is supposed to act as a heatbeat between EL and CL.

This PR implements and matches the same and aims to implements the heart beat functionality
Description
PS: this work is currently WIP and some details/clarifications are awaited. Also this is not the part of Kiln v2 spec.
Part of Kiln tracker

@g11tech g11tech marked this pull request as draft February 24, 2022 20:25
@github-actions
Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 2886203 Previous: a222e42 Ratio
BeaconState.hashTreeRoot - No change 571.00 ns/op 635.00 ns/op 0.90
BeaconState.hashTreeRoot - 1 full validator 124.27 us/op 164.82 us/op 0.75
BeaconState.hashTreeRoot - 32 full validator 1.8735 ms/op 2.4429 ms/op 0.77
BeaconState.hashTreeRoot - 512 full validator 25.695 ms/op 33.121 ms/op 0.78
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 125.60 us/op 168.85 us/op 0.74
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.3503 ms/op 2.8833 ms/op 0.82
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 28.183 ms/op 35.029 ms/op 0.80
BeaconState.hashTreeRoot - 1 balances 86.214 us/op 114.06 us/op 0.76
BeaconState.hashTreeRoot - 32 balances 765.21 us/op 952.03 us/op 0.80
BeaconState.hashTreeRoot - 512 balances 7.4715 ms/op 9.1126 ms/op 0.82
BeaconState.hashTreeRoot - 250000 balances 136.36 ms/op 174.74 ms/op 0.78
processSlot - 1 slots 50.229 us/op 73.279 us/op 0.69
processSlot - 32 slots 2.9673 ms/op 3.9761 ms/op 0.75
getCommitteeAssignments - req 1 vs - 250000 vc 5.2472 ms/op 5.3792 ms/op 0.98
getCommitteeAssignments - req 100 vs - 250000 vc 7.2745 ms/op 7.7328 ms/op 0.94
getCommitteeAssignments - req 1000 vs - 250000 vc 7.7685 ms/op 8.9325 ms/op 0.87
computeProposers - vc 250000 21.535 ms/op 28.462 ms/op 0.76
computeEpochShuffling - vc 250000 188.55 ms/op 214.59 ms/op 0.88
getNextSyncCommittee - vc 250000 352.25 ms/op 465.50 ms/op 0.76
altair processAttestation - 250000 vs - 7PWei normalcase 35.039 ms/op 45.107 ms/op 0.78
altair processAttestation - 250000 vs - 7PWei worstcase 34.126 ms/op 44.384 ms/op 0.77
altair processAttestation - setStatus - 1/6 committees join 10.452 ms/op 15.744 ms/op 0.66
altair processAttestation - setStatus - 1/3 committees join 23.274 ms/op 32.068 ms/op 0.73
altair processAttestation - setStatus - 1/2 committees join 35.143 ms/op 47.967 ms/op 0.73
altair processAttestation - setStatus - 2/3 committees join 47.409 ms/op 63.298 ms/op 0.75
altair processAttestation - setStatus - 4/5 committees join 57.982 ms/op 75.258 ms/op 0.77
altair processAttestation - setStatus - 100% committees join 71.520 ms/op 90.781 ms/op 0.79
altair processAttestation - updateEpochParticipants - 1/6 committees join 12.628 ms/op 15.811 ms/op 0.80
altair processAttestation - updateEpochParticipants - 1/3 committees join 26.107 ms/op 32.745 ms/op 0.80
altair processAttestation - updateEpochParticipants - 1/2 committees join 21.644 ms/op 23.451 ms/op 0.92
altair processAttestation - updateEpochParticipants - 2/3 committees join 25.767 ms/op 24.696 ms/op 1.04
altair processAttestation - updateEpochParticipants - 4/5 committees join 23.691 ms/op 25.829 ms/op 0.92
altair processAttestation - updateEpochParticipants - 100% committees join 25.073 ms/op 28.431 ms/op 0.88
altair processAttestation - updateAllStatus 19.728 ms/op 20.442 ms/op 0.97
altair processBlock - 250000 vs - 7PWei normalcase 32.465 ms/op 38.019 ms/op 0.85
altair processBlock - 250000 vs - 7PWei worstcase 99.221 ms/op 127.67 ms/op 0.78
altair processEpoch - mainnet_e81889 804.17 ms/op 934.12 ms/op 0.86
mainnet_e81889 - altair beforeProcessEpoch 335.59 ms/op 389.18 ms/op 0.86
mainnet_e81889 - altair processJustificationAndFinalization 50.547 us/op 126.22 us/op 0.40
mainnet_e81889 - altair processInactivityUpdates 18.253 ms/op 20.124 ms/op 0.91
mainnet_e81889 - altair processRewardsAndPenalties 97.952 ms/op 114.41 ms/op 0.86
mainnet_e81889 - altair processRegistryUpdates 5.9990 us/op 22.946 us/op 0.26
mainnet_e81889 - altair processSlashings 1.0400 us/op 6.6390 us/op 0.16
mainnet_e81889 - altair processEth1DataReset 1.0720 us/op 6.0790 us/op 0.18
mainnet_e81889 - altair processEffectiveBalanceUpdates 6.5632 ms/op 7.8439 ms/op 0.84
mainnet_e81889 - altair processSlashingsReset 8.6350 us/op 34.158 us/op 0.25
mainnet_e81889 - altair processRandaoMixesReset 11.846 us/op 45.448 us/op 0.26
mainnet_e81889 - altair processHistoricalRootsUpdate 1.4500 us/op 8.5790 us/op 0.17
mainnet_e81889 - altair processParticipationFlagUpdates 70.314 ms/op 92.676 ms/op 0.76
mainnet_e81889 - altair processSyncCommitteeUpdates 1.0510 us/op 7.2570 us/op 0.14
mainnet_e81889 - altair afterProcessEpoch 222.87 ms/op 255.63 ms/op 0.87
altair processInactivityUpdates - 250000 normalcase 68.800 ms/op 90.199 ms/op 0.76
altair processInactivityUpdates - 250000 worstcase 70.160 ms/op 98.479 ms/op 0.71
altair processParticipationFlagUpdates - 250000 anycase 54.257 ms/op 75.601 ms/op 0.72
altair processRewardsAndPenalties - 250000 normalcase 98.603 ms/op 102.83 ms/op 0.96
altair processRewardsAndPenalties - 250000 worstcase 93.754 ms/op 120.37 ms/op 0.78
altair processSyncCommitteeUpdates - 250000 349.22 ms/op 455.81 ms/op 0.77
Tree 40 250000 create 614.85 ms/op 921.46 ms/op 0.67
Tree 40 250000 get(125000) 330.04 ns/op 353.15 ns/op 0.93
Tree 40 250000 set(125000) 1.9670 us/op 3.1146 us/op 0.63
Tree 40 250000 toArray() 41.462 ms/op 54.203 ms/op 0.76
Tree 40 250000 iterate all - toArray() + loop 43.506 ms/op 48.140 ms/op 0.90
Tree 40 250000 iterate all - get(i) 125.09 ms/op 138.37 ms/op 0.90
MutableVector 250000 create 21.338 ms/op 21.288 ms/op 1.00
MutableVector 250000 get(125000) 12.490 ns/op 17.657 ns/op 0.71
MutableVector 250000 set(125000) 559.10 ns/op 673.36 ns/op 0.83
MutableVector 250000 toArray() 8.8285 ms/op 9.8059 ms/op 0.90
MutableVector 250000 iterate all - toArray() + loop 8.8797 ms/op 10.014 ms/op 0.89
MutableVector 250000 iterate all - get(i) 3.3539 ms/op 3.6650 ms/op 0.92
Array 250000 create 5.7573 ms/op 5.6774 ms/op 1.01
Array 250000 clone - spread 2.1496 ms/op 2.2052 ms/op 0.97
Array 250000 get(125000) 1.0120 ns/op 1.1260 ns/op 0.90
Array 250000 set(125000) 1.0230 ns/op 1.1090 ns/op 0.92
Array 250000 iterate all - loop 168.95 us/op 148.23 us/op 1.14
effectiveBalanceIncrements clone Uint8Array 300000 73.990 us/op 237.35 us/op 0.31
effectiveBalanceIncrements clone MutableVector 300000 646.00 ns/op 564.00 ns/op 1.15
effectiveBalanceIncrements rw all Uint8Array 300000 301.80 us/op 203.47 us/op 1.48
effectiveBalanceIncrements rw all MutableVector 300000 191.46 ms/op 218.67 ms/op 0.88
aggregationBits - 2048 els - readonlyValues 194.43 us/op 217.69 us/op 0.89
aggregationBits - 2048 els - zipIndexesInBitList 39.503 us/op 40.280 us/op 0.98
regular array get 100000 times 67.391 us/op 59.636 us/op 1.13
wrappedArray get 100000 times 67.455 us/op 59.417 us/op 1.14
arrayWithProxy get 100000 times 29.024 ms/op 44.821 ms/op 0.65
ssz.Root.equals 1.1460 us/op 1.2770 us/op 0.90
ssz.Root.equals with valueOf() 1.3630 us/op 1.4120 us/op 0.97
byteArrayEquals with valueOf() 1.3320 us/op 1.3990 us/op 0.95
phase0 processBlock - 250000 vs - 7PWei normalcase 8.1629 ms/op 10.526 ms/op 0.78
phase0 processBlock - 250000 vs - 7PWei worstcase 76.038 ms/op 90.445 ms/op 0.84
phase0 afterProcessEpoch - 250000 vs - 7PWei 206.40 ms/op 221.89 ms/op 0.93
phase0 beforeProcessEpoch - 250000 vs - 7PWei 591.55 ms/op 690.97 ms/op 0.86
phase0 processEpoch - mainnet_e58758 786.96 ms/op 923.46 ms/op 0.85
mainnet_e58758 - phase0 beforeProcessEpoch 461.94 ms/op 532.15 ms/op 0.87
mainnet_e58758 - phase0 processJustificationAndFinalization 50.242 us/op 111.25 us/op 0.45
mainnet_e58758 - phase0 processRewardsAndPenalties 113.91 ms/op 126.45 ms/op 0.90
mainnet_e58758 - phase0 processRegistryUpdates 35.756 us/op 85.017 us/op 0.42
mainnet_e58758 - phase0 processSlashings 1.2750 us/op 6.2920 us/op 0.20
mainnet_e58758 - phase0 processEth1DataReset 1.4420 us/op 5.8190 us/op 0.25
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 5.4151 ms/op 5.8145 ms/op 0.93
mainnet_e58758 - phase0 processSlashingsReset 7.9300 us/op 29.945 us/op 0.26
mainnet_e58758 - phase0 processRandaoMixesReset 11.864 us/op 35.006 us/op 0.34
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.2790 us/op 8.1600 us/op 0.16
mainnet_e58758 - phase0 processParticipationRecordUpdates 8.4150 us/op 30.727 us/op 0.27
mainnet_e58758 - phase0 afterProcessEpoch 178.76 ms/op 193.39 ms/op 0.92
phase0 processEffectiveBalanceUpdates - 250000 normalcase 6.2396 ms/op 6.7626 ms/op 0.92
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 6.6564 ms/op 7.2546 ms/op 0.92
phase0 processRegistryUpdates - 250000 normalcase 35.348 us/op 93.540 us/op 0.38
phase0 processRegistryUpdates - 250000 badcase_full_deposits 3.0010 ms/op 4.2855 ms/op 0.70
phase0 processRegistryUpdates - 250000 worstcase 0.5 1.6541 s/op 2.4120 s/op 0.69
phase0 getAttestationDeltas - 250000 normalcase 13.377 ms/op 14.599 ms/op 0.92
phase0 getAttestationDeltas - 250000 worstcase 13.442 ms/op 15.045 ms/op 0.89
phase0 processSlashings - 250000 worstcase 36.161 ms/op 39.444 ms/op 0.92
shuffle list - 16384 els 13.049 ms/op 14.739 ms/op 0.89
shuffle list - 250000 els 185.82 ms/op 198.61 ms/op 0.94
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 434.14 us/op 1.0953 ms/op 0.40
pass gossip attestations to forkchoice per slot 16.833 ms/op 23.791 ms/op 0.71
computeDeltas 4.0385 ms/op 4.0943 ms/op 0.99
computeProposerBoostScoreFromBalances 503.38 us/op 475.67 us/op 1.06
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.0792 ms/op 2.1018 ms/op 0.99
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 730.51 us/op 736.86 us/op 0.99
BLS verify - blst-native 1.8593 ms/op 2.1888 ms/op 0.85
BLS verifyMultipleSignatures 3 - blst-native 3.8142 ms/op 4.5778 ms/op 0.83
BLS verifyMultipleSignatures 8 - blst-native 8.2296 ms/op 9.5036 ms/op 0.87
BLS verifyMultipleSignatures 32 - blst-native 29.878 ms/op 34.415 ms/op 0.87
BLS aggregatePubkeys 32 - blst-native 39.751 us/op 48.322 us/op 0.82
BLS aggregatePubkeys 128 - blst-native 154.05 us/op 184.63 us/op 0.83
getAttestationsForBlock 66.875 ms/op 67.911 ms/op 0.98
CheckpointStateCache - add get delete 19.159 us/op 21.609 us/op 0.89
validate gossip signedAggregateAndProof - struct 4.4659 ms/op 5.2597 ms/op 0.85
validate gossip signedAggregateAndProof - treeBacked 4.4049 ms/op 5.0580 ms/op 0.87
validate gossip attestation - struct 2.0865 ms/op 2.4447 ms/op 0.85
validate gossip attestation - treeBacked 2.1278 ms/op 2.4215 ms/op 0.88
pickEth1Vote - no votes 9.7266 ms/op 9.7080 ms/op 1.00
pickEth1Vote - max votes 54.190 ms/op 60.912 ms/op 0.89
pickEth1Vote - Eth1Data hashTreeRoot value x2048 25.060 ms/op 28.530 ms/op 0.88
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 9.7894 ms/op 11.210 ms/op 0.87
pickEth1Vote - Eth1Data fastSerialize value x2048 5.2461 ms/op 5.8430 ms/op 0.90
pickEth1Vote - Eth1Data fastSerialize tree x2048 24.959 ms/op 35.271 ms/op 0.71
bytes32 toHexString 1.7170 us/op 2.0050 us/op 0.86
bytes32 Buffer.toString(hex) 713.00 ns/op 812.00 ns/op 0.88
bytes32 Buffer.toString(hex) from Uint8Array 878.00 ns/op 1.0740 us/op 0.82
bytes32 Buffer.toString(hex) + 0x 709.00 ns/op 793.00 ns/op 0.89
Object access 1 prop 0.34600 ns/op 0.38800 ns/op 0.89
Map access 1 prop 0.29300 ns/op 0.32900 ns/op 0.89
Object get x1000 17.745 ns/op 16.495 ns/op 1.08
Map get x1000 1.0180 ns/op 0.94700 ns/op 1.07
Object set x1000 111.58 ns/op 115.15 ns/op 0.97
Map set x1000 67.199 ns/op 72.667 ns/op 0.92
Return object 10000 times 0.37320 ns/op 0.40230 ns/op 0.93
Throw Error 10000 times 5.8460 us/op 6.4981 us/op 0.90
enrSubnets - fastDeserialize 64 bits 1.2620 us/op 1.3320 us/op 0.95
enrSubnets - ssz BitVector 64 bits 16.514 us/op 17.914 us/op 0.92
enrSubnets - fastDeserialize 4 bits 464.00 ns/op 483.00 ns/op 0.96
enrSubnets - ssz BitVector 4 bits 3.0220 us/op 3.0100 us/op 1.00
RateTracker 1000000 limit, 1 obj count per request 188.24 ns/op 209.33 ns/op 0.90
RateTracker 1000000 limit, 2 obj count per request 145.72 ns/op 148.58 ns/op 0.98
RateTracker 1000000 limit, 4 obj count per request 124.81 ns/op 119.02 ns/op 1.05
RateTracker 1000000 limit, 8 obj count per request 114.80 ns/op 112.94 ns/op 1.02
RateTracker with prune 4.0190 us/op 4.8280 us/op 0.83
array of 16000 items push then shift 3.1719 us/op 5.0791 us/op 0.62
LinkedList of 16000 items push then shift 18.053 ns/op 18.203 ns/op 0.99
array of 16000 items push then pop 214.82 ns/op 229.63 ns/op 0.94
LinkedList of 16000 items push then pop 17.117 ns/op 17.423 ns/op 0.98
array of 24000 items push then shift 4.5641 us/op 7.6547 us/op 0.60
LinkedList of 24000 items push then shift 22.597 ns/op 18.509 ns/op 1.22
array of 24000 items push then pop 191.17 ns/op 218.63 ns/op 0.87
LinkedList of 24000 items push then pop 19.799 ns/op 16.304 ns/op 1.21

by benchmarkbot/action

this.rpc =
rpc ??
new JsonRpcHttpClient(opts.urls, {
signal,
timeout: opts.timeout,
});
void this.exchangeTransitionConfiguration();
Copy link
Contributor

Choose a reason for hiding this comment

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

void Promise that may reject is a bad idea.

transitionConfig.terminalBlockHash !== this.transitionConfig.terminalBlockHash ||
transitionConfig.terminalBlockNumber !== this.transitionConfig.terminalBlockNumber
) {
throw Error(
Copy link
Contributor

Choose a reason for hiding this comment

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

This http engine should not be responsible to throw this Error. There should be something at a higher level that does this recurring calls and logs loudly if there's a mismatch. Keep in mind that there may be multiple transports in the future besides http. The return of this function could be a status

type ReturnType = {match: true} | {match: false; local: TransitionConfig; remote: TransitionConfig}

}
// Use this lastHeartBeatAt in the actual engine api calls to identify if this needs to
// be called again
this.lastHeartBeatAt = Math.floor(new Date().getTime() / 1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

This class should not be responsible to track the frequency of calls, this class should be state-less

@g11tech g11tech mentioned this pull request Apr 22, 2022
22 tasks
@dapplion dapplion changed the base branch from master to unstable May 27, 2022 04:35
@dapplion dapplion dismissed a stale review May 27, 2022 04:35

The base branch was changed.

@g11tech
Copy link
Contributor Author

g11tech commented Aug 5, 2022

closing this to begin afresh as the code has diverged quite a bit

@g11tech g11tech closed this Aug 5, 2022
@g11tech g11tech deleted the g11tech/exetransconfig branch August 5, 2022 11:02
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