From 2035ec159beebc761a91a7f2a02092742ca8ff4b Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 23 Jun 2023 12:05:00 +0800 Subject: [PATCH] cover all topics --- .../relayer/i_relayer_module.abigen.go | 154 +++++----- contracts/src/Relayer.sol | 18 +- .../contracts/contracts/Relayer.sol | 18 +- integration_tests/cosmoscli.py | 13 + integration_tests/ibc_utils.py | 22 +- integration_tests/test_ibc_rly.py | 279 +++++++++++------- 6 files changed, 271 insertions(+), 233 deletions(-) diff --git a/bindings/cosmos/precompile/relayer/i_relayer_module.abigen.go b/bindings/cosmos/precompile/relayer/i_relayer_module.abigen.go index bd93ed9074..44c2013ab2 100644 --- a/bindings/cosmos/precompile/relayer/i_relayer_module.abigen.go +++ b/bindings/cosmos/precompile/relayer/i_relayer_module.abigen.go @@ -43,7 +43,7 @@ type IRelayerModulePacketData struct { // RelayerModuleMetaData contains all meta data concerning the RelayerModule contract. var RelayerModuleMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"packetTimeoutHeight\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"packetTimeoutTimestamp\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"packetSequence\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetSrcPort\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetSrcChannel\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetDstPort\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetDstChannel\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetChannelOrdering\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetConnection\",\"type\":\"string\"}],\"name\":\"AcknowledgePacket\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"burner\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"name\":\"Burn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"portId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"channelId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyPortId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyChannelId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"}],\"name\":\"ChannelCloseConfirm\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"portId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"channelId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyPortId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyChannelId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"}],\"name\":\"ChannelCloseInit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"ChannelClosed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"portId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"channelId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyPortId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyChannelId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"}],\"name\":\"ChannelOpenAck\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"portId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"channelId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyPortId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyChannelId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"}],\"name\":\"ChannelOpenConfirm\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"portId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"channelId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyPortId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyChannelId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"}],\"name\":\"ChannelOpenInit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"portId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"channelId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyPortId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyChannelId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"}],\"name\":\"ChannelOpenTry\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"name\":\"CoinReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"name\":\"CoinSpent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"name\":\"Coinbase\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyClientId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyConnectionId\",\"type\":\"string\"}],\"name\":\"ConnectionOpenAck\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyClientId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyConnectionId\",\"type\":\"string\"}],\"name\":\"ConnectionOpenConfirm\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyClientId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyConnectionId\",\"type\":\"string\"}],\"name\":\"ConnectionOpenInit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyClientId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyConnectionId\",\"type\":\"string\"}],\"name\":\"ConnectionOpenTry\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientType\",\"type\":\"string\"}],\"name\":\"CreateClient\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"name\":\"DenominationTrace\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"FungibleTokenPacket\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"IbcTransfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"Message\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"sender\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"indexed\":false,\"internalType\":\"structIRelayerModule.PacketData\",\"name\":\"packetData\",\"type\":\"tuple\"}],\"name\":\"RecvPacket\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"subjectId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientType\",\"type\":\"string\"}],\"name\":\"SubmitMisbehaviour\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"refundReceiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"refundDenom\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Timeout\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"packetTimeoutHeight\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"packetTimeoutTimestamp\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"packetSequence\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetSrcPort\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetSrcChannel\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetDstPort\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetDstChannel\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetChannelOrdering\",\"type\":\"string\"}],\"name\":\"TimeoutPacket\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientType\",\"type\":\"string\"}],\"name\":\"UpdateClient\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientType\",\"type\":\"string\"}],\"name\":\"UpgradeClient\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetConnection\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"sender\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"indexed\":false,\"internalType\":\"structIRelayerModule.PacketData\",\"name\":\"packetData\",\"type\":\"tuple\"}],\"name\":\"WriteAcknowledgement\",\"type\":\"event\"}]", + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"packetSrcPort\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"packetSrcChannel\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"packetDstPort\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetDstChannel\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetChannelOrdering\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetConnection\",\"type\":\"string\"}],\"name\":\"AcknowledgePacket\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"burner\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"name\":\"Burn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"portId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"channelId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyPortId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyChannelId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"}],\"name\":\"ChannelCloseConfirm\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"portId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"channelId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyPortId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyChannelId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"}],\"name\":\"ChannelCloseInit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"ChannelClosed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"portId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"channelId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyPortId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyChannelId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"}],\"name\":\"ChannelOpenAck\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"portId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"channelId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyPortId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyChannelId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"}],\"name\":\"ChannelOpenConfirm\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"portId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"channelId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyPortId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyChannelId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"}],\"name\":\"ChannelOpenInit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"portId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"channelId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyPortId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyChannelId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"}],\"name\":\"ChannelOpenTry\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"name\":\"CoinReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"name\":\"CoinSpent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"name\":\"Coinbase\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyClientId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyConnectionId\",\"type\":\"string\"}],\"name\":\"ConnectionOpenAck\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyClientId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyConnectionId\",\"type\":\"string\"}],\"name\":\"ConnectionOpenConfirm\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyClientId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyConnectionId\",\"type\":\"string\"}],\"name\":\"ConnectionOpenInit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"connectionId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"counterpartyClientId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"counterpartyConnectionId\",\"type\":\"string\"}],\"name\":\"ConnectionOpenTry\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientType\",\"type\":\"string\"}],\"name\":\"CreateClient\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"name\":\"DenominationTrace\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"FungibleTokenPacket\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"IbcTransfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"Message\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"sender\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"indexed\":false,\"internalType\":\"structIRelayerModule.PacketData\",\"name\":\"packetData\",\"type\":\"tuple\"}],\"name\":\"RecvPacket\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"subjectId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientType\",\"type\":\"string\"}],\"name\":\"SubmitMisbehaviour\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"refundReceiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"refundDenom\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Timeout\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"packetSrcPort\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"packetSrcChannel\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"packetDstPort\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetDstChannel\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetChannelOrdering\",\"type\":\"string\"}],\"name\":\"TimeoutPacket\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientType\",\"type\":\"string\"}],\"name\":\"UpdateClient\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"clientType\",\"type\":\"string\"}],\"name\":\"UpgradeClient\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"packetConnection\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"sender\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"internalType\":\"structCosmos.Coin[]\",\"name\":\"amount\",\"type\":\"tuple[]\"}],\"indexed\":false,\"internalType\":\"structIRelayerModule.PacketData\",\"name\":\"packetData\",\"type\":\"tuple\"}],\"name\":\"WriteAcknowledgement\",\"type\":\"event\"}]", } // RelayerModuleABI is the input ABI used to generate the binding from. @@ -261,62 +261,59 @@ func (it *RelayerModuleAcknowledgePacketIterator) Close() error { // RelayerModuleAcknowledgePacket represents a AcknowledgePacket event raised by the RelayerModule contract. type RelayerModuleAcknowledgePacket struct { - PacketTimeoutHeight common.Hash - PacketTimeoutTimestamp common.Hash - PacketSequence common.Hash - PacketSrcPort string - PacketSrcChannel string - PacketDstPort string - PacketDstChannel string - PacketChannelOrdering string - PacketConnection string - Raw types.Log // Blockchain specific contextual infos -} - -// FilterAcknowledgePacket is a free log retrieval operation binding the contract event 0x6cb62951ddcddf156ec0146bf6eb3689c6bbddb3bdb82f13978c0b87055ce1f4. + PacketSrcPort common.Hash + PacketSrcChannel common.Hash + PacketDstPort common.Hash + PacketDstChannel string + PacketChannelOrdering string + PacketConnection string + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAcknowledgePacket is a free log retrieval operation binding the contract event 0xc7b594c06c08a3e531587ce7aea85dd2d77aa812e153185114587f284481ee2d. // -// Solidity: event AcknowledgePacket(string indexed packetTimeoutHeight, string indexed packetTimeoutTimestamp, string indexed packetSequence, string packetSrcPort, string packetSrcChannel, string packetDstPort, string packetDstChannel, string packetChannelOrdering, string packetConnection) -func (_RelayerModule *RelayerModuleFilterer) FilterAcknowledgePacket(opts *bind.FilterOpts, packetTimeoutHeight []string, packetTimeoutTimestamp []string, packetSequence []string) (*RelayerModuleAcknowledgePacketIterator, error) { +// Solidity: event AcknowledgePacket(string indexed packetSrcPort, string indexed packetSrcChannel, string indexed packetDstPort, string packetDstChannel, string packetChannelOrdering, string packetConnection) +func (_RelayerModule *RelayerModuleFilterer) FilterAcknowledgePacket(opts *bind.FilterOpts, packetSrcPort []string, packetSrcChannel []string, packetDstPort []string) (*RelayerModuleAcknowledgePacketIterator, error) { - var packetTimeoutHeightRule []interface{} - for _, packetTimeoutHeightItem := range packetTimeoutHeight { - packetTimeoutHeightRule = append(packetTimeoutHeightRule, packetTimeoutHeightItem) + var packetSrcPortRule []interface{} + for _, packetSrcPortItem := range packetSrcPort { + packetSrcPortRule = append(packetSrcPortRule, packetSrcPortItem) } - var packetTimeoutTimestampRule []interface{} - for _, packetTimeoutTimestampItem := range packetTimeoutTimestamp { - packetTimeoutTimestampRule = append(packetTimeoutTimestampRule, packetTimeoutTimestampItem) + var packetSrcChannelRule []interface{} + for _, packetSrcChannelItem := range packetSrcChannel { + packetSrcChannelRule = append(packetSrcChannelRule, packetSrcChannelItem) } - var packetSequenceRule []interface{} - for _, packetSequenceItem := range packetSequence { - packetSequenceRule = append(packetSequenceRule, packetSequenceItem) + var packetDstPortRule []interface{} + for _, packetDstPortItem := range packetDstPort { + packetDstPortRule = append(packetDstPortRule, packetDstPortItem) } - logs, sub, err := _RelayerModule.contract.FilterLogs(opts, "AcknowledgePacket", packetTimeoutHeightRule, packetTimeoutTimestampRule, packetSequenceRule) + logs, sub, err := _RelayerModule.contract.FilterLogs(opts, "AcknowledgePacket", packetSrcPortRule, packetSrcChannelRule, packetDstPortRule) if err != nil { return nil, err } return &RelayerModuleAcknowledgePacketIterator{contract: _RelayerModule.contract, event: "AcknowledgePacket", logs: logs, sub: sub}, nil } -// WatchAcknowledgePacket is a free log subscription operation binding the contract event 0x6cb62951ddcddf156ec0146bf6eb3689c6bbddb3bdb82f13978c0b87055ce1f4. +// WatchAcknowledgePacket is a free log subscription operation binding the contract event 0xc7b594c06c08a3e531587ce7aea85dd2d77aa812e153185114587f284481ee2d. // -// Solidity: event AcknowledgePacket(string indexed packetTimeoutHeight, string indexed packetTimeoutTimestamp, string indexed packetSequence, string packetSrcPort, string packetSrcChannel, string packetDstPort, string packetDstChannel, string packetChannelOrdering, string packetConnection) -func (_RelayerModule *RelayerModuleFilterer) WatchAcknowledgePacket(opts *bind.WatchOpts, sink chan<- *RelayerModuleAcknowledgePacket, packetTimeoutHeight []string, packetTimeoutTimestamp []string, packetSequence []string) (event.Subscription, error) { +// Solidity: event AcknowledgePacket(string indexed packetSrcPort, string indexed packetSrcChannel, string indexed packetDstPort, string packetDstChannel, string packetChannelOrdering, string packetConnection) +func (_RelayerModule *RelayerModuleFilterer) WatchAcknowledgePacket(opts *bind.WatchOpts, sink chan<- *RelayerModuleAcknowledgePacket, packetSrcPort []string, packetSrcChannel []string, packetDstPort []string) (event.Subscription, error) { - var packetTimeoutHeightRule []interface{} - for _, packetTimeoutHeightItem := range packetTimeoutHeight { - packetTimeoutHeightRule = append(packetTimeoutHeightRule, packetTimeoutHeightItem) + var packetSrcPortRule []interface{} + for _, packetSrcPortItem := range packetSrcPort { + packetSrcPortRule = append(packetSrcPortRule, packetSrcPortItem) } - var packetTimeoutTimestampRule []interface{} - for _, packetTimeoutTimestampItem := range packetTimeoutTimestamp { - packetTimeoutTimestampRule = append(packetTimeoutTimestampRule, packetTimeoutTimestampItem) + var packetSrcChannelRule []interface{} + for _, packetSrcChannelItem := range packetSrcChannel { + packetSrcChannelRule = append(packetSrcChannelRule, packetSrcChannelItem) } - var packetSequenceRule []interface{} - for _, packetSequenceItem := range packetSequence { - packetSequenceRule = append(packetSequenceRule, packetSequenceItem) + var packetDstPortRule []interface{} + for _, packetDstPortItem := range packetDstPort { + packetDstPortRule = append(packetDstPortRule, packetDstPortItem) } - logs, sub, err := _RelayerModule.contract.WatchLogs(opts, "AcknowledgePacket", packetTimeoutHeightRule, packetTimeoutTimestampRule, packetSequenceRule) + logs, sub, err := _RelayerModule.contract.WatchLogs(opts, "AcknowledgePacket", packetSrcPortRule, packetSrcChannelRule, packetDstPortRule) if err != nil { return nil, err } @@ -348,9 +345,9 @@ func (_RelayerModule *RelayerModuleFilterer) WatchAcknowledgePacket(opts *bind.W }), nil } -// ParseAcknowledgePacket is a log parse operation binding the contract event 0x6cb62951ddcddf156ec0146bf6eb3689c6bbddb3bdb82f13978c0b87055ce1f4. +// ParseAcknowledgePacket is a log parse operation binding the contract event 0xc7b594c06c08a3e531587ce7aea85dd2d77aa812e153185114587f284481ee2d. // -// Solidity: event AcknowledgePacket(string indexed packetTimeoutHeight, string indexed packetTimeoutTimestamp, string indexed packetSequence, string packetSrcPort, string packetSrcChannel, string packetDstPort, string packetDstChannel, string packetChannelOrdering, string packetConnection) +// Solidity: event AcknowledgePacket(string indexed packetSrcPort, string indexed packetSrcChannel, string indexed packetDstPort, string packetDstChannel, string packetChannelOrdering, string packetConnection) func (_RelayerModule *RelayerModuleFilterer) ParseAcknowledgePacket(log types.Log) (*RelayerModuleAcknowledgePacket, error) { event := new(RelayerModuleAcknowledgePacket) if err := _RelayerModule.contract.UnpackLog(event, "AcknowledgePacket", log); err != nil { @@ -3977,61 +3974,58 @@ func (it *RelayerModuleTimeoutPacketIterator) Close() error { // RelayerModuleTimeoutPacket represents a TimeoutPacket event raised by the RelayerModule contract. type RelayerModuleTimeoutPacket struct { - PacketTimeoutHeight common.Hash - PacketTimeoutTimestamp common.Hash - PacketSequence common.Hash - PacketSrcPort string - PacketSrcChannel string - PacketDstPort string - PacketDstChannel string - PacketChannelOrdering string - Raw types.Log // Blockchain specific contextual infos -} - -// FilterTimeoutPacket is a free log retrieval operation binding the contract event 0x14ff942c72308140b7b0ee963272c5a9b2ef3ae9f22628023393858b0b7fee04. + PacketSrcPort common.Hash + PacketSrcChannel common.Hash + PacketDstPort common.Hash + PacketDstChannel string + PacketChannelOrdering string + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTimeoutPacket is a free log retrieval operation binding the contract event 0x15785d3f86870204161ea96f3a26ee3848d7732767e6aa943ab88f45efc1cca0. // -// Solidity: event TimeoutPacket(string indexed packetTimeoutHeight, string indexed packetTimeoutTimestamp, string indexed packetSequence, string packetSrcPort, string packetSrcChannel, string packetDstPort, string packetDstChannel, string packetChannelOrdering) -func (_RelayerModule *RelayerModuleFilterer) FilterTimeoutPacket(opts *bind.FilterOpts, packetTimeoutHeight []string, packetTimeoutTimestamp []string, packetSequence []string) (*RelayerModuleTimeoutPacketIterator, error) { +// Solidity: event TimeoutPacket(string indexed packetSrcPort, string indexed packetSrcChannel, string indexed packetDstPort, string packetDstChannel, string packetChannelOrdering) +func (_RelayerModule *RelayerModuleFilterer) FilterTimeoutPacket(opts *bind.FilterOpts, packetSrcPort []string, packetSrcChannel []string, packetDstPort []string) (*RelayerModuleTimeoutPacketIterator, error) { - var packetTimeoutHeightRule []interface{} - for _, packetTimeoutHeightItem := range packetTimeoutHeight { - packetTimeoutHeightRule = append(packetTimeoutHeightRule, packetTimeoutHeightItem) + var packetSrcPortRule []interface{} + for _, packetSrcPortItem := range packetSrcPort { + packetSrcPortRule = append(packetSrcPortRule, packetSrcPortItem) } - var packetTimeoutTimestampRule []interface{} - for _, packetTimeoutTimestampItem := range packetTimeoutTimestamp { - packetTimeoutTimestampRule = append(packetTimeoutTimestampRule, packetTimeoutTimestampItem) + var packetSrcChannelRule []interface{} + for _, packetSrcChannelItem := range packetSrcChannel { + packetSrcChannelRule = append(packetSrcChannelRule, packetSrcChannelItem) } - var packetSequenceRule []interface{} - for _, packetSequenceItem := range packetSequence { - packetSequenceRule = append(packetSequenceRule, packetSequenceItem) + var packetDstPortRule []interface{} + for _, packetDstPortItem := range packetDstPort { + packetDstPortRule = append(packetDstPortRule, packetDstPortItem) } - logs, sub, err := _RelayerModule.contract.FilterLogs(opts, "TimeoutPacket", packetTimeoutHeightRule, packetTimeoutTimestampRule, packetSequenceRule) + logs, sub, err := _RelayerModule.contract.FilterLogs(opts, "TimeoutPacket", packetSrcPortRule, packetSrcChannelRule, packetDstPortRule) if err != nil { return nil, err } return &RelayerModuleTimeoutPacketIterator{contract: _RelayerModule.contract, event: "TimeoutPacket", logs: logs, sub: sub}, nil } -// WatchTimeoutPacket is a free log subscription operation binding the contract event 0x14ff942c72308140b7b0ee963272c5a9b2ef3ae9f22628023393858b0b7fee04. +// WatchTimeoutPacket is a free log subscription operation binding the contract event 0x15785d3f86870204161ea96f3a26ee3848d7732767e6aa943ab88f45efc1cca0. // -// Solidity: event TimeoutPacket(string indexed packetTimeoutHeight, string indexed packetTimeoutTimestamp, string indexed packetSequence, string packetSrcPort, string packetSrcChannel, string packetDstPort, string packetDstChannel, string packetChannelOrdering) -func (_RelayerModule *RelayerModuleFilterer) WatchTimeoutPacket(opts *bind.WatchOpts, sink chan<- *RelayerModuleTimeoutPacket, packetTimeoutHeight []string, packetTimeoutTimestamp []string, packetSequence []string) (event.Subscription, error) { +// Solidity: event TimeoutPacket(string indexed packetSrcPort, string indexed packetSrcChannel, string indexed packetDstPort, string packetDstChannel, string packetChannelOrdering) +func (_RelayerModule *RelayerModuleFilterer) WatchTimeoutPacket(opts *bind.WatchOpts, sink chan<- *RelayerModuleTimeoutPacket, packetSrcPort []string, packetSrcChannel []string, packetDstPort []string) (event.Subscription, error) { - var packetTimeoutHeightRule []interface{} - for _, packetTimeoutHeightItem := range packetTimeoutHeight { - packetTimeoutHeightRule = append(packetTimeoutHeightRule, packetTimeoutHeightItem) + var packetSrcPortRule []interface{} + for _, packetSrcPortItem := range packetSrcPort { + packetSrcPortRule = append(packetSrcPortRule, packetSrcPortItem) } - var packetTimeoutTimestampRule []interface{} - for _, packetTimeoutTimestampItem := range packetTimeoutTimestamp { - packetTimeoutTimestampRule = append(packetTimeoutTimestampRule, packetTimeoutTimestampItem) + var packetSrcChannelRule []interface{} + for _, packetSrcChannelItem := range packetSrcChannel { + packetSrcChannelRule = append(packetSrcChannelRule, packetSrcChannelItem) } - var packetSequenceRule []interface{} - for _, packetSequenceItem := range packetSequence { - packetSequenceRule = append(packetSequenceRule, packetSequenceItem) + var packetDstPortRule []interface{} + for _, packetDstPortItem := range packetDstPort { + packetDstPortRule = append(packetDstPortRule, packetDstPortItem) } - logs, sub, err := _RelayerModule.contract.WatchLogs(opts, "TimeoutPacket", packetTimeoutHeightRule, packetTimeoutTimestampRule, packetSequenceRule) + logs, sub, err := _RelayerModule.contract.WatchLogs(opts, "TimeoutPacket", packetSrcPortRule, packetSrcChannelRule, packetDstPortRule) if err != nil { return nil, err } @@ -4063,9 +4057,9 @@ func (_RelayerModule *RelayerModuleFilterer) WatchTimeoutPacket(opts *bind.Watch }), nil } -// ParseTimeoutPacket is a log parse operation binding the contract event 0x14ff942c72308140b7b0ee963272c5a9b2ef3ae9f22628023393858b0b7fee04. +// ParseTimeoutPacket is a log parse operation binding the contract event 0x15785d3f86870204161ea96f3a26ee3848d7732767e6aa943ab88f45efc1cca0. // -// Solidity: event TimeoutPacket(string indexed packetTimeoutHeight, string indexed packetTimeoutTimestamp, string indexed packetSequence, string packetSrcPort, string packetSrcChannel, string packetDstPort, string packetDstChannel, string packetChannelOrdering) +// Solidity: event TimeoutPacket(string indexed packetSrcPort, string indexed packetSrcChannel, string indexed packetDstPort, string packetDstChannel, string packetChannelOrdering) func (_RelayerModule *RelayerModuleFilterer) ParseTimeoutPacket(log types.Log) (*RelayerModuleTimeoutPacket, error) { event := new(RelayerModuleTimeoutPacket) if err := _RelayerModule.contract.UnpackLog(event, "TimeoutPacket", log); err != nil { diff --git a/contracts/src/Relayer.sol b/contracts/src/Relayer.sol index 27691ffd44..53eac97094 100644 --- a/contracts/src/Relayer.sol +++ b/contracts/src/Relayer.sol @@ -102,23 +102,17 @@ interface IRelayerModule { PacketData packetData ); event AcknowledgePacket( - string indexed packetTimeoutHeight, - string indexed packetTimeoutTimestamp, - string indexed packetSequence, - string packetSrcPort, - string packetSrcChannel, - string packetDstPort, + string indexed packetSrcPort, + string indexed packetSrcChannel, + string indexed packetDstPort, string packetDstChannel, string packetChannelOrdering, string packetConnection ); event TimeoutPacket( - string indexed packetTimeoutHeight, - string indexed packetTimeoutTimestamp, - string indexed packetSequence, - string packetSrcPort, - string packetSrcChannel, - string packetDstPort, + string indexed packetSrcPort, + string indexed packetSrcChannel, + string indexed packetDstPort, string packetDstChannel, string packetChannelOrdering ); diff --git a/integration_tests/contracts/contracts/Relayer.sol b/integration_tests/contracts/contracts/Relayer.sol index 27691ffd44..53eac97094 100644 --- a/integration_tests/contracts/contracts/Relayer.sol +++ b/integration_tests/contracts/contracts/Relayer.sol @@ -102,23 +102,17 @@ interface IRelayerModule { PacketData packetData ); event AcknowledgePacket( - string indexed packetTimeoutHeight, - string indexed packetTimeoutTimestamp, - string indexed packetSequence, - string packetSrcPort, - string packetSrcChannel, - string packetDstPort, + string indexed packetSrcPort, + string indexed packetSrcChannel, + string indexed packetDstPort, string packetDstChannel, string packetChannelOrdering, string packetConnection ); event TimeoutPacket( - string indexed packetTimeoutHeight, - string indexed packetTimeoutTimestamp, - string indexed packetSequence, - string packetSrcPort, - string packetSrcChannel, - string packetDstPort, + string indexed packetSrcPort, + string indexed packetSrcChannel, + string indexed packetDstPort, string packetDstChannel, string packetChannelOrdering ); diff --git a/integration_tests/cosmoscli.py b/integration_tests/cosmoscli.py index b6ab39fdda..47ce716b75 100644 --- a/integration_tests/cosmoscli.py +++ b/integration_tests/cosmoscli.py @@ -3,6 +3,7 @@ import hashlib import json import os +import re import subprocess import tempfile from collections import namedtuple @@ -868,6 +869,18 @@ def ibc_transfer( ) ) + def ibc_escrow_address(self, port, channel): + res = self.raw( + "query", + "ibc-transfer", + "escrow-address", + port, + channel, + home=self.data_dir, + node=self.node_rpc, + ).decode("utf-8") + return re.sub(r"\n", "", res) + def export(self): return self.raw("export", home=self.data_dir) diff --git a/integration_tests/ibc_utils.py b/integration_tests/ibc_utils.py index 5fe1102ce2..c4f00b8281 100644 --- a/integration_tests/ibc_utils.py +++ b/integration_tests/ibc_utils.py @@ -177,26 +177,6 @@ def hermes_transfer(ibc): return src_amount -def rly_transfer(ibc): - # chainmain-1 -> cronos_777-1 - my_ibc0 = "chainmain-1" - my_ibc1 = "cronos_777-1" - my_channel = "channel-0" - dst_addr = eth_to_bech32(ADDRS["signer2"]) - src_amount = 10 - src_denom = "basecro" - path = ibc.cronos.base_dir.parent / "relayer" - # dstchainid srcchainid srcportid srchannelid - cmd = ( - f"rly tx transfer {my_ibc0} {my_ibc1} {src_amount}{src_denom} " - f"{dst_addr} {my_channel} " - f"--path chainmain-cronos " - f"--home {str(path)}" - ) - subprocess.run(cmd, check=True, shell=True) - return src_amount - - def get_balance(chain, addr, denom): balance = chain.cosmos_cli().balance(addr, denom) print("balance", balance, addr, denom) @@ -301,6 +281,7 @@ def check_balance_change(): wait_for_fn("balance change", check_balance_change) assert chains[0].balance(sender, base_denom) == old_amt_sender_base assert chains[1].balance(receiver, "basecro") == old_amt_receiver_base - fee_amount + return amount def ibc_denom(channel, denom): @@ -379,3 +360,4 @@ def check_contract_balance_change(): wait_for_fn("check contract balance change", check_contract_balance_change) assert cronos_balance_after_send == amount + return amount, contract.address diff --git a/integration_tests/test_ibc_rly.py b/integration_tests/test_ibc_rly.py index 457e346b1a..1476a0bdc7 100644 --- a/integration_tests/test_ibc_rly.py +++ b/integration_tests/test_ibc_rly.py @@ -1,6 +1,7 @@ import json import os import signal +import subprocess import pytest from eth_utils import abi, keccak, to_checksum_address @@ -16,7 +17,6 @@ ibc_denom, ibc_incentivized_transfer, prepare_network, - rly_transfer, ) from .utils import ( ADDRS, @@ -29,6 +29,13 @@ ) CONTRACT = "0x0000000000000000000000000000000000000065" +method_map = None +contract_info = None +cronos_signer2 = ADDRS["signer2"] +src_amount = 10 +src_denom = "basecro" +dst_amount = src_amount * RATIO # the decimal places difference +dst_denom = "basetcro" @pytest.fixture(scope="module") @@ -53,8 +60,20 @@ def ibc(request, tmp_path_factory): proc.wait() -method_map = None -contract_info = None +def rly_transfer(ibc): + # chainmain-1 -> cronos_777-1 + my_ibc0 = "chainmain-1" + my_ibc1 = "cronos_777-1" + my_channel = "channel-0" + path = ibc.cronos.base_dir.parent / "relayer" + # dstchainid srcchainid srcportid srchannelid + cmd = ( + f"rly tx transfer {my_ibc0} {my_ibc1} {src_amount}{src_denom} " + f"{eth_to_bech32(cronos_signer2)} {my_channel} " + f"--path chainmain-cronos " + f"--home {str(path)}" + ) + subprocess.run(cmd, check=True, shell=True) def get_method_map(): @@ -99,6 +118,20 @@ def coin_received(addr, amt, denom): } +def coin_base(addr, amt, denom): + return { + "minter": addr, + "amount": [(amt, denom)], + } + + +def coin_spent(addr, amt, denom): + return { + "spender": addr, + "amount": [(amt, denom)], + } + + def fungible(src, dst, amt, denom): return { "receiver": src, @@ -116,16 +149,58 @@ def transfer(src, dst, amt, denom): } +def burn(addr, amt, denom): + return { + "burner": addr, + "amount": [(amt, denom)], + } + + +def update_client(): + return { + "clientId": keccak(text="07-tendermint-0"), + "clientType": keccak(text="07-tendermint"), + } + + +def recv_packet(src, dst, amt, denom): + return { + "packetData": (dst, src, [(amt, denom)]), + } + + +def acknowledge_packet(): + return { + "packetSrcPort": keccak(text="transfer"), + "packetSrcChannel": keccak(text="channel-0"), + "packetDstPort": keccak(text="transfer"), + "packetDstChannel": "channel-0", + "packetChannelOrdering": "ORDER_UNORDERED", + "packetConnection": "connection-0", + } + + +def denom_trace(denom): + return { + "denom": keccak(text=denom), + } + + +def write_ack(src, dst, amt, denom): + return { + "packetConnection": "connection-0", + "packetData": (dst, src, [(amt, denom)]), + } + + def test_ibc(ibc): + # chainmain-1 relayer -> cronos_777-1 signer2 w3 = ibc.cronos.w3 + wait_for_new_blocks(ibc.cronos.cosmos_cli(), 1) start = w3.eth.get_block_number() - src_amount = rly_transfer(ibc) - dst_amount = src_amount * RATIO # the decimal places difference - src_denom = "basecro" - dst_denom = "basetcro" - receiver = ADDRS["signer2"] + rly_transfer(ibc) denom = ibc_denom("channel-0", src_denom) - dst_addr = eth_to_bech32(receiver) + dst_addr = eth_to_bech32(cronos_signer2) old_dst_balance = get_balance(ibc.cronos, dst_addr, dst_denom) new_dst_balance = 0 @@ -137,140 +212,126 @@ def check_balance_change(): wait_for_fn("balance change", check_balance_change) assert old_dst_balance + dst_amount == new_dst_balance logs = get_logs(w3, start) - relayer = ibc.chainmain.cosmos_cli().address("relayer") - checksum_relayer = to_checksum_address(bech32_to_eth(relayer)) + relayer0 = ibc.chainmain.cosmos_cli().address("relayer") + relayer = to_checksum_address(bech32_to_eth(relayer0)) cronos_addr = module_address("cronos") transfer_addr = module_address("transfer") - expected_r = [ + expected = [ + update_client(), + recv_packet(relayer0, cronos_signer2, src_amount, src_denom), + denom_trace(denom), coin_received(transfer_addr, src_amount, denom), - coin_received(receiver, src_amount, denom), + coin_base(transfer_addr, src_amount, denom), + coin_spent(transfer_addr, src_amount, denom), + coin_received(cronos_signer2, src_amount, denom), + transfer(cronos_signer2, transfer_addr, src_amount, denom), + fungible(cronos_signer2, relayer, src_amount, src_denom), + coin_spent(cronos_signer2, src_amount, denom), coin_received(cronos_addr, src_amount, denom), + transfer(cronos_addr, cronos_signer2, src_amount, denom), coin_received(cronos_addr, dst_amount, dst_denom), - coin_received(receiver, dst_amount, dst_denom), + coin_base(cronos_addr, dst_amount, dst_denom), + coin_spent(cronos_addr, dst_amount, dst_denom), + coin_received(cronos_signer2, dst_amount, dst_denom), + transfer(cronos_signer2, cronos_addr, dst_amount, dst_denom), + coin_spent(cronos_signer2, src_amount, denom), coin_received(cronos_addr, src_amount, denom), + transfer(cronos_addr, cronos_signer2, src_amount, denom), coin_received(cronos_addr, dst_amount, dst_denom), - coin_received(receiver, dst_amount, dst_denom), + coin_base(cronos_addr, dst_amount, dst_denom), + coin_spent(cronos_addr, dst_amount, dst_denom), + coin_received(cronos_signer2, dst_amount, dst_denom), + transfer(cronos_signer2, cronos_addr, dst_amount, dst_denom), + write_ack(relayer0, cronos_signer2, src_amount, src_denom), ] - expected_t = [ - transfer(receiver, transfer_addr, src_amount, denom), - transfer(cronos_addr, receiver, src_amount, denom), - transfer(receiver, cronos_addr, dst_amount, dst_denom), - transfer(cronos_addr, receiver, src_amount, denom), - transfer(receiver, cronos_addr, dst_amount, dst_denom), - ] - topics_t = [] - topics_r = [] - for log in logs: + for i, log in enumerate(logs): method_name, args = get_topic_data(w3, log) - if method_name == "FungibleTokenPacket": - assert args == AttributeDict( - fungible(receiver, checksum_relayer, src_amount, src_denom), - ) - elif method_name == "UpdateClient": - assert args == AttributeDict( - { - "clientId": keccak(text="07-tendermint-0"), - "clientType": keccak(text="07-tendermint"), - } - ) - elif method_name == "RecvPacket": - assert args == AttributeDict( - { - "packetData": (receiver, relayer, [(src_amount, src_denom)]), - } - ) - elif method_name == "Transfer": - topics_t.append(args) - elif method_name == "CoinReceived": - topics_r.append(args) - assert topics_r == [AttributeDict(obj) for obj in expected_r] - assert topics_t == [AttributeDict(obj) for obj in expected_t] + assert args == AttributeDict(expected[i]), [i, method_name] + + +def get_escrow_address(cli, channel): + return to_checksum_address( + bech32_to_eth(cli.ibc_escrow_address("transfer", channel)), + ) def test_ibc_incentivized_transfer(ibc): w3 = ibc.cronos.w3 + cli = ibc.cronos.cosmos_cli() + wait_for_new_blocks(cli, 1) start = w3.eth.get_block_number() - ibc_incentivized_transfer(ibc) + amount = ibc_incentivized_transfer(ibc) logs = get_logs(w3, start) - src_amount = 10 - amount = 1000 - dst_amount = src_amount * RATIO # the decimal places difference - src_denom = "basecro" - denom = ibc_denom("channel-0", src_denom) - dst_denom = "basetcro" + channel = "channel-0" fee_denom = "ibcfee" transfer_denom = "transfer/channel-0/basetcro" - src_adr = ADDRS["signer2"] dst_adr = ibc.chainmain.cosmos_cli().address("signer2") - src_relayer = to_checksum_address( - bech32_to_eth(ibc.cronos.cosmos_cli().address("signer1")), - ) - dst_relayer = to_checksum_address( - bech32_to_eth(ibc.chainmain.cosmos_cli().address("relayer")), - ) + src_relayer = ADDRS["signer1"] checksum_dst_adr = to_checksum_address(bech32_to_eth(dst_adr)) - cronos_addr = module_address("cronos") - transfer_addr = module_address("transfer") - expect_f = [ - fungible(src_adr, dst_relayer, src_amount, src_denom), - fungible(checksum_dst_adr, src_adr, amount, dst_denom), - fungible(src_adr, checksum_dst_adr, amount, transfer_denom), - ] - expect_r = [ - coin_received(transfer_addr, src_amount, denom), - coin_received(src_adr, src_amount, denom), - coin_received(cronos_addr, src_amount, denom), - coin_received(cronos_addr, dst_amount, dst_denom), - coin_received(src_adr, dst_amount, dst_denom), - coin_received(cronos_addr, src_amount, denom), - coin_received(cronos_addr, dst_amount, dst_denom), - coin_received(src_adr, dst_amount, dst_denom), + feeibc_addr = module_address("feeibc") + escrow = get_escrow_address(cli, channel) + expected = [ + update_client(), + acknowledge_packet(), + coin_spent(feeibc_addr, src_amount, fee_denom), coin_received(src_relayer, src_amount, fee_denom), + transfer(src_relayer, feeibc_addr, src_amount, fee_denom), + coin_spent(feeibc_addr, src_amount, fee_denom), coin_received(src_relayer, src_amount, fee_denom), - coin_received(src_adr, src_amount, fee_denom), - coin_received(src_adr, amount, dst_denom), + transfer(src_relayer, feeibc_addr, src_amount, fee_denom), + coin_spent(feeibc_addr, src_amount, fee_denom), + coin_received(cronos_signer2, src_amount, fee_denom), + transfer(cronos_signer2, feeibc_addr, src_amount, fee_denom), + fungible(checksum_dst_adr, cronos_signer2, amount, dst_denom), + update_client(), + recv_packet(dst_adr, cronos_signer2, amount, transfer_denom), + coin_spent(escrow, amount, dst_denom), + coin_received(cronos_signer2, amount, dst_denom), + transfer(cronos_signer2, escrow, amount, dst_denom), + fungible(cronos_signer2, checksum_dst_adr, amount, transfer_denom), + write_ack(dst_adr, cronos_signer2, amount, transfer_denom), ] - topics_f = [] - topics_r = [] - for log in logs: + for i, log in enumerate(logs): method_name, args = get_topic_data(w3, log) - if method_name == "FungibleTokenPacket": - topics_f.append(args) - elif method_name == "CoinReceived": - topics_r.append(args) - assert topics_f == [AttributeDict(obj) for obj in expect_f] - assert topics_r == [AttributeDict(obj) for obj in expect_r] + assert args == AttributeDict(expected[i]), [i, method_name] def test_cronos_transfer_source_tokens(ibc): - wait_for_new_blocks(ibc.cronos.cosmos_cli(), 1) + cli = ibc.cronos.cosmos_cli() + wait_for_new_blocks(cli, 1) w3 = ibc.cronos.w3 start = w3.eth.get_block_number() - cronos_transfer_source_tokens(ibc) + amount, contract_address = cronos_transfer_source_tokens(ibc) logs = get_logs(w3, start) - amount = 1000 - src_adr = ADDRS["signer2"] dst_adr = ibc.chainmain.cosmos_cli().address("signer2") checksum_dst_adr = to_checksum_address(bech32_to_eth(dst_adr)) cronos_addr = module_address("cronos") - cronos_denom = "cronos0x68542BD12B41F5D51D6282Ec7D91D7d0D78E4503" - transfer_cronos_denom = f"transfer/channel-0/{cronos_denom}" - expect_f = [ + cronos_denom = f"cronos{contract_address}" + channel = "channel-0" + transfer_cronos_denom = f"transfer/{channel}/{cronos_denom}" + escrow = get_escrow_address(cli, channel) + expected = [ + update_client(), + acknowledge_packet(), fungible(checksum_dst_adr, ADDRS["validator"], amount, cronos_denom), - fungible(src_adr, checksum_dst_adr, amount, transfer_cronos_denom), - ] - expect_r = [ - coin_received(src_adr, amount, cronos_denom), + update_client(), + recv_packet(dst_adr, cronos_signer2, amount, transfer_cronos_denom), + coin_spent(escrow, amount, cronos_denom), + coin_received(cronos_signer2, amount, cronos_denom), + transfer(cronos_signer2, escrow, amount, cronos_denom), + fungible(cronos_signer2, checksum_dst_adr, amount, transfer_cronos_denom), + coin_spent(cronos_signer2, amount, cronos_denom), coin_received(cronos_addr, amount, cronos_denom), + transfer(cronos_addr, cronos_signer2, amount, cronos_denom), + coin_spent(cronos_addr, amount, cronos_denom), + burn(cronos_addr, amount, cronos_denom), + coin_spent(cronos_signer2, amount, cronos_denom), coin_received(cronos_addr, amount, cronos_denom), + transfer(cronos_addr, cronos_signer2, amount, cronos_denom), + coin_spent(cronos_addr, amount, cronos_denom), + burn(cronos_addr, amount, cronos_denom), + write_ack(dst_adr, cronos_signer2, amount, transfer_cronos_denom), ] - topics_f = [] - topics_r = [] - for log in logs: + for i, log in enumerate(logs): method_name, args = get_topic_data(w3, log) - if method_name == "FungibleTokenPacket": - topics_f.append(args) - elif method_name == "CoinReceived": - topics_r.append(args) - assert topics_f == [AttributeDict(obj) for obj in expect_f] - assert topics_r == [AttributeDict(obj) for obj in expect_r] + assert args == AttributeDict(expected[i]), [i, method_name]