Skip to content

Implement daily limit enforcement for testnet faucet requests#6967

Merged
cakesoft-vaibhav merged 3 commits into
upgrade/rn-0.83.9from
feat/testnet-faucet-limit
May 15, 2026
Merged

Implement daily limit enforcement for testnet faucet requests#6967
cakesoft-vaibhav merged 3 commits into
upgrade/rn-0.83.9from
feat/testnet-faucet-limit

Conversation

@Parsh
Copy link
Copy Markdown
Collaborator

@Parsh Parsh commented May 14, 2026

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 appId per 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:

  • Daily quota enforcement: The /testnetFaucet endpoint now requires appId and enforces a maximum of 5 successful requests per appId per UTC day. Exceeding the limit returns HTTP 429 with a structured error code FAUCET_DAILY_LIMIT_REACHED. The quota counter is incremented only after a successful transfer.

Frontend (Keeper app) changes:

  • Client quota awareness and error handling: The app now includes appId in faucet requests, distinguishes quota errors (HTTP 429) from generic failures, and sets a dedicated Redux flag (testCoinsQuotaReached) when the daily limit is hit.
  • User experience improvements: When the daily limit is reached, a KeeperModal is 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:

  • OpenSpec documentation: Detailed context, design decisions, requirements, and tasks are documented to clarify the quota logic, error handling, and affected files.

Most important changes:

Backend: Quota Enforcement

  • /testnetFaucet now enforces a per-appId daily 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

  • Keeper app includes appId in requests, distinguishes quota errors, and manages a new Redux flag for quota-reached state.

Localization

  • Adds English and Spanish string keys for all new quota-related UI messages.

Specification/Documentation

  • Thorough OpenSpec documentation details context, requirements, design decisions, and implementation tasks for the new quota system.

@Parsh Parsh requested a review from cakesoft-vaibhav May 14, 2026 16:41
@cakesoft-vaibhav cakesoft-vaibhav merged commit 7db99cf into upgrade/rn-0.83.9 May 15, 2026
1 check failed
@cakesoft-vaibhav cakesoft-vaibhav deleted the feat/testnet-faucet-limit branch May 15, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants