From e54a87bc44514e907c71728ad96775b962e5e5dc Mon Sep 17 00:00:00 2001 From: igneum-labs <337424239+igneum-labs@users.noreply.github.com> Date: Tue, 6 Oct 2026 20:29:45 +0000 Subject: [PATCH] publish-manifest.sh: the activation height check as a function with --self-test-height (the known-bad case 33000 against 201776, at the DAA, pending, unknown), the shape the shipper's 0.3.15 guard had; the public /api/live stays the source Co-Authored-By: Claude Fable 5.1 --- packaging/ota/publish-manifest.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/packaging/ota/publish-manifest.sh b/packaging/ota/publish-manifest.sh index 4eee0a156..1a857e789 100755 --- a/packaging/ota/publish-manifest.sh +++ b/packaging/ota/publish-manifest.sh @@ -8,6 +8,7 @@ # [--win packaging/windows/dist/Igneum-Miner-Setup-0.3.1.exe] --notes "one line of what changed" \ # [--activation-height 120000 --deadline-note "difficulty v2"] [--min-supported 0.3.0] [--channel devnet] [--deploy] # [--allow-passed-activation] (Horizon polish Q4: an activation height at or below the live DAA is refused otherwise) +# --self-test-height proves the height check on known values (33000 against 201776 refused; 300000 passes) and exits # [--override '{"difficulty_v2_activation_daa":33000,"proving_v0_activation_daa":120000}'] # consensus.override: the exact object every app writes to its override.json (the node's # --override-params-file), so it carries EVERY height switch, not just the new one; @@ -49,6 +50,7 @@ while [ $# -gt 0 ]; do --notes) NOTES="$2"; shift 2 ;; --activation-height) ACTIVATION="$2"; shift 2 ;; --allow-passed-activation) ALLOW_PASSED=1; shift ;; + --self-test-height) SELF_TEST_HEIGHT=1; shift ;; --deadline-note) DEADLINE="$2"; shift 2 ;; --override) OVERRIDE="$2"; shift 2 ;; # consensus.override: the exact JSON object every app writes to its override.json (all height switches, not just the new one) --min-supported) MIN_SUPPORTED="$2"; shift 2 ;; @@ -65,6 +67,24 @@ while [ $# -gt 0 ]; do *) echo "unknown argument: $1" >&2; exit 2 ;; esac done +# Horizon polish Q4 (6 October 2026): has an activation height passed? 0 = pending (above the DAA), 1 = passed (at or +# below it), 2 = unknown (no DAA). A passed activation made every app since the 0.3.14 manifest read the fork as +# close ("0 blocks away, installing now", every safe-moment guard skipped). +activation_passed() { # + local h="$1" daa="$2" + [ "${daa:-0}" -gt 0 ] || return 2 + [ "$h" -le "$daa" ] && return 1 || return 0 +} +if [ "${SELF_TEST_HEIGHT:-0}" = 1 ]; then + # (set -e: a non-zero return is captured with `|| v=$?`, never left bare) + fail=0; v=0 + v=0; activation_passed 33000 201776 || v=$?; [ "$v" -eq 1 ] || { echo "self-test: 33000 against 201776 should read as passed (got $v)" >&2; fail=1; } + v=0; activation_passed 201776 201776 || v=$?; [ "$v" -eq 1 ] || { echo "self-test: a height at the DAA should read as passed (got $v)" >&2; fail=1; } + v=0; activation_passed 300000 201776 || v=$?; [ "$v" -eq 0 ] || { echo "self-test: 300000 against 201776 should read as pending (got $v)" >&2; fail=1; } + v=0; activation_passed 300000 0 || v=$?; [ "$v" -eq 2 ] || { echo "self-test: no DAA should read as unknown (got $v)" >&2; fail=1; } + [ $fail -eq 0 ] && echo "self-test: the activation height check holds (passed, at the DAA, pending, unknown)" + exit $fail +fi [ -n "$VERSION" ] || [ "$VERIFY_ONLY" = 1 ] || { echo "--version is required" >&2; exit 2; } [ -n "$VERSION" ] || VERSION="(the folder's)" [ "$VERIFY_ONLY" = 1 ] || case "$VERSION" in [0-9]*.[0-9]*.[0-9]*) ;; *) echo "--version must be major.minor.patch" >&2; exit 2 ;; esac @@ -181,14 +201,15 @@ NEW="$DEST/igneum-app-latest.json.new" # below it is refused unless --allow-passed-activation says so. if [ -n "$ACTIVATION" ]; then LIVE_DAA="$(curl -fsS --max-time 10 "${IGNEUM_LIVE_API:-https://igneum.network/api/live}" 2>/dev/null | python3 -c 'import json,sys; print(int((json.load(sys.stdin).get("state") or {}).get("daa") or 0))' 2>/dev/null || echo 0)" - if [ "${LIVE_DAA:-0}" -gt 0 ] && [ "$ACTIVATION" -le "$LIVE_DAA" ]; then + verdict=0; activation_passed "$ACTIVATION" "${LIVE_DAA:-0}" || verdict=$? + if [ "$verdict" -eq 1 ]; then if [ "${ALLOW_PASSED:-0}" = 1 ]; then echo "activation height $ACTIVATION is at or below the live DAA $LIVE_DAA (passed); published anyway on --allow-passed-activation" >&2 else echo "refused: activation height $ACTIVATION is at or below the live DAA $LIVE_DAA, so it has passed; a passed activation makes every app read the fork as close (0.3.14 manifest). Drop --activation-height or pass --allow-passed-activation" >&2 exit 2 fi - elif [ "${LIVE_DAA:-0}" -eq 0 ]; then + elif [ "$verdict" -eq 2 ]; then echo "note: the live DAA could not be read from /api/live; the activation height $ACTIVATION is not checked against it" >&2 fi fi