From 57e0877726ca85f9a4de2376bfed7186c606d4ec Mon Sep 17 00:00:00 2001 From: Ruslan Akhtariev Date: Mon, 24 Apr 2023 09:50:14 +0800 Subject: [PATCH 1/4] x/ccv/types: sdk.Int -> math.Int, update sdkerrors path --- x/ccv/types/ccv.go | 2 +- x/ccv/types/errors.go | 2 +- x/ccv/types/expected_keepers.go | 5 +++-- x/ccv/types/utils.go | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/x/ccv/types/ccv.go b/x/ccv/types/ccv.go index 5622af8f8c..b41a7c6993 100644 --- a/x/ccv/types/ccv.go +++ b/x/ccv/types/ccv.go @@ -3,8 +3,8 @@ package types import ( "fmt" + sdkerrors "cosmossdk.io/errors" abci "github.com/cometbft/cometbft/abci/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) diff --git a/x/ccv/types/errors.go b/x/ccv/types/errors.go index 7b67a02d60..053ac6f8b4 100644 --- a/x/ccv/types/errors.go +++ b/x/ccv/types/errors.go @@ -1,7 +1,7 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrors "cosmossdk.io/errors" ) // CCV sentinel errors diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index a31c25a317..3da529b8b1 100644 --- a/x/ccv/types/expected_keepers.go +++ b/x/ccv/types/expected_keepers.go @@ -4,6 +4,7 @@ import ( context "context" "time" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" auth "github.com/cosmos/cosmos-sdk/x/auth/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" @@ -34,7 +35,7 @@ type StakingKeeper interface { Unjail(ctx sdk.Context, addr sdk.ConsAddress) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) IterateLastValidatorPowers(ctx sdk.Context, cb func(addr sdk.ValAddress, power int64) (stop bool)) - PowerReduction(ctx sdk.Context) sdk.Int + PowerReduction(ctx sdk.Context) math.Int PutUnbondingOnHold(ctx sdk.Context, id uint64) error IterateValidators(ctx sdk.Context, f func(index int64, validator stakingtypes.ValidatorI) (stop bool)) Validator(ctx sdk.Context, addr sdk.ValAddress) stakingtypes.ValidatorI @@ -42,7 +43,7 @@ type StakingKeeper interface { ValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) stakingtypes.ValidatorI Delegation(ctx sdk.Context, addr sdk.AccAddress, valAddr sdk.ValAddress) stakingtypes.DelegationI MaxValidators(ctx sdk.Context) uint32 - GetLastTotalPower(ctx sdk.Context) sdk.Int + GetLastTotalPower(ctx sdk.Context) math.Int GetLastValidators(ctx sdk.Context) (validators []stakingtypes.Validator) } diff --git a/x/ccv/types/utils.go b/x/ccv/types/utils.go index 55c280f39c..159f779362 100644 --- a/x/ccv/types/utils.go +++ b/x/ccv/types/utils.go @@ -5,11 +5,11 @@ import ( "sort" "time" + sdkerrors "cosmossdk.io/errors" abci "github.com/cometbft/cometbft/abci/types" tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" From 4479d85c6043db02d7e78319bb498e80b61034ca Mon Sep 17 00:00:00 2001 From: Ruslan Akhtariev Date: Mon, 24 Apr 2023 09:50:41 +0800 Subject: [PATCH 2/4] regenerate mocks --- testutil/keeper/mocks.go | 205 +++++++++++++++++++-------------------- 1 file changed, 100 insertions(+), 105 deletions(-) diff --git a/testutil/keeper/mocks.go b/testutil/keeper/mocks.go index 23171f8ed8..948d172c7b 100644 --- a/testutil/keeper/mocks.go +++ b/testutil/keeper/mocks.go @@ -1,7 +1,7 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/ccv/types/expected_keepers.go -// Package keeper is a generated GoMock package. +// Package mock_types is a generated GoMock package. package keeper import ( @@ -9,21 +9,20 @@ import ( reflect "reflect" time "time" - sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - types0 "github.com/cosmos/cosmos-sdk/x/auth/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - types1 "github.com/cosmos/cosmos-sdk/x/capability/types" - types2 "github.com/cosmos/cosmos-sdk/x/evidence/types" - types3 "github.com/cosmos/cosmos-sdk/x/slashing/types" - types4 "github.com/cosmos/cosmos-sdk/x/staking/types" - types5 "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - types6 "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" - types7 "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + math "cosmossdk.io/math" + types "github.com/cometbft/cometbft/abci/types" + types0 "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/x/auth/types" + types2 "github.com/cosmos/cosmos-sdk/x/capability/types" + types3 "github.com/cosmos/cosmos-sdk/x/evidence/types" + types4 "github.com/cosmos/cosmos-sdk/x/slashing/types" + types5 "github.com/cosmos/cosmos-sdk/x/staking/types" + types6 "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + types7 "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + types8 "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" + types9 "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" exported "github.com/cosmos/ibc-go/v7/modules/core/exported" gomock "github.com/golang/mock/gomock" - types8 "github.com/cometbft/cometbft/abci/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" ) // MockStakingKeeper is a mock of StakingKeeper interface. @@ -50,10 +49,10 @@ func (m *MockStakingKeeper) EXPECT() *MockStakingKeeperMockRecorder { } // Delegation mocks base method. -func (m *MockStakingKeeper) Delegation(ctx types.Context, addr types.AccAddress, valAddr types.ValAddress) types4.DelegationI { +func (m *MockStakingKeeper) Delegation(ctx types0.Context, addr types0.AccAddress, valAddr types0.ValAddress) types5.DelegationI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Delegation", ctx, addr, valAddr) - ret0, _ := ret[0].(types4.DelegationI) + ret0, _ := ret[0].(types5.DelegationI) return ret0 } @@ -64,10 +63,10 @@ func (mr *MockStakingKeeperMockRecorder) Delegation(ctx, addr, valAddr interface } // GetLastTotalPower mocks base method. -func (m *MockStakingKeeper) GetLastTotalPower(ctx types.Context) types.Int { +func (m *MockStakingKeeper) GetLastTotalPower(ctx types0.Context) math.Int { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetLastTotalPower", ctx) - ret0, _ := ret[0].(types.Int) + ret0, _ := ret[0].(math.Int) return ret0 } @@ -78,7 +77,7 @@ func (mr *MockStakingKeeperMockRecorder) GetLastTotalPower(ctx interface{}) *gom } // GetLastValidatorPower mocks base method. -func (m *MockStakingKeeper) GetLastValidatorPower(ctx types.Context, operator types.ValAddress) int64 { +func (m *MockStakingKeeper) GetLastValidatorPower(ctx types0.Context, operator types0.ValAddress) int64 { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetLastValidatorPower", ctx, operator) ret0, _ := ret[0].(int64) @@ -92,10 +91,10 @@ func (mr *MockStakingKeeperMockRecorder) GetLastValidatorPower(ctx, operator int } // GetLastValidators mocks base method. -func (m *MockStakingKeeper) GetLastValidators(ctx types.Context) []types4.Validator { +func (m *MockStakingKeeper) GetLastValidators(ctx types0.Context) []types5.Validator { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetLastValidators", ctx) - ret0, _ := ret[0].([]types4.Validator) + ret0, _ := ret[0].([]types5.Validator) return ret0 } @@ -106,10 +105,10 @@ func (mr *MockStakingKeeperMockRecorder) GetLastValidators(ctx interface{}) *gom } // GetValidator mocks base method. -func (m *MockStakingKeeper) GetValidator(ctx types.Context, addr types.ValAddress) (types4.Validator, bool) { +func (m *MockStakingKeeper) GetValidator(ctx types0.Context, addr types0.ValAddress) (types5.Validator, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetValidator", ctx, addr) - ret0, _ := ret[0].(types4.Validator) + ret0, _ := ret[0].(types5.Validator) ret1, _ := ret[1].(bool) return ret0, ret1 } @@ -121,10 +120,10 @@ func (mr *MockStakingKeeperMockRecorder) GetValidator(ctx, addr interface{}) *go } // GetValidatorByConsAddr mocks base method. -func (m *MockStakingKeeper) GetValidatorByConsAddr(ctx types.Context, consAddr types.ConsAddress) (types4.Validator, bool) { +func (m *MockStakingKeeper) GetValidatorByConsAddr(ctx types0.Context, consAddr types0.ConsAddress) (types5.Validator, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetValidatorByConsAddr", ctx, consAddr) - ret0, _ := ret[0].(types4.Validator) + ret0, _ := ret[0].(types5.Validator) ret1, _ := ret[1].(bool) return ret0, ret1 } @@ -136,10 +135,10 @@ func (mr *MockStakingKeeperMockRecorder) GetValidatorByConsAddr(ctx, consAddr in } // GetValidatorUpdates mocks base method. -func (m *MockStakingKeeper) GetValidatorUpdates(ctx types.Context) []types8.ValidatorUpdate { +func (m *MockStakingKeeper) GetValidatorUpdates(ctx types0.Context) []types.ValidatorUpdate { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetValidatorUpdates", ctx) - ret0, _ := ret[0].([]types8.ValidatorUpdate) + ret0, _ := ret[0].([]types.ValidatorUpdate) return ret0 } @@ -150,7 +149,7 @@ func (mr *MockStakingKeeperMockRecorder) GetValidatorUpdates(ctx interface{}) *g } // IsValidatorJailed mocks base method. -func (m *MockStakingKeeper) IsValidatorJailed(ctx types.Context, addr types.ConsAddress) bool { +func (m *MockStakingKeeper) IsValidatorJailed(ctx types0.Context, addr types0.ConsAddress) bool { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "IsValidatorJailed", ctx, addr) ret0, _ := ret[0].(bool) @@ -164,7 +163,7 @@ func (mr *MockStakingKeeperMockRecorder) IsValidatorJailed(ctx, addr interface{} } // IterateLastValidatorPowers mocks base method. -func (m *MockStakingKeeper) IterateLastValidatorPowers(ctx types.Context, cb func(types.ValAddress, int64) bool) { +func (m *MockStakingKeeper) IterateLastValidatorPowers(ctx types0.Context, cb func(types0.ValAddress, int64) bool) { m.ctrl.T.Helper() m.ctrl.Call(m, "IterateLastValidatorPowers", ctx, cb) } @@ -176,7 +175,7 @@ func (mr *MockStakingKeeperMockRecorder) IterateLastValidatorPowers(ctx, cb inte } // IterateValidators mocks base method. -func (m *MockStakingKeeper) IterateValidators(ctx types.Context, f func(int64, types4.ValidatorI) bool) { +func (m *MockStakingKeeper) IterateValidators(ctx types0.Context, f func(int64, types5.ValidatorI) bool) { m.ctrl.T.Helper() m.ctrl.Call(m, "IterateValidators", ctx, f) } @@ -188,7 +187,7 @@ func (mr *MockStakingKeeperMockRecorder) IterateValidators(ctx, f interface{}) * } // Jail mocks base method. -func (m *MockStakingKeeper) Jail(arg0 types.Context, arg1 types.ConsAddress) { +func (m *MockStakingKeeper) Jail(arg0 types0.Context, arg1 types0.ConsAddress) { m.ctrl.T.Helper() m.ctrl.Call(m, "Jail", arg0, arg1) } @@ -200,7 +199,7 @@ func (mr *MockStakingKeeperMockRecorder) Jail(arg0, arg1 interface{}) *gomock.Ca } // MaxValidators mocks base method. -func (m *MockStakingKeeper) MaxValidators(ctx types.Context) uint32 { +func (m *MockStakingKeeper) MaxValidators(ctx types0.Context) uint32 { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "MaxValidators", ctx) ret0, _ := ret[0].(uint32) @@ -214,10 +213,10 @@ func (mr *MockStakingKeeperMockRecorder) MaxValidators(ctx interface{}) *gomock. } // PowerReduction mocks base method. -func (m *MockStakingKeeper) PowerReduction(ctx types.Context) types.Int { +func (m *MockStakingKeeper) PowerReduction(ctx types0.Context) math.Int { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "PowerReduction", ctx) - ret0, _ := ret[0].(types.Int) + ret0, _ := ret[0].(math.Int) return ret0 } @@ -228,7 +227,7 @@ func (mr *MockStakingKeeperMockRecorder) PowerReduction(ctx interface{}) *gomock } // PutUnbondingOnHold mocks base method. -func (m *MockStakingKeeper) PutUnbondingOnHold(ctx types.Context, id uint64) error { +func (m *MockStakingKeeper) PutUnbondingOnHold(ctx types0.Context, id uint64) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "PutUnbondingOnHold", ctx, id) ret0, _ := ret[0].(error) @@ -242,7 +241,7 @@ func (mr *MockStakingKeeperMockRecorder) PutUnbondingOnHold(ctx, id interface{}) } // Slash mocks base method. -func (m *MockStakingKeeper) Slash(arg0 types.Context, arg1 types.ConsAddress, arg2, arg3 int64, arg4 types.Dec, arg5 types4.Infraction) { +func (m *MockStakingKeeper) Slash(arg0 types0.Context, arg1 types0.ConsAddress, arg2, arg3 int64, arg4 types0.Dec, arg5 types5.Infraction) { m.ctrl.T.Helper() m.ctrl.Call(m, "Slash", arg0, arg1, arg2, arg3, arg4, arg5) } @@ -254,7 +253,7 @@ func (mr *MockStakingKeeperMockRecorder) Slash(arg0, arg1, arg2, arg3, arg4, arg } // UnbondingCanComplete mocks base method. -func (m *MockStakingKeeper) UnbondingCanComplete(ctx types.Context, id uint64) error { +func (m *MockStakingKeeper) UnbondingCanComplete(ctx types0.Context, id uint64) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UnbondingCanComplete", ctx, id) ret0, _ := ret[0].(error) @@ -268,7 +267,7 @@ func (mr *MockStakingKeeperMockRecorder) UnbondingCanComplete(ctx, id interface{ } // UnbondingTime mocks base method. -func (m *MockStakingKeeper) UnbondingTime(ctx types.Context) time.Duration { +func (m *MockStakingKeeper) UnbondingTime(ctx types0.Context) time.Duration { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UnbondingTime", ctx) ret0, _ := ret[0].(time.Duration) @@ -282,7 +281,7 @@ func (mr *MockStakingKeeperMockRecorder) UnbondingTime(ctx interface{}) *gomock. } // Unjail mocks base method. -func (m *MockStakingKeeper) Unjail(ctx types.Context, addr types.ConsAddress) { +func (m *MockStakingKeeper) Unjail(ctx types0.Context, addr types0.ConsAddress) { m.ctrl.T.Helper() m.ctrl.Call(m, "Unjail", ctx, addr) } @@ -294,10 +293,10 @@ func (mr *MockStakingKeeperMockRecorder) Unjail(ctx, addr interface{}) *gomock.C } // Validator mocks base method. -func (m *MockStakingKeeper) Validator(ctx types.Context, addr types.ValAddress) types4.ValidatorI { +func (m *MockStakingKeeper) Validator(ctx types0.Context, addr types0.ValAddress) types5.ValidatorI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Validator", ctx, addr) - ret0, _ := ret[0].(types4.ValidatorI) + ret0, _ := ret[0].(types5.ValidatorI) return ret0 } @@ -308,10 +307,10 @@ func (mr *MockStakingKeeperMockRecorder) Validator(ctx, addr interface{}) *gomoc } // ValidatorByConsAddr mocks base method. -func (m *MockStakingKeeper) ValidatorByConsAddr(ctx types.Context, consAddr types.ConsAddress) types4.ValidatorI { +func (m *MockStakingKeeper) ValidatorByConsAddr(ctx types0.Context, consAddr types0.ConsAddress) types5.ValidatorI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ValidatorByConsAddr", ctx, consAddr) - ret0, _ := ret[0].(types4.ValidatorI) + ret0, _ := ret[0].(types5.ValidatorI) return ret0 } @@ -345,7 +344,7 @@ func (m *MockEvidenceKeeper) EXPECT() *MockEvidenceKeeperMockRecorder { } // HandleEquivocationEvidence mocks base method. -func (m *MockEvidenceKeeper) HandleEquivocationEvidence(ctx types.Context, evidence *types2.Equivocation) { +func (m *MockEvidenceKeeper) HandleEquivocationEvidence(ctx types0.Context, evidence *types3.Equivocation) { m.ctrl.T.Helper() m.ctrl.Call(m, "HandleEquivocationEvidence", ctx, evidence) } @@ -380,7 +379,7 @@ func (m *MockSlashingKeeper) EXPECT() *MockSlashingKeeperMockRecorder { } // DowntimeJailDuration mocks base method. -func (m *MockSlashingKeeper) DowntimeJailDuration(arg0 types.Context) time.Duration { +func (m *MockSlashingKeeper) DowntimeJailDuration(arg0 types0.Context) time.Duration { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DowntimeJailDuration", arg0) ret0, _ := ret[0].(time.Duration) @@ -394,10 +393,10 @@ func (mr *MockSlashingKeeperMockRecorder) DowntimeJailDuration(arg0 interface{}) } // GetValidatorSigningInfo mocks base method. -func (m *MockSlashingKeeper) GetValidatorSigningInfo(ctx types.Context, address types.ConsAddress) (types3.ValidatorSigningInfo, bool) { +func (m *MockSlashingKeeper) GetValidatorSigningInfo(ctx types0.Context, address types0.ConsAddress) (types4.ValidatorSigningInfo, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetValidatorSigningInfo", ctx, address) - ret0, _ := ret[0].(types3.ValidatorSigningInfo) + ret0, _ := ret[0].(types4.ValidatorSigningInfo) ret1, _ := ret[1].(bool) return ret0, ret1 } @@ -409,7 +408,7 @@ func (mr *MockSlashingKeeperMockRecorder) GetValidatorSigningInfo(ctx, address i } // IsTombstoned mocks base method. -func (m *MockSlashingKeeper) IsTombstoned(arg0 types.Context, arg1 types.ConsAddress) bool { +func (m *MockSlashingKeeper) IsTombstoned(arg0 types0.Context, arg1 types0.ConsAddress) bool { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "IsTombstoned", arg0, arg1) ret0, _ := ret[0].(bool) @@ -423,7 +422,7 @@ func (mr *MockSlashingKeeperMockRecorder) IsTombstoned(arg0, arg1 interface{}) * } // JailUntil mocks base method. -func (m *MockSlashingKeeper) JailUntil(arg0 types.Context, arg1 types.ConsAddress, arg2 time.Time) { +func (m *MockSlashingKeeper) JailUntil(arg0 types0.Context, arg1 types0.ConsAddress, arg2 time.Time) { m.ctrl.T.Helper() m.ctrl.Call(m, "JailUntil", arg0, arg1, arg2) } @@ -435,10 +434,10 @@ func (mr *MockSlashingKeeperMockRecorder) JailUntil(arg0, arg1, arg2 interface{} } // SlashFractionDoubleSign mocks base method. -func (m *MockSlashingKeeper) SlashFractionDoubleSign(ctx types.Context) types.Dec { +func (m *MockSlashingKeeper) SlashFractionDoubleSign(ctx types0.Context) types0.Dec { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SlashFractionDoubleSign", ctx) - ret0, _ := ret[0].(types.Dec) + ret0, _ := ret[0].(types0.Dec) return ret0 } @@ -449,10 +448,10 @@ func (mr *MockSlashingKeeperMockRecorder) SlashFractionDoubleSign(ctx interface{ } // SlashFractionDowntime mocks base method. -func (m *MockSlashingKeeper) SlashFractionDowntime(arg0 types.Context) types.Dec { +func (m *MockSlashingKeeper) SlashFractionDowntime(arg0 types0.Context) types0.Dec { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SlashFractionDowntime", arg0) - ret0, _ := ret[0].(types.Dec) + ret0, _ := ret[0].(types0.Dec) return ret0 } @@ -463,7 +462,7 @@ func (mr *MockSlashingKeeperMockRecorder) SlashFractionDowntime(arg0 interface{} } // Tombstone mocks base method. -func (m *MockSlashingKeeper) Tombstone(arg0 types.Context, arg1 types.ConsAddress) { +func (m *MockSlashingKeeper) Tombstone(arg0 types0.Context, arg1 types0.ConsAddress) { m.ctrl.T.Helper() m.ctrl.Call(m, "Tombstone", arg0, arg1) } @@ -498,7 +497,7 @@ func (m *MockChannelKeeper) EXPECT() *MockChannelKeeperMockRecorder { } // ChanCloseInit mocks base method. -func (m *MockChannelKeeper) ChanCloseInit(ctx types.Context, portID, channelID string, chanCap *types1.Capability) error { +func (m *MockChannelKeeper) ChanCloseInit(ctx types0.Context, portID, channelID string, chanCap *types2.Capability) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ChanCloseInit", ctx, portID, channelID, chanCap) ret0, _ := ret[0].(error) @@ -512,10 +511,10 @@ func (mr *MockChannelKeeperMockRecorder) ChanCloseInit(ctx, portID, channelID, c } // GetChannel mocks base method. -func (m *MockChannelKeeper) GetChannel(ctx types.Context, srcPort, srcChan string) (types7.Channel, bool) { +func (m *MockChannelKeeper) GetChannel(ctx types0.Context, srcPort, srcChan string) (types9.Channel, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetChannel", ctx, srcPort, srcChan) - ret0, _ := ret[0].(types7.Channel) + ret0, _ := ret[0].(types9.Channel) ret1, _ := ret[1].(bool) return ret0, ret1 } @@ -527,7 +526,7 @@ func (mr *MockChannelKeeperMockRecorder) GetChannel(ctx, srcPort, srcChan interf } // GetNextSequenceSend mocks base method. -func (m *MockChannelKeeper) GetNextSequenceSend(ctx types.Context, portID, channelID string) (uint64, bool) { +func (m *MockChannelKeeper) GetNextSequenceSend(ctx types0.Context, portID, channelID string) (uint64, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetNextSequenceSend", ctx, portID, channelID) ret0, _ := ret[0].(uint64) @@ -542,29 +541,22 @@ func (mr *MockChannelKeeperMockRecorder) GetNextSequenceSend(ctx, portID, channe } // SendPacket mocks base method. -func (m *MockChannelKeeper) SendPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, - sourcePort string, - sourceChannel string, - timeoutHeight clienttypes.Height, - timeoutTimestamp uint64, - data []byte, -) (sequence uint64, err error) { +func (m *MockChannelKeeper) SendPacket(ctx types0.Context, chanCap *types2.Capability, sourcePort, sourceChannel string, timeoutHeight types7.Height, timeoutTimestamp uint64, data []byte) (uint64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendPacket", ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) - ret0, _ := ret[0].(error) - return 0, ret0 + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 } // SendPacket indicates an expected call of SendPacket. -func (mr *MockChannelKeeperMockRecorder) SendPacket(ctx, channelCap, packet interface{}) *gomock.Call { +func (mr *MockChannelKeeperMockRecorder) SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendPacket", reflect.TypeOf((*MockChannelKeeper)(nil).SendPacket), ctx, channelCap, packet) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendPacket", reflect.TypeOf((*MockChannelKeeper)(nil).SendPacket), ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) } // WriteAcknowledgement mocks base method. -func (m *MockChannelKeeper) WriteAcknowledgement(ctx types.Context, chanCap *types1.Capability, packet exported.PacketI, acknowledgement exported.Acknowledgement) error { +func (m *MockChannelKeeper) WriteAcknowledgement(ctx types0.Context, chanCap *types2.Capability, packet exported.PacketI, acknowledgement exported.Acknowledgement) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "WriteAcknowledgement", ctx, chanCap, packet, acknowledgement) ret0, _ := ret[0].(error) @@ -601,10 +593,10 @@ func (m *MockPortKeeper) EXPECT() *MockPortKeeperMockRecorder { } // BindPort mocks base method. -func (m *MockPortKeeper) BindPort(ctx types.Context, portID string) *types1.Capability { +func (m *MockPortKeeper) BindPort(ctx types0.Context, portID string) *types2.Capability { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "BindPort", ctx, portID) - ret0, _ := ret[0].(*types1.Capability) + ret0, _ := ret[0].(*types2.Capability) return ret0 } @@ -638,10 +630,10 @@ func (m *MockConnectionKeeper) EXPECT() *MockConnectionKeeperMockRecorder { } // GetConnection mocks base method. -func (m *MockConnectionKeeper) GetConnection(ctx types.Context, connectionID string) (types6.ConnectionEnd, bool) { +func (m *MockConnectionKeeper) GetConnection(ctx types0.Context, connectionID string) (types8.ConnectionEnd, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetConnection", ctx, connectionID) - ret0, _ := ret[0].(types6.ConnectionEnd) + ret0, _ := ret[0].(types8.ConnectionEnd) ret1, _ := ret[1].(bool) return ret0, ret1 } @@ -676,7 +668,7 @@ func (m *MockClientKeeper) EXPECT() *MockClientKeeperMockRecorder { } // CreateClient mocks base method. -func (m *MockClientKeeper) CreateClient(ctx types.Context, clientState exported.ClientState, consensusState exported.ConsensusState) (string, error) { +func (m *MockClientKeeper) CreateClient(ctx types0.Context, clientState exported.ClientState, consensusState exported.ConsensusState) (string, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateClient", ctx, clientState, consensusState) ret0, _ := ret[0].(string) @@ -691,7 +683,7 @@ func (mr *MockClientKeeperMockRecorder) CreateClient(ctx, clientState, consensus } // GetClientState mocks base method. -func (m *MockClientKeeper) GetClientState(ctx types.Context, clientID string) (exported.ClientState, bool) { +func (m *MockClientKeeper) GetClientState(ctx types0.Context, clientID string) (exported.ClientState, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetClientState", ctx, clientID) ret0, _ := ret[0].(exported.ClientState) @@ -706,7 +698,7 @@ func (mr *MockClientKeeperMockRecorder) GetClientState(ctx, clientID interface{} } // GetLatestClientConsensusState mocks base method. -func (m *MockClientKeeper) GetLatestClientConsensusState(ctx types.Context, clientID string) (exported.ConsensusState, bool) { +func (m *MockClientKeeper) GetLatestClientConsensusState(ctx types0.Context, clientID string) (exported.ConsensusState, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetLatestClientConsensusState", ctx, clientID) ret0, _ := ret[0].(exported.ConsensusState) @@ -721,7 +713,7 @@ func (mr *MockClientKeeperMockRecorder) GetLatestClientConsensusState(ctx, clien } // GetSelfConsensusState mocks base method. -func (m *MockClientKeeper) GetSelfConsensusState(ctx types.Context, height exported.Height) (exported.ConsensusState, error) { +func (m *MockClientKeeper) GetSelfConsensusState(ctx types0.Context, height exported.Height) (exported.ConsensusState, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSelfConsensusState", ctx, height) ret0, _ := ret[0].(exported.ConsensusState) @@ -759,15 +751,17 @@ func (m *MockConsumerHooks) EXPECT() *MockConsumerHooksMockRecorder { } // AfterValidatorBonded mocks base method. -func (m *MockConsumerHooks) AfterValidatorBonded(ctx types.Context, consAddr types.ConsAddress, arg2 types.ValAddress) { +func (m *MockConsumerHooks) AfterValidatorBonded(ctx types0.Context, consAddr types0.ConsAddress, valAddresses types0.ValAddress) error { m.ctrl.T.Helper() - m.ctrl.Call(m, "AfterValidatorBonded", ctx, consAddr, arg2) + ret := m.ctrl.Call(m, "AfterValidatorBonded", ctx, consAddr, valAddresses) + ret0, _ := ret[0].(error) + return ret0 } // AfterValidatorBonded indicates an expected call of AfterValidatorBonded. -func (mr *MockConsumerHooksMockRecorder) AfterValidatorBonded(ctx, consAddr, arg2 interface{}) *gomock.Call { +func (mr *MockConsumerHooksMockRecorder) AfterValidatorBonded(ctx, consAddr, valAddresses interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterValidatorBonded", reflect.TypeOf((*MockConsumerHooks)(nil).AfterValidatorBonded), ctx, consAddr, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterValidatorBonded", reflect.TypeOf((*MockConsumerHooks)(nil).AfterValidatorBonded), ctx, consAddr, valAddresses) } // MockBankKeeper is a mock of BankKeeper interface. @@ -794,10 +788,10 @@ func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { } // GetAllBalances mocks base method. -func (m *MockBankKeeper) GetAllBalances(ctx types.Context, addr types.AccAddress) types.Coins { +func (m *MockBankKeeper) GetAllBalances(ctx types0.Context, addr types0.AccAddress) types0.Coins { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAllBalances", ctx, addr) - ret0, _ := ret[0].(types.Coins) + ret0, _ := ret[0].(types0.Coins) return ret0 } @@ -808,10 +802,10 @@ func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr interface{}) *gom } // GetBalance mocks base method. -func (m *MockBankKeeper) GetBalance(ctx types.Context, addr types.AccAddress, denom string) types.Coin { +func (m *MockBankKeeper) GetBalance(ctx types0.Context, addr types0.AccAddress, denom string) types0.Coin { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBalance", ctx, addr, denom) - ret0, _ := ret[0].(types.Coin) + ret0, _ := ret[0].(types0.Coin) return ret0 } @@ -822,7 +816,7 @@ func (mr *MockBankKeeperMockRecorder) GetBalance(ctx, addr, denom interface{}) * } // SendCoinsFromModuleToModule mocks base method. -func (m *MockBankKeeper) SendCoinsFromModuleToModule(ctx types.Context, senderModule, recipientModule string, amt types.Coins) error { +func (m *MockBankKeeper) SendCoinsFromModuleToModule(ctx types0.Context, senderModule, recipientModule string, amt types0.Coins) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendCoinsFromModuleToModule", ctx, senderModule, recipientModule, amt) ret0, _ := ret[0].(error) @@ -859,10 +853,10 @@ func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { } // GetModuleAccount mocks base method. -func (m *MockAccountKeeper) GetModuleAccount(ctx types.Context, name string) types0.ModuleAccountI { +func (m *MockAccountKeeper) GetModuleAccount(ctx types0.Context, name string) types1.ModuleAccountI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetModuleAccount", ctx, name) - ret0, _ := ret[0].(types0.ModuleAccountI) + ret0, _ := ret[0].(types1.ModuleAccountI) return ret0 } @@ -895,18 +889,19 @@ func (m *MockIBCTransferKeeper) EXPECT() *MockIBCTransferKeeperMockRecorder { return m.recorder } -// SendTransfer mocks base method. -func (m *MockIBCTransferKeeper) SendTransfer(ctx types.Context, sourcePort, sourceChannel string, token types.Coin, sender types.AccAddress, receiver string, timeoutHeight types5.Height, timeoutTimestamp uint64) error { +// Transfer mocks base method. +func (m *MockIBCTransferKeeper) Transfer(arg0 context.Context, arg1 *types6.MsgTransfer) (*types6.MsgTransferResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendTransfer", ctx, sourcePort, sourceChannel, token, sender, receiver, timeoutHeight, timeoutTimestamp) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "Transfer", arg0, arg1) + ret0, _ := ret[0].(*types6.MsgTransferResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// SendTransfer indicates an expected call of SendTransfer. -func (mr *MockIBCTransferKeeperMockRecorder) SendTransfer(ctx, sourcePort, sourceChannel, token, sender, receiver, timeoutHeight, timeoutTimestamp interface{}) *gomock.Call { +// Transfer indicates an expected call of Transfer. +func (mr *MockIBCTransferKeeperMockRecorder) Transfer(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendTransfer", reflect.TypeOf((*MockIBCTransferKeeper)(nil).SendTransfer), ctx, sourcePort, sourceChannel, token, sender, receiver, timeoutHeight, timeoutTimestamp) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Transfer", reflect.TypeOf((*MockIBCTransferKeeper)(nil).Transfer), arg0, arg1) } // MockIBCCoreKeeper is a mock of IBCCoreKeeper interface. @@ -933,10 +928,10 @@ func (m *MockIBCCoreKeeper) EXPECT() *MockIBCCoreKeeperMockRecorder { } // ChannelOpenInit mocks base method. -func (m *MockIBCCoreKeeper) ChannelOpenInit(goCtx context.Context, msg *types7.MsgChannelOpenInit) (*types7.MsgChannelOpenInitResponse, error) { +func (m *MockIBCCoreKeeper) ChannelOpenInit(goCtx context.Context, msg *types9.MsgChannelOpenInit) (*types9.MsgChannelOpenInitResponse, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ChannelOpenInit", goCtx, msg) - ret0, _ := ret[0].(*types7.MsgChannelOpenInitResponse) + ret0, _ := ret[0].(*types9.MsgChannelOpenInitResponse) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -971,7 +966,7 @@ func (m *MockScopedKeeper) EXPECT() *MockScopedKeeperMockRecorder { } // AuthenticateCapability mocks base method. -func (m *MockScopedKeeper) AuthenticateCapability(ctx types.Context, cap *types1.Capability, name string) bool { +func (m *MockScopedKeeper) AuthenticateCapability(ctx types0.Context, cap *types2.Capability, name string) bool { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AuthenticateCapability", ctx, cap, name) ret0, _ := ret[0].(bool) @@ -985,7 +980,7 @@ func (mr *MockScopedKeeperMockRecorder) AuthenticateCapability(ctx, cap, name in } // ClaimCapability mocks base method. -func (m *MockScopedKeeper) ClaimCapability(ctx types.Context, cap *types1.Capability, name string) error { +func (m *MockScopedKeeper) ClaimCapability(ctx types0.Context, cap *types2.Capability, name string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ClaimCapability", ctx, cap, name) ret0, _ := ret[0].(error) @@ -999,10 +994,10 @@ func (mr *MockScopedKeeperMockRecorder) ClaimCapability(ctx, cap, name interface } // GetCapability mocks base method. -func (m *MockScopedKeeper) GetCapability(ctx types.Context, name string) (*types1.Capability, bool) { +func (m *MockScopedKeeper) GetCapability(ctx types0.Context, name string) (*types2.Capability, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetCapability", ctx, name) - ret0, _ := ret[0].(*types1.Capability) + ret0, _ := ret[0].(*types2.Capability) ret1, _ := ret[1].(bool) return ret0, ret1 } From b4a000dfa0e733a1f9978dc90ed3f33a79a7298b Mon Sep 17 00:00:00 2001 From: Ruslan Akhtariev Date: Mon, 24 Apr 2023 10:31:29 +0800 Subject: [PATCH 3/4] remove unnecessary SA1019 disabler --- x/ccv/provider/keeper/key_assignment_test.go | 8 ++++---- x/ccv/provider/keeper/throttle_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index 6f3d3dbfcf..c8b20f6076 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -47,7 +47,7 @@ func TestGetAllValidatorConsumerPubKey(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - rand.Seed(time.Now().Unix()) // nolint:staticcheck // ignore SA1019 for tests + rand.Seed(time.Now().Unix()) chainIDs := []string{"consumer-1", "consumer-2", "consumer-3"} numAssignments := 10 testAssignments := []types.ValidatorConsumerPubKey{} @@ -124,7 +124,7 @@ func TestGetAllValidatorsByConsumerAddr(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - rand.Seed(time.Now().Unix()) // nolint:staticcheck // ignore SA1019 for tests + rand.Seed(time.Now().Unix()) chainIDs := []string{"consumer-1", "consumer-2", "consumer-3"} numAssignments := 10 testAssignments := []types.ValidatorByConsumerAddr{} @@ -202,7 +202,7 @@ func TestGetAllKeyAssignmentReplacements(t *testing.T) { chainID := "consumer-1" - rand.Seed(time.Now().Unix()) // nolint:staticcheck // ignore SA1019 for tests + rand.Seed(time.Now().Unix()) numAssignments := 10 testAssignments := []types.KeyAssignmentReplacement{} for i := 0; i < numAssignments; i++ { @@ -259,7 +259,7 @@ func TestGetAllConsumerAddrsToPrune(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - rand.Seed(time.Now().Unix()) // nolint:staticcheck // ignore SA1019 for tests + rand.Seed(time.Now().Unix()) chainIDs := []string{"consumer-1", "consumer-2", "consumer-3"} numAssignments := 10 testAssignments := []types.ConsumerAddrsToPrune{} diff --git a/x/ccv/provider/keeper/throttle_test.go b/x/ccv/provider/keeper/throttle_test.go index 381e9bbfcb..a18e1c9f10 100644 --- a/x/ccv/provider/keeper/throttle_test.go +++ b/x/ccv/provider/keeper/throttle_test.go @@ -782,7 +782,7 @@ func TestGlobalSlashEntryDeletion(t *testing.T) { // Instantiate shuffled copy of above slice shuffledEntries := append([]providertypes.GlobalSlashEntry{}, entries...) - rand.Seed(now.UnixNano()) // nolint:staticcheck // ignore SA1019 for tests + rand.Seed(now.UnixNano()) rand.Shuffle(len(shuffledEntries), func(i, j int) { shuffledEntries[i], shuffledEntries[j] = shuffledEntries[j], shuffledEntries[i] }) @@ -1190,7 +1190,7 @@ func TestPanicIfTooMuchThrottledPacketData(t *testing.T) { defaultParams.MaxThrottledPackets = tc.max providerKeeper.SetParams(ctx, defaultParams) - rand.Seed(time.Now().UnixNano()) // nolint:staticcheck // ignore SA1019 for tests + rand.Seed(time.Now().UnixNano()) // Queuing up a couple data instances for another chain shouldn't matter err := providerKeeper.QueueThrottledPacketData(ctx, "chain-17", 0, testkeeper.GetNewSlashPacketData()) From c24a75ff9405503d335f941573d41c881c26727c Mon Sep 17 00:00:00 2001 From: Ruslan Akhtariev Date: Mon, 24 Apr 2023 10:36:01 +0800 Subject: [PATCH 4/4] global midration from sdkerrors to cosmossdk.io/errors --- .../ante/forbidden_proposals_ante.go | 4 ++-- app/consumer-democracy/ante_handler.go | 9 +++++---- app/consumer/ante_handler.go | 9 +++++---- app/provider/ante_handler.go | 10 ++++++---- legacy_ibc_testing/testing/chain.go | 2 +- testutil/simibc/relay_util.go | 2 +- x/ccv/consumer/ibc_module.go | 8 +++++--- x/ccv/consumer/types/errors.go | 2 +- x/ccv/consumer/types/genesis.go | 2 +- x/ccv/consumer/types/validator.go | 5 +++-- x/ccv/provider/handler.go | 5 +++-- x/ccv/provider/ibc_module.go | 7 ++++--- x/ccv/provider/proposal_handler.go | 6 +++--- x/ccv/provider/types/errors.go | 2 +- x/ccv/provider/types/genesis.go | 2 +- x/ccv/provider/types/key_assignment.go | 2 +- x/ccv/provider/types/proposal.go | 2 +- 17 files changed, 44 insertions(+), 35 deletions(-) diff --git a/app/consumer-democracy/ante/forbidden_proposals_ante.go b/app/consumer-democracy/ante/forbidden_proposals_ante.go index 6734b6be7e..d959ede5c3 100644 --- a/app/consumer-democracy/ante/forbidden_proposals_ante.go +++ b/app/consumer-democracy/ante/forbidden_proposals_ante.go @@ -4,7 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrorstypes "github.com/cosmos/cosmos-sdk/types/errors" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -30,7 +30,7 @@ func (decorator ForbiddenProposalsDecorator) AnteHandle(ctx sdk.Context, tx sdk. sdkMsg, ok := message.GetCachedValue().(*govv1.MsgExecLegacyContent) if !ok { - return ctx, sdkerrors.ErrInvalidType.Wrapf("expected %T, got %T", (*govv1.MsgExecLegacyContent)(nil), message.GetCachedValue()) + return ctx, sdkerrorstypes.ErrInvalidType.Wrapf("expected %T, got %T", (*govv1.MsgExecLegacyContent)(nil), message.GetCachedValue()) } content, err := govv1.LegacyContentFromMessage(sdkMsg) diff --git a/app/consumer-democracy/ante_handler.go b/app/consumer-democracy/ante_handler.go index d19752b81b..d4c08598c0 100644 --- a/app/consumer-democracy/ante_handler.go +++ b/app/consumer-democracy/ante_handler.go @@ -1,8 +1,9 @@ package app import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrorstypes "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" @@ -22,13 +23,13 @@ type HandlerOptions struct { func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { if options.AccountKeeper == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler") + return nil, sdkerrors.Wrap(sdkerrorstypes.ErrLogic, "account keeper is required for AnteHandler") } if options.BankKeeper == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler") + return nil, sdkerrors.Wrap(sdkerrorstypes.ErrLogic, "bank keeper is required for AnteHandler") } if options.SignModeHandler == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") + return nil, sdkerrors.Wrap(sdkerrorstypes.ErrLogic, "sign mode handler is required for ante builder") } sigGasConsumer := options.SigGasConsumer diff --git a/app/consumer/ante_handler.go b/app/consumer/ante_handler.go index 40391e1978..b8e4584b0e 100644 --- a/app/consumer/ante_handler.go +++ b/app/consumer/ante_handler.go @@ -1,8 +1,9 @@ package app import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrorstypes "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" @@ -21,13 +22,13 @@ type HandlerOptions struct { func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { if options.AccountKeeper == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler") + return nil, sdkerrors.Wrap(sdkerrorstypes.ErrLogic, "account keeper is required for AnteHandler") } if options.BankKeeper == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler") + return nil, sdkerrors.Wrap(sdkerrorstypes.ErrLogic, "bank keeper is required for AnteHandler") } if options.SignModeHandler == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") + return nil, sdkerrors.Wrap(sdkerrorstypes.ErrLogic, "sign mode handler is required for ante builder") } sigGasConsumer := options.SigGasConsumer diff --git a/app/provider/ante_handler.go b/app/provider/ante_handler.go index 282f9d4b6d..395a61288e 100644 --- a/app/provider/ante_handler.go +++ b/app/provider/ante_handler.go @@ -1,8 +1,10 @@ package app import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrorstypes "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" @@ -18,13 +20,13 @@ type HandlerOptions struct { func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { if options.AccountKeeper == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler") + return nil, sdkerrors.Wrap(sdkerrorstypes.ErrLogic, "account keeper is required for AnteHandler") } if options.BankKeeper == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler") + return nil, sdkerrors.Wrap(sdkerrorstypes.ErrLogic, "bank keeper is required for AnteHandler") } if options.SignModeHandler == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") + return nil, sdkerrors.Wrap(sdkerrorstypes.ErrLogic, "sign mode handler is required for ante builder") } sigGasConsumer := options.SigGasConsumer diff --git a/legacy_ibc_testing/testing/chain.go b/legacy_ibc_testing/testing/chain.go index 0b11977bef..48b6c21bd4 100644 --- a/legacy_ibc_testing/testing/chain.go +++ b/legacy_ibc_testing/testing/chain.go @@ -6,6 +6,7 @@ import ( "testing" "time" + sdkerrors "cosmossdk.io/errors" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/crypto/tmhash" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" @@ -17,7 +18,6 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" diff --git a/testutil/simibc/relay_util.go b/testutil/simibc/relay_util.go index dd79a5a1b0..b3ac7bcd93 100644 --- a/testutil/simibc/relay_util.go +++ b/testutil/simibc/relay_util.go @@ -1,9 +1,9 @@ package simibc import ( + sdkerrors "cosmossdk.io/errors" tmtypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/x/ccv/consumer/ibc_module.go b/x/ccv/consumer/ibc_module.go index 9e189b420c..c662674a8b 100644 --- a/x/ccv/consumer/ibc_module.go +++ b/x/ccv/consumer/ibc_module.go @@ -4,8 +4,10 @@ import ( "fmt" "strings" + sdkerrors "cosmossdk.io/errors" + sdkerrorstypes "github.com/cosmos/cosmos-sdk/types/errors" + sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" @@ -207,7 +209,7 @@ func (am AppModule) OnChanCloseInit( if providerChannel, ok := am.keeper.GetProviderChannel(ctx); ok && providerChannel != channelID { return nil } - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "user cannot close channel") + return sdkerrors.Wrap(sdkerrorstypes.ErrInvalidRequest, "user cannot close channel") } // OnChanCloseConfirm implements the IBCModule interface @@ -258,7 +260,7 @@ func (am AppModule) OnAcknowledgementPacket( ) error { var ack channeltypes.Acknowledgement if err := types.ModuleCdc.UnmarshalJSON(acknowledgement, &ack); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal consumer packet acknowledgement: %v", err) + return sdkerrors.Wrapf(sdkerrorstypes.ErrUnknownRequest, "cannot unmarshal consumer packet acknowledgement: %v", err) } if err := am.keeper.OnAcknowledgementPacket(ctx, packet, ack); err != nil { diff --git a/x/ccv/consumer/types/errors.go b/x/ccv/consumer/types/errors.go index 486281139e..718f4b309b 100644 --- a/x/ccv/consumer/types/errors.go +++ b/x/ccv/consumer/types/errors.go @@ -1,7 +1,7 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrors "cosmossdk.io/errors" ) // Consumer sentinel errors diff --git a/x/ccv/consumer/types/genesis.go b/x/ccv/consumer/types/genesis.go index a2868842c3..f6a0c54173 100644 --- a/x/ccv/consumer/types/genesis.go +++ b/x/ccv/consumer/types/genesis.go @@ -1,7 +1,7 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrors "cosmossdk.io/errors" ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ccv "github.com/cosmos/interchain-security/x/ccv/types" diff --git a/x/ccv/consumer/types/validator.go b/x/ccv/consumer/types/validator.go index 69314b15d3..f77aeca0cd 100644 --- a/x/ccv/consumer/types/validator.go +++ b/x/ccv/consumer/types/validator.go @@ -1,9 +1,10 @@ package types import ( + sdkerrors "cosmossdk.io/errors" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrorstypes "github.com/cosmos/cosmos-sdk/types/errors" ) func NewCCValidator(address []byte, power int64, pubKey cryptotypes.PubKey) (CrossChainValidator, error) { @@ -29,7 +30,7 @@ func (ccv CrossChainValidator) UnpackInterfaces(unpacker codectypes.AnyUnpacker) func (ccv CrossChainValidator) ConsPubKey() (cryptotypes.PubKey, error) { pk, ok := ccv.Pubkey.GetCachedValue().(cryptotypes.PubKey) if !ok { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "expecting cryptotypes.PubKey, got %T", pk) + return nil, sdkerrors.Wrapf(sdkerrorstypes.ErrInvalidType, "expecting cryptotypes.PubKey, got %T", pk) } return pk, nil diff --git a/x/ccv/provider/handler.go b/x/ccv/provider/handler.go index 4751b8460c..73759277dd 100644 --- a/x/ccv/provider/handler.go +++ b/x/ccv/provider/handler.go @@ -1,8 +1,9 @@ package provider import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrorstypes "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/interchain-security/x/ccv/provider/keeper" "github.com/cosmos/interchain-security/x/ccv/provider/types" ) @@ -18,7 +19,7 @@ func NewHandler(k *keeper.Keeper) sdk.Handler { res, err := msgServer.AssignConsumerKey(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) + return nil, sdkerrors.Wrapf(sdkerrorstypes.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } } } diff --git a/x/ccv/provider/ibc_module.go b/x/ccv/provider/ibc_module.go index 08736a28ec..bc9fc09acb 100644 --- a/x/ccv/provider/ibc_module.go +++ b/x/ccv/provider/ibc_module.go @@ -3,8 +3,9 @@ package provider import ( "fmt" + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrorstypes "github.com/cosmos/cosmos-sdk/types/errors" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" @@ -151,7 +152,7 @@ func (am AppModule) OnChanCloseInit( channelID string, ) error { // Disallow user-initiated channel closing for provider channels - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "user cannot close channel") + return sdkerrors.Wrap(sdkerrorstypes.ErrInvalidRequest, "user cannot close channel") } // OnChanCloseConfirm implements the IBCModule interface @@ -216,7 +217,7 @@ func (am AppModule) OnAcknowledgementPacket( ) error { var ack channeltypes.Acknowledgement if err := ccv.ModuleCdc.UnmarshalJSON(acknowledgement, &ack); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal provider packet acknowledgement: %v", err) + return sdkerrors.Wrapf(sdkerrorstypes.ErrUnknownRequest, "cannot unmarshal provider packet acknowledgement: %v", err) } if err := am.keeper.OnAcknowledgementPacket(ctx, packet, ack); err != nil { diff --git a/x/ccv/provider/proposal_handler.go b/x/ccv/provider/proposal_handler.go index c8b135a805..13de8bb9df 100644 --- a/x/ccv/provider/proposal_handler.go +++ b/x/ccv/provider/proposal_handler.go @@ -1,9 +1,9 @@ package provider import ( - errorsmod "cosmossdk.io/errors" + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrorstypes "github.com/cosmos/cosmos-sdk/types/errors" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/interchain-security/x/ccv/provider/keeper" "github.com/cosmos/interchain-security/x/ccv/provider/types" @@ -22,7 +22,7 @@ func NewProviderProposalHandler(k keeper.Keeper) govv1beta1.Handler { case *types.EquivocationProposal: return k.HandleEquivocationProposal(ctx, c) default: - return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized ccv proposal content type: %T", c) + return sdkerrors.Wrapf(sdkerrorstypes.ErrUnknownRequest, "unrecognized ccv proposal content type: %T", c) } } } diff --git a/x/ccv/provider/types/errors.go b/x/ccv/provider/types/errors.go index 89505e3fd4..1d0cfe9013 100644 --- a/x/ccv/provider/types/errors.go +++ b/x/ccv/provider/types/errors.go @@ -1,7 +1,7 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrors "cosmossdk.io/errors" ) // Provider sentinel errors diff --git a/x/ccv/provider/types/genesis.go b/x/ccv/provider/types/genesis.go index 4d83726013..f863e81bb7 100644 --- a/x/ccv/provider/types/genesis.go +++ b/x/ccv/provider/types/genesis.go @@ -3,8 +3,8 @@ package types import ( "fmt" + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" ccv "github.com/cosmos/interchain-security/x/ccv/types" ) diff --git a/x/ccv/provider/types/key_assignment.go b/x/ccv/provider/types/key_assignment.go index 380b70c847..19b83eca6d 100644 --- a/x/ccv/provider/types/key_assignment.go +++ b/x/ccv/provider/types/key_assignment.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ccvtypes "github.com/cosmos/interchain-security/x/ccv/types" ) diff --git a/x/ccv/provider/types/proposal.go b/x/ccv/provider/types/proposal.go index 95de1620e9..39867d18e9 100644 --- a/x/ccv/provider/types/proposal.go +++ b/x/ccv/provider/types/proposal.go @@ -6,7 +6,7 @@ import ( "strings" time "time" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrors "cosmossdk.io/errors" evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"