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

Optimizing gas for swaps #5842

Closed
Tracked by #5191
stackman27 opened this issue Jul 15, 2023 · 1 comment
Closed
Tracked by #5191

Optimizing gas for swaps #5842

stackman27 opened this issue Jul 15, 2023 · 1 comment
Assignees

Comments

@stackman27
Copy link
Contributor

stackman27 commented Jul 15, 2023

Background

Currently with SwapExactAmountIn the gas goes over 50M with ~1K liquidity in a pool with over 100 positions initialized. The reason why the cost is so high is becasue we are crossing a lot of ticks. We can have more liquidity in ticks so that we dont cross tick with smaller swaps as well as figure out a way to optimize out swap functions to be more gas efficient

Suggested Design

@ValarDragon suggestion;

  • The first thing that comes to mind for me, is measuring gas cost for just getting a pool from state with all the spread accums / uptime accums in it.

  • Theres one trivial extra GetPool call we can eliminate from all swaps by making compute swap methods take in a pool instead of poolID
    EDIT: I think its maybe two GetPools eliminatable, including the one in updatePoolForSwap? This one not as clear

  • Similarly we can use the multi-send api's from bank to optimize the final fund transfers

Acceptance Criteria

  • Swap functions should cost a lot less gas (numbers tbd)
@stackman27 stackman27 self-assigned this Jul 15, 2023
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Osmosis Chain Development Jul 15, 2023
@czarcas7ic czarcas7ic moved this from Needs Triage 🔍 to Todo 🕒 in Osmosis Chain Development Jul 24, 2023
@czarcas7ic czarcas7ic moved this from Todo 🕒 to Needs PR Review in Osmosis Chain Development Jul 25, 2023
@ValarDragon
Copy link
Member

Closing this for now, were revisiting this problem lately under a different lens

@github-project-automation github-project-automation bot moved this from Needs PR Review to Done ✅ in Osmosis Chain Development Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants