Skip to content

Commit

Permalink
Fix Bug In Block Processing with 0x02 Credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
ethDreamer authored and realbigsean committed Jun 25, 2024
1 parent 4d61a91 commit 0199c7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
4 changes: 2 additions & 2 deletions consensus/state_processing/src/per_block_processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ pub fn get_expected_withdrawals<E: EthSpec>(
index: withdrawal_index,
validator_index,
address: validator
.get_eth1_withdrawal_address(spec)
.get_execution_withdrawal_address(spec)
.ok_or(BlockProcessingError::WithdrawalCredentialsInvalid)?,
amount: balance,
});
Expand All @@ -576,7 +576,7 @@ pub fn get_expected_withdrawals<E: EthSpec>(
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
Expand Down
12 changes: 0 additions & 12 deletions consensus/types/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Address> {
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<Address> {
self.has_execution_withdrawal_credential(spec)
Expand Down

0 comments on commit 0199c7d

Please sign in to comment.