From 507a9afbfb0d434f4c2cd59ef444860f9dce70e8 Mon Sep 17 00:00:00 2001 From: protolambda Date: Mon, 13 Jan 2020 18:57:56 +0100 Subject: [PATCH] apply custody bit fix suggestion from Dankrad --- specs/phase1/custody-game.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/phase1/custody-game.md b/specs/phase1/custody-game.md index d8c4954f3..fd804a722 100644 --- a/specs/phase1/custody-game.md +++ b/specs/phase1/custody-game.md @@ -188,7 +188,7 @@ def get_custody_atoms(bytez: bytes) -> Sequence[bytes]: def compute_custody_bit(key: BLSSignature, data: bytes) -> bit: full_G2_element = bls.signature_to_G2(key) s = full_G2_element[0].coeffs - bits = [legendre_bit((i + 1) * s[i % 2] + int.from_bytes(atom, "little"), BLS12_381_Q) + bits = [legendre_bit(sum(s[i % 2]**i * int.from_bytes(atom, "little")), BLS12_381_Q) for i, atom in enumerate(get_custody_atoms(data))] # XOR all atom bits return bit(sum(bits) % 2)