Skip to content

Commit

Permalink
chore(x/tally): skip committer payout calc if there is no commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hacheigriega committed Jan 11, 2025
1 parent 1e9f138 commit c0ac549
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions x/tally/keeper/endblock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ func TestEndBlock(t *testing.T) {
dataResults, err := f.batchingKeeper.GetDataResults(f.Context(), false)
require.NoError(t, err)
require.Contains(t, dataResults, *dataResult)

// TODO: Check before and after balances
})
}
}
Expand Down
15 changes: 10 additions & 5 deletions x/tally/keeper/payout.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ import (
// CalculateCommitterPayouts constructs distribution messages that
// pay the fixed gas cost for each commiter of a given data request.
func (k Keeper) CalculateCommitterPayouts(ctx sdk.Context, req types.Request) (types.DistributionMessages, error) {
result := types.DistributionMessages{
Messages: []types.DistributionMessage{},
RefundType: types.DistributionTypeTimedOut,
}
if len(req.Commits) == 0 {
return result, nil
}

gasCost, err := k.GetGasCostCommitment(ctx)
if err != nil {
return types.DistributionMessages{}, err
Expand All @@ -38,11 +46,8 @@ func (k Keeper) CalculateCommitterPayouts(ctx sdk.Context, req types.Request) (t
Type: types.DistributionTypeTimedOut,
}
}

return types.DistributionMessages{
Messages: distMsgs,
RefundType: types.DistributionTypeTimedOut,
}, nil
result.Messages = distMsgs
return result, nil
}

// TODO: This will become more complex when we introduce incentives.
Expand Down

0 comments on commit c0ac549

Please sign in to comment.