-
-
Notifications
You must be signed in to change notification settings - Fork 291
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: add verifySignatureSetsSameMessage BLS api #5747
feat: add verifySignatureSetsSameMessage BLS api #5747
Conversation
Performance Report✔️ no performance regression detected Full benchmark results
|
const startNs = process.hrtime.bigint(); | ||
const pubkey = bls.PublicKey.aggregate(sets.map((set) => set.publicKey)); | ||
// validate signature = true | ||
const signatures = sets.map((set) => bls.Signature.fromBytes(set.signature, CoordType.affine, true)); |
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.
Watch out, this can throw here and should be handled on a per-item basis
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.
Looks good! Can you add some tests for invalid signature format? Such that it throws an error on the fromBytes call for both worker and main thread, default and sameMessage
b8491c7
to
52785b0
Compare
// Create new jobs for each pubkey set, and Promise.all all the results | ||
for (const j of jobItemSameMessageToMultiSet(job)) { | ||
if (j.opts.priority) { | ||
this.jobs.unshift(j); | ||
} else { | ||
this.jobs.push(j); | ||
} | ||
} | ||
this.metrics?.blsThreadPool.sameMessageRetryJobs.inc(1); | ||
this.metrics?.blsThreadPool.sameMessageRetrySets.inc(job.sets.length); |
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.
Is it worth pulling this into a method since this block is repeated? eg: retryJobItemSameMessage
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.
👍 I extracted it to new method retryJobItemSameMessage
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.
Looks great! Pushed a commit with mostly cosmetic changes
🎉 This PR is included in v1.10.0 🎉 |
Motivation
verifyMultipleSignatures()
apicanAcceptWork()
(if we should process a gossip message or not)Description
verifySignatureSetsSameMessage()
bls apirunJob()
, take that chance to aggregate pubkeys and signatures of JobQueueItemSameMessage and transform it to a regular BlsWorkReq, seejobItemWorkReq
jobItemSameMessageToMultiSet
part of #5416