Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: not payee set for relayer caller #1654

Merged
merged 11 commits into from
Oct 25, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
22 changes: 12 additions & 10 deletions integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions integration_tests/test_ibc_rly.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from .ibc_utils import (
RATIO,
RELAYER_CALLER,
assert_duplicate,
cronos_transfer_source_tokens,
cronos_transfer_source_tokens_with_proxy,
Expand Down Expand Up @@ -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),
Expand Down
13 changes: 10 additions & 3 deletions x/cronos/keeper/precompiles/relayer.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -183,7 +185,6 @@
return nil, err
}
stateDB := evm.StateDB.(ExtStateDB)

var res []byte
precompileAddr := bc.Address()
args, err := method.Inputs.Unpack(contract.Input[4:])
Expand Down Expand Up @@ -230,9 +231,15 @@
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()
mmsqe marked this conversation as resolved.
Show resolved Hide resolved
return bc.ibcKeeper.Acknowledgement(goCtx, msg)
})

Check warning on line 237 in x/cronos/keeper/precompiles/relayer.go

View check run for this annotation

Codecov / codecov/patch

x/cronos/keeper/precompiles/relayer.go#L234-L237

Added lines #L234 - L237 were not covered by tests
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)
})

Check warning on line 242 in x/cronos/keeper/precompiles/relayer.go

View check run for this annotation

Codecov / codecov/patch

x/cronos/keeper/precompiles/relayer.go#L239-L242

Added lines #L239 - L242 were not covered by tests
case TimeoutOnClose:
res, err = exec(e, bc.ibcKeeper.TimeoutOnClose)
default:
Expand Down
Loading