node: implement tendermint modes (#6241)

Co-authored-by: dongsam <dongsamb@gmail.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
This commit is contained in:
Callum Waters
2021-03-18 11:17:53 +01:00
committed by GitHub
parent 5c547137f6
commit 9f7051d38a
18 changed files with 428 additions and 150 deletions

View File

@@ -41,6 +41,19 @@ moniker = "anonymous"
# and verifying their commits
fast-sync = true
# Mode of Node: full | validator | seed
# You will need to set it to "validator" if you want to run the node as a validator
# * full node (default)
# - all reactors
# - No priv_validator_key.json, priv_validator_state.json
# * validator node
# - all reactors
# - with priv_validator_key.json, priv_validator_state.json
# * seed node
# - only P2P, PEX Reactor
# - No priv_validator_key.json, priv_validator_state.json
mode = "full"
# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb
# * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
# - pure go
@@ -242,12 +255,6 @@ recv-rate = 5120000
# Set true to enable the peer-exchange reactor
pex = true
# Seed mode, in which node constantly crawls the network and looks for
# peers. If another node asks it for addresses, it responds and disconnects.
#
# Does not work if the peer-exchange reactor is disabled.
seed-mode = false
# Comma separated list of peer IDs to keep private (will not be gossiped to other peers)
private-peer-ids = ""
@@ -494,5 +501,4 @@ This section will cover settings within the p2p section of the `config.toml`.
- `max-num-outbound-peers` = is the maximum number of peers you will initiate outbound connects to at one time (where you dial their address and initiate the connection).
- `unconditional-peer-ids` = is similar to `persistent-peers` except that these peers will be connected to even if you are already connected to the maximum number of peers. This can be a validator node ID on your sentry node.
- `pex` = turns the peer exchange reactor on or off. Validator node will want the `pex` turned off so it would not begin gossiping to unknown peers on the network. PeX can also be turned off for statically configured networks with fixed network connectivity. For full nodes on open, dynamic networks, it should be turned on.
- `seed-mode` = is used for when node operators want to run their node as a seed node. Seed node's run a variation of the PeX protocol that disconnects from peers after sending them a list of peers to connect to. To minimize the servers usage, it is recommended to set the mempool's size to 0.
- `private-peer-ids` = is a comma-separated list of node ids that will _not_ be exposed to other peers (i.e., you will not tell other peers about the ids in this list). This can be filled with a validator's node id.

View File

@@ -56,6 +56,7 @@ The validator will only talk to the sentry that are provided, the sentry nodes w
When initializing nodes there are five parameters in the `config.toml` that may need to be altered.
- `mode:` (full | validator | seed) Mode of node (default: 'full'). If you want to run the node as validator, change it to 'validator'.
- `pex:` boolean. This turns the peer exchange reactor on or off for a node. When `pex=false`, only the `persistent-peers` list is available for connection.
- `persistent-peers:` a comma separated list of `nodeID@ip:port` values that define a list of peers that are expected to be online at all times. This is necessary at first startup because by setting `pex=false` the node will not be able to join the network.
- `unconditional-peer-ids:` comma separated list of nodeID's. These nodes will be connected to no matter the limits of inbound and outbound peers. This is useful for when sentry nodes have full address books.
@@ -67,6 +68,7 @@ When initializing nodes there are five parameters in the `config.toml` that may
| Config Option | Setting |
| ------------------------ | -------------------------- |
| mode | validator |
| pex | false |
| persistent-peers | list of sentry nodes |
| private-peer-ids | none |
@@ -74,12 +76,13 @@ When initializing nodes there are five parameters in the `config.toml` that may
| addr-book-strict | false |
| double-sign-check-height | 10 |
The validator node should have `pex=false` so it does not gossip to the entire network. The persistent peers will be your sentry nodes. Private peers can be left empty as the validator is not trying to hide who it is communicating with. Setting unconditional peers is optional for a validator because they will not have a full address books.
To run the node as validator ensure `mode=validator`. The validator node should have `pex=false` so it does not gossip to the entire network. The persistent peers will be your sentry nodes. Private peers can be left empty as the validator is not trying to hide who it is communicating with. Setting unconditional peers is optional for a validator because they will not have a full address books.
#### Sentry Node Configuration
| Config Option | Setting |
| ---------------------- | --------------------------------------------- |
| mode | full |
| pex | true |
| persistent-peers | validator node, optionally other sentry nodes |
| private-peer-ids | validator node ID |