Skip to content

Commit eec2c07

Browse files
authored
feat: make Boost curio compliant (#1918)
* make curio compliant * make gen * fix test * dynamic curio switching * fix test * fix harness restart test * fix ddp curio config * rollback FFI version * add Curio indicator
1 parent 4e7692d commit eec2c07

35 files changed

+413
-123
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ orbs:
66
executors:
77
golang:
88
docker:
9-
- image: cimg/go:1.21.7
9+
- image: cimg/go:1.22.3
1010
resource_class: 2xlarge
1111
ubuntu:
1212
docker:
@@ -154,7 +154,7 @@ jobs:
154154
linux: false
155155
darwin: true
156156
- golang/install:
157-
version: "1.21.7"
157+
version: "1.22.3"
158158
- run:
159159
name: Install pkg-config
160160
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config

.github/workflows/container-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
contents: read
1717
packages: write
1818
env:
19-
LOTUS_VERSION: 'v1.26.1'
19+
LOTUS_VERSION: 'v1.27.0'
2020
LOTUS_SOURCE_IMAGE: 'ghcr.io/filecoin-shipyard/lotus-containers:lotus'
2121
NETWORK_NAME: 'devnet'
2222
FFI_BUILD_FROM_SOURCE: '0'

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ docsgen-openrpc-boost: docsgen-openrpc-bin
217217

218218
## DOCKER IMAGES
219219
docker_user?=filecoin
220-
lotus_version?=v1.26.1
220+
lotus_version?=v1.27.0
221221
ffi_from_source?=0
222222
build_lotus?=0
223223
build_boost?=1
224-
boost_version?=v2.2.0-rc1
224+
boost_version?=v2.3.0-rc2
225225
ifeq ($(build_boost),1)
226226
#v1: build boost images currently checked out branch
227227
boost_build_cmd=docker/boost

cmd/boostd/init.go

Lines changed: 34 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ var initCmd = &cli.Command{
8787
}
8888

8989
rcfg.ConfigVersion = config.CurrentVersion
90-
cerr = setMinerApiConfig(cctx, rcfg, true)
90+
cerr = setMinerApiConfig(cctx, rcfg)
9191
if cerr != nil {
9292
return
9393
}
@@ -118,9 +118,14 @@ var initCmd = &cli.Command{
118118
return fmt.Errorf("writing config file %s: %w", string(newCfg), err)
119119
}
120120

121+
miner, err := address.NewFromString(curCfg.Wallets.Miner)
122+
if err != nil {
123+
return fmt.Errorf("converting miner address: %w", err)
124+
}
125+
121126
// Add the miner address to the metadata datastore
122-
fmt.Printf("Adding miner address %s to datastore\n", bp.minerActor)
123-
err = addMinerAddressToDatastore(ds, bp.minerActor)
127+
fmt.Printf("Adding miner address %s to datastore\n", miner)
128+
err = addMinerAddressToDatastore(ds, miner)
124129
if err != nil {
125130
return err
126131
}
@@ -140,10 +145,9 @@ var initCmd = &cli.Command{
140145
}
141146

142147
type boostParams struct {
143-
repo *lotus_repo.FsRepo
144-
minerActor address.Address
145-
walletPSD address.Address
146-
walletCP address.Address
148+
repo *lotus_repo.FsRepo
149+
walletPSD address.Address
150+
walletCP address.Address
147151
}
148152

149153
func initBoost(ctx context.Context, cctx *cli.Context, marketsRepo lotus_repo.LockedRepo) (*boostParams, error) {
@@ -177,36 +181,6 @@ func initBoost(ctx context.Context, cctx *cli.Context, marketsRepo lotus_repo.Lo
177181
}
178182
defer closer()
179183

180-
var minerActor address.Address
181-
if marketsRepo == nil {
182-
// If this is not a migration from an existing repo, just query the
183-
// miner directly for the actor address
184-
smApi, smCloser, err := lcli.GetStorageMinerAPI(cctx)
185-
if err != nil {
186-
if strings.Contains(err.Error(), "could not get API info") {
187-
err = fmt.Errorf("%w\nDo you need to set the environment variable MINER_API_INFO?", err)
188-
}
189-
return nil, err
190-
}
191-
defer smCloser()
192-
193-
minerActor, err = smApi.ActorAddress(ctx)
194-
if err != nil {
195-
return nil, fmt.Errorf("getting miner actor address: %w", err)
196-
}
197-
} else {
198-
// This is a migration from an existing repo, so get the miner address
199-
// from the repo datastore
200-
ds, err := marketsRepo.Datastore(context.Background(), metadataNamespace)
201-
if err != nil {
202-
return nil, fmt.Errorf("getting legacy repo datastore: %w", err)
203-
}
204-
minerActor, err = getMinerAddressFromDatastore(ds)
205-
if err != nil {
206-
return nil, fmt.Errorf("getting miner actor address: %w", err)
207-
}
208-
}
209-
210184
fmt.Println("Checking full node sync status")
211185

212186
if err := lcli.SyncWait(ctx, &v0api.WrapperV1Full{FullNode: api}, false); err != nil {
@@ -248,56 +222,46 @@ func initBoost(ctx context.Context, cctx *cli.Context, marketsRepo lotus_repo.Lo
248222
}
249223

250224
return &boostParams{
251-
repo: r,
252-
minerActor: minerActor,
253-
walletPSD: walletPSD,
254-
walletCP: walletCP,
225+
repo: r,
226+
walletPSD: walletPSD,
227+
walletCP: walletCP,
255228
}, nil
256229
}
257230

258-
func setMinerApiConfig(cctx *cli.Context, rcfg *config.Boost, dialCheck bool) error {
231+
func setMinerApiConfig(cctx *cli.Context, rcfg *config.Boost) error {
259232
ctx := cctx.Context
260-
asi, err := checkApiInfo(ctx, cctx.String("api-sector-index"), dialCheck)
233+
asi, miner1, err := checkApiInfo(ctx, cctx.String("api-sector-index"))
261234
if err != nil {
262235
return fmt.Errorf("checking sector index API: %w", err)
263236
}
264237
fmt.Printf("Sector index api info: %s\n", asi)
265238
rcfg.SectorIndexApiInfo = asi
266239

267-
ai, err := checkApiInfo(ctx, cctx.String("api-sealer"), dialCheck)
240+
ai, miner2, err := checkApiInfo(ctx, cctx.String("api-sealer"))
268241
if err != nil {
269242
return fmt.Errorf("checking sealer API: %w", err)
270243
}
271244

245+
if miner1 != miner2 {
246+
return errors.New("sector index and sealer APIs belong to different miners")
247+
}
248+
272249
fmt.Printf("Sealer api info: %s\n", ai)
250+
fmt.Printf("Miner address: %s", miner1)
273251
rcfg.SealerApiInfo = ai
252+
rcfg.Wallets.Miner = miner1
274253

275254
return nil
276255
}
277256

278257
func setCommonConfig(cctx *cli.Context, rcfg *config.Boost, bp *boostParams) {
279258
rcfg.Dealmaking.MaxStagingDealsBytes = cctx.Int64("max-staging-deals-bytes")
280-
rcfg.Wallets.Miner = bp.minerActor.String()
281259
rcfg.Wallets.DealCollateral = bp.walletCP.String()
282260
rcfg.Wallets.PublishStorageDeals = bp.walletPSD.String()
283261
}
284262

285263
var minerAddrDSKey = datastore.NewKey("miner-address")
286264

287-
func getMinerAddressFromDatastore(ds datastore.Batching) (address.Address, error) {
288-
addr, err := ds.Get(context.Background(), minerAddrDSKey)
289-
if err != nil {
290-
return address.Address{}, fmt.Errorf("getting miner address from legacy datastore: %w", err)
291-
}
292-
293-
minerAddr, err := address.NewFromBytes(addr)
294-
if err != nil {
295-
return address.Address{}, fmt.Errorf("parsing miner address from legacy datastore: %w", err)
296-
}
297-
298-
return minerAddr, nil
299-
}
300-
301265
func addMinerAddressToDatastore(ds datastore.Batching, minerActor address.Address) error {
302266
return ds.Put(context.Background(), minerAddrDSKey, minerActor.Bytes())
303267
}
@@ -328,33 +292,34 @@ func checkV1ApiSupport(ctx context.Context, cctx *cli.Context) error {
328292
return nil
329293
}
330294

331-
func checkApiInfo(ctx context.Context, ai string, dialCheck bool) (string, error) {
295+
func checkApiInfo(ctx context.Context, ai string) (string, string, error) {
332296
ai = strings.TrimPrefix(strings.TrimSpace(ai), "MINER_API_INFO=")
333297
info := cliutil.ParseApiInfo(ai)
334298
addr, err := info.DialArgs("v0")
335299
if err != nil {
336-
return "", fmt.Errorf("could not get DialArgs: %w", err)
337-
}
338-
339-
if !dialCheck {
340-
return ai, nil
300+
return "", "", fmt.Errorf("could not get DialArgs: %w", err)
341301
}
342302

343303
fmt.Printf("Checking miner api version of %s\n", addr)
344304
api, closer, err := client.NewStorageMinerRPCV0(ctx, addr, info.AuthHeader())
345305
if err != nil {
346-
return "", err
306+
return "", "", err
347307
}
348308
defer closer()
349309

350310
v, err := api.Version(ctx)
351311
if err != nil {
352-
return "", fmt.Errorf("checking version: %w", err)
312+
return "", "", fmt.Errorf("checking version: %w", err)
353313
}
354314

355315
if !v.APIVersion.EqMajorMinor(lapi.MinerAPIVersion0) {
356-
return "", fmt.Errorf("remote service API version didn't match (expected %s, remote %s)", lapi.MinerAPIVersion0, v.APIVersion)
316+
return "", "", fmt.Errorf("remote service API version didn't match (expected %s, remote %s)", lapi.MinerAPIVersion0, v.APIVersion)
317+
}
318+
319+
miner, err := api.ActorAddress(ctx)
320+
if err != nil {
321+
return "", "", fmt.Errorf("getting miner address: %w", err)
357322
}
358323

359-
return ai, nil
324+
return ai, miner.String(), nil
360325
}

cmd/booster-bitswap/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ var runCmd = &cli.Command{
194194
}
195195

196196
// Connect to the storage API(s) and create a piece reader
197-
sa := lib.NewMultiMinerAccessor(cctx.StringSlice("api-storage"), fullnodeApi)
197+
sa := lib.NewMultiMinerAccessor(cctx.StringSlice("api-storage"), fullnodeApi, time.Second*60)
198198
err = sa.Start(ctx, log)
199199
if err != nil {
200200
return err

cmd/booster-http/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ var runCmd = &cli.Command{
246246
}
247247

248248
// Connect to the storage API(s) and create a piece reader
249-
sa := lib.NewMultiMinerAccessor(cctx.StringSlice("api-storage"), fullnodeApi)
249+
sa := lib.NewMultiMinerAccessor(cctx.StringSlice("api-storage"), fullnodeApi, 60*time.Second)
250250
err = sa.Start(ctx, log)
251251
if err != nil {
252252
return err

cmd/lib/api.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,14 @@ type MultiMinerAccessor struct {
106106
sas map[address.Address]dagstore.SectorAccessor
107107
closeOnce sync.Once
108108
closers []jsonrpc.ClientCloser
109+
cachingDuration time.Duration
109110
}
110111

111-
func NewMultiMinerAccessor(storageApiInfos []string, fullnodeApi v1api.FullNode) *MultiMinerAccessor {
112+
func NewMultiMinerAccessor(storageApiInfos []string, fullnodeApi v1api.FullNode, cacheTTL time.Duration) *MultiMinerAccessor {
112113
return &MultiMinerAccessor{
113114
storageApiInfos: storageApiInfos,
114115
fullnodeApi: fullnodeApi,
116+
cachingDuration: cacheTTL,
115117
}
116118
}
117119

@@ -226,7 +228,7 @@ func CreateSectorAccessor(ctx context.Context, storageApiInfo string, fullnodeAp
226228
// Create the piece provider
227229
pp := sealer.NewPieceProvider(storage, storageService, storageService)
228230
const maxCacheSize = 4096
229-
newSectorAccessor := sectoraccessor.NewCachingSectorAccessor(maxCacheSize, 5*time.Minute)
231+
newSectorAccessor := sectoraccessor.NewCachingSectorAccessor(maxCacheSize, 10*time.Second)
230232
sa := newSectorAccessor(dtypes.MinerAddress(maddr), storageService, pp, fullnodeApi)
231233
return &sectorAccessor{SectorAccessor: sa, maddr: maddr}, storageCloser, nil
232234
}

docker/boost-client/Dockerfile.source

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#########################################################################################
2-
FROM golang:1.21-bullseye as builder
2+
FROM golang:1.22-bullseye as builder
33

44
RUN apt update && apt install -y \
55
build-essential \

docker/devnet/Dockerfile.source

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ COPY gql /src/gql
1313
RUN npm_config_legacy_peer_deps=yes npm ci --no-audit --prefix react&& \
1414
npm run --prefix react build
1515
#########################################################################################
16-
FROM golang:1.21-bullseye as builder
16+
FROM golang:1.22-bullseye as builder
1717

1818
RUN apt update && apt install -y \
1919
build-essential \

extern/boostd-data/Dockerfile.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.21-alpine
1+
FROM golang:1.22-alpine
22

33
WORKDIR /go/src/
44

0 commit comments

Comments
 (0)