diff --git a/x/budget/abci.go b/x/budget/abci.go index 8f4a506..26bcccb 100644 --- a/x/budget/abci.go +++ b/x/budget/abci.go @@ -3,8 +3,6 @@ package budget import ( "time" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" @@ -13,15 +11,10 @@ import ( ) // BeginBlocker collects budgets for the current block -func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) { +func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) err := k.CollectBudgets(ctx) if err != nil { panic(err) } } - -func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate { - defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker) - return []abci.ValidatorUpdate{} -} diff --git a/x/budget/keeper/genesis.go b/x/budget/keeper/genesis.go index f956c4d..de6cecf 100644 --- a/x/budget/keeper/genesis.go +++ b/x/budget/keeper/genesis.go @@ -1,6 +1,8 @@ package keeper import ( + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/budget/x/budget/types" @@ -14,7 +16,9 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { k.SetParams(ctx, genState.Params) moduleAcc := k.accountKeeper.GetModuleAccount(ctx, types.ModuleName) - k.accountKeeper.SetModuleAccount(ctx, moduleAcc) + if moduleAcc == nil { + panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) + } for _, record := range genState.BudgetRecords { k.SetTotalCollectedCoins(ctx, record.Name, record.TotalCollectedCoins) diff --git a/x/budget/module.go b/x/budget/module.go index 3406410..3426b23 100644 --- a/x/budget/module.go +++ b/x/budget/module.go @@ -159,8 +159,8 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock returns the begin blocker for the budget module. -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { - BeginBlocker(ctx, req, am.keeper) +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + BeginBlocker(ctx, am.keeper) } // EndBlock returns the end blocker for the budget module. It returns no validator diff --git a/x/budget/types/expected_keepers.go b/x/budget/types/expected_keepers.go index 246f0ee..396e254 100644 --- a/x/budget/types/expected_keepers.go +++ b/x/budget/types/expected_keepers.go @@ -9,19 +9,11 @@ import ( // BankKeeper defines the expected bank send keeper type BankKeeper interface { InputOutputCoins(ctx sdk.Context, inputs []banktypes.Input, outputs []banktypes.Output) error - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - - GetSupply(ctx sdk.Context, denom string) sdk.Coin - 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 } // AccountKeeper defines the expected account keeper type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI GetModuleAddress(name string) sdk.AccAddress GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI SetModuleAccount(sdk.Context, authtypes.ModuleAccountI)