From 6b5525b8d27876accf57d888eeed7fe1a137714d Mon Sep 17 00:00:00 2001 From: hannahhoward Date: Thu, 13 Aug 2020 21:11:32 -0700 Subject: [PATCH 1/2] feat(markets): update markets 0.5.6 update markets to 0.5.6, removing use of validators that moved inside markets --- go.mod | 2 +- go.sum | 4 ++-- node/builder.go | 8 -------- node/modules/client.go | 10 ---------- node/modules/storageminer.go | 20 -------------------- 5 files changed, 3 insertions(+), 41 deletions(-) diff --git a/go.mod b/go.mod index 13b154c26..93fc8a2a6 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 github.com/filecoin-project/go-data-transfer v0.6.1 github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f - github.com/filecoin-project/go-fil-markets v0.5.6-0.20200814021159-7be996ed8ccb + github.com/filecoin-project/go-fil-markets v0.5.6 github.com/filecoin-project/go-jsonrpc v0.1.1-0.20200602181149-522144ab4e24 github.com/filecoin-project/go-multistore v0.0.3 github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6 diff --git a/go.sum b/go.sum index 808632267..8c905c508 100644 --- a/go.sum +++ b/go.sum @@ -240,8 +240,8 @@ github.com/filecoin-project/go-data-transfer v0.6.1 h1:EA6X8fSiBRNVVwKm5pA7+njZn github.com/filecoin-project/go-data-transfer v0.6.1/go.mod h1:uRYBRKVBVM12CSusBtVrzDHkVw/3DKZpkxKJVP1Ydas= github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f h1:GxJzR3oRIMTPtpZ0b7QF8FKPK6/iPAc7trhlL5k/g+s= github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ= -github.com/filecoin-project/go-fil-markets v0.5.6-0.20200814021159-7be996ed8ccb h1:eCLqJb1tmhMCWUFAfJuSyyv/qLrqiAhICLjhUcbi4x8= -github.com/filecoin-project/go-fil-markets v0.5.6-0.20200814021159-7be996ed8ccb/go.mod h1:SJApXAKr5jyGpbzDEOhvemui0pih7hhT8r2MXJxCP1E= +github.com/filecoin-project/go-fil-markets v0.5.6 h1:WmBbV0qBU4NvLJ64xROpzrKUbkZxZqszZiEiCGmCEIY= +github.com/filecoin-project/go-fil-markets v0.5.6/go.mod h1:SJApXAKr5jyGpbzDEOhvemui0pih7hhT8r2MXJxCP1E= github.com/filecoin-project/go-jsonrpc v0.1.1-0.20200602181149-522144ab4e24 h1:Jc7vkplmZYVuaEcSXGHDwefvZIdoyyaoGDLqSr8Svms= github.com/filecoin-project/go-jsonrpc v0.1.1-0.20200602181149-522144ab4e24/go.mod h1:j6zV//WXIIY5kky873Q3iIKt/ViOE8rcijovmpxrXzM= github.com/filecoin-project/go-multistore v0.0.3 h1:vaRBY4YiA2UZFPK57RNuewypB8u0DzzQwqsL0XarpnI= diff --git a/node/builder.go b/node/builder.go index f70072596..cce2a76e5 100644 --- a/node/builder.go +++ b/node/builder.go @@ -108,7 +108,6 @@ const ( HandleIncomingBlocksKey HandleIncomingMessagesKey - RegisterClientValidatorKey HandlePaymentChannelManagerKey // miner @@ -116,7 +115,6 @@ const ( HandleDealsKey HandleRetrievalKey RunSectorServiceKey - RegisterProviderValidatorKey // daemon ExtractApiKey @@ -266,14 +264,11 @@ func Online() Option { Override(new(retrievalmarket.PeerResolver), modules.RetrievalResolver), Override(new(retrievalmarket.RetrievalClient), modules.RetrievalClient), - Override(new(dtypes.ClientDealStore), modules.NewClientDealStore), Override(new(dtypes.ClientDatastore), modules.NewClientDatastore), Override(new(dtypes.ClientDataTransfer), modules.NewClientGraphsyncDataTransfer), - Override(new(dtypes.ClientRequestValidator), modules.NewClientRequestValidator), Override(new(modules.ClientDealFunds), modules.NewClientDealFunds), Override(new(storagemarket.StorageClient), modules.StorageClient), Override(new(storagemarket.StorageClientNode), storageadapter.NewClientNodeAdapter), - Override(RegisterClientValidatorKey, modules.RegisterClientValidator), Override(new(beacon.RandomBeacon), modules.RandomBeacon), Override(new(*paychmgr.Store), paychmgr.NewStore), @@ -310,16 +305,13 @@ func Online() Option { Override(new(dtypes.StagingDAG), modules.StagingDAG), Override(new(dtypes.StagingGraphsync), modules.StagingGraphsync), Override(new(retrievalmarket.RetrievalProvider), modules.RetrievalProvider), - Override(new(dtypes.ProviderDealStore), modules.NewProviderDealStore), Override(new(dtypes.ProviderDataTransfer), modules.NewProviderDAGServiceDataTransfer), - Override(new(dtypes.ProviderRequestValidator), modules.NewProviderRequestValidator), Override(new(dtypes.ProviderPieceStore), modules.NewProviderPieceStore), Override(new(*storedask.StoredAsk), modules.NewStorageAsk), Override(new(dtypes.DealFilter), modules.BasicDealFilter(nil)), Override(new(modules.ProviderDealFunds), modules.NewProviderDealFunds), Override(new(storagemarket.StorageProvider), modules.StorageProvider), Override(new(storagemarket.StorageProviderNode), storageadapter.NewProviderNodeAdapter), - Override(RegisterProviderValidatorKey, modules.RegisterProviderValidator), Override(HandleRetrievalKey, modules.HandleRetrieval), Override(GetParamsKey, modules.GetParams), Override(HandleDealsKey, modules.HandleDeals), diff --git a/node/modules/client.go b/node/modules/client.go index 1d017d61f..80675a3d2 100644 --- a/node/modules/client.go +++ b/node/modules/client.go @@ -21,7 +21,6 @@ import ( "github.com/filecoin-project/go-fil-markets/storagemarket/impl/funds" "github.com/filecoin-project/go-fil-markets/storagemarket/impl/requestvalidation" smnet "github.com/filecoin-project/go-fil-markets/storagemarket/network" - "github.com/filecoin-project/go-statestore" "github.com/filecoin-project/go-storedcounter" "github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore/namespace" @@ -101,20 +100,11 @@ func NewClientGraphsyncDataTransfer(lc fx.Lifecycle, h host.Host, gs dtypes.Grap return dt, nil } -// NewClientDealStore creates a statestore for the client to store its deals -func NewClientDealStore(ds dtypes.ClientDatastore) dtypes.ClientDealStore { - return statestore.New(ds) -} - // NewClientDatastore creates a datastore for the client to store its deals func NewClientDatastore(ds dtypes.MetadataDS) dtypes.ClientDatastore { return namespace.Wrap(ds, datastore.NewKey("/deals/client")) } -func NewClientRequestValidator(deals dtypes.ClientDealStore) dtypes.ClientRequestValidator { - return requestvalidation.NewUnifiedRequestValidator(nil, deals) -} - type ClientDealFunds funds.DealFunds func NewClientDealFunds(ds dtypes.MetadataDS) (ClientDealFunds, error) { diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index ebb0c4986..71ec8fc75 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -36,13 +36,11 @@ import ( "github.com/filecoin-project/go-fil-markets/storagemarket" storageimpl "github.com/filecoin-project/go-fil-markets/storagemarket/impl" "github.com/filecoin-project/go-fil-markets/storagemarket/impl/funds" - "github.com/filecoin-project/go-fil-markets/storagemarket/impl/requestvalidation" "github.com/filecoin-project/go-fil-markets/storagemarket/impl/storedask" smnet "github.com/filecoin-project/go-fil-markets/storagemarket/network" "github.com/filecoin-project/go-jsonrpc/auth" "github.com/filecoin-project/go-multistore" paramfetch "github.com/filecoin-project/go-paramfetch" - "github.com/filecoin-project/go-statestore" "github.com/filecoin-project/go-storedcounter" sectorstorage "github.com/filecoin-project/sector-storage" "github.com/filecoin-project/sector-storage/ffiwrapper" @@ -209,15 +207,6 @@ func HandleDeals(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host, h sto }) } -// RegisterProviderValidator is an initialization hook that registers the provider -// request validator with the data transfer module as the validator for -// StorageDataTransferVoucher types -func RegisterProviderValidator(mrv dtypes.ProviderRequestValidator, dtm dtypes.ProviderDataTransfer) { - if err := dtm.RegisterVoucherType(&requestvalidation.StorageDataTransferVoucher{}, (*requestvalidation.UnifiedRequestValidator)(mrv)); err != nil { - panic(err) - } -} - // NewProviderDAGServiceDataTransfer returns a data transfer manager that just // uses the provider's Staging DAG service for transfers func NewProviderDAGServiceDataTransfer(lc fx.Lifecycle, h host.Host, gs dtypes.StagingGraphsync, ds dtypes.MetadataDS) (dtypes.ProviderDataTransfer, error) { @@ -242,11 +231,6 @@ func NewProviderDAGServiceDataTransfer(lc fx.Lifecycle, h host.Host, gs dtypes.S return dt, nil } -// NewProviderDealStore creates a statestore for the client to store its deals -func NewProviderDealStore(ds dtypes.MetadataDS) dtypes.ProviderDealStore { - return statestore.New(namespace.Wrap(ds, datastore.NewKey("/deals/provider"))) -} - // NewProviderPieceStore creates a statestore for storing metadata about pieces // shared by the storage and retrieval providers func NewProviderPieceStore(ds dtypes.MetadataDS) dtypes.ProviderPieceStore { @@ -337,10 +321,6 @@ func SetupBlockProducer(lc fx.Lifecycle, ds dtypes.MetadataDS, api lapi.FullNode return m, nil } -func NewProviderRequestValidator(deals dtypes.ProviderDealStore) dtypes.ProviderRequestValidator { - return requestvalidation.NewUnifiedRequestValidator(deals, nil) -} - func NewStorageAsk(ctx helpers.MetricsCtx, fapi lapi.FullNode, ds dtypes.MetadataDS, minerAddress dtypes.MinerAddress, spn storagemarket.StorageProviderNode) (*storedask.StoredAsk, error) { mi, err := fapi.StateMinerInfo(ctx, address.Address(minerAddress), types.EmptyTSK) From 25cb3a15e786e5869133fbdb83bf694f421f1178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 14 Aug 2020 21:03:20 +0200 Subject: [PATCH 2/2] wdpost: Wait for the correct confidence --- storage/wdpost_run.go | 17 +++++++++-------- storage/wdpost_sched.go | 7 +++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/storage/wdpost_run.go b/storage/wdpost_run.go index e9e626533..13f5547eb 100644 --- a/storage/wdpost_run.go +++ b/storage/wdpost_run.go @@ -317,12 +317,6 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di miner.DeadlineInfo return nil, xerrors.Errorf("failed to get chain randomness for windowPost (ts=%d; deadline=%d): %w", ts.Height(), di, err) } - commEpoch := di.Open - commRand, err := s.api.ChainGetRandomnessFromTickets(ctx, ts.Key(), crypto.DomainSeparationTag_PoStChainCommit, commEpoch, nil) - if err != nil { - return nil, xerrors.Errorf("failed to get chain randomness for windowPost (ts=%d; deadline=%d): %w", ts.Height(), di, err) - } - partitions, err := s.api.StateMinerPartitions(ctx, s.actor, di.Index, ts.Key()) if err != nil { return nil, xerrors.Errorf("getting partitions: %w", err) @@ -332,8 +326,6 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di miner.DeadlineInfo Deadline: di.Index, Partitions: make([]miner.PoStPartition, 0, len(partitions)), Proofs: nil, - ChainCommitEpoch: commEpoch, - ChainCommitRand: commRand, } var sinfos []abi.SectorInfo @@ -425,6 +417,15 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di miner.DeadlineInfo } elapsed := time.Since(tsStart) + + commEpoch := di.Open + commRand, err := s.api.ChainGetRandomnessFromTickets(ctx, ts.Key(), crypto.DomainSeparationTag_PoStChainCommit, commEpoch, nil) + if err != nil { + return nil, xerrors.Errorf("failed to get chain randomness for windowPost (ts=%d; deadline=%d): %w", ts.Height(), di, err) + } + params.ChainCommitEpoch = commEpoch + params.ChainCommitRand = commRand + log.Infow("submitting window PoSt", "elapsed", elapsed) return params, nil diff --git a/storage/wdpost_sched.go b/storage/wdpost_sched.go index 8adfe2f76..2bf7799d9 100644 --- a/storage/wdpost_sched.go +++ b/storage/wdpost_sched.go @@ -190,8 +190,11 @@ func (s *WindowPoStScheduler) update(ctx context.Context, new *types.TipSet) err s.abortActivePoSt() - if di.Challenge+StartConfidence >= new.Height() { - log.Info("not starting windowPost yet, waiting for startconfidence", di.Challenge, di.Challenge+StartConfidence, new.Height()) + // TODO: wait for di.Challenge here, will give us ~10min more to compute windowpost + // (Need to get correct deadline above, which is tricky) + + if di.Open+StartConfidence >= new.Height() { + log.Info("not starting windowPost yet, waiting for startconfidence", di.Open, di.Open+StartConfidence, new.Height()) return nil }