-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat: add endblocker with valsetupdate type #15829
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7e297f4
add setvalidator set update in staking
tac0turtle 2adba9d
different approach
tac0turtle 7afe9b9
cleanup
tac0turtle 8d970e7
Merge branch 'main' into marko/valsetupdate
tac0turtle b2e6188
cleanup
tac0turtle ccfe454
cleanup
tac0turtle 475a4c2
define type
tac0turtle c4d0e22
fix a few things
tac0turtle 74ecd2a
changelog and todo
tac0turtle 68bf01a
Merge branch 'main' into marko/valsetupdate
tac0turtle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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 file contains 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 file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
package staking | ||
package keeper | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
abci "github.com/cometbft/cometbft/abci/types" | ||
|
||
"github.com/cosmos/cosmos-sdk/telemetry" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/x/staking/keeper" | ||
"github.com/cosmos/cosmos-sdk/x/staking/types" | ||
) | ||
|
||
// BeginBlocker will persist the current header and validator set as a historical entry | ||
// and prune the oldest entry based on the HistoricalEntries parameter | ||
func BeginBlocker(ctx sdk.Context, k *keeper.Keeper) { | ||
func (k *Keeper) BeginBlocker(ctx sdk.Context) { | ||
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) | ||
|
||
k.TrackHistoricalInfo(ctx) | ||
|
||
} | ||
|
||
// Called every block, update validator set | ||
func EndBlocker(ctx sdk.Context, k *keeper.Keeper) []abci.ValidatorUpdate { | ||
func (k *Keeper) EndBlocker(ctx context.Context) ([]abci.ValidatorUpdate, error) { | ||
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker) | ||
|
||
return k.BlockValidatorUpdates(ctx) | ||
return k.BlockValidatorUpdates(sdk.UnwrapSDKContext(ctx)), nil | ||
Check warning Code scanning / CodeQL Panic in BeginBock or EndBlock consensus methods
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
|
||
} |
This file contains 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 file contains 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
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.
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.
Do we have somewhere something that explains the difference between:
HasABCIEndblock, EndBlockAppModule and HasEndBlocker?
Those 3 extension interfaces doing seemingly the same thing (I know they don't but still) could get confusing.
Small nit on that new extension interface, I think it should have had a capital B for block for consistency with the other 2.
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.
the one above gets removed in another pr. Left a todo for when we do docs on core api