diff --git a/.gitmodules b/.gitmodules index a5162bd71..c05da4f38 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,6 @@ [submodule "extern/go-sectorbuilder"] path = extern/go-sectorbuilder url = https://github.com/filecoin-project/go-sectorbuilder -[submodule "extern/proofs/rust-fil-proofs"] - path = extern/proofs/rust-fil-proofs - url = git@github.com:filecoin-project/rust-fil-proofs.git +[submodule "extern/go-fil-proofs"] + path = extern/go-fil-proofs + url = git@github.com:filecoin-project/go-fil-proofs.git diff --git a/Makefile b/Makefile index 5a087c129..ddf325607 100644 --- a/Makefile +++ b/Makefile @@ -41,9 +41,9 @@ CLEAN+=build/.sector-builder-install ## PROOFS -PROOFS_PATH:=extern/proofs/ +PROOFS_PATH:=extern/go-fil-proofs/ PROOFS_DEPS:=bin/paramcache bin/paramfetch misc/parameters.json -PROOFS_DEPS:=$(addprefix $(SECTOR_BUILDER_PATH),$(SECTOR_BUILDER_DEPS)) +PROOFS_DEPS:=$(addprefix $(PROOFS_PATH),$(PROOFS_DEPS)) $(PROOFS_DEPS): build/.proofs-install ; @@ -55,6 +55,16 @@ MODULES+=$(PROOFS_PATH) BUILD_DEPS+=build/.proofs-install CLEAN+=build/.proofs-install +PARAM_SECTOR_SIZES:=1024 268435456 +PARAM_SECTOR_SIZES:=$(addprefix params-,$(PARAM_SECTOR_SIZES)) + +$(PARAM_SECTOR_SIZES): extern/go-fil-proofs/bin/paramfetch extern/go-fil-proofs/misc/parameters.json + ./extern/go-fil-proofs/bin/paramfetch -z $(subst params-,,$@) --verbose --json=./extern/go-fil-proofs/misc/parameters.json +.PHONY: $(PARAM_SECTOR_SIZES) + +paramcache: extern/go-fil-proofs/bin/paramcache + RUST_LOG=info ./extern/go-fil-proofs/bin/paramcache + # end git modules $(MODULES): build/.update-modules ; @@ -82,6 +92,8 @@ pond: build clean: rm -rf $(CLEAN) -$(MAKE) -C $(BLS_PATH) clean + -$(MAKE) -C $(SECTOR_BUILDER_PATH) clean + -$(MAKE) -C $(PROOFS_PATH) clean .PHONY: clean dist-clean: diff --git a/build/params.go b/build/params.go index 21c102e9f..5160b2725 100644 --- a/build/params.go +++ b/build/params.go @@ -5,6 +5,6 @@ package build const UnixfsChunkSize uint64 = 1 << 20 const UnixfsLinksPerLevel = 1024 -const SectorSize = 16 << 20 +const SectorSize = 268435456 // TODO: Move other important consts here diff --git a/extern/go-fil-proofs b/extern/go-fil-proofs new file mode 160000 index 000000000..5201fa9a4 --- /dev/null +++ b/extern/go-fil-proofs @@ -0,0 +1 @@ +Subproject commit 5201fa9a47494a673da4322dffdf20b7bc335acb diff --git a/extern/proofs/Makefile b/extern/proofs/Makefile deleted file mode 100644 index 33bc829f7..000000000 --- a/extern/proofs/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -DEPS:=bin/paramcache bin/paramfetch misc/parameters.json - -all: $(DEPS) -.PHONY: all - -$(DEPS): .install-fil-proofs ; - -.install-fil-proofs: bls-signatures - ./install-proofs - @touch $@ - -clean: - rm -rf $(DEPS) .install-bls -.PHONY: clean diff --git a/extern/proofs/bin/.keep b/extern/proofs/bin/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/extern/proofs/install-proofs b/extern/proofs/install-proofs deleted file mode 100644 index f1de838ad..000000000 --- a/extern/proofs/install-proofs +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -set -Eeo pipefail - -# shellcheck source=install-shared.bash -source "$(dirname "${BASH_SOURCE[0]}")/install-shared.bash" - -subm_dir="rust-fil-proofs" - -git submodule update --init --recursive ${subm_dir} - -if download_release_tarball tarball_path "${subm_dir}"; then - tmp_dir=$(mktemp -d) - tar -C "$tmp_dir" -xzf "$tarball_path" - - mkdir -p bin - mkdir -p misc - - cp -R "${tmp_dir}/bin/*" bin - cp -R "${tmp_dir}/misc/*" misc -else - echo "failed to find or obtain precompiled assets for ${subm_dir}, falling back to local build" - build_from_source "${subm_dir}" - - mkdir -p bin - mkdir -p misc - - find "${subm_dir}" -type f -name parameters.json -exec mv -- "{}" ./misc/ \; - find "${subm_dir}" -type f -name paramcache -exec cp -- "{}" ./bin/ \; - find "${subm_dir}" -type f -name paramfetch -exec cp -- "{}" ./bin/ \; -fi \ No newline at end of file diff --git a/extern/proofs/install-shared.sh b/extern/proofs/install-shared.sh deleted file mode 100644 index 3c026bc81..000000000 --- a/extern/proofs/install-shared.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env bash - -download_release_tarball() { - __resultvar=$1 - __submodule_path=$2 - __repo_name=$(echo "$__submodule_path" | cut -d '/' -f 2) - __release_name="${__repo_name}-$(uname)" - __release_sha1=$(git rev-parse @:"${__submodule_path}") - __release_tag="${__release_sha1:0:16}" - __release_tag_url="https://api.github.com/repos/filecoin-project/${__repo_name}/releases/tags/${__release_tag}" - - echo "acquiring release @ ${__release_tag}" - - __release_response=$(curl \ - --retry 3 \ - --location "$__release_tag_url") - - __release_url=$(echo "$__release_response" | jq -r ".assets[] | select(.name | contains(\"${__release_name}\")) | .url") - - if [[ -z "$__release_url" ]]; then - (>&2 echo "failed to download release (tag URL: ${__release_tag_url}, response: ${__release_response})") - return 1 - fi - - __tar_path="/tmp/${__release_name}_$(basename "${__release_url}").tar.gz" - - if [[ ! -f "${__tar_path}" ]]; then - __asset_url=$(curl \ - --head \ - --retry 3 \ - --header "Accept:application/octet-stream" \ - --location \ - --output /dev/null \ - -w "%{url_effective}" \ - "$__release_url") - - curl --retry 3 --output "${__tar_path}" "$__asset_url" - if [[ $? -ne "0" ]]; then - (>&2 echo "failed to download release asset (tag URL: ${__release_tag_url}, asset URL: ${__asset_url})") - return 1 - fi - fi - - eval $__resultvar="'$__tar_path'" -} - -build_from_source() { - __submodule_path=$1 - __submodule_sha1=$(git rev-parse @:"${__submodule_path}") - __submodule_sha1_truncated="${__submodule_sha1:0:16}" - - echo "building from source @ ${__submodule_sha1_truncated}" - - if ! [ -x "$(command -v cargo)" ]; then - (>&2 echo 'Error: cargo is not installed.') - (>&2 echo 'Install Rust toolchain to resolve this problem.') - exit 1 - fi - - if ! [ -x "$(command -v rustup)" ]; then - (>&2 echo 'Error: rustup is not installed.') - (>&2 echo 'Install Rust toolchain installer to resolve this problem.') - exit 1 - fi - - if ! pushd "$__submodule_path"; then - (>&2 echo 'Error: could not cd into submodule') - exit 1 - fi - - - cargo --version - cargo update - - if [[ -f "./build-release.sh" ]]; then - ./build-release.sh "$(cat rust-toolchain)" - else - cargo build --release --all - fi - - popd || exit 1 -} diff --git a/extern/proofs/misc/.keep b/extern/proofs/misc/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/extern/proofs/rust-fil-proofs b/extern/proofs/rust-fil-proofs deleted file mode 160000 index 8ef99ff86..000000000 --- a/extern/proofs/rust-fil-proofs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8ef99ff867bd0c60acbaae6b4fe4214066936c78