feat(faucet): integrate reliakit-primitives + reliakit-validate#771
Conversation
- Add reliakit-primitives = "0.2" and reliakit-validate = "0.1" from crates.io (both published crates by the same author). - validate_address(): use HexString::new() for hex-char validation instead of manual .chars().all(|c| c.is_ascii_hexdigit()) — same semantics, more expressive. - DripRequest: implement Validate (from reliakit-validate) so address correctness is enforced at the type level. handle_drip() now calls Valid::new(req) before any state mutation or RPC call. - main(): use PositiveInt::new(drip_amount) and NonEmptyStr::new(rpc_url) to reject misconfigured values at startup before any I/O.
|
Warning Review limit reached
More reviews will be available in 6 minutes and 5 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Integrates two published Rust crates from the same author into the testnet faucet.
What changed
reliakit-primitives = "0.2"(crates.io)validate_address(): replaced manual.chars().all(|c| c.is_ascii_hexdigit())withHexString::new()— same semantics, uses the typed primitive.main():PositiveInt::new(cli.drip_amount)rejects drip_amount=0 at startup before any I/O.NonEmptyStr::new(&cli.rpc_url)rejects empty RPC URL.reliakit-validate = "0.1"(crates.io)DripRequestnow implementsValidate— address format rules are expressed once at the type level.handle_drip()callsValid::new(req)as the first operation, rejecting invalid addresses before any rate-limit state mutation or RPC call.No behavior change
The same address format is accepted/rejected. The change is structural: validation is now in one place (the
Validateimpl) and enforced at the type boundary rather than scattered through the handler.