Merge pull request #1638 from filecoin-project/frrist/fix-lack-gas-retval

fix: insufficient gas remaining to cover retval
This commit is contained in:
Whyrusleeping 2020-04-30 10:20:17 -07:00 committed by GitHub
commit f16ae9dffb

View File

@ -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
}
}