From 25de9e332461d92a9308b772603276e494caa3be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedemann=20F=C3=BCrst?= <59653747+friedemannf@users.noreply.github.com> Date: Tue, 26 Mar 2024 20:01:13 +0100 Subject: [PATCH] Handle zkSync "known transaction" error (SHIP-1233) (#12338) * Handle zkSync "known transaction" error (SHIP-1233) * add test case for zkSync specific known transaction error --------- Co-authored-by: Jim W Co-authored-by: Prashant Yadav <34992934+prashantkumar1982@users.noreply.github.com> --- .changeset/tiny-rabbits-crave.md | 5 +++++ core/chains/evm/client/errors.go | 3 ++- core/chains/evm/client/errors_test.go | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/tiny-rabbits-crave.md diff --git a/.changeset/tiny-rabbits-crave.md b/.changeset/tiny-rabbits-crave.md new file mode 100644 index 00000000000..55b6f71c523 --- /dev/null +++ b/.changeset/tiny-rabbits-crave.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +Handle zkSync specific known transaction error diff --git a/core/chains/evm/client/errors.go b/core/chains/evm/client/errors.go index 8095c122508..e58d3998927 100644 --- a/core/chains/evm/client/errors.go +++ b/core/chains/evm/client/errors.go @@ -224,7 +224,8 @@ var zkSync = ClientErrors{ // can't start a transaction from a non-account - trying to send from an invalid address, e.g. estimating a contract -> contract tx // max fee per gas higher than 2^64-1 - uint64 overflow // oversized data - data too large - Fatal: regexp.MustCompile(`(?:: |^)(?:exceeds block gas limit|intrinsic gas too low|Not enough gas for transaction validation|Failed to pay the fee to the operator|Error function_selector = 0x, data = 0x|invalid sender. can't start a transaction from a non-account|max(?: priority)? fee per (?:gas|pubdata byte) higher than 2\^64-1|oversized data. max: \d+; actual: \d+)$`), + Fatal: regexp.MustCompile(`(?:: |^)(?:exceeds block gas limit|intrinsic gas too low|Not enough gas for transaction validation|Failed to pay the fee to the operator|Error function_selector = 0x, data = 0x|invalid sender. can't start a transaction from a non-account|max(?: priority)? fee per (?:gas|pubdata byte) higher than 2\^64-1|oversized data. max: \d+; actual: \d+)$`), + TransactionAlreadyInMempool: regexp.MustCompile(`known transaction. transaction with hash .* is already in the system`), } var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync} diff --git a/core/chains/evm/client/errors_test.go b/core/chains/evm/client/errors_test.go index a59d3fbf719..5d1fa135725 100644 --- a/core/chains/evm/client/errors_test.go +++ b/core/chains/evm/client/errors_test.go @@ -127,6 +127,9 @@ func Test_Eth_Errors(t *testing.T) { {"call failed: AlreadyKnown", true, "Nethermind"}, {"call failed: OwnNonceAlreadyUsed", true, "Nethermind"}, {"known transaction", true, "Klaytn"}, + {"known transaction. transaction with hash 0x6013…3053 is already in the system", true, "zkSync"}, + // This seems to be an erroneous message from the zkSync client, we'll have to match it anyway + {"ErrorObject { code: ServerError(3), message: \\\"known transaction. transaction with hash 0xf016…ad63 is already in the system\\\", data: Some(RawValue(\\\"0x\\\")) }", true, "zkSync"}, } for _, test := range tests { err = evmclient.NewSendErrorS(test.message)