Skip to content

Commit

Permalink
Merge pull request #1914 from input-output-hk/jpraynaud/1911-seamless…
Browse files Browse the repository at this point in the history
…-stable-unstable-features-client-wasm

Refactor: seamless `unstable` to `stable` transition in WASM client
  • Loading branch information
jpraynaud authored Sep 4, 2024
2 parents 1beeae8 + b0eaa98 commit 899f86c
Show file tree
Hide file tree
Showing 15 changed files with 162 additions and 111 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ As a minor extension, we have adopted a slightly different versioning convention

## Mithril Distribution [XXXX] - UNRELEASED

- **BREAKING** changes in Mithril client WASM:

- Implementation of seamless transition from **unstable** to **stable** features.
- A new `unstable` option in the client allows the usage of unstable features.
- The previous `client.unstable` implementation is not supported anymore and must be replaced with `client`.

- Support for Mithril nodes footprint support in Prometheus monitoring in infrastructure.

- Add support for custom HTTP headers in Mithril client WASM library.
Expand All @@ -19,7 +25,7 @@ As a minor extension, we have adopted a slightly different versioning convention

- Add feature options `num-integer-backend` and `rug-backend` for `mithril-common` and `mithril-client` crates. Allows to disable `rug-backend` and avoid `LGPL` license usage.

- Post `Chang` hard fork cleanup of the CI and the devnet.
- Post `Chang` hard fork cleanup of the CI, devnet and infrastructure.

- **UNSTABLE** Cardano stake distribution certification:

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.

Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ broadcast_channel.onmessage = (e) => {

await initMithrilClient();

let client = await new MithrilClient(
aggregator_endpoint,
genesis_verification_key,
);
let client = new MithrilClient(aggregator_endpoint, genesis_verification_key, {
// The following option activates the unstable features of the client.
// Unstable features will trigger an error if this option is not set.
unstable: true,
});
let mithril_stake_distributions_list =
await client.list_mithril_stake_distributions();
console.log("stake distributions:", mithril_stake_distributions_list);
Expand Down Expand Up @@ -187,7 +188,7 @@ wget -q -O - https://aggregator.pre-release-preview.api.mithril.network/aggregat
:::

```js
const proof = await client.unstable.get_cardano_transaction_proofs([
const proof = await client.get_cardano_transaction_proofs([
"CARDANO_TRANSACTION_HASH_1",
"CARDANO_TRANSACTION_HASH_2",
]);
Expand All @@ -203,7 +204,7 @@ console.log(
);

let valid_cardano_transaction_proof =
await client.unstable.verify_cardano_transaction_proof_then_compute_message(
await client.verify_cardano_transaction_proof_then_compute_message(
proof,
proof_certificate,
);
Expand Down Expand Up @@ -233,11 +234,11 @@ wget -q -O - https://aggregator.testing-preview.api.mithril.network/aggregator |

```js
let cardano_stake_distributions_list =
await client.unstable.list_cardano_stake_distributions();
await client.list_cardano_stake_distributions();
console.log("cardano stake distributions:", cardano_stake_distributions_list);

let last_cardano_stake_distribution =
await client.unstable.get_cardano_stake_distribution(
await client.get_cardano_stake_distribution(
cardano_stake_distributions_list[0].hash,
);
console.log(
Expand All @@ -259,7 +260,7 @@ console.log(
);

let cardano_stake_distribution_message =
await client.unstable.compute_cardano_stake_distribution_message(
await client.compute_cardano_stake_distribution_message(
certificate,
last_cardano_stake_distribution,
);
Expand Down
2 changes: 1 addition & 1 deletion mithril-client-wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-client-wasm"
version = "0.3.10"
version = "0.4.0"
description = "Mithril client WASM"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
Loading

0 comments on commit 899f86c

Please sign in to comment.