Skip to content

Commit

Permalink
fix: apply review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jpraynaud committed Feb 21, 2025
1 parent b073961 commit 1bb55a4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import DocCardList from "@theme/DocCardList";

This section explores the way Mithril certification works for the different types of data currently supported, from the computation of the message that is signed by the Mithril signers, to the authenticity verification done by the Mithril clients.

Under the hood, we have implemented a certification framework which leverages the Mithril protocol to provide a robust foundation for "pluggable" custom modules which support the certification of specific type of data.
Under the hood, we have implemented a certification framework which leverages the Mithril protocol to provide a robust foundation for "pluggable" custom modules which support the certification of specific type of data:

- the **signers** compute the message with a specific module, and broadcast them
- the **aggregators** receive the signatures from the signers and attempt to aggregate them into a **Mithril multi-signature** ultimately sealed in a **Mithril certificate**
- the **clients** download "artifacts" and certificates in a **trustless way**, and use them to verify their authenticity.

[![Design of the Mithril certification](./images/certification-framework.jpg)](./images/certification-framework.jpg)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The message computation is the same on the signers and the aggregators.

The verification process operates on the full Cardano node internal database:

- the client downloads the a compressed artifact from an untrusted source (e.g. an aggregator or a cloud service)
- the client downloads a compressed artifact from an untrusted source (e.g. an aggregator or a cloud service)
- the client computes the message from the downloaded artifact and verifies that it is signed by a valid Mithril certificate.

[![Design of the certification of the Cardano node internal database](./images/cardano-node-database/message.jpg)](./images/cardano-node-database/message.jpg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ This is particularly useful for bridges, sidechains or other types of layer-2 pr

To do so, the Mithril signers and aggregators independently compute a message which represents the **Cardano stake distribution** and apply the Mithril protocol to jointly sign it.

A natural structure for the message is a **Merkle tree** which:

- can be represented succinctly by its **Merkle root** (the actual message signed)
- allows to **prove membership** of a transaction in the transactions set by providing the **Merkle path** from the transaction to the root.
A natural structure for the message is a **Merkle tree** which can be represented succinctly by its **Merkle root** (the actual message signed).

:::info

Expand Down Expand Up @@ -63,7 +60,7 @@ The Merkle tree inner nodes are computed with the `BLAKE2s-256` hash function: t
Given the very limited size of the stake distribution, the computation of the Merkle tree is very fast and can be done on the client side:

- the client downloads the serialized Cardano stake distribution from an artifact delivered by an aggregator
- the client computes the Merkle root (the message) and that it is is signed by a valid Mithril certificate.
- the client computes the Merkle root (the message) and that it is signed by a valid Mithril certificate.

[![Design of the certification of the Cardano stake distribution](./images/stake-distribution/message.jpg)](./images/stake-distribution/message.jpg)
<small><center>Message creation on the clients (same as on signers and aggregators)</center></small>
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ The Mithril certification is generally done with the following steps:
### Message computation

Unfortunately, creating a Merkle tree with `100 million` leaves is not feasible without high memory usage and long computation time, which is far beyond the operating capacity of the signer.
However, a **Merkle forrest** where the leaves of the Merkle tree which is signed are the roots of the Merkle trees whose leaves are the transaction hashes for contiguous block number ranges is providing a good solution.
However, a **Merkle forest** where the leaves of the Merkle tree which is signed are the roots of the Merkle trees whose leaves are the transaction hashes for contiguous block number ranges is providing a good solution.

It is worth pointing out that this structure is almost append-only in the case of transactions and thus some compression can be applied to the storage when it is not used to create a membership proof: this is why the information stored on the signers and the aggregators have different volumes.

The blocks are divided into **block ranges** of size `15` blocks. The leaves of the Merkle trees are the hashes of the transactions in the blocks of the range (`~150-1.5k` transactions per block range on the Cardano mainnet).
This allows to create a Merkle forrest of on an average `100` times less leaves than the number of transactions in the Cardano blockchain (`~1M` leaves instead on the Cardano mainnet).
The blocks are divided into **block ranges** of `15` blocks. The leaves of the Merkle trees are the hashes of the transactions in the blocks of the range (`~150-1.5k` transactions per block range on the Cardano mainnet).
This allows to create a Merkle forest of on an average `100` times less leaves than the number of transactions in the Cardano blockchain (`~1M` leaves instead on the Cardano mainnet).

[![Design of the certification of the Cardano transactions](./images/cardano-transactions/message-aggregator.jpg)](./images/cardano-transactions/message-aggregator.jpg)
<small><center>Message creation when aggregating on the aggregator</center></small>
Expand All @@ -71,7 +71,7 @@ The Merkle tree inner nodes are computed with the `BLAKE2s-256` hash function: t

The verification process operates on a subset of the Cardano set that can be certified (fully or partially):

- the client calls a prover route on the aggregator which computes a **Merkle proof of membership** for the transactions signed in the latest snapshot
- the client calls a prover route exposed by the aggregator which computes a **Merkle proof of membership** for the transactions signed in the latest snapshot
- the client verifies the proof of membership is valid and that its Merkle root (the message) is signed by a valid Mithril certificate.

[![Design of the certification of the Cardano transactions](./images/cardano-transactions/proof-client.jpg)](./images/cardano-transactions/proof-client.jpg)
Expand Down

0 comments on commit 1bb55a4

Please sign in to comment.