From fc4dad6a1360945058b28bfa522ade07ee6259d5 Mon Sep 17 00:00:00 2001 From: Dankrad Feist Date: Mon, 28 Dec 2020 17:38:09 +0000 Subject: [PATCH] Fix degree proof for length 0 (degree -inf) --- specs/phase1/beacon-chain.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/specs/phase1/beacon-chain.md b/specs/phase1/beacon-chain.md index 7fc216a36..b0640a0c9 100644 --- a/specs/phase1/beacon-chain.md +++ b/specs/phase1/beacon-chain.md @@ -91,7 +91,8 @@ We define the following Python custom types for type hinting and readability: | Name | Value | | - | - | -| `G2_SETUP` | Type `List[G2]`. The G2-side trusted setup `[G, G*s, G*s**2....]`; note that the first point is the generator. | +| `G1_SETUP` | Type `List[G1]`. The G1-side trusted setup `[G, G*s, G*s**2....]`; note that the first point is the generator. | +| `G2_SETUP` | Type `List[G2]`. The G2-side trusted setup `[G, G*s, G*s**2....]` | | `MODULUS` | `0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001` (curve order of BLS12_381) | | `ROOT_OF_UNITY` | `pow(PRIMITIVE_ROOT_OF_UNITY, (MODULUS - 1) // (MAX_SAMPLES_PER_BLOCK * POINTS_PER_SAMPLE, MODULUS)` | @@ -487,7 +488,9 @@ def process_shard_header(state: BeaconState, compute_signing_root(header, get_domain(state, DOMAIN_SHARD_HEADER)), signed_header.signature ) - # Verify length of the header, and simultaneously verify degree. + # Verify the length by verifying the degree. + if header.commitment.length == 0: + assert header.degree_proof == G1_SETUP[0] assert ( bls.Pairing(header.degree_proof, G2_SETUP[0]) == bls.Pairing(header.commitment.point, G2_SETUP[-header.commitment.length]))