Skip to content
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

Implement Cardano stake distribution commands in mithril-client CLI #1883

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
Loading