Search in sources :

Example 6 with Proposal

use of com.radixdlt.consensus.Proposal in project radixdlt by radixdlt.

the class BFTEventVerifierTest method when_process_bad_signature_proposal_then_should_not_be_forwarded.

@Test
public void when_process_bad_signature_proposal_then_should_not_be_forwarded() {
    Proposal proposal = mock(Proposal.class);
    BFTNode author = mock(BFTNode.class);
    when(proposal.getAuthor()).thenReturn(author);
    when(proposal.getSignature()).thenReturn(mock(ECDSASignature.class));
    when(validatorSet.containsNode(eq(author))).thenReturn(true);
    when(verifier.verify(any(), any(), any())).thenReturn(false);
    eventVerifier.processProposal(proposal);
    verify(forwardTo, never()).processProposal(any());
}
Also used : ECDSASignature(com.radixdlt.crypto.ECDSASignature) Proposal(com.radixdlt.consensus.Proposal) Test(org.junit.Test)

Example 7 with Proposal

use of com.radixdlt.consensus.Proposal in project radixdlt by radixdlt.

the class BFTEventVerifierTest method when_process_bad_author_proposal_then_should_not_be_forwarded.

@Test
public void when_process_bad_author_proposal_then_should_not_be_forwarded() {
    Proposal proposal = mock(Proposal.class);
    BFTNode author = mock(BFTNode.class);
    when(proposal.getAuthor()).thenReturn(author);
    when(proposal.getSignature()).thenReturn(mock(ECDSASignature.class));
    when(validatorSet.containsNode(eq(author))).thenReturn(false);
    when(verifier.verify(any(), any(), any())).thenReturn(true);
    eventVerifier.processProposal(proposal);
    verify(forwardTo, never()).processProposal(any());
}
Also used : ECDSASignature(com.radixdlt.crypto.ECDSASignature) Proposal(com.radixdlt.consensus.Proposal) Test(org.junit.Test)

Aggregations

Proposal (com.radixdlt.consensus.Proposal)7 ECDSASignature (com.radixdlt.crypto.ECDSASignature)4 BFTNode (com.radixdlt.consensus.bft.BFTNode)3 Test (org.junit.Test)3 AbstractModule (com.google.inject.AbstractModule)2 TypeLiteral (com.google.inject.TypeLiteral)2 BFTConfiguration (com.radixdlt.consensus.BFTConfiguration)2 HashSigner (com.radixdlt.consensus.HashSigner)2 HighQC (com.radixdlt.consensus.HighQC)2 Vote (com.radixdlt.consensus.Vote)2 BFTCommittedUpdate (com.radixdlt.consensus.bft.BFTCommittedUpdate)2 BFTHighQCUpdate (com.radixdlt.consensus.bft.BFTHighQCUpdate)2 BFTInsertUpdate (com.radixdlt.consensus.bft.BFTInsertUpdate)2 BFTRebuildUpdate (com.radixdlt.consensus.bft.BFTRebuildUpdate)2 NoVote (com.radixdlt.consensus.bft.NoVote)2 PacemakerMaxExponent (com.radixdlt.consensus.bft.PacemakerMaxExponent)2 PacemakerRate (com.radixdlt.consensus.bft.PacemakerRate)2 PacemakerTimeout (com.radixdlt.consensus.bft.PacemakerTimeout)2 PersistentVertexStore (com.radixdlt.consensus.bft.PersistentVertexStore)2 Self (com.radixdlt.consensus.bft.Self)2