From 542ebf22fe50721d0150a32106eb9003ed5837b9 Mon Sep 17 00:00:00 2001 From: Justin Traglia <95511699+jtraglia@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:11:25 -0500 Subject: [PATCH] Fix two small nits dealing with deposits (#8713) --- .../common/block/AbstractBlockProcessor.java | 4 ++-- .../electra/block/BlockProcessorElectra.java | 16 +--------------- .../epoch/EpochProcessorElectra.java | 6 +++--- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/AbstractBlockProcessor.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/AbstractBlockProcessor.java index aabdc8bacdc..bffd0c461fc 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/AbstractBlockProcessor.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/block/AbstractBlockProcessor.java @@ -756,7 +756,7 @@ public void applyDeposit( // Verify the deposit signature (proof of possession) which is not checked by the deposit // contract if (signatureAlreadyVerified - || depositSignatureIsValid(pubkey, withdrawalCredentials, amount, signature)) { + || isValidDepositSignature(pubkey, withdrawalCredentials, amount, signature)) { addValidatorToRegistry(state, pubkey, withdrawalCredentials, amount); } else { handleInvalidDeposit(pubkey, maybePubkeyToIndexMap); @@ -796,7 +796,7 @@ protected void handleInvalidDeposit( } /** is_valid_deposit_signature */ - protected boolean depositSignatureIsValid( + protected boolean isValidDepositSignature( final BLSPublicKey pubkey, final Bytes32 withdrawalCredentials, final UInt64 amount, diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java index dffd43c51d7..82588594732 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java @@ -642,7 +642,7 @@ public void applyDeposit( // Verify the deposit signature (proof of possession) which is not checked by the deposit // contract if (signatureAlreadyVerified - || depositSignatureIsValid(pubkey, withdrawalCredentials, amount, signature)) { + || isValidDepositSignature(pubkey, withdrawalCredentials, amount, signature)) { addValidatorToRegistry(state, pubkey, withdrawalCredentials, ZERO); final PendingDeposit deposit = schemaDefinitionsElectra @@ -777,18 +777,4 @@ private Optional checkCommittees( } return Optional.empty(); } - - protected Validator getValidatorFromDeposit( - final BLSPublicKey pubkey, final Bytes32 withdrawalCredentials) { - final UInt64 effectiveBalance = UInt64.ZERO; - return new Validator( - pubkey, - withdrawalCredentials, - effectiveBalance, - false, - FAR_FUTURE_EPOCH, - FAR_FUTURE_EPOCH, - FAR_FUTURE_EPOCH, - FAR_FUTURE_EPOCH); - } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/statetransition/epoch/EpochProcessorElectra.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/statetransition/epoch/EpochProcessorElectra.java index 53079c9a58e..b4d33c0dfb9 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/statetransition/epoch/EpochProcessorElectra.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/statetransition/epoch/EpochProcessorElectra.java @@ -204,7 +204,7 @@ public void applyPendingDeposits(final MutableBeaconState state, final PendingDe validatorIndex -> beaconStateMutators.increaseBalance(state, validatorIndex, deposit.getAmount()), () -> { - if (depositSignatureIsValid(deposit)) { + if (isValidDepositSignature(deposit)) { addValidatorToRegistry( state, deposit.getPublicKey(), @@ -214,9 +214,9 @@ public void applyPendingDeposits(final MutableBeaconState state, final PendingDe }); } - // TODO-lucas Duplicates method depositSignatureIsValid from BlockProcessor + // TODO-lucas Duplicates method isValidDepositSignature from BlockProcessor /** is_valid_deposit_signature */ - public boolean depositSignatureIsValid(final PendingDeposit deposit) { + public boolean isValidDepositSignature(final PendingDeposit deposit) { try { return depositSignatureVerifier.verify( deposit.getPublicKey(),