From a0d03378fabf76cb91897ffe17310050f3996ee2 Mon Sep 17 00:00:00 2001 From: Age Manning Date: Thu, 6 Apr 2023 12:40:55 +1000 Subject: [PATCH] Correct subnet subscription duration variable --- specs/phase0/validator.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/specs/phase0/validator.md b/specs/phase0/validator.md index 4df4437d0..1b06aecfb 100644 --- a/specs/phase0/validator.md +++ b/specs/phase0/validator.md @@ -94,7 +94,6 @@ All terminology, constants, functions, and protocol mechanics defined in the [Ph | `ATTESTATION_SUBNET_EXTRA_BITS` | `0` | The number of extra bits of a NodeId to use when mapping to a subscribed subnet | | `SUBNETS_PER_NODE` | `2` | The number of long-lived subnets a beacon node should be subscribed to. | | `ATTESTATION_SUBNET_PREFIX_BITS` | `(ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS)` | | -| `SUBNET_DURATION_IN_EPOCHS` | `2` | | ## Containers @@ -611,14 +610,14 @@ def get_aggregate_and_proof_signature(state: BeaconState, Because Phase 0 does not have shards and thus does not have Shard Committees, there is no stable backbone to the attestation subnets (`beacon_attestation_{subnet_id}`). To provide this stability, each beacon node should: -* Remain subscribed to `SUBNETS_PER_NODE` for `SUBNET_DURATION_IN_EPOCHS` epochs. +* Remain subscribed to `SUBNETS_PER_NODE` for `EPOCHS_PER_SUBNET_SUBSCRIPTION` epochs. * Maintain advertisement of the selected subnets in their node's ENR `attnets` entry by setting the selected `subnet_id` bits to `True` (e.g. `ENR["attnets"][subnet_id] = True`) for all persistent attestation subnets. * Select these subnets based on their node-id as specified by the following `compute_subnets(node_id,epoch)` function. ```python def compute_subnet(node_id: int, epoch: Epoch, index: int) -> int: node_id_prefix = node_id >> (256 - ATTESTATION_SUBNET_PREFIX_BITS) - permutation_seed = hash(uint_to_bytes(epoch // SUBNET_DURATION_IN_EPOCHS)) + permutation_seed = hash(uint_to_bytes(epoch // EPOCHS_PER_SUBNET_SUBSCRIPTION)) permutated_prefix = compute_shuffled_index(node_id_prefix, 1 << ATTESTATION_SUBNET_PREFIX_BITS, permutation_seed) return (permutated_prefix + index) % ATTESTATION_SUBNET_COUNT ```