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

Introduce multiple BLS backend support: BLST and Milagro #68

Merged
merged 4 commits into from
Aug 11, 2020

Conversation

mratsim
Copy link
Contributor

@mratsim mratsim commented Aug 11, 2020

This adds BLST as an alternative backend, complete with EIP2333 support (which requires importing BLST internals).

The code is using an older version of BLST, the same that was using in the proof-of-concept https://github.com/status-im/nim-blst repo. The changes are an API change for aggregation.

The code does not use multithreaded miller loops for aggregate verification like the Rust/Go code see:

Miracl/BLST can be switched with -d:BLS_BACKEND=miracl/-d:BLS_BACKEND=blst/-d:BLS_BACKEND=auto, auto is default

@mratsim mratsim merged commit 19f3b68 into master Aug 11, 2020
@mratsim mratsim deleted the switch-blst branch September 7, 2020 12:18
mratsim pushed a commit that referenced this pull request Jul 27, 2021
In #100 a regression was introduced to BLST `fastAggregateVerify`.

Previous code:
```
  var aggAffine{.noInit.}: PublicKey
  aggAffine.point.blst_p1_to_affine(aggregate)
  return coreVerifyNoGroupCheck(aggAffine, message, signature, DST)
```

New code introducing regression:
```
  var aggAffine{.noInit.}: PublicKey
  aggAffine.finish(aggAffine)
  return coreVerifyNoGroupCheck(aggAffine, message, signature, DST)
```

This change led to a compilation error when using `fastAggregateVerify`
with proof-of-possession.

Secondly, `aggregateVerify` with proof-possession also fails to compile.
This was never working, ever since BLST support was introduced in #68.

Problematic code:
```
  if publicKeys.len != proofs.len or publicKeys != messages.len:
     return false
```

This patch addresses both compilation problems and extends the existing
tests to also cover proof-of-possession functionality. Because the Eth2
vectors do not include proof-of-possession data, the test generator was
temporarily extended to produce such reference data. A copy of that data
is hardcoded in the eth2_vectors tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant