@Test public void shouldRejectExitWithInvalidSignature() throws Exception { beaconChainUtil.initializeStorage(); beaconChainUtil.createAndImportBlockAtSlot(6); SignedVoluntaryExit exit = dataStructureUtil.randomSignedVoluntaryExit(); when(stateTransitionValidator.validate(recentChainData.getBestState().orElseThrow(), exit)) .thenReturn(Optional.empty()); when(signatureVerifier.verifySignature( recentChainData.getBestState().orElseThrow(), exit, BLSSignatureVerifier.SIMPLE)) .thenReturn(false); assertThat(voluntaryExitValidator.validate(exit)).isEqualTo(REJECT); }
public InternalValidationResult validate(SignedVoluntaryExit exit) { if (!isFirstValidExitForValidator(exit)) { LOG.trace("VoluntaryExitValidator: Exit is not the first one for the given validator."); return IGNORE; } if (!passesProcessVoluntaryExitConditions(exit)) { return REJECT; } if (receivedValidExitSet.add(exit.getMessage().getValidator_index())) { return ACCEPT; } else { LOG.trace("VoluntaryExitValidator: Exit is not the first one for the given validator."); return IGNORE; } }
VoluntaryExitValidator { public InternalValidationResult validate(SignedVoluntaryExit exit) { if (!isFirstValidExitForValidator(exit)) { LOG.trace("VoluntaryExitValidator: Exit is not the first one for the given validator."); return IGNORE; } if (!passesProcessVoluntaryExitConditions(exit)) { return REJECT; } if (receivedValidExitSet.add(exit.getMessage().getValidator_index())) { return ACCEPT; } else { LOG.trace("VoluntaryExitValidator: Exit is not the first one for the given validator."); return IGNORE; } } }
VoluntaryExitValidator { public InternalValidationResult validate(SignedVoluntaryExit exit) { if (!isFirstValidExitForValidator(exit)) { LOG.trace("VoluntaryExitValidator: Exit is not the first one for the given validator."); return IGNORE; } if (!passesProcessVoluntaryExitConditions(exit)) { return REJECT; } if (receivedValidExitSet.add(exit.getMessage().getValidator_index())) { return ACCEPT; } else { LOG.trace("VoluntaryExitValidator: Exit is not the first one for the given validator."); return IGNORE; } } VoluntaryExitValidator(
      RecentChainData recentChainData,
      VoluntaryExitStateTransitionValidator stateTransitionValidator,
      VoluntaryExitSignatureVerifier signatureVerifier); }
VoluntaryExitValidator { public InternalValidationResult validate(SignedVoluntaryExit exit) { if (!isFirstValidExitForValidator(exit)) { LOG.trace("VoluntaryExitValidator: Exit is not the first one for the given validator."); return IGNORE; } if (!passesProcessVoluntaryExitConditions(exit)) { return REJECT; } if (receivedValidExitSet.add(exit.getMessage().getValidator_index())) { return ACCEPT; } else { LOG.trace("VoluntaryExitValidator: Exit is not the first one for the given validator."); return IGNORE; } } VoluntaryExitValidator(
      RecentChainData recentChainData,
      VoluntaryExitStateTransitionValidator stateTransitionValidator,
      VoluntaryExitSignatureVerifier signatureVerifier); InternalValidationResult validate(SignedVoluntaryExit exit); }
VoluntaryExitValidator { public InternalValidationResult validate(SignedVoluntaryExit exit) { if (!isFirstValidExitForValidator(exit)) { LOG.trace("VoluntaryExitValidator: Exit is not the first one for the given validator."); return IGNORE; } if (!passesProcessVoluntaryExitConditions(exit)) { return REJECT; } if (receivedValidExitSet.add(exit.getMessage().getValidator_index())) { return ACCEPT; } else { LOG.trace("VoluntaryExitValidator: Exit is not the first one for the given validator."); return IGNORE; } } VoluntaryExitValidator(
      RecentChainData recentChainData,
      VoluntaryExitStateTransitionValidator stateTransitionValidator,
      VoluntaryExitSignatureVerifier signatureVerifier); InternalValidationResult validate(SignedVoluntaryExit exit);  }