code-423n4 / 2021-12-vader-findings

0 stars 0 forks source link

Internal functions can be private if the contract is not herited #133

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

Dravee

Vulnerability details

Impact

private functions are cheaper than internal functions.

Proof of Concept

Several internal functions are in contracts that are never inherited.

Their internal keywords are there:

lbt\LiquidityBasedTWAP.sol:
  154:     ) internal returns (uint256 currentLiquidityEvaluation) {
  194:     ) internal view returns (uint256) {
  255:     ) internal {
  357:     ) internal returns (uint256 currentLiquidityEvaluation) {
  388:     ) internal view returns (uint256) {
  449:     ) internal {

tokens\converter\Converter.sol:
  166:     function getChainId() internal view returns (uint256 chainId) {

Therefore, their visibility should be reduced to private.

Tools Used

VS Code

Recommended Mitigation Steps

Define these functions as private.