Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Remove SysErrInternal definition, use of which is always a bug #304

Merged
merged 2 commits into from
Apr 27, 2020
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 actors/builtin/market/market_actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func (a Actor) ComputeDataCommitment(rt Runtime, params *ComputeDataCommitmentPa

commd, err := rt.Syscalls().ComputeUnsealedSectorCID(params.SectorType, pieces)
if err != nil {
rt.Abortf(exitcode.SysErrorIllegalArgument, "failed to compute unsealed sector CID: %s", err)
rt.Abortf(exitcode.ErrIllegalArgument, "failed to compute unsealed sector CID: %s", err)
}

return (*cbg.CborCid)(&commd)
Expand Down
2 changes: 1 addition & 1 deletion actors/builtin/power/power_actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ func (a Actor) computeInitialPledge(rt Runtime, desc *SectorStorageWeightDesc) a
builtin.RequireSuccess(rt, code, "failed to check epoch reward")
var epochReward abi.TokenAmount
if err := rwret.Into(&epochReward); err != nil {
rt.Abortf(exitcode.SysErrInternal, "failed to unmarshal epoch reward value: %s", err)
rt.Abortf(exitcode.ErrIllegalState, "failed to unmarshal epoch reward value: %s", err)
}

qapower := QAPowerForWeight(desc)
Expand Down
6 changes: 2 additions & 4 deletions actors/runtime/exitcode/reserved.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ const (
SysErrorReserved3 = ExitCode(12)
SysErrorReserved4 = ExitCode(13)
SysErrorReserved5 = ExitCode(14)

// Indicates something broken within the VM.
SysErrInternal = ExitCode(15)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep the definition, maybe rename to something indicating it's a VM error

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that this can never safely be used. These exit codes go on chain, but every time there's a VM error of this form (idiosyncratic, not reproducible between impls) it should not go on chain; instead the state evaluation should just fail.

It should never have existed. If Lotus still uses it, they are all bugs that should either be a different exit code, or a "fatal" error.

SysErrorReserved6 = ExitCode(15)
)

// The initial range of exit codes is reserved for system errors.
Expand All @@ -117,5 +115,5 @@ var names = map[ExitCode]string{
SysErrorReserved3: "SysErrorReserved3",
SysErrorReserved4: "SysErrorReserved4",
SysErrorReserved5: "SysErrorReserved5",
SysErrInternal: "SysErrInternal",
SysErrorReserved6: "SysErrorReserved6",
}
2 changes: 1 addition & 1 deletion support/mock/mockrt.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func (rt *Runtime) Create(obj runtime.CBORMarshaler) {
func (rt *Runtime) Readonly(st runtime.CBORUnmarshaler) {
found := rt.Store().Get(rt.state, st)
if !found {
rt.Abortf(exitcode.SysErrInternal, "actor state not found: %v", rt.state)
panic(fmt.Sprintf("actor state not found: %v", rt.state))
}
}

Expand Down