I have been working on creating a guide to port Solidity smart contracts to ink! smart contracts. I was hoping for some input on how to best handle Solidity's uint256
in ink!.
Solidity is optimized for 256 bit / 32 byte words. So, many Solidity smart contracts use uint256
as a way to save on gas (but not necessarily storage). ink! does not have a u256
built in. To me, it seems like the size of a u128
(largest primitive numerical type in ink!) would be more than sufficient to represent most non-hash numerical values.
So, I am thinking that the proper route for this is to reduce the uint256
to a more appropriate size in ink!. Or if absolutely necessary, create a wrapper around a [u64; 4]
.
Does this seem like an appropriate approach? Also, are there any similar word-size optimizations for ink! / Wasm?