Skip to content

Commit a958412

Browse files
committed
Introduce a network.json file
This file is expected to hold transaction ids for released Hydra versions. As such we can use it to make the tutorial simpler to be kept up-to-date.
1 parent 2632d92 commit a958412

File tree

4 files changed

+41
-7
lines changed

4 files changed

+41
-7
lines changed

CONTRIBUTING.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ During development
198198
To perform a release of next `<version>`:
199199

200200
1. Publish hydra scripts onto `preview`, `preprod`, and `mainnet` using the
201-
[smoke test][smoke-test] and take note of the transaction ids.
201+
[smoke test][smoke-test] and put the transaction ids as new `<version>`
202+
entries into [networks.json](./networks.json).
202203
2. Update CHANGELOG.md by replacing `UNRELEASED` with a date in
203204
[ISO8601](https://en.wikipedia.org/wiki/ISO_8601) and prepare contents.
204205
3. Run `./release.sh <version>`

docs/docs/tutorial/index.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ chmod +x bin/*
5858
mkdir -p bin
5959
version=0.13.0
6060
curl -L -O https://github.com/input-output-hk/hydra/releases/download/${version}/hydra-aarch64-darwin-${version}.zip
61-
unzip -d bin hydra-aarch64-darwin-${version}.zip
61+
unzip -d bin hydra-aarch64-darwin-${HYDRA_VERSION}.zip
6262
curl -L -o - https://github.com/input-output-hk/mithril/releases/download/2347.0/mithril-2347.0-macos-x64.tar.gz \
6363
| tar xz -C bin
6464
curl -L -o - https://github.com/input-output-hk/cardano-node/releases/download/8.1.2/cardano-node-8.1.2-macos.tar.gz \
@@ -381,11 +381,11 @@ In summary, the Hydra head participants exchanged and agreed on:
381381

382382
## Step 3: Start the Hydra node
383383

384-
With all these parameters defined, we now pick a version of the Head protocol we
385-
want to use. This is defined by the `hydra-node --version` itself and the
384+
With all these parameters defined, we now pick a HYDRA_VERSION of the Head protocol we
385+
want to use. This is defined by the `hydra-node --HYDRA_VERSION` itself and the
386386
`--hydra-scripts-tx-id` which point to scripts published on-chain.
387387

388-
For all [released](https://github.com/input-output-hk/hydra/releases) versions
388+
For all [released](https://github.com/input-output-hk/hydra/releases) HYDRA_VERSIONs
389389
of the `hydra-node` and common Cardano networks, the scripts do get
390390
pre-published and we can just use them. See the [user
391391
manual](../getting-started/quickstart#reference-scripts) for more information
@@ -397,12 +397,13 @@ Let's start the `hydra-node` with all these parameters now:
397397
<TabItem value="alice" label="Alice">
398398

399399
```shell
400+
version=0.13.0
400401
hydra-node \
401402
--node-id "alice-node" \
402403
--persistence-dir persistence-alice \
403404
--cardano-signing-key credentials/alice-node.sk \
404405
--hydra-signing-key credentials/alice-hydra.sk \
405-
--hydra-scripts-tx-id e5eb53b913e274e4003692d7302f22355af43f839f7aa73cb5eb53510f564496 \
406+
--hydra-scripts-tx-id $(curl https://raw.githubusercontent.com/input-output-hk/hydra/master/networks.json | jq -r ".preprod.\"${version}\"") \
406407
--ledger-protocol-parameters protocol-parameters.json \
407408
--testnet-magic 1 \
408409
--node-socket node.socket \
@@ -419,12 +420,13 @@ hydra-node \
419420
<TabItem value="bob" label="Bob">
420421

421422
```shell
423+
version=0.13.0
422424
hydra-node \
423425
--node-id "bob-node" \
424426
--persistence-dir persistence-bob \
425427
--cardano-signing-key credentials/bob-node.sk \
426428
--hydra-signing-key credentials/bob-hydra.sk \
427-
--hydra-scripts-tx-id e5eb53b913e274e4003692d7302f22355af43f839f7aa73cb5eb53510f564496 \
429+
--hydra-scripts-tx-id $(curl https://raw.githubusercontent.com/input-output-hk/hydra/master/networks.json | jq -r ".preprod.\"${version}\"") \
428430
--ledger-protocol-parameters protocol-parameters.json \
429431
--testnet-magic 1 \
430432
--node-socket node.socket \

networks.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"mainnet": {
3+
"0.13.0": "989e3ab136a2cdd3132a99975e76e02f62bcb03ba64ddbb5d2dfddffca8d390d"
4+
},
5+
"preprod": {
6+
"0.13.0": "f917dcd1fa2653e33d6d0ca5a067468595b546120c3085fab60848c34f92c265",
7+
"0.14.0": "d8ba8c488f52228b200df48fe28305bc311d0507da2c2420b10835bf00d21948"
8+
},
9+
"preview": {
10+
"0.13.0": "1e00c627ec4b2ad0b4aa68068d3818ca0e41338c87e5504cda118c4050a98763"
11+
}
12+
}

release.sh

+19
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ check_can_release() {
4949
confirm_uncommitted_changes
5050
check_version_is_valid $version
5151
check_changelog_is_up_to_date $version
52+
check_networks_is_up_to_date $version
5253

5354
true #avoid error on last instruction of function (see bash -e)
5455
}
@@ -139,6 +140,24 @@ check_changelog_is_up_to_date() {
139140
true #avoid error on last instruction of function (see bash -e)
140141
}
141142

143+
# Check whether a transaction id is present for all networks and given version.
144+
check_networks_is_up_to_date() {
145+
local version="$1"
146+
147+
local networks=(
148+
mainnet
149+
preprod
150+
preview
151+
)
152+
153+
local networks_file=networks.json
154+
155+
for network in "${networks[@]}"; do
156+
cat ${networks_file} | jq -e ".\"${network}\".\"${version}\"" > /dev/null \
157+
|| exit_err "Missing transaction id for ${version} on ${network} in ${networks_file}"
158+
done
159+
}
160+
142161
# Prepare helper functions
143162

144163
update_cabal_version() {

0 commit comments

Comments
 (0)