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

feat: support updated Linea gas fee estimation #8581

Merged
merged 18 commits into from
Feb 26, 2024

Conversation

matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Feb 14, 2024

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.
  • Fix saving custom gas fee values in the send flow.
  • Reject approval request when closing send confirm component.

Related issues

Fixes: #1531 #8708

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

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • 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 matthewwalsh0 requested a review from a team as a code owner February 14, 2024 17:06
@matthewwalsh0 matthewwalsh0 added the team-confirmations-system DEPRECATED: please use "team-confirmations" label instead label Feb 14, 2024
@matthewwalsh0 matthewwalsh0 changed the title Support updated Linea gas fee estimation feat: Support updated Linea gas fee estimation Feb 14, 2024
@matthewwalsh0 matthewwalsh0 changed the title feat: Support updated Linea gas fee estimation feat: support updated Linea gas fee estimation Feb 14, 2024
@codecov-commenter
Copy link

codecov-commenter commented Feb 17, 2024

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 ⚠️
...nents/Views/confirmations/SendFlow/Amount/index.js 80.00% 1 Missing ⚠️
app/core/Engine.ts 0.00% 1 Missing ⚠️
app/selectors/confirmTransaction.ts 93.33% 0 Missing and 1 partial ⚠️
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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sleepytanya
Copy link
Contributor

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

Fix linting.
@sleepytanya
Copy link
Contributor

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
Copy link
Contributor

sleepytanya commented Feb 23, 2024

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: #8708

Check transaction gas fee estimates in send flow.
Fix saving of custom gas fees in send flow.
Reject transaction when leaving send confirmation.
@sleepytanya
Copy link
Contributor

sleepytanya commented Feb 26, 2024

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 sleepytanya added the QA Passed A successful QA run through has been done label Feb 26, 2024
Copy link

sonarcloud bot commented Feb 26, 2024

@matthewwalsh0 matthewwalsh0 merged commit 9e4c51d into main Feb 26, 2024
26 checks passed
@matthewwalsh0 matthewwalsh0 deleted the feat/1531-linea-gas-fee-flow branch February 26, 2024 18:59
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2024
@metamaskbot metamaskbot added the release-7.18.0 Issue or pull request that will be included in release 7.18.0 label Feb 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
QA Passed A successful QA run through has been done release-7.18.0 Issue or pull request that will be included in release 7.18.0 team-confirmations-system DEPRECATED: please use "team-confirmations" label instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants