-
-
Notifications
You must be signed in to change notification settings - Fork 289
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: verifySignatureSetsSameSigningRoot bls api #5734
Conversation
Performance Report✔️ no performance regression detected Full benchmark results
|
Not sure that we'd ever want to verify on the main thread? |
@wemeetagain I think the theory of not to do heavy operations on main thread is because normally main thread is for I/O operation. Now we do I/O operations on worker thread, we can test verifying signatures (the 1st round) on main thread (and leave all fallback verifications on worker thread), this is when I tested |
another use case for |
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 am curious what you think about simplifying the API back to:
type WorkerApi = {
verifyManySignatureSets(workReqArr: BlsWorkReq[]): Promise<BlsWorkResult>;
};
That way there is only a single api from the chain code perspective and the decision making about when and to check messages for being the same and to verify accordingly all happens within the IBlsVerifier
. We would be able to achieve the grouping of similar attestations across multiple gossip messages and I think it will simplify the worker API.
If you don't think this is a good idea let me know and I will come back and finish the review with the code as-is.
opts?: Pick<VerifySignatureOpts, "verifyOnMainThread"> | ||
): Promise<boolean[]> { | ||
if (opts?.verifyOnMainThread && !this.blsVerifyAllMultiThread) { | ||
const isSameMessage = 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.
What do you think about a metric for main thread time similar to the other case?
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.
Should we also be counting the sets and keys to see what kind of gains we get under load?
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.
thanks for reminding this, all metrics are available, I only need to add "api" label there
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.
Should we also be counting the sets and keys to see what kind of gains we get under load?
we counted the api call, regarding the gain we can count on bls.test.ts
perf test
@matthewkeil thanks for looking into this PR. As discussed, the part of filtering signature sets with the same message is done in #5729 so we really need a new api here. I'm happy if you have any suggestions or simpler way to achieve this. |
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.
Thanks for taking the time to chat about this. Ill definitely spend some more time looking through the draft PR implementing this over the week!! Awesome idea 🚀 for optimization of the gossip work
@tuyennhv I think I found a simpler approach extending your idea. It re-uses the existing queue, such that:
Please take a look and consider incorporating |
@dapplion that's great, it looks really simpler, I created #5747 closing this PR for now |
Motivation
verifyMultipleSignatures()
apicanAcceptWork()
(if we should process a gossip message or not)Description
verifyManySignatureSetsSameMessage()
worker apiverifySignatureSetsMaybeBatch()
to add new paramisSameMessage: boolean
QueueItem
type (an item in "jobs" queue) andJobItem
type (which contain a resolve/reject function of a promise)verifySignatureSetsSameSigningRoot
has "verifyOnMainThread" to verify on main thread or not, consumer can decide it later (in feat: verify attestation gossip messages in batch #5729)part of #5416
Notes