Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

RevertReason changed to BytesValue #1746

Merged
merged 37 commits into from
Jul 30, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
639b410
RevertReason changed to BytesValue
Jul 24, 2019
8bd82ae
post review
Jul 25, 2019
20f4316
Added static nodes acceptance test (#1745)
lucassaldanha Jul 24, 2019
a85980a
update vertx to 2.8.0 (#1748)
Jul 24, 2019
5b78518
Reduce number of builds retained for master (#1751)
ajsutton Jul 24, 2019
5c67f04
PIE-1792: Added chainId validation to PrivateTransactionValidator (#1…
lucassaldanha Jul 24, 2019
2f9818a
Added note about private transaction nonce (#1740)
MadelineMurray Jul 25, 2019
c3bf607
[PAN-2950] Use java.time.Clock instead of System.currentTimeMillis() …
Jul 25, 2019
09fb64c
Report node local address as the coinbase in Clique and IBFT. (#1758)
ajsutton Jul 25, 2019
fbb8736
Renamed HA section to make clearer what it is (#1750)
MadelineMurray Jul 25, 2019
e88de17
[PAN-2845] Added eea_getPrivateTransaction (#1729)
MadelineMurray Jul 25, 2019
8e6364d
Fixes PIE-1669 typo (#1763)
sgregglives Jul 25, 2019
6c07566
[PAN-2943] Renames various eea methods to priv methods, with associat…
josh-richardson Jul 25, 2019
ec7cfa0
[PAN-2727] Permissioning Acceptance Test - Verify OnChain Nodes Out o…
usmansaleem Jul 26, 2019
825242a
PAN-2723: Testing permissioning with static nodes behaviour (#1764)
lucassaldanha Jul 26, 2019
e38bec0
trying to fix stuff
Jul 26, 2019
a118716
Fixed RevertReasonAT
Jul 26, 2019
66d2b2d
Cleanup
Jul 26, 2019
d7af3d4
not sure what this one is about
Jul 26, 2019
ae80d96
repair empty revert reason
Jul 26, 2019
6bf9ff5
fixes PAN-2958 list typo (missing new line) (#1742)
NicolasMassart Jul 26, 2019
35278e7
Revert "[PAN-2950] Use java.time.Clock instead of System.currentTimeM…
Jul 26, 2019
168dcf4
[PAN-2444] Add CLI flag for setting WorldStateDownloader task cache …
Jul 26, 2019
b439d7f
Moved priv methods into priv section (#1770)
MadelineMurray Jul 27, 2019
7082eb4
[PAN-2881] [PAN-2885] Updated onchain permissioning to include accoun…
MadelineMurray Jul 27, 2019
c5f6a0a
Added privacy group methods for web3.js-eea (#1761)
MadelineMurray Jul 27, 2019
89a39a2
[PAN-2957] Add Java 11+ as a prerequisite for installing Pantheon usi…
bgravenorst Jul 27, 2019
6412d95
Updated revert reason example (#1754)
MadelineMurray Jul 27, 2019
5f4b5be
Typo doc in word "exceptoinal" (#1767)
helderjnpinto Jul 29, 2019
4c7b677
Added content on deploying for production (#1774)
MadelineMurray Jul 29, 2019
8e9bd85
Repaired empty revert reason output
Jul 29, 2019
4ed31e8
Merge remote-tracking branch 'upstream/master' into revert
Jul 29, 2019
ec7b1bf
Transaction receipt inserts 0x for empty revert reason
Jul 29, 2019
58b75cc
Merge remote-tracking branch 'upstream/master' into revert
Jul 29, 2019
e64e574
Repair failing AT
Jul 29, 2019
98fe982
Merge branch 'master' into revert
rain-on Jul 30, 2019
0ae3d4c
Merge branch 'master' into revert
rain-on Jul 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added static nodes acceptance test (#1745)
  • Loading branch information
lucassaldanha authored and tmohay committed Jul 26, 2019
commit 20f4316f1848692c42f2217b95e674d5c8a0c740
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* 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;

import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase;
import tech.pegasys.pantheon.tests.acceptance.dsl.WaitUtils;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node;

import java.util.Arrays;

import org.junit.Before;
import org.junit.Test;

public class StaticNodesAcceptanceTest extends AcceptanceTestBase {

private Node otherNode;
private Node node;

@Before
public void setUp() throws Exception {
otherNode = pantheon.createNodeWithNoDiscovery("other-node");
cluster.start(otherNode);
}

@Test
public void shouldConnectToNodeAddedAsStaticNode() throws Exception {
node = pantheon.createNodeWithStaticNodes("node", Arrays.asList(otherNode));
cluster.addNode(node);

node.verify(net.awaitPeerCount(1));

WaitUtils.waitFor(1000000, () -> {});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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;

import static java.nio.charset.StandardCharsets.UTF_8;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.stream.Collectors;

public class StaticNodesUtils {

public static Path createStaticNodesFile(final Path directory, final List<String> staticNodes) {
try {
final Path tempFile = Files.createTempFile(directory, "", "");
tempFile.toFile().deleteOnExit();

final Path staticNodesFile = tempFile.getParent().resolve("static-nodes.json");
Files.move(tempFile, staticNodesFile);
staticNodesFile.toFile().deleteOnExit();

final String json =
staticNodes.stream()
.map(s -> String.format("\"%s\"", s))
.collect(Collectors.joining(",", "[", "]"));
Files.write(staticNodesFile, json.getBytes(UTF_8));

return staticNodesFile;
} catch (final IOException e) {
throw new IllegalStateException(e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ public class PantheonNode implements NodeConfiguration, RunnableNode, AutoClosea
private final boolean discoveryEnabled;
private final List<URI> bootnodes = new ArrayList<>();
private final boolean bootnodeEligible;

private Optional<String> genesisConfig = Optional.empty();
private NodeRequests nodeRequests;
private LoginRequestFactory loginRequestFactory;
private boolean useWsForJsonRpc = false;
private String token = null;
private final List<String> plugins = new ArrayList<>();
private final List<String> extraCLIOptions;
private final List<String> staticNodes;

public PantheonNode(
final String name,
Expand All @@ -120,7 +120,8 @@ public PantheonNode(
final boolean bootnodeEligible,
final boolean revertReasonEnabled,
final List<String> plugins,
final List<String> extraCLIOptions)
final List<String> extraCLIOptions,
final List<String> staticNodes)
throws IOException {
this.bootnodeEligible = bootnodeEligible;
this.revertReasonEnabled = revertReasonEnabled;
Expand Down Expand Up @@ -159,6 +160,7 @@ public PantheonNode(
}
});
this.extraCLIOptions = extraCLIOptions;
this.staticNodes = staticNodes;
LOG.info("Created PantheonNode {}", this.toString());
}

Expand Down Expand Up @@ -529,6 +531,15 @@ public boolean isRevertReasonEnabled() {
return revertReasonEnabled;
}

@Override
public List<String> getStaticNodes() {
return staticNodes;
}

public boolean hasStaticNodes() {
return staticNodes != null && !staticNodes.isEmpty();
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import tech.pegasys.pantheon.ethereum.jsonrpc.RpcApi;
import tech.pegasys.pantheon.ethereum.jsonrpc.RpcApis;
import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration;
import tech.pegasys.pantheon.tests.acceptance.dsl.StaticNodesUtils;

import java.io.BufferedReader;
import java.io.File;
Expand Down Expand Up @@ -99,6 +100,10 @@ public void startNode(final PantheonNode node) {
params.add(node.getBootnodes().stream().map(URI::toString).collect(Collectors.joining(",")));
}

if (node.hasStaticNodes()) {
createStaticNodes(node);
}

if (node.isJsonRpcEnabled()) {
params.add("--rpc-http-enabled");
params.add("--rpc-http-host");
Expand Down Expand Up @@ -244,6 +249,10 @@ private Path createGenesisFile(final PantheonNode node, final String genesisConf
}
}

private void createStaticNodes(final PantheonNode node) {
StaticNodesUtils.createStaticNodesFile(node.homeDirectory(), node.getStaticNodes());
}

private String apiList(final Collection<RpcApi> rpcApis) {
return rpcApis.stream().map(RpcApis::getValue).collect(Collectors.joining(","));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ public void startNode(final PantheonNode node) {
.metricsConfiguration(node.metricsConfiguration())
.p2pEnabled(node.isP2pEnabled())
.graphQLConfiguration(GraphQLConfiguration.createDefault())
.staticNodes(
node.getStaticNodes().stream()
.map(EnodeURL::fromString)
.collect(Collectors.toList()))
.build();

runner.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ public interface NodeConfiguration {
List<String> getExtraCLIOptions();

boolean isRevertReasonEnabled();

List<String> getStaticNodes();
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class PantheonFactoryConfiguration {
private final boolean revertReasonEnabled;
private final List<String> plugins;
private final List<String> extraCLIOptions;
private final List<String> staticNodes;

public PantheonFactoryConfiguration(
final String name,
Expand All @@ -61,7 +62,8 @@ public PantheonFactoryConfiguration(
final boolean bootnodeEligible,
final boolean revertReasonEnabled,
final List<String> plugins,
final List<String> extraCLIOptions) {
final List<String> extraCLIOptions,
final List<String> staticNodes) {
this.name = name;
this.miningParameters = miningParameters;
this.privacyParameters = privacyParameters;
Expand All @@ -79,6 +81,7 @@ public PantheonFactoryConfiguration(
this.revertReasonEnabled = revertReasonEnabled;
this.plugins = plugins;
this.extraCLIOptions = extraCLIOptions;
this.staticNodes = staticNodes;
}

public String getName() {
Expand Down Expand Up @@ -148,4 +151,8 @@ public List<String> getExtraCLIOptions() {
public boolean isRevertReasonEnabled() {
return revertReasonEnabled;
}

public List<String> getStaticNodes() {
return staticNodes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class PantheonFactoryConfigurationBuilder {
private boolean revertReasonEnabled = false;
private List<String> plugins = new ArrayList<>();
private List<String> extraCLIOptions = new ArrayList<>();
private List<String> staticNodes = new ArrayList<>();

public PantheonFactoryConfigurationBuilder() {
// Check connections more frequently during acceptance tests to cut down on
Expand Down Expand Up @@ -193,6 +194,11 @@ public PantheonFactoryConfigurationBuilder revertReasonEnabled() {
return this;
}

public PantheonFactoryConfigurationBuilder staticNodes(final List<String> staticNodes) {
this.staticNodes = staticNodes;
return this;
}

public PantheonFactoryConfiguration build() {
return new PantheonFactoryConfiguration(
name,
Expand All @@ -211,6 +217,7 @@ public PantheonFactoryConfiguration build() {
bootnodeEligible,
revertReasonEnabled,
plugins,
extraCLIOptions);
extraCLIOptions,
staticNodes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@
package tech.pegasys.pantheon.tests.acceptance.dsl.node.configuration;

import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;

import tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcConfiguration;
import tech.pegasys.pantheon.ethereum.jsonrpc.RpcApi;
import tech.pegasys.pantheon.ethereum.jsonrpc.websocket.WebSocketConfiguration;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.RunnableNode;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.configuration.genesis.GenesisConfigurationFactory;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -49,7 +52,8 @@ public PantheonNode create(final PantheonFactoryConfiguration config) throws IOE
config.isBootnodeEligible(),
config.isRevertReasonEnabled(),
config.getPlugins(),
config.getExtraCLIOptions());
config.getExtraCLIOptions(),
config.getStaticNodes());
}

public PantheonNode createMinerNode(final String name) throws IOException {
Expand Down Expand Up @@ -263,4 +267,25 @@ public PantheonNode createIbft2NodeWithValidators(final String name, final Strin
asList(validators), nodes, genesis::createIbft2GenesisConfig))
.build());
}

public PantheonNode createNodeWithStaticNodes(final String name, final List<Node> staticNodes)
throws IOException {

final List<String> staticNodesUrls =
staticNodes.stream()
.map(node -> (RunnableNode) node)
.map(RunnableNode::enodeUrl)
.map(URI::toASCIIString)
.collect(toList());

return create(
new PantheonFactoryConfigurationBuilder()
.name(name)
.jsonRpcEnabled()
.webSocketEnabled()
.discoveryEnabled(false)
.staticNodes(staticNodesUrls)
.bootnodeEligible(false)
.build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import tech.pegasys.pantheon.tests.acceptance.dsl.node.configuration.PantheonFactoryConfiguration;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.configuration.genesis.GenesisConfigurationProvider;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

Expand Down Expand Up @@ -66,7 +67,8 @@ public class PrivacyPantheonFactoryConfiguration extends PantheonFactoryConfigur
bootnodeEligible,
revertReasonEnabled,
plugins,
extraCLIOptions);
extraCLIOptions,
new ArrayList<>());
this.orion = orion;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import tech.pegasys.pantheon.util.bytes.BytesValues;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -83,7 +84,8 @@ public PrivacyNode(
bootnodeEligible,
revertReasonEnabled,
plugins,
extraCLIOptions);
extraCLIOptions,
new ArrayList<>());
this.orion = orion;
}

Expand Down