From 0e59ccbad50dd1224fdf3df1f507d76a0a787231 Mon Sep 17 00:00:00 2001 From: Artur Troian Date: Thu, 18 Apr 2024 13:59:40 -0400 Subject: [PATCH] fix: update deposit authorization with with unused amount fixes akash-network/support#88 Signed-off-by: Artur Troian --- app/app_configure.go | 1 + make/init.mk | 2 +- testutil/state/suite.go | 3 +- upgrades/software/v0.34.0/init.go | 11 ++ upgrades/software/v0.34.0/upgrade.go | 47 +++++ upgrades/upgrades.go | 2 + x/deployment/handler/mocks/authz_keeper.go | 23 ++- x/escrow/keeper/external.go | 10 ++ x/escrow/keeper/keeper.go | 48 +++-- x/escrow/keeper/mocks/authz_keeper.go | 200 +++++++++++++++++++++ x/escrow/keeper/mocks/bank_keeper.go | 23 ++- x/escrow/keeper/mocks/distr_keeper.go | 15 +- x/escrow/keeper/mocks/take_keeper.go | 15 +- 13 files changed, 356 insertions(+), 44 deletions(-) create mode 100644 upgrades/software/v0.34.0/init.go create mode 100644 upgrades/software/v0.34.0/upgrade.go create mode 100644 x/escrow/keeper/mocks/authz_keeper.go diff --git a/app/app_configure.go b/app/app_configure.go index 6921d9e120..c2f615de80 100644 --- a/app/app_configure.go +++ b/app/app_configure.go @@ -105,6 +105,7 @@ func (app *AkashApp) setAkashKeepers() { app.Keepers.Cosmos.Bank, app.Keepers.Akash.Take, app.Keepers.Cosmos.Distr, + app.Keepers.Cosmos.Authz, ) app.Keepers.Akash.Deployment = deployment.NewKeeper( diff --git a/make/init.mk b/make/init.mk index f0cb10530e..c5eb7fc6a8 100644 --- a/make/init.mk +++ b/make/init.mk @@ -53,7 +53,7 @@ endif GOLANGCI_LINT_VERSION ?= v1.51.2 STATIK_VERSION ?= v0.1.7 GIT_CHGLOG_VERSION ?= v0.15.1 -MOCKERY_VERSION ?= 2.24.0 +MOCKERY_VERSION ?= 2.42.0 COSMOVISOR_VERSION ?= v1.5.0 # ==== Build tools version tracking ==== diff --git a/testutil/state/suite.go b/testutil/state/suite.go index 36d0f488a6..73ae3b9c77 100644 --- a/testutil/state/suite.go +++ b/testutil/state/suite.go @@ -46,6 +46,7 @@ type Keepers struct { Provider pkeeper.IKeeper Bank *emocks.BankKeeper Distr *emocks.DistrKeeper + Authz *emocks.AuthzKeeper } // SetupTestSuite provides toolkit for accessing stores and keepers @@ -91,7 +92,7 @@ func SetupTestSuiteWithKeepers(t testing.TB, keepers Keepers) *TestSuite { } if keepers.Escrow == nil { - keepers.Escrow = ekeeper.NewKeeper(etypes.ModuleCdc, app.GetKey(etypes.StoreKey), keepers.Bank, keepers.Take, keepers.Distr) + keepers.Escrow = ekeeper.NewKeeper(etypes.ModuleCdc, app.GetKey(etypes.StoreKey), keepers.Bank, keepers.Take, keepers.Distr, keepers.Authz) } if keepers.Market == nil { keepers.Market = mkeeper.NewKeeper(mtypes.ModuleCdc, app.GetKey(mtypes.StoreKey), app.GetSubspace(mtypes.ModuleName), keepers.Escrow) diff --git a/upgrades/software/v0.34.0/init.go b/upgrades/software/v0.34.0/init.go new file mode 100644 index 0000000000..85fac9c593 --- /dev/null +++ b/upgrades/software/v0.34.0/init.go @@ -0,0 +1,11 @@ +// Package v0_34_0 +// nolint revive +package v0_34_0 + +import ( + utypes "github.com/akash-network/node/upgrades/types" +) + +func init() { + utypes.RegisterUpgrade(UpgradeName, initUpgrade) +} diff --git a/upgrades/software/v0.34.0/upgrade.go b/upgrades/software/v0.34.0/upgrade.go new file mode 100644 index 0000000000..1a20e1ad17 --- /dev/null +++ b/upgrades/software/v0.34.0/upgrade.go @@ -0,0 +1,47 @@ +// Package v0_34_0 +// nolint revive +package v0_34_0 + +import ( + "fmt" + + "github.com/tendermint/tendermint/libs/log" + + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + apptypes "github.com/akash-network/node/app/types" + utypes "github.com/akash-network/node/upgrades/types" +) + +const ( + UpgradeName = "v0.34.0" +) + +type upgrade struct { + *apptypes.App + log log.Logger +} + +var _ utypes.IUpgrade = (*upgrade)(nil) + +func initUpgrade(log log.Logger, app *apptypes.App) (utypes.IUpgrade, error) { + up := &upgrade{ + App: app, + log: log.With("module", fmt.Sprintf("upgrade/%s", UpgradeName)), + } + + return up, nil +} + +func (up *upgrade) StoreLoader() *storetypes.StoreUpgrades { + return &storetypes.StoreUpgrades{} +} + +func (up *upgrade) UpgradeHandler() upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return up.MM.RunMigrations(ctx, up.Configurator, fromVM) + } +} diff --git a/upgrades/upgrades.go b/upgrades/upgrades.go index 9a92c90f0c..c999c9713b 100644 --- a/upgrades/upgrades.go +++ b/upgrades/upgrades.go @@ -1,6 +1,8 @@ package upgrades import ( + // nolint: revive + _ "github.com/akash-network/node/upgrades/software/v0.34.0" // nolint: revive _ "github.com/akash-network/node/upgrades/software/v0.32.0" // nolint: revive diff --git a/x/deployment/handler/mocks/authz_keeper.go b/x/deployment/handler/mocks/authz_keeper.go index 057e85bda6..2109d51ead 100644 --- a/x/deployment/handler/mocks/authz_keeper.go +++ b/x/deployment/handler/mocks/authz_keeper.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.24.0. DO NOT EDIT. +// Code generated by mockery v2.42.0. DO NOT EDIT. package mocks @@ -29,6 +29,10 @@ func (_m *AuthzKeeper) EXPECT() *AuthzKeeper_Expecter { func (_m *AuthzKeeper) DeleteGrant(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string) error { ret := _m.Called(ctx, grantee, granter, msgType) + if len(ret) == 0 { + panic("no return value specified for DeleteGrant") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, string) error); ok { r0 = rf(ctx, grantee, granter, msgType) @@ -74,6 +78,10 @@ func (_c *AuthzKeeper_DeleteGrant_Call) RunAndReturn(run func(types.Context, typ func (_m *AuthzKeeper) GetCleanAuthorization(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string) (authz.Authorization, time.Time) { ret := _m.Called(ctx, grantee, granter, msgType) + if len(ret) == 0 { + panic("no return value specified for GetCleanAuthorization") + } + var r0 authz.Authorization var r1 time.Time if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, string) (authz.Authorization, time.Time)); ok { @@ -131,6 +139,10 @@ func (_c *AuthzKeeper_GetCleanAuthorization_Call) RunAndReturn(run func(types.Co func (_m *AuthzKeeper) SaveGrant(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, authorization authz.Authorization, expiration time.Time) error { ret := _m.Called(ctx, grantee, granter, authorization, expiration) + if len(ret) == 0 { + panic("no return value specified for SaveGrant") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, authz.Authorization, time.Time) error); ok { r0 = rf(ctx, grantee, granter, authorization, expiration) @@ -173,13 +185,12 @@ func (_c *AuthzKeeper_SaveGrant_Call) RunAndReturn(run func(types.Context, types return _c } -type mockConstructorTestingTNewAuthzKeeper interface { +// NewAuthzKeeper creates a new instance of AuthzKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewAuthzKeeper(t interface { mock.TestingT Cleanup(func()) -} - -// NewAuthzKeeper creates a new instance of AuthzKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewAuthzKeeper(t mockConstructorTestingTNewAuthzKeeper) *AuthzKeeper { +}) *AuthzKeeper { mock := &AuthzKeeper{} mock.Mock.Test(t) diff --git a/x/escrow/keeper/external.go b/x/escrow/keeper/external.go index e7f0907c6a..943959bff4 100644 --- a/x/escrow/keeper/external.go +++ b/x/escrow/keeper/external.go @@ -1,7 +1,10 @@ package keeper import ( + "time" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/authz" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" ) @@ -22,3 +25,10 @@ type DistrKeeper interface { GetFeePool(ctx sdk.Context) distrtypes.FeePool SetFeePool(ctx sdk.Context, pool distrtypes.FeePool) } + +//go:generate mockery --name AuthzKeeper --output ./mocks +type AuthzKeeper interface { + DeleteGrant(ctx sdk.Context, grantee, granter sdk.AccAddress, msgType string) error + GetCleanAuthorization(ctx sdk.Context, grantee, granter sdk.AccAddress, msgType string) (cap authz.Authorization, expiration time.Time) + SaveGrant(ctx sdk.Context, grantee, granter sdk.AccAddress, authorization authz.Authorization, expiration time.Time) error +} diff --git a/x/escrow/keeper/keeper.go b/x/escrow/keeper/keeper.go index 903346e164..8a11db8a71 100644 --- a/x/escrow/keeper/keeper.go +++ b/x/escrow/keeper/keeper.go @@ -3,10 +3,10 @@ package keeper import ( "fmt" + dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + types "github.com/akash-network/akash-api/go/node/escrow/v1beta3" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - - types "github.com/akash-network/akash-api/go/node/escrow/v1beta3" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" ) @@ -35,22 +35,24 @@ type Keeper interface { SavePayment(sdk.Context, types.FractionalPayment) } -func NewKeeper(cdc codec.BinaryCodec, skey sdk.StoreKey, bkeeper BankKeeper, tkeeper TakeKeeper, dkeeper DistrKeeper) Keeper { +func NewKeeper(cdc codec.BinaryCodec, skey sdk.StoreKey, bkeeper BankKeeper, tkeeper TakeKeeper, dkeeper DistrKeeper, akeeper AuthzKeeper) Keeper { return &keeper{ - cdc: cdc, - skey: skey, - bkeeper: bkeeper, - tkeeper: tkeeper, - dkeeper: dkeeper, + cdc: cdc, + skey: skey, + bkeeper: bkeeper, + tkeeper: tkeeper, + dkeeper: dkeeper, + authzKeeper: akeeper, } } type keeper struct { - cdc codec.BinaryCodec - skey sdk.StoreKey - bkeeper BankKeeper - tkeeper TakeKeeper - dkeeper DistrKeeper + cdc codec.BinaryCodec + skey sdk.StoreKey + bkeeper BankKeeper + tkeeper TakeKeeper + dkeeper DistrKeeper + authzKeeper AuthzKeeper hooks struct { onAccountClosed []AccountHook @@ -499,12 +501,12 @@ func (k *keeper) accountWithdraw(ctx sdk.Context, obj *types.Account) error { return nil } - if !obj.Balance.Amount.LT(sdk.NewDec(1)) { - owner, err := sdk.AccAddressFromBech32(obj.Owner) - if err != nil { - return err - } + owner, err := sdk.AccAddressFromBech32(obj.Owner) + if err != nil { + return err + } + if !obj.Balance.Amount.LT(sdk.NewDec(1)) { withdrawal := sdk.NewCoin(obj.Balance.Denom, obj.Balance.Amount.TruncateInt()) if err = k.bkeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, owner, sdk.NewCoins(withdrawal)); err != nil { ctx.Logger().Error("account withdraw", "err", err, "id", obj.ID) @@ -524,7 +526,17 @@ func (k *keeper) accountWithdraw(ctx sdk.Context, obj *types.Account) error { ctx.Logger().Error("account withdraw", "err", err, "id", obj.ID) return err } + obj.Funds = obj.Funds.Sub(sdk.NewDecCoinFromCoin(withdrawal)) + + msg := &dtypes.MsgDepositDeployment{Amount: sdk.NewCoin("uakt", sdk.NewInt(1))} + authorization, expiration := k.authzKeeper.GetCleanAuthorization(ctx, owner, depositor, sdk.MsgTypeURL(msg)) + + dauthz, valid := authorization.(*dtypes.DepositDeploymentAuthorization) + if valid && authorization != nil { + limitLeft := dauthz.SpendLimit.Add(withdrawal) + _ = k.authzKeeper.SaveGrant(ctx, owner, depositor, &dtypes.DepositDeploymentAuthorization{SpendLimit: limitLeft}, expiration) + } } k.saveAccount(ctx, obj) diff --git a/x/escrow/keeper/mocks/authz_keeper.go b/x/escrow/keeper/mocks/authz_keeper.go new file mode 100644 index 0000000000..2109d51ead --- /dev/null +++ b/x/escrow/keeper/mocks/authz_keeper.go @@ -0,0 +1,200 @@ +// Code generated by mockery v2.42.0. DO NOT EDIT. + +package mocks + +import ( + authz "github.com/cosmos/cosmos-sdk/x/authz" + + mock "github.com/stretchr/testify/mock" + + time "time" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// AuthzKeeper is an autogenerated mock type for the AuthzKeeper type +type AuthzKeeper struct { + mock.Mock +} + +type AuthzKeeper_Expecter struct { + mock *mock.Mock +} + +func (_m *AuthzKeeper) EXPECT() *AuthzKeeper_Expecter { + return &AuthzKeeper_Expecter{mock: &_m.Mock} +} + +// DeleteGrant provides a mock function with given fields: ctx, grantee, granter, msgType +func (_m *AuthzKeeper) DeleteGrant(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string) error { + ret := _m.Called(ctx, grantee, granter, msgType) + + if len(ret) == 0 { + panic("no return value specified for DeleteGrant") + } + + var r0 error + if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, string) error); ok { + r0 = rf(ctx, grantee, granter, msgType) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// AuthzKeeper_DeleteGrant_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGrant' +type AuthzKeeper_DeleteGrant_Call struct { + *mock.Call +} + +// DeleteGrant is a helper method to define mock.On call +// - ctx types.Context +// - grantee types.AccAddress +// - granter types.AccAddress +// - msgType string +func (_e *AuthzKeeper_Expecter) DeleteGrant(ctx interface{}, grantee interface{}, granter interface{}, msgType interface{}) *AuthzKeeper_DeleteGrant_Call { + return &AuthzKeeper_DeleteGrant_Call{Call: _e.mock.On("DeleteGrant", ctx, grantee, granter, msgType)} +} + +func (_c *AuthzKeeper_DeleteGrant_Call) Run(run func(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string)) *AuthzKeeper_DeleteGrant_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(types.AccAddress), args[2].(types.AccAddress), args[3].(string)) + }) + return _c +} + +func (_c *AuthzKeeper_DeleteGrant_Call) Return(_a0 error) *AuthzKeeper_DeleteGrant_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *AuthzKeeper_DeleteGrant_Call) RunAndReturn(run func(types.Context, types.AccAddress, types.AccAddress, string) error) *AuthzKeeper_DeleteGrant_Call { + _c.Call.Return(run) + return _c +} + +// GetCleanAuthorization provides a mock function with given fields: ctx, grantee, granter, msgType +func (_m *AuthzKeeper) GetCleanAuthorization(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string) (authz.Authorization, time.Time) { + ret := _m.Called(ctx, grantee, granter, msgType) + + if len(ret) == 0 { + panic("no return value specified for GetCleanAuthorization") + } + + var r0 authz.Authorization + var r1 time.Time + if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, string) (authz.Authorization, time.Time)); ok { + return rf(ctx, grantee, granter, msgType) + } + if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, string) authz.Authorization); ok { + r0 = rf(ctx, grantee, granter, msgType) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(authz.Authorization) + } + } + + if rf, ok := ret.Get(1).(func(types.Context, types.AccAddress, types.AccAddress, string) time.Time); ok { + r1 = rf(ctx, grantee, granter, msgType) + } else { + r1 = ret.Get(1).(time.Time) + } + + return r0, r1 +} + +// AuthzKeeper_GetCleanAuthorization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCleanAuthorization' +type AuthzKeeper_GetCleanAuthorization_Call struct { + *mock.Call +} + +// GetCleanAuthorization is a helper method to define mock.On call +// - ctx types.Context +// - grantee types.AccAddress +// - granter types.AccAddress +// - msgType string +func (_e *AuthzKeeper_Expecter) GetCleanAuthorization(ctx interface{}, grantee interface{}, granter interface{}, msgType interface{}) *AuthzKeeper_GetCleanAuthorization_Call { + return &AuthzKeeper_GetCleanAuthorization_Call{Call: _e.mock.On("GetCleanAuthorization", ctx, grantee, granter, msgType)} +} + +func (_c *AuthzKeeper_GetCleanAuthorization_Call) Run(run func(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string)) *AuthzKeeper_GetCleanAuthorization_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(types.AccAddress), args[2].(types.AccAddress), args[3].(string)) + }) + return _c +} + +func (_c *AuthzKeeper_GetCleanAuthorization_Call) Return(cap authz.Authorization, expiration time.Time) *AuthzKeeper_GetCleanAuthorization_Call { + _c.Call.Return(cap, expiration) + return _c +} + +func (_c *AuthzKeeper_GetCleanAuthorization_Call) RunAndReturn(run func(types.Context, types.AccAddress, types.AccAddress, string) (authz.Authorization, time.Time)) *AuthzKeeper_GetCleanAuthorization_Call { + _c.Call.Return(run) + return _c +} + +// SaveGrant provides a mock function with given fields: ctx, grantee, granter, authorization, expiration +func (_m *AuthzKeeper) SaveGrant(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, authorization authz.Authorization, expiration time.Time) error { + ret := _m.Called(ctx, grantee, granter, authorization, expiration) + + if len(ret) == 0 { + panic("no return value specified for SaveGrant") + } + + var r0 error + if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, authz.Authorization, time.Time) error); ok { + r0 = rf(ctx, grantee, granter, authorization, expiration) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// AuthzKeeper_SaveGrant_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveGrant' +type AuthzKeeper_SaveGrant_Call struct { + *mock.Call +} + +// SaveGrant is a helper method to define mock.On call +// - ctx types.Context +// - grantee types.AccAddress +// - granter types.AccAddress +// - authorization authz.Authorization +// - expiration time.Time +func (_e *AuthzKeeper_Expecter) SaveGrant(ctx interface{}, grantee interface{}, granter interface{}, authorization interface{}, expiration interface{}) *AuthzKeeper_SaveGrant_Call { + return &AuthzKeeper_SaveGrant_Call{Call: _e.mock.On("SaveGrant", ctx, grantee, granter, authorization, expiration)} +} + +func (_c *AuthzKeeper_SaveGrant_Call) Run(run func(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, authorization authz.Authorization, expiration time.Time)) *AuthzKeeper_SaveGrant_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(types.AccAddress), args[2].(types.AccAddress), args[3].(authz.Authorization), args[4].(time.Time)) + }) + return _c +} + +func (_c *AuthzKeeper_SaveGrant_Call) Return(_a0 error) *AuthzKeeper_SaveGrant_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *AuthzKeeper_SaveGrant_Call) RunAndReturn(run func(types.Context, types.AccAddress, types.AccAddress, authz.Authorization, time.Time) error) *AuthzKeeper_SaveGrant_Call { + _c.Call.Return(run) + return _c +} + +// NewAuthzKeeper creates a new instance of AuthzKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewAuthzKeeper(t interface { + mock.TestingT + Cleanup(func()) +}) *AuthzKeeper { + mock := &AuthzKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/x/escrow/keeper/mocks/bank_keeper.go b/x/escrow/keeper/mocks/bank_keeper.go index 2aabcdbbed..d68cc96ac2 100644 --- a/x/escrow/keeper/mocks/bank_keeper.go +++ b/x/escrow/keeper/mocks/bank_keeper.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.24.0. DO NOT EDIT. +// Code generated by mockery v2.42.0. DO NOT EDIT. package mocks @@ -24,6 +24,10 @@ func (_m *BankKeeper) EXPECT() *BankKeeper_Expecter { func (_m *BankKeeper) SendCoinsFromAccountToModule(ctx types.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { ret := _m.Called(ctx, senderAddr, recipientModule, amt) + if len(ret) == 0 { + panic("no return value specified for SendCoinsFromAccountToModule") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, string, types.Coins) error); ok { r0 = rf(ctx, senderAddr, recipientModule, amt) @@ -69,6 +73,10 @@ func (_c *BankKeeper_SendCoinsFromAccountToModule_Call) RunAndReturn(run func(ty func (_m *BankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { ret := _m.Called(ctx, senderModule, recipientAddr, amt) + if len(ret) == 0 { + panic("no return value specified for SendCoinsFromModuleToAccount") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, string, types.AccAddress, types.Coins) error); ok { r0 = rf(ctx, senderModule, recipientAddr, amt) @@ -114,6 +122,10 @@ func (_c *BankKeeper_SendCoinsFromModuleToAccount_Call) RunAndReturn(run func(ty func (_m *BankKeeper) SendCoinsFromModuleToModule(ctx types.Context, senderModule string, recipientModule string, amt types.Coins) error { ret := _m.Called(ctx, senderModule, recipientModule, amt) + if len(ret) == 0 { + panic("no return value specified for SendCoinsFromModuleToModule") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, string, string, types.Coins) error); ok { r0 = rf(ctx, senderModule, recipientModule, amt) @@ -155,13 +167,12 @@ func (_c *BankKeeper_SendCoinsFromModuleToModule_Call) RunAndReturn(run func(typ return _c } -type mockConstructorTestingTNewBankKeeper interface { +// NewBankKeeper creates a new instance of BankKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewBankKeeper(t interface { mock.TestingT Cleanup(func()) -} - -// NewBankKeeper creates a new instance of BankKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewBankKeeper(t mockConstructorTestingTNewBankKeeper) *BankKeeper { +}) *BankKeeper { mock := &BankKeeper{} mock.Mock.Test(t) diff --git a/x/escrow/keeper/mocks/distr_keeper.go b/x/escrow/keeper/mocks/distr_keeper.go index de24d87f79..d013b76750 100644 --- a/x/escrow/keeper/mocks/distr_keeper.go +++ b/x/escrow/keeper/mocks/distr_keeper.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.24.0. DO NOT EDIT. +// Code generated by mockery v2.42.0. DO NOT EDIT. package mocks @@ -27,6 +27,10 @@ func (_m *DistrKeeper) EXPECT() *DistrKeeper_Expecter { func (_m *DistrKeeper) GetFeePool(ctx types.Context) distributiontypes.FeePool { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetFeePool") + } + var r0 distributiontypes.FeePool if rf, ok := ret.Get(0).(func(types.Context) distributiontypes.FeePool); ok { r0 = rf(ctx) @@ -99,13 +103,12 @@ func (_c *DistrKeeper_SetFeePool_Call) RunAndReturn(run func(types.Context, dist return _c } -type mockConstructorTestingTNewDistrKeeper interface { +// NewDistrKeeper creates a new instance of DistrKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewDistrKeeper(t interface { mock.TestingT Cleanup(func()) -} - -// NewDistrKeeper creates a new instance of DistrKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewDistrKeeper(t mockConstructorTestingTNewDistrKeeper) *DistrKeeper { +}) *DistrKeeper { mock := &DistrKeeper{} mock.Mock.Test(t) diff --git a/x/escrow/keeper/mocks/take_keeper.go b/x/escrow/keeper/mocks/take_keeper.go index 85eae899c4..1ecf9727be 100644 --- a/x/escrow/keeper/mocks/take_keeper.go +++ b/x/escrow/keeper/mocks/take_keeper.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.24.0. DO NOT EDIT. +// Code generated by mockery v2.42.0. DO NOT EDIT. package mocks @@ -24,6 +24,10 @@ func (_m *TakeKeeper) EXPECT() *TakeKeeper_Expecter { func (_m *TakeKeeper) SubtractFees(ctx types.Context, amt types.Coin) (types.Coin, types.Coin, error) { ret := _m.Called(ctx, amt) + if len(ret) == 0 { + panic("no return value specified for SubtractFees") + } + var r0 types.Coin var r1 types.Coin var r2 error @@ -80,13 +84,12 @@ func (_c *TakeKeeper_SubtractFees_Call) RunAndReturn(run func(types.Context, typ return _c } -type mockConstructorTestingTNewTakeKeeper interface { +// NewTakeKeeper creates a new instance of TakeKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewTakeKeeper(t interface { mock.TestingT Cleanup(func()) -} - -// NewTakeKeeper creates a new instance of TakeKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewTakeKeeper(t mockConstructorTestingTNewTakeKeeper) *TakeKeeper { +}) *TakeKeeper { mock := &TakeKeeper{} mock.Mock.Test(t)