From 6ef1d6eb449ee1dc1d7d10d50990de7da55561ee Mon Sep 17 00:00:00 2001 From: amaechiokolobi <168412367+amaechiokolobi@users.noreply.github.com> Date: Sat, 17 Aug 2024 01:09:27 +0100 Subject: [PATCH] (SHIP-2626) added custom error handling for Treasure (#13981) * added custom error handling for Treasure * added changeset * fix * fixed test * moved Treasure error to Fatal * added treasure fatal * fixed changeset * add changeset * removed extra changeset * added fatal error case test * changeset fix * removed unsed fatal errors --- .changeset/strong-dogs-smash.md | 5 +++++ core/chains/evm/client/errors.go | 8 +++++++- core/chains/evm/client/errors_test.go | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .changeset/strong-dogs-smash.md diff --git a/.changeset/strong-dogs-smash.md b/.changeset/strong-dogs-smash.md new file mode 100644 index 00000000000..a34a418e65d --- /dev/null +++ b/.changeset/strong-dogs-smash.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +error handling for Treasure #added \ No newline at end of file diff --git a/core/chains/evm/client/errors.go b/core/chains/evm/client/errors.go index e7fff8d0dbc..5980b0dd963 100644 --- a/core/chains/evm/client/errors.go +++ b/core/chains/evm/client/errors.go @@ -161,6 +161,12 @@ var arbitrum = ClientErrors{ ServiceUnavailable: regexp.MustCompile(`(: |^)502 Bad Gateway: [\s\S]*$|network is unreachable|i/o timeout`), } +// Treasure +var treasureFatal = regexp.MustCompile(`(: |^)invalid chain id for signer(:|$)`) +var treasure = ClientErrors{ + Fatal: treasureFatal, +} + var celo = ClientErrors{ TxFeeExceedsCap: regexp.MustCompile(`(: |^)tx fee \([0-9\.]+ of currency celo\) exceeds the configured cap \([0-9\.]+ [a-zA-Z]+\)$`), TerminallyUnderpriced: regexp.MustCompile(`(: |^)gasprice is less than gas price minimum floor`), @@ -270,7 +276,7 @@ var internal = ClientErrors{ TerminallyStuck: regexp.MustCompile(TerminallyStuckMsg), } -var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, mantle, aStar, gnosis, internal} +var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, treasure, mantle, aStar, gnosis, internal} // ClientErrorRegexes returns a map of compiled regexes for each error type func ClientErrorRegexes(errsRegex config.ClientErrors) *ClientErrors { diff --git a/core/chains/evm/client/errors_test.go b/core/chains/evm/client/errors_test.go index 32a1ba2bf32..095e291f5e9 100644 --- a/core/chains/evm/client/errors_test.go +++ b/core/chains/evm/client/errors_test.go @@ -405,6 +405,7 @@ func Test_Eth_Errors_Fatal(t *testing.T) { {"failed to forward tx to sequencer, please try again. Error message: 'invalid sender'", true, "Mantle"}, {"client error fatal", true, "tomlConfig"}, + {"invalid chain id for signer", true, "Treasure"}, } for _, test := range tests {