diff --git a/testground/benchmark/benchmark/peer.py b/testground/benchmark/benchmark/peer.py index b9d8ce6f7e..8b480408ef 100644 --- a/testground/benchmark/benchmark/peer.py +++ b/testground/benchmark/benchmark/peer.py @@ -47,7 +47,7 @@ def bootstrap(ctx: Context, cli) -> PeerPacket: cli("genesis", "validate", home=home) p2p_peers = connect_all(peer, peers) - patch_configs(home, ctx.params.test_group_id, p2p_peers, "block-stm") + patch_configs(home, p2p_peers, {}, {}) return peer @@ -116,30 +116,32 @@ def gen_genesis(cli: ChainCommand, leader_home: Path, peers: List[PeerPacket]): ) -def patch_configs(home: Path, group: str, peers: str, block_executor: str): - # update persistent_peers and other configs in config.toml - config_patch = { +def patch_configs(home: Path, peers: str, config_patch: dict, app_patch: dict): + default_config_patch = { "db_backend": "rocksdb", - "p2p.persistent_peers": peers, "p2p.addr_book_strict": False, - "mempool.recheck": "false", + "mempool.recheck": False, "mempool.size": MEMPOOL_SIZE, "consensus.timeout_commit": "1s", "tx_index.indexer": "null", } - - app_patch = { + default_app_patch = { "minimum-gas-prices": "0basecro", "index-events": ["ethereum_tx.ethereumTxHash"], "memiavl.enable": True, "mempool.max-txs": MEMPOOL_SIZE, - "evm.block-executor": block_executor, + "evm.block-executor": "block-stm", # or "sequential" + "evm.block-stm-workers": 0, "evm.block-stm-pre-estimate": True, "json-rpc.enable-indexer": True, } - if block_executor == "block-stm": - app_patch["memiavl.cache-size"] = 0 - + # update persistent_peers and other configs in config.toml + config_patch = { + **default_config_patch, + **config_patch, + "p2p.persistent_peers": peers, + } + app_patch = {**default_app_patch, **app_patch} patch_toml(home / "config" / "config.toml", config_patch) patch_toml(home / "config" / "app.toml", app_patch) diff --git a/testground/benchmark/benchmark/stateless.py b/testground/benchmark/benchmark/stateless.py index 498d5e5309..5885c14a50 100644 --- a/testground/benchmark/benchmark/stateless.py +++ b/testground/benchmark/benchmark/stateless.py @@ -47,7 +47,8 @@ def gen( hostname_template=HOSTNAME_TEMPLATE, num_accounts=10, num_txs=1000, - block_executor="block-stm", # or "sequential" + config_patch={}, + app_patch={}, ): outdir = Path(outdir) cli = ChainCommand(LOCAL_CRONOSD_PATH) @@ -72,7 +73,7 @@ def gen( # write genesis file and patch config files for i in range(validators): patch_configs_local( - peers, genesis, outdir, VALIDATOR_GROUP, i, i, block_executor + peers, genesis, outdir, VALIDATOR_GROUP, i, config_patch, app_patch ) for i in range(fullnodes): patch_configs_local( @@ -81,8 +82,8 @@ def gen( outdir, FULLNODE_GROUP, i, - i + validators, - block_executor, + config_patch, + app_patch, ) print("write config") @@ -272,13 +273,13 @@ def patch_configs_local( outdir: Path, group: str, i: int, - group_seq: int, - block_executor: str, + config_patch, + app_patch, ): home = outdir / group / str(i) (home / "config" / "genesis.json").write_text(json.dumps(genesis)) p2p_peers = connect_all(peers[i], peers) - patch_configs(home, group, p2p_peers, block_executor) + patch_configs(home, p2p_peers, config_patch, app_patch) def node_index() -> int: