-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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: Delete legacy signature confirmation code #30038
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. |
54fb939
to
cee2f77
Compare
Builds ready [cee2f77]
Page Load Metrics (1823 ± 106 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
cee2f77
to
bcdaf5f
Compare
Removed dependencies detected. Learn more about Socket for GitHub ↗︎ 🚮 Removed packages: npm/[email protected] |
bcdaf5f
to
9db188b
Compare
@metamaskbot update-policies |
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
@MetaMask/policy-reviewers, the policy change results from removing the package |
ui/hooks/useTransactionInsights.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come the Snaps E2E's didn't need to be adapted for this? IIRC we are testing both the legacy and new confirmations for both signatures and transactions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I don't understand what https://github.com/MetaMask/metamask-extension/blob/main/test/e2e/snaps/test-snap-siginsights.spec.js#L258 is testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it stayed by mistake, I'll remove this too!
Policy changes lgtm |
Builds ready [a3621e6]
Page Load Metrics (1745 ± 59 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
@pedronfigueiredo |
@@ -414,7 +414,6 @@ | |||
"react-dom": "^16.12.0", | |||
"react-focus-lock": "^2.9.4", | |||
"react-idle-timer": "^4.2.5", | |||
"react-inspector": "^6.0.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
PATH_NAME_MAP[ | ||
`${CONFIRM_TRANSACTION_ROUTE}/:id${CONFIRM_INCREASE_ALLOWANCE_PATH}` | ||
] = 'Confirm Increase Allowance Transaction Page'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @pedronfigueiredo : are these paths still needed, may be we can simplify routing to route all confirmations to Confirm.tsx
. I think we no longer need sub-paths like above.
But this can be done in separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we have planned work for refactoring the routing separately 👍
export function getSnaps(state) { | ||
return state.metamask.snaps; | ||
} | ||
|
||
export function testFunctionToSeeIfItsCaught(state) { | ||
return state.metamask.snaps; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed, it looks same as getSnaps
above ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was committed by mistake, great catch Jyoti. I'll remove this now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, I left some small feedbacks.
a3621e6
to
f6b2604
Compare
64e0c3f
to
c958b4d
Compare
Builds ready [c958b4d]
Page Load Metrics (1607 ± 56 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
The PR does not appear to negatively impact any of the signatures and transactions confirmations, all basic flows |
## **Description** Building up on [#29926](#29926), the goal of this PR is to remove as much dead code as possible related to the signatures and transactions confirmations that predate the redesign. - Remove signature entry points from `confirm-transaction` and `confirm-transaction-switch`. - Remove signature-related components - `signature-request-header` - `signature-request-original` - `signature-request-siwe` - `signature-request` - `signature-request-message` - `confirm-signature-request` - Remove other unused code from confirmations - `confirm-hexdata` - `confirm-detail-row` - `confirm-page-container` - `confirm-page-container-summary` - `confirm-page-container-navigation` - `confirm-subtitle` - `confirm-title` - `transaction-decoding` - `custom-spending-cap` - `review-spending-cap` - `security-provider-banner-alert` - `transaction-alerts` - `ledger-instruction-field` - After removing these components, a pass was done on the deleted code to identify deleted uses of `selectors`, `actions`, `util`, and `hooks`. Some of these become dead code so they were deleted in this PR as well. - I went back and did the same in the diff for the PR to remove dead transactions code. - Removed unit tests, storybook stories, styles and localization files associated with the removed files. ## Attempt at automated way to flag dead code for removal I tried using the [import/no-unused-modules](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unused-modules.md) ESLint rule to catch unused exports. Here's the config I tried: ```js { files: [ 'ui/**/*.{js,ts,tsx}', 'shared/**/*.{js,ts,tsx}', ], rules: { 'import/no-unused-modules': [ 2, { unusedExports: true, missingExports: false, ignoreExports: [ // Any usage in test or Storybook files is ignored, // so if a function is only imported by these files, // it will still be flagged as unused. '**/*.test.*', '**/*.spec.*', '**/*.stories.*', ], }, ], }, } ``` However, given the way selectors are exported on `ui/selectors/index.js`, the rule can't correctly pattern match the unused selectors. I commented the index manually and ran the rule to find "dead code" selectors but this time all selectors were flagged as unused. Finally, I wondered if this rule could still give useful outputs for other folders of the project besides the selectors folder. When running the lint rule against the whole ui directory, the script ran for more than 2 hours before I stopped it. Unfortunately, using an ESLint rule to detect dead code is not time efficient, so for this PR I resorted to using the manual methods described above. [](https://codespaces.new/MetaMask/metamask-extension/pull/30038?quickstart=1) ## **Related issues** Fixes: MetaMask/MetaMask-planning#4062 ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] 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](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). 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.
b0d4839
c958b4d
to
b0d4839
Compare
Builds ready [b0d4839]
Page Load Metrics (1688 ± 74 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Description
Building up on #29926, the goal of this PR is to remove as much dead code as possible related to the signatures and transactions confirmations that predate the redesign.
confirm-transaction
andconfirm-transaction-switch
.signature-request-header
signature-request-original
signature-request-siwe
signature-request
signature-request-message
confirm-signature-request
confirm-hexdata
confirm-detail-row
confirm-page-container
confirm-page-container-summary
confirm-page-container-navigation
confirm-subtitle
confirm-title
transaction-decoding
custom-spending-cap
review-spending-cap
security-provider-banner-alert
transaction-alerts
ledger-instruction-field
selectors
,actions
,util
, andhooks
. Some of these become dead code so they were deleted in this PR as well.Attempt at automated way to flag dead code for removal
I tried using the import/no-unused-modules ESLint rule to catch unused exports. Here's the config I tried:
However, given the way selectors are exported on
ui/selectors/index.js
, the rule can't correctly pattern match the unused selectors. I commented the index manually and ran the rule to find "dead code" selectors but this time all selectors were flagged as unused.Finally, I wondered if this rule could still give useful outputs for other folders of the project besides the selectors folder. When running the lint rule against the whole ui directory, the script ran for more than 2 hours before I stopped it.
Unfortunately, using an ESLint rule to detect dead code is not time efficient, so for this PR I resorted to using the manual methods described above.
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/4062
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist