Skip to content

Commit

Permalink
feat: FVM: do not error on unsuccessful implicit messages
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Jul 31, 2023
1 parent 3f93b86 commit a76224b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions chain/consensus/compute_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context,
return xerrors.Errorf("running cron: %w", err)
}

if !ret.ExitCode.IsSuccess() {
return xerrors.Errorf("cron failed with exit code %d: %s", ret.ExitCode, ret.ActorErr.Error())
}

cronGas += ret.GasUsed

if em != nil {
Expand Down
5 changes: 5 additions & 0 deletions chain/consensus/filcns/filecoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ var RewardFunc = func(ctx context.Context, vmi vm.Interface, em stmgr.ExecMonito
if actErr != nil {
return xerrors.Errorf("failed to apply reward message: %w", actErr)
}

if !ret.ExitCode.IsSuccess() {
return xerrors.Errorf("reward actor failed with exit code %d: %s", ret.ExitCode, ret.ActorErr.Error())
}

if em != nil {
if err := em.MessageApplied(ctx, ts, rwMsg.Cid(), rwMsg, ret, true); err != nil {
return xerrors.Errorf("callback failed on reward message: %w", err)
Expand Down
4 changes: 0 additions & 4 deletions chain/vm/fvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit a76224b

Please sign in to comment.