Skip to content

Commit 02cc3bb

Browse files
committed
dash: CI required-gate entrypoints for G1 byte-parity KAT + G3a populated block production
Land tests/gates/g1_byte_parity_kat.sh and tests/gates/g3a_regtest_block_production.sh as deterministic executable entrypoints wrapping the existing DASH test targets: - G1 -> test_dash_x11_kat (DashX11Kat.*): X11 byte-parity KAT vectors (4 tests) - G3a -> test_dash_g3_assembled + test_dash_block_producer (DashG3Assembled.* / DashBlockProducer.*): populated-block assemble + X11-mine + dual-path reach-network (18 tests) Both self-configure a cold build (conan+cmake), build only their target(s), run ctest from build/, and hard-fail on the false-green empty-suite trap (No tests found -> exit 0). G3a carries an opt-in live regtest arm (DASH_RPC_PASS + DASH_RPC_AUTH) driving scripts/dash_g3a_populated_block_regtest.sh. SAFE-ADDITIVE, fenced to tests/gates/ + DASH tree; no consensus, shared-base, build.yml or CMake edits (ci-steward owns the .yml wiring, PR #619).
1 parent 2530888 commit 02cc3bb

2 files changed

Lines changed: 111 additions & 0 deletions

File tree

tests/gates/g1_byte_parity_kat.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
# G1 — DASH X11 byte-parity known-answer test (CI required-gate entrypoint).
3+
# Wraps the real test_dash_x11_kat gtest suite (DashX11Kat.*): genesis + testnet3
4+
# real-node header vectors reproduce the X11 block hash byte-for-byte (#596 vectors).
5+
# Deterministic: exit 0 = every KAT vector reproduced; nonzero = failure / hollow run.
6+
# Network-free, CI-runner safe (~0.1s). Fenced: a tests/gates/ entrypoint over an
7+
# existing DASH test target — no consensus / shared-base / build.yml / CMake edits.
8+
set -euo pipefail
9+
10+
GATE="G1 dash-x11-byte-parity-kat"
11+
TEST_REGEX='^DashX11Kat\.'
12+
TARGET=test_dash_x11_kat
13+
14+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
15+
BUILD_DIR="${BUILD_DIR:-$REPO_ROOT/build}"
16+
17+
# 1. Ensure the target exists (configure+build only if the CI cache is cold).
18+
if [ ! -f "$BUILD_DIR/CMakeCache.txt" ]; then
19+
echo "[$GATE] no build dir at $BUILD_DIR — configuring (conan + cmake)"
20+
conan install "$REPO_ROOT" --build=missing --output-folder="$BUILD_DIR" --settings=build_type=Release
21+
cmake -S "$REPO_ROOT" -B "$BUILD_DIR" \
22+
-DCMAKE_TOOLCHAIN_FILE="$BUILD_DIR/conan_toolchain.cmake" \
23+
-DCMAKE_BUILD_TYPE=Release
24+
fi
25+
cmake --build "$BUILD_DIR" --target "$TARGET" -j"$(nproc)"
26+
27+
# 2. Run from build/ and capture. Running ctest off the wrong CWD prints
28+
# "No tests were found!!!" and EXITS 0 — the classic false-green trap.
29+
set +e
30+
OUT="$(cd "$BUILD_DIR" && ctest -R "$TEST_REGEX" --output-on-failure 2>&1)"
31+
RC=$?
32+
set -e
33+
echo "$OUT"
34+
35+
# 3. False-green guard: demand a positive test count actually ran.
36+
if grep -q "No tests were found" <<<"$OUT"; then
37+
echo "[$GATE] FAIL — hollow run: 0 tests matched $TEST_REGEX (wrong CWD/target?)" >&2
38+
exit 1
39+
fi
40+
N="$(grep -oE 'out of [0-9]+' <<<"$OUT" | grep -oE '[0-9]+' | tail -1)"
41+
if [ -z "${N:-}" ] || [ "$N" -lt 1 ]; then
42+
echo "[$GATE] FAIL — no positive test count parsed" >&2
43+
exit 1
44+
fi
45+
if [ "$RC" -ne 0 ]; then
46+
echo "[$GATE] FAIL — ctest exit $RC ($N tests)" >&2
47+
exit "$RC"
48+
fi
49+
echo "[$GATE] PASS — $N DashX11Kat byte-parity vectors reproduced"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
# G3a — DASH populated block production (CI required-gate entrypoint).
3+
# Default arm (CI-runner, network-free): the DashG3Assembled.* + DashBlockProducer.*
4+
# gtest suites — c2pool-dash assembles a POPULATED block (coinbase DIP masternode
5+
# split + >=3 diverse non-witness payload txs), X11-mines a winning nonce, serializes
6+
# it, and the won block reaches the network on BOTH paths (embedded P2P + submitblock).
7+
# Optional live arm (opt-in when DASH_RPC_PASS + DASH_RPC_AUTH are set): additionally
8+
# drives scripts/dash_g3a_populated_block_regtest.sh against an isolated regtest dashd
9+
# for a real end-to-end populated block via the submitblock RPC arm.
10+
# Deterministic: exit 0 = pass; nonzero = failure / hollow run. Fenced: tests/gates/
11+
# entrypoint over existing DASH targets — no consensus / shared-base / build.yml / CMake.
12+
set -euo pipefail
13+
14+
GATE="G3a dash-populated-block-production"
15+
TEST_REGEX='^(DashG3Assembled|DashBlockProducer)\.'
16+
TARGETS=(test_dash_g3_assembled test_dash_block_producer)
17+
18+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
19+
BUILD_DIR="${BUILD_DIR:-$REPO_ROOT/build}"
20+
21+
# 1. Ensure the targets exist (configure+build only if the CI cache is cold).
22+
if [ ! -f "$BUILD_DIR/CMakeCache.txt" ]; then
23+
echo "[$GATE] no build dir at $BUILD_DIR — configuring (conan + cmake)"
24+
conan install "$REPO_ROOT" --build=missing --output-folder="$BUILD_DIR" --settings=build_type=Release
25+
cmake -S "$REPO_ROOT" -B "$BUILD_DIR" \
26+
-DCMAKE_TOOLCHAIN_FILE="$BUILD_DIR/conan_toolchain.cmake" \
27+
-DCMAKE_BUILD_TYPE=Release
28+
fi
29+
cmake --build "$BUILD_DIR" --target "${TARGETS[@]}" -j"$(nproc)"
30+
31+
# 2. Run from build/ and capture (false-green trap: wrong CWD prints
32+
# "No tests were found!!!" and EXITS 0).
33+
set +e
34+
OUT="$(cd "$BUILD_DIR" && ctest -R "$TEST_REGEX" --output-on-failure 2>&1)"
35+
RC=$?
36+
set -e
37+
echo "$OUT"
38+
39+
# 3. False-green guard: demand a positive test count actually ran.
40+
if grep -q "No tests were found" <<<"$OUT"; then
41+
echo "[$GATE] FAIL — hollow run: 0 tests matched $TEST_REGEX" >&2
42+
exit 1
43+
fi
44+
N="$(grep -oE 'out of [0-9]+' <<<"$OUT" | grep -oE '[0-9]+' | tail -1)"
45+
if [ -z "${N:-}" ] || [ "$N" -lt 1 ]; then
46+
echo "[$GATE] FAIL — no positive test count parsed" >&2
47+
exit 1
48+
fi
49+
if [ "$RC" -ne 0 ]; then
50+
echo "[$GATE] FAIL — ctest exit $RC ($N tests)" >&2
51+
exit "$RC"
52+
fi
53+
echo "[$GATE] PASS (CI arm) — $N assembled-block / producer assertions green"
54+
55+
# 4. Optional live regtest arm — only when an isolated dashd is wired in via env.
56+
if [ -n "${DASH_RPC_PASS:-}" ] && [ -n "${DASH_RPC_AUTH:-}" ]; then
57+
echo "[$GATE] live arm: driving scripts/dash_g3a_populated_block_regtest.sh"
58+
"$REPO_ROOT/scripts/dash_g3a_populated_block_regtest.sh"
59+
echo "[$GATE] PASS (live arm) — populated regtest block proven via c2pool-dash submitblock"
60+
else
61+
echo "[$GATE] live regtest arm SKIPPED (set DASH_RPC_PASS + DASH_RPC_AUTH to enable)"
62+
fi

0 commit comments

Comments
 (0)