diff --git a/src/main.rs b/src/main.rs index db9008b..f011916 100644 --- a/src/main.rs +++ b/src/main.rs @@ -728,7 +728,7 @@ struct TestLibrary { #[derive(Debug, PartialEq, Serialize, Deserialize)] struct TestBeaconState { execution_scripts: Vec, - libraries: Vec, + libraries: Option>, } #[derive(Debug, PartialEq, Serialize, Deserialize)] @@ -816,16 +816,19 @@ impl TryFrom for BeaconState { }) }) .collect(); - let libraries: Result, ScoutError> = input - .libraries - .iter() - .map(|library| { - Ok(Library { - name: library.name.to_string(), - code: std::fs::read(&library.file)?, + let libraries: Result, ScoutError> = if let Some(libraries) = input.libraries { + libraries + .iter() + .map(|library| { + Ok(Library { + name: library.name.to_string(), + code: std::fs::read(&library.file)?, + }) }) - }) - .collect(); + .collect() + } else { + Ok(Vec::new()) + }; Ok(BeaconState { execution_scripts: scripts?, libraries: libraries?,