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

Gas Optimizations #213

Open
code423n4 opened this issue May 30, 2022 · 1 comment
Open

Gas Optimizations #213

code423n4 opened this issue May 30, 2022 · 1 comment
Labels
bug Something isn't working G (Gas Optimization)

Comments

@code423n4
Copy link
Contributor

Visibility declared as public an not used inside the contract can be declared external

Risk: Gas optimization

Findings:

getVotingStage(uint256) should be declared external:
- Gauge.getVotingStage(uint256) (contracts/Gauge.sol#163-171)
Link: https://github.com/code-423n4/2022-05-velodrome/tree/main/contracts/contracts/Gauge.sol#L163-L171

getFee(bool) should be declared external:
- PairFactory.getFee(bool) (contracts/factories/PairFactory.sol#76-78)
Link: https://github.com/code-423n4/2022-05-velodrome/tree/main/contracts/contracts/factories/PairFactory.sol#L76-L78

setGovernor(address) should be declared external:
- Voter.setGovernor(address) (contracts/Voter.sol#82-85)
Link: https://github.com/code-423n4/2022-05-velodrome/tree/main/contracts/contracts/Voter.sol#L82-L85

setEmergencyCouncil(address) should be declared external:
- Voter.setEmergencyCouncil(address) (contracts/Voter.sol#87-90)
Link: https://github.com/code-423n4/2022-05-velodrome/tree/main/contracts/contracts/Voter.sol#L87-L90

whitelist(address) should be declared external:
- Voter.whitelist(address) (contracts/Voter.sol#178-181)
Link: https://github.com/code-423n4/2022-05-velodrome/tree/main/contracts/contracts/Voter.sol#L178-L181

getPastVotes(address,uint256) should be declared external:
- VotingEscrow.getPastVotes(address,uint256) (contracts/VotingEscrow.sol#1184-1199)
Link: https://github.com/code-423n4/2022-05-velodrome/tree/main/contracts/contracts/VotingEscrow.sol#L1184-L1199

delegateBySig(address,uint256,uint256,uint8,bytes32,bytes32) should be declared external:
- VotingEscrow.delegateBySig(address,uint256,uint256,uint8,bytes32,bytes32) (contracts/VotingEscrow.sol#1354-1391)
Link: https://github.com/code-423n4/2022-05-velodrome/tree/main/contracts/contracts/VotingEscrow.sol#L1354-L1391

Recommendation: Change visibility to external
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#public-function-that-could-be-declared-external

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels May 30, 2022
code423n4 added a commit that referenced this issue May 30, 2022
@GalloDaSballo
Copy link
Collaborator

The finding will not save gas since 0.6.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working G (Gas Optimization)
Projects
None yet
Development

No branches or pull requests

2 participants