state_processing: remove spurious withdrawal credentials check

This commit is contained in:
Michael Sproul 2019-05-29 10:56:21 +10:00
parent 706f850c9e
commit 37c67117d3
No known key found for this signature in database
GPG Key ID: 77B1309D2E54E914
3 changed files with 1 additions and 18 deletions

View File

@ -386,8 +386,6 @@ pub fn process_deposits<T: EthSpec>(
// Get an `Option<u64>` where `u64` is the validator index if this deposit public key
// already exists in the beacon_state.
//
// This function also verifies the withdrawal credentials.
let validator_index =
get_existing_validator_index(state, deposit).map_err(|e| e.into_with_index(i))?;

View File

@ -323,9 +323,6 @@ pub enum DepositInvalid {
BadIndex { state: u64, deposit: u64 },
/// The signature (proof-of-possession) does not match the given pubkey.
BadSignature,
/// The withdrawal credentials for the depositing validator did not match the withdrawal
/// credentials of an existing validator with the same public key.
BadWithdrawalCredentials,
/// The specified `branch` and `index` did not form a valid proof that the deposit is included
/// in the eth1 deposit root.
BadMerkleProof,

View File

@ -52,19 +52,7 @@ pub fn get_existing_validator_index<T: EthSpec>(
deposit: &Deposit,
) -> Result<Option<u64>, Error> {
let validator_index = state.get_validator_index(&deposit.data.pubkey)?;
// NOTE: it seems that v0.6.1 doesn't require the withdrawal credentials to be checked
match validator_index {
None => Ok(None),
Some(index) => {
verify!(
deposit.data.withdrawal_credentials
== state.validator_registry[index].withdrawal_credentials,
Invalid::BadWithdrawalCredentials
);
Ok(Some(index as u64))
}
}
Ok(validator_index.map(|idx| idx as u64))
}
/// Verify that a deposit is included in the state's eth1 deposit root.