Skip to content

Conversation

@mingbaile
Copy link

Hi, We are a research group specializing in programming languages and software engineering. We recently studied inconsistent state update vulnerabilities in Solidity and are developing a tool to detect such issues.

After testing our prototype on your repository, we found some state variables that might either be missing updates or could be optimized for gas efficiency. Would you find our results useful? Your feedback would be invaluable in improving our tool!

These modifiers save gas by avoiding storage (SLOAD costs ~100 gas) and embedding values directly into bytecode. The key difference:
constant: Set at compile time, no runtime cost.
immutable: Assigned in the constructor, slightly more gas usage.
(More details)

Potential Optimizations: In your repository, the following state variables might need attention. If they are meant to remain unchanged, using constant or immutable can optimize gas:

xBitsToken.sol
State variable: _BLOCKS_PER_READJUSTMENT, _MINIMUM_TARGET, _MAXIMUM_TARGET

uint public _BLOCKS_PER_READJUSTMENT = 1024;   
uint public  _MINIMUM_TARGET = 2**16;
uint public  _MAXIMUM_TARGET = 2**234;

Thanks for your time! Looking forward to your thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant