sc_network_light/
schema.rs1pub(crate) mod v1 {
22 pub(crate) mod light {
23 include!(concat!(env!("OUT_DIR"), "/api.v1.light.rs"));
24 }
25}
26
27#[cfg(test)]
28mod tests {
29 use prost::Message as _;
30
31 #[test]
32 fn empty_proof_encodes_correctly() {
33 let encoded = super::v1::light::Response {
34 response: Some(super::v1::light::response::Response::RemoteReadResponse(
35 super::v1::light::RemoteReadResponse { proof: Some(Vec::new()) },
36 )),
37 }
38 .encode_to_vec();
39
40 assert_eq!(encoded, vec![(2 << 3) | 2, 2, (2 << 3) | 2, 0]);
43 }
44
45 #[test]
46 fn no_proof_encodes_correctly() {
47 let encoded = super::v1::light::Response {
48 response: Some(super::v1::light::response::Response::RemoteReadResponse(
49 super::v1::light::RemoteReadResponse { proof: None },
50 )),
51 }
52 .encode_to_vec();
53
54 assert_eq!(encoded, vec![(2 << 3) | 2, 0]);
56 }
57
58 #[test]
59 fn proof_encodes_correctly() {
60 let encoded = super::v1::light::Response {
61 response: Some(super::v1::light::response::Response::RemoteReadResponse(
62 super::v1::light::RemoteReadResponse { proof: Some(vec![1, 2, 3, 4]) },
63 )),
64 }
65 .encode_to_vec();
66
67 assert_eq!(encoded, vec![(2 << 3) | 2, 6, (2 << 3) | 2, 4, 1, 2, 3, 4]);
68 }
69}