use of tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockHeader in project teku by ConsenSys.
the class ProposerSlashingTest method equalsReturnsFalseWhenProposalData1IsDifferent.
@Test
void equalsReturnsFalseWhenProposalData1IsDifferent() {
// Proposal is rather involved to create. Just create a random one until it is not the
// same as the original.
SignedBeaconBlockHeader otherProposal1 = dataStructureUtil.randomSignedBeaconBlockHeader();
while (Objects.equals(otherProposal1, proposal1)) {
otherProposal1 = dataStructureUtil.randomSignedBeaconBlockHeader();
}
ProposerSlashing testProposerSlashing = new ProposerSlashing(otherProposal1, proposal2);
assertNotEquals(proposerSlashing, testProposerSlashing);
}
use of tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockHeader in project teku by ConsenSys.
the class ProposerSlashingTest method equalsReturnsFalseWhenProposalData2IsDifferent.
@Test
void equalsReturnsFalseWhenProposalData2IsDifferent() {
// Proposal is rather involved to create. Just create a random one until it is not the
// same as the original.
SignedBeaconBlockHeader otherProposal2 = dataStructureUtil.randomSignedBeaconBlockHeader();
while (Objects.equals(otherProposal2, proposal2)) {
otherProposal2 = dataStructureUtil.randomSignedBeaconBlockHeader();
}
ProposerSlashing testProposerSlashing = new ProposerSlashing(proposal1, otherProposal2);
assertNotEquals(proposerSlashing, testProposerSlashing);
}
use of tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockHeader in project teku by ConsenSys.
the class ProposerSlashingValidatorTest method shouldRejectProposerSlashingForTwoSignedHeadersWithSameMessageButDifferentSignature.
@Test
public void shouldRejectProposerSlashingForTwoSignedHeadersWithSameMessageButDifferentSignature() throws Exception {
beaconChainUtil.initializeStorage();
beaconChainUtil.createAndImportBlockAtSlot(6);
SignedBeaconBlockHeader header1 = dataStructureUtil.randomSignedBeaconBlockHeader();
SignedBeaconBlockHeader header2 = new SignedBeaconBlockHeader(header1.getMessage(), BLSTestUtil.randomSignature(100));
assertThat(header2).isNotEqualTo(header1);
ProposerSlashing slashing = new ProposerSlashing(header1, header2);
assertThat(spec.validateProposerSlashing(getBestState(), slashing)).isEqualTo(Optional.of(ProposerSlashingInvalidReason.SAME_HEADER));
}
Aggregations