diff --git a/chain/actors/manifest.go b/chain/actors/manifest.go index 9ee159632..210680285 100644 --- a/chain/actors/manifest.go +++ b/chain/actors/manifest.go @@ -16,6 +16,7 @@ import ( "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/chain/actors/adt" + "github.com/filecoin-project/lotus/node/bundle" "github.com/filecoin-project/specs-actors/v8/actors/builtin/manifest" "github.com/mitchellh/go-homedir" @@ -122,12 +123,12 @@ func CanonicalName(name string) string { } func FetchAndLoadBundle(ctx context.Context, basePath string, bs blockstore.Blockstore, av Version, rel, netw string) (cid.Cid, error) { - fetcher, err := NewBundleFetcher(basePath) + fetcher, err := bundle.NewBundleFetcher(basePath) if err != nil { return cid.Undef, xerrors.Errorf("error creating fetcher for builtin-actors version %d: %w", av, err) } - path, err := fetcher.Fetch(av, rel, netw) + path, err := fetcher.Fetch(int(av), rel, netw) if err != nil { return cid.Undef, xerrors.Errorf("error fetching bundle for builtin-actors version %d: %w", av, err) } diff --git a/chain/actors/bundle.go b/node/bundle/bundle.go similarity index 90% rename from chain/actors/bundle.go rename to node/bundle/bundle.go index ecf5cd741..05f70dd31 100644 --- a/chain/actors/bundle.go +++ b/node/bundle/bundle.go @@ -1,4 +1,4 @@ -package actors +package bundle import ( "bytes" @@ -16,7 +16,7 @@ import ( logging "github.com/ipfs/go-log/v2" ) -var logb = logging.Logger("bundle-fetcher") +var log = logging.Logger("bundle-fetcher") type BundleFetcher struct { path string @@ -31,7 +31,7 @@ func NewBundleFetcher(basepath string) (*BundleFetcher, error) { return &BundleFetcher{path: path}, nil } -func (b *BundleFetcher) Fetch(version Version, release, netw string) (path string, err error) { +func (b *BundleFetcher) Fetch(version int, release, netw string) (path string, err error) { bundleName := fmt.Sprintf("builtin-actors-%s", netw) bundleFile := fmt.Sprintf("%s.car", bundleName) bundleHash := fmt.Sprintf("%s.sha256", bundleName) @@ -49,17 +49,17 @@ func (b *BundleFetcher) Fetch(version Version, release, netw string) (path strin return bundleFilePath, nil } - logb.Warnf("invalid bundle %s: %s; refetching", bundleName, err) + log.Warnf("invalid bundle %s: %s; refetching", bundleName, err) } - logb.Infof("fetching bundle %s", bundleFile) + log.Infof("fetching bundle %s", bundleFile) if err := b.fetch(release, bundleBasePath, bundleFile, bundleHash); err != nil { - logb.Errorf("error fetching bundle %s: %s", bundleName, err) + log.Errorf("error fetching bundle %s: %s", bundleName, err) return "", xerrors.Errorf("error fetching bundle: %w", err) } if err := b.check(bundleBasePath, bundleFile, bundleHash); err != nil { - logb.Errorf("error checking bundle %s: %s", bundleName, err) + log.Errorf("error checking bundle %s: %s", bundleName, err) return "", xerrors.Errorf("error checking bundle: %s", err) } @@ -67,7 +67,7 @@ func (b *BundleFetcher) Fetch(version Version, release, netw string) (path strin } func (b *BundleFetcher) fetchURL(url, path string) error { - logb.Infof("fetching URL: %s", url) + log.Infof("fetching URL: %s", url) resp, err := http.Get(url) //nolint if err != nil {