The EvolvingProteus._checkBalances function is used to verify the token reserve balances and the token reserve ratio are within the valid boundaries of the pool. To validate the reserve ratio is within the valid range of MIN_M - MAX_M, the following checks are performed:
The NATSPEC comments for the MIN_M and MAX_M are given as follows:
Even though the documentation says the y / x ratio can have at most 10**8, the logic implementation reverts when the y / x == 10**8 as shown below:
But it is not the case with the MIN_M, as the transaction will not revert when y / x == 1 / 10**8. There is a discrepancy between the documentation and the logic implementation.
Consider a scenario where the y balance = 200 * 10**20 and x balance = 200 * 10**12; now y / x = 10**8. The transaction is not expected to be reverted since the documentation mentions that the pool is allowed to have at most 10**8 y for each x. But according to the logic implementation, this transaction will revert since MAX_M == finalBalanceRatio. This breaks the expected behaviour of the protocol. 
https://github.com/code-423n4/2023-08-shell/blob/main/src/proteus/EvolvingProteus.sol#L812-L813
https://github.com/code-423n4/2023-08-shell/blob/main/src/proteus/EvolvingProteus.sol#L155-L157
https://github.com/code-423n4/2023-08-shell/blob/main/src/proteus/EvolvingProteus.sol#L149-L151
VSCode
It is recommended to modify the MAX_M <= finalBalanceRatio conditional check of the _checkBalances function, as shown below (omit the equality check in it):
Dravee (judge) commented:
For this audit, 13 reports were submitted by wardens detailing gas optimizations. The report highlighted below by lsaudit received the top score from the judge.
The following wardens also submitted reports: MrPotatoMagic, JP_Courses, 0xAnah, 0xhacksmithh, 0x11singh99, pontifex, 0x4non, pfapostol, 0xSmartContract, Sathish9098, Jorgect, and epistkr.
