Fix compilation after dep updates
This commit is contained in:
parent
a593a4f6f4
commit
fa2c6605c2
@ -448,7 +448,7 @@ func (sma StorageMinerActor) SubmitFallbackPoSt(act *types.Actor, vmctx types.VM
|
|||||||
return xerrors.New("could not decode comms")
|
return xerrors.New("could not decode comms")
|
||||||
}
|
}
|
||||||
si := ffi.PublicSectorInfo{
|
si := ffi.PublicSectorInfo{
|
||||||
SectorID: id,
|
SectorNum: abi.SectorNumber(id),
|
||||||
}
|
}
|
||||||
commR := comms[0]
|
commR := comms[0]
|
||||||
if len(commR) != len(si.CommR) {
|
if len(commR) != len(si.CommR) {
|
||||||
@ -471,7 +471,7 @@ func (sma StorageMinerActor) SubmitFallbackPoSt(act *types.Actor, vmctx types.VM
|
|||||||
copy(partial[:], t.Partial)
|
copy(partial[:], t.Partial)
|
||||||
candidates = append(candidates, sectorbuilder.EPostCandidate{
|
candidates = append(candidates, sectorbuilder.EPostCandidate{
|
||||||
PartialTicket: partial,
|
PartialTicket: partial,
|
||||||
SectorID: t.SectorID,
|
SectorNum: t.SectorID,
|
||||||
SectorChallengeIndex: t.ChallengeIndex,
|
SectorChallengeIndex: t.ChallengeIndex,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ type eppProvider struct{}
|
|||||||
func (epp *eppProvider) GenerateCandidates(ctx context.Context, _ sectorbuilder.SortedPublicSectorInfo, eprand []byte) ([]sectorbuilder.EPostCandidate, error) {
|
func (epp *eppProvider) GenerateCandidates(ctx context.Context, _ sectorbuilder.SortedPublicSectorInfo, eprand []byte) ([]sectorbuilder.EPostCandidate, error) {
|
||||||
return []sectorbuilder.EPostCandidate{
|
return []sectorbuilder.EPostCandidate{
|
||||||
{
|
{
|
||||||
SectorID: 1,
|
SectorNum: 1,
|
||||||
PartialTicket: [32]byte{},
|
PartialTicket: [32]byte{},
|
||||||
Ticket: [32]byte{},
|
Ticket: [32]byte{},
|
||||||
SectorChallengeIndex: 1,
|
SectorChallengeIndex: 1,
|
||||||
@ -527,7 +527,7 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round int64, miner add
|
|||||||
var commRa [32]byte
|
var commRa [32]byte
|
||||||
copy(commRa[:], s.CommR)
|
copy(commRa[:], s.CommR)
|
||||||
sinfos = append(sinfos, ffi.PublicSectorInfo{
|
sinfos = append(sinfos, ffi.PublicSectorInfo{
|
||||||
SectorID: uint64(s.SectorID),
|
SectorNum: s.SectorID,
|
||||||
CommR: commRa,
|
CommR: commRa,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -584,7 +584,7 @@ func ComputeProof(ctx context.Context, epp ElectionPoStProver, pi *ProofInput) (
|
|||||||
copy(part, win.PartialTicket[:])
|
copy(part, win.PartialTicket[:])
|
||||||
ept.Candidates = append(ept.Candidates, types.EPostTicket{
|
ept.Candidates = append(ept.Candidates, types.EPostTicket{
|
||||||
Partial: part,
|
Partial: part,
|
||||||
SectorID: win.SectorID,
|
SectorID: win.SectorNum,
|
||||||
ChallengeIndex: win.SectorChallengeIndex,
|
ChallengeIndex: win.SectorChallengeIndex,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ func GetSectorsForElectionPost(ctx context.Context, sm *StateManager, ts *types.
|
|||||||
var uselessBuffer [32]byte
|
var uselessBuffer [32]byte
|
||||||
copy(uselessBuffer[:], s.CommR)
|
copy(uselessBuffer[:], s.CommR)
|
||||||
uselessOtherArray = append(uselessOtherArray, ffi.PublicSectorInfo{
|
uselessOtherArray = append(uselessOtherArray, ffi.PublicSectorInfo{
|
||||||
SectorID: uint64(s.SectorID),
|
SectorNum: s.SectorID,
|
||||||
CommR: uselessBuffer,
|
CommR: uselessBuffer,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -670,7 +670,7 @@ func (syncer *Syncer) VerifyElectionPoStProof(ctx context.Context, h *types.Bloc
|
|||||||
copy(partial[:], t.Partial)
|
copy(partial[:], t.Partial)
|
||||||
winners = append(winners, sectorbuilder.EPostCandidate{
|
winners = append(winners, sectorbuilder.EPostCandidate{
|
||||||
PartialTicket: partial,
|
PartialTicket: partial,
|
||||||
SectorID: t.SectorID,
|
SectorNum: t.SectorID,
|
||||||
SectorChallengeIndex: t.ChallengeIndex,
|
SectorChallengeIndex: t.ChallengeIndex,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ type Ticket struct {
|
|||||||
|
|
||||||
type EPostTicket struct {
|
type EPostTicket struct {
|
||||||
Partial []byte
|
Partial []byte
|
||||||
SectorID uint64
|
SectorID abi.SectorNumber
|
||||||
ChallengeIndex uint64
|
ChallengeIndex uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,7 +530,6 @@ func (t *EPostTicket) UnmarshalCBOR(r io.Reader) error {
|
|||||||
if maj != cbg.MajUnsignedInt {
|
if maj != cbg.MajUnsignedInt {
|
||||||
return fmt.Errorf("wrong type for uint64 field")
|
return fmt.Errorf("wrong type for uint64 field")
|
||||||
}
|
}
|
||||||
t.SectorID = uint64(extra)
|
|
||||||
// t.ChallengeIndex (uint64) (uint64)
|
// t.ChallengeIndex (uint64) (uint64)
|
||||||
|
|
||||||
maj, extra, err = cbg.CborReadHeader(br)
|
maj, extra, err = cbg.CborReadHeader(br)
|
||||||
|
@ -196,7 +196,7 @@ func main() {
|
|||||||
|
|
||||||
sealedSectors = append(sealedSectors, ffi.PublicSectorInfo{
|
sealedSectors = append(sealedSectors, ffi.PublicSectorInfo{
|
||||||
CommR: pco.CommR,
|
CommR: pco.CommR,
|
||||||
SectorID: uint64(i),
|
SectorNum: i,
|
||||||
})
|
})
|
||||||
|
|
||||||
seed := sectorbuilder.SealSeed{
|
seed := sectorbuilder.SealSeed{
|
||||||
@ -224,7 +224,7 @@ func main() {
|
|||||||
|
|
||||||
if !c.Bool("skip-unseal") {
|
if !c.Bool("skip-unseal") {
|
||||||
log.Info("Unsealing sector")
|
log.Info("Unsealing sector")
|
||||||
rc, err := sb.ReadPieceFromSealedSector(context.TODO(), 1, 0, uint64(sectorSize), ticket.TicketBytes[:], commD[:])
|
rc, err := sb.ReadPieceFromSealedSector(context.TODO(), 1, 0, abi.UnpaddedPieceSize(sectorSize), ticket.TicketBytes[:], commD[:])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ func main() {
|
|||||||
for _, s := range genm.Sectors {
|
for _, s := range genm.Sectors {
|
||||||
sealedSectors = append(sealedSectors, ffi.PublicSectorInfo{
|
sealedSectors = append(sealedSectors, ffi.PublicSectorInfo{
|
||||||
CommR: s.CommR,
|
CommR: s.CommR,
|
||||||
SectorID: uint64(s.SectorID),
|
SectorNum: s.SectorID,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ loop:
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
case task := <-tasks:
|
case task := <-tasks:
|
||||||
log.Infof("New task: %d, sector %d, action: %d", task.TaskID, task.SectorID, task.Type)
|
log.Infof("New task: %d, sector %d, action: %d", task.TaskID, task.SectorNum, task.Type)
|
||||||
|
|
||||||
res := w.processTask(ctx, task)
|
res := w.processTask(ctx, task)
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ func (w *worker) processTask(ctx context.Context, task sectorbuilder.WorkerTask)
|
|||||||
return errRes(xerrors.Errorf("unknown task type %d", task.Type))
|
return errRes(xerrors.Errorf("unknown task type %d", task.Type))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := w.fetchSector(task.SectorID, task.Type); err != nil {
|
if err := w.fetchSector(task.SectorNum, task.Type); err != nil {
|
||||||
return errRes(xerrors.Errorf("fetching sector: %w", err))
|
return errRes(xerrors.Errorf("fetching sector: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ func (w *worker) processTask(ctx context.Context, task sectorbuilder.WorkerTask)
|
|||||||
switch task.Type {
|
switch task.Type {
|
||||||
case sectorbuilder.WorkerPreCommit:
|
case sectorbuilder.WorkerPreCommit:
|
||||||
w.limiter.workLimit <- struct{}{}
|
w.limiter.workLimit <- struct{}{}
|
||||||
rspco, err := w.sb.SealPreCommit(ctx, task.SectorID, task.SealTicket, task.Pieces)
|
rspco, err := w.sb.SealPreCommit(ctx, task.SectorNum, task.SealTicket, task.Pieces)
|
||||||
<-w.limiter.workLimit
|
<-w.limiter.workLimit
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -90,20 +90,20 @@ func (w *worker) processTask(ctx context.Context, task sectorbuilder.WorkerTask)
|
|||||||
}
|
}
|
||||||
res.Rspco = rspco.ToJson()
|
res.Rspco = rspco.ToJson()
|
||||||
|
|
||||||
if err := w.push("sealed", task.SectorID); err != nil {
|
if err := w.push("sealed", task.SectorNum); err != nil {
|
||||||
return errRes(xerrors.Errorf("pushing precommited data: %w", err))
|
return errRes(xerrors.Errorf("pushing precommited data: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := w.push("cache", task.SectorID); err != nil {
|
if err := w.push("cache", task.SectorNum); err != nil {
|
||||||
return errRes(xerrors.Errorf("pushing precommited data: %w", err))
|
return errRes(xerrors.Errorf("pushing precommited data: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := w.remove("staging", task.SectorID); err != nil {
|
if err := w.remove("staging", task.SectorNum); err != nil {
|
||||||
return errRes(xerrors.Errorf("cleaning up staged sector: %w", err))
|
return errRes(xerrors.Errorf("cleaning up staged sector: %w", err))
|
||||||
}
|
}
|
||||||
case sectorbuilder.WorkerCommit:
|
case sectorbuilder.WorkerCommit:
|
||||||
w.limiter.workLimit <- struct{}{}
|
w.limiter.workLimit <- struct{}{}
|
||||||
proof, err := w.sb.SealCommit(ctx, task.SectorID, task.SealTicket, task.SealSeed, task.Pieces, task.Rspco)
|
proof, err := w.sb.SealCommit(ctx, task.SectorNum, task.SealTicket, task.SealSeed, task.Pieces, task.Rspco)
|
||||||
<-w.limiter.workLimit
|
<-w.limiter.workLimit
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -112,11 +112,11 @@ func (w *worker) processTask(ctx context.Context, task sectorbuilder.WorkerTask)
|
|||||||
|
|
||||||
res.Proof = proof
|
res.Proof = proof
|
||||||
|
|
||||||
if err := w.push("cache", task.SectorID); err != nil {
|
if err := w.push("cache", task.SectorNum); err != nil {
|
||||||
return errRes(xerrors.Errorf("pushing precommited data: %w", err))
|
return errRes(xerrors.Errorf("pushing precommited data: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := w.remove("sealed", task.SectorID); err != nil {
|
if err := w.remove("sealed", task.SectorNum); err != nil {
|
||||||
return errRes(xerrors.Errorf("cleaning up sealed sector: %w", err))
|
return errRes(xerrors.Errorf("cleaning up sealed sector: %w", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ var preSealCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
gm, err := seed.PreSeal(maddr, abi.SectorSize(c.Uint64("sector-size")), c.Uint64("sector-offset"), c.Int("num-sectors"), sbroot, []byte(c.String("ticket-preimage")))
|
gm, err := seed.PreSeal(maddr, abi.SectorSize(c.Uint64("sector-size")), abi.SectorNumber(c.Uint64("sector-offset")), c.Int("num-sectors"), sbroot, []byte(c.String("ticket-preimage")))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ var aggregateSectorDirsCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := agsb.SetLastSectorID(highestSectorID); err != nil {
|
if err := agsb.SetLastSectorNum(highestSectorID); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,11 +32,11 @@ import (
|
|||||||
|
|
||||||
var log = logging.Logger("preseal")
|
var log = logging.Logger("preseal")
|
||||||
|
|
||||||
func PreSeal(maddr address.Address, ssize abi.SectorSize, offset uint64, sectors int, sbroot string, preimage []byte) (*genesis.GenesisMiner, error) {
|
func PreSeal(maddr address.Address, ssize abi.SectorSize, offset abi.SectorNumber, sectors int, sbroot string, preimage []byte) (*genesis.GenesisMiner, error) {
|
||||||
cfg := §orbuilder.Config{
|
cfg := §orbuilder.Config{
|
||||||
Miner: maddr,
|
Miner: maddr,
|
||||||
SectorSize: ssize,
|
SectorSize: ssize,
|
||||||
FallbackLastID: offset,
|
FallbackLastNum: offset,
|
||||||
Paths: sectorbuilder.SimplePath(sbroot),
|
Paths: sectorbuilder.SimplePath(sbroot),
|
||||||
WorkerThreads: 2,
|
WorkerThreads: 2,
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ func PreSeal(maddr address.Address, ssize abi.SectorSize, offset uint64, sectors
|
|||||||
|
|
||||||
var sealedSectors []*genesis.PreSeal
|
var sealedSectors []*genesis.PreSeal
|
||||||
for i := 0; i < sectors; i++ {
|
for i := 0; i < sectors; i++ {
|
||||||
sid, err := sb.AcquireSectorId()
|
sid, err := sb.AcquireSectorNumber()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
1
go.mod
1
go.mod
@ -19,6 +19,7 @@ require (
|
|||||||
github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce
|
github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce
|
||||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5
|
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5
|
||||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200206024724-973498b060e3
|
github.com/filecoin-project/go-fil-markets v0.0.0-20200206024724-973498b060e3
|
||||||
|
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.1
|
github.com/filecoin-project/go-paramfetch v0.0.1
|
||||||
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200210220012-eb75ec747d6b
|
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200210220012-eb75ec747d6b
|
||||||
github.com/filecoin-project/go-statestore v0.1.0
|
github.com/filecoin-project/go-statestore v0.1.0
|
||||||
|
2
go.sum
2
go.sum
@ -117,6 +117,8 @@ github.com/filecoin-project/go-fil-markets v0.0.0-20200206024724-973498b060e3 h1
|
|||||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200206024724-973498b060e3/go.mod h1:0d8NAXL4ecTLvxCpoc0cZd1XbRq9UtFT14BkITidVkc=
|
github.com/filecoin-project/go-fil-markets v0.0.0-20200206024724-973498b060e3/go.mod h1:0d8NAXL4ecTLvxCpoc0cZd1XbRq9UtFT14BkITidVkc=
|
||||||
github.com/filecoin-project/go-padreader v0.0.0-20200130212543-892867c4edf9 h1:CQsjS+oWG96rk5YbeKpPw84fhbgc5H6/BGvrlPgd63A=
|
github.com/filecoin-project/go-padreader v0.0.0-20200130212543-892867c4edf9 h1:CQsjS+oWG96rk5YbeKpPw84fhbgc5H6/BGvrlPgd63A=
|
||||||
github.com/filecoin-project/go-padreader v0.0.0-20200130212543-892867c4edf9/go.mod h1:r0gyD7zvnqyRKSY8stil5G/LF0kXFgNzW/yR4vjga+Y=
|
github.com/filecoin-project/go-padreader v0.0.0-20200130212543-892867c4edf9/go.mod h1:r0gyD7zvnqyRKSY8stil5G/LF0kXFgNzW/yR4vjga+Y=
|
||||||
|
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6 h1:92PET+sx1Hb4W/8CgFwGuxaKbttwY+UNspYZTvXY0vs=
|
||||||
|
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6/go.mod h1:0HgYnrkeSU4lu1p+LEOeDpFsNBssa0OGGriWdA4hvaE=
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878/go.mod h1:40kI2Gv16mwcRsHptI3OAV4nlOEU7wVDc4RgMylNFjU=
|
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878/go.mod h1:40kI2Gv16mwcRsHptI3OAV4nlOEU7wVDc4RgMylNFjU=
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.1 h1:gV7bs5YaqlgpGFMiLxInGK2L1FyCXUE0rimz4L7ghoE=
|
github.com/filecoin-project/go-paramfetch v0.0.1 h1:gV7bs5YaqlgpGFMiLxInGK2L1FyCXUE0rimz4L7ghoE=
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.1/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc=
|
github.com/filecoin-project/go-paramfetch v0.0.1/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc=
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
package padreader
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
"math/bits"
|
|
||||||
|
|
||||||
sectorbuilder "github.com/filecoin-project/filecoin-ffi"
|
|
||||||
)
|
|
||||||
|
|
||||||
func PaddedSize(size uint64) uint64 {
|
|
||||||
logv := 64 - bits.LeadingZeros64(size)
|
|
||||||
|
|
||||||
sectSize := uint64(1 << logv)
|
|
||||||
bound := sectorbuilder.GetMaxUserBytesPerStagedSector(sectSize)
|
|
||||||
if size <= bound {
|
|
||||||
return bound
|
|
||||||
}
|
|
||||||
|
|
||||||
return sectorbuilder.GetMaxUserBytesPerStagedSector(1 << (logv + 1))
|
|
||||||
}
|
|
||||||
|
|
||||||
type nullReader struct{}
|
|
||||||
|
|
||||||
func (nr nullReader) Read(b []byte) (int, error) {
|
|
||||||
for i := range b {
|
|
||||||
b[i] = 0
|
|
||||||
}
|
|
||||||
return len(b), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(r io.Reader, size uint64) (io.Reader, uint64) {
|
|
||||||
padSize := PaddedSize(size)
|
|
||||||
|
|
||||||
return io.MultiReader(
|
|
||||||
io.LimitReader(r, int64(size)),
|
|
||||||
io.LimitReader(nullReader{}, int64(padSize-size)),
|
|
||||||
), padSize
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package padreader
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"gotest.tools/assert"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestComputePaddedSize(t *testing.T) {
|
|
||||||
assert.Equal(t, uint64(1040384), PaddedSize(1000000))
|
|
||||||
|
|
||||||
assert.Equal(t, uint64(1016), PaddedSize(548))
|
|
||||||
assert.Equal(t, uint64(1016), PaddedSize(1015))
|
|
||||||
assert.Equal(t, uint64(1016), PaddedSize(1016))
|
|
||||||
assert.Equal(t, uint64(2032), PaddedSize(1017))
|
|
||||||
|
|
||||||
assert.Equal(t, uint64(2032), PaddedSize(1024))
|
|
||||||
assert.Equal(t, uint64(4064), PaddedSize(2048))
|
|
||||||
}
|
|
@ -33,7 +33,7 @@ func (rpn *retrievalProviderNode) UnsealSector(ctx context.Context, sectorID abi
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return rpn.sb.ReadPieceFromSealedSector(ctx, sectorID, offset, length, si.Ticket.TicketBytes, si.CommD)
|
return rpn.sb.ReadPieceFromSealedSector(ctx, sectorID, sectorbuilder.UnpaddedByteIndex(offset), abi.UnpaddedPieceSize(length), si.Ticket.TicketBytes, si.CommD)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rpn *retrievalProviderNode) SavePaymentVoucher(ctx context.Context, paymentChannel address.Address, voucher *retrievaltypes.SignedVoucher, proof []byte, expectedAmount retrievaltoken.TokenAmount) (retrievaltoken.TokenAmount, error) {
|
func (rpn *retrievalProviderNode) SavePaymentVoucher(ctx context.Context, paymentChannel address.Address, voucher *retrievaltypes.SignedVoucher, proof []byte, expectedAmount retrievaltoken.TokenAmount) (retrievaltoken.TokenAmount, error) {
|
||||||
|
@ -107,13 +107,13 @@ func (s *FPoStScheduler) checkFaults(ctx context.Context, ssi sectorbuilder.Sort
|
|||||||
params := &actors.DeclareFaultsParams{Faults: types.NewBitField()}
|
params := &actors.DeclareFaultsParams{Faults: types.NewBitField()}
|
||||||
|
|
||||||
for _, fault := range faults {
|
for _, fault := range faults {
|
||||||
if _, ok := declaredFaults[abi.SectorNumber(fault.SectorID)]; ok {
|
if _, ok := declaredFaults[abi.SectorNumber(fault.SectorNum)]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Warnf("new fault detected: sector %d: %s", fault.SectorID, fault.Err)
|
log.Warnf("new fault detected: sector %d: %s", fault.SectorNum, fault.Err)
|
||||||
declaredFaults[abi.SectorNumber(fault.SectorID)] = struct{}{}
|
declaredFaults[fault.SectorNum] = struct{}{}
|
||||||
params.Faults.Set(fault.SectorID)
|
params.Faults.Set(uint64(fault.SectorNum))
|
||||||
}
|
}
|
||||||
|
|
||||||
pc, err := params.Faults.Count()
|
pc, err := params.Faults.Count()
|
||||||
@ -184,7 +184,7 @@ func (s *FPoStScheduler) runPost(ctx context.Context, eps abi.ChainEpoch, ts *ty
|
|||||||
copy(part, sc.PartialTicket[:])
|
copy(part, sc.PartialTicket[:])
|
||||||
candidates[i] = types.EPostTicket{
|
candidates[i] = types.EPostTicket{
|
||||||
Partial: part,
|
Partial: part,
|
||||||
SectorID: sc.SectorID,
|
SectorID: sc.SectorNum,
|
||||||
ChallengeIndex: sc.SectorChallengeIndex,
|
ChallengeIndex: sc.SectorChallengeIndex,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ func (s *FPoStScheduler) sortedSectorInfo(ctx context.Context, ts *types.TipSet)
|
|||||||
copy(commR[:], sector.CommR)
|
copy(commR[:], sector.CommR)
|
||||||
|
|
||||||
sbsi[k] = ffi.PublicSectorInfo{
|
sbsi[k] = ffi.PublicSectorInfo{
|
||||||
SectorID: uint64(sector.SectorID),
|
SectorNum: sector.SectorID,
|
||||||
CommR: commR,
|
CommR: commR,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
// TODO: refactor this to be direct somehow
|
// TODO: refactor this to be direct somehow
|
||||||
|
|
||||||
func (m *Miner) AllocatePiece(size uint64) (sectorID abi.SectorNumber, offset uint64, err error) {
|
func (m *Miner) AllocatePiece(size abi.UnpaddedPieceSize) (sectorID abi.SectorNumber, offset uint64, err error) {
|
||||||
return m.sealing.AllocatePiece(size)
|
return m.sealing.AllocatePiece(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ func (m *Sealing) PledgeSector() error {
|
|||||||
|
|
||||||
size := abi.PaddedPieceSize(m.sb.SectorSize()).Unpadded()
|
size := abi.PaddedPieceSize(m.sb.SectorSize()).Unpadded()
|
||||||
|
|
||||||
sid, err := m.sb.AcquireSectorId()
|
sid, err := m.sb.AcquireSectorNumber()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("%+v", err)
|
log.Errorf("%+v", err)
|
||||||
return
|
return
|
||||||
|
@ -12,13 +12,13 @@ import (
|
|||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-padreader"
|
||||||
"github.com/filecoin-project/go-sectorbuilder"
|
"github.com/filecoin-project/go-sectorbuilder"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/chain/events"
|
"github.com/filecoin-project/lotus/chain/events"
|
||||||
"github.com/filecoin-project/lotus/chain/store"
|
"github.com/filecoin-project/lotus/chain/store"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/lib/padreader"
|
|
||||||
"github.com/filecoin-project/lotus/lib/statemachine"
|
"github.com/filecoin-project/lotus/lib/statemachine"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -96,12 +96,12 @@ func (m *Sealing) Stop(ctx context.Context) error {
|
|||||||
return m.sectors.Stop(ctx)
|
return m.sectors.Stop(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Sealing) AllocatePiece(size uint64) (sectorID abi.SectorNumber, offset uint64, err error) {
|
func (m *Sealing) AllocatePiece(size abi.UnpaddedPieceSize) (sectorID abi.SectorNumber, offset uint64, err error) {
|
||||||
if padreader.PaddedSize(size) != size {
|
if (padreader.PaddedSize(uint64(size))) != size {
|
||||||
return 0, 0, xerrors.Errorf("cannot allocate unpadded piece")
|
return 0, 0, xerrors.Errorf("cannot allocate unpadded piece")
|
||||||
}
|
}
|
||||||
|
|
||||||
sid, err := m.sb.AcquireSectorId() // TODO: Put more than one thing in a sector
|
sid, err := m.sb.AcquireSectorNumber() // TODO: Put more than one thing in a sector
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, 0, xerrors.Errorf("acquiring sector ID: %w", err)
|
return 0, 0, xerrors.Errorf("acquiring sector ID: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ type Piece struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Piece) ppi() (out sectorbuilder.PublicPieceInfo) {
|
func (p *Piece) ppi() (out sectorbuilder.PublicPieceInfo) {
|
||||||
out.Size = uint64(p.Size)
|
out.Size = p.Size
|
||||||
copy(out.CommP[:], p.CommP)
|
copy(out.CommP[:], p.CommP)
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ func (m *Sealing) fastPledgeCommitment(size abi.UnpaddedPieceSize, parts uint64)
|
|||||||
err = multierror.Append(err, perr)
|
err = multierror.Append(err, perr)
|
||||||
}
|
}
|
||||||
out[i] = sectorbuilder.PublicPieceInfo{
|
out[i] = sectorbuilder.PublicPieceInfo{
|
||||||
Size: uint64(piece),
|
Size: piece,
|
||||||
CommP: commP,
|
CommP: commP,
|
||||||
}
|
}
|
||||||
lk.Unlock()
|
lk.Unlock()
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-padreader"
|
||||||
sectorbuilder "github.com/filecoin-project/go-sectorbuilder"
|
sectorbuilder "github.com/filecoin-project/go-sectorbuilder"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/ipfs/go-datastore"
|
"github.com/ipfs/go-datastore"
|
||||||
@ -17,8 +18,8 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
cborutil "github.com/filecoin-project/go-cbor-util"
|
cborutil "github.com/filecoin-project/go-cbor-util"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/lib/padreader"
|
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
"github.com/filecoin-project/lotus/storage"
|
"github.com/filecoin-project/lotus/storage"
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user