Fix/1184 1185 1186 - #1229
Merged
Maki-Zeninn merged 3 commits intoAug 30, 2026
Merged
Conversation
…:deprecate() calls - Update cross_contract_tests.rs line 97 to include reason parameter - Update failure_scenarios.rs lines 161 and 163 to include reason parameter - Fixes stale signature calls to deprecate() which now requires 4 arguments
…nbounded storage growth - Add new QuoteError::TooManyTiers (discriminant 11) for tier limit violations - Add MAX_FEE_TIERS_PER_ROUTE constant set to 100 tiers per route - Validate tiers.len() early in set_route_fee_tiers() function - Prevents O(n²) insertion-sort complexity and storage growth issues - Mirrors existing guard pattern used in track_configured_route for routes
…pe with initialization check - Change function signature from Vec<FeeTier> to Result<Vec<FeeTier>, QuoteError> - Add initialization check: verify Admin data key exists before returning - Return QuoteError::NotInitialized when contract hasn't been initialized - Update resolve_route_fee_bps to use ? operator for error propagation - Update get_all_configured_routes to handle Result type - Update test_get_route_fee_tiers_returns_empty_when_not_set test - Update test_get_route_fee_tiers_returns_sorted_tiers test - Provides consistency with other public getters like get_default_fee
|
@Barbieple-Devstem 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.
Multi-Issue Fix: Integration Tests, Fee Tier Limits, and Route Fee Tiers API
Closes #1184
Closes #1185
Closes #1186
Summary
This PR addresses three related bugs and improvements across the stellar-router suite:
Changes
Issue #1184: Fix RouterRegistry::deprecate() Integration Test Calls
Problem: Integration test call sites were invoking
RouterRegistry::deprecate()with 3 arguments, but the current function signature requires 4parameters including a
reason: Option<String>field.Impact: Prevented compilation of
test_core_route_updated_after_registry_version_bumpandtest_registry_double_deprecate_failstests.Solution:
integration-tests/tests/cross_contract_tests.rs(line 97)integration-tests/tests/failure_scenarios.rs(lines 161 and 163)reasonargument:&None::<String>router-registry's own test suiteFiles Modified:
integration-tests/tests/cross_contract_tests.rsintegration-tests/tests/failure_scenarios.rsIssue #1185: Add MAX_FEE_TIERS_PER_ROUTE Validation
Problem: The
set_route_fee_tiersfunction in router-quote accepted arbitrarily large tier vectors without validation. While route tracking iscapped at
MAX_TRACKED_ROUTES(500) to prevent unbounded storage growth, individual route tier lists had no equivalent limit.Security/Performance Impact:
resolve_route_fee_bpsdegraded quote performanceSolution:
QuoteError::TooManyTiers(discriminant 11)MAX_FEE_TIERS_PER_ROUTEconstant (set to 100 tiers per route)set_route_fee_tiers()to check tier countQuoteError::TooManyTiersif limit exceededtrack_configured_routefor consistencyFiles Modified:
contracts/router-quote/src/lib.rsIssue #1186: Standardize get_route_fee_tiers API with Result Type
Problem: The
get_route_fee_tiersfunction lacked consistency with other public getter methods. While functions likeget_route_fee,get_default_fee,admin, andget_quoteall returnResult<T, QuoteError>and properly signal initialization status,get_route_fee_tiersreturneda bare
Vec<FeeTier>.Impact:
NotInitializederrorSolution:
Vec<FeeTier>→Result<Vec<FeeTier>, QuoteError>get_default_fee)QuoteError::NotInitializedwhen contract uninitializedresolve_route_fee_bps()- Uses?operator for error propagationget_all_configured_routes()- Handles Result type with fallback to empty vectortest_get_route_fee_tiers_returns_empty_when_not_set- Now asserts Ok with empty vectortest_get_route_fee_tiers_returns_sorted_tiers- Unwraps Result and verifies contentFiles Modified:
contracts/router-quote/src/lib.rsTechnical Details
Code Quality
Security Considerations
Breaking Changes
get_route_fee_tiers()return type changed to Result (breaking API change for public interface)QuoteError::TooManyTiersadded with discriminant 11Testing
All changes have been validated against existing test suite:
Related Issues
Closes #1184
Closes #1185
Closes #1186