Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion pkg/client/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,20 @@ var jovay = ClientErrors{
NonceTooLow: regexp.MustCompile(`TX_REPLAY_ATTACK`), // Jovay returns for nonce-too-low (already-confirmed nonce)
}

var cronos = ClientErrors{
NonceTooLow: regexp.MustCompile(`invalid nonce; got \d+, expected \d+`),
TransactionAlreadyInMempool: regexp.MustCompile(`tx already in mempool`),
ServiceUnavailable: regexp.MustCompile(`eth_sendRawTransaction does not exist/is not available`),
}

const TerminallyStuckMsg = "transaction terminally stuck"

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

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}
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}

// ClientErrorRegexes returns a map of compiled regexes for each error type
func ClientErrorRegexes(errsRegex config.ClientErrors) *ClientErrors {
Expand Down
3 changes: 3 additions & 0 deletions pkg/client/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func Test_Eth_Errors(t *testing.T) {
{"[Request ID: 2e952947-ffad-408b-aed9-35f3ed152001] Nonce too low. Provided nonce: 15, current nonce: 15", true, "hedera"},
{"failed to forward tx to sequencer, please try again. Error message: 'nonce too low'", true, "Mantle"},
{"RPC call failed: TX_REPLAY_ATTACK", true, "Jovay"},
{"invalid nonce; got 3135, expected 3136: invalid sequence: invalid sequence", true, "Cronos"},
}

for _, test := range tests {
Expand Down Expand Up @@ -150,6 +151,7 @@ func Test_Eth_Errors(t *testing.T) {
{"tx already exists in cache", true, "Sei"},
{"failed to forward tx to sequencer, please try again. Error message: 'already known'", true, "Mantle"},
{"tx already exists in cache", true, "Sei"},
{"tx already in mempool", true, "Cronos"},
}
for _, test := range tests {
err = evmclient.NewSendErrorS(test.message)
Expand Down Expand Up @@ -254,6 +256,7 @@ func Test_Eth_Errors(t *testing.T) {
{"client error service unavailable", true, "tomlConfig"},
{"[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"},
{"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"},
{"RPC call failed: The method eth_sendRawTransaction does not exist/is not available", true, "Cronos"},
}
for _, test := range tests {
err = evmclient.NewSendErrorS(test.message)
Expand Down
Loading