code-423n4 / 2021-09-sushitrident-2-findings

0 stars 0 forks source link

`addIncentive` and `reclaimIncentive` can be external #75

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

0xsanson

Vulnerability details

Impact

Function addIncentive and reclaimIncentive in ConcentratedLiquidityPoolManager can be external instead of public to save gas.

Proof of Concept

https://github.com/sushiswap/trident/blob/c405f3402a1ed336244053f8186742d2da5975e9/contracts/pool/concentrated/ConcentratedLiquidityPoolManager.sol#L36 https://github.com/sushiswap/trident/blob/c405f3402a1ed336244053f8186742d2da5975e9/contracts/pool/concentrated/ConcentratedLiquidityPoolManager.sol#L49

Tools Used

editor

sarangparikh22 commented 2 years ago

The above changes should have no effect on gas in this case, can you give me exact gas saving.

alcueca commented 2 years ago

@sarangparikh22, why would there be no gas savings?

These are public functions, transactional so they will always use gas. As far as I know the parameters will be copied from calldata to memory, costing gas.

sarangparikh22 commented 2 years ago

@alcueca The functioning of the current function has changed in our current code, I ran my test with those updated code, which uses the parameter and updates it, which is not possible to do with calldata. Since, this is for an older commit, it's a valid gas saving.

alcueca commented 2 years ago

Thank you, the wardens can only work on the submitted commit, and the issues are judged there. The issue is therefore valid.