Fast Khaki Raccoon
Medium
Although they are rare, they happen about 2 or 3 times a year, with 2024 having Cancun + Deneb, 2023 with Shanghai + Capella, and so on...
However the current system is not made to work with these changes properly as around the codebase we check for if the chain is a specific ID, instead of having configurable mappings.
As we can see from the bellow code we check if the chainid is 1, and if not we use the other fee. https://github.com/sherlock-audit/2025-01-peapods-finance/blob/main/contracts/contracts/DecentralizedIndex.sol#L198
uint256 _min = block.chainid == 1
? _lpBal / 1000
: _lpBal / 4000; // 0.1%/0.025% LP bal
However after a hard fork on ETH, everything will be the same, but the chainId will change, meaning that we would pick a _min
that is way smaller than the one that was used a few blocks back. This of course will spend enormous amounts of gas as now the min limit for swamping is less, meaning more swaps will occur.
The code snippet bellow that has a hard-coded check: https://github.com/sherlock-audit/2025-01-peapods-finance/blob/main/contracts/contracts/DecentralizedIndex.sol#L198
uint256 _min = block.chainid == 1
? _lpBal / 1000
: _lpBal / 4000; // 0.1%/0.025% LP bal
No response
No response
- ETH has a hard fork
- ChainId splits, new fork gets 1, old gets another number
- Old fork now has
min
set to 4 times less, performing 4x (or more) swaps, costing enormous amounts of gas for the users (eth is not cheap)
After a hard fork on ETH, everything will be the same, but the chainId will change, meaning that we would pick a _min
that is way smaller than the one that was used a few blocks back. This of course will spend enormous amounts of gas as now the min limit for swamping is less, meaning more swaps will occur.
uint256 _min = block.chainid == 1
? _lpBal / 1000
: _lpBal / 4000; // 0.1%/0.025% LP bal
No response
Use configurable mappings to set and manage the min amounts per contract.