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

tos32 error handling #1959

Merged
merged 1 commit into from
Mar 31, 2023
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: 2 additions & 0 deletions proto/src/proto/executor/v1/executor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,6 @@ enum ExecutorError {
EXECUTOR_ERROR_BALANCE_MISMATCH = 9;
// EXECUTOR_ERROR_FEA2SCALAR indicates that there is a fea2scalar error in the execution
EXECUTOR_ERROR_FEA2SCALAR = 10;
// EXECUTOR_ERROR_TOS32 indicates that there is a TOS32 error in the execution
EXECUTOR_ERROR_TOS32 = 11;
}
12 changes: 12 additions & 0 deletions state/runtime/executor/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ const (
EXECUTOR_ERROR_UNSUPPORTED_FORK_ID = 8
// EXECUTOR_ERROR_BALANCE_MISMATCH indicates that there is a balance mismatch error in the ROM
EXECUTOR_ERROR_BALANCE_MISMATCH = 9
// EXECUTOR_ERROR_FEA2SCALAR indicates that there is a fea2scalar error in the execution
EXECUTOR_ERROR_FEA2SCALAR = 10
// EXECUTOR_ERROR_TOS32 indicates that there is a TOS32 error in the execution
EXECUTOR_ERROR_TOS32 = 11
)

// RomErr returns an instance of error related to the ExecutorError
Expand Down Expand Up @@ -275,6 +279,10 @@ func ExecutorErr(errorCode pb.ExecutorError) error {
return runtime.ErrUnsupportedForkId
case EXECUTOR_ERROR_BALANCE_MISMATCH:
return runtime.ErrBalanceMismatch
case EXECUTOR_ERROR_FEA2SCALAR:
return runtime.ErrFea2Scalar
case EXECUTOR_ERROR_TOS32:
return runtime.ErrTos32
}
return fmt.Errorf("unknown error")
}
Expand All @@ -300,6 +308,10 @@ func ExecutorErrorCode(err error) pb.ExecutorError {
return pb.ExecutorError(EXECUTOR_ERROR_UNSUPPORTED_FORK_ID)
case runtime.ErrBalanceMismatch:
return pb.ExecutorError(EXECUTOR_ERROR_BALANCE_MISMATCH)
case runtime.ErrFea2Scalar:
return pb.ExecutorError(EXECUTOR_ERROR_FEA2SCALAR)
case runtime.ErrTos32:
return pb.ExecutorError(EXECUTOR_ERROR_TOS32)
}
return math.MaxInt32
}
31 changes: 18 additions & 13 deletions state/runtime/executor/pb/executor.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions state/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ var (
ErrUnsupportedForkId = errors.New("unsupported fork id")
// ErrBalanceMismatch indicates that the balance mismatch in the ROM
ErrBalanceMismatch = errors.New("balance mismatch")
// ErrFea2Scalar indicates a fea2scalar error in the ROM
ErrFea2Scalar = errors.New("fea2scalar")
// ErrTos32 indicates a tos32 error in the ROM
ErrTos32 = errors.New("tos32")
)

// ExecutionResult includes all output after executing given evm
Expand Down