kotlin-ipv8
kotlin-ipv8 copied to clipboard
Serializing Long is misleadingly using Int in transit
trafficstars
Another issue I found relates to the serialization of the Long values.
In the code seen below we can see an explicit cast to Int before putting the data in the buffer, thus the function downcasts to Int in serialization and upcasts back to Long when deserializing, causing confusion. https://github.com/Tribler/kotlin-ipv8/blob/476dc36d0a5208d4a6ef21d953e00e4a440046a4/ipv8/src/main/java/nl/tudelft/ipv8/messaging/Serialization.kt#L81-L85
I suggest conforming to the naming and just using Long in transit and create a separate explicit Int serialization.