WIP: uncomment out windowed post code, try to make it work

This commit is contained in:
whyrusleeping 2019-11-27 21:36:34 -06:00
parent 8fae155cf6
commit 45288b8810
3 changed files with 50 additions and 36 deletions

View File

@ -5,6 +5,7 @@ import (
"context"
"encoding/binary"
"fmt"
ffi "github.com/filecoin-project/filecoin-ffi"
"github.com/filecoin-project/lotus/build"
@ -389,7 +390,7 @@ func (sma StorageMinerActor) ProveCommitSector(act *types.Actor, vmctx types.VMC
}
type SubmitPoStParams struct {
Proof types.EPostProof
Proof []byte
}
func ProvingPeriodEnd(setPeriodEnd, height uint64) (uint64, uint64) {

View File

@ -299,7 +299,7 @@ func (sb *SectorBuilder) GenerateEPostCandidates(sectorInfo SortedPublicSectorIn
return nil, err
}
challengeCount := challangeCount(uint64(len(sectorInfo.Values())))
challengeCount := challengeCount(uint64(len(sectorInfo.Values())))
proverID := addressToProverID(sb.Miner)
return sectorbuilder.GenerateCandidates(sb.ssize, proverID, challengeSeed, challengeCount, privsectors)
@ -328,8 +328,24 @@ func (sb *SectorBuilder) pubSectorToPriv(sectorInfo SortedPublicSectorInfo) (Sor
return NewSortedPrivateSectorInfo(out), nil
}
func (sb *SectorBuilder) GenerateFallbackPoSt(sectorInfo SortedPrivateSectorInfo, challengeSeed [CommLen]byte, faults []uint64) ([]byte, error) {
panic("NYI")
func (sb *SectorBuilder) GenerateFallbackPoSt(sectorInfo SortedPublicSectorInfo, challengeSeed [CommLen]byte, faults []uint64) ([]byte, error) {
privsectors, err := sb.pubSectorToPriv(sectorInfo)
if err != nil {
return nil, err
}
challengeCount := challengeCount(uint64(len(sectorInfo.Values())))
if challengeCount > 10 {
challengeCount = 10
}
proverID := addressToProverID(sb.Miner)
candidates, err := sectorbuilder.GenerateCandidates(sb.ssize, proverID, challengeSeed, challengeCount, privsectors)
if err != nil {
return nil, err
}
return sectorbuilder.GeneratePoSt(sb.ssize, proverID, privsectors, challengeSeed, candidates)
}
var UserBytesForSectorSize = sectorbuilder.GetMaxUserBytesPerStagedSector
@ -357,7 +373,7 @@ func VerifyPost(ctx context.Context, sectorSize uint64, sectorInfo SortedPublicS
var challengeSeeda [CommLen]byte
copy(challengeSeeda[:], challengeSeed)
challengeCount := challangeCount(uint64(len(sectorInfo.Values())))
challengeCount := challengeCount(uint64(len(sectorInfo.Values())))
_, span := trace.StartSpan(ctx, "VerifyPoSt")
defer span.End()
@ -383,7 +399,7 @@ func GenerateDataCommitment(ssize uint64, pieces []PublicPieceInfo) ([CommLen]by
return sectorbuilder.GenerateDataCommitment(ssize, pieces)
}
func challangeCount(sectors uint64) uint64 {
func challengeCount(sectors uint64) uint64 {
// ceil(sectors / build.SectorChallengeRatioDiv)
return (sectors + build.SectorChallengeRatioDiv - 1) / build.SectorChallengeRatioDiv
}

View File

@ -2,9 +2,10 @@ package storage
import (
"context"
ffi "github.com/filecoin-project/filecoin-ffi"
"time"
ffi "github.com/filecoin-project/filecoin-ffi"
"go.opencensus.io/trace"
"golang.org/x/xerrors"
@ -170,20 +171,20 @@ func (p *post) preparePost(ctx context.Context) error {
return nil
}
func (p *post) sortedSectorInfo() sectorbuilder.SortedPrivateSectorInfo {
func (p *post) sortedSectorInfo() sectorbuilder.SortedPublicSectorInfo {
panic("NYI")
sbsi := make([]ffi.PrivateSectorInfo, len(p.sset))
sbsi := make([]ffi.PublicSectorInfo, len(p.sset))
for k, sector := range p.sset {
var commR [sectorbuilder.CommLen]byte
copy(commR[:], sector.CommR)
sbsi[k] = ffi.PrivateSectorInfo{
sbsi[k] = ffi.PublicSectorInfo{
SectorID: sector.SectorID,
CommR: commR,
}
}
return sectorbuilder.NewSortedPrivateSectorInfo(sbsi)
return sectorbuilder.NewSortedPublicSectorInfo(sbsi)
}
func (p *post) runPost(ctx context.Context) error {
@ -216,11 +217,8 @@ func (p *post) commitPost(ctx context.Context) (err error) {
ctx, span := trace.StartSpan(ctx, "storage.commitPost")
defer span.End()
panic("NYI")
/*
params := &actors.SubmitPoStParams{
//Proof: p.proof,
Proof: p.proof,
}
enc, aerr := actors.SerializeParams(params)
@ -244,7 +242,6 @@ func (p *post) commitPost(ctx context.Context) (err error) {
if err != nil {
return xerrors.Errorf("pushing message to mpool: %w", err)
}
*/
return nil
}