chore: Cherry-pick resimulate into V12.5.1#28178
Conversation
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR aims to add re-simulation logic which recently added at MetaMask/core#4792 Patch note: Transaction controller patch adds the re-simulate feature, branched belove to keep track. https://github.com/MetaMask/core/tree/patch/extension-transaction-controller-37-2-0 [](https://codespaces.new/MetaMask/metamask-extension/pull/28104?quickstart=1) Fixes: MetaMask/MetaMask-planning#3380 TBD <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> <!-- [screenshots/recordings] -->   - [X] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I’ve included tests if applicable - [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [ ] 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. --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
|
@metamaskbot update-policies |
|
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎ This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
|
Policy update failed. You can review the logs or retry the policy update here |
|
@metamaskbot update-policies |
|
Policy update failed. You can review the logs or retry the policy update here |
|
@metamaskbot update-policies |
|
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@metamask/base-controller@7.0.1, npm/@metamask/controller-utils@11.3.0 |
|
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
Upgrade the `TransactionController` to: - Support Etherscan API keys when polling for incoming transactions. - Populate `submitHistory` to aid with debug and persist even when resetting the account. Also adds the `ETHERSCAN_API_KEY` environment variable. [](https://codespaces.new/MetaMask/metamask-extension/pull/27611?quickstart=1) 1. Verify incoming transactions work on Mainnet and Sepolia with an API key set. 2. Verify `submitHistory` is populated in state logs after creating transactions and retrying, on both Infura and custom networks. - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [ ] 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.
Builds ready [d213294]
Page Load Metrics (1808 ± 89 ms)
|
| @@ -1849,6 +1849,10 @@ export default class MetamaskController extends EventEmitter { | |||
| getCurrentChainId({ metamask: this.networkController.state }) | |||
| ], | |||
| incomingTransactions: { | |||
There was a problem hiding this comment.
Why is this change needed here, but it is not on the commit being cherry-picked?
There was a problem hiding this comment.
They were added in this PR: #27611
It was an earlier bump of the transaction controller. This cherry-pick includes both PRs
| @@ -272,8 +272,10 @@ env: | |||
| - SECURITY_ALERTS_API_ENABLED: '' | |||
| # URL of security alerts API used to validate dApp requests | |||
| - SECURITY_ALERTS_API_URL: 'http://localhost:3000' | |||
There was a problem hiding this comment.
Why is this change not in the commit being cherry-picked?
There was a problem hiding this comment.
Same answer as here: https://github.com/MetaMask/metamask-extension/pull/28178/files#r1823521433
| signedCanceledTransactions: [], | ||
| txParams: this.#txParams, | ||
| transactionMeta: this.#transactionMeta, | ||
| // TODO: Replace `any` with type - version mismatch between smart-transactions-controller and transaction-controller breaking type safety |
There was a problem hiding this comment.
Any idea what the type incompatibilities are here? The SmartTransactionsController is using types from v34.0.0 of the TransactionController, and I didn't see any breaking changes in the changelog that might explain this.
There was a problem hiding this comment.
Ah, looks like it was this: MetaMask/core#4714
The additional two types aren't expected by the SmartTransactionsController. It looks like the SmartTransactionsController doesn't have any matchers for this property, so it should not cause any problems there.
| // TODO: Replace `any` with type - version mismatch between smart-transactions-controller and transaction-controller breaking type safety | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any |
There was a problem hiding this comment.
Nit: @ts-expect-error is preferred because it will flag when the override is no longer needed
| // TODO: Replace `any` with type - version mismatch between smart-transactions-controller and transaction-controller breaking type safety | |
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | |
| // @ts-expect-error version mismatch between smart-transactions-controller and transaction- | |
| // controller breaking type safety |
| }, | ||
| { | ||
| return: `0x00000000000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}`, | ||
| return: `0x000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}`, |
There was a problem hiding this comment.
Looks like this is from yet another separate transaction controller bump: #27954
| // for more info) | ||
| state.version = global.platform.getVersion(); | ||
| state.browser = window.navigator.userAgent; | ||
| state.completeTxList = await actions.getTransactions({ |
There was a problem hiding this comment.
Reasons not entirely clear to me, but this appears to be from #27611
This PR cherry-picks 2c86162#diff-63ab7391d870a62d8bcd3cc5d5371432068538deb98e5effcb899434ed8649bb