logos-blockchain-testing/book/src/prerequisites.md

245 lines
5.7 KiB
Markdown
Raw Normal View History

# Prerequisites & Setup
This page covers everything you need before running your first scenario.
## Required Files
### `versions.env` (Required)
All helper scripts require a `versions.env` file at the repository root:
```bash
VERSION=v0.3.1
2026-01-26 16:36:51 +01:00
LOGOS_BLOCKCHAIN_NODE_REV=abc123def456789
LOGOS_BLOCKCHAIN_BUNDLE_VERSION=v1
```
**What it defines:**
2026-01-26 16:36:51 +01:00
- `VERSION` — Circuit assets release tag
- `LOGOS_BLOCKCHAIN_NODE_REV` — Git revision of logos-blockchain-node to build/fetch
- `LOGOS_BLOCKCHAIN_BUNDLE_VERSION` — Bundle schema version
**Where it's used:**
- `scripts/run/run-examples.sh`
- `scripts/build/build-bundle.sh`
2026-01-26 16:36:51 +01:00
- `scripts/setup/setup-logos-blockchain-circuits.sh`
- CI workflows
**Error if missing:**
```text
ERROR: versions.env not found at repository root
This file is required and should define:
VERSION=<circuit release tag>
2026-01-26 16:36:51 +01:00
LOGOS_BLOCKCHAIN_NODE_REV=<logos-blockchain-node git revision>
LOGOS_BLOCKCHAIN_BUNDLE_VERSION=<bundle schema version>
```
**Fix:** Ensure you're in the repository root. The file should already exist in the checked-out repo.
## Node Binaries
2026-01-26 16:36:51 +01:00
Scenarios need compiled `logos-blockchain-node` binaries.
### Option 1: Use Helper Scripts (Recommended)
```bash
2026-01-26 16:36:51 +01:00
scripts/run/run-examples.sh -t 60 -n 3 host
```
This automatically:
2026-01-26 16:36:51 +01:00
- Clones/updates logos-blockchain-node checkout
- Builds required binaries
2026-01-26 16:36:51 +01:00
- Sets `LOGOS_BLOCKCHAIN_NODE_BIN`
### Option 2: Manual Build
2026-01-26 16:36:51 +01:00
If you have a sibling `logos-blockchain-node` checkout:
```bash
2026-01-26 16:36:51 +01:00
cd ../logos-blockchain-node
cargo build --release --bin logos-blockchain-node
# Set environment variables
2026-01-26 16:36:51 +01:00
export LOGOS_BLOCKCHAIN_NODE_BIN=$PWD/target/release/logos-blockchain-node
# Return to testing framework
cd ../nomos-testing
```
### Option 3: Prebuilt Bundles (CI)
CI workflows use prebuilt artifacts:
```yaml
- name: Download nomos binaries
uses: actions/download-artifact@v3
with:
name: nomos-binaries-linux
path: .tmp/
- name: Extract bundle
run: |
tar -xzf .tmp/nomos-binaries-linux-*.tar.gz -C .tmp/
2026-01-26 16:36:51 +01:00
export LOGOS_BLOCKCHAIN_NODE_BIN=$PWD/.tmp/logos-blockchain-node
```
2026-01-26 16:36:51 +01:00
## Circuit Assets
2026-01-26 16:36:51 +01:00
Nodes require circuit assets for proof generation. The framework expects a
directory containing the circuits, not a single file.
### Asset Location
2026-01-26 16:36:51 +01:00
**Default path:** `~/.logos-blockchain-circuits`
2026-01-26 16:36:51 +01:00
**Container path (compose/k8s):** `/opt/circuits` (set during image build)
### Getting Assets
**Option 1: Use helper script** (recommended):
```bash
2026-01-26 16:36:51 +01:00
scripts/setup/setup-logos-blockchain-circuits.sh v0.3.1 ~/.logos-blockchain-circuits
```
**Option 2: Let `run-examples.sh` handle it**:
```bash
2026-01-26 16:36:51 +01:00
scripts/run/run-examples.sh -t 60 -n 3 host
```
### Override Path
2026-01-26 16:36:51 +01:00
Set `LOGOS_BLOCKCHAIN_CIRCUITS` to use a custom location:
```bash
2026-01-26 16:36:51 +01:00
LOGOS_BLOCKCHAIN_CIRCUITS=/custom/path/to/circuits \
cargo run -p runner-examples --bin local_runner
```
### When Are Assets Needed?
| Runner | When Required |
|--------|---------------|
2026-01-26 16:36:51 +01:00
| **Host (local)** | Always |
| **Compose** | During image build (baked into image) |
2026-01-26 16:36:51 +01:00
| **K8s** | During image build |
**Error without assets:**
```text
2026-01-26 16:36:51 +01:00
Error: circuits directory not found (LOGOS_BLOCKCHAIN_CIRCUITS)
```
## Platform Requirements
### Host Runner (Local Processes)
**Requires:**
- Rust nightly toolchain
- Node binaries built
2026-01-26 16:36:51 +01:00
- Circuit assets for proof generation
- Available ports (18080+, 3100+, etc.)
**No Docker required.**
**Best for:**
- Quick iteration
- Development
- Smoke tests
### Compose Runner (Docker Compose)
**Requires:**
- Docker daemon running
- Docker image built: `logos-blockchain-testing:local`
2026-01-26 16:36:51 +01:00
- Circuit assets baked into image
- Docker Desktop (macOS) or Docker Engine (Linux)
**Platform notes (macOS / Apple silicon):**
2026-01-26 16:36:51 +01:00
- Prefer `LOGOS_BLOCKCHAIN_BUNDLE_DOCKER_PLATFORM=linux/arm64` for native performance
- Use `linux/amd64` only if targeting amd64 environments (slower via emulation)
**Best for:**
- Reproducible environments
- CI testing
- Chaos workloads (node control support)
### K8s Runner (Kubernetes)
**Requires:**
- Kubernetes cluster (Docker Desktop K8s, minikube, kind, or remote)
- `kubectl` configured
- Docker image built and loaded/pushed
2026-01-26 16:36:51 +01:00
- Circuit assets baked into image
**Local cluster setup:**
```bash
# Docker Desktop: Enable Kubernetes in settings
# OR: Use kind
kind create cluster
kind load docker-image logos-blockchain-testing:local
# OR: Use minikube
minikube start
minikube image load logos-blockchain-testing:local
```
2026-01-26 16:36:51 +01:00
**Remote cluster:** Push image to registry and set `LOGOS_BLOCKCHAIN_TESTNET_IMAGE`.
**Best for:**
- Production-like testing
- Resource isolation
- Large topologies
## Quick Setup Check
Run this checklist before your first scenario:
```bash
# 1. Verify versions.env exists
cat versions.env
2026-01-26 16:36:51 +01:00
# 2. Check circuit assets
ls -lh "${HOME}/.logos-blockchain-circuits"
chore: merge dev into master (#29) * Add node config overrides (#14) * chore: merge master into dev and update configs after merge (#17) * Sdp config structs from logos blockchain (#15) * Update configs after main repo merge --------- Co-authored-by: gusto <bacv@users.noreply.github.com> * Local deployer allows to stop and restart nodes (#16) * Unify local node control and restart support * Add local stop-node support * Use node names for restart/stop control * merge --------- Co-authored-by: hansieodendaal <hansie.odendaal@gmail.com> * Add orphan manual cluster test utilities * Update node rev and align consensus/wallet config * Update node rev and align wallet/KMS configs * Update main repo ref (#23) * Fix genesis utxos and scale leader stake * Document leader stake constants * feat: add custom persistent dir option for working files (#26) * chore: config and naming updates (#27) * Update config and crate naming - Updated configs to the lates main repo configs. - Updated all main repo crate namings to be same as the main repo. - Added `create_dir_all` to `pub(crate) fn create_tempdir(custom_work_dir: Option<PathBuf>) -> std::io::Result<TempDir> {`. - Wired in optional `persist_dir` when using the local deployer. - Update `time` vulnerability **Note:** Unsure about the `service_params` mapping in `pub(crate) fn cryptarchia_deployment(config: &GeneralConfig) -> CryptarchiaDeploymentSettings {` * fix ntp server config --------- Co-authored-by: Andrus Salumets <andrus@status.im> Co-authored-by: gusto <bacv@users.noreply.github.com> Co-authored-by: andrussal <salumets.andrus@gmail.com>
2026-02-09 14:12:26 +02:00
# 3. For compose/k8s: verify Docker is running
docker ps
chore: merge dev into master (#29) * Add node config overrides (#14) * chore: merge master into dev and update configs after merge (#17) * Sdp config structs from logos blockchain (#15) * Update configs after main repo merge --------- Co-authored-by: gusto <bacv@users.noreply.github.com> * Local deployer allows to stop and restart nodes (#16) * Unify local node control and restart support * Add local stop-node support * Use node names for restart/stop control * merge --------- Co-authored-by: hansieodendaal <hansie.odendaal@gmail.com> * Add orphan manual cluster test utilities * Update node rev and align consensus/wallet config * Update node rev and align wallet/KMS configs * Update main repo ref (#23) * Fix genesis utxos and scale leader stake * Document leader stake constants * feat: add custom persistent dir option for working files (#26) * chore: config and naming updates (#27) * Update config and crate naming - Updated configs to the lates main repo configs. - Updated all main repo crate namings to be same as the main repo. - Added `create_dir_all` to `pub(crate) fn create_tempdir(custom_work_dir: Option<PathBuf>) -> std::io::Result<TempDir> {`. - Wired in optional `persist_dir` when using the local deployer. - Update `time` vulnerability **Note:** Unsure about the `service_params` mapping in `pub(crate) fn cryptarchia_deployment(config: &GeneralConfig) -> CryptarchiaDeploymentSettings {` * fix ntp server config --------- Co-authored-by: Andrus Salumets <andrus@status.im> Co-authored-by: gusto <bacv@users.noreply.github.com> Co-authored-by: andrussal <salumets.andrus@gmail.com>
2026-02-09 14:12:26 +02:00
# 4. For compose/k8s: verify image exists
docker images | grep logos-blockchain-testing
chore: merge dev into master (#29) * Add node config overrides (#14) * chore: merge master into dev and update configs after merge (#17) * Sdp config structs from logos blockchain (#15) * Update configs after main repo merge --------- Co-authored-by: gusto <bacv@users.noreply.github.com> * Local deployer allows to stop and restart nodes (#16) * Unify local node control and restart support * Add local stop-node support * Use node names for restart/stop control * merge --------- Co-authored-by: hansieodendaal <hansie.odendaal@gmail.com> * Add orphan manual cluster test utilities * Update node rev and align consensus/wallet config * Update node rev and align wallet/KMS configs * Update main repo ref (#23) * Fix genesis utxos and scale leader stake * Document leader stake constants * feat: add custom persistent dir option for working files (#26) * chore: config and naming updates (#27) * Update config and crate naming - Updated configs to the lates main repo configs. - Updated all main repo crate namings to be same as the main repo. - Added `create_dir_all` to `pub(crate) fn create_tempdir(custom_work_dir: Option<PathBuf>) -> std::io::Result<TempDir> {`. - Wired in optional `persist_dir` when using the local deployer. - Update `time` vulnerability **Note:** Unsure about the `service_params` mapping in `pub(crate) fn cryptarchia_deployment(config: &GeneralConfig) -> CryptarchiaDeploymentSettings {` * fix ntp server config --------- Co-authored-by: Andrus Salumets <andrus@status.im> Co-authored-by: gusto <bacv@users.noreply.github.com> Co-authored-by: andrussal <salumets.andrus@gmail.com>
2026-02-09 14:12:26 +02:00
# 5. For host runner: verify node binaries (if not using scripts)
2026-01-26 16:36:51 +01:00
$LOGOS_BLOCKCHAIN_NODE_BIN --version
```
## Recommended: Use Helper Scripts
The easiest path is to let the helper scripts handle everything:
```bash
# Host runner
2026-01-26 16:36:51 +01:00
scripts/run/run-examples.sh -t 60 -n 3 host
# Compose runner
2026-01-26 16:36:51 +01:00
scripts/run/run-examples.sh -t 60 -n 3 compose
# K8s runner
2026-01-26 16:36:51 +01:00
scripts/run/run-examples.sh -t 60 -n 3 k8s
```
These scripts:
- Verify `versions.env` exists
2026-01-26 16:36:51 +01:00
- Clone/build logos-blockchain-node if needed
- Fetch circuit assets if missing
- Build Docker images (compose/k8s)
- Load images into cluster (k8s)
- Run the scenario with proper environment
**Next Steps:**
- [Running Examples](running-examples.md) — Learn how to run scenarios
- [Environment Variables](environment-variables.md) — Full variable reference
- [Troubleshooting](troubleshooting.md) — Common issues and fixes