Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into ipdx-circleci-depreca…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
galargh committed May 15, 2024
2 parents 6aa6164 + e14a85b commit c4df82c
Show file tree
Hide file tree
Showing 311 changed files with 11,223 additions and 2,260 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/sorted-pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Comment with sorted PR checks

on:
workflow_dispatch:
inputs:
pull_number:
description: 'Pull request number'
required: true
workflow_run:
workflows:
- Build
- Check
- CodeQL
- Test
types:
- requested
- completed

permissions:
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.event.inputs.pull_number || github.event.workflow_run.pull_requests[0].number }}
cancel-in-progress: true

jobs:
comment:
if: github.event.inputs.pull_number || github.event.workflow_run.event == 'pull_request'
uses: ipdxco/sorted-pr-checks/.github/workflows/comment.yml@v1
with:
pull_number: ${{ github.event.inputs.pull_number || github.event.workflow_run.pull_requests[0].number }}
template: unsuccessful_only
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ jobs:
echo -e "path<<EOF\n$CACHE_PATH\nEOF" | tee -a $GITHUB_OUTPUT
- id: make_deps
env:
CACHE_KEY: ${{ runner.os }}-${{ runner.arch }}-make-deps-${{ hashFiles('./extern/filecoin-ffi/install-filcrypto') }}-${{ hashFiles('./extern/filecoin-ffi/rust/rustc-target-features-optimized.json') }}
CACHE_KEY: ${{ runner.os }}-${{ runner.arch }}-make-deps-${{ hashFiles('./.git/modules/extern/filecoin-ffi/HEAD') }}
CACHE_PATH: |
./extern/filecoin-ffi/filcrypto.h
./extern/filecoin-ffi/libfilcrypto.a
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ build/paramfetch.sh
*.snap
devgen.car
localnet.json
/*.ndjson

*-fuzz.zip
/chain/types/work_msg/
Expand Down
69 changes: 28 additions & 41 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ linters:
- govet
- goimports
- misspell
- goconst
- golint
- revive
- errcheck
- gosec
- unconvert
- staticcheck
- varcheck
- deadcode
- scopelint
- exportloopref
- unused

# We don't want to skip builtin/
Expand All @@ -25,37 +22,36 @@ skip-dirs:

issues:
exclude:
- "by other packages, and that stutters; consider calling this"
- "Potential file inclusion via variable"
- "should have( a package)? comment"
- "Error return value of `logging.SetLogLevel` is not checked"
- "comment on exported"
- "(func|method) \\w+ should be \\w+"
- "(type|var|struct field|(method|func) parameter) `\\w+` should be `\\w+`"
- "(G306|G301|G307|G108|G302|G204|G104)"
- "don't use ALL_CAPS in Go names"
- "string .* has .* occurrences, make it a constant"
- "a blank import should be only in a main or test package, or have a comment justifying it"
- "package comment should be of the form"
- "Potential hardcoded credentials"
- "Use of weak random number generator"
- "xerrors.* is deprecated"
# gosec
- "^G101: Potential hardcoded credentials"
- "^G108: Profiling endpoint is automatically exposed on /debug/pprof"
- "^G204: Subprocess launched with (variable|a potential tainted input or cmd arguments)"
- "^G301: Expect directory permissions to be 0750 or less"
- "^G302: Expect file permissions to be 0600 or less"
- "^G304: Potential file inclusion via variable"
- "^G306: Expect WriteFile permissions to be 0600 or less"
- "^G404: Use of weak random number generator"
# staticcheck
- "^SA1019: xerrors.* is deprecated: As of Go 1.13, use errors"
# revive
- "^blank-imports: a blank import should be only in a main or test package, or have a comment justifying it"
- "^dot-imports: should not use dot imports"
- "^exported: (func|type) name will be used as [^\\s]+ by other packages, and that stutters; consider calling this \\w+"
- "^exported: comment on exported (const|function|method|type|var) [^\\s]+ should be of the form \"\\w+ ...\""
- "^exported: exported (const|function|method|type|var) [^\\s]+ should have comment (\\(or a comment on this block\\) )?or be unexported"
- "^indent-error-flow: if block ends with a return statement, so drop this else and outdent its block \\(move short variable declaration to its own line if necessary\\)"
- "^package-comments: package comment should be of the form \"Package \\w+ ...\""
- "^package-comments: should have a package comment"
- "^unexported-return: exported func \\w+ returns unexported type [^\\s]+, which can be annoying to use"
- "^unused-parameter: parameter '\\w+' seems to be unused, consider removing or renaming it as _"
- "^var-naming: (const|func|type|var|struct field|(method|func|interface method) parameter) [A-Z]\\w+ should be"
- "^var-naming: (method|range var) \\w*(Api|Http|Id|Rpc|Url)[^\\s]* should be \\w*(API|HTTP|ID|RPC|URL)"
- "^var-naming: don't use underscores in Go names"
- "^var-naming: don't use ALL_CAPS in Go names; use CamelCase"

exclude-use-default: false
exclude-rules:

- path: node/modules/lp2p
linters:
- golint

- path: build/params_.*\.go
linters:
- golint

- path: api/apistruct/struct.go
linters:
- golint

- path: .*_test.go
linters:
- gosec
Expand All @@ -67,12 +63,3 @@ issues:
- path: cmd/lotus-bench/.*
linters:
- gosec

- path: api/test/.*
text: "context.Context should be the first parameter"
linters:
- golint

linters-settings:
goconst:
min-occurrences: 6
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,37 @@

## Improvements

### JSON-RPC 2.0 Specification Conformance

The JSON-RPC 2.0 specification requires that a `"result"` property be present in the case of no error from an API call. This release ensures that all API calls that return a result have a `"result"` property in the response. This is a behaviour change over Lotus v1.26 and will impact any API call that only has a single error return value, where no error has occurred.

For example, a successful `WalletSetDefault` in v1.26 would return:

```json
{
"jsonrpc": "2.0",
"id": 1
}
```

As of this change, in conformance with the JSON-RPC 2.0 specification it will return:

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": null
}
```

There is no change in the behaviour when a call returns an error, as the error object will still be present in the response.

# v1.26.3 / 2024-04-22

**This is a patch release that addresses high memory load concerns for the Lotus daemon in the coming network migration for network version 22, scheduled on epoch `3855360 - 2024-04-24 - 14:00:00Z`.**

If your Lotus daemon is running on a machine with less memory and swap than 160GB, you should upgrade to this patch release to ensure you do not encounter any Out-Of-Memory issues during the pre-migration.

# v1.26.2 / 2024-04-08

**This is a mandatory patch release for the Filecoin network version 22 mainnet upgrade, for all node operators.**
Expand Down
95 changes: 95 additions & 0 deletions Dockerfile.curio
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#####################################
FROM golang:1.21.7-bullseye AS curio-builder
MAINTAINER Curio Development Team

RUN apt-get update && apt-get install -y ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev

ENV XDG_CACHE_HOME="/tmp"

### taken from https://github.com/rust-lang/docker-rust/blob/master/1.63.0/buster/Dockerfile
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.63.0

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='5cc9ffd1026e82e7fb2eec2121ad71f4b0f044e88bca39207b3f6b769aaa799c' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='e189948e396d47254103a49c987e7fb0e5dd8e34b200aa4481ecc4b8e41fb929' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.25.1/${rustArch}/rustup-init"; \
wget "$url"; \
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version;

COPY ./ /opt/curio
WORKDIR /opt/curio

### make configurable filecoin-ffi build
ARG FFI_BUILD_FROM_SOURCE=0
ENV FFI_BUILD_FROM_SOURCE=${FFI_BUILD_FROM_SOURCE}

RUN make clean deps

ARG RUSTFLAGS=""
ARG GOFLAGS=""

RUN make curio-devnet

#####################################
FROM ubuntu:22.04 AS curio-all-in-one

RUN apt-get update && apt-get install -y dnsutils vim curl

# Copy libraries and binaries from curio-builder
COPY --from=curio-builder /etc/ssl/certs /etc/ssl/certs
COPY --from=curio-builder /lib/*/libdl.so.2 /lib/
COPY --from=curio-builder /lib/*/librt.so.1 /lib/
COPY --from=curio-builder /lib/*/libgcc_s.so.1 /lib/
COPY --from=curio-builder /lib/*/libutil.so.1 /lib/
COPY --from=curio-builder /usr/lib/*/libltdl.so.7 /lib/
COPY --from=curio-builder /usr/lib/*/libnuma.so.1 /lib/
COPY --from=curio-builder /usr/lib/*/libhwloc.so.* /lib/
COPY --from=curio-builder /usr/lib/*/libOpenCL.so.1 /lib/

# Setup user and OpenCL configuration
RUN useradd -r -u 532 -U fc && \
mkdir -p /etc/OpenCL/vendors && \
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd

# Environment setup
ENV FILECOIN_PARAMETER_CACHE=/var/tmp/filecoin-proof-parameters \
LOTUS_MINER_PATH=/var/lib/lotus-miner \
LOTUS_PATH=/var/lib/lotus \
CURIO_REPO_PATH=/var/lib/curio

# Copy binaries and scripts
COPY --from=curio-builder /opt/curio/lotus /usr/local/bin/
COPY --from=curio-builder /opt/curio/lotus-seed /usr/local/bin/
COPY --from=curio-builder /opt/curio/lotus-shed /usr/local/bin/
COPY --from=curio-builder /opt/curio/lotus-miner /usr/local/bin/
COPY --from=curio-builder /opt/curio/curio /usr/local/bin/
COPY --from=curio-builder /opt/curio/sptool /usr/local/bin/

# Set up directories and permissions
RUN mkdir /var/tmp/filecoin-proof-parameters \
/var/lib/lotus \
/var/lib/lotus-miner \
/var/lib/curio && \
chown fc: /var/tmp/filecoin-proof-parameters /var/lib/lotus /var/lib/lotus-miner /var/lib/curio

# Define volumes
VOLUME ["/var/tmp/filecoin-proof-parameters", "/var/lib/lotus", "/var/lib/lotus-miner", "/var/lib/curio"]

# Expose necessary ports
EXPOSE 1234 2345 12300 4701 32100

CMD ["/bin/bash"]
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -428,3 +428,32 @@ docsgen-cli: lotus lotus-miner lotus-worker curio sptool
print-%:
@echo $*=$($*)

### Curio devnet images
curio_docker_user?=curio
curio_base_image=$(curio_docker_user)/curio-all-in-one:latest-debug
ffi_from_source?=0

curio-devnet: lotus lotus-miner lotus-shed lotus-seed curio sptool
.PHONY: curio-devnet

curio_docker_build_cmd=docker build --build-arg CURIO_TEST_IMAGE=$(curio_base_image) \
--build-arg FFI_BUILD_FROM_SOURCE=$(ffi_from_source) $(docker_args)

docker/curio-all-in-one:
$(curio_docker_build_cmd) -f Dockerfile.curio --target curio-all-in-one \
-t $(curio_base_image) --build-arg GOFLAGS=-tags=debug .
.PHONY: docker/curio-all-in-one

docker/%:
cd curiosrc/docker/$* && DOCKER_BUILDKIT=1 $(curio_docker_build_cmd) -t $(curio_docker_user)/$*-dev:dev \
--build-arg BUILD_VERSION=dev .

docker/curio-devnet: $(lotus_build_cmd) \
docker/curio-all-in-one docker/lotus docker/lotus-miner docker/curio docker/yugabyte
.PHONY: docker/curio-devnet

curio-devnet/up:
rm -rf ./curiosrc/docker/data && docker compose -f ./curiosrc/docker/docker-compose.yaml up -d

curio-devnet/down:
docker compose -f ./curiosrc/docker/docker-compose.yaml down --rmi=local && sleep 2 && rm -rf ./curiosrc/docker/data
4 changes: 4 additions & 0 deletions api/api_curio.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type Curio interface {

AllocatePieceToSector(ctx context.Context, maddr address.Address, piece PieceDealInfo, rawSize int64, source url.URL, header http.Header) (SectorOffset, error) //perm:write

StorageInit(ctx context.Context, path string, opts storiface.LocalStorageMeta) error //perm:admin
StorageAddLocal(ctx context.Context, path string) error //perm:admin
StorageDetachLocal(ctx context.Context, path string) error //perm:admin
StorageList(ctx context.Context) (map[storiface.ID][]storiface.Decl, error) //perm:admin
Expand All @@ -25,6 +26,9 @@ type Curio interface {
StorageInfo(context.Context, storiface.ID) (storiface.StorageInfo, error) //perm:admin
StorageFindSector(ctx context.Context, sector abi.SectorID, ft storiface.SectorFileType, ssize abi.SectorSize, allowFetch bool) ([]storiface.SectorStorageInfo, error) //perm:admin

LogList(ctx context.Context) ([]string, error) //perm:read
LogSetLevel(ctx context.Context, subsystem, level string) error //perm:admin

// Trigger shutdown
Shutdown(context.Context) error //perm:admin
}
2 changes: 1 addition & 1 deletion api/api_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ type FullNode interface {
WalletVerify(context.Context, address.Address, []byte, *crypto.Signature) (bool, error) //perm:read
// WalletDefaultAddress returns the address marked as default in the wallet.
WalletDefaultAddress(context.Context) (address.Address, error) //perm:write
// WalletSetDefault marks the given address as as the default one.
// WalletSetDefault marks the given address as the default one.
WalletSetDefault(context.Context, address.Address) error //perm:write
// WalletExport returns the private key of an address in the wallet.
WalletExport(context.Context, address.Address) (*types.KeyInfo, error) //perm:admin
Expand Down
2 changes: 2 additions & 0 deletions api/api_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ type Gateway interface {
Version(context.Context) (APIVersion, error)
Discover(context.Context) (apitypes.OpenRPCDocument, error)

EthAddressToFilecoinAddress(ctx context.Context, ethAddress ethtypes.EthAddress) (address.Address, error)
FilecoinAddressToEthAddress(ctx context.Context, filecoinAddress address.Address) (ethtypes.EthAddress, error)
EthAccounts(ctx context.Context) ([]ethtypes.EthAddress, error)
EthBlockNumber(ctx context.Context) (ethtypes.EthUint64, error)
EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum ethtypes.EthUint64) (ethtypes.EthUint64, error)
Expand Down
Loading

0 comments on commit c4df82c

Please sign in to comment.