Merge pull request #1517 from filecoin-project/feat/lotus-agnostic-node-interface
remove lotus types from sealing package in preparation for extraction
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
+15
-8
@@ -12,6 +12,9 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
storagemarket "github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||
sectorstorage "github.com/filecoin-project/sector-storage"
|
||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
||||
"github.com/filecoin-project/sector-storage/stores"
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
@@ -20,10 +23,8 @@ import (
|
||||
"github.com/filecoin-project/lotus/miner"
|
||||
"github.com/filecoin-project/lotus/node/impl/common"
|
||||
"github.com/filecoin-project/lotus/storage"
|
||||
"github.com/filecoin-project/lotus/storage/sealing"
|
||||
"github.com/filecoin-project/lotus/storage/sectorblocks"
|
||||
"github.com/filecoin-project/sector-storage"
|
||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
||||
"github.com/filecoin-project/sector-storage/stores"
|
||||
)
|
||||
|
||||
type StorageMinerAPI struct {
|
||||
@@ -97,9 +98,15 @@ func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid abi.SectorNumb
|
||||
CommR: info.CommR,
|
||||
Proof: info.Proof,
|
||||
Deals: deals,
|
||||
Ticket: info.Ticket,
|
||||
Seed: info.Seed,
|
||||
Retries: info.Nonce,
|
||||
Ticket: api.SealTicket{
|
||||
Value: info.TicketValue,
|
||||
Epoch: info.TicketEpoch,
|
||||
},
|
||||
Seed: api.SealSeed{
|
||||
Value: info.SeedValue,
|
||||
Epoch: info.SeedEpoch,
|
||||
},
|
||||
Retries: info.Nonce,
|
||||
|
||||
LastErr: info.LastErr,
|
||||
Log: log,
|
||||
@@ -115,7 +122,7 @@ func (sm *StorageMinerAPI) SectorsList(context.Context) ([]abi.SectorNumber, err
|
||||
|
||||
out := make([]abi.SectorNumber, len(sectors))
|
||||
for i, sector := range sectors {
|
||||
out[i] = sector.SectorID
|
||||
out[i] = sector.SectorNumber
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
@@ -144,7 +151,7 @@ func (sm *StorageMinerAPI) StorageStat(ctx context.Context, id stores.ID) (store
|
||||
return sm.StorageMgr.FsStat(ctx, id)
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) SectorsUpdate(ctx context.Context, id abi.SectorNumber, state api.SectorState) error {
|
||||
func (sm *StorageMinerAPI) SectorsUpdate(ctx context.Context, id abi.SectorNumber, state sealing.SectorState) error {
|
||||
return sm.Miner.ForceSectorState(ctx, id, state)
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,9 @@ import (
|
||||
"github.com/filecoin-project/go-fil-markets/storedcounter"
|
||||
paramfetch "github.com/filecoin-project/go-paramfetch"
|
||||
"github.com/filecoin-project/go-statestore"
|
||||
sectorstorage "github.com/filecoin-project/sector-storage"
|
||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
||||
"github.com/filecoin-project/sector-storage/stores"
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||
|
||||
@@ -49,9 +52,6 @@ import (
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
"github.com/filecoin-project/lotus/storage"
|
||||
"github.com/filecoin-project/lotus/storage/sealing"
|
||||
"github.com/filecoin-project/sector-storage"
|
||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
||||
"github.com/filecoin-project/sector-storage/stores"
|
||||
)
|
||||
|
||||
func minerAddrFromDS(ds dtypes.MetadataDS) (address.Address, error) {
|
||||
@@ -281,21 +281,18 @@ func SetupBlockProducer(lc fx.Lifecycle, ds dtypes.MetadataDS, api lapi.FullNode
|
||||
}
|
||||
|
||||
func SealTicketGen(fapi lapi.FullNode) sealing.TicketFn {
|
||||
return func(ctx context.Context) (*lapi.SealTicket, error) {
|
||||
return func(ctx context.Context) (abi.SealRandomness, abi.ChainEpoch, error) {
|
||||
ts, err := fapi.ChainHead(ctx)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("getting head ts for SealTicket failed: %w", err)
|
||||
return nil, 0, xerrors.Errorf("getting head ts for SealTicket failed: %w", err)
|
||||
}
|
||||
|
||||
r, err := fapi.ChainGetRandomness(ctx, ts.Key(), crypto.DomainSeparationTag_SealRandomness, ts.Height()-build.SealRandomnessLookback, nil)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("getting randomness for SealTicket failed: %w", err)
|
||||
return nil, 0, xerrors.Errorf("getting randomness for SealTicket failed: %w", err)
|
||||
}
|
||||
|
||||
return &lapi.SealTicket{
|
||||
Epoch: ts.Height() - build.SealRandomnessLookback,
|
||||
Value: abi.SealRandomness(r),
|
||||
}, nil
|
||||
return abi.SealRandomness(r), ts.Height() - build.SealRandomnessLookback, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user