Merge pull request #9391 from filecoin-project/feat/noparam-miner
feat: miner paramfetch: Don't fetch param files when not needed
This commit is contained in:
commit
88a17013dd
@ -94,6 +94,10 @@ func ConfigStorageMiner(c interface{}) Option {
|
||||
Override(new(paths.Store), From(new(*paths.Remote))),
|
||||
Override(new(dtypes.RetrievalPricingFunc), modules.RetrievalPricingFunc(cfg.Dealmaking)),
|
||||
|
||||
If(cfg.Subsystems.EnableMining || cfg.Subsystems.EnableSealing,
|
||||
Override(GetParamsKey, modules.GetParams(!cfg.Proving.DisableBuiltinWindowPoSt || !cfg.Proving.DisableBuiltinWinningPoSt || cfg.Storage.AllowCommit || cfg.Storage.AllowProveReplicaUpdate2)),
|
||||
),
|
||||
|
||||
If(!cfg.Subsystems.EnableMining,
|
||||
If(cfg.Subsystems.EnableSealing, Error(xerrors.Errorf("sealing can only be enabled on a mining node"))),
|
||||
If(cfg.Subsystems.EnableSectorStorage, Error(xerrors.Errorf("sealing can only be enabled on a mining node"))),
|
||||
@ -107,9 +111,6 @@ func ConfigStorageMiner(c interface{}) Option {
|
||||
Override(new(storiface.Prover), ffiwrapper.ProofProver),
|
||||
Override(new(storiface.ProverPoSt), From(new(sectorstorage.SectorManager))),
|
||||
|
||||
// Sealing (todo should be under EnableSealing, but storagefsm is currently bundled with storage.Miner)
|
||||
Override(GetParamsKey, modules.GetParams),
|
||||
|
||||
Override(new(dtypes.SetSealingConfigFunc), modules.NewSetSealConfigFunc),
|
||||
Override(new(dtypes.GetSealingConfigFunc), modules.NewGetSealConfigFunc),
|
||||
|
||||
|
@ -110,24 +110,31 @@ func minerAddrFromDS(ds dtypes.MetadataDS) (address.Address, error) {
|
||||
return address.NewFromBytes(maddrb)
|
||||
}
|
||||
|
||||
func GetParams(spt abi.RegisteredSealProof) error {
|
||||
ssize, err := spt.SectorSize()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
func GetParams(prover bool) func(spt abi.RegisteredSealProof) error {
|
||||
return func(spt abi.RegisteredSealProof) error {
|
||||
ssize, err := spt.SectorSize()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// If built-in assets are disabled, we expect the user to have placed the right
|
||||
// parameters in the right location on the filesystem (/var/tmp/filecoin-proof-parameters).
|
||||
if build.DisableBuiltinAssets {
|
||||
return nil
|
||||
}
|
||||
|
||||
var provingSize uint64
|
||||
if prover {
|
||||
provingSize = uint64(ssize)
|
||||
}
|
||||
|
||||
// TODO: We should fetch the params for the actual proof type, not just based on the size.
|
||||
if err := paramfetch.GetParams(context.TODO(), build.ParametersJSON(), build.SrsJSON(), provingSize); err != nil {
|
||||
return xerrors.Errorf("fetching proof parameters: %w", err)
|
||||
}
|
||||
|
||||
// If built-in assets are disabled, we expect the user to have placed the right
|
||||
// parameters in the right location on the filesystem (/var/tmp/filecoin-proof-parameters).
|
||||
if build.DisableBuiltinAssets {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: We should fetch the params for the actual proof type, not just based on the size.
|
||||
if err := paramfetch.GetParams(context.TODO(), build.ParametersJSON(), build.SrsJSON(), uint64(ssize)); err != nil {
|
||||
return xerrors.Errorf("fetching proof parameters: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func MinerAddress(ds dtypes.MetadataDS) (dtypes.MinerAddress, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user