Skip to content

Commit

Permalink
fix: Check on zero stake while processing TLMs
Browse files Browse the repository at this point in the history
  • Loading branch information
red-0ne committed Nov 7, 2024
1 parent 254c33a commit 15547ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
11 changes: 0 additions & 11 deletions x/tokenomics/keeper/settle_pending_claims.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,6 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) (
}
}

app, found := k.applicationKeeper.GetApplication(ctx, claim.SessionHeader.ApplicationAddress)
if !found {
return settledResult, expiredResult, types.ErrTokenomicsApplicationNotFound
}

logger.Info(fmt.Sprintf("application stake: %s", app.GetStake()))
if app.GetStake().IsZero() {
logger.Warn(fmt.Sprintf("application %q has no stake", claim.SessionHeader.ApplicationAddress))
continue
}

// If this code path is reached, then either:
// 1. The claim does not require a proof.
// 2. The claim requires a proof and a valid proof was found.
Expand Down
5 changes: 5 additions & 0 deletions x/tokenomics/keeper/token_logic_modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ func (k Keeper) ProcessTokenLogicModules(
}
logger = logger.With("actual_settlement_upokt", actualSettlementCoin)

if actualSettlementCoin.Amount.IsZero() {
logger.Info("actual settlement coin is zero, skipping TLM processing")
return nil
}

logger.Info(fmt.Sprintf("About to start processing TLMs for (%d) relays, equal to (%s) claimed", numRelays, actualSettlementCoin))
// Execute all the token logic modules processors
for tlm, tlmProcessor := range tokenLogicModuleProcessorMap {
Expand Down

0 comments on commit 15547ae

Please sign in to comment.