fix custody bit calculation format

This commit is contained in:
Danny Ryan 2020-03-16 09:52:27 -06:00
parent 9b7e0ab2be
commit d299b06a1c
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 2 additions and 2 deletions

View File

@ -194,8 +194,8 @@ def compute_custody_bit(key: BLSSignature, data: bytes) -> bit:
s = full_G2_element[0].coeffs s = full_G2_element[0].coeffs
custody_atoms = get_custody_atoms(data) custody_atoms = get_custody_atoms(data)
n = len(custody_atoms) n = len(custody_atoms)
return legendre_bit(sum(s[i % 2]**i * int.from_bytes(atom, "little")) a = sum(s[i % 2]**i * int.from_bytes(atom, "little") for i, atom in enumerate(custody_atoms) + s[n % 2]**n)
for i, atom in enumerate(custody_atoms) + s[n % 2]**n, BLS12_381_Q) return legendre_bit(a, BLS12_381_Q)
``` ```
### `get_randao_epoch_for_custody_period` ### `get_randao_epoch_for_custody_period`