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

Unused Named Returns #23

Closed
code423n4 opened this issue Nov 26, 2021 · 2 comments
Closed

Unused Named Returns #23

code423n4 opened this issue Nov 26, 2021 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists G (Gas Optimization) invalid This doesn't seem right

Comments

@code423n4
Copy link
Contributor

Handle

ye0lde

Vulnerability details

Impact

Removing unused named return variables can reduce gas usage and improve code clarity.

Proof of Concept

Remove the unused named returns:

https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/Auction.sol#L370
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/Auction.sol#L376

Removing the unused named returns here will remove the "shadows" warning at line #437 as well.
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/Auction.sol#L433-L435

https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/Auction.sol#L443-L454
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/Auction.sol#L475-L485
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/Auction.sol#L505-L514

uint256 avgMaltPrice; needs to be defined as a local variable at line #658
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/Auction.sol#L650-L655

https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/AuctionBurnReserveSkew.sol#L134

Removing the unused named returns here will remove the "shadows" warning at line #147 as well.
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/AuctionEscapeHatch.sol#L146-L148

Removing the unused named returns here will remove the "shadows" warning at line #157 as well.
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/AuctionEscapeHatch.sol#L156-L158

https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/AuctionParticipant.sol#L43

https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/LiquidityExtension.sol#L67

https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/MovingAverage.sol#L352

https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/RewardSystem/RewardDistributor.sol#L120

https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/RewardSystem/RewardThrottle.sol#L175-L178

https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/StabilizerNode.sol#L298

https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/SwingTrader.sol#L53
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/SwingTrader.sol#L80

Tools Used

Visual Studio Code, Remix

Recommended Mitigation Steps

Remove the unused named return variables.
See POC for details.

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Nov 26, 2021
code423n4 added a commit that referenced this issue Nov 26, 2021
@0xScotch 0xScotch added the duplicate This issue or pull request already exists label Dec 9, 2021
@0xScotch
Copy link
Collaborator

0xScotch commented Dec 9, 2021

#77

@0xScotch 0xScotch closed this as completed Dec 9, 2021
@GalloDaSballo
Copy link
Collaborator

Same as #76

@GalloDaSballo GalloDaSballo added the invalid This doesn't seem right label Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists G (Gas Optimization) invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants