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: #254

Solution:
- merge empty topics fix
- add integration tests to verify
  • Loading branch information
yihuang committed Dec 14, 2021
1 parent 087d3cd commit 36d6972
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 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/crypto-org-chain/ethermint v0.7.2-cronos-5
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
6 changes: 3 additions & 3 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"
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"
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 36d6972

Please sign in to comment.