-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1955 from OffchainLabs/execution-reverted-case
Match against "execution reverted" case insensitive
- Loading branch information
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package staker | ||
|
||
import ( | ||
"io" | ||
"testing" | ||
) | ||
|
||
func TestExecutionRevertedRegexp(t *testing.T) { | ||
executionRevertedErrors := []string{ | ||
// go-ethereum and most other execution clients return "execution reverted" | ||
"execution reverted", | ||
// execution clients may decode the EVM revert data as a string and include it in the error | ||
"execution reverted: FOO", | ||
// besu returns "Execution reverted" | ||
"Execution reverted", | ||
} | ||
for _, errString := range executionRevertedErrors { | ||
if !executionRevertedRegexp.MatchString(errString) { | ||
t.Fatalf("execution reverted regexp didn't match %q", errString) | ||
} | ||
} | ||
// This regexp should not match random IO errors | ||
if executionRevertedRegexp.MatchString(io.ErrUnexpectedEOF.Error()) { | ||
t.Fatal("execution reverted regexp matched unexpected EOF") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters