Skip to content

Commit e0e1d73

Browse files
committed
merge main into release/lotus1.17.2
2 parents 5ddd9de + 306cde2 commit e0e1d73

File tree

17 files changed

+2546
-211
lines changed

17 files changed

+2546
-211
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
docker/devnet/data
22
react/node_modules
3+
react/build
34
# filecoin-ffi installation
45
build/.filecoin-install
56
extern/filecoin-ffi/.install-filcrypto

Makefile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,46 @@ docsgen-openrpc-boost: docsgen-openrpc-bin
197197
./docgen-openrpc "api/api.go" "Boost" "api" "./api" -gzip > build/openrpc/boost.json.gz
198198

199199
.PHONY: docsgen docsgen-md-bin docsgen-openrpc-bin
200+
201+
## DOCKER IMAGES
202+
docker_user?=filecoin
203+
lotus_version?=1.17.1-rc2
204+
lotus_src_dir?=
205+
206+
ifeq ($(lotus_src_dir),)
207+
lotus_src_dir=/tmp/lotus-$(lotus_version)
208+
lotus_checkout_dir=$(lotus_src_dir)
209+
else
210+
lotus_version=dev
211+
lotus_checkout_dir=
212+
endif
213+
lotus_test_image=$(docker_user)/lotus-test:$(lotus_version)
214+
docker_build_cmd=docker build --build-arg LOTUS_TEST_IMAGE=$(lotus_test_image) $(docker_args)
215+
216+
### lotus test docker image
217+
info/lotus-test:
218+
@echo Lotus dir = $(lotus_src_dir)
219+
@echo Lotus ver = $(lotus_version)
220+
.PHONY: info/lotus-test
221+
$(lotus_checkout_dir):
222+
git clone --depth 1 --branch v$(lotus_version) https://github.com/filecoin-project/lotus $@
223+
docker/lotus-test: info/lotus-test | $(lotus_checkout_dir)
224+
cd $(lotus_src_dir) && $(docker_build_cmd) -f Dockerfile.lotus --target lotus-test \
225+
-t $(lotus_test_image) .
226+
.PHONY: docker/lotus-test
227+
228+
### devnet images
229+
docker/%: docker/lotus-test
230+
cd docker/devnet/$* && $(docker_build_cmd) -t $(docker_user)/$*-dev:$(lotus_version) \
231+
--build-arg BUILD_VERSION=$(lotus_version) .
232+
docker/boost: build/.update-modules docker/lotus-test
233+
DOCKER_BUILDKIT=1 $(docker_build_cmd) \
234+
-t $(docker_user)/boost-dev:dev --build-arg BUILD_VERSION=dev \
235+
-f docker/devnet/boost/Dockerfile.source .
236+
.PHONY: docker/boost
237+
docker/booster-http:
238+
$(docker_build_cmd) -t $(docker_user)/booster-http-dev:dev --build-arg BUILD_VERSION=dev \
239+
-f docker/devnet/booster-http/Dockerfile.source .
240+
.PHONY: docker/booster-http
241+
docker/all: docker/boost docker/booster-http docker/lotus docker/lotus-miner
242+
.PHONY: docker/all

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,18 +206,13 @@ Note also that the provider address is `t01000` and you will need to supply an a
206206

207207
### Building Docker images
208208

209-
1. Select Lotus version, for example: `lotus_version=1.17.1-rc2`. It must be the tag name of [the Lotus git repo](https://github.com/filecoin-project/lotus/tags) without `v` prefix.
210-
211-
2. Select Boost version, for example: `boost_version=1.3.0-rc1`.
212-
213-
3. Build images
209+
1. Build images
214210

215211
```
216-
cd docker/devnet
217-
make build/all
212+
make docker/all
218213
```
219214

220-
If you need to build a different version, edit the `.env` file.
215+
If you need to build containers using a specific version of lotus then provide the version as a parameter, e.g. `make docker/all lotus_version=1.17.0`. The version must be a tag name of [Lotus git repo](https://github.com/filecoin-project/lotus/tags) without `v` prefix. Or you can build using a local source of lotus - `make docker/all lotus_src_dir=<path of lotus source>`. Also, before starting devnet, you need to update versions in the [.env](docker/devnet/.env) file.
221216

222217
### Start devnet docker stack
223218

build/openrpc/boost.json.gz

-3 Bytes
Binary file not shown.

build/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package build
22

33
var CurrentCommit string
44

5-
const BuildVersion = "1.4.0-rc2"
5+
const BuildVersion = "1.4.0"
66

77
func UserVersion() string {
88
return BuildVersion + CurrentCommit

cmd/boostd/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"os"
55

6+
"github.com/filecoin-project/boost/cmd"
67
logging "github.com/ipfs/go-log/v2"
78
"github.com/urfave/cli/v2"
89

@@ -29,6 +30,7 @@ func main() {
2930
Usage: "boost repo path",
3031
Value: "~/.boost",
3132
},
33+
cmd.FlagJson,
3234
cliutil.FlagVeryVerbose,
3335
},
3436
Commands: []*cli.Command{

cmd/boostd/pieces.go

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"text/tabwriter"
77

88
bcli "github.com/filecoin-project/boost/cli"
9+
"github.com/filecoin-project/boost/cmd"
910
lcli "github.com/filecoin-project/lotus/cli"
1011
"github.com/filecoin-project/lotus/lib/tablewriter"
1112
"github.com/ipfs/go-cid"
@@ -40,9 +41,18 @@ var piecesListPiecesCmd = &cli.Command{
4041
return err
4142
}
4243

44+
if cctx.Bool("json") {
45+
46+
pieceCidsJson := map[string]interface{}{
47+
"pieceCids": pieceCids,
48+
}
49+
return cmd.PrintJson(pieceCidsJson)
50+
}
51+
4352
for _, pc := range pieceCids {
4453
fmt.Println(pc)
4554
}
55+
4656
return nil
4757
},
4858
}
@@ -69,6 +79,14 @@ var piecesListCidInfosCmd = &cli.Command{
6979
return err
7080
}
7181

82+
if cctx.Bool("json") && !cctx.Bool("verbose") {
83+
dataCidsJson := map[string]interface{}{
84+
"dataCids": cids,
85+
}
86+
87+
return cmd.PrintJson(dataCidsJson)
88+
}
89+
7290
w := tablewriter.New(tablewriter.Col("CID"),
7391
tablewriter.Col("Piece"),
7492
tablewriter.Col("BlockOffset"),
@@ -79,12 +97,18 @@ var piecesListCidInfosCmd = &cli.Command{
7997
tablewriter.Col("DealLen"),
8098
)
8199

100+
type dataCids map[string]interface{}
101+
var out []dataCids
102+
82103
for _, c := range cids {
83104
if !cctx.Bool("verbose") {
84105
fmt.Println(c)
85106
continue
86107
}
87108

109+
type pbl map[string]interface{}
110+
var pbls []pbl
111+
88112
ci, err := nodeApi.PiecesGetCIDInfo(ctx, c)
89113
if err != nil {
90114
fmt.Printf("Error getting CID info: %s\n", err)
@@ -109,8 +133,34 @@ var piecesListCidInfosCmd = &cli.Command{
109133
"DealOffset": deal.Offset,
110134
"DealLen": deal.Length,
111135
})
136+
137+
deal := map[string]interface{}{
138+
"ID": deal.DealID,
139+
"Sector": deal.SectorID,
140+
"Offset": deal.Offset,
141+
"Length": deal.Length,
142+
}
143+
tpbl := pbl{
144+
"PieceCid": pi.PieceCID,
145+
"BlockOffset": location.RelOffset,
146+
"BlockLength": location.BlockSize,
147+
"Deal": deal,
148+
}
149+
150+
pbls = append(pbls, tpbl)
112151
}
113152
}
153+
154+
tdataCids := dataCids{
155+
"DataCid": c,
156+
"PieceBlockLocation": pbls,
157+
}
158+
159+
out = append(out, tdataCids)
160+
}
161+
162+
if cctx.Bool("json") && cctx.Bool("verbose") {
163+
return cmd.PrintJson(out)
114164
}
115165

116166
if cctx.Bool("verbose") {
@@ -146,6 +196,28 @@ var piecesInfoCmd = &cli.Command{
146196
return err
147197
}
148198

199+
if cctx.Bool("json") {
200+
201+
type deal map[string]interface{}
202+
var deals []deal
203+
for _, d := range pi.Deals {
204+
dl := deal{
205+
"ID": d.DealID,
206+
"SectorID": d.SectorID,
207+
"Offset": d.Offset,
208+
"Length": d.Length,
209+
}
210+
deals = append(deals, dl)
211+
}
212+
213+
pieceinfo := map[string]interface{}{
214+
"PieceCid": pi.PieceCID,
215+
"Deals": deals,
216+
}
217+
218+
return cmd.PrintJson(pieceinfo)
219+
}
220+
149221
fmt.Println("Piece: ", pi.PieceCID)
150222
w := tabwriter.NewWriter(os.Stdout, 4, 4, 2, ' ', 0)
151223
fmt.Fprintln(w, "Deals:\nDealID\tSectorID\tLength\tOffset")
@@ -181,6 +253,31 @@ var piecesCidInfoCmd = &cli.Command{
181253
return err
182254
}
183255

256+
if cctx.Bool("json") {
257+
258+
type pbl map[string]interface{}
259+
type bl map[string]interface{}
260+
var pbls []pbl
261+
for _, d := range ci.PieceBlockLocations {
262+
tbp := bl{
263+
"RelOffset": d.RelOffset,
264+
"BlockSize": d.BlockSize,
265+
}
266+
tpbl := pbl{
267+
"PieceCid": d.PieceCID,
268+
"BlockLocation": tbp,
269+
}
270+
pbls = append(pbls, tpbl)
271+
}
272+
273+
pieceinfo := map[string]interface{}{
274+
"DataCid": ci.CID,
275+
"PieceBlockLocation": pbls,
276+
}
277+
278+
return cmd.PrintJson(pieceinfo)
279+
}
280+
184281
fmt.Println("Info for: ", ci.CID)
185282

186283
w := tabwriter.NewWriter(os.Stdout, 4, 4, 2, ' ', 0)

docker/devnet/Makefile

Lines changed: 0 additions & 57 deletions
This file was deleted.

docker/devnet/boost/Dockerfile.source

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
ARG LOTUS_TEST_IMAGE=filecoin/lotus-test:latest
55
FROM ${LOTUS_TEST_IMAGE} as lotus-dev
66
#########################################################################################
7+
FROM node:16.16-alpine3.15 AS react-builder
8+
9+
WORKDIR /src
10+
COPY react /src/react
11+
COPY gql /src/gql
12+
13+
RUN npm_config_legacy_peer_deps=yes npm ci --no-audit --prefix react&& \
14+
npm run --prefix react build
15+
#########################################################################################
716
FROM golang:1.18-bullseye as builder
817

918
RUN apt update && apt install -y \
@@ -31,6 +40,8 @@ RUN make build/.filecoin-install
3140
##############################################
3241
COPY . /go/src
3342
##############################################
43+
COPY --from=react-builder /src/react/build /go/src/react/build
44+
3445
RUN --mount=type=cache,target=/root/.cache/go-build \
3546
--mount=type=cache,target=/go/pkg/mod \
3647
make debug

0 commit comments

Comments
 (0)