From c66415ae4c9a155241935a4dc9c1f1ffd95d264a Mon Sep 17 00:00:00 2001 From: frrist Date: Wed, 29 Apr 2020 13:05:53 -0700 Subject: [PATCH] fix: insufficient gas remaining to cover retval proceed as in the case of method execution failure. --- chain/vm/vm.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/chain/vm/vm.go b/chain/vm/vm.go index 7d40ff3da..c87dbee94 100644 --- a/chain/vm/vm.go +++ b/chain/vm/vm.go @@ -365,9 +365,17 @@ func (vm *VM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, return nil, xerrors.Errorf("send returned nil runtime, send error was: %s", actorErr) } actorErr2 := rt.chargeGasSafe(rt.Pricelist().OnChainReturnValue(len(ret))) - if actorErr == nil { - //TODO: Ambigous what to do in this case - actorErr = actorErr2 + if actorErr2 != nil { + return &ApplyRet{ + MessageReceipt: types.MessageReceipt{ + ExitCode: aerrors.RetCode(actorErr2), + GasUsed: rt.gasUsed, + }, + ActorErr: actorErr2, + Penalty: types.NewInt(0), + Duration: time.Since(start), + }, nil + } }