-
Notifications
You must be signed in to change notification settings - Fork 130
[PAN-2265] Expose fast-sync options on command line #1218
[PAN-2265] Expose fast-sync options on command line #1218
Conversation
- add `--fast-sync-min-peers` hidden cli option - add `--fast-sync-max-wait-time` hidden cli option - update `FastSyncActions` to handle no timeout behaviour (when timeout set to 0 or no timeout set then we just trigger asynchrounously the waitPeersTask) - update unit tests mock related to sync config builder - add fast sync options in `everything_config.toml` - re enable `PantheonCommandTest.syncModeOptionMustBeUsed` fix PAN-2265 fixes PAN-2265
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me. Just a few changes to do. No big issues but that have to be fixed.
pantheon/src/main/java/tech/pegasys/pantheon/cli/DefaultCommandValues.java
Outdated
Show resolved
Hide resolved
pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
Outdated
Show resolved
Hide resolved
pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
Outdated
Show resolved
Hide resolved
pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
Outdated
Show resolved
Hide resolved
pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
Outdated
Show resolved
Hide resolved
pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java
Show resolved
Hide resolved
- fix coding style convention - add unit tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me if you change the two values in the tests
pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java
Outdated
Show resolved
Hide resolved
pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java
Outdated
Show resolved
Hide resolved
PR discussion
spotlessApply
...reum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActions.java
Outdated
Show resolved
Hide resolved
pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
Outdated
Show resolved
Hide resolved
pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
Outdated
Show resolved
Hide resolved
pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
Outdated
Show resolved
Hide resolved
pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java
Outdated
Show resolved
Hide resolved
pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java
Show resolved
Hide resolved
pantheon/src/main/java/tech/pegasys/pantheon/cli/DefaultCommandValues.java
Show resolved
Hide resolved
pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
Outdated
Show resolved
Hide resolved
…nd.java Co-Authored-By: abdelhamidbakhta <[email protected]>
…nd.java Co-Authored-By: abdelhamidbakhta <[email protected]>
…nd.java Co-Authored-By: abdelhamidbakhta <[email protected]>
...reum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActions.java
Outdated
Show resolved
Hide resolved
...reum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActions.java
Outdated
Show resolved
Hide resolved
pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
Outdated
Show resolved
Hide resolved
@@ -658,6 +678,19 @@ public void run() { | |||
} | |||
} | |||
|
|||
private void checkFastSyncOptions() throws ParameterException { | |||
if (fastSyncMaxWaitTime < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our parameter validation has been more just in time and directly in the configuration options rather than directly between the CLI and the config. It keeps the validations closer to where the parameters are actually stored. Validating in the CLI also provides a barrier to splitting the code apart.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A custom converter to restrict the integer to a positive non null one ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of other integers have restriction. For example metrics interval in seconds are not checked too. So what is the best practice to perform those checks ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we keep like this for this PR. We need to define a way to do this kind of checks and implement it for all options in a separate ticket imo.
pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
Outdated
Show resolved
Hide resolved
pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java
Show resolved
Hide resolved
set timeout to 5 minutes
…expose-fast-sync-opts-cli
add unit tests
PR description
add
--fast-sync-min-peers
hidden cli optionadd
--fast-sync-max-wait-time
hidden cli optionupdate
FastSyncActions
to handle no timeout behaviour (when timeout set to 0 or no timeout set then we just trigger asynchrounously the waitPeersTask)update unit tests mock related to sync config builder
add fast sync options in
everything_config.toml
re enable
PantheonCommandTest.syncModeOptionMustBeUsed
Fixed Issue(s)