From b3bac0c9e8b101350e54bc4196fe7dd047680adc Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Tue, 21 Jul 2020 23:59:15 +0200 Subject: [PATCH] Add better error messages for message pre-execution errors Signed-off-by: Jakub Sztandera --- chain/vm/vm.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chain/vm/vm.go b/chain/vm/vm.go index 6aab57393..112d507f3 100644 --- a/chain/vm/vm.go +++ b/chain/vm/vm.go @@ -347,6 +347,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, ExitCode: exitcode.SysErrSenderInvalid, GasUsed: 0, }, + ActorErr: aerrors.Newf(exitcode.SysErrSenderInvalid, "actor not found: %s", msg.From), Penalty: minerPenaltyAmount, Duration: time.Since(start), }, nil @@ -361,6 +362,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, ExitCode: exitcode.SysErrSenderInvalid, GasUsed: 0, }, + ActorErr: aerrors.Newf(exitcode.SysErrSenderInvalid, "send from not account actor: %s", fromActor.Code), Penalty: minerPenaltyAmount, Duration: time.Since(start), }, nil @@ -373,6 +375,8 @@ func (vm *VM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, ExitCode: exitcode.SysErrSenderStateInvalid, GasUsed: 0, }, + ActorErr: aerrors.Newf(exitcode.SysErrSenderStateInvalid, + "actor nonce invalid: msg:%d != state:%d", msg.Nonce, fromActor.Nonce), Penalty: minerPenaltyAmount, Duration: time.Since(start), }, nil @@ -386,6 +390,8 @@ func (vm *VM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, ExitCode: exitcode.SysErrSenderStateInvalid, GasUsed: 0, }, + ActorErr: aerrors.Newf(exitcode.SysErrSenderStateInvalid, + "actor balance less than needed: %s < %s", fromActor.Balance, totalCost), Penalty: minerPenaltyAmount, Duration: time.Since(start), }, nil