Skip to content

Commit

Permalink
Merge pull request #1883 from input-output-hk/dlachaume/1880/implemen…
Browse files Browse the repository at this point in the history
…t-cardano-stake-distribution-in-client-cli

Implement Cardano stake distribution commands in `mithril-client` CLI
  • Loading branch information
dlachaume authored Aug 12, 2024
2 parents c9a1e5b + bf5135f commit dea7b54
Show file tree
Hide file tree
Showing 14 changed files with 559 additions and 24 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/test-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ jobs:
shell: bash
run: |
CTX_CAPABILITY=$(wget -q -O - $AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])')
CSD_CAPABILITY=$(wget -q -O - $AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoStakeDistribution"])')
echo "ctx_enabled=$CTX_CAPABILITY" >> $GITHUB_OUTPUT
echo "csd_enabled=$CSD_CAPABILITY" >> $GITHUB_OUTPUT
- name: Assessing aggregator capabilities (Windows)
id: aggregator_capability_windows
Expand All @@ -86,7 +88,9 @@ jobs:
run: |
aria2c -o aggregator_capabilities.json $AGGREGATOR_ENDPOINT
CTX_CAPABILITY=$(jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])' aggregator_capabilities.json)
CSD_CAPABILITY=$(jq '.capabilities.signed_entity_types | contains(["CardanoStakeDistribution"])' aggregator_capabilities.json)
echo "ctx_enabled=$CTX_CAPABILITY" >> $GITHUB_OUTPUT
echo "csd_enabled=$CSD_CAPABILITY" >> $GITHUB_OUTPUT
- name: Checkout binary
uses: dawidd6/action-download-artifact@v3
Expand Down Expand Up @@ -152,6 +156,28 @@ jobs:
working-directory: ./bin
run: ./mithril-client --unstable ${{ steps.prepare.outputs.debug_level }} cardano-transaction certify $TRANSACTIONS_HASHES_TO_CERTIFY

- name: Cardano Stake Distribution / list and get last epoch and hash
if: steps.aggregator_capability_unix.outputs.csd_enabled == 'true' || steps.aggregator_capability_windows.outputs.csd_enabled == 'true'
shell: bash
working-directory: ./bin
run: |
./mithril-client --unstable ${{ steps.prepare.outputs.debug_level }} cardano-stake-distribution list
CMD_OUTPUT=$(./mithril-client --unstable cardano-stake-distribution list --json)
echo "CARDANO_STAKE_DISTRIBUTION_EPOCH=$(echo "$CMD_OUTPUT" | jq -r '.[0].epoch')" >> $GITHUB_ENV
echo "CARDANO_STAKE_DISTRIBUTION_HASH=$(echo "$CMD_OUTPUT" | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Cardano Stake Distribution / download & restore latest by epoch
if: steps.aggregator_capability_unix.outputs.csd_enabled == 'true' || steps.aggregator_capability_windows.outputs.csd_enabled == 'true'
shell: bash
working-directory: ./bin
run: ./mithril-client --unstable ${{ steps.prepare.outputs.debug_level }} cardano-stake-distribution download $CARDANO_STAKE_DISTRIBUTION_EPOCH

- name: Cardano Stake Distribution / download & restore latest by hash
if: steps.aggregator_capability_unix.outputs.csd_enabled == 'true' || steps.aggregator_capability_windows.outputs.csd_enabled == 'true'
shell: bash
working-directory: ./bin
run: ./mithril-client --unstable ${{ steps.prepare.outputs.debug_level }} cardano-stake-distribution download $CARDANO_STAKE_DISTRIBUTION_HASH

test-docker:
strategy:
fail-fast: false
Expand All @@ -178,7 +204,9 @@ jobs:
shell: bash
run: |
CTX_CAPABILITY=$(wget -q -O - $AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])')
CSD_CAPABILITY=$(wget -q -O - $AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoStakeDistribution"])')
echo "ctx_enabled=$CTX_CAPABILITY" >> $GITHUB_OUTPUT
echo "csd_enabled=$CSD_CAPABILITY" >> $GITHUB_OUTPUT
- name: Prepare Mithril client command
id: command
Expand Down Expand Up @@ -227,6 +255,25 @@ jobs:
shell: bash
run: ${{ steps.command.outputs.mithril_client }} --unstable ${{ steps.prepare.outputs.debug_level }} cardano-transaction certify $TRANSACTIONS_HASHES_TO_CERTIFY

- name: Cardano Stake Distribution / list and get last epoch and hash
if: steps.aggregator_capability.outputs.csd_enabled == 'true'
shell: bash
run: |
${{ steps.command.outputs.mithril_client }} --unstable cardano-stake-distribution list
CMD_OUTPUT=$(${{ steps.command.outputs.mithril_client }} --unstable cardano-stake-distribution list --json)
echo "CARDANO_STAKE_DISTRIBUTION_EPOCH=$(echo "$CMD_OUTPUT" | jq -r '.[0].epoch')" >> $GITHUB_ENV
echo "CARDANO_STAKE_DISTRIBUTION_HASH=$(echo "$CMD_OUTPUT" | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Cardano Stake Distribution / download & restore latest by epoch
if: steps.aggregator_capability.outputs.csd_enabled == 'true'
shell: bash
run: ${{ steps.command.outputs.mithril_client }} --unstable ${{ steps.prepare.outputs.debug_level }} cardano-stake-distribution download $CARDANO_STAKE_DISTRIBUTION_EPOCH --download-dir /app

- name: Cardano Stake Distribution / download & restore latest by hash
if: steps.aggregator_capability.outputs.csd_enabled == 'true'
shell: bash
run: ${{ steps.command.outputs.mithril_client }} --unstable ${{ steps.prepare.outputs.debug_level }} cardano-stake-distribution download $CARDANO_STAKE_DISTRIBUTION_HASH --download-dir /app

test-mithril-client-wasm:
strategy:
fail-fast: false
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ As a minor extension, we have adopted a slightly different versioning convention
- Implement the signable and artifact builders for the signed entity type `CardanoStakeDistribution`.
- Implement the HTTP routes related to the signed entity type `CardanoStakeDistribution` on the aggregator REST API.
- Added support in the `mithril-client` library for retrieving `CardanoStakeDistribution` by epoch or by hash, and for listing all available `CardanoStakeDistribution`.
- Implement `CardanoStakeDistribution` commands under the `--unstable` flag in the Mithril client CLI to list all available `CardanoStakeDistribution` and to download artifact by epoch or hash.

- Crates versions:

Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion mithril-client-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-client-cli"
version = "0.9.10"
version = "0.9.11"
description = "A Mithril Client"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
Loading

0 comments on commit dea7b54

Please sign in to comment.