Sync workspace: config, docs, scripts, CI, operator rules, and submodule pointers.
- Update dbis_core, cross-chain-pmm-lps, explorer-monorepo, metamask-integration, pr-workspace/chains - Omit embedded publish git dirs and empty placeholders from index Made-with: Cursor
This commit is contained in:
22
scripts/xdc-zero/README.md
Normal file
22
scripts/xdc-zero/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# XDC Zero + Chain 138 — scripts
|
||||
|
||||
| Script | Purpose |
|
||||
|--------|---------|
|
||||
| [`run-xdc-zero-138-operator-sequence.sh`](run-xdc-zero-138-operator-sequence.sh) | Print ordered operator steps (start here). |
|
||||
| [`clone-and-build-xdc-relayer.sh`](clone-and-build-xdc-relayer.sh) | `git clone` + `npm install` + `npm run build` for [XDC-Relayer](https://github.com/XinFinOrg/XDC-Relayer). |
|
||||
| [`deploy-endpoint-chain138.sh`](deploy-endpoint-chain138.sh) | Deploy the Chain 138 Endpoint stack from the XDC-Zero clone. Default path uses Hardhat; add `--manual` to deploy directly from artifacts when the Hardhat helper stalls on Besu. |
|
||||
| [`cast-deploy-simplecsc-chain138.sh`](cast-deploy-simplecsc-chain138.sh) | Deploy **SimpleCsc** (lab only) via `cast send --create`. |
|
||||
| [`set-fragment-addresses.sh`](set-fragment-addresses.sh) | Write **`config/xdc-zero/deployed/*.json`** from env; use with merge via `XDC_ZERO_CHAIN138_FRAG` / `XDC_ZERO_REG_FRAG`. Supports `--chain138-only` to stage the live Chain 138 endpoint before the parent side is deployed. |
|
||||
| [`merge-endpointconfig-chain138.sh`](merge-endpointconfig-chain138.sh) | Merge `chain138` + append parent `registers[]` (`jq`, backup). |
|
||||
| [`run-registerchain-both.sh`](run-registerchain-both.sh) | `registerchain.js` on `xdcparentnet` + `chain138`. |
|
||||
| [`run-registerapplications-both.sh`](run-registerapplications-both.sh) | `registerapplications.js` on both networks. |
|
||||
|
||||
**Relayer env templates:** `config/xdc-zero/xdc-relayer.dotenv.example` is for a clone-local `.env`; `config/xdc-zero/xdc-zero-relayer-138-pair.example.defaults` is the source for `/etc/default/xdc-zero-relayer-138-pair` when using the systemd unit. **XDC parent chain facts** (chain id 50, RPC mirrors, explorers): see `config/xdc-zero/README.md` section *XDC Network (parent)*.
|
||||
|
||||
**Preflight:** [`../verify/xdc-zero-chain138-preflight.sh`](../verify/xdc-zero-chain138-preflight.sh)
|
||||
|
||||
**Troubleshooting:** [docs/03-deployment/CHAIN138_XDC_ZERO_DEPLOYMENT_TROUBLESHOOTING.md](../../docs/03-deployment/CHAIN138_XDC_ZERO_DEPLOYMENT_TROUBLESHOOTING.md)
|
||||
|
||||
**Operator-local outputs:** `config/xdc-zero/deployed/endpoint-chain138.env` can store the coherent Chain 138 library + Endpoint addresses before you complete the parent-side deploy and merge steps.
|
||||
|
||||
**Runbook:** [docs/03-deployment/CHAIN138_XDC_ZERO_BRIDGE_RUNBOOK.md](../../docs/03-deployment/CHAIN138_XDC_ZERO_BRIDGE_RUNBOOK.md)
|
||||
45
scripts/xdc-zero/cast-deploy-simplecsc-chain138.sh
Executable file
45
scripts/xdc-zero/cast-deploy-simplecsc-chain138.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
# Deploy SimpleCsc (test contract — spike only) on Chain 138 via cast.
|
||||
# Usage: bash scripts/xdc-zero/cast-deploy-simplecsc-chain138.sh
|
||||
# Optional: GAS_PRICE_WEI=500000000000 (raise if Besu reports replacement underpriced)
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
# shellcheck source=/dev/null
|
||||
source "${PROJECT_ROOT}/scripts/lib/load-project-env.sh"
|
||||
|
||||
ART="${XDC_ZERO_ENDPOINT_DIR:-${HOME}/projects/XDC-Zero/endpoint}/artifacts/contracts/test/SimpleCsc.sol/SimpleCsc.json"
|
||||
[[ -f "$ART" ]] || {
|
||||
echo "ERROR: compile XDC-Zero endpoint first (artifact missing): $ART" >&2
|
||||
exit 1
|
||||
}
|
||||
command -v cast >/dev/null 2>&1 || {
|
||||
echo "ERROR: cast (foundry) required" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
BC=$(jq -r '.bytecode' "$ART")
|
||||
[[ -n "$BC" && "$BC" != null ]]
|
||||
|
||||
EXTRA=()
|
||||
if [[ -n "${GAS_PRICE_WEI:-}" ]]; then
|
||||
EXTRA+=(--gas-price "$GAS_PRICE_WEI")
|
||||
fi
|
||||
|
||||
echo "Deploying SimpleCsc to RPC_URL_138=$RPC_URL_138 ..."
|
||||
out=$(cast send --json --rpc-url "$RPC_URL_138" --private-key "$PRIVATE_KEY" --create "$BC" "${EXTRA[@]}" 2>&1) || {
|
||||
echo "$out" >&2
|
||||
echo "See docs/03-deployment/CHAIN138_XDC_ZERO_DEPLOYMENT_TROUBLESHOOTING.md (replacement / pending tx)." >&2
|
||||
exit 1
|
||||
}
|
||||
echo "$out"
|
||||
contract=$(printf '%s' "$out" | jq -r '.contractAddress // empty' 2>/dev/null || true)
|
||||
if [[ -z "$contract" || "$contract" == null ]]; then
|
||||
contract=$(printf '%s' "$out" | grep -oE '0x[a-fA-F0-9]{40}' | tail -1 || true)
|
||||
fi
|
||||
if [[ -n "$contract" ]]; then
|
||||
echo "SIMPLE_CSC_CHAIN138=$contract"
|
||||
echo "Append to config/xdc-zero/deployed/endpoint-chain138.env if desired."
|
||||
fi
|
||||
22
scripts/xdc-zero/clone-and-build-xdc-relayer.sh
Executable file
22
scripts/xdc-zero/clone-and-build-xdc-relayer.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Shallow-clone and build XinFin XDC-Relayer (Node 20+ recommended).
|
||||
# Usage: XDC_RELAYER_DIR=~/projects/XDC-Relayer bash scripts/xdc-zero/clone-and-build-xdc-relayer.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
DEST="${XDC_RELAYER_DIR:-${HOME}/projects/XDC-Relayer}"
|
||||
REPO_URL="${XDC_RELAYER_REPO_URL:-https://github.com/XinFinOrg/XDC-Relayer.git}"
|
||||
|
||||
if [[ ! -d "$DEST/.git" ]]; then
|
||||
git clone --depth 1 "$REPO_URL" "$DEST"
|
||||
fi
|
||||
cd "$DEST"
|
||||
command -v npm >/dev/null 2>&1 || {
|
||||
echo "ERROR: npm required" >&2
|
||||
exit 1
|
||||
}
|
||||
npm install
|
||||
npm run build
|
||||
echo "OK: built $DEST — run: cd $DEST && npm run start (needs .env + Redis per upstream README)"
|
||||
70
scripts/xdc-zero/deploy-endpoint-chain138.sh
Executable file
70
scripts/xdc-zero/deploy-endpoint-chain138.sh
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
# Deploy XDC-Zero Endpoint (+ EthereumTrieDB + MerklePatricia) to Chain 138 via Hardhat.
|
||||
# Requires: XDC-Zero clone with endpoint/hardhat.config.js network "chain138", yarn, PRIVATE_KEY.
|
||||
#
|
||||
# Usage:
|
||||
# XDC_ZERO_REPO=/path/to/XDC-Zero bash scripts/xdc-zero/deploy-endpoint-chain138.sh [--dry-run]
|
||||
#
|
||||
# RPC: RPC_URL_138 or endpoint/network.config.json "chain138" (repo dotenv loaded from proxmox root).
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
# shellcheck source=/dev/null
|
||||
source "${PROJECT_ROOT}/scripts/lib/load-project-env.sh"
|
||||
|
||||
DRY_RUN=false
|
||||
MANUAL=false
|
||||
for a in "$@"; do
|
||||
[[ "$a" == "--dry-run" ]] && DRY_RUN=true
|
||||
[[ "$a" == "--manual" ]] && MANUAL=true
|
||||
done
|
||||
|
||||
REPO="${XDC_ZERO_REPO:-${HOME}/projects/XDC-Zero}"
|
||||
EP="${REPO}/endpoint"
|
||||
if [[ ! -d "$EP" ]]; then
|
||||
echo "ERROR: XDC-Zero endpoint not found: $EP — set XDC_ZERO_REPO" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${EP}/hardhat.config.js" ]]; then
|
||||
echo "ERROR: missing ${EP}/hardhat.config.js" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${PRIVATE_KEY:-}" ]]; then
|
||||
echo "ERROR: PRIVATE_KEY not set (smom-dbis-138/.env or root .env after load-project-env)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if $DRY_RUN; then
|
||||
if $MANUAL; then
|
||||
echo "DRY-RUN: cd $EP && node scripts/endpointdeploy-manual.js"
|
||||
elif command -v yarn >/dev/null 2>&1; then
|
||||
echo "DRY-RUN: cd $EP && yarn hardhat run scripts/endpointdeploy.js --network chain138"
|
||||
else
|
||||
echo "DRY-RUN: cd $EP && npx hardhat run scripts/endpointdeploy.js --network chain138"
|
||||
fi
|
||||
echo "RPC_URL_138=${RPC_URL_138:-<from network.config.json chain138>}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cd "$EP"
|
||||
if [[ ! -d node_modules ]]; then
|
||||
if command -v yarn >/dev/null 2>&1; then
|
||||
echo "Installing endpoint dependencies (yarn)..."
|
||||
yarn --silent
|
||||
else
|
||||
echo "Installing endpoint dependencies (npm)..."
|
||||
npm install --silent
|
||||
fi
|
||||
fi
|
||||
echo "Deploying Endpoint stack to chain138 (if this hangs, see CHAIN138_XDC_ZERO_DEPLOYMENT_TROUBLESHOOTING.md)..."
|
||||
if $MANUAL; then
|
||||
node scripts/endpointdeploy-manual.js
|
||||
elif command -v yarn >/dev/null 2>&1; then
|
||||
yarn hardhat run scripts/endpointdeploy.js --network chain138
|
||||
else
|
||||
npx hardhat run scripts/endpointdeploy.js --network chain138
|
||||
fi
|
||||
echo "Done. Record MerklePatricia + Endpoint addresses; update fragments / merge endpointconfig."
|
||||
@@ -16,8 +16,8 @@ set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
FRAG="$PROJECT_ROOT/config/xdc-zero/endpointconfig.fragment.chain138.example.json"
|
||||
REG_FRAG="$PROJECT_ROOT/config/xdc-zero/xdcparentnet-register-chain138.fragment.json"
|
||||
FRAG="${XDC_ZERO_CHAIN138_FRAG:-$PROJECT_ROOT/config/xdc-zero/endpointconfig.fragment.chain138.example.json}"
|
||||
REG_FRAG="${XDC_ZERO_REG_FRAG:-$PROJECT_ROOT/config/xdc-zero/xdcparentnet-register-chain138.fragment.json}"
|
||||
|
||||
DRY_RUN=false
|
||||
BASE=""
|
||||
@@ -56,6 +56,7 @@ command -v jq >/dev/null 2>&1 || { echo "ERROR: jq required" >&2; exit 1; }
|
||||
_step1="$(jq --slurpfile f "$FRAG" '.chain138 = $f[0].chain138' "$BASE")"
|
||||
MERGED="$(printf '%s\n' "$_step1" | jq --slurpfile r "$REG_FRAG" '
|
||||
(if .xdcparentnet == null then . + {xdcparentnet: {registers: []}} else . end)
|
||||
| .xdcparentnet.registers //= []
|
||||
| .xdcparentnet.registers += $r[0]
|
||||
')"
|
||||
|
||||
|
||||
48
scripts/xdc-zero/run-registerapplications-both.sh
Executable file
48
scripts/xdc-zero/run-registerapplications-both.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run XDC-Zero registerapplications.js on xdcparentnet and chain138.
|
||||
# Prerequisites: applications[] filled in endpointconfig.json for each network; Endpoint owner key.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
# shellcheck source=/dev/null
|
||||
source "${PROJECT_ROOT}/scripts/lib/load-project-env.sh"
|
||||
|
||||
EP="${XDC_ZERO_ENDPOINT_DIR:-${HOME}/projects/XDC-Zero/endpoint}"
|
||||
DRY=false
|
||||
[[ "${1:-}" == "--dry-run" ]] && DRY=true
|
||||
|
||||
[[ -f "${EP}/endpointconfig.json" ]] || {
|
||||
echo "ERROR: missing ${EP}/endpointconfig.json" >&2
|
||||
exit 1
|
||||
}
|
||||
cd "$EP"
|
||||
if [[ ! -d node_modules ]]; then
|
||||
if command -v yarn >/dev/null 2>&1; then
|
||||
yarn install
|
||||
else
|
||||
npm install
|
||||
fi
|
||||
fi
|
||||
|
||||
run() {
|
||||
local net="$1"
|
||||
if $DRY; then
|
||||
if command -v yarn >/dev/null 2>&1; then
|
||||
echo "DRY-RUN: yarn hardhat run scripts/registerapplications.js --network $net"
|
||||
else
|
||||
echo "DRY-RUN: npx hardhat run scripts/registerapplications.js --network $net"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
if command -v yarn >/dev/null 2>&1; then
|
||||
yarn hardhat run scripts/registerapplications.js --network "$net"
|
||||
else
|
||||
npx hardhat run scripts/registerapplications.js --network "$net"
|
||||
fi
|
||||
}
|
||||
|
||||
run xdcparentnet
|
||||
run chain138
|
||||
echo "Done."
|
||||
58
scripts/xdc-zero/run-registerchain-both.sh
Executable file
58
scripts/xdc-zero/run-registerchain-both.sh
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run XDC-Zero registerchain.js on xdcparentnet and chain138 (owner txs).
|
||||
# Prerequisites: merged endpointconfig.json, PRIVATE_KEY is Endpoint owner, yarn deps installed.
|
||||
#
|
||||
# Usage:
|
||||
# source scripts/lib/load-project-env.sh
|
||||
# XDC_ZERO_ENDPOINT_DIR=/path/to/XDC-Zero/endpoint bash scripts/xdc-zero/run-registerchain-both.sh [--dry-run]
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
# shellcheck source=/dev/null
|
||||
source "${PROJECT_ROOT}/scripts/lib/load-project-env.sh"
|
||||
|
||||
EP="${XDC_ZERO_ENDPOINT_DIR:-${HOME}/projects/XDC-Zero/endpoint}"
|
||||
DRY=false
|
||||
[[ "${1:-}" == "--dry-run" ]] && DRY=true
|
||||
|
||||
[[ -f "${EP}/endpointconfig.json" ]] || {
|
||||
echo "ERROR: missing ${EP}/endpointconfig.json" >&2
|
||||
exit 1
|
||||
}
|
||||
[[ -f "${EP}/hardhat.config.js" ]] || {
|
||||
echo "ERROR: missing Hardhat project at $EP" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
cd "$EP"
|
||||
if [[ ! -d node_modules ]]; then
|
||||
if command -v yarn >/dev/null 2>&1; then
|
||||
yarn install
|
||||
else
|
||||
npm install
|
||||
fi
|
||||
fi
|
||||
|
||||
run() {
|
||||
local net="$1"
|
||||
if $DRY; then
|
||||
if command -v yarn >/dev/null 2>&1; then
|
||||
echo "DRY-RUN: yarn hardhat run scripts/registerchain.js --network $net"
|
||||
else
|
||||
echo "DRY-RUN: npx hardhat run scripts/registerchain.js --network $net"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
if command -v yarn >/dev/null 2>&1; then
|
||||
yarn hardhat run scripts/registerchain.js --network "$net"
|
||||
else
|
||||
npx hardhat run scripts/registerchain.js --network "$net"
|
||||
fi
|
||||
}
|
||||
|
||||
# Parent first or 138 first — both must succeed for bilateral registration
|
||||
run xdcparentnet
|
||||
run chain138
|
||||
echo "Done. Next: registerapplications.js on both networks if apps are configured."
|
||||
34
scripts/xdc-zero/run-xdc-zero-138-operator-sequence.sh
Executable file
34
scripts/xdc-zero/run-xdc-zero-138-operator-sequence.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# Print the recommended operator sequence (XDC Zero parent <-> Chain 138).
|
||||
# Usage: bash scripts/xdc-zero/run-xdc-zero-138-operator-sequence.sh
|
||||
|
||||
cat <<'EOF'
|
||||
Recommended sequence (after clearing any stuck deployer txs on 138 — see CHAIN138_XDC_ZERO_DEPLOYMENT_TROUBLESHOOTING.md):
|
||||
|
||||
1. RPC: bash scripts/verify/xdc-zero-chain138-preflight.sh
|
||||
2. Config: bash scripts/validation/validate-xdc-zero-config.sh
|
||||
3. Relayer: bash scripts/xdc-zero/clone-and-build-xdc-relayer.sh
|
||||
# Configure Redis + copy config/xdc-zero/xdc-relayer.dotenv.example to the relayer clone .env
|
||||
# or copy config/xdc-zero/xdc-zero-relayer-138-pair.example.defaults to /etc/default/xdc-zero-relayer-138-pair
|
||||
# Policy: relayer/service SUBNET_URL should use https://rpc-http-pub.d-bis.org, not Core
|
||||
4. Deploy parent Endpoint + CSC (XDC-Zero endpoint/, network xdcparentnet) — manual or upstream scripts; use stock CSC for production.
|
||||
5. Deploy 138 Endpoint:
|
||||
XDC_ZERO_REPO=~/projects/XDC-Zero bash scripts/xdc-zero/deploy-endpoint-chain138.sh
|
||||
# If Hardhat stalls on Besu, rerun with:
|
||||
# XDC_ZERO_REPO=~/projects/XDC-Zero bash scripts/xdc-zero/deploy-endpoint-chain138.sh --manual
|
||||
Optional spike CSC on 138:
|
||||
bash scripts/xdc-zero/cast-deploy-simplecsc-chain138.sh
|
||||
6. Addresses → fragments:
|
||||
export ENDPOINT_ON_138=... CSC_PARENT_ON_138=... ENDPOINT_ON_PARENT=... CSC_138_ON_PARENT=...
|
||||
bash scripts/xdc-zero/set-fragment-addresses.sh
|
||||
7. Merge: XDC_ZERO_CHAIN138_FRAG=.../deployed/endpointconfig.fragment.chain138.json \
|
||||
XDC_ZERO_REG_FRAG=.../deployed/xdcparentnet-register-chain138.fragment.json \
|
||||
bash scripts/xdc-zero/merge-endpointconfig-chain138.sh /path/to/XDC-Zero/endpoint/endpointconfig.json
|
||||
8. Register chains:
|
||||
XDC_ZERO_ENDPOINT_DIR=.../XDC-Zero/endpoint bash scripts/xdc-zero/run-registerchain-both.sh
|
||||
9. Apps + approve:
|
||||
XDC_ZERO_ENDPOINT_DIR=... bash scripts/xdc-zero/run-registerapplications-both.sh
|
||||
10. systemd: install config/systemd/xdc-zero-relayer-138-pair.example.service
|
||||
# Use config/xdc-zero/xdc-zero-relayer-138-pair.example.defaults for /etc/default/xdc-zero-relayer-138-pair
|
||||
|
||||
EOF
|
||||
64
scripts/xdc-zero/set-fragment-addresses.sh
Executable file
64
scripts/xdc-zero/set-fragment-addresses.sh
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
# Patch XDC Zero fragment JSON files with deployed addresses (no merge into endpointconfig yet).
|
||||
#
|
||||
# Required env:
|
||||
# ENDPOINT_ON_138 — Zero Endpoint on Chain 138
|
||||
# CSC_PARENT_ON_138 — CSC on 138 storing parent block roots
|
||||
# ENDPOINT_ON_PARENT — Zero Endpoint on XDC parent (Apothem/mainnet)
|
||||
# CSC_138_ON_PARENT — CSC on parent storing Chain 138 roots
|
||||
# Optional:
|
||||
# XDC_PARENT_CHAIN_ID=50 — chain id for parent as seen from Chain 138 register entry
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
DIR="$PROJECT_ROOT/config/xdc-zero"
|
||||
OUTD="$DIR/deployed"
|
||||
mkdir -p "$OUTD"
|
||||
|
||||
CHAIN138_ONLY=false
|
||||
for a in "$@"; do
|
||||
[[ "$a" == "--chain138-only" ]] && CHAIN138_ONLY=true
|
||||
done
|
||||
|
||||
: "${ENDPOINT_ON_138:?}"
|
||||
if ! $CHAIN138_ONLY; then
|
||||
: "${CSC_PARENT_ON_138:?}"
|
||||
: "${ENDPOINT_ON_PARENT:?}"
|
||||
: "${CSC_138_ON_PARENT:?}"
|
||||
fi
|
||||
PEER_CID="${XDC_PARENT_CHAIN_ID:-50}"
|
||||
|
||||
command -v jq >/dev/null 2>&1 || {
|
||||
echo "ERROR: jq required" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
F1_OUT="${OUTD}/endpointconfig.fragment.chain138.json"
|
||||
F2_OUT="${OUTD}/xdcparentnet-register-chain138.fragment.json"
|
||||
|
||||
jq --argjson cid "$PEER_CID" \
|
||||
--arg csc "${CSC_PARENT_ON_138:-0x0000000000000000000000000000000000000000}" \
|
||||
--arg ep "${ENDPOINT_ON_PARENT:-0x0000000000000000000000000000000000000000}" \
|
||||
--arg e138 "$ENDPOINT_ON_138" \
|
||||
'.chain138.endpoint = $e138
|
||||
| .chain138.registers[0].chainId = $cid
|
||||
| .chain138.registers[0].csc = $csc
|
||||
| .chain138.registers[0].endpoint = $ep' \
|
||||
"$DIR/endpointconfig.fragment.chain138.example.json" >"$F1_OUT"
|
||||
|
||||
jq --arg csc "${CSC_138_ON_PARENT:-0x0000000000000000000000000000000000000000}" --arg ep "$ENDPOINT_ON_138" \
|
||||
'.[0].csc = $csc | .[0].endpoint = $ep | .[0].chainId = 138' \
|
||||
"$DIR/xdcparentnet-register-chain138.fragment.json" >"$F2_OUT"
|
||||
|
||||
echo "Wrote (gitignored dir):"
|
||||
echo " $F1_OUT"
|
||||
echo " $F2_OUT"
|
||||
if $CHAIN138_ONLY; then
|
||||
echo "Mode: chain138-only"
|
||||
echo " note: parent-side CSC/Endpoint addresses are still zero placeholders."
|
||||
fi
|
||||
echo "Merge with:"
|
||||
echo " XDC_ZERO_CHAIN138_FRAG=$F1_OUT XDC_ZERO_REG_FRAG=$F2_OUT \\"
|
||||
echo " bash scripts/xdc-zero/merge-endpointconfig-chain138.sh --dry-run /path/to/XDC-Zero/endpoint/endpointconfig.json"
|
||||
Reference in New Issue
Block a user