Impl synthPoRep

This commit is contained in:
Andrew Jackson (Ajax) 2023-05-31 23:03:52 -05:00 committed by Łukasz Magiera
parent f4fe4cae9c
commit 08038540e4
7 changed files with 61 additions and 5 deletions

View File

@ -234,7 +234,7 @@ func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.Re
}
}
if !configWantSynthetic {
if nver < network.SyntheticVersion || !configWantSynthetic {
switch proof {
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1:
return abi.RegisteredSealProof_StackedDrg2KiBV1_1, nil
@ -250,6 +250,7 @@ func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.Re
return -1, xerrors.Errorf("unrecognized window post type: %d", proof)
}
}
switch proof {
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1:
return abi.RegisteredSealProof_StackedDrg2KiBV1_1_Feat_SyntheticPoRep, nil

View File

@ -65,7 +65,7 @@ func SealProofTypeFromSectorSize(ssize abi.SectorSize, nv network.Version, synth
return 0, xerrors.Errorf("unsupported sector size for miner: %v", ssize)
}
if synthetic {
if nv >= network.SyntheticVersion && synthetic {
return toSynthetic(v)
} else {
return v, nil

View File

@ -1741,7 +1741,7 @@ var sectorsCapacityCollateralCmd = &cli.Command{
return err
}
spt, err := lminer.PreferredSealProofTypeFromWindowPoStType(nv, mi.WindowPoStProofType)
spt, err := lminer.PreferredSealProofTypeFromWindowPoStType(nv, mi.WindowPoStProofType, false)
if err != nil {
return err
}

View File

@ -671,6 +671,14 @@
# env var: LOTUS_SEALING_TERMINATEBATCHWAIT
#TerminateBatchWait = "5m0s"
# SealWithSyntheticPoRep will reduce data holdings after PC1 by storing the precomputed responses
# to any challenge. This proof's PC1 step uses a cheaper-to-compute algorithm for the responses,
# but still must do more computation during PC1 in order to create this oracle.
#
# type: bool
# env var: LOTUS_SEALING_SEALWITHSYNTHETICPOREP
#SealWithSyntheticPoRep = false
[Storage]
# type: int

View File

@ -1265,6 +1265,14 @@ Submitting a smaller number of prove commits per epoch would reduce the possibil
Comment: ``,
},
{
Name: "SealWithSyntheticPoRep",
Type: "bool",
Comment: `SealWithSyntheticPoRep will reduce data holdings after PC1 by storing the precomputed responses
to any challenge. This proof's PC1 step uses a cheaper-to-compute algorithm for the responses,
but still must do more computation during PC1 in order to create this oracle.`,
},
},
"Splitstore": []DocField{
{

View File

@ -147,7 +147,7 @@ func StorageNetworkName(ctx helpers.MetricsCtx, a v1api.FullNode) (dtypes.Networ
return a.StateNetworkName(ctx)
}
func SealProofType(maddr dtypes.MinerAddress, fnapi v1api.FullNode) (abi.RegisteredSealProof, error) {
func SealProofType(maddr dtypes.MinerAddress, fnapi v1api.FullNode, configSyntheticPoRep bool) (abi.RegisteredSealProof, error) {
mi, err := fnapi.StateMinerInfo(context.TODO(), address.Address(maddr), types.EmptyTSK)
if err != nil {
return 0, err
@ -157,7 +157,7 @@ func SealProofType(maddr dtypes.MinerAddress, fnapi v1api.FullNode) (abi.Registe
return 0, err
}
return miner.PreferredSealProofTypeFromWindowPoStType(networkVersion, mi.WindowPoStProofType)
return miner.PreferredSealProofTypeFromWindowPoStType(networkVersion, mi.WindowPoStProofType, configSyntheticPoRep)
}
func AddressSelector(addrConf *config.MinerAddressConfig) func() (*ctladdr.AddressSelector, error) {

View File

@ -859,6 +859,33 @@ func (sb *Sealer) SealPreCommit2(ctx context.Context, sector storiface.SectorRef
}
}
if abi.Synthetic[sector.ProofType] {
err = ffi.GenerateSynthProofs(
sector.ProofType,
sealedCID,
unsealedCID,
paths.Cache,
paths.Sealed,
sector.ID.Number,
sector.ID.Miner, ticket,
[]abi.PieceInfo{{Size: abi.PaddedPieceSize(ssize), PieceCID: unsealedCID}})
if err != nil {
log.Warn("GenerateSynthProofs() failed: ", err)
log.Warnf("num:%d tkt:%v seed:%v sealedCID:%v, unsealedCID:%v", sector.ID.Number, ticket, sealedCID, unsealedCID)
return storiface.SectorCids{}, xerrors.Errorf("checking PreCommit failed: %w", err)
}
if err = ffi.ClearLayerData(ssize, paths.Cache); err != nil {
log.Warn("failed to GenerateSynthProofs(): ", err)
log.Warnf("num:%d tkt:%v seed:%v sealedCID:%v, unsealedCID:%v", sector.ID.Number, ticket, sealedCID, unsealedCID)
return storiface.SectorCids{
Unsealed: unsealedCID,
Sealed: sealedCID,
}, nil
// Note: non-fatal error.
}
}
return storiface.SectorCids{
Unsealed: unsealedCID,
Sealed: sealedCID,
@ -889,6 +916,18 @@ func (sb *Sealer) SealCommit1(ctx context.Context, sector storiface.SectorRef, t
return nil, xerrors.Errorf("StandaloneSealCommit: %w", err)
}
ssize, err := sector.ProofType.SectorSize()
if err != nil {
log.Warn("Unable to delete Synth cache: Could not read sector size:", err)
return output, nil // Non-fatal error.
}
ffi.ClearCache(uint64(ssize), paths.Cache)
if err != nil {
log.Warn("Unable to delete Synth cache:", err)
return output, nil // Non-fatal error.
}
return output, nil
}