Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ orbs:
executors:
golang:
docker:
- image: cimg/go:1.21.7
- image: cimg/go:1.22.3
resource_class: 2xlarge
ubuntu:
docker:
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
linux: false
darwin: true
- golang/install:
version: "1.21.7"
version: "1.22.3"
- run:
name: Install pkg-config
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/container-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
contents: read
packages: write
env:
LOTUS_VERSION: 'v1.26.1'
LOTUS_VERSION: 'v1.27.0'
LOTUS_SOURCE_IMAGE: 'ghcr.io/filecoin-shipyard/lotus-containers:lotus'
NETWORK_NAME: 'devnet'
FFI_BUILD_FROM_SOURCE: '0'
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ docsgen-openrpc-boost: docsgen-openrpc-bin

## DOCKER IMAGES
docker_user?=filecoin
lotus_version?=v1.26.1
lotus_version?=v1.27.0
ffi_from_source?=0
build_lotus?=0
build_boost?=1
boost_version?=v2.2.0-rc1
boost_version?=v2.3.0-rc2
ifeq ($(build_boost),1)
#v1: build boost images currently checked out branch
boost_build_cmd=docker/boost
Expand Down
103 changes: 34 additions & 69 deletions cmd/boostd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ var initCmd = &cli.Command{
}

rcfg.ConfigVersion = config.CurrentVersion
cerr = setMinerApiConfig(cctx, rcfg, true)
cerr = setMinerApiConfig(cctx, rcfg)
if cerr != nil {
return
}
Expand Down Expand Up @@ -118,9 +118,14 @@ var initCmd = &cli.Command{
return fmt.Errorf("writing config file %s: %w", string(newCfg), err)
}

miner, err := address.NewFromString(curCfg.Wallets.Miner)
if err != nil {
return fmt.Errorf("converting miner address: %w", err)
}

// Add the miner address to the metadata datastore
fmt.Printf("Adding miner address %s to datastore\n", bp.minerActor)
err = addMinerAddressToDatastore(ds, bp.minerActor)
fmt.Printf("Adding miner address %s to datastore\n", miner)
err = addMinerAddressToDatastore(ds, miner)
if err != nil {
return err
}
Expand All @@ -140,10 +145,9 @@ var initCmd = &cli.Command{
}

type boostParams struct {
repo *lotus_repo.FsRepo
minerActor address.Address
walletPSD address.Address
walletCP address.Address
repo *lotus_repo.FsRepo
walletPSD address.Address
walletCP address.Address
}

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

var minerActor address.Address
if marketsRepo == nil {
// If this is not a migration from an existing repo, just query the
// miner directly for the actor address
smApi, smCloser, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
if strings.Contains(err.Error(), "could not get API info") {
err = fmt.Errorf("%w\nDo you need to set the environment variable MINER_API_INFO?", err)
}
return nil, err
}
defer smCloser()

minerActor, err = smApi.ActorAddress(ctx)
if err != nil {
return nil, fmt.Errorf("getting miner actor address: %w", err)
}
} else {
// This is a migration from an existing repo, so get the miner address
// from the repo datastore
ds, err := marketsRepo.Datastore(context.Background(), metadataNamespace)
if err != nil {
return nil, fmt.Errorf("getting legacy repo datastore: %w", err)
}
minerActor, err = getMinerAddressFromDatastore(ds)
if err != nil {
return nil, fmt.Errorf("getting miner actor address: %w", err)
}
}

fmt.Println("Checking full node sync status")

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

return &boostParams{
repo: r,
minerActor: minerActor,
walletPSD: walletPSD,
walletCP: walletCP,
repo: r,
walletPSD: walletPSD,
walletCP: walletCP,
}, nil
}

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

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

if miner1 != miner2 {
return errors.New("sector index and sealer APIs belong to different miners")
}

fmt.Printf("Sealer api info: %s\n", ai)
fmt.Printf("Miner address: %s", miner1)
rcfg.SealerApiInfo = ai
rcfg.Wallets.Miner = miner1

return nil
}

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

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

func getMinerAddressFromDatastore(ds datastore.Batching) (address.Address, error) {
addr, err := ds.Get(context.Background(), minerAddrDSKey)
if err != nil {
return address.Address{}, fmt.Errorf("getting miner address from legacy datastore: %w", err)
}

minerAddr, err := address.NewFromBytes(addr)
if err != nil {
return address.Address{}, fmt.Errorf("parsing miner address from legacy datastore: %w", err)
}

return minerAddr, nil
}

func addMinerAddressToDatastore(ds datastore.Batching, minerActor address.Address) error {
return ds.Put(context.Background(), minerAddrDSKey, minerActor.Bytes())
}
Expand Down Expand Up @@ -328,33 +292,34 @@ func checkV1ApiSupport(ctx context.Context, cctx *cli.Context) error {
return nil
}

func checkApiInfo(ctx context.Context, ai string, dialCheck bool) (string, error) {
func checkApiInfo(ctx context.Context, ai string) (string, string, error) {
ai = strings.TrimPrefix(strings.TrimSpace(ai), "MINER_API_INFO=")
info := cliutil.ParseApiInfo(ai)
addr, err := info.DialArgs("v0")
if err != nil {
return "", fmt.Errorf("could not get DialArgs: %w", err)
}

if !dialCheck {
return ai, nil
return "", "", fmt.Errorf("could not get DialArgs: %w", err)
}

fmt.Printf("Checking miner api version of %s\n", addr)
api, closer, err := client.NewStorageMinerRPCV0(ctx, addr, info.AuthHeader())
if err != nil {
return "", err
return "", "", err
}
defer closer()

v, err := api.Version(ctx)
if err != nil {
return "", fmt.Errorf("checking version: %w", err)
return "", "", fmt.Errorf("checking version: %w", err)
}

if !v.APIVersion.EqMajorMinor(lapi.MinerAPIVersion0) {
return "", fmt.Errorf("remote service API version didn't match (expected %s, remote %s)", lapi.MinerAPIVersion0, v.APIVersion)
return "", "", fmt.Errorf("remote service API version didn't match (expected %s, remote %s)", lapi.MinerAPIVersion0, v.APIVersion)
}

miner, err := api.ActorAddress(ctx)
if err != nil {
return "", "", fmt.Errorf("getting miner address: %w", err)
}

return ai, nil
return ai, miner.String(), nil
}
2 changes: 1 addition & 1 deletion cmd/booster-bitswap/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ var runCmd = &cli.Command{
}

// Connect to the storage API(s) and create a piece reader
sa := lib.NewMultiMinerAccessor(cctx.StringSlice("api-storage"), fullnodeApi)
sa := lib.NewMultiMinerAccessor(cctx.StringSlice("api-storage"), fullnodeApi, time.Second*60)
err = sa.Start(ctx, log)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/booster-http/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ var runCmd = &cli.Command{
}

// Connect to the storage API(s) and create a piece reader
sa := lib.NewMultiMinerAccessor(cctx.StringSlice("api-storage"), fullnodeApi)
sa := lib.NewMultiMinerAccessor(cctx.StringSlice("api-storage"), fullnodeApi, 60*time.Second)
err = sa.Start(ctx, log)
if err != nil {
return err
Expand Down
6 changes: 4 additions & 2 deletions cmd/lib/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ type MultiMinerAccessor struct {
sas map[address.Address]dagstore.SectorAccessor
closeOnce sync.Once
closers []jsonrpc.ClientCloser
cachingDuration time.Duration
}

func NewMultiMinerAccessor(storageApiInfos []string, fullnodeApi v1api.FullNode) *MultiMinerAccessor {
func NewMultiMinerAccessor(storageApiInfos []string, fullnodeApi v1api.FullNode, cacheTTL time.Duration) *MultiMinerAccessor {
return &MultiMinerAccessor{
storageApiInfos: storageApiInfos,
fullnodeApi: fullnodeApi,
cachingDuration: cacheTTL,
}
}

Expand Down Expand Up @@ -226,7 +228,7 @@ func CreateSectorAccessor(ctx context.Context, storageApiInfo string, fullnodeAp
// Create the piece provider
pp := sealer.NewPieceProvider(storage, storageService, storageService)
const maxCacheSize = 4096
newSectorAccessor := sectoraccessor.NewCachingSectorAccessor(maxCacheSize, 5*time.Minute)
newSectorAccessor := sectoraccessor.NewCachingSectorAccessor(maxCacheSize, 10*time.Second)
sa := newSectorAccessor(dtypes.MinerAddress(maddr), storageService, pp, fullnodeApi)
return &sectorAccessor{SectorAccessor: sa, maddr: maddr}, storageCloser, nil
}
2 changes: 1 addition & 1 deletion docker/boost-client/Dockerfile.source
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#########################################################################################
FROM golang:1.21-bullseye as builder
FROM golang:1.22-bullseye as builder

RUN apt update && apt install -y \
build-essential \
Expand Down
2 changes: 1 addition & 1 deletion docker/devnet/Dockerfile.source
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ COPY gql /src/gql
RUN npm_config_legacy_peer_deps=yes npm ci --no-audit --prefix react&& \
npm run --prefix react build
#########################################################################################
FROM golang:1.21-bullseye as builder
FROM golang:1.22-bullseye as builder

RUN apt update && apt install -y \
build-essential \
Expand Down
2 changes: 1 addition & 1 deletion extern/boostd-data/Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine
FROM golang:1.22-alpine

WORKDIR /go/src/

Expand Down
2 changes: 1 addition & 1 deletion extern/boostd-data/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/filecoin-project/boost/extern/boostd-data

go 1.18
go 1.22

require (
contrib.go.opencensus.io/exporter/prometheus v0.4.2
Expand Down
Loading