MCPcopy Create free account
hub / github.com/BitVM/BitVM / utils_deserialize_assertions

Function utils_deserialize_assertions

bitvm/src/chunk/api_runtime_utils.rs:90–128  ·  view source on GitHub ↗

deserialize assertions to CompressedState (i.e. concrete types of bigint and hasbytes) and get proof

(
    asserts: Assertions,
)

Source from the content-addressed store, hash-verified

88
89// deserialize assertions to CompressedState (i.e. concrete types of bigint and hasbytes) and get proof
90fn utils_deserialize_assertions(
91 asserts: Assertions,
92) -> (
93 [CompressedStateObject; NUM_PUBS],
94 [CompressedStateObject; NUM_U256],
95 [CompressedStateObject; NUM_HASH],
96) {
97 let mut cobj_pubs = vec![];
98 for i in 0..NUM_PUBS {
99 let nibs = asserts.0[i].to_vec();
100 let cobj = CompressedStateObject::deserialize_from_byte_array(nibs);
101 cobj_pubs.push(cobj);
102 }
103 let cobj_pubs: [CompressedStateObject; NUM_PUBS] = cobj_pubs.try_into().unwrap();
104
105 let mut cobj_fqs = vec![];
106 for i in 0..NUM_U256 {
107 let nibs = asserts.1[i].to_vec();
108 let cobj = CompressedStateObject::deserialize_from_byte_array(nibs);
109 cobj_fqs.push(cobj);
110 }
111 let cobj_fqs: [CompressedStateObject; NUM_U256] = cobj_fqs.try_into().unwrap();
112
113 let mut cobj_hashes = vec![];
114 for i in 0..NUM_HASH {
115 let nibs = asserts.2[i].to_vec();
116 let cobj = CompressedStateObject::deserialize_from_byte_array(nibs);
117 cobj_hashes.push(cobj);
118 }
119 let cobj_hashes: [CompressedStateObject; NUM_HASH] = cobj_hashes.try_into().unwrap();
120
121 let cobjs: (
122 [CompressedStateObject; NUM_PUBS],
123 [CompressedStateObject; NUM_U256],
124 [CompressedStateObject; NUM_HASH],
125 ) = (cobj_pubs, cobj_fqs, cobj_hashes);
126
127 cobjs
128}
129
130// mirror of the funtion get_assertion_from_segments
131pub(crate) fn get_segments_from_assertion(

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected