|
|
|
@ -18,53 +18,39 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase; |
|
|
|
|
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; |
|
|
|
|
|
|
|
|
|
import org.junit.Before; |
|
|
|
|
import org.junit.Ignore; |
|
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
|
@Ignore |
|
|
|
|
public class CliqueGetSignersRpcTest extends AcceptanceTestBase { |
|
|
|
|
private PantheonNode minerNode1; |
|
|
|
|
private PantheonNode minerNode2; |
|
|
|
|
private PantheonNode minerNode3; |
|
|
|
|
private PantheonNode[] allNodes; |
|
|
|
|
private PantheonNode[] initialNodes; |
|
|
|
|
|
|
|
|
|
@Before |
|
|
|
|
public void setUp() throws Exception { |
|
|
|
|
final String[] validators = {"miner1", "miner2"}; |
|
|
|
|
final String[] validators = {"miner1"}; |
|
|
|
|
minerNode1 = pantheon.createCliqueNodeWithValidators("miner1", validators); |
|
|
|
|
minerNode2 = pantheon.createCliqueNodeWithValidators("miner2", validators); |
|
|
|
|
minerNode3 = pantheon.createCliqueNodeWithValidators("miner3", validators); |
|
|
|
|
initialNodes = new PantheonNode[] {minerNode1, minerNode2}; |
|
|
|
|
allNodes = new PantheonNode[] {minerNode1, minerNode2, minerNode3}; |
|
|
|
|
cluster.start(allNodes); |
|
|
|
|
cluster.start(minerNode1, minerNode2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void shouldBeAbleToGetValidatorsForBlockNumber() { |
|
|
|
|
cluster.verify(clique.validatorsAtBlockEqual("0x0", initialNodes)); |
|
|
|
|
cluster.waitUntil(wait.chainHeadIsAt(1)); |
|
|
|
|
minerNode1.execute(cliqueTransactions.createAddProposal(minerNode3)); |
|
|
|
|
minerNode2.execute(cliqueTransactions.createAddProposal(minerNode3)); |
|
|
|
|
cluster.verify(clique.validatorsAtBlockEqual("0x0", minerNode1)); |
|
|
|
|
minerNode1.waitUntil(wait.chainHeadIsAt(1)); |
|
|
|
|
|
|
|
|
|
minerNode1.execute(cliqueTransactions.createAddProposal(minerNode2)); |
|
|
|
|
cluster.waitUntil(wait.chainHeadHasProgressed(minerNode1, 1)); |
|
|
|
|
cluster.verify(clique.validatorsAtBlockEqual("0x2", initialNodes)); |
|
|
|
|
|
|
|
|
|
minerNode1.waitUntil(wait.chainHeadHasProgressed(minerNode1, 1)); |
|
|
|
|
cluster.verify(clique.validatorsAtBlockEqual("0x3", allNodes)); |
|
|
|
|
cluster.verify(clique.validatorsAtBlockEqual(LATEST, allNodes)); |
|
|
|
|
cluster.verify(clique.validatorsAtBlockEqual("0x2", minerNode1, minerNode2)); |
|
|
|
|
cluster.verify(clique.validatorsAtBlockEqual(LATEST, minerNode1, minerNode2)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void shouldBeAbleToGetValidatorsForBlockHash() { |
|
|
|
|
cluster.verify(clique.validatorsAtBlockHashFromBlockNumberEqual(minerNode1, 0, initialNodes)); |
|
|
|
|
minerNode1.execute(cliqueTransactions.createAddProposal(minerNode3)); |
|
|
|
|
minerNode2.execute(cliqueTransactions.createAddProposal(minerNode3)); |
|
|
|
|
|
|
|
|
|
minerNode1.waitUntil(wait.chainHeadHasProgressed(minerNode1, 1)); |
|
|
|
|
cluster.verify(clique.validatorsAtBlockHashFromBlockNumberEqual(minerNode1, 1, initialNodes)); |
|
|
|
|
cluster.verify(clique.validatorsAtBlockHashFromBlockNumberEqual(minerNode1, 0, minerNode1)); |
|
|
|
|
minerNode1.waitUntil(wait.chainHeadIsAt(1)); |
|
|
|
|
|
|
|
|
|
minerNode1.waitUntil(wait.chainHeadHasProgressed(minerNode1, 1)); |
|
|
|
|
cluster.verify(clique.validatorsAtBlockHashFromBlockNumberEqual(minerNode1, 3, allNodes)); |
|
|
|
|
minerNode1.execute(cliqueTransactions.createAddProposal(minerNode2)); |
|
|
|
|
cluster.waitUntil(wait.chainHeadHasProgressed(minerNode1, 1)); |
|
|
|
|
cluster.verify( |
|
|
|
|
clique.validatorsAtBlockHashFromBlockNumberEqual(minerNode1, 2, minerNode1, minerNode2)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|