From 0f2262e7809e5f40cd490e84e809a7f326cb891b Mon Sep 17 00:00:00 2001 From: HuangYi Date: Tue, 14 Dec 2021 15:25:25 +0800 Subject: [PATCH] Problem: empty topics in rpc response is not tested backport: https://github.com/crypto-org-chain/cronos/pull/254 Solution: - merge empty topics fix - add integration tests to verify Update integration_tests/shell.nix --- go.mod | 2 +- go.sum | 4 ++-- gomod2nix.toml | 6 +++--- .../contracts/contracts/TestERC20Utility.sol | 5 +++++ integration_tests/test_basic.py | 20 +++++++++++++++++++ 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 660aa80986..c3afa2adb4 100644 --- a/go.mod +++ b/go.mod @@ -164,4 +164,4 @@ replace github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethere // TODO: remove when ibc-go and ethermint upgrades cosmos-sdk replace github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.44.2 -replace github.com/tharsis/ethermint => github.com/crypto-org-chain/ethermint v0.7.2-cronos-4 +replace github.com/tharsis/ethermint => github.com/crypto-org-chain/ethermint v0.7.2-cronos-5 diff --git a/go.sum b/go.sum index f5d74f4616..743eae32e2 100644 --- a/go.sum +++ b/go.sum @@ -261,8 +261,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/crypto-org-chain/ethermint v0.7.2-cronos-4 h1:NaCc0L5zN2u7B9WofmhJfur23UDebWSRD+Goqf9URnY= -github.com/crypto-org-chain/ethermint v0.7.2-cronos-4/go.mod h1:J96LX4KvLyl+5jV6+mt/4l6srtGX/mdDTuqQQuYrdDk= +github.com/crypto-org-chain/ethermint v0.7.2-cronos-5 h1:pNlajIJZkBxMNIvKeNys2lPSRupz6kANMsA4BZvObMk= +github.com/crypto-org-chain/ethermint v0.7.2-cronos-5/go.mod h1:J96LX4KvLyl+5jV6+mt/4l6srtGX/mdDTuqQQuYrdDk= github.com/crypto-org-chain/go-ethereum v1.10.3-patched h1:kr6oQIYOi2VC8SZwkhlUDZE1Omit/YHVysKMgCB2nes= github.com/crypto-org-chain/go-ethereum v1.10.3-patched/go.mod h1:99onQmSd1GRGOziyGldI41YQb7EESX3Q4H41IfJgIQQ= github.com/crypto-org-chain/ibc-go v1.2.1-hooks h1:wuWaQqm/TFKJQwuFgjCPiPumQio+Yik5Z1DObDExrrU= diff --git a/gomod2nix.toml b/gomod2nix.toml index 2c93adee02..0b7e0cb6ea 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -4637,13 +4637,13 @@ sha256 = "1kmdk3v2a6ygcg2i8jfgz61yzxi4183xgzlaviq9jwsqwc2hj60w" ["github.com/tharsis/ethermint"] - sumVersion = "v0.7.2-cronos-4" + sumVersion = "v0.7.2-cronos-5" vendorPath = "github.com/crypto-org-chain/ethermint" ["github.com/tharsis/ethermint".fetch] type = "git" url = "https://github.com/crypto-org-chain/ethermint" - rev = "82805507f7d2e83cad547736883dc22acfb52440" - sha256 = "01f9i8vq0jqml676wvh0kr9kxg7grqw7f64g1qd81pzm2n89k7pn" + rev = "6defb508eabee4d7866da6858dc9fe0a5c82a33a" + sha256 = "01rl5q6wxv0blil4bzz023g9pyp15dbz57b68f9zp3jv0c0a89ad" ["github.com/tidwall/gjson"] sumVersion = "v1.6.7" diff --git a/integration_tests/contracts/contracts/TestERC20Utility.sol b/integration_tests/contracts/contracts/TestERC20Utility.sol index 29e9f436dc..e81fcca8ae 100644 --- a/integration_tests/contracts/contracts/TestERC20Utility.sol +++ b/integration_tests/contracts/contracts/TestERC20Utility.sol @@ -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)); + } } diff --git a/integration_tests/test_basic.py b/integration_tests/test_basic.py index bf7edb0cbd..17655052a5 100644 --- a/integration_tests/test_basic.py +++ b/integration_tests/test_basic.py @@ -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" + )