From 77bdcee90132a2edfb9c2113a755cbdae2e266f6 Mon Sep 17 00:00:00 2001 From: allthatjazzleo Date: Sat, 17 Jul 2021 23:09:17 +0800 Subject: [PATCH 1/2] Support config to patch config.toml for each validator --- pystarport/cluster.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pystarport/cluster.py b/pystarport/cluster.py index 05e2ac6..b86220d 100644 --- a/pystarport/cluster.py +++ b/pystarport/cluster.py @@ -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, {}) @@ -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"], @@ -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) @@ -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)) From 72a4b1d6aa6cbdd108cf6d0d3ec211453a771217 Mon Sep 17 00:00:00 2001 From: allthatjazzleo Date: Sun, 18 Jul 2021 23:26:52 +0800 Subject: [PATCH 2/2] add an entry in CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 864a14c..f975240 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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*