Merge branch 'dev' into official-kzg
This commit is contained in:
commit
8d91941818
|
@ -415,23 +415,10 @@ def get_initial_tracker(k: BLSFieldElement) -> WhiskTracker:
|
||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def apply_deposit(state: BeaconState,
|
def add_validator_to_registry(state: BeaconState,
|
||||||
pubkey: BLSPubkey,
|
pubkey: BLSPubkey,
|
||||||
withdrawal_credentials: Bytes32,
|
withdrawal_credentials: Bytes32,
|
||||||
amount: uint64,
|
amount: uint64) -> None:
|
||||||
signature: BLSSignature) -> None:
|
|
||||||
validator_pubkeys = [validator.pubkey for validator in state.validators]
|
|
||||||
if pubkey not in validator_pubkeys:
|
|
||||||
# Verify the deposit signature (proof of possession) which is not checked by the deposit contract
|
|
||||||
deposit_message = DepositMessage(
|
|
||||||
pubkey=pubkey,
|
|
||||||
withdrawal_credentials=withdrawal_credentials,
|
|
||||||
amount=amount,
|
|
||||||
)
|
|
||||||
domain = compute_domain(DOMAIN_DEPOSIT) # Fork-agnostic domain since deposits are valid across forks
|
|
||||||
signing_root = compute_signing_root(deposit_message, domain)
|
|
||||||
# Initialize validator if the deposit signature is valid
|
|
||||||
if bls.Verify(pubkey, signing_root, signature):
|
|
||||||
index = get_index_for_new_validator(state)
|
index = get_index_for_new_validator(state)
|
||||||
validator = get_validator_from_deposit(pubkey, withdrawal_credentials, amount)
|
validator = get_validator_from_deposit(pubkey, withdrawal_credentials, amount)
|
||||||
set_or_append_list(state.validators, index, validator)
|
set_or_append_list(state.validators, index, validator)
|
||||||
|
@ -443,10 +430,6 @@ def apply_deposit(state: BeaconState,
|
||||||
k = get_unique_whisk_k(state, ValidatorIndex(len(state.validators) - 1))
|
k = get_unique_whisk_k(state, ValidatorIndex(len(state.validators) - 1))
|
||||||
state.whisk_trackers.append(get_initial_tracker(k))
|
state.whisk_trackers.append(get_initial_tracker(k))
|
||||||
state.whisk_k_commitments.append(get_k_commitment(k))
|
state.whisk_k_commitments.append(get_k_commitment(k))
|
||||||
else:
|
|
||||||
# Increase balance by deposit amount
|
|
||||||
index = ValidatorIndex(validator_pubkeys.index(pubkey))
|
|
||||||
increase_balance(state, index, amount)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### `get_beacon_proposer_index`
|
### `get_beacon_proposer_index`
|
||||||
|
|
|
@ -76,7 +76,7 @@ Alias `block = signed_beacon_block.message`, `execution_payload = block.body.exe
|
||||||
then validate the following:
|
then validate the following:
|
||||||
- _[REJECT]_ The block's execution payload timestamp is correct with respect to the slot
|
- _[REJECT]_ The block's execution payload timestamp is correct with respect to the slot
|
||||||
-- i.e. `execution_payload.timestamp == compute_timestamp_at_slot(state, block.slot)`.
|
-- i.e. `execution_payload.timestamp == compute_timestamp_at_slot(state, block.slot)`.
|
||||||
- If `exection_payload` verification of block's parent by an execution node is *not* complete:
|
- If `execution_payload` verification of block's parent by an execution node is *not* complete:
|
||||||
- [REJECT] The block's parent (defined by `block.parent_root`) passes all
|
- [REJECT] The block's parent (defined by `block.parent_root`) passes all
|
||||||
validation (excluding execution node verification of the `block.body.execution_payload`).
|
validation (excluding execution node verification of the `block.body.execution_payload`).
|
||||||
- otherwise:
|
- otherwise:
|
||||||
|
|
|
@ -373,8 +373,8 @@ def test_invalid_signature_previous_committee(spec, state):
|
||||||
current_epoch = spec.get_current_epoch(state)
|
current_epoch = spec.get_current_epoch(state)
|
||||||
old_sync_committee = state.next_sync_committee
|
old_sync_committee = state.next_sync_committee
|
||||||
|
|
||||||
epoch_in_future_sync_commitee_period = current_epoch + 2 * spec.EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
epoch_in_future_sync_committee_period = current_epoch + 2 * spec.EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||||
slot_in_future_sync_committee_period = epoch_in_future_sync_commitee_period * spec.SLOTS_PER_EPOCH
|
slot_in_future_sync_committee_period = epoch_in_future_sync_committee_period * spec.SLOTS_PER_EPOCH
|
||||||
transition_to(spec, state, slot_in_future_sync_committee_period)
|
transition_to(spec, state, slot_in_future_sync_committee_period)
|
||||||
|
|
||||||
# Use the previous sync committee to produce the signature.
|
# Use the previous sync committee to produce the signature.
|
||||||
|
|
Loading…
Reference in New Issue