From 16630359800e76cfeef522a9e1e8b3270caf26b1 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Mon, 21 Oct 2024 11:48:10 +0800 Subject: [PATCH 1/2] Problem: benchmark txs have unexpected conflicts Solution: - use different recipient addresses --- CHANGELOG.md | 1 + testground/benchmark/benchmark/transaction.py | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b7e879b86..db958bd824 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * (testground)[1649](https://github.com/crypto-org-chain/cronos/pull/1649) Fix running single validator benchmark locally. * (cli)[#1647](https://github.com/crypto-org-chain/cronos/pull/1647) Fix node can't shutdown by signal. +* (testground)[#]() Remove unexpected conflicts in benchmark transactions. ### Improvements diff --git a/testground/benchmark/benchmark/transaction.py b/testground/benchmark/benchmark/transaction.py index 291fb84389..5ef86bedfc 100644 --- a/testground/benchmark/benchmark/transaction.py +++ b/testground/benchmark/benchmark/transaction.py @@ -20,12 +20,11 @@ CHAIN_ID = 777 CONNECTION_POOL_SIZE = 1024 TXS_DIR = "txs" -RECIPIENT = "0x1" + "0" * 39 -def simple_transfer_tx(nonce: int): +def simple_transfer_tx(sender: str, nonce: int): return { - "to": RECIPIENT, + "to": sender, "value": 1, "nonce": nonce, "gas": 21000, @@ -34,9 +33,9 @@ def simple_transfer_tx(nonce: int): } -def erc20_transfer_tx(nonce: int): +def erc20_transfer_tx(sender: str, nonce: int): # data is erc20 transfer function call - data = "0xa9059cbb" + eth_abi.encode(["address", "uint256"], [RECIPIENT, 1]).hex() + data = "0xa9059cbb" + eth_abi.encode(["address", "uint256"], [sender, 1]).hex() return { "to": CONTRACT_ADDRESS, "value": 0, @@ -68,7 +67,7 @@ def _do_job(job: Job): for acct in accounts: txs = [] for i in range(job.num_txs): - tx = job.create_tx(i) + tx = job.create_tx(acct.address, i) raw = acct.sign_transaction(tx).rawTransaction txs.append(EthTx(tx, raw, HexBytes(acct.address))) total += 1 From a9a1eb3c5ebd108fd695cf51c465bc1c11dbd9bd Mon Sep 17 00:00:00 2001 From: yihuang Date: Mon, 21 Oct 2024 12:01:21 +0800 Subject: [PATCH 2/2] Update CHANGELOG.md Signed-off-by: yihuang --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db958bd824..94f55c8c26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ * (testground)[1649](https://github.com/crypto-org-chain/cronos/pull/1649) Fix running single validator benchmark locally. * (cli)[#1647](https://github.com/crypto-org-chain/cronos/pull/1647) Fix node can't shutdown by signal. -* (testground)[#]() Remove unexpected conflicts in benchmark transactions. +* (testground)[#1652](https://github.com/crypto-org-chain/cronos/pull/1652) Remove unexpected conflicts in benchmark transactions. ### Improvements