Skip to content

Commit

Permalink
Updated docs for adding a new node into existing network (#510)
Browse files Browse the repository at this point in the history
Updated docs and tests
- Updated docs for adding a new node into existing network
- Updated versions of changed modules in 1.2.0
- Updated upgrade test
  • Loading branch information
ashcherbakov committed Aug 16, 2023
1 parent ffe1052 commit 964ff03
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 39 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ func New(
)

app.UpgradeKeeper.SetUpgradeHandler(
"v1.2.0",
"v1.2",
func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return make(module.VersionMap), nil
},
Expand Down
88 changes: 56 additions & 32 deletions docs/advanced/running-node-in-existing-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,46 +33,69 @@ Possible options when adding Validator, Observer, Sentry or Seed nodes to existi
> - Do not forget to check firewall and security settings
> - We do not recommend enabling state sync for `Validator Nodes` for security reasons
- Steps:
- Init node:

```bash
./dcld init "<node-name>" --chain-id "<chain-id>"
```

- Enable state sync in config `$HOME/.dcl/config/config.toml`:
- Steps:
- Init node:

```toml
[statesync]
enable = true

# RPC servers (comma-separated) for light client verification of the synced state machine and
# retrieval of state data for node bootstrapping. Also needs a trusted height and corresponding
# header hash obtained from a trusted source, and a period during which validators can be trusted.
#
# For Cosmos SDK-based chains, trust_period should usually be about 2/3 of the unbonding time (~2
# weeks) during which they can be financially punished (slashed) for misbehavior.
```bash
./dcld init "<node-name>" --chain-id "<chain-id>"
```

rpc_servers = "http(s)://<host>:<port>,http(s)://<host>:<port>"
trust_height = <trust-height>
trust_hash = "<trust-hash>"
trust_period = "168h0m0s"
```
- Enable state sync in config `$HOME/.dcl/config/config.toml`:

> **_NOTE:_** You should provide at least 2 addresses for `rpc_servers`. It can be 2 identical addresses
```toml
[statesync]
enable = true

# RPC servers (comma-separated) for light client verification of the synced state machine and
# retrieval of state data for node bootstrapping. Also needs a trusted height and corresponding
# header hash obtained from a trusted source, and a period during which validators can be trusted.
#
# For Cosmos SDK-based chains, trust_period should usually be about 2/3 of the unbonding time (~2
# weeks) during which they can be financially punished (slashed) for misbehavior.

rpc_servers = "http(s)://<host>:<port>,http(s)://<host>:<port>"
trust_height = <trust-height>
trust_hash = "<trust-hash>"
trust_period = "168h0m0s"
```

You can use the following command to obtain `<trust-height>` and `<trust-hash>` of your network
> **_NOTE:_** You should provide at least 2 addresses for `rpc_servers`. It can be 2 identical addresses
```bash
curl -s http(s)://<host>:<port>/commit | jq "{height: .result.signed_header.header.height, hash: .result.signed_header.commit.block_id.hash}"
```
You can use the following command to obtain `<trust-height>` and `<trust-hash>` of your network

- `<host>` - RPC endpoint host of the network being joined
- `<port>` - RPC endpoint port of the network being joined
```bash
curl -s http(s)://<host>:<port>/commit | jq "{height: .result.signed_header.header.height, hash: .result.signed_header.commit.block_id.hash}"
```

- Run the new node (refer to [running-node.md](../running-node.md) for node specific instructions)
- `<host>` - RPC endpoint host of the network being joined
- `<port>` - RPC endpoint port of the network being joined

<details>
<summary>Example for Testnet 2.0 (clickable) </summary>
```yaml
config:
statesync:
enable: true
rpc_servers: "https://on.test-net.dcl.csa-iot.org:26657,https://on.test-net.dcl.csa-iot.org:26657"
```
</details>
<details>
<summary>Example for Mainnet (clickable) </summary>
```yaml
config:
statesync:
enable: true
rpc_servers: "https://on.dcl.csa-iot.org:26657,https://on.dcl.csa-iot.org:26657"
```
</details>

- Run the new node (refer to [running-node.md](../running-node.md) for node specific instructions)

> **_NOTE:_** State sync is not attempted if the node has any local state (LastBlockHeight > 0)
> **_NOTE:_** State sync is not attempted if the node has any local state (LastBlockHeight > 0)
- Pros:
- No manual activities are needed (except configuring `$HOME/.dcl/config/config.toml`)
Expand Down Expand Up @@ -109,6 +132,7 @@ Possible options when adding Validator, Observer, Sentry or Seed nodes to existi
- All binary versions used for upgrading (using `cosmovisor`) existing network up to current state must be available
- Steps:
- Add a node with a binary version as was at the genesis state
- For Main Net: please use [0.12.1](https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/tag/v0.12.1) as a start version.
- Let the nodes catch-up and play all updates/migrations

- Pros:
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/upgrade/add-new-node-after-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ localnet_dir=".localnet"
dcl_user_home="/var/lib/dcl"
DCL_DIR="$dcl_user_home/.dcl"
mainnet_stable_version="0.12.1"
latest_release_binary_version="1.2.0"
latest_release_binary_version="1.2.2-pre"

node_name="new-observer"
node_p2p_port=26670
Expand Down
6 changes: 3 additions & 3 deletions integration_tests/upgrade/test-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ trustee_account_2="alice"
trustee_account_3="bob"
vendor_account="vendor_account"

plan_name="v1.2.0"
binary_version="v1.2.0"
upgrade_checksum="sha256:bceea1cf60260e870001bf958ec7b52d694050d53184c23f13314f3930070df3"
plan_name="v1.2"
binary_version="v1.2.2-pre"
upgrade_checksum="sha256:d1634c52c1fcc7eb529a51c41f626d9183690a18951c27756ac794a32be6526a"
vid=1
pid_1=1
pid_2=2
Expand Down
2 changes: 1 addition & 1 deletion x/compliance/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
}

// ConsensusVersion implements ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 1 }
func (AppModule) ConsensusVersion() uint64 { return 2 }

// BeginBlock executes all ABCI BeginBlock logic respective to the capability module.
func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {}
Expand Down
2 changes: 1 addition & 1 deletion x/model/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
}

// ConsensusVersion implements ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 1 }
func (AppModule) ConsensusVersion() uint64 { return 2 }

// BeginBlock executes all ABCI BeginBlock logic respective to the capability module.
func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {}
Expand Down

0 comments on commit 964ff03

Please sign in to comment.