Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull in geth changes to parse ABI errors #2121

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go-ethereum
8 changes: 2 additions & 6 deletions precompiles/precompile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions system_tests/precompile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package arbtest

import (
"context"
"fmt"
"math/big"
"testing"

Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
3 changes: 2 additions & 1 deletion system_tests/retryable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Expand Down
Loading