Skip to content

Commit

Permalink
Problem: empty topics in rpc response is not tested (#255)
Browse files Browse the repository at this point in the history
backport: #254

Solution:
- merge empty topics fix
- add integration tests to verify

Update integration_tests/shell.nix
  • Loading branch information
yihuang authored Dec 21, 2021
1 parent 150ef23 commit fb7db2e
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 @@ -218,3 +218,23 @@ def test_statesync(cronos):
)

print("succesfully syncing")


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 fb7db2e

Please sign in to comment.