Acceptance Test and DSL rename for IBFT2 (#1493)

Renaming the Ibft AT to ibft2

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
CJ Hare 6 years ago committed by GitHub
parent a21f812cda
commit 4ab12ae239
  1. 14
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/AcceptanceTestBase.java
  2. 10
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectProposals.java
  3. 8
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidators.java
  4. 20
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft2.java
  5. 4
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/PantheonNode.java
  6. 25
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/factory/PantheonNodeFactory.java
  7. 14
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/factory/PantheonNodeFactoryUtils.java
  8. 2
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyAcceptanceTestBase.java
  9. 2
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyNet.java
  10. 6
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyPantheonNodeFactory.java
  11. 14
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/Ibft2JsonRpcRequestFactory.java
  12. 6
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/JsonRequestFactories.java
  13. 8
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Discard.java
  14. 8
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2GetValidators.java
  15. 8
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2GetValidatorsAtHash.java
  16. 6
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Proposals.java
  17. 8
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Propose.java
  18. 28
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Transactions.java
  19. 6
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/waitcondition/WaitConditions.java
  20. 6
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/waitcondition/WaitUntilValidatorsChanged.java
  21. 43
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftDiscardRpcAcceptanceTest.java
  22. 46
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2DiscardRpcAcceptanceTest.java
  23. 35
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2MiningAcceptanceTest.java
  24. 27
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2ProposalRpcAcceptanceTest.java
  25. 31
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2ProposeRpcAcceptanceTest.java
  26. 2
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/privacy/Ibft2PrivacyClusterAcceptanceTest.java

@ -18,7 +18,7 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.contract.ContractVerifier;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Admin;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Clique;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eth;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Ibft;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Ibft2;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Login;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Net;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Perm;
@ -29,7 +29,7 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.node.factory.PermissionedNodeB
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.clique.CliqueTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eth.EthTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2.Ibft2Transactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.net.NetTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.web3.Web3Transactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitConditions;
@ -42,10 +42,10 @@ public class AcceptanceTestBase {
protected final Blockchain blockchain;
protected final Cluster cluster;
protected final CliqueTransactions cliqueTransactions;
protected final IbftTransactions ibftTransactions;
protected final Ibft2Transactions ibftTwoTransactions;
protected final Transactions transactions;
protected final Clique clique;
protected final Ibft ibft;
protected final Ibft2 ibftTwo;
protected final Web3 web3;
protected final Eth eth;
protected final Login login;
@ -63,10 +63,10 @@ public class AcceptanceTestBase {
blockchain = new Blockchain(ethTransactions);
eth = new Eth(ethTransactions);
cliqueTransactions = new CliqueTransactions();
ibftTransactions = new IbftTransactions();
ibftTwoTransactions = new Ibft2Transactions();
clique = new Clique(ethTransactions, cliqueTransactions);
ibft = new Ibft(ibftTransactions);
ibftTwo = new Ibft2(ibftTwoTransactions);
login = new Login();
net = new Net(new NetTransactions());
cluster = new Cluster(net);
@ -76,7 +76,7 @@ public class AcceptanceTestBase {
web3 = new Web3(new Web3Transactions());
pantheon = new PantheonNodeFactory();
contractVerifier = new ContractVerifier(accounts.getPrimaryBenefactor());
wait = new WaitConditions(ethTransactions, cliqueTransactions, ibftTransactions);
wait = new WaitConditions(ethTransactions, cliqueTransactions, ibftTwoTransactions);
permissionedNodeBuilder = new PermissionedNodeBuilder();
}

@ -18,21 +18,21 @@ import static tech.pegasys.pantheon.tests.acceptance.dsl.WaitUtils.waitFor;
import tech.pegasys.pantheon.ethereum.core.Address;
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2.Ibft2Transactions;
import java.util.Map;
public class ExpectProposals implements Condition {
private final IbftTransactions ibft;
private final Ibft2Transactions ibftTwo;
private final Map<Address, Boolean> proposers;
public ExpectProposals(final IbftTransactions ibft, final Map<Address, Boolean> proposers) {
this.ibft = ibft;
public ExpectProposals(final Ibft2Transactions ibftTwo, final Map<Address, Boolean> proposers) {
this.ibftTwo = ibftTwo;
this.proposers = proposers;
}
@Override
public void verify(final Node node) {
waitFor(() -> assertThat(node.execute(ibft.createProposals())).isEqualTo(proposers));
waitFor(() -> assertThat(node.execute(ibftTwo.createProposals())).isEqualTo(proposers));
}
}

@ -14,18 +14,18 @@ package tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft;
import static org.assertj.core.api.Assertions.assertThat;
import static tech.pegasys.pantheon.tests.acceptance.dsl.WaitUtils.waitFor;
import static tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions.LATEST;
import static tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2.Ibft2Transactions.LATEST;
import tech.pegasys.pantheon.ethereum.core.Address;
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2.Ibft2Transactions;
public class ExpectValidators implements Condition {
private final IbftTransactions ibft;
private final Ibft2Transactions ibft;
private final Address[] validators;
public ExpectValidators(final IbftTransactions ibft, final Address... validators) {
public ExpectValidators(final Ibft2Transactions ibft, final Address... validators) {
this.ibft = ibft;
this.validators = validators;
}

@ -17,7 +17,7 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition;
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft.ExpectProposals;
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft.ExpectValidators;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2.Ibft2Transactions;
import java.util.Arrays;
import java.util.Comparator;
@ -29,12 +29,12 @@ import java.util.stream.Collectors;
import com.google.common.collect.ImmutableMap;
public class Ibft {
public class Ibft2 {
private final IbftTransactions ibft;
private final Ibft2Transactions ibftTwo;
public Ibft(final IbftTransactions ibft) {
this.ibft = ibft;
public Ibft2(final Ibft2Transactions ibftTwo) {
this.ibftTwo = ibftTwo;
}
public List<PantheonNode> validators(final PantheonNode[] nodes) {
@ -46,7 +46,7 @@ public class Ibft {
}
public ExpectValidators validatorsEqual(final PantheonNode... validators) {
return new ExpectValidators(ibft, validatorAddresses(validators));
return new ExpectValidators(ibftTwo, validatorAddresses(validators));
}
private Address[] validatorAddresses(final PantheonNode[] validators) {
@ -54,18 +54,18 @@ public class Ibft {
}
public Condition noProposals() {
return new ExpectProposals(ibft, ImmutableMap.of());
return new ExpectProposals(ibftTwo, ImmutableMap.of());
}
public PendingVotesConfig pendingVotesEqual() {
return new PendingVotesConfig(ibft);
return new PendingVotesConfig(ibftTwo);
}
public static class PendingVotesConfig {
private final Map<PantheonNode, Boolean> proposals = new HashMap<>();
private final IbftTransactions ibft;
private final Ibft2Transactions ibft;
public PendingVotesConfig(final IbftTransactions ibft) {
private PendingVotesConfig(final Ibft2Transactions ibft) {
this.ibft = ibft;
}

@ -33,7 +33,7 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.AdminJsonRpcReques
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.CliqueJsonRpcRequestFactory;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.CustomNetJsonRpcRequestFactory;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.EeaJsonRpcRequestFactory;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.IbftJsonRpcRequestFactory;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Ibft2JsonRpcRequestFactory;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PermissioningJsonRpcRequestFactory;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction;
@ -279,7 +279,7 @@ public class PantheonNode implements NodeConfiguration, RunnableNode, AutoClosea
new JsonRequestFactories(
new JsonRpc2_0Web3j(web3jService, 2000, Async.defaultExecutorService()),
new CliqueJsonRpcRequestFactory(web3jService),
new IbftJsonRpcRequestFactory(web3jService),
new Ibft2JsonRpcRequestFactory(web3jService),
new PermissioningJsonRpcRequestFactory(web3jService),
new AdminJsonRpcRequestFactory(web3jService),
new EeaJsonRpcRequestFactory(web3jService),

@ -140,15 +140,6 @@ public class PantheonNodeFactory extends PantheonNodeFactoryUtils {
.build());
}
public PantheonNode createNodeWithP2pDisabledAndAdmin(final String name) throws IOException {
return create(
new PantheonFactoryConfigurationBuilder()
.name(name)
.p2pEnabled(false)
.jsonRpcConfiguration(jsonRpcConfigWithAdmin())
.build());
}
public PantheonNode createArchiveNodeWithRpcDisabled(final String name) throws IOException {
return create(new PantheonFactoryConfigurationBuilder().name(name).build());
}
@ -189,22 +180,22 @@ public class PantheonNodeFactory extends PantheonNodeFactoryUtils {
new PantheonFactoryConfigurationBuilder()
.name(name)
.miningEnabled()
.jsonRpcConfiguration(createJsonRpcConfigWithClique())
.jsonRpcConfiguration(createJsonRpcWithCliqueEnabledConfig())
.webSocketConfiguration(createWebSocketEnabledConfig())
.devMode(false)
.genesisConfigProvider(this::createCliqueGenesisConfig)
.build());
}
public PantheonNode createIbftNode(final String name) throws IOException {
public PantheonNode createIbft2Node(final String name) throws IOException {
return create(
new PantheonFactoryConfigurationBuilder()
.name(name)
.miningEnabled()
.jsonRpcConfiguration(createJsonRpcConfigWithIbft())
.jsonRpcConfiguration(createJsonRpcWithIbft2EnabledConfig())
.webSocketConfiguration(createWebSocketEnabledConfig())
.devMode(false)
.genesisConfigProvider(this::createIbftGenesisConfig)
.genesisConfigProvider(this::createIbft2GenesisConfig)
.build());
}
@ -229,7 +220,7 @@ public class PantheonNodeFactory extends PantheonNodeFactoryUtils {
new PantheonFactoryConfigurationBuilder()
.name(name)
.miningEnabled()
.jsonRpcConfiguration(createJsonRpcConfigWithClique())
.jsonRpcConfiguration(createJsonRpcWithCliqueEnabledConfig())
.webSocketConfiguration(createWebSocketEnabledConfig())
.devMode(false)
.genesisConfigProvider(
@ -239,20 +230,20 @@ public class PantheonNodeFactory extends PantheonNodeFactoryUtils {
.build());
}
public PantheonNode createIbftNodeWithValidators(final String name, final String... validators)
public PantheonNode createIbft2NodeWithValidators(final String name, final String... validators)
throws IOException {
return create(
new PantheonFactoryConfigurationBuilder()
.name(name)
.miningEnabled()
.jsonRpcConfiguration(createJsonRpcConfigWithIbft())
.jsonRpcConfiguration(createJsonRpcWithIbft2EnabledConfig())
.webSocketConfiguration(createWebSocketEnabledConfig())
.devMode(false)
.genesisConfigProvider(
nodes ->
createGenesisConfigForValidators(
asList(validators), nodes, this::createIbftGenesisConfig))
asList(validators), nodes, this::createIbft2GenesisConfig))
.build());
}
}

@ -49,7 +49,7 @@ public class PantheonNodeFactoryUtils {
validators, template, CliqueExtraData::createGenesisExtraDataString);
}
public Optional<String> createIbftGenesisConfig(
public Optional<String> createIbft2GenesisConfig(
final Collection<? extends RunnableNode> validators) {
final String template = readGenesisFile("/ibft/ibft.json");
return updateGenesisExtraData(
@ -85,12 +85,12 @@ public class PantheonNodeFactoryUtils {
return genesisConfigProvider.createGenesisConfig(nodes);
}
public JsonRpcConfiguration createJsonRpcConfigWithClique() {
return createJsonRpcConfigWithRpcApiEnabled(CLIQUE);
public JsonRpcConfiguration createJsonRpcWithCliqueEnabledConfig() {
return createJsonRpcWithRpcApiEnabledConfig(CLIQUE);
}
public JsonRpcConfiguration createJsonRpcConfigWithIbft() {
return createJsonRpcConfigWithRpcApiEnabled(IBFT);
public JsonRpcConfiguration createJsonRpcWithIbft2EnabledConfig() {
return createJsonRpcWithRpcApiEnabledConfig(IBFT);
}
public JsonRpcConfiguration createJsonRpcEnabledConfig() {
@ -109,10 +109,10 @@ public class PantheonNodeFactoryUtils {
}
public JsonRpcConfiguration jsonRpcConfigWithAdmin() {
return createJsonRpcConfigWithRpcApiEnabled(RpcApis.ADMIN);
return createJsonRpcWithRpcApiEnabledConfig(RpcApis.ADMIN);
}
public JsonRpcConfiguration createJsonRpcConfigWithRpcApiEnabled(final RpcApi... rpcApi) {
public JsonRpcConfiguration createJsonRpcWithRpcApiEnabledConfig(final RpcApi... rpcApi) {
final JsonRpcConfiguration jsonRpcConfig = createJsonRpcEnabledConfig();
final List<RpcApi> rpcApis = new ArrayList<>(jsonRpcConfig.getRpcApis());
rpcApis.addAll(Arrays.asList(rpcApi));

@ -25,7 +25,7 @@ public class PrivacyAcceptanceTestBase extends AcceptanceTestBase {
protected final Eea eea;
protected final PrivateTransactions privateTransactions;
protected static PrivateTransactionBuilder.Builder privateTransactionBuilder;
protected final PrivateTransactionBuilder.Builder privateTransactionBuilder;
protected final PrivateTransactionVerifier privateTransactionVerifier;
protected final PrivacyPantheonNodeFactory privacyPantheon;

@ -228,7 +228,7 @@ public class PrivacyNet {
name, generatePrivacyParameters(orion), keyFilePath, orion);
} else {
node =
pantheonNodeFactory.createIbftNodePrivacyEnabled(
pantheonNodeFactory.createIbft2NodePrivacyEnabled(
name, generatePrivacyParameters(orion), keyFilePath, orion);
}

@ -83,7 +83,7 @@ public class PrivacyPantheonNodeFactory extends PantheonNodeFactoryUtils {
.build());
}
public PrivacyNode createIbftNodePrivacyEnabled(
public PrivacyNode createIbft2NodePrivacyEnabled(
final String name,
final PrivacyParameters privacyParameters,
final String keyFilePath,
@ -95,10 +95,10 @@ public class PrivacyPantheonNodeFactory extends PantheonNodeFactoryUtils {
new PantheonFactoryConfigurationBuilder()
.name(name)
.miningEnabled()
.jsonRpcConfiguration(createJsonRpcConfigWithIbft())
.jsonRpcConfiguration(createJsonRpcWithIbft2EnabledConfig())
.webSocketConfiguration(createWebSocketEnabledConfig())
.devMode(false)
.genesisConfigProvider(this::createIbftGenesisConfig)
.genesisConfigProvider(this::createIbft2GenesisConfig)
.keyFilePath(keyFilePath)
.enablePrivateTransactions(privacyParameters)
.build())

@ -26,15 +26,15 @@ import java.util.Arrays;
import org.web3j.protocol.Web3jService;
import org.web3j.protocol.core.Request;
public class IbftJsonRpcRequestFactory {
public class Ibft2JsonRpcRequestFactory {
private final Web3jService web3jService;
public IbftJsonRpcRequestFactory(final Web3jService web3jService) {
public Ibft2JsonRpcRequestFactory(final Web3jService web3jService) {
this.web3jService = web3jService;
}
public Request<?, ProposeResponse> ibftPropose(final String address, final Boolean auth) {
public Request<?, ProposeResponse> propose(final String address, final Boolean auth) {
return new Request<>(
"ibft_proposeValidatorVote",
Arrays.asList(address, auth.toString()),
@ -42,17 +42,17 @@ public class IbftJsonRpcRequestFactory {
ProposeResponse.class);
}
public Request<?, DiscardResponse> ibftDiscard(final String address) {
public Request<?, DiscardResponse> discard(final String address) {
return new Request<>(
"ibft_discardValidatorVote", singletonList(address), web3jService, DiscardResponse.class);
}
public Request<?, ProposalsResponse> ibftProposals() {
public Request<?, ProposalsResponse> proposals() {
return new Request<>(
"ibft_getPendingVotes", emptyList(), web3jService, ProposalsResponse.class);
}
public Request<?, SignersBlockResponse> ibftGetValidators(final String blockNumber) {
public Request<?, SignersBlockResponse> validatorsAtBlock(final String blockNumber) {
return new Request<>(
"ibft_getValidatorsByBlockNumber",
singletonList(blockNumber),
@ -60,7 +60,7 @@ public class IbftJsonRpcRequestFactory {
SignersBlockResponse.class);
}
public Request<?, SignersBlockResponse> ibftGetSignersAtHash(final Hash hash) {
public Request<?, SignersBlockResponse> signersAtHash(final Hash hash) {
return new Request<>(
"ibft_getValidatorsByBlockHash",
singletonList(hash.toString()),

@ -21,7 +21,7 @@ public class JsonRequestFactories {
private final JsonRpc2_0Web3j netEth;
private final CliqueJsonRpcRequestFactory clique;
private final IbftJsonRpcRequestFactory ibft;
private final Ibft2JsonRpcRequestFactory ibft;
private final PermissioningJsonRpcRequestFactory perm;
private final AdminJsonRpcRequestFactory admin;
private final EeaJsonRpcRequestFactory eea;
@ -31,7 +31,7 @@ public class JsonRequestFactories {
public JsonRequestFactories(
final JsonRpc2_0Web3j netEth,
final CliqueJsonRpcRequestFactory clique,
final IbftJsonRpcRequestFactory ibft,
final Ibft2JsonRpcRequestFactory ibft,
final PermissioningJsonRpcRequestFactory perm,
final AdminJsonRpcRequestFactory admin,
final EeaJsonRpcRequestFactory eea,
@ -59,7 +59,7 @@ public class JsonRequestFactories {
return clique;
}
public IbftJsonRpcRequestFactory ibft() {
public Ibft2JsonRpcRequestFactory ibft() {
return ibft;
}

@ -10,7 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft;
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2;
import static org.assertj.core.api.Assertions.assertThat;
@ -20,17 +20,17 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction;
import java.io.IOException;
public class IbftDiscard implements Transaction<Boolean> {
public class Ibft2Discard implements Transaction<Boolean> {
private final String address;
public IbftDiscard(final String address) {
public Ibft2Discard(final String address) {
this.address = address;
}
@Override
public Boolean execute(final JsonRequestFactories node) {
try {
final DiscardResponse result = node.ibft().ibftDiscard(address).send();
final DiscardResponse result = node.ibft().discard(address).send();
assertThat(result).isNotNull();
assertThat(result.hasError()).isFalse();
return result.getResult();

@ -10,7 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft;
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2;
import static org.assertj.core.api.Assertions.assertThat;
@ -22,17 +22,17 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction;
import java.io.IOException;
import java.util.List;
public class IbftGetValidators implements Transaction<List<Address>> {
public class Ibft2GetValidators implements Transaction<List<Address>> {
private final String blockNumber;
public IbftGetValidators(final String blockNumber) {
public Ibft2GetValidators(final String blockNumber) {
this.blockNumber = blockNumber;
}
@Override
public List<Address> execute(final JsonRequestFactories node) {
try {
final SignersBlockResponse result = node.ibft().ibftGetValidators(blockNumber).send();
final SignersBlockResponse result = node.ibft().validatorsAtBlock(blockNumber).send();
assertThat(result).isNotNull();
assertThat(result.hasError()).isFalse();
return result.getResult();

@ -10,7 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft;
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2;
import static org.assertj.core.api.Assertions.assertThat;
@ -23,17 +23,17 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction;
import java.io.IOException;
import java.util.List;
public class IbftGetValidatorsAtHash implements Transaction<List<Address>> {
public class Ibft2GetValidatorsAtHash implements Transaction<List<Address>> {
private final Hash hash;
public IbftGetValidatorsAtHash(final Hash hash) {
public Ibft2GetValidatorsAtHash(final Hash hash) {
this.hash = hash;
}
@Override
public List<Address> execute(final JsonRequestFactories node) {
try {
final SignersBlockResponse result = node.ibft().ibftGetSignersAtHash(hash).send();
final SignersBlockResponse result = node.ibft().signersAtHash(hash).send();
assertThat(result).isNotNull();
assertThat(result.hasError()).isFalse();
return result.getResult();

@ -10,7 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft;
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2;
import static org.assertj.core.api.Assertions.assertThat;
@ -22,12 +22,12 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction;
import java.io.IOException;
import java.util.Map;
public class IbftProposals implements Transaction<Map<Address, Boolean>> {
public class Ibft2Proposals implements Transaction<Map<Address, Boolean>> {
@Override
public Map<Address, Boolean> execute(final JsonRequestFactories node) {
try {
final ProposalsResponse result = node.ibft().ibftProposals().send();
final ProposalsResponse result = node.ibft().proposals().send();
assertThat(result).isNotNull();
assertThat(result.hasError()).isFalse();
return result.getResult();

@ -10,7 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft;
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2;
import static org.assertj.core.api.Assertions.assertThat;
@ -20,11 +20,11 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction;
import java.io.IOException;
public class IbftPropose implements Transaction<Boolean> {
public class Ibft2Propose implements Transaction<Boolean> {
private final String address;
private final boolean auth;
public IbftPropose(final String address, final boolean auth) {
public Ibft2Propose(final String address, final boolean auth) {
this.address = address;
this.auth = auth;
}
@ -32,7 +32,7 @@ public class IbftPropose implements Transaction<Boolean> {
@Override
public Boolean execute(final JsonRequestFactories node) {
try {
final ProposeResponse result = node.ibft().ibftPropose(address, auth).send();
final ProposeResponse result = node.ibft().propose(address, auth).send();
assertThat(result).isNotNull();
assertThat(result.hasError()).isFalse();
return result.getResult();

@ -10,39 +10,39 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft;
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2;
import tech.pegasys.pantheon.ethereum.core.Hash;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode;
public class IbftTransactions {
public class Ibft2Transactions {
public static final String LATEST = "latest";
public IbftPropose createRemoveProposal(final PantheonNode node) {
public Ibft2Propose createRemoveProposal(final PantheonNode node) {
return propose(node.getAddress().toString(), false);
}
public IbftPropose createAddProposal(final PantheonNode node) {
public Ibft2Propose createAddProposal(final PantheonNode node) {
return propose(node.getAddress().toString(), true);
}
private IbftPropose propose(final String address, final boolean auth) {
return new IbftPropose(address, auth);
private Ibft2Propose propose(final String address, final boolean auth) {
return new Ibft2Propose(address, auth);
}
public IbftProposals createProposals() {
return new IbftProposals();
public Ibft2Proposals createProposals() {
return new Ibft2Proposals();
}
public IbftGetValidators createGetValidators(final String blockNumber) {
return new IbftGetValidators(blockNumber);
public Ibft2GetValidators createGetValidators(final String blockNumber) {
return new Ibft2GetValidators(blockNumber);
}
public IbftGetValidatorsAtHash createGetValidatorsAtHash(final Hash blockHash) {
return new IbftGetValidatorsAtHash(blockHash);
public Ibft2GetValidatorsAtHash createGetValidatorsAtHash(final Hash blockHash) {
return new Ibft2GetValidatorsAtHash(blockHash);
}
public IbftDiscard createDiscardProposal(final PantheonNode node) {
return new IbftDiscard(node.getAddress().toString());
public Ibft2Discard createDiscardProposal(final PantheonNode node) {
return new Ibft2Discard(node.getAddress().toString());
}
}

@ -19,17 +19,17 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.clique.CliqueTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eth.EthTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2.Ibft2Transactions;
import java.math.BigInteger;
public class WaitConditions {
private final EthTransactions eth;
private final CliqueTransactions clique;
private final IbftTransactions ibft;
private final Ibft2Transactions ibft;
public WaitConditions(
final EthTransactions eth, final CliqueTransactions clique, final IbftTransactions ibft) {
final EthTransactions eth, final CliqueTransactions clique, final Ibft2Transactions ibft) {
this.eth = eth;
this.clique = clique;
this.ibft = ibft;

@ -18,17 +18,17 @@ import static tech.pegasys.pantheon.tests.acceptance.dsl.transaction.clique.Cliq
import tech.pegasys.pantheon.ethereum.core.Address;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2.Ibft2Transactions;
import java.util.List;
public class WaitUntilValidatorsChanged implements WaitCondition {
private final IbftTransactions ibft;
private final Ibft2Transactions ibft;
private final List<Address> initialSigners;
public WaitUntilValidatorsChanged(
final List<Address> initialSigners, final IbftTransactions ibft) {
final List<Address> initialSigners, final Ibft2Transactions ibft) {
this.initialSigners = initialSigners;
this.ibft = ibft;
}

@ -1,43 +0,0 @@
/*
* Copyright 2019 ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.tests.acceptance.ibft;
import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode;
import java.io.IOException;
import org.junit.Test;
public class IbftDiscardRpcAcceptanceTest extends AcceptanceTestBase {
@Test
public void shouldDiscardVotes() throws IOException {
final String[] validators = {"validator1", "validator3"};
final PantheonNode validator1 = pantheon.createIbftNodeWithValidators("validator1", validators);
final PantheonNode validator2 = pantheon.createIbftNodeWithValidators("validator2", validators);
final PantheonNode validator3 = pantheon.createIbftNodeWithValidators("validator3", validators);
cluster.start(validator1, validator2, validator3);
validator1.execute(ibftTransactions.createAddProposal(validator2));
validator1.execute(ibftTransactions.createRemoveProposal(validator3));
validator1.verify(
ibft.pendingVotesEqual().addProposal(validator2).removeProposal(validator3).build());
validator1.execute(ibftTransactions.createDiscardProposal(validator2));
validator1.verify(ibft.pendingVotesEqual().removeProposal(validator3).build());
validator1.execute(ibftTransactions.createDiscardProposal(validator3));
cluster.verify(ibft.noProposals());
}
}

@ -0,0 +1,46 @@
/*
* Copyright 2019 ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.tests.acceptance.ibft2;
import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode;
import java.io.IOException;
import org.junit.Test;
public class Ibft2DiscardRpcAcceptanceTest extends AcceptanceTestBase {
@Test
public void shouldDiscardVotes() throws IOException {
final String[] validators = {"validator1", "validator3"};
final PantheonNode validator1 =
pantheon.createIbft2NodeWithValidators("validator1", validators);
final PantheonNode validator2 =
pantheon.createIbft2NodeWithValidators("validator2", validators);
final PantheonNode validator3 =
pantheon.createIbft2NodeWithValidators("validator3", validators);
cluster.start(validator1, validator2, validator3);
validator1.execute(ibftTwoTransactions.createAddProposal(validator2));
validator1.execute(ibftTwoTransactions.createRemoveProposal(validator3));
validator1.verify(
ibftTwo.pendingVotesEqual().addProposal(validator2).removeProposal(validator3).build());
validator1.execute(ibftTwoTransactions.createDiscardProposal(validator2));
validator1.verify(ibftTwo.pendingVotesEqual().removeProposal(validator3).build());
validator1.execute(ibftTwoTransactions.createDiscardProposal(validator3));
cluster.verify(ibftTwo.noProposals());
}
}

@ -10,7 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.tests.acceptance.ibft;
package tech.pegasys.pantheon.tests.acceptance.ibft2;
import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase;
import tech.pegasys.pantheon.tests.acceptance.dsl.account.Account;
@ -21,11 +21,11 @@ import java.util.List;
import org.junit.Test;
public class IbftMiningAcceptanceTest extends AcceptanceTestBase {
public class Ibft2MiningAcceptanceTest extends AcceptanceTestBase {
@Test
public void shouldMineOnSingleNode() throws IOException {
final PantheonNode minerNode = pantheon.createIbftNode("miner1");
final PantheonNode minerNode = pantheon.createIbft2Node("miner1");
cluster.start(minerNode);
cluster.waitUntil(wait.chainHeadHasProgressedByAtLeast(minerNode, 1));
@ -45,10 +45,10 @@ public class IbftMiningAcceptanceTest extends AcceptanceTestBase {
@Test
public void shouldMineOnMultipleNodes() throws IOException {
final PantheonNode minerNode1 = pantheon.createIbftNode("miner1");
final PantheonNode minerNode2 = pantheon.createIbftNode("miner2");
final PantheonNode minerNode3 = pantheon.createIbftNode("miner3");
final PantheonNode minerNode4 = pantheon.createIbftNode("miner4");
final PantheonNode minerNode1 = pantheon.createIbft2Node("miner1");
final PantheonNode minerNode2 = pantheon.createIbft2Node("miner2");
final PantheonNode minerNode3 = pantheon.createIbft2Node("miner3");
final PantheonNode minerNode4 = pantheon.createIbft2Node("miner4");
cluster.start(minerNode1, minerNode2, minerNode3, minerNode4);
cluster.waitUntil(wait.chainHeadHasProgressedByAtLeast(minerNode1, 1, 85));
@ -72,11 +72,14 @@ public class IbftMiningAcceptanceTest extends AcceptanceTestBase {
@Test
public void shouldMineOnMultipleNodesEvenWhenClusterContainsNonValidator() throws IOException {
final String[] validators = {"validator1", "validator2", "validator3"};
final PantheonNode validator1 = pantheon.createIbftNodeWithValidators("validator1", validators);
final PantheonNode validator2 = pantheon.createIbftNodeWithValidators("validator2", validators);
final PantheonNode validator3 = pantheon.createIbftNodeWithValidators("validator3", validators);
final PantheonNode validator1 =
pantheon.createIbft2NodeWithValidators("validator1", validators);
final PantheonNode validator2 =
pantheon.createIbft2NodeWithValidators("validator2", validators);
final PantheonNode validator3 =
pantheon.createIbft2NodeWithValidators("validator3", validators);
final PantheonNode nonValidatorNode =
pantheon.createIbftNodeWithValidators("non-validator", validators);
pantheon.createIbft2NodeWithValidators("non-validator", validators);
cluster.start(validator1, validator2, validator3, nonValidatorNode);
cluster.waitUntil(wait.chainHeadHasProgressedByAtLeast(validator1, 1, 85));
@ -97,12 +100,12 @@ public class IbftMiningAcceptanceTest extends AcceptanceTestBase {
@Test
public void shouldStillMineWhenANonProposerNodeFailsAndHasSufficientValidators()
throws IOException {
final PantheonNode minerNode1 = pantheon.createIbftNode("miner1");
final PantheonNode minerNode2 = pantheon.createIbftNode("miner2");
final PantheonNode minerNode3 = pantheon.createIbftNode("miner3");
final PantheonNode minerNode4 = pantheon.createIbftNode("miner4");
final PantheonNode minerNode1 = pantheon.createIbft2Node("miner1");
final PantheonNode minerNode2 = pantheon.createIbft2Node("miner2");
final PantheonNode minerNode3 = pantheon.createIbft2Node("miner3");
final PantheonNode minerNode4 = pantheon.createIbft2Node("miner4");
final List<PantheonNode> validators =
ibft.validators(new PantheonNode[] {minerNode1, minerNode2, minerNode3, minerNode4});
ibftTwo.validators(new PantheonNode[] {minerNode1, minerNode2, minerNode3, minerNode4});
final PantheonNode nonProposerNode = validators.get(validators.size() - 1);
cluster.start(validators);

@ -10,7 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.tests.acceptance.ibft;
package tech.pegasys.pantheon.tests.acceptance.ibft2;
import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode;
@ -19,24 +19,27 @@ import java.io.IOException;
import org.junit.Test;
public class IbftProposalRpcAcceptanceTest extends AcceptanceTestBase {
public class Ibft2ProposalRpcAcceptanceTest extends AcceptanceTestBase {
@Test
public void shouldReturnProposals() throws IOException {
final String[] validators = {"validator1", "validator2", "validator3"};
final PantheonNode validator1 = pantheon.createIbftNodeWithValidators("validator1", validators);
final PantheonNode validator2 = pantheon.createIbftNodeWithValidators("validator2", validators);
final PantheonNode validator3 = pantheon.createIbftNodeWithValidators("validator3", validators);
final PantheonNode validator1 =
pantheon.createIbft2NodeWithValidators("validator1", validators);
final PantheonNode validator2 =
pantheon.createIbft2NodeWithValidators("validator2", validators);
final PantheonNode validator3 =
pantheon.createIbft2NodeWithValidators("validator3", validators);
cluster.start(validator1, validator2, validator3);
cluster.verify(ibft.noProposals());
validator1.execute(ibftTransactions.createAddProposal(validator3));
validator1.execute(ibftTransactions.createRemoveProposal(validator2));
validator2.execute(ibftTransactions.createRemoveProposal(validator3));
cluster.verify(ibftTwo.noProposals());
validator1.execute(ibftTwoTransactions.createAddProposal(validator3));
validator1.execute(ibftTwoTransactions.createRemoveProposal(validator2));
validator2.execute(ibftTwoTransactions.createRemoveProposal(validator3));
validator1.verify(
ibft.pendingVotesEqual().addProposal(validator3).removeProposal(validator2).build());
validator2.verify(ibft.pendingVotesEqual().removeProposal(validator3).build());
validator3.verify(ibft.noProposals());
ibftTwo.pendingVotesEqual().addProposal(validator3).removeProposal(validator2).build());
validator2.verify(ibftTwo.pendingVotesEqual().removeProposal(validator3).build());
validator3.verify(ibftTwo.noProposals());
}
}

@ -10,7 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.tests.acceptance.ibft;
package tech.pegasys.pantheon.tests.acceptance.ibft2;
import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode;
@ -22,31 +22,34 @@ import org.junit.Test;
// These tests prove the ibft_proposeValidatorVote and ibft_getValidatorsByBlockNumber (implicitly)
// JSON RPC calls.
public class IbftProposeRpcAcceptanceTest extends AcceptanceTestBase {
public class Ibft2ProposeRpcAcceptanceTest extends AcceptanceTestBase {
@Test
public void validatorsCanBeAddedAndThenRemoved() throws IOException {
final String[] validators = {"validator1", "validator2", "validator3"};
final PantheonNode validator1 = pantheon.createIbftNodeWithValidators("validator1", validators);
final PantheonNode validator2 = pantheon.createIbftNodeWithValidators("validator2", validators);
final PantheonNode validator3 = pantheon.createIbftNodeWithValidators("validator3", validators);
final PantheonNode validator1 =
pantheon.createIbft2NodeWithValidators("validator1", validators);
final PantheonNode validator2 =
pantheon.createIbft2NodeWithValidators("validator2", validators);
final PantheonNode validator3 =
pantheon.createIbft2NodeWithValidators("validator3", validators);
final PantheonNode nonValidatorNode =
pantheon.createIbftNodeWithValidators("non-validator", validators);
pantheon.createIbft2NodeWithValidators("non-validator", validators);
cluster.start(validator1, validator2, validator3, nonValidatorNode);
cluster.verify(ibft.validatorsEqual(validator1, validator2, validator3));
cluster.verify(ibftTwo.validatorsEqual(validator1, validator2, validator3));
final WaitCondition addedCondition = wait.ibftValidatorsChanged(validator1);
validator1.execute(ibftTransactions.createAddProposal(nonValidatorNode));
validator2.execute(ibftTransactions.createAddProposal(nonValidatorNode));
validator1.execute(ibftTwoTransactions.createAddProposal(nonValidatorNode));
validator2.execute(ibftTwoTransactions.createAddProposal(nonValidatorNode));
cluster.waitUntil(addedCondition);
cluster.verify(ibft.validatorsEqual(validator1, validator2, validator3, nonValidatorNode));
cluster.verify(ibftTwo.validatorsEqual(validator1, validator2, validator3, nonValidatorNode));
final WaitCondition removedCondition = wait.ibftValidatorsChanged(validator1);
validator2.execute(ibftTransactions.createRemoveProposal(nonValidatorNode));
validator3.execute(ibftTransactions.createRemoveProposal(nonValidatorNode));
nonValidatorNode.execute(ibftTransactions.createRemoveProposal(nonValidatorNode));
validator2.execute(ibftTwoTransactions.createRemoveProposal(nonValidatorNode));
validator3.execute(ibftTwoTransactions.createRemoveProposal(nonValidatorNode));
nonValidatorNode.execute(ibftTwoTransactions.createRemoveProposal(nonValidatorNode));
cluster.waitUntil(removedCondition);
cluster.verify(ibft.validatorsEqual(validator1, validator2, validator3));
cluster.verify(ibftTwo.validatorsEqual(validator1, validator2, validator3));
}
}

@ -26,7 +26,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class IbftPrivacyClusterAcceptanceTest extends PrivacyAcceptanceTestBase {
public class Ibft2PrivacyClusterAcceptanceTest extends PrivacyAcceptanceTestBase {
private static final String CONTRACT_NAME = "Event Emmiter";
private EventEmitterHarness eventEmitterHarness;
Loading…
Cancel
Save