forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 7
perf: optimise staking endblocker #1725
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
Merged
randy-cro
merged 151 commits into
crypto-org-chain:release/v0.50.x
from
randy-cro:debug/validator-queue
Oct 15, 2025
Merged
perf: optimise staking endblocker #1725
randy-cro
merged 151 commits into
crypto-org-chain:release/v0.50.x
from
randy-cro:debug/validator-queue
Oct 15, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit 692150e.
6bc0bee to
99af2c5
Compare
songgaoye
reviewed
Oct 14, 2025
songgaoye
reviewed
Oct 14, 2025
songgaoye
reviewed
Oct 14, 2025
songgaoye
reviewed
Oct 14, 2025
songgaoye
reviewed
Oct 14, 2025
songgaoye
reviewed
Oct 14, 2025
songgaoye
reviewed
Oct 14, 2025
songgaoye
reviewed
Oct 14, 2025
songgaoye
reviewed
Oct 14, 2025
songgaoye
reviewed
Oct 14, 2025
songgaoye
reviewed
Oct 14, 2025
…prevent consensus failure
464fb46 to
f1c53f9
Compare
thomas-nguy
reviewed
Oct 14, 2025
thomas-nguy
reviewed
Oct 14, 2025
thomas-nguy
approved these changes
Oct 14, 2025
Collaborator
thomas-nguy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
d8ed3ff
into
crypto-org-chain:release/v0.50.x
46 of 48 checks passed
randy-cro
added a commit
that referenced
this pull request
Oct 21, 2025
perf: optimise staking endblocker (#1725)
randy-cro
added a commit
to randy-cro/cosmos-sdk
that referenced
this pull request
Oct 22, 2025
thomas-nguy
pushed a commit
that referenced
this pull request
Oct 31, 2025
20 tasks
randy-cro
added a commit
to randy-cro/cosmos-sdk
that referenced
this pull request
Nov 17, 2025
This reverts commit d8ed3ff.
randy-cro
added a commit
that referenced
this pull request
Nov 17, 2025
randy-cro
added a commit
to randy-cro/cosmos-sdk
that referenced
this pull request
Nov 17, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR optimises the staking endblocker.
It was discovered that on RocksDB archival nodes, the staking endblocker could take up to 1100ms, causing them to consistently lag behind pruned nodes. As such, there is an urgent need to improve block sync performance.
Root Cause
ValidatorQueueIteratorUBDQueueIteratorRedelegationQueueIteratorChanges Made
Instead of scanning the database from the beginning of time to the latest block height or timestamp on every block, an in-memory cache now stores these entries, significantly reducing I/O. The iterator is invoked only once during cache initialization when the node starts.
Results
With telemetry metrics enabled, we observed a significant performance improvement after these optimisations were applied.
Before:

After:

Closes: #XXXX
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues. Your PR will not be merged unless you satisfy
all of these items.
I have...
!in the type prefix if API or client breaking changeCHANGELOG.md