|
| 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/mithril-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. |
0 commit comments