feat(#58): add rate limiting to verify_and_register#187
Open
Peolite001 wants to merge 8 commits into
Open
Conversation
- Track call count per caller per 10-ledger window via DataKey::RateLimit(Address) - Add RateLimitExceeded error variant - Add set_rate_limit admin setter - Reject 11th call within window; counter auto-resets after 10 ledgers - SDK: expose RateLimitError with retryAfterLedgers - Soroban test covering rate limit path
Add RateLimitError class and enhance error handling
Removed introductory comments and restructured exports.
Added detailed documentation for the PassportClient class and its methods, including verifyCredential, verifyBatch, and isRevoked.
Added documentation header for the Agent Passport client.
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
Adds ledger-based rate limiting to the
verify_and_registercontract entry point. Each caller address is tracked with a 10-ledger rolling window (~1 minute). Exceeding 10 calls returns the newRateLimitExceedederror. Admin can adjust the limit viaset_rate_limit. The off-chain SDK wrapper surfaces this as a typedRateLimitErrorwithretryAfterLedgers.Checklist
cargo testpasses).Related Issues
Closes #58