feat: external risk service#1407
Conversation
|
Warning Review limit reached
Next review available in: 45 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR replaces the Range API-based AML risk checking client with a thin HTTP client querying a dedicated risk server. The Suggested reviewers: ✨ 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 |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@config.example.toml`:
- Around line 272-287: The full-coverage example config test is missing
assertions for the new Chainlink risk settings. Update
test_example_config_full_coverage in tests.rs to also verify
config.chainlink.risk.risk_server_url and config.chainlink.risk.request_timeout
alongside config.chainlink.risk.enabled, so the example file’s new values are
covered and any drift is caught. Use the existing
test_example_config_full_coverage and config.chainlink.risk fields to locate the
check.
In `@magicblock-aml/src/lib.rs`:
- Around line 43-57: `Risk::try_from_config` currently stores
`config.risk_server_url` without validation, so invalid or empty URLs only fail
later during requests. Add a parse/validation step in `try_from_config` before
constructing `Self`, and map failures to an appropriate `RiskError` so startup
fails fast. Keep the existing `Client::builder` setup and `base_url` assignment,
but ensure `RiskConfig::risk_server_url` is validated before trimming and
storing it.
In `@magicblock-chainlink/src/chainlink/errors.rs`:
- Around line 73-74: Rename the RangeRisk error variant to RiskCheckFailed in
the errors enum so it matches the new risk server naming. Update the enum
definition in the Errors/RiskError area and keep the existing #[error(...)]
message and #[from] conversion aligned with the new variant name, then fix any
references that still use RangeRisk across the Chainlink error handling code.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1ead3eac-31fd-40bc-b762-990a70bf8305
⛔ Files ignored due to path filters (2)
Cargo.lockis excluded by!**/*.locktest-integration/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (11)
config.example.tomlmagicblock-aml/Cargo.tomlmagicblock-aml/src/lib.rsmagicblock-api/src/magic_validator.rsmagicblock-chainlink/src/chainlink/errors.rsmagicblock-chainlink/src/chainlink/mod.rsmagicblock-config/src/config/chain.rsmagicblock-config/src/consts.rsmagicblock-config/src/tests.rstest-integration/test-aml/src/lib.rstest-integration/test-chainlink/tests/ix_aml_undelegation.rs
💤 Files with no reviewable changes (2)
- magicblock-aml/Cargo.toml
- magicblock-api/src/magic_validator.rs
Summary
Relies on the query filtering service to get risk results, sharing the same cache to reduce API calls.
Breaking Changes
Summary by CodeRabbit
New Features
Bug Fixes
Documentation