-
-
Notifications
You must be signed in to change notification settings - Fork 343
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
feat: verify gossip attestation messages in batch #5896
Conversation
Performance Report✔️ no performance regression detected 🚀🚀 Significant benchmark improvement detected
Full benchmark results
|
one trade off is "prometheus scrape duration" metric, it's ~80ms compare to ~25ms in feat1 mostly because we aggregate signatures on the main thread:
also the beacon block "time until head" is the same |
attestationOrBytesArr: AttestationOrBytes[], | ||
subnet: number, | ||
// for unit test, consumers do not need to pass this | ||
phase0ValidationFn = validateGossipAttestationNoSignatureCheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless this is talking about the phase0 fork, would recommend changing this language to "step 0", "step 1", etc.
@@ -133,7 +133,8 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier { | |||
// THe worker is not able to deserialize from uncompressed | |||
// `Error: err _wrapDeserialize` | |||
this.format = implementation === "blst-native" ? PointFormat.uncompressed : PointFormat.compressed; | |||
this.workers = this.createWorkers(implementation, defaultPoolSize); | |||
// 1 worker for the main thread | |||
this.workers = this.createWorkers(implementation, defaultPoolSize - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check above that defaultPoolSize is greater than 1
this.lastWaitTimeCheckedMs = now; | ||
this.nextWaitTimeMs = null; | ||
let resultedKey: string | null = null; | ||
for (const key of this.indexedItems.keys()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iterate by entries so you don't have to do a get below
@@ -18,28 +29,33 @@ import {GossipQueue, IndexedGossipQueueMinSizeOpts} from "./types.js"; | |||
*/ | |||
export class IndexedGossipQueueMinSize<T extends {indexed?: string}> implements GossipQueue<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not already you should collect this metrics when the node is scraped:
- Total count of unique data strings in the cache
- Total count of individual attestations in the cache
- Current histogram (reset, iterate, observe; like we do in the peer manager) of how long each data has been in the queue since addition
- Histogram of the age of a data when it is picked by the processor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added missing metrics 👍
🎉 This PR is included in v1.11.0 🎉 |
Motivation
subscribeAllSubnets
modeDescription
50ms
wait time for each key if key size is <= 32 to allow batch more attestationsuseWorker=true
) because it blocks main thread to aggregate signatures, so implementednetwork.beaconAttestationBatchValidation
undefined|false
, it's for backward compatible. In this case it goes withLinearGossipQueue
andDefaultGossipHandlers
IndexedGossipQueueMinSize
andBatchGossipHandlers
Closes #5416
Test result on test mainnet node
feat
mainnet node (unstable
+use_worker
=true) there, so the gossipsub bandwidth is the samebeacon_attestation
topic