From 7bc19e37f6c2ce5ce87484fefaa763fffeac8cb0 Mon Sep 17 00:00:00 2001 From: PatrickNercessian Date: Fri, 3 May 2024 14:07:02 -0400 Subject: [PATCH] Move station_id constraint assertion to run_js_module --- daemon/main.rs | 7 ------- runtime/runtime.rs | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/daemon/main.rs b/daemon/main.rs index a9471697..1169cd19 100644 --- a/daemon/main.rs +++ b/daemon/main.rs @@ -88,13 +88,6 @@ async fn run(config: CliArgs) -> Result { rng_seed: None, }; - if !Regex::new(r"^[0-9a-fA-F]{88}$") - .unwrap() - .is_match(&runtime_config.station_id) - { - return Err(anyhow!("Invalid station_id format")); - } - // TODO: handle module exit and restart it // https://github.com/filecoin-station/zinnia/issues/146 log::info!("Starting module {main_module}"); diff --git a/runtime/runtime.rs b/runtime/runtime.rs index 6d34a2db..d995ff49 100644 --- a/runtime/runtime.rs +++ b/runtime/runtime.rs @@ -97,6 +97,13 @@ pub async fn run_js_module( module_specifier: &ModuleSpecifier, bootstrap_options: &BootstrapOptions, ) -> Result<(), AnyError> { + if !Regex::new(r"^[0-9a-fA-F]{88}$") + .unwrap() + .is_match(&bootstrap_options.station_id) + { + return Err(anyhow!("Invalid station_id format")); + } + let blob_store = Arc::new(BlobStore::default()); let reporter = Rc::clone(&bootstrap_options.reporter);