chore: backport x/staking integration test migration changes (#22863)

This commit is contained in:
Akhil Kumar P 2024-12-13 17:47:17 +05:30 committed by GitHub
parent eac97c9055
commit a643d3afcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 6 deletions

View File

@ -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"
@ -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 {

View File

@ -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"}},

View File

@ -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())