introduce a marker type for builtin actor loading to make DI work
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
car "github.com/ipld/go-car"
|
||||
)
|
||||
|
||||
func LoadBultinActors(lc fx.Lifecycle, mctx helpers.MetricsCtx, bs dtypes.UniversalBlockstore) error {
|
||||
func LoadBultinActors(lc fx.Lifecycle, mctx helpers.MetricsCtx, bs dtypes.UniversalBlockstore) (result dtypes.BuiltinActorsLoaded, err error) {
|
||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||
|
||||
// TODO eventually we want this to start with bundle/manifest CIDs and fetch them from IPFS if
|
||||
@@ -25,7 +25,7 @@ func LoadBultinActors(lc fx.Lifecycle, mctx helpers.MetricsCtx, bs dtypes.Univer
|
||||
blobr := bytes.NewReader(build.BuiltinActorsV8Bundle())
|
||||
hdr, err := car.LoadCar(ctx, bs, blobr)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("error loading builtin actors v8 bundle: %w", err)
|
||||
return result, xerrors.Errorf("error loading builtin actors v8 bundle: %w", err)
|
||||
}
|
||||
|
||||
manifestCid := hdr.Roots[0]
|
||||
@@ -33,8 +33,8 @@ func LoadBultinActors(lc fx.Lifecycle, mctx helpers.MetricsCtx, bs dtypes.Univer
|
||||
|
||||
cborStore := cbor.NewCborStore(bs)
|
||||
if err := actors.LoadManifests(ctx, cborStore); err != nil {
|
||||
return xerrors.Errorf("error loading actor manifests: %w", err)
|
||||
return result, xerrors.Errorf("error loading actor manifests: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
return result, nil
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain"
|
||||
"github.com/filecoin-project/lotus/chain/beacon"
|
||||
"github.com/filecoin-project/lotus/chain/consensus"
|
||||
"github.com/filecoin-project/lotus/chain/consensus/filcns"
|
||||
"github.com/filecoin-project/lotus/chain/exchange"
|
||||
"github.com/filecoin-project/lotus/chain/gen/slashfilter"
|
||||
"github.com/filecoin-project/lotus/chain/messagepool"
|
||||
@@ -176,3 +177,7 @@ func NewSyncer(params SyncerParams) (*chain.Syncer, error) {
|
||||
func NewSlashFilter(ds dtypes.MetadataDS) *slashfilter.SlashFilter {
|
||||
return slashfilter.New(ds)
|
||||
}
|
||||
|
||||
func UpgradeSchedule(_ dtypes.BuiltinActorsLoaded) stmgr.UpgradeSchedule {
|
||||
return filcns.DefaultUpgradeSchedule()
|
||||
}
|
||||
|
||||
@@ -2,3 +2,4 @@ package dtypes
|
||||
|
||||
type NetworkName string
|
||||
type AfterGenesisSet struct{}
|
||||
type BuiltinActorsLoaded struct{}
|
||||
|
||||
Reference in New Issue
Block a user