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

fix: issue with default nonce value being wrong when switching networks between transactions #27297

Merged
merged 13 commits into from
Sep 25, 2024

Conversation

jpuri
Copy link
Contributor

@jpuri jpuri commented Sep 20, 2024

Description

When submitting transactions the transaction after network switch takes custom nonce of previous network.

Related issues

Fixes: #26979

Manual testing steps

  1. Enable custom nonce
  2. Create a confirmation (may or may not submit) and then switch network
  3. Create new transaction
  4. Ensure that nonce in new transaction is correct

Screenshots/Recordings

TODO

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.

@jpuri jpuri added the team-confirmations Push issues to confirmations team label Sep 20, 2024
@jpuri jpuri requested a review from a team as a code owner September 20, 2024 06:04
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.

@metamaskbot
Copy link
Collaborator

Builds ready [3a522b7]
Page Load Metrics (2208 ± 324 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint23744862047911437
domContentLoaded166543042185663318
load166943332208676324
domInteractive22171553517
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 231 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@sleepytanya
Copy link
Contributor

sleepytanya commented Sep 20, 2024

Build from #27297 (comment)

  1. Submitted Linea transaction - nonce 69
  2. Switched to Sepolia with the latest transaction nonce 320
  3. Transaction on Sepolia created with the nonce 69 (same as on latest Linea tx)
lineaSepolia.mov

matthewwalsh0
matthewwalsh0 previously approved these changes Sep 23, 2024
@@ -155,6 +157,8 @@ const Footer = () => {
dispatch(
rejectPendingApproval(currentConfirmation.id, serializeError(error)),
);
dispatch(updateCustomNonce(''));
dispatch(setNextNonce(''));
Copy link
Member

Choose a reason for hiding this comment

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

Not needed now and not introduced by this PR, but perhaps a future refactor could be to remove the nonce from Redux completely and instead just store the custom nonce directly in the TransactionMeta, or let the TransactionController derive it if not specified.

Copy link

sonarcloud bot commented Sep 23, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
50.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@metamaskbot
Copy link
Collaborator

Builds ready [8aa0342]
Page Load Metrics (1933 ± 123 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint27725791857447215
domContentLoaded161325621902260125
load162825841933255123
domInteractive15176483617
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 231 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [622bd6f]
Page Load Metrics (2221 ± 216 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint21937201941794381
domContentLoaded162136042192455218
load164736102221450216
domInteractive18190583517
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 250 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@sleepytanya
Copy link
Contributor

@jpuri

Fixed:

nonce.mov

@jpuri jpuri merged commit b46a642 into develop Sep 25, 2024
77 of 78 checks passed
@jpuri jpuri deleted the nonce_fix branch September 25, 2024 14:46
@github-actions github-actions bot locked and limited conversation to collaborators Sep 25, 2024
@metamaskbot metamaskbot added release-12.6.0 Issue or pull request that will be included in release 12.6.0 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 25, 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
6 participants