| 65 | } |
| 66 | |
| 67 | fn parse_test_data(data: &[u8]) -> ParsedSampleData { |
| 68 | let car = CarReader::new(data).unwrap(); |
| 69 | let header = car.header().to_owned(); |
| 70 | let blocks: HashMap<Cid, Vec<u8>> = car.into_iter().collect::<Result<_, _>>().unwrap(); |
| 71 | assert_eq!(1, header.roots().len(), "More than one root not supported"); |
| 72 | let root_cid = &header.roots()[0]; |
| 73 | let meta = serde_ipld_dagcbor::from_slice::<TestMeta>(blocks.get(root_cid).unwrap()).unwrap(); |
| 74 | ParsedSampleData { meta, blocks } |
| 75 | } |
| 76 | |
| 77 | fn extract_controller(event: &unvalidated::Event<Ipld>) -> String { |
| 78 | match event { |