Skip to content

Commit c59a1ee

Browse files
committed
nmc: 2e soak harness LEG1 binds chain_id to aux_id.hpp SSOT at runtime
Replace the hand-typed NMC_AUXPOW_CHAIN_ID=1 literal with a runtime derivation from src/impl/nmc/coin/aux_id.hpp (the #247 SSOT), normalizing the 0x0001 hex form to decimal for the createauxblock chainid compare. A scripts-only slice can no longer drift from consensus, and a missing header now fails the harness loud as a #247-not-in-tree pre-flight.
1 parent b42437d commit c59a1ee

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

scripts/nmc_regtest_aux_soak.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
# gen-nmc-daemon-creds.sh; no secret ever touches a coordination card.
2626
set -euo pipefail
2727

28-
NMC_AUXPOW_CHAIN_ID=1 # nmc::coin::NMC_AUXPOW_CHAIN_ID SSOT (aux_id.hpp); 0x0001
28+
# NMC_AUXPOW_CHAIN_ID is DERIVED from the aux_id.hpp SSOT at runtime (see below),
29+
# never a hand-typed literal -- the one place a scripts-only slice can drift from consensus.
2930
CLI_BIN="${NMC_CLI:-namecoin-cli}"
3031
DAEMON_BIN="${NMC_DAEMON:-namecoind}"
3132
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -53,6 +54,16 @@ trap cleanup EXIT
5354

5455
need "$DAEMON_BIN"; need "$CLI_BIN"; need openssl
5556

57+
# --- chain_id SSOT bind: derive from src/impl/nmc/coin/aux_id.hpp at runtime so this
58+
# scripts-only slice can NEVER drift from consensus (integrator UID1607). The header
59+
# ships with #247; its absence is also a clean "#247 not in-tree yet" pre-flight.
60+
AUX_ID_HDR="$SCRIPT_DIR/../src/impl/nmc/coin/aux_id.hpp"
61+
[ -f "$AUX_ID_HDR" ] || die "aux_id.hpp SSOT not found at $AUX_ID_HDR (#247 must be merged into the tree)"
62+
_RAW_CHAIN_ID="$(grep -E 'NMC_AUXPOW_CHAIN_ID[[:space:]]*=' "$AUX_ID_HDR" | sed -E 's/.*=[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+).*/\1/' | head -1 || true)"
63+
[ -n "$_RAW_CHAIN_ID" ] || die "could not parse NMC_AUXPOW_CHAIN_ID from $AUX_ID_HDR (SSOT format changed)"
64+
NMC_AUXPOW_CHAIN_ID=$(( _RAW_CHAIN_ID )) # normalize 0x0001 -> 1 for the decimal RPC compare
65+
log "chain_id SSOT bound from aux_id.hpp: raw=$_RAW_CHAIN_ID normalized=$NMC_AUXPOW_CHAIN_ID"
66+
5667
# --- provision creds (idempotent, self-service) --------------------------------
5768
NMC_REGTEST_DATADIR="$DATADIR_A" bash "$SCRIPT_DIR/gen-nmc-daemon-creds.sh" || true
5869
mkdir -p "$DATADIR_B"; chmod 700 "$DATADIR_B"

0 commit comments

Comments
 (0)