Skip to content

Commit

Permalink
Merge pull request #1383 from input-output-hk/disable-mithril-sanchonet
Browse files Browse the repository at this point in the history
Disable mithril sanchonet
  • Loading branch information
v0d1ch authored Apr 3, 2024
2 parents 6c0b994 + 1a2d2f5 commit c9d3553
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 46 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ changes.

## [0.16.0] - UNRELEASED

- Tested with `cardano-node 8.9.0`, `cardano-cli 8.20.3.0` and `mithril 2408.0`.
- Tested with `cardano-node 8.9.0`, `cardano-cli 8.20.3.0` and `mithril 2412.0`.

- **BREAKING** Hydra scripts changed due to updates in the `plutus` toolchain:
- Overall slight increase in script size.
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/tutorial/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ curl -L -O https://github.com/input-output-hk/hydra/releases/download/${version}
unzip -d bin hydra-x86_64-linux-${version}.zip
curl -L -o - https://github.com/input-output-hk/cardano-node/releases/download/8.9.0/cardano-node-8.9.0-linux.tar.gz \
| tar xz ./bin/cardano-node ./bin/cardano-cli
curl -L -o - https://github.com/input-output-hk/mithril/releases/download/2408.0/mithril-2408.0-linux-x64.tar.gz \
curl -L -o - https://github.com/input-output-hk/mithril/releases/download/2412.0/mithril-2412.0-linux-x64.tar.gz \
| tar xz -C bin mithril-client
chmod +x bin/*
```
Expand All @@ -61,7 +61,7 @@ curl -L -O https://github.com/input-output-hk/hydra/releases/download/${version}
unzip -d bin hydra-aarch64-darwin-${version}.zip
curl -L -o - https://github.com/input-output-hk/cardano-node/releases/download/8.9.0/cardano-node-8.9.0-macos.tar.gz \
| tar xz --wildcards ./bin/cardano-node ./bin/cardano-cli './bin/*.dylib'
curl -L -o - https://github.com/input-output-hk/mithril/releases/download/2408.0/mithril-2408.0-macos-x64.tar.gz \
curl -L -o - https://github.com/input-output-hk/mithril/releases/download/2412.0/mithril-2412.0-macos-x64.tar.gz \
| tar xz -C bin
chmod +x bin/*
```
Expand Down Expand Up @@ -122,7 +122,7 @@ We will be using the `mithril-client` configured to download from
`preprod` network to download the latest blockchain snapshot:

```shell
mithril-client snapshot download latest
mithril-client cardano-db download latest
```

<details>
Expand Down
26 changes: 13 additions & 13 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
flake = false;
};
cardano-node.url = "github:intersectmbo/cardano-node/8.9.0";
mithril.url = "github:input-output-hk/mithril/2408.0";
mithril.url = "github:input-output-hk/mithril/2412.0";
nix-npm-buildpackage.url = "github:serokell/nix-npm-buildpackage";
};

Expand Down
55 changes: 27 additions & 28 deletions hydra-cluster/src/Hydra/Cluster/Mithril.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Hydra.Cluster.Fixture (KnownNetwork (..))
import Network.HTTP.Simple (getResponseBody, httpBS, parseRequest)
import System.IO.Error (isEOFError)
import System.Process.Typed (createPipe, getStderr, proc, setStderr, withProcessWait_)
import Test.Hydra.Prelude (pendingWith)

data MithrilLog
= StartSnapshotDownload {network :: KnownNetwork, directory :: FilePath}
Expand All @@ -23,22 +24,22 @@ data MithrilLog
-- directory.
downloadLatestSnapshotTo :: Tracer IO MithrilLog -> KnownNetwork -> FilePath -> IO ()
downloadLatestSnapshotTo tracer network directory = do
case (genesisKeyURLForNetwork network, aggregatorEndpointForNetwork network) of
(Just genesisKeyURL, Just aggregatorEndpoint) -> do
traceWith tracer StartSnapshotDownload{network, directory}
genesisKey <- parseRequest genesisKeyURL >>= httpBS <&> getResponseBody
let cmd =
setStderr createPipe $
proc "mithril-client" $
concat
[ ["--aggregator-endpoint", aggregatorEndpoint]
, ["snapshot", "download", "latest"]
, ["--genesis-verification-key", decodeUtf8 genesisKey]
, ["--download-dir", directory]
, ["--json"]
]
withProcessWait_ cmd traceStderr
_ -> error $ "Network " <> show network <> " not supported by mithril."
when (network == Sanchonet) $
pendingWith "Mithril deployment of testing-sanchonet requires mithril-client 0.7.8, which is not yet released and does not work on other networks."

traceWith tracer StartSnapshotDownload{network, directory}
genesisKey <- parseRequest genesisKeyURL >>= httpBS <&> getResponseBody
let cmd =
setStderr createPipe $
proc "mithril-client" $
concat
[ ["--aggregator-endpoint", aggregatorEndpoint]
, ["cardano-db", "download", "latest"]
, ["--genesis-verification-key", decodeUtf8 genesisKey]
, ["--download-dir", directory]
, ["--json"]
]
withProcessWait_ cmd traceStderr
where
traceStderr p =
ignoreEOFErrors . forever $ do
Expand All @@ -50,16 +51,14 @@ downloadLatestSnapshotTo tracer network directory = do
ignoreEOFErrors =
handleJust (guard . isEOFError) (const $ pure ())

genesisKeyURLForNetwork :: KnownNetwork -> Maybe String
genesisKeyURLForNetwork = \case
Mainnet -> Just "https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/release-mainnet/genesis.vkey"
Preproduction -> Just "https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/release-preprod/genesis.vkey"
Preview -> Just "https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/pre-release-preview/genesis.vkey"
Sanchonet -> Just "https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-sanchonet/genesis.vkey"
genesisKeyURL = case network of
Mainnet -> "https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/release-mainnet/genesis.vkey"
Preproduction -> "https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/release-preprod/genesis.vkey"
Preview -> "https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/pre-release-preview/genesis.vkey"
Sanchonet -> "https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-sanchonet/genesis.vkey"

aggregatorEndpointForNetwork :: KnownNetwork -> Maybe String
aggregatorEndpointForNetwork = \case
Mainnet -> Just "https://aggregator.release-mainnet.api.mithril.network/aggregator"
Preproduction -> Just "https://aggregator.release-preprod.api.mithril.network/aggregator"
Preview -> Just "https://aggregator.pre-release-preview.api.mithril.network/aggregator"
Sanchonet -> Just "https://aggregator.testing-sanchonet.api.mithril.network/aggregator"
aggregatorEndpoint = case network of
Mainnet -> "https://aggregator.release-mainnet.api.mithril.network/aggregator"
Preproduction -> "https://aggregator.release-preprod.api.mithril.network/aggregator"
Preview -> "https://aggregator.pre-release-preview.api.mithril.network/aggregator"
Sanchonet -> "https://aggregator.testing-sanchonet.api.mithril.network/aggregator"

0 comments on commit c9d3553

Please sign in to comment.