Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Tracked by #4622
dalmirel opened this issue Dec 22, 2022 · 2 comments
Open
Tracked by #4622

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

dalmirel opened this issue Dec 22, 2022 · 2 comments

Comments

@dalmirel
Copy link
Contributor

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

// Fixed gas consumption per swap to prevent spam
ctx.GasMeter().ConsumeGas(types.BalancerGasFeeForSwap, "balancer swap computation")

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.
@ValarDragon
Copy link
Member

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

@deividaspetraitis
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Triage 🔍
Development

Successfully merging a pull request may close this issue.

5 participants