Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Mar 19, 2024
1 parent 5cd2099 commit a0401d6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,22 +427,11 @@ protected void processOperationsNoValidation(
throws BlockProcessingException {
safelyProcess(
() -> {
final int expectedDepositCount =
Math.min(
specConfig.getMaxDeposits(),
state
.getEth1Data()
.getDepositCount()
.minus(state.getEth1DepositIndex())
.intValue());
verifyOutstandingDepositsAreProcessed(state, body);

final Supplier<ValidatorExitContext> validatorExitContextSupplier =
beaconStateMutators.createValidatorExitContextSupplier(state);

checkArgument(
body.getDeposits().size() == expectedDepositCount,
"process_operations: Verify that outstanding deposits are processed up to the maximum number of deposits");

processProposerSlashingsNoValidation(
state, body.getProposerSlashings(), validatorExitContextSupplier);
processAttesterSlashings(
Expand All @@ -451,10 +440,21 @@ protected void processOperationsNoValidation(
processDeposits(state, body.getDeposits());
processVoluntaryExitsNoValidation(
state, body.getVoluntaryExits(), validatorExitContextSupplier);
// @process_shard_receipt_proofs
});
}

protected void verifyOutstandingDepositsAreProcessed(
final BeaconState state, final BeaconBlockBody body) {
final int expectedDepositCount =
Math.min(
specConfig.getMaxDeposits(),
state.getEth1Data().getDepositCount().minus(state.getEth1DepositIndex()).intValue());

checkArgument(
body.getDeposits().size() == expectedDepositCount,
"process_operations: Verify that outstanding deposits are processed up to the maximum number of deposits");
}

@Override
public void processProposerSlashings(
final MutableBeaconState state,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import static com.google.common.base.Preconditions.checkArgument;

import java.util.Optional;
import tech.pegasys.teku.infrastructure.ssz.SszList;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.cache.IndexedAttestationCache;
Expand Down Expand Up @@ -93,7 +94,6 @@ protected void processOperationsNoValidation(
"Deposit receipts were not found during block processing."))));
}

/** Disable former deposit mechanism once all prior deposits are processed * */
@Override
protected void verifyOutstandingDepositsAreProcessed(
final BeaconState state, final BeaconBlockBody body) {
Expand Down Expand Up @@ -130,11 +130,11 @@ public void processDepositReceipts(
}
applyDeposit(
state,
null,
depositReceipt.getPubkey(),
depositReceipt.getWithdrawalCredentials(),
depositReceipt.getAmount(),
depositReceipt.getSignature(),
Optional.empty(),
false);
}
}
Expand Down

0 comments on commit a0401d6

Please sign in to comment.