Skip to content

Commit

Permalink
chore: backport x/staking integration test migration changes (#22863)
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilkumarpilli authored Dec 13, 2024
1 parent eac97c9 commit a643d3a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
29 changes: 24 additions & 5 deletions baseapp/abci_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/cosmos/gogoproto/proto"

"cosmossdk.io/core/comet"
"cosmossdk.io/core/header"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
Expand Down Expand Up @@ -46,11 +47,29 @@ func ValidateVoteExtensions(
valStore ValidatorStore,
extCommit abci.ExtendedCommitInfo,
) error {
// Get values from context
cp := ctx.ConsensusParams() //nolint:staticcheck // ignore linting error
currentHeight := ctx.HeaderInfo().Height
chainID := ctx.HeaderInfo().ChainID
commitInfo := ctx.CometInfo().LastCommit
return ValidateVoteExtensionsWithParams(
ctx,
ctx.ConsensusParams(), //nolint:staticcheck // ignore linting error
ctx.HeaderInfo(),
ctx.CometInfo(),
valStore,
extCommit,
)
}

// ValidateVoteExtensionsWithParams defines a helper function for verifying vote extension
// signatures with consensus params, header info and comet info taken as input
func ValidateVoteExtensionsWithParams(
ctx context.Context,
cp cmtproto.ConsensusParams,
headerInfo header.Info,
cometInfo comet.Info,
valStore ValidatorStore,
extCommit abci.ExtendedCommitInfo,
) error {
currentHeight := headerInfo.Height
chainID := headerInfo.ChainID
commitInfo := cometInfo.LastCommit

// Check that both extCommit + commit are ordered in accordance with vp/address.
if err := validateExtendedCommitAgainstLastCommit(extCommit, commitInfo); err != nil {
Expand Down
1 change: 1 addition & 0 deletions testutil/configurator/configurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ func AuthModule() ModuleOption {
{Account: "fee_collector"},
{Account: testutil.DistributionModuleName, Permissions: []string{"minter"}},
{Account: testutil.MintModuleName, Permissions: []string{"minter"}},
{Account: testutil.StakingModuleName, Permissions: []string{"minter"}},
{Account: "bonded_tokens_pool", Permissions: []string{"burner", testutil.StakingModuleName}},
{Account: "not_bonded_tokens_pool", Permissions: []string{"burner", testutil.StakingModuleName}},
{Account: testutil.GovModuleName, Permissions: []string{"burner"}},
Expand Down
2 changes: 1 addition & 1 deletion x/staking/keeper/cons_pubkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (k Keeper) GetBlockConsPubKeyRotationHistory(ctx context.Context) ([]types.
}

// GetValidatorConsPubKeyRotationHistory iterates over all the rotated history objects in the state with the given valAddr and returns.
func (k Keeper) GetValidatorConsPubKeyRotationHistory(ctx sdk.Context, operatorAddress sdk.ValAddress) ([]types.ConsPubKeyRotationHistory, error) {
func (k Keeper) GetValidatorConsPubKeyRotationHistory(ctx context.Context, operatorAddress sdk.ValAddress) ([]types.ConsPubKeyRotationHistory, error) {
var historyObjects []types.ConsPubKeyRotationHistory

rng := collections.NewPrefixedPairRange[[]byte, uint64](operatorAddress.Bytes())
Expand Down

0 comments on commit a643d3a

Please sign in to comment.