Skip to content

set nonce to current, ignoring all nonce check on CallAndRestore#8897

Merged
ak88 merged 5 commits into
masterfrom
fix/no-nonce-check
Jul 1, 2025
Merged

set nonce to current, ignoring all nonce check on CallAndRestore#8897
ak88 merged 5 commits into
masterfrom
fix/no-nonce-check

Conversation

@ak88

@ak88 ak88 commented Jun 30, 2025

Copy link
Copy Markdown
Contributor

Partial fix #8813

Geth do not check nonce on eth_estimateGas or eth_call. This will effectively remove our nonce check, and fix the "wrong transaction nonce" issue as reported here https://quicknode.notion.site/Geth-vs-Nethermind-JSON-RPC-Resposnes-19615a82e84c804bbebfcdb71e3793fc

Alternatively we could merge ProcessingOptions and ExecutionOptions so DoNotVerifyNonce can be passed to TransactionProcessor, but this solution is of course simpler.

@ak88 ak88 marked this pull request as ready for review July 1, 2025 10:04
@benaadams benaadams requested a review from Copilot July 1, 2025 12:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates eth_call and eth_estimateGas to ignore the supplied transaction nonce—always using the on‐chain nonce instead—to mirror Geth’s behavior and fix the "wrong transaction nonce" error (#8813).

  • Added unit tests for eth_call and eth_estimateGas to verify invalid nonces are ignored.
  • Changed BlockchainBridge.CallAndRestore to unconditionally override the transaction nonce with the state reader’s nonce.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Nethermind/Nethermind.JsonRpc.Test/Modules/Eth/EthRpcModuleTests.EthCall.cs Added Eth_call_ignores_invalid_nonce test to verify eth_call ignores invalid nonce.
src/Nethermind/Nethermind.JsonRpc.Test/Modules/Eth/EthRpcModuleTests.EstimateGas.cs Added Eth_estimateGas_ignores_invalid_nonce test to verify eth_estimateGas ignores invalid nonce.
src/Nethermind/Nethermind.Facade/BlockchainBridge.cs Removed conditional nonce check in CallAndRestore, now always uses state reader’s nonce.
Comments suppressed due to low confidence (2)

src/Nethermind/Nethermind.Facade/BlockchainBridge.cs:255

  • [nitpick] This comment is vague; consider elaborating why nonce is ignored (e.g., reference issue #8813) and specify it applies only to eth_call and eth_estimateGas methods.
            //Ignore nonce on all CallAndRestore calls

src/Nethermind/Nethermind.Facade/BlockchainBridge.cs:256

  • [nitpick] Since the method is named CallAndRestore, consider capturing the original nonce before overwriting and restoring it after execution to preserve the caller’s transaction state.
            transaction.Nonce = components.StateReader.GetNonce(stateRoot, transaction.SenderAddress);

await TestEthCallOutOfGas(ctx, 300000000, 50000000);
}

[Test]

Copilot AI Jul 1, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The setup logic for ignoring invalid nonces in eth_call and eth_estimateGas tests is duplicated; consider extracting a shared helper to reduce repetition.

Copilot uses AI. Check for mistakes.
@emlautarom1

Copy link
Copy Markdown
Contributor

Erigon also does not check the nonce for eth_estimateGas (see: erigontech/erigon#8583 (comment))

@ak88 ak88 merged commit b448db4 into master Jul 1, 2025
134 of 137 checks passed
@ak88 ak88 deleted the fix/no-nonce-check branch July 1, 2025 19:47
@ak88 ak88 mentioned this pull request Jul 9, 2025
8 tasks
stdevMac pushed a commit that referenced this pull request Jul 31, 2025
* set nonce to current, ignoring all nonce check on CallAndRestore

* module tests for ignoring rpc calls

* comment
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.

eth_call discrepancies with Geth

4 participants