feat: FVM: do not error on unsuccessful implicit messages

This commit is contained in:
Aayush 2023-07-31 15:13:20 -04:00
parent 3f93b86ebe
commit cd958e4f6e
4 changed files with 10 additions and 5 deletions

View File

@ -135,6 +135,10 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context,
return xerrors.Errorf("running cron: %w", err) return xerrors.Errorf("running cron: %w", err)
} }
if !ret.ExitCode.IsSuccess() {
return xerrors.Errorf("cron failed with exit code %d: %w", ret.ExitCode, ret.ActorErr)
}
cronGas += ret.GasUsed cronGas += ret.GasUsed
if em != nil { if em != nil {

View File

@ -80,6 +80,11 @@ var RewardFunc = func(ctx context.Context, vmi vm.Interface, em stmgr.ExecMonito
if actErr != nil { if actErr != nil {
return xerrors.Errorf("failed to apply reward message: %w", actErr) return xerrors.Errorf("failed to apply reward message: %w", actErr)
} }
if !ret.ExitCode.IsSuccess() {
return xerrors.Errorf("reward actor failed with exit code %d: %w", ret.ExitCode, ret.ActorErr)
}
if em != nil { if em != nil {
if err := em.MessageApplied(ctx, ts, rwMsg.Cid(), rwMsg, ret, true); err != nil { if err := em.MessageApplied(ctx, ts, rwMsg.Cid(), rwMsg, ret, true); err != nil {
return xerrors.Errorf("callback failed on reward message: %w", err) return xerrors.Errorf("callback failed on reward message: %w", err)

View File

@ -520,10 +520,6 @@ func (vm *FVM) ApplyImplicitMessage(ctx context.Context, cmsg *types.Message) (*
} }
} }
if ret.ExitCode != 0 {
return applyRet, fmt.Errorf("implicit message failed with exit code: %d and error: %w", ret.ExitCode, applyRet.ActorErr)
}
return applyRet, nil return applyRet, nil
} }

View File

@ -275,7 +275,7 @@ func TestNoRemoveDatacapFromVerifreg(t *testing.T) {
Params: params, Params: params,
Value: big.Zero(), Value: big.Zero(),
}, types.EmptyTSK) }, types.EmptyTSK)
require.Error(t, err) require.NoError(t, err)
require.False(t, callResult.MsgRct.ExitCode.IsSuccess()) require.False(t, callResult.MsgRct.ExitCode.IsSuccess())
verifregDatacapAfter, err := clientApi.StateVerifiedClientStatus(ctx, builtin.VerifiedRegistryActorAddr, types.EmptyTSK) verifregDatacapAfter, err := clientApi.StateVerifiedClientStatus(ctx, builtin.VerifiedRegistryActorAddr, types.EmptyTSK)