I am trying to deserialise an object of type MembershipWitness from a [u8] submitted by the user via rest api. The input from the user is a string which contains the bytes separated by a comma, so I had to parse this string an convert it to [u8].
let mut witness_bytes: [u8; 32] = [0; 32];
let mut decoded_witness_elements = decoded_witness.split(",");
let mut k=0;
for s in decoded_witness_elements {
witness_bytes[k] = s.parse::<u8>().unwrap();
k=k+1;
}
let mut witness: &[u8] = &witness_bytes;
let witness_membership = <MembershipWitness<G1Affine>>::deserialize(witness).unwrap();
I am getting the following error:
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: IoError(Error { kind: UnexpectedEof, message: "failed to fill whole buffer" })',
This is related to the last line of of the above code.
Please note that I am using the crate: https://crates.io/crates/vb_accumulator.
Here are some screenshots that hopefully helps in understanding the issue:

