Feature/asset allowlist and contract probe#535
Merged
1nonlypiece merged 5 commits intoMay 28, 2026
Merged
Conversation
- Add validateSupportedAsset() to validate asset codes against SUPPORTED_ASSETS - Supports case-insensitive asset codes (e.g., 'xlm' -> 'XLM') - Throws ValidationError with clear message listing supported assets - Imports SUPPORTED_ASSETS from config module
- Import validateSupportedAsset from validation module - Add asset validation in POST /api/commitments before chain submission - Reject unsupported assets with VALIDATION_ERROR (400) - Validation occurs early in request processing, before rate limiting chain calls - Supports XLM and USDC assets
- Add probeContractReachability() function to verify contract accessibility - Probe checks if configured commitmentCore contract is reachable - Includes latency measurement and error details - Distinguishes between RPC-unreachable and contract-misconfigured states - Avoids leaking raw RPC details to client - Ready status now requires both RPC and contract to be reachable - Includes timeout handling (5s per probe)
- Test rejection of unsupported assets with VALIDATION_ERROR - Test acceptance of XLM and USDC assets - Test case-insensitive asset code handling - Test rejection of empty and null asset values - Test supported config includes XLM and USDC with correct metadata - Verify bounds consistency in supported config - Minimum 95% coverage for asset validation logic
- Test ready status when RPC and contract are reachable - Test sorobanRpc check is included in response - Test contract check is included in response - Test 503 response when not ready - Test timestamp in ISO format - Test distinction between RPC and contract issues - Test graceful handling of missing RPC configuration - Test error details when contract probe fails - Test reasonable timeout for probe operations (< 15s) - Minimum 95% coverage for contract probe logic
|
@strngecloud is attempting to deploy a commit to the 1nonly's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@strngecloud Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Backend: Asset Allowlist Validation & Contract Reachability Probe
Overview
This PR addresses two backend issues:
Changes
Issue #448: Asset Allowlist Validation
File:
src/lib/backend/validation.tsvalidateSupportedAsset()function to validate asset codes againstSUPPORTED_ASSETSValidationErrorwith clear message listing supported assetsFile:
src/app/api/commitments/route.tsVALIDATION_ERROR(400)Tests:
tests/api/config-supported.test.tsIssue #450: Contract Reachability Probe
File:
src/app/api/ready/route.tsprobeContractReachability()functionTests:
tests/api/ready-contract-probe.test.tsTest Coverage
Closes
Closes #448
Closes #450