Skip to content

Commit 7d680e8

Browse files
authored
Merge pull request #3077 from IntersectMBO/add_testnet_json
feat(cluster): add testnet.json metadata and status file
2 parents 934e59e + 3cf339f commit 7d680e8

File tree

7 files changed

+67
-26
lines changed

7 files changed

+67
-26
lines changed

cardano_node_tests/cluster_scripts/common/start-cluster-fast

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
#!/usr/bin/env bash
22

3-
# controlling environment variables:
4-
# DBSYNC_REPO - will start and configure db-sync if the value is path to db-sync repository
5-
# SMASH - if set, will start and configure smash
6-
# ENABLE_LEGACY - if set, local cluster will use legacy networking
7-
# MIXED_P2P - if set, local cluster will use P2P for some nodes and legacy topology for others
8-
# UTXO_BACKEND - 'mem' or 'disk', default is 'mem' (or legacy) if unset
9-
# NO_CC - if set, will not create committee
10-
# PV9 - if set, will use protocol version 9
11-
# DRY_RUN - if set, will not start the cluster
12-
133
set -Eeuo pipefail
144
trap 'echo "Error at line $LINENO"' ERR
155

@@ -19,6 +9,7 @@ STATE_CLUSTER="${SOCKET_PATH%/*}"
199
STATE_CLUSTER_NAME="${STATE_CLUSTER##*/}"
2010
SUPERVISORD_SOCKET_PATH="${STATE_CLUSTER}/supervisord.sock"
2111
START_CLUSTER_LOG="${STATE_CLUSTER}/start-cluster.log"
12+
START_CLUSTER_STATUS="${STATE_CLUSTER}/status_started"
2213

2314
INSTANCE_NUM="%%INSTANCE_NUM%%"
2415
if [[ "$SOCKET_PATH" != *"/state-cluster${INSTANCE_NUM}/"* ]]; then
@@ -54,7 +45,7 @@ DELEG_MAGIC_VALUE=3340000000000000
5445
DELEG_SUPPLY="$((POOL_PLEDGE * NUM_POOLS + DELEG_MAGIC_VALUE))"
5546
NONDELEG_SUPPLY="$(( (MAX_SUPPLY - DELEG_SUPPLY) * 8 / 10))"
5647

57-
if [ -f "${STATE_CLUSTER}/supervisord.pid" ]; then
48+
if [ -e "$SUPERVISORD_SOCKET_PATH" ]; then
5849
echo "Cluster already running. Please run \`${STATE_CLUSTER}/stop-cluster\` first!" >&2
5950
exit 1
6051
fi
@@ -83,6 +74,7 @@ cp "${SCRIPT_DIR}/byron-params.json" "$STATE_CLUSTER"
8374
cp "${SCRIPT_DIR}/dbsync-config.yaml" "$STATE_CLUSTER"
8475
cp "${SCRIPT_DIR}/submit-api-config.json" "$STATE_CLUSTER"
8576
cp "${SCRIPT_DIR}/supervisor.conf" "$STATE_CLUSTER"
77+
cp "$SCRIPT_DIR/testnet.json" "$STATE_CLUSTER"
8678
cp "$SCRIPT_DIR"/*genesis*.spec.json "${STATE_CLUSTER}/create_staked/"
8779

8880
if [ -n "${PV9:-""}" ]; then
@@ -716,4 +708,5 @@ if ! check_spend_success "${TXINS[@]}"; then
716708
exit 1
717709
fi
718710

719-
echo "Cluster started"
711+
: > "$START_CLUSTER_STATUS"
712+
echo "Cluster started 🚀"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "conway_fast",
3+
"description": "Local testnet that starts directly in Conway era.",
4+
"control_env": {
5+
"DBSYNC_REPO": "will start and configure db-sync if the value is path to db-sync repository",
6+
"SMASH": "if set, will start and configure smash",
7+
"ENABLE_LEGACY": "if set, local cluster will use legacy networking",
8+
"MIXED_P2P": "if set, local cluster will use P2P for some nodes and legacy topology for others",
9+
"UTXO_BACKEND": "'mem' or 'disk', default is 'mem' (or legacy) if unset",
10+
"NO_CC": "if set, will not create committee",
11+
"PV9": "if set, will use protocol version 9",
12+
"DRY_RUN": "if set, will not start the cluster"
13+
}
14+
}

cardano_node_tests/cluster_scripts/conway_slow/start-cluster

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
#!/usr/bin/env bash
22

3-
# controlling environment variables:
4-
# DBSYNC_REPO - will start and configure db-sync if the value is path to db-sync repository
5-
# SMASH - if set, will start and configure smash
6-
# ENABLE_LEGACY - if set, local cluster will use legacy networking
7-
# MIXED_P2P - if set, local cluster will use P2P for some nodes and legacy topology for others
8-
# UTXO_BACKEND - 'mem' or 'disk', default is 'mem' (or legacy) if unset
9-
# NO_CC - if set, will not create committee
10-
# PV9 - if set, will use protocol version 9
11-
# DRY_RUN - if set, will not start the cluster
12-
133
set -Eeuo pipefail
144
trap 'echo "Error at line $LINENO"' ERR
155

@@ -18,7 +8,9 @@ SOCKET_PATH="$(readlink -m "$CARDANO_NODE_SOCKET_PATH")"
188
STATE_CLUSTER="${SOCKET_PATH%/*}"
199
STATE_CLUSTER_NAME="${STATE_CLUSTER##*/}"
2010
SUPERVISORD_SOCKET_PATH="${STATE_CLUSTER}/supervisord.sock"
11+
# shellcheck disable=SC2034
2112
START_CLUSTER_LOG="${STATE_CLUSTER}/start-cluster.log"
13+
START_CLUSTER_STATUS="${STATE_CLUSTER}/status_started"
2214

2315
INSTANCE_NUM="%%INSTANCE_NUM%%"
2416
if [[ "$SOCKET_PATH" != *"/state-cluster${INSTANCE_NUM}/"* ]]; then
@@ -41,14 +33,16 @@ FEE=5000000
4133
SECURITY_PARAM="$(jq '.securityParam' < "${SCRIPT_DIR}/genesis.spec.json")"
4234
NETWORK_MAGIC="$(jq '.networkMagic' < "${SCRIPT_DIR}/genesis.spec.json")"
4335
MAX_SUPPLY="$(jq '.maxLovelaceSupply' < "${SCRIPT_DIR}/genesis.spec.json")"
36+
# shellcheck disable=SC2034
4437
SLOT_LENGTH="$(jq '.slotLength' < "${SCRIPT_DIR}/genesis.spec.json")"
38+
# shellcheck disable=SC2034
4539
EPOCH_SEC="$(jq '.epochLength * .slotLength | ceil' < "${SCRIPT_DIR}/genesis.spec.json")"
4640
POOL_COST="$(jq '.protocolParams.minPoolCost' < "${SCRIPT_DIR}/genesis.spec.json")"
4741
if [ "$POOL_COST" -eq 0 ]; then
4842
POOL_COST=600
4943
fi
5044

51-
if [ -f "${STATE_CLUSTER}/supervisord.pid" ]; then
45+
if [ -e "$SUPERVISORD_SOCKET_PATH" ]; then
5246
echo "Cluster already running. Please run \`${STATE_CLUSTER}/stop-cluster\` first!" >&2
5347
exit 1
5448
fi
@@ -78,6 +72,7 @@ cp "${SCRIPT_DIR}/byron-params.json" "$STATE_CLUSTER"
7872
cp "${SCRIPT_DIR}/dbsync-config.yaml" "$STATE_CLUSTER"
7973
cp "${SCRIPT_DIR}/submit-api-config.json" "$STATE_CLUSTER"
8074
cp "${SCRIPT_DIR}/supervisor.conf" "$STATE_CLUSTER"
75+
cp "$SCRIPT_DIR/testnet.json" "$STATE_CLUSTER"
8176
cp "$SCRIPT_DIR"/*genesis*.spec.json "${STATE_CLUSTER}/shelley/"
8277

8378
if [ -n "${PV9:-""}" ]; then
@@ -1428,4 +1423,5 @@ if [ -z "${PV9:-""}" ]; then
14281423
[ "$PROTOCOL_VERSION" = 10 ] || { echo "Unexpected protocol version '$PROTOCOL_VERSION' on line $LINENO" >&2; exit 1; } # assert
14291424
fi
14301425

1431-
echo "Cluster started"
1426+
: > "$START_CLUSTER_STATUS"
1427+
echo "Cluster started 🚀"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "conway_slow",
3+
"description": "Local testnet that starts in Byron era and hard-forks through all the protocol versions until it gets to Conway.",
4+
"control_env": {
5+
"DBSYNC_REPO": "will start and configure db-sync if the value is path to db-sync repository",
6+
"SMASH": "if set, will start and configure smash",
7+
"ENABLE_LEGACY": "if set, local cluster will use legacy networking",
8+
"MIXED_P2P": "if set, local cluster will use P2P for some nodes and legacy topology for others",
9+
"UTXO_BACKEND": "'mem' or 'disk', default is 'mem' (or legacy) if unset",
10+
"NO_CC": "if set, will not create committee",
11+
"PV9": "if set, will use protocol version 9",
12+
"DRY_RUN": "if set, will not start the cluster"
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "mainnet_fast",
3+
"description": "Local testnet that starts directly in Conway era and has the same epoch length as Mainnet.",
4+
"control_env": {
5+
"DBSYNC_REPO": "will start and configure db-sync if the value is path to db-sync repository",
6+
"SMASH": "if set, will start and configure smash",
7+
"ENABLE_LEGACY": "if set, local cluster will use legacy networking",
8+
"MIXED_P2P": "if set, local cluster will use P2P for some nodes and legacy topology for others",
9+
"UTXO_BACKEND": "'mem' or 'disk', default is 'mem' (or legacy) if unset",
10+
"NO_CC": "if set, will not create committee",
11+
"PV9": "if set, will use protocol version 9",
12+
"DRY_RUN": "if set, will not start the cluster"
13+
}
14+
}

cardano_node_tests/cluster_scripts/testnets/start-cluster

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ STATE_CLUSTER="${SOCKET_PATH%/*}"
1010
STATE_CLUSTER_NAME="${STATE_CLUSTER##*/}"
1111
SUPERVISORD_SOCKET_PATH="${STATE_CLUSTER}/supervisord.sock"
1212
START_CLUSTER_LOG="${STATE_CLUSTER}/start-cluster.log"
13+
START_CLUSTER_STATUS="${STATE_CLUSTER}/status_started"
1314

1415
INSTANCE_NUM="%%INSTANCE_NUM%%"
1516
if [[ "$SOCKET_PATH" != *"/state-cluster${INSTANCE_NUM}/"* ]]; then
1617
echo "CARDANO_NODE_SOCKET_PATH must be set to a path containing 'state-cluster${INSTANCE_NUM}', line $LINENO" >&2
1718
exit 1
1819
fi
1920

20-
if [ -f "$STATE_CLUSTER/supervisord.pid" ]; then
21+
if [ -e "$SUPERVISORD_SOCKET_PATH" ]; then
2122
echo "Cluster already running. Please run \`${STATE_CLUSTER}/stop-cluster\` first!" >&2
2223
exit 1
2324
fi
@@ -52,6 +53,7 @@ cp "$TESTNET_DIR"/shelley/faucet.* "$STATE_CLUSTER/shelley"
5253
cp "$SCRIPT_DIR"/cardano-node-* "$STATE_CLUSTER"
5354
cp "$SCRIPT_DIR/run-cardano-submit-api" "$STATE_CLUSTER"
5455
cp "$SCRIPT_DIR/supervisor.conf" "$STATE_CLUSTER"
56+
cp "$SCRIPT_DIR/testnet.json" "$STATE_CLUSTER"
5557
cp "$TESTNET_CONF_DIR/topology-relay1.json" "$STATE_CLUSTER"
5658
cp "$TESTNET_CONF_DIR"/genesis-*.json "$STATE_CLUSTER"
5759
ln -rs "$STATE_CLUSTER/genesis-byron.json" "$STATE_CLUSTER/byron/genesis.json"
@@ -228,4 +230,5 @@ faucet_init_balance="$(get_address_balance \
228230
--address "$(<"$STATE_CLUSTER/shelley/faucet.addr")")"
229231
echo "Faucet initial balance: $faucet_init_balance" >> "$START_CLUSTER_LOG"
230232

231-
echo "Cluster started"
233+
: > "$START_CLUSTER_STATUS"
234+
echo "Cluster started 🚀"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "testnets",
3+
"description": "Setup for long-running testnets like Preview.",
4+
"control_env": {
5+
"DBSYNC_REPO": "will start and configure db-sync if the value is path to db-sync repository"
6+
}
7+
}

0 commit comments

Comments
 (0)