mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-11 18:16:56 +00:00
Merge pull request #750 from ethereum/JustinDrake-patch-7
Do not check withdrawal credentials for existing validators
This commit is contained in:
commit
54fae53ce6
@ -1305,6 +1305,12 @@ def process_deposit(state: BeaconState, deposit: Deposit) -> None:
|
|||||||
# object, and we need to be able to skip over it
|
# object, and we need to be able to skip over it
|
||||||
state.deposit_index += 1
|
state.deposit_index += 1
|
||||||
|
|
||||||
|
validator_pubkeys = [v.pubkey for v in state.validator_registry]
|
||||||
|
pubkey = deposit_input.pubkey
|
||||||
|
amount = deposit.deposit_data.amount
|
||||||
|
withdrawal_credentials = deposit_input.withdrawal_credentials
|
||||||
|
|
||||||
|
if pubkey not in validator_pubkeys:
|
||||||
# Verify the proof of possession
|
# Verify the proof of possession
|
||||||
proof_is_valid = bls_verify(
|
proof_is_valid = bls_verify(
|
||||||
pubkey=deposit_input.pubkey,
|
pubkey=deposit_input.pubkey,
|
||||||
@ -1316,16 +1322,9 @@ def process_deposit(state: BeaconState, deposit: Deposit) -> None:
|
|||||||
DOMAIN_DEPOSIT,
|
DOMAIN_DEPOSIT,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not proof_is_valid:
|
if not proof_is_valid:
|
||||||
return
|
return
|
||||||
|
|
||||||
validator_pubkeys = [v.pubkey for v in state.validator_registry]
|
|
||||||
pubkey = deposit_input.pubkey
|
|
||||||
amount = deposit.deposit_data.amount
|
|
||||||
withdrawal_credentials = deposit_input.withdrawal_credentials
|
|
||||||
|
|
||||||
if pubkey not in validator_pubkeys:
|
|
||||||
# Add new validator
|
# Add new validator
|
||||||
validator = Validator(
|
validator = Validator(
|
||||||
pubkey=pubkey,
|
pubkey=pubkey,
|
||||||
@ -1342,10 +1341,7 @@ def process_deposit(state: BeaconState, deposit: Deposit) -> None:
|
|||||||
state.validator_balances.append(amount)
|
state.validator_balances.append(amount)
|
||||||
else:
|
else:
|
||||||
# Increase balance by deposit amount
|
# Increase balance by deposit amount
|
||||||
index = validator_pubkeys.index(pubkey)
|
state.validator_balances[validator_pubkeys.index(pubkey)] += amount
|
||||||
assert state.validator_registry[index].withdrawal_credentials == withdrawal_credentials
|
|
||||||
|
|
||||||
state.validator_balances[index] += amount
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Routines for updating validator status
|
### Routines for updating validator status
|
||||||
|
Loading…
x
Reference in New Issue
Block a user