Open hats-bug-reporter[bot] opened 9 months ago
Thanks for the submission. Even though you've showed the problem manifesting in a different way, the underlying issue is the same as in https://github.com/hats-finance/AlephZeroAMM-0x0d88a9ece90994ecb3ba704730819d71c139f60f/issues/44 .
Or to put it differently - if you set your test on top of https://github.com/Cardinal-Cryptography/common-amm/pull/84 , it will not fail. That branch already includes the fix for the problem raised in #44.
Thank you for the submission. After carefully reviewing it we've decided to mark it as INVALID.
PoC should refer to the actual point where the issue lies in and why. It's not enough to describe one of many scenarios where things break, without pointing out why.
We hope to see you in the future challenges of ink! codebase.
Github username: @rodiontr Twitter username: -- Submission hash (on-chain): 0x5d2df285a3916c2d5140a328b4d7e96bd0063997ed04c121a19fd8411b7f0f61 Severity: high
Description: Description\
The user may be not able to deposit into a farm if his deposit amount is greater than the time interval of the farming.
Attack Scenario\
Let's say the owner wants to set 50_000 rewards for one day of farming equal to 86400 seconds. The problem is that the tx will revert due to the formula that makes the reward rate equal to 0 if the amount is less than duration of the farming.
Attachments
PoC:
The test fails with the following error:
However, the owner of the farm should be able to start the farm regardless of the duration.
You can see how this issue is not present anymore if the rewards > duration in seconds. They can be set, for example, to 100000 and the issue disappear:
The output: