File tree Expand file tree Collapse file tree 7 files changed +158
-150
lines changed Expand file tree Collapse file tree 7 files changed +158
-150
lines changed Original file line number Diff line number Diff line change 1+ package ethtypes
2+
3+ import (
4+ "fmt"
5+
6+ "golang.org/x/xerrors"
7+ )
8+
9+ var ErrExecutionReverted = xerrors .New ("execution reverted" )
10+
11+ // ExecutionRevertedError is an error that occurs when a transaction reverts.
12+ type ExecutionRevertedError struct {
13+ Message string
14+ Code int
15+ Meta []byte
16+ Data string
17+ }
18+
19+ // Error implements the error interface.
20+ func (e * ExecutionRevertedError ) Error () string {
21+ if e .Message == "" {
22+ return fmt .Sprintf ("json-rpc error %d" , e .Code )
23+ }
24+ return e .Message
25+ }
26+
27+ // ErrorData returns the error data.
28+ func (e * ExecutionRevertedError ) ErrorData () interface {} {
29+ return e .Data
30+ }
31+
32+ // ErrorCode returns the JSON error code for a revert.
33+ // See: https://github.com/ethereum/wiki/wiki/JSON-RPC-Error-Codes-Improvement-Proposal
34+ func (e * ExecutionRevertedError ) ErrorCode () int {
35+ return 3
36+ }
37+
38+ // NewExecutionRevertedWithDataError returns an ExecutionRevertedError with the given code and data.
39+ func NewExecutionRevertedWithDataError (code int , data string ) * ExecutionRevertedError {
40+ return & ExecutionRevertedError {
41+ Message : ErrExecutionReverted .Error (),
42+ Code : code ,
43+ Data : data ,
44+ }
45+ }
Original file line number Diff line number Diff line change @@ -1165,37 +1165,3 @@ type EthCreateTraceResult struct {
11651165 GasUsed EthUint64 `json:"gasUsed"`
11661166 Code EthBytes `json:"code"`
11671167}
1168-
1169- type EthCallError struct {
1170- Message string
1171- Code int
1172- Meta []byte
1173- Data string
1174- }
1175-
1176- func (e * EthCallError ) Error () string {
1177- if e .Message == "" {
1178- return fmt .Sprintf ("json-rpc error %d" , e .Code )
1179- }
1180- return e .Message
1181- }
1182-
1183- func (e * EthCallError ) ErrorData () interface {} {
1184- return e .Data
1185- }
1186-
1187- func EthCallErrorWithDefaultCode (msg string , data string ) * EthCallError {
1188- return & EthCallError {
1189- Message : msg ,
1190- Code : - 32000 ,
1191- Data : data ,
1192- }
1193- }
1194-
1195- func EthCallErrorWithCode (msg string , code int , data string ) * EthCallError {
1196- return & EthCallError {
1197- Message : msg ,
1198- Code : code ,
1199- Data : data ,
1200- }
1201- }
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ replace github.com/filecoin-project/test-vectors => ./extern/test-vectors // pro
1212
1313replace github.com/filecoin-project/filecoin-ffi => ./extern/filecoin-ffi // provided via a git submodule
1414
15+ replace github.com/filecoin-project/go-jsonrpc => github.com/virajbhartiya/go-jsonrpc v0.0.0-20241011111701-53eab64ec154
16+
1517require (
1618 contrib.go.opencensus.io/exporter/prometheus v0.4.2
1719 github.com/BurntSushi/toml v1.3.2
Original file line number Diff line number Diff line change @@ -287,8 +287,6 @@ github.com/filecoin-project/go-hamt-ipld/v3 v3.0.1/go.mod h1:gXpNmr3oQx8l3o7qkGy
287287github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 /go.mod h1:bxmzgT8tmeVQA1/gvBwFmYdT8SOFUwB3ovSUfG1Ux0g =
288288github.com/filecoin-project/go-hamt-ipld/v3 v3.4.0 h1:nYs6OPUF8KbZ3E8o9p9HJnQaE8iugjHR5WYVMcicDJc =
289289github.com/filecoin-project/go-hamt-ipld/v3 v3.4.0 /go.mod h1:s0qiHRhFyrgW0SvdQMSJFQxNa4xEIG5XvqCBZUEgcbc =
290- github.com/filecoin-project/go-jsonrpc v0.6.0 h1:/fFJIAN/k6EgY90m7qbyfY28woMwyseZmh2gVs5sYjY =
291- github.com/filecoin-project/go-jsonrpc v0.6.0 /go.mod h1:/n/niXcS4ZQua6i37LcVbY1TmlJR0UIK9mDFQq2ICek =
292290github.com/filecoin-project/go-padreader v0.0.1 h1:8h2tVy5HpoNbr2gBRr+WD6zV6VD6XHig+ynSGJg8ZOs =
293291github.com/filecoin-project/go-padreader v0.0.1 /go.mod h1:VYVPJqwpsfmtoHnAmPx6MUwmrK6HIcDqZJiuZhtmfLQ =
294292github.com/filecoin-project/go-paramfetch v0.0.4 h1:H+Me8EL8T5+79z/KHYQQcT8NVOzYVqXIi7nhb48tdm8 =
@@ -1281,6 +1279,8 @@ github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8W
12811279github.com/valyala/fasttemplate v1.0.1 /go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8 =
12821280github.com/viant/assertly v0.4.8 /go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU =
12831281github.com/viant/toolbox v0.24.0 /go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM =
1282+ github.com/virajbhartiya/go-jsonrpc v0.0.0-20241011111701-53eab64ec154 h1:k3+bv8KyRZZXFjNtT5CK2Y8KqIK19ISShIPMqO6uEQI =
1283+ github.com/virajbhartiya/go-jsonrpc v0.0.0-20241011111701-53eab64ec154 /go.mod h1:lAUpS8BSVtKaA8+/CFUMA5dokMiSM7n0ehf8bHOFdpE =
12841284github.com/warpfork/go-testmark v0.12.1 h1:rMgCpJfwy1sJ50x0M0NgyphxYYPMOODIJHhsXyEHU0s =
12851285github.com/warpfork/go-testmark v0.12.1 /go.mod h1:kHwy7wfvGSPh1rQJYKayD4AbtNaeyZdcGi9tNJTaa5Y =
12861286github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436 /go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw =
You can’t perform that action at this time.
0 commit comments