Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implementing alerts for typed sign data signatures #24702

Merged
merged 4 commits into from
May 30, 2024

Conversation

jpuri
Copy link
Contributor

@jpuri jpuri commented May 22, 2024

Description

Extend alert system to typed signatures.

Related issues

Fixes: #24611

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@jpuri jpuri requested review from a team as code owners May 22, 2024 08:05
Copy link
Contributor

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.

Copy link

codecov bot commented May 22, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 65.73%. Comparing base (d27a233) to head (e57494d).
Report is 191 commits behind head on develop.

Files Patch % Lines
...nents/app/alert-system/alert-modal/alert-modal.tsx 33.33% 4 Missing ⚠️
...system/confirm-alert-modal/confirm-alert-modal.tsx 71.43% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #24702      +/-   ##
===========================================
- Coverage    67.37%   65.73%   -1.64%     
===========================================
  Files         1278     1363      +85     
  Lines        49881    54269    +4388     
  Branches     12944    14107    +1163     
===========================================
+ Hits         33605    35673    +2068     
- Misses       16276    18596    +2320     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [aa6f1db]
Page Load Metrics (545 ± 400 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6713089199
domContentLoaded7271363
load442116545833400
domInteractive7271363
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 13.92 KiB (0.21%)
  • common: 348 Bytes (0.01%)

@vinistevam vinistevam force-pushed the feat/implement-personal-sign-alerts branch 3 times, most recently from 86ac594 to 5891026 Compare May 23, 2024 07:24
@metamaskbot
Copy link
Collaborator

Builds ready [2bfa479]
Page Load Metrics (1463 ± 604 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint771521052211
domContentLoaded106719168
load63289914631258604
domInteractive106719168
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 11.34 KiB (0.17%)
  • common: 354 Bytes (0.01%)

ui/components/app/alerts-system/utils.ts Outdated Show resolved Hide resolved
ui/hooks/useAlerts.ts Show resolved Hide resolved
ui/pages/confirmations/hooks/setConfirmationAlerts.ts Outdated Show resolved Hide resolved
ui/pages/confirmations/utils/confirm.ts Show resolved Hide resolved
@jpuri jpuri force-pushed the type_sign_data_alerts branch 15 times, most recently from 53049d5 to a473161 Compare May 27, 2024 13:43
@metamaskbot
Copy link
Collaborator

Builds ready [7dac653]
Page Load Metrics (970 ± 565 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint604311197637
domContentLoaded8188313919
load4627849701178565
domInteractive8188313919
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 15.15 KiB (0.23%)
  • common: 608 Bytes (0.01%)


const unconfirmedDangerAlerts = fieldAlerts.filter(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

onClick={hasDangerFieldAlerts ? handleOpenConfirmModal : onSubmit}
danger={hasDangerAlerts ? true : isDangerButton}
onClick={hasDangerAlerts ? handleOpenConfirmModal : onSubmit}
danger={hasDangerAlerts}
size={ButtonSize.Lg}
disabled={hasUnconfirmedDangerAlerts ? false : disabled}
>
{hasUnconfirmedDangerAlerts ? t('reviewAlerts') : t('confirm')}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After our discussion regarding the designs for the MVP , I wanted to confirm a few details.
Once we receive a general alert from Blockaid, the button will be labeled Review Alerts. Clicking this button will open a friction modal where the user can acknowledge the alert and proceed to confirm the action.

Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is how it will work.

<ConfirmAlertModal {...defaultProps} />,
mockStore,
);
// todo: following 2 tests have been temporarily commented out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to comment out these two unit tests? I understand that the MVP does not support multiple providers, but can we keep the use case in the unit tests unless they are broken due to the MVP changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that is issue these test are breaking.

Base automatically changed from feat/implement-personal-sign-alerts to develop May 28, 2024 11:08
@vinistevam vinistevam dismissed pedronfigueiredo’s stale review May 28, 2024 11:08

The base branch was changed.

@jpuri jpuri changed the title Implementing alerts for typed sign data signatures feat: implementing alerts for typed sign data signatures May 29, 2024
@jpuri jpuri added needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) confirmation-redesign team-confirmations Push issues to confirmations team labels May 29, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [bc973c5]
Page Load Metrics (431 ± 404 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6514397209
domContentLoaded95217115
load602614431841404
domInteractive95217115
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: -4.8 KiB (-0.07%)
  • common: 412 Bytes (0.01%)

@bschorchit
Copy link

bschorchit commented May 29, 2024

Testing the latest build on this PR, I see malicious warning showing up as blue, missing the see details section and with a blue Confirm button first before both the banner and button change to red.
Screenshot 2024-05-29 at 08 49 56

@bschorchit
Copy link

Also, the see details section within the warning might be rendering with the wrong font/size cc: @SayaGT

Screenshot from this build:
Screenshot 2024-05-29 at 08 54 44

Screenshot from current prod:
Screenshot 2024-05-29 at 08 56 14

@jpuri
Copy link
Contributor Author

jpuri commented May 29, 2024

Hey @bschorchit : I tested it using malicious permits in test dapp and it seems to work well:

Screenshot 2024-05-29 at 6 39 13 PM

@SayaGT
Copy link

SayaGT commented May 29, 2024

@bschorchit @jpuri yes the font size for the alert details seems wrong. It should be Body-MD (baseline). Also the CTA shouldn't be "Review alerts", it should be Confirm.

@bschorchit
Copy link

Hey @bschorchit : I tested it using malicious permits in test dapp and it seems to work well:

I do see it as red as well, but sometimes only after ~1s. It doesn't happen every time, but I can consistently reproduce by trying a few times and alternating between Malicious Permit, Malicious Trade Order, Malicious Seaport

Here's a recording:

alert.mov

@bschorchit
Copy link

Summing up to facilitate reading (sorry for the multiple comments):

  1. Font size for alert details should be Body-MD (baseline) - source
  2. CTA should be Confirm rather than Review alerts as this is the single alert scenario - source
  3. Potential issue with rendering blue banner first - source
  4. Small copy updates to the friction modal - (sorry this is new, and totally on me for not getting content frozen sooner. I'll get the final copy soon) - we can tackle this on a follow up PR to prevent blocking this one from being blocked.

Copy link
Contributor

@vinistevam vinistevam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing PR! 🥇 🚀

@jpuri jpuri merged commit e4bf8b3 into develop May 30, 2024
71 of 72 checks passed
@jpuri jpuri deleted the type_sign_data_alerts branch May 30, 2024 11:13
@github-actions github-actions bot locked and limited conversation to collaborators May 30, 2024
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label May 30, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [e57494d]
Page Load Metrics (829 ± 557 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint691691043014
domContentLoaded97120168
load6531218291159557
domInteractive97120168
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: -4.77 KiB (-0.07%)
  • common: 410 Bytes (0.01%)

@gauthierpetetin gauthierpetetin added the release-12.0.0 Issue or pull request that will be included in release 12.0.0 label Jun 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
confirmation-redesign release-12.0.0 Issue or pull request that will be included in release 12.0.0 team-confirmations Push issues to confirmations team
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Implement alerts system for typed signatures
8 participants