Merge pull request #1767 from filecoin-project/feat/html-trace-improvements

add tipset key and height to html trace output
This commit is contained in:
Łukasz Magiera 2020-05-20 12:48:05 +02:00 committed by GitHub
commit 267368d56c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -892,7 +892,7 @@ var stateComputeStateCmd = &cli.Command{
return c.Code, nil return c.Code, nil
} }
return computeStateHtml(stout, getCode) return computeStateHtml(ts, stout, getCode)
} }
fmt.Println("computed state cid: ", stout.Root) fmt.Println("computed state cid: ", stout.Root)
@ -921,7 +921,7 @@ func codeStr(c cid.Cid) string {
return string(cmh.Digest) return string(cmh.Digest)
} }
func computeStateHtml(o *api.ComputeStateOutput, getCode func(addr address.Address) (cid.Cid, error)) error { func computeStateHtml(ts *types.TipSet, o *api.ComputeStateOutput, getCode func(addr address.Address) (cid.Cid, error)) error {
fmt.Printf(`<html> fmt.Printf(`<html>
<head> <head>
<style> <style>
@ -947,8 +947,10 @@ func computeStateHtml(o *api.ComputeStateOutput, getCode func(addr address.Addre
</style> </style>
</head> </head>
<body> <body>
<div>Tipset: <b>%s</b></div>
<div>Height: %d</div>
<div>State CID: <b>%s</b></div> <div>State CID: <b>%s</b></div>
<div>Calls</div>`, o.Root) <div>Calls</div>`, ts.Key(), ts.Height(), o.Root)
for _, ir := range o.Trace { for _, ir := range o.Trace {
toCode, err := getCode(ir.Msg.To) toCode, err := getCode(ir.Msg.To)