Make Synthetic PoRep work
This commit is contained in:
parent
c58ab3e582
commit
50cf19722a
@ -267,6 +267,6 @@ func TestPledgeSynth(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("3", func(t *testing.T) {
|
||||
runTest(t, 100)
|
||||
runTest(t, 3)
|
||||
})
|
||||
}
|
||||
|
@ -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, configSyntheticPoRep bool) (abi.RegisteredSealProof, error) {
|
||||
func SealProofType(maddr dtypes.MinerAddress, fnapi v1api.FullNode) (abi.RegisteredSealProof, error) {
|
||||
mi, err := fnapi.StateMinerInfo(context.TODO(), address.Address(maddr), types.EmptyTSK)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@ -157,7 +157,8 @@ func SealProofType(maddr dtypes.MinerAddress, fnapi v1api.FullNode, configSynthe
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return miner.PreferredSealProofTypeFromWindowPoStType(networkVersion, mi.WindowPoStProofType, configSyntheticPoRep)
|
||||
// node seal proof type does not decide whether or not we use synthetic porep
|
||||
return miner.PreferredSealProofTypeFromWindowPoStType(networkVersion, mi.WindowPoStProofType, false)
|
||||
}
|
||||
|
||||
func AddressSelector(addrConf *config.MinerAddressConfig) func() (*ctladdr.AddressSelector, error) {
|
||||
|
@ -825,15 +825,49 @@ func (sb *Sealer) SealPreCommit2(ctx context.Context, sector storiface.SectorRef
|
||||
return storiface.SectorCids{}, xerrors.Errorf("unmarshaling pc1 output: %w", err)
|
||||
}
|
||||
|
||||
var ticket abi.SealRandomness
|
||||
ti, found := p1odec["_lotus_SealRandomness"]
|
||||
|
||||
if abi.Synthetic[sector.ProofType] {
|
||||
if !found {
|
||||
return storiface.SectorCids{}, xerrors.Errorf("synthetic mode: ticket not found")
|
||||
}
|
||||
}
|
||||
|
||||
if found {
|
||||
ticket, err = base64.StdEncoding.DecodeString(ti.(string))
|
||||
ticket, err := base64.StdEncoding.DecodeString(ti.(string))
|
||||
if err != nil {
|
||||
return storiface.SectorCids{}, xerrors.Errorf("decoding ticket: %w", err)
|
||||
}
|
||||
|
||||
if abi.Synthetic[sector.ProofType] {
|
||||
// note: we generate synth porep challenges first because the C1 check below reads from those
|
||||
|
||||
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, sealedCID:%v, unsealedCID:%v", sector.ID.Number, ticket, sealedCID, unsealedCID)
|
||||
return storiface.SectorCids{}, xerrors.Errorf("generate synth proofs: %w", err)
|
||||
}
|
||||
|
||||
if err = ffi.ClearLayerData(ssize, paths.Cache); err != nil {
|
||||
log.Warn("failed to GenerateSynthProofs(): ", err)
|
||||
log.Warnf("num:%d tkt:%v, sealedCID:%v, unsealedCID:%v", sector.ID.Number, ticket, sealedCID, unsealedCID)
|
||||
return storiface.SectorCids{
|
||||
Unsealed: unsealedCID,
|
||||
Sealed: sealedCID,
|
||||
}, nil
|
||||
// Note: non-fatal error.
|
||||
}
|
||||
}
|
||||
|
||||
for i := 0; i < PC2CheckRounds; i++ {
|
||||
var sd [32]byte
|
||||
_, _ = rand.Read(sd[:])
|
||||
@ -859,33 +893,6 @@ 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, sealedCID:%v, unsealedCID:%v", sector.ID.Number, ticket, sealedCID, unsealedCID)
|
||||
return storiface.SectorCids{}, xerrors.Errorf("generate synth proofs: %w", err)
|
||||
}
|
||||
|
||||
if err = ffi.ClearLayerData(ssize, paths.Cache); err != nil {
|
||||
log.Warn("failed to GenerateSynthProofs(): ", err)
|
||||
log.Warnf("num:%d tkt:%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,
|
||||
|
Loading…
Reference in New Issue
Block a user