Skip to content

Commit 22b6613

Browse files
committed
fix ingest, market tasks
1 parent 8e5ea50 commit 22b6613

File tree

11 files changed

+57
-47
lines changed

11 files changed

+57
-47
lines changed

Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ build/.update-modules:
5050
# end git modules
5151

5252
## CUDA Library Path
53-
CUDA_PATH := $(shell dirname $$(dirname $$(which nvcc)))
54-
CUDA_LIB_PATH := $(CUDA_PATH)/lib64
55-
LIBRARY_PATH ?= $(CUDA_LIB_PATH)
56-
export LIBRARY_PATH
53+
setup_cuda:
54+
$(eval CUDA_PATH := $(shell dirname $$(dirname $$(which nvcc))))
55+
$(eval CUDA_LIB_PATH := $(CUDA_PATH)/lib64)
56+
export LIBRARY_PATH=$(CUDA_LIB_PATH)
57+
.PHONY: setup_cuda
5758

5859
## MAIN BINARIES
5960

@@ -81,9 +82,9 @@ BINS+=sptool
8182

8283
ifeq ($(shell uname),Linux)
8384

84-
batchdep: build/.supraseal-install
85+
batchdep: setup_cuda build/.supraseal-install
8586
batchdep: $(BUILD_DEPS)
86-
,PHONY: batchdep
87+
.PHONY: batchdep
8788

8889
batch: GOFLAGS+=-tags=supraseal
8990
batch: CGO_LDFLAGS_ALLOW='.*'

deps/config/doc_gen.go

Lines changed: 11 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

documentation/en/configuration/default-curio-configuration.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -217,24 +217,20 @@ description: The default curio configuration
217217
# type: int
218218
#SyntheticPoRepMaxTasks = 0
219219

220-
<<<<<<< HEAD
221-
<<<<<<< HEAD
222220
# Batch Seal
223221
#
224222
# type: bool
225223
#EnableBatchSeal = false
226-
=======
224+
227225
# EnableDealMarket
228226
#
229227
# type: bool
230228
#EnableDealMarket = false
231-
>>>>>>> 6d3d660 (basic mk12 scafolding)
232-
=======
229+
233230
# EnableCommP enabled the commP task on te node. CommP is calculated before sending PublishDealMessage for a Mk12 deal
234231
#
235232
# type: bool
236233
#EnableCommP = false
237-
>>>>>>> bd6e6c0 (poller redesign)
238234

239235

240236
[Fees]
@@ -416,7 +412,7 @@ description: The default curio configuration
416412
#InsertConcurrency = 8
417413

418414
[Market.StorageMarketConfig.MK12]
419-
# Miners is a list of miner to enable MK12 deals(Boost) for
415+
# Miners is a list of miner addresses to enable MK12 deals(Boost) for
420416
#
421417
# type: []string
422418
#Miners = []
@@ -425,27 +421,32 @@ description: The default curio configuration
425421
# deals to be ready to publish before publishing them all as a batch
426422
#
427423
# type: Duration
428-
#PublishMsgPeriod = "0s"
424+
#PublishMsgPeriod = "30m0s"
429425

430426
# The maximum number of deals to include in a single PublishStorageDeals
431427
# message
432428
#
433429
# type: uint64
434-
#MaxDealsPerPublishMsg = 0
430+
#MaxDealsPerPublishMsg = 8
435431

436432
# The maximum collateral that the provider will put up against a deal,
437433
# as a multiplier of the minimum collateral bound
438434
# The maximum fee to pay when sending the PublishStorageDeals message
439435
#
440436
# type: types.FIL
441-
#MaxPublishDealsFee = "0 FIL"
437+
#MaxPublishDealsFee = "5 FIL"
438+
439+
# ExpectedPoRepSealDuration is the expected time it would take to seal the deal sector
440+
# This will be used to fail the deals which cannot be sealed on time.
441+
#
442+
# type: Duration
443+
#ExpectedPoRepSealDuration = "8h0m0s"
442444

443-
# ExpectedSealDuration is the expected time it would take to seal the deal sector
445+
# ExpectedSnapSealDuration is the expected time it would take to snap the deal sector
444446
# This will be used to fail the deals which cannot be sealed on time.
445-
# Please make sure to update this to shorter duration for snap deals
446447
#
447448
# type: Duration
448-
#ExpectedSealDuration = "0s"
449+
#ExpectedSnapSealDuration = "2h0m0s"
449450

450451
# SkipCommP can be used to skip doing a commP check before PublishDealMessage is sent on chain
451452
# Warning: If this check is skipped and there is a commP mismatch, all deals in the

lib/paths/mocks/index.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/paths/mocks/pf.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/paths/mocks/store.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

market/storageIngest/deal_ingest_seal.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import (
99
"net/url"
1010
"time"
1111

12-
"github.com/filecoin-project/curio/build"
13-
"github.com/filecoin-project/curio/deps/config"
1412
logging "github.com/ipfs/go-log/v2"
1513
"golang.org/x/xerrors"
1614

@@ -22,6 +20,8 @@ import (
2220
"github.com/filecoin-project/go-state-types/dline"
2321
"github.com/filecoin-project/go-state-types/network"
2422

23+
"github.com/filecoin-project/curio/build"
24+
"github.com/filecoin-project/curio/deps/config"
2525
"github.com/filecoin-project/curio/harmony/harmonydb"
2626
"github.com/filecoin-project/curio/tasks/seal"
2727

@@ -38,6 +38,7 @@ var log = logging.Logger("storage-ingest")
3838
type Ingester interface {
3939
AllocatePieceToSector(ctx context.Context, tx *harmonydb.Tx, maddr address.Address, piece lpiece.PieceDealInfo, rawSize int64, source url.URL, header http.Header) (api.SectorOffset, error)
4040
SectorStartSealing(ctx context.Context, maddr address.Address, sector abi.SectorNumber) error
41+
GetExpectedSealDuration() abi.ChainEpoch
4142
}
4243

4344
type PieceIngesterApi interface {
@@ -572,3 +573,7 @@ func (p *PieceIngester) getOpenSectors(tx *harmonydb.Tx, mid int64) ([]*openSect
572573

573574
return os, nil
574575
}
576+
577+
func (p *PieceIngester) GetExpectedSealDuration() abi.ChainEpoch {
578+
return p.expectedSealDuration
579+
}

market/storageIngest/deal_ingest_snap.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import (
99
"net/url"
1010
"time"
1111

12-
"github.com/filecoin-project/curio/build"
13-
"github.com/filecoin-project/curio/deps/config"
1412
"golang.org/x/xerrors"
1513

1614
"github.com/filecoin-project/go-address"
@@ -22,6 +20,8 @@ import (
2220
verifreg13 "github.com/filecoin-project/go-state-types/builtin/v13/verifreg"
2321
"github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
2422

23+
"github.com/filecoin-project/curio/build"
24+
"github.com/filecoin-project/curio/deps/config"
2525
"github.com/filecoin-project/curio/harmony/harmonydb"
2626

2727
"github.com/filecoin-project/lotus/api"
@@ -693,3 +693,7 @@ func (p *PieceIngesterSnap) getOpenSectors(tx *harmonydb.Tx, mid int64) ([]*open
693693

694694
return os, nil
695695
}
696+
697+
func (p *PieceIngesterSnap) GetExpectedSealDuration() abi.ChainEpoch {
698+
return p.expectedSnapDuration
699+
}

tasks/storage-market/task_commp.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ import (
55
"encoding/json"
66
"fmt"
77
"io"
8-
"math"
98
"net/http"
109
"net/url"
1110
"strconv"
12-
"time"
1311

1412
"github.com/ipfs/go-cid"
1513
"golang.org/x/xerrors"
@@ -20,7 +18,6 @@ import (
2018
"github.com/filecoin-project/go-padreader"
2119
"github.com/filecoin-project/go-state-types/abi"
2220

23-
"github.com/filecoin-project/curio/build"
2421
"github.com/filecoin-project/curio/deps/config"
2522
"github.com/filecoin-project/curio/harmony/harmonydb"
2623
"github.com/filecoin-project/curio/harmony/harmonytask"
@@ -73,7 +70,7 @@ func (c *CommpTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done
7370
}
7471
piece := pieces[0]
7572

76-
expired, err := checkExpiry(ctx, c.db, c.api, piece.UUID, c.cfg.ExpectedSealDuration)
73+
expired, err := checkExpiry(ctx, c.db, c.api, piece.UUID, c.sm.pin.GetExpectedSealDuration())
7774
if err != nil {
7875
return false, xerrors.Errorf("deal %s expired: %w", piece.UUID, err)
7976
}
@@ -316,7 +313,7 @@ type headAPI interface {
316313
ChainHead(context.Context) (*types.TipSet, error)
317314
}
318315

319-
func checkExpiry(ctx context.Context, db *harmonydb.DB, api headAPI, deal string, buffer config.Duration) (bool, error) {
316+
func checkExpiry(ctx context.Context, db *harmonydb.DB, api headAPI, deal string, sealDuration abi.ChainEpoch) (bool, error) {
320317
var starts []struct {
321318
StartEpoch int64 `db:"start_epoch"`
322319
}
@@ -333,9 +330,7 @@ func checkExpiry(ctx context.Context, db *harmonydb.DB, api headAPI, deal string
333330
return false, err
334331
}
335332

336-
buff := int64(math.Floor(time.Duration(buffer).Seconds() / float64(build.BlockDelaySecs)))
337-
338-
if head.Height()+abi.ChainEpoch(buff) > startEPoch {
333+
if head.Height()+sealDuration > startEPoch {
339334
err = failDeal(ctx, db, deal, true, fmt.Sprintf("deal proposal must be proven on chain by deal proposal start epoch %d, but it has expired: current chain height: %d",
340335
startEPoch, head.Height()))
341336
return true, err

tasks/storage-market/task_find_deal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (f *FindDealTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (do
8888
}
8989
bd := bdeals[0]
9090

91-
expired, err := checkExpiry(ctx, f.db, f.api, bd.UUID, f.cfg.ExpectedSealDuration)
91+
expired, err := checkExpiry(ctx, f.db, f.api, bd.UUID, f.sm.pin.GetExpectedSealDuration())
9292
if err != nil {
9393
return false, xerrors.Errorf("deal %s expired: %w", bd.UUID, err)
9494
}

0 commit comments

Comments
 (0)