From 4ab12ae239502972b65f4c8d0e35ac186adc6f21 Mon Sep 17 00:00:00 2001 From: CJ Hare Date: Mon, 27 May 2019 14:00:44 +1000 Subject: [PATCH] Acceptance Test and DSL rename for IBFT2 (#1493) Renaming the Ibft AT to ibft2 Signed-off-by: Adrian Sutton --- .../acceptance/dsl/AcceptanceTestBase.java | 14 +++--- .../dsl/condition/ibft/ExpectProposals.java | 10 ++-- .../dsl/condition/ibft/ExpectValidators.java | 8 ++-- .../dsl/jsonrpc/{Ibft.java => Ibft2.java} | 20 ++++---- .../acceptance/dsl/node/PantheonNode.java | 4 +- .../dsl/node/factory/PantheonNodeFactory.java | 25 ++++------ .../factory/PantheonNodeFactoryUtils.java | 14 +++--- .../privacy/PrivacyAcceptanceTestBase.java | 2 +- .../acceptance/dsl/privacy/PrivacyNet.java | 2 +- .../privacy/PrivacyPantheonNodeFactory.java | 6 +-- ...y.java => Ibft2JsonRpcRequestFactory.java} | 14 +++--- .../dsl/transaction/JsonRequestFactories.java | 6 +-- .../Ibft2Discard.java} | 8 ++-- .../Ibft2GetValidators.java} | 8 ++-- .../Ibft2GetValidatorsAtHash.java} | 8 ++-- .../Ibft2Proposals.java} | 6 +-- .../Ibft2Propose.java} | 8 ++-- .../Ibft2Transactions.java} | 28 +++++------ .../dsl/waitcondition/WaitConditions.java | 6 +-- .../WaitUntilValidatorsChanged.java | 6 +-- .../ibft/IbftDiscardRpcAcceptanceTest.java | 43 ----------------- .../ibft2/Ibft2DiscardRpcAcceptanceTest.java | 46 +++++++++++++++++++ .../Ibft2MiningAcceptanceTest.java} | 35 +++++++------- .../Ibft2ProposalRpcAcceptanceTest.java} | 27 ++++++----- .../Ibft2ProposeRpcAcceptanceTest.java} | 31 +++++++------ ...=> Ibft2PrivacyClusterAcceptanceTest.java} | 2 +- 26 files changed, 195 insertions(+), 192 deletions(-) rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/{Ibft.java => Ibft2.java} (86%) rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/{IbftJsonRpcRequestFactory.java => Ibft2JsonRpcRequestFactory.java} (81%) rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/{ibft/IbftDiscard.java => ibft2/Ibft2Discard.java} (87%) rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/{ibft/IbftGetValidators.java => ibft2/Ibft2GetValidators.java} (86%) rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/{ibft/IbftGetValidatorsAtHash.java => ibft2/Ibft2GetValidatorsAtHash.java} (86%) rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/{ibft/IbftProposals.java => ibft2/Ibft2Proposals.java} (89%) rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/{ibft/IbftPropose.java => ibft2/Ibft2Propose.java} (86%) rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/{ibft/IbftTransactions.java => ibft2/Ibft2Transactions.java} (56%) delete mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftDiscardRpcAcceptanceTest.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2DiscardRpcAcceptanceTest.java rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/{ibft/IbftMiningAcceptanceTest.java => ibft2/Ibft2MiningAcceptanceTest.java} (75%) rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/{ibft/IbftProposalRpcAcceptanceTest.java => ibft2/Ibft2ProposalRpcAcceptanceTest.java} (51%) rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/{ibft/IbftProposeRpcAcceptanceTest.java => ibft2/Ibft2ProposeRpcAcceptanceTest.java} (56%) rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/privacy/{IbftPrivacyClusterAcceptanceTest.java => Ibft2PrivacyClusterAcceptanceTest.java} (98%) diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/AcceptanceTestBase.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/AcceptanceTestBase.java index 6021afe0f5..dd45057e2c 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/AcceptanceTestBase.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/AcceptanceTestBase.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(); } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectProposals.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectProposals.java index 0443e018c8..81fc3c7a94 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectProposals.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectProposals.java @@ -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 proposers; - public ExpectProposals(final IbftTransactions ibft, final Map proposers) { - this.ibft = ibft; + public ExpectProposals(final Ibft2Transactions ibftTwo, final Map 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)); } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidators.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidators.java index a398d592e5..936f46748d 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidators.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidators.java @@ -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; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft2.java similarity index 86% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft2.java index 450ffe5137..04e1fafc23 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft2.java @@ -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 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 proposals = new HashMap<>(); - private final IbftTransactions ibft; + private final Ibft2Transactions ibft; - public PendingVotesConfig(final IbftTransactions ibft) { + private PendingVotesConfig(final Ibft2Transactions ibft) { this.ibft = ibft; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/PantheonNode.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/PantheonNode.java index 7a4aff473e..d28a51d33f 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/PantheonNode.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/PantheonNode.java @@ -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), diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/factory/PantheonNodeFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/factory/PantheonNodeFactory.java index e1e306136f..31cba21969 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/factory/PantheonNodeFactory.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/factory/PantheonNodeFactory.java @@ -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()); } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/factory/PantheonNodeFactoryUtils.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/factory/PantheonNodeFactoryUtils.java index c58c5974e8..3646fcee39 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/factory/PantheonNodeFactoryUtils.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/factory/PantheonNodeFactoryUtils.java @@ -49,7 +49,7 @@ public class PantheonNodeFactoryUtils { validators, template, CliqueExtraData::createGenesisExtraDataString); } - public Optional createIbftGenesisConfig( + public Optional createIbft2GenesisConfig( final Collection 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 rpcApis = new ArrayList<>(jsonRpcConfig.getRpcApis()); rpcApis.addAll(Arrays.asList(rpcApi)); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyAcceptanceTestBase.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyAcceptanceTestBase.java index f0bc828083..1b9863dd6f 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyAcceptanceTestBase.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyAcceptanceTestBase.java @@ -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; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyNet.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyNet.java index 50b7916cef..ee0f1e8f25 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyNet.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyNet.java @@ -228,7 +228,7 @@ public class PrivacyNet { name, generatePrivacyParameters(orion), keyFilePath, orion); } else { node = - pantheonNodeFactory.createIbftNodePrivacyEnabled( + pantheonNodeFactory.createIbft2NodePrivacyEnabled( name, generatePrivacyParameters(orion), keyFilePath, orion); } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyPantheonNodeFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyPantheonNodeFactory.java index df2e8015e1..037f020bdd 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyPantheonNodeFactory.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyPantheonNodeFactory.java @@ -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()) diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/IbftJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/Ibft2JsonRpcRequestFactory.java similarity index 81% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/IbftJsonRpcRequestFactory.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/Ibft2JsonRpcRequestFactory.java index 05635c0d15..b330ad0934 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/IbftJsonRpcRequestFactory.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/Ibft2JsonRpcRequestFactory.java @@ -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 ibftPropose(final String address, final Boolean auth) { + public Request 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 ibftDiscard(final String address) { + public Request discard(final String address) { return new Request<>( "ibft_discardValidatorVote", singletonList(address), web3jService, DiscardResponse.class); } - public Request ibftProposals() { + public Request proposals() { return new Request<>( "ibft_getPendingVotes", emptyList(), web3jService, ProposalsResponse.class); } - public Request ibftGetValidators(final String blockNumber) { + public Request validatorsAtBlock(final String blockNumber) { return new Request<>( "ibft_getValidatorsByBlockNumber", singletonList(blockNumber), @@ -60,7 +60,7 @@ public class IbftJsonRpcRequestFactory { SignersBlockResponse.class); } - public Request ibftGetSignersAtHash(final Hash hash) { + public Request signersAtHash(final Hash hash) { return new Request<>( "ibft_getValidatorsByBlockHash", singletonList(hash.toString()), diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/JsonRequestFactories.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/JsonRequestFactories.java index 6efaf7b865..57d8e37837 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/JsonRequestFactories.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/JsonRequestFactories.java @@ -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; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftDiscard.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Discard.java similarity index 87% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftDiscard.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Discard.java index 58f5b497b4..dfc56f3c62 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftDiscard.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Discard.java @@ -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 { +public class Ibft2Discard implements Transaction { 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(); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetValidators.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2GetValidators.java similarity index 86% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetValidators.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2GetValidators.java index d773ece7b1..b55be6338d 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetValidators.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2GetValidators.java @@ -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> { +public class Ibft2GetValidators implements Transaction> { private final String blockNumber; - public IbftGetValidators(final String blockNumber) { + public Ibft2GetValidators(final String blockNumber) { this.blockNumber = blockNumber; } @Override public List
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(); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetValidatorsAtHash.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2GetValidatorsAtHash.java similarity index 86% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetValidatorsAtHash.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2GetValidatorsAtHash.java index 1a9caf4e54..404975a9d5 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetValidatorsAtHash.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2GetValidatorsAtHash.java @@ -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> { +public class Ibft2GetValidatorsAtHash implements Transaction> { private final Hash hash; - public IbftGetValidatorsAtHash(final Hash hash) { + public Ibft2GetValidatorsAtHash(final Hash hash) { this.hash = hash; } @Override public List
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(); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftProposals.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Proposals.java similarity index 89% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftProposals.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Proposals.java index 6724ac964d..dc5cc5a281 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftProposals.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Proposals.java @@ -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> { +public class Ibft2Proposals implements Transaction> { @Override public Map 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(); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftPropose.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Propose.java similarity index 86% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftPropose.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Propose.java index 88ff88d446..f260a39842 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftPropose.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Propose.java @@ -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 { +public class Ibft2Propose implements Transaction { 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 { @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(); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftTransactions.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Transactions.java similarity index 56% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftTransactions.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Transactions.java index 4b9e9bda11..b572bd8600 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftTransactions.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft2/Ibft2Transactions.java @@ -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()); } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/waitcondition/WaitConditions.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/waitcondition/WaitConditions.java index ebb3b8ede2..65d9a10099 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/waitcondition/WaitConditions.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/waitcondition/WaitConditions.java @@ -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; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/waitcondition/WaitUntilValidatorsChanged.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/waitcondition/WaitUntilValidatorsChanged.java index a1de59928f..dceba0bc8d 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/waitcondition/WaitUntilValidatorsChanged.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/waitcondition/WaitUntilValidatorsChanged.java @@ -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
initialSigners; public WaitUntilValidatorsChanged( - final List
initialSigners, final IbftTransactions ibft) { + final List
initialSigners, final Ibft2Transactions ibft) { this.initialSigners = initialSigners; this.ibft = ibft; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftDiscardRpcAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftDiscardRpcAcceptanceTest.java deleted file mode 100644 index 3b1dcd7fa2..0000000000 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftDiscardRpcAcceptanceTest.java +++ /dev/null @@ -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()); - } -} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2DiscardRpcAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2DiscardRpcAcceptanceTest.java new file mode 100644 index 0000000000..cf72f16a0f --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2DiscardRpcAcceptanceTest.java @@ -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()); + } +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftMiningAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2MiningAcceptanceTest.java similarity index 75% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftMiningAcceptanceTest.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2MiningAcceptanceTest.java index fcbf42fd28..68e2b4d479 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftMiningAcceptanceTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2MiningAcceptanceTest.java @@ -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 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); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftProposalRpcAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2ProposalRpcAcceptanceTest.java similarity index 51% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftProposalRpcAcceptanceTest.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2ProposalRpcAcceptanceTest.java index 7c91904492..52a4f7633d 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftProposalRpcAcceptanceTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2ProposalRpcAcceptanceTest.java @@ -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()); } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftProposeRpcAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2ProposeRpcAcceptanceTest.java similarity index 56% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftProposeRpcAcceptanceTest.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2ProposeRpcAcceptanceTest.java index 0ea14c3905..4a911c709a 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftProposeRpcAcceptanceTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2ProposeRpcAcceptanceTest.java @@ -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)); } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/privacy/IbftPrivacyClusterAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/privacy/Ibft2PrivacyClusterAcceptanceTest.java similarity index 98% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/privacy/IbftPrivacyClusterAcceptanceTest.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/privacy/Ibft2PrivacyClusterAcceptanceTest.java index 9e74825923..85f1d094f1 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/privacy/IbftPrivacyClusterAcceptanceTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/privacy/Ibft2PrivacyClusterAcceptanceTest.java @@ -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;