Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Dec 17, 2024
1 parent 2f84790 commit b1d4f8f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/integration_tests/test_batch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

from .utils import ADDRS, CONTRACTS, build_batch_tx, contract_address
from .utils import ADDRS, CONTRACTS, build_batch_tx, contract_address, build_batch_tx_signed, sign_transaction


def test_batch_tx(ethermint):
Expand All @@ -25,8 +25,12 @@ def test_batch_tx(ethermint):
{"from": sender, "nonce": nonce+1, "gas": 200000}
)

cosmos_tx, tx_hashes = build_batch_tx(
w3, cli, [deploy_tx, transfer_tx1, transfer_tx2]
cosmos_tx, tx_hashes = build_batch_tx_signed(
w3, cli, [
sign_transaction(w3, deploy_tx, KEYS["validator"]),
sign_transaction(w3, transfer_tx1, KEYS["signer1"]),
sign_transaction(w3, transfer_tx2, KEYS['signer1']),
]
)
rsp = cli.broadcast_tx_json(cosmos_tx)
assert rsp["code"] == 0, rsp["raw_log"]
Expand Down
4 changes: 4 additions & 0 deletions tests/integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ def modify_command_in_supervisor_config(ini: Path, fn, **kwargs):
def build_batch_tx(w3, cli, txs, key=KEYS["validator"]):
"return cosmos batch tx and eth tx hashes"
signed_txs = [sign_transaction(w3, tx, key) for tx in txs]
return build_batch_tx_signed(w3, cli, signed_txs)


def build_batch_tx_signed(w3, cli, signed_txs):
tmp_txs = [cli.build_evm_tx(signed.rawTransaction.hex()) for signed in signed_txs]

msgs = [tx["body"]["messages"][0] for tx in tmp_txs]
Expand Down

0 comments on commit b1d4f8f

Please sign in to comment.