Skip to content

Commit

Permalink
fix: Reduce gas limit fallback from 95% to 35% of the block gas limit…
Browse files Browse the repository at this point in the history
… on failed gas limit estimations (#27954)

<!--
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 applies the latest `transaction-controller` version that reduces
gas limit fallback.

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

## **Related issues**

Fixes: MetaMask/core#4739

## **Manual testing steps**

NA

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

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

- [X] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [X] 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: Matthew Walsh <matthew.walsh@consensys.net>
  • Loading branch information
OGPoyraz and matthewwalsh0 authored Oct 29, 2024
1 parent 1fd9510 commit f6b9e79
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 3 additions & 1 deletion app/scripts/lib/transaction/smart-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ class SmartTransactionHook {
signedTransactions,
signedCanceledTransactions: [],
txParams: this.#txParams,
transactionMeta: this.#transactionMeta,
// 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
transactionMeta: this.#transactionMeta as any,
});
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@
"@metamask/snaps-rpc-methods": "^11.5.0",
"@metamask/snaps-sdk": "^6.9.0",
"@metamask/snaps-utils": "^8.4.1",
"@metamask/transaction-controller": "^37.2.0",
"@metamask/transaction-controller": "^37.3.0",
"@metamask/user-operation-controller": "^13.0.0",
"@metamask/utils": "^9.3.0",
"@ngraveio/bc-ur": "^1.1.12",
Expand Down
5 changes: 2 additions & 3 deletions test/e2e/tests/simulation-details/mock-request-buy-erc721.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ export const BUY_ERC721_REQUEST_2_MOCK: MockRequestResponse = {
result: {
transactions: [
{
return:
'0x0000000000000000000000000000000000000000000000000000000000000000',
return: `0x0000000000000000000000000000000000000000000000000000000000000000`,
status: '0x1',
gasUsed: '0x5f66',
gasLimit: '0x60b9',
Expand Down Expand Up @@ -388,7 +387,7 @@ export const BUY_ERC721_REQUEST_2_MOCK: MockRequestResponse = {
baseFeePerGas: 42103363836,
},
{
return: `0x00000000000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}`,
return: `0x000000000000000000000000${SENDER_ADDRESS_NO_0X_MOCK}`,
status: '0x1',
gasUsed: '0x5f66',
gasLimit: '0x60b9',
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6397,9 +6397,9 @@ __metadata:
languageName: node
linkType: hard

"@metamask/transaction-controller@npm:^37.2.0":
version: 37.2.0
resolution: "@metamask/transaction-controller@npm:37.2.0"
"@metamask/transaction-controller@npm:^37.3.0":
version: 37.3.0
resolution: "@metamask/transaction-controller@npm:37.3.0"
dependencies:
"@ethereumjs/common": "npm:^3.2.0"
"@ethereumjs/tx": "npm:^4.2.0"
Expand All @@ -6426,7 +6426,7 @@ __metadata:
"@metamask/approval-controller": ^7.0.0
"@metamask/gas-fee-controller": ^20.0.0
"@metamask/network-controller": ^21.0.0
checksum: 10/0850797efb2157de41eaec153d31f8f63d194d2290fa41a3d439a28f95a35436f47d56546b0fa64427294280476d11ab4a7ed6161a13ad6f8215a3bc052a41e2
checksum: 10/314a46bdaf1a4c68fe232591d28f3f978d7ed17f19dbaa2e3cbcbc4d28d4f7fc4581d7f88446d31ced2176f4f2abf1022ae39a296cb884fd5a083181c562ee2c
languageName: node
linkType: hard

Expand Down Expand Up @@ -25958,7 +25958,7 @@ __metadata:
"@metamask/snaps-utils": "npm:^8.4.1"
"@metamask/test-bundler": "npm:^1.0.0"
"@metamask/test-dapp": "npm:8.7.0"
"@metamask/transaction-controller": "npm:^37.2.0"
"@metamask/transaction-controller": "npm:^37.3.0"
"@metamask/user-operation-controller": "npm:^13.0.0"
"@metamask/utils": "npm:^9.3.0"
"@ngraveio/bc-ur": "npm:^1.1.12"
Expand Down

0 comments on commit f6b9e79

Please sign in to comment.