Skip to content

Latest commit

 

History

History
190 lines (142 loc) · 6.91 KB

configuration.md

File metadata and controls

190 lines (142 loc) · 6.91 KB

Configuration

Configuration System

Config File Location

The configuration file is ~/.foc-devnet/config.toml by default, or $FOC_DEVNET_BASEDIR/config.toml when the base directory is overridden.

Config Structure

The following is a complete example with the current compiled defaults. Each component source has one variant table, such as [lotus.GitTag]. Set top-level ports, provider counts, and the Lotus build type before the source tables.

port_range_start = 5700
port_range_count = 100
active_pdp_sp_count = 2
approved_pdp_sp_count = 2
endorsed_pdp_sp_count = 1
lotus_build_type = "2k"

[lotus.GitTag]
url = "https://github.com/filecoin-project/lotus.git"
tag = "v1.39.1"

[curio.GitTag]
url = "https://github.com/filecoin-project/curio.git"
tag = "v1.29.2"

[filecoin_services.GitTag]
url = "https://github.com/FilOzone/filecoin-services.git"
tag = "v1.5.0"

[multicall3.GitTag]
url = "https://github.com/mds1/multicall3.git"
tag = "v3.1.0"

The source variants are GitTag (url, tag), GitCommit (url, commit), GitBranch (url, branch), and LocalSource (dir). PDP is optional. Without a pdp source table, deployment uses Filecoin Services' service_contracts/lib/pdp submodule. For example, add this table to use an existing local PDP checkout:

[pdp.LocalSource]
dir = "/home/user/dev/pdp"

Configuration Parameters

Parameter Type Default Description
port_range_start u16 5700 First host port in the configured range
port_range_count u16 100 Number of host ports in the range
active_pdp_sp_count usize 2 Number of Curio providers to run and register
approved_pdp_sp_count usize 2 Number of those providers to approve in Warm Storage
endorsed_pdp_sp_count usize 1 Number of approved providers to endorse
lotus_build_type string "2k" Lotus build, "2k" or "debug"; see Lotus build type

Provider counts must satisfy 0 ≤ endorsed_pdp_sp_count ≤ approved_pdp_sp_count ≤ active_pdp_sp_count ≤ 5. If approved_pdp_sp_count = 0, set endorsed_pdp_sp_count = 0 as well. Use a nonempty port range with enough available ports for the services configured.

Lotus Build Type

lotus_build_type selects the Lotus make target used by foc-devnet build lotus. With "2k", lotus-miner computes a real winning PoSt for every block, which can occupy several CPU cores on slower machines. "debug" builds the same devnet network, but lotus-miner submits a placeholder winning PoSt and Lotus accepts only placeholders, so block production uses almost no CPU. Window PoSt and PDP proofs are unaffected, and Curio is always built for 2k.

Set it during initialization with foc-devnet init --lotus-build-type debug, or edit config.toml later. After changing the value, run foc-devnet build lotus and then foc-devnet start. With "debug", Lotus logs an expected [INSECURE-POST-VALIDATION] warning at startup.

How Defaults Work

init writes Config::default() when no configuration file exists. An upgrade does not replace existing settings. To regenerate the configuration, back it up, run foc-devnet stop, and check that no devnet services remain. Then run:

foc-devnet clean --all && foc-devnet init

This deletes local run data as well as the old configuration. Plain clean preserves config.toml for the next init.

Editing Config

Edit config.toml to change the ports or provider counts for the next start. For source changes, use init source overrides when reinitializing. Keep ports and counts at the top level, before the component tables.

Environment Variables

FOC_DEVNET_BASEDIR

Overrides the default ~/.foc-devnet base directory. Use it to keep different configurations and their files on separate paths, or to put the data on another disk. It does not isolate Docker resources. Use only one running foc-devnet per Docker daemon: start and stop share cleanup scope, startup replaces an existing devnet Portainer, and clean --images acts on shared images.

Use an absolute path for shell and scenario commands. For example, after stopping any previous devnet from its original base directory:

export FOC_DEVNET_BASEDIR="$HOME/foc-test-env"
foc-devnet init
foc-devnet build lotus
foc-devnet build curio
foc-devnet start

The CLI expands a leading ~, but not every helper does. The shell examples in these guides assume FOC_DEVNET_BASEDIR is unset or already expanded to an absolute path.

Dependency Repository Management

Sources are selected through init and recorded in config.toml.

Required Dependent Repositories

  • lotus - Filecoin daemon
  • curio - Storage provider (PDP)
  • filecoin-services - FOC smart contracts
  • pdp - PDP contracts; optional independent override mounted over service_contracts/lib/pdp
  • multicall3 - Multicall3 contract

Dependent Version Strategy

Default versions for these repositories are defined in code (see src/config.rs Config::default()).

Use a tag or commit to pin a checkout; a branch can move. latesttag resolves to a specific tag during init and is saved as GitTag, so an ordinary re-init using that config does not automatically select a newer tag.

Updating defaults: See How Defaults Work for information on how defaults are defined and the steps to apply updates.

Using Local Dependency Repositories

For active development:

foc-devnet init \
    --lotus local:/home/user/dev/lotus \
    --curio local:/home/user/dev/curio \
    --filecoin-services local:/home/user/dev/filecoin-services \
    --pdp local:/home/user/dev/pdp

Mixed approach:

foc-devnet init \
    --lotus gitbranch:master \
    --curio local:/home/user/dev/curio

Sharing Configuration

Copy a valid config into a clean base directory before init. For a shared setup, use the same foc-devnet version and pin the dependencies. LocalSource paths must exist on the recipient's machine.

base="${FOC_DEVNET_BASEDIR:-$HOME/.foc-devnet}"
mkdir -p "$base"
cp -i shared-config.toml "$base/config.toml"
foc-devnet init

Reproducible Builds

Pin each dependency to a specific release tag, as in the configuration example, or to an exact commit. For a commit pin, replace the component's GitTag table with a GitCommit table (for example [lotus.GitCommit]), keep the url, and use commit instead of tag. Commit pins avoid relying on tags remaining unchanged.