I read somewhere that Sophia doesn’t have problems with integer overflow (like Python or Erlang number types). Is it true?
If yes then we don’t need to wrap basic aritmetic operations into the functions (like in this tutorial: https://dev.aepps.com/tutorials/sophia-fungible-token-contract.html).
If not - then I would like to discuss the possibility to update the VM to protect against number overflow.
For reference: Michelson (Tezos Smart Contract language) has arbitrary precision for numbers.
Furthermore, the mutez type which is domain specific type for token values, represented as int64 protects against the overflow:
Operations are limited to prevent overflow and mixing them with other numerical types by mistake
Yes, Sophia is safe in this aspect, the following is from protocol/sophia.md:
All operations are safe , in the sense that they behave as the corresponding operations on arbitrary-size integers and fail with arithmetic_error if the result cannot be represented by a 256-bit signed word. For example, 2 ^ 255 fails rather than wrapping around to -2²⁵⁵.
The division and remained operations also throw an arithmetic error if the second argument is zero.
But FATE only has integers and they can be of any size, so they will never wrap,” he explains. “So there’s all these things that become simpler and safer with FATE.”