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
var SectorSizes = []uint64{
1 << 10,
16 << 20,
256 << 20,
1 << 30,

View File

@ -184,6 +184,7 @@ func (sma StorageMinerActor) StorageMinerConstructor(act *types.Actor, vmctx typ
SectorSize: params.SectorSize,
}
fmt.Println("NEW STORAGE MINER WITH SECTOR SIZE: ", params.SectorSize)
minfocid, err := vmctx.Storage().Put(minerInfo)
if err != nil {
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)
hvrf := sha256.Sum256(vrfout)
log.Info("Replicas: ", sectors)
candidates, err := epp.GenerateCandidates(ctx, sectors, vrfout)
candidates, err := epp.GenerateCandidates(ctx, sectors, hvrf[:])
if err != nil {
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
}
proof, err := epp.ComputeProof(ctx, sectors, vrfout, winners)
proof, err := epp.ComputeProof(ctx, sectors, hvrf[:], winners)
if err != nil {
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{
Owner: owner,
Worker: worker,
SectorSize: build.SectorSizes[0],
SectorSize: 1024, // TODO: needs to come from preseals info
PeerID: pid,
})

View File

@ -291,28 +291,28 @@ func (sb *SectorBuilder) SealCommit(sectorID uint64, ticket SealTicket, seed Sea
}
}
/* sealedPath, err := sb.sealedSectorPath(sectorID)
if err != nil {
return nil, err
}
/* sealedPath, err := sb.sealedSectorPath(sectorID)
if err != nil {
return nil, err
}
err = sectorbuilder.ImportSealedSector(
sb.handle,
sectorID,
cacheDir,
sealedPath,
ticket,
seed,
rspco.CommR,
rspco.CommD,
rspco.CommC,
rspco.CommRLast,
proof,
pmeta,
)
if err != nil {
return nil, xerrors.Errorf("ImportSealedSector: %w", err)
}*/
err = sectorbuilder.ImportSealedSector(
sb.handle,
sectorID,
cacheDir,
sealedPath,
ticket,
seed,
rspco.CommR,
rspco.CommD,
rspco.CommC,
rspco.CommRLast,
proof,
pmeta,
)
if err != nil {
return nil, xerrors.Errorf("ImportSealedSector: %w", err)
}*/
return proof, nil
}
@ -357,9 +357,13 @@ func (sb *SectorBuilder) ComputeElectionPoSt(sectorInfo SortedPublicSectorInfo,
var cseed [CommLen]byte
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) {