filecoin-ffi master

This commit is contained in:
Łukasz Magiera 2019-11-27 23:34:48 +01:00
parent ce27cf9656
commit 99b9dfe18d
3 changed files with 6 additions and 22 deletions

View File

@ -19,20 +19,6 @@ var SectorSizes = []uint64{
1 << 30,
}
const nodeSize = 32
// sector size -> winSzNodes
//
// https://github.com/filecoin-project/rust-fil-proofs/blob/master/filecoin-proofs/src/constants.rs#L16-L20
var WindowSizeNodes = map[uint64]uint32{
1 << 10: 512 / nodeSize,
16 << 20: (4 << 20) / nodeSize,
256 << 20: (64 << 20) / nodeSize,
1 << 30: (128 << 20) / nodeSize,
}
func SupportedSectorSize(ssize uint64) bool {
for _, ss := range SectorSizes {
if ssize == ss {

2
extern/filecoin-ffi vendored

@ -1 +1 @@
Subproject commit 0e3c18829e42c95e2c92242e612f77781d5825ea
Subproject commit 0e71b164cf4b2e1c0f53ca25145e3ea57cc53e90

View File

@ -222,7 +222,6 @@ func (sb *SectorBuilder) SealPreCommit(sectorID uint64, ticket SealTicket, piece
rspco, err := sectorbuilder.SealPreCommit(
sb.ssize,
build.WindowSizeNodes[sb.ssize],
PoRepProofPartitions,
cacheDir,
stagedPath,
@ -250,7 +249,6 @@ func (sb *SectorBuilder) SealCommit(sectorID uint64, ticket SealTicket, seed Sea
proof, err = sectorbuilder.SealCommit(
sb.ssize,
build.WindowSizeNodes[sb.ssize],
PoRepProofPartitions,
cacheDir,
sectorID,
@ -292,7 +290,7 @@ func (sb *SectorBuilder) ComputeElectionPoSt(sectorInfo SortedPublicSectorInfo,
}
proverID := addressToProverID(sb.Miner)
return sectorbuilder.GeneratePoSt(sb.ssize, build.WindowSizeNodes[sb.ssize], proverID, privsects, cseed, winners)
return sectorbuilder.GeneratePoSt(sb.ssize, proverID, privsects, cseed, winners)
}
func (sb *SectorBuilder) GenerateEPostCandidates(sectorInfo SortedPublicSectorInfo, challengeSeed [CommLen]byte, faults []uint64) ([]EPostCandidate, error) {
@ -304,7 +302,7 @@ func (sb *SectorBuilder) GenerateEPostCandidates(sectorInfo SortedPublicSectorIn
challengeCount := challangeCount(uint64(len(sectorInfo.Values())))
proverID := addressToProverID(sb.Miner)
return sectorbuilder.GenerateCandidates(sb.ssize, build.WindowSizeNodes[sb.ssize], proverID, challengeSeed, challengeCount, privsectors)
return sectorbuilder.GenerateCandidates(sb.ssize, proverID, challengeSeed, challengeCount, privsectors)
}
func (sb *SectorBuilder) pubSectorToPriv(sectorInfo SortedPublicSectorInfo) (SortedPrivateSectorInfo, error) {
@ -344,7 +342,7 @@ func VerifySeal(sectorSize uint64, commR, commD []byte, proverID address.Address
copy(seeda[:], seed)
proverIDa := addressToProverID(proverID)
return sectorbuilder.VerifySeal(sectorSize, build.WindowSizeNodes[sectorSize], commRa, commDa, proverIDa, ticketa, seeda, sectorID, proof)
return sectorbuilder.VerifySeal(sectorSize, commRa, commDa, proverIDa, ticketa, seeda, sectorID, proof)
}
func NewSortedPrivateSectorInfo(sectors []sectorbuilder.PrivateSectorInfo) SortedPrivateSectorInfo {
@ -364,7 +362,7 @@ func VerifyPost(ctx context.Context, sectorSize uint64, sectorInfo SortedPublicS
_, span := trace.StartSpan(ctx, "VerifyPoSt")
defer span.End()
prover := addressToProverID(proverID)
return sectorbuilder.VerifyPoSt(sectorSize, build.WindowSizeNodes[sectorSize], sectorInfo, challengeSeeda, challengeCount, proof, winners, prover)
return sectorbuilder.VerifyPoSt(sectorSize, sectorInfo, challengeSeeda, challengeCount, proof, winners, prover)
}
func GeneratePieceCommitment(piece io.Reader, pieceSize uint64) (commP [CommLen]byte, err error) {
@ -382,7 +380,7 @@ func GeneratePieceCommitment(piece io.Reader, pieceSize uint64) (commP [CommLen]
}
func GenerateDataCommitment(ssize uint64, pieces []PublicPieceInfo) ([CommLen]byte, error) {
return sectorbuilder.GenerateDataCommitment(ssize, build.WindowSizeNodes[ssize], pieces)
return sectorbuilder.GenerateDataCommitment(ssize, pieces)
}
func challangeCount(sectors uint64) uint64 {