use the correct sector sizes in places

This commit is contained in:
whyrusleeping 2019-11-25 20:43:43 -06:00
parent 7a3ffbf9fe
commit a98295a747
5 changed files with 33 additions and 26 deletions

View File

@ -13,6 +13,7 @@ const UnixfsChunkSize uint64 = 1 << 20
const UnixfsLinksPerLevel = 1024 const UnixfsLinksPerLevel = 1024
var SectorSizes = []uint64{ var SectorSizes = []uint64{
1 << 10,
16 << 20, 16 << 20,
256 << 20, 256 << 20,
1 << 30, 1 << 30,

View File

@ -184,6 +184,7 @@ func (sma StorageMinerActor) StorageMinerConstructor(act *types.Actor, vmctx typ
SectorSize: params.SectorSize, SectorSize: params.SectorSize,
} }
fmt.Println("NEW STORAGE MINER WITH SECTOR SIZE: ", params.SectorSize)
minfocid, err := vmctx.Storage().Put(minerInfo) minfocid, err := vmctx.Storage().Put(minerInfo)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -466,8 +466,9 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round int64, miner add
} }
sectors := sectorbuilder.NewSortedPublicSectorInfo(sinfos) sectors := sectorbuilder.NewSortedPublicSectorInfo(sinfos)
hvrf := sha256.Sum256(vrfout)
log.Info("Replicas: ", sectors) log.Info("Replicas: ", sectors)
candidates, err := epp.GenerateCandidates(ctx, sectors, vrfout) candidates, err := epp.GenerateCandidates(ctx, sectors, hvrf[:])
if err != nil { if err != nil {
return false, nil, xerrors.Errorf("failed to generate electionPoSt candidates: %w", err) return false, nil, xerrors.Errorf("failed to generate electionPoSt candidates: %w", err)
} }
@ -494,7 +495,7 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round int64, miner add
return false, nil, nil return false, nil, nil
} }
proof, err := epp.ComputeProof(ctx, sectors, vrfout, winners) proof, err := epp.ComputeProof(ctx, sectors, hvrf[:], winners)
if err != nil { if err != nil {
return false, nil, xerrors.Errorf("failed to compute snark for election proof: %w", err) return false, nil, xerrors.Errorf("failed to compute snark for election proof: %w", err)
} }

View File

@ -246,7 +246,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
params := mustEnc(&actors.CreateStorageMinerParams{ params := mustEnc(&actors.CreateStorageMinerParams{
Owner: owner, Owner: owner,
Worker: worker, Worker: worker,
SectorSize: build.SectorSizes[0], SectorSize: 1024, // TODO: needs to come from preseals info
PeerID: pid, PeerID: pid,
}) })

View File

@ -291,28 +291,28 @@ func (sb *SectorBuilder) SealCommit(sectorID uint64, ticket SealTicket, seed Sea
} }
} }
/* sealedPath, err := sb.sealedSectorPath(sectorID) /* sealedPath, err := sb.sealedSectorPath(sectorID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
err = sectorbuilder.ImportSealedSector( err = sectorbuilder.ImportSealedSector(
sb.handle, sb.handle,
sectorID, sectorID,
cacheDir, cacheDir,
sealedPath, sealedPath,
ticket, ticket,
seed, seed,
rspco.CommR, rspco.CommR,
rspco.CommD, rspco.CommD,
rspco.CommC, rspco.CommC,
rspco.CommRLast, rspco.CommRLast,
proof, proof,
pmeta, pmeta,
) )
if err != nil { if err != nil {
return nil, xerrors.Errorf("ImportSealedSector: %w", err) return nil, xerrors.Errorf("ImportSealedSector: %w", err)
}*/ }*/
return proof, nil return proof, nil
} }
@ -357,9 +357,13 @@ func (sb *SectorBuilder) ComputeElectionPoSt(sectorInfo SortedPublicSectorInfo,
var cseed [CommLen]byte var cseed [CommLen]byte
copy(cseed[:], challengeSeed) copy(cseed[:], challengeSeed)
challengeCount := challangeCount(uint64(len(sectorInfo.Values()))) privsects, err := sb.pubSectorToPriv(sectorInfo)
if err != nil {
return nil, err
}
return sectorbuilder.GeneratePoSt(sb.handle, sectorInfo, cseed, challengeCount, winners) proverID := addressToProverID(sb.Miner)
return sectorbuilder.StandaloneGeneratePoSt(sb.ssize, proverID, privsects, cseed, winners)
} }
func (sb *SectorBuilder) GenerateEPostCandidates(sectorInfo SortedPublicSectorInfo, challengeSeed [CommLen]byte, faults []uint64) ([]EPostCandidate, error) { func (sb *SectorBuilder) GenerateEPostCandidates(sectorInfo SortedPublicSectorInfo, challengeSeed [CommLen]byte, faults []uint64) ([]EPostCandidate, error) {