-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Contract storage size panic on u32 overflow #2672
Comments
storage size should remain u32; if anyone ever manages to store more than 4GB of data on-chain, and pays for it, then it's fine to just saturate the total at 2**32-1. |
ok, implementation speaking it might not be easier because currently we only decrease/increase storage size on removed/inserted value. Thus we need to keep track of the real storage size otherwise a contract could go to a storage size of u32::max*2 and then remove u32::max size and he would have storage_size=0 but real_storage_size=u32::max. or find another implementation |
So switching from That said, it might be worthwhile to switch from panic to a regular |
Storage size is u32, and has value of all values size + storage_size_offset. If this exceed u32::max_value() then it currently panics.
Even if chain like Ethereum storage might never reach 4GB it might be the case for some peculiar chain using our framework. Thus I would go to make storage_size being u64.
This would imply some more complex conversion in rent computation but nothing that complicated.
The text was updated successfully, but these errors were encountered: