From 56451618cf2345859114fe63b762bbba17ccde40 Mon Sep 17 00:00:00 2001 From: yutianwu Date: Wed, 12 Jul 2023 17:05:10 +0800 Subject: [PATCH] feat: support cross chain for multiple blockchains (#242) --- types/cross_chain.go | 5 +- x/crosschain/keeper/config.go | 4 +- x/crosschain/keeper/grpc_query.go | 6 +- x/crosschain/keeper/keeper.go | 42 +++---- x/crosschain/keeper/keeper_test.go | 12 +- x/crosschain/types/keys.go | 5 - x/gov/keeper/common_test.go | 3 +- x/gov/keeper/crosschain.go | 1 + x/gov/testutil/expected_keepers.go | 7 +- x/gov/testutil/expected_keepers_mocks.go | 23 +++- x/gov/types/expected_keepers.go | 3 +- x/oracle/keeper/msg_server.go | 30 ++--- x/oracle/keeper/msg_server_test.go | 16 +-- x/oracle/types/expected_keeper_mocks.go | 141 +++++++++++------------ x/oracle/types/expected_keepers.go | 6 +- 15 files changed, 160 insertions(+), 144 deletions(-) diff --git a/types/cross_chain.go b/types/cross_chain.go index 3a98517cda..521485f90d 100644 --- a/types/cross_chain.go +++ b/types/cross_chain.go @@ -38,8 +38,9 @@ type CrossChainApplication interface { } type CrossChainAppContext struct { - Sequence uint64 - Header *PackageHeader + SrcChainId ChainID + Sequence uint64 + Header *PackageHeader } type ExecuteResult struct { diff --git a/x/crosschain/keeper/config.go b/x/crosschain/keeper/config.go index a26c8dc750..ec51a1327f 100644 --- a/x/crosschain/keeper/config.go +++ b/x/crosschain/keeper/config.go @@ -4,7 +4,7 @@ import sdk "github.com/cosmos/cosmos-sdk/types" type crossChainConfig struct { srcChainID sdk.ChainID - destChainId sdk.ChainID + destBscChainId sdk.ChainID nameToChannelID map[string]sdk.ChannelID channelIDToName map[sdk.ChannelID]string channelIDToApp map[sdk.ChannelID]sdk.CrossChainApplication @@ -13,7 +13,7 @@ type crossChainConfig struct { func newCrossChainCfg() *crossChainConfig { config := &crossChainConfig{ srcChainID: 0, - destChainId: 0, + destBscChainId: 0, nameToChannelID: make(map[string]sdk.ChannelID), channelIDToName: make(map[sdk.ChannelID]string), channelIDToApp: make(map[sdk.ChannelID]sdk.CrossChainApplication), diff --git a/x/crosschain/keeper/grpc_query.go b/x/crosschain/keeper/grpc_query.go index b24e07faf2..c4533f7647 100644 --- a/x/crosschain/keeper/grpc_query.go +++ b/x/crosschain/keeper/grpc_query.go @@ -26,7 +26,7 @@ func (k Keeper) CrossChainPackage(c context.Context, req *types.QueryCrossChainP } ctx := sdk.UnwrapSDKContext(c) - pack, err := k.GetCrossChainPackage(ctx, sdk.ChannelID(req.ChannelId), req.Sequence) + pack, err := k.GetCrossChainPackage(ctx, k.GetDestBscChainID(), sdk.ChannelID(req.ChannelId), req.Sequence) if err != nil { return nil, err } @@ -42,7 +42,7 @@ func (k Keeper) SendSequence(c context.Context, req *types.QuerySendSequenceRequ } ctx := sdk.UnwrapSDKContext(c) - sequence := k.GetSendSequence(ctx, sdk.ChannelID(req.ChannelId)) + sequence := k.GetSendSequence(ctx, k.GetDestBscChainID(), sdk.ChannelID(req.ChannelId)) return &types.QuerySendSequenceResponse{ Sequence: sequence, @@ -56,7 +56,7 @@ func (k Keeper) ReceiveSequence(c context.Context, req *types.QueryReceiveSequen } ctx := sdk.UnwrapSDKContext(c) - sequence := k.GetReceiveSequence(ctx, sdk.ChannelID(req.ChannelId)) + sequence := k.GetReceiveSequence(ctx, k.GetDestBscChainID(), sdk.ChannelID(req.ChannelId)) return &types.QueryReceiveSequenceResponse{ Sequence: sequence, diff --git a/x/crosschain/keeper/keeper.go b/x/crosschain/keeper/keeper.go index 0d6ff7b3c7..419d43b1b6 100644 --- a/x/crosschain/keeper/keeper.go +++ b/x/crosschain/keeper/keeper.go @@ -92,15 +92,15 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { } // CreateRawIBCPackageWithFee creates a cross chain package with given cross chain fee -func (k Keeper) CreateRawIBCPackageWithFee(ctx sdk.Context, channelID sdk.ChannelID, +func (k Keeper) CreateRawIBCPackageWithFee(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID, packageType sdk.CrossChainPackageType, packageLoad []byte, relayerFee, ackRelayerFee *big.Int, ) (uint64, error) { - if packageType == sdk.SynCrossChainPackageType && k.GetChannelSendPermission(ctx, k.GetDestChainID(), channelID) != sdk.ChannelAllow { + if packageType == sdk.SynCrossChainPackageType && k.GetChannelSendPermission(ctx, destChainId, channelID) != sdk.ChannelAllow { return 0, fmt.Errorf("channel %d is not allowed to write syn package", channelID) } - sequence := k.GetSendSequence(ctx, channelID) - key := types.BuildCrossChainPackageKey(k.GetSrcChainID(), k.GetDestChainID(), channelID, sequence) + sequence := k.GetSendSequence(ctx, destChainId, channelID) + key := types.BuildCrossChainPackageKey(k.GetSrcChainID(), destChainId, channelID, sequence) kvStore := ctx.KVStore(k.storeKey) if kvStore.Has(key) { return 0, fmt.Errorf("duplicated sequence") @@ -116,11 +116,11 @@ func (k Keeper) CreateRawIBCPackageWithFee(ctx sdk.Context, channelID sdk.Channe kvStore.Set(key, append(packageHeader, packageLoad...)) - k.IncrSendSequence(ctx, channelID) + k.IncrSendSequence(ctx, destChainId, channelID) err := ctx.EventManager().EmitTypedEvent(&types.EventCrossChain{ SrcChainId: uint32(k.GetSrcChainID()), - DestChainId: uint32(k.GetDestChainID()), + DestChainId: uint32(destChainId), ChannelId: uint32(channelID), Sequence: sequence, PackageType: uint32(packageType), @@ -157,7 +157,7 @@ func (k Keeper) RegisterChannel(name string, id sdk.ChannelID, app sdk.CrossChai // IsDestChainSupported returns the support status of a dest chain func (k Keeper) IsDestChainSupported(chainID sdk.ChainID) bool { - return chainID == k.cfg.destChainId + return chainID == k.cfg.destBscChainId } // SetChannelSendPermission sets the channel send permission @@ -188,39 +188,39 @@ func (k Keeper) GetSrcChainID() sdk.ChainID { // SetDestChainID sets the destination chain id func (k Keeper) SetDestChainID(destChainId sdk.ChainID) { - k.cfg.destChainId = destChainId + k.cfg.destBscChainId = destChainId } -// GetDestChainID gets the destination chain id -func (k Keeper) GetDestChainID() sdk.ChainID { - return k.cfg.destChainId +// GetDestBscChainID gets the destination chain id of bsc +func (k Keeper) GetDestBscChainID() sdk.ChainID { + return k.cfg.destBscChainId } // GetCrossChainPackage returns the ibc package by sequence -func (k Keeper) GetCrossChainPackage(ctx sdk.Context, channelId sdk.ChannelID, sequence uint64) ([]byte, error) { +func (k Keeper) GetCrossChainPackage(ctx sdk.Context, destChainId sdk.ChainID, channelId sdk.ChannelID, sequence uint64) ([]byte, error) { kvStore := ctx.KVStore(k.storeKey) - key := types.BuildCrossChainPackageKey(k.GetSrcChainID(), k.GetDestChainID(), channelId, sequence) + key := types.BuildCrossChainPackageKey(k.GetSrcChainID(), destChainId, channelId, sequence) return kvStore.Get(key), nil } // GetSendSequence returns the sending sequence of the channel -func (k Keeper) GetSendSequence(ctx sdk.Context, channelID sdk.ChannelID) uint64 { - return k.getSequence(ctx, k.GetDestChainID(), channelID, types.PrefixForSendSequenceKey) +func (k Keeper) GetSendSequence(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID) uint64 { + return k.getSequence(ctx, destChainId, channelID, types.PrefixForSendSequenceKey) } // IncrSendSequence increases the sending sequence of the channel -func (k Keeper) IncrSendSequence(ctx sdk.Context, channelID sdk.ChannelID) { - k.incrSequence(ctx, k.GetDestChainID(), channelID, types.PrefixForSendSequenceKey) +func (k Keeper) IncrSendSequence(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID) { + k.incrSequence(ctx, destChainId, channelID, types.PrefixForSendSequenceKey) } // GetReceiveSequence returns the receiving sequence of the channel -func (k Keeper) GetReceiveSequence(ctx sdk.Context, channelID sdk.ChannelID) uint64 { - return k.getSequence(ctx, k.GetDestChainID(), channelID, types.PrefixForReceiveSequenceKey) +func (k Keeper) GetReceiveSequence(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID) uint64 { + return k.getSequence(ctx, destChainId, channelID, types.PrefixForReceiveSequenceKey) } // IncrReceiveSequence increases the receiving sequence of the channel -func (k Keeper) IncrReceiveSequence(ctx sdk.Context, channelID sdk.ChannelID) { - k.incrSequence(ctx, k.GetDestChainID(), channelID, types.PrefixForReceiveSequenceKey) +func (k Keeper) IncrReceiveSequence(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID) { + k.incrSequence(ctx, destChainId, channelID, types.PrefixForReceiveSequenceKey) } // getSequence returns the sequence with a prefix diff --git a/x/crosschain/keeper/keeper_test.go b/x/crosschain/keeper/keeper_test.go index 5702ab28ef..7345a9d286 100644 --- a/x/crosschain/keeper/keeper_test.go +++ b/x/crosschain/keeper/keeper_test.go @@ -53,21 +53,21 @@ func TestTestSuite(t *testing.T) { } func (s *TestSuite) TestIncrSendSequence() { - beforeSequence := s.crossChainKeeper.GetSendSequence(s.ctx, sdk.ChannelID(1)) + beforeSequence := s.crossChainKeeper.GetSendSequence(s.ctx, sdk.ChainID(1), sdk.ChannelID(1)) - s.crossChainKeeper.IncrSendSequence(s.ctx, sdk.ChannelID(1)) + s.crossChainKeeper.IncrSendSequence(s.ctx, sdk.ChainID(1), sdk.ChannelID(1)) - afterSequence := s.crossChainKeeper.GetSendSequence(s.ctx, sdk.ChannelID(1)) + afterSequence := s.crossChainKeeper.GetSendSequence(s.ctx, sdk.ChainID(1), sdk.ChannelID(1)) s.Require().EqualValues(afterSequence, beforeSequence+1) } func (s *TestSuite) TestIncrReceiveSequence() { - beforeSequence := s.crossChainKeeper.GetReceiveSequence(s.ctx, sdk.ChannelID(1)) + beforeSequence := s.crossChainKeeper.GetReceiveSequence(s.ctx, sdk.ChainID(1), sdk.ChannelID(1)) - s.crossChainKeeper.IncrReceiveSequence(s.ctx, sdk.ChannelID(1)) + s.crossChainKeeper.IncrReceiveSequence(s.ctx, sdk.ChainID(1), sdk.ChannelID(1)) - afterSequence := s.crossChainKeeper.GetReceiveSequence(s.ctx, sdk.ChannelID(1)) + afterSequence := s.crossChainKeeper.GetReceiveSequence(s.ctx, sdk.ChainID(1), sdk.ChannelID(1)) s.Require().EqualValues(afterSequence, beforeSequence+1) } diff --git a/x/crosschain/types/keys.go b/x/crosschain/types/keys.go index 8b4ce08039..4f9e25115e 100644 --- a/x/crosschain/types/keys.go +++ b/x/crosschain/types/keys.go @@ -23,8 +23,6 @@ const ( MaxSideChainIdLength = 20 SequenceLength = 8 - - GovChannelId = sdk.ChannelID(9) ) var ( @@ -58,9 +56,6 @@ func (c *ChannelPermissionSetting) Check() error { if len(c.DestChainId) == 0 || len(c.DestChainId) > MaxSideChainIdLength { return fmt.Errorf("invalid dest chain id") } - if c.ChannelId == GovChannelId { - return fmt.Errorf("gov channel id is forbidden to set") - } if c.Permission != sdk.ChannelAllow && c.Permission != sdk.ChannelForbidden { return fmt.Errorf("permission %d is invalid", c.Permission) } diff --git a/x/gov/keeper/common_test.go b/x/gov/keeper/common_test.go index 7283530e0c..5831dac745 100644 --- a/x/gov/keeper/common_test.go +++ b/x/gov/keeper/common_test.go @@ -91,7 +91,8 @@ func setupGovKeeper(t *testing.T) ( govKeeper.SetLegacyRouter(govRouter) govKeeper.SetParams(ctx, v1.DefaultParams()) - crossChainKeeper.EXPECT().CreateRawIBCPackageWithFee(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(uint64(0), nil).AnyTimes() + crossChainKeeper.EXPECT().GetDestBscChainID().Return(sdk.ChainID(714)).AnyTimes() + crossChainKeeper.EXPECT().CreateRawIBCPackageWithFee(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(uint64(0), nil).AnyTimes() // Register all handlers for the MegServiceRouter. msr.SetInterfaceRegistry(encCfg.InterfaceRegistry) diff --git a/x/gov/keeper/crosschain.go b/x/gov/keeper/crosschain.go index f245387a23..349c330b68 100644 --- a/x/gov/keeper/crosschain.go +++ b/x/gov/keeper/crosschain.go @@ -47,6 +47,7 @@ func (k Keeper) SyncParams(ctx sdk.Context, cpc govv1.CrossChainParamsChange) er _, err := k.crossChainKeeper.CreateRawIBCPackageWithFee( ctx, + k.crossChainKeeper.GetDestBscChainID(), types.SyncParamsChannelID, sdk.SynCrossChainPackageType, encodedPackage, diff --git a/x/gov/testutil/expected_keepers.go b/x/gov/testutil/expected_keepers.go index 68081e4203..a018300264 100644 --- a/x/gov/testutil/expected_keepers.go +++ b/x/gov/testutil/expected_keepers.go @@ -38,9 +38,10 @@ type StakingKeeper interface { // CrossChainKeeper defines the expected crossChain keeper type CrossChainKeeper interface { - RegisterChannel(name string, id sdk.ChannelID, app sdk.CrossChainApplication) error - - CreateRawIBCPackageWithFee(ctx sdk.Context, channelID sdk.ChannelID, packageType sdk.CrossChainPackageType, + GetDestBscChainID() sdk.ChainID + CreateRawIBCPackageWithFee(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID, packageType sdk.CrossChainPackageType, packageLoad []byte, relayerFee, ackRelayerFee *big.Int, ) (uint64, error) + + RegisterChannel(name string, id sdk.ChannelID, app sdk.CrossChainApplication) error } diff --git a/x/gov/testutil/expected_keepers_mocks.go b/x/gov/testutil/expected_keepers_mocks.go index 9d0f6ecf2e..be6731dd57 100644 --- a/x/gov/testutil/expected_keepers_mocks.go +++ b/x/gov/testutil/expected_keepers_mocks.go @@ -1,6 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/gov/testutil/expected_keepers.go - // Package testutil is a generated GoMock package. package testutil @@ -1061,18 +1060,32 @@ func (m *MockCrossChainKeeper) EXPECT() *MockCrossChainKeeperMockRecorder { } // CreateRawIBCPackageWithFee mocks base method. -func (m *MockCrossChainKeeper) CreateRawIBCPackageWithFee(ctx types.Context, channelID types.ChannelID, packageType types.CrossChainPackageType, packageLoad []byte, relayerFee, ackRelayerFee *big.Int) (uint64, error) { +func (m *MockCrossChainKeeper) CreateRawIBCPackageWithFee(ctx types.Context, destChainId types.ChainID, channelID types.ChannelID, packageType types.CrossChainPackageType, packageLoad []byte, relayerFee, ackRelayerFee *big.Int) (uint64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateRawIBCPackageWithFee", ctx, channelID, packageType, packageLoad, relayerFee, ackRelayerFee) + ret := m.ctrl.Call(m, "CreateRawIBCPackageWithFee", ctx, destChainId, channelID, packageType, packageLoad, relayerFee, ackRelayerFee) ret0, _ := ret[0].(uint64) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateRawIBCPackageWithFee indicates an expected call of CreateRawIBCPackageWithFee. -func (mr *MockCrossChainKeeperMockRecorder) CreateRawIBCPackageWithFee(ctx, channelID, packageType, packageLoad, relayerFee, ackRelayerFee interface{}) *gomock.Call { +func (mr *MockCrossChainKeeperMockRecorder) CreateRawIBCPackageWithFee(ctx, destChainId, channelID, packageType, packageLoad, relayerFee, ackRelayerFee interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRawIBCPackageWithFee", reflect.TypeOf((*MockCrossChainKeeper)(nil).CreateRawIBCPackageWithFee), ctx, destChainId, channelID, packageType, packageLoad, relayerFee, ackRelayerFee) +} + +// GetDestBscChainID mocks base method. +func (m *MockCrossChainKeeper) GetDestBscChainID() types.ChainID { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDestBscChainID") + ret0, _ := ret[0].(types.ChainID) + return ret0 +} + +// GetDestBscChainID indicates an expected call of GetDestBscChainID. +func (mr *MockCrossChainKeeperMockRecorder) GetDestBscChainID() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRawIBCPackageWithFee", reflect.TypeOf((*MockCrossChainKeeper)(nil).CreateRawIBCPackageWithFee), ctx, channelID, packageType, packageLoad, relayerFee, ackRelayerFee) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDestBscChainID", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetDestBscChainID)) } // RegisterChannel mocks base method. diff --git a/x/gov/types/expected_keepers.go b/x/gov/types/expected_keepers.go index eae9e6a76b..70de43317c 100644 --- a/x/gov/types/expected_keepers.go +++ b/x/gov/types/expected_keepers.go @@ -53,7 +53,8 @@ type BankKeeper interface { } type CrossChainKeeper interface { - CreateRawIBCPackageWithFee(ctx sdk.Context, channelID sdk.ChannelID, packageType sdk.CrossChainPackageType, + GetDestBscChainID() sdk.ChainID + CreateRawIBCPackageWithFee(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID, packageType sdk.CrossChainPackageType, packageLoad []byte, relayerFee, ackRelayerFee *big.Int, ) (uint64, error) diff --git a/x/oracle/keeper/msg_server.go b/x/oracle/keeper/msg_server.go index 9db0a2bbd7..dfe75714b7 100644 --- a/x/oracle/keeper/msg_server.go +++ b/x/oracle/keeper/msg_server.go @@ -59,7 +59,7 @@ func (k msgServer) Claim(goCtx context.Context, req *types.MsgClaim) (*types.Msg return nil, sdkerrors.Wrapf(types.ErrInvalidSrcChainId, "src chain id(%d) is not supported", req.SrcChainId) } - sequence := k.CrossChainKeeper.GetReceiveSequence(ctx, types.RelayPackagesChannelId) + sequence := k.CrossChainKeeper.GetReceiveSequence(ctx, sdk.ChainID(req.SrcChainId), types.RelayPackagesChannelId) if sequence != req.Sequence { return nil, sdkerrors.Wrapf(types.ErrInvalidReceiveSequence, "current sequence of channel %d is %d", types.RelayPackagesChannelId, sequence) } @@ -92,7 +92,7 @@ func (k msgServer) Claim(goCtx context.Context, req *types.MsgClaim) (*types.Msg totalRelayerFee = totalRelayerFee.Add(relayerFee) // increase channel sequence - k.CrossChainKeeper.IncrReceiveSequence(ctx, pack.ChannelId) + k.CrossChainKeeper.IncrReceiveSequence(ctx, sdk.ChainID(req.SrcChainId), pack.ChannelId) } err = k.distributeReward(ctx, relayer, signedRelayers, totalRelayerFee) @@ -100,7 +100,7 @@ func (k msgServer) Claim(goCtx context.Context, req *types.MsgClaim) (*types.Msg return nil, err } - k.CrossChainKeeper.IncrReceiveSequence(ctx, types.RelayPackagesChannelId) + k.CrossChainKeeper.IncrReceiveSequence(ctx, sdk.ChainID(req.SrcChainId), types.RelayPackagesChannelId) err = ctx.EventManager().EmitTypedEvents(events...) if err != nil { @@ -179,7 +179,7 @@ func (k Keeper) handlePackage( return sdkmath.ZeroInt(), nil, sdkerrors.Wrapf(types.ErrChannelNotRegistered, "channel %d not registered", pack.ChannelId) } - sequence := k.CrossChainKeeper.GetReceiveSequence(ctx, pack.ChannelId) + sequence := k.CrossChainKeeper.GetReceiveSequence(ctx, sdk.ChainID(srcChainId), pack.ChannelId) if sequence != pack.Sequence { return sdkmath.ZeroInt(), nil, sdkerrors.Wrapf(types.ErrInvalidReceiveSequence, "current sequence of channel %d is %d", pack.ChannelId, sequence) @@ -201,7 +201,7 @@ func (k Keeper) handlePackage( } cacheCtx, write := ctx.CacheContext() - crash, result := executeClaim(cacheCtx, crossChainApp, sequence, pack.Payload, &packageHeader) + crash, result := executeClaim(cacheCtx, crossChainApp, srcChainId, sequence, pack.Payload, &packageHeader) if result.IsOk() { write() } @@ -216,7 +216,7 @@ func (k Keeper) handlePackage( return sdkmath.ZeroInt(), nil, sdkerrors.Wrapf(types.ErrInvalidPackage, "payload without header") } - sendSeq, ibcErr := k.CrossChainKeeper.CreateRawIBCPackageWithFee(ctx, pack.ChannelId, + sendSeq, ibcErr := k.CrossChainKeeper.CreateRawIBCPackageWithFee(ctx, sdk.ChainID(srcChainId), pack.ChannelId, sdk.FailAckCrossChainPackageType, pack.Payload[sdk.SynPackageHeaderLength:], packageHeader.AckRelayerFee, sdk.NilAckRelayerFee) if ibcErr != nil { logger.Error("failed to write FailAckCrossChainPackage", "err", err) @@ -224,7 +224,7 @@ func (k Keeper) handlePackage( } sendSequence = int64(sendSeq) } else if len(result.Payload) != 0 { - sendSeq, err := k.CrossChainKeeper.CreateRawIBCPackageWithFee(ctx, pack.ChannelId, + sendSeq, err := k.CrossChainKeeper.CreateRawIBCPackageWithFee(ctx, sdk.ChainID(srcChainId), pack.ChannelId, sdk.AckCrossChainPackageType, result.Payload, packageHeader.AckRelayerFee, sdk.NilAckRelayerFee) if err != nil { logger.Error("failed to write AckCrossChainPackage", "err", err) @@ -253,6 +253,7 @@ func (k Keeper) handlePackage( func executeClaim( ctx sdk.Context, app sdk.CrossChainApplication, + srcChainId uint32, sequence uint64, payload []byte, header *sdk.PackageHeader, @@ -272,18 +273,21 @@ func executeClaim( switch header.PackageType { case sdk.SynCrossChainPackageType: result = app.ExecuteSynPackage(ctx, &sdk.CrossChainAppContext{ - Sequence: sequence, - Header: header, + SrcChainId: sdk.ChainID(srcChainId), + Sequence: sequence, + Header: header, }, payload[sdk.SynPackageHeaderLength:]) case sdk.AckCrossChainPackageType: result = app.ExecuteAckPackage(ctx, &sdk.CrossChainAppContext{ - Sequence: sequence, - Header: header, + SrcChainId: sdk.ChainID(srcChainId), + Sequence: sequence, + Header: header, }, payload[sdk.AckPackageHeaderLength:]) case sdk.FailAckCrossChainPackageType: result = app.ExecuteFailAckPackage(ctx, &sdk.CrossChainAppContext{ - Sequence: sequence, - Header: header, + SrcChainId: sdk.ChainID(srcChainId), + Sequence: sequence, + Header: header, }, payload[sdk.AckPackageHeaderLength:]) default: panic(fmt.Sprintf("receive unexpected package type %d", header.PackageType)) diff --git a/x/oracle/keeper/msg_server_test.go b/x/oracle/keeper/msg_server_test.go index 9410e41263..6d8bdea033 100644 --- a/x/oracle/keeper/msg_server_test.go +++ b/x/oracle/keeper/msg_server_test.go @@ -38,11 +38,11 @@ func (s *TestSuite) TestClaim() { s.crossChainKeeper.EXPECT().GetSrcChainID().Return(sdk.ChainID(1)).AnyTimes() s.crossChainKeeper.EXPECT().IsDestChainSupported(sdk.ChainID(56)).Return(true).AnyTimes() - s.crossChainKeeper.EXPECT().GetReceiveSequence(gomock.Any(), types.RelayPackagesChannelId).Return(uint64(0)).AnyTimes() - s.crossChainKeeper.EXPECT().GetReceiveSequence(gomock.Any(), sdk.ChannelID(1)).Return(uint64(0)).AnyTimes() - s.crossChainKeeper.EXPECT().CreateRawIBCPackageWithFee(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(uint64(0), nil).AnyTimes() + s.crossChainKeeper.EXPECT().GetReceiveSequence(gomock.Any(), gomock.Any(), types.RelayPackagesChannelId).Return(uint64(0)).AnyTimes() + s.crossChainKeeper.EXPECT().GetReceiveSequence(gomock.Any(), gomock.Any(), sdk.ChannelID(1)).Return(uint64(0)).AnyTimes() + s.crossChainKeeper.EXPECT().CreateRawIBCPackageWithFee(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(uint64(0), nil).AnyTimes() s.crossChainKeeper.EXPECT().GetCrossChainApp(sdk.ChannelID(1)).Return(&DummyCrossChainApp{}).AnyTimes() - s.crossChainKeeper.EXPECT().IncrReceiveSequence(gomock.Any(), gomock.Any()).Return().AnyTimes() + s.crossChainKeeper.EXPECT().IncrReceiveSequence(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes() s.stakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("BNB").AnyTimes() s.bankKeeper.EXPECT().SendCoinsFromModuleToAccount(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() @@ -104,11 +104,11 @@ func (s *TestSuite) TestInvalidClaim() { s.crossChainKeeper.EXPECT().GetSrcChainID().Return(sdk.ChainID(1)).AnyTimes() s.crossChainKeeper.EXPECT().IsDestChainSupported(sdk.ChainID(65)).Return(false) - s.crossChainKeeper.EXPECT().GetReceiveSequence(gomock.Any(), types.RelayPackagesChannelId).Return(uint64(0)).AnyTimes() - s.crossChainKeeper.EXPECT().GetReceiveSequence(gomock.Any(), sdk.ChannelID(1)).Return(uint64(0)).AnyTimes() - s.crossChainKeeper.EXPECT().CreateRawIBCPackageWithFee(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(uint64(0), nil).AnyTimes() + s.crossChainKeeper.EXPECT().GetReceiveSequence(gomock.Any(), gomock.Any(), types.RelayPackagesChannelId).Return(uint64(0)).AnyTimes() + s.crossChainKeeper.EXPECT().GetReceiveSequence(gomock.Any(), gomock.Any(), sdk.ChannelID(1)).Return(uint64(0)).AnyTimes() + s.crossChainKeeper.EXPECT().CreateRawIBCPackageWithFee(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(uint64(0), nil).AnyTimes() s.crossChainKeeper.EXPECT().GetCrossChainApp(sdk.ChannelID(1)).Return(&DummyCrossChainApp{}).AnyTimes() - s.crossChainKeeper.EXPECT().IncrReceiveSequence(gomock.Any(), gomock.Any()).Return().AnyTimes() + s.crossChainKeeper.EXPECT().IncrReceiveSequence(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes() s.stakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("BNB").AnyTimes() s.bankKeeper.EXPECT().SendCoinsFromModuleToAccount(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() diff --git a/x/oracle/types/expected_keeper_mocks.go b/x/oracle/types/expected_keeper_mocks.go index 6756d97639..d63d1ffe3d 100644 --- a/x/oracle/types/expected_keeper_mocks.go +++ b/x/oracle/types/expected_keeper_mocks.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/cosmos/cosmos-sdk/x/oracle/types (interfaces: StakingKeeper,CrossChainKeeper,BankKeeper) +// Source: expected_keepers.go // Package types is a generated GoMock package. package types @@ -8,145 +8,144 @@ import ( big "math/big" reflect "reflect" - gomock "github.com/golang/mock/gomock" - types "github.com/cosmos/cosmos-sdk/types" types0 "github.com/cosmos/cosmos-sdk/x/staking/types" + gomock "github.com/golang/mock/gomock" ) -// MockStakingKeeper is a mock of StakingKeeper interface +// MockStakingKeeper is a mock of StakingKeeper interface. type MockStakingKeeper struct { ctrl *gomock.Controller recorder *MockStakingKeeperMockRecorder } -// MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper +// MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper. type MockStakingKeeperMockRecorder struct { mock *MockStakingKeeper } -// NewMockStakingKeeper creates a new mock instance +// NewMockStakingKeeper creates a new mock instance. func NewMockStakingKeeper(ctrl *gomock.Controller) *MockStakingKeeper { mock := &MockStakingKeeper{ctrl: ctrl} mock.recorder = &MockStakingKeeperMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockStakingKeeper) EXPECT() *MockStakingKeeperMockRecorder { return m.recorder } -// BondDenom mocks base method -func (m *MockStakingKeeper) BondDenom(arg0 types.Context) string { +// BondDenom mocks base method. +func (m *MockStakingKeeper) BondDenom(ctx types.Context) string { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BondDenom", arg0) + ret := m.ctrl.Call(m, "BondDenom", ctx) ret0, _ := ret[0].(string) return ret0 } -// BondDenom indicates an expected call of BondDenom -func (mr *MockStakingKeeperMockRecorder) BondDenom(arg0 interface{}) *gomock.Call { +// BondDenom indicates an expected call of BondDenom. +func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondDenom", reflect.TypeOf((*MockStakingKeeper)(nil).BondDenom), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondDenom", reflect.TypeOf((*MockStakingKeeper)(nil).BondDenom), ctx) } -// GetHistoricalInfo mocks base method -func (m *MockStakingKeeper) GetHistoricalInfo(arg0 types.Context, arg1 int64) (types0.HistoricalInfo, bool) { +// GetHistoricalInfo mocks base method. +func (m *MockStakingKeeper) GetHistoricalInfo(ctx types.Context, height int64) (types0.HistoricalInfo, bool) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetHistoricalInfo", arg0, arg1) + ret := m.ctrl.Call(m, "GetHistoricalInfo", ctx, height) ret0, _ := ret[0].(types0.HistoricalInfo) ret1, _ := ret[1].(bool) return ret0, ret1 } -// GetHistoricalInfo indicates an expected call of GetHistoricalInfo -func (mr *MockStakingKeeperMockRecorder) GetHistoricalInfo(arg0, arg1 interface{}) *gomock.Call { +// GetHistoricalInfo indicates an expected call of GetHistoricalInfo. +func (mr *MockStakingKeeperMockRecorder) GetHistoricalInfo(ctx, height interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHistoricalInfo", reflect.TypeOf((*MockStakingKeeper)(nil).GetHistoricalInfo), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHistoricalInfo", reflect.TypeOf((*MockStakingKeeper)(nil).GetHistoricalInfo), ctx, height) } -// GetLastValidators mocks base method -func (m *MockStakingKeeper) GetLastValidators(arg0 types.Context) []types0.Validator { +// GetLastValidators mocks base method. +func (m *MockStakingKeeper) GetLastValidators(ctx types.Context) []types0.Validator { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetLastValidators", arg0) + ret := m.ctrl.Call(m, "GetLastValidators", ctx) ret0, _ := ret[0].([]types0.Validator) return ret0 } -// GetLastValidators indicates an expected call of GetLastValidators -func (mr *MockStakingKeeperMockRecorder) GetLastValidators(arg0 interface{}) *gomock.Call { +// GetLastValidators indicates an expected call of GetLastValidators. +func (mr *MockStakingKeeperMockRecorder) GetLastValidators(ctx interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLastValidators", reflect.TypeOf((*MockStakingKeeper)(nil).GetLastValidators), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLastValidators", reflect.TypeOf((*MockStakingKeeper)(nil).GetLastValidators), ctx) } -// MockCrossChainKeeper is a mock of CrossChainKeeper interface +// MockCrossChainKeeper is a mock of CrossChainKeeper interface. type MockCrossChainKeeper struct { ctrl *gomock.Controller recorder *MockCrossChainKeeperMockRecorder } -// MockCrossChainKeeperMockRecorder is the mock recorder for MockCrossChainKeeper +// MockCrossChainKeeperMockRecorder is the mock recorder for MockCrossChainKeeper. type MockCrossChainKeeperMockRecorder struct { mock *MockCrossChainKeeper } -// NewMockCrossChainKeeper creates a new mock instance +// NewMockCrossChainKeeper creates a new mock instance. func NewMockCrossChainKeeper(ctrl *gomock.Controller) *MockCrossChainKeeper { mock := &MockCrossChainKeeper{ctrl: ctrl} mock.recorder = &MockCrossChainKeeperMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockCrossChainKeeper) EXPECT() *MockCrossChainKeeperMockRecorder { return m.recorder } -// CreateRawIBCPackageWithFee mocks base method -func (m *MockCrossChainKeeper) CreateRawIBCPackageWithFee(arg0 types.Context, arg1 types.ChannelID, arg2 types.CrossChainPackageType, arg3 []byte, arg4, arg5 *big.Int) (uint64, error) { +// CreateRawIBCPackageWithFee mocks base method. +func (m *MockCrossChainKeeper) CreateRawIBCPackageWithFee(ctx types.Context, destChainId types.ChainID, channelID types.ChannelID, packageType types.CrossChainPackageType, packageLoad []byte, relayerFee, ackRelayerFee *big.Int) (uint64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateRawIBCPackageWithFee", arg0, arg1, arg2, arg3, arg4, arg5) + ret := m.ctrl.Call(m, "CreateRawIBCPackageWithFee", ctx, destChainId, channelID, packageType, packageLoad, relayerFee, ackRelayerFee) ret0, _ := ret[0].(uint64) ret1, _ := ret[1].(error) return ret0, ret1 } -// CreateRawIBCPackageWithFee indicates an expected call of CreateRawIBCPackageWithFee -func (mr *MockCrossChainKeeperMockRecorder) CreateRawIBCPackageWithFee(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +// CreateRawIBCPackageWithFee indicates an expected call of CreateRawIBCPackageWithFee. +func (mr *MockCrossChainKeeperMockRecorder) CreateRawIBCPackageWithFee(ctx, destChainId, channelID, packageType, packageLoad, relayerFee, ackRelayerFee interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRawIBCPackageWithFee", reflect.TypeOf((*MockCrossChainKeeper)(nil).CreateRawIBCPackageWithFee), arg0, arg1, arg2, arg3, arg4, arg5) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRawIBCPackageWithFee", reflect.TypeOf((*MockCrossChainKeeper)(nil).CreateRawIBCPackageWithFee), ctx, destChainId, channelID, packageType, packageLoad, relayerFee, ackRelayerFee) } -// GetCrossChainApp mocks base method -func (m *MockCrossChainKeeper) GetCrossChainApp(arg0 types.ChannelID) types.CrossChainApplication { +// GetCrossChainApp mocks base method. +func (m *MockCrossChainKeeper) GetCrossChainApp(channelID types.ChannelID) types.CrossChainApplication { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCrossChainApp", arg0) + ret := m.ctrl.Call(m, "GetCrossChainApp", channelID) ret0, _ := ret[0].(types.CrossChainApplication) return ret0 } -// GetCrossChainApp indicates an expected call of GetCrossChainApp -func (mr *MockCrossChainKeeperMockRecorder) GetCrossChainApp(arg0 interface{}) *gomock.Call { +// GetCrossChainApp indicates an expected call of GetCrossChainApp. +func (mr *MockCrossChainKeeperMockRecorder) GetCrossChainApp(channelID interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCrossChainApp", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetCrossChainApp), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCrossChainApp", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetCrossChainApp), channelID) } -// GetReceiveSequence mocks base method -func (m *MockCrossChainKeeper) GetReceiveSequence(arg0 types.Context, arg1 types.ChannelID) uint64 { +// GetReceiveSequence mocks base method. +func (m *MockCrossChainKeeper) GetReceiveSequence(ctx types.Context, chainId types.ChainID, channelID types.ChannelID) uint64 { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetReceiveSequence", arg0, arg1) + ret := m.ctrl.Call(m, "GetReceiveSequence", ctx, chainId, channelID) ret0, _ := ret[0].(uint64) return ret0 } -// GetReceiveSequence indicates an expected call of GetReceiveSequence -func (mr *MockCrossChainKeeperMockRecorder) GetReceiveSequence(arg0, arg1 interface{}) *gomock.Call { +// GetReceiveSequence indicates an expected call of GetReceiveSequence. +func (mr *MockCrossChainKeeperMockRecorder) GetReceiveSequence(ctx, chainId, channelID interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReceiveSequence", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetReceiveSequence), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReceiveSequence", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetReceiveSequence), ctx, chainId, channelID) } -// GetSrcChainID mocks base method +// GetSrcChainID mocks base method. func (m *MockCrossChainKeeper) GetSrcChainID() types.ChainID { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSrcChainID") @@ -154,71 +153,71 @@ func (m *MockCrossChainKeeper) GetSrcChainID() types.ChainID { return ret0 } -// GetSrcChainID indicates an expected call of GetSrcChainID +// GetSrcChainID indicates an expected call of GetSrcChainID. func (mr *MockCrossChainKeeperMockRecorder) GetSrcChainID() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSrcChainID", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetSrcChainID)) } -// IncrReceiveSequence mocks base method -func (m *MockCrossChainKeeper) IncrReceiveSequence(arg0 types.Context, arg1 types.ChannelID) { +// IncrReceiveSequence mocks base method. +func (m *MockCrossChainKeeper) IncrReceiveSequence(ctx types.Context, chainId types.ChainID, channelID types.ChannelID) { m.ctrl.T.Helper() - m.ctrl.Call(m, "IncrReceiveSequence", arg0, arg1) + m.ctrl.Call(m, "IncrReceiveSequence", ctx, chainId, channelID) } -// IncrReceiveSequence indicates an expected call of IncrReceiveSequence -func (mr *MockCrossChainKeeperMockRecorder) IncrReceiveSequence(arg0, arg1 interface{}) *gomock.Call { +// IncrReceiveSequence indicates an expected call of IncrReceiveSequence. +func (mr *MockCrossChainKeeperMockRecorder) IncrReceiveSequence(ctx, chainId, channelID interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IncrReceiveSequence", reflect.TypeOf((*MockCrossChainKeeper)(nil).IncrReceiveSequence), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IncrReceiveSequence", reflect.TypeOf((*MockCrossChainKeeper)(nil).IncrReceiveSequence), ctx, chainId, channelID) } -// IsDestChainSupported mocks base method -func (m *MockCrossChainKeeper) IsDestChainSupported(arg0 types.ChainID) bool { +// IsDestChainSupported mocks base method. +func (m *MockCrossChainKeeper) IsDestChainSupported(chainID types.ChainID) bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsDestChainSupported", arg0) + ret := m.ctrl.Call(m, "IsDestChainSupported", chainID) ret0, _ := ret[0].(bool) return ret0 } -// IsDestChainSupported indicates an expected call of IsDestChainSupported -func (mr *MockCrossChainKeeperMockRecorder) IsDestChainSupported(arg0 interface{}) *gomock.Call { +// IsDestChainSupported indicates an expected call of IsDestChainSupported. +func (mr *MockCrossChainKeeperMockRecorder) IsDestChainSupported(chainID interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsDestChainSupported", reflect.TypeOf((*MockCrossChainKeeper)(nil).IsDestChainSupported), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsDestChainSupported", reflect.TypeOf((*MockCrossChainKeeper)(nil).IsDestChainSupported), chainID) } -// MockBankKeeper is a mock of BankKeeper interface +// MockBankKeeper is a mock of BankKeeper interface. type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder } -// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper +// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. type MockBankKeeperMockRecorder struct { mock *MockBankKeeper } -// NewMockBankKeeper creates a new mock instance +// NewMockBankKeeper creates a new mock instance. func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper { mock := &MockBankKeeper{ctrl: ctrl} mock.recorder = &MockBankKeeperMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { return m.recorder } -// SendCoinsFromModuleToAccount mocks base method -func (m *MockBankKeeper) SendCoinsFromModuleToAccount(arg0 types.Context, arg1 string, arg2 types.AccAddress, arg3 types.Coins) error { +// SendCoinsFromModuleToAccount mocks base method. +func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendCoinsFromModuleToAccount", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "SendCoinsFromModuleToAccount", ctx, senderModule, recipientAddr, amt) ret0, _ := ret[0].(error) return ret0 } -// SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +// SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) } diff --git a/x/oracle/types/expected_keepers.go b/x/oracle/types/expected_keepers.go index 47b24572d8..6d751db32e 100644 --- a/x/oracle/types/expected_keepers.go +++ b/x/oracle/types/expected_keepers.go @@ -14,14 +14,14 @@ type StakingKeeper interface { } type CrossChainKeeper interface { - CreateRawIBCPackageWithFee(ctx sdk.Context, channelID sdk.ChannelID, + CreateRawIBCPackageWithFee(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID, packageType sdk.CrossChainPackageType, packageLoad []byte, relayerFee, ackRelayerFee *big.Int, ) (uint64, error) GetCrossChainApp(channelID sdk.ChannelID) sdk.CrossChainApplication GetSrcChainID() sdk.ChainID IsDestChainSupported(chainID sdk.ChainID) bool - GetReceiveSequence(ctx sdk.Context, channelID sdk.ChannelID) uint64 - IncrReceiveSequence(ctx sdk.Context, channelID sdk.ChannelID) + GetReceiveSequence(ctx sdk.Context, chainId sdk.ChainID, channelID sdk.ChannelID) uint64 + IncrReceiveSequence(ctx sdk.Context, chainId sdk.ChainID, channelID sdk.ChannelID) } type BankKeeper interface {