Fix/1179 1180 1181 1182 router registry optimization - #1228
Merged
Maki-Zeninn merged 4 commits intoAug 30, 2026
Merged
Conversation
…heck Replace the expensive Vec::contains scan on ContractNames with an is_empty() check on the versions list that is already being fetched and processed. Only add the name to ContractNames if this is a new registration (empty versions list before adding the version).
Add test_bulk_register_unauthorized_caller_fails to verify that unauthorized callers are properly rejected when attempting to call bulk_register. This test also ensures that no registry modifications occur when authorization fails.
…tes parameter Update all RouterCore::initialize() calls in integration tests to include the max_routes: Option<u32> parameter. Pass None for all cases. Affected files: - cross_contract_tests.rs (1 call) - failure_scenarios.rs (6 calls) - quote_execution_multicall_pipeline.rs (1 call)
…ing burst_allowance parameter Update all RouterMiddleware::configure_route() calls in integration tests to include the burst_allowance: u32 parameter. Pass 0 for all cases. Affected files: - cross_contract_tests.rs (6 call sites) - quote_execution_multicall_pipeline.rs (2 call sites) - failure_scenarios.rs (4 call sites)
|
@OZILSOLAR 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.
Summary
This pull request addresses four interconnected GitHub issues related to router-registry performance optimization and integration test signature
updates. All changes maintain backward compatibility while improving performance and test coverage.
Changes Implemented
1. Issue #1179 - Registry Performance Optimization
Problem: The
register_entryfunction in router-registry was performing an O(n) linear scan on every contract registration by callingVec::contains()to check if a name already exists in theContractNamesstorage.Solution: Replace the expensive vector scan with an
is_empty()check on the versions list, which is already being fetched and processed. Thisoptimization:
Files Changed:
contracts/router-registry/src/lib.rs: Modifiedregister_entry()method (lines 740-760)2. Issue #1180 - Test Coverage for
bulk_registerProblem: The
bulk_registerfunction implemented admin authorization checks but lacked dedicated test coverage for unauthorized caller rejection.This created a security risk: accidental removal of the authorization gate could go undetected.
Solution: Add
test_bulk_register_unauthorized_caller_fails()test that:bulk_registerwith an unauthorized addressUnauthorizederrorFiles Changed:
contracts/router-registry/src/lib.rs: Added test at line 1389-14063. Issue #1181 - RouterCore::initialize() Signature Update
Problem: Integration test files contained stale
RouterCore::initialize()calls that were missing the newly-addedmax_routes: Option<u32>parameter, causing compilation failures.
Solution: Update all
RouterCoreClient::initialize()invocations to include themax_routesparameter set toNone, consistent with therouter-core test suite's implementation.
Files Changed:
integration-tests/tests/cross_contract_tests.rs: 1 call updated (line 51)integration-tests/tests/failure_scenarios.rs: 6 calls updated (lines 36, 47, 64, 81, 98, 113)integration-tests/tests/quote_execution_multicall_pipeline.rs: 1 call updated (line 98)Total Call Sites: 8 locations across 3 test files
4. Issue #1182 - RouterMiddleware::configure_route() Signature Update
Problem: Integration test files contained stale
RouterMiddleware::configure_route()calls missing the newly-addedburst_allowance: u32parameter, causing compilation failures.
Solution: Update all
RouterMiddlewareClient::configure_route()invocations to include theburst_allowanceparameter set to0.Files Changed:
integration-tests/tests/cross_contract_tests.rs: 6 calls updated (lines 163, 178, 194, 222, 248, 276)integration-tests/tests/quote_execution_multicall_pipeline.rs: 2 calls updated (lines 137, 508)integration-tests/tests/failure_scenarios.rs: 4 calls updated (lines 258, 276, 308, 328)Total Call Sites: 12 locations across 3 test files
Impact Analysis
Performance
Test Coverage
Compilation
Backward Compatibility
Testing
All changes have been tested:
Commits
This PR contains 4 sequential commits:
2eccfe9- fix(1179): optimize register_entry O(n) linear scan with is_empty() check70a98f7- test(1180): add unauthorized-caller test coverage for bulk_register4d98910- fix(1181): update RouterCore::initialize() calls with missing max_routes parameter7f2091e- fix(1182): update RouterMiddleware::configure_route() calls with missing burst_allowance parameterCloses #1179
Closes #1180
Closes #1181
Closes #1182