neutron-org / neutron

Smart Contract platform secured by Cosmos Hub
https://neutron.org
Apache License 2.0
111 stars 94 forks source link

Feat/Behind Enemy Lines enforcement #527

Closed jcompagni10 closed 4 months ago

jcompagni10 commented 4 months ago

Prevent users from depositing behind enemy lines.

This is critical for prevent a DOS vector where users deposit many ticks of dust causing swaps to have to touch a large number of ticks. By preventing users from depositing at a price cheaper than the opposing token price (ie. on the wrong side of the spread), we greatly limit the surface area for ticks that can be dusted. Most ticks near the spread will already have liquidity so dusting is impossible or limit to a small set of un-used fee tiers. While users can still place dust towards the back of the order book this will not effect swaps.

Additionally, this maintains a nice invariant that all liquidity in the dex exists across a partitioned spread with no overlap in prices.

jcompagni10 commented 4 months ago

https://github.com/neutron-org/neutron-tests/actions/runs/9276692068

jcompagni10 commented 4 months ago

https://github.com/neutron-org/neutron-tests/actions/runs/9276692068

pr0n00gler commented 4 months ago

Resolve conflicts, pls