Skip to content

Commit

Permalink
core/chains/evm/client: Arbitrum Nitro errors (#7237)
Browse files Browse the repository at this point in the history
cherry picked from commit e6a4e56
  • Loading branch information
jmank88 authored Aug 16, 2022
1 parent 8797335 commit 6537a63
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/chains/evm/client/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,15 @@ var besu = ClientErrors{

// Arbitrum
// https://github.com/OffchainLabs/arbitrum/blob/cac30586bc10ecc1ae73e93de517c90984677fdb/packages/arb-evm/evm/result.go#L158
var arbitrumFatal = regexp.MustCompile(`(: |^)(invalid message format|forbidden sender address|execution reverted: error code)$`)
// nitro: https://github.com/OffchainLabs/go-ethereum/blob/master/core/state_transition.go
var arbitrumFatal = regexp.MustCompile(`(: |^)(invalid message format|forbidden sender address|execution reverted(: error code)?)$|(: |^)nonce too high(:|$)`)
var arbitrum = ClientErrors{
// TODO: Arbitrum returns this in case of low or high nonce. Update this when Arbitrum fix it
// https://app.shortcut.com/chainlinklabs/story/16801/add-full-support-for-incorrect-nonce-on-arbitrum
NonceTooLow: regexp.MustCompile(`(: |^)invalid transaction nonce$`),
NonceTooLow: regexp.MustCompile(`(: |^)invalid transaction nonce$|(: |^)nonce too low(:|$)`),
// TODO: Is it terminally or replacement?
TerminallyUnderpriced: regexp.MustCompile(`(: |^)gas price too low$`),
InsufficientEth: regexp.MustCompile(`(: |^)not enough funds for gas`),
InsufficientEth: regexp.MustCompile(`(: |^)(not enough funds for gas|insufficient funds for gas \* price \+ value)`),
Fatal: arbitrumFatal,
}

Expand Down
4 changes: 4 additions & 0 deletions core/chains/evm/client/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func Test_Eth_Errors(t *testing.T) {

tests := []errorCase{
{"nonce too low", true, "Geth"},
{"nonce too low: address 0x336394A3219e71D9d9bd18201d34E95C1Bb7122C, tx: 8089 state: 8090", true, "Arbitrum"},
{"Nonce too low", true, "Besu"},
{"Transaction nonce is too low. Try incrementing the nonce.", true, "Parity"},
{"transaction rejected: nonce too low", true, "Arbitrum"},
Expand Down Expand Up @@ -156,6 +157,7 @@ func Test_Eth_Errors(t *testing.T) {
{"Insufficient funds. The account you tried to send transaction from does not have enough funds. Required 200.50 and got: 100.25.", true, "Parity"},
{"transaction rejected: insufficient funds for gas * price + value", true, "Arbitrum"},
{"not enough funds for gas", true, "Arbitrum"},
{"insufficient funds for gas * price + value: address 0xb68D832c1241bc50db1CF09e96c0F4201D5539C9 have 9934612900000000 want 9936662900000000", true, "Arbitrum"},
{"invalid transaction: insufficient funds for gas * price + value", true, "Optimism"},
{"call failed: InsufficientFunds", true, "Nethermind"},
}
Expand Down Expand Up @@ -269,6 +271,8 @@ func Test_Eth_Errors_Fatal(t *testing.T) {
{"forbidden sender address", true, "Arbitrum"},
{"tx dropped due to L2 congestion", false, "Arbitrum"},
{"execution reverted: error code", true, "Arbitrum"},
{"execution reverted", true, "Arbitrum"},
{"nonce too high: address 0x336394A3219e71D9d9bd18201d34E95C1Bb7122C, tx: 8089 state: 8090", true, "Arbitrum"},

{"call failed: SenderIsContract", true, "Nethermind"},
{"call failed: Invalid", true, "Nethermind"},
Expand Down
6 changes: 6 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Arbitrum` chains are no longer restricted to only `FixedPrice` `GAS_ESTIMATOR_MODE`
- Updated `Arbitrum Rinkeby` configuration for Nitro

## 1.7.1 - Unreleased

### Added

- `Arbitrum Nitro` client error support

## 1.7.0 - 2022-08-08

### Added
Expand Down

0 comments on commit 6537a63

Please sign in to comment.