Implement daily limit enforcement for testnet faucet requests#6967
Merged
Conversation
cakesoft-vaibhav
approved these changes
May 15, 2026
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.
This pull request introduces a per-app daily request limit to the testnet faucet flow in the Keeper app and relay. The main goal is to prevent a single app instance from draining the faucet by capping requests to 5 per
appIdper UTC day. The implementation includes backend quota enforcement, structured error handling, and improved client UX for quota-reached scenarios. Both backend and frontend are updated to support this new quota, with clear user messaging and robust error discrimination.Backend (Relay) changes:
/testnetFaucetendpoint now requiresappIdand enforces a maximum of 5 successful requests perappIdper UTC day. Exceeding the limit returns HTTP 429 with a structured error codeFAUCET_DAILY_LIMIT_REACHED. The quota counter is incremented only after a successful transfer.Frontend (Keeper app) changes:
appIdin faucet requests, distinguishes quota errors (HTTP 429) from generic failures, and sets a dedicated Redux flag (testCoinsQuotaReached) when the daily limit is hit.KeeperModalis shown with clear messaging and an OK button, keeping the user on the settings screen. The Receive Test Sats row now displays a static hint about the daily limit.Specification and documentation:
Most important changes:
Backend: Quota Enforcement
/testnetFaucetnow enforces a per-appIddaily limit (max 5 requests per UTC day), returning HTTP 429 with a structured error code if exceeded, and increments the quota only after successful transfers.Frontend: Client Handling and UX
appIdin requests, distinguishes quota errors, and manages a new Redux flag for quota-reached state.Localization
Specification/Documentation