You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, we are a research group on programming languages and software engineering. We recently conducted a systematic study on the causes, effects, and fixes of the inconsistent state update vulnerability in solidity. We are attempting to build a tool to detect bugs about state updates based on our findings. We have tried our prototype tool on some popular Github solidity repositories, and for your repository, we found that there are missing state updates or gas consumption that can be optimized.
The point is that when we declare a state variable in the contract, if the variable is not reassigned throughout the project, it may be a missed state update, including balance, order number, counter, contract status flag, etc. Of course, it may also be a state variable with special purposes that does not need to be changed, such as maximum supply, contract administrator address, configuration information, etc. When declaring these state variables that do not need to be changed, the constant or immutable modifier should be used as required, which will save gas.
For your repository, we found the following state variable that may need attention. If you are not forgetting to update it, perhaps you should declare it with the constant or immutable modifier:
Do you find our results useful? Your reply and invaluable suggestions would be greatly appreciated, and are vital for improving our tool. Thanks a lot for your time!
(The reason why constant and immutable modifiers can save gas is that they do not consume storage space within the EVM. Their values are compiled directly into smart contract bytecode, which reduces the gas cost of storage. This storage method also avoids the SLOAD operation that reads EVM storage (costs about 100 gas in EVM). The main difference between constant and immutable variables is that the value of immutable variables can be set in the constructor, and immutable variables may cost more gas than constant variables. In addition, there is a slight difference in the variable types they support. The official documentation describes more details: https://docs.soliditylang.org/en/latest/contracts.html)
The text was updated successfully, but these errors were encountered:
Hi, we are a research group on programming languages and software engineering. We recently conducted a systematic study on the causes, effects, and fixes of the inconsistent state update vulnerability in solidity. We are attempting to build a tool to detect bugs about state updates based on our findings. We have tried our prototype tool on some popular Github solidity repositories, and for your repository, we found that there are missing state updates or gas consumption that can be optimized.
The point is that when we declare a state variable in the contract, if the variable is not reassigned throughout the project, it may be a missed state update, including balance, order number, counter, contract status flag, etc. Of course, it may also be a state variable with special purposes that does not need to be changed, such as maximum supply, contract administrator address, configuration information, etc. When declaring these state variables that do not need to be changed, the constant or immutable modifier should be used as required, which will save gas.
For your repository, we found the following state variable that may need attention. If you are not forgetting to update it, perhaps you should declare it with the constant or immutable modifier:
AttestationIndexer.sol
State variable: __gap
Do you find our results useful? Your reply and invaluable suggestions would be greatly appreciated, and are vital for improving our tool. Thanks a lot for your time!
(The reason why constant and immutable modifiers can save gas is that they do not consume storage space within the EVM. Their values are compiled directly into smart contract bytecode, which reduces the gas cost of storage. This storage method also avoids the SLOAD operation that reads EVM storage (costs about 100 gas in EVM). The main difference between constant and immutable variables is that the value of immutable variables can be set in the constructor, and immutable variables may cost more gas than constant variables. In addition, there is a slight difference in the variable types they support. The official documentation describes more details: https://docs.soliditylang.org/en/latest/contracts.html)
The text was updated successfully, but these errors were encountered: