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

fix: re-simulate transactions if security checks fail #4792

Merged
merged 29 commits into from
Oct 29, 2024

Conversation

OGPoyraz
Copy link
Member

Explanation

This PR adds a mechanism to re-trigger of simulations if the security provider mark transaction as malicious and the previous simulation native balance change is different then the previous simulation.

References

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3380

Changelog

@metamask/transaction-controller

  • ADDED: Add mechanism to re-trigger of simulations if the security provider mark transaction as malicious and the previous simulation native balance change is different then the previous simulation.
  • ADDED: Add changeInSimulationData property to simulationData in order to detect change of simulation data.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@OGPoyraz OGPoyraz requested a review from a team as a code owner October 14, 2024 12:35
@OGPoyraz
Copy link
Member Author

@metamaskbot publish-preview

Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "18.2.2-preview-3fec6ed",
  "@metamask-previews/address-book-controller": "6.0.1-preview-3fec6ed",
  "@metamask-previews/announcement-controller": "7.0.1-preview-3fec6ed",
  "@metamask-previews/approval-controller": "7.1.0-preview-3fec6ed",
  "@metamask-previews/assets-controllers": "38.3.0-preview-3fec6ed",
  "@metamask-previews/base-controller": "7.0.1-preview-3fec6ed",
  "@metamask-previews/build-utils": "3.0.1-preview-3fec6ed",
  "@metamask-previews/chain-controller": "0.1.3-preview-3fec6ed",
  "@metamask-previews/composable-controller": "9.0.1-preview-3fec6ed",
  "@metamask-previews/controller-utils": "11.3.0-preview-3fec6ed",
  "@metamask-previews/ens-controller": "14.0.1-preview-3fec6ed",
  "@metamask-previews/eth-json-rpc-provider": "4.1.4-preview-3fec6ed",
  "@metamask-previews/gas-fee-controller": "20.0.1-preview-3fec6ed",
  "@metamask-previews/json-rpc-engine": "9.0.3-preview-3fec6ed",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.3-preview-3fec6ed",
  "@metamask-previews/keyring-controller": "17.2.2-preview-3fec6ed",
  "@metamask-previews/logging-controller": "6.0.1-preview-3fec6ed",
  "@metamask-previews/message-manager": "10.1.1-preview-3fec6ed",
  "@metamask-previews/name-controller": "8.0.1-preview-3fec6ed",
  "@metamask-previews/network-controller": "21.0.1-preview-3fec6ed",
  "@metamask-previews/notification-controller": "7.0.0-preview-3fec6ed",
  "@metamask-previews/notification-services-controller": "0.9.0-preview-3fec6ed",
  "@metamask-previews/permission-controller": "11.0.2-preview-3fec6ed",
  "@metamask-previews/permission-log-controller": "3.0.1-preview-3fec6ed",
  "@metamask-previews/phishing-controller": "12.0.3-preview-3fec6ed",
  "@metamask-previews/polling-controller": "10.0.1-preview-3fec6ed",
  "@metamask-previews/preferences-controller": "13.0.3-preview-3fec6ed",
  "@metamask-previews/profile-sync-controller": "0.9.7-preview-3fec6ed",
  "@metamask-previews/queued-request-controller": "5.1.0-preview-3fec6ed",
  "@metamask-previews/rate-limit-controller": "6.0.1-preview-3fec6ed",
  "@metamask-previews/selected-network-controller": "18.0.1-preview-3fec6ed",
  "@metamask-previews/signature-controller": "19.1.0-preview-3fec6ed",
  "@metamask-previews/transaction-controller": "37.2.0-preview-3fec6ed",
  "@metamask-previews/user-operation-controller": "15.0.1-preview-3fec6ed"
}

@OGPoyraz OGPoyraz requested review from a team as code owners October 15, 2024 11:24
@OGPoyraz OGPoyraz requested a review from a team as a code owner October 15, 2024 11:34
@OGPoyraz
Copy link
Member Author

@metamaskbot publish-preview

@matthewwalsh0
Copy link
Member

@metamaskbot publish-preview

Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "18.2.2-preview-c3543e68",
  "@metamask-previews/address-book-controller": "6.0.1-preview-c3543e68",
  "@metamask-previews/announcement-controller": "7.0.1-preview-c3543e68",
  "@metamask-previews/approval-controller": "7.1.0-preview-c3543e68",
  "@metamask-previews/assets-controllers": "39.0.0-preview-c3543e68",
  "@metamask-previews/base-controller": "7.0.1-preview-c3543e68",
  "@metamask-previews/build-utils": "3.0.1-preview-c3543e68",
  "@metamask-previews/chain-controller": "0.1.3-preview-c3543e68",
  "@metamask-previews/composable-controller": "9.0.1-preview-c3543e68",
  "@metamask-previews/controller-utils": "11.4.0-preview-c3543e68",
  "@metamask-previews/ens-controller": "14.0.1-preview-c3543e68",
  "@metamask-previews/eth-json-rpc-provider": "4.1.5-preview-c3543e68",
  "@metamask-previews/gas-fee-controller": "21.0.0-preview-c3543e68",
  "@metamask-previews/json-rpc-engine": "10.0.0-preview-c3543e68",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.4-preview-c3543e68",
  "@metamask-previews/keyring-controller": "17.3.0-preview-c3543e68",
  "@metamask-previews/logging-controller": "6.0.1-preview-c3543e68",
  "@metamask-previews/message-manager": "11.0.0-preview-c3543e68",
  "@metamask-previews/multichain": "0.0.0-preview-c3543e68",
  "@metamask-previews/name-controller": "8.0.1-preview-c3543e68",
  "@metamask-previews/network-controller": "22.0.0-preview-c3543e68",
  "@metamask-previews/notification-controller": "7.0.0-preview-c3543e68",
  "@metamask-previews/notification-services-controller": "0.12.0-preview-c3543e68",
  "@metamask-previews/permission-controller": "11.0.2-preview-c3543e68",
  "@metamask-previews/permission-log-controller": "3.0.1-preview-c3543e68",
  "@metamask-previews/phishing-controller": "12.0.3-preview-c3543e68",
  "@metamask-previews/polling-controller": "11.0.0-preview-c3543e68",
  "@metamask-previews/preferences-controller": "13.1.0-preview-c3543e68",
  "@metamask-previews/profile-sync-controller": "0.9.7-preview-c3543e68",
  "@metamask-previews/queued-request-controller": "5.1.0-preview-c3543e68",
  "@metamask-previews/rate-limit-controller": "6.0.1-preview-c3543e68",
  "@metamask-previews/selected-network-controller": "18.0.2-preview-c3543e68",
  "@metamask-previews/signature-controller": "20.1.0-preview-c3543e68",
  "@metamask-previews/transaction-controller": "37.3.0-preview-c3543e68",
  "@metamask-previews/user-operation-controller": "16.0.0-preview-c3543e68"
}

@matthewwalsh0
Copy link
Member

@metamaskbot publish-preview

Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "18.2.2-preview-f6c3e03d",
  "@metamask-previews/address-book-controller": "6.0.1-preview-f6c3e03d",
  "@metamask-previews/announcement-controller": "7.0.1-preview-f6c3e03d",
  "@metamask-previews/approval-controller": "7.1.0-preview-f6c3e03d",
  "@metamask-previews/assets-controllers": "39.0.0-preview-f6c3e03d",
  "@metamask-previews/base-controller": "7.0.1-preview-f6c3e03d",
  "@metamask-previews/build-utils": "3.0.1-preview-f6c3e03d",
  "@metamask-previews/chain-controller": "0.1.3-preview-f6c3e03d",
  "@metamask-previews/composable-controller": "9.0.1-preview-f6c3e03d",
  "@metamask-previews/controller-utils": "11.4.0-preview-f6c3e03d",
  "@metamask-previews/ens-controller": "14.0.1-preview-f6c3e03d",
  "@metamask-previews/eth-json-rpc-provider": "4.1.5-preview-f6c3e03d",
  "@metamask-previews/gas-fee-controller": "21.0.0-preview-f6c3e03d",
  "@metamask-previews/json-rpc-engine": "10.0.0-preview-f6c3e03d",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.4-preview-f6c3e03d",
  "@metamask-previews/keyring-controller": "17.3.0-preview-f6c3e03d",
  "@metamask-previews/logging-controller": "6.0.1-preview-f6c3e03d",
  "@metamask-previews/message-manager": "11.0.0-preview-f6c3e03d",
  "@metamask-previews/multichain": "0.0.0-preview-f6c3e03d",
  "@metamask-previews/name-controller": "8.0.1-preview-f6c3e03d",
  "@metamask-previews/network-controller": "22.0.0-preview-f6c3e03d",
  "@metamask-previews/notification-controller": "7.0.0-preview-f6c3e03d",
  "@metamask-previews/notification-services-controller": "0.12.0-preview-f6c3e03d",
  "@metamask-previews/permission-controller": "11.0.2-preview-f6c3e03d",
  "@metamask-previews/permission-log-controller": "3.0.1-preview-f6c3e03d",
  "@metamask-previews/phishing-controller": "12.0.3-preview-f6c3e03d",
  "@metamask-previews/polling-controller": "11.0.0-preview-f6c3e03d",
  "@metamask-previews/preferences-controller": "13.1.0-preview-f6c3e03d",
  "@metamask-previews/profile-sync-controller": "0.9.7-preview-f6c3e03d",
  "@metamask-previews/queued-request-controller": "5.1.0-preview-f6c3e03d",
  "@metamask-previews/rate-limit-controller": "6.0.1-preview-f6c3e03d",
  "@metamask-previews/selected-network-controller": "18.0.2-preview-f6c3e03d",
  "@metamask-previews/signature-controller": "20.1.0-preview-f6c3e03d",
  "@metamask-previews/transaction-controller": "37.3.0-preview-f6c3e03d",
  "@metamask-previews/user-operation-controller": "16.0.0-preview-f6c3e03d"
}

@OGPoyraz
Copy link
Member Author

@metamaskbot publish-preview

Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "18.2.2-preview-3806a69c",
  "@metamask-previews/address-book-controller": "6.0.1-preview-3806a69c",
  "@metamask-previews/announcement-controller": "7.0.1-preview-3806a69c",
  "@metamask-previews/approval-controller": "7.1.0-preview-3806a69c",
  "@metamask-previews/assets-controllers": "39.0.0-preview-3806a69c",
  "@metamask-previews/base-controller": "7.0.1-preview-3806a69c",
  "@metamask-previews/build-utils": "3.0.1-preview-3806a69c",
  "@metamask-previews/chain-controller": "0.1.3-preview-3806a69c",
  "@metamask-previews/composable-controller": "9.0.1-preview-3806a69c",
  "@metamask-previews/controller-utils": "11.4.0-preview-3806a69c",
  "@metamask-previews/ens-controller": "14.0.1-preview-3806a69c",
  "@metamask-previews/eth-json-rpc-provider": "4.1.5-preview-3806a69c",
  "@metamask-previews/gas-fee-controller": "21.0.0-preview-3806a69c",
  "@metamask-previews/json-rpc-engine": "10.0.0-preview-3806a69c",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.4-preview-3806a69c",
  "@metamask-previews/keyring-controller": "17.3.0-preview-3806a69c",
  "@metamask-previews/logging-controller": "6.0.1-preview-3806a69c",
  "@metamask-previews/message-manager": "11.0.0-preview-3806a69c",
  "@metamask-previews/multichain": "0.0.0-preview-3806a69c",
  "@metamask-previews/name-controller": "8.0.1-preview-3806a69c",
  "@metamask-previews/network-controller": "22.0.0-preview-3806a69c",
  "@metamask-previews/notification-controller": "7.0.0-preview-3806a69c",
  "@metamask-previews/notification-services-controller": "0.12.0-preview-3806a69c",
  "@metamask-previews/permission-controller": "11.0.2-preview-3806a69c",
  "@metamask-previews/permission-log-controller": "3.0.1-preview-3806a69c",
  "@metamask-previews/phishing-controller": "12.0.3-preview-3806a69c",
  "@metamask-previews/polling-controller": "11.0.0-preview-3806a69c",
  "@metamask-previews/preferences-controller": "13.1.0-preview-3806a69c",
  "@metamask-previews/profile-sync-controller": "0.9.7-preview-3806a69c",
  "@metamask-previews/queued-request-controller": "5.1.0-preview-3806a69c",
  "@metamask-previews/rate-limit-controller": "6.0.1-preview-3806a69c",
  "@metamask-previews/selected-network-controller": "18.0.2-preview-3806a69c",
  "@metamask-previews/signature-controller": "20.1.0-preview-3806a69c",
  "@metamask-previews/transaction-controller": "37.3.0-preview-3806a69c",
  "@metamask-previews/user-operation-controller": "16.0.0-preview-3806a69c"
}

@OGPoyraz OGPoyraz merged commit 1f0b94a into main Oct 29, 2024
119 checks passed
@OGPoyraz OGPoyraz deleted the 3380-confirmations-fix-for-the-new-simulations-bypass branch October 29, 2024 10:31
OGPoyraz added a commit that referenced this pull request Oct 29, 2024
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

This PR adds a mechanism to re-trigger of simulations if the security
provider mark transaction as `malicious` and the previous simulation
native balance change is different then the previous simulation.

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

Fixes: MetaMask/MetaMask-planning#3380

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

- **ADDED**: Add mechanism to re-trigger of simulations if the security
provider mark transaction as `malicious` and the previous simulation
native balance change is different then the previous simulation.
- **ADDED**: Add `changeInSimulationData` property to `simulationData`
in order to detect change of simulation data.

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [X] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [X] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

---------

Co-authored-by: Matthew Walsh <[email protected]>
OGPoyraz added a commit that referenced this pull request Oct 29, 2024
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

This PR adds a mechanism to re-trigger of simulations if the security
provider mark transaction as `malicious` and the previous simulation
native balance change is different then the previous simulation.

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

Fixes: MetaMask/MetaMask-planning#3380

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

- **ADDED**: Add mechanism to re-trigger of simulations if the security
provider mark transaction as `malicious` and the previous simulation
native balance change is different then the previous simulation.
- **ADDED**: Add `changeInSimulationData` property to `simulationData`
in order to detect change of simulation data.

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [X] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [X] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

---------

Co-authored-by: Matthew Walsh <[email protected]>
OGPoyraz added a commit that referenced this pull request Oct 29, 2024
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

This PR adds a mechanism to re-trigger of simulations if the security
provider mark transaction as `malicious` and the previous simulation
native balance change is different then the previous simulation.

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

Fixes: MetaMask/MetaMask-planning#3380

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

- **ADDED**: Add mechanism to re-trigger of simulations if the security
provider mark transaction as `malicious` and the previous simulation
native balance change is different then the previous simulation.
- **ADDED**: Add `changeInSimulationData` property to `simulationData`
in order to detect change of simulation data.

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [X] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [X] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

---------

Co-authored-by: Matthew Walsh <[email protected]>
OGPoyraz added a commit that referenced this pull request Oct 29, 2024
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

This PR adds a mechanism to re-trigger of simulations if the security
provider mark transaction as `malicious` and the previous simulation
native balance change is different then the previous simulation.

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

Fixes: MetaMask/MetaMask-planning#3380

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

- **ADDED**: Add mechanism to re-trigger of simulations if the security
provider mark transaction as `malicious` and the previous simulation
native balance change is different then the previous simulation.
- **ADDED**: Add `changeInSimulationData` property to `simulationData`
in order to detect change of simulation data.

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [X] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [X] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

---------

Co-authored-by: Matthew Walsh <[email protected]>
OGPoyraz added a commit that referenced this pull request Oct 29, 2024
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

This PR adds a mechanism to re-trigger of simulations if the security
provider mark transaction as `malicious` and the previous simulation
native balance change is different then the previous simulation.

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

Fixes: MetaMask/MetaMask-planning#3380

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

- **ADDED**: Add mechanism to re-trigger of simulations if the security
provider mark transaction as `malicious` and the previous simulation
native balance change is different then the previous simulation.
- **ADDED**: Add `changeInSimulationData` property to `simulationData`
in order to detect change of simulation data.

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [X] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [X] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

---------

Co-authored-by: Matthew Walsh <[email protected]>
OGPoyraz added a commit that referenced this pull request Oct 29, 2024
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

This PR adds a mechanism to re-trigger of simulations if the security
provider mark transaction as `malicious` and the previous simulation
native balance change is different then the previous simulation.

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

Fixes: MetaMask/MetaMask-planning#3380

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

- **ADDED**: Add mechanism to re-trigger of simulations if the security
provider mark transaction as `malicious` and the previous simulation
native balance change is different then the previous simulation.
- **ADDED**: Add `changeInSimulationData` property to `simulationData`
in order to detect change of simulation data.

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [X] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [X] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

---------

Co-authored-by: Matthew Walsh <[email protected]>
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Oct 30, 2024
<!--
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.
-->

## **Description**

<!--
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

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28104?quickstart=1)

## **Related issues**

Fixes: MetaMask/MetaMask-planning#3380

## **Manual testing steps**

TBD

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**


![1](https://github.com/user-attachments/assets/67fc06d4-2f01-4e95-b1da-e84f5145462e)

![2](https://github.com/user-attachments/assets/52153a4a-4c0d-44bd-990b-51f9b90eefb4)


## **Pre-merge author checklist**

- [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.

## **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.

---------

Co-authored-by: MetaMask Bot <[email protected]>
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Oct 30, 2024
<!--
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.
-->

## **Description**

<!--
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

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28104?quickstart=1)

## **Related issues**

Fixes: MetaMask/MetaMask-planning#3380

## **Manual testing steps**

TBD

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**


![1](https://github.com/user-attachments/assets/67fc06d4-2f01-4e95-b1da-e84f5145462e)

![2](https://github.com/user-attachments/assets/52153a4a-4c0d-44bd-990b-51f9b90eefb4)


## **Pre-merge author checklist**

- [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.

## **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.

---------

Co-authored-by: MetaMask Bot <[email protected]>
OGPoyraz added a commit to MetaMask/metamask-extension that referenced this pull request Oct 30, 2024
<!--
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

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](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] -->

![1](https://github.com/user-attachments/assets/67fc06d4-2f01-4e95-b1da-e84f5145462e)

![2](https://github.com/user-attachments/assets/52153a4a-4c0d-44bd-990b-51f9b90eefb4)

- [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 <[email protected]>
NicolasMassart added a commit to MetaMask/metamask-mobile that referenced this pull request Oct 30, 2024
<!--
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.
-->

## **Description**

<!--
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 - this will eventually be removed in subsequent
releases.

MetaMask/core@main...patch/mobile-transaction-controller-35-0-0



## **Related issues**

Fixes: MetaMask/MetaMask-planning#3380

## **Manual testing steps**

Since the changes are in the core - it's already validated in the
extension in the transaction lifecycle.

But for the sake of risk, all transaction simulations will be rechecked
and approval will be needed from QA as we discussed internally.

## **Screenshots/Recordings**


https://github.com/user-attachments/assets/42a433d0-7156-4f6d-b45b-fd6cdda712ee


### **Before**

NA

### **After**

NA

## **Pre-merge author checklist**

- [X] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.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-mobile/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.

---------

Co-authored-by: Nico MASSART <[email protected]>
NicolasMassart pushed a commit to MetaMask/metamask-mobile that referenced this pull request Oct 30, 2024
<!--
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.
-->

## **Description**

<!--
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 - this will eventually be removed in subsequent
releases.

MetaMask/core@main...patch/mobile-transaction-controller-35-0-0

## **Related issues**

Fixes: MetaMask/MetaMask-planning#3380

## **Manual testing steps**

Since the changes are in the core - it's already validated in the
extension in the transaction lifecycle.

But for the sake of risk, all transaction simulations will be rechecked
and approval will be needed from QA as we discussed internally.

## **Screenshots/Recordings**

https://github.com/user-attachments/assets/42a433d0-7156-4f6d-b45b-fd6cdda712ee

### **Before**

NA

### **After**

NA

## **Pre-merge author checklist**

- [X] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.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-mobile/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.

---------

Co-authored-by: Nico MASSART <[email protected]>
# Conflicts:
#	locales/languages/en.json
#	patches/@MetaMask+transaction-controller+35.0.0.patch
OGPoyraz added a commit to MetaMask/metamask-mobile that referenced this pull request Oct 30, 2024
<!--
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 - this will eventually be removed in subsequent
releases.

MetaMask/core@main...patch/mobile-transaction-controller-35-0-0

Fixes: MetaMask/MetaMask-planning#3380

Since the changes are in the core - it's already validated in the
extension in the transaction lifecycle.

But for the sake of risk, all transaction simulations will be rechecked
and approval will be needed from QA as we discussed internally.

https://github.com/user-attachments/assets/42a433d0-7156-4f6d-b45b-fd6cdda712ee

NA

NA

- [X] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.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-mobile/blob/main/.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: Nico MASSART <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants