feat: vm: add actor error backtraces to FVM

This commit is contained in:
Steven Allen 2022-04-20 17:15:14 +02:00
parent f9a4a400da
commit 6c0c111847
2 changed files with 22 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/chain/actors/aerrors"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/go-state-types/network"
@ -311,6 +312,15 @@ func (vm *FVM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet
}
}
var aerr aerrors.ActorError
if ret.ExitCode != 0 {
amsg := ret.FailureInfo
if amsg == "" {
amsg = "unknown error"
}
aerr = aerrors.New(exitcode.ExitCode(ret.ExitCode), amsg)
}
return &ApplyRet{
MessageReceipt: types.MessageReceipt{
Return: ret.Return,
@ -327,7 +337,7 @@ func (vm *FVM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet
GasRefund: 0,
GasBurned: 0,
},
ActorErr: nil,
ActorErr: aerr,
ExecutionTrace: et.ToExecutionTrace(),
Duration: time.Since(start),
}, nil
@ -351,13 +361,22 @@ func (vm *FVM) ApplyImplicitMessage(ctx context.Context, cmsg *types.Message) (*
}
}
var aerr aerrors.ActorError
if ret.ExitCode != 0 {
amsg := ret.FailureInfo
if amsg == "" {
amsg = "unknown error"
}
aerr = aerrors.New(exitcode.ExitCode(ret.ExitCode), amsg)
}
return &ApplyRet{
MessageReceipt: types.MessageReceipt{
Return: ret.Return,
ExitCode: exitcode.ExitCode(ret.ExitCode),
GasUsed: ret.GasUsed,
},
ActorErr: nil,
ActorErr: aerr,
ExecutionTrace: et.ToExecutionTrace(),
Duration: time.Since(start),
}, nil

2
extern/filecoin-ffi vendored

@ -1 +1 @@
Subproject commit 4cb8411aa6c15bc8f38fef9dcd9ae5d83837eb87
Subproject commit 791b68203d33ac494b9904f04b7239674b068df4