-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable cost differences between SSTORE8-248 #93
Comments
I think the cause is in solidity instead of EVM, as Ref: |
@janx shouldn't it be though? You're storing a value, should it not be cheaper if the size capability of the value is smaller? |
The main cost for sstore is not created from the size of the stored value (at least not for sizes up to 32 bytes), but from the actual insertion, so I don't think it is reasonable to reduce the costs for smaller values. The gas savings for smaller values in solidity does not arise from taking up less space but from being able to combine multiple variable assignments into a single sstore. |
@VoR0220 it would be cool. My point is adding SSTORE8-248 alone may not work, since variable assignment in solidity will be compiled to opcodes more than SSTORE. And as @chriseth pointed out, right now the main cost is from actual insertion, that should be taken into consideration too. Also related: |
The bulk of the actual underlying computational effort is in updating the merkle branch, which doesn't depend too much on the size of storage especially for values under 32 bytes; hence, Chris is entirely correct in that the larger gains come in batching multiple storage update operations (something that |
closing |
Currently in solidity, there is this very unintuitive way of declaring variables. You would think that taking up less storage with a uint8 would end up costing less in gas than a uint256, but in actuality you end up being charged more in gas for a uint8 than a uint256. This proposal is for a set of EVM opcodes to mimic SSTORE but with specific sizes and ascending gas costs from 8-248. I will add to this more, but this is an initial posting to get this out there. Let me know your initial thoughts and concerns.
The text was updated successfully, but these errors were encountered: