Skip to content

Commit 6aa4aca

Browse files
authored
Restore typed data to serialized PODs (#318)
1 parent 3306f36 commit 6aa4aca

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/frontend/serialization.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
use std::collections::HashMap;
2+
13
use schemars::JsonSchema;
24
use serde::{Deserialize, Serialize};
35

46
use super::Error;
57
use crate::{
68
frontend::{MainPod, SignedPod},
7-
middleware::{deserialize_pod, deserialize_signed_pod, Params, PodId, VDSet},
9+
middleware::{
10+
deserialize_pod, deserialize_signed_pod, Key, Params, PodId, Statement, VDSet, Value,
11+
},
812
};
913

1014
#[derive(Serialize, Deserialize, JsonSchema)]
@@ -19,6 +23,7 @@ pub enum SignedPodType {
1923
pub struct SerializedSignedPod {
2024
pod_type: (usize, String),
2125
id: PodId,
26+
entries: HashMap<Key, Value>,
2227
data: serde_json::Value,
2328
}
2429

@@ -30,6 +35,7 @@ pub struct SerializedMainPod {
3035
pod_type: (usize, String),
3136
id: PodId,
3237
vd_set: VDSet,
38+
public_statements: Vec<Statement>,
3339
data: serde_json::Value,
3440
}
3541

@@ -40,6 +46,7 @@ impl From<SignedPod> for SerializedSignedPod {
4046
SerializedSignedPod {
4147
pod_type: (pod_type, pod_type_name_str.to_string()),
4248
id: pod.id(),
49+
entries: pod.kvs().clone(),
4350
data,
4451
}
4552
}
@@ -64,6 +71,7 @@ impl From<MainPod> for SerializedMainPod {
6471
id: pod.id(),
6572
vd_set: pod.pod.vd_set().clone(),
6673
params: pod.params.clone(),
74+
public_statements: pod.pod.pub_statements(),
6775
data,
6876
}
6977
}

0 commit comments

Comments
 (0)