Skip to content

Commit

Permalink
Merge pull request #109 from wukongcheng/silei/software-upgrade
Browse files Browse the repository at this point in the history
Silei/software upgrade:  fix bug that each node has different appHash
  • Loading branch information
wukongcheng authored Aug 7, 2018
2 parents 86ac510 + 0f5918d commit 10584a2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ build_cur:
build_example:
go build -o build/basecoind ./examples/basecoin/cmd/basecoind
go build -o build/basecli ./examples/basecoin/cmd/basecli
go build -o build/basecoind1 ./examples/basecoin1/cmd/basecoind1
go build -o build/basecli1 ./examples/basecoin1/cmd/basecli1

install_examples:
go install ./examples/basecoin/cmd/basecoind
Expand Down
14 changes: 14 additions & 0 deletions modules/upgrade/keep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@ func TestSwitchKeeper(t *testing.T) {
require.Equal(t, len(ModuleListBucket[3]), 2)
}

func TestSetKVStoreKeylist(t *testing.T) {
ctx, keeper := createTestInput(t)

router := baseapp.NewRouter()
router.AddRoute("main-0", []*sdk.KVStoreKey{sdk.NewKVStoreKey("main")}, nil)
router.AddRoute("acc-0", []*sdk.KVStoreKey{sdk.NewKVStoreKey("acc")}, nil)
router.AddRoute("gov-0", []*sdk.KVStoreKey{sdk.NewKVStoreKey("gov")}, nil)
router.AddRoute("stake-0", []*sdk.KVStoreKey{sdk.NewKVStoreKey("stake")}, nil)
router.AddRoute("upgrade-0", []*sdk.KVStoreKey{sdk.NewKVStoreKey("upgrade")}, nil)

InitGenesis(ctx, keeper, router)
keeper.SetKVStoreKeylist(ctx)
}

func getModuleList(router baseapp.Router) ModuleLifeTimeList {

modulelist := NewModuleLifeTimeList()
Expand Down
10 changes: 9 additions & 1 deletion modules/upgrade/keeper_commitID.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package upgrade
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"sort"
)

var (
Expand Down Expand Up @@ -35,8 +36,15 @@ func (keeper Keeper) SetKVStoreKeylist(ctx sdk.Context) {
}
}

var KVStoreKeyList string
var list []string
for key, _ := range storeSet {
list = append(list, key)
}

sort.Sort(sort.StringSlice(list))

var KVStoreKeyList string
for _, key := range list {
if KVStoreKeyList == "" {
KVStoreKeyList += key
} else {
Expand Down

0 comments on commit 10584a2

Please sign in to comment.