Repository navigation
Dijkstra transaction serialisation support #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b18326c
Let the shared witness-set and vote encoders serve Dijkstra
palas 88787f2
Serialise Dijkstra transactions in full
palas 6117e69
Generate Dijkstra blocks and transactions in the unit tests
palas 0701f4f
List every Dijkstra guard in ledger order, keys and scripts
palas 5d5d254
Add a golden test for a full Dijkstra transaction
palas 8c14bad
Check that no field is dropped from random Dijkstra transactions
palas 5f463af
Read a Dijkstra sub-transaction through nextBlock on a local devnet
palas 7cdbabd
Key account balance intervals by stake address, like credits and with…
palas c0e6f8e
Link the ledger fix for guard datums from the codec generators
palas 229c046
Shut the devnet test client down when an expectation fails
palas 7482aca
Remove the devnet files after a successful run
palas 0cc11f9
Check guard datums and credit amounts in the no-field-dropped property
palas 54fb2cf
Fix the yarn log level flag in the Dijkstra devnet job
palas 20cc285
Skip the Dijkstra devnet job on pull requests from forks, and give it…
palas 78ae851
Share the Hydra cache steps of the TypeScript and Dijkstra devnet jobs
palas 8eda50d
Take the Nix caches from the flakes in all workflows
palas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
clients/TypeScript/packages/client/test/DijkstraDevnet.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() | ||
| } | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.