feat(config): support configurable CC sector expiration
This commit is contained in:
parent
2d40089b7e
commit
9e34cce1f2
2
extern/storage-sealing/sealiface/config.go
vendored
2
extern/storage-sealing/sealiface/config.go
vendored
@ -20,6 +20,8 @@ type Config struct {
|
||||
|
||||
WaitDealsDelay time.Duration
|
||||
|
||||
CommittedCapacityDefaultLifetime time.Duration
|
||||
|
||||
AlwaysKeepUnsealedCopy bool
|
||||
|
||||
FinalizeEarly bool
|
||||
|
@ -131,6 +131,12 @@ type SealingConfig struct {
|
||||
|
||||
WaitDealsDelay Duration
|
||||
|
||||
// CommittedCapacityDefaultLifetime is the default duration a Committed Capacity (CC)
|
||||
// sector will live before it must be extended or converted into sector containing deals
|
||||
// before it is terminated.
|
||||
// Value must be between 180-540 days inclusive.
|
||||
CommittedCapacityDefaultLifetime Duration
|
||||
|
||||
AlwaysKeepUnsealedCopy bool
|
||||
|
||||
// Run sector finalization before submitting sector proof to the chain
|
||||
|
@ -178,8 +178,11 @@ func (m *Miner) Run(ctx context.Context) error {
|
||||
// provides extra methods.
|
||||
adaptedAPI = NewSealingAPIAdapter(m.api)
|
||||
|
||||
// sealing configuration.
|
||||
cfg = sealing.GetSealingConfigFunc(m.getSealConfig)
|
||||
|
||||
// Instantiate a precommit policy.
|
||||
defaultDuration = policy.GetMaxSectorExpirationExtension() - (md.WPoStProvingPeriod * 2)
|
||||
defaultDuration = getDefaultSectorExpirationExtension(cfg) - (md.WPoStProvingPeriod * 2)
|
||||
provingBoundary = md.PeriodStart % md.WPoStProvingPeriod
|
||||
|
||||
// TODO: Maybe we update this policy after actor upgrades?
|
||||
@ -189,9 +192,6 @@ func (m *Miner) Run(ctx context.Context) error {
|
||||
as = func(ctx context.Context, mi miner.MinerInfo, use api.AddrUse, goodFunds, minFunds abi.TokenAmount) (address.Address, abi.TokenAmount, error) {
|
||||
return m.addrSel.AddressFor(ctx, m.api, mi, use, goodFunds, minFunds)
|
||||
}
|
||||
|
||||
// sealing configuration.
|
||||
cfg = sealing.GetSealingConfigFunc(m.getSealConfig)
|
||||
)
|
||||
|
||||
// Instantiate the sealing FSM.
|
||||
@ -203,6 +203,16 @@ func (m *Miner) Run(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func getDefaultSectorExpirationExtension(cfg sealing.GetSealingConfigFunc) abi.ChainEpoch {
|
||||
c, err := cfg()
|
||||
if err != nil {
|
||||
log.Warnf("failed to load sealing config, using default sector extension expiration")
|
||||
log.Errorf("sealing config load error: %s", err.Error())
|
||||
return policy.GetMaxSectorExpirationExtension()
|
||||
}
|
||||
return abi.ChainEpoch(c.CommittedCapacityDefaultLifetime.Truncate(builtin.EpochDurationSeconds))
|
||||
}
|
||||
|
||||
func (m *Miner) handleSealingNotifications(before, after sealing.SectorInfo) {
|
||||
m.journal.RecordEvent(m.sealingEvtType, func() interface{} {
|
||||
return SealingStateEvt{
|
||||
|
Loading…
Reference in New Issue
Block a user