Skip to content

fix: nonce rpc checks#1882

Closed
tynes wants to merge 3 commits intodevelopfrom
fix/nonce-rpc-checks
Closed

fix: nonce rpc checks#1882
tynes wants to merge 3 commits intodevelopfrom
fix/nonce-rpc-checks

Conversation

@tynes
Copy link
Contributor

@tynes tynes commented Dec 7, 2021

Description
The current behavior of the sequencer will return the
error message nonce too low even in the case when the
nonce it too high.

This PR changes that functionality so that there are 2 explicit error messages
for when users send transactions with an incorrect nonce.
When the nonce is too low, the user can expect to get the message back:
invalid transaction: nonce too low
When the nonce is too high, the user can expect to get the message back:
invalid transaction: nonce too high

There isn't a concept of nonce too high in the L1 mempool due to the async
nature of the p2p network, but since there is not a p2p network that gossips
transactions, this feature is added to give a better error message back to the users.

@changeset-bot
Copy link

changeset-bot bot commented Dec 7, 2021

🦋 Changeset detected

Latest commit: 3c4b99c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@eth-optimism/l2geth Patch
@eth-optimism/integration-tests Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added 2-reviewers A-integration Area: integration tests A-ops Area: ops labels Dec 7, 2021
tynes added 2 commits December 6, 2021 16:43
The current behavior of the sequencer will return the
error message `nonce too low` even in the case when the
nonce it too high. This should be followed up with changes
that fix that problem. Need to double check that it will not
break any integrations.
Previously the error message `nonce too low` would
be returned even when the user submitted a transaction
with a nonce that was too high
@tynes tynes force-pushed the fix/nonce-rpc-checks branch from cc76511 to a04b004 Compare December 7, 2021 00:44
@github-actions github-actions bot added A-cannon Area: cannon and removed A-ops Area: ops labels Dec 7, 2021
@tynes tynes marked this pull request as ready for review December 7, 2021 00:48
@codecov-commenter
Copy link

codecov-commenter commented Dec 7, 2021

Codecov Report

Merging #1882 (3c4b99c) into develop (30b17cf) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #1882   +/-   ##
========================================
  Coverage    71.99%   71.99%           
========================================
  Files           70       70           
  Lines         2321     2321           
  Branches       346      346           
========================================
  Hits          1671     1671           
  Misses         650      650           
Flag Coverage Δ
batch-submitter 62.07% <ø> (ø)
contracts 87.96% <ø> (ø)
core-utils 57.50% <ø> (ø)
data-transport-layer 38.64% <ø> (ø)
message-relayer 70.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 30b17cf...3c4b99c. Read the comment docs.

@smartcontracts
Copy link
Contributor

Did we get an explicit user request for this? What experience do users usually get when they send a transaction with too high of a nonce on L1? I want to make sure that the experience is pretty much identical on L2 and I'd be worried about adding a new error that doesn't exist on L1.

@tynes
Copy link
Contributor Author

tynes commented Dec 7, 2021

When users send a tx with too high of a nonce on L1, it can be accepted into the mempool still. Since we do not have a mempool, we cannot accept transactions with too high of a nonce. This was to improve the error messaging back to the user since the error message would be incorrect. This is true that this adds a new error message that doesn't exist on L1

@smartcontracts
Copy link
Contributor

I see. Do we have user reports of this being an issue?

@tynes
Copy link
Contributor Author

tynes commented Dec 8, 2021

I see. Do we have user reports of this being an issue?

No user reports but it does improve the error message for both the user and our internal logging of error messages

if nonce > tx.Nonce() {
return ErrNonceTooLow
} else if nonce < tx.Nonce() {
return errors.New("nonce too high")
Copy link
Contributor

Choose a reason for hiding this comment

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

we can use the concrete ErrNonceTooHigh error:

ErrNonceTooHigh = errors.New("nonce too high")

@cfromknecht
Copy link
Contributor

cfromknecht commented Dec 8, 2021

I want to make sure that the experience is pretty much identical on L2 and I'd be worried about adding a new error that doesn't exist on L1.

@smartcontracts this is also relevant to #1816, which will now bubble up the low-level execution errors. We have the option of either mapping ErrNonceTooHigh to ErrNonceTooLow at the mempool and execution levels, or adding an additional error that doesn't exist. The only way to truly replicate the L1 behavior would be to add a mempool/reschedule the execution attempt, both of which I presume are out of scope in the immediate term.

@mslipper
Copy link
Collaborator

This is already implemented; we split it across two different PRs and merged them both last week.

@mslipper mslipper closed this Dec 20, 2021
@maurelian maurelian deleted the fix/nonce-rpc-checks branch December 6, 2022 20:57
theochap pushed a commit that referenced this pull request Dec 10, 2025
## Overview

Couple of changes:
1. Adds a `release-perf` build profile that has `codegen-units = 1` set
and link time optimizations turned on.
    - This profile is used by default when building application images.
1. Enables CPU-specific optimizations in the generic application
dockerfile's build routine.
1. Enables the `asm-keccak` feature in `alloy-primitives` within
`kona-node`'s dependency graph.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cannon Area: cannon A-integration Area: integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants