diff --git a/testground/benchmark/benchmark/sendtx.py b/testground/benchmark/benchmark/sendtx.py index 24b11f8ba4..4810441f6c 100644 --- a/testground/benchmark/benchmark/sendtx.py +++ b/testground/benchmark/benchmark/sendtx.py @@ -31,16 +31,14 @@ def async_write_tx(account, tx, file_path): file.write(ujson.dumps([raw_tx.hex()])) -def get_txs_foler(outdir: Path, group, global_seq): - folder = outdir / TMP_TXS_FOLDER / group / str(global_seq) +def get_txs_foler(outdir: Path, global_seq): + folder = outdir / TMP_TXS_FOLDER / str(global_seq) folder.mkdir(parents=True, exist_ok=True) return folder -def prepare_txs( - outdir: Path, group, global_seq, num_accounts, num_txs, max_workers=8000 -): - folder = get_txs_foler(outdir, group, global_seq) +def prepare_txs(outdir: Path, global_seq, num_accounts, num_txs, max_workers=8000): + folder = get_txs_foler(outdir, global_seq) accounts = [gen_account(global_seq, i + 1) for i in range(num_accounts)] with ThreadPoolExecutor(max_workers=max_workers) as executor: futs = [] @@ -60,12 +58,12 @@ def prepare_txs( fut.result() except Exception as e: print("sign_transaction failed", e) - print(f"prepared {len(futs)} txs for {group} {global_seq}") + print(f"prepared {len(futs)} txs for {global_seq}") -def read_txs(outdir: Path, group, global_seq): +def read_txs(outdir: Path, global_seq): txs = [] - folder = get_txs_foler(outdir, group, global_seq) + folder = get_txs_foler(outdir, global_seq) for file in folder.glob("*.json"): with open(file, "r") as f: tx_data = ujson.load(f) diff --git a/testground/benchmark/benchmark/stateless.py b/testground/benchmark/benchmark/stateless.py index e3563f393a..dbeffef7d0 100644 --- a/testground/benchmark/benchmark/stateless.py +++ b/testground/benchmark/benchmark/stateless.py @@ -182,14 +182,10 @@ def _gen_txs( for i in range(validators): global_seq = i if validator_generate_load: - prepare_txs( - outdir, VALIDATOR_GROUP, global_seq, num_accounts, num_txs, max_workers - ) + prepare_txs(outdir, global_seq, num_accounts, num_txs, max_workers) for i in range(fullnodes): global_seq = i + validators - prepare_txs( - outdir, FULLNODE_GROUP, global_seq, num_accounts, num_txs, max_workers - ) + prepare_txs(outdir, global_seq, num_accounts, num_txs, max_workers) @cli.command() @@ -253,8 +249,8 @@ def do_run( txs = [] if group == FULLNODE_GROUP or cfg.get("validator-generate-load", True): print("preparing", cfg["num_accounts"] * cfg["num_txs"], "txs") - prepare_txs(outdir, group, global_seq, cfg["num_accounts"], cfg["num_txs"]) - txs = read_txs(outdir, group, global_seq) + prepare_txs(outdir, global_seq, cfg["num_accounts"], cfg["num_txs"]) + txs = read_txs(outdir, global_seq) else: txs = [] print(f"loaded {len(txs)} txs") @@ -374,7 +370,7 @@ def init_node_local( num_accounts=num_accounts, ) if group == FULLNODE_GROUP or validator_generate_load: - prepare_txs(outdir, group, global_seq, num_accounts, num_txs) + prepare_txs(outdir, global_seq, num_accounts, num_txs) return packet