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
132 changes: 132 additions & 0 deletions .github/workflows/build-w3m-lotus-512.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Build W3M Lotus 512

on:
push:
branches:
- master
- main
- 'feat/*w3m*'
- 'release/*'
pull_request:
branches:
- master
- main
workflow_dispatch:

defaults:
run:
shell: bash

permissions:
contents: read

jobs:
build:
name: Build W3M Lotus 512 (Linux X64)
runs-on: [self-hosted, high-clock]
steps:
- name: Check out code
uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0

- name: Install system dependencies
uses: ./.github/actions/install-system-dependencies

- name: Install Go
uses: ./.github/actions/install-go

- name: Install dependencies
run: make deps

- name: Build W3M Lotus 512 binaries
run: |
set -e
echo "Building w3mlotus512 binaries for Linux X64..."
make w3mlotus512-lotus
make w3mlotus512-lotus-miner
make w3mlotus512-lotus-worker
make w3mlotus512-lotus-seed
make w3mlotus512-lotus-shed

- name: Verify binaries exist
run: |
set -e
echo "Verifying built binaries..."
for binary in lotus lotus-miner lotus-worker lotus-seed lotus-shed; do
if [[ ! -f "$binary" ]]; then
echo "Error: $binary not found!"
exit 1
fi
echo "✓ $binary built successfully"
ls -la "$binary"
done

- name: Package binaries
run: |
set -e
PACKAGE_NAME="w3m-lotus-512-linux-x64"
mkdir -p "$PACKAGE_NAME"

# Copy binaries
cp lotus lotus-miner lotus-worker lotus-seed lotus-shed "$PACKAGE_NAME/"

# Copy documentation and config
cp README-W3M-LOTUS-512.md "$PACKAGE_NAME/" || echo "README not found, skipping"
cp build/bootstrap/w3m-lotus-512.pi "$PACKAGE_NAME/" || echo "Bootstrap file not found, skipping"

# Create archive
tar -czf "${PACKAGE_NAME}.tar.gz" "$PACKAGE_NAME"
echo "Package created: ${PACKAGE_NAME}.tar.gz"
ls -la "${PACKAGE_NAME}.tar.gz"

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: w3m-lotus-512-linux-x64
path: w3m-lotus-512-linux-x64.tar.gz
retention-days: 90

release-summary:
name: Build Summary
needs: build
runs-on: ubuntu-latest
if: always()
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
continue-on-error: true

- name: Create summary
run: |
echo "# W3M Lotus 512 Build Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
echo "**Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [[ -d artifacts ]]; then
echo "## Built Artifacts" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
for artifact in artifacts/*/*.tar.gz; do
if [[ -f "$artifact" ]]; then
basename=$(basename "$artifact")
size=$(du -h "$artifact" | cut -f1)
echo "- **$basename** ($size)" >> $GITHUB_STEP_SUMMARY
fi
done
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Package Contents" >> $GITHUB_STEP_SUMMARY
echo "- lotus (daemon)" >> $GITHUB_STEP_SUMMARY
echo "- lotus-miner" >> $GITHUB_STEP_SUMMARY
echo "- lotus-worker" >> $GITHUB_STEP_SUMMARY
echo "- lotus-seed" >> $GITHUB_STEP_SUMMARY
echo "- lotus-shed" >> $GITHUB_STEP_SUMMARY
echo "- README-W3M-LOTUS-512.md" >> $GITHUB_STEP_SUMMARY
echo "- w3m-lotus-512.pi (bootstrap configuration)" >> $GITHUB_STEP_SUMMARY
else
echo "❌ No artifacts were built" >> $GITHUB_STEP_SUMMARY
fi
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ TWOK_FLAGS=-tags=2k
CALIBNET_FLAGS=-tags=calibnet
BUTTERFLYNET_FLAGS=-tags=butterflynet
INTEROPNET_FLAGS=-tags=interopnet
W3MLOTUS512_FLAGS=-tags=w3mlotus512

# Network-specific pattern rules
debug-%:
Expand All @@ -88,6 +89,8 @@ butterflynet-%:
$(MAKE) $* GOFLAGS="$(GOFLAGS) $(BUTTERFLYNET_FLAGS)"
interopnet-%:
$(MAKE) $* GOFLAGS="$(GOFLAGS) $(INTEROPNET_FLAGS)"
w3mlotus512-%:
$(MAKE) $* GOFLAGS="$(GOFLAGS) $(W3MLOTUS512_FLAGS)"

build-devnets: build lotus-seed lotus-shed
.PHONY: build-devnets
Expand Down Expand Up @@ -123,6 +126,12 @@ interopnet:
$(MAKE) interopnet-lotus interopnet-lotus-miner interopnet-lotus-worker interopnet-lotus-seed interopnet-lotus-shed
.PHONY: interopnet

w3mlotus512:
@printf "\033[33m'make w3mlotus512' builds all W3M 512MiB test network binaries. Use 'make w3mlotus512-<binary>' targets for individual binaries.\033[0m\n"
@printf "Example: make w3mlotus512-lotus w3mlotus512-lotus-miner\n\n"
$(MAKE) w3mlotus512-lotus w3mlotus512-lotus-miner w3mlotus512-lotus-worker w3mlotus512-lotus-seed w3mlotus512-lotus-shed
.PHONY: w3mlotus512

lotus: $(BUILD_DEPS) ## Build the main Lotus binary
rm -f lotus
$(GOCC) build $(GOFLAGS) -o lotus ./cmd/lotus
Expand Down
130 changes: 130 additions & 0 deletions README-W3M-LOTUS-512.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# W3M Lotus 512 MiB Test Network Configuration

This configuration sets up a custom Lotus build optimized for testing with 512 MiB sectors and a specific bootstrap node.

## Overview

The `w3m-lotus-512` build configuration provides:
- **512 MiB minimum consensus power** (suitable for testing)
- **10-second block times** (3x faster than mainnet)
- **Custom bootstrap node** support
- **Development network** settings with debugging enabled
- **Shorter PreCommit delays** for faster testing

## Quick Start

### 1. Configure Your Bootstrap Node

Edit the bootstrap configuration file with your node's multiaddress:

```bash
vim build/bootstrap/w3m-lotus-512.pi
```

Replace the placeholder with your actual bootstrap node:
```
/ip4/YOUR_IP_HERE/tcp/YOUR_PORT_HERE/p2p/YOUR_PEER_ID_HERE
```

Example:
```
/ip4/192.168.1.100/tcp/1234/p2p/12D3KooWBF8cpp65hp2u9LK5mh19x67ftAam84z9LsfaquTDSBpt
```

### 2. Build the Binaries

```bash
# Clean any existing builds
make clean

# Build all w3m-lotus-512 binaries
make w3mlotus512

# Or build individual components:
make w3mlotus512-lotus # Lotus daemon
make w3mlotus512-lotus-miner # Lotus miner
make w3mlotus512-lotus-worker # Lotus worker
```

### 3. Initialize and Run

#### Start the Lotus Daemon
```bash
# Initialize the daemon (first time only)
./lotus daemon --genesis-file=/path/to/genesis.car

# The daemon will automatically connect to your configured bootstrap node
```

#### Initialize the Miner with 512 MiB Sectors
```bash
# Create a new miner with 512 MiB sectors
./lotus-miner init --sector-size=512MiB

# Start the miner
./lotus-miner run
```

## Configuration Details

### Network Parameters
- **Build Tag**: `w3mlotus512`
- **Network Bundle**: `devnet`
- **Actor Debugging**: Enabled
- **Block Delay**: 10 seconds
- **Minimum Consensus Power**: 512 MiB
- **PreCommit Challenge Delay**: 10 epochs
- **Bootstrap Peers Threshold**: 4

### File Locations
- **Bootstrap Configuration**: `build/bootstrap/w3m-lotus-512.pi`
- **Build Parameters**: `build/buildconstants/params_w3m-lotus-512.go`
- **Network Configuration**: Uses devnet actor bundles

### Build System
The Makefile has been extended with:
- `W3MLOTUS512_FLAGS=-tags=w3mlotus512`
- Pattern rule: `w3mlotus512-%` for building network-specific binaries
- Main target: `make w3mlotus512` to build all components

## Alternative: Environment Variable

If you prefer not to modify the code, you can use the environment variable to override bootstrap peers:

```bash
export LOTUS_P2P_BOOTSTRAPPERS="/ip4/YOUR_IP/tcp/YOUR_PORT/p2p/YOUR_PEER_ID"
./lotus daemon
```

## Important Notes

1. **Not for Production**: This configuration is designed for testing and development only. The low consensus power requirement (512 MiB) makes it unsuitable for production use.

2. **Sector Size**: While the minimum power is 512 MiB, you can still seal larger sectors (32 GiB, 64 GiB) if needed. The 512 MiB is just the minimum to gain power on the network.

3. **Genesis File**: You'll need a genesis file to start your network. This can be created using `lotus-seed` or obtained from your network administrator.

4. **Network Isolation**: This configuration creates an isolated network that won't connect to mainnet or other testnets due to the custom bootstrap node.

## Troubleshooting

### Bootstrap Connection Issues
- Ensure your bootstrap node is running and accessible
- Check firewall settings allow connections on the specified port
- Verify the multiaddress format is correct

### Build Issues
- Ensure you have the correct Go version installed (check GO_VERSION_MIN)
- Run `make deps` if you encounter dependency issues
- Check that the FFI submodule is properly initialized

### Sector Size Issues
- If miner init fails, ensure you have enough disk space for 512 MiB sectors
- Check that proof parameters for 512 MiB are downloaded (lotus will auto-download if needed)

## For Developers

To modify the configuration, edit:
- `build/buildconstants/params_w3m-lotus-512.go` for network parameters
- `build/bootstrap/w3m-lotus-512.pi` for bootstrap peers
- Add more bootstrap nodes (one per line) if running multiple bootstrap nodes
1 change: 1 addition & 0 deletions build/bootstrap/w3m-lotus-512.pi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/ip4/YOUR_IP_HERE/tcp/YOUR_PORT_HERE/p2p/YOUR_PEER_ID_HERE
Loading
Loading