From 0199c7d3f24ed808f1b08b4a226cf22209ab86b0 Mon Sep 17 00:00:00 2001 From: Mark Mackey Date: Thu, 16 May 2024 12:55:03 +0300 Subject: [PATCH] Fix Bug In Block Processing with 0x02 Credentials --- .../state_processing/src/per_block_processing.rs | 4 ++-- consensus/types/src/validator.rs | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/consensus/state_processing/src/per_block_processing.rs b/consensus/state_processing/src/per_block_processing.rs index 0f67dd95f85..05621d188be 100644 --- a/consensus/state_processing/src/per_block_processing.rs +++ b/consensus/state_processing/src/per_block_processing.rs @@ -566,7 +566,7 @@ pub fn get_expected_withdrawals( index: withdrawal_index, validator_index, address: validator - .get_eth1_withdrawal_address(spec) + .get_execution_withdrawal_address(spec) .ok_or(BlockProcessingError::WithdrawalCredentialsInvalid)?, amount: balance, }); @@ -576,7 +576,7 @@ pub fn get_expected_withdrawals( index: withdrawal_index, validator_index, address: validator - .get_eth1_withdrawal_address(spec) + .get_execution_withdrawal_address(spec) .ok_or(BlockProcessingError::WithdrawalCredentialsInvalid)?, amount: balance.safe_sub( validator diff --git a/consensus/types/src/validator.rs b/consensus/types/src/validator.rs index ea83495c09b..1eb8dc12a8e 100644 --- a/consensus/types/src/validator.rs +++ b/consensus/types/src/validator.rs @@ -130,18 +130,6 @@ impl Validator { is_compounding_withdrawal_credential(self.withdrawal_credentials, spec) } - /// Get the eth1 withdrawal address if this validator has one initialized. - pub fn get_eth1_withdrawal_address(&self, spec: &ChainSpec) -> Option
{ - self.has_eth1_withdrawal_credential(spec) - .then(|| { - self.withdrawal_credentials - .as_bytes() - .get(12..) - .map(Address::from_slice) - }) - .flatten() - } - /// Get the execution withdrawal address if this validator has one initialized. pub fn get_execution_withdrawal_address(&self, spec: &ChainSpec) -> Option
{ self.has_execution_withdrawal_credential(spec)