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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,16 @@ protected virtual TransactionResult BuyGas(Transaction tx, BlockHeader header, I

protected virtual TransactionResult IncrementNonce(Transaction tx, BlockHeader header, IReleaseSpec spec, ITxTracer tracer, ExecutionOptions opts)
{
if (tx.Nonce != WorldState.GetNonce(tx.SenderAddress!))
UInt256 stateNonce = WorldState.GetNonce(tx.SenderAddress!);
if (tx.Nonce > stateNonce)
{
TraceLogInvalidTx(tx, $"WRONG_TRANSACTION_NONCE: {tx.Nonce} (expected {WorldState.GetNonce(tx.SenderAddress)})");
return TransactionResult.WrongTransactionNonce;
return TransactionResult.TransactionNonceTooHigh(tx, stateNonce);
}
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

return TransactionResult.TransactionNonceTooLow(tx, stateNonce);
}

WorldState.IncrementNonce(tx.SenderAddress);
Expand Down Expand Up @@ -824,6 +830,7 @@ public readonly struct TransactionResult(string? error) : IEquatable<Transaction
public static readonly TransactionResult SenderHasDeployedCode = "sender has deployed code";
public static readonly TransactionResult SenderNotSpecified = "sender not specified";
public static readonly TransactionResult TransactionSizeOverMaxInitCodeSize = "EIP-3860 - transaction size over max init code size";
public static readonly TransactionResult WrongTransactionNonce = "wrong transaction nonce";
public static TransactionResult TransactionNonceTooHigh(Transaction tx, UInt256 stNonce) => $"err: nonce too high: address {tx.SenderAddress}, tx: {tx.Nonce} state: {stNonce} (supplied gas {tx.GasLimit})";
public static TransactionResult TransactionNonceTooLow(Transaction tx, UInt256 stNonce) => $"err: nonce too high: address {tx.SenderAddress}, tx: {tx.Nonce} state: {stNonce} (supplied gas {tx.GasLimit})";
}
}
Loading