Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sealing: Partially sealed sector import #9210

Merged
merged 28 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
29135aa
sector import: Initial api scaffolding
magik6k Aug 24, 2022
5c485c3
sealing: Drop redundant Piece type
magik6k Aug 26, 2022
332d83b
sector import: Check pieces in Sealing.Receive
magik6k Aug 26, 2022
ca790b4
sealing: Validate piece alignment in checkPieces
magik6k Aug 26, 2022
2318419
sector import: Fix missing perm tag on SectorReceive
magik6k Aug 26, 2022
2b64452
sector import: More check progress
magik6k Aug 30, 2022
39e4845
sector import: Put the imported sector into the sealing pipeline
magik6k Aug 31, 2022
fbb487a
sector import: Plumbing for DownloadSectorData in the sealing system
magik6k Aug 31, 2022
ea99bd9
sector import: Sector data download
magik6k Aug 31, 2022
cde23be
sector import: Fix tests
magik6k Sep 2, 2022
cdadf5e
sector import: Implement handleReceiveSector
magik6k Sep 2, 2022
3caa010
sector import: Update type-gen
magik6k Sep 2, 2022
fef7232
sector import: Initial SectorReceive itest
magik6k Sep 5, 2022
12a8ab5
sector import: Add missing initial fsm state transition
magik6k Sep 6, 2022
9c6d531
sector import: Plumb sector download task canfig
magik6k Sep 6, 2022
3086e8a
sector import: Seal with the correct proof type in saas itest
magik6k Sep 6, 2022
830c2ff
sector import: FinalizeInto, send finalized cacde in itest
magik6k Sep 6, 2022
9f03569
sector import: Remote Commit1
magik6k Sep 9, 2022
b2dfaae
sector import: Test remote commit1 retry
magik6k Sep 9, 2022
1428948
sector import: Implement seed/ticket/commr/commd checks
magik6k Sep 9, 2022
c17ab76
sector import: Remote Commit2
magik6k Sep 9, 2022
474c602
tarutil: Strict header checks
magik6k Sep 9, 2022
ef834b9
sector import: Fix test build
magik6k Sep 9, 2022
061a990
sector import: RemoteSealingDoneEndpoint
magik6k Sep 9, 2022
fec9c0f
sector import: Fix lint
magik6k Sep 9, 2022
a05593d
systar: Create file after header checks
magik6k Sep 14, 2022
859c260
sealing: Address review
magik6k Sep 16, 2022
015139d
sealing pipeline: Clarify maybeNotifyRemoteDone
magik6k Sep 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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?
magik6k marked this conversation as resolved.
Show resolved Hide resolved

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


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
Comment on lines +602 to +603
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

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