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

[PAN-2797] Refactor experimental CLI options #1629

Merged
merged 23 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4fa95f9
Check connections more frequently during acceptance tests
mbaxter Jun 20, 2019
f9c716c
Get CLI params from NetworkingConfiguration
mbaxter Jun 20, 2019
097ea41
Set a default NetworkingConfiguration
mbaxter Jun 20, 2019
75fa3fe
Add missing mocked method
mbaxter Jun 21, 2019
7183850
Rework CLI flag handling
mbaxter Jun 21, 2019
44c1e27
Merge branch 'master' into PAN-2797/retry-connections
mbaxter Jun 21, 2019
8047744
Merge branch 'master' into PAN-2797/retry-connections
mbaxter Jun 24, 2019
a33009e
Merge branch 'master' into PAN-2797/retry-connections
mbaxter Jun 25, 2019
f60e2e2
Rework Options interface
mbaxter Jun 25, 2019
f6c1343
Move sync CLI config to new model, update getters
mbaxter Jun 28, 2019
a5b0458
Rework CLIOptions tests
mbaxter Jun 28, 2019
4f543a6
Create EthProtocolOptions
mbaxter Jun 28, 2019
bea4084
Add RocksDBOptions
mbaxter Jun 28, 2019
b0b51fe
Merge branch 'master' into PAN-2797/retry-connections
mbaxter Jun 28, 2019
8febbef
Clean up tests
mbaxter Jun 28, 2019
0f0cab0
Merge branch 'master' into PAN-2797/refactor-cli-x-options
mbaxter Jul 2, 2019
4a2be75
Merge branch 'master' into PAN-2797/refactor-cli-x-options
mbaxter Jul 2, 2019
2a382a6
Create TransactionPoolOptions
mbaxter Jul 2, 2019
1ef04cb
Fix annotations
mbaxter Jul 2, 2019
51c33a3
Simplify tests
mbaxter Jul 2, 2019
f415317
Remove NetworkingOptions
mbaxter Jul 2, 2019
f7a232f
Merge branch 'master' into PAN-2797/refactor-cli-x-options
mbaxter Jul 2, 2019
4ff7bea
Merge branch 'master' into PAN-2797/refactor-cli-x-options
Jul 2, 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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import tech.pegasys.pantheon.controller.KeyPairUtil;
import tech.pegasys.pantheon.controller.PantheonController;
import tech.pegasys.pantheon.controller.PantheonControllerBuilder;
import tech.pegasys.pantheon.ethereum.eth.EthereumWireProtocolConfiguration;
import tech.pegasys.pantheon.ethereum.eth.EthProtocolConfiguration;
import tech.pegasys.pantheon.ethereum.eth.sync.SynchronizerConfiguration;
import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPoolConfiguration;
import tech.pegasys.pantheon.ethereum.graphql.GraphQLConfiguration;
Expand Down Expand Up @@ -115,8 +115,8 @@ public void startNode(final PantheonNode node) {
.nodePrivateKeyFile(KeyPairUtil.getDefaultKeyFile(node.homeDirectory()))
.metricsSystem(noOpMetricsSystem)
.transactionPoolConfiguration(TransactionPoolConfiguration.builder().build())
.rocksDbConfiguration(new RocksDbConfiguration.Builder().databaseDir(tempDir).build())
.ethereumWireProtocolConfiguration(EthereumWireProtocolConfiguration.defaultConfig())
.rocksDbConfiguration(RocksDbConfiguration.builder().databaseDir(tempDir).build())
.ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig())
.clock(Clock.systemUTC())
.build();
} catch (final IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import tech.pegasys.pantheon.ethereum.core.Util;
import tech.pegasys.pantheon.ethereum.core.Wei;
import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions;
import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPoolConfiguration;
import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule;
import tech.pegasys.pantheon.ethereum.worldstate.WorldStateArchive;
import tech.pegasys.pantheon.metrics.MetricsSystem;
Expand Down Expand Up @@ -114,7 +115,7 @@ public void proposerAddressCanBeExtractFromAConstructedBlock() {
coinbase,
parent -> extraData,
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS,
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
5,
TestClock.fixed(),
metricsSystem),
Expand Down Expand Up @@ -145,7 +146,7 @@ public void insertsValidVoteIntoConstructedBlock() {
coinbase,
parent -> extraData,
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS,
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
5,
TestClock.fixed(),
metricsSystem),
Expand Down Expand Up @@ -175,7 +176,7 @@ public void insertsNoVoteWhenAuthInValidators() {
coinbase,
parent -> extraData,
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS,
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
5,
TestClock.fixed(),
metricsSystem),
Expand Down Expand Up @@ -208,7 +209,7 @@ public void insertsNoVoteWhenAtEpoch() {
coinbase,
parent -> extraData,
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS,
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
5,
TestClock.fixed(),
metricsSystem),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import tech.pegasys.pantheon.ethereum.core.Util;
import tech.pegasys.pantheon.ethereum.core.Wei;
import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions;
import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPoolConfiguration;
import tech.pegasys.pantheon.metrics.MetricsSystem;
import tech.pegasys.pantheon.metrics.noop.NoOpMetricsSystem;
import tech.pegasys.pantheon.testutil.TestClock;
Expand Down Expand Up @@ -91,7 +92,7 @@ public void extraDataCreatedOnEpochBlocksContainsValidators() {
Executors.newSingleThreadExecutor(),
CliqueProtocolSchedule.create(GENESIS_CONFIG_OPTIONS, proposerKeyPair),
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS,
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
1,
TestClock.fixed(),
metricsSystem),
Expand Down Expand Up @@ -128,7 +129,7 @@ public void extraDataForNonEpochBlocksDoesNotContainValidaors() {
Executors.newSingleThreadExecutor(),
CliqueProtocolSchedule.create(GENESIS_CONFIG_OPTIONS, proposerKeyPair),
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS,
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
1,
TestClock.fixed(),
metricsSystem),
Expand Down Expand Up @@ -165,7 +166,7 @@ public void shouldUseLatestVanityData() {
Executors.newSingleThreadExecutor(),
CliqueProtocolSchedule.create(GENESIS_CONFIG_OPTIONS, proposerKeyPair),
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS,
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
1,
TestClock.fixed(),
metricsSystem),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import tech.pegasys.pantheon.ethereum.core.Util;
import tech.pegasys.pantheon.ethereum.core.Wei;
import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions;
import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPoolConfiguration;
import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule;
import tech.pegasys.pantheon.ethereum.worldstate.WorldStateArchive;
import tech.pegasys.pantheon.metrics.MetricsSystem;
Expand Down Expand Up @@ -285,7 +286,7 @@ private static ControllerAndState createControllerAndFinalState(

final PendingTransactions pendingTransactions =
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS, 1, clock, metricsSystem);
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS, 1, clock, metricsSystem);

final IbftBlockCreatorFactory blockCreatorFactory =
new IbftBlockCreatorFactory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import tech.pegasys.pantheon.ethereum.core.BlockHeaderTestFixture;
import tech.pegasys.pantheon.ethereum.core.Wei;
import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions;
import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPoolConfiguration;
import tech.pegasys.pantheon.ethereum.mainnet.BlockHeaderValidator;
import tech.pegasys.pantheon.ethereum.mainnet.HeaderValidationMode;
import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule;
Expand Down Expand Up @@ -83,7 +84,10 @@ public void createdBlockPassesValidationRulesAndHasAppropriateHashAndMixHash() {

final PendingTransactions pendingTransactions =
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS, 1, TestClock.fixed(), metricsSystem);
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
1,
TestClock.fixed(),
metricsSystem);

final IbftBlockCreator blockCreator =
new IbftBlockCreator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import static java.util.Collections.singletonList;

import tech.pegasys.pantheon.ethereum.chain.Blockchain;
import tech.pegasys.pantheon.ethereum.eth.EthereumWireProtocolConfiguration;
import tech.pegasys.pantheon.ethereum.eth.EthProtocolConfiguration;
import tech.pegasys.pantheon.ethereum.eth.manager.EthProtocolManager;
import tech.pegasys.pantheon.ethereum.p2p.rlpx.wire.Capability;
import tech.pegasys.pantheon.ethereum.worldstate.WorldStateArchive;
Expand All @@ -37,7 +37,7 @@ public Istanbul64ProtocolManager(
final int computationWorkers,
final Clock clock,
final MetricsSystem metricsSystem,
final EthereumWireProtocolConfiguration ethereumWireProtocolConfiguration) {
final EthProtocolConfiguration ethereumWireProtocolConfiguration) {
super(
blockchain,
worldStateArchive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import tech.pegasys.pantheon.ethereum.core.Hash;
import tech.pegasys.pantheon.ethereum.core.Wei;
import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions;
import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPoolConfiguration;
import tech.pegasys.pantheon.ethereum.mainnet.BlockHeaderValidator;
import tech.pegasys.pantheon.ethereum.mainnet.HeaderValidationMode;
import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule;
Expand Down Expand Up @@ -98,7 +99,7 @@ public void headerProducedPassesValidationRules() {
initialValidatorList)
.encode(),
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS,
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
1,
TestClock.fixed(),
metricsSystem),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import tech.pegasys.pantheon.ethereum.core.WorldUpdater;
import tech.pegasys.pantheon.ethereum.difficulty.fixed.FixedDifficultyProtocolSchedule;
import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions;
import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPoolConfiguration;
import tech.pegasys.pantheon.ethereum.mainnet.MainnetTransactionProcessor;
import tech.pegasys.pantheon.ethereum.mainnet.MainnetTransactionProcessor.Result;
import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule;
Expand Down Expand Up @@ -68,7 +69,10 @@ public class BlockTransactionSelectorTest {

private final PendingTransactions pendingTransactions =
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS, 5, TestClock.fixed(), metricsSystem);
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
5,
TestClock.fixed(),
metricsSystem);
private final Blockchain blockchain = new TestBlockchain();
private final DefaultMutableWorldState worldState = inMemoryWorldState();
private final Supplier<Boolean> isCancelled = () -> false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import tech.pegasys.pantheon.ethereum.core.PrivacyParameters;
import tech.pegasys.pantheon.ethereum.core.Wei;
import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions;
import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPoolConfiguration;
import tech.pegasys.pantheon.ethereum.mainnet.EthHashSolver;
import tech.pegasys.pantheon.ethereum.mainnet.EthHasher.Light;
import tech.pegasys.pantheon.ethereum.mainnet.ProtocolScheduleBuilder;
Expand Down Expand Up @@ -66,7 +67,10 @@ public void createMainnetBlock1() throws IOException {

final PendingTransactions pendingTransactions =
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS, 1, TestClock.fixed(), metricsSystem);
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
1,
TestClock.fixed(),
metricsSystem);

final EthHashBlockCreator blockCreator =
new EthHashBlockCreator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import tech.pegasys.pantheon.ethereum.core.MiningParameters;
import tech.pegasys.pantheon.ethereum.core.MiningParametersTestBuilder;
import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions;
import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPoolConfiguration;
import tech.pegasys.pantheon.metrics.MetricsSystem;
import tech.pegasys.pantheon.metrics.noop.NoOpMetricsSystem;
import tech.pegasys.pantheon.testutil.TestClock;
Expand All @@ -36,7 +37,10 @@ public void startingMiningWithoutCoinbaseThrowsException() {

final PendingTransactions pendingTransactions =
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS, 1, TestClock.fixed(), metricsSystem);
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
1,
TestClock.fixed(),
metricsSystem);

final EthHashMinerExecutor executor =
new EthHashMinerExecutor(
Expand All @@ -58,7 +62,10 @@ public void settingCoinbaseToNullThrowsException() {

final PendingTransactions pendingTransactions =
new PendingTransactions(
PendingTransactions.DEFAULT_TX_RETENTION_HOURS, 1, TestClock.fixed(), metricsSystem);
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
1,
TestClock.fixed(),
metricsSystem);

final EthHashMinerExecutor executor =
new EthHashMinerExecutor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static OperationBenchmarkHelper create() throws IOException {
final Path storageDirectory = Files.createTempDirectory("benchmark");
final KeyValueStorage keyValueStorage =
RocksDbKeyValueStorage.create(
new RocksDbConfiguration.Builder().databaseDir(storageDirectory).build(),
RocksDbConfiguration.builder().databaseDir(storageDirectory).build(),
new NoOpMetricsSystem());

final ExecutionContextTestFixture executionContext =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public PrivacyParameters build() throws IOException {
Path privateDbPath = dataDir.resolve(PRIVATE_DATABASE_PATH);
StorageProvider privateStorageProvider =
RocksDbStorageProvider.create(
new RocksDbConfiguration.Builder()
RocksDbConfiguration.builder()
.databaseDir(privateDbPath)
.label("private_state")
.build(),
Expand Down
1 change: 0 additions & 1 deletion ethereum/eth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ dependencies {
implementation project(':services:pipeline')
implementation project(':services:tasks')

implementation 'info.picocli:picocli'
implementation 'io.vertx:vertx-core'
implementation 'com.google.guava:guava'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ public void setUpUnchangedState() throws Exception {
ethProtocolManager =
EthProtocolManagerTestUtil.create(
new EthScheduler(
syncConfig.downloaderParallelism(),
syncConfig.transactionsParallelism(),
syncConfig.computationParallelism(),
syncConfig.getDownloaderParallelism(),
syncConfig.getTransactionsParallelism(),
syncConfig.getComputationParallelism(),
metricsSystem));

peer = EthProtocolManagerTestUtil.createPeer(ethProtocolManager, blockHeader.getNumber());

final EthContext ethContext = ethProtocolManager.ethContext();
storageProvider =
RocksDbStorageProvider.create(
new RocksDbConfiguration.Builder().databaseDir(tempDir.resolve("database")).build(),
RocksDbConfiguration.builder().databaseDir(tempDir.resolve("database")).build(),
metricsSystem);
worldStateStorage = storageProvider.createWorldStateStorage();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
import java.util.Objects;

import com.google.common.base.MoreObjects;
import picocli.CommandLine;

public class EthereumWireProtocolConfiguration {
public class EthProtocolConfiguration {

public static final int DEFAULT_MAX_GET_BLOCK_HEADERS = 192;
public static final int DEFAULT_MAX_GET_BLOCK_BODIES = 128;
Expand All @@ -31,7 +30,7 @@ public class EthereumWireProtocolConfiguration {
private final int maxGetReceipts;
private final int maxGetNodeData;

public EthereumWireProtocolConfiguration(
public EthProtocolConfiguration(
final int maxGetBlockHeaders,
final int maxGetBlockBodies,
final int maxGetReceipts,
Expand All @@ -42,8 +41,8 @@ public EthereumWireProtocolConfiguration(
this.maxGetNodeData = maxGetNodeData;
}

public static EthereumWireProtocolConfiguration defaultConfig() {
return new EthereumWireProtocolConfiguration(
public static EthProtocolConfiguration defaultConfig() {
return new EthProtocolConfiguration(
DEFAULT_MAX_GET_BLOCK_HEADERS,
DEFAULT_MAX_GET_BLOCK_BODIES,
DEFAULT_MAX_GET_RECEIPTS,
Expand Down Expand Up @@ -78,7 +77,7 @@ public boolean equals(final Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
final EthereumWireProtocolConfiguration that = (EthereumWireProtocolConfiguration) o;
final EthProtocolConfiguration that = (EthProtocolConfiguration) o;
return maxGetBlockHeaders == that.maxGetBlockHeaders
&& maxGetBlockBodies == that.maxGetBlockBodies
&& maxGetReceipts == that.maxGetReceipts
Expand All @@ -101,41 +100,17 @@ public String toString() {
}

public static class Builder {
@CommandLine.Option(
hidden = true,
names = {"--Xewp-max-get-headers"},
paramLabel = "<INTEGER>",
description =
"Maximum request limit for Ethereum Wire Protocol GET_BLOCK_HEADERS. (default: ${DEFAULT-VALUE})")
private PositiveNumber maxGetBlockHeaders =
PositiveNumber.fromInt(EthereumWireProtocolConfiguration.DEFAULT_MAX_GET_BLOCK_HEADERS);

@CommandLine.Option(
hidden = true,
names = {"--Xewp-max-get-bodies"},
paramLabel = "<INTEGER>",
description =
"Maximum request limit for Ethereum Wire Protocol GET_BLOCK_BODIES. (default: ${DEFAULT-VALUE})")
PositiveNumber.fromInt(EthProtocolConfiguration.DEFAULT_MAX_GET_BLOCK_HEADERS);

private PositiveNumber maxGetBlockBodies =
PositiveNumber.fromInt(EthereumWireProtocolConfiguration.DEFAULT_MAX_GET_BLOCK_BODIES);

@CommandLine.Option(
hidden = true,
names = {"--Xewp-max-get-receipts"},
paramLabel = "<INTEGER>",
description =
"Maximum request limit for Ethereum Wire Protocol GET_RECEIPTS. (default: ${DEFAULT-VALUE})")
PositiveNumber.fromInt(EthProtocolConfiguration.DEFAULT_MAX_GET_BLOCK_BODIES);

private PositiveNumber maxGetReceipts =
PositiveNumber.fromInt(EthereumWireProtocolConfiguration.DEFAULT_MAX_GET_RECEIPTS);

@CommandLine.Option(
hidden = true,
names = {"--Xewp-max-get-node-data"},
paramLabel = "<INTEGER>",
description =
"Maximum request limit for Ethereum Wire Protocol GET_NODE_DATA. (default: ${DEFAULT-VALUE})")
PositiveNumber.fromInt(EthProtocolConfiguration.DEFAULT_MAX_GET_RECEIPTS);

private PositiveNumber maxGetNodeData =
PositiveNumber.fromInt(EthereumWireProtocolConfiguration.DEFAULT_MAX_GET_NODE_DATA);
PositiveNumber.fromInt(EthProtocolConfiguration.DEFAULT_MAX_GET_NODE_DATA);

public Builder maxGetBlockHeaders(final PositiveNumber maxGetBlockHeaders) {
this.maxGetBlockHeaders = maxGetBlockHeaders;
Expand All @@ -157,8 +132,8 @@ public Builder maxGetNodeData(final PositiveNumber maxGetNodeData) {
return this;
}

public EthereumWireProtocolConfiguration build() {
return new EthereumWireProtocolConfiguration(
public EthProtocolConfiguration build() {
return new EthProtocolConfiguration(
maxGetBlockHeaders.getValue(),
maxGetBlockBodies.getValue(),
maxGetReceipts.getValue(),
Expand Down
Loading