diff --git a/CHANGELOG.md b/CHANGELOG.md index 03b4ea776b..8734ce4c5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * (testground)[1649](https://github.com/crypto-org-chain/cronos/pull/1649) Fix running single validator benchmark locally. * (cli)[#1647](https://github.com/crypto-org-chain/cronos/pull/1647) Fix node can't shutdown by signal. * (testground)[#1652](https://github.com/crypto-org-chain/cronos/pull/1652) Remove unexpected conflicts in benchmark transactions. +* [#1654](https://github.com/crypto-org-chain/cronos/pull/1654) Set relayer as payee for relayer caller when enabled incentivized packet. * [#1655](https://github.com/crypto-org-chain/cronos/pull/1655) Fix state overwrite in debug trace APIs. * [#1663](https://github.com/crypto-org-chain/cronos/pull/1663) Align attributes for ibc timeout event. diff --git a/integration_tests/cosmoscli.py b/integration_tests/cosmoscli.py index 2ed8812414..4b6aca5746 100644 --- a/integration_tests/cosmoscli.py +++ b/integration_tests/cosmoscli.py @@ -601,9 +601,12 @@ def combine_batch_multisig_tx( def broadcast_tx(self, tx_file, **kwargs): kwargs.setdefault("broadcast_mode", "sync") kwargs.setdefault("output", "json") - return json.loads( + rsp = json.loads( self.raw("tx", "broadcast", tx_file, node=self.node_rpc, **kwargs) ) + if rsp["code"] == 0: + rsp = self.event_query_tx_for(rsp["txhash"]) + return rsp def broadcast_tx_json(self, tx, **kwargs): with tempfile.NamedTemporaryFile("w") as fp: @@ -1612,10 +1615,7 @@ def register_counterparty_payee( return rsp def register_payee(self, port_id, channel_id, relayer, payee, **kwargs): - default_kwargs = { - "home": self.data_dir, - } - return json.loads( + rsp = json.loads( self.raw( "tx", "ibc-fee", @@ -1625,14 +1625,15 @@ def register_payee(self, port_id, channel_id, relayer, payee, **kwargs): relayer, payee, "-y", - **(default_kwargs | kwargs), + home=self.data_dir, + **kwargs, ) ) + if rsp["code"] == 0: + rsp = self.event_query_tx_for(rsp["txhash"]) + return rsp def pay_packet_fee(self, port_id, channel_id, packet_seq, **kwargs): - default_kwargs = { - "home": self.data_dir, - } rsp = json.loads( self.raw( "tx", @@ -1642,7 +1643,8 @@ def pay_packet_fee(self, port_id, channel_id, packet_seq, **kwargs): channel_id, str(packet_seq), "-y", - **(default_kwargs | kwargs), + home=self.data_dir, + **kwargs, ) ) if rsp["code"] == 0: diff --git a/integration_tests/test_ibc_rly.py b/integration_tests/test_ibc_rly.py index c482a87807..0e8e23ee91 100644 --- a/integration_tests/test_ibc_rly.py +++ b/integration_tests/test_ibc_rly.py @@ -7,7 +7,6 @@ from .ibc_utils import ( RATIO, - RELAYER_CALLER, assert_duplicate, cronos_transfer_source_tokens, cronos_transfer_source_tokens_with_proxy, @@ -293,8 +292,8 @@ def test_ibc_incentivized_transfer(ibc): acknowledge_packet(seq0), distribute_fee(src_relayer, fee), *send_coins(feeibc_addr, src_relayer, src_amount, fee_denom), - distribute_fee(RELAYER_CALLER, fee), - *send_coins(feeibc_addr, RELAYER_CALLER, src_amount, fee_denom), + distribute_fee(src_relayer, fee), + *send_coins(feeibc_addr, src_relayer, src_amount, fee_denom), distribute_fee(cronos_signer2, ""), *send_coins(feeibc_addr, cronos_signer2, 0, fee_denom), fungible(checksum_dst_adr, cronos_signer2, amount, dst_denom), diff --git a/x/cronos/keeper/precompiles/relayer.go b/x/cronos/keeper/precompiles/relayer.go index 8bbcad970c..a16c90df71 100644 --- a/x/cronos/keeper/precompiles/relayer.go +++ b/x/cronos/keeper/precompiles/relayer.go @@ -1,11 +1,13 @@ package precompiles import ( + "context" "errors" "fmt" "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" @@ -183,7 +185,6 @@ func (bc *RelayerContract) Run(evm *vm.EVM, contract *vm.Contract, readonly bool return nil, err } stateDB := evm.StateDB.(ExtStateDB) - var res []byte precompileAddr := bc.Address() args, err := method.Inputs.Unpack(contract.Input[4:]) @@ -230,9 +231,15 @@ func (bc *RelayerContract) Run(evm *vm.EVM, contract *vm.Contract, readonly bool case RecvPacket: res, err = exec(e, bc.ibcKeeper.RecvPacket) case Acknowledgement: - res, err = exec(e, bc.ibcKeeper.Acknowledgement) + res, err = exec(e, func(goCtx context.Context, msg *channeltypes.MsgAcknowledgement) (*channeltypes.MsgAcknowledgementResponse, error) { + msg.Signer = sdk.AccAddress(evm.TxContext.Origin.Bytes()).String() + return bc.ibcKeeper.Acknowledgement(goCtx, msg) + }) case Timeout: - res, err = exec(e, bc.ibcKeeper.Timeout) + res, err = exec(e, func(goCtx context.Context, msg *channeltypes.MsgTimeout) (*channeltypes.MsgTimeoutResponse, error) { + msg.Signer = sdk.AccAddress(evm.TxContext.Origin.Bytes()).String() + return bc.ibcKeeper.Timeout(goCtx, msg) + }) case TimeoutOnClose: res, err = exec(e, bc.ibcKeeper.TimeoutOnClose) default: