From 03138e0c783fb794afc0241b81f908869fd89cd7 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Thu, 1 Feb 2024 14:28:37 -0700 Subject: [PATCH 1/2] Pull in geth changes to parse ABI errors --- go-ethereum | 2 +- precompiles/precompile.go | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/go-ethereum b/go-ethereum index 1acd9c64ac..a0685a71f3 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit 1acd9c64ac5804729475ef60aa578b4ec52fa0e6 +Subproject commit a0685a71f31c14f414c01cb5c7c91170fd0e84be diff --git a/precompiles/precompile.go b/precompiles/precompile.go index 5d2ecce745..175bb21902 100644 --- a/precompiles/precompile.go +++ b/precompiles/precompile.go @@ -96,12 +96,8 @@ func RenderSolError(solErr abi.Error, data []byte) (string, error) { if err != nil { return "", err } - valsRange, ok := vals.([]interface{}) - if !ok { - return "", errors.New("unexpected unpack result") - } - strVals := make([]string, 0, len(valsRange)) - for _, val := range valsRange { + strVals := make([]string, 0, len(vals)) + for _, val := range vals { strVals = append(strVals, fmt.Sprintf("%v", val)) } return fmt.Sprintf("error %v(%v)", solErr.Name, strings.Join(strVals, ", ")), nil From 74692529c3883e1f8341cede2f585da71323559a Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Thu, 1 Feb 2024 16:39:46 -0700 Subject: [PATCH 2/2] Fix tests --- system_tests/precompile_test.go | 8 ++++++-- system_tests/retryable_test.go | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/system_tests/precompile_test.go b/system_tests/precompile_test.go index e0a9c2ce78..0ad0f8f1e4 100644 --- a/system_tests/precompile_test.go +++ b/system_tests/precompile_test.go @@ -5,6 +5,7 @@ package arbtest import ( "context" + "fmt" "math/big" "testing" @@ -67,7 +68,9 @@ func TestCustomSolidityErrors(t *testing.T) { Fatal(t, "customRevert call should have errored") } observedMessage := customError.Error() - expectedMessage := "execution reverted: error Custom(1024, This spider family wards off bugs: /\\oo/\\ //\\(oo)/\\ /\\oo/\\, true)" + expectedError := "Custom(1024, This spider family wards off bugs: /\\oo/\\ //\\(oo)/\\ /\\oo/\\, true)" + // The first error is server side. The second error is client side ABI decoding. + expectedMessage := fmt.Sprintf("execution reverted: error %v: %v", expectedError, expectedError) if observedMessage != expectedMessage { Fatal(t, observedMessage) } @@ -79,7 +82,8 @@ func TestCustomSolidityErrors(t *testing.T) { Fatal(t, "out of range ArbBlockHash call should have errored") } observedMessage = customError.Error() - expectedMessage = "execution reverted: error InvalidBlockNumber(1000000000, 1)" + expectedError = "InvalidBlockNumber(1000000000, 1)" + expectedMessage = fmt.Sprintf("execution reverted: error %v: %v", expectedError, expectedError) if observedMessage != expectedMessage { Fatal(t, observedMessage) } diff --git a/system_tests/retryable_test.go b/system_tests/retryable_test.go index 4619671700..4e7bd2c7d8 100644 --- a/system_tests/retryable_test.go +++ b/system_tests/retryable_test.go @@ -121,7 +121,8 @@ func TestRetryableNoExist(t *testing.T) { arbRetryableTx, err := precompilesgen.NewArbRetryableTx(common.HexToAddress("6e"), builder.L2.Client) Require(t, err) _, err = arbRetryableTx.GetTimeout(&bind.CallOpts{}, common.Hash{}) - if err.Error() != "execution reverted: error NoTicketWithID()" { + // The first error is server side. The second error is client side ABI decoding. + if err.Error() != "execution reverted: error NoTicketWithID(): NoTicketWithID()" { Fatal(t, "didn't get expected NoTicketWithID error") } }