Skip to content

Commit

Permalink
Merge pull request #1518 from input-output-hk/damien/1510/adapt-multi…
Browse files Browse the repository at this point in the history
…-platform-test-for-cardano-transactions

Adapt multi platform test for Cardano transactions
  • Loading branch information
dlachaume authored Feb 23, 2024
2 parents 5afc6fc + 4b32967 commit 52fa7d3
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 2 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/test-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,25 @@ jobs:
echo "NETWORK=${{ inputs.network }}" >> $GITHUB_ENV
echo "AGGREGATOR_ENDPOINT=${{ inputs.aggregator_endpoint }}" >> $GITHUB_ENV
echo "GENESIS_VERIFICATION_KEY=$(curl -s ${{ inputs.genesis_verification_key }})" >> $GITHUB_ENV
echo "TRANSACTIONS_HASHES_TO_CERTIFY=${{ inputs.transactions_hashes_to_certify }}" >> $GITHUB_ENV
- name: Assessing aggregator capabilities (Unix)
id: aggregator_capability_unix
if: runner.os != 'Windows'
shell: bash
run: |
CTX_CAPABILITY=$(wget -q -O - $AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])')
echo "ctx_enabled=$CTX_CAPABILITY" >> $GITHUB_OUTPUT
- name: Assessing aggregator capabilities (Windows)
id: aggregator_capability_windows
if: runner.os == 'Windows'
shell: bash
run: |
aria2c -o aggregator_capabilities.json $AGGREGATOR_ENDPOINT
CTX_CAPABILITY=$(jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])' aggregator_capabilities.json)
echo "ctx_enabled=$CTX_CAPABILITY" >> $GITHUB_OUTPUT
- name: Checkout binary
uses: dawidd6/action-download-artifact@v3
with:
Expand Down Expand Up @@ -114,6 +132,26 @@ jobs:
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} mithril-stake-distribution download $MITHRIL_STAKE_DISTRIBUTION_HASH

- name: Cardano transaction / list and get last commitment
if: steps.aggregator_capability_unix.outputs.ctx_enabled == 'true' || steps.aggregator_capability_windows.outputs.ctx_enabled == 'true'
shell: bash
working-directory: ./bin
run: |
./mithril-client ${{ steps.prepare.outputs.debug_level }} --unstable cardano-transaction commitment list
echo "CTX_COMMITMENT_HASH=$(./mithril-client --unstable cardano-transaction commitment list --json | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Cardano transaction / show commitment
if: steps.aggregator_capability_unix.outputs.ctx_enabled == 'true' || steps.aggregator_capability_windows.outputs.ctx_enabled == 'true'
shell: bash
working-directory: ./bin
run: ./mithril-client --unstable cardano-transaction commitment show $CTX_COMMITMENT_HASH

- name: Cardano transaction certify
if: steps.aggregator_capability_unix.outputs.ctx_enabled == 'true' || steps.aggregator_capability_windows.outputs.ctx_enabled == 'true'
shell: bash
working-directory: ./bin
run: ./mithril-client --unstable ${{ steps.prepare.outputs.debug_level }} cardano-transaction certify $TRANSACTIONS_HASHES_TO_CERTIFY

test-docker:
strategy:
fail-fast: false
Expand All @@ -133,6 +171,14 @@ jobs:
echo "NETWORK=${{ inputs.network }}" >> $GITHUB_ENV
echo "AGGREGATOR_ENDPOINT=${{ inputs.aggregator_endpoint }}" >> $GITHUB_ENV
echo "GENESIS_VERIFICATION_KEY=$(curl -s ${{ inputs.genesis_verification_key }})" >> $GITHUB_ENV
echo "TRANSACTIONS_HASHES_TO_CERTIFY=${{ inputs.transactions_hashes_to_certify }}" >> $GITHUB_ENV
- name: Assessing aggregator capabilities
id: aggregator_capability
shell: bash
run: |
CTX_CAPABILITY=$(wget -q -O - $AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])')
echo "ctx_enabled=$CTX_CAPABILITY" >> $GITHUB_OUTPUT
- name: Prepare Mithril client command
id: command
Expand Down Expand Up @@ -164,6 +210,23 @@ jobs:
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} mithril-stake-distribution download $MITHRIL_STAKE_DISTRIBUTION_HASH --download-dir /app

- name: Cardano transaction / list and get last commitment
if: steps.aggregator_capability.outputs.ctx_enabled == 'true'
shell: bash
run: |
${{ steps.command.outputs.mithril_client }} --unstable cardano-transaction commitment list
echo "CTX_COMMITMENT_HASH=$(${{ steps.command.outputs.mithril_client }} --unstable cardano-transaction commitment list --json | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Cardano transaction / show commitment
if: steps.aggregator_capability.outputs.ctx_enabled == 'true'
shell: bash
run: ${{ steps.command.outputs.mithril_client }} --unstable cardano-transaction commitment show $CTX_COMMITMENT_HASH

- name: Cardano transaction certify
if: steps.aggregator_capability.outputs.ctx_enabled == 'true'
shell: bash
run: ${{ steps.command.outputs.mithril_client }} --unstable ${{ steps.prepare.outputs.debug_level }} cardano-transaction certify $TRANSACTIONS_HASHES_TO_CERTIFY

test-mithril-client-wasm:
strategy:
fail-fast: false
Expand Down
4 changes: 2 additions & 2 deletions mithril-client-wasm/www-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ if (aggregator_capabilities.includes("CardanoTransactions")) {

let proof_certificate;
test_number++;
await run_test("proof verify_certificate_chain", test_number, async () => {
await run_test("proof_verify_certificate_chain", test_number, async () => {
proof_certificate = await client.verify_certificate_chain(
ctx_proof.certificate_hash
);
Expand All @@ -185,7 +185,7 @@ if (aggregator_capabilities.includes("CardanoTransactions")) {
);

test_number++;
await run_test("proof verify_message_match_certificate", test_number, async () => {
await run_test("proof_verify_message_match_certificate", test_number, async () => {
const valid_stake_distribution_message =
await client.verify_message_match_certificate(
ctx_proof_message,
Expand Down

0 comments on commit 52fa7d3

Please sign in to comment.