Skip to content

Commit ac0d8de

Browse files
hunjixintom123222
authored andcommitted
rebase v1.14 ~ v1.24
1 parent 4a1a7bd commit ac0d8de

File tree

41 files changed

+1546
-255
lines changed

Some content is hidden

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

41 files changed

+1546
-255
lines changed

.github/workflows/build_upload.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: build and upload
2+
3+
on:
4+
push:
5+
branches: ['**']
6+
tags: ['**']
7+
8+
jobs:
9+
build_upload:
10+
uses: filecoin-project/venus/.github/workflows/common_build_upload.yml@master
11+
with:
12+
bin_name: 'lotus'
13+
has_ffi: true
14+
secrets:
15+
OSS_KEY_ID: ${{secrets.OSS_KEY_ID}}
16+
OSS_KEY_SECRET: ${{secrets.OSS_KEY_SECRET}}
17+
OSS_ENDPOINT: ${{secrets.OSS_ENDPOINT}}
18+
OSS_BUCKET: ${{secrets.OSS_BUCKET}}
19+
FTP_HOST: ${{secrets.FTP_HOST}}
20+
FTP_USER: ${{secrets.FTP_USER}}
21+
FTP_PWD: ${{secrets.FTP_PWD}}
22+
GODEYE_URL: ${{secrets.GODEYE_URL}}
23+
token: ${{github.token}}

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ bin/tmp/*
4545
.vscode
4646
scratchpad
4747

48-
build/builtin-actors/v*
49-
build/builtin-actors/*.car
48+
.vscode
5049

5150
dist/
5251

@@ -55,3 +54,7 @@ dist/
5554
# in dirty git state if removed from the docker context
5655
!extern/filecoin-ffi/rust/filecoin.pc
5756
!extern/test-vectors
57+
58+
localnet.json
59+
60+
devgen.car

Dockerfile

Lines changed: 19 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,28 @@
1-
#####################################
2-
FROM golang:1.20.7-bullseye AS lotus-builder
3-
MAINTAINER Lotus Development Team
1+
ARG RUNTIME_TAG=v1.14.0
42

5-
RUN apt-get update && apt-get install -y ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev
3+
FROM filvenus/venus-buildenv:v1.14.0 AS buildenv
64

7-
ENV XDG_CACHE_HOME="/tmp"
5+
WORKDIR /build
86

9-
### taken from https://github.com/rust-lang/docker-rust/blob/master/1.63.0/buster/Dockerfile
10-
ENV RUSTUP_HOME=/usr/local/rustup \
11-
CARGO_HOME=/usr/local/cargo \
12-
PATH=/usr/local/cargo/bin:$PATH \
13-
RUST_VERSION=1.63.0
7+
ENV GOPROXY="https://goproxy.cn,direct"
148

15-
RUN set -eux; \
16-
dpkgArch="$(dpkg --print-architecture)"; \
17-
case "${dpkgArch##*-}" in \
18-
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='5cc9ffd1026e82e7fb2eec2121ad71f4b0f044e88bca39207b3f6b769aaa799c' ;; \
19-
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='e189948e396d47254103a49c987e7fb0e5dd8e34b200aa4481ecc4b8e41fb929' ;; \
20-
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
21-
esac; \
22-
url="https://static.rust-lang.org/rustup/archive/1.25.1/${rustArch}/rustup-init"; \
23-
wget "$url"; \
24-
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
25-
chmod +x rustup-init; \
26-
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
27-
rm rustup-init; \
28-
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
29-
rustup --version; \
30-
cargo --version; \
31-
rustc --version;
9+
COPY ./go.mod /build/
10+
COPY ./exter[n] ./go.mod /build/extern/
11+
RUN go mod download
3212

33-
COPY ./ /opt/filecoin
34-
WORKDIR /opt/filecoin
13+
COPY . /build
14+
RUN make dist-clean
15+
RUN make deps
16+
RUN make force
3517

36-
RUN scripts/docker-git-state-check.sh
18+
FROM filvenus/venus-runtime:${RUNTIME_TAG}
3719

38-
### make configurable filecoin-ffi build
39-
ARG FFI_BUILD_FROM_SOURCE=0
40-
ENV FFI_BUILD_FROM_SOURCE=${FFI_BUILD_FROM_SOURCE}
20+
ARG BUILD_TARGET=
21+
ENV VENUS_COMPONENT=${BUILD_TARGET}
4122

42-
RUN make clean deps
23+
# copy the app from build env
24+
COPY --from=buildenv /build/lotus /lotus
25+
COPY --from=buildenv /build/lotus-miner /lotus-miner
26+
COPY --from=buildenv /build/lotus-seed /lotus-seed
4327

44-
ARG RUSTFLAGS=""
45-
ARG GOFLAGS=""
46-
47-
RUN make buildall
48-
49-
#####################################
50-
FROM ubuntu:20.04 AS lotus-base
51-
MAINTAINER Lotus Development Team
52-
53-
# Base resources
54-
COPY --from=lotus-builder /etc/ssl/certs /etc/ssl/certs
55-
COPY --from=lotus-builder /lib/*/libdl.so.2 /lib/
56-
COPY --from=lotus-builder /lib/*/librt.so.1 /lib/
57-
COPY --from=lotus-builder /lib/*/libgcc_s.so.1 /lib/
58-
COPY --from=lotus-builder /lib/*/libutil.so.1 /lib/
59-
COPY --from=lotus-builder /usr/lib/*/libltdl.so.7 /lib/
60-
COPY --from=lotus-builder /usr/lib/*/libnuma.so.1 /lib/
61-
COPY --from=lotus-builder /usr/lib/*/libhwloc.so.* /lib/
62-
COPY --from=lotus-builder /usr/lib/*/libOpenCL.so.1 /lib/
63-
64-
RUN useradd -r -u 532 -U fc \
65-
&& mkdir -p /etc/OpenCL/vendors \
66-
&& echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
67-
68-
#####################################
69-
FROM lotus-base AS lotus
70-
MAINTAINER Lotus Development Team
71-
72-
COPY --from=lotus-builder /opt/filecoin/lotus /usr/local/bin/
73-
COPY --from=lotus-builder /opt/filecoin/lotus-shed /usr/local/bin/
74-
COPY scripts/docker-lotus-entrypoint.sh /
75-
76-
ARG DOCKER_LOTUS_IMPORT_SNAPSHOT https://snapshots.mainnet.filops.net/minimal/latest
77-
ENV DOCKER_LOTUS_IMPORT_SNAPSHOT ${DOCKER_LOTUS_IMPORT_SNAPSHOT}
78-
ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters
79-
ENV LOTUS_PATH /var/lib/lotus
80-
ENV DOCKER_LOTUS_IMPORT_WALLET ""
81-
82-
RUN mkdir /var/lib/lotus /var/tmp/filecoin-proof-parameters
83-
RUN chown fc: /var/lib/lotus /var/tmp/filecoin-proof-parameters
84-
85-
VOLUME /var/lib/lotus
86-
VOLUME /var/tmp/filecoin-proof-parameters
87-
88-
USER fc
89-
90-
EXPOSE 1234
91-
92-
ENTRYPOINT ["/docker-lotus-entrypoint.sh"]
93-
94-
CMD ["-help"]
95-
96-
#####################################
97-
FROM lotus-base AS lotus-all-in-one
98-
99-
ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters
100-
ENV LOTUS_MINER_PATH /var/lib/lotus-miner
101-
ENV LOTUS_PATH /var/lib/lotus
102-
ENV LOTUS_WORKER_PATH /var/lib/lotus-worker
103-
ENV WALLET_PATH /var/lib/lotus-wallet
104-
105-
COPY --from=lotus-builder /opt/filecoin/lotus /usr/local/bin/
106-
COPY --from=lotus-builder /opt/filecoin/lotus-seed /usr/local/bin/
107-
COPY --from=lotus-builder /opt/filecoin/lotus-shed /usr/local/bin/
108-
COPY --from=lotus-builder /opt/filecoin/lotus-wallet /usr/local/bin/
109-
COPY --from=lotus-builder /opt/filecoin/lotus-gateway /usr/local/bin/
110-
COPY --from=lotus-builder /opt/filecoin/lotus-miner /usr/local/bin/
111-
COPY --from=lotus-builder /opt/filecoin/lotus-worker /usr/local/bin/
112-
COPY --from=lotus-builder /opt/filecoin/lotus-provider /usr/local/bin/
113-
COPY --from=lotus-builder /opt/filecoin/lotus-stats /usr/local/bin/
114-
COPY --from=lotus-builder /opt/filecoin/lotus-fountain /usr/local/bin/
115-
116-
RUN mkdir /var/tmp/filecoin-proof-parameters
117-
RUN mkdir /var/lib/lotus
118-
RUN mkdir /var/lib/lotus-miner
119-
RUN mkdir /var/lib/lotus-worker
120-
RUN mkdir /var/lib/lotus-wallet
121-
RUN mkdir /var/lib/lotus-provider
122-
RUN chown fc: /var/tmp/filecoin-proof-parameters
123-
RUN chown fc: /var/lib/lotus
124-
RUN chown fc: /var/lib/lotus-miner
125-
RUN chown fc: /var/lib/lotus-worker
126-
RUN chown fc: /var/lib/lotus-wallet
127-
RUN chown fc: /var/lib/lotus-provider
128-
129-
130-
VOLUME /var/tmp/filecoin-proof-parameters
131-
VOLUME /var/lib/lotus
132-
VOLUME /var/lib/lotus-miner
133-
VOLUME /var/lib/lotus-worker
134-
VOLUME /var/lib/lotus-wallet
135-
VOLUME /var/lib/lotus-provider
136-
137-
EXPOSE 1234
138-
EXPOSE 2345
139-
EXPOSE 3456
140-
EXPOSE 1777
28+
# ENTRYPOINT ["/script/init.sh"]

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ debug: build-devnets
7575
2k: GOFLAGS+=-tags=2k
7676
2k: build-devnets
7777

78+
force: GOFLAGS+=-tags=force
79+
force: build-devnets
80+
7881
calibnet: GOFLAGS+=-tags=calibnet
7982
calibnet: build-devnets
8083

@@ -410,3 +413,29 @@ print-%:
410413

411414
circleci:
412415
go generate -x ./.circleci
416+
417+
TAG:=test
418+
docker: $(BUILD_DEPS)
419+
# ifdef DOCKERFILE
420+
# cp $(DOCKERFILE) ./dockerfile
421+
# else
422+
# curl -o dockerfile https://raw.githubusercontent.com/filecoin-project/venus-docs/master/script/docker/dockerfile
423+
# endif
424+
docker build --build-arg HTTPS_PROXY=$(BUILD_DOCKER_PROXY) --build-arg BUILD_TARGET=lotus -t lotus .
425+
docker tag lotus filvenus/lotus:$(TAG)
426+
ifdef PRIVATE_REGISTRY
427+
docker tag lotus $(PRIVATE_REGISTRY)/filvenus/lotus:$(TAG)
428+
endif
429+
.PHONY: docker
430+
431+
docker-push: docker
432+
ifdef PRIVATE_REGISTRY
433+
docker push $(PRIVATE_REGISTRY)/filvenus/lotus:$(TAG)
434+
docker tag $(PRIVATE_REGISTRY)/filvenus/lotus:$(TAG) $(PRIVATE_REGISTRY)/filvenus/lotus:latest
435+
docker push $(PRIVATE_REGISTRY)/filvenus/lotus:latest
436+
else
437+
docker push filvenus/lotus:$(TAG)
438+
docker tag filvenus/lotus:$(TAG) filvenus/lotus:latest
439+
docker push filvenus/lotus:latest
440+
endif
441+
.PHONY: docker-push

api/api_errors.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package api
33
import (
44
"errors"
55
"reflect"
6-
7-
"github.com/filecoin-project/go-jsonrpc"
86
)
97

108
const (
11-
EOutOfGas = iota + jsonrpc.FirstUserCode
9+
// todo: add api.RPCErrors
10+
// EOutOfGas = iota + jsonrpc.FirstUserCode
11+
EOutOfGas = iota + 2
1212
EActorNotFound
1313
)
1414

@@ -24,7 +24,7 @@ func (e *ErrActorNotFound) Error() string {
2424
return "actor not found"
2525
}
2626

27-
var RPCErrors = jsonrpc.NewErrors()
27+
// var RPCErrors = jsonrpc.NewErrors()
2828

2929
func ErrorIsIn(err error, errorTypes []error) bool {
3030
for _, etype := range errorTypes {
@@ -36,7 +36,7 @@ func ErrorIsIn(err error, errorTypes []error) bool {
3636
return false
3737
}
3838

39-
func init() {
40-
RPCErrors.Register(EOutOfGas, new(*ErrOutOfGas))
41-
RPCErrors.Register(EActorNotFound, new(*ErrActorNotFound))
42-
}
39+
// func init() {
40+
// RPCErrors.Register(EOutOfGas, new(*ErrOutOfGas))
41+
// RPCErrors.Register(EActorNotFound, new(*ErrActorNotFound))
42+
// }

api/api_full.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const LookbackNoLimit = abi.ChainEpoch(-1)
6666
type FullNode interface {
6767
Common
6868
Net
69+
VenusAPI
6970

7071
// MethodGroup: Chain
7172
// The Chain method group contains methods for interacting with the

api/api_test.go

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ import (
1212
"testing"
1313

1414
"github.com/stretchr/testify/require"
15-
"golang.org/x/xerrors"
16-
17-
"github.com/filecoin-project/go-jsonrpc"
1815
)
1916

2017
func goCmd() string {
@@ -128,17 +125,18 @@ func TestPermTags(t *testing.T) {
128125
_ = PermissionedWorkerAPI(&WorkerStruct{})
129126
}
130127

131-
func TestRetryErrorIsInTrue(t *testing.T) {
132-
errorsToRetry := []error{&jsonrpc.RPCConnectionError{}}
133-
require.True(t, ErrorIsIn(&jsonrpc.RPCConnectionError{}, errorsToRetry))
134-
}
135-
136-
func TestRetryErrorIsInFalse(t *testing.T) {
137-
errorsToRetry := []error{&jsonrpc.RPCConnectionError{}}
138-
require.False(t, ErrorIsIn(xerrors.Errorf("random error"), errorsToRetry))
139-
}
140-
141-
func TestRetryWrappedErrorIsInTrue(t *testing.T) {
142-
errorsToRetry := []error{&jsonrpc.RPCConnectionError{}}
143-
require.True(t, ErrorIsIn(xerrors.Errorf("wrapped: %w", &jsonrpc.RPCConnectionError{}), errorsToRetry))
144-
}
128+
// todo: add api.RPCErrors
129+
// func TestRetryErrorIsInTrue(t *testing.T) {
130+
// errorsToRetry := []error{&jsonrpc.RPCConnectionError{}}
131+
// require.True(t, ErrorIsIn(&jsonrpc.RPCConnectionError{}, errorsToRetry))
132+
// }
133+
134+
// func TestRetryErrorIsInFalse(t *testing.T) {
135+
// errorsToRetry := []error{&jsonrpc.RPCConnectionError{}}
136+
// require.False(t, ErrorIsIn(xerrors.Errorf("random error"), errorsToRetry))
137+
// }
138+
139+
// func TestRetryWrappedErrorIsInTrue(t *testing.T) {
140+
// errorsToRetry := []error{&jsonrpc.RPCConnectionError{}}
141+
// require.True(t, ErrorIsIn(xerrors.Errorf("wrapped: %w", &jsonrpc.RPCConnectionError{}), errorsToRetry))
142+
// }

api/api_venus.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package api
2+
3+
import (
4+
"context"
5+
6+
"github.com/filecoin-project/go-address"
7+
8+
"github.com/filecoin-project/lotus/chain/types"
9+
)
10+
11+
type VenusAPI interface {
12+
// MethodGroup: Venus
13+
14+
MpoolSelects(context.Context, types.TipSetKey, []float64) ([][]*types.SignedMessage, error) //perm:read
15+
16+
MpoolPublishMessage(ctx context.Context, smsg *types.SignedMessage) error //perm:write
17+
18+
MpoolPublishByAddr(context.Context, address.Address) error //perm:write
19+
20+
GasBatchEstimateMessageGas(ctx context.Context, estimateMessages []*EstimateMessage, fromNonce uint64, tsk types.TipSetKey) ([]*EstimateResult, error) //perm:read
21+
}

0 commit comments

Comments
 (0)