Skip to content

Commit 9a76c72

Browse files
committed
wip(docs): add guide to run SNARK tests
1 parent 41ba137 commit 9a76c72

1 file changed

Lines changed: 139 additions & 0 deletions

File tree

RUN-IVC-SNARK-TESTS.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Running SNARK Proofs Tests
2+
3+
This guide walks you through running SNARK proof tests for Mithril, covering both unit tests and the full end-to-end test suite.
4+
5+
## Prerequisites
6+
7+
- **Operating System**: Linux (Ubuntu 24.04 or later)
8+
- **Rust toolchain**: latest stable version
9+
- **Hardware Requirements**: At least 32GB (64GB recommended) of RAM and 16 CPU cores for optimal performance. If you computer has less CPU cores, you will need to adjust the `cardano-epoch-length` by the ratio of your CPU cores to 16. For example, if you have 8 CPU cores, double the `cardano-epoch-length`.
10+
11+
## Getting Started
12+
13+
Clone the Mithril repository:
14+
15+
```bash
16+
git clone git@github.com:input-output-hk/mithril.git
17+
cd mithril
18+
```
19+
20+
### Branch Setup
21+
22+
Switch to the dedicated SNARK end-to-end test branch:
23+
24+
```bash
25+
git switch jpraynaud/3142-ivc-snark-e2e-tests
26+
```
27+
28+
## Unit Tests
29+
30+
Run the full workspace unit tests with the `future_snark` feature enabled:
31+
32+
```bash
33+
cargo test --all-features --features future_snark
34+
```
35+
36+
## End-to-End Test
37+
38+
### Working Directory Configuration
39+
40+
> **Important**: The working directory path must be kept short because the Cardano node uses local socket files with path length limitations. Use an absolute path such as the example below. **Do not** use `.` as the working directory, this could delete your entire repository.
41+
42+
Set the working directory environment variable:
43+
44+
```bash
45+
WORK_DIRECTORY=~/Desktop/mithril/artifacts
46+
```
47+
48+
### Running the Test
49+
50+
The following command compiles all required nodes and runs the end-to-end test with SNARK proofs. Expect the full process to take approximately **100 minutes** on the recommended hardware configuration(otherwise the time will be multiplied by the ratio of your CPU cores to 16):
51+
52+
```bash
53+
cargo build --release --features future_snark \
54+
-p mithril-aggregator \
55+
-p mithril-signer \
56+
-p mithril-client-cli \
57+
-p mithril-relay \
58+
-p mithril-end-to-end \
59+
&& RUST_BACKTRACE=1 ./target/release/mithril-end-to-end -vvvv \
60+
--bin-directory ./target/release/ \
61+
--work-directory=$WORK_DIRECTORY \
62+
--devnet-scripts-directory=./mithril-test-lab/cardano-devnet \
63+
--cardano-node-version=11.0.1 \
64+
--mithril-era=lagrange \
65+
--aggregate-signature-type IvcSnark \
66+
--cardano-slot-length 1.0 \
67+
--cardano-epoch-length 1200 \
68+
--mithril-run-interval 60000 \
69+
minimal \
70+
--signed-entity-type CardanoStakeDistribution
71+
```
72+
73+
## Explorer
74+
75+
In a separate terminal, you can run the explorer to visualize the devnet by switching to the `mithril-explorer` directory:
76+
77+
```bash
78+
cd mithril-explorer
79+
```
80+
81+
Then build the WASM client with the `future_snark` feature enabled:
82+
83+
```bash
84+
WASM_PACK_ARGS="-- --features future_snark" make -C ../mithril-client-wasm build
85+
```
86+
87+
Then, run the development server:
88+
89+
```bash
90+
make dev
91+
```
92+
93+
Open [http://localhost:3000/explorer/?aggregator=https%3A%2F%2Faggregator.dev-follower-preview.api.mithril.network%2Faggregator](http://localhost:3000/explorer/?aggregator=https%3A%2F%2Faggregator.dev-follower-preview.api.mithril.network%2Faggregator) with your browser to see the result.
94+
95+
## Client
96+
97+
In order to verify some transaction on the `ivc-snark-preview` devnet, you can use the client CLI with the following command:
98+
99+
First compile the client CLI with the `future_snark` feature enabled:
100+
101+
```bash
102+
cargo build --release -p mithril-client-cli --features future_snark && mv target/release/mithril-client .
103+
```
104+
105+
Then, setup the environment variables:
106+
107+
```bash
108+
export AGGREGATOR_ENDPOINT=https://aggregator.ivc-snark-preview.api.mithril.network/aggregator
109+
export GENESIS_VERIFICATION_KEY=$(wget -q -O - https://raw.githubusercontent.com/input-output-hk/mithril/jpraynaud/3142-ivc-snark-e2e-tests/mithril-infra/configuration/ivc-snark-preview/genesis.vkey)
110+
```
111+
112+
Finally, you can verify a transaction with the following command:
113+
114+
```bash
115+
./mithril-client -vvv --json cardano-transaction certify 476b70373def274898ff32a95b6c00eecaff6db1937aec328d055121f84e39b8
116+
```
117+
118+
This should return a valid proof for the transaction, confirming that it has been certified by the Mithril protocol using SNARK proofs:
119+
120+
```bash
121+
{"mithril_client_cli_version":"0.13.17"}
122+
Jun 30 15:09:45.564 DEBG Mithril Client CLI version: 0.13.17
123+
Jun 30 15:09:45.564 DEBG Run Mode: dev
124+
Jun 30 15:09:45.564 DEBG Reading configuration file './config/dev.json'.
125+
src: MithrilCertificateVerifier
126+
Jun 30 15:09:45.570 DEBG New MithrilCertificateVerifier created
127+
{"timestamp": "2026-06-30T13:09:45.574372758+00:00", "step_num": 1, "total_steps": 4, "message": "Fetching a proof for the given transactions…"}
128+
Jun 30 15:09:45.574 DEBG GET /proof/cardano-transaction?transaction_hashes=476b70373def274898ff32a95b6c00eecaff6db1937aec328d055121f84e39b8, aggregator: https://aggregator.ivc-snark-preview.api.mithril.network/aggregator/
129+
{"timestamp": "2026-06-30T13:09:45.710021572+00:00", "step_num": 2, "total_steps": 4, "message": "Verifying the proof…"}
130+
Jun 30 15:09:45.710 DEBG Got Proof from aggregator, proof: CardanoTransactionsProofsMessage { certificate_hash: "8352001d7f0bdf688db035808e44236b97ab0fe379df300dd82d574706f5ada4", certified_transactions: [CardanoTransactionsSetProofMessagePart { transactions_hashes: ["476b70373def274898ff32a95b6c00eecaff6db1937aec328d055121f84e39b8"], proof: "7b226d61737465725f70726f6f66223a7b22696e6e65725f726f6f74223a7b2268617368223a5b31302c3131302c3132362c37342c362c3230302c34342c36342c35322c3133342c31332c3233302c37362c39302c38342c3136352c3235342c3136332c3137342c3139352c3235322c32372c3230362c3136302c38342c312c3230392c3132392c33372c3230362c3138362c36335d7d2c22696e6e65725f6c6561766573223a5b5b36353337372c7b2268617368223a5b39372c302c3135392c372c35372c38372c37312c3131362c3130372c3131342c39362c3130362c3232322c3232332c37302c34332c37372c3135332c3234352c3135302c32312c39312c3132352c35372c32392c3232362c39342c3139302c3139392c3130392c38312c3130315d7d5d5d2c22696e6e65725f70726f6f665f73697a65223a3537373133312c22696e6e65725f70726f6f665f6974656d73223a5b7b2268617368223a5b3138392c3232312c3234362c38332c3235302c3230392c3136302c362c32372c31392c3136382c3233372c3235342c34322c3135382c3131312c32312c3234342c3233302c322c34352c3231352c3138302c37362c3235302c342c31362c3132332c3133382c31312c3132392c3131315d7d2c7b2268617368223a5b3134382c3230382c3134312c3133312c3136382c3137342c39312c38302c3232332c31322c3139322c3138332c3232342c36372c3230362c3135342c35302c3231372c39382c35362c36342c3133372c332c3235302c37342c36392c362c35302c3130332c34392c3131362c385d7d2c7b2268617368223a5b3136342c34352c3137312c37362c3131312c33372c34352c3231372c3132342c3230382c31302c36372c37362c38332c35372c3132362c3133392c3138312c3232382c3233352c39322c34382c31382c33322c3134342c3133392c35352c3133312c33362c31322c39312c3135335d7d2c7b2268617368223a5b3132352c3139362c3232362c302c3137342c3131302c3131352c3135342c33362c3133382c3233392c362c3132372c3230382c3230302c3138302c322c31332c35342c3136342c37372c3234332c3136382c3138332c3234352c35302c38342c35392c3133302c3235332c3138332c3136345d7d2c7b2268617368223a5b33392c392c3130302c37312c3133392c3234322c3234322c3130312c3235332c3136312c34372c3231352c36322c3231322c3139352c3138362c3235352c36322c3234362c39322c36352c33372c31392c3131382c362c33392c3139352c39302c3130382c31362c3231342c34315d7d2c7b2268617368223a5b36312c3231392c34342c3135322c33342c39342c3139372c3235332c3137312c3131362c38312c31342c33352c3131382c3139392c31322c3139312c3235322c33302c3137302c3232352c3132382c3233352c31372c34322c3134382c3135302c3230322c3137392c39342c3232332c3136305d7d2c7b2268617368223a5b33382c3135382c3132322c3235302c3230392c3138322c3138372c3231362c33352c372c38392c31332c3134332c3139382c38382c3139382c33332c32302c3131312c3139362c3131312c3136372c3234382c3134332c38312c3235312c3139362c3234322c3234312c3136382c3133332c34335d7d2c7b2268617368223a5b352c3133352c392c3138392c37382c3230332c3133352c35342c3136392c3136322c3235312c3231352c312c3132382c3235352c33362c3234362c3232302c3139392c3137322c3235332c3138342c36352c3235322c34312c3137312c3130342c3233362c3232342c32332c3132322c36325d7d2c7b2268617368223a5b3132382c39312c38322c3135332c3137342c38312c35342c31392c3139312c302c33342c34372c36372c332c3131382c3135392c34372c342c33302c3138312c33352c3233312c3235322c3135322c3130382c3134372c3137362c3233372c332c35332c35302c3137355d7d2c7b2268617368223a5b37352c3230382c39322c3136392c3230322c37382c36332c33332c32332c38392c3231312c3136392c3234352c37372c322c35312c39382c33362c38322c39382c35302c38342c3137352c34372c35352c3136352c3230302c32372c36342c3234322c3234392c3136325d7d2c7b2268617368223a5b33342c36302c3230302c3131322c3232302c31352c3132322c3234372c3133332c3232332c39352c3233352c31362c3230322c3136322c3132372c3233342c3135312c3133382c362c3235352c37372c38332c3136332c34382c38302c3234332c3136392c3235302c3137382c31352c3231355d7d2c7b2268617368223a5b3231392c3233372c3135352c3135342c3138312c38322c3233342c3133322c3135362c3233342c3136392c3231392c32362c3230302c3232382c3137312c35372c3131342c39332c32342c3234392c3138302c34322c3230342c36382c3133322c35382c3233312c392c342c3233342c345d7d2c7b2268617368223a5b32342c3230352c39322c3139362c38312c31312c35332c3131392c36392c37302c3130312c3132312c33332c3230342c3138302c32372c32382c3133332c3232312c3135332c3139382c35352c3234332c3232332c32352c3139312c3135352c33312c3138342c3136332c34342c3136365d7d2c7b2268617368223a5b3133302c3139342c3135392c32302c3231302c35392c3137342c372c31362c3138352c36302c33322c3232372c35302c3235302c3133312c3234342c31372c3131382c39332c31382c3135312c3135332c3232312c32352c32342c3137362c35392c3235332c3235352c39352c3138385d7d2c7b2268617368223a5b352c37382c3134382c3134302c38342c3232332c3138332c3232362c3133362c39392c34382c3231352c362c35392c332c3139332c35302c3137332c3130302c32342c3131372c32302c3230322c3133352c3138312c32382c3230332c372c3135372c3130382c3234332c3134315d7d2c7b2268617368223a5b37342c3232382c3135312c3133372c3134382c32342c362c35362c3231352c3136382c35372c3134302c3231322c37352c39332c34342c3233322c3131392c36332c3135332c3235312c34302c3133352c3130352c3230312c36302c3233332c3132382c352c3231312c3132372c3233335d7d2c7b2268617368223a5b35382c3138322c312c32302c3130302c3130382c3138342c3130312c34302c392c392c302c32352c3135372c3135392c31312c3231332c3138372c32312c3234372c38362c3133392c3234352c332c39392c37302c3133342c37362c37372c37322c3134372c3131355d7d2c7b2268617368223a5b3137312c382c36382c3132322c34332c3131372c3137392c31342c35302c302c3134302c31302c3131332c33362c3130322c3136322c3139372c31362c3132372c3233382c36362c3132372c3135332c34372c35332c3232392c32342c3230352c36392c3135372c3131372c3232355d7d2c7b2268617368223a5b33342c352c3231352c3135302c3138352c3231372c3136392c3234362c38382c3132352c35302c3131382c3138302c3230392c39342c3235332c3139312c31372c342c3233332c31372c3136362c3232382c33362c3138312c3235312c3230382c38302c3134342c37332c3137302c34395d7d5d7d2c227375625f70726f6f6673223a5b5b7b22696e6e65725f72616e6765223a7b227374617274223a3532363032302c22656e64223a3532363033357d7d2c7b226d61737465725f70726f6f66223a7b22696e6e65725f726f6f74223a7b2268617368223a5b3233372c3230362c392c33362c33392c35302c3233382c3131312c3138332c3132302c3136372c3135312c3139382c3133352c3130332c36322c3134372c3135362c3134322c3138322c31342c3134312c3232392c3130362c33382c3130322c34392c3235332c3234382c3230362c35342c3131305d7d2c22696e6e65725f6c6561766573223a5b5b37332c7b2268617368223a5b35322c35352c35342c39382c35352c34382c35312c35352c35312c3130302c3130312c3130322c35302c35352c35322c35362c35372c35362c3130322c3130322c35312c35302c39372c35372c35332c39382c35342c39392c34382c34382c3130312c3130312c39392c39372c3130322c3130322c35342c3130302c39382c34392c35372c35312c35352c39372c3130312c39392c35312c35302c35362c3130302c34382c35332c35332c34392c35302c34392c3130322c35362c35322c3130312c35312c35372c39382c35365d7d5d5d2c22696e6e65725f70726f6f665f73697a65223a313135302c22696e6e65725f70726f6f665f6974656d73223a5b7b2268617368223a5b35322c39382c35372c39382c35362c3130302c35362c3130312c3130302c35322c3130302c35372c39372c39392c35302c35322c34392c35372c39392c3130312c3130312c35352c3130322c35302c3130312c35302c3130322c39372c39392c39372c35332c3130312c35322c34382c3130322c39392c34392c35362c35342c35332c35302c39392c35352c35372c35322c34392c34392c3130312c35342c3130322c3130302c35362c39392c3130312c39392c35312c39372c35372c3130312c35372c39372c35312c35372c35305d7d2c7b2268617368223a5b3232342c38352c3131342c3232302c38312c37322c37362c3130342c3137382c31362c3232372c3134322c3135322c3138342c3230332c36362c3235332c31372c3230322c3233362c31352c3137342c34392c3137322c3139392c3136302c3230302c35352c33332c38372c3233372c3134375d7d2c7b2268617368223a5b3137332c36352c3130342c33382c3134312c33382c3132302c3139322c3235312c3232352c34352c34332c37352c3234362c3234382c33332c35352c31362c3134362c35362c3138332c32372c33352c3231372c34332c39302c39372c3233342c3134302c31392c36342c3232385d7d2c7b2268617368223a5b31302c38302c3135302c3232332c38382c38362c3138342c3234362c35392c3232352c3135382c3233352c3134312c3132342c3130352c3136332c34302c39302c39312c39362c372c31392c3134332c3139382c3139312c332c3133342c3137332c3130302c302c3139312c32385d7d2c7b2268617368223a5b382c31342c34322c3132302c3137342c3234392c3133342c3230372c3137372c37382c36332c33332c3131312c32392c38342c3135392c3234392c3133302c3136352c3230362c33302c31312c33302c32392c3137392c3139392c3230382c35372c37352c3136332c33302c3233375d7d2c7b2268617368223a5b3233362c35362c3235302c38312c31362c3235352c3133322c3233332c3231312c31342c3230392c35342c33352c3131332c3139332c3130332c3137352c38372c3139372c3133362c3137392c3132342c3232382c32302c3131352c36332c3133312c38352c36352c3137382c31372c3132385d7d2c7b2268617368223a5b37392c3230322c37322c33362c3132382c36322c3139312c3231352c3234382c39302c3135372c3138372c3136312c3135372c3132382c3131362c3135342c3230382c31392c3134342c32362c34352c3133342c3134362c33322c37312c35382c39362c3136392c3130362c3138312c3138395d7d2c7b2268617368223a5b36322c3133392c34362c37312c3234342c36312c3131392c36322c3137302c3232372c36342c38332c3130322c3232362c372c3233352c3131392c3133322c3133332c3230312c32302c3234362c3231342c3137302c37362c36302c34352c34322c3134392c36392c33342c3131375d7d2c7b2268617368223a5b3131312c3130372c35382c3131372c3134312c3137342c35342c3130352c3131342c3135342c37362c36342c3233332c3137372c3232352c3139382c3132352c3133312c33382c33382c3136342c312c3133332c3230382c3139302c3138372c3137392c37372c3131352c3232392c3134312c3235355d7d2c7b2268617368223a5b3131312c3235342c3137332c32372c3139312c3234322c3231372c3131362c3235312c3233352c33392c3132362c3230302c3233332c3130342c3230392c3139392c3131362c36342c3137322c352c33302c37312c3233302c3235312c3230362c3136342c34362c39362c3131322c3232352c3137315d7d5d7d2c227375625f70726f6f6673223a5b5d7d5d5d7d" }], non_certified_transactions: [], latest_block_number: BlockNumber(4428599) }
131+
{"timestamp": "2026-06-30T13:09:45.710151054+00:00", "step_num": 3, "total_steps": 4, "message": "Fetching the associated certificate and verifying the certificate chain…"}
132+
Jun 30 15:09:45.710 DEBG GET /certificate/8352001d7f0bdf688db035808e44236b97ab0fe379df300dd82d574706f5ada4, aggregator: https://aggregator.ivc-snark-preview.api.mithril.network/aggregator/
133+
src: MithrilCertificateVerifier
134+
Jun 30 15:09:45.806 DEBG Verifying certificate, certificate_signed_entity_type: CardanoTransactions(Epoch(1344), BlockNumber(4428599)), certificate_epoch: Epoch(1344), certificate_previous_hash: 3a707182de1938f2d923def7d3bd3cef853c86575db5837f0be95261f3722d5d, certificate_hash: 8352001d7f0bdf688db035808e44236b97ab0fe379df300dd82d574706f5ada4
135+
Jun 30 15:09:45.807 DEBG Verify multi signature for "65336365396665393065646263326236613138343439323665366638383531393364353262306165613064656166623861323334303034383463313332656234"
136+
{"timestamp": "2026-06-30T13:09:45.819705265+00:00", "step_num": 4, "total_steps": 4, "message": "Verify that the proof is signed in the associated certificate"}
137+
{"certified_transactions": ["476b70373def274898ff32a95b6c00eecaff6db1937aec328d055121f84e39b8"], "non_certified_transactions": []}
138+
139+
```

0 commit comments

Comments
 (0)