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

refactor: remove duplicate spread factor accumulator update logic #7625

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

p0mvn
Copy link
Member

@p0mvn p0mvn commented Feb 27, 2024

Closes: #XXX

What is the purpose of the change

Removed duplicate CL spread factor accumulator refetch.

Note that this is already achieved by the call to this:

initialSpreadRewardGrowthOppositeDirectionOfLastTraversal, err := k.getInitialSpreadRewardGrowthOppositeDirectionOfLastTraversalForTick(ctx, pool, tickIndex)

The above method does exactly the same operation as the removed logic:

currentTick := pool.GetCurrentTick()
if currentTick >= tick {
spreadRewardAccumulator, err := k.GetSpreadRewardAccumulator(ctx, pool.GetId())
if err != nil {
return sdk.DecCoins{}, err
}
return spreadRewardAccumulator.GetValue(), nil
}

Testing

  • Covered by existing tests

@p0mvn p0mvn added the V:state/breaking State machine breaking PR label Feb 27, 2024
@p0mvn p0mvn mentioned this pull request Feb 27, 2024
6 tasks
@p0mvn p0mvn marked this pull request as ready for review February 27, 2024 19:33
Copy link
Contributor

@AlpinYukseloglu AlpinYukseloglu left a comment

Choose a reason for hiding this comment

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

ACK since this was extracted from #7622 which I reviewed/approved

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@ValarDragon ValarDragon left a comment

Choose a reason for hiding this comment

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

that was tricky to convince myself was already here haha

Good job, nice gas savings :)

@ValarDragon ValarDragon merged commit 2306ddd into main Feb 28, 2024
1 check passed
@ValarDragon ValarDragon deleted the roman/dupl-accum-logic branch February 28, 2024 03:05
@github-actions github-actions bot mentioned this pull request Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants