Skip to content

Commit 04dd7d3

Browse files
fix: gas limit estimation (#28327)
## **Description** Upgrade transaction controller to fix gas limit estimation on specific networks. ## **Related issues** Fixes: #28307 #28175 ## **Manual testing steps** See issue. ## **Screenshots/Recordings** ### **Before** ### **After** ## **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.
1 parent f3f6507 commit 04dd7d3

File tree

5 files changed

+29
-34
lines changed

5 files changed

+29
-34
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@
347347
"@metamask/snaps-sdk": "^6.10.0",
348348
"@metamask/snaps-utils": "^8.5.1",
349349
"@metamask/solana-wallet-snap": "^0.1.9",
350-
"@metamask/transaction-controller": "^38.1.0",
350+
"@metamask/transaction-controller": "^38.3.0",
351351
"@metamask/user-operation-controller": "^13.0.0",
352352
"@metamask/utils": "^10.0.1",
353353
"@ngraveio/bc-ur": "^1.1.12",

test/e2e/flask/user-operations.spec.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ describe('User Operations', function () {
256256
from: ERC_4337_ACCOUNT,
257257
to: GANACHE_ACCOUNT,
258258
value: convertETHToHexGwei(1),
259-
data: '0x',
259+
maxFeePerGas: '0x0',
260+
maxPriorityFeePerGas: '0x0',
260261
});
261262

262263
await confirmTransaction(driver);
@@ -294,7 +295,8 @@ describe('User Operations', function () {
294295
from: ERC_4337_ACCOUNT,
295296
to: GANACHE_ACCOUNT,
296297
value: convertETHToHexGwei(1),
297-
data: '0x',
298+
maxFeePerGas: '0x0',
299+
maxPriorityFeePerGas: '0x0',
298300
});
299301

300302
await confirmTransaction(driver);

test/e2e/tests/transaction/edit-gas-fee.spec.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const { strict: assert } = require('assert');
22
const {
33
createInternalTransaction,
4+
createDappTransaction,
45
} = require('../../page-objects/flows/transaction');
56

67
const {
78
withFixtures,
8-
openDapp,
99
unlockWallet,
1010
generateGanacheOptions,
1111
WINDOW_TITLES,
@@ -172,11 +172,9 @@ describe('Editing Confirm Transaction', function () {
172172
// login to extension
173173
await unlockWallet(driver);
174174

175-
// open dapp and connect
176-
await openDapp(driver);
177-
await driver.clickElement({
178-
text: 'Send EIP 1559 Transaction',
179-
tag: 'button',
175+
await createDappTransaction(driver, {
176+
maxFeePerGas: '0x2000000000',
177+
maxPriorityFeePerGas: '0x1000000000',
180178
});
181179

182180
// check transaction in extension popup
@@ -198,12 +196,12 @@ describe('Editing Confirm Transaction', function () {
198196
'.currency-display-component__text',
199197
);
200198
const transactionAmount = transactionAmounts[0];
201-
assert.equal(await transactionAmount.getText(), '0');
199+
assert.equal(await transactionAmount.getText(), '0.001');
202200

203201
// has correct updated value on the confirm screen the transaction
204202
await driver.waitForSelector({
205203
css: '.currency-display-component__text',
206-
text: '0.00021',
204+
text: '0.00185144',
207205
});
208206

209207
// confirms the transaction
@@ -227,7 +225,7 @@ describe('Editing Confirm Transaction', function () {
227225
'[data-testid="transaction-list-item-primary-currency"]',
228226
);
229227
assert.equal(txValues.length, 1);
230-
assert.ok(/-0\s*ETH/u.test(await txValues[0].getText()));
228+
assert.ok(/-0.001\s*ETH/u.test(await txValues[0].getText()));
231229
},
232230
);
233231
});

test/e2e/tests/transaction/multiple-transactions.spec.js

+11-16
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,13 @@ describe('Multiple transactions', function () {
2626
// initiates a transaction from the dapp
2727
await openDapp(driver);
2828
// creates first transaction
29-
await driver.clickElement({
30-
text: 'Send EIP 1559 Transaction',
31-
tag: 'button',
32-
});
29+
await createDappTransaction(driver);
3330
await driver.waitUntilXWindowHandles(3);
3431

3532
await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp);
3633

3734
// creates second transaction
38-
await driver.clickElement({
39-
text: 'Send EIP 1559 Transaction',
40-
tag: 'button',
41-
});
35+
await createDappTransaction(driver);
4236
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);
4337

4438
// confirms second transaction
@@ -94,19 +88,13 @@ describe('Multiple transactions', function () {
9488
// initiates a transaction from the dapp
9589
await openDapp(driver);
9690
// creates first transaction
97-
await driver.clickElement({
98-
text: 'Send EIP 1559 Transaction',
99-
tag: 'button',
100-
});
91+
await createDappTransaction(driver);
10192
await driver.waitUntilXWindowHandles(3);
10293

10394
await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp);
10495

10596
// creates second transaction
106-
await driver.clickElement({
107-
text: 'Send EIP 1559 Transaction',
108-
tag: 'button',
109-
});
97+
await createDappTransaction(driver);
11098
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);
11199

112100
// rejects second transaction
@@ -141,3 +129,10 @@ describe('Multiple transactions', function () {
141129
);
142130
});
143131
});
132+
133+
async function createDappTransaction(driver) {
134+
await driver.clickElement({
135+
text: 'Send EIP 1559 Without Gas',
136+
tag: 'button',
137+
});
138+
}

yarn.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -6458,9 +6458,9 @@ __metadata:
64586458
languageName: node
64596459
linkType: hard
64606460

6461-
"@metamask/transaction-controller@npm:^38.1.0":
6462-
version: 38.1.0
6463-
resolution: "@metamask/transaction-controller@npm:38.1.0"
6461+
"@metamask/transaction-controller@npm:^38.3.0":
6462+
version: 38.3.0
6463+
resolution: "@metamask/transaction-controller@npm:38.3.0"
64646464
dependencies:
64656465
"@ethereumjs/common": "npm:^3.2.0"
64666466
"@ethereumjs/tx": "npm:^4.2.0"
@@ -6469,7 +6469,7 @@ __metadata:
64696469
"@ethersproject/contracts": "npm:^5.7.0"
64706470
"@ethersproject/providers": "npm:^5.7.0"
64716471
"@metamask/base-controller": "npm:^7.0.2"
6472-
"@metamask/controller-utils": "npm:^11.4.1"
6472+
"@metamask/controller-utils": "npm:^11.4.2"
64736473
"@metamask/eth-query": "npm:^4.0.0"
64746474
"@metamask/metamask-eth-abis": "npm:^3.1.1"
64756475
"@metamask/nonce-tracker": "npm:^6.0.0"
@@ -6487,7 +6487,7 @@ __metadata:
64876487
"@metamask/approval-controller": ^7.0.0
64886488
"@metamask/gas-fee-controller": ^22.0.0
64896489
"@metamask/network-controller": ^22.0.0
6490-
checksum: 10/c1bdca52bbbce42a76ec9c640197534ec6c223b0f5d5815acfa53490dc1175850ea9aeeb6ae3c5ec34218f0bdbbbeb3e8731e2552aa9411e3ed7798a5dea8ab5
6490+
checksum: 10/f4e8e3a1a31e3e62b0d1a59bbe15ebfa4dc3e4cf077fb95c1815c00661c60ef4676046c49f57eab9749cd31d3e55ac3fed7bc247e3f5a3d459f2dcb03998633d
64916491
languageName: node
64926492
linkType: hard
64936493

@@ -26590,7 +26590,7 @@ __metadata:
2659026590
"@metamask/solana-wallet-snap": "npm:^0.1.9"
2659126591
"@metamask/test-bundler": "npm:^1.0.0"
2659226592
"@metamask/test-dapp": "npm:8.13.0"
26593-
"@metamask/transaction-controller": "npm:^38.1.0"
26593+
"@metamask/transaction-controller": "npm:^38.3.0"
2659426594
"@metamask/user-operation-controller": "npm:^13.0.0"
2659526595
"@metamask/utils": "npm:^10.0.1"
2659626596
"@ngraveio/bc-ur": "npm:^1.1.12"

0 commit comments

Comments
 (0)