Skip to content

Commit

Permalink
Merge pull request #9210 from filecoin-project/feat/recievesector
Browse files Browse the repository at this point in the history
feat: sealing: Partially sealed sector import
  • Loading branch information
magik6k authored Sep 19, 2022
2 parents 4abc38d + 015139d commit 4cdeb6c
Show file tree
Hide file tree
Showing 57 changed files with 2,951 additions and 286 deletions.
10 changes: 10 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,16 @@ workflows:
suite: itest-sector_finalize_early
target: "./itests/sector_finalize_early_test.go"

- test:
name: test-itest-sector_import_full
suite: itest-sector_import_full
target: "./itests/sector_import_full_test.go"

- test:
name: test-itest-sector_import_simple
suite: itest-sector_import_simple
target: "./itests/sector_import_simple_test.go"

- test:
name: test-itest-sector_make_cc_avail
suite: itest-sector_make_cc_avail
Expand Down
110 changes: 110 additions & 0 deletions api/api_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-jsonrpc/auth"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/builtin/v8/market"
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
abinetwork "github.com/filecoin-project/go-state-types/network"
Expand Down Expand Up @@ -144,6 +145,8 @@ type StorageMiner interface {
// SectorNumFree drops a sector reservation
SectorNumFree(ctx context.Context, name string) error //perm:admin

SectorReceive(ctx context.Context, meta RemoteSectorMeta) error //perm:admin

// WorkerConnect tells the node to connect to workers RPC
WorkerConnect(context.Context, string) error //perm:admin retry:true
WorkerStats(context.Context) (map[uuid.UUID]storiface.WorkerStats, error) //perm:admin
Expand All @@ -166,6 +169,7 @@ type StorageMiner interface {
ReturnMoveStorage(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
ReturnUnsealPiece(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
ReturnReadPiece(ctx context.Context, callID storiface.CallID, ok bool, err *storiface.CallError) error //perm:admin retry:true
ReturnDownloadSector(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
ReturnFetch(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true

// SealingSchedDiag dumps internal sealing scheduler state
Expand Down Expand Up @@ -504,3 +508,109 @@ type NumAssignerMeta struct {

Next abi.SectorNumber
}

type RemoteSectorMeta struct {
////////
// BASIC SECTOR INFORMATION

// State specifies the first state the sector will enter after being imported
// Must be one of the following states:
// * Packing
// * GetTicket
// * PreCommitting
// * SubmitCommit
// * Proving/Available
State SectorState

Sector abi.SectorID
Type abi.RegisteredSealProof

////////
// SEALING METADATA
// (allows lotus to continue the sealing process)

// Required in Packing and later
Pieces []SectorPiece // todo better type?

// Required in PreCommitting and later
TicketValue abi.SealRandomness
TicketEpoch abi.ChainEpoch
PreCommit1Out storiface.PreCommit1Out // todo specify better

CommD *cid.Cid
CommR *cid.Cid // SectorKey

// Required in SubmitCommit and later
PreCommitInfo *miner.SectorPreCommitInfo
PreCommitDeposit *big.Int
PreCommitMessage *cid.Cid
PreCommitTipSet types.TipSetKey

SeedValue abi.InteractiveSealRandomness
SeedEpoch abi.ChainEpoch

CommitProof []byte

// Required in Proving/Available
CommitMessage *cid.Cid

// Optional sector metadata to import
Log []SectorLog

////////
// SECTOR DATA SOURCE

// Sector urls - lotus will use those for fetching files into local storage

// Required in all states
DataUnsealed *storiface.SectorLocation

// Required in PreCommitting and later
DataSealed *storiface.SectorLocation
DataCache *storiface.SectorLocation

////////
// SEALING SERVICE HOOKS

// URL
// RemoteCommit1Endpoint is an URL of POST endpoint which lotus will call requesting Commit1 (seal_commit_phase1)
// request body will be json-serialized RemoteCommit1Params struct
RemoteCommit1Endpoint string

// RemoteCommit2Endpoint is an URL of POST endpoint which lotus will call requesting Commit2 (seal_commit_phase2)
// request body will be json-serialized RemoteCommit2Params struct
RemoteCommit2Endpoint string

// RemoteSealingDoneEndpoint is called after the sector exists the sealing pipeline
// request body will be json-serialized RemoteSealingDoneParams struct
RemoteSealingDoneEndpoint string
}

type RemoteCommit1Params struct {
Ticket, Seed []byte

Unsealed cid.Cid
Sealed cid.Cid

ProofType abi.RegisteredSealProof
}

type RemoteCommit2Params struct {
Sector abi.SectorID
ProofType abi.RegisteredSealProof

// todo spec better
Commit1Out storiface.Commit1Out
}

type RemoteSealingDoneParams struct {
// Successful is true if the sector has entered state considered as "successfully sealed"
Successful bool

// State is the state the sector has entered
// For example "Proving" / "Removing"
State string

// Optional commit message CID
CommitMessage *cid.Cid
}
1 change: 1 addition & 0 deletions api/api_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type Worker interface {
MoveStorage(ctx context.Context, sector storiface.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) //perm:admin
UnsealPiece(context.Context, storiface.SectorRef, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (storiface.CallID, error) //perm:admin
Fetch(context.Context, storiface.SectorRef, storiface.SectorFileType, storiface.PathType, storiface.AcquireMode) (storiface.CallID, error) //perm:admin
DownloadSectorData(ctx context.Context, sector storiface.SectorRef, finalized bool, src map[storiface.SectorFileType]storiface.SectorLocation) (storiface.CallID, error) //perm:admin

GenerateWinningPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []storiface.PostSectorChallenge, randomness abi.PoStRandomness) ([]proof.PoStProof, error) //perm:admin
GenerateWindowPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []storiface.PostSectorChallenge, partitionIdx int, randomness abi.PoStRandomness) (storiface.WindowPoStResult, error) //perm:admin
Expand Down
123 changes: 123 additions & 0 deletions api/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions api/docgen/docgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"go/ast"
"go/parser"
"go/token"
"net/http"
"path/filepath"
"reflect"
"strings"
Expand Down Expand Up @@ -340,6 +341,17 @@ func init() {
"": bitfield.NewFromSet([]uint64{5, 6, 7, 10}),
})

addExample(http.Header{
"Authorization": []string{"Bearer ey.."},
})

addExample(map[storiface.SectorFileType]storiface.SectorLocation{
storiface.FTSealed: {
Local: false,
URL: "https://example.com/sealingservice/sectors/s-f0123-12345",
Headers: nil,
},
})
}

func GetAPIType(name, pkg string) (i interface{}, t reflect.Type, permStruct []reflect.Type) {
Expand Down
39 changes: 39 additions & 0 deletions api/proxy_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified build/openrpc/full.json.gz
Binary file not shown.
Binary file modified build/openrpc/gateway.json.gz
Binary file not shown.
Binary file modified build/openrpc/miner.json.gz
Binary file not shown.
Binary file modified build/openrpc/worker.json.gz
Binary file not shown.
Loading

0 comments on commit 4cdeb6c

Please sign in to comment.