-
Notifications
You must be signed in to change notification settings - Fork 7
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
Use a mask for BLS aggregation and improve caching #604
Conversation
type Aggregate interface { | ||
// Aggregates signatures from a participants. | ||
// | ||
// Implementations must be safe for concurrent use. | ||
Aggregate(signerMask []int, sigs [][]byte) ([]byte, error) | ||
// VerifyAggregate verifies an aggregate signature. | ||
// | ||
// Implementations must be safe for concurrent use. | ||
VerifyAggregate(signerMask []int, payload, aggSig []byte) error | ||
} | ||
|
||
type Verifier interface { | ||
// Verifies a signature for the given public key. | ||
// | ||
// Implementations must be safe for concurrent use. | ||
Verify(pubKey PubKey, msg, sig []byte) error | ||
// Aggregates signatures from a participants. | ||
Aggregate(pubKeys []PubKey, sigs [][]byte) ([]byte, error) | ||
// VerifyAggregate verifies an aggregate signature. | ||
// Return an Aggregate that can aggregate and verify aggregate signatures made by the given | ||
// public keys. | ||
// | ||
// Implementations must be safe for concurrent use. | ||
VerifyAggregate(payload, aggSig []byte, signers []PubKey) error | ||
Aggregate(pubKeys []PubKey) (Aggregate, error) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface changes. Basically:
- You call
Verifier.Aggregate(allPublicKeys)
. - Then you call either
Aggregate
(name clash) orVerifyAggregate
on the resultingAggregate
(naming?).
gpbft/participant.go
Outdated
// TODO: this is slow and under a lock, but we only want to do it once per | ||
// instance... ideally we'd have a per-instance lock/once, but that probably isn't | ||
// worth it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, punt till later (probably not much worse than fetching the committee under the lock).
fa0a974
to
0860f44
Compare
This is ready for review although still WIP until the upstream changes (drand/kyber#61) land. Reviews there would also be helpful (only look at the last two commits, everything else is from a previous PR). |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #604 +/- ##
==========================================
- Coverage 79.47% 76.90% -2.58%
==========================================
Files 55 64 +9
Lines 4907 5451 +544
==========================================
+ Hits 3900 4192 +292
- Misses 631 857 +226
- Partials 376 402 +26
|
Woops; sorry for PR title change noise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach SGWM
e9683d1
to
0ebf539
Compare
Ok, waiting on dedis/kyber#546 now. |
1c1c3ad
to
fdee71b
Compare
70702e5
to
02278ad
Compare
be0652f
to
1c17db1
Compare
byteIndex := i / 8 | ||
mask := byte(1) << uint(i&7) | ||
if (m.mask[byteIndex] & mask) != 0 { | ||
count++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could just popcount but doens't matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make a PR upstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. Later. I have too many stacked.
It's probably going to take a while for upstream to merge the changes so we're importing just the changed package (BDN) and the new package (Gnark) into this repo. That way we avoid forking the entire repo but can still import our changes. Any changes to these pacakges should be submitted as PRs to upstream _first_, then backported to this repo. Includes: - dedis/kyber#546 - dedis/kyber#551 - dedis/kyber#553
1c17db1
to
f5af3ff
Compare
Merged by rebase to preserve the three separate commits. |
Design:
There are three commits here and this PR should be merged by rebase, not squash.
The code imported in commit 2 should be (nearly) identical to the code in the
bdn
andgnark
packages in https://github.com/Stebalien/kyber/tree/f3.fixes #592