node builder: Cleanup and add some docstrings
This commit is contained in:
parent
811fb44dd0
commit
adeb4cefee
427
node/builder.go
427
node/builder.go
@ -171,6 +171,7 @@ type Settings struct {
|
|||||||
Lite bool // Start node in "lite" mode
|
Lite bool // Start node in "lite" mode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Basic lotus-app services
|
||||||
func defaults() []Option {
|
func defaults() []Option {
|
||||||
return []Option{
|
return []Option{
|
||||||
// global system journal.
|
// global system journal.
|
||||||
@ -184,65 +185,256 @@ func defaults() []Option {
|
|||||||
return metricsi.CtxScope(context.Background(), "lotus")
|
return metricsi.CtxScope(context.Background(), "lotus")
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Override(new(record.Validator), modules.RecordValidator),
|
|
||||||
Override(new(dtypes.Bootstrapper), dtypes.Bootstrapper(false)),
|
|
||||||
Override(new(dtypes.ShutdownChan), make(chan struct{})),
|
Override(new(dtypes.ShutdownChan), make(chan struct{})),
|
||||||
|
|
||||||
// Filecoin modules
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func libp2p() Option {
|
var LibP2P = Options(
|
||||||
return Options(
|
// Host config
|
||||||
Override(new(peerstore.Peerstore), pstoremem.NewPeerstore),
|
Override(new(dtypes.Bootstrapper), dtypes.Bootstrapper(false)),
|
||||||
|
|
||||||
Override(DefaultTransportsKey, lp2p.DefaultTransports),
|
// Host dependencies
|
||||||
|
Override(new(peerstore.Peerstore), pstoremem.NewPeerstore),
|
||||||
|
Override(PstoreAddSelfKeysKey, lp2p.PstoreAddSelfKeys),
|
||||||
|
Override(StartListeningKey, lp2p.StartListening(config.DefaultFullNode().Libp2p.ListenAddresses)),
|
||||||
|
|
||||||
Override(new(lp2p.RawHost), lp2p.Host),
|
// Host settings
|
||||||
Override(new(host.Host), lp2p.RoutedHost),
|
Override(DefaultTransportsKey, lp2p.DefaultTransports),
|
||||||
Override(new(lp2p.BaseIpfsRouting), lp2p.DHTRouting(dht.ModeAuto)),
|
Override(AddrsFactoryKey, lp2p.AddrsFactory(nil, nil)),
|
||||||
|
Override(SmuxTransportKey, lp2p.SmuxTransport(true)),
|
||||||
|
Override(RelayKey, lp2p.NoRelay()),
|
||||||
|
Override(SecurityKey, lp2p.Security(true, false)),
|
||||||
|
|
||||||
Override(DiscoveryHandlerKey, lp2p.DiscoveryHandler),
|
// Host
|
||||||
Override(AddrsFactoryKey, lp2p.AddrsFactory(nil, nil)),
|
Override(new(lp2p.RawHost), lp2p.Host),
|
||||||
Override(SmuxTransportKey, lp2p.SmuxTransport(true)),
|
Override(new(host.Host), lp2p.RoutedHost),
|
||||||
Override(RelayKey, lp2p.NoRelay()),
|
Override(new(lp2p.BaseIpfsRouting), lp2p.DHTRouting(dht.ModeAuto)),
|
||||||
Override(SecurityKey, lp2p.Security(true, false)),
|
|
||||||
|
|
||||||
Override(BaseRoutingKey, lp2p.BaseRouting),
|
Override(DiscoveryHandlerKey, lp2p.DiscoveryHandler),
|
||||||
Override(new(routing.Routing), lp2p.Routing),
|
|
||||||
|
|
||||||
Override(NatPortMapKey, lp2p.NatPortMap),
|
// Routing
|
||||||
Override(BandwidthReporterKey, lp2p.BandwidthCounter),
|
Override(new(record.Validator), modules.RecordValidator),
|
||||||
|
Override(BaseRoutingKey, lp2p.BaseRouting),
|
||||||
|
Override(new(routing.Routing), lp2p.Routing),
|
||||||
|
|
||||||
Override(ConnectionManagerKey, lp2p.ConnectionManager(50, 200, 20*time.Second, nil)),
|
// Services
|
||||||
Override(AutoNATSvcKey, lp2p.AutoNATService),
|
Override(NatPortMapKey, lp2p.NatPortMap),
|
||||||
|
Override(BandwidthReporterKey, lp2p.BandwidthCounter),
|
||||||
|
Override(AutoNATSvcKey, lp2p.AutoNATService),
|
||||||
|
|
||||||
Override(new(*dtypes.ScoreKeeper), lp2p.ScoreKeeper),
|
// Services (pubsub)
|
||||||
Override(new(*pubsub.PubSub), lp2p.GossipSub),
|
Override(new(*dtypes.ScoreKeeper), lp2p.ScoreKeeper),
|
||||||
Override(new(*config.Pubsub), func(bs dtypes.Bootstrapper) *config.Pubsub {
|
Override(new(*pubsub.PubSub), lp2p.GossipSub),
|
||||||
return &config.Pubsub{
|
Override(new(*config.Pubsub), func(bs dtypes.Bootstrapper) *config.Pubsub {
|
||||||
Bootstrapper: bool(bs),
|
return &config.Pubsub{
|
||||||
}
|
Bootstrapper: bool(bs),
|
||||||
}),
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
Override(PstoreAddSelfKeysKey, lp2p.PstoreAddSelfKeys),
|
// Services (connection management)
|
||||||
Override(StartListeningKey, lp2p.StartListening(config.DefaultFullNode().Libp2p.ListenAddresses)),
|
Override(ConnectionManagerKey, lp2p.ConnectionManager(50, 200, 20*time.Second, nil)),
|
||||||
|
Override(new(*conngater.BasicConnectionGater), lp2p.ConnGater),
|
||||||
Override(new(*conngater.BasicConnectionGater), lp2p.ConnGater),
|
Override(ConnGaterKey, lp2p.ConnGaterOption),
|
||||||
Override(ConnGaterKey, lp2p.ConnGaterOption),
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func isType(t repo.RepoType) func(s *Settings) bool {
|
func isType(t repo.RepoType) func(s *Settings) bool {
|
||||||
return func(s *Settings) bool { return s.nodeType == t }
|
return func(s *Settings) bool { return s.nodeType == t }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isFullOrLiteNode(s *Settings) bool { return s.nodeType == repo.FullNode }
|
||||||
|
func isFullNode(s *Settings) bool { return s.nodeType == repo.FullNode && !s.Lite }
|
||||||
|
func isLiteNode(s *Settings) bool { return s.nodeType == repo.FullNode && s.Lite }
|
||||||
|
|
||||||
|
// Chain node provides access to the Filecoin blockchain, by setting up a full
|
||||||
|
// validator node, or by delegating some actions to other nodes (lite mode)
|
||||||
|
var ChainNode = Options(
|
||||||
|
// Full node or lite node
|
||||||
|
// TODO: Fix offline mode
|
||||||
|
|
||||||
|
// Consensus settings
|
||||||
|
Override(new(dtypes.DrandSchedule), modules.BuiltinDrandConfig),
|
||||||
|
Override(new(stmgr.UpgradeSchedule), stmgr.DefaultUpgradeSchedule()),
|
||||||
|
Override(new(dtypes.NetworkName), modules.NetworkName),
|
||||||
|
Override(new(modules.Genesis), modules.ErrorGenesis),
|
||||||
|
Override(new(dtypes.AfterGenesisSet), modules.SetGenesis),
|
||||||
|
Override(SetGenesisKey, modules.DoSetGenesis),
|
||||||
|
Override(new(beacon.Schedule), modules.RandomSchedule),
|
||||||
|
|
||||||
|
// Network bootstrap
|
||||||
|
Override(new(dtypes.BootstrapPeers), modules.BuiltinBootstrap),
|
||||||
|
Override(new(dtypes.DrandBootstrap), modules.DrandBootstrap),
|
||||||
|
|
||||||
|
// Consensus: crypto dependencies
|
||||||
|
Override(new(ffiwrapper.Verifier), ffiwrapper.ProofVerifier),
|
||||||
|
|
||||||
|
// Consensus: VM
|
||||||
|
Override(new(vm.SyscallBuilder), vm.Syscalls),
|
||||||
|
|
||||||
|
// Consensus: Chain storage/access
|
||||||
|
Override(new(*store.ChainStore), modules.ChainStore),
|
||||||
|
Override(new(*stmgr.StateManager), modules.StateManager),
|
||||||
|
Override(new(dtypes.ChainBitswap), modules.ChainBitswap),
|
||||||
|
Override(new(dtypes.ChainBlockService), modules.ChainBlockService), // todo: unused
|
||||||
|
|
||||||
|
// Consensus: Chain sync
|
||||||
|
|
||||||
|
// We don't want the SyncManagerCtor to be used as an fx constructor, but rather as a value.
|
||||||
|
// It will be called implicitly by the Syncer constructor.
|
||||||
|
Override(new(chain.SyncManagerCtor), func() chain.SyncManagerCtor { return chain.NewSyncManager }),
|
||||||
|
Override(new(*chain.Syncer), modules.NewSyncer),
|
||||||
|
Override(new(exchange.Client), exchange.NewClient),
|
||||||
|
|
||||||
|
// Chain networking
|
||||||
|
Override(new(*hello.Service), hello.NewHelloService),
|
||||||
|
Override(new(exchange.Server), exchange.NewServer),
|
||||||
|
Override(new(*peermgr.PeerMgr), peermgr.NewPeerMgr),
|
||||||
|
|
||||||
|
// Chain mining API dependencies
|
||||||
|
Override(new(*slashfilter.SlashFilter), modules.NewSlashFilter),
|
||||||
|
|
||||||
|
// Service: Message Pool
|
||||||
|
Override(new(dtypes.DefaultMaxFeeFunc), modules.NewDefaultMaxFeeFunc),
|
||||||
|
Override(new(*messagepool.MessagePool), modules.MessagePool),
|
||||||
|
Override(new(*dtypes.MpoolLocker), new(dtypes.MpoolLocker)),
|
||||||
|
|
||||||
|
// Shared graphsync (markets, serving chain)
|
||||||
|
Override(new(dtypes.Graphsync), modules.Graphsync(config.DefaultFullNode().Client.SimultaneousTransfers)),
|
||||||
|
|
||||||
|
// Service: Wallet
|
||||||
|
Override(new(*messagesigner.MessageSigner), messagesigner.NewMessageSigner),
|
||||||
|
Override(new(*wallet.LocalWallet), wallet.NewWallet),
|
||||||
|
Override(new(wallet.Default), From(new(*wallet.LocalWallet))),
|
||||||
|
Override(new(api.WalletAPI), From(new(wallet.MultiWallet))),
|
||||||
|
|
||||||
|
// Service: Payment channels
|
||||||
|
Override(new(*paychmgr.Store), paychmgr.NewStore),
|
||||||
|
Override(new(*paychmgr.Manager), paychmgr.NewManager),
|
||||||
|
Override(HandlePaymentChannelManagerKey, paychmgr.HandleManager),
|
||||||
|
Override(SettlePaymentChannelsKey, settler.SettlePaymentChannels),
|
||||||
|
|
||||||
|
// Markets (common)
|
||||||
|
Override(new(*discoveryimpl.Local), modules.NewLocalDiscovery),
|
||||||
|
|
||||||
|
// Markets (retrieval)
|
||||||
|
Override(new(discovery.PeerResolver), modules.RetrievalResolver),
|
||||||
|
Override(new(retrievalmarket.RetrievalClient), modules.RetrievalClient),
|
||||||
|
Override(new(dtypes.ClientDataTransfer), modules.NewClientGraphsyncDataTransfer),
|
||||||
|
|
||||||
|
// Markets (storage)
|
||||||
|
Override(new(*market.FundManager), market.NewFundManager),
|
||||||
|
Override(new(dtypes.ClientDatastore), modules.NewClientDatastore),
|
||||||
|
Override(new(storagemarket.StorageClient), modules.StorageClient),
|
||||||
|
Override(new(storagemarket.StorageClientNode), storageadapter.NewClientNodeAdapter),
|
||||||
|
Override(HandleMigrateClientFundsKey, modules.HandleMigrateClientFunds),
|
||||||
|
|
||||||
|
// Lite node API
|
||||||
|
ApplyIf(isLiteNode,
|
||||||
|
Override(new(messagesigner.MpoolNonceAPI), From(new(modules.MpoolNonceAPI))),
|
||||||
|
Override(new(full.ChainModuleAPI), From(new(api.GatewayAPI))),
|
||||||
|
Override(new(full.GasModuleAPI), From(new(api.GatewayAPI))),
|
||||||
|
Override(new(full.MpoolModuleAPI), From(new(api.GatewayAPI))),
|
||||||
|
Override(new(full.StateModuleAPI), From(new(api.GatewayAPI))),
|
||||||
|
Override(new(stmgr.StateManagerAPI), modules.NewRPCStateManager),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Full node API / service startup
|
||||||
|
ApplyIf(isFullNode,
|
||||||
|
Override(new(messagesigner.MpoolNonceAPI), From(new(*messagepool.MessagePool))),
|
||||||
|
Override(new(full.ChainModuleAPI), From(new(full.ChainModule))),
|
||||||
|
Override(new(full.GasModuleAPI), From(new(full.GasModule))),
|
||||||
|
Override(new(full.MpoolModuleAPI), From(new(full.MpoolModule))),
|
||||||
|
Override(new(full.StateModuleAPI), From(new(full.StateModule))),
|
||||||
|
Override(new(stmgr.StateManagerAPI), From(new(*stmgr.StateManager))),
|
||||||
|
|
||||||
|
Override(RunHelloKey, modules.RunHello),
|
||||||
|
Override(RunChainExchangeKey, modules.RunChainExchange),
|
||||||
|
Override(RunPeerMgrKey, modules.RunPeerMgr),
|
||||||
|
Override(HandleIncomingMessagesKey, modules.HandleIncomingMessages),
|
||||||
|
Override(HandleIncomingBlocksKey, modules.HandleIncomingBlocks),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
var MinerNode = Options(
|
||||||
|
// API dependencies
|
||||||
|
Override(new(api.Common), From(new(common.CommonAPI))),
|
||||||
|
Override(new(sectorstorage.StorageAuth), modules.StorageAuth),
|
||||||
|
|
||||||
|
// Actor config
|
||||||
|
Override(new(dtypes.MinerAddress), modules.MinerAddress),
|
||||||
|
Override(new(dtypes.MinerID), modules.MinerID),
|
||||||
|
Override(new(abi.RegisteredSealProof), modules.SealProofType),
|
||||||
|
Override(new(dtypes.NetworkName), modules.StorageNetworkName),
|
||||||
|
|
||||||
|
// Sector storage
|
||||||
|
Override(new(*stores.Index), stores.NewIndex),
|
||||||
|
Override(new(stores.SectorIndex), From(new(*stores.Index))),
|
||||||
|
Override(new(stores.LocalStorage), From(new(repo.LockedRepo))),
|
||||||
|
Override(new(*sectorstorage.Manager), modules.SectorStorage),
|
||||||
|
Override(new(sectorstorage.SectorManager), From(new(*sectorstorage.Manager))),
|
||||||
|
Override(new(storiface.WorkerReturn), From(new(sectorstorage.SectorManager))),
|
||||||
|
|
||||||
|
// Sector storage: Proofs
|
||||||
|
Override(new(ffiwrapper.Verifier), ffiwrapper.ProofVerifier),
|
||||||
|
Override(new(storage2.Prover), From(new(sectorstorage.SectorManager))),
|
||||||
|
|
||||||
|
// Sealing
|
||||||
|
Override(new(sealing.SectorIDCounter), modules.SectorIDCounter),
|
||||||
|
Override(GetParamsKey, modules.GetParams),
|
||||||
|
|
||||||
|
// Mining / proving
|
||||||
|
Override(new(*slashfilter.SlashFilter), modules.NewSlashFilter),
|
||||||
|
Override(new(*storage.Miner), modules.StorageMiner(config.DefaultStorageMiner().Fees)),
|
||||||
|
Override(new(*miner.Miner), modules.SetupBlockProducer),
|
||||||
|
Override(new(gen.WinningPoStProver), storage.NewWinningPoStProver),
|
||||||
|
|
||||||
|
Override(new(*storage.AddressSelector), modules.AddressSelector(nil)),
|
||||||
|
|
||||||
|
// Markets
|
||||||
|
Override(new(dtypes.StagingMultiDstore), modules.StagingMultiDatastore),
|
||||||
|
Override(new(dtypes.StagingBlockstore), modules.StagingBlockstore),
|
||||||
|
Override(new(dtypes.StagingDAG), modules.StagingDAG),
|
||||||
|
Override(new(dtypes.StagingGraphsync), modules.StagingGraphsync),
|
||||||
|
Override(new(dtypes.ProviderPieceStore), modules.NewProviderPieceStore),
|
||||||
|
Override(new(*sectorblocks.SectorBlocks), sectorblocks.NewSectorBlocks),
|
||||||
|
|
||||||
|
// Markets (retrieval)
|
||||||
|
Override(new(retrievalmarket.RetrievalProvider), modules.RetrievalProvider),
|
||||||
|
Override(new(dtypes.RetrievalDealFilter), modules.RetrievalDealFilter(nil)),
|
||||||
|
Override(HandleRetrievalKey, modules.HandleRetrieval),
|
||||||
|
|
||||||
|
// Markets (storage)
|
||||||
|
Override(new(dtypes.ProviderDataTransfer), modules.NewProviderDAGServiceDataTransfer),
|
||||||
|
Override(new(*storedask.StoredAsk), modules.NewStorageAsk),
|
||||||
|
Override(new(dtypes.StorageDealFilter), modules.BasicDealFilter(nil)),
|
||||||
|
Override(new(storagemarket.StorageProvider), modules.StorageProvider),
|
||||||
|
Override(new(*storageadapter.DealPublisher), storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{})),
|
||||||
|
Override(new(storagemarket.StorageProviderNode), storageadapter.NewProviderNodeAdapter(nil)),
|
||||||
|
Override(HandleMigrateProviderFundsKey, modules.HandleMigrateProviderFunds),
|
||||||
|
Override(HandleDealsKey, modules.HandleDeals),
|
||||||
|
|
||||||
|
// Config (todo: get a real property system)
|
||||||
|
Override(new(dtypes.ConsiderOnlineStorageDealsConfigFunc), modules.NewConsiderOnlineStorageDealsConfigFunc),
|
||||||
|
Override(new(dtypes.SetConsiderOnlineStorageDealsConfigFunc), modules.NewSetConsideringOnlineStorageDealsFunc),
|
||||||
|
Override(new(dtypes.ConsiderOnlineRetrievalDealsConfigFunc), modules.NewConsiderOnlineRetrievalDealsConfigFunc),
|
||||||
|
Override(new(dtypes.SetConsiderOnlineRetrievalDealsConfigFunc), modules.NewSetConsiderOnlineRetrievalDealsConfigFunc),
|
||||||
|
Override(new(dtypes.StorageDealPieceCidBlocklistConfigFunc), modules.NewStorageDealPieceCidBlocklistConfigFunc),
|
||||||
|
Override(new(dtypes.SetStorageDealPieceCidBlocklistConfigFunc), modules.NewSetStorageDealPieceCidBlocklistConfigFunc),
|
||||||
|
Override(new(dtypes.ConsiderOfflineStorageDealsConfigFunc), modules.NewConsiderOfflineStorageDealsConfigFunc),
|
||||||
|
Override(new(dtypes.SetConsiderOfflineStorageDealsConfigFunc), modules.NewSetConsideringOfflineStorageDealsFunc),
|
||||||
|
Override(new(dtypes.ConsiderOfflineRetrievalDealsConfigFunc), modules.NewConsiderOfflineRetrievalDealsConfigFunc),
|
||||||
|
Override(new(dtypes.SetConsiderOfflineRetrievalDealsConfigFunc), modules.NewSetConsiderOfflineRetrievalDealsConfigFunc),
|
||||||
|
Override(new(dtypes.ConsiderVerifiedStorageDealsConfigFunc), modules.NewConsiderVerifiedStorageDealsConfigFunc),
|
||||||
|
Override(new(dtypes.SetConsiderVerifiedStorageDealsConfigFunc), modules.NewSetConsideringVerifiedStorageDealsFunc),
|
||||||
|
Override(new(dtypes.ConsiderUnverifiedStorageDealsConfigFunc), modules.NewConsiderUnverifiedStorageDealsConfigFunc),
|
||||||
|
Override(new(dtypes.SetConsiderUnverifiedStorageDealsConfigFunc), modules.NewSetConsideringUnverifiedStorageDealsFunc),
|
||||||
|
Override(new(dtypes.SetSealingConfigFunc), modules.NewSetSealConfigFunc),
|
||||||
|
Override(new(dtypes.GetSealingConfigFunc), modules.NewGetSealConfigFunc),
|
||||||
|
Override(new(dtypes.SetExpectedSealDurationFunc), modules.NewSetExpectedSealDurationFunc),
|
||||||
|
Override(new(dtypes.GetExpectedSealDurationFunc), modules.NewGetExpectedSealDurationFunc),
|
||||||
|
)
|
||||||
|
|
||||||
// Online sets up basic libp2p node
|
// Online sets up basic libp2p node
|
||||||
func Online() Option {
|
func Online() Option {
|
||||||
isFullOrLiteNode := func(s *Settings) bool { return s.nodeType == repo.FullNode }
|
|
||||||
isFullNode := func(s *Settings) bool { return s.nodeType == repo.FullNode && !s.Lite }
|
|
||||||
isLiteNode := func(s *Settings) bool { return s.nodeType == repo.FullNode && s.Lite }
|
|
||||||
|
|
||||||
return Options(
|
return Options(
|
||||||
// make sure that online is applied before Config.
|
// make sure that online is applied before Config.
|
||||||
@ -252,159 +444,10 @@ func Online() Option {
|
|||||||
Error(errors.New("the Online option must be set before Config option")),
|
Error(errors.New("the Online option must be set before Config option")),
|
||||||
),
|
),
|
||||||
|
|
||||||
libp2p(),
|
LibP2P,
|
||||||
|
|
||||||
// common
|
ApplyIf(isFullOrLiteNode, ChainNode),
|
||||||
Override(new(*slashfilter.SlashFilter), modules.NewSlashFilter),
|
ApplyIf(isType(repo.StorageMiner), MinerNode),
|
||||||
|
|
||||||
// Full node or lite node
|
|
||||||
ApplyIf(isFullOrLiteNode,
|
|
||||||
// TODO: Fix offline mode
|
|
||||||
|
|
||||||
Override(new(dtypes.BootstrapPeers), modules.BuiltinBootstrap),
|
|
||||||
Override(new(dtypes.DrandBootstrap), modules.DrandBootstrap),
|
|
||||||
Override(new(dtypes.DrandSchedule), modules.BuiltinDrandConfig),
|
|
||||||
|
|
||||||
Override(new(ffiwrapper.Verifier), ffiwrapper.ProofVerifier),
|
|
||||||
Override(new(vm.SyscallBuilder), vm.Syscalls),
|
|
||||||
Override(new(*store.ChainStore), modules.ChainStore),
|
|
||||||
Override(new(stmgr.UpgradeSchedule), stmgr.DefaultUpgradeSchedule()),
|
|
||||||
Override(new(*stmgr.StateManager), modules.StateManager),
|
|
||||||
Override(new(*wallet.LocalWallet), wallet.NewWallet),
|
|
||||||
Override(new(wallet.Default), From(new(*wallet.LocalWallet))),
|
|
||||||
Override(new(api.WalletAPI), From(new(wallet.MultiWallet))),
|
|
||||||
Override(new(*messagesigner.MessageSigner), messagesigner.NewMessageSigner),
|
|
||||||
|
|
||||||
Override(new(dtypes.ChainBitswap), modules.ChainBitswap),
|
|
||||||
Override(new(dtypes.ChainBlockService), modules.ChainBlockService),
|
|
||||||
|
|
||||||
// Filecoin services
|
|
||||||
// We don't want the SyncManagerCtor to be used as an fx constructor, but rather as a value.
|
|
||||||
// It will be called implicitly by the Syncer constructor.
|
|
||||||
Override(new(chain.SyncManagerCtor), func() chain.SyncManagerCtor { return chain.NewSyncManager }),
|
|
||||||
Override(new(*chain.Syncer), modules.NewSyncer),
|
|
||||||
Override(new(exchange.Client), exchange.NewClient),
|
|
||||||
Override(new(*messagepool.MessagePool), modules.MessagePool),
|
|
||||||
Override(new(dtypes.DefaultMaxFeeFunc), modules.NewDefaultMaxFeeFunc),
|
|
||||||
|
|
||||||
Override(new(modules.Genesis), modules.ErrorGenesis),
|
|
||||||
Override(new(dtypes.AfterGenesisSet), modules.SetGenesis),
|
|
||||||
Override(SetGenesisKey, modules.DoSetGenesis),
|
|
||||||
|
|
||||||
Override(new(dtypes.NetworkName), modules.NetworkName),
|
|
||||||
Override(new(*hello.Service), hello.NewHelloService),
|
|
||||||
Override(new(exchange.Server), exchange.NewServer),
|
|
||||||
Override(new(*peermgr.PeerMgr), peermgr.NewPeerMgr),
|
|
||||||
|
|
||||||
Override(new(dtypes.Graphsync), modules.Graphsync(config.DefaultFullNode().Client.SimultaneousTransfers)),
|
|
||||||
Override(new(*dtypes.MpoolLocker), new(dtypes.MpoolLocker)),
|
|
||||||
Override(new(*discoveryimpl.Local), modules.NewLocalDiscovery),
|
|
||||||
Override(new(discovery.PeerResolver), modules.RetrievalResolver),
|
|
||||||
|
|
||||||
Override(new(retrievalmarket.RetrievalClient), modules.RetrievalClient),
|
|
||||||
Override(new(dtypes.ClientDatastore), modules.NewClientDatastore),
|
|
||||||
Override(new(dtypes.ClientDataTransfer), modules.NewClientGraphsyncDataTransfer),
|
|
||||||
Override(new(storagemarket.StorageClient), modules.StorageClient),
|
|
||||||
Override(new(storagemarket.StorageClientNode), storageadapter.NewClientNodeAdapter),
|
|
||||||
Override(new(beacon.Schedule), modules.RandomSchedule),
|
|
||||||
|
|
||||||
Override(new(*paychmgr.Store), paychmgr.NewStore),
|
|
||||||
Override(new(*paychmgr.Manager), paychmgr.NewManager),
|
|
||||||
Override(new(*market.FundManager), market.NewFundManager),
|
|
||||||
Override(HandleMigrateClientFundsKey, modules.HandleMigrateClientFunds),
|
|
||||||
Override(HandlePaymentChannelManagerKey, paychmgr.HandleManager),
|
|
||||||
Override(SettlePaymentChannelsKey, settler.SettlePaymentChannels),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Lite node
|
|
||||||
ApplyIf(isLiteNode,
|
|
||||||
Override(new(messagesigner.MpoolNonceAPI), From(new(modules.MpoolNonceAPI))),
|
|
||||||
Override(new(full.ChainModuleAPI), From(new(api.GatewayAPI))),
|
|
||||||
Override(new(full.GasModuleAPI), From(new(api.GatewayAPI))),
|
|
||||||
Override(new(full.MpoolModuleAPI), From(new(api.GatewayAPI))),
|
|
||||||
Override(new(full.StateModuleAPI), From(new(api.GatewayAPI))),
|
|
||||||
Override(new(stmgr.StateManagerAPI), modules.NewRPCStateManager),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Full node
|
|
||||||
ApplyIf(isFullNode,
|
|
||||||
Override(new(messagesigner.MpoolNonceAPI), From(new(*messagepool.MessagePool))),
|
|
||||||
Override(new(full.ChainModuleAPI), From(new(full.ChainModule))),
|
|
||||||
Override(new(full.GasModuleAPI), From(new(full.GasModule))),
|
|
||||||
Override(new(full.MpoolModuleAPI), From(new(full.MpoolModule))),
|
|
||||||
Override(new(full.StateModuleAPI), From(new(full.StateModule))),
|
|
||||||
Override(new(stmgr.StateManagerAPI), From(new(*stmgr.StateManager))),
|
|
||||||
|
|
||||||
Override(RunHelloKey, modules.RunHello),
|
|
||||||
Override(RunChainExchangeKey, modules.RunChainExchange),
|
|
||||||
Override(RunPeerMgrKey, modules.RunPeerMgr),
|
|
||||||
Override(HandleIncomingMessagesKey, modules.HandleIncomingMessages),
|
|
||||||
Override(HandleIncomingBlocksKey, modules.HandleIncomingBlocks),
|
|
||||||
),
|
|
||||||
|
|
||||||
// miner
|
|
||||||
ApplyIf(isType(repo.StorageMiner),
|
|
||||||
Override(new(api.Common), From(new(common.CommonAPI))),
|
|
||||||
Override(new(sectorstorage.StorageAuth), modules.StorageAuth),
|
|
||||||
|
|
||||||
Override(new(*stores.Index), stores.NewIndex),
|
|
||||||
Override(new(stores.SectorIndex), From(new(*stores.Index))),
|
|
||||||
Override(new(dtypes.MinerID), modules.MinerID),
|
|
||||||
Override(new(dtypes.MinerAddress), modules.MinerAddress),
|
|
||||||
Override(new(abi.RegisteredSealProof), modules.SealProofType),
|
|
||||||
Override(new(stores.LocalStorage), From(new(repo.LockedRepo))),
|
|
||||||
Override(new(sealing.SectorIDCounter), modules.SectorIDCounter),
|
|
||||||
Override(new(*sectorstorage.Manager), modules.SectorStorage),
|
|
||||||
Override(new(ffiwrapper.Verifier), ffiwrapper.ProofVerifier),
|
|
||||||
|
|
||||||
Override(new(sectorstorage.SectorManager), From(new(*sectorstorage.Manager))),
|
|
||||||
Override(new(storage2.Prover), From(new(sectorstorage.SectorManager))),
|
|
||||||
Override(new(storiface.WorkerReturn), From(new(sectorstorage.SectorManager))),
|
|
||||||
|
|
||||||
Override(new(*sectorblocks.SectorBlocks), sectorblocks.NewSectorBlocks),
|
|
||||||
Override(new(*storage.Miner), modules.StorageMiner(config.DefaultStorageMiner().Fees)),
|
|
||||||
Override(new(*storage.AddressSelector), modules.AddressSelector(nil)),
|
|
||||||
Override(new(dtypes.NetworkName), modules.StorageNetworkName),
|
|
||||||
|
|
||||||
Override(new(dtypes.StagingMultiDstore), modules.StagingMultiDatastore),
|
|
||||||
Override(new(dtypes.StagingBlockstore), modules.StagingBlockstore),
|
|
||||||
Override(new(dtypes.StagingDAG), modules.StagingDAG),
|
|
||||||
Override(new(dtypes.StagingGraphsync), modules.StagingGraphsync),
|
|
||||||
Override(new(retrievalmarket.RetrievalProvider), modules.RetrievalProvider),
|
|
||||||
Override(new(dtypes.ProviderDataTransfer), modules.NewProviderDAGServiceDataTransfer),
|
|
||||||
Override(new(dtypes.ProviderPieceStore), modules.NewProviderPieceStore),
|
|
||||||
Override(new(*storedask.StoredAsk), modules.NewStorageAsk),
|
|
||||||
Override(new(dtypes.StorageDealFilter), modules.BasicDealFilter(nil)),
|
|
||||||
Override(new(dtypes.RetrievalDealFilter), modules.RetrievalDealFilter(nil)),
|
|
||||||
Override(new(storagemarket.StorageProvider), modules.StorageProvider),
|
|
||||||
Override(new(*storageadapter.DealPublisher), storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{})),
|
|
||||||
Override(new(storagemarket.StorageProviderNode), storageadapter.NewProviderNodeAdapter(nil)),
|
|
||||||
Override(HandleMigrateProviderFundsKey, modules.HandleMigrateProviderFunds),
|
|
||||||
Override(HandleRetrievalKey, modules.HandleRetrieval),
|
|
||||||
Override(GetParamsKey, modules.GetParams),
|
|
||||||
Override(HandleDealsKey, modules.HandleDeals),
|
|
||||||
Override(new(gen.WinningPoStProver), storage.NewWinningPoStProver),
|
|
||||||
Override(new(*miner.Miner), modules.SetupBlockProducer),
|
|
||||||
|
|
||||||
Override(new(dtypes.ConsiderOnlineStorageDealsConfigFunc), modules.NewConsiderOnlineStorageDealsConfigFunc),
|
|
||||||
Override(new(dtypes.SetConsiderOnlineStorageDealsConfigFunc), modules.NewSetConsideringOnlineStorageDealsFunc),
|
|
||||||
Override(new(dtypes.ConsiderOnlineRetrievalDealsConfigFunc), modules.NewConsiderOnlineRetrievalDealsConfigFunc),
|
|
||||||
Override(new(dtypes.SetConsiderOnlineRetrievalDealsConfigFunc), modules.NewSetConsiderOnlineRetrievalDealsConfigFunc),
|
|
||||||
Override(new(dtypes.StorageDealPieceCidBlocklistConfigFunc), modules.NewStorageDealPieceCidBlocklistConfigFunc),
|
|
||||||
Override(new(dtypes.SetStorageDealPieceCidBlocklistConfigFunc), modules.NewSetStorageDealPieceCidBlocklistConfigFunc),
|
|
||||||
Override(new(dtypes.ConsiderOfflineStorageDealsConfigFunc), modules.NewConsiderOfflineStorageDealsConfigFunc),
|
|
||||||
Override(new(dtypes.SetConsiderOfflineStorageDealsConfigFunc), modules.NewSetConsideringOfflineStorageDealsFunc),
|
|
||||||
Override(new(dtypes.ConsiderOfflineRetrievalDealsConfigFunc), modules.NewConsiderOfflineRetrievalDealsConfigFunc),
|
|
||||||
Override(new(dtypes.SetConsiderOfflineRetrievalDealsConfigFunc), modules.NewSetConsiderOfflineRetrievalDealsConfigFunc),
|
|
||||||
Override(new(dtypes.ConsiderVerifiedStorageDealsConfigFunc), modules.NewConsiderVerifiedStorageDealsConfigFunc),
|
|
||||||
Override(new(dtypes.SetConsiderVerifiedStorageDealsConfigFunc), modules.NewSetConsideringVerifiedStorageDealsFunc),
|
|
||||||
Override(new(dtypes.ConsiderUnverifiedStorageDealsConfigFunc), modules.NewConsiderUnverifiedStorageDealsConfigFunc),
|
|
||||||
Override(new(dtypes.SetConsiderUnverifiedStorageDealsConfigFunc), modules.NewSetConsideringUnverifiedStorageDealsFunc),
|
|
||||||
Override(new(dtypes.SetSealingConfigFunc), modules.NewSetSealConfigFunc),
|
|
||||||
Override(new(dtypes.GetSealingConfigFunc), modules.NewGetSealConfigFunc),
|
|
||||||
Override(new(dtypes.SetExpectedSealDurationFunc), modules.NewSetExpectedSealDurationFunc),
|
|
||||||
Override(new(dtypes.GetExpectedSealDurationFunc), modules.NewGetExpectedSealDurationFunc),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user