feat: enhance route validation for Linea, Zircuit, and zkSync adapters#526
Merged
0xHarbs merged 1 commit intofeat/add-native-bridgesfrom Feb 19, 2026
Merged
feat: enhance route validation for Linea, Zircuit, and zkSync adapters#5260xHarbs merged 1 commit intofeat/add-native-bridgesfrom
0xHarbs merged 1 commit intofeat/add-native-bridgesfrom
Conversation
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.
Findings (highest severity first)
High: zkSync callback flow could falsely reject valid withdrawals
l1BatchTxIndex was validated with a falsy check, so 0 (valid first tx in batch) was treated as missing and would block callback finalization.
High: native adapters accepted unsupported route pairs
linea, zircuit, and zksync adapters fell through into assumptions when route pairs didn’t match expected directions, risking malformed transactions on wrong chains.
Medium: zkSync unit tests were stale and no longer reflected implementation
Tests referenced removed helper methods and asserted old behavior (e.g., ETH withdraw target), so they did not protect current production paths.
Low: lint hygiene issues
Unused imports/vars and typing/lint issues in new adapter code.
Implemented fixes
Added explicit route validation guards in:
packages/adapters/rebalance/src/adapters/zksync/zksync.ts
packages/adapters/rebalance/src/adapters/linea/linea.ts
packages/adapters/rebalance/src/adapters/zircuit/zircuit.ts
Fixed zkSync nullish checks so valid zero values are accepted:
l1BatchNumber == null and l1BatchTxIndex == null checks instead of falsy checks.
Cleaned lint/type issues in Zircuit/Linea implementations.
Rebuilt zksync tests to match actual adapter behavior and callback proof flow.
Added route-validation tests for linea and zircuit adapters.