fix: ValidatorStore interface doesn't match StakingKeeper (backport #17164) (#17283)

Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
mergify[bot]
2023-08-03 23:13:13 +00:00
committed by GitHub
co-authored by Facundo Medica Julien Robert
parent 8375a67cff
commit 69db56b49b
9 changed files with 174 additions and 113 deletions
+5 -10
View File
@@ -218,7 +218,8 @@ a default signature verification method which applications can use:
```go
type ValidatorStore interface {
GetValidatorByConsAddr(sdk.Context, cryptotypes.Address) (cryptotypes.PubKey, error)
TotalBondedTokens(ctx context.Context) (math.Int, error)
BondedTokensAndPubKeyByConsAddr(context.Context, sdk.ConsAddress) (math.Int, cmtprotocrypto.PublicKey, error)
}
// ValidateVoteExtensions is a function that an application can execute in
@@ -229,16 +230,10 @@ func (app *BaseApp) ValidateVoteExtensions(ctx sdk.Context, currentHeight int64,
continue
}
valConsAddr := cmtcrypto.Address(vote.Validator.Address)
validator, err := app.validatorStore.GetValidatorByConsAddr(ctx, valConsAddr)
valConsAddr := sdk.ConsAddress(vote.Validator.Address)
bondedTokens, cmtPubKey, err := valStore.BondedTokensAndPubKeyByConsAddr(ctx, valConsAddr)
if err != nil {
return fmt.Errorf("failed to get validator %s for vote extension", valConsAddr)
}
cmtPubKey, err := validator.CmtConsPublicKey()
if err != nil {
return fmt.Errorf("failed to convert public key: %w", err)
return fmt.Errorf("failed to get bonded tokens and public key for validator %s: %w", valConsAddr, err)
}
if len(vote.ExtensionSignature) == 0 {