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
backport: crypto-org-chain#254

Solution:
- merge empty topics fix
- add integration tests to verify
  • Loading branch information
yihuang committed Dec 14, 2021
1 parent 087d3cd commit 64c767d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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/yihuang/ethermint v0.6.1-0.20211214073201-9fe3fe860947
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,6 @@ 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/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=
Expand Down Expand Up @@ -1208,6 +1206,8 @@ github.com/xtaci/kcp-go v5.4.20+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae/go.mod h1:gXtu8J62kEgmN++bm9BVICuT/e8yiLI2KFobd/TRFsE=
github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE=
github.com/yeya24/promlinter v0.1.0/go.mod h1:rs5vtZzeBHqqMwXqFScncpCF6u06lezhZepno9AB1Oc=
github.com/yihuang/ethermint v0.6.1-0.20211214073201-9fe3fe860947 h1:9C+rTQeQKw89wN63UJ3L/Fl2zmEiuZsiICFEB/i82fI=
github.com/yihuang/ethermint v0.6.1-0.20211214073201-9fe3fe860947/go.mod h1:J96LX4KvLyl+5jV6+mt/4l6srtGX/mdDTuqQQuYrdDk=
github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg=
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc=
Expand Down
10 changes: 5 additions & 5 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4637,13 +4637,13 @@
sha256 = "1kmdk3v2a6ygcg2i8jfgz61yzxi4183xgzlaviq9jwsqwc2hj60w"

["github.com/tharsis/ethermint"]
sumVersion = "v0.7.2-cronos-4"
vendorPath = "github.com/crypto-org-chain/ethermint"
sumVersion = "v0.6.1-0.20211214073201-9fe3fe860947"
vendorPath = "github.com/yihuang/ethermint"
["github.com/tharsis/ethermint".fetch]
type = "git"
url = "https://github.com/crypto-org-chain/ethermint"
rev = "82805507f7d2e83cad547736883dc22acfb52440"
sha256 = "01f9i8vq0jqml676wvh0kr9kxg7grqw7f64g1qd81pzm2n89k7pn"
url = "https://github.com/yihuang/ethermint"
rev = "9fe3fe860947ec5733ffeaf822baf7c54e272f17"
sha256 = "008mh7s68491g6f9ay1axid14827w9ivm53j2asd3jnk53hxvbni"

["github.com/tidwall/gjson"]
sumVersion = "v1.6.7"
Expand Down
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));
}
}
19 changes: 19 additions & 0 deletions integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,22 @@ 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 receipt.topics == []
assert (
receipt.data
== "0x68656c6c6f20776f726c64000000000000000000000000000000000000000000"
)

0 comments on commit 64c767d

Please sign in to comment.