From 37c67117d3d4669bbac572711fc00221b7af3662 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Wed, 29 May 2019 10:56:21 +1000 Subject: [PATCH] state_processing: remove spurious withdrawal credentials check --- eth2/state_processing/src/per_block_processing.rs | 2 -- .../src/per_block_processing/errors.rs | 3 --- .../src/per_block_processing/verify_deposit.rs | 14 +------------- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/eth2/state_processing/src/per_block_processing.rs b/eth2/state_processing/src/per_block_processing.rs index 79a452185..fba96b833 100644 --- a/eth2/state_processing/src/per_block_processing.rs +++ b/eth2/state_processing/src/per_block_processing.rs @@ -386,8 +386,6 @@ pub fn process_deposits( // Get an `Option` 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))?; diff --git a/eth2/state_processing/src/per_block_processing/errors.rs b/eth2/state_processing/src/per_block_processing/errors.rs index 1c5514516..41e6410be 100644 --- a/eth2/state_processing/src/per_block_processing/errors.rs +++ b/eth2/state_processing/src/per_block_processing/errors.rs @@ -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, diff --git a/eth2/state_processing/src/per_block_processing/verify_deposit.rs b/eth2/state_processing/src/per_block_processing/verify_deposit.rs index 6c3109764..da2353bb9 100644 --- a/eth2/state_processing/src/per_block_processing/verify_deposit.rs +++ b/eth2/state_processing/src/per_block_processing/verify_deposit.rs @@ -52,19 +52,7 @@ pub fn get_existing_validator_index( deposit: &Deposit, ) -> Result, 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.