Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: benchmark txs have unexpected conflicts #1652

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)[#1652](https://github.com/crypto-org-chain/cronos/pull/1652) Remove unexpected conflicts in benchmark transactions.

### Improvements

Expand Down
11 changes: 5 additions & 6 deletions testground/benchmark/benchmark/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down
Loading