Skip to content

Commit

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

* The state compatible epoch speedup

* update changelog

---------

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

# Conflicts:
#	CHANGELOG.md
#	x/incentives/keeper/distribute.go

* Update CHANGELOG.md

* Update distribute.go

---------

Co-authored-by: Dev Ojha <[email protected]>
  • Loading branch information
mergify[bot] and ValarDragon authored Aug 25, 2023
1 parent 834d3dd commit 4c6fc3d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 40 deletions.
39 changes: 1 addition & 38 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,46 +42,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### State Breaking

* [#5532](https://github.com/osmosis-labs/osmosis/pull/5532) fix: Fix x/tokenfactory genesis import denoms reset x/bank existing denom metadata

### Misc Improvements

* [#5534](https://github.com/osmosis-labs/osmosis/pull/5534) fix: fix the account number of x/tokenfactory module account
* [#5750](https://github.com/osmosis-labs/osmosis/pull/5750) feat: add cli commmand for converting proto structs to proto marshalled bytes

## v16.0.0
Osmosis Labs is excited to announce the release of v16.0.0, a major upgrade that includes a number of new features and improvements like introduction of new modules, updates existing APIs, and dependency updates. This upgrade aims to enhance capital efficiency by introducing SuperCharged Liquidity, introduce custom liquidity pools backed by CosmWasm smart contracts, and improve overall functionality.

New Modules and Features:

SuperCharged Liquidity Module (x/concentrated-liquidity):
- Introduces a game-changing pool model that enhances captical efficiency in Osmosis.

CosmWasm Pool Module (x/cosmwasmpool):
- Enables the creation and management of liquidity pools backed by CosmWasm smart contracts.

ProtoRev Changes (x/protorev):
- Modifies the payment schedule for the dev account from weekly to after every trade.
- Triggers backruns, joinPool, and exitPool using hooks.

TokenFactory before send hooks (x/tokenfactory):
- This enhancement allows for executing custom logic before sending tokens, providing more flexibility
and control over token transfers.


### Security

* Prevents a deadlock that new smart contracts could cause due to bugs in the SDK
* Adds a new app.toml config called `query-gas-limit` that limits how much computational resources a query can require. Mitigates bugs where nodes were getting knocked off the network due to responding to long queries.

### Bug fixes

* Makes historic queries use the correct block timestamp
* Fixes a bug where certain governance events weren't emitted
* Adds mempool protection for Barberry bug
* Various export genesis bug fixes
* [#6161](https://github.com/osmosis-labs/osmosis/pull/6161) Reduce CPU time of epochs

## v15.1.2

Expand Down
17 changes: 17 additions & 0 deletions x/incentives/keeper/distribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,23 @@ func (k Keeper) distributeInternal(
}

remainCoins := gauge.Coins.Sub(gauge.DistributedCoins)

// 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
}

// if its a perpetual gauge, we set remaining epochs to 1.
// otherwise is is a non perpetual gauge and we determine how many epoch payouts are left
remainEpochs := uint64(1)
Expand Down
4 changes: 2 additions & 2 deletions x/superfluid/keeper/stake.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ 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.
k.Logger(ctx).Info(fmt.Sprintf("Existing delegation not found for %s with %s during superfluid refresh."+
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 {
currentAmount = validator.TokensFromShares(delegation.Shares).RoundInt()
Expand All @@ -86,7 +86,7 @@ func (k Keeper) RefreshIntermediaryDelegationAmounts(ctx sdk.Context) {
ctx.Logger().Error("Error in forceUndelegateAndBurnOsmoTokens, state update reverted", err)
}
} else {
ctx.Logger().Info("Intermediary account already has correct delegation amount?" +
ctx.Logger().Debug("Intermediary account already has correct delegation amount?" +
" This with high probability implies the exact same spot price as the last epoch," +
"and no delegation changes.")
}
Expand Down

0 comments on commit 4c6fc3d

Please sign in to comment.