From 10cffc00f1cf8861d3dd076e35a689393846e650 Mon Sep 17 00:00:00 2001 From: Satya Date: Thu, 17 Sep 2026 13:06:37 +0800 Subject: [PATCH] Update Ogmios to 7.0.0 / Kupo to 2.12.0 and fix devnet startup issues Move Ogmios and Kupo back to the CardanoSolutions upstream and drop the PV11 stopgap that bundled Linux x86_64 IntersectMBO builds into the arm64 image. Both components now ship native binaries for linux/amd64, linux/arm64 and macOS arm64, so the Docker images no longer need x86_64 emulation and a native macOS install works. Ogmios / Kupo - Bump to Ogmios 7.0.0 and Kupo 2.12.0 from CardanoSolutions (.tar.gz -> .zip) - Use real aarch64 assets for arm64 instead of emulated x86_64 ones - Consolidate the duplicated OS/arch resolution into one helper that fails fast with an actionable message on unpublished platforms (macOS x86_64, Windows) instead of 404-ing - Flatten the nested archive layout the macOS zips use (v7.0.0/bin/ogmios) so the binary always lands at /bin/ - Handle the Kupo tag/asset version mismatch (tag v2.12, asset v2.12.0) Ogmios as the Yaci Store tx evaluator - Enable Ogmios by default (ogmios_enabled=true) and use it to evaluate Plutus script costs, falling back to the embedded Scalus evaluator - Wait for Ogmios to answer on /health before committing to the ogmios evaluator mode. The mode is baked into the Store process at startup and never re-evaluated, so a short-lived Ogmios would otherwise leave the Store unable to evaluate any script for the lifetime of the devnet - Skip Ogmios/Kupo in yano-only mode; they need the Haskell node's n2c socket - Don't let an Ogmios failure abort the startup chain before Yaci Store runs - Treat enableOgmios as optional in the admin API so omitting it keeps the configured default rather than forcing Ogmios off Fix prometheus.port never being applied The property was read, stored on ClusterInfo and put into the Mustache values map, but templates/configuration.json hardcoded 12798 with no placeholder, so the value was silently dropped. A second cardano-node on the host holding 12798 made the devnet node die at bind with the error going to stderr, which node.sh does not capture. Disable the Yano DuckLake projection archive Yano pre15's devnet profile enables the projection archive by default. DevKit reads nothing from Yano's history API, and the archive defaults to ./history relative to the working directory - the shared yano home - so it outlived create-node -o and then failed the startup identity and coverage guards. Turn it off and pin the dir inside the node folder so it is cleaned up with the cluster if it is ever re-enabled. Also bumps Yano to 0.1.0-pre15. Co-Authored-By: Claude Opus 5 (1M context) --- .gitignore | 2 + README.md | 10 +- applications/cli/Earthfile | 5 - applications/cli/config/download.properties | 15 +- applications/cli/docker/download-kupo.sh | 22 +-- .../cli/docker/download-kupo.sh.original | 25 --- applications/cli/docker/download-ogmios.sh | 20 +-- .../cli/docker/download-ogmios.sh.original | 27 ---- .../commands/common/DownloadService.java | 147 +++++++++++------- .../commands/general/DownloadCommand.java | 12 +- .../api/ClusterAdminController.java | 10 +- .../localcluster/ogmios/OgmiosService.java | 69 +++++++- .../yacistore/YaciStoreService.java | 22 ++- .../localcluster/yano/YanoConfigBuilder.java | 11 +- .../localcluster/yano/YanoService.java | 4 +- .../devnet/templates/configuration.json | 2 +- config/env | 4 +- docs/pages/getting-started/docker.mdx | 16 +- docs/pages/known-issues.mdx | 33 ++-- docs/pages/services.mdx | 4 +- npm/yaci-devkit/README.md | 2 + scripts/info.sh | 2 +- 22 files changed, 266 insertions(+), 198 deletions(-) delete mode 100644 applications/cli/docker/download-kupo.sh.original delete mode 100644 applications/cli/docker/download-ogmios.sh.original diff --git a/.gitignore b/.gitignore index 28de45b4..0af7ccdf 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ applications/cli/src/main/resources/static/wallet/ /applications/cli/chainstate/ /e2e-tests/evolution-sdk/node_modules/ /chainstate/ +*.swp +*.swo diff --git a/README.md b/README.md index 0eae0e28..8889098b 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ For most development scenarios, Yaci DevKit runs a single Cardano node: │ API Layer │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ Yaci Store │ │ Ogmios │ │ Kupo │ │ -│ │ (Indexer) │ │ (Optional) │ │ (Optional) │ │ +│ │ (Indexer) │ │ (Tx Eval) │ │ (Optional) │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ └─────────────────────────────────────────────────────────────┘ │ @@ -90,8 +90,8 @@ For PV11 hard fork compatible local devnets, use the PV11 beta release from this | **[Yaci Store](https://github.com/bloxbean/yaci-store)** | Lightweight indexer with Blockfrost-compatible APIs | 8080 | | **[Yaci Viewer](./applications/viewer)** | Web-based blockchain explorer for developers | 5173 | | **Cardano Node** | Official Cardano node (supports both amd64/arm64) | 3001 (n2n), 3333 (n2c through socat) | -| **[Ogmios](https://ogmios.dev/)** | WebSocket API for Cardano (optional) | 1337 | -| **[Kupo](https://cardanosolutions.github.io/kupo/)** | Chain indexer (optional) | 1442 | +| **[Ogmios](https://ogmios.dev/) v7.0.0** | WebSocket API for Cardano (enabled by default; used as Yaci Store's tx evaluator) | 1337 | +| **[Kupo](https://cardanosolutions.github.io/kupo/) v2.12.0** | Chain indexer (optional) | 1442 | | **MCP Server** | AI coding assistant integration | 10000 | ## 🎯 Quick Start @@ -173,7 +173,9 @@ yaci-cli> create-node -o --start (Can be used in a Java app with Cardano Client Lib's Blockfrost backend or [Javascript app with MeshJS + Blockfrost provider](https://github.com/MeshJS/examples/blob/main/mesh/yaci-send-lovelace.ts) as it exposes required BF compatible minimum apis for tx building and submission) - **Yaci Store Swagger UI**: http://localhost:8080/swagger-ui/index.html -- **Ogmios Url (Optional)**: http://localhost:1337 +- **Ogmios Url**: http://localhost:1337 + + (Enabled by default and used by Yaci Store to evaluate Plutus script costs. Set `ogmios_enabled=false` in `config/env` to fall back to the embedded Scalus evaluator.) **(Optional) If you enabled Kupo** - **Kupo Url (Optional)**: http://localhost:1442 diff --git a/applications/cli/Earthfile b/applications/cli/Earthfile index 6e1d3b30..41941726 100644 --- a/applications/cli/Earthfile +++ b/applications/cli/Earthfile @@ -91,11 +91,6 @@ docker-build: COPY docker/download-$TARGETARCH.sh . RUN sh download-$TARGETARCH.sh - # PV11 Ogmios/Kupo IntersectMBO artifacts are Linux x86_64-only for now. - # The arm64 image bundles those x86_64 binaries as a temporary Apple Silicon - # Docker Desktop workaround; native Linux arm64 hosts may fail at runtime - # unless x86_64 binfmt/qemu emulation is available. - #Ogmios download COPY docker/download-ogmios.sh . RUN bash download-ogmios.sh $TARGETARCH diff --git a/applications/cli/config/download.properties b/applications/cli/config/download.properties index ab51f963..44be2a4d 100644 --- a/applications/cli/config/download.properties +++ b/applications/cli/config/download.properties @@ -1,19 +1,20 @@ #Please specify either the version or the full url for the following components node.version=11.0.1 -ogmios.version=6.14.0.2 -kupo.version=2.11.0.1 +ogmios.version=7.0.0 +kupo.version=2.12.0 yaci.store.tag=rel-native-2.0.1-devkit yaci.store.version=2.0.1-devkit yaci.store.jar.version=2.0.1 -yano.tag=v0.1.0-pre6 -yano.version=0.1.0-pre6 +yano.tag=v0.1.0-pre15 +yano.version=0.1.0-pre15 #node.url= -# IntersectMBO currently publishes the PV11-compatible Ogmios/Kupo builds only -# for Linux x86_64. These default versions resolve on Linux x86_64; on other -# platforms, set a compatible custom URL here when one is available. +# Ogmios/Kupo are published by CardanoSolutions for x86_64-linux, aarch64-linux +# and aarch64-macos. The Linux builds are statically linked; the macOS builds link +# only against system libraries. macOS x86_64 and Windows are not published : on +# those set a compatible custom URL here or use the DevKit Docker image. #ogmios.url= #kupo.url= #yaci.store.url= diff --git a/applications/cli/docker/download-kupo.sh b/applications/cli/docker/download-kupo.sh index f4631115..898a38b4 100644 --- a/applications/cli/docker/download-kupo.sh +++ b/applications/cli/docker/download-kupo.sh @@ -1,21 +1,13 @@ #!/bin/bash set -euo pipefail -# PV11 workaround: IntersectMBO currently publishes the cardano-node 11.0.1 -# compatible Kupo release only as a Linux x86_64 tarball. We bundle it for -# arm64 Docker images too so Apple Silicon Docker Desktop can run it through -# emulation. This may fail at runtime on native Linux arm64 hosts without -# x86_64 binfmt/qemu support. Keep the original CardanoSolutions downloader in -# download-kupo.sh.original for reverting once upstream publishes the needed -# assets again. +# Assign the architecture based on user input and determine the correct suffix case "${1:-}" in amd64) ARCH="x86_64" ;; arm64) - echo "Warning: IntersectMBO Kupo v2.11.0.1 has no Linux arm64 asset." - echo "Bundling the Linux x86_64 artifact for arm64 Docker image compatibility on Docker Desktop." - ARCH="x86_64" + ARCH="aarch64" ;; *) echo "Error: Invalid architecture specified. Use 'amd64' or 'arm64'." @@ -23,15 +15,17 @@ case "${1:-}" in ;; esac -version=v2.11.0.1 -file=kupo-${version}-${ARCH}-linux.tar.gz -url=https://github.com/IntersectMBO/kupo/releases/download/${version}/${file} +# Kupo release tags are major.minor (v2.12) while the asset carries the full version (v2.12.0) +version=v2.12.0 +tag=v2.12 +file=kupo-${version}-${ARCH}-linux.zip +url=https://github.com/CardanoSolutions/kupo/releases/download/${tag}/${file} wget "${url}" rm -rf /app/kupo mkdir -p /app/kupo -tar -xzf "${file}" -C /app/kupo +unzip "${file}" -d /app/kupo chmod +x /app/kupo/bin/kupo diff --git a/applications/cli/docker/download-kupo.sh.original b/applications/cli/docker/download-kupo.sh.original deleted file mode 100644 index 5db3c8ff..00000000 --- a/applications/cli/docker/download-kupo.sh.original +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Assign the architecture based on user input and determine the correct suffix -case $1 in - amd64) - ARCH="x86_64" - ;; - arm64) - ARCH="aarch64" - ;; - *) - echo "Error: Invalid architecture specified. Use 'amd64' or 'arm64'." - exit 1 - ;; -esac - -file=kupo-v2.11.0-$ARCH-linux.zip -wget https://github.com/CardanoSolutions/kupo/releases/download/v2.11/$file - -mkdir /app/kupo -unzip $file -d /app/kupo - -chmod +x /app/kupo/bin/kupo - -rm $file diff --git a/applications/cli/docker/download-ogmios.sh b/applications/cli/docker/download-ogmios.sh index 3a56223d..d323a425 100644 --- a/applications/cli/docker/download-ogmios.sh +++ b/applications/cli/docker/download-ogmios.sh @@ -1,21 +1,13 @@ #!/bin/bash set -euo pipefail -# PV11 workaround: IntersectMBO currently publishes the cardano-node 11.0.1 -# compatible Ogmios release only as a Linux x86_64 tarball. We bundle it for -# arm64 Docker images too so Apple Silicon Docker Desktop can run it through -# emulation. This may fail at runtime on native Linux arm64 hosts without -# x86_64 binfmt/qemu support. Keep the original CardanoSolutions downloader in -# download-ogmios.sh.original for reverting once upstream publishes the needed -# assets again. +# Assign the architecture based on user input and determine the correct suffix case "${1:-}" in amd64) ARCH="x86_64" ;; arm64) - echo "Warning: IntersectMBO Ogmios v6.14.0.2 has no Linux arm64 asset." - echo "Bundling the Linux x86_64 artifact for arm64 Docker image compatibility on Docker Desktop." - ARCH="x86_64" + ARCH="aarch64" ;; *) echo "Error: Invalid architecture specified. Use 'amd64' or 'arm64'." @@ -23,15 +15,15 @@ case "${1:-}" in ;; esac -version=v6.14.0.2 -file=ogmios-${version}-${ARCH}-linux.tar.gz -url=https://github.com/IntersectMBO/ogmios/releases/download/${version}/${file} +version=v7.0.0 +file=ogmios-${version}-${ARCH}-linux.zip +url=https://github.com/CardanoSolutions/ogmios/releases/download/${version}/${file} wget "${url}" rm -rf /app/ogmios mkdir -p /app/ogmios -tar -xzf "${file}" -C /app/ogmios +unzip "${file}" -d /app/ogmios chmod +x /app/ogmios/bin/ogmios diff --git a/applications/cli/docker/download-ogmios.sh.original b/applications/cli/docker/download-ogmios.sh.original deleted file mode 100644 index 93f34bd9..00000000 --- a/applications/cli/docker/download-ogmios.sh.original +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Assign the architecture based on user input and determine the correct suffix -case $1 in - amd64) - SUFFIX="x86_64" - ;; - arm64) - SUFFIX="aarch64" - ;; - *) - echo "Error: Invalid architecture specified. Use 'amd64' or 'arm64'." - exit 1 - ;; -esac - - -version=v6.14.0 -file=ogmios-${version}-${SUFFIX}-linux.zip -wget https://github.com/CardanoSolutions/ogmios/releases/download/${version}/$file - -mkdir /app/ogmios -unzip $file -d /app/ogmios - -chmod +x /app/ogmios/bin/ogmios - -rm $file diff --git a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/commands/common/DownloadService.java b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/commands/common/DownloadService.java index e5d50179..2ae290ad 100644 --- a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/commands/common/DownloadService.java +++ b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/commands/common/DownloadService.java @@ -32,10 +32,6 @@ public class DownloadService { private final static String YACI_STORE_DOWNLOAD_URL = "https://github.com/bloxbean/yaci-store/releases/download"; private final static String OGMIOS_DOWNLOAD_URL = "https://github.com/CardanoSolutions/ogmios/releases/download"; private final static String KUPO_DOWNLOAD_URL = "https://github.com/CardanoSolutions/kupo/releases/download"; - private final static String INTERSECT_OGMIOS_DOWNLOAD_URL = "https://github.com/IntersectMBO/ogmios/releases/download"; - private final static String INTERSECT_KUPO_DOWNLOAD_URL = "https://github.com/IntersectMBO/kupo/releases/download"; - private final static String INTERSECT_OGMIOS_VERSION = "6.14.0.2"; - private final static String INTERSECT_KUPO_VERSION = "2.11.0.1"; private final static String YANO_DOWNLOAD_URL = "https://github.com/bloxbean/yano/releases/download"; private final ClusterConfig clusterConfig; @@ -315,8 +311,8 @@ public boolean downloadJre(boolean overwrite) { public boolean downloadOgmios(boolean overwrite) { String downloadPath = resolveOgmiosDownloadPath(); - if ( downloadPath == null) { - writeLn(error("Download URL for ogmios is not set. Please set the download URL in download.properties")); + if (downloadPath == null) { + //resolveOgmiosDownloadPath() has already reported the specific reason return false; } @@ -337,7 +333,14 @@ public boolean downloadOgmios(boolean overwrite) { if (downloadedFile != null) { try { extractArchive(downloadedFile.toFile().getAbsolutePath(), clusterConfig.getOgmiosHome(), downloadPath); + flattenNestedArchiveLayout(clusterConfig.getOgmiosHome(), "ogmios"); + if (!ogmiosExec.toFile().exists()) { + writeLn(error("ogmios binary was not found at %s after extraction. The downloaded archive may be invalid.", + ogmiosExec.toFile().getAbsolutePath())); + return false; + } setExecutablePermission(ogmiosExec.toFile().getAbsolutePath()); + Files.deleteIfExists(downloadedFile); return true; } catch (IOException e) { writeLn(error("Error extracting ogmios" + e.getMessage())); @@ -352,8 +355,8 @@ public boolean downloadOgmios(boolean overwrite) { public boolean downloadKupo(boolean overwrite) { String downloadPath = resolveKupoDownloadPath(); - if ( downloadPath == null) { - writeLn(error("Download URL for Kupo is not set. Please set the download URL in download.properties")); + if (downloadPath == null) { + //resolveKupoDownloadPath() has already reported the specific reason return false; } @@ -374,7 +377,14 @@ public boolean downloadKupo(boolean overwrite) { if (downloadedFile != null) { try { extractArchive(downloadedFile.toFile().getAbsolutePath(), clusterConfig.getKupoHome(), downloadPath); + flattenNestedArchiveLayout(clusterConfig.getKupoHome(), "kupo"); + if (!kupoExec.toFile().exists()) { + writeLn(error("kupo binary was not found at %s after extraction. The downloaded archive may be invalid.", + kupoExec.toFile().getAbsolutePath())); + return false; + } setExecutablePermission(kupoExec.toFile().getAbsolutePath()); + Files.deleteIfExists(downloadedFile); return true; } catch (IOException e) { writeLn(error("Error extracting kupo" + e.getMessage())); @@ -558,6 +568,44 @@ private String resolveArchiveFileName(String component, String downloadPath) { return isTarGz(downloadPath) ? component + ".tar.gz" : component + ".zip"; } + /** + * CardanoSolutions release archives are not consistent across platforms : the Ogmios macOS build + * nests everything under a single version directory (v7.0.0/bin/ogmios) while the Linux builds are + * flat (bin/ogmios). Flatten the nested layout so the executable is always at + * <targetDir>/bin/<binaryName>, which is what the runtime services expect. + */ + private void flattenNestedArchiveLayout(String targetDir, String binaryName) throws IOException { + Path target = Path.of(targetDir); + if (Files.exists(target.resolve("bin").resolve(binaryName))) + return; + + Path nestedRoot = null; + try (var children = Files.list(target)) { + var candidates = children.filter(Files::isDirectory) + .filter(dir -> Files.exists(dir.resolve("bin").resolve(binaryName))) + .toList(); + if (candidates.size() == 1) + nestedRoot = candidates.get(0); + } + + if (nestedRoot == null) + return; + + writeLn(info("Flattening nested archive layout : %s", nestedRoot.getFileName().toString())); + + //Move files individually rather than whole directories : moving a directory onto an existing + //non-empty directory fails with DirectoryNotEmptyException even with REPLACE_EXISTING. + try (var files = Files.walk(nestedRoot)) { + for (Path source : files.filter(Files::isRegularFile).toList()) { + Path destination = target.resolve(nestedRoot.relativize(source).toString()); + Files.createDirectories(destination.getParent()); + Files.move(source, destination, StandardCopyOption.REPLACE_EXISTING); + } + } + + FileUtils.deleteDirectory(nestedRoot.toFile()); + } + private boolean isTarGz(String downloadPath) { String normalized = downloadPath.toLowerCase(Locale.ROOT); return normalized.contains(".tar.gz") || normalized.contains(".tgz"); @@ -702,36 +750,11 @@ private String resolveOgmiosDownloadPath() { return null; } - if (INTERSECT_OGMIOS_VERSION.equals(ogmiosVersion)) { - if (!isLinuxX86_64()) { - writeLn(error("Ogmios %s is currently available from IntersectMBO only for Linux x86_64. Set ogmios.url to a compatible build or use the DevKit Docker image.", ogmiosVersion)); - return null; - } - - return INTERSECT_OGMIOS_DOWNLOAD_URL + "/v" + ogmiosVersion + "/ogmios-v" + ogmiosVersion + "-x86_64-linux.tar.gz"; - } - - String osPrefix = null; - if (SystemUtils.IS_OS_MAC) { - osPrefix = "macos"; - } else if (SystemUtils.IS_OS_LINUX) { - osPrefix = "linux"; - } else { - writeLn(error("Unsupported OS : " + System.getProperty("os.name"))); - } - - if (osPrefix == null) + String platformSuffix = resolveOgmiosKupoPlatformSuffix("Ogmios", "ogmios.url"); + if (platformSuffix == null) return null; - String arch = System.getProperty("os.arch"); - String cpuArch = null; - if (arch.startsWith("aarch") || arch.startsWith("arm")) { - cpuArch = "aarch64"; - } else{ - cpuArch = "x86_64"; - } - - String url = OGMIOS_DOWNLOAD_URL + "/v" + ogmiosVersion + "/ogmios-v" + ogmiosVersion + "-" + cpuArch + "-" + osPrefix + ".zip"; + String url = OGMIOS_DOWNLOAD_URL + "/v" + ogmiosVersion + "/ogmios-v" + ogmiosVersion + "-" + platformSuffix + ".zip"; return url; } @@ -745,47 +768,51 @@ private String resolveKupoDownloadPath() { return null; } - if (INTERSECT_KUPO_VERSION.equals(kupoVersion)) { - if (!isLinuxX86_64()) { - writeLn(error("Kupo %s is currently available from IntersectMBO only for Linux x86_64. Set kupo.url to a compatible build or use the DevKit Docker image.", kupoVersion)); - return null; - } + String platformSuffix = resolveOgmiosKupoPlatformSuffix("Kupo", "kupo.url"); + if (platformSuffix == null) + return null; - return INTERSECT_KUPO_DOWNLOAD_URL + "/v" + kupoVersion + "/kupo-v" + kupoVersion + "-x86_64-linux.tar.gz"; - } + //Kupo release tags are major.minor (e.g. v2.12) while the asset name carries the + //full version (e.g. kupo-v2.12.0-x86_64-linux.zip) + String versionParts[] = kupoVersion.split("\\."); + String trimmedVersionPath = kupoVersion; + if (versionParts.length == 3) + trimmedVersionPath = versionParts[0] + "." + versionParts[1]; - String osPrefix = null; + String url = KUPO_DOWNLOAD_URL + "/v" + trimmedVersionPath + "/kupo-v" + kupoVersion + "-" + platformSuffix + ".zip"; + return url; + } + + /** + * Resolves the "<cpuArch>-<os>" suffix used by CardanoSolutions Ogmios/Kupo release assets. + * Only x86_64-linux, aarch64-linux and aarch64-macos builds are published, so any other OS/arch + * combination fails fast with an actionable message instead of a 404 download. + */ + private String resolveOgmiosKupoPlatformSuffix(String component, String urlProperty) { + String osPrefix; if (SystemUtils.IS_OS_MAC) { osPrefix = "macos"; } else if (SystemUtils.IS_OS_LINUX) { osPrefix = "linux"; } else { writeLn(error("Unsupported OS : " + System.getProperty("os.name"))); - } - - if (osPrefix == null) return null; + } String arch = System.getProperty("os.arch"); - String cpuArch = null; + String cpuArch; if (arch.startsWith("aarch") || arch.startsWith("arm")) { cpuArch = "aarch64"; - } else{ + } else { cpuArch = "x86_64"; } - String versionParts[] = kupoVersion.split("\\."); - String trimmedVersionPath = kupoVersion; - if (versionParts.length == 3) - trimmedVersionPath = versionParts[0] + "." + versionParts[1]; - - String url = KUPO_DOWNLOAD_URL + "/v" + trimmedVersionPath + "/kupo-v" + kupoVersion + "-" + cpuArch + "-" + osPrefix + ".zip"; - return url; - } + if (SystemUtils.IS_OS_MAC && "x86_64".equals(cpuArch)) { + writeLn(error("%s is not published for macOS x86_64. Set %s to a compatible build or use the DevKit Docker image.", component, urlProperty)); + return null; + } - private boolean isLinuxX86_64() { - String arch = System.getProperty("os.arch"); - return SystemUtils.IS_OS_LINUX && !arch.startsWith("aarch") && !arch.startsWith("arm"); + return cpuArch + "-" + osPrefix; } private String resolveYanoDownloadPath() { diff --git a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/commands/general/DownloadCommand.java b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/commands/general/DownloadCommand.java index 177b69a3..3b7f7f0e 100644 --- a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/commands/general/DownloadCommand.java +++ b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/commands/general/DownloadCommand.java @@ -112,8 +112,12 @@ public void downloadAndStart( if (enableYaciStore) { applicationConfig.setYaciStoreEnabled(true); - applicationConfig.setOgmiosEnabled(false); //TODO -- Temporarily till Ogmios is ready - } else if (enableKupomios){ + //Ogmios is the default tx evaluator for Yaci Store. If Ogmios fails to start, + //Yaci Store falls back to the embedded Scalus evaluator. + applicationConfig.setOgmiosEnabled(true); + } + + if (enableKupomios) { applicationConfig.setOgmiosEnabled(true); applicationConfig.setKupoEnabled(true); } @@ -124,7 +128,9 @@ public void downloadAndStart( if (!componentList.contains("ogmios")) { componentList.add("ogmios"); } - } else if (enableKupomios) { + } + + if (enableKupomios) { if (!componentList.contains("ogmios")) componentList.add("ogmios"); if (!componentList.contains("kupo")) diff --git a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/api/ClusterAdminController.java b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/api/ClusterAdminController.java index f11ee3bf..1d8144be 100644 --- a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/api/ClusterAdminController.java +++ b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/api/ClusterAdminController.java @@ -240,7 +240,11 @@ public boolean create(@RequestBody DevNetCreateRequest request) { boolean originalEnableKupo = applicationConfig.isKupoEnabled(); applicationConfig.setYaciStoreEnabled(request.enableYaciStore()); - applicationConfig.setOgmiosEnabled(request.enableOgmios()); + //enableOgmios is optional : when the caller omits it, keep the configured default + //(ogmios_enabled in config/env) instead of forcing Ogmios off. + applicationConfig.setOgmiosEnabled(request.enableOgmios() != null + ? request.enableOgmios() + : originalEnableOgmios); if (request.enableKupomios()) { applicationConfig.setOgmiosEnabled(true); @@ -307,8 +311,8 @@ record DevNetCreateRequest(Map genesisProperties, int multiNodeStakeRatioFactor, @Schema(description = "Enable Yaci Store", defaultValue = "false") boolean enableYaciStore, - @Schema(description = "Enable Ogmios", defaultValue = "false") - boolean enableOgmios, + @Schema(description = "Enable Ogmios. If omitted, the configured default (ogmios_enabled) is used.") + Boolean enableOgmios, @Schema(description = "Enable Ogmios and Kupo", defaultValue = "false") boolean enableKupomios) { } diff --git a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/ogmios/OgmiosService.java b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/ogmios/OgmiosService.java index 6b968242..09005908 100644 --- a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/ogmios/OgmiosService.java +++ b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/ogmios/OgmiosService.java @@ -19,8 +19,13 @@ import java.io.File; import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; import java.nio.file.Files; import java.nio.file.Path; +import java.time.Duration; import java.util.*; import java.util.concurrent.*; import java.util.function.Consumer; @@ -41,6 +46,10 @@ public class OgmiosService { private final TemplateEngine templateEngine; private final ProcessUtil processUtil; + private final HttpClient httpClient = HttpClient.newBuilder() + .connectTimeout(Duration.ofSeconds(2)) + .build(); + private List processes = new ArrayList<>(); private Process ogmiosProcess; @@ -52,8 +61,14 @@ public class OgmiosService { public void handleClusterStarted(ClusterStarted clusterStarted) { String clusterName = clusterStarted.getClusterName(); - start(clusterName, msg -> writeLn(msg)); - + //Ogmios is optional. This listener runs before YaciStoreService's (@Order(1)), so an exception here + //would abort the rest of the startup chain and prevent Yaci Store from starting at all. + try { + start(clusterName, msg -> writeLn(msg)); + } catch (Exception e) { + log.error("Error starting Ogmios/Kupo", e); + writeLn(error("Could not start Ogmios/Kupo : " + e.getMessage())); + } } public boolean start(String clusterName, Consumer writer) { @@ -78,6 +93,13 @@ public boolean start(String clusterName, Consumer writer) { throw new IllegalStateException("Cluster info not found for cluster: " + clusterName + ". Please check if the cluster is created."); + //Ogmios/Kupo talk to the Haskell node over its n2c socket, which doesn't exist in yano-only mode. + NodeMode nodeMode = clusterInfo.getNodeMode() != null ? clusterInfo.getNodeMode() : NodeMode.HASKELL_ONLY; + if (nodeMode == NodeMode.YANO_ONLY) { + writer.accept(info("Ogmios/Kupo require a Haskell cardano-node and are not supported in yano-only mode. Skipping.")); + return false; + } + if (appConfig.isOgmiosEnabled()) { if (!ogmiosPortAvailabilityCheck(clusterInfo, writer)) return false; @@ -108,6 +130,49 @@ public boolean isOgmiosRunning() { return ogmiosProcess != null && ogmiosProcess.isAlive(); } + /** + * Waits until Ogmios actually answers on its HTTP health endpoint. + *

+ * {@link #isOgmiosRunning()} only reports that the process was still alive a second after spawn, which is + * not enough to hand Yaci Store the "ogmios" tx evaluator : if Ogmios dies or never connects to the node + * socket shortly after start, the evaluator mode is already baked into the Store process and every Plutus + * script evaluation would fail for the lifetime of the devnet. Callers use this to fall back to Scalus. + */ + public boolean waitForOgmiosReady(int ogmiosPort, Consumer writer) { + String healthUrl = "http://localhost:" + ogmiosPort + "/health"; + int maxAttempts = 15; + + for (int i = 0; i < maxAttempts; i++) { + if (!isOgmiosRunning()) { + writer.accept(warn("Ogmios process is no longer running.")); + return false; + } + + try { + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create(healthUrl)) + .timeout(Duration.ofSeconds(2)) + .GET() + .build(); + HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); + if (response.statusCode() == 200) + return true; + } catch (Exception e) { + //Not ready yet + } + + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + return false; + } + } + + writer.accept(warn("Ogmios did not become ready within timeout.")); + return false; + } + private static boolean ogmiosPortAvailabilityCheck(ClusterInfo clusterInfo, Consumer writer) { boolean ogmiosPortAvailable = PortUtil.isPortAvailable(clusterInfo.getOgmiosPort()); if (!ogmiosPortAvailable) { diff --git a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/yacistore/YaciStoreService.java b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/yacistore/YaciStoreService.java index 6e0d2962..bd8a61ac 100644 --- a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/yacistore/YaciStoreService.java +++ b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/yacistore/YaciStoreService.java @@ -380,7 +380,7 @@ private StoreStartResult startStoreApp(ClusterInfo clusterInfo, Era era, Consume builder.directory(new File(clusterConfig.getYaciStoreBinPath())); boolean yanoOnly = NodeMode.YANO_ONLY == clusterInfo.getNodeMode(); - String txEvaluatorMode = resolveTxEvaluatorMode(writer); + String txEvaluatorMode = resolveTxEvaluatorMode(clusterInfo, writer); builder.environment().put("STORE_SUBMIT_TX_EVALUATOR_MODE", txEvaluatorMode); writer.accept(info("Yaci Store tx evaluator mode: " + txEvaluatorMode)); @@ -522,15 +522,25 @@ private StoreStartResult startStoreApp(ClusterInfo clusterInfo, Era era, Consume return new StoreStartResult(process, started.get()); } - private String resolveTxEvaluatorMode(Consumer writer) { - if (appConfig.isOgmiosEnabled() && ogmiosService.isOgmiosRunning()) - return TX_EVALUATOR_MODE_OGMIOS; + private String resolveTxEvaluatorMode(ClusterInfo clusterInfo, Consumer writer) { + if (!appConfig.isOgmiosEnabled()) + return TX_EVALUATOR_MODE_SCALUS; - if (appConfig.isOgmiosEnabled()) { + if (!ogmiosService.isOgmiosRunning()) { writer.accept(warn("Ogmios is enabled but not running. Using Scalus tx evaluator for Yaci Store.")); + return TX_EVALUATOR_MODE_SCALUS; } - return TX_EVALUATOR_MODE_SCALUS; + //The mode is baked into the Store process at startup and never re-evaluated, so confirm Ogmios is + //actually serving before committing to it. Otherwise a short-lived Ogmios would leave the Store + //unable to evaluate any Plutus script for the lifetime of the devnet. + if (!ogmiosService.waitForOgmiosReady(clusterInfo.getOgmiosPort(), writer)) { + writer.accept(warn("Ogmios is not responding on port " + clusterInfo.getOgmiosPort() + + ". Using Scalus tx evaluator for Yaci Store.")); + return TX_EVALUATOR_MODE_SCALUS; + } + + return TX_EVALUATOR_MODE_OGMIOS; } private Process startViewerApp(String cluster) throws IOException, InterruptedException, ExecutionException, TimeoutException { diff --git a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/yano/YanoConfigBuilder.java b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/yano/YanoConfigBuilder.java index 5fb3491f..10901493 100644 --- a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/yano/YanoConfigBuilder.java +++ b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/yano/YanoConfigBuilder.java @@ -34,11 +34,12 @@ public class YanoConfigBuilder { * @param clusterInfo cluster configuration * @param yanoConfigDir resolved path to Yano's devnet config (genesis files, keys) * @param yanoDataDir resolved path for Yano's chainstate storage + * @param yanoHistoryDir resolved path for Yano's history archive * @param pastTimeTravelMode whether past-time-travel mode is enabled * @return true if config was written successfully */ public boolean build(ClusterInfo clusterInfo, Path yanoConfigDir, Path yanoDataDir, - boolean pastTimeTravelMode) { + Path yanoHistoryDir, boolean pastTimeTravelMode) { Map props = new LinkedHashMap<>(); // Quarkus profile @@ -64,6 +65,14 @@ public boolean build(ClusterInfo clusterInfo, Path yanoConfigDir, Path yanoDataD // Storage — inside the node folder so it gets cleaned up with create-node -o props.put("yano.storage.path", yanoDataDir.toAbsolutePath().toString()); + // History archive — Yano's bundled devnet profile enables the DuckLake projection + // archive by default. DevKit reads nothing from Yano's history api, so it's turned off + // here. The dir is pinned inside the node folder anyway: it defaults to ./history, + // relative to the working directory, which is the shared yanoHome — an archive written + // there outlives create-node -o and then fails the startup identity/coverage guards. + props.put("yano.history.projection.enabled", "false"); + props.put("yano.history.dir", yanoHistoryDir.toAbsolutePath().toString()); + // Past-time-travel mode if (pastTimeTravelMode) { props.put("yano.block-producer.past-time-travel-mode", "true"); diff --git a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/yano/YanoService.java b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/yano/YanoService.java index e9ac8446..81b60978 100644 --- a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/yano/YanoService.java +++ b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/yano/YanoService.java @@ -242,9 +242,10 @@ private Process startYanoProcess(ClusterInfo clusterInfo, Path clusterFolder, Pa // Store Yano data inside node folder so it gets cleaned up with create-node -o Path yanoDataDir = clusterFolder.resolve("node").resolve("yano"); Files.createDirectories(yanoDataDir); + Path yanoHistoryDir = clusterFolder.resolve("node").resolve("yano-history"); // Write application.properties for Yano (persists config on disk for debugging) - yanoConfigBuilder.build(clusterInfo, yanoConfigDir, yanoDataDir, pastTimeTravelMode); + yanoConfigBuilder.build(clusterInfo, yanoConfigDir, yanoDataDir, yanoHistoryDir, pastTimeTravelMode); ProcessBuilder builder = new ProcessBuilder(); builder.directory(new File(clusterConfig.getYanoHome())); @@ -328,6 +329,7 @@ public void handleClusterStopped(ClusterStopped clusterStopped) { public void handleClusterDeleted(ClusterDeleted clusterDeleted) { Path clusterFolder = Path.of(clusterConfig.getClusterHome(), clusterDeleted.getClusterName()); deleteIfPresent(clusterFolder.resolve("node").resolve("yano"), "Yano data"); + deleteIfPresent(clusterFolder.resolve("node").resolve("yano-history"), "Yano history"); deleteIfPresent(clusterFolder.resolve("yano-config"), "Yano config"); deleteBootstrapMarker(clusterFolder); } diff --git a/applications/cli/src/main/resources/localcluster/templates/devnet/templates/configuration.json b/applications/cli/src/main/resources/localcluster/templates/devnet/templates/configuration.json index 15be04c1..ca0b8e95 100644 --- a/applications/cli/src/main/resources/localcluster/templates/devnet/templates/configuration.json +++ b/applications/cli/src/main/resources/localcluster/templates/devnet/templates/configuration.json @@ -87,7 +87,7 @@ "hasEKG": 12788, "hasPrometheus": [ "127.0.0.1", - 12798 + {{prometheusPort}} ], "minSeverity": "Info", "options": { diff --git a/config/env b/config/env index 5a3b53f6..caf55888 100644 --- a/config/env +++ b/config/env @@ -1,5 +1,7 @@ yaci_store_enabled=true -ogmios_enabled=false +#Ogmios is enabled by default and used as the Yaci Store tx evaluator. +#Set to false to fall back to the embedded Scalus evaluator. +ogmios_enabled=true kupo_enabled=false node=node1 diff --git a/docs/pages/getting-started/docker.mdx b/docs/pages/getting-started/docker.mdx index a652c4e0..98b68fa0 100644 --- a/docs/pages/getting-started/docker.mdx +++ b/docs/pages/getting-started/docker.mdx @@ -25,11 +25,11 @@ The Docker distribution includes: For Ogmios and Kupo, ensure ports 1337 and 1442 are also available if you plan to use these services. -Starting with Yaci DevKit `v0.12.0-beta5`, the default Docker setup uses Yaci Store's `scalus` transaction evaluator. Ogmios is optional and is not started just for transaction evaluation. +The default Docker setup starts Ogmios and uses it as Yaci Store's transaction evaluator. If Ogmios is unavailable, Yaci Store falls back to the embedded `scalus` evaluator. Kupo remains optional. - -For Yaci DevKit `v0.12.0-beta5`, PV11-compatible Ogmios/Kupo binaries are currently available only as Linux x86_64 builds from IntersectMBO. Docker images can run these on Apple Silicon Docker Desktop through emulation, but native Linux arm64 hosts may need x86_64 emulation or the amd64 image. See [Known Issues](/known-issues#pv11-ogmioskupo-docker-arm64-compatibility). + +Ogmios `v7.0.0` and Kupo `v2.12.0` are bundled as **native** binaries in both the `linux/amd64` and `linux/arm64` images — no x86_64 emulation is required on Apple Silicon or native Linux arm64 hosts. ## Installation @@ -194,13 +194,15 @@ topup_addresses=addr_test1...address1:20000,addr_test1...address2:10000 ### Optional Services -#### Enable Ogmios and Kupo -To activate Ogmios and Kupo support, either: +#### Ogmios and Kupo +Ogmios is **enabled by default** (`ogmios_enabled=true` in `config/env`) and is used as Yaci Store's transaction evaluator. Set `ogmios_enabled=false` to disable it and fall back to the embedded `scalus` evaluator. + +Kupo is optional and disabled by default. To activate it, either: -1. **Via env file**: Set `ogmios_enabled=true` and `kupo_enabled=true` in `config/env` +1. **Via env file**: Set `kupo_enabled=true` in `config/env` 2. **Via CLI**: Use the `enable-kupomios` command in Yaci CLI -In `v0.12.0-beta5+`, if Ogmios is enabled and running when Yaci Store starts, Yaci Store uses `ogmios` transaction evaluation. Otherwise it uses `scalus`. +When Yaci Store starts, DevKit uses the `ogmios` evaluator if Ogmios is enabled and responding on its health endpoint; otherwise it logs a warning and uses `scalus`. #### Service URLs - **CLI/Admin Swagger UI**: http://localhost:10000/swagger-ui.html diff --git a/docs/pages/known-issues.mdx b/docs/pages/known-issues.mdx index 0ae7f6aa..305bf2e7 100644 --- a/docs/pages/known-issues.mdx +++ b/docs/pages/known-issues.mdx @@ -6,41 +6,44 @@ This page documents known issues, workarounds, and frequently asked questions ab ## Known Issues -### PV11 Ogmios/Kupo Docker arm64 Compatibility +### Ogmios / Kupo Platform Availability - -**Issue**: PV11-compatible (Cardano node 11.0.1) Ogmios `v6.14.0.2` and Kupo `v2.11.0.1` are currently published by IntersectMBO only as Linux x86_64 binaries. + +Ogmios `v7.0.0` and Kupo `v2.12.0` are published for Linux (x86_64, arm64) and macOS arm64 only. #### Current Behavior -The DevKit Docker image bundles those x86_64 Ogmios/Kupo binaries in both the `linux/amd64` and `linux/arm64` images as a temporary workaround. - -- **Linux x86_64 Docker hosts**: Supported. -- **Apple Silicon Docker Desktop**: Expected to work through Docker Desktop's x86_64 emulation. -- **Native Linux arm64 Docker hosts**: May fail at runtime unless x86_64 binfmt/qemu emulation is configured on the host. -- **Native CLI on macOS arm64**: The default PV11 Ogmios/Kupo Linux x86_64 binaries cannot run directly. Use Docker, or set custom `ogmios.url` / `kupo.url` values when compatible native binaries are available. +- **Docker (linux/amd64 and linux/arm64)**: Fully supported. Both images bundle **native**, statically linked binaries — no emulation required. +- **Native CLI on Linux (x86_64 and arm64)**: Both supported. +- **Native CLI on macOS arm64**: Both supported. The macOS builds link only against system libraries and run standalone. +- **Native CLI on macOS x86_64 / Windows**: Neither component is published. `download -c ogmios` fails fast with an explanatory message instead of attempting a 404 download. #### Workaround -On native Linux arm64 hosts, run the DevKit Docker image as `linux/amd64` or configure x86_64 emulation. For native CLI installs, use a compatible Ogmios/Kupo build when one becomes available by setting direct URLs in `config/download.properties`. +On an unsupported platform, use the DevKit Docker image, or set a custom `ogmios.url` / `kupo.url` in `config/download.properties`. + +When Ogmios is unavailable, Yaci Store automatically falls back to the embedded `scalus` transaction evaluator, so transaction evaluation keeps working. --- -### Yaci Store Tx Evaluator Mode (v0.12.0-beta5+) +### Yaci Store Tx Evaluator Mode -Starting with Yaci DevKit `v0.12.0-beta5`, Yaci Store uses the `scalus` transaction evaluator by default. +Yaci Store uses the `ogmios` transaction evaluator by default in the Docker distribution, and falls back to the embedded `scalus` evaluator when Ogmios is unavailable. -Default Yaci Store transaction evaluation no longer requires Ogmios. If Ogmios is enabled and running when Yaci Store starts, DevKit automatically switches the evaluator mode to `ogmios`. +DevKit selects the evaluator at devnet start: + +- If Ogmios is enabled **and** responds on its health endpoint, the mode is `ogmios`. +- Otherwise DevKit logs a warning and uses `scalus`. No transaction evaluation is lost either way. -This means the temporary PV11 Ogmios/Kupo binary limitations do not block the default Yaci Store transaction evaluation path. +To force the Scalus evaluator, set `ogmios_enabled=false` in `config/env` (Docker) or `ogmios.enabled=false` in `config/application.properties` (zip distribution). Check the active mode in the Yaci CLI startup output: ```text -Yaci Store tx evaluator mode: scalus +Yaci Store tx evaluator mode: ogmios ``` --- diff --git a/docs/pages/services.mdx b/docs/pages/services.mdx index b9326539..de913a6c 100644 --- a/docs/pages/services.mdx +++ b/docs/pages/services.mdx @@ -73,7 +73,9 @@ For Docker, services are configured in `config/env` with underscore notation. ```shell yaci_store_enabled=true -ogmios_enabled=false +# Ogmios is enabled by default and used as the Yaci Store tx evaluator. +# Set to false to fall back to the embedded Scalus evaluator. +ogmios_enabled=true kupo_enabled=false ``` diff --git a/npm/yaci-devkit/README.md b/npm/yaci-devkit/README.md index e60b523d..0e5d8936 100644 --- a/npm/yaci-devkit/README.md +++ b/npm/yaci-devkit/README.md @@ -35,4 +35,6 @@ npm i -g @bloxbean/yaci-devkit ``` - Downloads and starts the Cardano node, Ogmios, and Kupo. +> **Note on platforms**: Ogmios and Kupo are published for Linux (x86_64, arm64) and macOS arm64. On macOS x86_64 and Windows they are unavailable; there Yaci Store falls back to the embedded `scalus` script cost evaluator, or you can use the Docker distribution. + For a full list of Yaci CLI commands, check the Yaci DevKit [documentation](https://devkit.yaci.xyz/commands). diff --git a/scripts/info.sh b/scripts/info.sh index 54a46764..74e2ceb5 100755 --- a/scripts/info.sh +++ b/scripts/info.sh @@ -23,7 +23,7 @@ echo "--------------------------------------------" echo "Other Urls" echo "--------------------------------------------" -echo "Ogmios Url (Optional) : ws://localhost:${HOST_OGMIOS_PORT}" +echo "Ogmios Url : ws://localhost:${HOST_OGMIOS_PORT}" echo "Kupo Url (Optional) : http://localhost:${HOST_KUPO_PORT}" echo ""