diff --git a/app/app.go b/app/app.go index 2ed197734..c467d47bf 100644 --- a/app/app.go +++ b/app/app.go @@ -473,7 +473,6 @@ func New( app.BankKeeper, app.PaymentKeeper, ) - virtualgroupModule := virtualgroupmodule.NewAppModule(appCodec, app.VirtualgroupKeeper, app.SpKeeper) app.PermissionmoduleKeeper = *permissionmodulekeeper.NewKeeper( appCodec, @@ -497,6 +496,9 @@ func New( ) storageModule := storagemodule.NewAppModule(appCodec, app.StorageKeeper, app.AccountKeeper, app.BankKeeper, app.SpKeeper) + app.VirtualgroupKeeper.SetStorageKeeper(&app.StorageKeeper) + virtualgroupModule := virtualgroupmodule.NewAppModule(appCodec, app.VirtualgroupKeeper, app.SpKeeper) + app.ChallengeKeeper = *challengemodulekeeper.NewKeeper( appCodec, keys[challengemoduletypes.StoreKey], diff --git a/e2e/tests/permission_test.go b/e2e/tests/permission_test.go index 699d4f1b8..bf998799e 100644 --- a/e2e/tests/permission_test.go +++ b/e2e/tests/permission_test.go @@ -1925,7 +1925,7 @@ func (s *StorageTestSuite) TestExpiredAccountPolicyGCAndRePut() { Actions: []types.ActionType{types.ACTION_DELETE_BUCKET}, Effect: types.EFFECT_ALLOW, } - expirationTime := time.Now().Add(5 * time.Second) + expirationTime := time.Now().Add(3 * time.Second) msgPutBucketPolicy := storagetypes.NewMsgPutPolicy(owner.GetAddr(), types2.NewBucketGRN(bucketName).String(), principal, []*types.Statement{bucketStatement}, &expirationTime) @@ -1990,7 +1990,7 @@ func (s *StorageTestSuite) TestExpiredGroupPolicyGCAndRePut() { principal := types.NewPrincipalWithGroupId(headGroupResponse.GroupInfo.Id) // Put bucket policy for group - expirationTime := time.Now().Add(5 * time.Second) + expirationTime := time.Now().Add(3 * time.Second) bucketStatement := &types.Statement{ Actions: []types.ActionType{types.ACTION_DELETE_BUCKET}, diff --git a/e2e/tests/storage_test.go b/e2e/tests/storage_test.go index 366f4365d..9e4bff8c8 100644 --- a/e2e/tests/storage_test.go +++ b/e2e/tests/storage_test.go @@ -1699,7 +1699,7 @@ func (s *StorageTestSuite) TestRejectSealObject() { // secondarySPIDs = append(secondarySPIDs, ssp.Info.Id) // secondarySPs = append(secondarySPs, ssp) // } -// if len(secondarySPIDs) == 5 { +// if len(secondarySPIDs) == 6 { // break // } // } diff --git a/e2e/tests/virtualgroup_test.go b/e2e/tests/virtualgroup_test.go index 39e9e6663..c344ecfad 100644 --- a/e2e/tests/virtualgroup_test.go +++ b/e2e/tests/virtualgroup_test.go @@ -170,6 +170,39 @@ func (s *VirtualGroupTestSuite) TestBasic() { context.Background(), &virtualgroupmoduletypes.QueryGlobalVirtualGroupRequest{GlobalVirtualGroupId: newGVG.Id}) s.Require().Error(err) + + // test number of secondary SP doest not match onchain requirement + secondarySPIDs = append(secondarySPIDs, secondarySPIDs[0]) + msgCreateGVG := virtualgroupmoduletypes.MsgCreateGlobalVirtualGroup{ + StorageProvider: primarySP.OperatorKey.GetAddr().String(), + FamilyId: virtualgroupmoduletypes.NoSpecifiedFamilyId, + SecondarySpIds: secondarySPIDs, + Deposit: sdk.Coin{ + Denom: s.Config.Denom, + Amount: types.NewIntFromInt64WithDecimal(1, types.DecimalBNB), + }, + } + s.SendTxBlockWithExpectErrorString(&msgCreateGVG, primarySP.OperatorKey, virtualgroupmoduletypes.ErrInvalidSecondarySPCount.Error()) + + // test GVG has duplicated secondary Sp + secondarySPIDs = make([]uint32, 0) + for _, ssp := range s.StorageProviders { + if ssp.Info.Id != primarySP.Info.Id { + secondarySPIDs = append(secondarySPIDs, ssp.Info.Id) + } + } + secondarySPIDs[len(secondarySPIDs)-1] = secondarySPIDs[0] + msgCreateGVG = virtualgroupmoduletypes.MsgCreateGlobalVirtualGroup{ + StorageProvider: primarySP.OperatorKey.GetAddr().String(), + FamilyId: virtualgroupmoduletypes.NoSpecifiedFamilyId, + SecondarySpIds: secondarySPIDs, + Deposit: sdk.Coin{ + Denom: s.Config.Denom, + Amount: types.NewIntFromInt64WithDecimal(1, types.DecimalBNB), + }, + } + s.SendTxBlockWithExpectErrorString(&msgCreateGVG, primarySP.OperatorKey, virtualgroupmoduletypes.ErrDuplicateSecondarySP.Error()) + } func (s *VirtualGroupTestSuite) TestSettle() { diff --git a/go.mod b/go.mod index 5304019c2..fc160d746 100644 --- a/go.mod +++ b/go.mod @@ -178,7 +178,7 @@ replace ( github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.0-20231030090949-99ef7dbd1e62 github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 - github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v1.0.2-0.20231101023808-a3c24a58eca0 + github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v1.0.2-0.20231109071432-ddd4ce07ab5c github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.20.1 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/wercker/journalhook => github.com/wercker/journalhook v0.0.0-20230927020745-64542ffa4117 diff --git a/go.sum b/go.sum index 026c7f9ea..92a7bce4e 100644 --- a/go.sum +++ b/go.sum @@ -163,8 +163,8 @@ github.com/bnb-chain/greenfield-cometbft v0.0.0-20231030090949-99ef7dbd1e62 h1:p github.com/bnb-chain/greenfield-cometbft v0.0.0-20231030090949-99ef7dbd1e62/go.mod h1:43yICrTxu90VjEUpQN23bsqi9mua5m5sFQq/ekHwN9s= github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 h1:XcWulGacHVRiSCx90Q8Y//ajOrLNBQWR/KDB89dy3cU= github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1/go.mod h1:ey1CiK4bYo1RBNJLRiVbYr5CMdSxci9S/AZRINLtppI= -github.com/bnb-chain/greenfield-cosmos-sdk v1.0.2-0.20231101023808-a3c24a58eca0 h1:5BQrQRqQ0GTR3UgvTtlTCJAYPkWrjk9Yk9kRnmzzut0= -github.com/bnb-chain/greenfield-cosmos-sdk v1.0.2-0.20231101023808-a3c24a58eca0/go.mod h1:ZWyfWX032fdHkICmEoJwylfqmL+Atf/QNVS8GzJq1Kc= +github.com/bnb-chain/greenfield-cosmos-sdk v1.0.2-0.20231109071432-ddd4ce07ab5c h1:2/EgztaiMBMZQu3HBdfRjbAct/pENdwelFVLSSeD3j4= +github.com/bnb-chain/greenfield-cosmos-sdk v1.0.2-0.20231109071432-ddd4ce07ab5c/go.mod h1:ZWyfWX032fdHkICmEoJwylfqmL+Atf/QNVS8GzJq1Kc= github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230816082903-b48770f5e210 h1:GHPbV2bC+gmuO6/sG0Tm8oGal3KKSRlyE+zPscDjlA8= github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230816082903-b48770f5e210/go.mod h1:vhsZxXE9tYJeYB5JR4hPhd6Pc/uPf7j1T8IJ7p9FdeM= github.com/bnb-chain/greenfield-cosmos-sdk/math v0.0.0-20230816082903-b48770f5e210 h1:FLVOn4+OVbsKi2+YJX5kmD27/4dRu4FW7xCXFhzDO5s= diff --git a/x/virtualgroup/keeper/keeper.go b/x/virtualgroup/keeper/keeper.go index 6cded1b3b..c325bc1c1 100644 --- a/x/virtualgroup/keeper/keeper.go +++ b/x/virtualgroup/keeper/keeper.go @@ -29,6 +29,7 @@ type ( accountKeeper types.AccountKeeper bankKeeper types.BankKeeper paymentKeeper types.PaymentKeeper + storageKeeper types.StorageKeeper // sequence gvgSequence sequence.Sequence[uint32] gvgFamilySequence sequence.Sequence[uint32] @@ -63,6 +64,10 @@ func NewKeeper( return &k } +func (k *Keeper) SetStorageKeeper(storageKeeper types.StorageKeeper) { + k.storageKeeper = storageKeeper +} + func (k Keeper) GetAuthority() string { return k.authority } diff --git a/x/virtualgroup/keeper/msg_server.go b/x/virtualgroup/keeper/msg_server.go index 2d5f9ceac..94726bd8a 100644 --- a/x/virtualgroup/keeper/msg_server.go +++ b/x/virtualgroup/keeper/msg_server.go @@ -53,6 +53,20 @@ func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam func (k msgServer) CreateGlobalVirtualGroup(goCtx context.Context, req *types.MsgCreateGlobalVirtualGroup) (*types.MsgCreateGlobalVirtualGroupResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + if ctx.IsUpgraded(upgradetypes.Pampas) { + expectSecondarySPNum := int(k.storageKeeper.GetExpectSecondarySPNumForECObject(ctx, ctx.BlockTime().Unix())) + if len(req.GetSecondarySpIds()) != expectSecondarySPNum { + return nil, types.ErrInvalidSecondarySPCount.Wrapf("the number of secondary sp in the Global virtual group should be %d", expectSecondarySPNum) + } + spIdSet := make(map[uint32]struct{}, len(req.GetSecondarySpIds())) + for _, spId := range req.GetSecondarySpIds() { + if _, ok := spIdSet[spId]; ok { + return nil, types.ErrDuplicateSecondarySP.Wrapf("the SP(id=%d) is duplicate in the Global virtual group.", spId) + } + spIdSet[spId] = struct{}{} + } + } + var gvgStatisticsWithinSPs []*types.GVGStatisticsWithinSP spOperatorAddr := sdk.MustAccAddressFromHex(req.StorageProvider) diff --git a/x/virtualgroup/types/errors.go b/x/virtualgroup/types/errors.go index a16c2ca9e..6f5e85f98 100644 --- a/x/virtualgroup/types/errors.go +++ b/x/virtualgroup/types/errors.go @@ -6,21 +6,22 @@ import ( // x/virtualgroup module sentinel errors var ( - ErrGVGFamilyNotExist = errors.Register(ModuleName, 1100, "global virtual group family not exist.") - ErrGVGNotExistInFamily = errors.Register(ModuleName, 1101, "global virtual group not exist in family.") - ErrGVGNotExist = errors.Register(ModuleName, 1102, "global virtual group not exist.") - ErrGVGNotEmpty = errors.Register(ModuleName, 1103, "the store size of gvg is not zero") - ErrGenSequenceIDError = errors.Register(ModuleName, 1104, "generate sequence id error.") - ErrWithdrawAmountTooLarge = errors.Register(ModuleName, 1105, "withdrawal amount is too large.") - ErrSwapOutFailed = errors.Register(ModuleName, 1106, "swap out failed.") - ErrLVGNotExist = errors.Register(ModuleName, 1107, "local virtual group not exist.") - ErrSPCanNotExit = errors.Register(ModuleName, 1108, "the sp can not exit now.") - ErrSettleFailed = errors.Register(ModuleName, 1109, "fail to settle.") - ErrInvalidGVGCount = errors.Register(ModuleName, 1120, "the count of global virtual group ids is invalid.") - ErrWithdrawFailed = errors.Register(ModuleName, 1121, "with draw failed.") - - ErrLimitationExceed = errors.Register(ModuleName, 1123, "limitation exceed.") - ErrInsufficientStaking = errors.Register(ModuleName, 1125, "insufficient staking for gvg") + ErrGVGFamilyNotExist = errors.Register(ModuleName, 1100, "global virtual group family not exist.") + ErrGVGNotExistInFamily = errors.Register(ModuleName, 1101, "global virtual group not exist in family.") + ErrGVGNotExist = errors.Register(ModuleName, 1102, "global virtual group not exist.") + ErrGVGNotEmpty = errors.Register(ModuleName, 1103, "the store size of gvg is not zero") + ErrGenSequenceIDError = errors.Register(ModuleName, 1104, "generate sequence id error.") + ErrWithdrawAmountTooLarge = errors.Register(ModuleName, 1105, "withdrawal amount is too large.") + ErrSwapOutFailed = errors.Register(ModuleName, 1106, "swap out failed.") + ErrLVGNotExist = errors.Register(ModuleName, 1107, "local virtual group not exist.") + ErrSPCanNotExit = errors.Register(ModuleName, 1108, "the sp can not exit now.") + ErrSettleFailed = errors.Register(ModuleName, 1109, "fail to settle.") + ErrInvalidGVGCount = errors.Register(ModuleName, 1120, "the count of global virtual group ids is invalid.") + ErrWithdrawFailed = errors.Register(ModuleName, 1121, "with draw failed.") + ErrInvalidSecondarySPCount = errors.Register(ModuleName, 1122, "the number of secondary sp within the global virtual group is invalid.") + ErrLimitationExceed = errors.Register(ModuleName, 1123, "limitation exceed.") + ErrDuplicateSecondarySP = errors.Register(ModuleName, 1124, "the global virtual group has duplicate secondary sp.") + ErrInsufficientStaking = errors.Register(ModuleName, 1125, "insufficient staking for gvg") ErrInvalidDenom = errors.Register(ModuleName, 2000, "Invalid denom.") ) diff --git a/x/virtualgroup/types/expected_keepers.go b/x/virtualgroup/types/expected_keepers.go index 9018acfda..240915cb7 100644 --- a/x/virtualgroup/types/expected_keepers.go +++ b/x/virtualgroup/types/expected_keepers.go @@ -44,3 +44,7 @@ type PaymentKeeper interface { Withdraw(ctx sdk.Context, fromAddr, toAddr sdk.AccAddress, amount sdkmath.Int) error IsEmptyNetFlow(ctx sdk.Context, account sdk.AccAddress) bool } + +type StorageKeeper interface { + GetExpectSecondarySPNumForECObject(ctx sdk.Context, time int64) (res uint32) +} diff --git a/x/virtualgroup/types/expected_keepers_mocks.go b/x/virtualgroup/types/expected_keepers_mocks.go index 1377f7c0a..eacf13dd3 100644 --- a/x/virtualgroup/types/expected_keepers_mocks.go +++ b/x/virtualgroup/types/expected_keepers_mocks.go @@ -46,7 +46,7 @@ func (m *MockSpKeeper) DepositDenomForSP(ctx types0.Context) string { } // DepositDenomForSP indicates an expected call of DepositDenomForSP. -func (mr *MockSpKeeperMockRecorder) DepositDenomForSP(ctx interface{}) *gomock.Call { +func (mr *MockSpKeeperMockRecorder) DepositDenomForSP(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DepositDenomForSP", reflect.TypeOf((*MockSpKeeper)(nil).DepositDenomForSP), ctx) } @@ -60,7 +60,7 @@ func (m *MockSpKeeper) Exit(ctx types0.Context, sp *types.StorageProvider) error } // Exit indicates an expected call of Exit. -func (mr *MockSpKeeperMockRecorder) Exit(ctx, sp interface{}) *gomock.Call { +func (mr *MockSpKeeperMockRecorder) Exit(ctx, sp any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exit", reflect.TypeOf((*MockSpKeeper)(nil).Exit), ctx, sp) } @@ -75,7 +75,7 @@ func (m *MockSpKeeper) GetStorageProvider(ctx types0.Context, id uint32) (*types } // GetStorageProvider indicates an expected call of GetStorageProvider. -func (mr *MockSpKeeperMockRecorder) GetStorageProvider(ctx, id interface{}) *gomock.Call { +func (mr *MockSpKeeperMockRecorder) GetStorageProvider(ctx, id any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStorageProvider", reflect.TypeOf((*MockSpKeeper)(nil).GetStorageProvider), ctx, id) } @@ -90,7 +90,7 @@ func (m *MockSpKeeper) GetStorageProviderByFundingAddr(ctx types0.Context, sealA } // GetStorageProviderByFundingAddr indicates an expected call of GetStorageProviderByFundingAddr. -func (mr *MockSpKeeperMockRecorder) GetStorageProviderByFundingAddr(ctx, sealAddr interface{}) *gomock.Call { +func (mr *MockSpKeeperMockRecorder) GetStorageProviderByFundingAddr(ctx, sealAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStorageProviderByFundingAddr", reflect.TypeOf((*MockSpKeeper)(nil).GetStorageProviderByFundingAddr), ctx, sealAddr) } @@ -105,7 +105,7 @@ func (m *MockSpKeeper) GetStorageProviderByOperatorAddr(ctx types0.Context, addr } // GetStorageProviderByOperatorAddr indicates an expected call of GetStorageProviderByOperatorAddr. -func (mr *MockSpKeeperMockRecorder) GetStorageProviderByOperatorAddr(ctx, addr interface{}) *gomock.Call { +func (mr *MockSpKeeperMockRecorder) GetStorageProviderByOperatorAddr(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStorageProviderByOperatorAddr", reflect.TypeOf((*MockSpKeeper)(nil).GetStorageProviderByOperatorAddr), ctx, addr) } @@ -117,7 +117,7 @@ func (m *MockSpKeeper) SetStorageProvider(ctx types0.Context, sp *types.StorageP } // SetStorageProvider indicates an expected call of SetStorageProvider. -func (mr *MockSpKeeperMockRecorder) SetStorageProvider(ctx, sp interface{}) *gomock.Call { +func (mr *MockSpKeeperMockRecorder) SetStorageProvider(ctx, sp any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetStorageProvider", reflect.TypeOf((*MockSpKeeper)(nil).SetStorageProvider), ctx, sp) } @@ -154,7 +154,7 @@ func (m *MockAccountKeeper) GetAccount(ctx types0.Context, addr types0.AccAddres } // GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) } @@ -168,7 +168,7 @@ func (m *MockAccountKeeper) GetModuleAccount(ctx types0.Context, moduleName stri } // GetModuleAccount indicates an expected call of GetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccount), ctx, moduleName) } @@ -182,7 +182,7 @@ func (m *MockAccountKeeper) GetModuleAddress(name string) types0.AccAddress { } // GetModuleAddress indicates an expected call of GetModuleAddress. -func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), name) } @@ -194,7 +194,7 @@ func (m *MockAccountKeeper) IterateAccounts(ctx types0.Context, process func(typ } // IterateAccounts indicates an expected call of IterateAccounts. -func (mr *MockAccountKeeperMockRecorder) IterateAccounts(ctx, process interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) IterateAccounts(ctx, process any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateAccounts", reflect.TypeOf((*MockAccountKeeper)(nil).IterateAccounts), ctx, process) } @@ -206,7 +206,7 @@ func (m *MockAccountKeeper) SetModuleAccount(arg0 types0.Context, arg1 types1.Mo } // SetModuleAccount indicates an expected call of SetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetModuleAccount), arg0, arg1) } @@ -243,7 +243,7 @@ func (m *MockBankKeeper) GetAllBalances(ctx types0.Context, addr types0.AccAddre } // GetAllBalances indicates an expected call of GetAllBalances. -func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr) } @@ -257,7 +257,7 @@ func (m *MockBankKeeper) GetBalance(ctx types0.Context, addr types0.AccAddress, } // GetBalance indicates an expected call of GetBalance. -func (mr *MockBankKeeperMockRecorder) GetBalance(ctx, addr, denom interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) GetBalance(ctx, addr, denom any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBalance", reflect.TypeOf((*MockBankKeeper)(nil).GetBalance), ctx, addr, denom) } @@ -271,7 +271,7 @@ func (m *MockBankKeeper) LockedCoins(ctx types0.Context, addr types0.AccAddress) } // LockedCoins indicates an expected call of LockedCoins. -func (mr *MockBankKeeperMockRecorder) LockedCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) LockedCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LockedCoins", reflect.TypeOf((*MockBankKeeper)(nil).LockedCoins), ctx, addr) } @@ -285,7 +285,7 @@ func (m *MockBankKeeper) SendCoins(ctx types0.Context, fromAddr, toAddr types0.A } // SendCoins indicates an expected call of SendCoins. -func (mr *MockBankKeeperMockRecorder) SendCoins(ctx, fromAddr, toAddr, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoins(ctx, fromAddr, toAddr, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoins", reflect.TypeOf((*MockBankKeeper)(nil).SendCoins), ctx, fromAddr, toAddr, amt) } @@ -299,7 +299,7 @@ func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx types0.Context, sender } // SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) } @@ -313,7 +313,7 @@ func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx types0.Context, sender } // SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) } @@ -327,7 +327,7 @@ func (m *MockBankKeeper) SpendableCoins(ctx types0.Context, addr types0.AccAddre } // SpendableCoins indicates an expected call of SpendableCoins. -func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) } @@ -364,7 +364,7 @@ func (m *MockPaymentKeeper) IsEmptyNetFlow(ctx types0.Context, account types0.Ac } // IsEmptyNetFlow indicates an expected call of IsEmptyNetFlow. -func (mr *MockPaymentKeeperMockRecorder) IsEmptyNetFlow(ctx, account interface{}) *gomock.Call { +func (mr *MockPaymentKeeperMockRecorder) IsEmptyNetFlow(ctx, account any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsEmptyNetFlow", reflect.TypeOf((*MockPaymentKeeper)(nil).IsEmptyNetFlow), ctx, account) } @@ -379,7 +379,7 @@ func (m *MockPaymentKeeper) QueryDynamicBalance(ctx types0.Context, addr types0. } // QueryDynamicBalance indicates an expected call of QueryDynamicBalance. -func (mr *MockPaymentKeeperMockRecorder) QueryDynamicBalance(ctx, addr interface{}) *gomock.Call { +func (mr *MockPaymentKeeperMockRecorder) QueryDynamicBalance(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryDynamicBalance", reflect.TypeOf((*MockPaymentKeeper)(nil).QueryDynamicBalance), ctx, addr) } @@ -393,7 +393,44 @@ func (m *MockPaymentKeeper) Withdraw(ctx types0.Context, fromAddr, toAddr types0 } // Withdraw indicates an expected call of Withdraw. -func (mr *MockPaymentKeeperMockRecorder) Withdraw(ctx, fromAddr, toAddr, amount interface{}) *gomock.Call { +func (mr *MockPaymentKeeperMockRecorder) Withdraw(ctx, fromAddr, toAddr, amount any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Withdraw", reflect.TypeOf((*MockPaymentKeeper)(nil).Withdraw), ctx, fromAddr, toAddr, amount) } + +// MockStorageKeeper is a mock of StorageKeeper interface. +type MockStorageKeeper struct { + ctrl *gomock.Controller + recorder *MockStorageKeeperMockRecorder +} + +// MockStorageKeeperMockRecorder is the mock recorder for MockStorageKeeper. +type MockStorageKeeperMockRecorder struct { + mock *MockStorageKeeper +} + +// NewMockStorageKeeper creates a new mock instance. +func NewMockStorageKeeper(ctrl *gomock.Controller) *MockStorageKeeper { + mock := &MockStorageKeeper{ctrl: ctrl} + mock.recorder = &MockStorageKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockStorageKeeper) EXPECT() *MockStorageKeeperMockRecorder { + return m.recorder +} + +// GetExpectSecondarySPNumForECObject mocks base method. +func (m *MockStorageKeeper) GetExpectSecondarySPNumForECObject(ctx types0.Context, time int64) uint32 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetExpectSecondarySPNumForECObject", ctx, time) + ret0, _ := ret[0].(uint32) + return ret0 +} + +// GetExpectSecondarySPNumForECObject indicates an expected call of GetExpectSecondarySPNumForECObject. +func (mr *MockStorageKeeperMockRecorder) GetExpectSecondarySPNumForECObject(ctx, time any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExpectSecondarySPNumForECObject", reflect.TypeOf((*MockStorageKeeper)(nil).GetExpectSecondarySPNumForECObject), ctx, time) +}