Skip to content

Commit d0a7234

Browse files
committed
test(docker): comprehensive 5-validator integration test with WASM challenge lifecycle
Add validator-5 to docker-compose (IP 172.28.1.5, port 9005, key ...0005) and rewrite test-multi-validator.sh as a comprehensive integration test covering all 5 requirements: 1. Consensus: distributed storage on all 5 validators, P2P peer activity, validator startup verification, consensus engine initialization 2. WASM module: binary validation (magic bytes, size), directory existence in containers, copy to all 5 validators, size verification 3. Sudo/challenges: sudo key recognition, challenge update message type, WASM executor initialization status 4. Persistence: storage DB existence and stability, WASM module persistence, hash consistency across all validators 5. Evaluation architecture: mock-subtensor health, neuron data, commit/reveal weight flow, P2P network topology, subtensor connectivity Additional changes: - Dockerfile.test-validator: create /wasm_modules/challenges directory - entrypoint-test.sh: add WASM_MODULE_DIR env var passthrough to CLI args - docker-compose: add BOOTSTRAP_PEERS to validator-1 (self-bootstrap) to prevent crash from empty bootstrap check - Test script auto-builds term-challenge WASM if binary not found - 20 tests across 5 suites with pass/fail/skip tracking and per-validator log collection
1 parent 60f98ae commit d0a7234

4 files changed

Lines changed: 541 additions & 73 deletions

File tree

tests/docker/Dockerfile.test-validator

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ RUN apt-get update && apt-get install -y \
5555
COPY --from=builder /app/target/release/validator-node /usr/local/bin/validator-node
5656
COPY --from=builder /scripts/test-harness.sh /scripts/test-harness.sh
5757

58-
# Create data directory
59-
RUN mkdir -p /data && chmod 755 /data
58+
# Create data and WASM module directories
59+
RUN mkdir -p /data /wasm_modules/challenges && chmod 755 /data /wasm_modules /wasm_modules/challenges
6060

6161
# Environment defaults
6262
ENV RUST_LOG=info,validator_node=debug,platform_p2p_consensus=info

tests/docker/docker-compose.multi-validator.yml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# =============================================================================
22
# Platform Multi-Validator Test Network
33
# =============================================================================
4-
# For comprehensive production-like testing with 4 validators in P2P network
4+
# For comprehensive production-like testing with 5 validators in P2P network
55
#
66
# Usage:
77
# docker compose -f tests/docker/docker-compose.multi-validator.yml up --build -d
@@ -54,6 +54,7 @@ services:
5454
- P2P_LISTEN_ADDR=/ip4/0.0.0.0/tcp/9000
5555
- NETUID=100
5656
- NO_BITTENSOR=false
57+
- BOOTSTRAP_PEERS=/ip4/172.28.1.1/tcp/9000
5758
- SUBTENSOR_ENDPOINT=ws://mock-subtensor:9944
5859
- PLATFORM_TEST_ARTIFACTS_DIR=/artifacts
5960
- PLATFORM_TEST_TMP_BASE=/tmp/platform-tests
@@ -195,11 +196,52 @@ services:
195196
retries: 6
196197
start_period: 15s
197198

199+
# ==========================================================================
200+
# Validator 5
201+
# ==========================================================================
202+
validator-5:
203+
build:
204+
context: ../..
205+
dockerfile: tests/docker/Dockerfile.test-validator
206+
container_name: platform-validator-5
207+
hostname: validator-5
208+
environment:
209+
- RUST_LOG=info,validator_node=debug,platform_p2p_consensus=debug
210+
- DATA_DIR=/data
211+
- VALIDATOR_SECRET_KEY=0x0000000000000000000000000000000000000000000000000000000000000005
212+
- P2P_LISTEN_ADDR=/ip4/0.0.0.0/tcp/9000
213+
- NETUID=100
214+
- NO_BITTENSOR=false
215+
- BOOTSTRAP_PEERS=/ip4/172.28.1.1/tcp/9000
216+
- SUBTENSOR_ENDPOINT=ws://mock-subtensor:9944
217+
- PLATFORM_TEST_ARTIFACTS_DIR=/artifacts
218+
- PLATFORM_TEST_TMP_BASE=/tmp/platform-tests
219+
ports:
220+
- "9005:9000"
221+
volumes:
222+
- validator5-data:/data
223+
- test-artifacts:/artifacts
224+
networks:
225+
platform-test:
226+
ipv4_address: 172.28.1.5
227+
depends_on:
228+
mock-subtensor:
229+
condition: service_healthy
230+
validator-1:
231+
condition: service_started
232+
healthcheck:
233+
test: ["CMD-SHELL", "test -e /data/distributed.db || exit 1"]
234+
interval: 10s
235+
timeout: 5s
236+
retries: 6
237+
start_period: 15s
238+
198239
volumes:
199240
validator1-data:
200241
validator2-data:
201242
validator3-data:
202243
validator4-data:
244+
validator5-data:
203245
test-artifacts:
204246

205247
networks:

tests/docker/entrypoint-test.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ if [ -n "${BOOTSTRAP_PEERS:-}" ]; then
3939
done
4040
fi
4141

42+
if [ -n "${WASM_MODULE_DIR:-}" ]; then
43+
ARGS="$ARGS --wasm-module-dir ${WASM_MODULE_DIR}"
44+
fi
45+
4246
if [ "${NO_BITTENSOR:-false}" = "true" ]; then
4347
ARGS="$ARGS --no-bittensor"
4448
fi

0 commit comments

Comments
 (0)