From 53bd9c3b590a3be3211b6345c1c741b20d67ef01 Mon Sep 17 00:00:00 2001 From: amaechiokolobi <168412367+amaechiokolobi@users.noreply.github.com> Date: Wed, 31 Jul 2024 22:08:14 +0300 Subject: [PATCH 01/12] added custom error handling for Treasure --- core/chains/evm/client/errors.go | 20 ++++++++++++++++++++ core/chains/evm/client/errors_test.go | 15 +++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/core/chains/evm/client/errors.go b/core/chains/evm/client/errors.go index 22fac5f7287..1e0740d41c6 100644 --- a/core/chains/evm/client/errors.go +++ b/core/chains/evm/client/errors.go @@ -62,6 +62,7 @@ const ( Fatal ServiceUnavailable TerminallyStuck + InvalidSender ) type ClientErrors map[int]*regexp.Regexp @@ -161,6 +162,21 @@ var arbitrum = ClientErrors{ ServiceUnavailable: regexp.MustCompile(`(: |^)502 Bad Gateway: [\s\S]*$`), } +// Treasure +// Derived from Arbitrum config due to similar behaviour +var treasureFatal = regexp.MustCompile(`(: |^)(invalid message format|forbidden sender address)$|(: |^)(execution reverted)(:|$)`) +var treasure = ClientErrors{ + NonceTooLow: regexp.MustCompile(`(: |^)invalid transaction nonce$|(: |^)nonce too low(:|$)`), + NonceTooHigh: regexp.MustCompile(`(: |^)nonce too high(:|$)`), + TerminallyUnderpriced: regexp.MustCompile(`(: |^)gas price too low$`), + InsufficientEth: regexp.MustCompile(`(: |^)(not enough funds for gas|insufficient funds for gas \* price \+ value)`), + Fatal: arbitrumFatal, + L2FeeTooLow: regexp.MustCompile(`(: |^)max fee per gas less than block base fee(:|$)`), + L2Full: regexp.MustCompile(`(: |^)(queue full|sequencer pending tx pool full, please try again)(:|$)`), + ServiceUnavailable: regexp.MustCompile(`(: |^)502 Bad Gateway: [\s\S]*$`), + InvalidSender: regexp.MustCompile(`(: |^)invalid chain id for signer(:|$)`), +} + 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`), @@ -333,6 +349,10 @@ func (s *SendError) IsInsufficientEth(configErrors *ClientErrors) bool { return s.is(InsufficientEth, configErrors) } +func (s *SendError) IsInvalidSenderError(configErrors *ClientErrors) bool { + return s.is(InvalidSender, configErrors) +} + // IsTxFeeExceedsCap returns true if the transaction and gas price are combined in // some way that makes the total transaction too expensive for the eth node to // accept at all. No amount of retrying at this or higher gas prices can ever diff --git a/core/chains/evm/client/errors_test.go b/core/chains/evm/client/errors_test.go index cca54c2a4a9..9ce9c56fe05 100644 --- a/core/chains/evm/client/errors_test.go +++ b/core/chains/evm/client/errors_test.go @@ -56,6 +56,21 @@ func Test_Eth_Errors(t *testing.T) { } }) + t.Run("IsInvalidSender", func(t *testing.T) { + tests := []errorCase{ + {"invalid chain id for signer", true, "Treasure"}, + } + + for _, test := range tests { + t.Run(test.network, func(t *testing.T) { + err = evmclient.NewSendErrorS(test.message) + assert.Equal(t, err.IsInvalidSenderError(clientErrors), test.expect) + err = newSendErrorWrapped(test.message) + assert.Equal(t, err.IsNonceTooHighError(clientErrors), test.expect) + }) + } + }) + t.Run("IsNonceTooHigh", func(t *testing.T) { tests := []errorCase{ {"call failed: NonceGap", true, "Nethermind"}, From d241e5506508840c41fcd8ac5b25ce4df64b502f Mon Sep 17 00:00:00 2001 From: amaechiokolobi <168412367+amaechiokolobi@users.noreply.github.com> Date: Wed, 31 Jul 2024 23:42:58 +0300 Subject: [PATCH 02/12] added changeset --- .changeset/strong-dogs-smash.md | 5 +++++ 1 file changed, 5 insertions(+) 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..278b28f470d --- /dev/null +++ b/.changeset/strong-dogs-smash.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +feat: added error handling for Treasure From 153a6b16cf98ad2f3d0de807cf64e1f987efb5a8 Mon Sep 17 00:00:00 2001 From: amaechiokolobi <168412367+amaechiokolobi@users.noreply.github.com> Date: Thu, 1 Aug 2024 00:52:55 +0300 Subject: [PATCH 03/12] fix --- core/chains/evm/client/errors.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/chains/evm/client/errors.go b/core/chains/evm/client/errors.go index 1e0740d41c6..583afd19089 100644 --- a/core/chains/evm/client/errors.go +++ b/core/chains/evm/client/errors.go @@ -170,7 +170,7 @@ var treasure = ClientErrors{ NonceTooHigh: regexp.MustCompile(`(: |^)nonce too high(:|$)`), TerminallyUnderpriced: regexp.MustCompile(`(: |^)gas price too low$`), InsufficientEth: regexp.MustCompile(`(: |^)(not enough funds for gas|insufficient funds for gas \* price \+ value)`), - Fatal: arbitrumFatal, + Fatal: treasureFatal, L2FeeTooLow: regexp.MustCompile(`(: |^)max fee per gas less than block base fee(:|$)`), L2Full: regexp.MustCompile(`(: |^)(queue full|sequencer pending tx pool full, please try again)(:|$)`), ServiceUnavailable: regexp.MustCompile(`(: |^)502 Bad Gateway: [\s\S]*$`), @@ -273,7 +273,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, internal} +var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, internal, treasure} // ClientErrorRegexes returns a map of compiled regexes for each error type func ClientErrorRegexes(errsRegex config.ClientErrors) *ClientErrors { From a5d3319daa8a9cf6618ffd3ca843e27f61374fb9 Mon Sep 17 00:00:00 2001 From: amaechiokolobi <168412367+amaechiokolobi@users.noreply.github.com> Date: Thu, 1 Aug 2024 14:05:36 +0300 Subject: [PATCH 04/12] fixed test --- core/chains/evm/client/errors_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/chains/evm/client/errors_test.go b/core/chains/evm/client/errors_test.go index 9ce9c56fe05..ab7dd33befe 100644 --- a/core/chains/evm/client/errors_test.go +++ b/core/chains/evm/client/errors_test.go @@ -66,7 +66,7 @@ func Test_Eth_Errors(t *testing.T) { err = evmclient.NewSendErrorS(test.message) assert.Equal(t, err.IsInvalidSenderError(clientErrors), test.expect) err = newSendErrorWrapped(test.message) - assert.Equal(t, err.IsNonceTooHighError(clientErrors), test.expect) + assert.Equal(t, err.IsInvalidSenderError(clientErrors), test.expect) }) } }) From a3788a3f05dd81ef8e6180cec14873fca26e73bf Mon Sep 17 00:00:00 2001 From: amaechiokolobi <168412367+amaechiokolobi@users.noreply.github.com> Date: Wed, 7 Aug 2024 10:47:56 +0100 Subject: [PATCH 05/12] moved Treasure error to Fatal --- core/chains/evm/client/errors.go | 20 ++------------------ core/chains/evm/client/errors_test.go | 15 --------------- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/core/chains/evm/client/errors.go b/core/chains/evm/client/errors.go index 583afd19089..b0af957c8d7 100644 --- a/core/chains/evm/client/errors.go +++ b/core/chains/evm/client/errors.go @@ -62,7 +62,6 @@ const ( Fatal ServiceUnavailable TerminallyStuck - InvalidSender ) type ClientErrors map[int]*regexp.Regexp @@ -164,18 +163,7 @@ var arbitrum = ClientErrors{ // Treasure // Derived from Arbitrum config due to similar behaviour -var treasureFatal = regexp.MustCompile(`(: |^)(invalid message format|forbidden sender address)$|(: |^)(execution reverted)(:|$)`) -var treasure = ClientErrors{ - NonceTooLow: regexp.MustCompile(`(: |^)invalid transaction nonce$|(: |^)nonce too low(:|$)`), - NonceTooHigh: regexp.MustCompile(`(: |^)nonce too high(:|$)`), - TerminallyUnderpriced: regexp.MustCompile(`(: |^)gas price too low$`), - InsufficientEth: regexp.MustCompile(`(: |^)(not enough funds for gas|insufficient funds for gas \* price \+ value)`), - Fatal: treasureFatal, - L2FeeTooLow: regexp.MustCompile(`(: |^)max fee per gas less than block base fee(:|$)`), - L2Full: regexp.MustCompile(`(: |^)(queue full|sequencer pending tx pool full, please try again)(:|$)`), - ServiceUnavailable: regexp.MustCompile(`(: |^)502 Bad Gateway: [\s\S]*$`), - InvalidSender: regexp.MustCompile(`(: |^)invalid chain id for signer(:|$)`), -} +var treasureFatal = regexp.MustCompile(`((: |^)(invalid message format|forbidden sender address)$|(: |^)(execution reverted)(:|$)|(: |^)invalid chain id for signer(:|$))`) var celo = ClientErrors{ TxFeeExceedsCap: regexp.MustCompile(`(: |^)tx fee \([0-9\.]+ of currency celo\) exceeds the configured cap \([0-9\.]+ [a-zA-Z]+\)$`), @@ -273,7 +261,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, internal, treasure} +var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, internal} // ClientErrorRegexes returns a map of compiled regexes for each error type func ClientErrorRegexes(errsRegex config.ClientErrors) *ClientErrors { @@ -349,10 +337,6 @@ func (s *SendError) IsInsufficientEth(configErrors *ClientErrors) bool { return s.is(InsufficientEth, configErrors) } -func (s *SendError) IsInvalidSenderError(configErrors *ClientErrors) bool { - return s.is(InvalidSender, configErrors) -} - // IsTxFeeExceedsCap returns true if the transaction and gas price are combined in // some way that makes the total transaction too expensive for the eth node to // accept at all. No amount of retrying at this or higher gas prices can ever diff --git a/core/chains/evm/client/errors_test.go b/core/chains/evm/client/errors_test.go index ab7dd33befe..cca54c2a4a9 100644 --- a/core/chains/evm/client/errors_test.go +++ b/core/chains/evm/client/errors_test.go @@ -56,21 +56,6 @@ func Test_Eth_Errors(t *testing.T) { } }) - t.Run("IsInvalidSender", func(t *testing.T) { - tests := []errorCase{ - {"invalid chain id for signer", true, "Treasure"}, - } - - for _, test := range tests { - t.Run(test.network, func(t *testing.T) { - err = evmclient.NewSendErrorS(test.message) - assert.Equal(t, err.IsInvalidSenderError(clientErrors), test.expect) - err = newSendErrorWrapped(test.message) - assert.Equal(t, err.IsInvalidSenderError(clientErrors), test.expect) - }) - } - }) - t.Run("IsNonceTooHigh", func(t *testing.T) { tests := []errorCase{ {"call failed: NonceGap", true, "Nethermind"}, From 39af08775f038f4ffffcf63f1f36dfc27f3bdf6b Mon Sep 17 00:00:00 2001 From: amaechiokolobi <168412367+amaechiokolobi@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:00:53 +0100 Subject: [PATCH 06/12] added treasure fatal --- core/chains/evm/client/errors.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/chains/evm/client/errors.go b/core/chains/evm/client/errors.go index b0af957c8d7..4b726d89f18 100644 --- a/core/chains/evm/client/errors.go +++ b/core/chains/evm/client/errors.go @@ -164,6 +164,9 @@ var arbitrum = ClientErrors{ // Treasure // Derived from Arbitrum config due to similar behaviour var treasureFatal = regexp.MustCompile(`((: |^)(invalid message format|forbidden sender address)$|(: |^)(execution reverted)(:|$)|(: |^)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]+\)$`), @@ -261,7 +264,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, internal} +var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, internal, treasure} // ClientErrorRegexes returns a map of compiled regexes for each error type func ClientErrorRegexes(errsRegex config.ClientErrors) *ClientErrors { From 4b86126e68301f69dff07b149fbe13342e2d8a95 Mon Sep 17 00:00:00 2001 From: amaechiokolobi <168412367+amaechiokolobi@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:22:05 +0100 Subject: [PATCH 07/12] fixed changeset --- .changeset/strong-dogs-smash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/strong-dogs-smash.md b/.changeset/strong-dogs-smash.md index 278b28f470d..fcdbae9974c 100644 --- a/.changeset/strong-dogs-smash.md +++ b/.changeset/strong-dogs-smash.md @@ -2,4 +2,4 @@ "chainlink": minor --- -feat: added error handling for Treasure +#added error handling for Treasure \ No newline at end of file From 910364080fb1f90fcdfc9b76b525a2524d99a8ed Mon Sep 17 00:00:00 2001 From: amaechiokolobi <168412367+amaechiokolobi@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:40:17 +0100 Subject: [PATCH 08/12] add changeset --- .changeset/quiet-pants-lick.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/quiet-pants-lick.md diff --git a/.changeset/quiet-pants-lick.md b/.changeset/quiet-pants-lick.md new file mode 100644 index 00000000000..bde16bbcb7d --- /dev/null +++ b/.changeset/quiet-pants-lick.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +#add treasure ruby fatal error From b58e808ca163fc45911be93bf9d94edafdda4efb Mon Sep 17 00:00:00 2001 From: amaechiokolobi <168412367+amaechiokolobi@users.noreply.github.com> Date: Thu, 8 Aug 2024 13:07:20 +0100 Subject: [PATCH 09/12] removed extra changeset --- .changeset/quiet-pants-lick.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .changeset/quiet-pants-lick.md diff --git a/.changeset/quiet-pants-lick.md b/.changeset/quiet-pants-lick.md deleted file mode 100644 index bde16bbcb7d..00000000000 --- a/.changeset/quiet-pants-lick.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -#add treasure ruby fatal error From b73c8ea77be160735f557309dbea14cc397d18c2 Mon Sep 17 00:00:00 2001 From: amaechiokolobi <168412367+amaechiokolobi@users.noreply.github.com> Date: Fri, 16 Aug 2024 19:49:40 +0100 Subject: [PATCH 10/12] added fatal error case test --- core/chains/evm/client/errors_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/chains/evm/client/errors_test.go b/core/chains/evm/client/errors_test.go index 72fa1347ec0..dd8daaa4b90 100644 --- a/core/chains/evm/client/errors_test.go +++ b/core/chains/evm/client/errors_test.go @@ -384,6 +384,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 { From 381c675b61daaa9404cda7c4b4969e8b0fb58639 Mon Sep 17 00:00:00 2001 From: amaechiokolobi <168412367+amaechiokolobi@users.noreply.github.com> Date: Fri, 16 Aug 2024 20:28:04 +0100 Subject: [PATCH 11/12] changeset fix --- .changeset/strong-dogs-smash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/strong-dogs-smash.md b/.changeset/strong-dogs-smash.md index fcdbae9974c..a34a418e65d 100644 --- a/.changeset/strong-dogs-smash.md +++ b/.changeset/strong-dogs-smash.md @@ -2,4 +2,4 @@ "chainlink": minor --- -#added error handling for Treasure \ No newline at end of file +error handling for Treasure #added \ No newline at end of file From de678777ed2f4141b6b14518e34a122f49f74e07 Mon Sep 17 00:00:00 2001 From: amaechiokolobi <168412367+amaechiokolobi@users.noreply.github.com> Date: Fri, 16 Aug 2024 20:35:33 +0100 Subject: [PATCH 12/12] removed unsed fatal errors --- core/chains/evm/client/errors.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/chains/evm/client/errors.go b/core/chains/evm/client/errors.go index dc9c436db8d..5980b0dd963 100644 --- a/core/chains/evm/client/errors.go +++ b/core/chains/evm/client/errors.go @@ -162,8 +162,7 @@ var arbitrum = ClientErrors{ } // Treasure -// Derived from Arbitrum config due to similar behaviour -var treasureFatal = regexp.MustCompile(`((: |^)(invalid message format|forbidden sender address)$|(: |^)(execution reverted)(:|$)|(: |^)invalid chain id for signer(:|$))`) +var treasureFatal = regexp.MustCompile(`(: |^)invalid chain id for signer(:|$)`) var treasure = ClientErrors{ Fatal: treasureFatal, }