fix: properly handle security_warnings metrics in QuotesReceived#8394
Open
infiniteflower wants to merge 2 commits intomainfrom
Open
fix: properly handle security_warnings metrics in QuotesReceived#8394infiniteflower wants to merge 2 commits intomainfrom
infiniteflower wants to merge 2 commits intomainfrom
Conversation
4e76757 to
7714b04
Compare
SteP-n-s
approved these changes
Apr 8, 2026
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.
Explanation
Previously,
security_warningswas a client-only property — clients fetched token warnings on destination token selection and passed them in analytics events fired before quotes arrived (e.g.QuotesRequested,QuotesError,InputSourceDestinationSwitched). Now that token warnings are streamed as part of the quote response (stored instate.tokenWarnings), the controller needs to derivesecurity_warningsfrom state so it appears on post-quote events likeQuotesReceived.This PR:
security_warnings: string[]to theQuoteFetchDatametrics type so the controller can populate it fromstate.tokenWarnings.security_warningsin#getQuoteFetchData()by mappingtokenWarningsdescriptions.#mergeSecurityWarningshelper that combines the client-providedwarningsarray (from the Blockaid/message/scan/endpoint, currently Solana-only) with controller-derived token warnings, and applies it to theQuotesReceivedevent.tokenWarningsis populated.References
Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-4318
Consensys/segment-schematokenWarningsfrom theirsecurity_warningsarrayChecklist
Note
Low Risk
Low risk: changes are limited to analytics payload construction and associated type/test updates, with no impact on quote fetching or transaction execution logic.
Overview
Ensures
UnifiedSwapBridgeEventName.QuotesReceivedincludessecurity_warningsderived from controllerstate.tokenWarnings, so post-quote metrics carry token warning information.Adds
security_warnings: string[]to theQuoteFetchDatametrics shape, computes it in#getQuoteFetchData(), and forQuotesReceivedspecifically merges client-providedwarningswith controller-derived warnings (deduped). Updates snapshots and adds a focused test covering the merge behavior.Reviewed by Cursor Bugbot for commit 17ad5d0. Bugbot is set up for automated code reviews on this repo. Configure here.