Skip to content

Commit 8bde5fe

Browse files
committed
Parse libraries in YAML format
1 parent bee7a66 commit 8bde5fe

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/main.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,16 @@ pub fn process_shard_block(
721721
Ok(deposit_receipts)
722722
}
723723

724+
#[derive(Debug, PartialEq, Serialize, Deserialize)]
725+
struct TestLibrary {
726+
name: String,
727+
file: String,
728+
}
729+
724730
#[derive(Debug, PartialEq, Serialize, Deserialize)]
725731
struct TestBeaconState {
726732
execution_scripts: Vec<String>,
733+
libraries: Vec<TestLibrary>,
727734
}
728735

729736
#[derive(Debug, PartialEq, Serialize, Deserialize)]
@@ -811,10 +818,19 @@ impl TryFrom<TestBeaconState> for BeaconState {
811818
})
812819
})
813820
.collect();
821+
let libraries: Result<Vec<Library>, ScoutError> = input
822+
.libraries
823+
.iter()
824+
.map(|library| {
825+
Ok(Library {
826+
name: library.name.to_string(),
827+
code: std::fs::read(&library.file)?,
828+
})
829+
})
830+
.collect();
814831
Ok(BeaconState {
815832
execution_scripts: scripts?,
816-
// FIXME: add parser here
817-
libraries: Vec::new(),
833+
libraries: libraries?,
818834
})
819835
}
820836
}

0 commit comments

Comments
 (0)