fix lint error; stamp metadata on vector.

This commit is contained in:
Raúl Kripalani 2020-12-15 17:08:49 +00:00
parent 446b1cc883
commit 3fa51f08e1

View File

@ -10,7 +10,6 @@ import (
"github.com/filecoin-project/test-vectors/schema" "github.com/filecoin-project/test-vectors/schema"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli" lcli "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/conformance" "github.com/filecoin-project/lotus/conformance"
) )
@ -133,10 +132,24 @@ func doExtractTipset(opts extractOpts) error {
return err return err
} }
version, err := FullAPI.Version(ctx)
if err != nil {
return err
}
ntwkName, err := FullAPI.StateNetworkName(ctx)
if err != nil {
return err
}
vector := schema.TestVector{ vector := schema.TestVector{
Class: schema.ClassTipset, Class: schema.ClassTipset,
Meta: &schema.Metadata{ Meta: &schema.Metadata{
ID: opts.id, ID: opts.id,
Gen: []schema.GenerationData{
{Source: fmt.Sprintf("network:%s", ntwkName)},
{Source: fmt.Sprintf("tipset:%s", ts.Key())},
{Source: "github.com/filecoin-project/lotus", Version: version.String()}},
}, },
Selector: schema.Selector{ Selector: schema.Selector{
schema.SelectorMinProtocolVersion: codename, schema.SelectorMinProtocolVersion: codename,
@ -161,16 +174,12 @@ func doExtractTipset(opts extractOpts) error {
}, },
} }
// do nothing with this for now.
var traces = make([]types.ExecutionTrace, 0, len(result.AppliedResults))
for _, res := range result.AppliedResults { for _, res := range result.AppliedResults {
vector.Post.Receipts = append(vector.Post.Receipts, &schema.Receipt{ vector.Post.Receipts = append(vector.Post.Receipts, &schema.Receipt{
ExitCode: int64(res.ExitCode), ExitCode: int64(res.ExitCode),
ReturnValue: res.Return, ReturnValue: res.Return,
GasUsed: res.GasUsed, GasUsed: res.GasUsed,
}) })
traces = append(traces, res.ExecutionTrace)
} }
return writeVector(vector, opts.file) return writeVector(vector, opts.file)