Skip to content

Commit

Permalink
Extend Nethermind error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dimriou committed Nov 30, 2022
1 parent 841431f commit b59bc07
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/chains/evm/client/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,16 @@ var klaytn = ClientErrors{
// Nethermind
// All errors: https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Nethermind.TxPool/AcceptTxResult.cs
// All filters: https://github.com/NethermindEth/nethermind/tree/9b68ec048c65f4b44fb863164c0dec3f7780d820/src/Nethermind/Nethermind.TxPool/Filters
var nethermindFatal = regexp.MustCompile(`(: |^)(SenderIsContract|Invalid|Int256Overflow|FailedToResolveSender|GasLimitExceeded)$`)
var nethermindFatal = regexp.MustCompile(`(: |^)(SenderIsContract|Invalid(, transaction Hash is null)?|Int256Overflow|FailedToResolveSender|GasLimitExceeded(, Gas limit: \d+, gas limit of rejected tx: \d+)?|NonceGap(, Future nonce. Expected nonce: \d+)?)$`)
var nethermind = ClientErrors{
// OldNonce: The EOA (externally owned account) that signed this transaction (sender) has already signed and executed a transaction with the same nonce.
NonceTooLow: regexp.MustCompile(`(: |^)OldNonce$`),
NonceTooLow: regexp.MustCompile(`(: |^)OldNonce(, Current nonce: \d+, nonce of rejected tx: \d+)?$`),

// FeeTooLow/FeeTooLowToCompete: Fee paid by this transaction is not enough to be accepted in the mempool.
TerminallyUnderpriced: regexp.MustCompile(`(: |^)(FeeTooLow|FeeTooLowToCompete)$`),
TerminallyUnderpriced: regexp.MustCompile(`(: |^)(FeeTooLow(, MaxFeePerGas too low. MaxFeePerGas: \d+, BaseFee: \d+, MaxPriorityFeePerGas:\d+, Block number: \d+|` +
`, EffectivePriorityFeePerGas too low \d+ < \d+, BaseFee: \d+|` +
`, FeePerGas needs to be higher than \d+ to be added to the TxPool. Affordable FeePerGas of rejected tx: \d+.)?|` +
`FeeTooLowToCompete)$`),

// AlreadyKnown: A transaction with the same hash has already been added to the pool in the past.
// OwnNonceAlreadyUsed: A transaction with same nonce has been signed locally already and is awaiting in the pool.
Expand Down
8 changes: 8 additions & 0 deletions core/chains/evm/client/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func Test_Eth_Errors(t *testing.T) {
{"invalid transaction: nonce too low", true, "Optimism"},
{"call failed: nonce too low: address 0x0499BEA33347cb62D79A9C0b1EDA01d8d329894c current nonce (5833) > tx nonce (5511)", true, "Avalanche"},
{"call failed: OldNonce", true, "Nethermind"},
{"call failed: OldNonce, Current nonce: 22, nonce of rejected tx: 17", true, "Nethermind"},
}

for _, test := range tests {
Expand Down Expand Up @@ -128,6 +129,9 @@ func Test_Eth_Errors(t *testing.T) {
{"Transaction gas price is too low. It does not satisfy your node's minimal gas price (minimal: 100 got: 50). Try increasing the gas price.", true, "Parity"},
{"gas price too low", true, "Arbitrum"},
{"FeeTooLow", true, "Nethermind"},
{"FeeTooLow, MaxFeePerGas too low. MaxFeePerGas: 50, BaseFee: 100, MaxPriorityFeePerGas:200, Block number: 5", true, "Nethermind"},
{"FeeTooLow, EffectivePriorityFeePerGas too low 10 < 20, BaseFee: 30", true, "Nethermind"},
{"FeeTooLow, FeePerGas needs to be higher than 100 to be added to the TxPool. Affordable FeePerGas of rejected tx: 50.", true, "Nethermind"},
{"FeeTooLowToCompete", true, "Nethermind"},
{"transaction underpriced", true, "Klaytn"},
{"intrinsic gas too low", true, "Klaytn"},
Expand Down Expand Up @@ -307,9 +311,13 @@ func Test_Eth_Errors_Fatal(t *testing.T) {

{"call failed: SenderIsContract", true, "Nethermind"},
{"call failed: Invalid", true, "Nethermind"},
{"call failed: Invalid, transaction Hash is null", true, "Nethermind"},
{"call failed: Int256Overflow", true, "Nethermind"},
{"call failed: FailedToResolveSender", true, "Nethermind"},
{"call failed: GasLimitExceeded", true, "Nethermind"},
{"call failed: GasLimitExceeded, Gas limit: 100, gas limit of rejected tx: 150", true, "Nethermind"},
{"call failed: NonceGap", true, "Nethermind"},
{"call failed: NonceGap, Future nonce. Expected nonce: 10", true, "Nethermind"},

{"invalid shard", true, "Harmony"},
{"`to` address of transaction in blacklist", true, "Harmony"},
Expand Down

0 comments on commit b59bc07

Please sign in to comment.