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

Shadowing Local Variables found in RCOrderbook.sol #124

Open
code423n4 opened this issue Jun 16, 2021 · 1 comment
Open

Shadowing Local Variables found in RCOrderbook.sol #124

code423n4 opened this issue Jun 16, 2021 · 1 comment

Comments

@code423n4
Copy link
Contributor

Handle

maplesyrup

Vulnerability details

Impact

1 - Low Risk

  • Possible incorrect use of variables are at stake which may have bad side effects to the contract if implemented incorrectly.

Proof of Concept

According to the Slither-analyzer documentation (https://github.com/crytic/slither/wiki/Detector-Documentation#local-variable-shadowing), shadowing local variables is naming conventions found in two or more variables that are similar. Although they do not pose any immediate risk to the contract, incorrect usage of the variables is possible and can cause serious issues if the developer does not pay close attention.

It is recommended that the naming of the following variables should be changed slightly to avoid any confusion:


RCOrderbook._updateBidInOrderbook(address,address,uint256,uint256,uint256,RCOrderbook.Bid)._owner

(contracts/RCOrderbook.sol line(s)#358) shadows:

Ownable._owner <------(state variable)

(node_modules/@openzeppelin/contracts/access/Ownable.sol line(s)#19)


RCOrderbook.closeMarket()._owner

(contracts/RCOrderbook.sol line(s)#639) shadows:

Ownable._owner <------(state variable)

(node_modules/@openzeppelin/contracts/access/Ownable.sol line(s)#19)


Tools Used

Solidity Compiler 0.8.4
Hardhat v2.3.3
Slither v0.8.0

Compiled, Tested, Deployed contracts on a local hardhat network.

Ran Slither-analyzer for further detecting and testing.

Recommended Mitigation Steps

(Worked best under python venv)

  1. Clone Project Repository
  2. Run Project against Hardhat network;
    compile and run default test on contracts.
  3. Installed slither analyzer:
    https://github.com/crytic/slither
  4. Ran [$ slither .] against RCOrderbook.sol and all contracts to verify results
@code423n4 code423n4 added 1 (Low Risk) bug Something isn't working labels Jun 16, 2021
code423n4 added a commit that referenced this issue Jun 16, 2021
@Splidge
Copy link
Collaborator

Splidge commented Jun 21, 2021

fixed here

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

2 participants