Skip to content

Commit

Permalink
Problem: empty topics in rpc response is not tested
Browse files Browse the repository at this point in the history
Closes: #841

Solution:
- merge empty topics fix
- add integration tests to verify
  • Loading branch information
yihuang committed Jan 4, 2022
1 parent 399a38c commit 4fed105
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions integration_tests/contracts/contracts/TestERC20Utility.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ contract TestERC20Utility is ERC20 {
_burn(msg.sender, total);
emit __CronosSendToEthereum(recipient, amount, bridge_fee);
}

function test_log0() public {
bytes32 data = "hello world";
log0(bytes32(data));
}
}
20 changes: 20 additions & 0 deletions integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,3 +427,23 @@ def test_message_call(cronos):
assert 23828976 == receipt.cumulativeGasUsed
assert receipt.status == 1, "shouldn't fail"
assert len(receipt.logs) == iterations


def test_log0(cluster):
"""
test compliance of empty topics behavior
"""
w3 = cluster.w3
contract = deploy_contract(
w3,
Path(__file__).parent
/ "contracts/artifacts/contracts/TestERC20Utility.sol/TestERC20Utility.json",
)
tx = contract.functions.test_log0().buildTransaction({"from": ADDRS["validator"]})
receipt = send_transaction(w3, tx, KEYS["validator"])
assert len(receipt.logs) == 1
log = receipt.logs[0]
assert log.topics == []
assert (
log.data == "0x68656c6c6f20776f726c64000000000000000000000000000000000000000000"
)

0 comments on commit 4fed105

Please sign in to comment.