-
Notifications
You must be signed in to change notification settings - Fork 693
Update BLS signature module #1581
Conversation
@hwwhww can you look into fixing these linting errors that show up when using the latest py_ecc as well? #1576 -> https://circleci.com/gh/ethereum/py-evm/109848?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link |
@pipermerriam yes, I'll investigate 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.
looks good! left some comments.
Done. Thanks for doing the type cleanups! :) |
o = FQ12([1] + [0] * 11) | ||
for m_pubs in set(messages): | ||
# aggregate the pubs | ||
group_pub = Z1 |
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 think I was a bit unclear in the last comment. I meant something like the following which utilizes aggregate_pubs
rather than directly calling add
for message in set(messages):
pubkeys_for_message = [
pubkey for i, pubkey in enumerate(pubkeys)
if messages[i] == message
]
group_pub = aggregate_pubkeys(pubkeys_for_message)
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.
Oh I see! I think I've tried to do that before, if we want to utilize aggregate_pubkeys
, we will need:
len(messages)
times extracompress_G1()
calling (insideaggregate_pubkeys
)len(messages)
times extradecompress_G1()
calling for the second argument ofpairing
.
Alternatively, we might refactor aggregate_signatures(signatures: Sequence[bytes]) -> Tuple[int, int]
to:
def aggregate_pubkeys(pubkeys: Sequence[int]) -> int:
return compress_G1(_aggregate_pubkeys(pubkeys))
def _aggregate_pubkeys(pubkeys: Sequence[int]) -> Tuple[FQ, FQ, FQ]:
o = Z1
for p in pubkeys:
o = add(o, decompress_G1(p))
return o
And then make verify_multiple
call _aggregate_pubkeys()
.
What do you think of 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.
oh crap, you're right.
I'm okay either way. It's not a huge gain in code reuse and this code won't change much once in place.
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.
Do whichever you want. I'm going to use the updated work in #1631 in the morning so merge whenever you're ready.
@djrtwo merging it now! We can optimize the BLS APIs while moving it to |
What was wrong?
#1565
How was it fixed?
Note
eth/beacon/aggregation.py
for now. It's supposed to be updated in other PRs.Cute Animal Picture