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

[Bug]: Error Message: getMinimumGasTotalInHexWei expects either gasPrice OR the EIP-1559 gas fields, but neither were provided #24263

Closed
digiwand opened this issue Apr 26, 2024 · 2 comments · Fixed by #24287 or #24292
Assignees
Labels
regression-prod-11.14.0 Regression bug that was found in production in release 11.14.0 release-11.17.0 Issue or pull request that will be included in release 11.17.0 Sev1-high High severity; partial loss of service with severe impact upon users, with no workaround. team-confirmations Push issues to confirmations team type-bug

Comments

@digiwand
Copy link
Contributor

digiwand commented Apr 26, 2024

Describe the bug

Multiple users are experiencing an error with getMinimumGasTotalInHexWei when attempting to issue a transaction from a variety of networks.

@anaamolnar

I see this issue comes steady in the queue everyday since the 11.14.0 release. About 2-4 per day. Reports mention multiple networks,including Ethereum Mainnet, Scroll, Polygon ZKEvm, etc.
A more detailed ticket: https://consensys.zendesk.com/agent/tickets/1157137

Related Links:

Current Investigation Findings:

it appears the issue is related to an incomplete formation of the gasEstimationObject created in core/transaction-controller#transactionFeeSelector

/ui/selectors/confirm-transaction.js#L293 - transactionFeeSelector:

const gasEstimationObject = {
    gasLimit: txData.txParams?.gas ?? '0x0',
};

// .. logic that adds more props to gasEstimationObject

getMinimumGasTotalInHexWei(gasEstimationObject);

/shared/modules/gas.utils.js#L76 - getMinimumGasTotalInHexWei:

export function getMinimumGasTotalInHexWei({
  gasLimit = '0x0',
  gasPrice,
  maxPriorityFeePerGas,
  maxFeePerGas,
  baseFeePerGas,
} = {}) {
  const isEIP1559Estimate = Boolean(
    maxFeePerGas || maxPriorityFeePerGas || baseFeePerGas,
  );
  if (isEIP1559Estimate && gasPrice) {
    throw new Error(
      `getMinimumGasTotalInHexWei expects either gasPrice OR the EIP-1559 gas fields, but both were provided`,
    );
  }

  if (isEIP1559Estimate === false && !gasPrice) {
    throw new Error(
      `getMinimumGasTotalInHexWei expects either gasPrice OR the EIP-1559 gas fields, but neither were provided`,
    );
  }

@danjm

the below code is resulting in a gasEstimationObject which does not have any of the following properties: maxFeePerGas, maxPriorityFeePerGas, baseFeePerGas, gasPrice

that would be possible if networkAndAccountSupportsEIP1559 was false and if gasEstimateType was not any of none,ethGasPrice, or legacy

Another possibility is that each of the values in this expression are numbers === 0
const isEIP1559Estimate = Boolean( maxFeePerGas || maxPriorityFeePerGas || baseFeePerGas, );

Expected behavior

No response

Screenshots/Recordings

image (1)

Steps to reproduce

From a report:

  1. I go into any application where I need to sign a transaction specifically with payment for gas.
  2. The metamask pop-up window appears.
  3. For a split second it will show how much I will spend for gas, and if I don’t have time to press it, an error will immediately appear

From another report:
I tried to deposit Metis on Metis network by a use of AAVE Defi app
The URL is as follows: https://app.aave.com/?marketName=proto_metis_v3
The steps are just click on the URL above, connect MetaMask and try to deposit Metis. Click the button Supply.
However, they said they could no longer reproduce it the next day

Error messages or log output

Error details
Message: getMinimumGasTotalInHexWei expects either gasPrice OR the EIP-1559 gas fields, but neither were provided
Code: Error
Stack:
Error: getMinimumGasTotalInHexWei expects either gasPrice OR the EIP-1559 gas fields, but neither were provided
at n.getMinimumGasTotalInHexWei (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-2.js:15:835395)
at a.transactionFeeSelector (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-10.js:1:300714)
at n.default.txData [as mapToProps] (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-8.js:1:27146)
at r (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-2.js:1:52186)
at r.mapToProps (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-2.js:1:52322)
at r (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-2.js:1:52186)
at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-2.js:1:50725
at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-2.js:1:43423
at Object.useMemo (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-1.js:33:250245)
at n.useMemo (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-4.js:8:449673)
at z (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-2.js:1:43367)
at ga (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-1.js:33:246078)
at Za (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-1.js:33:254286)
at Ja (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-1.js:33:254105)
at Ya (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-1.js:33:253824)
at Pl (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-1.js:33:294417)
at Iu (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-1.js:33:276868)
at ju (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-1.js:33:276793)
at Eu (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-1.js:33:274133)
at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-1.js:33:232483
at n.unstable_runWithPriority (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-2.js:1:242911)
at Yi (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/ui-1.js:33:232192)

image

Version

11.14.0

Build type

None

Browser

Other (please elaborate in the "Additional Context" section)

Operating system

Other (please elaborate in the "Additional Context" section)

Hardware wallet

No response

Additional context

No response

Severity

No response

@digiwand digiwand added type-bug regression-prod-11.14.0 Regression bug that was found in production in release 11.14.0 team-confirmations Push issues to confirmations team labels Apr 26, 2024
@bschorchit
Copy link

bschorchit commented Apr 26, 2024

I was able to consistently reproduce this issue for some time by going through the send flow on Scroll network and also on Polygon skEVM on v11.14.1

Observations (in case they are useful):

  • if the crash happens before the confirmation for the send flow shows up, closing and re-opening solves it.
  • if the crash happens on the confirmation, the confirmation persists even after closing and re-opening the popup so the crash happens again (you can see the confirmation for 1-2 seconds before the crash happens again)
  • if the crash happens on the confirmation, disabling and re-enabling the extension showed me the unlock screen. After unlocking it, I saw the crash screen again (didn't see any confirmation appear for few seconds first in this case), but closing and re-opening the popup not only solved the crash screen, but also made me not able to reproduce this issue anymore on any network.
  • Both networks don't support EIP559 so this might be relevant info.
Screen.Recording.2024-04-26.at.14.40.52.mov

@bschorchit bschorchit added the Sev1-high High severity; partial loss of service with severe impact upon users, with no workaround. label Apr 26, 2024
@digiwand
Copy link
Contributor Author

Thanks @bschorchit for the helpful insights! Made a bit more progress on this with this info.

I was able to reproduce the issue by adding the Scroll Sepholia Testnet (see: https://docs.scroll.io/en/user-guide/setup/), then using our test dapp > Send Eth > Send

Investigation update:

when the error occurs, in the selectors/confirm-transaction#transactionFeeSelector, the gasEstimateType is "fee-market" which breaks without adding any props to the gasEstimationObject. When it works in the same flow it has been "eth_gasPrice"

    switch (gasEstimateType) {
      case GasEstimateTypes.none:
        gasEstimationObject.gasPrice = txData.txParams?.gasPrice ?? '0x0';
        break;
      case GasEstimateTypes.ethGasPrice:
        gasEstimationObject.gasPrice =
          txData.txParams?.gasPrice ??
          decGWEIToHexWEI(gasFeeEstimates.gasPrice);
        break;
      case GasEstimateTypes.legacy:
        gasEstimationObject.gasPrice =
          txData.txParams?.gasPrice ?? getAveragePriceEstimateInHexWEI(state);
        break;
      case GasEstimateTypes.feeMarket:
        break;
      default:
        break;
    }

digiwand added a commit that referenced this issue Apr 29, 2024
…arket" (#24287)

## **Description**

See Issue #24263
for investigation details

This will be a hotfix targeting v11.14.3

## **Related issues**

Fixes: #24263

## **Manual testing steps**

One way to repro is by adding the Scroll Sepholia Testnet (see:
https://docs.scroll.io/en/user-guide/setup/), then using our test dapp >
Send Eth > Send

For other repro methods, please refer to the related issue ticket

## **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 Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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/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: Matthew Walsh <matthew.walsh@consensys.net>
@metamaskbot metamaskbot added the release-11.17.0 Issue or pull request that will be included in release 11.17.0 label Apr 29, 2024
digiwand added a commit that referenced this issue Apr 29, 2024
…arket" (#24287)

## **Description**

See Issue #24263
for investigation details

This will be a hotfix targeting v11.14.3

## **Related issues**

Fixes: #24263

## **Manual testing steps**

One way to repro is by adding the Scroll Sepholia Testnet (see:
https://docs.scroll.io/en/user-guide/setup/), then using our test dapp >
Send Eth > Send

For other repro methods, please refer to the related issue ticket

## **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 Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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/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: Matthew Walsh <matthew.walsh@consensys.net>
NidhiKJha pushed a commit that referenced this issue Apr 30, 2024
…arket" (#24287)

## **Description**

See Issue #24263
for investigation details

This will be a hotfix targeting v11.14.3

## **Related issues**

Fixes: #24263

## **Manual testing steps**

One way to repro is by adding the Scroll Sepholia Testnet (see:
https://docs.scroll.io/en/user-guide/setup/), then using our test dapp >
Send Eth > Send

For other repro methods, please refer to the related issue ticket

## **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 Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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/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: Matthew Walsh <matthew.walsh@consensys.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-prod-11.14.0 Regression bug that was found in production in release 11.14.0 release-11.17.0 Issue or pull request that will be included in release 11.17.0 Sev1-high High severity; partial loss of service with severe impact upon users, with no workaround. team-confirmations Push issues to confirmations team type-bug
Projects
Archived in project
Status: Fixed
4 participants