metamask-mobile icon indicating copy to clipboard operation
metamask-mobile copied to clipboard

feat: support updated Linea gas fee estimation

Open matthewwalsh0 opened this issue 1 year ago • 4 comments
trafficstars

Description

When creating transactions on a Linea network, use the updated gas fee estimates provided by the linea_estimateGas RPC method.

This is provided via the patched TransactionController which periodically updates these values in the new gasFeeEstimates property of the transaction metadata.

Specifically:

  • Create selectors for the GasFeeController, TransactionController, and for general transaction confirmation.
  • Use these new selectors in place of any direct state references to ensure the transaction specific estimates are used whenever they are available.
  • Resolve a Redux / selector limitation of BaseControllerV1 controllers. See app/redux/slices/engine/index.ts.

Related issues

Fixes: #1531

Manual testing steps

Verify transactions are successfully submitted with the provided gas fees with permutations of:

  • Linea Network (Mainnet / Goerli)
  • Other Network (Mainnet / Sepolia)
  • dApp Gas Fees / Suggested Fees
  • Priority Level (Low / Medium / High)

If possible, verify that the gas fees for an identical transaction are lower than the previous commit.

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • [x] I’ve followed MetaMask Coding Standards.
  • [x] I've clearly explained what problem this PR is solving and how it is solved.
  • [x] I've linked related issues
  • [x] I've included manual testing steps
  • [x] I've included screenshots/recordings if applicable
  • [x] I’ve included tests if applicable
  • [x] I’ve documented my code using JSDoc format if applicable
  • [x] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • [x] I’ve properly set the pull request status:
    • [x] In case it's not yet "ready for review", I've set it to "draft".
    • [x] In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

matthewwalsh0 avatar Feb 14 '24 17:02 matthewwalsh0

Codecov Report

Attention: Patch coverage is 80.88235% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 41.55%. Comparing base (667d8c8) to head (b93dc8d).

Files Patch % Lines
...ents/Views/confirmations/SendFlow/Confirm/index.js 56.52% 10 Missing :warning:
...nents/Views/confirmations/SendFlow/Amount/index.js 80.00% 1 Missing :warning:
app/core/Engine.ts 0.00% 1 Missing :warning:
app/selectors/confirmTransaction.ts 93.33% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8581      +/-   ##
==========================================
+ Coverage   41.47%   41.55%   +0.07%     
==========================================
  Files        1263     1267       +4     
  Lines       30605    30648      +43     
  Branches     3008     3011       +3     
==========================================
+ Hits        12694    12735      +41     
- Misses      17157    17158       +1     
- Partials      754      755       +1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Feb 17 '24 00:02 codecov-commenter

QA build, Samsung s24+ physical device. Transactions with the provided gas fees can be successfully submitted on mainnet/Sepolia, Linea/Linea Goerli.

MM production gas fees on Linea Goerli: market gas fee nonce 64 - 0.5820 low gas fee nonce 65 - 0.5640 aggr gas fee nonce 66 - 0.5880

Gas fee on Linea Goerli on current branch doesn't change whenever 'market', 'aggressive' or 'low' gas fee selected: market gas fee 82, 83, 84 - 0 0.5820 low gas fee 79, 80, 81 - 0.5820 aggr gas fee 76, 77, 78 - 0.5820

sleepytanya avatar Feb 21 '24 02:02 sleepytanya

Gas fee doesn't change https://lineascan.build/address/0x2990079bcdEe240329a520d2444386FC119da21a
nonces 71-76 made on production, gas fees changing: 71&72 - market 1.5132 GWEI 72&73 - low 1.4664 GWEI 75&76 - aggressive 1.5288 GWEI nonces 77-82 on branch: 77&78 - market 1.5132 GWEI 79&80 - low 1.5132 GWEI 81&82 - aggressive 1.5132 GWEI

sleepytanya avatar Feb 21 '24 14:02 sleepytanya

QA build, Samsung s24+ physical device.

Linea mainnet current branch:

nonce 114 and 115 market gas fees of 1.0816 GWEI and 1.0819 GWEI nonce 116 and 117 low gas fees of 1.0811 GWEI and 1.0813 GWEI nonce 118 and 119 aggressive gas fees of 1.0813 GWEI and 1.0814 GWEI

Linea mainnet production:

nonce 120 and 121 market gas fees of 1.0796 GWEI and 1.0793 GWEI nonce 122 and 124 low gas fees of 1.0460 GWEI and 1.0462 GWEI nonce 123 and 125 aggressive gas fees of 1.0906 GWEI and 1.0908 GWEI

Linea Goerli current branch:

nonce 68 and 69 market gas fee 0.5820 GWEI nonce 70 and 71 low gas fee 0.5820 GWEI nonce 72 and 73 aggressive gas fee 0.5820 GWEI It appears that custom gas fees are ignored and txs are submitted at the original suggested market rates.

Linea Goerli production:

nonce 62 and 63 market gas fee 0.5820 GWEI nonce 64 and 65 low gas fee 0.5640 GWEI nonce 66 and 67 aggressive gas fee 0.5880 GWEI.

Similar issue on Sepolia and mainnet here: https://github.com/MetaMask/metamask-mobile/issues/8708

sleepytanya avatar Feb 23 '24 05:02 sleepytanya

Gas fees estimation adjusted accordingly to custom gas settings in the UI, transactions sent with the saved gas fees, custom gas settings reflected on block explorer. QA build, Chrome 121.0.6167.184.

Mainnet https://etherscan.io/address/0x2990079bcdEe240329a520d2444386FC119da21a, 'send' transactions from the wallet Nonces 860, 861,867 - market gas fee Nonces 862, 863, 866 - low gas gee Nonces 864, 865, 868 - aggressive gas fee

Linea mainnet https://lineascan.build/address/0x2990079bcdEe240329a520d2444386FC119da21a, 'send' transactions from the wallet Nonces 131, 132 - market gas fee Nonces 133, 134 - low gas fee Nonces 135, 136 - aggressive gas fee

Sepolia https://sepolia.etherscan.io/address/0x2990079bcdEe240329a520d2444386FC119da21a, test dapp 'create token' transactions Nonces 529, 530 - market gas fee Nonces 531, 532 - low gas fee Nonces 533, 534 - aggressive gas fee

sleepytanya avatar Feb 26 '24 16:02 sleepytanya