pool.sol : First depositor can influence on the share value of the other depositor who may face truncation issue.
Summary
This issue can be faced by almost all the pool based contract. where initial depositor can deposit big amount. This will directly influence on the share value other depositors.
ak1
medium
pool.sol : First depositor can influence on the share value of the other depositor who may face truncation issue.
Summary
This issue can be faced by almost all the pool based contract. where initial depositor can deposit big amount. This will directly influence on the share value other depositors.
Vulnerability Detail
Pool calculates the share of deposit value as shown in above calculation. First user who deposit huge sum can decide the share values.
Impact
Future users can be suffered by less number of shares due to truncation issue.
Code Snippet
https://github.com/sherlock-audit/2023-02-surge/blob/main/surge-protocol-v1/src/Pool.sol#L199-L204
Tool used
Manual Review
Recommendation
During pool creation, mint/deposit some amount of initial share.
Duplicate of #125