@Test void signBlock_shouldSignWhenSlashingProtectionAllowsIt() { final BeaconBlock block = dataStructureUtil.randomBeaconBlock(6); when(slashingProtector.maySignBlock( publicKey, forkInfo.getGenesisValidatorsRoot(), block.getSlot())) .thenReturn(SafeFuture.completedFuture(true)); when(delegate.signBlock(block, forkInfo)).thenReturn(signatureFuture); assertThatSafeFuture(signer.signBlock(block, forkInfo)).isCompletedWithValue(signature); }
@Override public SafeFuture<BLSSignature> signBlock(final BeaconBlock block, final ForkInfo forkInfo) { return slashingProtector .maySignBlock(validatorPublicKey, forkInfo.getGenesisValidatorsRoot(), block.getSlot()) .thenAccept(verifySigningAllowed(slashableBlockMessage(block))) .thenCompose(__ -> delegate.signBlock(block, forkInfo)); }
SlashingProtectedSigner implements Signer { @Override public SafeFuture<BLSSignature> signBlock(final BeaconBlock block, final ForkInfo forkInfo) { return slashingProtector .maySignBlock(validatorPublicKey, forkInfo.getGenesisValidatorsRoot(), block.getSlot()) .thenAccept(verifySigningAllowed(slashableBlockMessage(block))) .thenCompose(__ -> delegate.signBlock(block, forkInfo)); } }
SlashingProtectedSigner implements Signer { @Override public SafeFuture<BLSSignature> signBlock(final BeaconBlock block, final ForkInfo forkInfo) { return slashingProtector .maySignBlock(validatorPublicKey, forkInfo.getGenesisValidatorsRoot(), block.getSlot()) .thenAccept(verifySigningAllowed(slashableBlockMessage(block))) .thenCompose(__ -> delegate.signBlock(block, forkInfo)); } SlashingProtectedSigner(
      final BLSPublicKey validatorPublicKey,
      final SlashingProtector slashingProtector,
      final Signer delegate); }
SlashingProtectedSigner implements Signer { @Override public SafeFuture<BLSSignature> signBlock(final BeaconBlock block, final ForkInfo forkInfo) { return slashingProtector .maySignBlock(validatorPublicKey, forkInfo.getGenesisValidatorsRoot(), block.getSlot()) .thenAccept(verifySigningAllowed(slashableBlockMessage(block))) .thenCompose(__ -> delegate.signBlock(block, forkInfo)); } SlashingProtectedSigner(
      final BLSPublicKey validatorPublicKey,
      final SlashingProtector slashingProtector,
      final Signer delegate); @Override SafeFuture<BLSSignature> signBlock(final BeaconBlock block, final ForkInfo forkInfo); @Override SafeFuture<BLSSignature> signAttestationData(
      final AttestationData attestationData, final ForkInfo forkInfo); @Override SafeFuture<BLSSignature> createRandaoReveal(final UInt64 epoch, final ForkInfo forkInfo); @Override SafeFuture<BLSSignature> signAggregationSlot(final UInt64 slot, final ForkInfo forkInfo); @Override SafeFuture<BLSSignature> signAggregateAndProof(
      final AggregateAndProof aggregateAndProof, final ForkInfo forkInfo); @Override SafeFuture<BLSSignature> signVoluntaryExit(
      final VoluntaryExit voluntaryExit, final ForkInfo forkInfo); @Override boolean isLocal(); }
SlashingProtectedSigner implements Signer { @Override public SafeFuture<BLSSignature> signBlock(final BeaconBlock block, final ForkInfo forkInfo) { return slashingProtector .maySignBlock(validatorPublicKey, forkInfo.getGenesisValidatorsRoot(), block.getSlot()) .thenAccept(verifySigningAllowed(slashableBlockMessage(block))) .thenCompose(__ -> delegate.signBlock(block, forkInfo)); } SlashingProtectedSigner(
      final BLSPublicKey validatorPublicKey,
      final SlashingProtector slashingProtector,
      final Signer delegate); @Override SafeFuture<BLSSignature> signBlock(final BeaconBlock block, final ForkInfo forkInfo); @Override SafeFuture<BLSSignature> signAttestationData(
      final AttestationData attestationData, final ForkInfo forkInfo); @Override SafeFuture<BLSSignature> createRandaoReveal(final UInt64 epoch, final ForkInfo forkInfo); @Override SafeFuture<BLSSignature> signAggregationSlot(final UInt64 slot, final ForkInfo forkInfo); @Override SafeFuture<BLSSignature> signAggregateAndProof(
      final AggregateAndProof aggregateAndProof, final ForkInfo forkInfo); @Override SafeFuture<BLSSignature> signVoluntaryExit(
      final VoluntaryExit voluntaryExit, final ForkInfo forkInfo); @Override boolean isLocal();  }