|
14 | 14 |
|
15 | 15 | import cli_parser
|
16 | 16 | from constants import IGNORED_MODEL_HASHES
|
17 |
| -from execution_layer.circuit import ProofSystem |
18 | 17 |
|
19 | 18 | from functools import partial
|
20 | 19 | from collections import OrderedDict
|
@@ -56,12 +55,14 @@ def run_shared_preflight_checks(role: Optional[Roles] = None):
|
56 | 55 | Exception: If any of the pre-flight checks fail.
|
57 | 56 | """
|
58 | 57 |
|
59 |
| - preflight_checks = OrderedDict({ |
60 |
| - "Syncing model files": partial(sync_model_files, role=role), |
61 |
| - "Ensuring Node.js version": ensure_nodejs_version, |
62 |
| - "Checking SnarkJS installation": ensure_snarkjs_installed, |
63 |
| - "Checking EZKL installation": ensure_ezkl_installed, |
64 |
| - }) |
| 58 | + preflight_checks = OrderedDict( |
| 59 | + { |
| 60 | + "Syncing model files": partial(sync_model_files, role=role), |
| 61 | + "Ensuring Node.js version": ensure_nodejs_version, |
| 62 | + "Checking SnarkJS installation": ensure_snarkjs_installed, |
| 63 | + "Checking EZKL installation": ensure_ezkl_installed, |
| 64 | + } |
| 65 | + ) |
65 | 66 |
|
66 | 67 | bt.logging.info(" PreFlight | Running pre-flight checks")
|
67 | 68 |
|
@@ -176,6 +177,26 @@ def sync_model_files(role: Optional[Roles] = None):
|
176 | 177 | MODEL_DIR = os.path.join(os.path.dirname(__file__), "..", "deployment_layer")
|
177 | 178 | SYNC_LOG_PREFIX = " SYNC | "
|
178 | 179 |
|
| 180 | + loop = asyncio.get_event_loop() |
| 181 | + for logrows in range(1, 26): |
| 182 | + if os.path.exists( |
| 183 | + os.path.join(os.path.expanduser("~"), ".ezkl", "srs", f"kzg{logrows}.srs") |
| 184 | + ): |
| 185 | + bt.logging.info( |
| 186 | + f"{SYNC_LOG_PREFIX}SRS for logrows={logrows} already exists, skipping..." |
| 187 | + ) |
| 188 | + continue |
| 189 | + |
| 190 | + try: |
| 191 | + loop.run_until_complete(download_srs(logrows)) |
| 192 | + bt.logging.info( |
| 193 | + f"{SYNC_LOG_PREFIX}Successfully downloaded SRS for logrows={logrows}" |
| 194 | + ) |
| 195 | + except Exception as e: |
| 196 | + bt.logging.error( |
| 197 | + f"{SYNC_LOG_PREFIX}Failed to download SRS for logrows={logrows}: {e}" |
| 198 | + ) |
| 199 | + |
179 | 200 | for model_hash in os.listdir(MODEL_DIR):
|
180 | 201 | if not model_hash.startswith("model_"):
|
181 | 202 | continue
|
@@ -203,29 +224,6 @@ def sync_model_files(role: Optional[Roles] = None):
|
203 | 224 | SYNC_LOG_PREFIX + f"Failed to parse JSON from {metadata_file}"
|
204 | 225 | )
|
205 | 226 | continue
|
206 |
| - # If it's an EZKL model, we'll try to download the SRS files |
207 |
| - if metadata.get("proof_system") == ProofSystem.EZKL: |
208 |
| - ezkl_settings_file = os.path.join(MODEL_DIR, model_hash, "settings.json") |
209 |
| - if not os.path.isfile(ezkl_settings_file): |
210 |
| - bt.logging.error( |
211 |
| - f"{SYNC_LOG_PREFIX}Settings file not found at {ezkl_settings_file} for {model_hash}. Skipping sync." |
212 |
| - ) |
213 |
| - continue |
214 |
| - |
215 |
| - try: |
216 |
| - with open(ezkl_settings_file, "r", encoding="utf-8") as f: |
217 |
| - logrows = json.load(f).get("run_args", {}).get("logrows") |
218 |
| - if logrows: |
219 |
| - loop = asyncio.get_event_loop() |
220 |
| - loop.run_until_complete(download_srs(logrows)) |
221 |
| - bt.logging.info( |
222 |
| - f"{SYNC_LOG_PREFIX}Successfully downloaded SRS for logrows={logrows}" |
223 |
| - ) |
224 |
| - except (json.JSONDecodeError, subprocess.CalledProcessError) as e: |
225 |
| - bt.logging.error( |
226 |
| - f"{SYNC_LOG_PREFIX}Failed to process settings or download SRS: {e}" |
227 |
| - ) |
228 |
| - continue |
229 | 227 |
|
230 | 228 | external_files = metadata.get("external_files", {})
|
231 | 229 | for key, url in external_files.items():
|
|
0 commit comments