-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: redundant parse chainID from gensis when start server
- Loading branch information
Showing
5 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import json | ||
from pathlib import Path | ||
|
||
import pytest | ||
from pystarport import ports | ||
|
||
from .network import setup_custom_cronos | ||
from .utils import wait_for_port | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def custom_cronos(tmp_path_factory): | ||
path = tmp_path_factory.mktemp("cronos") | ||
yield from setup_custom_cronos( | ||
path, | ||
26800, | ||
Path(__file__).parent / "configs/default.jsonnet", | ||
) | ||
|
||
|
||
def test_config_client_id(custom_cronos): | ||
n0 = "cronos_777-1-node0" | ||
p0 = custom_cronos.base_port(0) | ||
w3 = custom_cronos.w3 | ||
custom_cronos.supervisorctl("stop", n0) | ||
cli = custom_cronos.cosmos_cli(0) | ||
dir = cli.data_dir / "config" | ||
|
||
def edit_gensis_cfg(chain_id): | ||
genesis_cfg = dir / "genesis.json" | ||
genesis = json.loads(genesis_cfg.read_text()) | ||
genesis["chain_id"] = chain_id | ||
genesis_cfg.write_text(json.dumps(genesis)) | ||
|
||
# start with empty chain_id from genesis should fail | ||
edit_gensis_cfg("") | ||
with pytest.raises(Exception): | ||
custom_cronos.supervisorctl("start", n0) | ||
|
||
edit_gensis_cfg("cronos_777-1") | ||
custom_cronos.supervisorctl("start", n0) | ||
wait_for_port(ports.evmrpc_port(p0)) | ||
assert w3.eth.chain_id == 777 |