From a9584122325e3877277f302e4d8369699000e574 Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Fri, 1 Dec 2023 19:10:06 +0100 Subject: [PATCH] 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. --- CONTRIBUTING.md | 3 ++- docs/docs/tutorial/index.md | 14 ++++++++------ networks.json | 12 ++++++++++++ release.sh | 19 +++++++++++++++++++ 4 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 networks.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3ed6359a8c3..aebaf6e15ec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -198,7 +198,8 @@ During development To perform a release of next ``: 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 `` + 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 ` diff --git a/docs/docs/tutorial/index.md b/docs/docs/tutorial/index.md index bedbd4b46e0..c1f767cd3c5 100644 --- a/docs/docs/tutorial/index.md +++ b/docs/docs/tutorial/index.md @@ -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 \ @@ -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 @@ -397,12 +397,13 @@ Let's start the `hydra-node` with all these parameters now: ```shell +version=0.13.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 \ @@ -419,12 +420,13 @@ hydra-node \ ```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 \ diff --git a/networks.json b/networks.json new file mode 100644 index 00000000000..32afe6ea3be --- /dev/null +++ b/networks.json @@ -0,0 +1,12 @@ +{ + "mainnet": { + "0.13.0": "989e3ab136a2cdd3132a99975e76e02f62bcb03ba64ddbb5d2dfddffca8d390d" + }, + "preprod": { + "0.13.0": "f917dcd1fa2653e33d6d0ca5a067468595b546120c3085fab60848c34f92c265", + "0.14.0": "d8ba8c488f52228b200df48fe28305bc311d0507da2c2420b10835bf00d21948" + }, + "preview": { + "0.13.0": "1e00c627ec4b2ad0b4aa68068d3818ca0e41338c87e5504cda118c4050a98763" + } +} diff --git a/release.sh b/release.sh index 127a4c83410..398ca1cc93c 100755 --- a/release.sh +++ b/release.sh @@ -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) } @@ -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() {