osmosis icon indicating copy to clipboard operation
osmosis copied to clipboard

x/gamm: define gas fee for stableswap pool swap computations

Open dalmirel opened this issue 2 years ago • 2 comments

This Issue is created during the Informal Systems audit, after analysis of the existing specification and code inspection for balancer code performed on commit hash: 42d73f1 and for stableswap code performed on: v13.0.0

Summary: Currently there is no charging gas for swaps for computations made during SwapExactAmountIn and SwapExactAmountOut for stableswap pools. Gas is charged only for i/o ops.

Balancer pools do charge additional gas defined with constant BalancerGasFeeForSwap https://github.com/osmosis-labs/osmosis/blob/7374795e0de22f3a291ca59c5faffa7851acf3bd/x/gamm/pool-models/balancer/pool.go#L594-L595

Suggestions:

  • There should be StableswapGasFeeForSwap defined, at least and added in updatePoolLiquidityForSwap, only when the function is called for swaps - since currently it is used for exit also.
  • It would also be good to parametrize gas fees - this could resolve possible issues during testing.

dalmirel avatar Dec 22 '22 13:12 dalmirel

We should definitely do this, I suggest using a constant amount of 30_000 gas.

ValarDragon avatar Apr 01 '24 10:04 ValarDragon

Hey @ValarDragon, I may need some guidance, but I would be happy to work on this task. Feel to suggest something else in case you thing there is something more relevant.

deividaspetraitis avatar Apr 03 '24 12:04 deividaspetraitis