Change address from bytes to bech32 strings (#7242)

* init

* Fix bank proto messages

* missing conversions

* remove casttype for addresses

* Fix tests

* Fix consaddress

* more test fixes

* Fix tests

* fixed tests

* migrate missing proto declarations

* format

* Fix format

* Fix alignment

* Fix more tests

* Fix ibc merge issue

* Fix fmt

* Fix more tests

* Fix missing address declarations

* Fix staking tests

* Fix more tests

* Fix config

* fixed tests

* Fix more tests

* Update staking grpc tests

* Fix merge issue

* fixed failing tests in x/distr

* fixed sim tests

* fixed failing tests

* Fix bugs

* Add logs

* fixed slashing issue

* Fix staking grpc tests

* Fix all bank tests :)

* Fix tests in distribution

* Fix more tests in distr

* Fix slashing tests

* Fix statking tests

* Fix evidence tests

* Fix gov tests

* Fix bug in create vesting account

* Fix test

* remove fmt

* fixed gov tests

* fixed x/ibc tests

* fixed x/ibc-transfer tests

* fixed staking tests

* fixed staking tests

* fixed test

* fixed distribution issue

* fix pagination test

* fmt

* lint

* fix build

* fix format

* revert tally tests

* revert tally tests

* lint

* Fix sim test

* revert

* revert

* fixed tally issue

* fix tests

* revert

* fmt

* refactor

* remove `GetAddress()`

* remove fmt

* revert fmt.Striger usage

* Fix tests

* Fix rest test

* disable interfacer lint check

* make proto-format

* add nolint rule

* remove stray println

Co-authored-by: aleem1314 <aleem.md789@gmail.com>
Co-authored-by: atheesh <atheesh@vitwit.com>
This commit is contained in:
Anil Kumar Kammari
2020-09-25 10:25:37 +00:00
committed by GitHub
co-authored by aleem1314 atheesh
parent 91ca8ad3c1
commit d55c1a2665
247 changed files with 5815 additions and 7810 deletions
+3 -3
View File
@@ -48,11 +48,11 @@ func TestRandomizedGenState(t *testing.T) {
require.Len(t, stakingGenesis.Delegations, 3)
require.Len(t, stakingGenesis.Validators, 3)
// check Delegations
require.Equal(t, "cosmos1tnh2q55v8wyygtt9srz5safamzdengsnqeycj3", stakingGenesis.Delegations[0].DelegatorAddress.String())
require.Equal(t, "cosmosvaloper1tnh2q55v8wyygtt9srz5safamzdengsn9dsd7z", stakingGenesis.Delegations[0].ValidatorAddress.String())
require.Equal(t, "cosmos1tnh2q55v8wyygtt9srz5safamzdengsnqeycj3", stakingGenesis.Delegations[0].DelegatorAddress)
require.Equal(t, "cosmosvaloper1tnh2q55v8wyygtt9srz5safamzdengsn9dsd7z", stakingGenesis.Delegations[0].ValidatorAddress)
require.Equal(t, "1000.000000000000000000", stakingGenesis.Delegations[0].Shares.String())
// check validators
require.Equal(t, "cosmosvaloper1ghekyjucln7y67ntx7cf27m9dpuxxemnsvnaes", stakingGenesis.Validators[2].OperatorAddress.String())
require.Equal(t, "cosmosvaloper1ghekyjucln7y67ntx7cf27m9dpuxxemnsvnaes", stakingGenesis.Validators[2].GetOperator().String())
require.Equal(t, "cosmosvalconspub1zcjduepq280tm686ma80cva9z620dmknd9a858pd2zmq9ackfenfllecjxds0hg9n7", stakingGenesis.Validators[2].ConsensusPubkey)
require.Equal(t, false, stakingGenesis.Validators[2].Jailed)
require.Equal(t, "Unbonded", stakingGenesis.Validators[2].Status.String())
+1 -1
View File
@@ -331,7 +331,7 @@ func SimulateMsgUndelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper
}
valAddr := validator.GetOperator()
delegations := k.GetValidatorDelegations(ctx, validator.OperatorAddress)
delegations := k.GetValidatorDelegations(ctx, validator.GetOperator())
if delegations == nil {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgUndelegate, "keeper does have any delegation entries"), nil, nil
}
+22 -22
View File
@@ -86,8 +86,8 @@ func TestSimulateMsgCreateValidator(t *testing.T) {
require.Equal(t, "0.047464127245687382", msg.Commission.Rate.String())
require.Equal(t, types.TypeMsgCreateValidator, msg.Type())
require.Equal(t, "cosmosvalconspub1zcjduepq280tm686ma80cva9z620dmknd9a858pd2zmq9ackfenfllecjxds0hg9n7", msg.Pubkey)
require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.DelegatorAddress.String())
require.Equal(t, "cosmosvaloper1ghekyjucln7y67ntx7cf27m9dpuxxemnsvnaes", msg.ValidatorAddress.String())
require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.DelegatorAddress)
require.Equal(t, "cosmosvaloper1ghekyjucln7y67ntx7cf27m9dpuxxemnsvnaes", msg.ValidatorAddress)
require.Len(t, futureOperations, 0)
}
@@ -119,12 +119,12 @@ func TestSimulateMsgEditValidator(t *testing.T) {
require.True(t, operationMsg.OK)
require.Equal(t, "0.280623462081924936", msg.CommissionRate.String())
require.Equal(t, "jLxzIivHSl", msg.GetDescription().Moniker)
require.Equal(t, "rBqDOTtGTO", msg.GetDescription().Identity)
require.Equal(t, "BSpYuLyYgg", msg.GetDescription().Website)
require.Equal(t, "wNbeHVIkPZ", msg.GetDescription().SecurityContact)
require.Equal(t, "jLxzIivHSl", msg.Description.Moniker)
require.Equal(t, "rBqDOTtGTO", msg.Description.Identity)
require.Equal(t, "BSpYuLyYgg", msg.Description.Website)
require.Equal(t, "wNbeHVIkPZ", msg.Description.SecurityContact)
require.Equal(t, types.TypeMsgEditValidator, msg.Type())
require.Equal(t, "cosmosvaloper1tnh2q55v8wyygtt9srz5safamzdengsn9dsd7z", msg.ValidatorAddress.String())
require.Equal(t, "cosmosvaloper1tnh2q55v8wyygtt9srz5safamzdengsn9dsd7z", msg.ValidatorAddress)
require.Len(t, futureOperations, 0)
}
@@ -142,7 +142,7 @@ func TestSimulateMsgDelegate(t *testing.T) {
// setup accounts[0] as validator
validator0 := getTestingValidator0(t, app, ctx, accounts)
setupValidatorRewards(app, ctx, validator0.OperatorAddress)
setupValidatorRewards(app, ctx, validator0.GetOperator())
// begin a new block
app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}})
@@ -156,11 +156,11 @@ func TestSimulateMsgDelegate(t *testing.T) {
types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg)
require.True(t, operationMsg.OK)
require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.DelegatorAddress.String())
require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.DelegatorAddress)
require.Equal(t, "4896096", msg.Amount.Amount.String())
require.Equal(t, "stake", msg.Amount.Denom)
require.Equal(t, types.TypeMsgDelegate, msg.Type())
require.Equal(t, "cosmosvaloper1tnh2q55v8wyygtt9srz5safamzdengsn9dsd7z", msg.ValidatorAddress.String())
require.Equal(t, "cosmosvaloper1tnh2q55v8wyygtt9srz5safamzdengsn9dsd7z", msg.ValidatorAddress)
require.Len(t, futureOperations, 0)
}
@@ -183,11 +183,11 @@ func TestSimulateMsgUndelegate(t *testing.T) {
delTokens := sdk.TokensFromConsensusPower(2)
validator0, issuedShares := validator0.AddTokensFromDel(delTokens)
delegator := accounts[1]
delegation := types.NewDelegation(delegator.Address, validator0.OperatorAddress, issuedShares)
delegation := types.NewDelegation(delegator.Address, validator0.GetOperator(), issuedShares)
app.StakingKeeper.SetDelegation(ctx, delegation)
app.DistrKeeper.SetDelegatorStartingInfo(ctx, validator0.OperatorAddress, delegator.Address, distrtypes.NewDelegatorStartingInfo(2, sdk.OneDec(), 200))
app.DistrKeeper.SetDelegatorStartingInfo(ctx, validator0.GetOperator(), delegator.Address, distrtypes.NewDelegatorStartingInfo(2, sdk.OneDec(), 200))
setupValidatorRewards(app, ctx, validator0.OperatorAddress)
setupValidatorRewards(app, ctx, validator0.GetOperator())
// begin a new block
app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}})
@@ -201,11 +201,11 @@ func TestSimulateMsgUndelegate(t *testing.T) {
types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg)
require.True(t, operationMsg.OK)
require.Equal(t, "cosmos1p8wcgrjr4pjju90xg6u9cgq55dxwq8j7u4x9a0", msg.DelegatorAddress.String())
require.Equal(t, "cosmos1p8wcgrjr4pjju90xg6u9cgq55dxwq8j7u4x9a0", msg.DelegatorAddress)
require.Equal(t, "560969", msg.Amount.Amount.String())
require.Equal(t, "stake", msg.Amount.Denom)
require.Equal(t, types.TypeMsgUndelegate, msg.Type())
require.Equal(t, "cosmosvaloper1tnh2q55v8wyygtt9srz5safamzdengsn9dsd7z", msg.ValidatorAddress.String())
require.Equal(t, "cosmosvaloper1tnh2q55v8wyygtt9srz5safamzdengsn9dsd7z", msg.ValidatorAddress)
require.Len(t, futureOperations, 0)
}
@@ -231,12 +231,12 @@ func TestSimulateMsgBeginRedelegate(t *testing.T) {
// setup accounts[2] as delegator
delegator := accounts[2]
delegation := types.NewDelegation(delegator.Address, validator1.OperatorAddress, issuedShares)
delegation := types.NewDelegation(delegator.Address, validator1.GetOperator(), issuedShares)
app.StakingKeeper.SetDelegation(ctx, delegation)
app.DistrKeeper.SetDelegatorStartingInfo(ctx, validator1.OperatorAddress, delegator.Address, distrtypes.NewDelegatorStartingInfo(2, sdk.OneDec(), 200))
app.DistrKeeper.SetDelegatorStartingInfo(ctx, validator1.GetOperator(), delegator.Address, distrtypes.NewDelegatorStartingInfo(2, sdk.OneDec(), 200))
setupValidatorRewards(app, ctx, validator0.OperatorAddress)
setupValidatorRewards(app, ctx, validator1.OperatorAddress)
setupValidatorRewards(app, ctx, validator0.GetOperator())
setupValidatorRewards(app, ctx, validator1.GetOperator())
// begin a new block
app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}})
@@ -250,12 +250,12 @@ func TestSimulateMsgBeginRedelegate(t *testing.T) {
types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg)
require.True(t, operationMsg.OK)
require.Equal(t, "cosmos12gwd9jchc69wck8dhstxgwz3z8qs8yv67ps8mu", msg.DelegatorAddress.String())
require.Equal(t, "cosmos12gwd9jchc69wck8dhstxgwz3z8qs8yv67ps8mu", msg.DelegatorAddress)
require.Equal(t, "692322", msg.Amount.Amount.String())
require.Equal(t, "stake", msg.Amount.Denom)
require.Equal(t, types.TypeMsgBeginRedelegate, msg.Type())
require.Equal(t, "cosmosvaloper1h6a7shta7jyc72hyznkys683z98z36e0zdk8g9", msg.GetValidatorDstAddress().String())
require.Equal(t, "cosmosvaloper17s94pzwhsn4ah25tec27w70n65h5t2scgxzkv2", msg.GetValidatorSrcAddress().String())
require.Equal(t, "cosmosvaloper1h6a7shta7jyc72hyznkys683z98z36e0zdk8g9", msg.ValidatorDstAddress)
require.Equal(t, "cosmosvaloper17s94pzwhsn4ah25tec27w70n65h5t2scgxzkv2", msg.ValidatorSrcAddress)
require.Len(t, futureOperations, 0)
}