Skip to content
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

Use any as validator pubkey #7597

Merged
merged 58 commits into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e098384
protobuf pubkey type update
robert-zaremba Oct 19, 2020
4999b5c
wip2
robert-zaremba Oct 19, 2020
8f3645c
wip3
robert-zaremba Oct 19, 2020
bdd82af
solving types.NewValidator issues
robert-zaremba Oct 19, 2020
94047df
remove bech32 from validator type assignment
robert-zaremba Oct 19, 2020
324f31a
update Validator interface
robert-zaremba Oct 19, 2020
cc2d8a5
Changelog update
robert-zaremba Oct 19, 2020
774bf73
wip4
robert-zaremba Oct 19, 2020
ee2cad2
update genutil
robert-zaremba Oct 19, 2020
fc02eab
fix simapp & x/ibc/testing tests
clevinson Oct 19, 2020
51b2ab9
update staking
robert-zaremba Oct 19, 2020
05b8e73
changelog update
robert-zaremba Oct 19, 2020
3f139a1
fix import cycle in tests
robert-zaremba Oct 19, 2020
8734a4e
fix amino panic on TestValidatorMarshalUnmarshalJSON
robert-zaremba Oct 19, 2020
dfa92d6
fix TestValidatorMarshalUnmarshalJSON consensus_pubkey check
robert-zaremba Oct 19, 2020
32a2278
Add UnpackInterfaces to HistoricalInfo
robert-zaremba Oct 20, 2020
da990bf
fix TestHistoricalInfo
robert-zaremba Oct 20, 2020
003affd
update todos
robert-zaremba Oct 20, 2020
ff38afc
fix: Expecting ed25519.PubKey to implement proto.Message
robert-zaremba Oct 20, 2020
d50c77e
fix linter issues
robert-zaremba Oct 20, 2020
27ef9a7
Fix migrate test
amaury1093 Oct 20, 2020
4a95588
Update CHANGELOG.md
robert-zaremba Oct 20, 2020
98080ac
Merge pull request #7596 from cosmos/am-7477-migrate-staking
amaury1093 Oct 20, 2020
1dd1742
review comments
robert-zaremba Oct 20, 2020
515c072
cosmetic changes
robert-zaremba Oct 20, 2020
5cc8260
add UnpackInterfaces got GenesisRandomized test
robert-zaremba Oct 20, 2020
217bd2d
Validator.Equal reuses Validator.MinEqual
robert-zaremba Oct 20, 2020
605e33e
fix test
robert-zaremba Oct 20, 2020
d95c789
use Validator.Equal in tests
robert-zaremba Oct 20, 2020
5a07467
Fix staking simulation TestRandomizedGenState
blushi Oct 20, 2020
77f149f
Remove TODO
blushi Oct 20, 2020
1ac1245
use HistoricalInfo.Equal
robert-zaremba Oct 20, 2020
e6ac2ee
use proto.Equal
robert-zaremba Oct 20, 2020
da53a90
rename Validator.GetConsPubKey to TmConsPubKey
robert-zaremba Oct 20, 2020
978d9df
prefer require.Equal over reflect.DeepEqual
robert-zaremba Oct 20, 2020
653e4e4
SetHistoricalInfo using a pointer
robert-zaremba Oct 20, 2020
3da8daf
Fix TestQueryDelegation test
blushi Oct 21, 2020
34257ee
Fix TestQueryValidators test
blushi Oct 21, 2020
8905dfe
Fix TestSimulateMsgUnjail test
blushi Oct 21, 2020
fa73f01
experiement with LegacyAmino instances
robert-zaremba Oct 21, 2020
602928c
Register codecs in all simapp tests
robert-zaremba Oct 21, 2020
4774148
Fix cli_test compilation problems
robert-zaremba Oct 21, 2020
5350cc3
fix typo sdk -> std
robert-zaremba Oct 21, 2020
eddbe0c
fix typo
robert-zaremba Oct 21, 2020
62c1fc5
fix TestPlanStringer
robert-zaremba Oct 21, 2020
bfc93a3
Merge branch 'master' into robert/validator-pubkey
robert-zaremba Oct 21, 2020
a500f82
Rename to MakeEncodingConfig
amaury1093 Oct 22, 2020
6e33895
Remove RegisterCodecsTests
amaury1093 Oct 22, 2020
71e5331
Use gRPC in GetCmdQueryValidators
amaury1093 Oct 22, 2020
1cae118
Empty status
amaury1093 Oct 22, 2020
334253f
Merge pull request #7626 from cosmos/am-validator-pubkey
robert-zaremba Oct 22, 2020
54c85a5
fix info log check
robert-zaremba Oct 22, 2020
9d0ca25
linter fixes
robert-zaremba Oct 22, 2020
2598a7f
rename simapparams to simappparams
robert-zaremba Oct 23, 2020
4e21ba4
Update simapp/test_helpers.go
robert-zaremba Oct 23, 2020
a019c4d
comments updates
robert-zaremba Oct 23, 2020
1c8b045
use valAddr1 instead of sdk.ValAddress(pk1.Address().Bytes())
robert-zaremba Oct 23, 2020
1fa3829
Merge branch 'master' into robert/validator-pubkey
robert-zaremba Oct 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ Ref: https://keepachangelog.com/en/1.0.0/

* (kvstore) [\#7415](https://github.com/cosmos/cosmos-sdk/pull/7415) Allow new stores to be registered during on-chain upgrades.

## [v0.40.0-rc0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.40.0-rc0) - 2020-10-13
robert-zaremba marked this conversation as resolved.
Show resolved Hide resolved

### API Breaking Changes

* (x/staking/types) [\#7447](https://github.com/cosmos/cosmos-sdk/issues/7447) Remove bech32 PubKey support
* `ValidatorI` inteface update. `GetConsPubKey`, `GetConsAddr` methods return error
* `Validator` update. Methods changed in `ValidatorI` (as described above) and `ToTmValidator` return error.
* `Validator.ConsensusPubkey` type changed from `string` to `codectypes.Any`
* `MsgCreateValidator.Pubkey` type changed from `string` to `codectypes.Any`

## [v0.40.0-rc0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.40.0-rc0) - 2020-10-13

Expand Down
2 changes: 2 additions & 0 deletions codec/amino.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func (cdc *LegacyAmino) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr interfa
}
}

// MarshalJSON implements codec.Marshaler interface
func (cdc *LegacyAmino) MarshalJSON(o interface{}) ([]byte, error) {
err := cdc.jsonMarshalAnys(o)
if err != nil {
Expand All @@ -155,6 +156,7 @@ func (cdc *LegacyAmino) MustMarshalJSON(o interface{}) []byte {
return bz
}

// UnmarshalJSON implements codec.Marshaler interface
func (cdc *LegacyAmino) UnmarshalJSON(bz []byte, ptr interface{}) error {
err := cdc.Amino.UnmarshalJSON(bz, ptr)
if err != nil {
Expand Down
17 changes: 11 additions & 6 deletions proto/cosmos/staking/v1beta1/staking.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ syntax = "proto3";
package cosmos.staking.v1beta1;

import "gogoproto/gogo.proto";
import "tendermint/types/types.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";

import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "tendermint/types/types.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types";

Expand Down Expand Up @@ -73,10 +76,12 @@ message Validator {
option (gogoproto.goproto_getters) = false;

string operator_address = 1 [(gogoproto.moretags) = "yaml:\"operator_address\""];
string consensus_pubkey = 2 [(gogoproto.moretags) = "yaml:\"consensus_pubkey\""];
bool jailed = 3;
BondStatus status = 4;
string tokens = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
google.protobuf.Any consensus_pubkey = 2 [
(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey",
robert-zaremba marked this conversation as resolved.
Show resolved Hide resolved
(gogoproto.moretags) = "yaml:\"consensus_pubkey\""];
bool jailed = 3;
BondStatus status = 4;
string tokens = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
string delegator_shares = 6 [
(gogoproto.moretags) = "yaml:\"delegator_shares\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
Expand Down
12 changes: 7 additions & 5 deletions proto/cosmos/staking/v1beta1/tx.proto
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
syntax = "proto3";
package cosmos.staking.v1beta1;

import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
import "gogoproto/gogo.proto";

import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "google/protobuf/timestamp.proto";
import "cosmos/staking/v1beta1/staking.proto";
import "google/protobuf/any.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types";

Expand Down Expand Up @@ -44,7 +46,7 @@ message MsgCreateValidator {
];
string delegator_address = 4 [(gogoproto.moretags) = "yaml:\"delegator_address\""];
string validator_address = 5 [(gogoproto.moretags) = "yaml:\"validator_address\""];
google.protobuf.Any pubkey = 6;
google.protobuf.Any pubkey = 6 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"];
cosmos.base.v1beta1.Coin value = 7 [(gogoproto.nullable) = false];
}

Expand Down Expand Up @@ -104,7 +106,7 @@ message MsgBeginRedelegate {
}

// MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type.
message MsgBeginRedelegateResponse {
message MsgBeginRedelegateResponse {
google.protobuf.Timestamp completion_time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
}

Expand All @@ -120,6 +122,6 @@ message MsgUndelegate {
}

// MsgUndelegateResponse defines the Msg/Undelegate response type.
message MsgUndelegateResponse {
message MsgUndelegateResponse {
google.protobuf.Timestamp completion_time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
}
5 changes: 4 additions & 1 deletion simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

bam "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/simapp/helpers"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -92,9 +93,11 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs
bondAmt := sdk.NewInt(1000000)

for _, val := range valSet.Validators {
pkAny, err := codectypes.PackAny(val.PubKey)
require.NoError(t, err)
validator := stakingtypes.Validator{
OperatorAddress: sdk.ValAddress(val.Address).String(),
ConsensusPubkey: sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, val.PubKey),
ConsensusPubkey: pkAny,
Jailed: false,
Status: stakingtypes.Bonded,
Tokens: bondAmt,
Expand Down
10 changes: 6 additions & 4 deletions x/distribution/simulation/operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,15 @@ func (suite *SimTestSuite) getTestingValidator0(accounts []simtypes.Account) sta
}

func (suite *SimTestSuite) getTestingValidator(accounts []simtypes.Account, commission stakingtypes.Commission, n int) stakingtypes.Validator {
require := suite.Require()
account := accounts[n]
valPubKey := account.PubKey
valAddr := sdk.ValAddress(account.PubKey.Address().Bytes())
validator := stakingtypes.NewValidator(valAddr, valPubKey, stakingtypes.Description{})
validator, err := validator.SetInitialCommission(commission)
suite.Require().NoError(err)

validator, err := stakingtypes.NewValidator(valAddr, valPubKey, stakingtypes.
Description{})
require.NoError(err)
validator, err = validator.SetInitialCommission(commission)
require.NoError(err)
validator.DelegatorShares = sdk.NewDec(100)
validator.Tokens = sdk.NewInt(1000000)

Expand Down
4 changes: 2 additions & 2 deletions x/evidence/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions x/gov/keeper/common_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package keeper_test

import (
"testing"

"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
)

var (
TestProposal = types.NewTextProposal("Test", "description")
)

func createValidators(ctx sdk.Context, app *simapp.SimApp, powers []int64) ([]sdk.AccAddress, []sdk.ValAddress) {
func createValidators(t *testing.T, ctx sdk.Context, app *simapp.SimApp, powers []int64) ([]sdk.AccAddress, []sdk.ValAddress) {
addrs := simapp.AddTestAddrsIncremental(app, ctx, 5, sdk.NewInt(30000000))
valAddrs := simapp.ConvertAddrsToValAddrs(addrs)
pks := simapp.CreateTestPubKeys(5)
Expand All @@ -27,9 +30,12 @@ func createValidators(ctx sdk.Context, app *simapp.SimApp, powers []int64) ([]sd
app.GetSubspace(stakingtypes.ModuleName),
)

val1 := stakingtypes.NewValidator(valAddrs[0], pks[0], stakingtypes.Description{})
val2 := stakingtypes.NewValidator(valAddrs[1], pks[1], stakingtypes.Description{})
val3 := stakingtypes.NewValidator(valAddrs[2], pks[2], stakingtypes.Description{})
val1, err := stakingtypes.NewValidator(valAddrs[0], pks[0], stakingtypes.Description{})
require.NoError(t, err)
val2, err := stakingtypes.NewValidator(valAddrs[1], pks[1], stakingtypes.Description{})
require.NoError(t, err)
val3, err := stakingtypes.NewValidator(valAddrs[2], pks[2], stakingtypes.Description{})
require.NoError(t, err)

app.StakingKeeper.SetValidator(ctx, val1)
app.StakingKeeper.SetValidator(ctx, val2)
Expand Down
2 changes: 1 addition & 1 deletion x/gov/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposits() {
func (suite *KeeperTestSuite) TestGRPCQueryTally() {
app, ctx, queryClient := suite.app, suite.ctx, suite.queryClient

addrs, _ := createValidators(ctx, app, []int64{5, 5, 5})
addrs, _ := createValidators(suite.T(), ctx, app, []int64{5, 5, 5})

var (
req *types.QueryTallyResultRequest
Expand Down
36 changes: 19 additions & 17 deletions x/gov/keeper/tally_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestTallyNoOneVotes(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

createValidators(ctx, app, []int64{5, 5, 5})
createValidators(t, ctx, app, []int64{5, 5, 5})

tp := TestProposal
proposal, err := app.GovKeeper.SubmitProposal(ctx, tp)
Expand All @@ -39,7 +39,7 @@ func TestTallyNoQuorum(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

createValidators(ctx, app, []int64{2, 5, 0})
createValidators(t, ctx, app, []int64{2, 5, 0})

addrs := simapp.AddTestAddrsIncremental(app, ctx, 1, sdk.NewInt(10000000))

Expand All @@ -64,7 +64,7 @@ func TestTallyOnlyValidatorsAllYes(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

addrs, _ := createValidators(ctx, app, []int64{5, 5, 5})
addrs, _ := createValidators(t, ctx, app, []int64{5, 5, 5})
tp := TestProposal

proposal, err := app.GovKeeper.SubmitProposal(ctx, tp)
Expand All @@ -90,7 +90,7 @@ func TestTallyOnlyValidators51No(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

valAccAddrs, _ := createValidators(ctx, app, []int64{5, 6, 0})
valAccAddrs, _ := createValidators(t, ctx, app, []int64{5, 6, 0})

tp := TestProposal
proposal, err := app.GovKeeper.SubmitProposal(ctx, tp)
Expand All @@ -114,7 +114,7 @@ func TestTallyOnlyValidators51Yes(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

valAccAddrs, _ := createValidators(ctx, app, []int64{5, 6, 0})
valAccAddrs, _ := createValidators(t, ctx, app, []int64{5, 6, 0})

tp := TestProposal
proposal, err := app.GovKeeper.SubmitProposal(ctx, tp)
Expand All @@ -139,7 +139,7 @@ func TestTallyOnlyValidatorsVetoed(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

valAccAddrs, _ := createValidators(ctx, app, []int64{6, 6, 7})
valAccAddrs, _ := createValidators(t, ctx, app, []int64{6, 6, 7})

tp := TestProposal
proposal, err := app.GovKeeper.SubmitProposal(ctx, tp)
Expand All @@ -165,7 +165,7 @@ func TestTallyOnlyValidatorsAbstainPasses(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

valAccAddrs, _ := createValidators(ctx, app, []int64{6, 6, 7})
valAccAddrs, _ := createValidators(t, ctx, app, []int64{6, 6, 7})

tp := TestProposal
proposal, err := app.GovKeeper.SubmitProposal(ctx, tp)
Expand All @@ -191,7 +191,7 @@ func TestTallyOnlyValidatorsAbstainFails(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

valAccAddrs, _ := createValidators(ctx, app, []int64{6, 6, 7})
valAccAddrs, _ := createValidators(t, ctx, app, []int64{6, 6, 7})

tp := TestProposal
proposal, err := app.GovKeeper.SubmitProposal(ctx, tp)
Expand All @@ -217,7 +217,7 @@ func TestTallyOnlyValidatorsNonVoter(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

valAccAddrs, _ := createValidators(ctx, app, []int64{5, 6, 7})
valAccAddrs, _ := createValidators(t, ctx, app, []int64{5, 6, 7})
valAccAddr1, valAccAddr2 := valAccAddrs[0], valAccAddrs[1]

tp := TestProposal
Expand All @@ -243,7 +243,7 @@ func TestTallyDelgatorOverride(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

addrs, valAddrs := createValidators(ctx, app, []int64{5, 6, 7})
addrs, valAddrs := createValidators(t, ctx, app, []int64{5, 6, 7})

delTokens := sdk.TokensFromConsensusPower(30)
val1, found := app.StakingKeeper.GetValidator(ctx, valAddrs[0])
Expand Down Expand Up @@ -279,7 +279,7 @@ func TestTallyDelgatorInherit(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

addrs, vals := createValidators(ctx, app, []int64{5, 6, 7})
addrs, vals := createValidators(t, ctx, app, []int64{5, 6, 7})

delTokens := sdk.TokensFromConsensusPower(30)
val3, found := app.StakingKeeper.GetValidator(ctx, vals[2])
Expand Down Expand Up @@ -314,7 +314,7 @@ func TestTallyDelgatorMultipleOverride(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

addrs, vals := createValidators(ctx, app, []int64{5, 6, 7})
addrs, vals := createValidators(t, ctx, app, []int64{5, 6, 7})

delTokens := sdk.TokensFromConsensusPower(10)
val1, found := app.StakingKeeper.GetValidator(ctx, vals[0])
Expand Down Expand Up @@ -354,9 +354,9 @@ func TestTallyDelgatorMultipleInherit(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

createValidators(ctx, app, []int64{25, 6, 7})
createValidators(t, ctx, app, []int64{25, 6, 7})

addrs, vals := createValidators(ctx, app, []int64{5, 6, 7})
addrs, vals := createValidators(t, ctx, app, []int64{5, 6, 7})

delTokens := sdk.TokensFromConsensusPower(10)
val2, found := app.StakingKeeper.GetValidator(ctx, vals[1])
Expand Down Expand Up @@ -395,7 +395,7 @@ func TestTallyJailedValidator(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

addrs, valAddrs := createValidators(ctx, app, []int64{25, 6, 7})
addrs, valAddrs := createValidators(t, ctx, app, []int64{25, 6, 7})

delTokens := sdk.TokensFromConsensusPower(10)
val2, found := app.StakingKeeper.GetValidator(ctx, valAddrs[1])
Expand All @@ -410,7 +410,9 @@ func TestTallyJailedValidator(t *testing.T) {

_ = staking.EndBlocker(ctx, app.StakingKeeper)

app.StakingKeeper.Jail(ctx, sdk.ConsAddress(val2.GetConsPubKey().Address()))
consKey, err := val2.GetConsPubKey()
require.NoError(t, err)
app.StakingKeeper.Jail(ctx, sdk.ConsAddress(consKey.Address()))

tp := TestProposal
proposal, err := app.GovKeeper.SubmitProposal(ctx, tp)
Expand All @@ -436,7 +438,7 @@ func TestTallyValidatorMultipleDelegations(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

addrs, valAddrs := createValidators(ctx, app, []int64{10, 10, 10})
addrs, valAddrs := createValidators(t, ctx, app, []int64{10, 10, 10})

delTokens := sdk.TokensFromConsensusPower(10)
val2, found := app.StakingKeeper.GetValidator(ctx, valAddrs[1])
Expand Down
2 changes: 1 addition & 1 deletion x/gov/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion x/ibc/core/02-client/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ func (suite *KeeperTestSuite) SetupTest() {
privVal := ibctestingmock.NewPV()
pk, err := privVal.GetPubKey()
suite.Require().NoError(err)
val := stakingtypes.NewValidator(sdk.ValAddress(pk.Address()), pk, stakingtypes.Description{})
val, err := stakingtypes.NewValidator(sdk.ValAddress(pk.Address()), pk, stakingtypes.Description{})
suite.Require().NoError(err)

val.Status = stakingtypes.Bonded
val.Tokens = sdk.NewInt(rand.Int63())
validators = append(validators, val)
Expand Down
6 changes: 4 additions & 2 deletions x/slashing/keeper/unjail.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ func (k Keeper) Unjail(ctx sdk.Context, validatorAddr sdk.ValAddress) error {
return types.ErrValidatorNotJailed
}

consAddr := sdk.ConsAddress(validator.GetConsPubKey().Address())

consAddr, err := validator.GetConsAddr()
if err != nil {
return err
}
// If the validator has a ValidatorSigningInfo object that signals that the
// validator was bonded and so we must check that the validator is not tombstoned
// and can be unjailed at the current block.
Expand Down
Loading