refactor: split up bridge quote validators#9413
Conversation
a3b1b6c to
86125be
Compare
6513b61 to
4092316
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2cdd2f6. Configure here.
| value: HexString, | ||
| data: HexString, | ||
| gasLimit: nullable(number()), | ||
| effectiveGas: optional(number()), |
There was a problem hiding this comment.
Loose hex validation accepts invalid trades
Medium Severity
Trade and intent fields now use a custom HexString pattern (0x plus any alphanumeric characters) instead of isStrictHexString and isValidHexAddress. Malformed to/from lengths and non-hex characters in value/data (and intent token addresses) can pass quote validation and reach downstream signing or submission.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 2cdd2f6. Configure here.
There was a problem hiding this comment.
This is intentional. Clients should use whatever the backend provides


Explanation
References
Checklist
Note
Medium Risk
Large refactor across bridge quote parsing and package exports, with stricter/slimmer step schemas and renamed validators—consumers on deep imports or rich step payloads could break until aligned with V2.
Overview
Replaces the monolithic
utils/validators.tswith asrc/validators/module layout (quote, trade, feature-flags, batch-sell, intent, etc.) ahead of QuoteResponse V2, and wires the controller, fetch layer, selectors, metrics, and tests to the new import paths.Public surface:
index.tsnow re-exports quote/trade types and validators from./validators/*instead of./typesand./utils/validators; trade type guards move fromtrade-utilstovalidators/trade(onlyextractTradeDatastays intrade-utils).validateSwapsTokenObjectis renamed tovalidateBridgeAsset.Validation behavior: SSE/HTTP quote failures log via new
formatStructErrors(path + message) while metrics still useaggregatorId|pathkeys. Step validation dropsprotocol, per-step amounts, and related fields; mocks are trimmed to match. Quote gains optional V2-oriented fields (walletAddress,slippage,protocols, metabridge BPS,FeeType.NETWORK/RELAYER). QuoteResponse V1 schema adds optionall1GasFeesInHexWei/nonEvmFeesInNativeon the struct; legacy fee types intypes.tsare marked deprecated.Cleanup: Removes
Protocol/ProtocolSchemafrom shared types; trims eslint suppressions; changelog notes the validator split.Reviewed by Cursor Bugbot for commit f262909. Bugbot is set up for automated code reviews on this repo. Configure here.