Unify MethodCall and ReplayResults into SimulationResult

- Call and Replay now return the same type, which includes both Message and MessageReceipt
This commit is contained in:
Aayush Rajasekaran
2020-03-06 11:10:40 -08:00
parent 9bf4aa7546
commit 2d63b007f2
15 changed files with 90 additions and 94 deletions
+9 -9
View File
@@ -143,14 +143,14 @@ func (a *StateAPI) StatePledgeCollateral(ctx context.Context, tsk types.TipSetKe
return types.NewInt(0), xerrors.Errorf("failed to get miner worker addr: %w", err)
}
if ret.ExitCode != 0 {
return types.NewInt(0), xerrors.Errorf("failed to get miner worker addr (exit code %d)", ret.ExitCode)
if ret.MsgRct.ExitCode != 0 {
return types.NewInt(0), xerrors.Errorf("failed to get miner worker addr (exit code %d)", ret.MsgRct.ExitCode)
}
return types.BigFromBytes(ret.Return), nil
return types.BigFromBytes(ret.MsgRct.Return), nil
}
func (a *StateAPI) StateCall(ctx context.Context, msg *types.Message, tsk types.TipSetKey) (*api.MethodCall, error) {
func (a *StateAPI) StateCall(ctx context.Context, msg *types.Message, tsk types.TipSetKey) (*api.InvocResult, error) {
ts, err := a.Chain.GetTipSetFromKey(tsk)
if err != nil {
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
@@ -158,7 +158,7 @@ func (a *StateAPI) StateCall(ctx context.Context, msg *types.Message, tsk types.
return a.StateManager.Call(ctx, msg, ts)
}
func (a *StateAPI) StateReplay(ctx context.Context, tsk types.TipSetKey, mc cid.Cid) (*api.ReplayResults, error) {
func (a *StateAPI) StateReplay(ctx context.Context, tsk types.TipSetKey, mc cid.Cid) (*api.InvocResult, error) {
ts, err := a.Chain.GetTipSetFromKey(tsk)
if err != nil {
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
@@ -173,10 +173,10 @@ func (a *StateAPI) StateReplay(ctx context.Context, tsk types.TipSetKey, mc cid.
errstr = r.ActorErr.Error()
}
return &api.ReplayResults{
Msg: m,
Receipt: &r.MessageReceipt,
Error: errstr,
return &api.InvocResult{
Msg: m,
MsgRct: &r.MessageReceipt,
Error: errstr,
}, nil
}