SectorID -> SectorNumber

This commit is contained in:
laser 2020-04-06 15:31:33 -07:00
parent 0170418fc1
commit 43f4db2308
10 changed files with 58 additions and 58 deletions

View File

@ -287,7 +287,7 @@ func migratePreSealMeta(ctx context.Context, api lapi.FullNode, metadata string,
info := &sealing.SectorInfo{ info := &sealing.SectorInfo{
State: sealing.Proving, State: sealing.Proving,
SectorID: sector.SectorID, SectorNumber: sector.SectorID,
Pieces: []sealing.Piece{ Pieces: []sealing.Piece{
{ {
DealID: &dealID, DealID: &dealID,

View File

@ -122,7 +122,7 @@ func (sm *StorageMinerAPI) SectorsList(context.Context) ([]abi.SectorNumber, err
out := make([]abi.SectorNumber, len(sectors)) out := make([]abi.SectorNumber, len(sectors))
for i, sector := range sectors { for i, sector := range sectors {
out[i] = sector.SectorID out[i] = sector.SectorNumber
} }
return out, nil return out, nil
} }

View File

@ -204,19 +204,19 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.SectorID (abi.SectorNumber) (uint64) // t.SectorNumber (abi.SectorNumber) (uint64)
if len("SectorID") > cbg.MaxLength { if len("SectorNumber") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"SectorID\" was too long") return xerrors.Errorf("Value in field \"SectorNumber\" was too long")
} }
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("SectorID")))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("SectorNumber")))); err != nil {
return err return err
} }
if _, err := w.Write([]byte("SectorID")); err != nil { if _, err := w.Write([]byte("SectorNumber")); err != nil {
return err return err
} }
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorNumber))); err != nil {
return err return err
} }
@ -636,8 +636,8 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
t.State = SectorState(sval) t.State = SectorState(sval)
} }
// t.SectorID (abi.SectorNumber) (uint64) // t.SectorNumber (abi.SectorNumber) (uint64)
case "SectorID": case "SectorNumber":
{ {
@ -648,7 +648,7 @@ func (t *SectorInfo) 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 = abi.SectorNumber(extra) t.SectorNumber = abi.SectorNumber(extra)
} }
// t.Nonce (uint64) (uint64) // t.Nonce (uint64) (uint64)

View File

@ -52,15 +52,15 @@ func checkPieces(ctx context.Context, si SectorInfo, api SealingAPI) error {
} }
if proposal.PieceCID != piece.CommP { if proposal.PieceCID != piece.CommP {
return &ErrInvalidDeals{xerrors.Errorf("piece %d (or %d) of sector %d refers deal %d with wrong CommP: %x != %x", i, len(si.Pieces), si.SectorID, piece.DealID, piece.CommP, proposal.PieceCID)} return &ErrInvalidDeals{xerrors.Errorf("piece %d (or %d) of sector %d refers deal %d with wrong CommP: %x != %x", i, len(si.Pieces), si.SectorNumber, piece.DealID, piece.CommP, proposal.PieceCID)}
} }
if piece.Size != proposal.PieceSize.Unpadded() { if piece.Size != proposal.PieceSize.Unpadded() {
return &ErrInvalidDeals{xerrors.Errorf("piece %d (or %d) of sector %d refers deal %d with different size: %d != %d", i, len(si.Pieces), si.SectorID, piece.DealID, piece.Size, proposal.PieceSize)} return &ErrInvalidDeals{xerrors.Errorf("piece %d (or %d) of sector %d refers deal %d with different size: %d != %d", i, len(si.Pieces), si.SectorNumber, piece.DealID, piece.Size, proposal.PieceSize)}
} }
if height >= proposal.StartEpoch { if height >= proposal.StartEpoch {
return &ErrExpiredDeals{xerrors.Errorf("piece %d (or %d) of sector %d refers expired deal %d - should start at %d, head %d", i, len(si.Pieces), si.SectorID, piece.DealID, proposal.StartEpoch, height)} return &ErrExpiredDeals{xerrors.Errorf("piece %d (or %d) of sector %d refers expired deal %d - should start at %d, head %d", i, len(si.Pieces), si.SectorNumber, piece.DealID, proposal.StartEpoch, height)}
} }
} }
@ -101,7 +101,7 @@ func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte)
return &ErrBadSeed{xerrors.Errorf("seed epoch was not set")} return &ErrBadSeed{xerrors.Errorf("seed epoch was not set")}
} }
pci, err := m.api.StateSectorPreCommitInfo(ctx, m.maddr, si.SectorID, tok) pci, err := m.api.StateSectorPreCommitInfo(ctx, m.maddr, si.SectorNumber, tok)
if err != nil { if err != nil {
return xerrors.Errorf("getting precommit info: %w", err) return xerrors.Errorf("getting precommit info: %w", err)
} }
@ -133,13 +133,13 @@ func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte)
} }
ok, err := m.verif.VerifySeal(abi.SealVerifyInfo{ ok, err := m.verif.VerifySeal(abi.SealVerifyInfo{
SectorID: m.minerSector(si.SectorID), SectorID: m.minerSector(si.SectorNumber),
OnChain: abi.OnChainSealVerifyInfo{ OnChain: abi.OnChainSealVerifyInfo{
SealedCID: pci.Info.SealedCID, SealedCID: pci.Info.SealedCID,
InteractiveEpoch: si.SeedEpoch, InteractiveEpoch: si.SeedEpoch,
RegisteredProof: spt, RegisteredProof: spt,
Proof: proof, Proof: proof,
SectorNumber: si.SectorID, SectorNumber: si.SectorNumber,
SealRandEpoch: si.TicketEpoch, SealRandEpoch: si.TicketEpoch,
}, },
Randomness: si.TicketValue, Randomness: si.TicketValue,

View File

@ -23,7 +23,7 @@ func (m *Sealing) Plan(events []statemachine.Event, user interface{}) (interface
return func(ctx statemachine.Context, si SectorInfo) error { return func(ctx statemachine.Context, si SectorInfo) error {
err := next(ctx, si) err := next(ctx, si)
if err != nil { if err != nil {
log.Errorf("unhandled sector error (%d): %+v", si.SectorID, err) log.Errorf("unhandled sector error (%d): %+v", si.SectorNumber, err)
return nil return nil
} }
@ -187,7 +187,7 @@ func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(sta
return m.handleFinalizeSector, nil return m.handleFinalizeSector, nil
case Proving: case Proving:
// TODO: track sector health / expiration // TODO: track sector health / expiration
log.Infof("Proving sector %d", state.SectorID) log.Infof("Proving sector %d", state.SectorNumber)
// Handled failure modes // Handled failure modes
case SealFailed: case SealFailed:
@ -209,7 +209,7 @@ func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(sta
case UndefinedSectorState: case UndefinedSectorState:
log.Error("sector update with undefined state!") log.Error("sector update with undefined state!")
case FailedUnrecoverable: case FailedUnrecoverable:
log.Errorf("sector %d failed unrecoverably", state.SectorID) log.Errorf("sector %d failed unrecoverably", state.SectorNumber)
default: default:
log.Errorf("unexpected sector update state: %d", state.State) log.Errorf("unexpected sector update state: %d", state.State)
} }
@ -256,8 +256,8 @@ func (m *Sealing) restartSectors(ctx context.Context) error {
} }
for _, sector := range trackedSectors { for _, sector := range trackedSectors {
if err := m.sectors.Send(uint64(sector.SectorID), SectorRestart{}); err != nil { if err := m.sectors.Send(uint64(sector.SectorNumber), SectorRestart{}); err != nil {
log.Errorf("restarting sector %d: %+v", sector.SectorID, err) log.Errorf("restarting sector %d: %+v", sector.SectorNumber, err)
} }
} }
@ -305,7 +305,7 @@ func planOne(ts ...func() (mut mutator, next SectorState)) func(events []statema
} }
if err, iserr := events[0].User.(error); iserr { if err, iserr := events[0].User.(error); iserr {
log.Warnf("sector %d got error event %T: %+v", state.SectorID, events[0].User, err) log.Warnf("sector %d got error event %T: %+v", state.SectorNumber, events[0].User, err)
} }
events[0].User.(mutator).apply(state) events[0].User.(mutator).apply(state)

View File

@ -29,7 +29,7 @@ type SectorFatalError struct{ error }
func (evt SectorFatalError) FormatError(xerrors.Printer) (next error) { return evt.error } func (evt SectorFatalError) FormatError(xerrors.Printer) (next error) { return evt.error }
func (evt SectorFatalError) applyGlobal(state *SectorInfo) bool { func (evt SectorFatalError) applyGlobal(state *SectorInfo) bool {
log.Errorf("Fatal error on sector %d: %+v", state.SectorID, evt.error) log.Errorf("Fatal error on sector %d: %+v", state.SectorNumber, evt.error)
// TODO: Do we want to mark the state as unrecoverable? // TODO: Do we want to mark the state as unrecoverable?
// I feel like this should be a softer error, where the user would // I feel like this should be a softer error, where the user would
// be able to send a retry event of some kind // be able to send a retry event of some kind
@ -54,7 +54,7 @@ type SectorStart struct {
} }
func (evt SectorStart) apply(state *SectorInfo) { func (evt SectorStart) apply(state *SectorInfo) {
state.SectorID = evt.ID state.SectorNumber = evt.ID
state.Pieces = evt.Pieces state.Pieces = evt.Pieces
state.SectorType = evt.SectorType state.SectorType = evt.SectorType
} }

View File

@ -16,7 +16,7 @@ import (
) )
func (m *Sealing) handlePacking(ctx statemachine.Context, sector SectorInfo) error { func (m *Sealing) handlePacking(ctx statemachine.Context, sector SectorInfo) error {
log.Infow("performing filling up rest of the sector...", "sector", sector.SectorID) log.Infow("performing filling up rest of the sector...", "sector", sector.SectorNumber)
var allocated abi.UnpaddedPieceSize var allocated abi.UnpaddedPieceSize
for _, piece := range sector.Pieces { for _, piece := range sector.Pieces {
@ -35,10 +35,10 @@ func (m *Sealing) handlePacking(ctx statemachine.Context, sector SectorInfo) err
} }
if len(fillerSizes) > 0 { if len(fillerSizes) > 0 {
log.Warnf("Creating %d filler pieces for sector %d", len(fillerSizes), sector.SectorID) log.Warnf("Creating %d filler pieces for sector %d", len(fillerSizes), sector.SectorNumber)
} }
pieces, err := m.pledgeSector(ctx.Context(), m.minerSector(sector.SectorID), sector.existingPieces(), fillerSizes...) pieces, err := m.pledgeSector(ctx.Context(), m.minerSector(sector.SectorNumber), sector.existingPieces(), fillerSizes...)
if err != nil { if err != nil {
return xerrors.Errorf("filling up the sector (%v): %w", fillerSizes, err) return xerrors.Errorf("filling up the sector (%v): %w", fillerSizes, err)
} }
@ -61,13 +61,13 @@ func (m *Sealing) handlePreCommit1(ctx statemachine.Context, sector SectorInfo)
} }
} }
log.Infow("performing sector replication...", "sector", sector.SectorID) log.Infow("performing sector replication...", "sector", sector.SectorNumber)
ticketValue, ticketEpoch, err := m.tktFn(ctx.Context()) ticketValue, ticketEpoch, err := m.tktFn(ctx.Context())
if err != nil { if err != nil {
return ctx.Send(SectorSealPreCommitFailed{xerrors.Errorf("getting ticket failed: %w", err)}) return ctx.Send(SectorSealPreCommitFailed{xerrors.Errorf("getting ticket failed: %w", err)})
} }
pc1o, err := m.sealer.SealPreCommit1(ctx.Context(), m.minerSector(sector.SectorID), ticketValue, sector.pieceInfos()) pc1o, err := m.sealer.SealPreCommit1(ctx.Context(), m.minerSector(sector.SectorNumber), ticketValue, sector.pieceInfos())
if err != nil { if err != nil {
return ctx.Send(SectorSealPreCommitFailed{xerrors.Errorf("seal pre commit(1) failed: %w", err)}) return ctx.Send(SectorSealPreCommitFailed{xerrors.Errorf("seal pre commit(1) failed: %w", err)})
} }
@ -80,7 +80,7 @@ func (m *Sealing) handlePreCommit1(ctx statemachine.Context, sector SectorInfo)
} }
func (m *Sealing) handlePreCommit2(ctx statemachine.Context, sector SectorInfo) error { func (m *Sealing) handlePreCommit2(ctx statemachine.Context, sector SectorInfo) error {
cids, err := m.sealer.SealPreCommit2(ctx.Context(), m.minerSector(sector.SectorID), sector.PreCommit1Out) cids, err := m.sealer.SealPreCommit2(ctx.Context(), m.minerSector(sector.SectorNumber), sector.PreCommit1Out)
if err != nil { if err != nil {
return ctx.Send(SectorSealPreCommitFailed{xerrors.Errorf("seal pre commit(2) failed: %w", err)}) return ctx.Send(SectorSealPreCommitFailed{xerrors.Errorf("seal pre commit(2) failed: %w", err)})
} }
@ -108,7 +108,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
params := &miner.SectorPreCommitInfo{ params := &miner.SectorPreCommitInfo{
Expiration: 10000000, // TODO: implement Expiration: 10000000, // TODO: implement
SectorNumber: sector.SectorID, SectorNumber: sector.SectorNumber,
RegisteredProof: sector.SectorType, RegisteredProof: sector.SectorType,
SealedCID: *sector.CommR, SealedCID: *sector.CommR,
@ -121,7 +121,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("could not serialize pre-commit sector parameters: %w", err)}) return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("could not serialize pre-commit sector parameters: %w", err)})
} }
log.Info("submitting precommit for sector: ", sector.SectorID) log.Info("submitting precommit for sector: ", sector.SectorNumber)
mcid, err := m.api.SendMsg(ctx.Context(), m.worker, m.maddr, builtin.MethodsMiner.PreCommitSector, big.NewInt(0), big.NewInt(1), 1000000, enc.Bytes()) mcid, err := m.api.SendMsg(ctx.Context(), m.worker, m.maddr, builtin.MethodsMiner.PreCommitSector, big.NewInt(0), big.NewInt(1), 1000000, enc.Bytes())
if err != nil { if err != nil {
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)}) return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)})
@ -132,7 +132,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
func (m *Sealing) handleWaitSeed(ctx statemachine.Context, sector SectorInfo) error { func (m *Sealing) handleWaitSeed(ctx statemachine.Context, sector SectorInfo) error {
// would be ideal to just use the events.Called handler, but it wouldnt be able to handle individual message timeouts // would be ideal to just use the events.Called handler, but it wouldnt be able to handle individual message timeouts
log.Info("Sector precommitted: ", sector.SectorID) log.Info("Sector precommitted: ", sector.SectorNumber)
mw, err := m.api.StateWaitMsg(ctx.Context(), *sector.PreCommitMessage) mw, err := m.api.StateWaitMsg(ctx.Context(), *sector.PreCommitMessage)
if err != nil { if err != nil {
return ctx.Send(SectorChainPreCommitFailed{err}) return ctx.Send(SectorChainPreCommitFailed{err})
@ -143,9 +143,9 @@ func (m *Sealing) handleWaitSeed(ctx statemachine.Context, sector SectorInfo) er
err := xerrors.Errorf("sector precommit failed: %d", mw.Receipt.ExitCode) err := xerrors.Errorf("sector precommit failed: %d", mw.Receipt.ExitCode)
return ctx.Send(SectorChainPreCommitFailed{err}) return ctx.Send(SectorChainPreCommitFailed{err})
} }
log.Info("precommit message landed on chain: ", sector.SectorID) log.Info("precommit message landed on chain: ", sector.SectorNumber)
pci, err := m.api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorID, mw.TipSetTok) pci, err := m.api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, mw.TipSetTok)
if err != nil { if err != nil {
return xerrors.Errorf("getting precommit info: %w", err) return xerrors.Errorf("getting precommit info: %w", err)
} }
@ -179,18 +179,18 @@ func (m *Sealing) handleWaitSeed(ctx statemachine.Context, sector SectorInfo) er
func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo) error { func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo) error {
log.Info("scheduling seal proof computation...") log.Info("scheduling seal proof computation...")
log.Infof("KOMIT %d %x(%d); %x(%d); %v; r:%x; d:%x", sector.SectorID, sector.TicketValue, sector.TicketEpoch, sector.SeedValue, sector.SeedEpoch, sector.pieceInfos(), sector.CommR, sector.CommD) log.Infof("KOMIT %d %x(%d); %x(%d); %v; r:%x; d:%x", sector.SectorNumber, sector.TicketValue, sector.TicketEpoch, sector.SeedValue, sector.SeedEpoch, sector.pieceInfos(), sector.CommR, sector.CommD)
cids := storage.SectorCids{ cids := storage.SectorCids{
Unsealed: *sector.CommD, Unsealed: *sector.CommD,
Sealed: *sector.CommR, Sealed: *sector.CommR,
} }
c2in, err := m.sealer.SealCommit1(ctx.Context(), m.minerSector(sector.SectorID), sector.TicketValue, sector.SeedValue, sector.pieceInfos(), cids) c2in, err := m.sealer.SealCommit1(ctx.Context(), m.minerSector(sector.SectorNumber), sector.TicketValue, sector.SeedValue, sector.pieceInfos(), cids)
if err != nil { if err != nil {
return ctx.Send(SectorComputeProofFailed{xerrors.Errorf("computing seal proof failed: %w", err)}) return ctx.Send(SectorComputeProofFailed{xerrors.Errorf("computing seal proof failed: %w", err)})
} }
proof, err := m.sealer.SealCommit2(ctx.Context(), m.minerSector(sector.SectorID), c2in) proof, err := m.sealer.SealCommit2(ctx.Context(), m.minerSector(sector.SectorNumber), c2in)
if err != nil { if err != nil {
return ctx.Send(SectorComputeProofFailed{xerrors.Errorf("computing seal proof failed: %w", err)}) return ctx.Send(SectorComputeProofFailed{xerrors.Errorf("computing seal proof failed: %w", err)})
} }
@ -202,7 +202,7 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo)
// TODO: Consider splitting states and persist proof for faster recovery // TODO: Consider splitting states and persist proof for faster recovery
params := &miner.ProveCommitSectorParams{ params := &miner.ProveCommitSectorParams{
SectorNumber: sector.SectorID, SectorNumber: sector.SectorNumber,
Proof: proof, Proof: proof,
} }
@ -225,7 +225,7 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo)
func (m *Sealing) handleCommitWait(ctx statemachine.Context, sector SectorInfo) error { func (m *Sealing) handleCommitWait(ctx statemachine.Context, sector SectorInfo) error {
if sector.CommitMessage == nil { if sector.CommitMessage == nil {
log.Errorf("sector %d entered commit wait state without a message cid", sector.SectorID) log.Errorf("sector %d entered commit wait state without a message cid", sector.SectorNumber)
return ctx.Send(SectorCommitFailed{xerrors.Errorf("entered commit wait with no commit cid")}) return ctx.Send(SectorCommitFailed{xerrors.Errorf("entered commit wait with no commit cid")})
} }
@ -244,7 +244,7 @@ func (m *Sealing) handleCommitWait(ctx statemachine.Context, sector SectorInfo)
func (m *Sealing) handleFinalizeSector(ctx statemachine.Context, sector SectorInfo) error { func (m *Sealing) handleFinalizeSector(ctx statemachine.Context, sector SectorInfo) error {
// TODO: Maybe wait for some finality // TODO: Maybe wait for some finality
if err := m.sealer.FinalizeSector(ctx.Context(), m.minerSector(sector.SectorID)); err != nil { if err := m.sealer.FinalizeSector(ctx.Context(), m.minerSector(sector.SectorNumber)); err != nil {
return ctx.Send(SectorFinalizeFailed{xerrors.Errorf("finalize sector: %w", err)}) return ctx.Send(SectorFinalizeFailed{xerrors.Errorf("finalize sector: %w", err)})
} }
@ -256,7 +256,7 @@ func (m *Sealing) handleFaulty(ctx statemachine.Context, sector SectorInfo) erro
// TODO: coalesce faulty sector reporting // TODO: coalesce faulty sector reporting
bf := abi.NewBitField() bf := abi.NewBitField()
bf.Set(uint64(sector.SectorID)) bf.Set(uint64(sector.SectorNumber))
params := &miner.DeclareTemporaryFaultsParams{ params := &miner.DeclareTemporaryFaultsParams{
SectorNumbers: bf, SectorNumbers: bf,
@ -287,7 +287,7 @@ func (m *Sealing) handleFaultReported(ctx statemachine.Context, sector SectorInf
} }
if mw.Receipt.ExitCode != 0 { if mw.Receipt.ExitCode != 0 {
log.Errorf("UNHANDLED: declaring sector fault failed (exit=%d, msg=%s) (id: %d)", mw.Receipt.ExitCode, *sector.FaultReportMsg, sector.SectorID) log.Errorf("UNHANDLED: declaring sector fault failed (exit=%d, msg=%s) (id: %d)", mw.Receipt.ExitCode, *sector.FaultReportMsg, sector.SectorNumber)
return xerrors.Errorf("UNHANDLED: submitting fault declaration failed (exit %d)", mw.Receipt.ExitCode) return xerrors.Errorf("UNHANDLED: submitting fault declaration failed (exit %d)", mw.Receipt.ExitCode)
} }

View File

@ -16,7 +16,7 @@ func failedCooldown(ctx statemachine.Context, sector SectorInfo) error {
retryStart := time.Unix(int64(sector.Log[len(sector.Log)-1].Timestamp), 0).Add(minRetryTime) retryStart := time.Unix(int64(sector.Log[len(sector.Log)-1].Timestamp), 0).Add(minRetryTime)
if len(sector.Log) > 0 && !time.Now().After(retryStart) { if len(sector.Log) > 0 && !time.Now().After(retryStart) {
log.Infof("%s(%d), waiting %s before retrying", sector.State, sector.SectorID, time.Until(retryStart)) log.Infof("%s(%d), waiting %s before retrying", sector.State, sector.SectorNumber, time.Until(retryStart))
select { select {
case <-time.After(time.Until(retryStart)): case <-time.After(time.Until(retryStart)):
case <-ctx.Context().Done(): case <-ctx.Context().Done():
@ -30,13 +30,13 @@ func failedCooldown(ctx statemachine.Context, sector SectorInfo) error {
func (m *Sealing) checkPreCommitted(ctx statemachine.Context, sector SectorInfo) (*miner.SectorPreCommitOnChainInfo, bool) { func (m *Sealing) checkPreCommitted(ctx statemachine.Context, sector SectorInfo) (*miner.SectorPreCommitOnChainInfo, bool) {
tok, _, err := m.api.ChainHead(ctx.Context()) tok, _, err := m.api.ChainHead(ctx.Context())
if err != nil { if err != nil {
log.Errorf("handleSealFailed(%d): temp error: %+v", sector.SectorID, err) log.Errorf("handleSealFailed(%d): temp error: %+v", sector.SectorNumber, err)
return nil, true return nil, true
} }
info, err := m.api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorID, tok) info, err := m.api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, tok)
if err != nil { if err != nil {
log.Errorf("handleSealFailed(%d): temp error: %+v", sector.SectorID, err) log.Errorf("handleSealFailed(%d): temp error: %+v", sector.SectorNumber, err)
return nil, true return nil, true
} }
@ -73,12 +73,12 @@ func (m *Sealing) handlePreCommitFailed(ctx statemachine.Context, sector SectorI
if pci, is := m.checkPreCommitted(ctx, sector); is && pci != nil { if pci, is := m.checkPreCommitted(ctx, sector); is && pci != nil {
if sector.PreCommitMessage != nil { if sector.PreCommitMessage != nil {
log.Warn("sector %d is precommitted on chain, but we don't have precommit message", sector.SectorID) log.Warn("sector %d is precommitted on chain, but we don't have precommit message", sector.SectorNumber)
return nil // TODO: SeedWait needs this currently return nil // TODO: SeedWait needs this currently
} }
if pci.Info.SealedCID != *sector.CommR { if pci.Info.SealedCID != *sector.CommR {
log.Warn("sector %d is precommitted on chain, with different CommR: %x != %x", sector.SectorID, pci.Info.SealedCID, sector.CommR) log.Warn("sector %d is precommitted on chain, with different CommR: %x != %x", sector.SectorNumber, pci.Info.SealedCID, sector.CommR)
return nil // TODO: remove when the actor allows re-precommit return nil // TODO: remove when the actor allows re-precommit
} }

View File

@ -30,7 +30,7 @@ type Log struct {
type SectorInfo struct { type SectorInfo struct {
State SectorState State SectorState
SectorID abi.SectorNumber // TODO: this field's name should be changed to SectorNumber SectorNumber abi.SectorNumber // TODO: this field's name should be changed to SectorNumber
Nonce uint64 // TODO: remove Nonce uint64 // TODO: remove
SectorType abi.RegisteredProof SectorType abi.RegisteredProof

View File

@ -18,7 +18,7 @@ func TestSectorInfoSelialization(t *testing.T) {
si := &SectorInfo{ si := &SectorInfo{
State: "stateful", State: "stateful",
SectorID: 234, SectorNumber: 234,
Nonce: 345, Nonce: 345,
Pieces: []Piece{{ Pieces: []Piece{{
DealID: &d, DealID: &d,
@ -50,7 +50,7 @@ func TestSectorInfoSelialization(t *testing.T) {
assert.Equal(t, si.State, si2.State) assert.Equal(t, si.State, si2.State)
assert.Equal(t, si.Nonce, si2.Nonce) assert.Equal(t, si.Nonce, si2.Nonce)
assert.Equal(t, si.SectorID, si2.SectorID) assert.Equal(t, si.SectorNumber, si2.SectorNumber)
assert.Equal(t, si.Pieces, si2.Pieces) assert.Equal(t, si.Pieces, si2.Pieces)
assert.Equal(t, si.CommD, si2.CommD) assert.Equal(t, si.CommD, si2.CommD)