* Metrics Service configuration incorrect
--metrics-push-enabled is not eabling metrics push and --metrics-enabled
is enabling push instead of polling.
* formatting
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
fixes NC-1737 by adding an option dependency mechanism for "enabled" options
This mechanism is aimed at preventing the use of options if the associated
service is disabled. This is not a generic system as our need is simple here.
But in future version of PicoCLI some options dependency mechanism may be
implemented that could replace this.
See https://github.com/remkop/picocli/issues/295
Our current mechanism apply to p2p, rpc (http+ws), mining, privacy and metrics.
It logs a warning wherever some options are used that require another one to be enabled.
Also renamed inconsistent isRpcHttpEnabled option variable and moved
--privacy-enabled option to be on top of other privacy options.
injects a Logger in PantheonCommand constructor to log and also provides injection capabilities for a mock in tests.
adds unit tests
updates tests logger name to TEST_LOGGER to prevent confusion with the mock
remove --max-trailing-peers after merge with master where it was deleted
updated rules for metrics
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Don't overload `--metrics-host` and `--metrics-port` for push mode, instead add '--metrics-push-enabled' , `--metrics-push-host` and `--metrics-push-port`, rename `--metrics-prometheus-job` to `--metrics-push-prometheus-job` and remove `--metrics-mode`
* Show an error if both metrics and metrics-push are enabled.
* Allow shutdown if we cannot communicate with the Push Gateway.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
fixed NC-2206 remove --max-trailing-peers
Replaces the option by a constant.
Removes option test.
Doc update
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* create permissioning config from toml file
* added CLI options for separately enabling node and account permissioning
* moved check for bootnodes on whitelist out of CLI
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* created fixed difficulty calculator.
* Use fixed calculator at the right spot.
* Use fixeddifficulty in the main dev.json file.
* Removed development difficulty calculators.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Messages which originate with the current node are logged in the
gossiper such that if a remote peer sends a packet which originated
from the local back to the local node, it should not go back out
again.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Messages which originate with the current node are logged in the
gossiper such that if a remote peer sends a packet which originated
from the local back to the local node, it should not go back out
again.
It was found that if a non-existent account sent a transaction via
JSON RPC - the transction would be rejected, even if the upfront cost
of the transaction was 0 (0 gasprice, and 0 value).
This was because the sender was deemed to not exist, therefore not
have the required funds.
If the tranasaction was received via block propogation, this problem
would not be hit (as the sender account would be created in the world
state prior to validating the transaction). Local/remote transactions
did not have access to the world state to do this.
MainnetTransactionValidator has been updated to allow a 'null' sender
to create a transaction if the price is zero (and the nonce is acceptable
from the standpoint of a default/initial account state).
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Separate the management of sync target and actual import from the rest of the Downloader logic in preparation for introducing a fast sync chain downloader.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
fixes NC-2120 --discovery-enabled option refactoring
now able to have --discovery-enabled option with true as default
and --discovery-enabled=true or --discovery-enabled=false on CLI
and discovery-enabled=true or discovery-enabled=false in YAML config file.
updates doc
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
fixes NC-2026 adds a `--network` option instead of separated options
Networks are now defined using a `--network` option that takes the case insensitive
name of an enum values as input : MAINNET, RINKEBY, ROPSTEN, GOERLI, DEV
These presets are a set of network-id, genesis file and boonodes list.
If the `--genesis-file` is provided with a valid JSON genesis file,
Pantheon uses it instead of the default network. An empty bootnodes list is then
the default value and network id is the chain id found in the genesis file.
`--network-id` and `--bootnodes` options can override these defaults.
You can of course also override the `--network-id` and `--bootnodes` for a
predefined known network (using `--network`).
User have no reason to set `--network` and `--genesis-file` options at the same
time that would lead to misunderstandings so we raise an error to prevent both
options to be defined at the same time on the command line.
Also fixes NC-2189 renaming --private-genesis-file to --genesis-file
Updates a lot of doc according to the options changes
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Refactoring for more readable IBFT IT
* Renaming Roles to peers
* Moving the assert behaviour into the RoundChangePeers
* Renmaing prefix of assert to verify, grammar
* Reducing usage of getAllPeers()
* Dropping the getter for the peer list
* Dropping peer from method names, as it's now in the class name
* Spotless
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
fixes NC-2104 remove Clique and iBFT defaults and centralise default values
As toString() is used to display default values in CLI description and this is
not used anywhere else for RpcApi objects, it may have been used for debug long
ago, but now we can use the simple string value as return from toString.
Then we are able to use the DEFAULT_JSON_RPC_APIS constant as default value
directly instead of hard coded defaults string in option that was probably used
because previous toString was not outputting correct representation. It may be
interesting to comment when some does this sort of hack.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Makes Synchronizer responsible for deciding if it has enough peers or not rather than ProtocolManager.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Add Privacy Cli options
* Wire up Precompiled contract configuration to Protocol Spec
* Rename createDefault to noPrivacy to indicate the defaults.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Add support for initiating fast sync to DefaultSynchronizer, starting full sync once that completes.
* Wait for a minimum number of peers to be available before starting fast sync.
* Select pivot block.
* Fetch the pivot block header.
* Ensure that a majority of peers (which have the pivot block) agree on the block.
* Pull isRetryingError and assignPeer up to AbstractRetryingPeerTask so it can be reused.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>