@Test public void shouldRejectProposerSlashingWithInvalidSignature() throws Exception { beaconChainUtil.initializeStorage(); beaconChainUtil.createAndImportBlockAtSlot(6); ProposerSlashing slashing = dataStructureUtil.randomProposerSlashing(); when(stateTransitionValidator.validate(recentChainData.getBestState().orElseThrow(), slashing)) .thenReturn(Optional.empty()); when(signatureVerifier.verifySignature( recentChainData.getBestState().orElseThrow(), slashing, BLSSignatureVerifier.SIMPLE)) .thenReturn(false); assertThat(proposerSlashingValidator.validate(slashing)).isEqualTo(REJECT); }
public InternalValidationResult validate(ProposerSlashing slashing) { if (!isFirstValidSlashingForValidator(slashing)) { LOG.trace( "ProposerSlashingValidator: Slashing is not the first one for the given validator."); return IGNORE; } if (!passesProcessProposerSlashingConditions(slashing)) { return REJECT; } if (receivedValidSlashingForProposerSet.add( slashing.getHeader_1().getMessage().getProposer_index())) { return ACCEPT; } else { LOG.trace( "ProposerSlashingValidator: Slashing is not the first one for the given validator."); return IGNORE; } }
ProposerSlashingValidator { public InternalValidationResult validate(ProposerSlashing slashing) { if (!isFirstValidSlashingForValidator(slashing)) { LOG.trace( "ProposerSlashingValidator: Slashing is not the first one for the given validator."); return IGNORE; } if (!passesProcessProposerSlashingConditions(slashing)) { return REJECT; } if (receivedValidSlashingForProposerSet.add( slashing.getHeader_1().getMessage().getProposer_index())) { return ACCEPT; } else { LOG.trace( "ProposerSlashingValidator: Slashing is not the first one for the given validator."); return IGNORE; } } }
ProposerSlashingValidator { public InternalValidationResult validate(ProposerSlashing slashing) { if (!isFirstValidSlashingForValidator(slashing)) { LOG.trace( "ProposerSlashingValidator: Slashing is not the first one for the given validator."); return IGNORE; } if (!passesProcessProposerSlashingConditions(slashing)) { return REJECT; } if (receivedValidSlashingForProposerSet.add( slashing.getHeader_1().getMessage().getProposer_index())) { return ACCEPT; } else { LOG.trace( "ProposerSlashingValidator: Slashing is not the first one for the given validator."); return IGNORE; } } ProposerSlashingValidator(
      RecentChainData recentChainData,
      ProposerSlashingStateTransitionValidator proposerSlashingStateTransitionValidator,
      ProposerSlashingSignatureVerifier proposerSlashingSignatureVerifier); }
ProposerSlashingValidator { public InternalValidationResult validate(ProposerSlashing slashing) { if (!isFirstValidSlashingForValidator(slashing)) { LOG.trace( "ProposerSlashingValidator: Slashing is not the first one for the given validator."); return IGNORE; } if (!passesProcessProposerSlashingConditions(slashing)) { return REJECT; } if (receivedValidSlashingForProposerSet.add( slashing.getHeader_1().getMessage().getProposer_index())) { return ACCEPT; } else { LOG.trace( "ProposerSlashingValidator: Slashing is not the first one for the given validator."); return IGNORE; } } ProposerSlashingValidator(
      RecentChainData recentChainData,
      ProposerSlashingStateTransitionValidator proposerSlashingStateTransitionValidator,
      ProposerSlashingSignatureVerifier proposerSlashingSignatureVerifier); InternalValidationResult validate(ProposerSlashing slashing); }
ProposerSlashingValidator { public InternalValidationResult validate(ProposerSlashing slashing) { if (!isFirstValidSlashingForValidator(slashing)) { LOG.trace( "ProposerSlashingValidator: Slashing is not the first one for the given validator."); return IGNORE; } if (!passesProcessProposerSlashingConditions(slashing)) { return REJECT; } if (receivedValidSlashingForProposerSet.add( slashing.getHeader_1().getMessage().getProposer_index())) { return ACCEPT; } else { LOG.trace( "ProposerSlashingValidator: Slashing is not the first one for the given validator."); return IGNORE; } } ProposerSlashingValidator(
      RecentChainData recentChainData,
      ProposerSlashingStateTransitionValidator proposerSlashingStateTransitionValidator,
      ProposerSlashingSignatureVerifier proposerSlashingSignatureVerifier); InternalValidationResult validate(ProposerSlashing slashing);  }