Skip to content

Commit e3deda0

Browse files
cleanup: miner: remove markets and deal-making from Lotus Miner (#12005)
* remove client CLI * remove markets CLI from miner * remove markets from all CLI * remove client API * update go mod * remove EnableMarkets flag * remove market subsystem * remove dagstore * remove index provider * remove graphsync and data-transfer * remove markets * go mod tidy * fix cbor gen deps * remove deal making from config * remove eol alert * go mod tidy * changes as per review * make jen * changes as per review * merge master * remove libp2p from config * miner does not have libp2p conn in api test
1 parent 469960c commit e3deda0

File tree

86 files changed

+1512
-16426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1512
-16426
lines changed

.github/workflows/check.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ jobs:
4444
- uses: ./.github/actions/install-go
4545
- run: make deps lotus
4646
- run: go install golang.org/x/tools/cmd/goimports
47-
- run: go install github.com/hannahhoward/cbor-gen-for
4847
- run: make gen
4948
- run: git diff --exit-code
5049
- run: make docsgen-cli

api/api_full.go

Lines changed: 0 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ import (
1212

1313
"github.com/filecoin-project/go-address"
1414
"github.com/filecoin-project/go-bitfield"
15-
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
16-
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
17-
"github.com/filecoin-project/go-fil-markets/storagemarket"
1815
"github.com/filecoin-project/go-jsonrpc"
1916
"github.com/filecoin-project/go-state-types/abi"
2017
"github.com/filecoin-project/go-state-types/big"
@@ -33,7 +30,6 @@ import (
3330
"github.com/filecoin-project/lotus/chain/types"
3431
"github.com/filecoin-project/lotus/chain/types/ethtypes"
3532
"github.com/filecoin-project/lotus/node/modules/dtypes"
36-
"github.com/filecoin-project/lotus/node/repo/imports"
3733
)
3834

3935
//go:generate go run github.com/golang/mock/mockgen -destination=mocks/mock_full.go -package=mocks . FullNode
@@ -869,17 +865,6 @@ type EthSubscriber interface {
869865
EthSubscription(ctx context.Context, r jsonrpc.RawParams) error // rpc_method:eth_subscription notify:true
870866
}
871867

872-
type StorageAsk struct {
873-
Response *storagemarket.StorageAsk
874-
875-
DealProtocols []string
876-
}
877-
878-
type FileRef struct {
879-
Path string
880-
IsCAR bool
881-
}
882-
883868
type MinerSectors struct {
884869
// Live sectors that should be proven.
885870
Live uint64
@@ -889,55 +874,6 @@ type MinerSectors struct {
889874
Faulty uint64
890875
}
891876

892-
type ImportRes struct {
893-
Root cid.Cid
894-
ImportID imports.ID
895-
}
896-
897-
type Import struct {
898-
Key imports.ID
899-
Err string
900-
901-
Root *cid.Cid
902-
903-
// Source is the provenance of the import, e.g. "import", "unknown", else.
904-
// Currently useless but may be used in the future.
905-
Source string
906-
907-
// FilePath is the path of the original file. It is important that the file
908-
// is retained at this path, because it will be referenced during
909-
// the transfer (when we do the UnixFS chunking, we don't duplicate the
910-
// leaves, but rather point to chunks of the original data through
911-
// positional references).
912-
FilePath string
913-
914-
// CARPath is the path of the CAR file containing the DAG for this import.
915-
CARPath string
916-
}
917-
918-
type DealInfo struct {
919-
ProposalCid cid.Cid
920-
State storagemarket.StorageDealStatus
921-
Message string // more information about deal state, particularly errors
922-
DealStages *storagemarket.DealStages
923-
Provider address.Address
924-
925-
DataRef *storagemarket.DataRef
926-
PieceCID cid.Cid
927-
Size uint64
928-
929-
PricePerEpoch types.BigInt
930-
Duration uint64
931-
932-
DealID abi.DealID
933-
934-
CreationTime time.Time
935-
Verified bool
936-
937-
TransferChannelID *datatransfer.ChannelID
938-
DataTransfer *DataTransferChannel
939-
}
940-
941877
type MsgLookup struct {
942878
Message cid.Cid // Can be different than requested, in case it was replaced, but only gas values changed
943879
Receipt types.MessageReceipt
@@ -1059,38 +995,6 @@ type MinerPower struct {
1059995
HasMinPower bool
1060996
}
1061997

1062-
type QueryOffer struct {
1063-
Err string
1064-
1065-
Root cid.Cid
1066-
Piece *cid.Cid
1067-
1068-
Size uint64
1069-
MinPrice types.BigInt
1070-
UnsealPrice types.BigInt
1071-
PricePerByte abi.TokenAmount
1072-
PaymentInterval uint64
1073-
PaymentIntervalIncrease uint64
1074-
Miner address.Address
1075-
MinerPeer retrievalmarket.RetrievalPeer
1076-
}
1077-
1078-
func (o *QueryOffer) Order(client address.Address) RetrievalOrder {
1079-
return RetrievalOrder{
1080-
Root: o.Root,
1081-
Piece: o.Piece,
1082-
Size: o.Size,
1083-
Total: o.MinPrice,
1084-
UnsealPrice: o.UnsealPrice,
1085-
PaymentInterval: o.PaymentInterval,
1086-
PaymentIntervalIncrease: o.PaymentIntervalIncrease,
1087-
Client: client,
1088-
1089-
Miner: o.Miner,
1090-
MinerPeer: &o.MinerPeer,
1091-
}
1092-
}
1093-
1094998
type MarketBalance struct {
1095999
Escrow big.Int
10961000
Locked big.Int
@@ -1145,25 +1049,6 @@ type MarketDeal struct {
11451049
State MarketDealState
11461050
}
11471051

1148-
type RetrievalOrder struct {
1149-
Root cid.Cid
1150-
Piece *cid.Cid
1151-
DataSelector *Selector
1152-
1153-
// todo: Size/Total are only used for calculating price per byte; we should let users just pass that
1154-
Size uint64
1155-
Total types.BigInt
1156-
1157-
UnsealPrice types.BigInt
1158-
PaymentInterval uint64
1159-
PaymentIntervalIncrease uint64
1160-
Client address.Address
1161-
Miner address.Address
1162-
MinerPeer *retrievalmarket.RetrievalPeer
1163-
1164-
RemoteStore *RemoteStoreID `json:"RemoteStore,omitempty"`
1165-
}
1166-
11671052
type RemoteStoreID = uuid.UUID
11681053

11691054
type InvocResult struct {
@@ -1181,34 +1066,6 @@ type MethodCall struct {
11811066
Error string
11821067
}
11831068

1184-
type StartDealParams struct {
1185-
Data *storagemarket.DataRef
1186-
Wallet address.Address
1187-
Miner address.Address
1188-
EpochPrice types.BigInt
1189-
MinBlocksDuration uint64
1190-
ProviderCollateral big.Int
1191-
DealStartEpoch abi.ChainEpoch
1192-
FastRetrieval bool
1193-
VerifiedDeal bool
1194-
}
1195-
1196-
func (s *StartDealParams) UnmarshalJSON(raw []byte) (err error) {
1197-
type sdpAlias StartDealParams
1198-
1199-
sdp := sdpAlias{
1200-
FastRetrieval: true,
1201-
}
1202-
1203-
if err := json.Unmarshal(raw, &sdp); err != nil {
1204-
return err
1205-
}
1206-
1207-
*s = StartDealParams(sdp)
1208-
1209-
return nil
1210-
}
1211-
12121069
type IpldObject struct {
12131070
Cid cid.Cid
12141071
Obj interface{}

api/api_storage.go

Lines changed: 1 addition & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,9 @@ import (
77

88
"github.com/google/uuid"
99
"github.com/ipfs/go-cid"
10-
"github.com/libp2p/go-libp2p/core/peer"
1110

1211
"github.com/filecoin-project/go-address"
1312
"github.com/filecoin-project/go-bitfield"
14-
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
15-
"github.com/filecoin-project/go-fil-markets/piecestore"
16-
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
17-
"github.com/filecoin-project/go-fil-markets/storagemarket"
1813
"github.com/filecoin-project/go-jsonrpc/auth"
1914
"github.com/filecoin-project/go-state-types/abi"
2015
"github.com/filecoin-project/go-state-types/big"
@@ -215,110 +210,12 @@ type StorageMiner interface {
215210
StorageDetachLocal(ctx context.Context, path string) error //perm:admin
216211
StorageRedeclareLocal(ctx context.Context, id *storiface.ID, dropMissing bool) error //perm:admin
217212

218-
MarketImportDealData(ctx context.Context, propcid cid.Cid, path string) error //perm:write
219-
MarketListDeals(ctx context.Context) ([]*MarketDeal, error) //perm:read
220-
221-
// MarketListRetrievalDeals is deprecated, returns empty list
222-
MarketListRetrievalDeals(ctx context.Context) ([]struct{}, error) //perm:read
223-
MarketGetDealUpdates(ctx context.Context) (<-chan storagemarket.MinerDeal, error) //perm:read
224-
MarketListIncompleteDeals(ctx context.Context) ([]storagemarket.MinerDeal, error) //perm:read
225-
MarketSetAsk(ctx context.Context, price types.BigInt, verifiedPrice types.BigInt, duration abi.ChainEpoch, minPieceSize abi.PaddedPieceSize, maxPieceSize abi.PaddedPieceSize) error //perm:admin
226-
MarketGetAsk(ctx context.Context) (*storagemarket.SignedStorageAsk, error) //perm:read
227-
MarketSetRetrievalAsk(ctx context.Context, rask *retrievalmarket.Ask) error //perm:admin
228-
MarketGetRetrievalAsk(ctx context.Context) (*retrievalmarket.Ask, error) //perm:read
229-
MarketListDataTransfers(ctx context.Context) ([]DataTransferChannel, error) //perm:write
230-
MarketDataTransferUpdates(ctx context.Context) (<-chan DataTransferChannel, error) //perm:write
231-
// MarketDataTransferDiagnostics generates debugging information about current data transfers over graphsync
232-
MarketDataTransferDiagnostics(ctx context.Context, p peer.ID) (*TransferDiagnostics, error) //perm:write
233-
// MarketRestartDataTransfer attempts to restart a data transfer with the given transfer ID and other peer
234-
MarketRestartDataTransfer(ctx context.Context, transferID datatransfer.TransferID, otherPeer peer.ID, isInitiator bool) error //perm:write
235-
// MarketCancelDataTransfer cancels a data transfer with the given transfer ID and other peer
236-
MarketCancelDataTransfer(ctx context.Context, transferID datatransfer.TransferID, otherPeer peer.ID, isInitiator bool) error //perm:write
237-
MarketPendingDeals(ctx context.Context) (PendingDealInfo, error) //perm:write
238-
MarketPublishPendingDeals(ctx context.Context) error //perm:admin
239-
MarketRetryPublishDeal(ctx context.Context, propcid cid.Cid) error //perm:admin
240-
241-
// DagstoreListShards returns information about all shards known to the
242-
// DAG store. Only available on nodes running the markets subsystem.
243-
DagstoreListShards(ctx context.Context) ([]DagstoreShardInfo, error) //perm:read
244-
245-
// DagstoreInitializeShard initializes an uninitialized shard.
246-
//
247-
// Initialization consists of fetching the shard's data (deal payload) from
248-
// the storage subsystem, generating an index, and persisting the index
249-
// to facilitate later retrievals, and/or to publish to external sources.
250-
//
251-
// This operation is intended to complement the initial migration. The
252-
// migration registers a shard for every unique piece CID, with lazy
253-
// initialization. Thus, shards are not initialized immediately to avoid
254-
// IO activity competing with proving. Instead, shard are initialized
255-
// when first accessed. This method forces the initialization of a shard by
256-
// accessing it and immediately releasing it. This is useful to warm up the
257-
// cache to facilitate subsequent retrievals, and to generate the indexes
258-
// to publish them externally.
259-
//
260-
// This operation fails if the shard is not in ShardStateNew state.
261-
// It blocks until initialization finishes.
262-
DagstoreInitializeShard(ctx context.Context, key string) error //perm:write
263-
264-
// DagstoreRecoverShard attempts to recover a failed shard.
265-
//
266-
// This operation fails if the shard is not in ShardStateErrored state.
267-
// It blocks until recovery finishes. If recovery failed, it returns the
268-
// error.
269-
DagstoreRecoverShard(ctx context.Context, key string) error //perm:write
270-
271-
// DagstoreInitializeAll initializes all uninitialized shards in bulk,
272-
// according to the policy passed in the parameters.
273-
//
274-
// It is recommended to set a maximum concurrency to avoid extreme
275-
// IO pressure if the storage subsystem has a large amount of deals.
276-
//
277-
// It returns a stream of events to report progress.
278-
DagstoreInitializeAll(ctx context.Context, params DagstoreInitializeAllParams) (<-chan DagstoreInitializeAllEvent, error) //perm:write
279-
280-
// DagstoreGC runs garbage collection on the DAG store.
281-
DagstoreGC(ctx context.Context) ([]DagstoreShardResult, error) //perm:admin
282-
283-
// DagstoreRegisterShard registers a shard manually with dagstore with given pieceCID
284-
DagstoreRegisterShard(ctx context.Context, key string) error //perm:admin
285-
286-
// IndexerAnnounceDeal informs indexer nodes that a new deal was received,
287-
// so they can download its index
288-
IndexerAnnounceDeal(ctx context.Context, proposalCid cid.Cid) error //perm:admin
289-
290-
// IndexerAnnounceAllDeals informs the indexer nodes aboutall active deals.
291-
IndexerAnnounceAllDeals(ctx context.Context) error //perm:admin
292-
293-
// DagstoreLookupPieces returns information about shards that contain the given CID.
294-
DagstoreLookupPieces(ctx context.Context, cid cid.Cid) ([]DagstoreShardInfo, error) //perm:admin
213+
MarketListDeals(ctx context.Context) ([]*MarketDeal, error) //perm:read
295214

296215
// RuntimeSubsystems returns the subsystems that are enabled
297216
// in this instance.
298217
RuntimeSubsystems(ctx context.Context) (MinerSubsystems, error) //perm:read
299218

300-
DealsImportData(ctx context.Context, dealPropCid cid.Cid, file string) error //perm:admin
301-
DealsList(ctx context.Context) ([]*MarketDeal, error) //perm:admin
302-
DealsConsiderOnlineStorageDeals(context.Context) (bool, error) //perm:admin
303-
DealsSetConsiderOnlineStorageDeals(context.Context, bool) error //perm:admin
304-
DealsConsiderOnlineRetrievalDeals(context.Context) (bool, error) //perm:admin
305-
DealsSetConsiderOnlineRetrievalDeals(context.Context, bool) error //perm:admin
306-
DealsPieceCidBlocklist(context.Context) ([]cid.Cid, error) //perm:admin
307-
DealsSetPieceCidBlocklist(context.Context, []cid.Cid) error //perm:admin
308-
DealsConsiderOfflineStorageDeals(context.Context) (bool, error) //perm:admin
309-
DealsSetConsiderOfflineStorageDeals(context.Context, bool) error //perm:admin
310-
DealsConsiderOfflineRetrievalDeals(context.Context) (bool, error) //perm:admin
311-
DealsSetConsiderOfflineRetrievalDeals(context.Context, bool) error //perm:admin
312-
DealsConsiderVerifiedStorageDeals(context.Context) (bool, error) //perm:admin
313-
DealsSetConsiderVerifiedStorageDeals(context.Context, bool) error //perm:admin
314-
DealsConsiderUnverifiedStorageDeals(context.Context) (bool, error) //perm:admin
315-
DealsSetConsiderUnverifiedStorageDeals(context.Context, bool) error //perm:admin
316-
317-
PiecesListPieces(ctx context.Context) ([]cid.Cid, error) //perm:read
318-
PiecesListCidInfos(ctx context.Context) ([]cid.Cid, error) //perm:read
319-
PiecesGetPieceInfo(ctx context.Context, pieceCid cid.Cid) (*piecestore.PieceInfo, error) //perm:read
320-
PiecesGetCIDInfo(ctx context.Context, payloadCid cid.Cid) (*piecestore.CIDInfo, error) //perm:read
321-
322219
// CreateBackup creates node backup onder the specified file name. The
323220
// method requires that the lotus-miner is running with the
324221
// LOTUS_BACKUP_BASE_PATH environment variable set to some path, and that
@@ -471,37 +368,6 @@ type SectorOffset struct {
471368
Offset abi.PaddedPieceSize
472369
}
473370

474-
// DagstoreShardInfo is the serialized form of dagstore.DagstoreShardInfo that
475-
// we expose through JSON-RPC to avoid clients having to depend on the
476-
// dagstore lib.
477-
type DagstoreShardInfo struct {
478-
Key string
479-
State string
480-
Error string
481-
}
482-
483-
// DagstoreShardResult enumerates results per shard.
484-
type DagstoreShardResult struct {
485-
Key string
486-
Success bool
487-
Error string
488-
}
489-
490-
type DagstoreInitializeAllParams struct {
491-
MaxConcurrency int
492-
IncludeSealed bool
493-
}
494-
495-
// DagstoreInitializeAllEvent represents an initialization event.
496-
type DagstoreInitializeAllEvent struct {
497-
Key string
498-
Event string // "start", "end"
499-
Success bool
500-
Error string
501-
Total int
502-
Current int
503-
}
504-
505371
type NumAssignerMeta struct {
506372
Reserved bitfield.BitField
507373
Allocated bitfield.BitField

0 commit comments

Comments
 (0)