Skip to content

Commit

Permalink
Rename ACTIVATION_EXIT_DELAY to MAX_SEED_LOOKAHEAD for phase 1
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinDrake committed Sep 23, 2019
1 parent 57b468e commit 3a50c0b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion configs/mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ SLOTS_PER_EPOCH: 64
# 2**0 (= 1) epochs 6.4 minutes
MIN_SEED_LOOKAHEAD: 1
# 2**2 (= 4) epochs 25.6 minutes
ACTIVATION_EXIT_DELAY: 4
MAX_SEED_LOOKAHEAD: 4
# 2**10 (= 1,024) slots ~1.7 hours
SLOTS_PER_ETH1_VOTING_PERIOD: 1024
# 2**13 (= 8,192) slots ~13 hours
Expand Down
2 changes: 1 addition & 1 deletion configs/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ SLOTS_PER_EPOCH: 8
# 2**0 (= 1) epochs
MIN_SEED_LOOKAHEAD: 1
# 2**2 (= 4) epochs
ACTIVATION_EXIT_DELAY: 4
MAX_SEED_LOOKAHEAD: 4
# [customized] higher frequency new deposits from eth1 for testing
SLOTS_PER_ETH1_VOTING_PERIOD: 16
# [customized] smaller state
Expand Down
4 changes: 2 additions & 2 deletions specs/core/0_beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ The following values are (non-configurable) constants used throughout the specif
| `MIN_ATTESTATION_INCLUSION_DELAY` | `2**0` (= 1) | slots | 6 seconds |
| `SLOTS_PER_EPOCH` | `2**6` (= 64) | slots | 6.4 minutes |
| `MIN_SEED_LOOKAHEAD` | `2**0` (= 1) | epochs | 6.4 minutes |
| `ACTIVATION_EXIT_DELAY` | `2**2` (= 4) | epochs | 25.6 minutes |
| `MAX_SEED_LOOKAHEAD` | `2**2` (= 4) | epochs | 25.6 minutes |
| `SLOTS_PER_ETH1_VOTING_PERIOD` | `2**10` (= 1,024) | slots | ~1.7 hours |
| `SLOTS_PER_HISTORICAL_ROOT` | `2**13` (= 8,192) | slots | ~13 hours |
| `MIN_VALIDATOR_WITHDRAWABILITY_DELAY` | `2**8` (= 256) | epochs | ~27 hours |
Expand Down Expand Up @@ -779,7 +779,7 @@ def compute_activation_exit_epoch(epoch: Epoch) -> Epoch:
"""
Return the epoch during which validator activations and exits initiated in ``epoch`` take effect.
"""
return Epoch(epoch + 1 + ACTIVATION_EXIT_DELAY)
return Epoch(epoch + 1 + MAX_SEED_LOOKAHEAD)
```

#### `compute_domain`
Expand Down
8 changes: 4 additions & 4 deletions specs/core/1_custody-game.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def ceillog2(x: uint64) -> int:
### `is_valid_merkle_branch_with_mixin`

```python
def is_valid_merkle_branch_with_mixin(leaf: Hash,
def is_valid_merkle_branch_with_mixin(leaf: Hash,
branch: Sequence[Hash],
depth: uint64,
index: uint64,
Expand Down Expand Up @@ -315,7 +315,7 @@ def legendre_bit(a: int, q: int) -> int:
if a >= q:
return legendre_bit(a % q, q)
if a == 0:
return 0
return 0
assert(q > a > 0 and q % 2 == 1)
t = 1
n = q
Expand Down Expand Up @@ -602,7 +602,7 @@ def process_bit_challenge(state: BeaconState, challenge: CustodyBitChallenge) ->
# Verify attestation is eligible for challenging
responder = state.validators[challenge.responder_index]
assert get_current_epoch(state) <= get_randao_epoch_for_custody_period(
get_custody_period_for_validator(state, challenge.responder_index, epoch),
get_custody_period_for_validator(state, challenge.responder_index, epoch),
challenge.responder_index
) + 2 * EPOCHS_PER_CUSTODY_PERIOD + responder.max_reveal_lateness

Expand Down Expand Up @@ -673,7 +673,7 @@ def process_chunk_challenge_response(state: BeaconState,
# Verify bit challenge data is null
assert response.chunk_bits_branch == [] and response.chunk_bits_leaf == Hash()
# Verify minimum delay
assert get_current_epoch(state) >= challenge.inclusion_epoch + ACTIVATION_EXIT_DELAY
assert get_current_epoch(state) >= challenge.inclusion_epoch + MAX_SEED_LOOKAHEAD
# Verify the chunk matches the crosslink data root
assert is_valid_merkle_branch(
leaf=hash_tree_root(response.chunk),
Expand Down
2 changes: 1 addition & 1 deletion specs/validator/0_beacon-chain-validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Once a validator has been processed and added to the beacon state's `validators`

### Activation

In normal operation, the validator is quickly activated, at which point the validator is added to the shuffling and begins validation after an additional `ACTIVATION_EXIT_DELAY` epochs (25.6 minutes).
In normal operation, the validator is quickly activated, at which point the validator is added to the shuffling and begins validation after an additional `MAX_SEED_LOOKAHEAD` epochs (25.6 minutes).

The function [`is_active_validator`](../core/0_beacon-chain.md#is_active_validator) can be used to check if a validator is active during a given epoch. Usage is as follows:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_activation(spec, state):
index = 0
mock_deposit(spec, state, index)

for _ in range(spec.ACTIVATION_EXIT_DELAY + 1):
for _ in range(spec.MAX_SEED_LOOKAHEAD + 1):
next_epoch(spec, state)

yield from run_process_registry_updates(spec, state)
Expand Down Expand Up @@ -73,7 +73,7 @@ def test_ejection(spec, state):
# Mock an ejection
state.validators[index].effective_balance = spec.EJECTION_BALANCE

for _ in range(spec.ACTIVATION_EXIT_DELAY + 1):
for _ in range(spec.MAX_SEED_LOOKAHEAD + 1):
next_epoch(spec, state)

yield from run_process_registry_updates(spec, state)
Expand Down

0 comments on commit 3a50c0b

Please sign in to comment.