Skip to content

Commit

Permalink
Support config to patch config.toml for each validator (#19)
Browse files Browse the repository at this point in the history
* Support config to patch config.toml for each validator

* add an entry in CHANGELOG.md
  • Loading branch information
allthatjazzleo authored Jul 19, 2021
1 parent 721bd70 commit 3a21f58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- [13](https://github.com/crypto-com/pystarport/issues/13) Support configure start command flags
- [19](https://github.com/crypto-com/pystarport/issues/19) Support `config` to patch `config.toml` for each validator

*Jul 6, 2021*

Expand Down
6 changes: 4 additions & 2 deletions pystarport/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def custom_edit_tm(doc):
home / "config/config.toml",
base_port,
node0["p2p"]["persistent_peers"],
{},
custom_edit=custom_edit_tm,
)
edit_app_cfg(home / "config/app.toml", base_port, {})
Expand Down Expand Up @@ -835,7 +836,7 @@ def create_account(cli, account, use_ledger=False):
]
)
for i, val in enumerate(config["validators"]):
edit_tm_cfg(data_dir / f"node{i}/config/config.toml", val["base_port"], peers)
edit_tm_cfg(data_dir / f"node{i}/config/config.toml", val["base_port"], peers, val.get("config", {}))
edit_app_cfg(
data_dir / f"node{i}/config/app.toml",
val["base_port"],
Expand Down Expand Up @@ -1019,7 +1020,7 @@ def docker_compose_yml(cmd, validators, data_dir, image):
}


def edit_tm_cfg(path, base_port, peers, *, custom_edit=None):
def edit_tm_cfg(path, base_port, peers, config, *, custom_edit=None):
doc = tomlkit.parse(open(path).read())
# tendermint is start in process, not needed
# doc['proxy_app'] = 'tcp://127.0.0.1:%d' % abci_port(base_port)
Expand All @@ -1032,6 +1033,7 @@ def edit_tm_cfg(path, base_port, peers, *, custom_edit=None):
doc["p2p"]["allow_duplicate_ip"] = True
doc["consensus"]["timeout_commit"] = "1s"
doc["rpc"]["timeout_broadcast_tx_commit"] = "30s"
patch_toml_doc(doc, config)
if custom_edit is not None:
custom_edit(doc)
open(path, "w").write(tomlkit.dumps(doc))
Expand Down

0 comments on commit 3a21f58

Please sign in to comment.