Skip to content

Commit 2f3834b

Browse files
committed
add regex for cronos errs
1 parent eead1ad commit 2f3834b

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

pkg/client/errors.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,14 +312,20 @@ var jovay = ClientErrors{
312312
NonceTooLow: regexp.MustCompile(`TX_REPLAY_ATTACK`), // Jovay returns for nonce-too-low (already-confirmed nonce)
313313
}
314314

315+
var cronos = ClientErrors{
316+
NonceTooLow: regexp.MustCompile(`invalid nonce; got \d+, expected \d+`),
317+
TransactionAlreadyInMempool: regexp.MustCompile(`tx already in mempool`),
318+
ServiceUnavailable: regexp.MustCompile(`eth_sendRawTransaction does not exist/is not available`),
319+
}
320+
315321
const TerminallyStuckMsg = "transaction terminally stuck"
316322

317323
// Tx.Error messages that are set internally so they are not chain or client specific
318324
var internal = ClientErrors{
319325
TerminallyStuck: regexp.MustCompile(TerminallyStuckMsg),
320326
}
321327

322-
var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, optimism, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, treasure, mantle, aStar, hedera, gnosis, sei, monad, jovay, internal}
328+
var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, optimism, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, treasure, mantle, aStar, hedera, gnosis, sei, monad, jovay, cronos, internal}
323329

324330
// ClientErrorRegexes returns a map of compiled regexes for each error type
325331
func ClientErrorRegexes(errsRegex config.ClientErrors) *ClientErrors {

pkg/client/errors_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func Test_Eth_Errors(t *testing.T) {
5252
{"[Request ID: 2e952947-ffad-408b-aed9-35f3ed152001] Nonce too low. Provided nonce: 15, current nonce: 15", true, "hedera"},
5353
{"failed to forward tx to sequencer, please try again. Error message: 'nonce too low'", true, "Mantle"},
5454
{"RPC call failed: TX_REPLAY_ATTACK", true, "Jovay"},
55+
{"invalid nonce; got 3135, expected 3136: invalid sequence: invalid sequence", true, "Cronos"},
5556
}
5657

5758
for _, test := range tests {
@@ -150,6 +151,7 @@ func Test_Eth_Errors(t *testing.T) {
150151
{"tx already exists in cache", true, "Sei"},
151152
{"failed to forward tx to sequencer, please try again. Error message: 'already known'", true, "Mantle"},
152153
{"tx already exists in cache", true, "Sei"},
154+
{"tx already in mempool", true, "Cronos"},
153155
}
154156
for _, test := range tests {
155157
err = evmclient.NewSendErrorS(test.message)
@@ -254,6 +256,7 @@ func Test_Eth_Errors(t *testing.T) {
254256
{"client error service unavailable", true, "tomlConfig"},
255257
{"[Request ID: 825608a8-fd8a-4b5b-aea7-92999509306d] Error invoking RPC: [Request ID: 825608a8-fd8a-4b5b-aea7-92999509306d] Transaction execution returns a null value for transaction", true, "hedera"},
256258
{"call failed: 503 Service Temporarily Unavailable: <html>\r\n<head><title>503 Service Temporarily Unavailable</title></head>\r\n<body>\r\n<center><h1>503 Service Temporarily Unavailable</h1></center>\r\n</body>\r\n</html>\r\n", true, "Arbitrum"},
259+
{"RPC call failed: The method eth_sendRawTransaction does not exist/is not available", true, "Cronos"},
257260
}
258261
for _, test := range tests {
259262
err = evmclient.NewSendErrorS(test.message)

0 commit comments

Comments
 (0)