Skip to content
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

Variable one in Utils.sol can be set to constant #146

Open
code423n4 opened this issue Jul 21, 2021 · 0 comments
Open

Variable one in Utils.sol can be set to constant #146

code423n4 opened this issue Jul 21, 2021 · 0 comments
Assignees

Comments

@code423n4
Copy link
Contributor

Handle

maplesyrup

Vulnerability details

Impact

Gas optimizations
Does not affect the contract in any harmful way. Suggestions allow for smart contract gas optimizations.

Proof of Concept

According to Slither analyzer documentation (https://github.com/crytic/slither/wiki/Detector-Documentation#state-variables-that-could-be-declared-constant), the variable in contract Utils.sol called "one" or Utils.one can be set to a constant as it is considered a variable that does not change throughout the contract.

Slither Detectors:

constable-states:

Utils.one (contracts/Utils.sol, lines#11) should be constant


Code in contract:

uint public one = 10**18; <---- can be constant as it does not change


Console output (via Slither in JSON format):

"constable-states": [
"Utils.one (contracts/Utils.sol#11) should be constant\n"
],

Tools Used

Spartan Contracts
Solidity (v 0.8.3)
Slither Analyzer (v 0.8.0)

Recommended Mitigation Steps

  1. Clone repository for Spartan Smart Contracts
  2. Create a python virtual environment with a stable python version
  3. Install Slither Analyzer on the python VEM
  4. Run Slither against all contracts
@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Jul 21, 2021
code423n4 added a commit that referenced this issue Jul 21, 2021
@SamusElderg SamusElderg self-assigned this Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants