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

JsonRpc standardization: wrongTransactionNonce error #8126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yerke26
Copy link
Contributor

@yerke26 yerke26 commented Jan 29, 2025

Currently eth_call, eth_simulateV1, eth_estimateGas, eth_sendRawTransaction, eth_sendTransaction returns in Geth and Nethermind different error message for the same error:

Nethermind has:

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "wrong transaction nonce"
    },
    "id": 1
}

Geth:
when nonce high

{
    "jsonrpc": "2.0",
    "id": 1,
    "error": {
    "code": -32000,
       "message": "err: nonce too high: address {senderAddress}, tx: {txNonce} state: {stateNonce} (supplied gas {gasLimit})"
}

when nonce low:

{
    "jsonrpc": "2.0",
    "id": 1,
    "error": {
    "code": -32000,
       "message": "err: nonce too low: address {senderAddress}, tx: {txNonce} state: {stateNonce} (supplied gas {gasLimit})"
}

replaced WrongTransactionNonce error with TransactionNonceTooHigh, TransactionNonceTooLow

Changes

  • List the changes

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Optional. Remove if not applicable.

Documentation

Requires documentation update

  • Yes
  • No

If yes, link the PR to the docs update or the issue with the details labeled docs. Remove if not applicable.

Requires explanation in Release Notes

  • Yes
  • No

If yes, fill in the details here. Remove if not applicable.

Remarks

Optional. Remove if not applicable.

}
if (tx.Nonce < stateNonce)
{
TraceLogInvalidTx(tx, $"WRONG_TRANSACTION_NONCE: {tx.Nonce} (expected {WorldState.GetNonce(tx.SenderAddress)})");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should change WRONG_TRANSACTION_NONCE logs also?

Copy link
Member

Choose a reason for hiding this comment

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

Why not

}
if (tx.Nonce < stateNonce)
{
TraceLogInvalidTx(tx, $"WRONG_TRANSACTION_NONCE: {tx.Nonce} (expected {WorldState.GetNonce(tx.SenderAddress)})");
Copy link
Member

Choose a reason for hiding this comment

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

Why not

Copy link
Contributor

@MarekM25 MarekM25 left a comment

Choose a reason for hiding this comment

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

Think about covering with tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants