Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeny-stakewise committed Feb 14, 2024
1 parent 89a76d0 commit 97154d7
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/validators/signing/tests/oracle_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ def verify_signature_shards(
exit_signature_shards: ExitSignatureShards,
exit_signature: BLSSignature | None = None,
):
# Decrypt the signature shards using the oracle private keys
exit_signature_shares_decrypted = []
for oracle_privkey, exit_signature_shard in zip(
self.oracle_privkeys, exit_signature_shards.exit_signatures
):
exit_signature_shares_decrypted.append(
BLSSignature(
ecies.decrypt(oracle_privkey.secret, Web3.to_bytes(hexstr=exit_signature_shard))
)
)

# Verify the pubkey shares reconstruct into the full validator pubkey
validator_pubkey_shares = {
idx: BLSPubkey(Web3.to_bytes(hexstr=s))
Expand All @@ -60,13 +49,13 @@ def verify_signature_shards(
fork=fork,
)
for idx, (signature_share, validator_pubkey_share) in enumerate(
zip(exit_signature_shares_decrypted, exit_signature_shards.public_keys)
zip(exit_signature_shards.exit_signatures, exit_signature_shards.public_keys)
):
pubkey_share = Web3.to_bytes(hexstr=validator_pubkey_share)
assert bls.Verify(pubkey_share, message, signature_share) is True

# Verify the full reconstructed signature using full public key
signatures = dict(enumerate(exit_signature_shares_decrypted))
signatures = dict(enumerate(exit_signature_shards.exit_signatures))
random_indexes = random.sample(sorted(signatures), k=self.exit_signature_recover_threshold)
random_signature_subset = {k: v for k, v in signatures.items() if k in random_indexes}
reconstructed_full_signature = reconstruct_shared_bls_signature(random_signature_subset)
Expand Down

0 comments on commit 97154d7

Please sign in to comment.