WIP: uncomment out windowed post code, try to make it work
This commit is contained in:
parent
8fae155cf6
commit
45288b8810
@ -5,6 +5,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
@ -389,7 +390,7 @@ func (sma StorageMinerActor) ProveCommitSector(act *types.Actor, vmctx types.VMC
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SubmitPoStParams struct {
|
type SubmitPoStParams struct {
|
||||||
Proof types.EPostProof
|
Proof []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func ProvingPeriodEnd(setPeriodEnd, height uint64) (uint64, uint64) {
|
func ProvingPeriodEnd(setPeriodEnd, height uint64) (uint64, uint64) {
|
||||||
|
@ -299,7 +299,7 @@ func (sb *SectorBuilder) GenerateEPostCandidates(sectorInfo SortedPublicSectorIn
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
challengeCount := challangeCount(uint64(len(sectorInfo.Values())))
|
challengeCount := challengeCount(uint64(len(sectorInfo.Values())))
|
||||||
|
|
||||||
proverID := addressToProverID(sb.Miner)
|
proverID := addressToProverID(sb.Miner)
|
||||||
return sectorbuilder.GenerateCandidates(sb.ssize, proverID, challengeSeed, challengeCount, privsectors)
|
return sectorbuilder.GenerateCandidates(sb.ssize, proverID, challengeSeed, challengeCount, privsectors)
|
||||||
@ -328,8 +328,24 @@ func (sb *SectorBuilder) pubSectorToPriv(sectorInfo SortedPublicSectorInfo) (Sor
|
|||||||
return NewSortedPrivateSectorInfo(out), nil
|
return NewSortedPrivateSectorInfo(out), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sb *SectorBuilder) GenerateFallbackPoSt(sectorInfo SortedPrivateSectorInfo, challengeSeed [CommLen]byte, faults []uint64) ([]byte, error) {
|
func (sb *SectorBuilder) GenerateFallbackPoSt(sectorInfo SortedPublicSectorInfo, challengeSeed [CommLen]byte, faults []uint64) ([]byte, error) {
|
||||||
panic("NYI")
|
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
|
var UserBytesForSectorSize = sectorbuilder.GetMaxUserBytesPerStagedSector
|
||||||
@ -357,7 +373,7 @@ func VerifyPost(ctx context.Context, sectorSize uint64, sectorInfo SortedPublicS
|
|||||||
var challengeSeeda [CommLen]byte
|
var challengeSeeda [CommLen]byte
|
||||||
copy(challengeSeeda[:], challengeSeed)
|
copy(challengeSeeda[:], challengeSeed)
|
||||||
|
|
||||||
challengeCount := challangeCount(uint64(len(sectorInfo.Values())))
|
challengeCount := challengeCount(uint64(len(sectorInfo.Values())))
|
||||||
|
|
||||||
_, span := trace.StartSpan(ctx, "VerifyPoSt")
|
_, span := trace.StartSpan(ctx, "VerifyPoSt")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
@ -383,7 +399,7 @@ func GenerateDataCommitment(ssize uint64, pieces []PublicPieceInfo) ([CommLen]by
|
|||||||
return sectorbuilder.GenerateDataCommitment(ssize, pieces)
|
return sectorbuilder.GenerateDataCommitment(ssize, pieces)
|
||||||
}
|
}
|
||||||
|
|
||||||
func challangeCount(sectors uint64) uint64 {
|
func challengeCount(sectors uint64) uint64 {
|
||||||
// ceil(sectors / build.SectorChallengeRatioDiv)
|
// ceil(sectors / build.SectorChallengeRatioDiv)
|
||||||
return (sectors + build.SectorChallengeRatioDiv - 1) / build.SectorChallengeRatioDiv
|
return (sectors + build.SectorChallengeRatioDiv - 1) / build.SectorChallengeRatioDiv
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,10 @@ package storage
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||||
|
|
||||||
"go.opencensus.io/trace"
|
"go.opencensus.io/trace"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
@ -170,20 +171,20 @@ func (p *post) preparePost(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *post) sortedSectorInfo() sectorbuilder.SortedPrivateSectorInfo {
|
func (p *post) sortedSectorInfo() sectorbuilder.SortedPublicSectorInfo {
|
||||||
panic("NYI")
|
panic("NYI")
|
||||||
sbsi := make([]ffi.PrivateSectorInfo, len(p.sset))
|
sbsi := make([]ffi.PublicSectorInfo, len(p.sset))
|
||||||
for k, sector := range p.sset {
|
for k, sector := range p.sset {
|
||||||
var commR [sectorbuilder.CommLen]byte
|
var commR [sectorbuilder.CommLen]byte
|
||||||
copy(commR[:], sector.CommR)
|
copy(commR[:], sector.CommR)
|
||||||
|
|
||||||
sbsi[k] = ffi.PrivateSectorInfo{
|
sbsi[k] = ffi.PublicSectorInfo{
|
||||||
SectorID: sector.SectorID,
|
SectorID: sector.SectorID,
|
||||||
CommR: commR,
|
CommR: commR,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sectorbuilder.NewSortedPrivateSectorInfo(sbsi)
|
return sectorbuilder.NewSortedPublicSectorInfo(sbsi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *post) runPost(ctx context.Context) error {
|
func (p *post) runPost(ctx context.Context) error {
|
||||||
@ -216,35 +217,31 @@ func (p *post) commitPost(ctx context.Context) (err error) {
|
|||||||
ctx, span := trace.StartSpan(ctx, "storage.commitPost")
|
ctx, span := trace.StartSpan(ctx, "storage.commitPost")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
panic("NYI")
|
params := &actors.SubmitPoStParams{
|
||||||
/*
|
Proof: p.proof,
|
||||||
|
}
|
||||||
|
|
||||||
params := &actors.SubmitPoStParams{
|
enc, aerr := actors.SerializeParams(params)
|
||||||
//Proof: p.proof,
|
if aerr != nil {
|
||||||
}
|
return xerrors.Errorf("could not serialize submit post parameters: %w", aerr)
|
||||||
|
}
|
||||||
|
|
||||||
enc, aerr := actors.SerializeParams(params)
|
msg := &types.Message{
|
||||||
if aerr != nil {
|
To: p.m.maddr,
|
||||||
return xerrors.Errorf("could not serialize submit post parameters: %w", aerr)
|
From: p.m.worker,
|
||||||
}
|
Method: actors.MAMethods.SubmitPoSt,
|
||||||
|
Params: enc,
|
||||||
|
Value: types.NewInt(1000), // currently hard-coded late fee in actor, returned if not late
|
||||||
|
GasLimit: types.NewInt(1000000), // i dont know help
|
||||||
|
GasPrice: types.NewInt(1),
|
||||||
|
}
|
||||||
|
|
||||||
msg := &types.Message{
|
log.Info("mpush")
|
||||||
To: p.m.maddr,
|
|
||||||
From: p.m.worker,
|
|
||||||
Method: actors.MAMethods.SubmitPoSt,
|
|
||||||
Params: enc,
|
|
||||||
Value: types.NewInt(1000), // currently hard-coded late fee in actor, returned if not late
|
|
||||||
GasLimit: types.NewInt(1000000), // i dont know help
|
|
||||||
GasPrice: types.NewInt(1),
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Info("mpush")
|
p.smsg, err = p.m.api.MpoolPushMessage(ctx, msg)
|
||||||
|
if err != nil {
|
||||||
p.smsg, err = p.m.api.MpoolPushMessage(ctx, msg)
|
return xerrors.Errorf("pushing message to mpool: %w", err)
|
||||||
if err != nil {
|
}
|
||||||
return xerrors.Errorf("pushing message to mpool: %w", err)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user