From 0dcfdd764e7cb4d5249b7dddd5822450fa036a66 Mon Sep 17 00:00:00 2001 From: tmohay Date: Tue, 22 Jan 2019 15:22:32 +1100 Subject: [PATCH 01/14] starting acceptance tests --- .../acceptance/dsl/AcceptanceTestBase.java | 6 +- .../tests/acceptance/dsl/jsonrpc/Ibft.java | 21 ++++++ .../dsl/transaction/PantheonWeb3j.java | 73 ++++++++++++++++--- .../dsl/transaction/ibft/IbftDiscard.java | 40 ++++++++++ .../dsl/transaction/ibft/IbftGetSigners.java | 42 +++++++++++ .../ibft/IbftGetSignersAtHash.java | 43 +++++++++++ .../dsl/transaction/ibft/IbftProposals.java | 37 ++++++++++ .../dsl/transaction/ibft/IbftPropose.java | 42 +++++++++++ .../transaction/ibft/IbftTransactions.java | 48 ++++++++++++ .../ibft/IbftProposeRpcAcceptanceTest.java | 26 +++++++ 10 files changed, 367 insertions(+), 11 deletions(-) create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftDiscard.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetSigners.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetSignersAtHash.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftProposals.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftPropose.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftTransactions.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftProposeRpcAcceptanceTest.java 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 d42e9eb0d1..231fb17761 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 @@ -26,6 +26,7 @@ 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.net.NetTransactions; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.web3.Web3Transactions; import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitConditions; @@ -38,6 +39,7 @@ public class AcceptanceTestBase { protected final Blockchain blockchain; protected final Cluster cluster; protected final CliqueTransactions cliqueTransactions; + protected final IbftTransactions ibftTransactions; protected final Transactions transactions; protected final Clique clique; protected final Ibft ibft; @@ -55,8 +57,10 @@ protected AcceptanceTestBase() { blockchain = new Blockchain(ethTransactions); eth = new Eth(ethTransactions); cliqueTransactions = new CliqueTransactions(); + ibftTransactions = new IbftTransactions(); + clique = new Clique(ethTransactions, cliqueTransactions); - ibft = new Ibft(); + ibft = new Ibft(ethTransactions, ibftTransactions); net = new Net(new NetTransactions()); cluster = new Cluster(net); transactions = new Transactions(accounts); 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/Ibft.java index 3c6f30c8b1..c5a2140bfb 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/Ibft.java @@ -12,14 +12,27 @@ */ package tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc; +import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.clique.ExpectValidators; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import java.util.Arrays; import java.util.Comparator; import java.util.List; +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; public class Ibft { + private final EthTransactions eth; + private final IbftTransactions ibft; + + public Ibft(final EthTransactions eth, final IbftTransactions ibft) { + this.eth = eth; + this.ibft = ibft; + } + public List validators(final PantheonNode[] nodes) { final Comparator compareByAddress = Comparator.comparing(PantheonNode::getAddress); @@ -27,4 +40,12 @@ public List validators(final PantheonNode[] nodes) { pantheonNodes.sort(compareByAddress); return pantheonNodes; } + + public ExpectValidators validatorsEqual(final PantheonNode... validators) { + return new ExpectValidators(ibft, validatorAddresses(validators)); + } + + private Address[] validatorAddresses(final PantheonNode[] validators) { + return Arrays.stream(validators).map(PantheonNode::getAddress).sorted().toArray(Address[]::new); + } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java index d488a8d5c1..83610410ec 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java @@ -73,13 +73,54 @@ public Request cliqueGetSignersAtHash(final Hash hash) SignersBlockResponse.class); } - public static class ProposeResponse extends Response {} + public Request ibftPropose(final String address, final Boolean auth) { + return new Request<>( + "ibft_proposeValidatorVote", + Arrays.asList(address, auth.toString()), + web3jService, + ProposeResponse.class); + } + + public Request ibftDiscard(final String address) { + return new Request<>( + "ibft_discardValidatorVote", singletonList(address), web3jService, DiscardResponse.class); + } + + public Request ibftProposals() { + return new Request<>("ibft_getPendingVotes", emptyList(), web3jService, + ProposalsResponse.class); + } + + public Request ibftGetSigners(final String blockNumber) { + return new Request<>( + "ibft_getValidatorsByBlockNumber", singletonList(blockNumber), web3jService, + SignersBlockResponse.class); + } + + public Request ibftGetSignersAtHash(final Hash hash) { + return new Request<>( + "ibft_getValidatorsByBlockHash", + singletonList(hash.toString()), + web3jService, + SignersBlockResponse.class); + } + - public static class DiscardResponse extends Response {} + public static class ProposeResponse extends Response { - public static class SignersBlockResponse extends Response> {} + } + + public static class DiscardResponse extends Response { + + } + + public static class SignersBlockResponse extends Response> { - public static class ProposalsResponse extends Response> {} + } + + public static class ProposalsResponse extends Response> { + + } public Request addAccountsToWhitelist( final List accounts) { @@ -104,11 +145,17 @@ public Request getAccountsWhitelist() { "perm_getAccountsWhitelist", null, web3jService, GetAccountsWhitelistResponse.class); } - public static class AddAccountsToWhitelistResponse extends Response {} + public static class AddAccountsToWhitelistResponse extends Response { - public static class RemoveAccountsFromWhitelistResponse extends Response {} + } - public static class GetAccountsWhitelistResponse extends Response> {} + public static class RemoveAccountsFromWhitelistResponse extends Response { + + } + + public static class GetAccountsWhitelistResponse extends Response> { + + } public Request addNodesToWhitelist(final List enodeList) { return new Request<>( @@ -131,9 +178,15 @@ public Request getNodesWhitelist() { "perm_getNodesWhitelist", Lists.emptyList(), web3jService, GetNodesWhitelistResponse.class); } - public static class AddNodeResponse extends Response {} + public static class AddNodeResponse extends Response { + + } + + public static class RemoveNodeResponse extends Response { - public static class RemoveNodeResponse extends Response {} + } - public static class GetNodesWhitelistResponse extends Response> {} + public static class GetNodesWhitelistResponse extends Response> { + + } } 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/ibft/IbftDiscard.java new file mode 100644 index 0000000000..ee4692e4be --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftDiscard.java @@ -0,0 +1,40 @@ +/* + * Copyright 2018 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.dsl.transaction.ibft; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.DiscardResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; + +public class IbftDiscard implements Transaction { + private final String address; + + public IbftDiscard(final String address) { + this.address = address; + } + + @Override + public Boolean execute(final PantheonWeb3j node) { + try { + final DiscardResponse result = node.cliqueDiscard(address).send(); + assertThat(result).isNotNull(); + assertThat(result.hasError()).isFalse(); + return result.getResult(); + } catch (final IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetSigners.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetSigners.java new file mode 100644 index 0000000000..464f7c061d --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetSigners.java @@ -0,0 +1,42 @@ +/* + * Copyright 2018 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.dsl.transaction.ibft; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.util.List; +import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; + +public class IbftGetSigners implements Transaction> { + private final String blockNumber; + + public IbftGetSigners(final String blockNumber) { + this.blockNumber = blockNumber; + } + + @Override + public List
execute(final PantheonWeb3j node) { + try { + final SignersBlockResponse result = node.cliqueGetSigners(blockNumber).send(); + assertThat(result).isNotNull(); + assertThat(result.hasError()).isFalse(); + return result.getResult(); + } catch (final IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetSignersAtHash.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetSignersAtHash.java new file mode 100644 index 0000000000..fbfb912454 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetSignersAtHash.java @@ -0,0 +1,43 @@ +/* + * Copyright 2018 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.dsl.transaction.ibft; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.util.List; +import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; + +public class IbftGetSignersAtHash implements Transaction> { + private final Hash hash; + + public IbftGetSignersAtHash(final Hash hash) { + this.hash = hash; + } + + @Override + public List
execute(final PantheonWeb3j node) { + try { + final SignersBlockResponse result = node.cliqueGetSignersAtHash(hash).send(); + assertThat(result).isNotNull(); + assertThat(result.hasError()).isFalse(); + return result.getResult(); + } catch (final IOException e) { + throw new RuntimeException(e); + } + } +} 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/ibft/IbftProposals.java new file mode 100644 index 0000000000..f30c82d0b0 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftProposals.java @@ -0,0 +1,37 @@ +/* + * Copyright 2018 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.dsl.transaction.ibft; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.util.Map; +import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposalsResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; + +public class IbftProposals implements Transaction> { + + @Override + public Map execute(final PantheonWeb3j node) { + try { + final ProposalsResponse result = node.cliqueProposals().send(); + assertThat(result).isNotNull(); + assertThat(result.hasError()).isFalse(); + return result.getResult(); + } catch (final IOException e) { + throw new RuntimeException(e); + } + } +} 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/ibft/IbftPropose.java new file mode 100644 index 0000000000..dff493a861 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftPropose.java @@ -0,0 +1,42 @@ +/* + * Copyright 2018 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.dsl.transaction.ibft; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposeResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; + +public class IbftPropose implements Transaction { + private final String address; + private final boolean auth; + + public IbftPropose(final String address, final boolean auth) { + this.address = address; + this.auth = auth; + } + + @Override + public Boolean execute(final PantheonWeb3j node) { + try { + final ProposeResponse result = node.cliquePropose(address, auth).send(); + assertThat(result).isNotNull(); + assertThat(result.hasError()).isFalse(); + return result.getResult(); + } catch (final IOException e) { + throw new RuntimeException(e); + } + } +} 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/ibft/IbftTransactions.java new file mode 100644 index 0000000000..86bd46ee45 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftTransactions.java @@ -0,0 +1,48 @@ +/* + * Copyright 2018 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.dsl.transaction.ibft; + +import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; + +public class IbftTransactions { + public static final String LATEST = "latest"; + + public IbftPropose createRemoveProposal(final PantheonNode node) { + return propose(node.getAddress().toString(), false); + } + + public IbftPropose createAddProposal(final PantheonNode node) { + return propose(node.getAddress().toString(), true); + } + + private IbftPropose propose(final String address, final boolean auth) { + return new IbftPropose(address, auth); + } + + public IbftProposals createProposals() { + return new IbftProposals(); + } + + public IbftGetSigners createGetSigners(final String blockNumber) { + return new IbftGetSigners(blockNumber); + } + + public IbftGetSignersAtHash createGetSignersAtHash(final Hash blockHash) { + return new IbftGetSignersAtHash(blockHash); + } + + public IbftDiscard createDiscardProposal(final PantheonNode node) { + return new IbftDiscard(node.getAddress().toString()); + } +} 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/ibft/IbftProposeRpcAcceptanceTest.java new file mode 100644 index 0000000000..f450bf95d4 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftProposeRpcAcceptanceTest.java @@ -0,0 +1,26 @@ +package tech.pegasys.pantheon.tests.acceptance.ibft; + +import java.io.IOException; +import org.junit.Test; +import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase; +import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; + +public class IbftProposeRpcAcceptanceTest extends AcceptanceTestBase { + + @Test + public void shouldAddNewValidators() throws IOException { + final String[] validators = {"miner1", "miner2", "miner3"}; + final PantheonNode minerNode1 = pantheon.createIbftNode("miner1"); + final PantheonNode minerNode2 = pantheon.createIbftNode("miner2"); + final PantheonNode minerNode3 = pantheon.createIbftNode("miner3"); + final PantheonNode nonValidatorNode = + pantheon.createIbftNodeWithValidators("non-validator", validators); + cluster.start(minerNode1, minerNode2, minerNode3, nonValidatorNode); + + cluster.verify(ibft.validatorsEqual(minerNode1, minerNode2)); + + + + } + +} From bc7407032e41a858489c22bde65797c8a3a64c0d Mon Sep 17 00:00:00 2001 From: tmohay Date: Tue, 22 Jan 2019 16:34:41 +1100 Subject: [PATCH 02/14] test nearly working --- .../acceptance/dsl/AcceptanceTestBase.java | 2 +- .../dsl/condition/ibft/ExpectProposals.java | 38 ++++++++++++++++ .../dsl/condition/ibft/ExpectValidators.java | 39 ++++++++++++++++ .../ibft/ExpectValidatorsAtBlock.java | 42 ++++++++++++++++++ .../ibft/ExpectValidatorsAtBlockHash.java | 44 +++++++++++++++++++ .../tests/acceptance/dsl/jsonrpc/Ibft.java | 8 ++-- .../dsl/transaction/PantheonWeb3j.java | 2 +- ...GetSigners.java => IbftGetValidators.java} | 6 +-- ...Hash.java => IbftGetValidatorsAtHash.java} | 4 +- .../transaction/ibft/IbftTransactions.java | 8 ++-- .../dsl/waitcondition/WaitConditions.java | 10 ++++- .../WaitUntilValidatorsChanged.java | 44 +++++++++++++++++++ .../ibft/IbftProposeRpcAcceptanceTest.java | 19 +++++--- 13 files changed, 243 insertions(+), 23 deletions(-) create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectProposals.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidators.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlock.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlockHash.java rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/{IbftGetSigners.java => IbftGetValidators.java} (87%) rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/{IbftGetSignersAtHash.java => IbftGetValidatorsAtHash.java} (92%) create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/waitcondition/WaitUntilValidatorsChanged.java 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 231fb17761..67dd02dc21 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 @@ -68,7 +68,7 @@ protected AcceptanceTestBase() { web3 = new Web3(new Web3Transactions()); pantheon = new PantheonNodeFactory(); contractVerifier = new ContractVerifier(accounts.getPrimaryBenefactor()); - wait = new WaitConditions(ethTransactions, cliqueTransactions); + wait = new WaitConditions(ethTransactions, cliqueTransactions, ibftTransactions); } @After 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 new file mode 100644 index 0000000000..3cdece65cf --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectProposals.java @@ -0,0 +1,38 @@ +/* + * Copyright 2018 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.dsl.condition.ibft; + +import static org.assertj.core.api.Assertions.assertThat; +import static tech.pegasys.pantheon.tests.acceptance.dsl.WaitUtils.waitFor; + +import java.util.Map; +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.clique.CliqueTransactions; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions; + +public class ExpectProposals implements Condition { + private final IbftTransactions ibft; + private final Map proposers; + + public ExpectProposals(final IbftTransactions ibft, final Map proposers) { + this.ibft = ibft; + this.proposers = proposers; + } + + @Override + public void verify(final Node node) { + waitFor(() -> assertThat(node.execute(ibft.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 new file mode 100644 index 0000000000..f1d3a5d4a1 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidators.java @@ -0,0 +1,39 @@ +/* + * Copyright 2018 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.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.clique.CliqueTransactions.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; + +public class ExpectValidators implements Condition { + private final IbftTransactions ibft; + private final Address[] validators; + + public ExpectValidators(final IbftTransactions ibft, final Address... validators) { + this.ibft = ibft; + this.validators = validators; + } + + @Override + public void verify(final Node node) { + waitFor( + () -> + assertThat(node.execute(ibft.createGetValidators(LATEST))).containsExactly(validators)); + } +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlock.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlock.java new file mode 100644 index 0000000000..7770da7133 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlock.java @@ -0,0 +1,42 @@ +/* + * Copyright 2018 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.dsl.condition.ibft; + +import static org.assertj.core.api.Assertions.assertThat; +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; + +public class ExpectValidatorsAtBlock implements Condition { + private final IbftTransactions ibft; + private final String blockParameter; + private final Address[] validators; + + public ExpectValidatorsAtBlock( + final IbftTransactions ibft, final String blockNumber, final Address... validators) { + this.ibft = ibft; + this.blockParameter = blockNumber; + this.validators = validators; + } + + @Override + public void verify(final Node node) { + waitFor( + () -> + assertThat(node.execute(ibft.createGetValidators(blockParameter))) + .containsExactly(validators)); + } +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlockHash.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlockHash.java new file mode 100644 index 0000000000..c9b4784ee5 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlockHash.java @@ -0,0 +1,44 @@ +/* + * Copyright 2018 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.dsl.condition.ibft; + +import static org.assertj.core.api.Assertions.assertThat; +import static tech.pegasys.pantheon.tests.acceptance.dsl.WaitUtils.waitFor; + +import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.core.Hash; +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.clique.CliqueTransactions; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions; + +public class ExpectValidatorsAtBlockHash implements Condition { + private final IbftTransactions ibft; + private final Hash blockHash; + private final Address[] validators; + + public ExpectValidatorsAtBlockHash( + final IbftTransactions ibft, final Hash blockHash, final Address... validators) { + this.ibft = ibft; + this.blockHash = blockHash; + this.validators = validators; + } + + @Override + public void verify(final Node node) { + waitFor( + () -> + assertThat(node.execute(ibft.createGetValidatorsAtHash(blockHash))) + .containsExactly(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/Ibft.java index c5a2140bfb..976766f1c9 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/Ibft.java @@ -12,14 +12,12 @@ */ package tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc; -import tech.pegasys.pantheon.ethereum.core.Address; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.clique.ExpectValidators; -import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; - import java.util.Arrays; import java.util.Comparator; import java.util.List; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.clique.CliqueTransactions; +import tech.pegasys.pantheon.ethereum.core.Address; +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.eth.EthTransactions; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java index 83610410ec..305e1a0cac 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java @@ -91,7 +91,7 @@ public Request ibftProposals() { ProposalsResponse.class); } - public Request ibftGetSigners(final String blockNumber) { + public Request ibftGetValidators(final String blockNumber) { return new Request<>( "ibft_getValidatorsByBlockNumber", singletonList(blockNumber), web3jService, SignersBlockResponse.class); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetSigners.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetValidators.java similarity index 87% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetSigners.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetValidators.java index 464f7c061d..32a95b6e5e 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetSigners.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetValidators.java @@ -21,17 +21,17 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -public class IbftGetSigners implements Transaction> { +public class IbftGetValidators implements Transaction> { private final String blockNumber; - public IbftGetSigners(final String blockNumber) { + public IbftGetValidators(final String blockNumber) { this.blockNumber = blockNumber; } @Override public List
execute(final PantheonWeb3j node) { try { - final SignersBlockResponse result = node.cliqueGetSigners(blockNumber).send(); + final SignersBlockResponse result = node.ibftGetValidators(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/IbftGetSignersAtHash.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetValidatorsAtHash.java similarity index 92% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetSignersAtHash.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetValidatorsAtHash.java index fbfb912454..5bafd6dc7d 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetSignersAtHash.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ibft/IbftGetValidatorsAtHash.java @@ -22,10 +22,10 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -public class IbftGetSignersAtHash implements Transaction> { +public class IbftGetValidatorsAtHash implements Transaction> { private final Hash hash; - public IbftGetSignersAtHash(final Hash hash) { + public IbftGetValidatorsAtHash(final Hash hash) { this.hash = hash; } 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/ibft/IbftTransactions.java index 86bd46ee45..4b9e9bda11 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/ibft/IbftTransactions.java @@ -34,12 +34,12 @@ public IbftProposals createProposals() { return new IbftProposals(); } - public IbftGetSigners createGetSigners(final String blockNumber) { - return new IbftGetSigners(blockNumber); + public IbftGetValidators createGetValidators(final String blockNumber) { + return new IbftGetValidators(blockNumber); } - public IbftGetSignersAtHash createGetSignersAtHash(final Hash blockHash) { - return new IbftGetSignersAtHash(blockHash); + public IbftGetValidatorsAtHash createGetValidatorsAtHash(final Hash blockHash) { + return new IbftGetValidatorsAtHash(blockHash); } public IbftDiscard createDiscardProposal(final PantheonNode node) { 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 3f5b86f55f..5f02a89f6e 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 @@ -21,14 +21,18 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eth.EthTransactions; import java.math.BigInteger; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions; public class WaitConditions { private final EthTransactions eth; private final CliqueTransactions clique; + private final IbftTransactions ibft; - public WaitConditions(final EthTransactions eth, final CliqueTransactions clique) { + public WaitConditions(final EthTransactions eth, final CliqueTransactions clique, + final IbftTransactions ibft) { this.eth = eth; this.clique = clique; + this.ibft = ibft; } public WaitCondition chainHeadHasProgressed( @@ -42,6 +46,10 @@ public WaitCondition cliqueValidatorsChanged(final Node node) { return new WaitUntilSignersChanged(node.execute(clique.createGetSigners(LATEST)), clique); } + public WaitCondition ibftValidatorsChanged(final Node node) { + return new WaitUntilValidatorsChanged(node.execute(ibft.createGetValidators(LATEST)), ibft); + } + public WaitCondition chainHeadIsAt(final long blockNumber) { return new ExpectBlockNumber(eth, BigInteger.valueOf(blockNumber))::verify; } 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 new file mode 100644 index 0000000000..c58eaae16a --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/waitcondition/WaitUntilValidatorsChanged.java @@ -0,0 +1,44 @@ +/* + * Copyright 2018 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.dsl.waitcondition; + +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.clique.CliqueTransactions.LATEST; + +import java.util.List; +import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.clique.CliqueTransactions; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions; + +public class WaitUntilValidatorsChanged implements WaitCondition { + + private final IbftTransactions ibft; + private final List
initialSigners; + + public WaitUntilValidatorsChanged( + final List
initialSigners, final IbftTransactions ibft) { + this.initialSigners = initialSigners; + this.ibft = ibft; + } + + @Override + public void waitUntil(final Node node) { + waitFor( + 60, + () -> + assertThat(node.execute(ibft.createGetValidators(LATEST))) + .isNotEqualTo(initialSigners)); + } +} 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/ibft/IbftProposeRpcAcceptanceTest.java index f450bf95d4..4fa0067ed2 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/ibft/IbftProposeRpcAcceptanceTest.java @@ -4,20 +4,27 @@ import org.junit.Test; import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; +import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitCondition; public class IbftProposeRpcAcceptanceTest extends AcceptanceTestBase { @Test public void shouldAddNewValidators() throws IOException { - final String[] validators = {"miner1", "miner2", "miner3"}; - final PantheonNode minerNode1 = pantheon.createIbftNode("miner1"); - final PantheonNode minerNode2 = pantheon.createIbftNode("miner2"); - final PantheonNode minerNode3 = pantheon.createIbftNode("miner3"); + 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 nonValidatorNode = pantheon.createIbftNodeWithValidators("non-validator", validators); - cluster.start(minerNode1, minerNode2, minerNode3, nonValidatorNode); + cluster.start(validator1, validator2, validator3, nonValidatorNode); - cluster.verify(ibft.validatorsEqual(minerNode1, minerNode2)); + cluster.verify(ibft.validatorsEqual(validator1, validator2, validator3)); + final WaitCondition validatorsChanged = wait.ibftValidatorsChanged(validator1); + validator1.execute(ibftTransactions.createAddProposal(nonValidatorNode)); + validator2.execute(ibftTransactions.createAddProposal(nonValidatorNode)); + + cluster.waitUntil(validatorsChanged); + cluster.verify(ibft.validatorsEqual(validator1, validator2, validator3, nonValidatorNode)); From ce4627f129b4f4d84480d0dd13c7032ee8fca4bb Mon Sep 17 00:00:00 2001 From: tmohay Date: Tue, 22 Jan 2019 20:56:32 +1100 Subject: [PATCH 03/14] added getProposals test --- .../tests/acceptance/dsl/jsonrpc/Ibft.java | 43 +++++++++++++++++++ .../dsl/transaction/ibft/IbftProposals.java | 2 +- .../dsl/transaction/ibft/IbftPropose.java | 2 +- .../ibft/IbftDiscardRpcAcceptanceTest.java | 5 +++ .../ibft/IbftProposalRpcAcceptanceTest.java | 40 +++++++++++++++++ .../ibft/IbftProposeRpcAcceptanceTest.java | 17 +++++--- 6 files changed, 101 insertions(+), 8 deletions(-) create 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/ibft/IbftProposalRpcAcceptanceTest.java 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/Ibft.java index 976766f1c9..0bca4d0ffe 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/Ibft.java @@ -12,10 +12,17 @@ */ package tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc; +import com.google.common.collect.ImmutableMap; import java.util.Arrays; import java.util.Comparator; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; import tech.pegasys.pantheon.ethereum.core.Address; +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.eth.EthTransactions; @@ -46,4 +53,40 @@ public ExpectValidators validatorsEqual(final PantheonNode... validators) { private Address[] validatorAddresses(final PantheonNode[] validators) { return Arrays.stream(validators).map(PantheonNode::getAddress).sorted().toArray(Address[]::new); } + + public Condition noProposals() { + return new ExpectProposals(ibft, ImmutableMap.of()); + } + + public ProposalsConfig proposalsEqual() { + return new ProposalsConfig(ibft); + } + + public static class ProposalsConfig { + private final Map proposals = new HashMap<>(); + private final IbftTransactions ibft; + + public ProposalsConfig(final IbftTransactions ibft) { + this.ibft = ibft; + } + + public Ibft.ProposalsConfig addProposal(final PantheonNode node) { + proposals.put(node, true); + return this; + } + + public Ibft.ProposalsConfig removeProposal(final PantheonNode node) { + proposals.put(node, false); + return this; + } + + public Condition build() { + final Map proposalsAsAddress = + this.proposals + .entrySet() + .stream() + .collect(Collectors.toMap(p -> p.getKey().getAddress(), Entry::getValue)); + return new tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft.ExpectProposals(ibft, proposalsAsAddress); + } + } } 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/ibft/IbftProposals.java index f30c82d0b0..4483857be2 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/ibft/IbftProposals.java @@ -26,7 +26,7 @@ public class IbftProposals implements Transaction> { @Override public Map execute(final PantheonWeb3j node) { try { - final ProposalsResponse result = node.cliqueProposals().send(); + final ProposalsResponse result = node.ibftProposals().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/ibft/IbftPropose.java index dff493a861..b571f44236 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/ibft/IbftPropose.java @@ -31,7 +31,7 @@ public IbftPropose(final String address, final boolean auth) { @Override public Boolean execute(final PantheonWeb3j node) { try { - final ProposeResponse result = node.cliquePropose(address, auth).send(); + final ProposeResponse result = node.ibftPropose(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/ibft/IbftDiscardRpcAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftDiscardRpcAcceptanceTest.java new file mode 100644 index 0000000000..b9873f00ec --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftDiscardRpcAcceptanceTest.java @@ -0,0 +1,5 @@ +package tech.pegasys.pantheon.tests.acceptance.ibft; + +public class IbftDiscardRpcAcceptanceTest { + +} 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/ibft/IbftProposalRpcAcceptanceTest.java new file mode 100644 index 0000000000..6fb9995fff --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftProposalRpcAcceptanceTest.java @@ -0,0 +1,40 @@ +/* + * Copyright 2018 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 java.io.IOException; +import org.junit.Test; +import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase; +import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; + +public class IbftProposalRpcAcceptanceTest 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); + cluster.start(validator1, validator2, validator3); + + cluster.verify(ibft.noProposals()); + validator1.execute(ibftTransactions.createAddProposal(validator3)); + validator1.execute(ibftTransactions.createRemoveProposal(validator2)); + validator2.execute(ibftTransactions.createRemoveProposal(validator3)); + + validator1.verify( + ibft.proposalsEqual().addProposal(validator3).removeProposal(validator2).build()); + validator2.verify(ibft.proposalsEqual().removeProposal(validator3).build()); + validator3.verify(ibft.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/ibft/IbftProposeRpcAcceptanceTest.java index 4fa0067ed2..682ca89b2d 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/ibft/IbftProposeRpcAcceptanceTest.java @@ -6,10 +6,12 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitCondition; +// These tests prove the ibft_proposeValidatorVote and ibft_getValidatorsByBlockNumber (implicitly) +// JSON RPC calls. public class IbftProposeRpcAcceptanceTest extends AcceptanceTestBase { @Test - public void shouldAddNewValidators() throws IOException { + 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); @@ -19,15 +21,18 @@ public void shouldAddNewValidators() throws IOException { cluster.start(validator1, validator2, validator3, nonValidatorNode); cluster.verify(ibft.validatorsEqual(validator1, validator2, validator3)); - final WaitCondition validatorsChanged = wait.ibftValidatorsChanged(validator1); + final WaitCondition addedCondition = wait.ibftValidatorsChanged(validator1); validator1.execute(ibftTransactions.createAddProposal(nonValidatorNode)); validator2.execute(ibftTransactions.createAddProposal(nonValidatorNode)); - cluster.waitUntil(validatorsChanged); + cluster.waitUntil(addedCondition); cluster.verify(ibft.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)); + cluster.waitUntil(removedCondition); + cluster.verify(ibft.validatorsEqual(validator1, validator2, validator3)); } - } From 10ff9891c6e2344407f4a97085a7cbe23e0b01bf Mon Sep 17 00:00:00 2001 From: tmohay Date: Tue, 22 Jan 2019 22:18:42 +1100 Subject: [PATCH 04/14] added discard test --- .../dsl/transaction/ibft/IbftDiscard.java | 2 +- .../ibft/IbftDiscardRpcAcceptanceTest.java | 32 ++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) 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/ibft/IbftDiscard.java index ee4692e4be..4a4f0a030d 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/ibft/IbftDiscard.java @@ -29,7 +29,7 @@ public IbftDiscard(final String address) { @Override public Boolean execute(final PantheonWeb3j node) { try { - final DiscardResponse result = node.cliqueDiscard(address).send(); + final DiscardResponse result = node.ibftDiscard(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/ibft/IbftDiscardRpcAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftDiscardRpcAcceptanceTest.java index b9873f00ec..a99bdccd82 100644 --- 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 @@ -1,5 +1,35 @@ package tech.pegasys.pantheon.tests.acceptance.ibft; -public class IbftDiscardRpcAcceptanceTest { +import java.io.IOException; +import org.junit.Test; +import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase; +import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; +public class IbftDiscardRpcAcceptanceTest extends AcceptanceTestBase { + + @Test + public void shouldDiscardVotes() throws IOException { + final String[] validators = {"validator1", "validator2"}; + 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.createRemoveProposal(validator2)); + validator1.execute(ibftTransactions.createAddProposal(validator3)); + + validator2.execute(ibftTransactions.createRemoveProposal(validator2)); + validator2.execute(ibftTransactions.createAddProposal(validator3)); + + validator1.execute(ibftTransactions.createDiscardProposal(validator2)); + validator1.execute(ibftTransactions.createDiscardProposal(validator3)); + + validator1.waitUntil(wait.chainHeadHasProgressed(validator1, 2)); + + cluster.verify(ibft.validatorsEqual(validator1, validator2)); + validator1.verify(ibft.noProposals()); + validator2.verify( + ibft.proposalsEqual().removeProposal(validator2).addProposal(validator3).build()); + } } From d4ff5e225fef9f39f4effeacdce8194b0d80afd6 Mon Sep 17 00:00:00 2001 From: tmohay Date: Tue, 22 Jan 2019 22:51:15 +1100 Subject: [PATCH 05/14] fix spotless --- .../dsl/condition/ibft/ExpectProposals.java | 4 +- .../ibft/ExpectValidatorsAtBlockHash.java | 1 - .../tests/acceptance/dsl/jsonrpc/Ibft.java | 21 ++++---- .../dsl/transaction/PantheonWeb3j.java | 49 ++++++------------- .../dsl/transaction/ibft/IbftDiscard.java | 3 +- .../transaction/ibft/IbftGetValidators.java | 5 +- .../ibft/IbftGetValidatorsAtHash.java | 5 +- .../dsl/transaction/ibft/IbftProposals.java | 5 +- .../dsl/transaction/ibft/IbftPropose.java | 3 +- .../dsl/waitcondition/WaitConditions.java | 6 +-- .../WaitUntilValidatorsChanged.java | 4 +- .../ibft/IbftDiscardRpcAcceptanceTest.java | 19 +++++-- .../ibft/IbftProposalRpcAcceptanceTest.java | 6 ++- .../ibft/IbftProposeRpcAcceptanceTest.java | 18 ++++++- 14 files changed, 83 insertions(+), 66 deletions(-) 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 3cdece65cf..0443e018c8 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 @@ -15,13 +15,13 @@ import static org.assertj.core.api.Assertions.assertThat; import static tech.pegasys.pantheon.tests.acceptance.dsl.WaitUtils.waitFor; -import java.util.Map; 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.clique.CliqueTransactions; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions; +import java.util.Map; + public class ExpectProposals implements Condition { private final IbftTransactions ibft; private final Map proposers; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlockHash.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlockHash.java index c9b4784ee5..8e29486e85 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlockHash.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlockHash.java @@ -19,7 +19,6 @@ import tech.pegasys.pantheon.ethereum.core.Hash; 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.clique.CliqueTransactions; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions; public class ExpectValidatorsAtBlockHash implements Condition { 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/Ibft.java index 0bca4d0ffe..05bce65f9a 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/Ibft.java @@ -12,14 +12,6 @@ */ package tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc; -import com.google.common.collect.ImmutableMap; -import java.util.Arrays; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.stream.Collectors; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft.ExpectProposals; @@ -28,6 +20,16 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eth.EthTransactions; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions; +import java.util.Arrays; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; + +import com.google.common.collect.ImmutableMap; + public class Ibft { private final EthTransactions eth; @@ -86,7 +88,8 @@ public Condition build() { .entrySet() .stream() .collect(Collectors.toMap(p -> p.getKey().getAddress(), Entry::getValue)); - return new tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft.ExpectProposals(ibft, proposalsAsAddress); + return new tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft.ExpectProposals( + ibft, proposalsAsAddress); } } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java index 305e1a0cac..b7c434b163 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java @@ -87,13 +87,15 @@ public Request ibftDiscard(final String address) { } public Request ibftProposals() { - return new Request<>("ibft_getPendingVotes", emptyList(), web3jService, - ProposalsResponse.class); + return new Request<>( + "ibft_getPendingVotes", emptyList(), web3jService, ProposalsResponse.class); } public Request ibftGetValidators(final String blockNumber) { return new Request<>( - "ibft_getValidatorsByBlockNumber", singletonList(blockNumber), web3jService, + "ibft_getValidatorsByBlockNumber", + singletonList(blockNumber), + web3jService, SignersBlockResponse.class); } @@ -105,22 +107,13 @@ public Request ibftGetSignersAtHash(final Hash hash) { SignersBlockResponse.class); } + public static class ProposeResponse extends Response {} - public static class ProposeResponse extends Response { - - } - - public static class DiscardResponse extends Response { - - } - - public static class SignersBlockResponse extends Response> { - - } + public static class DiscardResponse extends Response {} - public static class ProposalsResponse extends Response> { + public static class SignersBlockResponse extends Response> {} - } + public static class ProposalsResponse extends Response> {} public Request addAccountsToWhitelist( final List accounts) { @@ -145,17 +138,11 @@ public Request getAccountsWhitelist() { "perm_getAccountsWhitelist", null, web3jService, GetAccountsWhitelistResponse.class); } - public static class AddAccountsToWhitelistResponse extends Response { + public static class AddAccountsToWhitelistResponse extends Response {} - } + public static class RemoveAccountsFromWhitelistResponse extends Response {} - public static class RemoveAccountsFromWhitelistResponse extends Response { - - } - - public static class GetAccountsWhitelistResponse extends Response> { - - } + public static class GetAccountsWhitelistResponse extends Response> {} public Request addNodesToWhitelist(final List enodeList) { return new Request<>( @@ -178,15 +165,9 @@ public Request getNodesWhitelist() { "perm_getNodesWhitelist", Lists.emptyList(), web3jService, GetNodesWhitelistResponse.class); } - public static class AddNodeResponse extends Response { + public static class AddNodeResponse extends Response {} - } + public static class RemoveNodeResponse extends Response {} - public static class RemoveNodeResponse extends Response { - - } - - public static class GetNodesWhitelistResponse extends Response> { - - } + public static class GetNodesWhitelistResponse extends Response> {} } 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/ibft/IbftDiscard.java index 4a4f0a030d..d10aa44714 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/ibft/IbftDiscard.java @@ -14,11 +14,12 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.DiscardResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; + public class IbftDiscard implements Transaction { private final String address; 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/ibft/IbftGetValidators.java index 32a95b6e5e..8eb6d89a16 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/ibft/IbftGetValidators.java @@ -14,13 +14,14 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.List; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.List; + public class IbftGetValidators implements Transaction> { private final String blockNumber; 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/ibft/IbftGetValidatorsAtHash.java index 5bafd6dc7d..13e415448d 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/ibft/IbftGetValidatorsAtHash.java @@ -14,14 +14,15 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.List; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.List; + public class IbftGetValidatorsAtHash implements Transaction> { private final Hash hash; 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/ibft/IbftProposals.java index 4483857be2..8dcd0183a5 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/ibft/IbftProposals.java @@ -14,13 +14,14 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.Map; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposalsResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.Map; + public class IbftProposals implements Transaction> { @Override 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/ibft/IbftPropose.java index b571f44236..b23f939a58 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/ibft/IbftPropose.java @@ -14,11 +14,12 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; + public class IbftPropose implements Transaction { private final String address; private final boolean auth; 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 5f02a89f6e..9870c2d7a8 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.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 java.math.BigInteger; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions; public class WaitConditions { private final EthTransactions eth; private final CliqueTransactions clique; private final IbftTransactions ibft; - public WaitConditions(final EthTransactions eth, final CliqueTransactions clique, - final IbftTransactions ibft) { + public WaitConditions( + final EthTransactions eth, final CliqueTransactions clique, final IbftTransactions 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 c58eaae16a..a1de59928f 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 @@ -16,12 +16,12 @@ import static tech.pegasys.pantheon.tests.acceptance.dsl.WaitUtils.waitFor; import static tech.pegasys.pantheon.tests.acceptance.dsl.transaction.clique.CliqueTransactions.LATEST; -import java.util.List; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.clique.CliqueTransactions; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions; +import java.util.List; + public class WaitUntilValidatorsChanged implements WaitCondition { private final IbftTransactions 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 index a99bdccd82..9b501d8c49 100644 --- 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 @@ -1,10 +1,24 @@ +/* + * 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 java.io.IOException; -import org.junit.Test; 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 @@ -14,7 +28,6 @@ public void shouldDiscardVotes() throws IOException { final PantheonNode validator2 = pantheon.createIbftNodeWithValidators("validator2", validators); final PantheonNode validator3 = pantheon.createIbftNodeWithValidators("validator3", validators); cluster.start(validator1, validator2, validator3); - validator1.execute(ibftTransactions.createRemoveProposal(validator2)); validator1.execute(ibftTransactions.createAddProposal(validator3)); 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/ibft/IbftProposalRpcAcceptanceTest.java index 6fb9995fff..f1be12133c 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/ibft/IbftProposalRpcAcceptanceTest.java @@ -12,11 +12,13 @@ */ package tech.pegasys.pantheon.tests.acceptance.ibft; -import java.io.IOException; -import org.junit.Test; 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 IbftProposalRpcAcceptanceTest extends AcceptanceTestBase { @Test 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/ibft/IbftProposeRpcAcceptanceTest.java index 682ca89b2d..0ea14c3905 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/ibft/IbftProposeRpcAcceptanceTest.java @@ -1,11 +1,25 @@ +/* + * 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 java.io.IOException; -import org.junit.Test; import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitCondition; +import java.io.IOException; + +import org.junit.Test; + // These tests prove the ibft_proposeValidatorVote and ibft_getValidatorsByBlockNumber (implicitly) // JSON RPC calls. public class IbftProposeRpcAcceptanceTest extends AcceptanceTestBase { From c2df59f98e48363746924a75756b2b6559d8de20 Mon Sep 17 00:00:00 2001 From: tmohay Date: Sat, 26 Jan 2019 11:22:50 +1100 Subject: [PATCH 06/14] wip --- .../CliqueDiscardRpcAcceptanceTest.java | 2 + .../acceptance/dsl/AcceptanceTestBase.java | 2 +- .../tests/acceptance/dsl/jsonrpc/Ibft.java | 21 +++----- .../CliqueJsonRpcRequestFactory.java | 53 +++++++++++++++++++ .../dsl/transaction/PantheonWeb3j.java | 29 ---------- .../dsl/transaction/clique/CliqueDiscard.java | 6 ++- .../transaction/clique/CliqueTransaction.java | 27 ++++++++++ .../clique/CliqueTransactions.java | 9 ++++ 8 files changed, 104 insertions(+), 45 deletions(-) create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransaction.java diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/clique/CliqueDiscardRpcAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/clique/CliqueDiscardRpcAcceptanceTest.java index 09da7e7e04..d644cbb288 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/clique/CliqueDiscardRpcAcceptanceTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/clique/CliqueDiscardRpcAcceptanceTest.java @@ -32,6 +32,8 @@ public void shouldDiscardVotes() throws IOException { pantheon.createCliqueNodeWithValidators("miner3", initialValidators); cluster.start(minerNode1, minerNode2, minerNode3); + minerNode1.execute(CliqueTransactions::proposeRemovalOf(minerNode2)); + minerNode1.execute(cliqueTransactions.createRemoveProposal(minerNode2)); minerNode2.execute(cliqueTransactions.createRemoveProposal(minerNode2)); minerNode1.execute(cliqueTransactions.createAddProposal(minerNode3)); 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 67dd02dc21..4866b36201 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 @@ -60,7 +60,7 @@ protected AcceptanceTestBase() { ibftTransactions = new IbftTransactions(); clique = new Clique(ethTransactions, cliqueTransactions); - ibft = new Ibft(ethTransactions, ibftTransactions); + ibft = new Ibft(ibftTransactions); net = new Net(new NetTransactions()); cluster = new Cluster(net); transactions = new Transactions(accounts); 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/Ibft.java index 05bce65f9a..18f3e47515 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/Ibft.java @@ -12,14 +12,7 @@ */ package tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc; -import tech.pegasys.pantheon.ethereum.core.Address; -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.eth.EthTransactions; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions; - +import com.google.common.collect.ImmutableMap; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; @@ -27,16 +20,18 @@ import java.util.Map; import java.util.Map.Entry; import java.util.stream.Collectors; - -import com.google.common.collect.ImmutableMap; +import tech.pegasys.pantheon.ethereum.core.Address; +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; public class Ibft { - private final EthTransactions eth; private final IbftTransactions ibft; - public Ibft(final EthTransactions eth, final IbftTransactions ibft) { - this.eth = eth; + public Ibft(final IbftTransactions ibft) { this.ibft = ibft; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java new file mode 100644 index 0000000000..bdba940571 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java @@ -0,0 +1,53 @@ +package tech.pegasys.pantheon.tests.acceptance.dsl.transaction; + +import static java.util.Collections.emptyList; +import static java.util.Collections.singletonList; + +import java.util.Arrays; +import org.web3j.protocol.Web3jService; +import org.web3j.protocol.core.Request; +import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.DiscardResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposalsResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposeResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; + +public class CliqueJsonRpcRequestFactory { + + protected final Web3jService web3jService; + + public CliqueJsonRpcRequestFactory(Web3jService web3jService) { + this.web3jService = web3jService; + } + + public Request cliquePropose(final String address, final Boolean auth) { + return new Request<>( + "clique_propose", + Arrays.asList(address, auth.toString()), + web3jService, + ProposeResponse.class); + } + + public Request cliqueDiscard(final String address) { + return new Request<>( + "clique_discard", singletonList(address), web3jService, DiscardResponse.class); + } + + public Request cliqueProposals() { + return new Request<>("clique_proposals", emptyList(), web3jService, ProposalsResponse.class); + } + + public Request cliqueGetSigners(final String blockNumber) { + return new Request<>( + "clique_getSigners", singletonList(blockNumber), web3jService, SignersBlockResponse.class); + } + + public Request cliqueGetSignersAtHash(final Hash hash) { + return new Request<>( + "clique_getSignersAtHash", + singletonList(hash.toString()), + web3jService, + SignersBlockResponse.class); + } + +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java index b7c434b163..c616d1fb91 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java @@ -43,35 +43,6 @@ public PantheonWeb3j( super(web3jService, pollingInterval, scheduledExecutorService); } - public Request cliquePropose(final String address, final Boolean auth) { - return new Request<>( - "clique_propose", - Arrays.asList(address, auth.toString()), - web3jService, - ProposeResponse.class); - } - - public Request cliqueDiscard(final String address) { - return new Request<>( - "clique_discard", singletonList(address), web3jService, DiscardResponse.class); - } - - public Request cliqueProposals() { - return new Request<>("clique_proposals", emptyList(), web3jService, ProposalsResponse.class); - } - - public Request cliqueGetSigners(final String blockNumber) { - return new Request<>( - "clique_getSigners", singletonList(blockNumber), web3jService, SignersBlockResponse.class); - } - - public Request cliqueGetSignersAtHash(final Hash hash) { - return new Request<>( - "clique_getSignersAtHash", - singletonList(hash.toString()), - web3jService, - SignersBlockResponse.class); - } public Request ibftPropose(final String address, final Boolean auth) { return new Request<>( diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueDiscard.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueDiscard.java index 237c8b15f3..138b2ae0e6 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueDiscard.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueDiscard.java @@ -14,6 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; +import org.web3j.protocol.core.Response; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.DiscardResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -23,14 +24,15 @@ public class CliqueDiscard implements Transaction { private final String address; - public CliqueDiscard(final String address) { + public CliqueDiscard(final String address, + ) { this.address = address; } @Override public Boolean execute(final PantheonWeb3j node) { try { - final DiscardResponse result = node.cliqueDiscard(address).send(); + final Response result = node.cliqueDiscard(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/clique/CliqueTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransaction.java new file mode 100644 index 0000000000..0d18dd06a3 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransaction.java @@ -0,0 +1,27 @@ +package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.clique; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import org.web3j.protocol.core.Response; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; + +public class CliqueTransaction implements Transaction { + + private final String transactionName; + public final + + + @Override + public T execute(PantheonWeb3j node) { + try { + final Response result = node.cliqueDiscard(address).send(); + assertThat(result).isNotNull(); + assertThat(result.hasError()).isFalse(); + return result.getResult(); + } catch (final IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransactions.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransactions.java index f9a500b098..c70f09c633 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransactions.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransactions.java @@ -14,10 +14,19 @@ import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.CliqueJsonRpcRequestFactory; public class CliqueTransactions { public static final String LATEST = "latest"; + public CliqueTransactions( + CliqueJsonRpcRequestFactory requestFactory) { + this.requestFactory = requestFactory; + } + + private CliqueJsonRpcRequestFactory requestFactory; + + public CliquePropose createRemoveProposal(final PantheonNode node) { return propose(node.getAddress().toString(), false); } From 3d2d3fd0adfc0b6e7ba0c99f4777e6a49b99ee1d Mon Sep 17 00:00:00 2001 From: tmohay Date: Tue, 29 Jan 2019 02:52:37 +1100 Subject: [PATCH 07/14] Removed references to PantheonWeb3j --- .../CliqueDiscardRpcAcceptanceTest.java | 2 - .../acceptance/dsl/node/PantheonNode.java | 65 +++++++++-------- .../CliqueJsonRpcRequestFactory.java | 2 +- .../DeploySmartContractTransaction.java | 2 +- .../IbftJsonRpcRequestFactory.java | 56 +++++++++++++++ .../dsl/transaction/JsonRequestFactories.java | 41 +++++++++++ .../dsl/transaction/PantheonWeb3j.java | 72 +------------------ .../PermJsonRpcRequestFactory.java | 66 +++++++++++++++++ .../dsl/transaction/Transaction.java | 2 +- .../account/TransferTransaction.java | 6 +- .../account/TransferTransactionSet.java | 4 +- .../dsl/transaction/clique/CliqueDiscard.java | 10 ++- .../transaction/clique/CliqueGetSigners.java | 6 +- .../clique/CliqueGetSignersAtHash.java | 6 +- .../transaction/clique/CliqueProposals.java | 6 +- .../dsl/transaction/clique/CliquePropose.java | 6 +- .../transaction/clique/CliqueTransaction.java | 27 ------- .../clique/CliqueTransactions.java | 8 --- .../eth/EthAccountsTransaction.java | 6 +- .../eth/EthBlockNumberTransaction.java | 6 +- .../eth/EthGetBalanceTransaction.java | 6 +- .../eth/EthGetBlockTransaction.java | 6 +- .../EthGetTransactionCountTransaction.java | 6 +- .../EthGetTransactionReceiptTransaction.java | 6 +- .../eth/EthGetWorkTransaction.java | 6 +- .../eth/EthSendRawTransactionTransaction.java | 6 +- .../dsl/transaction/ibft/IbftDiscard.java | 6 +- .../transaction/ibft/IbftGetValidators.java | 6 +- .../ibft/IbftGetValidatorsAtHash.java | 6 +- .../dsl/transaction/ibft/IbftProposals.java | 6 +- .../dsl/transaction/ibft/IbftPropose.java | 6 +- .../net/NetPeerCountTransaction.java | 6 +- .../net/NetVersionTransaction.java | 6 +- ...PermAddAccountsToWhitelistTransaction.java | 6 +- .../perm/PermAddNodeTransaction.java | 6 +- .../PermGetAccountsWhitelistTransaction.java | 6 +- .../PermGetNodesWhitelistTransaction.java | 6 +- ...emoveAccountsFromWhitelistTransaction.java | 6 +- .../perm/PermRemoveNodeTransaction.java | 6 +- .../transaction/web3/Web3Sha3Transaction.java | 6 +- .../ethereum/core/TransactionPool.java | 2 +- 41 files changed, 290 insertions(+), 231 deletions(-) create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/IbftJsonRpcRequestFactory.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/JsonRequestFactories.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermJsonRpcRequestFactory.java delete mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransaction.java diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/clique/CliqueDiscardRpcAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/clique/CliqueDiscardRpcAcceptanceTest.java index d644cbb288..09da7e7e04 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/clique/CliqueDiscardRpcAcceptanceTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/clique/CliqueDiscardRpcAcceptanceTest.java @@ -32,8 +32,6 @@ public void shouldDiscardVotes() throws IOException { pantheon.createCliqueNodeWithValidators("miner3", initialValidators); cluster.start(minerNode1, minerNode2, minerNode3); - minerNode1.execute(CliqueTransactions::proposeRemovalOf(minerNode2)); - minerNode1.execute(cliqueTransactions.createRemoveProposal(minerNode2)); minerNode2.execute(cliqueTransactions.createRemoveProposal(minerNode2)); minerNode1.execute(cliqueTransactions.createAddProposal(minerNode3)); 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 adcb466f4d..1f4887ead1 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 @@ -14,21 +14,9 @@ import static org.apache.logging.log4j.LogManager.getLogger; -import tech.pegasys.pantheon.cli.EthNetworkConfig; -import tech.pegasys.pantheon.controller.KeyPairUtil; -import tech.pegasys.pantheon.crypto.SECP256K1.KeyPair; -import tech.pegasys.pantheon.ethereum.core.Address; -import tech.pegasys.pantheon.ethereum.core.MiningParameters; -import tech.pegasys.pantheon.ethereum.core.Util; -import tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcConfiguration; -import tech.pegasys.pantheon.ethereum.jsonrpc.websocket.WebSocketConfiguration; -import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration; -import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitCondition; - +import com.google.common.base.MoreObjects; +import com.google.common.io.MoreFiles; +import com.google.common.io.RecursiveDeleteOption; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -42,19 +30,35 @@ import java.util.Properties; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; - -import com.google.common.base.MoreObjects; -import com.google.common.io.MoreFiles; -import com.google.common.io.RecursiveDeleteOption; import org.apache.logging.log4j.Logger; import org.awaitility.Awaitility; import org.awaitility.core.ConditionTimeoutException; import org.java_websocket.exceptions.WebsocketNotConnectedException; +import org.web3j.protocol.Web3jService; +import org.web3j.protocol.core.JsonRpc2_0Web3j; import org.web3j.protocol.http.HttpService; import org.web3j.protocol.websocket.WebSocketClient; import org.web3j.protocol.websocket.WebSocketListener; import org.web3j.protocol.websocket.WebSocketService; import org.web3j.utils.Async; +import tech.pegasys.pantheon.cli.EthNetworkConfig; +import tech.pegasys.pantheon.controller.KeyPairUtil; +import tech.pegasys.pantheon.crypto.SECP256K1.KeyPair; +import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.core.MiningParameters; +import tech.pegasys.pantheon.ethereum.core.Util; +import tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcConfiguration; +import tech.pegasys.pantheon.ethereum.jsonrpc.websocket.WebSocketConfiguration; +import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration; +import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.CliqueJsonRpcRequestFactory; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.IbftJsonRpcRequestFactory; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PermJsonRpcRequestFactory; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitCondition; public class PantheonNode implements Node, NodeConfiguration, RunnableNode, AutoCloseable { @@ -77,6 +81,7 @@ public class PantheonNode implements Node, NodeConfiguration, RunnableNode, Auto private List bootnodes = new ArrayList<>(); private PantheonWeb3j pantheonWeb3j; + private JsonRequestFactories jsonRequestFactories; private Optional ethNetworkConfig = Optional.empty(); public PantheonNode( @@ -157,19 +162,19 @@ public String hostName() { return LOCALHOST; } - private PantheonWeb3j pantheonWeb3j() { - - if (pantheonWeb3j == null) { - if (!jsonRpcBaseUrl().isPresent()) { - return new PantheonWeb3j( - new HttpService("http://" + LOCALHOST + ":8545"), 2000, Async.defaultExecutorService()); - } + private JsonRequestFactories jsonRequestFactories() { + if (jsonRequestFactories == null) { + final Web3jService web3jService = jsonRpcBaseUrl().map(url -> new HttpService(url)).orElse( + new HttpService("http://" + LOCALHOST + ":8545")); - return new PantheonWeb3j( - new HttpService(jsonRpcBaseUrl().get()), 2000, Async.defaultExecutorService()); + jsonRequestFactories = new JsonRequestFactories( + new JsonRpc2_0Web3j(web3jService, 2000, Async.defaultExecutorService()), + new CliqueJsonRpcRequestFactory(web3jService), + new IbftJsonRpcRequestFactory(web3jService), + new PermJsonRpcRequestFactory(web3jService)); } - return pantheonWeb3j; + return jsonRequestFactories; } /** All future JSON-RPC calls are made via a web sockets connection. */ @@ -375,7 +380,7 @@ public void ethNetworkConfig(final Optional ethNetworkConfig) @Override public T execute(final Transaction transaction) { - return transaction.execute(pantheonWeb3j()); + return transaction.execute(jsonRequestFactories()); } @Override diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java index bdba940571..381ef32779 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java @@ -14,7 +14,7 @@ public class CliqueJsonRpcRequestFactory { - protected final Web3jService web3jService; + private final Web3jService web3jService; public CliqueJsonRpcRequestFactory(Web3jService web3jService) { this.web3jService = web3jService; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java index 2d82324992..6f8134d6d4 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java @@ -37,7 +37,7 @@ public class DeploySmartContractTransaction implements Trans } @Override - public T execute(final PantheonWeb3j node) { + public T execute(final JsonRequestFactories node) { try { final Method method = clazz.getMethod( 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/IbftJsonRpcRequestFactory.java new file mode 100644 index 0000000000..f9c62e1f39 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/IbftJsonRpcRequestFactory.java @@ -0,0 +1,56 @@ +package tech.pegasys.pantheon.tests.acceptance.dsl.transaction; + +import static java.util.Collections.emptyList; +import static java.util.Collections.singletonList; + +import java.util.Arrays; +import org.web3j.protocol.Web3jService; +import org.web3j.protocol.core.Request; +import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.DiscardResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposalsResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposeResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; + +public class IbftJsonRpcRequestFactory { + + private final Web3jService web3jService; + + public IbftJsonRpcRequestFactory(Web3jService web3jService) { + this.web3jService = web3jService; + } + + public Request ibftPropose(final String address, final Boolean auth) { + return new Request<>( + "ibft_proposeValidatorVote", + Arrays.asList(address, auth.toString()), + web3jService, + ProposeResponse.class); + } + + public Request ibftDiscard(final String address) { + return new Request<>( + "ibft_discardValidatorVote", singletonList(address), web3jService, DiscardResponse.class); + } + + public Request ibftProposals() { + return new Request<>( + "ibft_getPendingVotes", emptyList(), web3jService, ProposalsResponse.class); + } + + public Request ibftGetValidators(final String blockNumber) { + return new Request<>( + "ibft_getValidatorsByBlockNumber", + singletonList(blockNumber), + web3jService, + SignersBlockResponse.class); + } + + public Request ibftGetSignersAtHash(final Hash hash) { + return new Request<>( + "ibft_getValidatorsByBlockHash", + singletonList(hash.toString()), + web3jService, + SignersBlockResponse.class); + } +} 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 new file mode 100644 index 0000000000..132507df2b --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/JsonRequestFactories.java @@ -0,0 +1,41 @@ +package tech.pegasys.pantheon.tests.acceptance.dsl.transaction; + +import org.web3j.protocol.core.JsonRpc2_0Web3j; + +public class JsonRequestFactories { + + private final JsonRpc2_0Web3j netEth; + private final CliqueJsonRpcRequestFactory clique; + private final IbftJsonRpcRequestFactory ibft; + private final PermJsonRpcRequestFactory perm; + + public JsonRequestFactories(JsonRpc2_0Web3j netEth, + CliqueJsonRpcRequestFactory clique, + IbftJsonRpcRequestFactory ibft, + PermJsonRpcRequestFactory perm) { + this.netEth = netEth; + this.clique = clique; + this.ibft = ibft; + this.perm = perm; + } + + public JsonRpc2_0Web3j eth() { + return netEth; + } + + public JsonRpc2_0Web3j net() { + return netEth; + } + + public CliqueJsonRpcRequestFactory clique() { + return clique; + } + + public IbftJsonRpcRequestFactory ibft() { + return ibft; + } + + public PermJsonRpcRequestFactory perm() { + return perm; + } +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java index c616d1fb91..7b524059fc 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java @@ -44,39 +44,7 @@ public PantheonWeb3j( } - public Request ibftPropose(final String address, final Boolean auth) { - return new Request<>( - "ibft_proposeValidatorVote", - Arrays.asList(address, auth.toString()), - web3jService, - ProposeResponse.class); - } - - public Request ibftDiscard(final String address) { - return new Request<>( - "ibft_discardValidatorVote", singletonList(address), web3jService, DiscardResponse.class); - } - - public Request ibftProposals() { - return new Request<>( - "ibft_getPendingVotes", emptyList(), web3jService, ProposalsResponse.class); - } - - public Request ibftGetValidators(final String blockNumber) { - return new Request<>( - "ibft_getValidatorsByBlockNumber", - singletonList(blockNumber), - web3jService, - SignersBlockResponse.class); - } - public Request ibftGetSignersAtHash(final Hash hash) { - return new Request<>( - "ibft_getValidatorsByBlockHash", - singletonList(hash.toString()), - web3jService, - SignersBlockResponse.class); - } public static class ProposeResponse extends Response {} @@ -86,28 +54,9 @@ public static class SignersBlockResponse extends Response> {} public static class ProposalsResponse extends Response> {} - public Request addAccountsToWhitelist( - final List accounts) { - return new Request<>( - "perm_addAccountsToWhitelist", - Collections.singletonList(accounts), - web3jService, - AddAccountsToWhitelistResponse.class); - } - public Request removeAccountsFromWhitelist( - final List accounts) { - return new Request<>( - "perm_removeAccountsFromWhitelist", - Collections.singletonList(accounts), - web3jService, - RemoveAccountsFromWhitelistResponse.class); - } - public Request getAccountsWhitelist() { - return new Request<>( - "perm_getAccountsWhitelist", null, web3jService, GetAccountsWhitelistResponse.class); - } + public static class AddAccountsToWhitelistResponse extends Response {} @@ -115,26 +64,7 @@ public static class RemoveAccountsFromWhitelistResponse extends Response> {} - public Request addNodesToWhitelist(final List enodeList) { - return new Request<>( - "perm_addNodesToWhitelist", - Collections.singletonList(enodeList), - web3jService, - AddNodeResponse.class); - } - - public Request removeNodesFromWhitelist(final List enodeList) { - return new Request<>( - "perm_removeNodesFromWhitelist", - Collections.singletonList(enodeList), - web3jService, - RemoveNodeResponse.class); - } - public Request getNodesWhitelist() { - return new Request<>( - "perm_getNodesWhitelist", Lists.emptyList(), web3jService, GetNodesWhitelistResponse.class); - } public static class AddNodeResponse extends Response {} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermJsonRpcRequestFactory.java new file mode 100644 index 0000000000..e8e2c3f365 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermJsonRpcRequestFactory.java @@ -0,0 +1,66 @@ +package tech.pegasys.pantheon.tests.acceptance.dsl.transaction; + +import java.util.Collections; +import java.util.List; +import org.assertj.core.util.Lists; +import org.web3j.protocol.Web3jService; +import org.web3j.protocol.core.Request; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.AddAccountsToWhitelistResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.AddNodeResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.GetAccountsWhitelistResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.GetNodesWhitelistResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.RemoveAccountsFromWhitelistResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.RemoveNodeResponse; + +public class PermJsonRpcRequestFactory { + private final Web3jService web3jService; + + public PermJsonRpcRequestFactory(Web3jService web3jService) { + this.web3jService = web3jService; + } + + public Request addNodesToWhitelist(final List enodeList) { + return new Request<>( + "perm_addNodesToWhitelist", + Collections.singletonList(enodeList), + web3jService, + AddNodeResponse.class); + } + + public Request removeNodesFromWhitelist(final List enodeList) { + return new Request<>( + "perm_removeNodesFromWhitelist", + Collections.singletonList(enodeList), + web3jService, + RemoveNodeResponse.class); + } + + public Request getNodesWhitelist() { + return new Request<>( + "perm_getNodesWhitelist", Lists.emptyList(), web3jService, GetNodesWhitelistResponse.class); + } + + public Request getAccountsWhitelist() { + return new Request<>( + "perm_getAccountsWhitelist", null, web3jService, GetAccountsWhitelistResponse.class); + } + + public Request addAccountsToWhitelist( + final List accounts) { + return new Request<>( + "perm_addAccountsToWhitelist", + Collections.singletonList(accounts), + web3jService, + AddAccountsToWhitelistResponse.class); + } + + public Request removeAccountsFromWhitelist( + final List accounts) { + return new Request<>( + "perm_removeAccountsFromWhitelist", + Collections.singletonList(accounts), + web3jService, + RemoveAccountsFromWhitelistResponse.class); + } + +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/Transaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/Transaction.java index beea7962ff..2489128b56 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/Transaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/Transaction.java @@ -14,5 +14,5 @@ public interface Transaction { - T execute(final PantheonWeb3j node); + T execute(final JsonRequestFactories node); } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/account/TransferTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/account/TransferTransaction.java index 88e04a5211..191b226e4d 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/account/TransferTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/account/TransferTransaction.java @@ -16,7 +16,7 @@ import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.tests.acceptance.dsl.account.Account; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -62,11 +62,11 @@ public TransferTransaction( } @Override - public Hash execute(final PantheonWeb3j node) { + public Hash execute(final JsonRequestFactories node) { final String signedTransactionData = signedTransactionData(); try { return Hash.fromHexString( - node.ethSendRawTransaction(signedTransactionData).send().getTransactionHash()); + node.eth().ethSendRawTransaction(signedTransactionData).send().getTransactionHash()); } catch (final IOException e) { throw new RuntimeException(e); } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/account/TransferTransactionSet.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/account/TransferTransactionSet.java index b0cab54977..3e1037c005 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/account/TransferTransactionSet.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/account/TransferTransactionSet.java @@ -13,7 +13,7 @@ package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.account; import tech.pegasys.pantheon.ethereum.core.Hash; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.util.ArrayList; @@ -28,7 +28,7 @@ public TransferTransactionSet(final List transactions) { } @Override - public List execute(final PantheonWeb3j node) { + public List execute(final JsonRequestFactories node) { final List hashes = new ArrayList<>(); for (final TransferTransaction transaction : transactions) { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueDiscard.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueDiscard.java index 138b2ae0e6..f45ffc6dcd 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueDiscard.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueDiscard.java @@ -15,8 +15,7 @@ import static org.assertj.core.api.Assertions.assertThat; import org.web3j.protocol.core.Response; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.DiscardResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -24,15 +23,14 @@ public class CliqueDiscard implements Transaction { private final String address; - public CliqueDiscard(final String address, - ) { + public CliqueDiscard(final String address) { this.address = address; } @Override - public Boolean execute(final PantheonWeb3j node) { + public Boolean execute(final JsonRequestFactories node) { try { - final Response result = node.cliqueDiscard(address).send(); + final Response result = node.clique().cliqueDiscard(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/clique/CliqueGetSigners.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSigners.java index 0b7ca14f1f..a2352264f3 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSigners.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSigners.java @@ -15,7 +15,7 @@ import static org.assertj.core.api.Assertions.assertThat; import tech.pegasys.pantheon.ethereum.core.Address; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -30,9 +30,9 @@ public CliqueGetSigners(final String blockNumber) { } @Override - public List
execute(final PantheonWeb3j node) { + public List
execute(final JsonRequestFactories node) { try { - final SignersBlockResponse result = node.cliqueGetSigners(blockNumber).send(); + final SignersBlockResponse result = node.clique().cliqueGetSigners(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/clique/CliqueGetSignersAtHash.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSignersAtHash.java index 953903fca9..1a81caa166 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSignersAtHash.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSignersAtHash.java @@ -16,7 +16,7 @@ import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.Hash; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -31,9 +31,9 @@ public CliqueGetSignersAtHash(final Hash hash) { } @Override - public List
execute(final PantheonWeb3j node) { + public List
execute(final JsonRequestFactories node) { try { - final SignersBlockResponse result = node.cliqueGetSignersAtHash(hash).send(); + final SignersBlockResponse result = node.clique().cliqueGetSignersAtHash(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/clique/CliqueProposals.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueProposals.java index a81f84909b..6ea020eabc 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueProposals.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueProposals.java @@ -15,7 +15,7 @@ import static org.assertj.core.api.Assertions.assertThat; import tech.pegasys.pantheon.ethereum.core.Address; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposalsResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -25,9 +25,9 @@ public class CliqueProposals implements Transaction> { @Override - public Map execute(final PantheonWeb3j node) { + public Map execute(final JsonRequestFactories node) { try { - final ProposalsResponse result = node.cliqueProposals().send(); + final ProposalsResponse result = node.clique().cliqueProposals().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/clique/CliquePropose.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliquePropose.java index e4f4d7212e..f00ae924cf 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliquePropose.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliquePropose.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -30,9 +30,9 @@ public CliquePropose(final String address, final boolean auth) { } @Override - public Boolean execute(final PantheonWeb3j node) { + public Boolean execute(final JsonRequestFactories node) { try { - final ProposeResponse result = node.cliquePropose(address, auth).send(); + final ProposeResponse result = node.clique().cliquePropose(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/clique/CliqueTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransaction.java deleted file mode 100644 index 0d18dd06a3..0000000000 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransaction.java +++ /dev/null @@ -1,27 +0,0 @@ -package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.clique; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.IOException; -import org.web3j.protocol.core.Response; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; - -public class CliqueTransaction implements Transaction { - - private final String transactionName; - public final - - - @Override - public T execute(PantheonWeb3j node) { - try { - final Response result = node.cliqueDiscard(address).send(); - assertThat(result).isNotNull(); - assertThat(result.hasError()).isFalse(); - return result.getResult(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransactions.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransactions.java index c70f09c633..81aadaefcf 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransactions.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransactions.java @@ -19,14 +19,6 @@ public class CliqueTransactions { public static final String LATEST = "latest"; - public CliqueTransactions( - CliqueJsonRpcRequestFactory requestFactory) { - this.requestFactory = requestFactory; - } - - private CliqueJsonRpcRequestFactory requestFactory; - - public CliquePropose createRemoveProposal(final PantheonNode node) { return propose(node.getAddress().toString(), false); } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthAccountsTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthAccountsTransaction.java index b8a9c2dd21..b70d23e1d3 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthAccountsTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthAccountsTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -27,9 +27,9 @@ public class EthAccountsTransaction implements Transaction> { EthAccountsTransaction() {} @Override - public List execute(final PantheonWeb3j node) { + public List execute(final JsonRequestFactories node) { try { - final EthAccounts result = node.ethAccounts().send(); + final EthAccounts result = node.eth().ethAccounts().send(); assertThat(result).isNotNull(); return result.getAccounts(); } catch (final IOException e) { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthBlockNumberTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthBlockNumberTransaction.java index fe7a1a87ce..3f686d84d9 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthBlockNumberTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthBlockNumberTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -25,10 +25,10 @@ public class EthBlockNumberTransaction implements Transaction { EthBlockNumberTransaction() {} @Override - public BigInteger execute(final PantheonWeb3j node) { + public BigInteger execute(final JsonRequestFactories node) { try { final org.web3j.protocol.core.methods.response.EthBlockNumber result = - node.ethBlockNumber().send(); + node.eth().ethBlockNumber().send(); assertThat(result).isNotNull(); assertThat(result.hasError()).isFalse(); return result.getBlockNumber(); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetBalanceTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetBalanceTransaction.java index 57ea00b0c3..16e45858e4 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetBalanceTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetBalanceTransaction.java @@ -16,7 +16,7 @@ import static org.web3j.protocol.core.DefaultBlockParameterName.LATEST; import tech.pegasys.pantheon.tests.acceptance.dsl.account.Account; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -33,9 +33,9 @@ public class EthGetBalanceTransaction implements Transaction { } @Override - public BigInteger execute(final PantheonWeb3j node) { + public BigInteger execute(final JsonRequestFactories node) { try { - final EthGetBalance result = node.ethGetBalance(account.getAddress(), LATEST).send(); + final EthGetBalance result = node.eth().ethGetBalance(account.getAddress(), LATEST).send(); assertThat(result).isNotNull(); assertThat(result.hasError()).isFalse(); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetBlockTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetBlockTransaction.java index 9cb5e1a623..993c8d46c5 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetBlockTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetBlockTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -34,10 +34,10 @@ public class EthGetBlockTransaction implements Transaction { } @Override - public Block execute(final PantheonWeb3j node) { + public Block execute(final JsonRequestFactories node) { try { final EthBlock result = - node.ethGetBlockByNumber(blockParameter, fullTransactionObjects).send(); + node.eth().ethGetBlockByNumber(blockParameter, fullTransactionObjects).send(); assertThat(result).isNotNull(); assertThat(result.hasError()).isFalse(); return result.getBlock(); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetTransactionCountTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetTransactionCountTransaction.java index ae31f9783f..9ed472432b 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetTransactionCountTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetTransactionCountTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -32,10 +32,10 @@ public EthGetTransactionCountTransaction(final String accountAddress) { } @Override - public BigInteger execute(final PantheonWeb3j node) { + public BigInteger execute(final JsonRequestFactories node) { try { EthGetTransactionCount result = - node.ethGetTransactionCount(accountAddress, DefaultBlockParameterName.LATEST).send(); + node.eth().ethGetTransactionCount(accountAddress, DefaultBlockParameterName.LATEST).send(); assertThat(result).isNotNull(); return result.getTransactionCount(); } catch (final IOException e) { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetTransactionReceiptTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetTransactionReceiptTransaction.java index 2784ce1991..58e5eecaa2 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetTransactionReceiptTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetTransactionReceiptTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -33,9 +33,9 @@ public class EthGetTransactionReceiptTransaction } @Override - public Optional execute(final PantheonWeb3j node) { + public Optional execute(final JsonRequestFactories node) { try { - final EthGetTransactionReceipt result = node.ethGetTransactionReceipt(input).send(); + final EthGetTransactionReceipt result = node.eth().ethGetTransactionReceipt(input).send(); assertThat(result.hasError()).isFalse(); return result.getTransactionReceipt(); } catch (final IOException e) { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetWorkTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetWorkTransaction.java index f98199c420..7d58e64f60 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetWorkTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetWorkTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -26,9 +26,9 @@ public class EthGetWorkTransaction implements Transaction { EthGetWorkTransaction() {} @Override - public String[] execute(final PantheonWeb3j node) { + public String[] execute(final JsonRequestFactories node) { try { - final EthGetWork result = node.ethGetWork().send(); + final EthGetWork result = node.eth().ethGetWork().send(); assertThat(result).isNotNull(); return new String[] { result.getCurrentBlockHeaderPowHash(), diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthSendRawTransactionTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthSendRawTransactionTransaction.java index 6a17dcd0cb..3e3332fd8e 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthSendRawTransactionTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthSendRawTransactionTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -30,9 +30,9 @@ public class EthSendRawTransactionTransaction implements Transaction { } @Override - public String execute(final PantheonWeb3j node) { + public String execute(final JsonRequestFactories node) { try { - EthSendTransaction response = node.ethSendRawTransaction(transactionData).send(); + EthSendTransaction response = node.eth().ethSendRawTransaction(transactionData).send(); assertThat(response.getTransactionHash()).isNotNull(); return response.getTransactionHash(); } catch (final IOException e) { 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/ibft/IbftDiscard.java index d10aa44714..087de1b74d 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/ibft/IbftDiscard.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.DiscardResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -28,9 +28,9 @@ public IbftDiscard(final String address) { } @Override - public Boolean execute(final PantheonWeb3j node) { + public Boolean execute(final JsonRequestFactories node) { try { - final DiscardResponse result = node.ibftDiscard(address).send(); + final DiscardResponse result = node.ibft().ibftDiscard(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/ibft/IbftGetValidators.java index 8eb6d89a16..5252704abe 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/ibft/IbftGetValidators.java @@ -15,7 +15,7 @@ import static org.assertj.core.api.Assertions.assertThat; import tech.pegasys.pantheon.ethereum.core.Address; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -30,9 +30,9 @@ public IbftGetValidators(final String blockNumber) { } @Override - public List
execute(final PantheonWeb3j node) { + public List
execute(final JsonRequestFactories node) { try { - final SignersBlockResponse result = node.ibftGetValidators(blockNumber).send(); + final SignersBlockResponse result = node.ibft().ibftGetValidators(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/ibft/IbftGetValidatorsAtHash.java index 13e415448d..4d60fb2de0 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/ibft/IbftGetValidatorsAtHash.java @@ -16,7 +16,7 @@ import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.Hash; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -31,9 +31,9 @@ public IbftGetValidatorsAtHash(final Hash hash) { } @Override - public List
execute(final PantheonWeb3j node) { + public List
execute(final JsonRequestFactories node) { try { - final SignersBlockResponse result = node.cliqueGetSignersAtHash(hash).send(); + final SignersBlockResponse result = node.ibft().ibftGetSignersAtHash(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/ibft/IbftProposals.java index 8dcd0183a5..1da2287c21 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/ibft/IbftProposals.java @@ -15,7 +15,7 @@ import static org.assertj.core.api.Assertions.assertThat; import tech.pegasys.pantheon.ethereum.core.Address; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposalsResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -25,9 +25,9 @@ public class IbftProposals implements Transaction> { @Override - public Map execute(final PantheonWeb3j node) { + public Map execute(final JsonRequestFactories node) { try { - final ProposalsResponse result = node.ibftProposals().send(); + final ProposalsResponse result = node.ibft().ibftProposals().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/ibft/IbftPropose.java index b23f939a58..b465280ab7 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/ibft/IbftPropose.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -30,9 +30,9 @@ public IbftPropose(final String address, final boolean auth) { } @Override - public Boolean execute(final PantheonWeb3j node) { + public Boolean execute(final JsonRequestFactories node) { try { - final ProposeResponse result = node.ibftPropose(address, auth).send(); + final ProposeResponse result = node.ibft().ibftPropose(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/net/NetPeerCountTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/net/NetPeerCountTransaction.java index e52e2f4f1e..f400e1a559 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/net/NetPeerCountTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/net/NetPeerCountTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -27,9 +27,9 @@ public class NetPeerCountTransaction implements Transaction { NetPeerCountTransaction() {} @Override - public BigInteger execute(final PantheonWeb3j node) { + public BigInteger execute(final JsonRequestFactories node) { try { - final NetPeerCount result = node.netPeerCount().send(); + final NetPeerCount result = node.net().netPeerCount().send(); assertThat(result).isNotNull(); assertThat(result.hasError()).isFalse(); return result.getQuantity(); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/net/NetVersionTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/net/NetVersionTransaction.java index 6effb90bdc..9217a60d48 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/net/NetVersionTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/net/NetVersionTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -26,9 +26,9 @@ public class NetVersionTransaction implements Transaction { NetVersionTransaction() {} @Override - public String execute(final PantheonWeb3j node) { + public String execute(final JsonRequestFactories node) { try { - final NetVersion result = node.netVersion().send(); + final NetVersion result = node.net().netVersion().send(); assertThat(result).isNotNull(); assertThat(result.hasError()).isFalse(); return result.getNetVersion(); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddAccountsToWhitelistTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddAccountsToWhitelistTransaction.java index d624a185bc..3ad35e367c 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddAccountsToWhitelistTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddAccountsToWhitelistTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.AddAccountsToWhitelistResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -30,9 +30,9 @@ public PermAddAccountsToWhitelistTransaction(final List accounts) { } @Override - public Boolean execute(final PantheonWeb3j node) { + public Boolean execute(final JsonRequestFactories node) { try { - AddAccountsToWhitelistResponse response = node.addAccountsToWhitelist(accounts).send(); + AddAccountsToWhitelistResponse response = node.perm().addAccountsToWhitelist(accounts).send(); assertThat(response.getResult()).isTrue(); return response.getResult(); } catch (IOException e) { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddNodeTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddNodeTransaction.java index a1be4d199c..51fdb9cea1 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddNodeTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddNodeTransaction.java @@ -15,7 +15,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.AddNodeResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -29,9 +29,9 @@ public PermAddNodeTransaction(final List enodeList) { } @Override - public Boolean execute(final PantheonWeb3j node) { + public Boolean execute(final JsonRequestFactories node) { try { - final AddNodeResponse result = node.addNodesToWhitelist(enodeList).send(); + final AddNodeResponse result = node.perm().addNodesToWhitelist(enodeList).send(); assertThat(result).isNotNull(); return result.getResult(); } catch (final IOException e) { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetAccountsWhitelistTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetAccountsWhitelistTransaction.java index 42ccf85aaa..1d9f89d202 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetAccountsWhitelistTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetAccountsWhitelistTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.GetAccountsWhitelistResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -24,9 +24,9 @@ public class PermGetAccountsWhitelistTransaction implements Transaction> { @Override - public List execute(final PantheonWeb3j node) { + public List execute(final JsonRequestFactories node) { try { - GetAccountsWhitelistResponse response = node.getAccountsWhitelist().send(); + GetAccountsWhitelistResponse response = node.perm().getAccountsWhitelist().send(); assertThat(response.getResult()).isNotNull(); return response.getResult(); } catch (IOException e) { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetNodesWhitelistTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetNodesWhitelistTransaction.java index 0687bedad1..e49fe4f3a6 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetNodesWhitelistTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetNodesWhitelistTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.GetNodesWhitelistResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -23,9 +23,9 @@ public class PermGetNodesWhitelistTransaction implements Transaction> { @Override - public List execute(final PantheonWeb3j node) { + public List execute(final JsonRequestFactories node) { try { - GetNodesWhitelistResponse result = node.getNodesWhitelist().send(); + GetNodesWhitelistResponse result = node.perm().getNodesWhitelist().send(); assertThat(result).isNotNull(); return result.getResult(); } catch (final IOException e) { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveAccountsFromWhitelistTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveAccountsFromWhitelistTransaction.java index 5c85e49f76..005bfc6e72 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveAccountsFromWhitelistTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveAccountsFromWhitelistTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.RemoveAccountsFromWhitelistResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -30,10 +30,10 @@ public PermRemoveAccountsFromWhitelistTransaction(final List accounts) { } @Override - public Boolean execute(final PantheonWeb3j node) { + public Boolean execute(final JsonRequestFactories node) { try { RemoveAccountsFromWhitelistResponse response = - node.removeAccountsFromWhitelist(accounts).send(); + node.perm().removeAccountsFromWhitelist(accounts).send(); assertThat(response.getResult()).isTrue(); return response.getResult(); } catch (IOException e) { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveNodeTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveNodeTransaction.java index 1a1ad6f9ea..81fd4af7ca 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveNodeTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveNodeTransaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.RemoveNodeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; @@ -29,9 +29,9 @@ public PermRemoveNodeTransaction(final List enodeList) { } @Override - public Boolean execute(final PantheonWeb3j node) { + public Boolean execute(final JsonRequestFactories node) { try { - final RemoveNodeResponse result = node.removeNodesFromWhitelist(enodeList).send(); + final RemoveNodeResponse result = node.perm().removeNodesFromWhitelist(enodeList).send(); assertThat(result).isNotNull(); return result.getResult(); } catch (final IOException e) { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/web3/Web3Sha3Transaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/web3/Web3Sha3Transaction.java index 15341a0a65..4e218d0155 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/web3/Web3Sha3Transaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/web3/Web3Sha3Transaction.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; @@ -30,9 +30,9 @@ public class Web3Sha3Transaction implements Transaction { } @Override - public String execute(final PantheonWeb3j node) { + public String execute(final JsonRequestFactories node) { try { - final Web3Sha3 result = node.web3Sha3(input).send(); + final Web3Sha3 result = node.net().web3Sha3(input).send(); assertThat(result).isNotNull(); assertThat(result.hasError()).isFalse(); return result.getResult(); diff --git a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java index 7cb4bb2c93..8a1bc46b5e 100644 --- a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java +++ b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java @@ -131,7 +131,7 @@ private ValidationResult validateTransaction( final ValidationResult basicValidationResult = getTransactionValidator().validate(transaction); if (!basicValidationResult.isValid()) { - return basicValidationResult; +// return basicValidationResult; } final String sender = transaction.getSender().toString(); From 01cf37c2011a73c7b58138804c319c611baab1cf Mon Sep 17 00:00:00 2001 From: tmohay Date: Tue, 29 Jan 2019 03:15:54 +1100 Subject: [PATCH 08/14] fixed error in DeployContract --- .../dsl/transaction/DeploySmartContractTransaction.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java index 6f8134d6d4..fb3b4be478 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java @@ -43,9 +43,11 @@ public T execute(final JsonRequestFactories node) { clazz.getMethod( "deploy", Web3j.class, Credentials.class, BigInteger.class, BigInteger.class); + + final Object invoked = method.invoke( - METHOD_IS_STATIC, node, BENEFACTOR_ONE, DEFAULT_GAS_PRICE, DEFAULT_GAS_LIMIT); + METHOD_IS_STATIC, node.eth(), BENEFACTOR_ONE, DEFAULT_GAS_PRICE, DEFAULT_GAS_LIMIT); return cast(invoked).send(); } catch (final Exception e) { From 6d041bf042232ddea3959b1113ec73171041e213 Mon Sep 17 00:00:00 2001 From: tmohay Date: Tue, 29 Jan 2019 08:02:12 +1100 Subject: [PATCH 09/14] spotless fixes --- .../tests/acceptance/dsl/jsonrpc/Ibft.java | 16 ++--- .../acceptance/dsl/node/PantheonNode.java | 63 ++++++++++--------- .../CliqueJsonRpcRequestFactory.java | 23 +++++-- .../DeploySmartContractTransaction.java | 2 - .../IbftJsonRpcRequestFactory.java | 22 +++++-- .../dsl/transaction/JsonRequestFactories.java | 25 ++++++-- .../dsl/transaction/PantheonWeb3j.java | 17 ----- ...> PermissioningJsonRpcRequestFactory.java} | 29 ++++++--- .../dsl/transaction/clique/CliqueDiscard.java | 3 +- .../clique/CliqueTransactions.java | 1 - .../EthGetTransactionCountTransaction.java | 4 +- .../ethereum/core/TransactionPool.java | 2 +- 12 files changed, 125 insertions(+), 82 deletions(-) rename acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/{PermJsonRpcRequestFactory.java => PermissioningJsonRpcRequestFactory.java} (77%) 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/Ibft.java index 18f3e47515..cc4f98ac89 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/Ibft.java @@ -12,7 +12,13 @@ */ package tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc; -import com.google.common.collect.ImmutableMap; +import tech.pegasys.pantheon.ethereum.core.Address; +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 java.util.Arrays; import java.util.Comparator; import java.util.HashMap; @@ -20,12 +26,8 @@ import java.util.Map; import java.util.Map.Entry; import java.util.stream.Collectors; -import tech.pegasys.pantheon.ethereum.core.Address; -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 com.google.common.collect.ImmutableMap; public class 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 1f4887ead1..ba4d1c7735 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 @@ -14,9 +14,25 @@ import static org.apache.logging.log4j.LogManager.getLogger; -import com.google.common.base.MoreObjects; -import com.google.common.io.MoreFiles; -import com.google.common.io.RecursiveDeleteOption; +import tech.pegasys.pantheon.cli.EthNetworkConfig; +import tech.pegasys.pantheon.controller.KeyPairUtil; +import tech.pegasys.pantheon.crypto.SECP256K1.KeyPair; +import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.core.MiningParameters; +import tech.pegasys.pantheon.ethereum.core.Util; +import tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcConfiguration; +import tech.pegasys.pantheon.ethereum.jsonrpc.websocket.WebSocketConfiguration; +import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration; +import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.CliqueJsonRpcRequestFactory; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.IbftJsonRpcRequestFactory; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PermissioningJsonRpcRequestFactory; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitCondition; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -30,6 +46,10 @@ import java.util.Properties; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; + +import com.google.common.base.MoreObjects; +import com.google.common.io.MoreFiles; +import com.google.common.io.RecursiveDeleteOption; import org.apache.logging.log4j.Logger; import org.awaitility.Awaitility; import org.awaitility.core.ConditionTimeoutException; @@ -41,24 +61,6 @@ import org.web3j.protocol.websocket.WebSocketListener; import org.web3j.protocol.websocket.WebSocketService; import org.web3j.utils.Async; -import tech.pegasys.pantheon.cli.EthNetworkConfig; -import tech.pegasys.pantheon.controller.KeyPairUtil; -import tech.pegasys.pantheon.crypto.SECP256K1.KeyPair; -import tech.pegasys.pantheon.ethereum.core.Address; -import tech.pegasys.pantheon.ethereum.core.MiningParameters; -import tech.pegasys.pantheon.ethereum.core.Util; -import tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcConfiguration; -import tech.pegasys.pantheon.ethereum.jsonrpc.websocket.WebSocketConfiguration; -import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration; -import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.CliqueJsonRpcRequestFactory; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.IbftJsonRpcRequestFactory; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PermJsonRpcRequestFactory; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitCondition; public class PantheonNode implements Node, NodeConfiguration, RunnableNode, AutoCloseable { @@ -164,14 +166,17 @@ public String hostName() { private JsonRequestFactories jsonRequestFactories() { if (jsonRequestFactories == null) { - final Web3jService web3jService = jsonRpcBaseUrl().map(url -> new HttpService(url)).orElse( - new HttpService("http://" + LOCALHOST + ":8545")); - - jsonRequestFactories = new JsonRequestFactories( - new JsonRpc2_0Web3j(web3jService, 2000, Async.defaultExecutorService()), - new CliqueJsonRpcRequestFactory(web3jService), - new IbftJsonRpcRequestFactory(web3jService), - new PermJsonRpcRequestFactory(web3jService)); + final Web3jService web3jService = + jsonRpcBaseUrl() + .map(url -> new HttpService(url)) + .orElse(new HttpService("http://" + LOCALHOST + ":8545")); + + jsonRequestFactories = + new JsonRequestFactories( + new JsonRpc2_0Web3j(web3jService, 2000, Async.defaultExecutorService()), + new CliqueJsonRpcRequestFactory(web3jService), + new IbftJsonRpcRequestFactory(web3jService), + new PermissioningJsonRpcRequestFactory(web3jService)); } return jsonRequestFactories; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java index 381ef32779..ef62ba5898 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java @@ -1,22 +1,36 @@ +/* + * 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.dsl.transaction; import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; -import java.util.Arrays; -import org.web3j.protocol.Web3jService; -import org.web3j.protocol.core.Request; import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.DiscardResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposalsResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; +import java.util.Arrays; + +import org.web3j.protocol.Web3jService; +import org.web3j.protocol.core.Request; + public class CliqueJsonRpcRequestFactory { private final Web3jService web3jService; - public CliqueJsonRpcRequestFactory(Web3jService web3jService) { + public CliqueJsonRpcRequestFactory(final Web3jService web3jService) { this.web3jService = web3jService; } @@ -49,5 +63,4 @@ public Request cliqueGetSignersAtHash(final Hash hash) web3jService, SignersBlockResponse.class); } - } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java index fb3b4be478..294420def8 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java @@ -43,8 +43,6 @@ public T execute(final JsonRequestFactories node) { clazz.getMethod( "deploy", Web3j.class, Credentials.class, BigInteger.class, BigInteger.class); - - final Object invoked = method.invoke( METHOD_IS_STATIC, node.eth(), BENEFACTOR_ONE, DEFAULT_GAS_PRICE, DEFAULT_GAS_LIMIT); 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/IbftJsonRpcRequestFactory.java index f9c62e1f39..41a53dee53 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/IbftJsonRpcRequestFactory.java @@ -1,22 +1,36 @@ +/* + * 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.dsl.transaction; import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; -import java.util.Arrays; -import org.web3j.protocol.Web3jService; -import org.web3j.protocol.core.Request; import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.DiscardResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposalsResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; +import java.util.Arrays; + +import org.web3j.protocol.Web3jService; +import org.web3j.protocol.core.Request; + public class IbftJsonRpcRequestFactory { private final Web3jService web3jService; - public IbftJsonRpcRequestFactory(Web3jService web3jService) { + public IbftJsonRpcRequestFactory(final Web3jService web3jService) { this.web3jService = web3jService; } 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 132507df2b..6aa0215cb2 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 @@ -1,3 +1,15 @@ +/* + * 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.dsl.transaction; import org.web3j.protocol.core.JsonRpc2_0Web3j; @@ -7,12 +19,13 @@ public class JsonRequestFactories { private final JsonRpc2_0Web3j netEth; private final CliqueJsonRpcRequestFactory clique; private final IbftJsonRpcRequestFactory ibft; - private final PermJsonRpcRequestFactory perm; + private final PermissioningJsonRpcRequestFactory perm; - public JsonRequestFactories(JsonRpc2_0Web3j netEth, - CliqueJsonRpcRequestFactory clique, - IbftJsonRpcRequestFactory ibft, - PermJsonRpcRequestFactory perm) { + public JsonRequestFactories( + final JsonRpc2_0Web3j netEth, + final CliqueJsonRpcRequestFactory clique, + final IbftJsonRpcRequestFactory ibft, + final PermissioningJsonRpcRequestFactory perm) { this.netEth = netEth; this.clique = clique; this.ibft = ibft; @@ -35,7 +48,7 @@ public IbftJsonRpcRequestFactory ibft() { return ibft; } - public PermJsonRpcRequestFactory perm() { + public PermissioningJsonRpcRequestFactory perm() { return perm; } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java index 7b524059fc..907463c073 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java @@ -12,22 +12,14 @@ */ package tech.pegasys.pantheon.tests.acceptance.dsl.transaction; -import static java.util.Collections.emptyList; -import static java.util.Collections.singletonList; - import tech.pegasys.pantheon.ethereum.core.Address; -import tech.pegasys.pantheon.ethereum.core.Hash; -import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.ScheduledExecutorService; -import org.assertj.core.util.Lists; import org.web3j.protocol.Web3jService; import org.web3j.protocol.core.JsonRpc2_0Web3j; -import org.web3j.protocol.core.Request; import org.web3j.protocol.core.Response; public class PantheonWeb3j extends JsonRpc2_0Web3j { @@ -43,9 +35,6 @@ public PantheonWeb3j( super(web3jService, pollingInterval, scheduledExecutorService); } - - - public static class ProposeResponse extends Response {} public static class DiscardResponse extends Response {} @@ -54,18 +43,12 @@ public static class SignersBlockResponse extends Response> {} public static class ProposalsResponse extends Response> {} - - - - public static class AddAccountsToWhitelistResponse extends Response {} public static class RemoveAccountsFromWhitelistResponse extends Response {} public static class GetAccountsWhitelistResponse extends Response> {} - - public static class AddNodeResponse extends Response {} public static class RemoveNodeResponse extends Response {} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermissioningJsonRpcRequestFactory.java similarity index 77% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermJsonRpcRequestFactory.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermissioningJsonRpcRequestFactory.java index e8e2c3f365..8840d9d802 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermJsonRpcRequestFactory.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermissioningJsonRpcRequestFactory.java @@ -1,10 +1,17 @@ +/* + * 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.dsl.transaction; -import java.util.Collections; -import java.util.List; -import org.assertj.core.util.Lists; -import org.web3j.protocol.Web3jService; -import org.web3j.protocol.core.Request; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.AddAccountsToWhitelistResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.AddNodeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.GetAccountsWhitelistResponse; @@ -12,10 +19,17 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.RemoveAccountsFromWhitelistResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.RemoveNodeResponse; -public class PermJsonRpcRequestFactory { +import java.util.Collections; +import java.util.List; + +import org.assertj.core.util.Lists; +import org.web3j.protocol.Web3jService; +import org.web3j.protocol.core.Request; + +public class PermissioningJsonRpcRequestFactory { private final Web3jService web3jService; - public PermJsonRpcRequestFactory(Web3jService web3jService) { + public PermissioningJsonRpcRequestFactory(final Web3jService web3jService) { this.web3jService = web3jService; } @@ -62,5 +76,4 @@ public Request removeAccountsFromWhiteli web3jService, RemoveAccountsFromWhitelistResponse.class); } - } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueDiscard.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueDiscard.java index f45ffc6dcd..4763fcc1d0 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueDiscard.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueDiscard.java @@ -14,12 +14,13 @@ import static org.assertj.core.api.Assertions.assertThat; -import org.web3j.protocol.core.Response; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; +import org.web3j.protocol.core.Response; + public class CliqueDiscard implements Transaction { private final String address; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransactions.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransactions.java index 81aadaefcf..f9a500b098 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransactions.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueTransactions.java @@ -14,7 +14,6 @@ import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.CliqueJsonRpcRequestFactory; public class CliqueTransactions { public static final String LATEST = "latest"; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetTransactionCountTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetTransactionCountTransaction.java index 9ed472432b..23d6df7480 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetTransactionCountTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthGetTransactionCountTransaction.java @@ -35,7 +35,9 @@ public EthGetTransactionCountTransaction(final String accountAddress) { public BigInteger execute(final JsonRequestFactories node) { try { EthGetTransactionCount result = - node.eth().ethGetTransactionCount(accountAddress, DefaultBlockParameterName.LATEST).send(); + node.eth() + .ethGetTransactionCount(accountAddress, DefaultBlockParameterName.LATEST) + .send(); assertThat(result).isNotNull(); return result.getTransactionCount(); } catch (final IOException e) { diff --git a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java index 8a1bc46b5e..860ead1f5b 100644 --- a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java +++ b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java @@ -131,7 +131,7 @@ private ValidationResult validateTransaction( final ValidationResult basicValidationResult = getTransactionValidator().validate(transaction); if (!basicValidationResult.isValid()) { -// return basicValidationResult; + // return basicValidationResult; } final String sender = transaction.getSender().toString(); From a97162d0a4a59be443c15328de34fdd29075ed1d Mon Sep 17 00:00:00 2001 From: tmohay Date: Tue, 29 Jan 2019 08:12:19 +1100 Subject: [PATCH 10/14] moved types out of pantheon3 --- .../acceptance/dsl/node/PantheonNode.java | 51 ++++++++--------- .../CliqueJsonRpcRequestFactory.java | 12 ++-- .../IbftJsonRpcRequestFactory.java | 12 ++-- .../dsl/transaction/JsonRequestFactories.java | 4 ++ .../dsl/transaction/PantheonWeb3j.java | 57 ------------------- .../PermissioningJsonRpcRequestFactory.java | 14 ++--- .../dsl/transaction/ResponseTypes.java | 28 +++++++++ .../transaction/clique/CliqueGetSigners.java | 7 +-- .../clique/CliqueGetSignersAtHash.java | 7 +-- .../transaction/clique/CliqueProposals.java | 7 +-- .../dsl/transaction/clique/CliquePropose.java | 5 +- .../dsl/transaction/ibft/IbftDiscard.java | 5 +- .../transaction/ibft/IbftGetValidators.java | 7 +-- .../ibft/IbftGetValidatorsAtHash.java | 7 +-- .../dsl/transaction/ibft/IbftProposals.java | 7 +-- .../dsl/transaction/ibft/IbftPropose.java | 5 +- ...PermAddAccountsToWhitelistTransaction.java | 7 +-- .../perm/PermAddNodeTransaction.java | 7 +-- .../PermGetAccountsWhitelistTransaction.java | 7 +-- .../PermGetNodesWhitelistTransaction.java | 7 +-- ...emoveAccountsFromWhitelistTransaction.java | 7 +-- .../perm/PermRemoveNodeTransaction.java | 7 +-- 22 files changed, 113 insertions(+), 164 deletions(-) delete mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ResponseTypes.java 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 ba4d1c7735..13e6ae1967 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 @@ -14,25 +14,9 @@ import static org.apache.logging.log4j.LogManager.getLogger; -import tech.pegasys.pantheon.cli.EthNetworkConfig; -import tech.pegasys.pantheon.controller.KeyPairUtil; -import tech.pegasys.pantheon.crypto.SECP256K1.KeyPair; -import tech.pegasys.pantheon.ethereum.core.Address; -import tech.pegasys.pantheon.ethereum.core.MiningParameters; -import tech.pegasys.pantheon.ethereum.core.Util; -import tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcConfiguration; -import tech.pegasys.pantheon.ethereum.jsonrpc.websocket.WebSocketConfiguration; -import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration; -import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.CliqueJsonRpcRequestFactory; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.IbftJsonRpcRequestFactory; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PermissioningJsonRpcRequestFactory; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitCondition; - +import com.google.common.base.MoreObjects; +import com.google.common.io.MoreFiles; +import com.google.common.io.RecursiveDeleteOption; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -46,10 +30,6 @@ import java.util.Properties; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; - -import com.google.common.base.MoreObjects; -import com.google.common.io.MoreFiles; -import com.google.common.io.RecursiveDeleteOption; import org.apache.logging.log4j.Logger; import org.awaitility.Awaitility; import org.awaitility.core.ConditionTimeoutException; @@ -61,6 +41,24 @@ import org.web3j.protocol.websocket.WebSocketListener; import org.web3j.protocol.websocket.WebSocketService; import org.web3j.utils.Async; +import tech.pegasys.pantheon.cli.EthNetworkConfig; +import tech.pegasys.pantheon.controller.KeyPairUtil; +import tech.pegasys.pantheon.crypto.SECP256K1.KeyPair; +import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.core.MiningParameters; +import tech.pegasys.pantheon.ethereum.core.Util; +import tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcConfiguration; +import tech.pegasys.pantheon.ethereum.jsonrpc.websocket.WebSocketConfiguration; +import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration; +import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.CliqueJsonRpcRequestFactory; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.IbftJsonRpcRequestFactory; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PermissioningJsonRpcRequestFactory; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitCondition; public class PantheonNode implements Node, NodeConfiguration, RunnableNode, AutoCloseable { @@ -82,7 +80,6 @@ public class PantheonNode implements Node, NodeConfiguration, RunnableNode, Auto private final boolean devMode; private List bootnodes = new ArrayList<>(); - private PantheonWeb3j pantheonWeb3j; private JsonRequestFactories jsonRequestFactories; private Optional ethNetworkConfig = Optional.empty(); @@ -196,11 +193,9 @@ public void useWebSocketsForJsonRpc() { throw new RuntimeException("Error connection to WebSocket endpoint", e); } - if (pantheonWeb3j != null) { - pantheonWeb3j.shutdown(); + if (jsonRequestFactories != null) { + jsonRequestFactories.shutdown(); } - - pantheonWeb3j = new PantheonWeb3j(webSocketService, 2000, Async.defaultExecutorService()); } private void checkIfWebSocketEndpointIsAvailable(final String url) { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java index ef62ba5898..67bb77ca1a 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java @@ -15,16 +15,14 @@ import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; -import tech.pegasys.pantheon.ethereum.core.Hash; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.DiscardResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposalsResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposeResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; - import java.util.Arrays; - import org.web3j.protocol.Web3jService; import org.web3j.protocol.core.Request; +import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.DiscardResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposalsResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposeResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse; public class CliqueJsonRpcRequestFactory { 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/IbftJsonRpcRequestFactory.java index 41a53dee53..6d65ca4439 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/IbftJsonRpcRequestFactory.java @@ -15,16 +15,14 @@ import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; -import tech.pegasys.pantheon.ethereum.core.Hash; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.DiscardResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposalsResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposeResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; - import java.util.Arrays; - import org.web3j.protocol.Web3jService; import org.web3j.protocol.core.Request; +import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.DiscardResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposalsResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposeResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse; public class IbftJsonRpcRequestFactory { 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 6aa0215cb2..4b391eb405 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 @@ -51,4 +51,8 @@ public IbftJsonRpcRequestFactory ibft() { public PermissioningJsonRpcRequestFactory perm() { return perm; } + + public void shutdown() { + netEth.shutdown(); + } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java deleted file mode 100644 index 907463c073..0000000000 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2018 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.dsl.transaction; - -import tech.pegasys.pantheon.ethereum.core.Address; - -import java.util.List; -import java.util.Map; -import java.util.concurrent.ScheduledExecutorService; - -import org.web3j.protocol.Web3jService; -import org.web3j.protocol.core.JsonRpc2_0Web3j; -import org.web3j.protocol.core.Response; - -public class PantheonWeb3j extends JsonRpc2_0Web3j { - - public PantheonWeb3j(final Web3jService web3jService) { - super(web3jService); - } - - public PantheonWeb3j( - final Web3jService web3jService, - final long pollingInterval, - final ScheduledExecutorService scheduledExecutorService) { - super(web3jService, pollingInterval, scheduledExecutorService); - } - - public static class ProposeResponse extends Response {} - - public static class DiscardResponse extends Response {} - - public static class SignersBlockResponse extends Response> {} - - public static class ProposalsResponse extends Response> {} - - public static class AddAccountsToWhitelistResponse extends Response {} - - public static class RemoveAccountsFromWhitelistResponse extends Response {} - - public static class GetAccountsWhitelistResponse extends Response> {} - - public static class AddNodeResponse extends Response {} - - public static class RemoveNodeResponse extends Response {} - - public static class GetNodesWhitelistResponse extends Response> {} -} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermissioningJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermissioningJsonRpcRequestFactory.java index 8840d9d802..f68dfbb7d5 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermissioningJsonRpcRequestFactory.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermissioningJsonRpcRequestFactory.java @@ -12,19 +12,17 @@ */ package tech.pegasys.pantheon.tests.acceptance.dsl.transaction; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.AddAccountsToWhitelistResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.AddNodeResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.GetAccountsWhitelistResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.GetNodesWhitelistResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.RemoveAccountsFromWhitelistResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.RemoveNodeResponse; - import java.util.Collections; import java.util.List; - import org.assertj.core.util.Lists; import org.web3j.protocol.Web3jService; import org.web3j.protocol.core.Request; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.AddAccountsToWhitelistResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.AddNodeResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.GetAccountsWhitelistResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.GetNodesWhitelistResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.RemoveAccountsFromWhitelistResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.RemoveNodeResponse; public class PermissioningJsonRpcRequestFactory { private final Web3jService web3jService; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ResponseTypes.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ResponseTypes.java new file mode 100644 index 0000000000..1adb9ea765 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ResponseTypes.java @@ -0,0 +1,28 @@ +package tech.pegasys.pantheon.tests.acceptance.dsl.transaction; + +import java.util.List; +import java.util.Map; +import org.web3j.protocol.core.Response; +import tech.pegasys.pantheon.ethereum.core.Address; + +public class ResponseTypes { + public static class ProposeResponse extends Response {} + + public static class DiscardResponse extends Response {} + + public static class SignersBlockResponse extends Response> {} + + public static class ProposalsResponse extends Response> {} + + public static class AddAccountsToWhitelistResponse extends Response {} + + public static class RemoveAccountsFromWhitelistResponse extends Response {} + + public static class GetAccountsWhitelistResponse extends Response> {} + + public static class AddNodeResponse extends Response {} + + public static class RemoveNodeResponse extends Response {} + + public static class GetNodesWhitelistResponse extends Response> {} +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSigners.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSigners.java index a2352264f3..d0b02aafae 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSigners.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSigners.java @@ -14,14 +14,13 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.IOException; +import java.util.List; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -import java.io.IOException; -import java.util.List; - public class CliqueGetSigners implements Transaction> { private final String blockNumber; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSignersAtHash.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSignersAtHash.java index 1a81caa166..91d46bc6b2 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSignersAtHash.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSignersAtHash.java @@ -14,15 +14,14 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.IOException; +import java.util.List; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -import java.io.IOException; -import java.util.List; - public class CliqueGetSignersAtHash implements Transaction> { private final Hash hash; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueProposals.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueProposals.java index 6ea020eabc..2a824e1b2f 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueProposals.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueProposals.java @@ -14,14 +14,13 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.IOException; +import java.util.Map; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposalsResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposalsResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -import java.io.IOException; -import java.util.Map; - public class CliqueProposals implements Transaction> { @Override diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliquePropose.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliquePropose.java index f00ae924cf..0f65016658 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliquePropose.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliquePropose.java @@ -14,12 +14,11 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.IOException; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposeResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -import java.io.IOException; - public class CliquePropose implements Transaction { private final String address; private final boolean auth; 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/ibft/IbftDiscard.java index 087de1b74d..c2a0885421 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/ibft/IbftDiscard.java @@ -14,12 +14,11 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.IOException; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.DiscardResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.DiscardResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -import java.io.IOException; - public class IbftDiscard implements Transaction { private final String address; 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/ibft/IbftGetValidators.java index 5252704abe..c177a2b945 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/ibft/IbftGetValidators.java @@ -14,14 +14,13 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.IOException; +import java.util.List; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -import java.io.IOException; -import java.util.List; - public class IbftGetValidators implements Transaction> { private final String blockNumber; 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/ibft/IbftGetValidatorsAtHash.java index 4d60fb2de0..d1a69ddc22 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/ibft/IbftGetValidatorsAtHash.java @@ -14,15 +14,14 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.IOException; +import java.util.List; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.SignersBlockResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -import java.io.IOException; -import java.util.List; - public class IbftGetValidatorsAtHash implements Transaction> { private final Hash hash; 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/ibft/IbftProposals.java index 1da2287c21..25543e5b16 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/ibft/IbftProposals.java @@ -14,14 +14,13 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.IOException; +import java.util.Map; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposalsResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposalsResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -import java.io.IOException; -import java.util.Map; - public class IbftProposals implements Transaction> { @Override 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/ibft/IbftPropose.java index b465280ab7..3f9f01b1cb 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/ibft/IbftPropose.java @@ -14,12 +14,11 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.IOException; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.ProposeResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -import java.io.IOException; - public class IbftPropose implements Transaction { private final String address; private final boolean auth; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddAccountsToWhitelistTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddAccountsToWhitelistTransaction.java index 3ad35e367c..29fe3e57cb 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddAccountsToWhitelistTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddAccountsToWhitelistTransaction.java @@ -14,12 +14,11 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.AddAccountsToWhitelistResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; - import java.io.IOException; import java.util.List; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.AddAccountsToWhitelistResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; public class PermAddAccountsToWhitelistTransaction implements Transaction { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddNodeTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddNodeTransaction.java index 51fdb9cea1..3126e5c104 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddNodeTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddNodeTransaction.java @@ -13,13 +13,12 @@ package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.perm; import static org.assertj.core.api.Assertions.assertThat; -import static tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.AddNodeResponse; - -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; import java.io.IOException; import java.util.List; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.AddNodeResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; public class PermAddNodeTransaction implements Transaction { private final List enodeList; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetAccountsWhitelistTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetAccountsWhitelistTransaction.java index 1d9f89d202..d7279bb9b1 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetAccountsWhitelistTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetAccountsWhitelistTransaction.java @@ -14,12 +14,11 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.GetAccountsWhitelistResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; - import java.io.IOException; import java.util.List; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.GetAccountsWhitelistResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; public class PermGetAccountsWhitelistTransaction implements Transaction> { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetNodesWhitelistTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetNodesWhitelistTransaction.java index e49fe4f3a6..f9b2bb560d 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetNodesWhitelistTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetNodesWhitelistTransaction.java @@ -14,12 +14,11 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.GetNodesWhitelistResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; - import java.io.IOException; import java.util.List; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.GetNodesWhitelistResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; public class PermGetNodesWhitelistTransaction implements Transaction> { @Override diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveAccountsFromWhitelistTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveAccountsFromWhitelistTransaction.java index 005bfc6e72..374ffb8838 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveAccountsFromWhitelistTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveAccountsFromWhitelistTransaction.java @@ -14,12 +14,11 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.RemoveAccountsFromWhitelistResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; - import java.io.IOException; import java.util.List; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.RemoveAccountsFromWhitelistResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; public class PermRemoveAccountsFromWhitelistTransaction implements Transaction { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveNodeTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveNodeTransaction.java index 81fd4af7ca..ce983fde6a 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveNodeTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveNodeTransaction.java @@ -14,12 +14,11 @@ import static org.assertj.core.api.Assertions.assertThat; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j.RemoveNodeResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; - import java.io.IOException; import java.util.List; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.RemoveNodeResponse; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; public class PermRemoveNodeTransaction implements Transaction { private final List enodeList; From 08ae3d66076a2f721d2388ea3098ebf87a0c4c53 Mon Sep 17 00:00:00 2001 From: tmohay Date: Tue, 29 Jan 2019 09:48:45 +1100 Subject: [PATCH 11/14] trying to make AT work --- .../acceptance/dsl/node/PantheonNode.java | 49 ++++++++++--------- .../CliqueJsonRpcRequestFactory.java | 8 +-- .../IbftJsonRpcRequestFactory.java | 8 +-- .../PermissioningJsonRpcRequestFactory.java | 12 +++-- .../dsl/transaction/ResponseTypes.java | 16 +++++- .../transaction/clique/CliqueGetSigners.java | 5 +- .../clique/CliqueGetSignersAtHash.java | 5 +- .../transaction/clique/CliqueProposals.java | 5 +- .../dsl/transaction/clique/CliquePropose.java | 3 +- .../dsl/transaction/ibft/IbftDiscard.java | 3 +- .../transaction/ibft/IbftGetValidators.java | 5 +- .../ibft/IbftGetValidatorsAtHash.java | 5 +- .../dsl/transaction/ibft/IbftProposals.java | 5 +- .../dsl/transaction/ibft/IbftPropose.java | 3 +- ...PermAddAccountsToWhitelistTransaction.java | 5 +- .../perm/PermAddNodeTransaction.java | 5 +- .../PermGetAccountsWhitelistTransaction.java | 5 +- .../PermGetNodesWhitelistTransaction.java | 5 +- ...emoveAccountsFromWhitelistTransaction.java | 5 +- .../perm/PermRemoveNodeTransaction.java | 5 +- .../ethereum/core/TransactionPool.java | 3 +- 21 files changed, 101 insertions(+), 64 deletions(-) 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 13e6ae1967..9dc09fe1d0 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 @@ -14,9 +14,24 @@ import static org.apache.logging.log4j.LogManager.getLogger; -import com.google.common.base.MoreObjects; -import com.google.common.io.MoreFiles; -import com.google.common.io.RecursiveDeleteOption; +import tech.pegasys.pantheon.cli.EthNetworkConfig; +import tech.pegasys.pantheon.controller.KeyPairUtil; +import tech.pegasys.pantheon.crypto.SECP256K1.KeyPair; +import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.core.MiningParameters; +import tech.pegasys.pantheon.ethereum.core.Util; +import tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcConfiguration; +import tech.pegasys.pantheon.ethereum.jsonrpc.websocket.WebSocketConfiguration; +import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration; +import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.CliqueJsonRpcRequestFactory; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.IbftJsonRpcRequestFactory; +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; +import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitCondition; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -30,6 +45,10 @@ import java.util.Properties; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; + +import com.google.common.base.MoreObjects; +import com.google.common.io.MoreFiles; +import com.google.common.io.RecursiveDeleteOption; import org.apache.logging.log4j.Logger; import org.awaitility.Awaitility; import org.awaitility.core.ConditionTimeoutException; @@ -41,24 +60,6 @@ import org.web3j.protocol.websocket.WebSocketListener; import org.web3j.protocol.websocket.WebSocketService; import org.web3j.utils.Async; -import tech.pegasys.pantheon.cli.EthNetworkConfig; -import tech.pegasys.pantheon.controller.KeyPairUtil; -import tech.pegasys.pantheon.crypto.SECP256K1.KeyPair; -import tech.pegasys.pantheon.ethereum.core.Address; -import tech.pegasys.pantheon.ethereum.core.MiningParameters; -import tech.pegasys.pantheon.ethereum.core.Util; -import tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcConfiguration; -import tech.pegasys.pantheon.ethereum.jsonrpc.websocket.WebSocketConfiguration; -import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration; -import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.CliqueJsonRpcRequestFactory; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.IbftJsonRpcRequestFactory; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PermissioningJsonRpcRequestFactory; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; -import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitCondition; public class PantheonNode implements Node, NodeConfiguration, RunnableNode, AutoCloseable { @@ -347,9 +348,9 @@ public String toString() { @Override public void stop() { - if (pantheonWeb3j != null) { - pantheonWeb3j.shutdown(); - pantheonWeb3j = null; + if (jsonRequestFactories != null) { + jsonRequestFactories.shutdown(); + jsonRequestFactories = null; } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java index 67bb77ca1a..7d4a53960c 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java @@ -15,15 +15,17 @@ import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; -import java.util.Arrays; -import org.web3j.protocol.Web3jService; -import org.web3j.protocol.core.Request; import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.DiscardResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposalsResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse; +import java.util.Arrays; + +import org.web3j.protocol.Web3jService; +import org.web3j.protocol.core.Request; + public class CliqueJsonRpcRequestFactory { private final Web3jService web3jService; 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/IbftJsonRpcRequestFactory.java index 6d65ca4439..05635c0d15 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/IbftJsonRpcRequestFactory.java @@ -15,15 +15,17 @@ import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; -import java.util.Arrays; -import org.web3j.protocol.Web3jService; -import org.web3j.protocol.core.Request; import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.DiscardResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposalsResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse; +import java.util.Arrays; + +import org.web3j.protocol.Web3jService; +import org.web3j.protocol.core.Request; + public class IbftJsonRpcRequestFactory { private final Web3jService web3jService; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermissioningJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermissioningJsonRpcRequestFactory.java index f68dfbb7d5..a05fd263e6 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermissioningJsonRpcRequestFactory.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PermissioningJsonRpcRequestFactory.java @@ -12,11 +12,6 @@ */ package tech.pegasys.pantheon.tests.acceptance.dsl.transaction; -import java.util.Collections; -import java.util.List; -import org.assertj.core.util.Lists; -import org.web3j.protocol.Web3jService; -import org.web3j.protocol.core.Request; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.AddAccountsToWhitelistResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.AddNodeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.GetAccountsWhitelistResponse; @@ -24,6 +19,13 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.RemoveAccountsFromWhitelistResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.RemoveNodeResponse; +import java.util.Collections; +import java.util.List; + +import org.assertj.core.util.Lists; +import org.web3j.protocol.Web3jService; +import org.web3j.protocol.core.Request; + public class PermissioningJsonRpcRequestFactory { private final Web3jService web3jService; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ResponseTypes.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ResponseTypes.java index 1adb9ea765..6df0e623e9 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ResponseTypes.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/ResponseTypes.java @@ -1,9 +1,23 @@ +/* + * 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.dsl.transaction; +import tech.pegasys.pantheon.ethereum.core.Address; + import java.util.List; import java.util.Map; + import org.web3j.protocol.core.Response; -import tech.pegasys.pantheon.ethereum.core.Address; public class ResponseTypes { public static class ProposeResponse extends Response {} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSigners.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSigners.java index d0b02aafae..3e4caaa9c6 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSigners.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSigners.java @@ -14,13 +14,14 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.List; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.List; + public class CliqueGetSigners implements Transaction> { private final String blockNumber; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSignersAtHash.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSignersAtHash.java index 91d46bc6b2..1dc06f24c9 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSignersAtHash.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueGetSignersAtHash.java @@ -14,14 +14,15 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.List; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.List; + public class CliqueGetSignersAtHash implements Transaction> { private final Hash hash; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueProposals.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueProposals.java index 2a824e1b2f..a00b266a69 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueProposals.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliqueProposals.java @@ -14,13 +14,14 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.Map; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposalsResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.Map; + public class CliqueProposals implements Transaction> { @Override diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliquePropose.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliquePropose.java index 0f65016658..f767e07800 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliquePropose.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/clique/CliquePropose.java @@ -14,11 +14,12 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; + public class CliquePropose implements Transaction { private final String address; private final boolean auth; 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/ibft/IbftDiscard.java index c2a0885421..58f5b497b4 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/ibft/IbftDiscard.java @@ -14,11 +14,12 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.DiscardResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; + public class IbftDiscard implements Transaction { private final String address; 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/ibft/IbftGetValidators.java index c177a2b945..d773ece7b1 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/ibft/IbftGetValidators.java @@ -14,13 +14,14 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.List; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.List; + public class IbftGetValidators implements Transaction> { private final String blockNumber; 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/ibft/IbftGetValidatorsAtHash.java index d1a69ddc22..1a9caf4e54 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/ibft/IbftGetValidatorsAtHash.java @@ -14,14 +14,15 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.List; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.List; + public class IbftGetValidatorsAtHash implements Transaction> { private final Hash hash; 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/ibft/IbftProposals.java index 25543e5b16..6724ac964d 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/ibft/IbftProposals.java @@ -14,13 +14,14 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.Map; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposalsResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.Map; + public class IbftProposals implements Transaction> { @Override 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/ibft/IbftPropose.java index 3f9f01b1cb..88ff88d446 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/ibft/IbftPropose.java @@ -14,11 +14,12 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; + public class IbftPropose implements Transaction { private final String address; private final boolean auth; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddAccountsToWhitelistTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddAccountsToWhitelistTransaction.java index 29fe3e57cb..313d9cd981 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddAccountsToWhitelistTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddAccountsToWhitelistTransaction.java @@ -14,12 +14,13 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.List; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.AddAccountsToWhitelistResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.List; + public class PermAddAccountsToWhitelistTransaction implements Transaction { private final List accounts; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddNodeTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddNodeTransaction.java index 3126e5c104..a1319dab25 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddNodeTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermAddNodeTransaction.java @@ -14,12 +14,13 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.List; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.AddNodeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.List; + public class PermAddNodeTransaction implements Transaction { private final List enodeList; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetAccountsWhitelistTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetAccountsWhitelistTransaction.java index d7279bb9b1..11622ad188 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetAccountsWhitelistTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetAccountsWhitelistTransaction.java @@ -14,12 +14,13 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.List; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.GetAccountsWhitelistResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.List; + public class PermGetAccountsWhitelistTransaction implements Transaction> { @Override diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetNodesWhitelistTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetNodesWhitelistTransaction.java index f9b2bb560d..56067e731c 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetNodesWhitelistTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetNodesWhitelistTransaction.java @@ -14,12 +14,13 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.List; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.GetNodesWhitelistResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.List; + public class PermGetNodesWhitelistTransaction implements Transaction> { @Override public List execute(final JsonRequestFactories node) { diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveAccountsFromWhitelistTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveAccountsFromWhitelistTransaction.java index 374ffb8838..e62a58a636 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveAccountsFromWhitelistTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveAccountsFromWhitelistTransaction.java @@ -14,12 +14,13 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.List; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.RemoveAccountsFromWhitelistResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.List; + public class PermRemoveAccountsFromWhitelistTransaction implements Transaction { private final List accounts; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveNodeTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveNodeTransaction.java index ce983fde6a..7495ddd74b 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveNodeTransaction.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermRemoveNodeTransaction.java @@ -14,12 +14,13 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; -import java.util.List; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.RemoveNodeResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; +import java.io.IOException; +import java.util.List; + public class PermRemoveNodeTransaction implements Transaction { private final List enodeList; diff --git a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java index 860ead1f5b..0d0eef662b 100644 --- a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java +++ b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java @@ -44,6 +44,7 @@ *

This class is safe for use across multiple threads. */ public class TransactionPool implements BlockAddedObserver { + private static final Logger LOG = getLogger(); private final PendingTransactions pendingTransactions; private final ProtocolSchedule protocolSchedule; @@ -131,7 +132,7 @@ private ValidationResult validateTransaction( final ValidationResult basicValidationResult = getTransactionValidator().validate(transaction); if (!basicValidationResult.isValid()) { - // return basicValidationResult; + return basicValidationResult; } final String sender = transaction.getSender().toString(); From e20674ac24922cdea7dc8b521a4a6a86d1a05dff Mon Sep 17 00:00:00 2001 From: tmohay Date: Tue, 29 Jan 2019 13:09:54 +1100 Subject: [PATCH 12/14] fixed admin --- .../tests/acceptance/dsl/jsonrpc/Admin.java | 2 +- .../acceptance/dsl/node/PantheonNode.java | 2 +- .../AdminJsonRpcRequestFactory.java | 25 +++++++++++++++++++ .../dsl/transaction/JsonRequestFactories.java | 9 ++++++- 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/AdminJsonRpcRequestFactory.java diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Admin.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Admin.java index b047a5ee9e..c90377ece0 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Admin.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Admin.java @@ -25,7 +25,7 @@ public class Admin { private Transaction addPeerTransaction(final String enode) { return (n) -> { try { - final Response resp = n.adminAddPeer(enode).send(); + final Response resp = n.admin().adminAddPeer(enode).send(); assertThat(resp).isNotNull(); assertThat(resp.hasError()).isFalse(); return resp.getResult(); 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 3a5e3b1516..31b59ba2b5 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 @@ -180,7 +180,7 @@ private JsonRequestFactories jsonRequestFactories() { new JsonRpc2_0Web3j(web3jService, 2000, Async.defaultExecutorService()), new CliqueJsonRpcRequestFactory(web3jService), new IbftJsonRpcRequestFactory(web3jService), - new PermissioningJsonRpcRequestFactory(web3jService)); + new PermissioningJsonRpcRequestFactory(web3jService), admin); } return jsonRequestFactories; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/AdminJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/AdminJsonRpcRequestFactory.java new file mode 100644 index 0000000000..13f3940913 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/AdminJsonRpcRequestFactory.java @@ -0,0 +1,25 @@ +package tech.pegasys.pantheon.tests.acceptance.dsl.transaction; + +import java.util.Collections; +import org.web3j.protocol.Web3jService; +import org.web3j.protocol.core.Request; +import org.web3j.protocol.core.Response; + +public class AdminJsonRpcRequestFactory { + + public static class AdminAddPeerResponse extends Response {} + + private final Web3jService web3jService; + + public AdminJsonRpcRequestFactory(final Web3jService web3jService) { + this.web3jService = web3jService; + } + + public Request adminAddPeer(final String enodeAddress) { + return new Request<>( + "admin_addPeer", + Collections.singletonList(enodeAddress), + web3jService, + AdminAddPeerResponse.class); + } +} 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 4b391eb405..e3f72d097c 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 @@ -20,16 +20,19 @@ public class JsonRequestFactories { private final CliqueJsonRpcRequestFactory clique; private final IbftJsonRpcRequestFactory ibft; private final PermissioningJsonRpcRequestFactory perm; + private final AdminJsonRpcRequestFactory admin; public JsonRequestFactories( final JsonRpc2_0Web3j netEth, final CliqueJsonRpcRequestFactory clique, final IbftJsonRpcRequestFactory ibft, - final PermissioningJsonRpcRequestFactory perm) { + final PermissioningJsonRpcRequestFactory perm, + final AdminJsonRpcRequestFactory admin) { this.netEth = netEth; this.clique = clique; this.ibft = ibft; this.perm = perm; + this.admin = admin; } public JsonRpc2_0Web3j eth() { @@ -52,6 +55,10 @@ public PermissioningJsonRpcRequestFactory perm() { return perm; } + public AdminJsonRpcRequestFactory admin() { + return admin; + } + public void shutdown() { netEth.shutdown(); } From cca7ae84745260c24e1499ee48e2e2260133c4a3 Mon Sep 17 00:00:00 2001 From: tmohay Date: Tue, 29 Jan 2019 13:22:36 +1100 Subject: [PATCH 13/14] spotless --- .../tests/acceptance/dsl/node/PantheonNode.java | 4 +++- .../dsl/transaction/AdminJsonRpcRequestFactory.java | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) 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 31b59ba2b5..05c0097638 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 @@ -25,6 +25,7 @@ import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration; import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.AdminJsonRpcRequestFactory; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.CliqueJsonRpcRequestFactory; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.IbftJsonRpcRequestFactory; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories; @@ -180,7 +181,8 @@ private JsonRequestFactories jsonRequestFactories() { new JsonRpc2_0Web3j(web3jService, 2000, Async.defaultExecutorService()), new CliqueJsonRpcRequestFactory(web3jService), new IbftJsonRpcRequestFactory(web3jService), - new PermissioningJsonRpcRequestFactory(web3jService), admin); + new PermissioningJsonRpcRequestFactory(web3jService), + new AdminJsonRpcRequestFactory(web3jService)); } return jsonRequestFactories; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/AdminJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/AdminJsonRpcRequestFactory.java index 13f3940913..68c7a99417 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/AdminJsonRpcRequestFactory.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/AdminJsonRpcRequestFactory.java @@ -1,6 +1,19 @@ +/* + * 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.dsl.transaction; import java.util.Collections; + import org.web3j.protocol.Web3jService; import org.web3j.protocol.core.Request; import org.web3j.protocol.core.Response; From 8a0efa11db1e04cc23cd304ea29aecb8b1a43d93 Mon Sep 17 00:00:00 2001 From: tmohay Date: Tue, 29 Jan 2019 14:19:35 +1100 Subject: [PATCH 14/14] post comments from JFrame --- .../dsl/condition/ibft/ExpectValidators.java | 2 +- .../ibft/ExpectValidatorsAtBlock.java | 42 ------------------ .../ibft/ExpectValidatorsAtBlockHash.java | 43 ------------------- .../tests/acceptance/dsl/jsonrpc/Ibft.java | 12 +++--- .../ibft/IbftDiscardRpcAcceptanceTest.java | 2 +- .../ibft/IbftProposalRpcAcceptanceTest.java | 4 +- .../ethereum/core/TransactionPool.java | 1 - 7 files changed, 10 insertions(+), 96 deletions(-) delete mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlock.java delete mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlockHash.java 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 f1d3a5d4a1..a398d592e5 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,7 +14,7 @@ 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.clique.CliqueTransactions.LATEST; +import static tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions.LATEST; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlock.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlock.java deleted file mode 100644 index 7770da7133..0000000000 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlock.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2018 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.dsl.condition.ibft; - -import static org.assertj.core.api.Assertions.assertThat; -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; - -public class ExpectValidatorsAtBlock implements Condition { - private final IbftTransactions ibft; - private final String blockParameter; - private final Address[] validators; - - public ExpectValidatorsAtBlock( - final IbftTransactions ibft, final String blockNumber, final Address... validators) { - this.ibft = ibft; - this.blockParameter = blockNumber; - this.validators = validators; - } - - @Override - public void verify(final Node node) { - waitFor( - () -> - assertThat(node.execute(ibft.createGetValidators(blockParameter))) - .containsExactly(validators)); - } -} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlockHash.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlockHash.java deleted file mode 100644 index 8e29486e85..0000000000 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidatorsAtBlockHash.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2018 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.dsl.condition.ibft; - -import static org.assertj.core.api.Assertions.assertThat; -import static tech.pegasys.pantheon.tests.acceptance.dsl.WaitUtils.waitFor; - -import tech.pegasys.pantheon.ethereum.core.Address; -import tech.pegasys.pantheon.ethereum.core.Hash; -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; - -public class ExpectValidatorsAtBlockHash implements Condition { - private final IbftTransactions ibft; - private final Hash blockHash; - private final Address[] validators; - - public ExpectValidatorsAtBlockHash( - final IbftTransactions ibft, final Hash blockHash, final Address... validators) { - this.ibft = ibft; - this.blockHash = blockHash; - this.validators = validators; - } - - @Override - public void verify(final Node node) { - waitFor( - () -> - assertThat(node.execute(ibft.createGetValidatorsAtHash(blockHash))) - .containsExactly(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/Ibft.java index cc4f98ac89..37c9bbbaaa 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/Ibft.java @@ -57,24 +57,24 @@ public Condition noProposals() { return new ExpectProposals(ibft, ImmutableMap.of()); } - public ProposalsConfig proposalsEqual() { - return new ProposalsConfig(ibft); + public PendingVotesConfig pendingVotesEqual() { + return new PendingVotesConfig(ibft); } - public static class ProposalsConfig { + public static class PendingVotesConfig { private final Map proposals = new HashMap<>(); private final IbftTransactions ibft; - public ProposalsConfig(final IbftTransactions ibft) { + public PendingVotesConfig(final IbftTransactions ibft) { this.ibft = ibft; } - public Ibft.ProposalsConfig addProposal(final PantheonNode node) { + public PendingVotesConfig addProposal(final PantheonNode node) { proposals.put(node, true); return this; } - public Ibft.ProposalsConfig removeProposal(final PantheonNode node) { + public PendingVotesConfig removeProposal(final PantheonNode node) { proposals.put(node, false); return this; } 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 index 9b501d8c49..59cacd89b0 100644 --- 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 @@ -43,6 +43,6 @@ public void shouldDiscardVotes() throws IOException { cluster.verify(ibft.validatorsEqual(validator1, validator2)); validator1.verify(ibft.noProposals()); validator2.verify( - ibft.proposalsEqual().removeProposal(validator2).addProposal(validator3).build()); + ibft.pendingVotesEqual().removeProposal(validator2).addProposal(validator3).build()); } } 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/ibft/IbftProposalRpcAcceptanceTest.java index f1be12133c..7c91904492 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/ibft/IbftProposalRpcAcceptanceTest.java @@ -35,8 +35,8 @@ public void shouldReturnProposals() throws IOException { validator2.execute(ibftTransactions.createRemoveProposal(validator3)); validator1.verify( - ibft.proposalsEqual().addProposal(validator3).removeProposal(validator2).build()); - validator2.verify(ibft.proposalsEqual().removeProposal(validator3).build()); + ibft.pendingVotesEqual().addProposal(validator3).removeProposal(validator2).build()); + validator2.verify(ibft.pendingVotesEqual().removeProposal(validator3).build()); validator3.verify(ibft.noProposals()); } } diff --git a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java index 0d0eef662b..7cb4bb2c93 100644 --- a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java +++ b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java @@ -44,7 +44,6 @@ *

This class is safe for use across multiple threads. */ public class TransactionPool implements BlockAddedObserver { - private static final Logger LOG = getLogger(); private final PendingTransactions pendingTransactions; private final ProtocolSchedule protocolSchedule;