diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 543b17dd8cd..e7e9d30a813 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,6 @@ name: Build on: - pull_request: push: branches: - master diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6c848221994..022cef93193 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,7 +1,6 @@ name: Check on: - pull_request: push: branches: - master diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b2a1551b70d..26c5c9e9db9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,6 @@ name: Test on: - pull_request: push: branches: - master diff --git a/Makefile b/Makefile index 1a81ed4f08b..8930fffd13d 100644 --- a/Makefile +++ b/Makefile @@ -1,386 +1,10 @@ SHELL=/usr/bin/env bash -all: build -.PHONY: all - -unexport GOFLAGS - -GOCC?=go - -GOVERSION:=$(shell $(GOCC) version | tr ' ' '\n' | grep go1 | sed 's/^go//' | awk -F. '{printf "%d%03d%03d", $$1, $$2, $$3}') -GOVERSIONMIN:=$(shell cat GO_VERSION_MIN | awk -F. '{printf "%d%03d%03d", $$1, $$2, $$3}') - -ifeq ($(shell expr $(GOVERSION) \< $(GOVERSIONMIN)), 1) -$(warning Your Golang version is go$(shell expr $(GOVERSION) / 1000000).$(shell expr $(GOVERSION) % 1000000 / 1000).$(shell expr $(GOVERSION) % 1000)) -$(error Update Golang to version to at least $(shell cat GO_VERSION_MIN)) -endif - -# git modules that need to be loaded -MODULES:= - -CLEAN:= -BINS:= - -ldflags=-X=github.com/filecoin-project/lotus/build.CurrentCommit=+git.$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)) -ifneq ($(strip $(LDFLAGS)),) - ldflags+=-extldflags=$(LDFLAGS) -endif - -GOFLAGS+=-ldflags="$(ldflags)" - - -## FFI - -FFI_PATH:=extern/filecoin-ffi/ -FFI_DEPS:=.install-filcrypto -FFI_DEPS:=$(addprefix $(FFI_PATH),$(FFI_DEPS)) - -$(FFI_DEPS): build/.filecoin-install ; - -build/.filecoin-install: $(FFI_PATH) - $(MAKE) -C $(FFI_PATH) $(FFI_DEPS:$(FFI_PATH)%=%) - @touch $@ - -MODULES+=$(FFI_PATH) -BUILD_DEPS+=build/.filecoin-install -CLEAN+=build/.filecoin-install - -ffi-version-check: - @[[ "$$(awk '/const Version/{print $$5}' extern/filecoin-ffi/version.go)" -eq 3 ]] || (echo "FFI version mismatch, update submodules"; exit 1) -BUILD_DEPS+=ffi-version-check - -.PHONY: ffi-version-check - -$(MODULES): build/.update-modules ; -# dummy file that marks the last time modules were updated -build/.update-modules: - git submodule update --init --recursive - touch $@ - -# end git modules - -## MAIN BINARIES - -CLEAN+=build/.update-modules - -deps: $(BUILD_DEPS) -.PHONY: deps - -build-devnets: build lotus-seed lotus-shed -.PHONY: build-devnets - -debug: GOFLAGS+=-tags=debug -debug: build-devnets - -2k: GOFLAGS+=-tags=2k -2k: build-devnets - -calibnet: GOFLAGS+=-tags=calibnet -calibnet: build-devnets - -butterflynet: GOFLAGS+=-tags=butterflynet -butterflynet: build-devnets - -interopnet: GOFLAGS+=-tags=interopnet -interopnet: build-devnets - -lotus: $(BUILD_DEPS) - rm -f lotus - $(GOCC) build $(GOFLAGS) -o lotus ./cmd/lotus - -.PHONY: lotus -BINS+=lotus - -lotus-miner: $(BUILD_DEPS) - rm -f lotus-miner - $(GOCC) build $(GOFLAGS) -o lotus-miner ./cmd/lotus-miner -.PHONY: lotus-miner -BINS+=lotus-miner - -lotus-worker: $(BUILD_DEPS) - rm -f lotus-worker - $(GOCC) build $(GOFLAGS) -o lotus-worker ./cmd/lotus-worker -.PHONY: lotus-worker -BINS+=lotus-worker - -lotus-shed: $(BUILD_DEPS) - rm -f lotus-shed - $(GOCC) build $(GOFLAGS) -o lotus-shed ./cmd/lotus-shed -.PHONY: lotus-shed -BINS+=lotus-shed - -lotus-gateway: $(BUILD_DEPS) - rm -f lotus-gateway - $(GOCC) build $(GOFLAGS) -o lotus-gateway ./cmd/lotus-gateway -.PHONY: lotus-gateway -BINS+=lotus-gateway - -build: lotus lotus-miner lotus-worker - @[[ $$(type -P "lotus") ]] && echo "Caution: you have \ -an existing lotus binary in your PATH. This may cause problems if you don't run 'sudo make install'" || true - -.PHONY: build - -install: install-daemon install-miner install-worker - -install-daemon: - install -C ./lotus /usr/local/bin/lotus - -install-miner: - install -C ./lotus-miner /usr/local/bin/lotus-miner - -install-worker: - install -C ./lotus-worker /usr/local/bin/lotus-worker - -install-app: - install -C ./$(APP) /usr/local/bin/$(APP) - -uninstall: uninstall-daemon uninstall-miner uninstall-worker -.PHONY: uninstall - -uninstall-daemon: - rm -f /usr/local/bin/lotus - -uninstall-miner: - rm -f /usr/local/bin/lotus-miner - -uninstall-worker: - rm -f /usr/local/bin/lotus-worker - -# TOOLS - -lotus-seed: $(BUILD_DEPS) - rm -f lotus-seed - $(GOCC) build $(GOFLAGS) -o lotus-seed ./cmd/lotus-seed - -.PHONY: lotus-seed -BINS+=lotus-seed - -benchmarks: - $(GOCC) run github.com/whyrusleeping/bencher ./... > bench.json - @echo Submitting results - @curl -X POST 'http://benchmark.kittyhawk.wtf/benchmark' -d '@bench.json' -u "${benchmark_http_cred}" -.PHONY: benchmarks - -lotus-fountain: - rm -f lotus-fountain - $(GOCC) build $(GOFLAGS) -o lotus-fountain ./cmd/lotus-fountain - $(GOCC) run github.com/GeertJohan/go.rice/rice append --exec lotus-fountain -i ./cmd/lotus-fountain -i ./build -.PHONY: lotus-fountain -BINS+=lotus-fountain - -lotus-bench: - rm -f lotus-bench - $(GOCC) build $(GOFLAGS) -o lotus-bench ./cmd/lotus-bench -.PHONY: lotus-bench -BINS+=lotus-bench - -lotus-stats: - rm -f lotus-stats - $(GOCC) build $(GOFLAGS) -o lotus-stats ./cmd/lotus-stats -.PHONY: lotus-stats -BINS+=lotus-stats - -lotus-pcr: - rm -f lotus-pcr - $(GOCC) build $(GOFLAGS) -o lotus-pcr ./cmd/lotus-pcr -.PHONY: lotus-pcr -BINS+=lotus-pcr - -lotus-health: - rm -f lotus-health - $(GOCC) build -o lotus-health ./cmd/lotus-health -.PHONY: lotus-health -BINS+=lotus-health - -lotus-wallet: $(BUILD_DEPS) - rm -f lotus-wallet - $(GOCC) build $(GOFLAGS) -o lotus-wallet ./cmd/lotus-wallet -.PHONY: lotus-wallet -BINS+=lotus-wallet - -lotus-keygen: - rm -f lotus-keygen - $(GOCC) build -o lotus-keygen ./cmd/lotus-keygen -.PHONY: lotus-keygen -BINS+=lotus-keygen - -testground: - $(GOCC) build -tags testground -o /dev/null ./cmd/lotus -.PHONY: testground -BINS+=testground - - -tvx: - rm -f tvx - $(GOCC) build -o tvx ./cmd/tvx -.PHONY: tvx -BINS+=tvx - -lotus-sim: $(BUILD_DEPS) - rm -f lotus-sim - $(GOCC) build $(GOFLAGS) -o lotus-sim ./cmd/lotus-sim -.PHONY: lotus-sim -BINS+=lotus-sim - -# SYSTEMD - -install-daemon-service: install-daemon - mkdir -p /etc/systemd/system - mkdir -p /var/log/lotus - install -C -m 0644 ./scripts/lotus-daemon.service /etc/systemd/system/lotus-daemon.service - systemctl daemon-reload - @echo - @echo "lotus-daemon service installed." - @echo "To start the service, run: 'sudo systemctl start lotus-daemon'" - @echo "To enable the service on startup, run: 'sudo systemctl enable lotus-daemon'" - -install-miner-service: install-miner install-daemon-service - mkdir -p /etc/systemd/system - mkdir -p /var/log/lotus - install -C -m 0644 ./scripts/lotus-miner.service /etc/systemd/system/lotus-miner.service - systemctl daemon-reload - @echo - @echo "lotus-miner service installed." - @echo "To start the service, run: 'sudo systemctl start lotus-miner'" - @echo "To enable the service on startup, run: 'sudo systemctl enable lotus-miner'" - -install-main-services: install-miner-service - -install-all-services: install-main-services - -install-services: install-main-services - -clean-daemon-service: clean-miner-service - -systemctl stop lotus-daemon - -systemctl disable lotus-daemon - rm -f /etc/systemd/system/lotus-daemon.service - systemctl daemon-reload - -clean-miner-service: - -systemctl stop lotus-miner - -systemctl disable lotus-miner - rm -f /etc/systemd/system/lotus-miner.service - systemctl daemon-reload - -clean-main-services: clean-daemon-service - -clean-all-services: clean-main-services - -clean-services: clean-all-services - -# MISC - -buildall: $(BINS) - -install-completions: - mkdir -p /usr/share/bash-completion/completions /usr/local/share/zsh/site-functions/ - install -C ./scripts/bash-completion/lotus /usr/share/bash-completion/completions/lotus - install -C ./scripts/zsh-completion/lotus /usr/local/share/zsh/site-functions/_lotus - -unittests: - @$(GOCC) test $(shell go list ./... | grep -v /lotus/itests) -.PHONY: unittests - -clean: - rm -rf $(CLEAN) $(BINS) - -$(MAKE) -C $(FFI_PATH) clean -.PHONY: clean - -dist-clean: - git clean -xdff - git submodule deinit --all -f -.PHONY: dist-clean - -type-gen: api-gen - $(GOCC) run ./gen/main.go - $(GOCC) generate -x ./... - goimports -w api/ - -actors-code-gen: - $(GOCC) run ./gen/inline-gen . gen/inlinegen-data.json - $(GOCC) run ./chain/actors/agen - $(GOCC) fmt ./... - -actors-gen: actors-code-gen - $(GOCC) run ./scripts/fiximports -.PHONY: actors-gen - -bundle-gen: - $(GOCC) run ./gen/bundle $(VERSION) $(RELEASE) $(RELEASE_OVERRIDES) - $(GOCC) fmt ./build/... -.PHONY: bundle-gen - - -api-gen: - $(GOCC) run ./gen/api - goimports -w api - goimports -w api -.PHONY: api-gen - -cfgdoc-gen: - $(GOCC) run ./node/config/cfgdocgen > ./node/config/doc_gen.go - -appimage: lotus - rm -rf appimage-builder-cache || true - rm AppDir/io.filecoin.lotus.desktop || true - rm AppDir/icon.svg || true - rm Appdir/AppRun || true - mkdir -p AppDir/usr/bin - cp ./lotus AppDir/usr/bin/ - appimage-builder - -docsgen: docsgen-md docsgen-openrpc fiximports - -docsgen-md-bin: api-gen actors-gen - $(GOCC) build $(GOFLAGS) -o docgen-md ./api/docgen/cmd -docsgen-openrpc-bin: api-gen actors-gen - $(GOCC) build $(GOFLAGS) -o docgen-openrpc ./api/docgen-openrpc/cmd - -docsgen-md: docsgen-md-full docsgen-md-storage docsgen-md-worker - -docsgen-md-full: docsgen-md-bin - ./docgen-md "api/api_full.go" "FullNode" "api" "./api" > documentation/en/api-v1-unstable-methods.md - ./docgen-md "api/v0api/full.go" "FullNode" "v0api" "./api/v0api" > documentation/en/api-v0-methods.md -docsgen-md-storage: docsgen-md-bin - ./docgen-md "api/api_storage.go" "StorageMiner" "api" "./api" > documentation/en/api-v0-methods-miner.md -docsgen-md-worker: docsgen-md-bin - ./docgen-md "api/api_worker.go" "Worker" "api" "./api" > documentation/en/api-v0-methods-worker.md - -docsgen-openrpc: docsgen-openrpc-full docsgen-openrpc-storage docsgen-openrpc-worker docsgen-openrpc-gateway - -docsgen-openrpc-full: docsgen-openrpc-bin - ./docgen-openrpc "api/api_full.go" "FullNode" "api" "./api" > build/openrpc/full.json -docsgen-openrpc-storage: docsgen-openrpc-bin - ./docgen-openrpc "api/api_storage.go" "StorageMiner" "api" "./api" > build/openrpc/miner.json -docsgen-openrpc-worker: docsgen-openrpc-bin - ./docgen-openrpc "api/api_worker.go" "Worker" "api" "./api" > build/openrpc/worker.json -docsgen-openrpc-gateway: docsgen-openrpc-bin - ./docgen-openrpc "api/api_gateway.go" "Gateway" "api" "./api" > build/openrpc/gateway.json - -.PHONY: docsgen docsgen-md-bin docsgen-openrpc-bin - -fiximports: - $(GOCC) run ./scripts/fiximports - -gen: actors-code-gen type-gen cfgdoc-gen docsgen api-gen - $(GOCC) run ./scripts/fiximports - @echo ">>> IF YOU'VE MODIFIED THE CLI OR CONFIG, REMEMBER TO ALSO RUN 'make docsgen-cli'" -.PHONY: gen - -jen: gen - -snap: lotus lotus-miner lotus-worker - snapcraft - # snapcraft upload ./lotus_*.snap - -# separate from gen because it needs binaries -docsgen-cli: lotus lotus-miner lotus-worker - python3 ./scripts/generate-lotus-cli.py - ./lotus config default > documentation/en/default-lotus-config.toml - ./lotus-miner config default > documentation/en/default-lotus-miner-config.toml -.PHONY: docsgen-cli - -print-%: - @echo $*=$($*) - +%: + @echo -e "### ⚠️⚠️⚠️ NOTICE ⚠️⚠️⚠️ ###\n" \ + "The 'releases' branch has been deprecated with the 202408 split of 'Lotus Node' and 'Lotus Miner'.\n" \ + "See https://github.com/filecoin-project/lotus/blob/master/LOTUS_RELEASE_FLOW.md for more info and alternatives.\n" \ + "----------------------" | tee /dev/stderr + @exit 1 + +.PHONY: % \ No newline at end of file diff --git a/README.md b/README.md index 0839e2f6b24..3877e3bac58 100644 --- a/README.md +++ b/README.md @@ -1,141 +1,3 @@ -

- - Project Lotus Logo - -

- -

Project Lotus - 莲

- -

- - - - - -
-

- -Lotus is an implementation of the Filecoin Distributed Storage Network. For more details about Filecoin, check out the [Filecoin Spec](https://spec.filecoin.io). - -## Building & Documentation - -> Note: The default `master` branch is the dev branch, please use with caution. For the latest stable version, checkout the most recent [`Latest release`](https://github.com/filecoin-project/lotus/releases). - -For complete instructions on how to build, install and setup lotus, please visit [https://lotus.filecoin.io](https://lotus.filecoin.io/lotus/install/prerequisites/#supported-platforms). Basic build instructions can be found further down in this readme. - -## Reporting a Vulnerability - -Please send an email to security@filecoin.org. See our [security policy](SECURITY.md) for more details. - -## Related packages - -These repos are independent and reusable modules, but are tightly integrated into Lotus to make up a fully featured Filecoin implementation: - -- [go-fil-markets](https://github.com/filecoin-project/go-fil-markets) which has its own [kanban work tracker available here](https://app.zenhub.com/workspaces/markets-shared-components-5daa144a7046a60001c6e253/board) -- [builtin-actors](https://github.com/filecoin-project/builtin-actors) - -## Contribute - -Lotus is a universally open project and welcomes contributions of all kinds: code, docs, and more. However, before making a contribution, we ask you to heed these recommendations: - -1. If the proposal entails a protocol change, please first submit a [Filecoin Improvement Proposal](https://github.com/filecoin-project/FIPs). -2. If the change is complex and requires prior discussion, [open an issue](github.com/filecoin-project/lotus/issues) or a [discussion](https://github.com/filecoin-project/lotus/discussions) to request feedback before you start working on a pull request. This is to avoid disappointment and sunk costs, in case the change is not actually needed or accepted. -3. Please refrain from submitting PRs to adapt existing code to subjective preferences. The changeset should contain functional or technical improvements/enhancements, bug fixes, new features, or some other clear material contribution. Simple stylistic changes are likely to be rejected in order to reduce code churn. - -When implementing a change: - -1. Adhere to the standard Go formatting guidelines, e.g. [Effective Go](https://golang.org/doc/effective_go.html). Run `go fmt`. -2. Stick to the idioms and patterns used in the codebase. Familiar-looking code has a higher chance of being accepted than eerie code. Pay attention to commonly used variable and parameter names, avoidance of naked returns, error handling patterns, etc. -3. Comments: follow the advice on the [Commentary](https://golang.org/doc/effective_go.html#commentary) section of Effective Go. -4. Minimize code churn. Modify only what is strictly necessary. Well-encapsulated changesets will get a quicker response from maintainers. -5. Lint your code with [`golangci-lint`](https://golangci-lint.run) (CI will reject your PR if unlinted). -6. Add tests. -7. Title the PR in a meaningful way and describe the rationale and the thought process in the PR description. -8. Write clean, thoughtful, and detailed [commit messages](https://chris.beams.io/posts/git-commit/). This is even more important than the PR description, because commit messages are stored _inside_ the Git history. One good rule is: if you are happy posting the commit message as the PR description, then it's a good commit message. - -## Basic Build Instructions -**System-specific Software Dependencies**: - -Building Lotus requires some system dependencies, usually provided by your distribution. - -Ubuntu/Debian: -``` -sudo apt install mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl clang build-essential hwloc libhwloc-dev wget -y && sudo apt upgrade -y -``` - -Fedora: -``` -sudo dnf -y install gcc make git bzr jq pkgconfig mesa-libOpenCL mesa-libOpenCL-devel opencl-headers ocl-icd ocl-icd-devel clang llvm wget hwloc hwloc-devel -``` - -For other distributions you can find the required dependencies [here.](https://lotus.filecoin.io/lotus/install/prerequisites/#supported-platforms) For instructions specific to macOS, you can find them [here.](https://lotus.filecoin.io/lotus/install/macos/) - -#### Go - -To build Lotus, you need a working installation of [Go 1.21.7 or higher](https://golang.org/dl/): - -```bash -wget -c https://golang.org/dl/go1.21.7.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local -``` - -**TIP:** -You'll need to add `/usr/local/go/bin` to your path. For most Linux distributions you can run something like: - -```shell -echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc && source ~/.bashrc -``` - -See the [official Golang installation instructions](https://golang.org/doc/install) if you get stuck. - -### Build and install Lotus - -Once all the dependencies are installed, you can build and install the Lotus suite (`lotus`, `lotus-miner`, and `lotus-worker`). - -1. Clone the repository: - - ```sh - git clone https://github.com/filecoin-project/lotus.git - cd lotus/ - ``` - -Note: The default branch `master` is the dev branch where the latest new features, bug fixes and improvement are in. However, if you want to run lotus on Filecoin mainnet and want to run a production-ready lotus, get the latest release[ here](https://github.com/filecoin-project/lotus/releases). - -2. To join mainnet, checkout the [latest release](https://github.com/filecoin-project/lotus/releases). - - If you are changing networks from a previous Lotus installation or there has been a network reset, read the [Switch networks guide](https://lotus.filecoin.io/lotus/manage/switch-networks/) before proceeding. - - For networks other than mainnet, look up the current branch or tag/commit for the network you want to join in the [Filecoin networks dashboard](https://network.filecoin.io), then build Lotus for your specific network below. - - ```sh - git checkout - # For example: - git checkout # tag for a release - ``` - - Currently, the latest code on the _master_ branch corresponds to mainnet. - -3. If you are in China, see "[Lotus: tips when running in China](https://lotus.filecoin.io/lotus/configure/nodes-in-china/)". -4. This build instruction uses the prebuilt proofs binaries. If you want to build the proof binaries from source check the [complete instructions](https://lotus.filecoin.io/lotus/install/prerequisites/). Note, if you are building the proof binaries from source, [installing rustup](https://lotus.filecoin.io/lotus/install/linux/#rustup) is also needed. - -5. Build and install Lotus: - - ```sh - make clean all #mainnet - - # Or to join a testnet or devnet: - make clean calibnet # Calibration with min 32GiB sectors - - sudo make install - ``` - - This will put `lotus`, `lotus-miner` and `lotus-worker` in `/usr/local/bin`. - - `lotus` will use the `$HOME/.lotus` folder by default for storage (configuration, chain data, wallets, etc). See [advanced options](https://lotus.filecoin.io/lotus/configure/defaults/#environment-variables) for information on how to customize the Lotus folder. - -6. You should now have Lotus installed. You can now [start the Lotus daemon and sync the chain](https://lotus.filecoin.io/lotus/install/linux/#start-the-lotus-daemon-and-sync-the-chain). - -7. (Optional) Follow the [Setting Up Prometheus and Grafana](https://github.com/filecoin-project/lotus/tree/master/metrics/README.md) guide for detailed instructions on setting up a working monitoring system running against a local running lotus node. - -## License - -Dual-licensed under [MIT](https://github.com/filecoin-project/lotus/blob/master/LICENSE-MIT) + [Apache 2.0](https://github.com/filecoin-project/lotus/blob/master/LICENSE-APACHE) +> [!IMPORTANT] +> # Branch Deprecated +> The `releases` branch is now deprecated with the separated releasing of `Lotus Node` and `Lotus Miner`. Please see https://github.com/filecoin-project/lotus/blob/master/LOTUS_RELEASE_FLOW.md for more info and alternatives. \ No newline at end of file