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

Do not check for know attesters when publishing AggregateAndProof #4092

Merged
merged 2 commits into from
May 31, 2022

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented May 31, 2022

Motivation

Fix ropsten error

Error publishing aggregateAndProofs slot=3542, index=20 Internal Server Error: ATTESTATION_ERROR_ATTESTERS_ALREADY_KNOWN
Error: Internal Server Error: ATTESTATION_ERROR_ATTESTERS_ALREADY_KNOWN

Description

Due to #4019, we filter a lot of AggregateAndProof with known attesters. We should not have that check at api side.

Closes #4089

@@ -14,7 +14,8 @@ import {getCommitteeIndices, verifyHeadBlockAndTargetRoot, verifyPropagationSlot

export async function validateGossipAggregateAndProof(
chain: IBeaconChain,
signedAggregateAndProof: phase0.SignedAggregateAndProof
signedAggregateAndProof: phase0.SignedAggregateAndProof,
validateKnownAttesters: boolean = true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's best to have a default that's the falsy value. For example use as variable: skipValidationKnownAttesters

@github-actions
Copy link
Contributor

github-actions bot commented May 31, 2022

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 8781d6a Previous: d5d3d6b Ratio
BeaconState.hashTreeRoot - No change 527.00 ns/op 534.00 ns/op 0.99
BeaconState.hashTreeRoot - 1 full validator 67.869 us/op 68.019 us/op 1.00
BeaconState.hashTreeRoot - 32 full validator 670.02 us/op 687.93 us/op 0.97
BeaconState.hashTreeRoot - 512 full validator 6.8565 ms/op 7.3072 ms/op 0.94
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 85.761 us/op 86.953 us/op 0.99
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.1824 ms/op 1.1937 ms/op 0.99
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 16.365 ms/op 16.336 ms/op 1.00
BeaconState.hashTreeRoot - 1 balances 66.826 us/op 65.927 us/op 1.01
BeaconState.hashTreeRoot - 32 balances 564.90 us/op 570.71 us/op 0.99
BeaconState.hashTreeRoot - 512 balances 5.6896 ms/op 5.5274 ms/op 1.03
BeaconState.hashTreeRoot - 250000 balances 119.68 ms/op 125.37 ms/op 0.95
processSlot - 1 slots 13.600 us/op 12.630 us/op 1.08
processSlot - 32 slots 1.9842 ms/op 1.9256 ms/op 1.03
getCommitteeAssignments - req 1 vs - 250000 vc 5.5499 ms/op 6.5733 ms/op 0.84
getCommitteeAssignments - req 100 vs - 250000 vc 7.7948 ms/op 9.0007 ms/op 0.87
getCommitteeAssignments - req 1000 vs - 250000 vc 8.5218 ms/op 9.7818 ms/op 0.87
computeProposers - vc 250000 20.771 ms/op 19.248 ms/op 1.08
computeEpochShuffling - vc 250000 182.83 ms/op 204.01 ms/op 0.90
getNextSyncCommittee - vc 250000 332.89 ms/op 315.79 ms/op 1.05
altair processAttestation - 250000 vs - 7PWei normalcase 4.7182 ms/op 4.1682 ms/op 1.13
altair processAttestation - 250000 vs - 7PWei worstcase 6.6648 ms/op 6.0953 ms/op 1.09
altair processAttestation - setStatus - 1/6 committees join 208.82 us/op 236.76 us/op 0.88
altair processAttestation - setStatus - 1/3 committees join 383.77 us/op 446.12 us/op 0.86
altair processAttestation - setStatus - 1/2 committees join 552.76 us/op 623.53 us/op 0.89
altair processAttestation - setStatus - 2/3 committees join 770.91 us/op 833.56 us/op 0.92
altair processAttestation - setStatus - 4/5 committees join 1.0906 ms/op 1.1410 ms/op 0.96
altair processAttestation - setStatus - 100% committees join 1.2813 ms/op 1.3437 ms/op 0.95
altair processBlock - 250000 vs - 7PWei normalcase 33.249 ms/op 28.686 ms/op 1.16
altair processBlock - 250000 vs - 7PWei normalcase hashState 42.787 ms/op 39.130 ms/op 1.09
altair processBlock - 250000 vs - 7PWei worstcase 84.653 ms/op 86.454 ms/op 0.98
altair processBlock - 250000 vs - 7PWei worstcase hashState 124.55 ms/op 115.59 ms/op 1.08
altair processEth1Data - 250000 vs - 7PWei normalcase 823.10 us/op 969.79 us/op 0.85
altair processEpoch - mainnet_e81889 605.66 ms/op 653.52 ms/op 0.93
mainnet_e81889 - altair beforeProcessEpoch 165.46 ms/op 149.41 ms/op 1.11
mainnet_e81889 - altair processJustificationAndFinalization 63.532 us/op 33.780 us/op 1.88
mainnet_e81889 - altair processInactivityUpdates 11.465 ms/op 13.240 ms/op 0.87
mainnet_e81889 - altair processRewardsAndPenalties 147.44 ms/op 159.40 ms/op 0.92
mainnet_e81889 - altair processRegistryUpdates 14.306 us/op 6.7820 us/op 2.11
mainnet_e81889 - altair processSlashings 4.3590 us/op 2.3360 us/op 1.87
mainnet_e81889 - altair processEth1DataReset 5.0120 us/op 1.9570 us/op 2.56
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.4007 ms/op 3.1090 ms/op 0.77
mainnet_e81889 - altair processSlashingsReset 20.445 us/op 9.8740 us/op 2.07
mainnet_e81889 - altair processRandaoMixesReset 24.978 us/op 12.068 us/op 2.07
mainnet_e81889 - altair processHistoricalRootsUpdate 4.4020 us/op 2.1440 us/op 2.05
mainnet_e81889 - altair processParticipationFlagUpdates 15.078 us/op 5.7350 us/op 2.63
mainnet_e81889 - altair processSyncCommitteeUpdates 3.9100 us/op 1.8950 us/op 2.06
mainnet_e81889 - altair afterProcessEpoch 196.11 ms/op 235.64 ms/op 0.83
altair processInactivityUpdates - 250000 normalcase 40.454 ms/op 39.024 ms/op 1.04
altair processInactivityUpdates - 250000 worstcase 33.940 ms/op 33.624 ms/op 1.01
altair processRewardsAndPenalties - 250000 normalcase 138.01 ms/op 151.16 ms/op 0.91
altair processRewardsAndPenalties - 250000 worstcase 83.039 ms/op 89.842 ms/op 0.92
altair processSyncCommitteeUpdates - 250000 312.48 ms/op 327.61 ms/op 0.95
Tree 40 250000 create 925.68 ms/op 882.91 ms/op 1.05
Tree 40 250000 get(125000) 329.09 ns/op 344.36 ns/op 0.96
Tree 40 250000 set(125000) 3.2295 us/op 2.6228 us/op 1.23
Tree 40 250000 toArray() 35.762 ms/op 36.367 ms/op 0.98
Tree 40 250000 iterate all - toArray() + loop 37.145 ms/op 37.792 ms/op 0.98
Tree 40 250000 iterate all - get(i) 139.28 ms/op 133.79 ms/op 1.04
MutableVector 250000 create 18.235 ms/op 17.632 ms/op 1.03
MutableVector 250000 get(125000) 14.723 ns/op 15.974 ns/op 0.92
MutableVector 250000 set(125000) 836.18 ns/op 732.15 ns/op 1.14
MutableVector 250000 toArray() 7.0537 ms/op 7.7001 ms/op 0.92
MutableVector 250000 iterate all - toArray() + loop 7.0317 ms/op 7.9299 ms/op 0.89
MutableVector 250000 iterate all - get(i) 3.3436 ms/op 4.0330 ms/op 0.83
Array 250000 create 6.7103 ms/op 6.5880 ms/op 1.02
Array 250000 clone - spread 3.9882 ms/op 4.1583 ms/op 0.96
Array 250000 get(125000) 1.5660 ns/op 1.7560 ns/op 0.89
Array 250000 set(125000) 1.4600 ns/op 1.7320 ns/op 0.84
Array 250000 iterate all - loop 125.77 us/op 207.18 us/op 0.61
effectiveBalanceIncrements clone Uint8Array 300000 466.06 us/op 89.042 us/op 5.23
effectiveBalanceIncrements clone MutableVector 300000 909.00 ns/op 765.00 ns/op 1.19
effectiveBalanceIncrements rw all Uint8Array 300000 254.45 us/op 310.86 us/op 0.82
effectiveBalanceIncrements rw all MutableVector 300000 206.95 ms/op 186.08 ms/op 1.11
aggregationBits - 2048 els - zipIndexesInBitList 28.038 us/op 29.656 us/op 0.95
regular array get 100000 times 54.342 us/op 81.756 us/op 0.66
wrappedArray get 100000 times 54.354 us/op 83.395 us/op 0.65
arrayWithProxy get 100000 times 41.593 ms/op 41.800 ms/op 1.00
ssz.Root.equals 574.00 ns/op 537.00 ns/op 1.07
byteArrayEquals 575.00 ns/op 531.00 ns/op 1.08
phase0 processBlock - 250000 vs - 7PWei normalcase 4.4609 ms/op 4.0504 ms/op 1.10
phase0 processBlock - 250000 vs - 7PWei worstcase 57.080 ms/op 54.110 ms/op 1.05
phase0 afterProcessEpoch - 250000 vs - 7PWei 204.69 ms/op 224.69 ms/op 0.91
phase0 beforeProcessEpoch - 250000 vs - 7PWei 85.223 ms/op 78.984 ms/op 1.08
phase0 processEpoch - mainnet_e58758 550.71 ms/op 595.85 ms/op 0.92
mainnet_e58758 - phase0 beforeProcessEpoch 253.27 ms/op 255.19 ms/op 0.99
mainnet_e58758 - phase0 processJustificationAndFinalization 60.128 us/op 34.085 us/op 1.76
mainnet_e58758 - phase0 processRewardsAndPenalties 138.43 ms/op 149.36 ms/op 0.93
mainnet_e58758 - phase0 processRegistryUpdates 32.642 us/op 17.092 us/op 1.91
mainnet_e58758 - phase0 processSlashings 3.8390 us/op 2.0250 us/op 1.90
mainnet_e58758 - phase0 processEth1DataReset 4.1780 us/op 2.0660 us/op 2.02
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.5291 ms/op 2.8014 ms/op 0.90
mainnet_e58758 - phase0 processSlashingsReset 19.243 us/op 9.9250 us/op 1.94
mainnet_e58758 - phase0 processRandaoMixesReset 24.621 us/op 10.519 us/op 2.34
mainnet_e58758 - phase0 processHistoricalRootsUpdate 4.6300 us/op 2.3080 us/op 2.01
mainnet_e58758 - phase0 processParticipationRecordUpdates 24.864 us/op 11.520 us/op 2.16
mainnet_e58758 - phase0 afterProcessEpoch 154.04 ms/op 194.84 ms/op 0.79
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.1406 ms/op 3.5451 ms/op 0.60
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.2713 ms/op 3.7206 ms/op 0.61
phase0 processRegistryUpdates - 250000 normalcase 27.502 us/op 14.955 us/op 1.84
phase0 processRegistryUpdates - 250000 badcase_full_deposits 477.88 us/op 535.57 us/op 0.89
phase0 processRegistryUpdates - 250000 worstcase 0.5 237.62 ms/op 251.06 ms/op 0.95
phase0 getAttestationDeltas - 250000 normalcase 13.657 ms/op 15.988 ms/op 0.85
phase0 getAttestationDeltas - 250000 worstcase 13.463 ms/op 16.130 ms/op 0.83
phase0 processSlashings - 250000 worstcase 6.4807 ms/op 6.6390 ms/op 0.98
shuffle list - 16384 els 10.612 ms/op 13.483 ms/op 0.79
shuffle list - 250000 els 150.69 ms/op 198.63 ms/op 0.76
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 484.38 us/op 614.27 us/op 0.79
pass gossip attestations to forkchoice per slot 6.2768 ms/op 3.9007 ms/op 1.61
computeDeltas 3.9221 ms/op 3.6311 ms/op 1.08
computeProposerBoostScoreFromBalances 783.17 us/op 1.1162 ms/op 0.70
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.6981 ms/op 2.0075 ms/op 1.34
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 77.657 us/op 97.807 us/op 0.79
BLS verify - blst-native 1.9671 ms/op 2.2994 ms/op 0.86
BLS verifyMultipleSignatures 3 - blst-native 4.0524 ms/op 4.7294 ms/op 0.86
BLS verifyMultipleSignatures 8 - blst-native 8.7126 ms/op 10.301 ms/op 0.85
BLS verifyMultipleSignatures 32 - blst-native 33.497 ms/op 36.232 ms/op 0.92
BLS aggregatePubkeys 32 - blst-native 43.927 us/op 48.993 us/op 0.90
BLS aggregatePubkeys 128 - blst-native 167.05 us/op 188.72 us/op 0.89
getAttestationsForBlock 68.158 ms/op 78.337 ms/op 0.87
isKnown best case - 1 super set check 473.00 ns/op 550.00 ns/op 0.86
isKnown normal case - 2 super set checks 460.00 ns/op 514.00 ns/op 0.89
isKnown worse case - 16 super set checks 472.00 ns/op 523.00 ns/op 0.90
CheckpointStateCache - add get delete 12.419 us/op 12.397 us/op 1.00
validate gossip signedAggregateAndProof - struct 4.5133 ms/op 5.1869 ms/op 0.87
validate gossip attestation - struct 2.2469 ms/op 2.4787 ms/op 0.91
altair verifyImport mainnet_s3766816:31 6.9538 s/op 7.4371 s/op 0.94
pickEth1Vote - no votes 2.4523 ms/op 2.5218 ms/op 0.97
pickEth1Vote - max votes 27.734 ms/op 26.136 ms/op 1.06
pickEth1Vote - Eth1Data hashTreeRoot value x2048 14.448 ms/op 13.594 ms/op 1.06
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 24.842 ms/op 24.028 ms/op 1.03
pickEth1Vote - Eth1Data fastSerialize value x2048 1.7015 ms/op 1.8487 ms/op 0.92
pickEth1Vote - Eth1Data fastSerialize tree x2048 19.349 ms/op 16.872 ms/op 1.15
bytes32 toHexString 1.1880 us/op 1.2110 us/op 0.98
bytes32 Buffer.toString(hex) 773.00 ns/op 820.00 ns/op 0.94
bytes32 Buffer.toString(hex) from Uint8Array 1.4220 us/op 1.0330 us/op 1.38
bytes32 Buffer.toString(hex) + 0x 734.00 ns/op 791.00 ns/op 0.93
Object access 1 prop 0.41100 ns/op 0.41800 ns/op 0.98
Map access 1 prop 0.32100 ns/op 0.36000 ns/op 0.89
Object get x1000 15.703 ns/op 21.353 ns/op 0.74
Map get x1000 0.88400 ns/op 1.2060 ns/op 0.73
Object set x1000 120.56 ns/op 132.35 ns/op 0.91
Map set x1000 78.556 ns/op 78.176 ns/op 1.00
Return object 10000 times 0.39560 ns/op 0.46020 ns/op 0.86
Throw Error 10000 times 6.3076 us/op 7.3402 us/op 0.86
enrSubnets - fastDeserialize 64 bits 2.8260 us/op 3.1000 us/op 0.91
enrSubnets - ssz BitVector 64 bits 881.00 ns/op 876.00 ns/op 1.01
enrSubnets - fastDeserialize 4 bits 405.00 ns/op 437.00 ns/op 0.93
enrSubnets - ssz BitVector 4 bits 817.00 ns/op 875.00 ns/op 0.93
prioritizePeers score -10:0 att 32-0.1 sync 2-0 104.98 us/op 112.98 us/op 0.93
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 144.50 us/op 150.85 us/op 0.96
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 288.29 us/op 249.98 us/op 1.15
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 562.14 us/op 532.58 us/op 1.06
prioritizePeers score 0:0 att 64-1 sync 4-1 525.99 us/op 571.75 us/op 0.92
RateTracker 1000000 limit, 1 obj count per request 195.80 ns/op 221.77 ns/op 0.88
RateTracker 1000000 limit, 2 obj count per request 162.81 ns/op 167.63 ns/op 0.97
RateTracker 1000000 limit, 4 obj count per request 129.44 ns/op 138.60 ns/op 0.93
RateTracker 1000000 limit, 8 obj count per request 115.82 ns/op 126.94 ns/op 0.91
RateTracker with prune 6.2840 us/op 5.0490 us/op 1.24
array of 16000 items push then shift 5.1982 us/op 3.7983 us/op 1.37
LinkedList of 16000 items push then shift 31.353 ns/op 26.682 ns/op 1.18
array of 16000 items push then pop 282.11 ns/op 266.68 ns/op 1.06
LinkedList of 16000 items push then pop 26.699 ns/op 23.052 ns/op 1.16
array of 24000 items push then shift 8.1467 us/op 5.4475 us/op 1.50
LinkedList of 24000 items push then shift 31.520 ns/op 27.233 ns/op 1.16
array of 24000 items push then pop 239.23 ns/op 224.54 ns/op 1.07
LinkedList of 24000 items push then pop 22.784 ns/op 23.441 ns/op 0.97
intersect bitArray bitLen 8 11.647 ns/op 14.573 ns/op 0.80
intersect array and set length 8 173.72 ns/op 190.15 ns/op 0.91
intersect bitArray bitLen 128 66.643 ns/op 89.375 ns/op 0.75
intersect array and set length 128 2.2584 us/op 2.5843 us/op 0.87

by benchmarkbot/action

@twoeths twoeths marked this pull request as ready for review May 31, 2022 07:06
@twoeths twoeths requested a review from a team as a code owner May 31, 2022 07:06
@g11tech g11tech merged commit 63ce21d into unstable May 31, 2022
@g11tech g11tech deleted the tuyen/api-reject-valid-aggregates branch May 31, 2022 12:41
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.

API rejects valid aggregates
3 participants