From 5c6988a7c126e278f6c2adf62c26828138ec211a Mon Sep 17 00:00:00 2001 From: vyzo Date: Tue, 2 Feb 2021 21:26:50 +0200 Subject: [PATCH 01/12] refactor coalescing logic into its own function, take both cancellation sets into account --- chain/store/coalescer.go | 71 ++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/chain/store/coalescer.go b/chain/store/coalescer.go index 443359c8a..a6d066bca 100644 --- a/chain/store/coalescer.go +++ b/chain/store/coalescer.go @@ -157,52 +157,51 @@ func (c *HeadChangeCoalescer) coalesce(revert, apply []*types.TipSet) { // coalesced revert set // - pending reverts are cancelled by incoming applys // - incoming reverts are cancelled by pending applys - newRevert := make([]*types.TipSet, 0, len(c.revert)+len(revert)) - for _, ts := range c.revert { - _, cancel := applying[ts.Key()] - if cancel { - continue - } - - newRevert = append(newRevert, ts) - } - - for _, ts := range revert { - _, cancel := pendApply[ts.Key()] - if cancel { - continue - } - - newRevert = append(newRevert, ts) - } + newRevert := c.merge(c.revert, revert, pendApply, applying) // coalesced apply set // - pending applys are cancelled by incoming reverts // - incoming applys are cancelled by pending reverts - newApply := make([]*types.TipSet, 0, len(c.apply)+len(apply)) - for _, ts := range c.apply { - _, cancel := reverting[ts.Key()] - if cancel { - continue - } - - newApply = append(newApply, ts) - } - - for _, ts := range apply { - _, cancel := pendRevert[ts.Key()] - if cancel { - continue - } - - newApply = append(newApply, ts) - } + newApply := c.merge(c.apply, apply, pendRevert, reverting) // commit the coalesced sets c.revert = newRevert c.apply = newApply } +func (c *HeadChangeCoalescer) merge(pend, incoming []*types.TipSet, cancel1, cancel2 map[types.TipSetKey]struct{}) []*types.TipSet { + result := make([]*types.TipSet, 0, len(pend)+len(incoming)) + for _, ts := range pend { + _, cancel := cancel1[ts.Key()] + if cancel { + continue + } + + _, cancel = cancel2[ts.Key()] + if cancel { + continue + } + + result = append(result, ts) + } + + for _, ts := range incoming { + _, cancel := cancel1[ts.Key()] + if cancel { + continue + } + + _, cancel = cancel2[ts.Key()] + if cancel { + continue + } + + result = append(result, ts) + } + + return result +} + func (c *HeadChangeCoalescer) dispatch() { err := c.notify(c.revert, c.apply) if err != nil { From ebfde330ddb51d22dc10ba6f2f468e9671193b1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 4 Feb 2021 20:06:00 +0100 Subject: [PATCH 02/12] shed: Support miner nodes in rpc util --- cmd/lotus-shed/rpc.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cmd/lotus-shed/rpc.go b/cmd/lotus-shed/rpc.go index cbee95c6b..fe81e5a62 100644 --- a/cmd/lotus-shed/rpc.go +++ b/cmd/lotus-shed/rpc.go @@ -24,9 +24,18 @@ import ( var rpcCmd = &cli.Command{ Name: "rpc", Usage: "Interactive JsonPRC shell", - // TODO: flag for miner/worker + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "miner", + }, + }, Action: func(cctx *cli.Context) error { - addr, headers, err := lcli.GetRawAPI(cctx, repo.FullNode) + rt := repo.FullNode + if cctx.Bool("miner") { + rt = repo.StorageMiner + } + + addr, headers, err := lcli.GetRawAPI(cctx, rt) if err != nil { return err } From adeb4cefee60d7e853e469ff8e7655d3e8131e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 8 Feb 2021 16:41:00 +0100 Subject: [PATCH 03/12] node builder: Cleanup and add some docstrings --- node/builder.go | 427 ++++++++++++++++++++++++++---------------------- 1 file changed, 235 insertions(+), 192 deletions(-) diff --git a/node/builder.go b/node/builder.go index 5f61420d4..0766d934a 100644 --- a/node/builder.go +++ b/node/builder.go @@ -171,6 +171,7 @@ type Settings struct { Lite bool // Start node in "lite" mode } +// Basic lotus-app services func defaults() []Option { return []Option{ // global system journal. @@ -184,65 +185,256 @@ func defaults() []Option { 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{})), - - // Filecoin modules - } } -func libp2p() Option { - return Options( - Override(new(peerstore.Peerstore), pstoremem.NewPeerstore), +var LibP2P = Options( + // Host config + 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), - Override(new(host.Host), lp2p.RoutedHost), - Override(new(lp2p.BaseIpfsRouting), lp2p.DHTRouting(dht.ModeAuto)), + // Host settings + Override(DefaultTransportsKey, lp2p.DefaultTransports), + 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), - Override(AddrsFactoryKey, lp2p.AddrsFactory(nil, nil)), - Override(SmuxTransportKey, lp2p.SmuxTransport(true)), - Override(RelayKey, lp2p.NoRelay()), - Override(SecurityKey, lp2p.Security(true, false)), + // Host + Override(new(lp2p.RawHost), lp2p.Host), + Override(new(host.Host), lp2p.RoutedHost), + Override(new(lp2p.BaseIpfsRouting), lp2p.DHTRouting(dht.ModeAuto)), - Override(BaseRoutingKey, lp2p.BaseRouting), - Override(new(routing.Routing), lp2p.Routing), + Override(DiscoveryHandlerKey, lp2p.DiscoveryHandler), - Override(NatPortMapKey, lp2p.NatPortMap), - Override(BandwidthReporterKey, lp2p.BandwidthCounter), + // Routing + 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)), - Override(AutoNATSvcKey, lp2p.AutoNATService), + // Services + Override(NatPortMapKey, lp2p.NatPortMap), + Override(BandwidthReporterKey, lp2p.BandwidthCounter), + Override(AutoNATSvcKey, lp2p.AutoNATService), - Override(new(*dtypes.ScoreKeeper), lp2p.ScoreKeeper), - Override(new(*pubsub.PubSub), lp2p.GossipSub), - Override(new(*config.Pubsub), func(bs dtypes.Bootstrapper) *config.Pubsub { - return &config.Pubsub{ - Bootstrapper: bool(bs), - } - }), + // Services (pubsub) + Override(new(*dtypes.ScoreKeeper), lp2p.ScoreKeeper), + Override(new(*pubsub.PubSub), lp2p.GossipSub), + Override(new(*config.Pubsub), func(bs dtypes.Bootstrapper) *config.Pubsub { + return &config.Pubsub{ + Bootstrapper: bool(bs), + } + }), - Override(PstoreAddSelfKeysKey, lp2p.PstoreAddSelfKeys), - Override(StartListeningKey, lp2p.StartListening(config.DefaultFullNode().Libp2p.ListenAddresses)), - - Override(new(*conngater.BasicConnectionGater), lp2p.ConnGater), - Override(ConnGaterKey, lp2p.ConnGaterOption), - ) -} + // Services (connection management) + Override(ConnectionManagerKey, lp2p.ConnectionManager(50, 200, 20*time.Second, nil)), + Override(new(*conngater.BasicConnectionGater), lp2p.ConnGater), + Override(ConnGaterKey, lp2p.ConnGaterOption), +) func isType(t repo.RepoType) func(s *Settings) bool { 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 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( // 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")), ), - libp2p(), + LibP2P, - // common - Override(new(*slashfilter.SlashFilter), modules.NewSlashFilter), - - // 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), - ), + ApplyIf(isFullOrLiteNode, ChainNode), + ApplyIf(isType(repo.StorageMiner), MinerNode), ) } From 307fc14093dff4952a44f9853d7b5f41b2789382 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Tue, 9 Feb 2021 17:08:19 +0100 Subject: [PATCH 04/12] go.mod: do not depend on gocheck --- go.mod | 3 +-- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index b3a144ed6..9de0bd583 100644 --- a/go.mod +++ b/go.mod @@ -133,7 +133,7 @@ require ( github.com/whyrusleeping/cbor-gen v0.0.0-20210118024343-169e9d70c0c2 github.com/whyrusleeping/ledger-filecoin-go v0.9.1-0.20201010031517-c3dcc1bddce4 github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 - github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d + github.com/whyrusleeping/pubsub v0.0.0-20190708150250-92bcb0691325 github.com/xorcare/golden v0.6.1-0.20191112154924-b87f686d7542 go.opencensus.io v0.22.5 go.uber.org/dig v1.10.0 // indirect @@ -147,7 +147,6 @@ require ( golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 gopkg.in/cheggaaa/pb.v1 v1.0.28 gotest.tools v2.2.0+incompatible - launchpad.net/gocheck v0.0.0-20140225173054-000000000087 // indirect ) replace github.com/filecoin-project/lotus => ./ diff --git a/go.sum b/go.sum index b40b7000c..8fa392904 100644 --- a/go.sum +++ b/go.sum @@ -1503,8 +1503,8 @@ github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84 github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d h1:wnjWu1N8UTNf2zzF5FWlEyNNbNw5GMVHaHaaLdvdTdA= -github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d/go.mod h1:g7ckxrjiFh8mi1AY7ox23PZD0g6QU/TxW3U3unX7I3A= +github.com/whyrusleeping/pubsub v0.0.0-20190708150250-92bcb0691325 h1:++Zf4xQ7YrkE81gNHIjVqx5JZsn0nbMeHOkY1ILAIME= +github.com/whyrusleeping/pubsub v0.0.0-20190708150250-92bcb0691325/go.mod h1:g7ckxrjiFh8mi1AY7ox23PZD0g6QU/TxW3U3unX7I3A= github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee h1:lYbXeSvJi5zk5GLKVuid9TVjS9a0OmLIDKTfoZBL6Ow= github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:m2aV4LZI4Aez7dP5PMyVKEHhUyEJ/RjmPEDOpDvudHg= github.com/whyrusleeping/yamux v1.1.5/go.mod h1:E8LnQQ8HKx5KD29HZFUwM1PxCOdPRzGwur1mcYhXcD8= @@ -1952,8 +1952,6 @@ honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXe honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= howett.net/plist v0.0.0-20181124034731-591f970eefbb h1:jhnBjNi9UFpfpl8YZhA9CrOqpnJdvzuiHsl/dnxl11M= howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= -launchpad.net/gocheck v0.0.0-20140225173054-000000000087 h1:Izowp2XBH6Ya6rv+hqbceQyw/gSGoXfH/UPoTGduL54= -launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM= modernc.org/cc v1.0.0 h1:nPibNuDEx6tvYrUAtvDTTw98rx5juGsa5zuDnKwEEQQ= modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= modernc.org/fileutil v1.0.0/go.mod h1:JHsWpkrk/CnVV1H/eGlFf85BEpfkrp56ro8nojIq9Q8= From 59f814028f2e7f8ac84c1ad2566836456897f6cb Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Tue, 9 Feb 2021 18:48:43 +0100 Subject: [PATCH 05/12] add storageadapter.PublishMsgConfig to miner in testkit --- testplans/lotus-soup/go.mod | 2 +- testplans/lotus-soup/go.sum | 16 ++++------------ testplans/lotus-soup/testkit/role_miner.go | 5 +++++ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/testplans/lotus-soup/go.mod b/testplans/lotus-soup/go.mod index 4d52f9fe0..9974fe81c 100644 --- a/testplans/lotus-soup/go.mod +++ b/testplans/lotus-soup/go.mod @@ -12,7 +12,7 @@ require ( github.com/filecoin-project/go-jsonrpc v0.1.2 github.com/filecoin-project/go-state-types v0.0.0-20210119062722-4adba5aaea71 github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b - github.com/filecoin-project/lotus v1.5.0-pre3.0.20210208143915-0afe7325f677 + github.com/filecoin-project/lotus v1.5.0-pre3.0.20210209162308-5a3b9839540b github.com/filecoin-project/specs-actors v0.9.13 github.com/google/uuid v1.1.2 github.com/gorilla/mux v1.7.4 diff --git a/testplans/lotus-soup/go.sum b/testplans/lotus-soup/go.sum index 76f0b9006..083fbafa4 100644 --- a/testplans/lotus-soup/go.sum +++ b/testplans/lotus-soup/go.sum @@ -268,8 +268,6 @@ github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f/go github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a h1:hyJ+pUm/4U4RdEZBlg6k8Ma4rDiuvqyGpoICXAxwsTg= github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ= github.com/filecoin-project/go-fil-markets v1.0.5-0.20201113164554-c5eba40d5335/go.mod h1:AJySOJC00JRWEZzRG2KsfUnqEf5ITXxeX09BE9N4f9c= -github.com/filecoin-project/go-fil-markets v1.1.2 h1:5FVdDmF9GvW6Xllql9OGiJXEZjh/tu590BXSQH2W/vU= -github.com/filecoin-project/go-fil-markets v1.1.2/go.mod h1:6oTRaAsHnCqhi3mpZqdvnWIzH6QzHQc4dbhJrI9/BfQ= github.com/filecoin-project/go-fil-markets v1.1.7 h1:7yy7alIDWzUxljxZhGmG3+wvaU4Ty5QDMbPmdZeaIJ8= github.com/filecoin-project/go-fil-markets v1.1.7/go.mod h1:6oTRaAsHnCqhi3mpZqdvnWIzH6QzHQc4dbhJrI9/BfQ= github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM= @@ -298,10 +296,8 @@ github.com/filecoin-project/go-statestore v0.1.0 h1:t56reH59843TwXHkMcwyuayStBIi github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI= github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b h1:fkRZSPrYpk42PV3/lIXiL0LHetxde7vyYYvSsttQtfg= github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b/go.mod h1:Q0GQOBtKf1oE10eSXSlhN45kDBdGvEcVOqMiffqX+N8= -github.com/filecoin-project/lotus v1.5.0-pre3.0.20210129041213-b4ad2e5e93dc h1:sSuevGua2qnMYFbCfmIVY4PrgeiqnO+B+lMvAvjOQJg= -github.com/filecoin-project/lotus v1.5.0-pre3.0.20210129041213-b4ad2e5e93dc/go.mod h1:z4jbMMD9IFSBsin3xytoe4XphQPaJDrqdnC8AWNIF5w= -github.com/filecoin-project/lotus v1.5.0-pre3.0.20210208143915-0afe7325f677 h1:q5JrE5JVqwwn8UFN7rBHfG0dJt2EJNbw8DY21dVngvM= -github.com/filecoin-project/lotus v1.5.0-pre3.0.20210208143915-0afe7325f677/go.mod h1:uFOz8oe+uOQnU+ynrzs5jInUw4tyXsxPui6x3k2DKhM= +github.com/filecoin-project/lotus v1.5.0-pre3.0.20210209162308-5a3b9839540b h1:6L8LdxQDksFInGRmYbCrujBc7fEHip13T6UQX6iTk+I= +github.com/filecoin-project/lotus v1.5.0-pre3.0.20210209162308-5a3b9839540b/go.mod h1:frbnLE7QVAsmwe5XwTI6P0ZjjpGvA5/h1cM6yg2zhYM= github.com/filecoin-project/specs-actors v0.9.4/go.mod h1:BStZQzx5x7TmCkLv0Bpa07U6cPKol6fd3w9KjMPZ6Z4= github.com/filecoin-project/specs-actors v0.9.12/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao= github.com/filecoin-project/specs-actors v0.9.13 h1:rUEOQouefi9fuVY/2HOroROJlZbOzWYXXeIh41KF2M4= @@ -310,8 +306,6 @@ github.com/filecoin-project/specs-actors/v2 v2.0.1/go.mod h1:v2NZVYinNIKA9acEMBm github.com/filecoin-project/specs-actors/v2 v2.3.2/go.mod h1:UuJQLoTx/HPvvWeqlIFmC/ywlOLHNe8SNQ3OunFbu2Y= github.com/filecoin-project/specs-actors/v2 v2.3.4 h1:NZK2oMCcA71wNsUzDBmLQyRMzcCnX9tDGvwZ53G67j8= github.com/filecoin-project/specs-actors/v2 v2.3.4/go.mod h1:UuJQLoTx/HPvvWeqlIFmC/ywlOLHNe8SNQ3OunFbu2Y= -github.com/filecoin-project/specs-actors/v3 v3.0.1-0.20210128055125-ab0632b1c8fa h1:J0yyTt9MLDaN0XvzjEAWTCvG6SRVfXc6dVLluvRiOsQ= -github.com/filecoin-project/specs-actors/v3 v3.0.1-0.20210128055125-ab0632b1c8fa/go.mod h1:NL24TPjJGyU7fh1ztpUyYcoZi3TmRKNEI0huPYmhObA= github.com/filecoin-project/specs-actors/v3 v3.0.1-0.20210128235937-57195d8909b1 h1:I6mvbwANIoToUZ37cYmuLyDKbPlAUxWnp0fJOZnlTz4= github.com/filecoin-project/specs-actors/v3 v3.0.1-0.20210128235937-57195d8909b1/go.mod h1:NL24TPjJGyU7fh1ztpUyYcoZi3TmRKNEI0huPYmhObA= github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506 h1:Ur/l2+6qN+lQiqjozWWc5p9UDaAMDZKTlDS98oRnlIw= @@ -1548,8 +1542,8 @@ github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84 github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d h1:wnjWu1N8UTNf2zzF5FWlEyNNbNw5GMVHaHaaLdvdTdA= -github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d/go.mod h1:g7ckxrjiFh8mi1AY7ox23PZD0g6QU/TxW3U3unX7I3A= +github.com/whyrusleeping/pubsub v0.0.0-20190708150250-92bcb0691325 h1:++Zf4xQ7YrkE81gNHIjVqx5JZsn0nbMeHOkY1ILAIME= +github.com/whyrusleeping/pubsub v0.0.0-20190708150250-92bcb0691325/go.mod h1:g7ckxrjiFh8mi1AY7ox23PZD0g6QU/TxW3U3unX7I3A= github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee h1:lYbXeSvJi5zk5GLKVuid9TVjS9a0OmLIDKTfoZBL6Ow= github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:m2aV4LZI4Aez7dP5PMyVKEHhUyEJ/RjmPEDOpDvudHg= github.com/whyrusleeping/yamux v1.1.5/go.mod h1:E8LnQQ8HKx5KD29HZFUwM1PxCOdPRzGwur1mcYhXcD8= @@ -2009,8 +2003,6 @@ honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXe honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= howett.net/plist v0.0.0-20181124034731-591f970eefbb h1:jhnBjNi9UFpfpl8YZhA9CrOqpnJdvzuiHsl/dnxl11M= howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= -launchpad.net/gocheck v0.0.0-20140225173054-000000000087 h1:Izowp2XBH6Ya6rv+hqbceQyw/gSGoXfH/UPoTGduL54= -launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM= modernc.org/cc v1.0.0 h1:nPibNuDEx6tvYrUAtvDTTw98rx5juGsa5zuDnKwEEQQ= modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= modernc.org/fileutil v1.0.0/go.mod h1:JHsWpkrk/CnVV1H/eGlFf85BEpfkrp56ro8nojIq9Q8= diff --git a/testplans/lotus-soup/testkit/role_miner.go b/testplans/lotus-soup/testkit/role_miner.go index 19eca4514..7bd688780 100644 --- a/testplans/lotus-soup/testkit/role_miner.go +++ b/testplans/lotus-soup/testkit/role_miner.go @@ -25,6 +25,7 @@ import ( "github.com/filecoin-project/lotus/chain/wallet" "github.com/filecoin-project/lotus/cmd/lotus-seed/seed" "github.com/filecoin-project/lotus/extern/sector-storage/stores" + "github.com/filecoin-project/lotus/markets/storageadapter" "github.com/filecoin-project/lotus/miner" "github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node/impl" @@ -264,6 +265,10 @@ func PrepareMiner(t *TestEnvironment) (*LotusMiner, error) { node.Online(), node.Repo(minerRepo), node.Override(new(api.FullNode), n.FullApi), + node.Override(new(*storageadapter.DealPublisher), storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{ + Period: 15 * time.Second, + MaxDealsPerMsg: 1, + })), withApiEndpoint(fmt.Sprintf("/ip4/0.0.0.0/tcp/%s", t.PortNumber("miner_rpc", "0"))), withMinerListenAddress(minerIP), } From e387f3810ed6ef2405d8d11daa74071516a64ccb Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Tue, 9 Feb 2021 14:18:19 -0800 Subject: [PATCH 06/12] add code cid to stateReadState output --- api/api_full.go | 1 + node/impl/full/state.go | 1 + 2 files changed, 2 insertions(+) diff --git a/api/api_full.go b/api/api_full.go index 7aea4c443..9c967ca32 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -650,6 +650,7 @@ type Message struct { type ActorState struct { Balance types.BigInt + Code cid.Cid State interface{} } diff --git a/node/impl/full/state.go b/node/impl/full/state.go index 04105b225..0f5d16ab2 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -473,6 +473,7 @@ func (a *StateAPI) StateReadState(ctx context.Context, actor address.Address, ts return &api.ActorState{ Balance: act.Balance, + Code: act.Code, State: oif, }, nil } From b17f644ab9eabc7bea43c51e4dfd9d1865535bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 10 Feb 2021 00:46:33 +0100 Subject: [PATCH 07/12] docsgen --- documentation/en/api-methods.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/documentation/en/api-methods.md b/documentation/en/api-methods.md index a35481135..abf048f46 100644 --- a/documentation/en/api-methods.md +++ b/documentation/en/api-methods.md @@ -4405,6 +4405,9 @@ Response: ```json { "Balance": "0", + "Code": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, "State": {} } ``` From 6d4caa0163dc3c9f16b747605b841a972c3e0108 Mon Sep 17 00:00:00 2001 From: Cory Schwartz Date: Tue, 9 Feb 2021 16:54:32 -0800 Subject: [PATCH 08/12] lotus-seed command to generate lotus block Currently devnet deployment requires spinning up a full daemon. This would move the daemon `lotus-make-genesis` logic to lotus-seed so it can be more easily executed in scripts, etc. --- cmd/lotus-seed/genesis.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/cmd/lotus-seed/genesis.go b/cmd/lotus-seed/genesis.go index bbaea6969..b99302de6 100644 --- a/cmd/lotus-seed/genesis.go +++ b/cmd/lotus-seed/genesis.go @@ -9,6 +9,11 @@ import ( "strconv" "strings" + "github.com/filecoin-project/lotus/chain/vm" + "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" + "github.com/filecoin-project/lotus/journal" + "github.com/filecoin-project/lotus/lib/blockstore" + "github.com/filecoin-project/lotus/node/modules/testing" "github.com/google/uuid" "github.com/mitchellh/go-homedir" "github.com/urfave/cli/v2" @@ -32,6 +37,7 @@ var genesisCmd = &cli.Command{ genesisNewCmd, genesisAddMinerCmd, genesisAddMsigsCmd, + genesisCarCmd, }, } @@ -302,3 +308,31 @@ func parseMultisigCsv(csvf string) ([]GenAccountEntry, error) { return entries, nil } + +var genesisCarCmd = &cli.Command{ + Name: "car", + Description: "write genesis car file", + ArgsUsage: "genesis template `FILE`", + Flags: []cli.Flag{ + &cli.StringFlag{ + Name: "out", + Aliases: []string{"o"}, + Value: "genesis.car", + Usage: "write output to `FILE`", + }, + }, + Action: func(c *cli.Context) error { + if c.Args().Len() != 1 { + return xerrors.Errorf("Please specify a genesis template. (i.e, the one created with `genesis new`)") + } + ofile := c.String("out") + jrnl := journal.NilJournal() + bstor := blockstore.NewTemporarySync() + sbldr := vm.Syscalls(ffiwrapper.ProofVerifier) + _, err := testing.MakeGenesis(ofile, c.Args().First())(bstor, sbldr, jrnl)() + if err != nil { + return err + } + return nil + }, +} From 039ca9f3b47a1ba0360074b8665d69f3cc7e8361 Mon Sep 17 00:00:00 2001 From: Cory Schwartz Date: Tue, 9 Feb 2021 17:05:56 -0800 Subject: [PATCH 09/12] return the err --- cmd/lotus-seed/genesis.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmd/lotus-seed/genesis.go b/cmd/lotus-seed/genesis.go index b99302de6..c68867891 100644 --- a/cmd/lotus-seed/genesis.go +++ b/cmd/lotus-seed/genesis.go @@ -330,9 +330,6 @@ var genesisCarCmd = &cli.Command{ bstor := blockstore.NewTemporarySync() sbldr := vm.Syscalls(ffiwrapper.ProofVerifier) _, err := testing.MakeGenesis(ofile, c.Args().First())(bstor, sbldr, jrnl)() - if err != nil { - return err - } - return nil + return err }, } From b6c9ddccfff30a47b3cb1d29f1d99b7a29dd01b4 Mon Sep 17 00:00:00 2001 From: Dirk McCormick Date: Mon, 8 Feb 2021 16:31:06 +0100 Subject: [PATCH 10/12] feat: deals - show data transfer % --- api/api_full.go | 7 ++++--- cli/client.go | 23 ++++++++++++----------- cli/test/client.go | 1 - documentation/en/api-methods-miner.md | 3 ++- documentation/en/api-methods.md | 10 +++++++--- go.mod | 2 +- go.sum | 4 ++-- node/impl/client/client.go | 15 +++++++++++++-- 8 files changed, 41 insertions(+), 24 deletions(-) diff --git a/api/api_full.go b/api/api_full.go index 7aea4c443..4c0003a16 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -937,9 +937,10 @@ type DataSize struct { } type DataCIDSize struct { - PayloadSize int64 - PieceSize abi.PaddedPieceSize - PieceCID cid.Cid + RawBlockSize uint64 + PayloadSize int64 + PieceSize abi.PaddedPieceSize + PieceCID cid.Cid } type CommPRet struct { diff --git a/cli/client.go b/cli/client.go index 60729f2e5..10ea092a8 100644 --- a/cli/client.go +++ b/cli/client.go @@ -850,8 +850,9 @@ uiLoop: TransferType: storagemarket.TTGraphsync, Root: data, - PieceCid: &ds.PieceCID, - PieceSize: ds.PieceSize.Unpadded(), + PieceCid: &ds.PieceCID, + PieceSize: ds.PieceSize.Unpadded(), + RawBlockSize: ds.RawBlockSize, }, Wallet: a, Miner: maddr, @@ -1567,7 +1568,7 @@ func outputStorageDeals(ctx context.Context, out io.Writer, full lapi.FullNode, if verbose { w := tabwriter.NewWriter(out, 2, 4, 2, ' ', 0) - fmt.Fprintf(w, "Created\tDealCid\tDealId\tProvider\tState\tOn Chain?\tSlashed?\tPieceCID\tSize\tPrice\tDuration\tTransferChannelID\tTransferStatus\tVerified\tMessage\n") + fmt.Fprintf(w, "Created\tDealCid\tDealId\tProvider\tState\tOn Chain?\tSlashed?\tPieceCID\tSize\tPrice\tDuration\tTransferChannelID\tTransferStatus\tTransfer %%\tVerified\tMessage\n") for _, d := range deals { onChain := "N" if d.OnChainDealState.SectorStartEpoch != -1 { @@ -1585,17 +1586,16 @@ func outputStorageDeals(ctx context.Context, out io.Writer, full lapi.FullNode, transferChannelID = d.LocalDeal.TransferChannelID.String() } transferStatus := "" + transferPct := "" if d.LocalDeal.DataTransfer != nil { transferStatus = datatransfer.Statuses[d.LocalDeal.DataTransfer.Status] - // TODO: Include the transferred percentage once this bug is fixed: - // https://github.com/ipfs/go-graphsync/issues/126 - //fmt.Printf("transferred: %d / size: %d\n", d.LocalDeal.DataTransfer.Transferred, d.LocalDeal.Size) - //if d.LocalDeal.Size > 0 { - // pct := (100 * d.LocalDeal.DataTransfer.Transferred) / d.LocalDeal.Size - // transferPct = fmt.Sprintf("%d%%", pct) - //} + // Calculate transfer % + if d.LocalDeal.DataRef.RawBlockSize > 0 { + pct := (100 * d.LocalDeal.DataTransfer.Transferred) / d.LocalDeal.DataRef.RawBlockSize + transferPct = fmt.Sprintf("%d%%", pct) + } } - fmt.Fprintf(w, "%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%d\t%s\t%s\t%v\t%s\n", + fmt.Fprintf(w, "%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%d\t%s\t%s\t%s\t%v\t%s\n", d.LocalDeal.CreationTime.Format(time.Stamp), d.LocalDeal.ProposalCid, d.LocalDeal.DealID, @@ -1609,6 +1609,7 @@ func outputStorageDeals(ctx context.Context, out io.Writer, full lapi.FullNode, d.LocalDeal.Duration, transferChannelID, transferStatus, + transferPct, d.LocalDeal.Verified, d.LocalDeal.Message) } diff --git a/cli/test/client.go b/cli/test/client.go index 4a49f732a..4cb1300a1 100644 --- a/cli/test/client.go +++ b/cli/test/client.go @@ -69,7 +69,6 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode test.TestNode) dataCid2.String(), duration, minerAddr.String(), - "no", "yes", } out = clientCLI.RunInteractiveCmd(cmd, interactiveCmds) diff --git a/documentation/en/api-methods-miner.md b/documentation/en/api-methods-miner.md index aa84ebdf2..08d249a10 100644 --- a/documentation/en/api-methods-miner.md +++ b/documentation/en/api-methods-miner.md @@ -643,7 +643,8 @@ Response: "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" }, "PieceCid": null, - "PieceSize": 1024 + "PieceSize": 1024, + "RawBlockSize": 42 }, "AvailableForRetrieval": true, "DealID": 5432, diff --git a/documentation/en/api-methods.md b/documentation/en/api-methods.md index a35481135..444e23729 100644 --- a/documentation/en/api-methods.md +++ b/documentation/en/api-methods.md @@ -930,6 +930,7 @@ Inputs: Response: ```json { + "RawBlockSize": 42, "PayloadSize": 9, "PieceSize": 1032, "PieceCID": { @@ -1028,7 +1029,8 @@ Response: "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" }, "PieceCid": null, - "PieceSize": 1024 + "PieceSize": 1024, + "RawBlockSize": 42 }, "PieceCID": { "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" @@ -1098,7 +1100,8 @@ Response: "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" }, "PieceCid": null, - "PieceSize": 1024 + "PieceSize": 1024, + "RawBlockSize": 42 }, "PieceCID": { "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" @@ -1416,7 +1419,8 @@ Inputs: "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" }, "PieceCid": null, - "PieceSize": 1024 + "PieceSize": 1024, + "RawBlockSize": 42 }, "Wallet": "f01234", "Miner": "f01234", diff --git a/go.mod b/go.mod index b3a144ed6..a1b13adb9 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 github.com/filecoin-project/go-data-transfer v1.2.7 github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a - github.com/filecoin-project/go-fil-markets v1.1.7 + github.com/filecoin-project/go-fil-markets v1.1.8 github.com/filecoin-project/go-jsonrpc v0.1.2 github.com/filecoin-project/go-multistore v0.0.3 github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20 diff --git a/go.sum b/go.sum index b40b7000c..05cbf5273 100644 --- a/go.sum +++ b/go.sum @@ -269,8 +269,8 @@ github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f/go github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a h1:hyJ+pUm/4U4RdEZBlg6k8Ma4rDiuvqyGpoICXAxwsTg= github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ= github.com/filecoin-project/go-fil-markets v1.0.5-0.20201113164554-c5eba40d5335/go.mod h1:AJySOJC00JRWEZzRG2KsfUnqEf5ITXxeX09BE9N4f9c= -github.com/filecoin-project/go-fil-markets v1.1.7 h1:7yy7alIDWzUxljxZhGmG3+wvaU4Ty5QDMbPmdZeaIJ8= -github.com/filecoin-project/go-fil-markets v1.1.7/go.mod h1:6oTRaAsHnCqhi3mpZqdvnWIzH6QzHQc4dbhJrI9/BfQ= +github.com/filecoin-project/go-fil-markets v1.1.8 h1:rnb+9Did4sClxTUHDpzmf9WmTzL1wQsBSsUb9RQa4Rg= +github.com/filecoin-project/go-fil-markets v1.1.8/go.mod h1:6oTRaAsHnCqhi3mpZqdvnWIzH6QzHQc4dbhJrI9/BfQ= github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM= github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24= github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM= diff --git a/node/impl/client/client.go b/node/impl/client/client.go index 00c840b63..2a60da9bf 100644 --- a/node/impl/client/client.go +++ b/node/impl/client/client.go @@ -755,7 +755,13 @@ func (a *API) ClientDealPieceCID(ctx context.Context, root cid.Cid) (api.DataCID w := &writer.Writer{} bw := bufio.NewWriterSize(w, int(writer.CommPBuf)) - err := car.WriteCar(ctx, dag, []cid.Cid{root}, w) + // Calculate the raw block size so we can figure out the transfer percentage + // (the raw block size is the denominator) + var rawBlockSize uint64 + err := car.WriteCarWithWalker(ctx, dag, []cid.Cid{root}, w, func(nd ipld.Node) ([]*ipld.Link, error) { + rawBlockSize += uint64(len(nd.RawData())) + return nd.Links(), nil + }) if err != nil { return api.DataCIDSize{}, err } @@ -765,7 +771,12 @@ func (a *API) ClientDealPieceCID(ctx context.Context, root cid.Cid) (api.DataCID } dataCIDSize, err := w.Sum() - return api.DataCIDSize(dataCIDSize), err + return api.DataCIDSize{ + RawBlockSize: rawBlockSize, + PayloadSize: dataCIDSize.PayloadSize, + PieceSize: dataCIDSize.PieceSize, + PieceCID: dataCIDSize.PieceCID, + }, err } func (a *API) ClientGenCar(ctx context.Context, ref api.FileRef, outputPath string) error { From 044972ebdc75810e92ed60045813aec20e55b360 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Wed, 10 Feb 2021 14:38:42 +0100 Subject: [PATCH 11/12] make categories uppercase --- cli/cmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/cmd.go b/cli/cmd.go index 02ef06002..12ea76855 100644 --- a/cli/cmd.go +++ b/cli/cmd.go @@ -324,6 +324,6 @@ var Commands = []*cli.Command{ } func WithCategory(cat string, cmd *cli.Command) *cli.Command { - cmd.Category = cat + cmd.Category = strings.ToUpper(cat) return cmd } From 0c6aef221d5b5f7fa6cdb54802726ccf134e51ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 11 Feb 2021 12:00:26 +0100 Subject: [PATCH 12/12] Fix error logging format strings --- chain/market/fundmanager.go | 4 ++-- chain/messagepool/selection.go | 2 +- chain/stmgr/stmgr.go | 2 +- cli/log.go | 2 +- cmd/lotus-chainwatch/processor/processor.go | 12 ++++++------ cmd/lotus-shed/jwt.go | 2 +- cmd/lotus-shed/keyinfo.go | 2 +- markets/storageadapter/provider.go | 2 +- node/modules/client.go | 6 +++--- node/modules/storageminer.go | 6 +++--- paychmgr/simple.go | 2 +- storage/wdpost_run.go | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/chain/market/fundmanager.go b/chain/market/fundmanager.go index 99f8b9173..e3f10fdec 100644 --- a/chain/market/fundmanager.go +++ b/chain/market/fundmanager.go @@ -324,7 +324,7 @@ func (a *fundedAddress) saveState() { // Not much we can do if saving to the datastore fails, just log err := a.str.save(a.state) if err != nil { - log.Errorf("saving state to store for addr %s: %w", a.state.Addr, err) + log.Errorf("saving state to store for addr %s: %v", a.state.Addr, err) } } @@ -579,7 +579,7 @@ func (a *fundedAddress) startWaitForResults(msgCid cid.Cid) { if err != nil { // We don't really care about the results here, we're just waiting // so as to only process one on-chain message at a time - log.Errorf("waiting for results of message %s for addr %s: %w", msgCid, a.state.Addr, err) + log.Errorf("waiting for results of message %s for addr %s: %v", msgCid, a.state.Addr, err) } a.lk.Lock() diff --git a/chain/messagepool/selection.go b/chain/messagepool/selection.go index 1bbb03f77..26b9845fc 100644 --- a/chain/messagepool/selection.go +++ b/chain/messagepool/selection.go @@ -719,7 +719,7 @@ func (mp *MessagePool) createMessageChains(actor address.Address, mset map[uint6 // the balance a, err := mp.api.GetActorAfter(actor, ts) if err != nil { - log.Errorf("failed to load actor state, not building chain for %s: %w", actor, err) + log.Errorf("failed to load actor state, not building chain for %s: %v", actor, err) return nil } diff --git a/chain/stmgr/stmgr.go b/chain/stmgr/stmgr.go index 62f2ec04c..73088ba2a 100644 --- a/chain/stmgr/stmgr.go +++ b/chain/stmgr/stmgr.go @@ -621,7 +621,7 @@ func (sm *StateManager) WaitForMessage(ctx context.Context, mcid cid.Cid, confid go func() { fts, r, foundMsg, err := sm.searchBackForMsg(ctx, head[0].Val, msg, lookbackLimit) if err != nil { - log.Warnf("failed to look back through chain for message: %w", err) + log.Warnf("failed to look back through chain for message: %v", err) return } diff --git a/cli/log.go b/cli/log.go index ed624eb8d..a4aeaad5c 100644 --- a/cli/log.go +++ b/cli/log.go @@ -93,7 +93,7 @@ var logSetLevel = &cli.Command{ for _, system := range systems { if err := api.LogSetLevel(ctx, system, cctx.Args().First()); err != nil { - return xerrors.Errorf("setting log level on %s: %w", system, err) + return xerrors.Errorf("setting log level on %s: %v", system, err) } } diff --git a/cmd/lotus-chainwatch/processor/processor.go b/cmd/lotus-chainwatch/processor/processor.go index 1f8b246ed..8da6b08cc 100644 --- a/cmd/lotus-chainwatch/processor/processor.go +++ b/cmd/lotus-chainwatch/processor/processor.go @@ -146,7 +146,7 @@ func (p *Processor) Start(ctx context.Context) { go func() { defer grp.Done() if err := p.HandleMarketChanges(ctx, actorChanges[builtin2.StorageMarketActorCodeID]); err != nil { - log.Errorf("Failed to handle market changes: %w", err) + log.Errorf("Failed to handle market changes: %v", err) return } }() @@ -155,7 +155,7 @@ func (p *Processor) Start(ctx context.Context) { go func() { defer grp.Done() if err := p.HandleMinerChanges(ctx, actorChanges[builtin2.StorageMinerActorCodeID]); err != nil { - log.Errorf("Failed to handle miner changes: %w", err) + log.Errorf("Failed to handle miner changes: %v", err) return } }() @@ -164,7 +164,7 @@ func (p *Processor) Start(ctx context.Context) { go func() { defer grp.Done() if err := p.HandleRewardChanges(ctx, actorChanges[builtin2.RewardActorCodeID], nullRounds); err != nil { - log.Errorf("Failed to handle reward changes: %w", err) + log.Errorf("Failed to handle reward changes: %v", err) return } }() @@ -173,7 +173,7 @@ func (p *Processor) Start(ctx context.Context) { go func() { defer grp.Done() if err := p.HandlePowerChanges(ctx, actorChanges[builtin2.StoragePowerActorCodeID]); err != nil { - log.Errorf("Failed to handle power actor changes: %w", err) + log.Errorf("Failed to handle power actor changes: %v", err) return } }() @@ -182,7 +182,7 @@ func (p *Processor) Start(ctx context.Context) { go func() { defer grp.Done() if err := p.HandleMessageChanges(ctx, toProcess); err != nil { - log.Errorf("Failed to handle message changes: %w", err) + log.Errorf("Failed to handle message changes: %v", err) return } }() @@ -191,7 +191,7 @@ func (p *Processor) Start(ctx context.Context) { go func() { defer grp.Done() if err := p.HandleCommonActorsChanges(ctx, actorChanges); err != nil { - log.Errorf("Failed to handle common actor changes: %w", err) + log.Errorf("Failed to handle common actor changes: %v", err) return } }() diff --git a/cmd/lotus-shed/jwt.go b/cmd/lotus-shed/jwt.go index 7fa1a18dd..78abcec76 100644 --- a/cmd/lotus-shed/jwt.go +++ b/cmd/lotus-shed/jwt.go @@ -168,7 +168,7 @@ var jwtNewCmd = &cli.Command{ defer func() { if err := file.Close(); err != nil { - log.Warnf("failed to close output file: %w", err) + log.Warnf("failed to close output file: %v", err) } }() diff --git a/cmd/lotus-shed/keyinfo.go b/cmd/lotus-shed/keyinfo.go index 4dcd10cbf..3c99b5050 100644 --- a/cmd/lotus-shed/keyinfo.go +++ b/cmd/lotus-shed/keyinfo.go @@ -427,7 +427,7 @@ var keyinfoNewCmd = &cli.Command{ defer func() { if err := file.Close(); err != nil { - log.Warnf("failed to close output file: %w", err) + log.Warnf("failed to close output file: %v", err) } }() diff --git a/markets/storageadapter/provider.go b/markets/storageadapter/provider.go index 58e1cb38b..4e361cf1c 100644 --- a/markets/storageadapter/provider.go +++ b/markets/storageadapter/provider.go @@ -104,7 +104,7 @@ func (n *ProviderNodeAdapter) OnDealComplete(ctx context.Context, deal storagema for time.Since(curTime) < addPieceRetryTimeout { if !xerrors.Is(err, sealing.ErrTooManySectorsSealing) { if err != nil { - log.Errorf("failed to addPiece for deal %d, err: %w", deal.DealID, err) + log.Errorf("failed to addPiece for deal %d, err: %v", deal.DealID, err) } break } diff --git a/node/modules/client.go b/node/modules/client.go index 8ba0d6a8d..677fe6908 100644 --- a/node/modules/client.go +++ b/node/modules/client.go @@ -58,18 +58,18 @@ func HandleMigrateClientFunds(lc fx.Lifecycle, ds dtypes.MetadataDS, wallet full if xerrors.Is(err, datastore.ErrNotFound) { return nil } - log.Errorf("client funds migration - getting datastore value: %w", err) + log.Errorf("client funds migration - getting datastore value: %v", err) return nil } var value abi.TokenAmount if err = value.UnmarshalCBOR(bytes.NewReader(b)); err != nil { - log.Errorf("client funds migration - unmarshalling datastore value: %w", err) + log.Errorf("client funds migration - unmarshalling datastore value: %v", err) return nil } _, err = fundMgr.Reserve(ctx, addr, addr, value) if err != nil { - log.Errorf("client funds migration - reserving funds (wallet %s, addr %s, funds %d): %w", + log.Errorf("client funds migration - reserving funds (wallet %s, addr %s, funds %d): %v", addr, addr, value, err) return nil } diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index f12962683..ba38d501b 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -293,19 +293,19 @@ func HandleMigrateProviderFunds(lc fx.Lifecycle, ds dtypes.MetadataDS, node api. } ts, err := node.ChainHead(ctx) if err != nil { - log.Errorf("provider funds migration - getting chain head: %w", err) + log.Errorf("provider funds migration - getting chain head: %v", err) return nil } mi, err := node.StateMinerInfo(ctx, address.Address(minerAddress), ts.Key()) if err != nil { - log.Errorf("provider funds migration - getting miner info %s: %w", minerAddress, err) + log.Errorf("provider funds migration - getting miner info %s: %v", minerAddress, err) return nil } _, err = node.MarketReserveFunds(ctx, mi.Worker, address.Address(minerAddress), value) if err != nil { - log.Errorf("provider funds migration - reserving funds (wallet %s, addr %s, funds %d): %w", + log.Errorf("provider funds migration - reserving funds (wallet %s, addr %s, funds %d): %v", mi.Worker, minerAddress, value, err) return nil } diff --git a/paychmgr/simple.go b/paychmgr/simple.go index 1ad58d6f5..939a5a5be 100644 --- a/paychmgr/simple.go +++ b/paychmgr/simple.go @@ -415,7 +415,7 @@ func (ca *channelAccessor) waitForPaychCreateMsg(channelID string, mcid cid.Cid) func (ca *channelAccessor) waitPaychCreateMsg(channelID string, mcid cid.Cid) error { mwait, err := ca.api.StateWaitMsg(ca.chctx, mcid, build.MessageConfidence) if err != nil { - log.Errorf("wait msg: %w", err) + log.Errorf("wait msg: %v", err) return err } diff --git a/storage/wdpost_run.go b/storage/wdpost_run.go index c80617558..2690069d4 100644 --- a/storage/wdpost_run.go +++ b/storage/wdpost_run.go @@ -45,7 +45,7 @@ func (s *WindowPoStScheduler) failPost(err error, ts *types.TipSet, deadline *dl } }) - log.Errorf("Got err %w - TODO handle errors", err) + log.Errorf("Got err %+v - TODO handle errors", err) /*s.failLk.Lock() if eps > s.failed { s.failed = eps