Merge pull request #8804 from filecoin-project/gstuart/exec-trace-consistency

Fix: state:  Set exec trace subcalls to nil when appropriate
This commit is contained in:
Aayush Rajasekaran 2022-06-07 09:40:00 -04:00 committed by GitHub
commit 0e5e5f49df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,16 +60,18 @@ func (t *FvmExecutionTrace) ToExecutionTrace() types.ExecutionTrace {
}
ret := types.ExecutionTrace{
Msg: t.Msg,
MsgRct: t.MsgRct,
Error: t.Error,
Duration: 0,
GasCharges: nil,
Subcalls: make([]types.ExecutionTrace, len(t.Subcalls)),
Msg: t.Msg,
MsgRct: t.MsgRct,
Error: t.Error,
Subcalls: nil, // Should be nil when there are no subcalls for backwards compatibility
}
for i, v := range t.Subcalls {
ret.Subcalls[i] = v.ToExecutionTrace()
if len(t.Subcalls) > 0 {
ret.Subcalls = make([]types.ExecutionTrace, len(t.Subcalls))
for i, v := range t.Subcalls {
ret.Subcalls[i] = v.ToExecutionTrace()
}
}
return ret