Skip to content

Commit

Permalink
Fix running ATs with in-process node runner (PegaSysEng#1285)
Browse files Browse the repository at this point in the history
Supplies an EthereumWireProtocolConfiguration when creating PantheonController.
  • Loading branch information
ajsutton authored and notlesh committed May 4, 2019
1 parent 77f432f commit fb64b5d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import tech.pegasys.pantheon.cli.PantheonControllerBuilder;
import tech.pegasys.pantheon.controller.KeyPairUtil;
import tech.pegasys.pantheon.controller.PantheonController;
import tech.pegasys.pantheon.ethereum.eth.EthereumWireProtocolConfiguration;
import tech.pegasys.pantheon.ethereum.eth.sync.SynchronizerConfiguration;
import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions;
import tech.pegasys.pantheon.metrics.MetricsSystem;
Expand Down Expand Up @@ -76,6 +77,7 @@ public void startNode(final PantheonNode node) {
.metricsSystem(noOpMetricsSystem)
.maxPendingTransactions(PendingTransactions.MAX_PENDING_TRANSACTIONS)
.rocksDbConfiguration(new RocksDbConfiguration.Builder().databaseDir(tempDir).build())
.ethereumWireProtocolConfiguration(EthereumWireProtocolConfiguration.defaultConfig())
.build();
} catch (final IOException e) {
throw new RuntimeException("Error building PantheonController", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package tech.pegasys.pantheon.cli;

import static com.google.common.base.Preconditions.checkNotNull;
import static tech.pegasys.pantheon.controller.KeyPairUtil.loadKeyPair;

import tech.pegasys.pantheon.config.GenesisConfigFile;
Expand Down Expand Up @@ -105,6 +106,16 @@ public PantheonControllerBuilder privacyParameters(final PrivacyParameters priva
}

public PantheonController<?> build() throws IOException {
checkNotNull(nodePrivateKeyFile, "Missing node private key file");
checkNotNull(synchronizerConfiguration, "Missing synchronizer configuration");
checkNotNull(rocksDbConfiguration, "Missing rocksdb configuration");
checkNotNull(homePath, "Missing home path");
checkNotNull(ethNetworkConfig, "Missing Ethereum network config");
checkNotNull(miningParameters, "Missing mining parameters");
checkNotNull(metricsSystem, "Missing metrics system");
checkNotNull(privacyParameters, "Missing privacy parameters");
checkNotNull(ethereumWireProtocolConfiguration, "Missing Ethereum wire protocol config");

// instantiate a controller with mainnet config if no genesis file is defined
// otherwise use the indicated genesis file
final KeyPair nodeKeys = loadKeyPair(nodePrivateKeyFile);
Expand All @@ -120,7 +131,7 @@ public PantheonController<?> build() throws IOException {
final String genesisConfig = ethNetworkConfig.getGenesisConfig();
genesisConfigFile = GenesisConfigFile.fromConfig(genesisConfig);
}
Clock clock = Clock.systemUTC();
final Clock clock = Clock.systemUTC();
return PantheonController.fromConfig(
genesisConfigFile,
synchronizerConfiguration,
Expand Down

0 comments on commit fb64b5d

Please sign in to comment.