Skip to content

Commit

Permalink
Don't check for expired locks every single blcok (#8147)
Browse files Browse the repository at this point in the history
* Don't check for expired locks every single blcok

* Add Changelog
  • Loading branch information
ValarDragon authored Apr 27, 2024
1 parent 473da26 commit a89ea91
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#8125](https://github.com/osmosis-labs/osmosis/pull/8125) When using smart accounts, fees are deducted directly after the feePayer is authenticated. Regardless of the authentication of other signers
* [#8136](https://github.com/osmosis-labs/osmosis/pull/8136) Don't allow gauge creation/addition with rewards that have no protorev route (i.e. no way to determine if rewards meet minimum epoch value distribution requirements)
* [#8144](https://github.com/osmosis-labs/osmosis/pull/8144) IBC wasm clients can now make stargate queries and support abort.
* [#8147](https://github.com/osmosis-labs/osmosis/pull/8147) Process unbonding locks once per minute, rather than every single block.

### State Compatible

Expand Down
14 changes: 8 additions & 6 deletions x/lockup/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper)

// Called every block to automatically unlock matured locks.
func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate {
// TODO: Change this logic to "know" when the next unbonding time is, and only unlock at that time.
// At each unbond, do an iterate to find the next unbonding time and wait until then.
// delete synthetic locks matured before lockup deletion
k.DeleteAllMaturedSyntheticLocks(ctx)
if ctx.BlockHeight()%30 == 0 {
// TODO: Change this logic to "know" when the next unbonding time is, and only unlock at that time.
// At each unbond, do an iterate to find the next unbonding time and wait until then.
// delete synthetic locks matured before lockup deletion
k.DeleteAllMaturedSyntheticLocks(ctx)

// withdraw and delete locks
k.WithdrawAllMaturedLocks(ctx)
// withdraw and delete locks
k.WithdrawAllMaturedLocks(ctx)
}
return []abci.ValidatorUpdate{}
}

Expand Down

0 comments on commit a89ea91

Please sign in to comment.