add Dealmaking.StartEpochSealingBuffer config
This commit is contained in:
parent
c2fa54ca9c
commit
809289f5ef
@ -207,6 +207,12 @@
|
|||||||
# env var: LOTUS_DEALMAKING_SIMULTANEOUSTRANSFERS
|
# env var: LOTUS_DEALMAKING_SIMULTANEOUSTRANSFERS
|
||||||
#SimultaneousTransfers = 20
|
#SimultaneousTransfers = 20
|
||||||
|
|
||||||
|
# Minimum start epoch buffer to give time for sealing of sector with deal.
|
||||||
|
#
|
||||||
|
# type: uint64
|
||||||
|
# env var: LOTUS_DEALMAKING_STARTEPOCHSEALINGBUFFER
|
||||||
|
#StartEpochSealingBuffer = 480
|
||||||
|
|
||||||
# A command used for fine-grained evaluation of storage deals
|
# A command used for fine-grained evaluation of storage deals
|
||||||
# see https://docs.filecoin.io/mine/lotus/miner-configuration/#using-filters-for-fine-grained-storage-and-retrieval-deal-acceptance for more details
|
# see https://docs.filecoin.io/mine/lotus/miner-configuration/#using-filters-for-fine-grained-storage-and-retrieval-deal-acceptance for more details
|
||||||
#
|
#
|
||||||
|
7
extern/storage-sealing/input.go
vendored
7
extern/storage-sealing/input.go
vendored
@ -274,11 +274,16 @@ func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPiec
|
|||||||
return api.SectorOffset{}, xerrors.Errorf("getting proposal CID: %w", err)
|
return api.SectorOffset{}, xerrors.Errorf("getting proposal CID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg, err := m.getConfig()
|
||||||
|
if err != nil {
|
||||||
|
return api.SectorOffset{}, xerrors.Errorf("getting config: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
_, head, err := m.Api.ChainHead(ctx)
|
_, head, err := m.Api.ChainHead(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return api.SectorOffset{}, xerrors.Errorf("couldnt get chain head: %w", err)
|
return api.SectorOffset{}, xerrors.Errorf("couldnt get chain head: %w", err)
|
||||||
}
|
}
|
||||||
if head > deal.DealProposal.StartEpoch {
|
if head+cfg.StartEpochSealingBuffer > deal.DealProposal.StartEpoch {
|
||||||
return api.SectorOffset{}, xerrors.Errorf(
|
return api.SectorOffset{}, xerrors.Errorf(
|
||||||
"cannot add piece for deal with piece CID %s: current epoch %d has passed deal proposal start epoch %d",
|
"cannot add piece for deal with piece CID %s: current epoch %d has passed deal proposal start epoch %d",
|
||||||
deal.DealProposal.PieceCID, head, deal.DealProposal.StartEpoch)
|
deal.DealProposal.PieceCID, head, deal.DealProposal.StartEpoch)
|
||||||
|
2
extern/storage-sealing/sealiface/config.go
vendored
2
extern/storage-sealing/sealiface/config.go
vendored
@ -22,6 +22,8 @@ type Config struct {
|
|||||||
|
|
||||||
CommittedCapacitySectorLifetime time.Duration
|
CommittedCapacitySectorLifetime time.Duration
|
||||||
|
|
||||||
|
StartEpochSealingBuffer abi.ChainEpoch
|
||||||
|
|
||||||
AlwaysKeepUnsealedCopy bool
|
AlwaysKeepUnsealedCopy bool
|
||||||
|
|
||||||
FinalizeEarly bool
|
FinalizeEarly bool
|
||||||
|
@ -59,10 +59,11 @@ type DealPublisher struct {
|
|||||||
publishPeriod time.Duration
|
publishPeriod time.Duration
|
||||||
publishSpec *api.MessageSendSpec
|
publishSpec *api.MessageSendSpec
|
||||||
|
|
||||||
lk sync.Mutex
|
lk sync.Mutex
|
||||||
pending []*pendingDeal
|
pending []*pendingDeal
|
||||||
cancelWaitForMoreDeals context.CancelFunc
|
cancelWaitForMoreDeals context.CancelFunc
|
||||||
publishPeriodStart time.Time
|
publishPeriodStart time.Time
|
||||||
|
startEpochSealingBuffer abi.ChainEpoch
|
||||||
}
|
}
|
||||||
|
|
||||||
// A deal that is queued to be published
|
// A deal that is queued to be published
|
||||||
@ -93,6 +94,8 @@ type PublishMsgConfig struct {
|
|||||||
// The maximum number of deals to include in a single PublishStorageDeals
|
// The maximum number of deals to include in a single PublishStorageDeals
|
||||||
// message
|
// message
|
||||||
MaxDealsPerMsg uint64
|
MaxDealsPerMsg uint64
|
||||||
|
// Minimum start epoch buffer to give time for sealing of sector with deal
|
||||||
|
StartEpochSealingBuffer uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDealPublisher(
|
func NewDealPublisher(
|
||||||
@ -124,13 +127,14 @@ func newDealPublisher(
|
|||||||
) *DealPublisher {
|
) *DealPublisher {
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
return &DealPublisher{
|
return &DealPublisher{
|
||||||
api: dpapi,
|
api: dpapi,
|
||||||
as: as,
|
as: as,
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
Shutdown: cancel,
|
Shutdown: cancel,
|
||||||
maxDealsPerPublishMsg: publishMsgCfg.MaxDealsPerMsg,
|
maxDealsPerPublishMsg: publishMsgCfg.MaxDealsPerMsg,
|
||||||
publishPeriod: publishMsgCfg.Period,
|
publishPeriod: publishMsgCfg.Period,
|
||||||
publishSpec: publishSpec,
|
startEpochSealingBuffer: abi.ChainEpoch(publishMsgCfg.StartEpochSealingBuffer),
|
||||||
|
publishSpec: publishSpec,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +333,7 @@ func (p *DealPublisher) validateDeal(deal market2.ClientDealProposal) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if head.Height() > deal.Proposal.StartEpoch {
|
if head.Height()+p.startEpochSealingBuffer > deal.Proposal.StartEpoch {
|
||||||
return xerrors.Errorf(
|
return xerrors.Errorf(
|
||||||
"cannot publish deal with piece CID %s: current epoch %d has passed deal proposal start epoch %d",
|
"cannot publish deal with piece CID %s: current epoch %d has passed deal proposal start epoch %d",
|
||||||
deal.Proposal.PieceCID, head.Height(), deal.Proposal.StartEpoch)
|
deal.Proposal.PieceCID, head.Height(), deal.Proposal.StartEpoch)
|
||||||
|
@ -199,8 +199,9 @@ func ConfigStorageMiner(c interface{}) Option {
|
|||||||
Override(new(dtypes.RetrievalDealFilter), modules.RetrievalDealFilter(dealfilter.CliRetrievalDealFilter(cfg.Dealmaking.RetrievalFilter))),
|
Override(new(dtypes.RetrievalDealFilter), modules.RetrievalDealFilter(dealfilter.CliRetrievalDealFilter(cfg.Dealmaking.RetrievalFilter))),
|
||||||
),
|
),
|
||||||
Override(new(*storageadapter.DealPublisher), storageadapter.NewDealPublisher(&cfg.Fees, storageadapter.PublishMsgConfig{
|
Override(new(*storageadapter.DealPublisher), storageadapter.NewDealPublisher(&cfg.Fees, storageadapter.PublishMsgConfig{
|
||||||
Period: time.Duration(cfg.Dealmaking.PublishMsgPeriod),
|
Period: time.Duration(cfg.Dealmaking.PublishMsgPeriod),
|
||||||
MaxDealsPerMsg: cfg.Dealmaking.MaxDealsPerPublishMsg,
|
MaxDealsPerMsg: cfg.Dealmaking.MaxDealsPerPublishMsg,
|
||||||
|
StartEpochSealingBuffer: cfg.Dealmaking.StartEpochSealingBuffer,
|
||||||
})),
|
})),
|
||||||
Override(new(storagemarket.StorageProviderNode), storageadapter.NewProviderNodeAdapter(&cfg.Fees, &cfg.Dealmaking)),
|
Override(new(storagemarket.StorageProviderNode), storageadapter.NewProviderNodeAdapter(&cfg.Fees, &cfg.Dealmaking)),
|
||||||
),
|
),
|
||||||
|
@ -148,6 +148,8 @@ func DefaultStorageMiner() *StorageMiner {
|
|||||||
|
|
||||||
SimultaneousTransfers: DefaultSimultaneousTransfers,
|
SimultaneousTransfers: DefaultSimultaneousTransfers,
|
||||||
|
|
||||||
|
StartEpochSealingBuffer: 480, // 480 epochs buffer == 4 hours from adding deal to sector to sector being sealed
|
||||||
|
|
||||||
RetrievalPricing: &RetrievalPricing{
|
RetrievalPricing: &RetrievalPricing{
|
||||||
Strategy: RetrievalPricingDefaultMode,
|
Strategy: RetrievalPricingDefaultMode,
|
||||||
Default: &RetrievalPricingDefault{
|
Default: &RetrievalPricingDefault{
|
||||||
|
@ -265,6 +265,12 @@ passed to the sealing node by the markets service. 0 is unlimited.`,
|
|||||||
|
|
||||||
Comment: `The maximum number of parallel online data transfers (storage+retrieval)`,
|
Comment: `The maximum number of parallel online data transfers (storage+retrieval)`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "StartEpochSealingBuffer",
|
||||||
|
Type: "uint64",
|
||||||
|
|
||||||
|
Comment: `Minimum start epoch buffer to give time for sealing of sector with deal.`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "Filter",
|
Name: "Filter",
|
||||||
Type: "string",
|
Type: "string",
|
||||||
|
@ -131,6 +131,8 @@ type DealmakingConfig struct {
|
|||||||
MaxStagingDealsBytes int64
|
MaxStagingDealsBytes int64
|
||||||
// The maximum number of parallel online data transfers (storage+retrieval)
|
// The maximum number of parallel online data transfers (storage+retrieval)
|
||||||
SimultaneousTransfers uint64
|
SimultaneousTransfers uint64
|
||||||
|
// Minimum start epoch buffer to give time for sealing of sector with deal.
|
||||||
|
StartEpochSealingBuffer uint64
|
||||||
|
|
||||||
// A command used for fine-grained evaluation of storage deals
|
// A command used for fine-grained evaluation of storage deals
|
||||||
// see https://docs.filecoin.io/mine/lotus/miner-configuration/#using-filters-for-fine-grained-storage-and-retrieval-deal-acceptance for more details
|
// see https://docs.filecoin.io/mine/lotus/miner-configuration/#using-filters-for-fine-grained-storage-and-retrieval-deal-acceptance for more details
|
||||||
|
@ -932,6 +932,8 @@ func ToSealingConfig(cfg *config.StorageMiner) sealiface.Config {
|
|||||||
TerminateBatchMax: cfg.Sealing.TerminateBatchMax,
|
TerminateBatchMax: cfg.Sealing.TerminateBatchMax,
|
||||||
TerminateBatchMin: cfg.Sealing.TerminateBatchMin,
|
TerminateBatchMin: cfg.Sealing.TerminateBatchMin,
|
||||||
TerminateBatchWait: time.Duration(cfg.Sealing.TerminateBatchWait),
|
TerminateBatchWait: time.Duration(cfg.Sealing.TerminateBatchWait),
|
||||||
|
|
||||||
|
StartEpochSealingBuffer: abi.ChainEpoch(cfg.Dealmaking.StartEpochSealingBuffer),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user