introduce a marker type for builtin actor loading to make DI work
This commit is contained in:
parent
f26d19ed7d
commit
5e3112fa95
@ -57,7 +57,7 @@ var ChainNode = Options(
|
|||||||
|
|
||||||
// Consensus settings
|
// Consensus settings
|
||||||
Override(new(dtypes.DrandSchedule), modules.BuiltinDrandConfig),
|
Override(new(dtypes.DrandSchedule), modules.BuiltinDrandConfig),
|
||||||
Override(new(stmgr.UpgradeSchedule), filcns.DefaultUpgradeSchedule()),
|
Override(new(stmgr.UpgradeSchedule), modules.UpgradeSchedule),
|
||||||
Override(new(dtypes.NetworkName), modules.NetworkName),
|
Override(new(dtypes.NetworkName), modules.NetworkName),
|
||||||
Override(new(modules.Genesis), modules.ErrorGenesis),
|
Override(new(modules.Genesis), modules.ErrorGenesis),
|
||||||
Override(new(dtypes.AfterGenesisSet), modules.SetGenesis),
|
Override(new(dtypes.AfterGenesisSet), modules.SetGenesis),
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
car "github.com/ipld/go-car"
|
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)
|
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||||
|
|
||||||
// TODO eventually we want this to start with bundle/manifest CIDs and fetch them from IPFS if
|
// 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())
|
blobr := bytes.NewReader(build.BuiltinActorsV8Bundle())
|
||||||
hdr, err := car.LoadCar(ctx, bs, blobr)
|
hdr, err := car.LoadCar(ctx, bs, blobr)
|
||||||
if err != nil {
|
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]
|
manifestCid := hdr.Roots[0]
|
||||||
@ -33,8 +33,8 @@ func LoadBultinActors(lc fx.Lifecycle, mctx helpers.MetricsCtx, bs dtypes.Univer
|
|||||||
|
|
||||||
cborStore := cbor.NewCborStore(bs)
|
cborStore := cbor.NewCborStore(bs)
|
||||||
if err := actors.LoadManifests(ctx, cborStore); err != nil {
|
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"
|
||||||
"github.com/filecoin-project/lotus/chain/beacon"
|
"github.com/filecoin-project/lotus/chain/beacon"
|
||||||
"github.com/filecoin-project/lotus/chain/consensus"
|
"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/exchange"
|
||||||
"github.com/filecoin-project/lotus/chain/gen/slashfilter"
|
"github.com/filecoin-project/lotus/chain/gen/slashfilter"
|
||||||
"github.com/filecoin-project/lotus/chain/messagepool"
|
"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 {
|
func NewSlashFilter(ds dtypes.MetadataDS) *slashfilter.SlashFilter {
|
||||||
return slashfilter.New(ds)
|
return slashfilter.New(ds)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func UpgradeSchedule(_ dtypes.BuiltinActorsLoaded) stmgr.UpgradeSchedule {
|
||||||
|
return filcns.DefaultUpgradeSchedule()
|
||||||
|
}
|
||||||
|
@ -2,3 +2,4 @@ package dtypes
|
|||||||
|
|
||||||
type NetworkName string
|
type NetworkName string
|
||||||
type AfterGenesisSet struct{}
|
type AfterGenesisSet struct{}
|
||||||
|
type BuiltinActorsLoaded struct{}
|
||||||
|
Loading…
Reference in New Issue
Block a user