Skip to content

Commit

Permalink
Problem: no register support for payee and counterpartyPayee (#1665)
Browse files Browse the repository at this point in the history
* Problem: no register support for payee and counterpartyPayee

* Update integration_tests/ibc_utils.py

Signed-off-by: mmsqe <[email protected]>

* counterpartyPayee

* fix test

---------

Signed-off-by: mmsqe <[email protected]>
  • Loading branch information
mmsqe authored Oct 28, 2024
1 parent 01b048e commit 27f1a59
Show file tree
Hide file tree
Showing 14 changed files with 289 additions and 414 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## UNRELEASED

### Features

* [#1665](https://github.com/crypto-org-chain/cronos/pull/1665) Support register for payee and counterpartyPayee in relayer precompile.

### Improvements

* [#1664](https://github.com/crypto-org-chain/cronos/pull/1664) Update cometbft to 0.38.13.
Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ func New(
evmS,
[]evmkeeper.CustomContractFn{
func(_ sdk.Context, rules ethparams.Rules) vm.PrecompiledContract {
return cronosprecompiles.NewRelayerContract(app.IBCKeeper, appCodec, rules, app.Logger())
return cronosprecompiles.NewRelayerContract(app.IBCKeeper, app.IBCFeeKeeper, appCodec, rules, app.Logger())
},
func(ctx sdk.Context, rules ethparams.Rules) vm.PrecompiledContract {
return cronosprecompiles.NewIcaContract(ctx, app.ICAControllerKeeper, &app.CronosKeeper, appCodec, gasConfig)
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/configs/ibc.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ config {
'account-prefix': 'cro',
'coin-type': 394,
'app-config': {
'minimum-gas-prices': '500basecro',
'minimum-gas-prices': '0basecro',
},
validators: [
{
Expand Down Expand Up @@ -68,7 +68,7 @@ config {
},
{
name: 'signer2',
coins: '10000000000000cro',
coins: '10000000000000cro,100000000000ibcfee',
mnemonic: '${SIGNER2_MNEMONIC}',
},
] + [
Expand Down
23 changes: 21 additions & 2 deletions integration_tests/contracts/contracts/TestRelayer.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import {IRelayerFunctions} from "./src/RelayerFunctions.sol";

contract TestRelayer {
address constant relayer = 0x0000000000000000000000000000000000000065;
address constant relayerContract = 0x0000000000000000000000000000000000000065;
IRelayerFunctions relayer = IRelayerFunctions(relayerContract);
address payee;
address counterpartyPayee;

function batchCall(bytes[] memory payloads) public {
for (uint256 i = 0; i < payloads.length; i++) {
(bool success,) = relayer.call(payloads[i]);
(bool success,) = relayerContract.call(payloads[i]);
require(success);
}
}

function callRegisterPayee(string calldata portID, string calldata channelID, address payeeAddr) public returns (bool) {
require(payee == address(0) || payee == msg.sender, "register fail");
bool result = relayer.registerPayee(portID, channelID, payeeAddr);
require(result, "call failed");
payee = msg.sender;
}

function callRegisterCounterpartyPayee(string calldata portID, string calldata channelID, string calldata counterpartyPayeeAddr) public returns (bool) {
require(counterpartyPayee == address(0) || counterpartyPayee == msg.sender, "register fail");
bool result = relayer.registerCounterpartyPayee(portID, channelID, counterpartyPayeeAddr);
require(result, "call failed");
counterpartyPayee = msg.sender;
}
}
2 changes: 1 addition & 1 deletion integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ def ibc_transfer(
to,
amount,
channel, # src channel
target_version, # chain version number of target chain
target_version=1, # chain version number of target chain
event_query_tx_for=False,
**kwargs,
):
Expand Down
Loading

0 comments on commit 27f1a59

Please sign in to comment.