Skip to content

Commit

Permalink
State compatible epoch speedup from v18 (#6161)
Browse files Browse the repository at this point in the history
* The state compatible epoch speedup

* update changelog

---------

Co-authored-by: devbot-wizard <[email protected]>
(cherry picked from commit 19c3c50)

# Conflicts:
#	CHANGELOG.md
#	x/superfluid/keeper/stake.go
  • Loading branch information
ValarDragon authored and mergify[bot] committed Aug 29, 2023
1 parent ccd154f commit e0f8556
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

<<<<<<< HEAD
### State Breaking

### Bug Fixes
Expand All @@ -59,10 +60,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<<<<<<< HEAD
=======
=======
>>>>>>> 19c3c508 (State compatible epoch speedup from v18 (#6161))
### Misc Improvements

* [#6161](https://github.com/osmosis-labs/osmosis/pull/6161) Reduce CPU time of epochs

<<<<<<< HEAD
### Bug Fixes

* [#6162](https://github.com/osmosis-labs/osmosis/pull/6162) allow zero qualifying balancer shares in CL incentives
Expand All @@ -81,6 +85,8 @@ Fixes mainnet bugs w/ incorrect accumulation sumtrees, and CL handling for a bal
* [#6144](https://github.com/osmosis-labs/osmosis/pull/6144) misc: Move many Superfluid info logs to debug logs
* [#6161](https://github.com/osmosis-labs/osmosis/pull/6161) Reduce CPU time of epochs

=======
>>>>>>> 19c3c508 (State compatible epoch speedup from v18 (#6161))
### API breaks

* [#6071](https://github.com/osmosis-labs/osmosis/pull/6071) reduce number of returns for UpdatePosition and TicksToSqrtPrice functions
Expand Down
16 changes: 16 additions & 0 deletions x/incentives/keeper/distribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,22 @@ func (k Keeper) distributeInternal(
return nil, nil
}

// In this case, remove redundant cases.
// Namely: gauge empty OR gauge coins undistributable.
if remainCoins.Empty() {
ctx.Logger().Debug(fmt.Sprintf("gauge debug, this gauge is empty, why is it being ran %d. Balancer code", gauge.Id))
err := k.updateGaugePostDistribute(ctx, gauge, totalDistrCoins)
return totalDistrCoins, err
}

// Remove some spam gauges, is state compatible.
// If they're to pool 1 they can't distr at this small of a quantity.
if remainCoins.Len() == 1 && remainCoins[0].Amount.LTE(sdk.NewInt(10)) && gauge.DistributeTo.Denom == "gamm/pool/1" && remainCoins[0].Denom != "uosmo" {
ctx.Logger().Debug(fmt.Sprintf("gauge debug, this gauge is perceived spam, skipping %d", gauge.Id))
err := k.updateGaugePostDistribute(ctx, gauge, totalDistrCoins)
return totalDistrCoins, err
}

for _, lock := range locks {
distrCoins := sdk.Coins{}
ctx.Logger().Debug("distributeInternal, distribute to lock", "module", types.ModuleName, "gaugeId", gauge.Id, "lockId", lock.ID, "remainCons", remainCoins, "height", ctx.BlockHeight())
Expand Down
3 changes: 3 additions & 0 deletions x/superfluid/keeper/stake.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ func (k Keeper) RefreshIntermediaryDelegationAmounts(ctx sdk.Context) {
if !found {
// continue if current delegation is 0, in case its really a dust delegation
// that becomes worth something after refresh.
<<<<<<< HEAD
// TODO: We have a correct explanation for this in some github issue, lets amend this correctly.
=======
>>>>>>> 19c3c508 (State compatible epoch speedup from v18 (#6161))
k.Logger(ctx).Debug(fmt.Sprintf("Existing delegation not found for %s with %s during superfluid refresh."+
" It may have been previously bonded, but now unbonded.", mAddr.String(), acc.ValAddr))
} else {
Expand Down

0 comments on commit e0f8556

Please sign in to comment.