status-im / nim-blscurve

Nim implementation of BLS signature scheme (Boneh-Lynn-Shacham) over Barreto-Lynn-Scott (BLS) curve BLS12-381
Apache License 2.0
26 stars 11 forks source link

Multi-signatures verification with offending signature detection #55

Closed mratsim closed 4 years ago

mratsim commented 4 years ago

This is similar to #52 with a twist.

52 is suitable for syncing and catching up to the chain.

However, once we have caught, signature verification is still a bottleneck but we may have to verify multiple signatures that are not aggregated.

Research: https://ethresear.ch/t/fast-verification-of-multiple-bls-signatures/5407

We could aggregate signatures and then use fastAggregateVerify https://github.com/status-im/nim-blscurve/blob/b435f1a7296fceda8a68aaca391e6d76b2c632d3/blscurve/bls_signature_scheme.nim#L402-L407 but in case we have a wrong signature aggregated, we want to slash that exact validator and we would have to recheck on non-aggregated signatures.

This would allow to do batch verification on non-aggregated signatures while being able to pinpoint the wrong signature.

mratsim commented 4 years ago

Ah seems I misread the post date "May 19" was for May 2019 not 3 days ago. We already have this: https://github.com/status-im/nim-blscurve/blob/b435f1a7296fceda8a68aaca391e6d76b2c632d3/blscurve/bls_signature_scheme.nim#L191-L250