Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .config/forest.dic
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
303
304
ABI
Algorand/M
API's
Expand Down Expand Up @@ -64,6 +64,7 @@ coreos
CPUs
cron
crypto
Curio
daemon
daemonize
Datacap
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lotus-api-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
for env in ./scripts/tests/api_compare/.env ./scripts/tests/bootstrapper/.env ./scripts/tests/snapshot_parity/.env; do
sed -i "s/\(LOTUS_IMAGE=filecoin.*\):.*/\1:$TAG-calibnet/" "$env"
done
for env in ./scripts/devnet/.env ./scripts/devnet-forest-miner/.env; do
for env in ./scripts/devnet/.env ./scripts/devnet-forest-miner/.env ./scripts/devnet-forest-curio/.env; do
sed -i "s/\(LOTUS_IMAGE=filecoin.*\):.*/\1:$TAG-2k/" "$env"
done
else
Expand Down
46 changes: 38 additions & 8 deletions .github/workflows/miner-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,20 @@ jobs:
if-no-files-found: error

miner-tests:
name: Miner integration tests (${{ matrix.group }})
name: Miner integration tests (${{ matrix.devnet }}, ${{ matrix.group }})
needs: build
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
# The `forest-dev devnet miner --group` values. Add groups as more Lotus itests are ported.
# Add groups as more Lotus itests are ported; both stacks run every group.
group: [onboarding]
devnet: [devnet-forest-miner, devnet-forest-curio]
env:
# We use a custom Dockerfile for CI to speed up the build process.
FOREST_DOCKERFILE_OVERRIDE: scripts/devnet/forest_ci.dockerfile
MINER_TEST_GROUP: ${{ matrix.group }}
DEVNET_DIR: scripts/${{ matrix.devnet }}
steps:
- uses: actions/cache@v6
id: cache
Expand All @@ -98,23 +100,51 @@ jobs:
- name: Load cache into volume
if: steps.cache.outputs.cache-hit == 'true'
run: |
docker volume create devnet-forest-miner_filecoin-proofs
docker volume create "${{ matrix.devnet }}_filecoin-proofs"
docker run --rm \
-v devnet-forest-miner_filecoin-proofs:/proofs \
-v "${{ matrix.devnet }}_filecoin-proofs":/proofs \
-v "$FIL_PROOFS_PARAMETER_CACHE":/cache \
"$SHELL_IMAGE" \
sh -c "cp /cache/* /proofs"
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Read Curio commit
if: matrix.devnet == 'devnet-forest-curio'
run: |
CURIO_COMMIT=$(grep -E '^CURIO_COMMIT=' scripts/devnet-forest-curio/.env | cut -d= -f2)
echo "CURIO_COMMIT=${CURIO_COMMIT}" >> "$GITHUB_ENV"
- name: Restore Curio image cache
if: matrix.devnet == 'devnet-forest-curio'
id: curio-cache
uses: actions/cache/restore@v6
with:
path: /tmp/curio-image
key: curio-image-${{ env.CURIO_COMMIT }}-${{ hashFiles('scripts/devnet-forest-curio/curio.dockerfile') }}
- name: Load Curio image
if: matrix.devnet == 'devnet-forest-curio' && steps.curio-cache.outputs.cache-hit == 'true'
run: docker load -i /tmp/curio-image/curio.tar
- name: Build Curio image
if: matrix.devnet == 'devnet-forest-curio' && steps.curio-cache.outputs.cache-hit != 'true'
run: |
mkdir -p /tmp/curio-image
./scripts/devnet-forest-curio/build_image.sh
docker save "forest/curio-devnet:${CURIO_COMMIT}" -o /tmp/curio-image/curio.tar
timeout-minutes: 45
- name: Save Curio image cache
if: matrix.devnet == 'devnet-forest-curio' && steps.curio-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: /tmp/curio-image
key: curio-image-${{ env.CURIO_COMMIT }}-${{ hashFiles('scripts/devnet-forest-curio/curio.dockerfile') }}
- uses: actions/download-artifact@v8
with:
name: "forest-${{ runner.os }}"
- name: Devnet setup
run: ./scripts/devnet-forest-miner/setup.sh
run: ./${{ env.DEVNET_DIR }}/setup.sh
timeout-minutes: ${{ fromJSON(env.SCRIPT_TIMEOUT_MINUTES) }}
- name: Devnet check
run: ./scripts/devnet-forest-miner/check.sh
run: ./${{ env.DEVNET_DIR }}/check.sh
timeout-minutes: ${{ fromJSON(env.SCRIPT_TIMEOUT_MINUTES) }}
- name: Add forest binaries to PATH
run: |
Expand All @@ -123,7 +153,7 @@ jobs:
- name: Miner tests
run: |
set -euo pipefail
export DEVNET_DIR=scripts/devnet-forest-miner
export DEVNET_DIR="${{ env.DEVNET_DIR }}"
source ./scripts/devnet/test_harness.sh
devnet_test_env_init
forest-dev devnet miner --group "$MINER_TEST_GROUP"
Expand All @@ -135,7 +165,7 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: |
docker run --rm \
-v devnet-forest-miner_filecoin-proofs:/proofs \
-v "${{ matrix.devnet }}_filecoin-proofs":/proofs \
-v "$FIL_PROOFS_PARAMETER_CACHE":/cache \
"$SHELL_IMAGE" \
sh -c "cp /proofs/* /cache"
Expand Down
11 changes: 8 additions & 3 deletions docs/docs/users/guides/running_with_curio.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ title: Running Forest With Curio
sidebar_position: 99
---

:::note
[Curio](https://curiostorage.org/) is the successor to Lotus Miner. Forest can act as Curio's chain node (the same "Forest, Curio, YugabyteDB" layout Curio documents).

[Curio](https://curiostorage.org/) is the successor to Lotus-miner under active development by Curio Storage Inc. Compatibility with Forest is not yet confirmed.
Compatibility was checked against **Curio v1.29.0** on the local stack in [`scripts/devnet-forest-curio`](https://github.com/ChainSafe/forest/tree/main/scripts/devnet-forest-curio):

:::
- Put an admin token in `FULLNODE_API_INFO` and keep the miner worker key in Forest's wallet (`MinerCreateBlock` and message signing use it).
- On a private network, the genesis name must start with `local` or `test` (Curio drops other chain nodes). The stack uses `localnet`.

```shell
mise run test:devnet:miner:curio
```
4 changes: 4 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ run = "scripts/devnet/with_devnet.sh scripts/devnet-forest-miner devnet_integrat
description = "Run the Lotus Miner integration tests against the Forest-produced local docker devnet."
run = "scripts/devnet/with_devnet.sh scripts/devnet-forest-miner forest-dev devnet miner"

[tasks."test:devnet:miner:curio"]
description = "Run the miner integration tests against the Forest-produced Curio docker devnet."
run = "scripts/devnet/with_devnet.sh scripts/devnet-forest-curio forest-dev devnet miner"

[tasks."codecov:nextest"]
description = "Run codecov with nextest"
run = '''
Expand Down
32 changes: 32 additions & 0 deletions scripts/devnet-forest-curio/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
LOTUS_IMAGE=filecoin/lotus-all-in-one:v1.38.3-2k
# Curio rejects chain nodes whose network name does not start with local or test.
NETWORK_NAME=localnet
FOREST_DATA_DIR=/forest_data
LOTUS_DATA_DIR=/lotus_data
FIL_PROOFS_PARAMETER_CACHE=/var/tmp/filecoin-proof-parameters
MINER_ACTOR_ADDRESS=t01000
LOTUS_RPC_PORT=1234
LOTUS_P2P_PORT=1235
# Unused here; compose interpolates the extended forest-miner file which references it.
MINER_RPC_PORT=2345
FOREST_RPC_PORT=3456
FOREST_P2P_PORT=4903
# Curio v1.29.0
CURIO_COMMIT=409a2ab3510d65f22ae31ba1afddc911f4b315d7
CURIO_REPO_PATH=/var/lib/curio
YUGABYTE_IMAGE=yugabytedb/yugabyte:2025.2.2.2-b11@sha256:1fdda2ae928facf0b7b25b7c1183c540567c33730cce10a557c81c33a8e18422
GENESIS_NETWORK_VERSION=18
SHARK_HEIGHT=-10
HYGGE_HEIGHT=-9
LIGHTNING_HEIGHT=3
THUNDER_HEIGHT=6
WATERMELON_HEIGHT=9
DRAGON_HEIGHT=12
WAFFLE_HEIGHT=18
TUKTUK_HEIGHT=20
TEEP_HEIGHT=22
TOCK_HEIGHT=24
GOLDEN_WEEK_HEIGHT=26
FIREHORSE_HEIGHT=28
SOLSTICE_HEIGHT=30
TARGET_HEIGHT=34
17 changes: 17 additions & 0 deletions scripts/devnet-forest-curio/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Forest-produced devnet (Curio seals and mines)

Same chain topology as [`../devnet-forest-miner`](../devnet-forest-miner), with Curio in place of Lotus Miner:

| | this stack |
| --------------- | ---------------------- |
| Block producer | **Forest** + **Curio** |
| Validating node | Lotus |
| HarmonyDB | Yugabyte |

`NETWORK_NAME=localnet` because Curio rejects a chain node whose name does not start with `local` or `test`. The Curio container gets the same `LOTUS_*` upgrade-height variables as Lotus; a `2k` Curio binary otherwise assumes a different genesis schedule.

`setup.sh` builds `forest/curio-devnet:<CURIO_COMMIT>` once (about 15 minutes) and reuses it afterward.

```shell
mise run test:devnet:miner:curio
```
21 changes: 21 additions & 0 deletions scripts/devnet-forest-curio/build_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Build forest/curio-devnet:${CURIO_COMMIT} when that tag is missing.
set -euo pipefail

PARENT_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=/dev/null
source "${PARENT_PATH}/.env"

IMAGE="forest/curio-devnet:${CURIO_COMMIT}"
if docker image inspect "${IMAGE}" >/dev/null 2>&1; then
echo "Using existing ${IMAGE}"
exit 0
fi

echo "Building ${IMAGE} (linux/amd64) ..."
docker build \
--platform linux/amd64 \
--build-arg "CURIO_COMMIT=${CURIO_COMMIT}" \
-f "${PARENT_PATH}/curio.dockerfile" \
-t "${IMAGE}" \
"${PARENT_PATH}"
39 changes: 39 additions & 0 deletions scripts/devnet-forest-curio/check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
# Assert Forest and Lotus both climb past TARGET_HEIGHT (Curio is mining through Forest).

set -eux

PARENT_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
pushd "${PARENT_PATH}"
# shellcheck source=/dev/null
source .env

function get_sync_height {
local port=$1
curl --silent -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","id":2,"method":"Filecoin.ChainHead","param":"null"}' \
"http://127.0.0.1:${port}/rpc/v1" | jq '.result.Height'
}

start_time=$(date +%s)
timeout=$((start_time + 900)) # 15 minutes for Yugabyte + Curio cold start
target_height=$TARGET_HEIGHT

while true; do
forest_height=$(get_sync_height "${FOREST_RPC_PORT}")
lotus_height=$(get_sync_height "${LOTUS_RPC_PORT}")
if [ "$forest_height" -gt "$target_height" ] && [ "$lotus_height" -gt "$target_height" ]; then
echo "Both nodes past $target_height (Forest: $forest_height, Lotus: $lotus_height): Lotus validated Forest/Curio-produced blocks"
break
fi

current_time=$(date +%s)
if [ "$current_time" -gt "$timeout" ]; then
echo "Timeout reached (Forest: $forest_height, Lotus: $lotus_height), target $target_height not reached by both"
exit 1
fi

sleep 1
done

popd
58 changes: 58 additions & 0 deletions scripts/devnet-forest-curio/curio.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Curio 2k image for the Forest-produced Curio devnet. Tags and GOAMD64 must be
# set explicitly: Curio's Dockerfile clears CURIO_TAGS, and its Makefile hardcodes
# GOAMD64=v3 which SIGILLs under QEMU.
ARG CURIO_COMMIT
FROM rust:1.86.0-slim-bookworm AS rust-toolchain

FROM golang:1.26-trixie AS curio-builder
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG CURIO_COMMIT
RUN test -n "$CURIO_COMMIT"

RUN apt-get update && \
apt-get install --no-install-recommends -y ca-certificates build-essential clang \
ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev git && \
rm -rf /var/lib/apt/lists/*

COPY --from=rust-toolchain /usr/local/cargo /usr/local/cargo
COPY --from=rust-toolchain /usr/local/rustup /usr/local/rustup
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH

WORKDIR /opt/curio
RUN git clone https://github.com/filecoin-project/curio.git . && \
git checkout "$CURIO_COMMIT" && \
git submodule update --init

# Portable BLST so the binary runs under QEMU; rewrite GOAMD64=v3 -> v1.
RUN sed -i 's/GOAMD64=v3/GOAMD64=v1/g' scripts/makefiles/30-build.mk

ENV FFI_USE_OPENCL=1 \
CURIO_TAGS="cunative nosupraseal 2k" \
CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__" \
CGO_CFLAGS="-D__BLST_PORTABLE__" \
FFI_USE_BLST_PORTABLE=1 \
FFI_USE_GPU=0

RUN make clean deps && make build && strip curio sptool

FROM ubuntu:24.04
RUN apt-get update && \
apt-get install --no-install-recommends -y ca-certificates curl jq dnsutils && \
rm -rf /var/lib/apt/lists/*

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/
COPY --from=curio-builder /opt/curio/curio /opt/curio/sptool /usr/local/bin/

RUN curio --version && ! command -v lotus-miner

CMD ["/bin/bash"]
36 changes: 36 additions & 0 deletions scripts/devnet-forest-curio/curio_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# Bootstrap Curio against Forest for genesis ${MINER_ACTOR_ADDRESS}, then run.
set -euo pipefail

set +x
export FULLNODE_API_INFO="$(cat "${FOREST_DATA_DIR}/token.jwt"):/dns/forest/tcp/${FOREST_RPC_PORT}/http"
set -x

MACHINE="$(hostname -i | awk '{print $1}'):12300"

if [ ! -f "${CURIO_REPO_PATH}/.init.config" ]; then
curio config new-cluster "${MINER_ACTOR_ADDRESS}"
curio config create --title devnet < /devnet-layer.toml
touch "${CURIO_REPO_PATH}/.init.config"
fi

curio run --nosync --name forest-devnet --layers seal,post,devnet &
CURIO_PID=$!

until curio cli --machine "${MACHINE}" wait-api; do
if ! kill -0 "${CURIO_PID}" 2>/dev/null; then
echo "curio exited before its API came up" >&2
wait "${CURIO_PID}"
exit 1
fi
echo "waiting for curio API on ${MACHINE} ..."
sleep 2
done

if [ ! -f "${CURIO_REPO_PATH}/.init.storage" ]; then
curio cli --machine "${MACHINE}" storage attach "${LOTUS_DATA_DIR}/genesis-sectors"
curio cli --machine "${MACHINE}" storage attach --init --seal --store "${CURIO_REPO_PATH}/storage"
touch "${CURIO_REPO_PATH}/.init.storage"
fi

wait "${CURIO_PID}"
7 changes: 7 additions & 0 deletions scripts/devnet-forest-curio/devnet-layer.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Batching.PreCommit]
Timeout = "0h0m5s"
Slack = "6h0m0s"

[Batching.Commit]
Timeout = "0h0m5s"
Slack = "1h0m0s"
Loading
Loading