produce more valid post proof

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
This commit is contained in:
Ignacio Hagopian 2020-05-20 11:16:45 -03:00
parent ca37a9086f
commit 806f7b33aa
No known key found for this signature in database
GPG Key ID: 4DC349E20B2AD1BE

View File

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"math"
"math/rand" "math/rand"
"sync" "sync"
@ -247,11 +248,24 @@ func AddOpFinish(ctx context.Context) (context.Context, func()) {
} }
func (mgr *SectorMgr) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []abi.SectorInfo, randomness abi.PoStRandomness) ([]abi.PoStProof, error) { func (mgr *SectorMgr) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []abi.SectorInfo, randomness abi.PoStRandomness) ([]abi.PoStProof, error) {
return []abi.PoStProof{}, nil return generateFakePoSt(sectorInfo), nil
} }
func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []abi.SectorInfo, randomness abi.PoStRandomness) ([]abi.PoStProof, error) { func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []abi.SectorInfo, randomness abi.PoStRandomness) ([]abi.PoStProof, error) {
return []abi.PoStProof{}, nil return generateFakePoSt(sectorInfo), nil
}
func generateFakePoSt(sectorInfo []abi.SectorInfo) []abi.PoStProof {
se, err := sectorInfo[0].RegisteredProof.WindowPoStPartitionSectors()
if err != nil {
panic(err)
}
return []abi.PoStProof{
{
RegisteredProof: sectorInfo[0].RegisteredProof,
ProofBytes: make([]byte, 192*int(math.Ceil(float64(len(sectorInfo))/float64(se)))),
},
}
} }
func (mgr *SectorMgr) ReadPieceFromSealedSector(ctx context.Context, sectorID abi.SectorID, offset ffiwrapper.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, commD cid.Cid) (io.ReadCloser, error) { func (mgr *SectorMgr) ReadPieceFromSealedSector(ctx context.Context, sectorID abi.SectorID, offset ffiwrapper.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, commD cid.Cid) (io.ReadCloser, error) {