Skip to content

Commit

Permalink
feat: shed: print out actor code CIDs in manifest cid checker
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Jun 23, 2022
1 parent b368d08 commit b2dfa00
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion cmd/lotus-shed/cid.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import (
"encoding/hex"
"fmt"
"os"
"text/tabwriter"

"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
cbor "github.com/ipfs/go-ipld-cbor"

"github.com/ipfs/go-cid"
"github.com/ipld/go-car"
Expand Down Expand Up @@ -104,6 +109,7 @@ var cidFromCarCmd = &cli.Command{
}

bs := blockstore.NewMemory()
wrapBs := adt.WrapStore(ctx, cbor.NewCborStore(bs))

hdr, err := car.LoadCar(ctx, bs, f)
if err != nil {
Expand All @@ -114,6 +120,19 @@ var cidFromCarCmd = &cli.Command{

fmt.Printf("Manifest CID: %s\n", manifestCid.String())

return nil
entries, err := actors.ReadManifest(ctx, wrapBs, manifestCid)
if err != nil {
return xerrors.Errorf("error loading manifest: %w", err)
}

tw := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
_, _ = fmt.Fprintln(tw, "\nActor\tCID\t")

for name, cid := range entries {
_, _ = fmt.Fprintf(tw, "%v\t%v\n", name, cid)

}

return tw.Flush()
},
}

0 comments on commit b2dfa00

Please sign in to comment.