Skip to content

Commit

Permalink
Merge pull request #1219 from lavanet/CNS-880-audit-create-future-sub…
Browse files Browse the repository at this point in the history
…scription-validate

CNS-880-audit-create-future-subscription-validate
  • Loading branch information
Yaroms authored Feb 14, 2024
2 parents 38f48a6 + dee2b88 commit 09f89e9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions x/subscription/keeper/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,14 @@ func (k Keeper) CreateFutureSubscription(ctx sdk.Context,
return err
}

if duration > types.MAX_SUBSCRIPTION_DURATION {
str := strconv.FormatInt(types.MAX_SUBSCRIPTION_DURATION, 10)
return utils.LavaFormatWarning("duration cannot exceed limit ("+str+" months)",
fmt.Errorf("future subscription failed"),
utils.Attribute{Key: "duration", Value: duration},
)
}

var sub types.Subscription
nextEpoch, err := k.epochstorageKeeper.GetNextEpoch(ctx, block)
if err != nil {
Expand Down

0 comments on commit 09f89e9

Please sign in to comment.