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

Optimism Bedrock Fix + New Gas Displays #19960

Merged
merged 3 commits into from
Dec 11, 2023
Merged

Conversation

segun
Copy link
Contributor

@segun segun commented Jul 11, 2023

Explanation

This PR has lots of changes, but most of them are i18n messages and fixes to existing e2e and unit tests. So it's not all that daunting. Thanks for the review ;)

Problem: the Optimism Bedrock upgrade, which adds support to EIP1559, happened on June 6th.
Now, we see some issues with the current gas displays

  • whenever we send a transaction Optimism network we often display 0 on any the suggested gas fees options. This seems to be a rounding issue - fees are so low in the L2 that we end up displaying a 0 for all the options

The bug in code is that we always try to display the values in ETH, But the Optimism fees are sent from the backend in GWEI, the fix is to check if the ETH conversion is zero and then use GWEI conversion, if that is also zero, we then use WEI conversion.

Screenshots/Screencaps

Before

image

After

Screenshot 2023-07-11 at 12 37 55 Screenshot 2023-07-11 at 12 38 13 Screenshot 2023-07-11 at 12 38 05

Manual Testing Steps

  1. Select Optimism network
  2. Send EIP1559
  3. Click Edit fees
  4. See recommended fees are 0

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.

In this case, a QA Engineer approval will be be required.

@segun segun added team-confirmations-secure-ux-PR PRs from the confirmations team needs-ux-ds-review needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Jul 11, 2023
@segun segun requested a review from a team as a code owner July 11, 2023 09:35
@segun segun self-assigned this Jul 11, 2023
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@segun segun marked this pull request as draft July 11, 2023 11:30
@segun segun force-pushed the dev-segun-new-gas-component branch 3 times, most recently from d686c19 to 4291c53 Compare July 12, 2023 10:54
@metamaskbot
Copy link
Collaborator

Builds ready [4291c53]
Page Load Metrics (1537 ± 52 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1092261312512
domContentLoaded13781812153710852
load13781813153710852
domInteractive13781812153710852
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 bytes
  • ui: 3015 bytes
  • common: -322 bytes

@codecov
Copy link

codecov bot commented Jul 12, 2023

Codecov Report

Attention: 29 lines in your changes are missing coverage. Please review.

Comparison is base (1e60159) 67.78% compared to head (da9663c) 67.78%.
Report is 6 commits behind head on develop.

Files Patch % Lines
...app/fee-details-component/fee-details-component.js 59.52% 17 Missing ⚠️
.../components/app/gas-timing/gas-timing.component.js 78.12% 7 Missing ⚠️
...omponents/app/gas-details-item/gas-details-item.js 87.50% 2 Missing ⚠️
...s/app/approve-content-card/approve-content-card.js 50.00% 1 Missing ⚠️
...ponents/app/edit-gas-fee-icon/edit-gas-fee-icon.js 91.67% 1 Missing ⚠️
...saction-base/confirm-transaction-base.component.js 91.67% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #19960      +/-   ##
===========================================
- Coverage    67.78%   67.78%   -0.00%     
===========================================
  Files         1052     1053       +1     
  Lines        40816    40876      +60     
  Branches     10943    10955      +12     
===========================================
+ Hits         27665    27704      +39     
- Misses       13151    13172      +21     

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

@segun segun force-pushed the dev-segun-new-gas-component branch 3 times, most recently from d5aeb78 to bcba2ef Compare July 13, 2023 09:19
@metamaskbot
Copy link
Collaborator

Builds ready [89e9ef2]
Page Load Metrics (1672 ± 42 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1183101564220
domContentLoaded1496184516718842
load1496184516728842
domInteractive1496184516718842
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 bytes
  • ui: 3354 bytes
  • common: -322 bytes

@metamaskbot
Copy link
Collaborator

Builds ready [eec3426]
Page Load Metrics (1502 ± 37 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint103162122168
domContentLoaded1350171715017637
load1351171715027637
domInteractive1350171715017737
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 bytes
  • ui: 4220 bytes
  • common: -322 bytes

@segun segun force-pushed the dev-segun-new-gas-component branch from eec3426 to 8ab1b8a Compare July 18, 2023 08:19
@metamaskbot
Copy link
Collaborator

Builds ready [8ab1b8a]
Page Load Metrics (1491 ± 32 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint100170120178
domContentLoaded1363159314916732
load1363159314916732
domInteractive1363159314916732
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 bytes
  • ui: 4172 bytes
  • common: -322 bytes

@@ -53,18 +53,26 @@ export function useCurrencyDisplay(
const isUserPreferredCurrency = currency === currentCurrency;

const value = useMemo(() => {
let ethDisplayValue;
console.log('Using display value: ', displayValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Console needs removal

Copy link
Contributor

@georgewrmarshall georgewrmarshall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @segun, Great start! I've left a few suggestions regarding UI and using the component library components instead of writing more CSS

@segun segun requested review from kumavis, brad-decker and a team as code owners August 14, 2023 15:51
@metamaskbot
Copy link
Collaborator

Builds ready [d83ac11]
Page Load Metrics (1289 ± 86 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint861711172713
domContentLoaded95119115
load9881797128917986
domInteractive95119115
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0.00%)
  • ui: 4.27 KiB (0.06%)
  • common: -322 Bytes (-0.01%)

Comment on lines 65 to 73

await driver.clickElement({ text: 'Edit', tag: 'button' });

const [gasLimitInput, gasPriceInput] = await driver.findElements(
'input[type="number"]',
);
await gasPriceInput.fill('8');
await gasLimitInput.fill('100000');
await driver.clickElement({ text: 'Save', tag: 'button' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Can we not send from address book without editing gas? If much this should be a test case in the send spec, no? Edit gas price and limit before sending

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we can, but I've noticed instances in the CI when this fails. I am not able to replicate these failures locally, but @seaona helped me troubleshoot CI and we found out that in the cases when this fails, the confirm button below is not enabled because the fee is too small.

So the tests passed locally but intermittently fail on CI. But with this fix it passes everytime on CI.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

humm ok that is interesting.. it feels that there's an issue with that test. We should try to get to the root cause of it instead of fixing by editing the gas values during the test (that seems to be a different test case). If the test is passing for now, I would recommend tackling the flaky test in different PR.
My suggestion is, do not change the test in this PR and create a task to address the specific test later and add it to our board.
what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure done that

css: '.transaction-detail-item:nth-of-type(1) h6:nth-of-type(2)',
text: '0.04503836 ETH',
css: '.currency-display-component__text',
text: '0.05684869',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for the different amount?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, but tests are not passing with old value

This is the 1st commit message:

Add border and padding to gas component.

Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>

refine css

Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>

Base Accordion component

Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>

Show fee details if supports eip 1559

Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>

Show maxFeePerGas as optimism fee.
Show L1 fee where available

Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>

Display L2 values in GWEI

Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>

Max fee per gas no longer needed in opts

Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>

remove new line

Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>

Add new edit gas icon component.

Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>

fix some UI alignment issues
show fee details before transaction details.

Fix Optimism edge case.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

Fix snapshop
Rebase

Fix snapshots

fix snaphot

Fix conflicts

Fix snapshot

Fixed snapshot

fix snapshot

Fix e2e

fix e2e

Fix snapshots.

Fix account token list spec

fix flaky tests.

Fix snapshot

Fix snapshots
@segun segun force-pushed the dev-segun-new-gas-component branch from 9878402 to 961b1b4 Compare December 5, 2023 13:35
@metamaskbot
Copy link
Collaborator

Builds ready [da9663c]
Page Load Metrics (1395 ± 54 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint93144114136
domContentLoaded104820105
load11591600139511254
domInteractive104820105
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0.00%)
  • ui: 4.27 KiB (0.06%)
  • common: -322 Bytes (-0.01%)

@segun segun merged commit f2cf947 into develop Dec 11, 2023
67 checks passed
@segun segun deleted the dev-segun-new-gas-component branch December 11, 2023 12:48
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2023
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Dec 11, 2023
@metamaskbot metamaskbot added the release-11.9.0 Issue or pull request that will be included in release 11.9.0 label Dec 11, 2023
@gauthierpetetin gauthierpetetin added release-11.8.0 Issue or pull request that will be included in release 11.8.0 and removed release-11.9.0 Issue or pull request that will be included in release 11.9.0 labels Jan 2, 2024
@metamaskbot
Copy link
Collaborator

Missing release label release-11.8.0 on PR. Adding release label release-11.8.0 on PR and removing other release labels(release-11.9.0), as PR was added to branch 11.8.0 when release was cut.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-11.8.0 Issue or pull request that will be included in release 11.8.0 team-confirmations-secure-ux-PR PRs from the confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Optimism Bedrock upgrade - issues with gas display for new EIP1559 transactions