Skip to content

Commit

Permalink
Introduce a network.json file
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ch1bo committed Dec 1, 2023
1 parent 036faea commit b500377
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ During development
To perform a release of next `<version>`:

1. Publish hydra scripts onto `preview`, `preprod`, and `mainnet` using the
[smoke test][smoke-test] and take note of the transaction ids.
[smoke test][smoke-test] and put the transaction ids as new `<version>`
entries into [networks.json](./networks.json).
2. Update CHANGELOG.md by replacing `UNRELEASED` with a date in
[ISO8601](https://en.wikipedia.org/wiki/ISO_8601) and prepare contents.
3. Run `./release.sh <version>`
Expand Down
14 changes: 8 additions & 6 deletions docs/docs/tutorial/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ chmod +x bin/*
mkdir -p bin
version=0.13.0
curl -L -O https://github.com/input-output-hk/hydra/releases/download/${version}/hydra-aarch64-darwin-${version}.zip
unzip -d bin hydra-aarch64-darwin-${version}.zip
unzip -d bin hydra-aarch64-darwin-${HYDRA_VERSION}.zip
curl -L -o - https://github.com/input-output-hk/mithril/releases/download/2347.0/mithril-2347.0-macos-x64.tar.gz \
| tar xz -C bin
curl -L -o - https://github.com/input-output-hk/cardano-node/releases/download/8.1.2/cardano-node-8.1.2-macos.tar.gz \
Expand Down Expand Up @@ -381,11 +381,11 @@ In summary, the Hydra head participants exchanged and agreed on:

## Step 3: Start the Hydra node

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

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

```shell
version=0.14.0
hydra-node \
--node-id "alice-node" \
--persistence-dir persistence-alice \
--cardano-signing-key credentials/alice-node.sk \
--hydra-signing-key credentials/alice-hydra.sk \
--hydra-scripts-tx-id e5eb53b913e274e4003692d7302f22355af43f839f7aa73cb5eb53510f564496 \
--hydra-scripts-tx-id $(curl https://raw.githubusercontent.com/input-output-hk/hydra/master/networks.json | jq -r ".preprod.\"${version}\"") \
--ledger-protocol-parameters protocol-parameters.json \
--testnet-magic 1 \
--node-socket node.socket \
Expand All @@ -419,12 +420,13 @@ hydra-node \
<TabItem value="bob" label="Bob">

```shell
version=0.13.0
hydra-node \
--node-id "bob-node" \
--persistence-dir persistence-bob \
--cardano-signing-key credentials/bob-node.sk \
--hydra-signing-key credentials/bob-hydra.sk \
--hydra-scripts-tx-id e5eb53b913e274e4003692d7302f22355af43f839f7aa73cb5eb53510f564496 \
--hydra-scripts-tx-id $(curl https://raw.githubusercontent.com/input-output-hk/hydra/master/networks.json | jq -r ".preprod.\"${version}\"") \
--ledger-protocol-parameters protocol-parameters.json \
--testnet-magic 1 \
--node-socket node.socket \
Expand Down
12 changes: 12 additions & 0 deletions networks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"mainnet": {
"0.13.0": "989e3ab136a2cdd3132a99975e76e02f62bcb03ba64ddbb5d2dfddffca8d390d"
},
"preprod": {
"0.13.0": "f917dcd1fa2653e33d6d0ca5a067468595b546120c3085fab60848c34f92c265",
"0.14.0": "d8ba8c488f52228b200df48fe28305bc311d0507da2c2420b10835bf00d21948"
},
"preview": {
"0.13.0": "1e00c627ec4b2ad0b4aa68068d3818ca0e41338c87e5504cda118c4050a98763"
}
}
19 changes: 19 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ check_can_release() {
confirm_uncommitted_changes
check_version_is_valid $version
check_changelog_is_up_to_date $version
check_networks_is_up_to_date $version

true #avoid error on last instruction of function (see bash -e)
}
Expand Down Expand Up @@ -139,6 +140,24 @@ check_changelog_is_up_to_date() {
true #avoid error on last instruction of function (see bash -e)
}

# Check whether a transaction id is present for all networks and given version.
check_networks_is_up_to_date() {
local version="$1"

local networks=(
mainnet
preprod
preview
)

local networks_file=networks.json

for network in "${networks[@]}"; do
cat ${networks_file} | jq -e ".\"${network}\".\"${version}\"" > /dev/null \
|| exit_err "Missing transaction id for ${version} on ${network} in ${networks_file}"
done
}

# Prepare helper functions

update_cabal_version() {
Expand Down

0 comments on commit b500377

Please sign in to comment.