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

Nc 2026 network option #645

Merged

Conversation

NicolasMassart
Copy link
Contributor

@NicolasMassart NicolasMassart commented Jan 23, 2019

PR description

Enable a new way to define known network usage with a --network option.

It removes the use of --ropsten --rinkeby --goerli --ottoman and --dev-mode options.

--network option 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).

Also fixes NC-2189 renaming --private-genesis-file to --genesis-file

Updated a lot of doc according to all these changes

This PR depends on #635 to be merged first as it includes some changes merged from this PR -> blocked label added on this PR. PR merged and closed.

Fixed Issue(s)

fixes NC-2026
fixes NC-2029
fixes NC-2189

As toString() is used to display default values in CLI description and this is
not used anywhere else for RpcApi objects, it may have benn 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.
…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 benn 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.
Networks are now defined using a `--network` option that takes the cas insensitive
name of an enum values as input :   MAINNET, OTTOMAN, RINKEBY, ROPSTEN, GOERLI, DEV

These presets are a set of network-id, genesis file and boonodes list.

If the `--private-genesis-file` is provided with a valid JSON genesis file,
Pantheon consider that none of these predefined networks are used and requires
user to also set the `--network-id` and `--bootnodes` options.

However you can also just override the `--network-id` and `--bootnodes` for
a predefined network without having to provide a genesis file.
@NicolasMassart NicolasMassart added blocked Blocked by other issues documentation Related to any type of documentation api Related to public APIs labels Jan 23, 2019
@NicolasMassart NicolasMassart self-assigned this Jan 23, 2019
Copy link
Contributor

@shemnon shemnon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have to start using --network-id with external genesis files? Why can't we default to the chainId value in the genesis.json? {"config":{"chainId":42}} . I like that we have an override but except in a few cases networkId == chainId.

# Conflicts:
#	docs/Reference/Pantheon-CLI-Syntax.md
#	pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
#	pantheon/src/test/resources/everything_config.toml
Networks are now defined using a `--network` option that takes the cas 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`).

Also fixes NC-2189 renaming --private-genesis-file to --genesis-file

Updated a lot of doc according to the options changes
…2026_network_option

# Conflicts:
#	docs/Reference/Pantheon-CLI-Syntax.md
@NicolasMassart NicolasMassart removed the blocked Blocked by other issues label Jan 24, 2019
Copy link
Contributor

@MadelineMurray MadelineMurray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

docs/Configuring-Pantheon/NetworkID-And-ChainID.md Outdated Show resolved Hide resolved
docs/Configuring-Pantheon/NetworkID-And-ChainID.md Outdated Show resolved Hide resolved
docs/Getting-Started/Starting-Pantheon.md Outdated Show resolved Hide resolved
docs/Getting-Started/Starting-Pantheon.md Show resolved Hide resolved
docs/Getting-Started/Starting-Pantheon.md Outdated Show resolved Hide resolved
docs/Reference/Pantheon-CLI-Syntax.md Outdated Show resolved Hide resolved
docs/Reference/Pantheon-CLI-Syntax.md Outdated Show resolved Hide resolved
docs/Reference/Pantheon-CLI-Syntax.md Outdated Show resolved Hide resolved
docs/Reference/Pantheon-CLI-Syntax.md Outdated Show resolved Hide resolved
docs/Reference/Pantheon-CLI-Syntax.md Outdated Show resolved Hide resolved
Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I still don't think that specifying a custom genesis file should affect network ID and bootnodes - it's just surprising behaviour for users, but I think that can be a follow up discussion as it's not hard to change back if we want. Worth moving forward in the mean time.

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 review feedbacks comments for the PR.
@NicolasMassart NicolasMassart merged commit ae06077 into PegaSysEng:master Jan 25, 2019
rain-on pushed a commit to rain-on/pantheon that referenced this pull request Jan 29, 2019
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
@NicolasMassart NicolasMassart deleted the NC-2026_network_option branch January 30, 2019 16:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api Related to public APIs documentation Related to any type of documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants