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

Don't check for expired locks every single blcok #8147

Merged
merged 2 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,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