phoreproject / bls

Go implementation of the BLS12-381 pairing
Apache License 2.0
89 stars 31 forks source link

Much faster aggregate-verify, and change domain type to be less opinionated. #11

Closed protolambda closed 5 years ago

protolambda commented 5 years ago

Aggregate pubkeys first, then verify the signature. Like Milagro does.

Performance difference in verify-aggragate with 128 pubkeys:

~800-900 ms on a Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz

Now: ~18-20 ms (see new benchmarks)

An equal (also 128 sigs/pubkeys) Milagro bench runs in the ~8ms range for me.

This PR also changes the domain type to [8]byte, this makes the API less opinionated, as the endianness choice is now up to the API caller. It needs to be in bytes anyway. This follows the BLS spec in Eth 2.0

CC @prestonvanloon @nisdas @kirk-baird

protolambda commented 5 years ago

Amended, go fmt :sweat:

meyer9 commented 5 years ago

Merged. Thanks for the contribution!