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 enum instead of int32 for BondStatus #7499

Merged
merged 34 commits into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
267ef39
Migrate staking module
amaury1093 Oct 6, 2020
0d50d31
Merge branch 'master' into am-migrate-followup
amaury1093 Oct 6, 2020
586ea7a
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-m…
amaury1093 Oct 7, 2020
075a4ef
Add gov legacy
amaury1093 Oct 7, 2020
e1521d5
Add comments
amaury1093 Oct 7, 2020
ef05dde
Add x/distrib
amaury1093 Oct 7, 2020
e8488ae
x/crisis
amaury1093 Oct 7, 2020
ab59c83
x/mint
amaury1093 Oct 7, 2020
a735812
Merge branch 'master' into am-migrate-followup
amaury1093 Oct 7, 2020
7770196
Fix test
amaury1093 Oct 7, 2020
0f8cf26
Merge branch 'master' into am-migrate-followup
amaury1093 Oct 8, 2020
f084fe1
migrate x/genutil
amaury1093 Oct 9, 2020
a97ca37
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-m…
amaury1093 Oct 9, 2020
846f63d
Merge branch 'am-migrate-followup' of ssh://github.com/cosmos/cosmos-…
amaury1093 Oct 9, 2020
eb0a7ab
Fix lint
amaury1093 Oct 9, 2020
5d608ac
Fix staking constants
amaury1093 Oct 9, 2020
06cb049
Fix test
amaury1093 Oct 9, 2020
b4d4289
Update x/genutil/legacy/v040/migrate.go
amaury1093 Oct 9, 2020
b63535d
Add migrate script instead of change BondStatus constants
amaury1093 Oct 9, 2020
049ca8d
Change staking bondStatus to enum
amaury1093 Oct 9, 2020
9ca4e39
Merge branch 'am-migrate-followup' of ssh://github.com/cosmos/cosmos-…
amaury1093 Oct 9, 2020
6fcc163
Fix test
amaury1093 Oct 9, 2020
2bc7a87
Fix another test
amaury1093 Oct 9, 2020
f0cd710
Remove staking exported
amaury1093 Oct 9, 2020
bcc9db2
Merge branch 'am-migrate-followup' into am-migrate-followup-staking
amaury1093 Oct 9, 2020
2379a24
fix references
amaury1093 Oct 9, 2020
7c276aa
Better constants
amaury1093 Oct 9, 2020
6d0560b
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-m…
amaury1093 Oct 12, 2020
7c4329a
Fix build
amaury1093 Oct 12, 2020
510c3b6
Fix lint
amaury1093 Oct 12, 2020
bd03ff3
Remove buf version
amaury1093 Oct 12, 2020
8ed1fdc
Fix tests
amaury1093 Oct 12, 2020
8fa8bf0
Fix test
amaury1093 Oct 12, 2020
fe7e6ad
Merge branch 'master' into am-migrate-followup-staking
alexanderbez Oct 12, 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
2 changes: 1 addition & 1 deletion types/staking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (s *stakingTestSuite) TestBondStatus() {
s.Require().False(sdk.Unbonded.Equal(sdk.Bonded))
s.Require().False(sdk.Unbonded.Equal(sdk.Unbonding))
s.Require().False(sdk.Bonded.Equal(sdk.Unbonding))
s.Require().Panicsf(func() { sdk.BondStatus(3).String() }, "invalid bond status") // nolint:govet
s.Require().Panicsf(func() { sdk.BondStatus(0).String() }, "invalid bond status") // nolint:govet
s.Require().Equal(sdk.BondStatusUnbonded, sdk.Unbonded.String())
s.Require().Equal(sdk.BondStatusBonded, sdk.Bonded.String())
s.Require().Equal(sdk.BondStatusUnbonding, sdk.Unbonding.String())
Expand Down
2 changes: 1 addition & 1 deletion x/genutil/legacy/v040/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func Migrate(appState types.AppMap, clientCtx client.Context) types.AppMap {
appState[v040staking.ModuleName] = v040Codec.MustMarshalJSON(v040staking.Migrate(stakingGenState))
}

// Remove x/genutil
// Migrate x/genutil
if appState[v039genutil.ModuleName] != nil {
// unmarshal relative source genesis application state
var genutilGenState v039genutil.GenesisState
Expand Down
7 changes: 3 additions & 4 deletions x/staking/legacy/v040/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package v040_test

import (
"encoding/json"
"fmt"
"testing"

"github.com/stretchr/testify/require"
Expand All @@ -23,12 +22,12 @@ func TestMigrate(t *testing.T) {
WithLegacyAmino(encodingConfig.Amino).
WithJSONMarshaler(encodingConfig.Marshaler)

consPubKey := ed25519.GenPrivKey().PubKey()
consPubKey := ed25519.GenPrivKeyFromSecret([]byte("val0")).PubKey()
stakingGenState := v038staking.GenesisState{
Validators: v038staking.Validators{v038staking.Validator{
ConsPubKey: consPubKey,
Status: v034staking.Unbonded,
}},x
}},
}

migrated := v040staking.Migrate(stakingGenState)
Expand Down Expand Up @@ -70,7 +69,7 @@ func TestMigrate(t *testing.T) {
},
"update_time": "0001-01-01T00:00:00Z"
},
"consensus_pubkey": "cosmosvalconspub1zcjduepqtrz32re64nu80d3lagdry56ywym6yjrayrv2ycrvvm07f9tkve8s397nyf",
"consensus_pubkey": "cosmosvalconspub1zcjduepq9ymett3nlv6fytn7lqxzd3q3ckvd79eqlcf3wkhgamcl4rzghesq83ecpx",
"delegator_shares": "0",
"description": {
"details": "",
Expand Down