fastcrypto icon indicating copy to clipboard operation
fastcrypto copied to clipboard

[BLS] Expose signing and verification api that takes as input an already mapped-to-point msg

Open kchalkias opened this issue 2 years ago • 5 comments

This will enable caching when the same msg is used for signing and verification (or when we fall back to single sig verification in consensus). See this tweet: https://twitter.com/kostascrypto/status/1656809806198640640?s=20

kchalkias avatar May 12 '23 03:05 kchalkias

It's not a simple change, so let's first analyze the potential performance improvement (e.g., using flamegraph of batch_verify with 10/100/1000 signatures).

benr-ml avatar May 12 '23 05:05 benr-ml

@benr-ml map-to-point is ~70 microsec (pretty much half the signing cost or ~6.5% faster aggregated sig verification - assuming you were a signer and you had it in LRU). I guess adding the LRU is easy, and the complexity is on utilizing the BLST api to input a map2point directly during verification, right?

kchalkias avatar May 12 '23 07:05 kchalkias

Thanks, let's also check this with batch_verify since that's what we're hoping to optimize (maybe it's better...). As for the LRU, probably not too difficult, but yeah, the changes to BLST will be the more tricky part, we'd need to break the rust interfaces/use the C++ ones directly.

benr-ml avatar May 12 '23 08:05 benr-ml

I thought about breaking the interfaces anyway to utilise pre computation on the pairing (see https://github.com/MystenLabs/fastcrypto/issues/507). We should do some experiments first though.

jonas-lj avatar May 12 '23 08:05 jonas-lj

@jonas-lj and @benr-ml yes we need some data from testnet and mainnet, as said in the recent past, we record all ideas in GH (not to forget them) and then see what makes sense based on data we get every week.

kchalkias avatar May 12 '23 15:05 kchalkias