From c8c810c0e107a20a6ed086aa3187d6e1ddeeb330 Mon Sep 17 00:00:00 2001 From: Justin Drake Date: Fri, 5 Jul 2019 15:03:37 +0100 Subject: [PATCH 1/2] Minor fixes --- specs/core/0_beacon-chain.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 975874d51..75fa127f7 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -540,8 +540,6 @@ class BeaconState(Container): ### Math -#### `int_to_bytes` - #### `integer_squareroot` ```python @@ -560,13 +558,15 @@ def integer_squareroot(n: uint64) -> uint64: #### `xor` ```python -def xor(bytes1: Bytes32, bytes2: Bytes32) -> Bytes32: +def xor(bytes_1: Bytes32, bytes_2: Bytes32) -> Bytes32: """ Return the exclusive-or of two 32-byte strings. """ - return Bytes32(a ^ b for a, b in zip(bytes1, bytes2)) + return Bytes32(a ^ b for a, b in zip(bytes_1, bytes_2)) ``` +#### `int_to_bytes` + ```python def int_to_bytes(n: uint64, length: uint64) -> bytes: """ @@ -653,7 +653,7 @@ def is_slashable_attestation_data(data_1: AttestationData, data_2: AttestationDa ```python def is_valid_indexed_attestation(state: BeaconState, indexed_attestation: IndexedAttestation) -> bool: """ - Verify validity of ``indexed_attestation``. + Check indices and signature of ``indexed_attestation``. """ bit_0_indices = indexed_attestation.custody_bit_0_indices bit_1_indices = indexed_attestation.custody_bit_1_indices @@ -989,7 +989,7 @@ def get_total_balance(state: BeaconState, indices: Set[ValidatorIndex]) -> Gwei: """ Return the combined effective balance of the ``indices``. (1 Gwei minimum to avoid divisions by zero.) """ - return Gwei(max(sum([state.validators[index].effective_balance for index in indices]), 1)) + return Gwei(max(1, sum([state.validators[index].effective_balance for index in indices]))) ``` #### `get_total_active_balance` From 591f9658d349c8a970865d53e716ea7aed9e24d8 Mon Sep 17 00:00:00 2001 From: Justin Drake Date: Fri, 5 Jul 2019 15:04:57 +0100 Subject: [PATCH 2/2] Copy edit --- specs/core/0_beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 75fa127f7..441d6f72b 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -653,7 +653,7 @@ def is_slashable_attestation_data(data_1: AttestationData, data_2: AttestationDa ```python def is_valid_indexed_attestation(state: BeaconState, indexed_attestation: IndexedAttestation) -> bool: """ - Check indices and signature of ``indexed_attestation``. + Check if ``indexed_attestation`` has valid indices and signature. """ bit_0_indices = indexed_attestation.custody_bit_0_indices bit_1_indices = indexed_attestation.custody_bit_1_indices