Synthetic PoRep Impl

This commit is contained in:
Andrew Jackson (Ajax) 2023-06-09 11:21:31 -05:00 committed by Łukasz Magiera
parent 5ed8a5c0ac
commit 7f306a5b02
7 changed files with 31 additions and 36 deletions

View File

@ -165,7 +165,7 @@ func (stage *PreCommitStage) packMiner(
// Generate pre-commits.
sealType, err := miner.PreferredSealProofTypeFromWindowPoStType(
nv, minerInfo.WindowPoStProofType,
nv, minerInfo.WindowPoStProofType, false
)
if err != nil {
return 0, false, err

View File

@ -88,7 +88,7 @@ func TestSectorImport(t *testing.T) {
require.NoError(t, err)
ver, err := client.StateNetworkVersion(ctx, types.EmptyTSK)
require.NoError(t, err)
spt, err := lminer.PreferredSealProofTypeFromWindowPoStType(ver, mi.WindowPoStProofType)
spt, err := lminer.PreferredSealProofTypeFromWindowPoStType(ver, mi.WindowPoStProofType, false)
require.NoError(t, err)
ssize, err := spt.SectorSize()

View File

@ -63,7 +63,7 @@ func TestSectorImportAfterPC2(t *testing.T) {
require.NoError(t, err)
ver, err := client.StateNetworkVersion(ctx, types.EmptyTSK)
require.NoError(t, err)
spt, err := lminer.PreferredSealProofTypeFromWindowPoStType(ver, mi.WindowPoStProofType)
spt, err := lminer.PreferredSealProofTypeFromWindowPoStType(ver, mi.WindowPoStProofType, false)
require.NoError(t, err)
ssize, err := spt.SectorSize()

View File

@ -23,7 +23,6 @@ import (
"github.com/filecoin-project/lotus/api/v1api"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/events"
"github.com/filecoin-project/lotus/chain/events/state"
"github.com/filecoin-project/lotus/chain/types"
@ -170,25 +169,6 @@ func (n *ProviderNodeAdapter) GetMinerWorkerAddress(ctx context.Context, maddr a
return mi.Worker, nil
}
func (n *ProviderNodeAdapter) GetProofType(ctx context.Context, maddr address.Address, tok shared.TipSetToken) (abi.RegisteredSealProof, error) {
tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil {
return 0, err
}
mi, err := n.StateMinerInfo(ctx, maddr, tsk)
if err != nil {
return 0, err
}
nver, err := n.StateNetworkVersion(ctx, tsk)
if err != nil {
return 0, err
}
return miner.PreferredSealProofTypeFromWindowPoStType(nver, mi.WindowPoStProofType)
}
func (n *ProviderNodeAdapter) SignBytes(ctx context.Context, signer address.Address, b []byte) (*crypto.Signature, error) {
signer, err := n.StateAccountKey(ctx, signer, types.EmptyTSK)
if err != nil {

View File

@ -197,7 +197,7 @@ func (a *API) dealStarter(ctx context.Context, params *api.StartDealParams, isSt
return nil, xerrors.Errorf("failed to get network version: %w", err)
}
st, err := miner.PreferredSealProofTypeFromWindowPoStType(networkVersion, mi.WindowPoStProofType)
st, err := miner.PreferredSealProofTypeFromWindowPoStType(networkVersion, mi.WindowPoStProofType, false)
if err != nil {
return nil, xerrors.Errorf("failed to get seal proof type: %w", err)
}

View File

@ -339,7 +339,12 @@ func (m *Sealing) currentSealProof(ctx context.Context) (abi.RegisteredSealProof
return 0, err
}
return lminer.PreferredSealProofTypeFromWindowPoStType(ver, mi.WindowPoStProofType)
c, err := m.getConfig()
if err != nil {
return 0, err
}
return lminer.PreferredSealProofTypeFromWindowPoStType(ver, mi.WindowPoStProofType, c.SealWithSyntheticPoRep)
}
func (m *Sealing) minerSector(spt abi.RegisteredSealProof, num abi.SectorNumber) storiface.SectorRef {

View File

@ -917,17 +917,6 @@ 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.ClearSyntheticProofs(uint64(ssize), paths.Cache)
if err != nil {
log.Warn("Unable to delete Synth cache:", err)
return output, nil // Non-fatal error.
}
return output, nil
}
@ -1117,6 +1106,13 @@ func (sb *Sealer) FinalizeSector(ctx context.Context, sector storiface.SectorRef
}
defer done()
if abi.Synthetic[sector.ProofType] {
if err = ffi.ClearSyntheticProofs(uint64(ssize), paths.Cache); err != nil {
log.Warn("Unable to delete Synth cache:", err)
// Pass-Thru on error.
}
}
return ffi.ClearCache(uint64(ssize), paths.Cache)
}
@ -1155,6 +1151,13 @@ func (sb *Sealer) FinalizeSectorInto(ctx context.Context, sector storiface.Secto
}
}
if abi.Synthetic[sector.ProofType] {
if err = ffi.ClearSyntheticProofs(uint64(ssize), paths.Cache); err != nil {
log.Warn("Unable to delete Synth cache:", err)
// Pass-Thru on error.
}
}
return ffi.ClearCache(uint64(ssize), dest)
}
@ -1183,6 +1186,13 @@ func (sb *Sealer) FinalizeReplicaUpdate(ctx context.Context, sector storiface.Se
}
defer done()
if abi.Synthetic[sector.ProofType] {
if err = ffi.ClearSyntheticProofs(uint64(ssize), paths.Cache); err != nil {
log.Warn("Unable to delete Synth cache:", err)
// Pass-Thru on error.
}
}
if err := ffi.ClearCache(uint64(ssize), paths.UpdateCache); err != nil {
return xerrors.Errorf("clear cache: %w", err)
}