mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-01 09:45:02 -05:00
Fix typos
This commit is contained in:
@@ -10,12 +10,12 @@ Use an OS that has Python 3.8 or above. For example, Debian 11 (bullseye)
|
||||
```sh
|
||||
sudo apt install -y make git wget python3-venv gcc python3-dev
|
||||
```
|
||||
1. Download the latest [consensus specs](https://github.com/ethereum/consensus-specs)
|
||||
2. Download the latest [consensus specs](https://github.com/ethereum/consensus-specs)
|
||||
```sh
|
||||
git clone https://github.com/ethereum/consensus-specs.git
|
||||
cd consensus-specs
|
||||
```
|
||||
1. Create the specifications and tests:
|
||||
3. Create the specifications and tests:
|
||||
```sh
|
||||
make install_test
|
||||
make pyspec
|
||||
@@ -31,12 +31,12 @@ To read more about creating the environment, [see here](core/pyspec/README.md).
|
||||
cd ~/consensus-specs
|
||||
. venv/bin/activate
|
||||
```
|
||||
1. Run a sanity check test against Altair fork:
|
||||
2. Run a sanity check test against Altair fork:
|
||||
```sh
|
||||
cd tests/core/pyspec
|
||||
python -m pytest -k test_empty_block_transition --fork altair eth2spec
|
||||
```
|
||||
1. The output should be similar to:
|
||||
3. The output should be similar to:
|
||||
```
|
||||
============================= test session starts ==============================
|
||||
platform linux -- Python 3.9.2, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
|
||||
@@ -114,7 +114,7 @@ In Python `yield` is used by [generators](https://wiki.python.org/moin/Generator
|
||||
we can treat it as a partial return statement that doesn't stop the function's processing, only adds to a list
|
||||
of return values. Here we add two values, the string `'pre'` and the initial state, to the list of return values.
|
||||
|
||||
[You can read more about test generators and how the are used here](generators).
|
||||
[You can read more about test generators and how they are used here](generators).
|
||||
|
||||
```python
|
||||
block = build_empty_block_for_next_slot(spec, state)
|
||||
@@ -417,7 +417,7 @@ In the last line you can see two conditions being asserted:
|
||||
|
||||
1. `data.slot + MIN_ATTESTATION_INCLUSION_DELAY <= state.slot` which verifies that the attestation doesn't
|
||||
arrive too early.
|
||||
1. `state.slot <= data.slot + SLOTS_PER_EPOCH` which verifies that the attestation doesn't
|
||||
2. `state.slot <= data.slot + SLOTS_PER_EPOCH` which verifies that the attestation doesn't
|
||||
arrive too late.
|
||||
|
||||
This is how the consensus layer tests deal with edge cases, by asserting the conditions required for the
|
||||
@@ -431,7 +431,7 @@ Now we'll write a similar test that verifies that being `SLOTS_PER_EPOCH` away i
|
||||
`test_after_epoch_slots` function. We need two changes:
|
||||
|
||||
1. Call `transition_to_slot_via_block` with one less slot to advance
|
||||
1. Don't tell `run_attestation_processing` to return an empty post state.
|
||||
2. Don't tell `run_attestation_processing` to return an empty post state.
|
||||
|
||||
The modified function is:
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ def slash_some_validators_for_inactivity_scores_test(spec, state, rng=Random(404
|
||||
next_epoch_via_block(spec, future_state)
|
||||
|
||||
proposer_index = spec.get_beacon_proposer_index(future_state)
|
||||
# Slash ~1/4 of validaors
|
||||
# Slash ~1/4 of validators
|
||||
for validator_index in range(len(state.validators)):
|
||||
if rng.choice(range(4)) == 0 and validator_index != proposer_index:
|
||||
spec.slash_validator(state, validator_index)
|
||||
|
||||
@@ -136,6 +136,6 @@ def test_inactivity_scores_full_participation_leaking(spec, state):
|
||||
yield 'blocks', [signed_block]
|
||||
yield 'post', state
|
||||
|
||||
# Full particiaption during a leak so all scores should decrease by 1
|
||||
# Full participation during a leak so all scores should decrease by 1
|
||||
for pre, post in zip(previous_inactivity_scores, state.inactivity_scores):
|
||||
assert post == pre - 1
|
||||
|
||||
@@ -55,7 +55,7 @@ def test_is_assigned_to_sync_committee(spec, state):
|
||||
disqualified_pubkeys = set(
|
||||
filter(lambda key: key not in sync_committee_pubkeys, active_pubkeys)
|
||||
)
|
||||
# NOTE: only check `disqualified_pubkeys` if SYNC_COMMITEE_SIZE < validator count
|
||||
# NOTE: only check `disqualified_pubkeys` if SYNC_COMMITTEE_SIZE < validator count
|
||||
if disqualified_pubkeys:
|
||||
sample_size = 3
|
||||
assert validator_count >= sample_size
|
||||
|
||||
@@ -255,7 +255,7 @@ def state_transition_with_full_block(spec,
|
||||
sync_aggregate=None,
|
||||
block=None):
|
||||
"""
|
||||
Build and apply a block with attestions at the calculated `slot_to_attest` of current epoch and/or previous epoch.
|
||||
Build and apply a block with attestations at the calculated `slot_to_attest` of current epoch and/or previous epoch.
|
||||
"""
|
||||
if block is None:
|
||||
block = build_empty_block_for_next_slot(spec, state)
|
||||
|
||||
@@ -206,7 +206,7 @@ def run_get_inclusion_delay_deltas(spec, state):
|
||||
rewarded_proposer_indices.add(earliest_attestation.proposer_index)
|
||||
|
||||
# Ensure all expected proposers have been rewarded
|
||||
# Track rewarde indices
|
||||
# Track reward indices
|
||||
proposing_indices = [a.proposer_index for a in eligible_attestations]
|
||||
for index in proposing_indices:
|
||||
if index in rewarded_proposer_indices:
|
||||
|
||||
@@ -7,7 +7,7 @@ def set_validator_fully_withdrawable(spec, state, index, withdrawable_epoch=None
|
||||
|
||||
validator = state.validators[index]
|
||||
validator.withdrawable_epoch = withdrawable_epoch
|
||||
# set exit epoch as well to avoid interactions with other epoch process, e.g. forced ejecions
|
||||
# set exit epoch as well to avoid interactions with other epoch process, e.g. forced ejections
|
||||
if validator.exit_epoch > withdrawable_epoch:
|
||||
validator.exit_epoch = withdrawable_epoch
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ def test_activation_queue_no_activation_no_finality(spec, state):
|
||||
def test_activation_queue_sorting(spec, state):
|
||||
churn_limit = spec.get_validator_churn_limit(state)
|
||||
|
||||
# try to activate more than the per-epoch churn linmit
|
||||
# try to activate more than the per-epoch churn limit
|
||||
mock_activations = churn_limit * 2
|
||||
|
||||
epoch = spec.get_current_epoch(state)
|
||||
|
||||
@@ -40,7 +40,7 @@ Blocks must be processed in order, following the main transition function
|
||||
Blocks are encoded as `SignedBeaconBlock`s from the relevant spec version
|
||||
as indicated by the `post_fork` and `fork_block` data in the `meta.yaml`.
|
||||
|
||||
As blocks span fork boundaires, a `fork_block` number is given in
|
||||
As blocks span fork boundaries, a `fork_block` number is given in
|
||||
the `meta.yaml` to help resolve which blocks belong to which fork.
|
||||
|
||||
The `fork_block` is the index in the test data of the **last** block
|
||||
|
||||
Reference in New Issue
Block a user