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

Speedup quo round up, start CL speedup integration (backport #8014) #8034

Closed
wants to merge 1 commit into from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 12, 2024

Significantly speedup quo round up by removing a second quo call, and lowering the big int size throughout by 2 words.

Also uses code reuse for panic checks as requested by @czarcas7ic

Summary by CodeRabbit

  • New Features

    • Introduced enhanced rounding logic for division operations in financial calculations.
    • Added a new function to support multiplication of decimal values, improving precision in financial computations.
  • Bug Fixes

    • Corrected rounding issues in division operations to accurately handle remainders.
    • Updated liquidity and price calculation methods to ensure accurate financial reporting in pools.

This is an automatic backport of pull request #8014 done by [Mergify](https://mergify.com).

* Speedup quo round up

* Code reuse

* Missed a code re-use point

* Add future notes

* Comment cleanup

* Auto: update go.mod after push to dev/speedup_quoroundup that modified dependencies locally

* Add new fn: NewBigDecFromDecMulDec

* Auto: update go.mod after push to dev/speedup_quoroundup that modified dependencies locally

* Remove some extra ops from CL

* Further perf notes

* Make faster QuoRoundUpNextIntMut

* Auto: update go.mod after push to dev/speedup_quoroundup that modified dependencies locally

* Remove another 2 BigDec ops

* Add another dec op

* Auto: update go.mod after push to dev/speedup_quoroundup that modified dependencies locally

* Start moving some liquidity calls to Dec not BigDec

* One more BigDec x Dec op

* Auto: update go.mod after push to dev/speedup_quoroundup that modified dependencies locally

* Another liq BigDec -> Dec

* Missed one step

* Move another Liquidity BigDec -> Dec

* Minor spread reward update

* Make CalcAmount1Dec use Dec for Liquidity

* Make one more op mutative

* One more speedup

* Fix test

* Speedup SpotPrice impl

---------

Co-authored-by: github-actions <[email protected]>
(cherry picked from commit 7b599d5)

# Conflicts:
#	CHANGELOG.md
#	go.mod
#	go.sum
#	osmomath/decimal.go
#	osmomath/go.mod
#	osmomath/go.sum
#	osmoutils/go.mod
#	osmoutils/go.sum
#	x/concentrated-liquidity/math/math.go
#	x/concentrated-liquidity/swapstrategy/one_for_zero.go
#	x/epochs/go.mod
#	x/epochs/go.sum
#	x/ibc-hooks/go.mod
#	x/ibc-hooks/go.sum
Copy link
Contributor Author

mergify bot commented Apr 12, 2024

Cherry-pick of 7b599d5 has failed:

On branch mergify/bp/v23.x/pr-8014
Your branch is up to date with 'origin/v23.x'.

You are currently cherry-picking commit 7b599d55.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   osmomath/decimal_test.go
	modified:   x/concentrated-liquidity/incentives_test.go
	modified:   x/concentrated-liquidity/math/math_test.go
	modified:   x/concentrated-liquidity/model/pool.go
	modified:   x/concentrated-liquidity/model/pool_test.go
	modified:   x/concentrated-liquidity/position_test.go
	modified:   x/concentrated-liquidity/swaps_tick_cross_test.go
	modified:   x/concentrated-liquidity/swapstrategy/spread_rewards.go
	modified:   x/concentrated-liquidity/swapstrategy/swap_strategy.go
	modified:   x/concentrated-liquidity/swapstrategy/zero_for_one.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   CHANGELOG.md
	both modified:   go.mod
	both modified:   go.sum
	both modified:   osmomath/decimal.go
	both modified:   osmomath/go.mod
	both modified:   osmomath/go.sum
	both modified:   osmoutils/go.mod
	both modified:   osmoutils/go.sum
	both modified:   x/concentrated-liquidity/math/math.go
	both modified:   x/concentrated-liquidity/swapstrategy/one_for_zero.go
	both modified:   x/epochs/go.mod
	both modified:   x/epochs/go.sum
	both modified:   x/ibc-hooks/go.mod
	both modified:   x/ibc-hooks/go.sum

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot deleted the mergify/bp/v23.x/pr-8014 branch April 18, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant