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

enable signature verification in initial sync #1217

Closed
ColinSchwarz opened this issue Jul 24, 2020 · 12 comments
Closed

enable signature verification in initial sync #1217

ColinSchwarz opened this issue Jul 24, 2020 · 12 comments
Assignees
Labels
prio-medium Resolve this some time soon (tm).

Comments

@ColinSchwarz
Copy link
Contributor

pending answer to “In initial sync, do we need to verify ALL operations? or just block signature?"

@ColinSchwarz ColinSchwarz added the prio-medium Resolve this some time soon (tm). label Jul 24, 2020
@dapplion
Copy link
Contributor

dapplion commented Dec 6, 2020

@tuyennhv Would you mind assessing the viability of this now that we have BLST?

@twoeths
Copy link
Contributor

twoeths commented Dec 7, 2020

@tuyennhv Would you mind assessing the viability of this now that we have BLST?

I have some statistics when I sync mainnet until block 28000:

  • lighthouse takes less than 10 minutes with signature verification
  • lodestar takes almost 1h without signature verification (due to the single thread nature)

so I think we have to wait for #1771 first where we send a block range to do state transition and verify multiple signatures at the same time. We'll see which signatures we want to verify at that time.

@dapplion
Copy link
Contributor

dapplion commented Dec 7, 2020

With batch signature verification we can achieve 50% savings in the best case scenario so it won't help much if are still an order of magnitude away.

@dapplion
Copy link
Contributor

dapplion commented Dec 7, 2020

Would be very valuable to know how much time is currently spent doing signature verification. Then we know if we have to focus on optimizing the state transition function itself or signature verification

@twoeths
Copy link
Contributor

twoeths commented Dec 7, 2020

lodestar takes almost 1h without signature verification (due to the single thread nature)

as I said above, for initial sync we don't do any signature verification for now so if we do, the time to sync is much bigger.

if we plan on having signature verification for initial sync, we need to work on #1771 first before we bench mark.

@dapplion
Copy link
Contributor

dapplion commented Dec 7, 2020

Sorry just closed the issue, BLST is already integrated in current master

@dapplion
Copy link
Contributor

dapplion commented Dec 7, 2020

@tuyennhv As I summarized in #1771
In terms of speeding up signature verification, it has 3 steps

  • Change herumi for BLST, x10 speed increase ✔️
  • Use batch verification x2 speed increase ⌛
  • Multi-thread x2-x8 speed increase ❓

So the most impactful speed increase is already delivered. That's why I think it's a good time to benchmark how good or bad are we right now.

@twoeths
Copy link
Contributor

twoeths commented Dec 7, 2020

thanks for the clarification @dapplion , we haven't applied signature verification for initial sync yet so there's no difference when BLST is in.

@twoeths
Copy link
Contributor

twoeths commented Dec 8, 2020

The below statistic is from Pyrmont syncs till slot 5000 in my local environment and latest master 83c2949

Desc # Duration Max Block Transition Time
No signature verification 1 30 minutes 9418ms at slot: 2368
No signature verification 2 24 minutes 4767ms at slot: 3584
Block signature verification 1 22 minutes 4693ms at slot: 2624
Block signature verification 2 21 minutes 4246ms at slot: 4576
All operations signature verification 1 42 minutes 5609ms at slot: 1984
All operations signature verification 2 48 minutes 4327ms at slot: 3264

not sure why verifying block signature takes less time although I run twice but at least it's comparable to no signature verification.

@dapplion
Copy link
Contributor

dapplion commented Dec 8, 2020

@tuyennhv Thanks for benchmarking this! @wemeetagain Do you think it would be valuable to profile a couple of blocks and check what's the actual time spent in BLS signature verification on a small sample?

@wemeetagain
Copy link
Member

Yes, I think that would be good to more deeply understand these results.

I personally don't understand how "block signature verification" could possibly be faster than "no block signature verification".

@dapplion dapplion self-assigned this Jan 20, 2021
@dapplion
Copy link
Contributor

Fixed with #2147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio-medium Resolve this some time soon (tm).
Projects
None yet
Development

No branches or pull requests

4 participants