Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support config to patch config.toml for each validator #19

Merged
merged 2 commits into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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