diff --git a/app/app.go b/app/app.go index a87abb240b..c7c749cda3 100644 --- a/app/app.go +++ b/app/app.go @@ -226,27 +226,27 @@ type App struct { memKeys map[string]*storetypes.MemoryStoreKey // keepers - AccountKeeper authkeeper.AccountKeeper - BankKeeper bankkeeper.Keeper - StakingKeeper stakingkeeper.Keeper - SlashingKeeper slashingkeeper.Keeper - DistrKeeper distrkeeper.Keeper - GovKeeper govkeeper.Keeper - CrisisKeeper crisiskeeper.Keeper - UpgradeKeeper upgradekeeper.Keeper - ParamsKeeper paramskeeper.Keeper - EvidenceKeeper evidencekeeper.Keeper - ZetaCoreKeeper crosschainkeeper.Keeper - ZetaObserverKeeper *observerkeeper.Keeper - mm *module.Manager - sm *module.SimulationManager - configurator module.Configurator - EvmKeeper *evmkeeper.Keeper - FeeMarketKeeper feemarketkeeper.Keeper - FungibleKeeper fungibleModuleKeeper.Keeper - EmissionsKeeper emissionsModuleKeeper.Keeper - GroupKeeper groupkeeper.Keeper - AuthzKeeper authzkeeper.Keeper + AccountKeeper authkeeper.AccountKeeper + BankKeeper bankkeeper.Keeper + StakingKeeper stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper + DistrKeeper distrkeeper.Keeper + GovKeeper govkeeper.Keeper + CrisisKeeper crisiskeeper.Keeper + UpgradeKeeper upgradekeeper.Keeper + ParamsKeeper paramskeeper.Keeper + EvidenceKeeper evidencekeeper.Keeper + CrosschainKeeper crosschainkeeper.Keeper + ObserverKeeper *observerkeeper.Keeper + mm *module.Manager + sm *module.SimulationManager + configurator module.Configurator + EvmKeeper *evmkeeper.Keeper + FeeMarketKeeper feemarketkeeper.Keeper + FungibleKeeper fungibleModuleKeeper.Keeper + EmissionsKeeper emissionsModuleKeeper.Keeper + GroupKeeper groupkeeper.Keeper + AuthzKeeper authzkeeper.Keeper } // New returns a reference to an initialized ZetaApp. @@ -336,7 +336,7 @@ func New( app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - app.ZetaObserverKeeper = observerkeeper.NewKeeper( + app.ObserverKeeper = observerkeeper.NewKeeper( appCodec, keys[observertypes.StoreKey], keys[observertypes.MemStoreKey], @@ -348,7 +348,7 @@ func New( // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks app.StakingKeeper = *stakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks(), app.ZetaObserverKeeper.Hooks()), + stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks(), app.ObserverKeeper.Hooks()), ) app.AuthzKeeper = authzkeeper.NewKeeper( @@ -365,7 +365,8 @@ func New( authtypes.FeeCollectorName, app.BankKeeper, app.StakingKeeper, - app.ZetaObserverKeeper, + app.ObserverKeeper, + app.AccountKeeper, ) // Create Ethermint keepers tracer := cast.ToString(appOpts.Get(srvflags.EVMTracer)) @@ -391,10 +392,10 @@ func New( app.AccountKeeper, app.EvmKeeper, app.BankKeeper, - app.ZetaObserverKeeper, + app.ObserverKeeper, ) - app.ZetaCoreKeeper = *crosschainkeeper.NewKeeper( + app.CrosschainKeeper = *crosschainkeeper.NewKeeper( appCodec, keys[crosschaintypes.StoreKey], keys[crosschaintypes.MemStoreKey], @@ -402,7 +403,7 @@ func New( app.GetSubspace(crosschaintypes.ModuleName), app.AccountKeeper, app.BankKeeper, - app.ZetaObserverKeeper, + app.ObserverKeeper, &app.FungibleKeeper, ) app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper, group.Config{ @@ -442,7 +443,7 @@ func New( app.EvidenceKeeper = *evidenceKeeper app.EvmKeeper = app.EvmKeeper.SetHooks(evmkeeper.NewMultiEvmHooks( - app.ZetaCoreKeeper.Hooks(), + app.CrosschainKeeper.Hooks(), app.FungibleKeeper.EVMHooks(), )) @@ -474,10 +475,10 @@ func New( groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, interfaceRegistry), evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, evmSs), feemarket.NewAppModule(app.FeeMarketKeeper, feeSs), - crosschainmodule.NewAppModule(appCodec, app.ZetaCoreKeeper, app.StakingKeeper, app.AccountKeeper), - observermodule.NewAppModule(appCodec, *app.ZetaObserverKeeper, app.AccountKeeper, app.BankKeeper), - fungibleModule.NewAppModule(appCodec, app.FungibleKeeper, app.AccountKeeper, app.BankKeeper), - emissionsModule.NewAppModule(appCodec, app.EmissionsKeeper, app.AccountKeeper), + crosschainmodule.NewAppModule(appCodec, app.CrosschainKeeper), + observermodule.NewAppModule(appCodec, *app.ObserverKeeper), + fungibleModule.NewAppModule(appCodec, app.FungibleKeeper), + emissionsModule.NewAppModule(appCodec, app.EmissionsKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), ) @@ -589,7 +590,7 @@ func New( sdk.MsgTypeURL(&vestingtypes.MsgCreatePermanentLockedAccount{}), sdk.MsgTypeURL(&vestingtypes.MsgCreatePeriodicVestingAccount{}), }, - ObserverKeeper: app.ZetaObserverKeeper, + ObserverKeeper: app.ObserverKeeper, } anteHandler, err := ante.NewAnteHandler(options) diff --git a/changelog.md b/changelog.md index b0f89948f6..5fa64f61a2 100644 --- a/changelog.md +++ b/changelog.md @@ -48,6 +48,7 @@ ### Chores * [1729](https://github.com/zeta-chain/node/pull/1729) - add issue templates +* [1754](https://github.com/zeta-chain/node/pull/1754) - cleanup expected keepers ## Version: v12.2.4 diff --git a/testutil/keeper/emissions.go b/testutil/keeper/emissions.go index edcde7a75e..4e57ced16d 100644 --- a/testutil/keeper/emissions.go +++ b/testutil/keeper/emissions.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" typesparams "github.com/cosmos/cosmos-sdk/x/params/types" @@ -49,6 +50,7 @@ func EmissionsKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, observerkeeper.Keeper{}, + authkeeper.AccountKeeper{}, ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) diff --git a/testutil/keeper/mocks/crosschain/account.go b/testutil/keeper/mocks/crosschain/account.go index 274a79766d..0560f21be8 100644 --- a/testutil/keeper/mocks/crosschain/account.go +++ b/testutil/keeper/mocks/crosschain/account.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.41.0. DO NOT EDIT. package mocks @@ -14,26 +14,6 @@ type CrosschainAccountKeeper struct { mock.Mock } -// GetAccount provides a mock function with given fields: ctx, addr -func (_m *CrosschainAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) authtypes.AccountI { - ret := _m.Called(ctx, addr) - - if len(ret) == 0 { - panic("no return value specified for GetAccount") - } - - var r0 authtypes.AccountI - if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) authtypes.AccountI); ok { - r0 = rf(ctx, addr) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(authtypes.AccountI) - } - } - - return r0 -} - // GetModuleAccount provides a mock function with given fields: ctx, name func (_m *CrosschainAccountKeeper) GetModuleAccount(ctx types.Context, name string) authtypes.ModuleAccountI { ret := _m.Called(ctx, name) @@ -54,31 +34,6 @@ func (_m *CrosschainAccountKeeper) GetModuleAccount(ctx types.Context, name stri return r0 } -// GetModuleAddress provides a mock function with given fields: name -func (_m *CrosschainAccountKeeper) GetModuleAddress(name string) types.AccAddress { - ret := _m.Called(name) - - if len(ret) == 0 { - panic("no return value specified for GetModuleAddress") - } - - var r0 types.AccAddress - if rf, ok := ret.Get(0).(func(string) types.AccAddress); ok { - r0 = rf(name) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(types.AccAddress) - } - } - - return r0 -} - -// SetModuleAccount provides a mock function with given fields: _a0, _a1 -func (_m *CrosschainAccountKeeper) SetModuleAccount(_a0 types.Context, _a1 authtypes.ModuleAccountI) { - _m.Called(_a0, _a1) -} - // NewCrosschainAccountKeeper creates a new instance of CrosschainAccountKeeper. 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 NewCrosschainAccountKeeper(t interface { diff --git a/testutil/keeper/mocks/crosschain/bank.go b/testutil/keeper/mocks/crosschain/bank.go index 278cccb833..9ac2b1278b 100644 --- a/testutil/keeper/mocks/crosschain/bank.go +++ b/testutil/keeper/mocks/crosschain/bank.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.41.0. DO NOT EDIT. package mocks @@ -31,64 +31,6 @@ func (_m *CrosschainBankKeeper) BurnCoins(ctx types.Context, name string, amt ty return r0 } -// GetAllBalances provides a mock function with given fields: ctx, addr -func (_m *CrosschainBankKeeper) GetAllBalances(ctx types.Context, addr types.AccAddress) types.Coins { - ret := _m.Called(ctx, addr) - - if len(ret) == 0 { - panic("no return value specified for GetAllBalances") - } - - var r0 types.Coins - if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) types.Coins); ok { - r0 = rf(ctx, addr) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(types.Coins) - } - } - - return r0 -} - -// GetBalance provides a mock function with given fields: ctx, addr, denom -func (_m *CrosschainBankKeeper) GetBalance(ctx types.Context, addr types.AccAddress, denom string) types.Coin { - ret := _m.Called(ctx, addr, denom) - - if len(ret) == 0 { - panic("no return value specified for GetBalance") - } - - var r0 types.Coin - if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, string) types.Coin); ok { - r0 = rf(ctx, addr, denom) - } else { - r0 = ret.Get(0).(types.Coin) - } - - return r0 -} - -// LockedCoins provides a mock function with given fields: ctx, addr -func (_m *CrosschainBankKeeper) LockedCoins(ctx types.Context, addr types.AccAddress) types.Coins { - ret := _m.Called(ctx, addr) - - if len(ret) == 0 { - panic("no return value specified for LockedCoins") - } - - var r0 types.Coins - if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) types.Coins); ok { - r0 = rf(ctx, addr) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(types.Coins) - } - } - - return r0 -} - // MintCoins provides a mock function with given fields: ctx, moduleName, amt func (_m *CrosschainBankKeeper) MintCoins(ctx types.Context, moduleName string, amt types.Coins) error { ret := _m.Called(ctx, moduleName, amt) @@ -107,62 +49,6 @@ func (_m *CrosschainBankKeeper) MintCoins(ctx types.Context, moduleName string, return r0 } -// SendCoinsFromAccountToModule provides a mock function with given fields: ctx, senderAddr, recipientModule, amt -func (_m *CrosschainBankKeeper) 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) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// SendCoinsFromModuleToAccount provides a mock function with given fields: ctx, senderModule, recipientAddr, amt -func (_m *CrosschainBankKeeper) 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) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// SpendableCoins provides a mock function with given fields: ctx, addr -func (_m *CrosschainBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins { - ret := _m.Called(ctx, addr) - - if len(ret) == 0 { - panic("no return value specified for SpendableCoins") - } - - var r0 types.Coins - if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) types.Coins); ok { - r0 = rf(ctx, addr) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(types.Coins) - } - } - - return r0 -} - // NewCrosschainBankKeeper creates a new instance of CrosschainBankKeeper. 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 NewCrosschainBankKeeper(t interface { diff --git a/testutil/keeper/mocks/crosschain/fungible.go b/testutil/keeper/mocks/crosschain/fungible.go index b40bd35c40..e8e090189d 100644 --- a/testutil/keeper/mocks/crosschain/fungible.go +++ b/testutil/keeper/mocks/crosschain/fungible.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.41.0. DO NOT EDIT. package mocks @@ -486,36 +486,6 @@ func (_m *CrosschainFungibleKeeper) QuerySystemContractGasCoinZRC20(ctx types.Co return r0, r1 } -// QueryUniswapV2RouterGetZRC4AmountsIn provides a mock function with given fields: ctx, amountOut, inZRC4 -func (_m *CrosschainFungibleKeeper) QueryUniswapV2RouterGetZRC4AmountsIn(ctx types.Context, amountOut *big.Int, inZRC4 common.Address) (*big.Int, error) { - ret := _m.Called(ctx, amountOut, inZRC4) - - if len(ret) == 0 { - panic("no return value specified for QueryUniswapV2RouterGetZRC4AmountsIn") - } - - var r0 *big.Int - var r1 error - if rf, ok := ret.Get(0).(func(types.Context, *big.Int, common.Address) (*big.Int, error)); ok { - return rf(ctx, amountOut, inZRC4) - } - if rf, ok := ret.Get(0).(func(types.Context, *big.Int, common.Address) *big.Int); ok { - r0 = rf(ctx, amountOut, inZRC4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*big.Int) - } - } - - if rf, ok := ret.Get(1).(func(types.Context, *big.Int, common.Address) error); ok { - r1 = rf(ctx, amountOut, inZRC4) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - // QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn provides a mock function with given fields: ctx, amountOut, inZRC4, outZRC4 func (_m *CrosschainFungibleKeeper) QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn(ctx types.Context, amountOut *big.Int, inZRC4 common.Address, outZRC4 common.Address) (*big.Int, error) { ret := _m.Called(ctx, amountOut, inZRC4, outZRC4) diff --git a/testutil/keeper/mocks/crosschain/observer.go b/testutil/keeper/mocks/crosschain/observer.go index 5000f37e03..a6fd222875 100644 --- a/testutil/keeper/mocks/crosschain/observer.go +++ b/testutil/keeper/mocks/crosschain/observer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.41.0. DO NOT EDIT. package mocks @@ -143,26 +143,6 @@ func (_m *CrosschainObserverKeeper) FindBallot(ctx types.Context, index string, return r0, r1, r2 } -// GetAllBallots provides a mock function with given fields: ctx -func (_m *CrosschainObserverKeeper) GetAllBallots(ctx types.Context) []*observertypes.Ballot { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetAllBallots") - } - - var r0 []*observertypes.Ballot - if rf, ok := ret.Get(0).(func(types.Context) []*observertypes.Ballot); ok { - r0 = rf(ctx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*observertypes.Ballot) - } - } - - return r0 -} - // GetAllChainNonces provides a mock function with given fields: ctx func (_m *CrosschainObserverKeeper) GetAllChainNonces(ctx types.Context) []observertypes.ChainNonces { ret := _m.Called(ctx) @@ -621,34 +601,6 @@ func (_m *CrosschainObserverKeeper) GetPendingNonces(ctx types.Context, tss stri return r0, r1 } -// GetPreviousTSS provides a mock function with given fields: ctx -func (_m *CrosschainObserverKeeper) GetPreviousTSS(ctx types.Context) (observertypes.TSS, bool) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetPreviousTSS") - } - - var r0 observertypes.TSS - var r1 bool - if rf, ok := ret.Get(0).(func(types.Context) (observertypes.TSS, bool)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(types.Context) observertypes.TSS); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(observertypes.TSS) - } - - if rf, ok := ret.Get(1).(func(types.Context) bool); ok { - r1 = rf(ctx) - } else { - r1 = ret.Get(1).(bool) - } - - return r0, r1 -} - // GetSupportedChainFromChainID provides a mock function with given fields: ctx, chainID func (_m *CrosschainObserverKeeper) GetSupportedChainFromChainID(ctx types.Context, chainID int64) *common.Chain { ret := _m.Called(ctx, chainID) @@ -788,26 +740,11 @@ func (_m *CrosschainObserverKeeper) RemoveAllExistingMigrators(ctx types.Context _m.Called(ctx) } -// RemoveChainNonces provides a mock function with given fields: ctx, index -func (_m *CrosschainObserverKeeper) RemoveChainNonces(ctx types.Context, index string) { - _m.Called(ctx, index) -} - // RemoveFromPendingNonces provides a mock function with given fields: ctx, tss, chainID, nonce func (_m *CrosschainObserverKeeper) RemoveFromPendingNonces(ctx types.Context, tss string, chainID int64, nonce int64) { _m.Called(ctx, tss, chainID, nonce) } -// RemoveNonceToCctx provides a mock function with given fields: ctx, cctx -func (_m *CrosschainObserverKeeper) RemoveNonceToCctx(ctx types.Context, cctx observertypes.NonceToCctx) { - _m.Called(ctx, cctx) -} - -// SetBallot provides a mock function with given fields: ctx, ballot -func (_m *CrosschainObserverKeeper) SetBallot(ctx types.Context, ballot *observertypes.Ballot) { - _m.Called(ctx, ballot) -} - // SetChainNonces provides a mock function with given fields: ctx, chainNonces func (_m *CrosschainObserverKeeper) SetChainNonces(ctx types.Context, chainNonces observertypes.ChainNonces) { _m.Called(ctx, chainNonces) @@ -843,11 +780,6 @@ func (_m *CrosschainObserverKeeper) SetNonceToCctx(ctx types.Context, nonceToCct _m.Called(ctx, nonceToCctx) } -// SetObservers provides a mock function with given fields: ctx, om -func (_m *CrosschainObserverKeeper) SetObservers(ctx types.Context, om observertypes.ObserverSet) { - _m.Called(ctx, om) -} - // SetPendingNonces provides a mock function with given fields: ctx, pendingNonces func (_m *CrosschainObserverKeeper) SetPendingNonces(ctx types.Context, pendingNonces observertypes.PendingNonces) { _m.Called(ctx, pendingNonces) diff --git a/testutil/keeper/mocks/crosschain/staking.go b/testutil/keeper/mocks/crosschain/staking.go index 772bb09971..1fb8a14061 100644 --- a/testutil/keeper/mocks/crosschain/staking.go +++ b/testutil/keeper/mocks/crosschain/staking.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.41.0. DO NOT EDIT. package mocks @@ -35,34 +35,6 @@ func (_m *CrosschainStakingKeeper) GetAllValidators(ctx types.Context) []staking return r0 } -// GetValidator provides a mock function with given fields: ctx, addr -func (_m *CrosschainStakingKeeper) GetValidator(ctx types.Context, addr types.ValAddress) (stakingtypes.Validator, bool) { - ret := _m.Called(ctx, addr) - - if len(ret) == 0 { - panic("no return value specified for GetValidator") - } - - var r0 stakingtypes.Validator - var r1 bool - if rf, ok := ret.Get(0).(func(types.Context, types.ValAddress) (stakingtypes.Validator, bool)); ok { - return rf(ctx, addr) - } - if rf, ok := ret.Get(0).(func(types.Context, types.ValAddress) stakingtypes.Validator); ok { - r0 = rf(ctx, addr) - } else { - r0 = ret.Get(0).(stakingtypes.Validator) - } - - if rf, ok := ret.Get(1).(func(types.Context, types.ValAddress) bool); ok { - r1 = rf(ctx, addr) - } else { - r1 = ret.Get(1).(bool) - } - - return r0, r1 -} - // NewCrosschainStakingKeeper creates a new instance of CrosschainStakingKeeper. 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 NewCrosschainStakingKeeper(t interface { diff --git a/testutil/keeper/mocks/fungible/account.go b/testutil/keeper/mocks/fungible/account.go index 94b7a84d75..f7a2788969 100644 --- a/testutil/keeper/mocks/fungible/account.go +++ b/testutil/keeper/mocks/fungible/account.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.41.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/bank.go b/testutil/keeper/mocks/fungible/bank.go index d44da595c0..599ba3453f 100644 --- a/testutil/keeper/mocks/fungible/bank.go +++ b/testutil/keeper/mocks/fungible/bank.go @@ -1,9 +1,8 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.41.0. DO NOT EDIT. package mocks import ( - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" mock "github.com/stretchr/testify/mock" types "github.com/cosmos/cosmos-sdk/types" @@ -14,124 +13,6 @@ type FungibleBankKeeper struct { mock.Mock } -// BlockedAddr provides a mock function with given fields: addr -func (_m *FungibleBankKeeper) BlockedAddr(addr types.AccAddress) bool { - ret := _m.Called(addr) - - if len(ret) == 0 { - panic("no return value specified for BlockedAddr") - } - - var r0 bool - if rf, ok := ret.Get(0).(func(types.AccAddress) bool); ok { - r0 = rf(addr) - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - -// BurnCoins provides a mock function with given fields: ctx, moduleName, amt -func (_m *FungibleBankKeeper) BurnCoins(ctx types.Context, moduleName string, amt types.Coins) error { - ret := _m.Called(ctx, moduleName, amt) - - if len(ret) == 0 { - panic("no return value specified for BurnCoins") - } - - var r0 error - if rf, ok := ret.Get(0).(func(types.Context, string, types.Coins) error); ok { - r0 = rf(ctx, moduleName, amt) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// GetBalance provides a mock function with given fields: ctx, addr, denom -func (_m *FungibleBankKeeper) GetBalance(ctx types.Context, addr types.AccAddress, denom string) types.Coin { - ret := _m.Called(ctx, addr, denom) - - if len(ret) == 0 { - panic("no return value specified for GetBalance") - } - - var r0 types.Coin - if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, string) types.Coin); ok { - r0 = rf(ctx, addr, denom) - } else { - r0 = ret.Get(0).(types.Coin) - } - - return r0 -} - -// GetDenomMetaData provides a mock function with given fields: ctx, denom -func (_m *FungibleBankKeeper) GetDenomMetaData(ctx types.Context, denom string) (banktypes.Metadata, bool) { - ret := _m.Called(ctx, denom) - - if len(ret) == 0 { - panic("no return value specified for GetDenomMetaData") - } - - var r0 banktypes.Metadata - var r1 bool - if rf, ok := ret.Get(0).(func(types.Context, string) (banktypes.Metadata, bool)); ok { - return rf(ctx, denom) - } - if rf, ok := ret.Get(0).(func(types.Context, string) banktypes.Metadata); ok { - r0 = rf(ctx, denom) - } else { - r0 = ret.Get(0).(banktypes.Metadata) - } - - if rf, ok := ret.Get(1).(func(types.Context, string) bool); ok { - r1 = rf(ctx, denom) - } else { - r1 = ret.Get(1).(bool) - } - - return r0, r1 -} - -// HasSupply provides a mock function with given fields: ctx, denom -func (_m *FungibleBankKeeper) HasSupply(ctx types.Context, denom string) bool { - ret := _m.Called(ctx, denom) - - if len(ret) == 0 { - panic("no return value specified for HasSupply") - } - - var r0 bool - if rf, ok := ret.Get(0).(func(types.Context, string) bool); ok { - r0 = rf(ctx, denom) - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - -// IsSendEnabledCoin provides a mock function with given fields: ctx, coin -func (_m *FungibleBankKeeper) IsSendEnabledCoin(ctx types.Context, coin types.Coin) bool { - ret := _m.Called(ctx, coin) - - if len(ret) == 0 { - panic("no return value specified for IsSendEnabledCoin") - } - - var r0 bool - if rf, ok := ret.Get(0).(func(types.Context, types.Coin) bool); ok { - r0 = rf(ctx, coin) - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - // MintCoins provides a mock function with given fields: ctx, moduleName, amt func (_m *FungibleBankKeeper) MintCoins(ctx types.Context, moduleName string, amt types.Coins) error { ret := _m.Called(ctx, moduleName, amt) @@ -150,24 +31,6 @@ func (_m *FungibleBankKeeper) MintCoins(ctx types.Context, moduleName string, am return r0 } -// SendCoinsFromAccountToModule provides a mock function with given fields: ctx, senderAddr, recipientModule, amt -func (_m *FungibleBankKeeper) 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) - } else { - r0 = ret.Error(0) - } - - return r0 -} - // SendCoinsFromModuleToAccount provides a mock function with given fields: ctx, senderModule, recipientAddr, amt func (_m *FungibleBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { ret := _m.Called(ctx, senderModule, recipientAddr, amt) @@ -186,11 +49,6 @@ func (_m *FungibleBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, se return r0 } -// SetDenomMetaData provides a mock function with given fields: ctx, denomMetaData -func (_m *FungibleBankKeeper) SetDenomMetaData(ctx types.Context, denomMetaData banktypes.Metadata) { - _m.Called(ctx, denomMetaData) -} - // NewFungibleBankKeeper creates a new instance of FungibleBankKeeper. 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 NewFungibleBankKeeper(t interface { diff --git a/testutil/keeper/mocks/fungible/evm.go b/testutil/keeper/mocks/fungible/evm.go index 64c041b22d..bdfd9e8130 100644 --- a/testutil/keeper/mocks/fungible/evm.go +++ b/testutil/keeper/mocks/fungible/evm.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.41.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/observer.go b/testutil/keeper/mocks/fungible/observer.go index a808da6d5f..b5736cd960 100644 --- a/testutil/keeper/mocks/fungible/observer.go +++ b/testutil/keeper/mocks/fungible/observer.go @@ -1,11 +1,11 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.41.0. DO NOT EDIT. package mocks import ( mock "github.com/stretchr/testify/mock" + common "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common" observertypes "github.com/zeta-chain/zetacore/x/observer/types" types "github.com/cosmos/cosmos-sdk/types" @@ -16,132 +16,6 @@ type FungibleObserverKeeper struct { mock.Mock } -// GetAllBallots provides a mock function with given fields: ctx -func (_m *FungibleObserverKeeper) GetAllBallots(ctx types.Context) []*observertypes.Ballot { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetAllBallots") - } - - var r0 []*observertypes.Ballot - if rf, ok := ret.Get(0).(func(types.Context) []*observertypes.Ballot); ok { - r0 = rf(ctx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*observertypes.Ballot) - } - } - - return r0 -} - -// GetBallot provides a mock function with given fields: ctx, index -func (_m *FungibleObserverKeeper) GetBallot(ctx types.Context, index string) (observertypes.Ballot, bool) { - ret := _m.Called(ctx, index) - - if len(ret) == 0 { - panic("no return value specified for GetBallot") - } - - var r0 observertypes.Ballot - var r1 bool - if rf, ok := ret.Get(0).(func(types.Context, string) (observertypes.Ballot, bool)); ok { - return rf(ctx, index) - } - if rf, ok := ret.Get(0).(func(types.Context, string) observertypes.Ballot); ok { - r0 = rf(ctx, index) - } else { - r0 = ret.Get(0).(observertypes.Ballot) - } - - if rf, ok := ret.Get(1).(func(types.Context, string) bool); ok { - r1 = rf(ctx, index) - } else { - r1 = ret.Get(1).(bool) - } - - return r0, r1 -} - -// GetChainParamsByChainID provides a mock function with given fields: ctx, chainID -func (_m *FungibleObserverKeeper) GetChainParamsByChainID(ctx types.Context, chainID int64) (*observertypes.ChainParams, bool) { - ret := _m.Called(ctx, chainID) - - if len(ret) == 0 { - panic("no return value specified for GetChainParamsByChainID") - } - - var r0 *observertypes.ChainParams - var r1 bool - if rf, ok := ret.Get(0).(func(types.Context, int64) (*observertypes.ChainParams, bool)); ok { - return rf(ctx, chainID) - } - if rf, ok := ret.Get(0).(func(types.Context, int64) *observertypes.ChainParams); ok { - r0 = rf(ctx, chainID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*observertypes.ChainParams) - } - } - - if rf, ok := ret.Get(1).(func(types.Context, int64) bool); ok { - r1 = rf(ctx, chainID) - } else { - r1 = ret.Get(1).(bool) - } - - return r0, r1 -} - -// GetMaturedBallotList provides a mock function with given fields: ctx -func (_m *FungibleObserverKeeper) GetMaturedBallotList(ctx types.Context) []string { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetMaturedBallotList") - } - - var r0 []string - if rf, ok := ret.Get(0).(func(types.Context) []string); ok { - r0 = rf(ctx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) - } - } - - return r0 -} - -// GetObserverSet provides a mock function with given fields: ctx -func (_m *FungibleObserverKeeper) GetObserverSet(ctx types.Context) (observertypes.ObserverSet, bool) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetObserverSet") - } - - var r0 observertypes.ObserverSet - var r1 bool - if rf, ok := ret.Get(0).(func(types.Context) (observertypes.ObserverSet, bool)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(types.Context) observertypes.ObserverSet); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(observertypes.ObserverSet) - } - - if rf, ok := ret.Get(1).(func(types.Context) bool); ok { - r1 = rf(ctx) - } else { - r1 = ret.Get(1).(bool) - } - - return r0, r1 -} - // GetParams provides a mock function with given fields: ctx func (_m *FungibleObserverKeeper) GetParams(ctx types.Context) observertypes.Params { ret := _m.Called(ctx) @@ -180,16 +54,6 @@ func (_m *FungibleObserverKeeper) GetSupportedChains(ctx types.Context) []*commo return r0 } -// SetBallot provides a mock function with given fields: ctx, ballot -func (_m *FungibleObserverKeeper) SetBallot(ctx types.Context, ballot *observertypes.Ballot) { - _m.Called(ctx, ballot) -} - -// SetObservers provides a mock function with given fields: ctx, om -func (_m *FungibleObserverKeeper) SetObservers(ctx types.Context, om observertypes.ObserverSet) { - _m.Called(ctx, om) -} - // NewFungibleObserverKeeper creates a new instance of FungibleObserverKeeper. 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 NewFungibleObserverKeeper(t interface { diff --git a/x/crosschain/module.go b/x/crosschain/module.go index 8821a7942e..888de9c905 100644 --- a/x/crosschain/module.go +++ b/x/crosschain/module.go @@ -105,22 +105,16 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { type AppModule struct { AppModuleBasic - keeper keeper.Keeper - stakingKeeper types.StakingKeeper - authKeeper types.AccountKeeper + keeper keeper.Keeper } func NewAppModule( cdc codec.Codec, keeper keeper.Keeper, - stakingKeeper types.StakingKeeper, - authKeeper types.AccountKeeper, ) AppModule { return AppModule{ AppModuleBasic: NewAppModuleBasic(cdc), keeper: keeper, - stakingKeeper: stakingKeeper, - authKeeper: authKeeper, } } @@ -175,7 +169,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.Ra InitGenesis(ctx, am.keeper, genState) // ensure account is created - am.authKeeper.GetModuleAccount(ctx, types.ModuleName) + am.keeper.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) return []abci.ValidatorUpdate{} } diff --git a/x/crosschain/types/expected_keepers.go b/x/crosschain/types/expected_keepers.go index 3bbd137795..540600b73b 100644 --- a/x/crosschain/types/expected_keepers.go +++ b/x/crosschain/types/expected_keepers.go @@ -17,38 +17,22 @@ import ( type StakingKeeper interface { GetAllValidators(ctx sdk.Context) (validators []stakingtypes.Validator) - GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) } // AccountKeeper defines the expected account keeper (noalias) type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - - GetModuleAddress(name string) sdk.AccAddress GetModuleAccount(ctx sdk.Context, name string) types.ModuleAccountI - - // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 - SetModuleAccount(sdk.Context, types.ModuleAccountI) } // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error } type ObserverKeeper interface { GetObserverSet(ctx sdk.Context) (val observertypes.ObserverSet, found bool) - SetBallot(ctx sdk.Context, ballot *observertypes.Ballot) GetBallot(ctx sdk.Context, index string) (val observertypes.Ballot, found bool) - GetAllBallots(ctx sdk.Context) (voters []*observertypes.Ballot) GetParams(ctx sdk.Context) (params observertypes.Params) GetChainParamsByChainID(ctx sdk.Context, chainID int64) (params *observertypes.ChainParams, found bool) GetNodeAccount(ctx sdk.Context, address string) (nodeAccount observertypes.NodeAccount, found bool) @@ -67,7 +51,6 @@ type ObserverKeeper interface { AddBallotToList(ctx sdk.Context, ballot observertypes.Ballot) GetBlockHeader(ctx sdk.Context, hash []byte) (val common.BlockHeader, found bool) CheckIfTssPubkeyHasBeenGenerated(ctx sdk.Context, tssPubkey string) (observertypes.TSS, bool) - GetPreviousTSS(ctx sdk.Context) (val observertypes.TSS, found bool) GetAllTSS(ctx sdk.Context) (list []observertypes.TSS) GetTSS(ctx sdk.Context) (val observertypes.TSS, found bool) SetTSS(ctx sdk.Context, tss observertypes.TSS) @@ -80,11 +63,9 @@ type ObserverKeeper interface { RemoveAllExistingMigrators(ctx sdk.Context) SetChainNonces(ctx sdk.Context, chainNonces observertypes.ChainNonces) GetChainNonces(ctx sdk.Context, index string) (val observertypes.ChainNonces, found bool) - RemoveChainNonces(ctx sdk.Context, index string) GetAllChainNonces(ctx sdk.Context) (list []observertypes.ChainNonces) SetNonceToCctx(ctx sdk.Context, nonceToCctx observertypes.NonceToCctx) GetNonceToCctx(ctx sdk.Context, tss string, chainID int64, nonce int64) (val observertypes.NonceToCctx, found bool) - RemoveNonceToCctx(ctx sdk.Context, cctx observertypes.NonceToCctx) GetAllPendingNonces(ctx sdk.Context) (list []observertypes.PendingNonces, err error) GetPendingNonces(ctx sdk.Context, tss string, chainID int64) (val observertypes.PendingNonces, found bool) SetPendingNonces(ctx sdk.Context, pendingNonces observertypes.PendingNonces) @@ -106,7 +87,6 @@ type FungibleKeeper interface { QuerySystemContractGasCoinZRC20(ctx sdk.Context, chainID *big.Int) (eth.Address, error) GetUniswapV2Router02Address(ctx sdk.Context) (eth.Address, error) QueryUniswapV2RouterGetZetaAmountsIn(ctx sdk.Context, amountOut *big.Int, outZRC4 eth.Address) (*big.Int, error) - QueryUniswapV2RouterGetZRC4AmountsIn(ctx sdk.Context, amountOut *big.Int, inZRC4 eth.Address) (*big.Int, error) QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn(ctx sdk.Context, amountOut *big.Int, inZRC4, outZRC4 eth.Address) (*big.Int, error) QueryGasLimit(ctx sdk.Context, contract eth.Address) (*big.Int, error) QueryProtocolFlatFee(ctx sdk.Context, contract eth.Address) (*big.Int, error) diff --git a/x/emissions/keeper/keeper.go b/x/emissions/keeper/keeper.go index fe9e4429e7..b0fe4d26ee 100644 --- a/x/emissions/keeper/keeper.go +++ b/x/emissions/keeper/keeper.go @@ -22,6 +22,7 @@ type ( bankKeeper types.BankKeeper stakingKeeper types.StakingKeeper observerKeeper types.ObserverKeeper + authKeeper types.AccountKeeper } ) @@ -34,7 +35,7 @@ func NewKeeper( bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, observerKeeper types.ObserverKeeper, - + authKeeper types.AccountKeeper, ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -42,7 +43,6 @@ func NewKeeper( } return &Keeper{ - cdc: cdc, storeKey: storeKey, memKey: memKey, @@ -51,6 +51,7 @@ func NewKeeper( bankKeeper: bankKeeper, stakingKeeper: stakingKeeper, observerKeeper: observerKeeper, + authKeeper: authKeeper, } } @@ -73,3 +74,7 @@ func (k Keeper) GetStakingKeeper() types.StakingKeeper { func (k Keeper) GetObserverKeeper() types.ObserverKeeper { return k.observerKeeper } + +func (k Keeper) GetAuthKeeper() types.AccountKeeper { + return k.authKeeper +} diff --git a/x/emissions/module.go b/x/emissions/module.go index a40c9743e9..7086c998fc 100644 --- a/x/emissions/module.go +++ b/x/emissions/module.go @@ -101,19 +101,16 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { type AppModule struct { AppModuleBasic - keeper emissionskeeper.Keeper - accountKeeper types.AccountKeeper + keeper emissionskeeper.Keeper } func NewAppModule( cdc codec.Codec, keeper emissionskeeper.Keeper, - accountKeeper types.AccountKeeper, ) AppModule { return AppModule{ AppModuleBasic: NewAppModuleBasic(cdc), keeper: keeper, - accountKeeper: accountKeeper, } } @@ -154,9 +151,9 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.Ra InitGenesis(ctx, am.keeper, genState) - am.accountKeeper.GetModuleAccount(ctx, types.ModuleName) - am.accountKeeper.GetModuleAccount(ctx, types.UndistributedTssRewardsPool) - am.accountKeeper.GetModuleAccount(ctx, types.UndistributedObserverRewardsPool) + am.keeper.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) + am.keeper.GetAuthKeeper().GetModuleAccount(ctx, types.UndistributedTssRewardsPool) + am.keeper.GetAuthKeeper().GetModuleAccount(ctx, types.UndistributedObserverRewardsPool) return []abci.ValidatorUpdate{} } diff --git a/x/emissions/types/expected_keepers.go b/x/emissions/types/expected_keepers.go index 15ad6781a7..9facd542b8 100644 --- a/x/emissions/types/expected_keepers.go +++ b/x/emissions/types/expected_keepers.go @@ -8,27 +8,18 @@ import ( // AccountKeeper defines the expected account keeper used for simulations (noalias) type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI GetModuleAccount(ctx sdk.Context, moduleName string) types.ModuleAccountI // Methods imported from account should be defined here } type ObserverKeeper interface { GetMaturedBallotList(ctx sdk.Context) []string - GetObserverSet(ctx sdk.Context) (val observertypes.ObserverSet, found bool) - SetBallot(ctx sdk.Context, ballot *observertypes.Ballot) GetBallot(ctx sdk.Context, index string) (val observertypes.Ballot, found bool) - GetAllBallots(ctx sdk.Context) (voters []*observertypes.Ballot) - GetParams(ctx sdk.Context) (params observertypes.Params) - GetChainParamsByChainID(ctx sdk.Context, chainID int64) (params *observertypes.ChainParams, found bool) } // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin // Methods imported from bank should be defined here } diff --git a/x/fungible/module.go b/x/fungible/module.go index e66b28f1e8..5a88d9e11b 100644 --- a/x/fungible/module.go +++ b/x/fungible/module.go @@ -101,22 +101,16 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { type AppModule struct { AppModuleBasic - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper + keeper keeper.Keeper } func NewAppModule( cdc codec.Codec, keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, ) AppModule { return AppModule{ AppModuleBasic: NewAppModuleBasic(cdc), keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, } } @@ -158,7 +152,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.Ra InitGenesis(ctx, am.keeper, genState) // ensure fungible module account is set on genesis - if acc := am.accountKeeper.GetModuleAccount(ctx, types.ModuleName); acc == nil { + if acc := am.keeper.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName); acc == nil { // NOTE: shouldn't occur panic("the fungible module account has not been set") } diff --git a/x/fungible/types/expected_keepers.go b/x/fungible/types/expected_keepers.go index c576a7cafc..5fbef0d279 100644 --- a/x/fungible/types/expected_keepers.go +++ b/x/fungible/types/expected_keepers.go @@ -6,7 +6,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/vm" @@ -28,26 +27,12 @@ type AccountKeeper interface { type BankKeeper interface { SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - IsSendEnabledCoin(ctx sdk.Context, coin sdk.Coin) bool - BlockedAddr(addr sdk.AccAddress) bool - GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) - SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) - HasSupply(ctx sdk.Context, denom string) bool - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin } type ObserverKeeper interface { - GetObserverSet(ctx sdk.Context) (val observertypes.ObserverSet, found bool) - SetBallot(ctx sdk.Context, ballot *observertypes.Ballot) - GetBallot(ctx sdk.Context, index string) (val observertypes.Ballot, found bool) - GetAllBallots(ctx sdk.Context) (voters []*observertypes.Ballot) GetParams(ctx sdk.Context) (params observertypes.Params) - GetChainParamsByChainID(ctx sdk.Context, chainID int64) (params *observertypes.ChainParams, found bool) GetSupportedChains(ctx sdk.Context) []*common.Chain - GetMaturedBallotList(ctx sdk.Context) []string } type EVMKeeper interface { diff --git a/x/observer/keeper/keeper.go b/x/observer/keeper/keeper.go index b8cb0378c3..c7a5f38e77 100644 --- a/x/observer/keeper/keeper.go +++ b/x/observer/keeper/keeper.go @@ -30,7 +30,6 @@ func NewKeeper( ps paramtypes.Subspace, stakingKeeper types.StakingKeeper, slashinKeeper types.SlashingKeeper, - ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { diff --git a/x/observer/module.go b/x/observer/module.go index 8e4e750608..efb851964d 100644 --- a/x/observer/module.go +++ b/x/observer/module.go @@ -101,22 +101,16 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { type AppModule struct { AppModuleBasic - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper + keeper keeper.Keeper } func NewAppModule( cdc codec.Codec, keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, ) AppModule { return AppModule{ AppModuleBasic: NewAppModuleBasic(cdc), keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, } } diff --git a/x/observer/types/expected_keepers.go b/x/observer/types/expected_keepers.go index d6fa8010db..b72c74a766 100644 --- a/x/observer/types/expected_keepers.go +++ b/x/observer/types/expected_keepers.go @@ -2,25 +2,11 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - // Methods imported from bank should be defined here -} - type StakingKeeper interface { - GetAllValidators(ctx sdk.Context) (validators []stakingtypes.Validator) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) GetDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation stakingtypes.Delegation, found bool) SetValidator(ctx sdk.Context, validator stakingtypes.Validator)