Skip to content

Commit

Permalink
Problem: benchmark don't enable block-stm (#1536)
Browse files Browse the repository at this point in the history
* Problem: benchmark don't enable block-stm

Solution:
- make block-executor configurable

* Update testground/benchmark/benchmark/peer.py

Signed-off-by: yihuang <huang@crypto.com>

---------

Signed-off-by: yihuang <huang@crypto.com>
  • Loading branch information
yihuang authored Aug 2, 2024
1 parent 918fede commit b4bec82
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
5 changes: 3 additions & 2 deletions testground/benchmark/benchmark/peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
patch_configs(home, ctx.params.test_group_id, p2p_peers, "block-stm")
return peer


Expand Down Expand Up @@ -116,7 +116,7 @@ def gen_genesis(cli: ChainCommand, leader_home: Path, peers: List[PeerPacket]):
)


def patch_configs(home: Path, group: str, peers: str):
def patch_configs(home: Path, group: str, peers: str, block_executor: str):
# update persistent_peers and other configs in config.toml
config_patch = {
"p2p.persistent_peers": peers,
Expand All @@ -133,6 +133,7 @@ def patch_configs(home: Path, group: str, peers: str):
"index-events": ["ethereum_tx.ethereumTxHash"],
"memiavl.enable": True,
"mempool.max-txs": MEMPOOL_SIZE,
"evm.block-executor": block_executor,
}

patch_toml(home / "config" / "config.toml", config_patch)
Expand Down
16 changes: 13 additions & 3 deletions testground/benchmark/benchmark/stateless.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def gen(
hostname_template=HOSTNAME_TEMPLATE,
num_accounts=10,
num_txs=1000,
block_executor="block-stm", # or "sequential"
):
outdir = Path(outdir)
cli = ChainCommand(LOCAL_CRONOSD_PATH)
Expand All @@ -67,10 +68,18 @@ def gen(
print("patch genesis")
# write genesis file and patch config files
for i in range(validators):
patch_configs_local(peers, genesis, outdir, VALIDATOR_GROUP, i, i)
patch_configs_local(
peers, genesis, outdir, VALIDATOR_GROUP, i, i, block_executor
)
for i in range(fullnodes):
patch_configs_local(
peers, genesis, outdir, FULLNODE_GROUP, i, i + validators
peers,
genesis,
outdir,
FULLNODE_GROUP,
i,
i + validators,
block_executor,
)

print("write config")
Expand Down Expand Up @@ -208,11 +217,12 @@ def patch_configs_local(
group: str,
i: int,
group_seq: int,
block_executor: str,
):
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)
patch_configs(home, group, p2p_peers, block_executor)


def node_index() -> int:
Expand Down

0 comments on commit b4bec82

Please sign in to comment.