Skip to content

Commit

Permalink
Fix two small nits dealing with deposits (Consensys#8713)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtraglia authored and tbenr committed Oct 14, 2024
1 parent b2a46b8 commit 542ebf2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -777,18 +777,4 @@ private Optional<OperationInvalidReason> 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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(),
Expand Down

0 comments on commit 542ebf2

Please sign in to comment.