MCPcopy Create free account
hub / github.com/Lightprotocol/light-protocol-v1 / pack_into_slice

Method pack_into_slice

program/src/state.rs:104–177  ·  view source on GitHub ↗
(&self, dst: &mut [u8])

Source from the content-addressed store, hash-verified

102 }
103
104 fn pack_into_slice(&self, dst: &mut [u8]) {
105 let dst = array_mut_ref![dst, 0, ChecksAndTransferState::LEN];
106
107 let (
108 //constants
109 _is_initialized_dst,
110 account_type_dst,
111 found_root_dst,
112 merkle_tree_index_dst,
113 signing_address_dst, // is relayer address
114 relayer_fee_dst,
115 recipient_dst,
116 ext_amount_dst,
117 amount_dst,
118 root_hash_dst,
119 _unused_dst,
120 tx_integrity_hash_dst,
121 //variables
122 current_instruction_index_dst,
123 //220
124 _unused_remainder_dst,
125 proof_a_b_c_leaves_and_nullifiers_dst,
126 ) = mut_array_refs![
127 dst,
128 1,
129 1,
130 1,
131 1,
132 32,
133 8,
134 32,
135 8,
136 32,
137 32,
138 32,
139 32,
140 8,
141 3296,
142 384 + ENCRYPTED_UTXOS_LENGTH
143 ];
144
145 for (i, const_has_changed) in self.changed_constants.iter().enumerate() {
146 if *const_has_changed {
147 if i == 0 {
148 *account_type_dst = [self.account_type; 1];
149 } else if i == 1 {
150 *found_root_dst = [self.found_root; 1];
151 } else if i == 2 {
152 *merkle_tree_index_dst = [self.merkle_tree_index; 1];
153 } else if i == 3 {
154 *signing_address_dst = self.signing_address.clone().try_into().unwrap();
155 } else if i == 4 {
156 *relayer_fee_dst = self.relayer_fee.clone().try_into().unwrap();
157 } else if i == 5 {
158 *recipient_dst = self.recipient.clone().try_into().unwrap();
159 } else if i == 6 {
160 *ext_amount_dst = self.ext_amount.clone().try_into().unwrap();
161 } else if i == 7 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected