Skip to content

Commit

Permalink
PR feedback 2, remove randomness
Browse files Browse the repository at this point in the history
  • Loading branch information
ChihChengLiang committed May 8, 2019
1 parent a66537d commit 80b7c32
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions tests/test_bls.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,27 +249,21 @@ def test_multi_multi():
pubkeys = [privtopub(k) for k in privkeys]

class Attestation:
def __init__(self, msg_1, msg_2):
msg_1_validators = sample(validator_indices, 3)
msg_2_validators = sample(validator_indices, 3)
def __init__(self):
msg_1_validators = (1, 2, 3, 4)
msg_2_validators = (4, 5, 6, 7)
self.agg_pubkeys = [
aggregate_pubkeys([pubkeys[i] for i in msg_1_validators]),
aggregate_pubkeys([pubkeys[i] for i in msg_2_validators]),
]
self.msgs = [msg_1, msg_2]
msg_1_sigs = [sign(msg_1, privkeys[i], domain) for i in msg_1_validators]
msg_2_sigs = [sign(msg_2, privkeys[i], domain) for i in msg_2_validators]
self.msgs = (b'\x12' * 32, b'\x34' * 32)
msg_1_sigs = [sign(self.msgs[0], privkeys[i], domain) for i in msg_1_validators]
msg_2_sigs = [sign(self.msgs[1], privkeys[i], domain) for i in msg_2_validators]
self.sig = aggregate_signatures([
aggregate_signatures(msg_1_sigs),
aggregate_signatures(msg_2_sigs),
])

msgs = (
(b'\x12' * 32, b'\x34' * 32),
(b'\x56' * 32, b'\x78' * 32),
(b'\x90' * 32, b'\xab' * 32),
)
atts = [Attestation(msg_1, msg_2) for msg_1, msg_2 in msgs]
atts = (Attestation(),) * 3
assert verify_multiple_multiple(
signatures=[att.sig for att in atts],
pubkeys_and_messages=[[att.agg_pubkeys, att.msgs] for att in atts],
Expand Down

0 comments on commit 80b7c32

Please sign in to comment.