Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/actions/ogmios-from-hydra/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Get ogmios from the Hydra cache
description: Wait until Hydra has built ogmios for the commit under test, then copy its binary to server/bin/ogmios. Needs Nix.
runs:
using: composite
steps:
# Temporary: poll the Nix cache directly until Hydra check-run reporting is fixed.
# Use the PR head SHA on pull_request events (not $GITHUB_SHA, which is the
# ephemeral merge commit GitHub creates server-side and that Hydra doesn't see).
# Falls back to $GITHUB_SHA on push events.
- name: Wait for ogmios in Hydra cache
env:
TARGET_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
shell: bash
run: |
set -o pipefail
echo "Target SHA: $TARGET_SHA"
if ! out=$(nix eval --raw "git+https://github.com/$GITHUB_REPOSITORY?rev=$TARGET_SHA&submodules=1#ogmios"); then
echo "nix eval failed"
exit 1
fi
if [ -z "$out" ]; then
echo "nix eval returned an empty path"
exit 1
fi
drv=$(nix eval --raw "git+https://github.com/$GITHUB_REPOSITORY?rev=$TARGET_SHA&submodules=1#ogmios.drvPath" 2>/dev/null || true)
echo "Resolved store path: $out"
echo "Derivation path: $drv"
echo "Waiting for $out in cache..."
deadline=$((SECONDS + 1800))
while true; do
if nix path-info --refresh --store https://cache.iog.io "$out" >/dev/null 2>&1; then
echo "Found in cache"
break
fi
if [ "$SECONDS" -ge "$deadline" ]; then
echo "Timed out after 30 minutes waiting for Hydra cache (path: $out)"
exit 1
fi
echo "Not in cache yet, waiting 30s..."
sleep 30
done

- name: Download ogmios binary from Hydra cache
env:
TARGET_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
shell: bash
run: |
nix build "git+https://github.com/$GITHUB_REPOSITORY?rev=$TARGET_SHA&submodules=1#ogmios" \
--builders "" --max-jobs 0
mkdir -p server/bin
cp result/bin/ogmios server/bin/ogmios
chmod +x server/bin/ogmios
4 changes: 1 addition & 3 deletions .github/workflows/container-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ jobs:
- name: Install Nix
uses: cachix/install-nix-action@b97f05dcb019ddea06450a50ef6203d2fdc19fee # v31
with:
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
substituters = https://cache.iog.io/ https://cache.nixos.org/
extra_nix_config: accept-flake-config = true

# Temporary: poll the Nix cache directly until Hydra check-run reporting
# is fixed. Both architectures are built by Hydra; wait for each.
Expand Down
93 changes: 45 additions & 48 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,55 +83,10 @@ jobs:
- name: Install Nix
uses: cachix/install-nix-action@b97f05dcb019ddea06450a50ef6203d2fdc19fee # v31
with:
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
substituters = https://cache.iog.io/ https://cache.nixos.org/

# Temporary: poll the Nix cache directly until Hydra check-run reporting is fixed.
# Use the PR head SHA on pull_request events (not $GITHUB_SHA, which is the
# ephemeral merge commit GitHub creates server-side and that Hydra doesn't see).
# Falls back to $GITHUB_SHA on push events.
- name: Wait for ogmios in Hydra cache
env:
TARGET_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
set -o pipefail
echo "Target SHA: $TARGET_SHA"
if ! out=$(nix eval --raw "git+https://github.com/$GITHUB_REPOSITORY?rev=$TARGET_SHA&submodules=1#ogmios"); then
echo "nix eval failed"
exit 1
fi
if [ -z "$out" ]; then
echo "nix eval returned an empty path"
exit 1
fi
drv=$(nix eval --raw "git+https://github.com/$GITHUB_REPOSITORY?rev=$TARGET_SHA&submodules=1#ogmios.drvPath" 2>/dev/null || true)
echo "Resolved store path: $out"
echo "Derivation path: $drv"
echo "Waiting for $out in cache..."
deadline=$((SECONDS + 1800))
while true; do
if nix path-info --refresh --store https://cache.iog.io "$out" >/dev/null 2>&1; then
echo "Found in cache"
break
fi
if [ "$SECONDS" -ge "$deadline" ]; then
echo "Timed out after 30 minutes waiting for Hydra cache (path: $out)"
exit 1
fi
echo "Not in cache yet, waiting 30s..."
sleep 30
done
extra_nix_config: accept-flake-config = true

- name: Download ogmios binary from Hydra cache
env:
TARGET_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
nix build "git+https://github.com/$GITHUB_REPOSITORY?rev=$TARGET_SHA&submodules=1#ogmios" \
--builders "" --max-jobs 0
mkdir -p server/bin
cp result/bin/ogmios server/bin/ogmios
chmod +x server/bin/ogmios
- name: Get ogmios from the Hydra cache
uses: ./.github/actions/ogmios-from-hydra

- name: Download cardano-node configs
env:
Expand Down Expand Up @@ -200,3 +155,45 @@ jobs:
run: |
docker stop -t 300 cardano-node || true
docker rm cardano-node || true

# Preview has no Dijkstra blocks, so this job makes its own Dijkstra devnet.
dijkstra_devnet:
Comment thread
palas marked this conversation as resolved.
Resolved
# The ogmios binary comes from Hydra, which may not build pull requests from forks.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
# The waits for Hydra and for the devnet add up to about 50 minutes.
timeout-minutes: 75
runs-on: ubuntu-24.04
env:
# cardano-node 11.2.0
CARDANO_NODE_FLAKE: github:IntersectMBO/cardano-node/dac0d7ab2dfdee1f9eda901589e3c6ac8eaa1899
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
submodules: true
persist-credentials: false

- name: Install Nix
uses: cachix/install-nix-action@b97f05dcb019ddea06450a50ef6203d2fdc19fee # v31
with:
extra_nix_config: accept-flake-config = true

- name: Get ogmios from the Hydra cache
uses: ./.github/actions/ogmios-from-hydra

- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: lts/jod

- name: Build TypeScript client
working-directory: clients/TypeScript
run: |
yarn install --frozen-lockfile --non-interactive --loglevel=error
yarn build

- name: Run the Dijkstra devnet test
run: |
nix shell "$CARDANO_NODE_FLAKE#cardano-testnet" "$CARDANO_NODE_FLAKE#cardano-node" "$CARDANO_NODE_FLAKE#cardano-cli" -c \
scripts/dijkstra-devnet-test.sh server/bin/ogmios \
yarn --cwd clients/TypeScript/packages/client test DijkstraDevnet
4 changes: 1 addition & 3 deletions .github/workflows/network-synchronization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ jobs:
- name: Install Nix
uses: cachix/install-nix-action@b97f05dcb019ddea06450a50ef6203d2fdc19fee # v31
with:
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
substituters = https://cache.iog.io/ https://cache.nixos.org/
extra_nix_config: accept-flake-config = true

- name: Restore cardano-node DB from S3
id: restore
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release-upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ jobs:
- name: Install Nix
uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 # v31
with:
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
substituters = https://cache.iog.io/ https://cache.nixos.org/
extra_nix_config: accept-flake-config = true

# Temporary: poll the Nix cache directly until Hydra check-run reporting is
# fixed. Both architectures are built by Hydra; wait for each.
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ math: true

- The JSON schema now lists `dijkstra` as an era name where Ogmios can return it, such as the `era` of a block and the eras in an era mismatch error. The schema also describes the `guard` clause of native scripts and the `guard` script purpose, which Dijkstra transactions can contain. The `guard` purpose appears in redeemer pointers and in the list of missing redeemers. Before, such responses did not match the schema. The schema also describes the `maxReferenceScriptsSizePerBlock` and `maxReferenceScriptsSizePerTransaction` protocol parameters of the Dijkstra era, and accepts the stake addresses that Ogmios uses as keys of the withdrawals in a `treasuryWithdrawals` governance action. Before, responses that contained them did not match the schema.

- In the Dijkstra era, `nextBlock` and `nextTransaction` now return transactions with all their content, with the same fields as in the Conway era: inputs, outputs, certificates, withdrawals, mint, fee, votes, proposals, metadata, signatories, scripts, datums, redeemers, and so on. Before, a Dijkstra transaction only had `id`, `spends` and, when asked for, `cbor`. Dijkstra transactions also have new fields:
Comment thread
palas marked this conversation as resolved.
Resolved
- `subTransactions`: the transactions nested in this one. Each has its own `id` and the same fields as a transaction, except `spends`, `fee`, `collaterals`, `collateralReturn`, `totalCollateral`, `startingAccountBalanceIntervals` and `subTransactions`.
- `guards`: the keys and scripts that guard the transaction, each with `from` and `credential`, in the ledger's order. The index of a redeemer with purpose `guard` points into this list. Keys are also listed in `requiredExtraSignatories`.
- `topLevelGuards`: the guards that the top-level transaction must list, each with `from`, `credential` and, for Plutus scripts, a `datum`.
- `credits`: amounts paid directly into accounts, with the same shape as `withdrawals`.
- `accountBalanceIntervals`: conditions on account balances, each with the stake address of the `account` and either `atLeast`, `atMost`, both, or `exactly`.
- `startingAccountBalanceIntervals` (top-level transactions only): the same conditions, checked against the balances before the transaction and its sub-transactions are applied.

### [6.14.0] - 2025-10-16

#### Added
Expand Down
41 changes: 41 additions & 0 deletions clients/TypeScript/packages/client/test/DijkstraDevnet.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { dummyInteractionContext } from './helpers'
import { createChainSynchronizationClient } from '../src/ChainSynchronization'
import { Transaction } from '@cardano-ogmios/schema'

// Set by scripts/dijkstra-devnet-test.sh. Without them, this test is skipped.
const transactionId = process.env.DIJKSTRA_TX_ID
const subTransactionId = process.env.DIJKSTRA_SUB_TX_ID

const describeOnDevnet = transactionId === undefined ? describe.skip : describe

describeOnDevnet('Dijkstra devnet', () => {
it('reads a transaction with a sub-transaction from a block', async () => {
const context = await dummyInteractionContext()
let found : (tx: Transaction) => void
const transaction = new Promise<Transaction>(resolve => { found = resolve })
const client = await createChainSynchronizationClient(context, {
rollBackward: async (_response, nextBlock) => {
nextBlock()
},
rollForward: async ({ block }, nextBlock) => {
const tx = block.type === 'praos'
? block.transactions?.find(tx => tx.id === transactionId)
: undefined
if (tx !== undefined) {
found(tx)
} else {
nextBlock()
}
}
})
await client.resume(['origin'], 1)
try {
const tx = await transaction

expect(tx.id).toBe(transactionId)
expect(tx.subTransactions?.map(subTx => subTx.id)).toEqual([subTransactionId])
} finally {
await client.shutdown()
}
})
})
Loading
Loading