merge in `dev` and resolve conflicts
This commit is contained in:
commit
6e5f43c033
|
@ -49,9 +49,9 @@
|
||||||
- [`BeaconState`](#beaconstate)
|
- [`BeaconState`](#beaconstate)
|
||||||
- [Helper functions](#helper-functions)
|
- [Helper functions](#helper-functions)
|
||||||
- [Math](#math)
|
- [Math](#math)
|
||||||
|
- [`int_to_bytes`](#int_to_bytes)
|
||||||
- [`integer_squareroot`](#integer_squareroot)
|
- [`integer_squareroot`](#integer_squareroot)
|
||||||
- [`xor`](#xor)
|
- [`xor`](#xor)
|
||||||
- [`int_to_bytes`](#int_to_bytes)
|
|
||||||
- [`bytes_to_int`](#bytes_to_int)
|
- [`bytes_to_int`](#bytes_to_int)
|
||||||
- [Crypto](#crypto)
|
- [Crypto](#crypto)
|
||||||
- [`hash`](#hash)
|
- [`hash`](#hash)
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
- [`is_slashable_validator`](#is_slashable_validator)
|
- [`is_slashable_validator`](#is_slashable_validator)
|
||||||
- [`is_slashable_attestation_data`](#is_slashable_attestation_data)
|
- [`is_slashable_attestation_data`](#is_slashable_attestation_data)
|
||||||
- [`is_valid_merkle_branch`](#is_valid_merkle_branch)
|
- [`is_valid_merkle_branch`](#is_valid_merkle_branch)
|
||||||
- [Misc](#misc)
|
- [Misc](#misc-1)
|
||||||
- [`compute_shuffled_index`](#compute_shuffled_index)
|
- [`compute_shuffled_index`](#compute_shuffled_index)
|
||||||
- [`compute_committee`](#compute_committee)
|
- [`compute_committee`](#compute_committee)
|
||||||
- [`compute_epoch_of_slot`](#compute_epoch_of_slot)
|
- [`compute_epoch_of_slot`](#compute_epoch_of_slot)
|
||||||
|
@ -90,6 +90,7 @@
|
||||||
- [`get_attestation_data_slot`](#get_attestation_data_slot)
|
- [`get_attestation_data_slot`](#get_attestation_data_slot)
|
||||||
- [`get_compact_committees_root`](#get_compact_committees_root)
|
- [`get_compact_committees_root`](#get_compact_committees_root)
|
||||||
- [`get_total_balance`](#get_total_balance)
|
- [`get_total_balance`](#get_total_balance)
|
||||||
|
- [`get_total_active_balance`](#get_total_active_balance)
|
||||||
- [`get_domain`](#get_domain)
|
- [`get_domain`](#get_domain)
|
||||||
- [`get_indexed_attestation`](#get_indexed_attestation)
|
- [`get_indexed_attestation`](#get_indexed_attestation)
|
||||||
- [`get_attesting_indices`](#get_attesting_indices)
|
- [`get_attesting_indices`](#get_attesting_indices)
|
||||||
|
@ -1438,8 +1439,8 @@ def process_registry_updates(state: BeaconState) -> None:
|
||||||
# Process activation eligibility and ejections
|
# Process activation eligibility and ejections
|
||||||
for index, validator in enumerate(state.validators):
|
for index, validator in enumerate(state.validators):
|
||||||
if (
|
if (
|
||||||
validator.activation_eligibility_epoch == FAR_FUTURE_EPOCH and
|
validator.activation_eligibility_epoch == FAR_FUTURE_EPOCH
|
||||||
validator.effective_balance == MAX_EFFECTIVE_BALANCE
|
and validator.effective_balance == MAX_EFFECTIVE_BALANCE
|
||||||
):
|
):
|
||||||
validator.activation_eligibility_epoch = get_current_epoch(state)
|
validator.activation_eligibility_epoch = get_current_epoch(state)
|
||||||
|
|
||||||
|
@ -1448,9 +1449,9 @@ def process_registry_updates(state: BeaconState) -> None:
|
||||||
|
|
||||||
# Queue validators eligible for activation and not dequeued for activation prior to finalized epoch
|
# Queue validators eligible for activation and not dequeued for activation prior to finalized epoch
|
||||||
activation_queue = sorted([
|
activation_queue = sorted([
|
||||||
index for index, validator in enumerate(state.validators) if
|
index for index, validator in enumerate(state.validators)
|
||||||
validator.activation_eligibility_epoch != FAR_FUTURE_EPOCH and
|
if validator.activation_eligibility_epoch != FAR_FUTURE_EPOCH
|
||||||
validator.activation_epoch >= compute_activation_exit_epoch(state.finalized_checkpoint.epoch)
|
and validator.activation_epoch >= compute_activation_exit_epoch(state.finalized_checkpoint.epoch)
|
||||||
], key=lambda index: state.validators[index].activation_eligibility_epoch)
|
], key=lambda index: state.validators[index].activation_eligibility_epoch)
|
||||||
# Dequeued validators for activation up to churn limit (without resetting activation epoch)
|
# Dequeued validators for activation up to churn limit (without resetting activation epoch)
|
||||||
for index in activation_queue[:get_validator_churn_limit(state)]:
|
for index in activation_queue[:get_validator_churn_limit(state)]:
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
- [Time parameters](#time-parameters)
|
- [Time parameters](#time-parameters)
|
||||||
- [Fork choice](#fork-choice)
|
- [Fork choice](#fork-choice)
|
||||||
- [Helpers](#helpers)
|
- [Helpers](#helpers)
|
||||||
- [`Checkpoint`](#checkpoint)
|
- [`LatestMessage`](#latestmessage)
|
||||||
- [`Store`](#store)
|
- [`Store`](#store)
|
||||||
- [`get_genesis_store`](#get_genesis_store)
|
- [`get_genesis_store`](#get_genesis_store)
|
||||||
- [`get_ancestor`](#get_ancestor)
|
- [`get_ancestor`](#get_ancestor)
|
||||||
|
@ -113,8 +113,8 @@ def get_latest_attesting_balance(store: Store, root: Hash) -> Gwei:
|
||||||
active_indices = get_active_validator_indices(state, get_current_epoch(state))
|
active_indices = get_active_validator_indices(state, get_current_epoch(state))
|
||||||
return Gwei(sum(
|
return Gwei(sum(
|
||||||
state.validators[i].effective_balance for i in active_indices
|
state.validators[i].effective_balance for i in active_indices
|
||||||
if (i in store.latest_messages and
|
if (i in store.latest_messages
|
||||||
get_ancestor(store, store.latest_messages[i].root, store.blocks[root].slot) == root)
|
and get_ancestor(store, store.latest_messages[i].root, store.blocks[root].slot) == root)
|
||||||
))
|
))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
- [Max operations per block](#max-operations-per-block)
|
- [Max operations per block](#max-operations-per-block)
|
||||||
- [Reward and penalty quotients](#reward-and-penalty-quotients)
|
- [Reward and penalty quotients](#reward-and-penalty-quotients)
|
||||||
- [Signature domains](#signature-domains)
|
- [Signature domains](#signature-domains)
|
||||||
|
- [TODO PLACEHOLDER](#todo-placeholder)
|
||||||
- [Data structures](#data-structures)
|
- [Data structures](#data-structures)
|
||||||
- [Custody objects](#custody-objects)
|
- [Custody objects](#custody-objects)
|
||||||
- [`CustodyChunkChallenge`](#custodychunkchallenge)
|
- [`CustodyChunkChallenge`](#custodychunkchallenge)
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
- [Helpers](#helpers)
|
- [Helpers](#helpers)
|
||||||
- [`ceillog2`](#ceillog2)
|
- [`ceillog2`](#ceillog2)
|
||||||
- [`get_crosslink_chunk_count`](#get_crosslink_chunk_count)
|
- [`get_crosslink_chunk_count`](#get_crosslink_chunk_count)
|
||||||
|
- [`get_bit`](#get_bit)
|
||||||
- [`get_custody_chunk_bit`](#get_custody_chunk_bit)
|
- [`get_custody_chunk_bit`](#get_custody_chunk_bit)
|
||||||
- [`get_chunk_bits_root`](#get_chunk_bits_root)
|
- [`get_chunk_bits_root`](#get_chunk_bits_root)
|
||||||
- [`get_randao_epoch_for_custody_period`](#get_randao_epoch_for_custody_period)
|
- [`get_randao_epoch_for_custody_period`](#get_randao_epoch_for_custody_period)
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
- [Initial values](#initial-values)
|
- [Initial values](#initial-values)
|
||||||
- [Time parameters](#time-parameters)
|
- [Time parameters](#time-parameters)
|
||||||
- [Signature domains](#signature-domains)
|
- [Signature domains](#signature-domains)
|
||||||
|
- [TODO PLACEHOLDER](#todo-placeholder)
|
||||||
- [Data structures](#data-structures)
|
- [Data structures](#data-structures)
|
||||||
- [`ShardBlockBody`](#shardblockbody)
|
- [`ShardBlockBody`](#shardblockbody)
|
||||||
- [`ShardAttestation`](#shardattestation)
|
- [`ShardAttestation`](#shardattestation)
|
||||||
|
@ -181,8 +182,8 @@ def get_persistent_committee(state: BeaconState,
|
||||||
# Take not-yet-cycled-out validators from earlier committee and already-cycled-in validators from
|
# Take not-yet-cycled-out validators from earlier committee and already-cycled-in validators from
|
||||||
# later committee; return a sorted list of the union of the two, deduplicated
|
# later committee; return a sorted list of the union of the two, deduplicated
|
||||||
return sorted(list(set(
|
return sorted(list(set(
|
||||||
[i for i in earlier_committee if epoch % PERSISTENT_COMMITTEE_PERIOD < get_switchover_epoch(state, epoch, i)] +
|
[i for i in earlier_committee if epoch % PERSISTENT_COMMITTEE_PERIOD < get_switchover_epoch(state, epoch, i)]
|
||||||
[i for i in later_committee if epoch % PERSISTENT_COMMITTEE_PERIOD >= get_switchover_epoch(state, epoch, i)]
|
+ [i for i in later_committee if epoch % PERSISTENT_COMMITTEE_PERIOD >= get_switchover_epoch(state, epoch, i)]
|
||||||
)))
|
)))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -398,8 +399,8 @@ def is_valid_beacon_attestation(shard: Shard,
|
||||||
assert candidate.data.previous_crosslink.data_root == Hash()
|
assert candidate.data.previous_crosslink.data_root == Hash()
|
||||||
else:
|
else:
|
||||||
previous_attestation = next(
|
previous_attestation = next(
|
||||||
(attestation for attestation in valid_attestations if
|
(attestation for attestation in valid_attestations
|
||||||
attestation.data.crosslink.data_root == candidate.data.previous_crosslink.data_root),
|
if attestation.data.crosslink.data_root == candidate.data.previous_crosslink.data_root),
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
assert previous_attestation is not None
|
assert previous_attestation is not None
|
||||||
|
|
|
@ -153,8 +153,8 @@ def compute_committee(header: BeaconBlockHeader,
|
||||||
# Take not-yet-cycled-out validators from earlier committee and already-cycled-in validators from
|
# Take not-yet-cycled-out validators from earlier committee and already-cycled-in validators from
|
||||||
# later committee; return a sorted list of the union of the two, deduplicated
|
# later committee; return a sorted list of the union of the two, deduplicated
|
||||||
return sorted(list(set(
|
return sorted(list(set(
|
||||||
[i for i in actual_earlier_committee if epoch % PERSISTENT_COMMITTEE_PERIOD < get_switchover_epoch(i)] +
|
[i for i in actual_earlier_committee if epoch % PERSISTENT_COMMITTEE_PERIOD < get_switchover_epoch(i)]
|
||||||
[i for i in actual_later_committee if epoch % PERSISTENT_COMMITTEE_PERIOD >= get_switchover_epoch(i)]
|
+ [i for i in actual_later_committee if epoch % PERSISTENT_COMMITTEE_PERIOD >= get_switchover_epoch(i)]
|
||||||
)))
|
)))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -132,10 +132,9 @@ Once a validator is activated, the validator is assigned [responsibilities](#bea
|
||||||
A validator can get committee assignments for a given epoch using the following helper via `get_committee_assignment(state, epoch, validator_index)` where `epoch <= next_epoch`.
|
A validator can get committee assignments for a given epoch using the following helper via `get_committee_assignment(state, epoch, validator_index)` where `epoch <= next_epoch`.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def get_committee_assignment(
|
def get_committee_assignment(state: BeaconState,
|
||||||
state: BeaconState,
|
epoch: Epoch,
|
||||||
epoch: Epoch,
|
validator_index: ValidatorIndex) -> Tuple[List[ValidatorIndex], Shard, Slot]:
|
||||||
validator_index: ValidatorIndex) -> Tuple[List[ValidatorIndex], Shard, Slot]:
|
|
||||||
"""
|
"""
|
||||||
Return the committee assignment in the ``epoch`` for ``validator_index``.
|
Return the committee assignment in the ``epoch`` for ``validator_index``.
|
||||||
``assignment`` returned is a tuple of the following form:
|
``assignment`` returned is a tuple of the following form:
|
||||||
|
|
|
@ -188,8 +188,8 @@ def test_attester_slashing(spec, state):
|
||||||
pre_state = deepcopy(state)
|
pre_state = deepcopy(state)
|
||||||
|
|
||||||
attester_slashing = get_valid_attester_slashing(spec, state, signed_1=True, signed_2=True)
|
attester_slashing = get_valid_attester_slashing(spec, state, signed_1=True, signed_2=True)
|
||||||
validator_index = (attester_slashing.attestation_1.custody_bit_0_indices +
|
validator_index = (attester_slashing.attestation_1.custody_bit_0_indices
|
||||||
attester_slashing.attestation_1.custody_bit_1_indices)[0]
|
+ attester_slashing.attestation_1.custody_bit_1_indices)[0]
|
||||||
|
|
||||||
assert not state.validators[validator_index].slashed
|
assert not state.validators[validator_index].slashed
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue