While using Ivy for networking, based on udp_impl.ivy, I found that using the following definition of a packet:
type packet
interpret packet -> bv[16]
instance pkt_serdes : serdes(packet,bytes, ivy_binary_ser, ivy_binary_deser)
instance net : udp_impl(endpoint_id, packet, ivy_binary_ser, ivy_binary_deser)
Enables, transmitting random messages of 8bytes, with only 2bytes(16bits) that is randomly initialized, while the 6 bytes are initialized to 0x00.
The destination thus receives, 8bytes in total, rather than the expected 2bytes.
While trying to debug this issue, I found that the following script for compilation:
/ivy/ivy_to_cpp.py provides the following description for __ser:
template <class T> void __ser(ivy_ser &res, const T &inp);
template <>
void __ser<int>(ivy_ser &res, const int &inp) {
res.set((long long)inp);
}
Which suggests that the packet is interpreted to be a long long. Is there a way, to ensure that the __ser and __deser, can be modified so that randomized data-packets of length 16bits can be generated, and no extra-padding bytes are sent on the wire?