diff --git a/cmd/lotus-sim/simulation/stages/precommit_stage.go b/cmd/lotus-sim/simulation/stages/precommit_stage.go index 8f82d8988..aa8b80406 100644 --- a/cmd/lotus-sim/simulation/stages/precommit_stage.go +++ b/cmd/lotus-sim/simulation/stages/precommit_stage.go @@ -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 diff --git a/itests/sector_import_full_test.go b/itests/sector_import_full_test.go index e4ec5e141..c9bd96afd 100644 --- a/itests/sector_import_full_test.go +++ b/itests/sector_import_full_test.go @@ -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() diff --git a/itests/sector_import_simple_test.go b/itests/sector_import_simple_test.go index f34438694..fb1a77a14 100644 --- a/itests/sector_import_simple_test.go +++ b/itests/sector_import_simple_test.go @@ -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() diff --git a/markets/storageadapter/provider.go b/markets/storageadapter/provider.go index a5022613b..ad6140473 100644 --- a/markets/storageadapter/provider.go +++ b/markets/storageadapter/provider.go @@ -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 { diff --git a/node/impl/client/client.go b/node/impl/client/client.go index 3ed4a01a7..73ffeabe3 100644 --- a/node/impl/client/client.go +++ b/node/impl/client/client.go @@ -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) } diff --git a/storage/pipeline/sealing.go b/storage/pipeline/sealing.go index d664de1e2..578062397 100644 --- a/storage/pipeline/sealing.go +++ b/storage/pipeline/sealing.go @@ -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 { diff --git a/storage/sealer/ffiwrapper/sealer_cgo.go b/storage/sealer/ffiwrapper/sealer_cgo.go index 11cf30baf..217fe8fec 100644 --- a/storage/sealer/ffiwrapper/sealer_cgo.go +++ b/storage/sealer/ffiwrapper/sealer_cgo.go @@ -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) }