Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit c9534e8

Browse files
authored
Merge pull request #1936 from carver/improve-nonce-error
More informative nonce error
2 parents 73cc2fb + c067107 commit c9534e8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

eth/vm/forks/frontier/validation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ def validate_frontier_transaction(state: StateAPI,
2626
if sender_balance < total_cost:
2727
raise ValidationError("Sender account balance cannot afford txn")
2828

29-
if state.get_nonce(transaction.sender) != transaction.nonce:
30-
raise ValidationError("Invalid transaction nonce")
29+
sender_nonce = state.get_nonce(transaction.sender)
30+
if sender_nonce != transaction.nonce:
31+
raise ValidationError(
32+
f"Invalid transaction nonce: Expected {sender_nonce}, but got {transaction.nonce}"
33+
)
3134

3235

3336
def validate_frontier_transaction_against_header(_vm: VirtualMachineAPI,

newsfragments/1936.internal.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve the error when transaction nonce is invalid: include expected and actual.

0 commit comments

Comments
 (0)