|
1 | 1 | open Core_kernel |
2 | 2 |
|
| 3 | +(* Check if circuit data dumping is enabled via environment variable *) |
| 4 | +let should_dump_circuit_data () = |
| 5 | + match Sys.getenv_opt "MINA_DUMP_CIRCUIT_DATA" with |
| 6 | + | Some "true" | Some "1" | Some "yes" -> |
| 7 | + true |
| 8 | + | _ -> |
| 9 | + false |
| 10 | + |
3 | 11 | module Step = struct |
4 | 12 | module Key = struct |
5 | 13 | module Proving = struct |
@@ -53,7 +61,14 @@ module Step = struct |
53 | 61 | [%test_eq: string] header.constraint_system_hash |
54 | 62 | header_read.constraint_system_hash ; |
55 | 63 | { Backend.Tick.Keypair.index; cs } ) ) |
56 | | - (fun (_, header, _, _) t path -> |
| 64 | + (fun (_, header, _, cs) t path -> |
| 65 | + (* Conditionally dump extra circuit data based on environment variable *) |
| 66 | + if should_dump_circuit_data () then ( |
| 67 | + let logger = Logger.create () in |
| 68 | + Logger.info logger ~module_:__MODULE__ ~location:__LOC__ |
| 69 | + "Dumping Step circuit data to %s" path ; |
| 70 | + Kimchi_pasta_constraint_system.Vesta_constraint_system |
| 71 | + .dump_extra_circuit_data cs path ) ; |
57 | 72 | Or_error.try_with (fun () -> |
58 | 73 | Snark_keys_header.write_with_header |
59 | 74 | ~expected_max_size_log2:33 (* 8 GB should be enough *) |
@@ -185,7 +200,14 @@ module Wrap = struct |
185 | 200 | [%test_eq: string] header.constraint_system_hash |
186 | 201 | header_read.constraint_system_hash ; |
187 | 202 | { Backend.Tock.Keypair.index; cs } ) ) |
188 | | - (fun (_, header, _) t path -> |
| 203 | + (fun (_, header, cs) t path -> |
| 204 | + (* Conditionally dump extra circuit data based on environment variable *) |
| 205 | + if should_dump_circuit_data () then ( |
| 206 | + let logger = Logger.create () in |
| 207 | + Logger.info logger ~module_:__MODULE__ ~location:__LOC__ |
| 208 | + "Dumping Wrap circuit data to %s" path ; |
| 209 | + Kimchi_pasta_constraint_system.Pallas_constraint_system |
| 210 | + .dump_extra_circuit_data cs path ) ; |
189 | 211 | Or_error.try_with (fun () -> |
190 | 212 | Snark_keys_header.write_with_header |
191 | 213 | ~expected_max_size_log2:33 (* 8 GB should be enough *) |
|
0 commit comments