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

fix: handle error and revert data in EthEstimateGas and EthCall #12553

Merged
merged 27 commits into from
Oct 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
19bf92e
fix: handle error and revert data in EthEstimateGas and EthCall
virajbhartiya Oct 4, 2024
1f47508
feat: itests
virajbhartiya Oct 4, 2024
6859ee5
feat: Add EthCallError struct and tests
virajbhartiya Oct 7, 2024
61f7fe5
refactor: eth call error
akaladarshi Oct 9, 2024
619b9a5
fix: handle error and revert data in EthCall
virajbhartiya Oct 11, 2024
e53a74d
feat: Refactor EthCall to handle invalid block number
virajbhartiya Oct 11, 2024
6d69cdd
refactor: eth call error to execution reverted error
akaladarshi Oct 11, 2024
5c7bdae
address comments
akaladarshi Oct 15, 2024
d1abde9
small change
akaladarshi Oct 15, 2024
22d418a
update changelog
akaladarshi Oct 15, 2024
273cbcc
update tests
virajbhartiya Oct 15, 2024
529dd97
remove go-jsonrpc
virajbhartiya Oct 15, 2024
d8015cc
add test for ethEstimateGas and addressed changes
virajbhartiya Oct 16, 2024
cc212fe
rename error
virajbhartiya Oct 16, 2024
cad6f2b
fix lint errors
virajbhartiya Oct 16, 2024
7aec77b
refactor: execution reverted error
akaladarshi Oct 16, 2024
a092883
Merge branch 'master' into jsonrpc
akaladarshi Oct 17, 2024
0ba5a70
implement error codec interface
akaladarshi Oct 22, 2024
3206a77
fix ci tests
akaladarshi Oct 22, 2024
6a7b6c1
update go mod
akaladarshi Oct 22, 2024
762d719
address comments
akaladarshi Oct 23, 2024
a88c3fe
small fix
akaladarshi Oct 23, 2024
35519c0
Merge branch 'master' into jsonrpc
akaladarshi Oct 23, 2024
0992e7e
address comments
akaladarshi Oct 24, 2024
2264607
Update go.mod dependencies
virajbhartiya Oct 24, 2024
cd7455e
Update go-jsonrpc version to v0.7.0
virajbhartiya Oct 24, 2024
5ed6352
Merge branch 'master' into jsonrpc
rvagg Oct 25, 2024
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
Prev Previous commit
Next Next commit
update tests
virajbhartiya committed Oct 15, 2024
commit 273cbccf54b321ba8debf81d145f8aa0e6ea6092
1 change: 1 addition & 0 deletions extern/go-jsonrpc
Submodule go-jsonrpc added at 53eab6
21 changes: 15 additions & 6 deletions itests/fevm_test.go
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ import (
"errors"
"fmt"
"os"
"strings"
"testing"
"time"

@@ -1040,7 +1039,7 @@ func TestFEVMErrorParsing(t *testing.T) {
"failCustom()": customError,
} {
sig := sig
expected := fmt.Sprintf("exit 33, revert reason: %s, vm error", expected)
expected := expected
t.Run(sig, func(t *testing.T) {
entryPoint := kit.CalcFuncSignature(sig)
t.Run("EthCall", func(t *testing.T) {
@@ -1049,8 +1048,13 @@ func TestFEVMErrorParsing(t *testing.T) {
Data: entryPoint,
}, ethtypes.NewEthBlockNumberOrHashFromPredefined("latest"))
require.Error(t, err)
if !strings.Contains(err.Error(), expected) {
require.Contains(t, err.Error(), "panic in rpc method 'Filecoin.EthCall'")

var dataErr jsonrpc.ErrorWithData
if errors.As(err, &dataErr) {
errData := dataErr.ErrorData()
require.Contains(t, errData, expected, "Error data should contain the expected error")
} else {
t.Fatalf("Expected error to implement jsonrpc.ErrorWithData")
}
})
t.Run("EthEstimateGas", func(t *testing.T) {
@@ -1062,8 +1066,13 @@ func TestFEVMErrorParsing(t *testing.T) {

_, err = e.EthEstimateGas(ctx, gasParams)
require.Error(t, err)
if !strings.Contains(err.Error(), expected) {
require.Contains(t, err.Error(), "panic in rpc method 'Filecoin.EthEstimateGas'")

var dataErr jsonrpc.ErrorWithData
if errors.As(err, &dataErr) {
errData := dataErr.ErrorData()
require.Contains(t, errData, expected, "Error data should contain the expected error")
} else {
t.Fatalf("Expected error to implement jsonrpc.ErrorWithData")
}
})
})