Merge pull request #2303 from ericsson49/ericsson49/fix_typos

Sharding spec typos fixed
This commit is contained in:
Danny Ryan 2021-04-05 12:27:33 -06:00 committed by GitHub
commit 0b069fbfca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -12,7 +12,7 @@
- [Configuration](#configuration) - [Configuration](#configuration)
- [Misc](#misc) - [Misc](#misc)
- [New containers](#new-containers) - [New containers](#new-containers)
- [DASSample](#dassample) - [`DASSample`](#dassample)
- [Helper functions](#helper-functions) - [Helper functions](#helper-functions)
- [Reverse bit ordering](#reverse-bit-ordering) - [Reverse bit ordering](#reverse-bit-ordering)
- [`reverse_bit_order`](#reverse_bit_order) - [`reverse_bit_order`](#reverse_bit_order)
@ -45,7 +45,7 @@ We define the following Python custom types for type hinting and readability:
## New containers ## New containers
### DASSample ### `DASSample`
```python ```python
class DASSample(Container): class DASSample(Container):

View File

@ -70,7 +70,7 @@ We define the following Python custom types for type hinting and readability:
| Name | SSZ equivalent | Description | | Name | SSZ equivalent | Description |
| - | - | - | | - | - | - |
| `Shard` | `uint64` | A shard number | | `Shard` | `uint64` | A shard number |
| `BLSCommitment` | `bytes48` | A G1 curve point | | `BLSCommitment` | `Bytes48` | A G1 curve point |
| `BLSPoint` | `uint256` | A number `x` in the range `0 <= x < MODULUS` | | `BLSPoint` | `uint256` | A number `x` in the range `0 <= x < MODULUS` |
## Constants ## Constants
@ -108,7 +108,7 @@ The following values are (non-configurable) constants used throughout the specif
| - | - | | - | - |
| `G1_SETUP` | Type `List[G1]`. The G1-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....]` | | `G2_SETUP` | Type `List[G2]`. The G2-side trusted setup `[G, G*s, G*s**2....]` |
| `ROOT_OF_UNITY` | `pow(PRIMITIVE_ROOT_OF_UNITY, (MODULUS - 1) // (MAX_SAMPLES_PER_BLOCK * POINTS_PER_SAMPLE, MODULUS)` | | `ROOT_OF_UNITY` | `pow(PRIMITIVE_ROOT_OF_UNITY, (MODULUS - 1) // (MAX_SAMPLES_PER_BLOCK * POINTS_PER_SAMPLE), MODULUS)` |
### Gwei values ### Gwei values
@ -223,7 +223,7 @@ class PendingShardHeader(Container):
# Who voted for the header # Who voted for the header
votes: Bitlist[MAX_VALIDATORS_PER_COMMITTEE] votes: Bitlist[MAX_VALIDATORS_PER_COMMITTEE]
# Has this header been confirmed? # Has this header been confirmed?
confirmed: bool confirmed: boolean
``` ```
## Helper functions ## Helper functions
@ -514,7 +514,7 @@ def process_shard_header(state: BeaconState,
assert header.degree_proof == G1_SETUP[0] assert header.degree_proof == G1_SETUP[0]
assert ( assert (
bls.Pairing(header.degree_proof, G2_SETUP[0]) bls.Pairing(header.degree_proof, G2_SETUP[0])
== bls.Pairing(header.commitment.point, G2_SETUP[-header.commitment.length])) == bls.Pairing(header.commitment.point, G2_SETUP[-header.commitment.length])
) )
# Get the correct pending header list # Get the correct pending header list
@ -618,7 +618,7 @@ def process_pending_headers(state: BeaconState) -> None:
for slot_index in range(SLOTS_PER_EPOCH): for slot_index in range(SLOTS_PER_EPOCH):
for shard in range(SHARD_COUNT): for shard in range(SHARD_COUNT):
state.grandparent_epoch_confirmed_commitments[shard][slot_index] = DataCommitment() state.grandparent_epoch_confirmed_commitments[shard][slot_index] = DataCommitment()
confirmed_headers = [candidate in state.previous_epoch_pending_shard_headers if candidate.confirmed] confirmed_headers = [candidate for candidate in state.previous_epoch_pending_shard_headers if candidate.confirmed]
for header in confirmed_headers: for header in confirmed_headers:
state.grandparent_epoch_confirmed_commitments[c.shard][c.slot % SLOTS_PER_EPOCH] = c.commitment state.grandparent_epoch_confirmed_commitments[c.shard][c.slot % SLOTS_PER_EPOCH] = c.commitment
``` ```
@ -666,7 +666,7 @@ def reset_pending_headers(state: BeaconState) -> None:
next_epoch = get_current_epoch(state) + 1 next_epoch = get_current_epoch(state) + 1
next_epoch_start_slot = compute_start_slot_at_epoch(next_epoch) next_epoch_start_slot = compute_start_slot_at_epoch(next_epoch)
for slot in range(next_epoch_start_slot, next_epoch_start_slot + SLOTS_IN_EPOCH): for slot in range(next_epoch_start_slot, next_epoch_start_slot + SLOTS_IN_EPOCH):
for index in range(get_committee_count_per_slot(next_epoch): for index in range(get_committee_count_per_slot(next_epoch)):
shard = compute_shard_from_committee_index(state, slot, index) shard = compute_shard_from_committee_index(state, slot, index)
committee_length = len(get_beacon_committee(state, slot, shard)) committee_length = len(get_beacon_committee(state, slot, shard))
state.current_epoch_pending_shard_headers.append(PendingShardHeader( state.current_epoch_pending_shard_headers.append(PendingShardHeader(