RewardAttester.Validate: treat reward.Amount as max cap#219
Merged
Conversation
A gitlink at .claude/worktrees/agent-aad269c9 was accidentally committed in #200. Without a corresponding .gitmodules entry, the checkout action's submodule cleanup step fails on every push to main with "fatal: No url found for submodule path", which in turn skips the tag-edge job and prevents :edge from auto-promoting on merge. Drop the gitlink and add .claude/ to .gitignore so local Claude Code worktrees don't get committed again. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…quality Trending tracks and trending underground top-10 challenges pay rank-dependent amounts (1000 for ranks 1-5, 100 for ranks 6-10), but RewardAttester.Validate enforced strict equality between claim.Amount and the static reward.Amount config (1000 for tt/tut). With the API fixed to send per-rank user_challenges.amount, validators reject ranks 6-10 with 'amount does not match reward amount', leaving those winners undisbursed. Per-claim amount is determined upstream by the discovery node from user_challenges, and the claim authority signature is checked separately in Authenticate(). The validator's job here is to act as a sanity bound, not the source of truth on amount. Treat reward.Amount as a max cap and explicitly reject amount=0 (preserving the previous 'missing amount' behavior that strict equality incidentally caught). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
raymondjacobson
approved these changes
May 13, 2026
| // Allow any positive amount up to the static reward config amount. Some | ||
| // rewards (notably trending tracks/underground top 10) pay rank-dependent | ||
| // amounts that are <= the headline reward.Amount; the actual per-claim | ||
| // amount is determined by the discovery node from user_challenges.amount |
Contributor
There was a problem hiding this comment.
update comment to not mention discovery node
Contributor
There was a problem hiding this comment.
or just remove this comment entirely, not too useful for just a > check lol
Contributor
|
Looks like the new test fails --- FAIL: TestRewardsLifecycle (8.45s) |
Test 2 previously asserted that amount=50 fails when reward cap is 100. Under the new cap behavior (any amount <= cap is valid), 50 should succeed. Update to assert below-cap succeeds and add a new test 2b asserting that exceeding the cap (150 > 100) correctly fails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Trending tracks and trending underground top-10 challenges pay rank-dependent amounts (1000 for ranks 1-5, 100 for ranks 6-10). After api#783 fixes the API to send per-rank
user_challenges.amount, validators reject ranks 6-10 withamount does not match reward amount(the static config has 1000 for bothttandtut).This change relaxes the validator-side equality check to a max cap. The per-claim amount is determined upstream by the discovery node from
user_challenges, and the claim authority signature is verified separately inAuthenticate(). The validator's amount check serves as a sanity bound, not the source of truth.Behavior change
claim.Amount > reward.Amount→ reject (catastrophic over-attestation guard, unchanged in spirit)claim.Amount == reward.Amount→ accept (unchanged)claim.Amount < reward.Amount(and > 0) → now accepts (was reject)claim.Amount == 0→ reject withmissing amount(preserves previous behavior, which strict equality caught incidentally)Real-world repro
Today's
/disburse 2026-05-01from the trending-challenge-rewards bot left 4 winners stuck:FloppyDriveMusic,CymaticsBass,dilemmamusic182) are ranks 6-10 withuser_challenges.amount=100. All 3 reachable validators (creatornode.audius.co,audius.bragi.cc,v.monophonic.digital) rejectamount=100against their config oftt:1000/tut:1000. The API gets0 validator attestations, need 3and the claim never lands.Nonkalonk) is a separate AAO denial, not addressed here.Test plan
go test ./pkg/rewards/...(existing assertions updated to reflect cap semantics; new assertion that amount equal-to-cap still works)/disburse 2026-05-01to clear the 3 stuck rank 6-10 winners.Followups
audius-cn1.tikilabs.comis returning HTTP 522 — with that down, only 3 of 4 prod validators are usable, no margin if any one fails. Worth pinging that operator independently.reward.Amountconfig is now best understood as a per-claim ceiling rather than a fixed payout. Consider renaming the field toMaxAmountin a future cleanup.🤖 Generated with Claude Code