specs-actors: Fix most compilation errors

This commit is contained in:
Łukasz Magiera 2020-02-09 07:06:32 +01:00
parent 68eb35e0f4
commit fb495e98b4
4 changed files with 11 additions and 10 deletions

View File

@ -40,7 +40,7 @@ func checkPieces(ctx context.Context, si SectorInfo, api sealingApi) error {
return &ErrApi{xerrors.Errorf("getting deal %d for piece %d: %w", piece.DealID, i, err)}
}
h, err := multihash.Decode(deal.PieceCID.Hash())
h, err := multihash.Decode(deal.Proposal.PieceCID.Hash())
if err != nil {
return &ErrInvalidDeals{xerrors.Errorf("decoding piece CID: %w", err)}
}
@ -49,12 +49,12 @@ func checkPieces(ctx context.Context, si SectorInfo, api sealingApi) error {
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, h.Digest)}
}
if piece.Size != deal.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, deal.PieceSize)}
if piece.Size != deal.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, deal.Proposal.PieceSize)}
}
if head.Height() >= deal.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, deal.StartEpoch, head.Height())}
if head.Height() >= deal.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, deal.Proposal.StartEpoch, head.Height())}
}
}

3
fsm.go
View File

@ -6,6 +6,7 @@ import (
"reflect"
"time"
"github.com/filecoin-project/specs-actors/actors/abi"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/api"
@ -237,7 +238,7 @@ func (m *Sealing) restartSectors(ctx context.Context) error {
return nil
}
func (m *Sealing) ForceSectorState(ctx context.Context, id uint64, state api.SectorState) error {
func (m *Sealing) ForceSectorState(ctx context.Context, id abi.SectorNumber, state api.SectorState) error {
return m.sectors.Send(id, SectorForceState{state})
}

View File

@ -5,15 +5,15 @@ import (
"io"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-sectorbuilder"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin/market"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/namespace"
logging "github.com/ipfs/go-log/v2"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-sectorbuilder"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/events"
"github.com/filecoin-project/lotus/chain/store"
@ -39,7 +39,7 @@ type sealingApi interface { // TODO: trim down
StateWaitMsg(context.Context, cid.Cid) (*api.MsgWait, error) // TODO: removeme eventually
StateGetActor(ctx context.Context, actor address.Address, ts *types.TipSet) (*types.Actor, error)
StateGetReceipt(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error)
StateMarketStorageDeal(context.Context, abi.DealID, *types.TipSet) (*market.DealProposal, error)
StateMarketStorageDeal(context.Context, abi.DealID, *types.TipSet) (*api.MarketDeal, error)
MpoolPushMessage(context.Context, *types.Message) (*types.SignedMessage, error)

View File

@ -94,7 +94,7 @@ func (m *Sealing) ListSectors() ([]SectorInfo, error) {
return sectors, nil
}
func (m *Sealing) GetSectorInfo(sid uint64) (SectorInfo, error) {
func (m *Sealing) GetSectorInfo(sid abi.SectorNumber) (SectorInfo, error) {
var out SectorInfo
err := m.sectors.Get(sid).Get(&out)
return out, err