This commit is contained in:
dapplion 2024-03-13 00:23:47 +08:00
parent c5af391ad4
commit fc65a6f864
5 changed files with 9914 additions and 7 deletions

View File

@ -58,10 +58,11 @@
- [Updated `process_operations`](#updated-process_operations) - [Updated `process_operations`](#updated-process_operations)
- [Deposits](#deposits) - [Deposits](#deposits)
- [Updated `apply_deposit`](#updated--apply_deposit) - [Updated `apply_deposit`](#updated--apply_deposit)
- [Modified `add_validator_to_registry`](#modified-add_validator_to_registry)
- [Updated `get_validator_from_deposit`](#updated-get_validator_from_deposit) - [Updated `get_validator_from_deposit`](#updated-get_validator_from_deposit)
- [Withdrawals](#withdrawals) - [Withdrawals](#withdrawals)
- [New `process_execution_layer_withdraw_request`](#new-process_execution_layer_withdraw_request) - [New `process_execution_layer_withdraw_request`](#new-process_execution_layer_withdraw_request)
- [Updated `get_expected_withdrawals`](#updated--get_expected_withdrawals) - [Updated `get_expected_withdrawals`](#updated-get_expected_withdrawals)
- [Consolidations](#consolidations) - [Consolidations](#consolidations)
- [New `process_consolidation`](#new-process_consolidation) - [New `process_consolidation`](#new-process_consolidation)
@ -691,9 +692,9 @@ def process_execution_layer_withdraw_request(
# Verify the validator is active # Verify the validator is active
and is_active_validator(validator, get_current_epoch(state)) and is_active_validator(validator, get_current_epoch(state))
# Verify exit has not been initiated, and slashed # Verify exit has not been initiated, and slashed
validator.exit_epoch == FAR_FUTURE_EPOCH and validator.exit_epoch == FAR_FUTURE_EPOCH
# Verify the validator has been active long enough # Verify the validator has been active long enough
get_current_epoch(state) >= validator.activation_epoch + SHARD_COMMITTEE_PERIOD and get_current_epoch(state) >= validator.activation_epoch + SHARD_COMMITTEE_PERIOD
): ):
return return
# New condition: only allow partial withdrawals with compounding withdrawal credentials # New condition: only allow partial withdrawals with compounding withdrawal credentials
@ -705,10 +706,10 @@ def process_execution_layer_withdraw_request(
) )
# only exit validator if it has no pending withdrawals in the queue # only exit validator if it has no pending withdrawals in the queue
if is_full_exit_request and pending_balance_to_withdraw == 0: if is_full_exit_request and pending_balance_to_withdraw == 0:
initiate_validator_exit(state, validator_index) initiate_validator_exit(state, index)
elif state.balances[validator_index] > MIN_ACTIVATION_BALANCE + pending_balance_to_withdraw: elif state.balances[index] > MIN_ACTIVATION_BALANCE + pending_balance_to_withdraw:
to_withdraw = min( to_withdraw = min(
state.balances[validator_index] - MIN_ACTIVATION_BALANCE - pending_balance_to_withdraw, state.balances[index] - MIN_ACTIVATION_BALANCE - pending_balance_to_withdraw,
amount amount
) )
exit_queue_epoch = compute_exit_epoch_and_update_churn(state, to_withdraw) exit_queue_epoch = compute_exit_epoch_and_update_churn(state, to_withdraw)

View File

@ -29,7 +29,8 @@ This document represents the changes to be made in the code of an "honest valida
Aggregator selection is now balance based. `state` is the `BeaconState` at the previous epoch of `slot` to allow lookahead. Aggregator selection is now balance based. `state` is the `BeaconState` at the previous epoch of `slot` to allow lookahead.
```python ```python
def is_aggregator(state: BeaconState, slot: Slot, index: CommitteeIndex, slot_signature: BLSSignature) -> bool: def is_aggregator(state: BeaconState, slot: Slot, index: CommitteeIndex,
slot_signature: BLSSignature, validator: ValidatorIndex) -> bool:
committee = get_beacon_committee(state, slot, index) committee = get_beacon_committee(state, slot, index)
committee_balance = get_total_balance(state, set(committee)) committee_balance = get_total_balance(state, set(committee))
balance = state.balances[validator] balance = state.balances[validator]

View File

@ -0,0 +1 @@
from . import mainnet as spec # noqa:F401

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long