Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
1a6bbd9 to
9dca36a
Compare
Builds ready [9dca36a]
Page Load Metrics (1632 ± 61 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Codecov Report
@@ Coverage Diff @@
## develop #18008 +/- ##
========================================
Coverage 64.55% 64.55%
========================================
Files 919 919
Lines 35444 35405 -39
Branches 9119 9099 -20
========================================
- Hits 22880 22855 -25
+ Misses 12564 12550 -14
... and 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
9dca36a to
a2f9690
Compare
Builds ready [a2f9690]
Page Load Metrics (1592 ± 41 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
- also removes === null check which makes this logic a bit more robust
Builds ready [91af4a8]
Page Load Metrics (1803 ± 55 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
.push returns length of mutated array
| : properties.ui_customizations.push( | ||
| METAMETRIC_KEY_OPTIONS[METAMETRIC_KEY.UI_CUSTOMIZATIONS] | ||
| .SIWE, | ||
| ); |
There was a problem hiding this comment.
turns out Array.push returns the length of the mutated array. this is a JS gotchya. fixed by using Array.concat
Builds ready [726a9f7]
Page Load Metrics (1423 ± 20 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
| let msgParams; | ||
|
|
||
| if (eventType.REQUESTED === EVENT_NAMES.SIGNATURE_REQUESTED) { | ||
| properties.signature_type = method; | ||
|
|
||
| const data = req?.params?.[0]; | ||
| const from = req?.params?.[1]; | ||
| const paramsExamplePassword = req?.params?.[2]; | ||
|
|
||
| msgParams = { | ||
| ...paramsExamplePassword, | ||
| from, | ||
| data, | ||
| origin, | ||
| }; | ||
|
|
||
| const msgData = { | ||
| msgParams, | ||
| status: 'unapproved', | ||
| type: req.method, | ||
| }; | ||
|
|
||
| try { | ||
| const securityProviderResponse = await securityProviderRequest( | ||
| msgData, | ||
| req.method, | ||
| ); | ||
|
|
||
| if (securityProviderResponse?.flagAsDangerous === 1) { | ||
| properties.ui_customizations = ['flagged_as_malicious']; | ||
| } else if (securityProviderResponse?.flagAsDangerous === 2) { | ||
| properties.ui_customizations = ['flagged_as_safety_unknown']; | ||
| } else { | ||
| properties.ui_customizations = null; | ||
| } | ||
|
|
||
| if (method === MESSAGE_TYPE.PERSONAL_SIGN) { | ||
| const { isSIWEMessage } = detectSIWE({ data }); | ||
| if (isSIWEMessage) { | ||
| properties.ui_customizations === null | ||
| ? (properties.ui_customizations = [ | ||
| METAMETRIC_KEY_OPTIONS[METAMETRIC_KEY.UI_CUSTOMIZATIONS] | ||
| .SIWE, | ||
| ]) | ||
| : properties.ui_customizations.push( | ||
| METAMETRIC_KEY_OPTIONS[METAMETRIC_KEY.UI_CUSTOMIZATIONS] | ||
| .SIWE, | ||
| ); | ||
| } | ||
| } | ||
| } catch (e) { | ||
| console.warn( | ||
| `createRPCMethodTrackingMiddleware: Error calling securityProviderRequest - ${e}`, | ||
| ); | ||
| } | ||
| } else { | ||
| properties.method = method; |
There was a problem hiding this comment.
Not fully understanding why this was all removed, could you elaborate?
There was a problem hiding this comment.
Did this turn out to be a wasteful duplication?
There was a problem hiding this comment.
yep! exactly. It's the same code verbatim from line 167. They live in the same scope of function rpcMethodTrackingMiddleware. no need to redefined :)
Explanation
Fixes: #18474
See: #18007
Progresses #17974
Fix SIWE event and clean createRPCMethodTrackingMiddleware logic
Fix SIWE event that was introduced in #17688:
(while adding a test, I found a bug with the metametric event)
Clean:
ui_customizations)ui_customizationsevent props to metametrics consterrorCodesandTransactionStatusconstScreenshots/Screencaps
Before
After
Manual Testing Steps
Pre-merge author checklist
Pre-merge reviewer checklist
If further QA is required (e.g. new feature, complex testing steps, large refactor), add the
Extension QA Boardlabel.In this case, a QA Engineer approval will be be required.