wdpost: Config for disabling sector prechecks

This commit is contained in:
Łukasz Magiera 2022-07-01 22:20:05 +02:00
parent 84881f64ad
commit 59f3161fd6
6 changed files with 57 additions and 10 deletions

View File

@ -117,7 +117,7 @@ func ConfigStorageMiner(c interface{}) Option {
Override(new(*miner.Miner), modules.SetupBlockProducer),
Override(new(gen.WinningPoStProver), storage.NewWinningPoStProver),
Override(new(*storage.Miner), modules.StorageMiner(cfg.Fees)),
Override(new(*wdpost.WindowPoStScheduler), modules.WindowPostScheduler(cfg.Fees)),
Override(new(*wdpost.WindowPoStScheduler), modules.WindowPostScheduler(cfg.Fees, cfg.Proving)),
Override(new(sectorblocks.SectorBuilder), From(new(*storage.Miner))),
),

View File

@ -627,16 +627,15 @@ over the worker address if this flag is set.`,
Name: "ParallelCheckLimit",
Type: "int",
Comment: `WARNING: Setting this value too high may make the node crash by running out of stack
WARNING: Setting this value too low may make sector challenge reading much slower, resulting in failed PoSt due
to late submission.`,
Comment: `After changing this option, confirm that the new value works in your setup by invoking
'lotus-miner proving compute window-post 0'`,
},
{
Name: "DisableBuiltinWindowPoSt",
Type: "bool",
Comment: `WARNING: If no windowPoSt workers are connected, window PoSt WILL FAIL resulting in faulty sectors which will need
to be recovered. Before enabling this option, make sure your PoSt workers work correctly.`,
Comment: `After changing this option, confirm that the new value works in your setup by invoking
'lotus-miner proving compute window-post 0'`,
},
{
Name: "DisableBuiltinWinningPoSt",
@ -645,6 +644,13 @@ to be recovered. Before enabling this option, make sure your PoSt workers work c
Comment: `WARNING: If no WinningPoSt workers are connected, Winning PoSt WILL FAIL resulting in lost block rewards.
Before enabling this option, make sure your PoSt workers work correctly.`,
},
{
Name: "DisableWDPoStPreChecks",
Type: "bool",
Comment: `After changing this option, confirm that the new value works in your setup by invoking
'lotus-miner proving compute window-post 0'`,
},
},
"Pubsub": []DocField{
{

View File

@ -225,12 +225,18 @@ type ProvingConfig struct {
// WARNING: Setting this value too high may make the node crash by running out of stack
// WARNING: Setting this value too low may make sector challenge reading much slower, resulting in failed PoSt due
// to late submission.
//
// After changing this option, confirm that the new value works in your setup by invoking
// 'lotus-miner proving compute window-post 0'
ParallelCheckLimit int
// Disable Window PoSt computation on the lotus-miner process even if no window PoSt workers are present.
//
// WARNING: If no windowPoSt workers are connected, window PoSt WILL FAIL resulting in faulty sectors which will need
// to be recovered. Before enabling this option, make sure your PoSt workers work correctly.
//
// After changing this option, confirm that the new value works in your setup by invoking
// 'lotus-miner proving compute window-post 0'
DisableBuiltinWindowPoSt bool
// Disable Winning PoSt computation on the lotus-miner process even if no winning PoSt workers are present.
@ -238,6 +244,32 @@ type ProvingConfig struct {
// WARNING: If no WinningPoSt workers are connected, Winning PoSt WILL FAIL resulting in lost block rewards.
// Before enabling this option, make sure your PoSt workers work correctly.
DisableBuiltinWinningPoSt bool
// Disable WindowPoSt provable sector readability checks.
//
// In normal operation, when preparing to compute WindowPoSt, lotus-miner will perform a round of reading challenges
// from all sectors to confirm that those sectors can be proven. Challenges read in this process are discarded, as
// we're only interested in checkdng that sector data can be read.
//
// When using builtin proof computation (no PoSt workers, and DisableBuiltinWindowPoSt is set to false), this process
// can save a lot of time and compute resources in the case that some sectors are not readable - this is caused by
// the builtin logic not skipping snark computation when some sectors need to be skipped.
//
// When using PoSt workers, this process is mostly redundant, with PoSt workers challenges will be read once, and
// if challenges for some sectors aren't readable, those sectors will just get skipped.
//
// Disabling sector pre-checks will slightly requice IO load when proving sectors, possibly resulting in shorter
// time to produce window PoSt. In setups with good IO capabilities the effect of this option on proving time should
// be negligible.
//
// NOTE: It likely is a bad idea to disable sector pre-checks in setups with no PoSt workers.
//
// NOTE: Even when this option is enabled, recovering sectors will be checked before recovery declaration message is
// sent to the chain
//
// After changing this option, confirm that the new value works in your setup by invoking
// 'lotus-miner proving compute window-post 0'
DisableWDPoStPreChecks bool
}
type SealingConfig struct {

View File

@ -254,7 +254,7 @@ func StorageMiner(fc config.MinerFeeConfig) func(params StorageMinerParams) (*st
}
}
func WindowPostScheduler(fc config.MinerFeeConfig) func(params StorageMinerParams) (*wdpost.WindowPoStScheduler, error) {
func WindowPostScheduler(fc config.MinerFeeConfig, pc config.ProvingConfig) func(params StorageMinerParams) (*wdpost.WindowPoStScheduler, error) {
return func(params StorageMinerParams) (*wdpost.WindowPoStScheduler, error) {
var (
mctx = params.MetricsCtx
@ -269,7 +269,7 @@ func WindowPostScheduler(fc config.MinerFeeConfig) func(params StorageMinerParam
ctx := helpers.LifecycleCtx(mctx, lc)
fps, err := wdpost.NewWindowedPoStScheduler(api, fc, as, sealer, verif, sealer, j, maddr)
fps, err := wdpost.NewWindowedPoStScheduler(api, fc, pc, as, sealer, verif, sealer, j, maddr)
if err != nil {
return nil, err
}

View File

@ -335,9 +335,15 @@ func (s *WindowPoStScheduler) runPoStCycle(ctx context.Context, manual bool, di
return nil, xerrors.Errorf("adding recoveries to set of sectors to prove: %w", err)
}
good, err := s.checkSectors(ctx, toProve, ts.Key())
good, err := toProve.Copy()
if err != nil {
return nil, xerrors.Errorf("checking sectors to skip: %w", err)
return nil, xerrors.Errorf("copy toProve: %w", err)
}
if !s.disablePreChecks {
good, err = s.checkSectors(ctx, toProve, ts.Key())
if err != nil {
return nil, xerrors.Errorf("checking sectors to skip: %w", err)
}
}
good, err = bitfield.SubtractBitField(good, postSkipped)

View File

@ -70,6 +70,7 @@ type WindowPoStScheduler struct {
faultTracker sealer.FaultTracker
proofType abi.RegisteredPoStProof
partitionSectors uint64
disablePreChecks bool
ch *changeHandler
actor address.Address
@ -84,6 +85,7 @@ type WindowPoStScheduler struct {
// NewWindowedPoStScheduler creates a new WindowPoStScheduler scheduler.
func NewWindowedPoStScheduler(api NodeAPI,
cfg config.MinerFeeConfig,
pcfg config.ProvingConfig,
as *ctladdr.AddressSelector,
sp storiface.ProverPoSt,
verif storiface.Verifier,
@ -104,6 +106,7 @@ func NewWindowedPoStScheduler(api NodeAPI,
faultTracker: ft,
proofType: mi.WindowPoStProofType,
partitionSectors: mi.WindowPoStPartitionSectors,
disablePreChecks: pcfg.DisableWDPoStPreChecks,
actor: actor,
evtTypes: [...]journal.EventType{