Description — what to implement and the why/impact.
Implement a sliding-window rate limiting policy in the wallet contract (contracts/wallet). Autonomous AI agents executing transactions via wallets need protection against sudden anomalous spikes or runaway loops that could drain funds within a short interval. Adding a sliding-window rate limiter directly into the wallet execution path provides on-chain velocity checks.
Context & Requirements — background, constraints, design references, edge cases;
- Grounded in
contracts/wallet using Soroban ledger timestamps (env.ledger().timestamp()).
- Must track transaction counts or cumulative values over configured time windows.
- Must return a deterministic error such as
RATE_LIMIT_EXCEEDED when transactions exceed the threshold within the active window.
- Must optimize storage writes to prune expired window entries and avoid state bloat.
Acceptance Criteria — a checklist ("- [ ] ...") of specific, testable conditions that define "done".
Implementation Guidance — likely files/modules to touch and a suggested approach
- Likely files:
contracts/wallet/src/lib.rs, contracts/wallet/src/policy.rs (or wallet transaction handler).
- Approach: Store timestamps of recent successful transactions in a bounded vector or state map. On each execute call, filter out timestamps older than the window duration and check the count or total against configured limits.
Testing & Validation — how the contributor should prove it works
- Run
cargo test --package astroid-wallet to validate rate-limiting edge cases under simulated ledger time increments.
- Verify formatting and clippy checks pass cleanly across the workspace.
Submission Guidelines — must open a PR that includes "Closes #"; assignment is required before starting; follow the repo's existing style and conventions.
Wave complexity: Medium
Description — what to implement and the why/impact.
Implement a sliding-window rate limiting policy in the wallet contract (
contracts/wallet). Autonomous AI agents executing transactions via wallets need protection against sudden anomalous spikes or runaway loops that could drain funds within a short interval. Adding a sliding-window rate limiter directly into the wallet execution path provides on-chain velocity checks.Context & Requirements — background, constraints, design references, edge cases;
contracts/walletusing Soroban ledger timestamps (env.ledger().timestamp()).RATE_LIMIT_EXCEEDEDwhen transactions exceed the threshold within the active window.Acceptance Criteria — a checklist ("- [ ] ...") of specific, testable conditions that define "done".
contracts/wallet.RATE_LIMIT_EXCEEDEDerror constant.Implementation Guidance — likely files/modules to touch and a suggested approach
contracts/wallet/src/lib.rs,contracts/wallet/src/policy.rs(or wallet transaction handler).Testing & Validation — how the contributor should prove it works
cargo test --package astroid-walletto validate rate-limiting edge cases under simulated ledger time increments.Submission Guidelines — must open a PR that includes "Closes #"; assignment is required before starting; follow the repo's existing style and conventions.
Wave complexity: Medium