|
|
@ -12,7 +12,7 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package tech.pegasys.pantheon.consensus.ibft.tests; |
|
|
|
package tech.pegasys.pantheon.consensus.ibft.tests; |
|
|
|
|
|
|
|
|
|
|
|
import static tech.pegasys.pantheon.consensus.ibft.support.TestHelpers.createValidPreparedRoundArtifacts; |
|
|
|
import static tech.pegasys.pantheon.consensus.ibft.support.IntegrationTestHelpers.createValidPreparedRoundArtifacts; |
|
|
|
|
|
|
|
|
|
|
|
import tech.pegasys.pantheon.consensus.ibft.ConsensusRoundIdentifier; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.ConsensusRoundIdentifier; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.messagewrappers.Commit; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.messagewrappers.Commit; |
|
|
@ -23,10 +23,10 @@ import tech.pegasys.pantheon.consensus.ibft.payload.RoundChangeCertificate; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.payload.RoundChangePayload; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.payload.RoundChangePayload; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.payload.SignedData; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.payload.SignedData; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.statemachine.PreparedRoundArtifacts; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.statemachine.PreparedRoundArtifacts; |
|
|
|
|
|
|
|
import tech.pegasys.pantheon.consensus.ibft.support.IntegrationTestHelpers; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.support.RoundSpecificPeers; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.support.RoundSpecificPeers; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.support.TestContext; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.support.TestContext; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.support.TestContextBuilder; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.support.TestContextBuilder; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.support.TestHelpers; |
|
|
|
|
|
|
|
import tech.pegasys.pantheon.consensus.ibft.support.ValidatorPeer; |
|
|
|
import tech.pegasys.pantheon.consensus.ibft.support.ValidatorPeer; |
|
|
|
import tech.pegasys.pantheon.ethereum.core.Block; |
|
|
|
import tech.pegasys.pantheon.ethereum.core.Block; |
|
|
|
|
|
|
|
|
|
|
@ -71,10 +71,7 @@ public class ReceivedNewRoundTest { |
|
|
|
nextProposer.injectNewRound( |
|
|
|
nextProposer.injectNewRound( |
|
|
|
targetRound, |
|
|
|
targetRound, |
|
|
|
new RoundChangeCertificate(roundChanges), |
|
|
|
new RoundChangeCertificate(roundChanges), |
|
|
|
nextProposer |
|
|
|
nextProposer.getMessageFactory().createProposal(targetRound, blockToPropose)); |
|
|
|
.getMessageFactory() |
|
|
|
|
|
|
|
.createProposal(targetRound, blockToPropose) |
|
|
|
|
|
|
|
.getSignedPayload()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final Prepare expectedPrepare = |
|
|
|
final Prepare expectedPrepare = |
|
|
|
localNodeMessageFactory.createPrepare(targetRound, blockToPropose.getHash()); |
|
|
|
localNodeMessageFactory.createPrepare(targetRound, blockToPropose.getHash()); |
|
|
@ -97,10 +94,7 @@ public class ReceivedNewRoundTest { |
|
|
|
illegalProposer.injectNewRound( |
|
|
|
illegalProposer.injectNewRound( |
|
|
|
nextRoundId, |
|
|
|
nextRoundId, |
|
|
|
new RoundChangeCertificate(roundChanges), |
|
|
|
new RoundChangeCertificate(roundChanges), |
|
|
|
illegalProposer |
|
|
|
illegalProposer.getMessageFactory().createProposal(nextRoundId, blockToPropose)); |
|
|
|
.getMessageFactory() |
|
|
|
|
|
|
|
.createProposal(nextRoundId, blockToPropose) |
|
|
|
|
|
|
|
.getSignedPayload()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
peers.verifyNoMessagesReceived(); |
|
|
|
peers.verifyNoMessagesReceived(); |
|
|
|
} |
|
|
|
} |
|
|
@ -122,11 +116,7 @@ public class ReceivedNewRoundTest { |
|
|
|
nextProposer.injectNewRound( |
|
|
|
nextProposer.injectNewRound( |
|
|
|
nextRoundId, |
|
|
|
nextRoundId, |
|
|
|
new RoundChangeCertificate(roundChanges), |
|
|
|
new RoundChangeCertificate(roundChanges), |
|
|
|
peers |
|
|
|
peers.getNonProposing(0).getMessageFactory().createProposal(nextRoundId, reproposedBlock)); |
|
|
|
.getNonProposing(0) |
|
|
|
|
|
|
|
.getMessageFactory() |
|
|
|
|
|
|
|
.createProposal(nextRoundId, reproposedBlock) |
|
|
|
|
|
|
|
.getSignedPayload()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
peers.verifyMessagesReceived( |
|
|
|
peers.verifyMessagesReceived( |
|
|
|
localNodeMessageFactory.createPrepare(nextRoundId, reproposedBlock.getHash())); |
|
|
|
localNodeMessageFactory.createPrepare(nextRoundId, reproposedBlock.getHash())); |
|
|
@ -152,7 +142,7 @@ public class ReceivedNewRoundTest { |
|
|
|
.createProposal(interimRound, context.createBlockForProposalFromChainHead(1, 30)); |
|
|
|
.createProposal(interimRound, context.createBlockForProposalFromChainHead(1, 30)); |
|
|
|
|
|
|
|
|
|
|
|
interimRoundProposer.injectNewRound( |
|
|
|
interimRoundProposer.injectNewRound( |
|
|
|
interimRound, new RoundChangeCertificate(roundChangePayloads), proposal.getSignedPayload()); |
|
|
|
interimRound, new RoundChangeCertificate(roundChangePayloads), proposal); |
|
|
|
|
|
|
|
|
|
|
|
peers.verifyNoMessagesReceived(); |
|
|
|
peers.verifyNoMessagesReceived(); |
|
|
|
} |
|
|
|
} |
|
|
@ -175,11 +165,7 @@ public class ReceivedNewRoundTest { |
|
|
|
nextProposer.injectNewRound( |
|
|
|
nextProposer.injectNewRound( |
|
|
|
nextRoundId, |
|
|
|
nextRoundId, |
|
|
|
new RoundChangeCertificate(roundChanges), |
|
|
|
new RoundChangeCertificate(roundChanges), |
|
|
|
peers |
|
|
|
peers.getNonProposing(0).getMessageFactory().createProposal(nextRoundId, reproposedBlock)); |
|
|
|
.getNonProposing(0) |
|
|
|
|
|
|
|
.getMessageFactory() |
|
|
|
|
|
|
|
.createProposal(nextRoundId, reproposedBlock) |
|
|
|
|
|
|
|
.getSignedPayload()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
peers.verifyMessagesReceived( |
|
|
|
peers.verifyMessagesReceived( |
|
|
|
localNodeMessageFactory.createPrepare(nextRoundId, reproposedBlock.getHash())); |
|
|
|
localNodeMessageFactory.createPrepare(nextRoundId, reproposedBlock.getHash())); |
|
|
@ -191,11 +177,7 @@ public class ReceivedNewRoundTest { |
|
|
|
nextProposer.injectNewRound( |
|
|
|
nextProposer.injectNewRound( |
|
|
|
nextRoundId, |
|
|
|
nextRoundId, |
|
|
|
new RoundChangeCertificate(roundChanges), |
|
|
|
new RoundChangeCertificate(roundChanges), |
|
|
|
peers |
|
|
|
peers.getNonProposing(0).getMessageFactory().createProposal(nextRoundId, reproposedBlock)); |
|
|
|
.getNonProposing(0) |
|
|
|
|
|
|
|
.getMessageFactory() |
|
|
|
|
|
|
|
.createProposal(nextRoundId, reproposedBlock) |
|
|
|
|
|
|
|
.getSignedPayload()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
peers.verifyNoMessagesReceived(); |
|
|
|
peers.verifyNoMessagesReceived(); |
|
|
|
|
|
|
|
|
|
|
@ -203,7 +185,7 @@ public class ReceivedNewRoundTest { |
|
|
|
|
|
|
|
|
|
|
|
final Commit expectedCommit = |
|
|
|
final Commit expectedCommit = |
|
|
|
new Commit( |
|
|
|
new Commit( |
|
|
|
TestHelpers.createSignedCommitPayload( |
|
|
|
IntegrationTestHelpers.createSignedCommitPayload( |
|
|
|
nextRoundId, reproposedBlock, context.getLocalNodeParams().getNodeKeyPair())); |
|
|
|
nextRoundId, reproposedBlock, context.getLocalNodeParams().getNodeKeyPair())); |
|
|
|
|
|
|
|
|
|
|
|
peers.verifyMessagesReceived(expectedCommit); |
|
|
|
peers.verifyMessagesReceived(expectedCommit); |
|
|
|