From 76e266df25ae68dc2d88675a124007b57e73e6dc Mon Sep 17 00:00:00 2001 From: Muku <44918265+muku314115@users.noreply.github.com> Date: Wed, 7 Jun 2023 15:40:12 +0530 Subject: [PATCH] inital changes (#449) Co-authored-by: Ajaz Ahmed Ansari --- x/participationrewards/keeper/hooks.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/x/participationrewards/keeper/hooks.go b/x/participationrewards/keeper/hooks.go index c01ded314..807fa3307 100644 --- a/x/participationrewards/keeper/hooks.go +++ b/x/participationrewards/keeper/hooks.go @@ -1,8 +1,6 @@ package keeper import ( - "errors" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" sdk "github.com/cosmos/cosmos-sdk/types" @@ -56,11 +54,7 @@ func (k *Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, _ int64) k.GetParams(ctx).DistributionProportions, ) if err != nil { - if errors.Is(err, types.ErrNothingToAllocate) { - k.Logger(ctx).Info(err.Error()) - } else { - k.Logger(ctx).Error(err.Error()) - } + k.Logger(ctx).Error(err.Error()) } k.Logger(ctx).Info("Triggering submodule hooks") @@ -74,6 +68,12 @@ func (k *Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, _ int64) return nil } + if allocation == nil { + // if allocation is unset, then return early to avoid panic + k.Logger(ctx).Error("nil allocation", "error", err.Error()) + return nil + } + if err := k.AllocateZoneRewards(ctx, tvs, *allocation); err != nil { k.Logger(ctx).Error(err.Error()) return err