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

improve getToDistributedCoinsFromGauges #2014

Merged
merged 3 commits into from
Jul 11, 2022
Merged

improve getToDistributedCoinsFromGauges #2014

merged 3 commits into from
Jul 11, 2022

Conversation

catShaark
Copy link
Contributor

Closes: #2005

What is the purpose of the change

Change getToDistributeCoinsFromGauges so that it only iterate through all gauges once.

Testing and Verifying

This change is already covered by existing tests

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? no
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? no
  • How is the feature or change documented? not documented

@catShaark catShaark requested a review from a team July 10, 2022 08:16
@@ -21,9 +21,14 @@ func (k Keeper) getDistributedCoinsFromGauges(gauges []types.Gauge) sdk.Coins {
}

func (k Keeper) getToDistributeCoinsFromGauges(gauges []types.Gauge) sdk.Coins {
// TODO: Consider optimizing this in the future to only require one iteration over all gauges.
coins := k.getCoinsFromGauges(gauges)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func (k Keeper) getCoinsFromGauges(gauges []types.Gauge) sdk.Coins {..} is unused now, maybe you can remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I'll remove it

Copy link
Contributor

@stackman27 stackman27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once we figure out what to do with getCoinsFromGauges() function and linter fix😅

Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement with the complexity! LGTM!

@mattverse mattverse merged commit 23dbadd into osmosis-labs:main Jul 11, 2022
@czarcas7ic czarcas7ic mentioned this pull request Aug 19, 2022
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.

x/incentives: get to distribute coins with single iteration
4 participants