Skip to content

fix: nonce increment/decrement functionality using arrow buttons#26569

Merged
vinistevam merged 12 commits intodevelopfrom
fix/custom-nonce-increment-btns
Sep 3, 2024
Merged

fix: nonce increment/decrement functionality using arrow buttons#26569
vinistevam merged 12 commits intodevelopfrom
fix/custom-nonce-increment-btns

Conversation

@vinistevam
Copy link
Copy Markdown
Contributor

@vinistevam vinistevam commented Aug 21, 2024

Description

Context
When customizing the nonce using a lower increment button nonce value is set to 0, using higher increment button results in nonce = 1.

This PR aims to fix the support of the arrow buttons to increase/decrease the number taking the suggested next nonce as the base.

Open in GitHub Codespaces

Related issues

Fixes: #23535

Manual testing steps

  1. Enable custom nonce
  2. Send Eth
  3. Customize nonce using the arrow buttons

Screenshots/Recordings

Before

After

Screencast.from.21-08-2024.10.42.17.webm

Pre-merge author checklist

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.

@vinistevam vinistevam added the team-confirmations Push issues to confirmations team label Aug 21, 2024
@github-actions
Copy link
Copy Markdown
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.

@vinistevam vinistevam marked this pull request as ready for review August 21, 2024 13:46
@vinistevam vinistevam requested a review from a team as a code owner August 21, 2024 13:46
);
};

const handleNonceChange = ({ target: { value } }) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor, do we want a useCallback just in case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

100% we need to use the usaCallback, but in this case, it is an old class component.

const inputValue = Number(value);

if (inputValue < 0 || isNaN(inputValue)) {
updateCustomNonce('');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it be cleaner to set this to undefined to be explicit as we already have the fallback on 533?

return;
}

updateCustomNonce(String(inputValue));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Assuming the inputValue is a decimal and not hexadecimal, why are we storing it as a string?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, no need to store it as a string, removed.

@vinistevam vinistevam requested a review from a team as a code owner August 22, 2024 12:31
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 22, 2024

Codecov Report

Attention: Patch coverage is 53.33333% with 7 lines in your changes missing coverage. Please review.

Project coverage is 70.13%. Comparing base (5c5bc87) to head (a9b1358).

Files with missing lines Patch % Lines
...saction-base/confirm-transaction-base.component.js 53.33% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #26569      +/-   ##
===========================================
+ Coverage    70.13%   70.13%   +0.01%     
===========================================
  Files         1424     1424              
  Lines        49567    49571       +4     
  Branches     13867    13867              
===========================================
+ Hits         34759    34765       +6     
+ Misses       14808    14806       -2     

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

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [2e30805]
Page Load Metrics (90 ± 9 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint84158121209
domContentLoaded56123882110
load5812390199
domInteractive117539178
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: -113 Bytes (-0.00%)
  • common: 0 Bytes (0.00%)

@sleepytanya
Copy link
Copy Markdown
Contributor

Works great!

increments.mov

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [8cbf8be]
Page Load Metrics (83 ± 13 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint761871132412
domContentLoaded44164782814
load53164832613
domInteractive105426126
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: -113 Bytes (-0.00%)
  • common: 0 Bytes (0.00%)

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Sep 3, 2024

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [a9b1358]
Page Load Metrics (1884 ± 91 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint25523291723524252
domContentLoaded15802255185818388
load15882322188419091
domInteractive217938157
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: -113 Bytes (-0.00%)
  • common: 0 Bytes (0.00%)

@vinistevam vinistevam merged commit 56363e2 into develop Sep 3, 2024
@vinistevam vinistevam deleted the fix/custom-nonce-increment-btns branch September 3, 2024 10:03
@github-actions github-actions bot locked and limited conversation to collaborators Sep 3, 2024
@metamaskbot metamaskbot added the release-12.6.0 Issue or pull request that will be included in release 12.6.0 label Sep 3, 2024
@gauthierpetetin gauthierpetetin added release-12.5.0 Issue or pull request that will be included in release 12.5.0 and removed release-12.6.0 Issue or pull request that will be included in release 12.6.0 labels Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

QA Passed release-12.5.0 Issue or pull request that will be included in release 12.5.0 team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Customizing nonce with increment buttons adjusts nonce value to 0 or 1.

6 participants