Skip to content

Commit

Permalink
Merge pull request #108 from MrXJC/jiacheng/software-upgrade
Browse files Browse the repository at this point in the history
setup runMsgs callback function fo basecoin and basecoin1
  • Loading branch information
wukongcheng authored Aug 7, 2018
2 parents 2e40979 + c90cb97 commit 86ac510
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Gopkg.lock

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

1 change: 1 addition & 0 deletions examples/basecoin/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppO
app.SetInitChainer(app.initChainer)
app.SetBeginBlocker(app.BeginBlocker)
app.SetEndBlocker(app.EndBlocker)
app.SetRunMsg(app.runMsgs)
app.SetAnteHandler(auth.NewAnteHandler(app.accountMapper, app.feeCollectionKeeper))
app.MountStoresIAVL(app.keyMain, app.keyAccount, app.keyStake, app.keySlashing, app.keyGov, app.keyFeeCollection, app.keyUpgrade)

Expand Down
2 changes: 1 addition & 1 deletion examples/basecoin/app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var (
flagName = "name"
flagClientHome = "home-client"
flagOWK = "owk"
denom = "basecoin"
denom = "iris"

// bonded tokens given to genesis validators/accounts
freeFermionVal = int64(100)
Expand Down
1 change: 1 addition & 0 deletions examples/basecoin1/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppO
app.SetInitChainer(app.initChainer)
app.SetBeginBlocker(app.BeginBlocker)
app.SetEndBlocker(app.EndBlocker)
app.SetRunMsg(app.runMsgs)
app.SetAnteHandler(auth.NewAnteHandler(app.accountMapper, app.feeCollectionKeeper))
app.MountStoresIAVL(app.keyMain, app.keyAccount, app.keyIBC, app.keyStake, app.keySlashing, app.keyGov, app.keyFeeCollection, app.keyUpgrade)

Expand Down
2 changes: 1 addition & 1 deletion examples/basecoin1/app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var (
flagName = "name"
flagClientHome = "home-client"
flagOWK = "owk"
denom = "basecoin"
denom = "iris"

// bonded tokens given to genesis validators/accounts
freeFermionVal = int64(100)
Expand Down
6 changes: 4 additions & 2 deletions modules/gov/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ func (keeper Keeper) activateVotingPeriod(ctx sdk.Context, proposal Proposal) {

var (
defaultMinDeposit int64 = 10
defaultMaxDepositPeriod int64 = 10
defaultVotingPeriod int64 = 10
//defaultMaxDepositPeriod int64 = 10000
//defaultVotingPeriod int64 = 10000
defaultMaxDepositPeriod int64 = 2 // for test
defaultVotingPeriod int64 = 2 // for test
)

// Gets procedure from store. TODO: move to global param store and allow for updating of this
Expand Down
3 changes: 2 additions & 1 deletion modules/upgrade/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (
)

const (
defaultSwitchPeriod int64 = 57600 // 2 days
//defaultSwitchPeriod int64 = 57600 // 2 days
defaultSwitchPeriod int64 = 10 // for test
)

type Keeper struct {
Expand Down
6 changes: 2 additions & 4 deletions modules/upgrade/tally.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ func tally(ctx sdk.Context, k Keeper) (passes bool) {

totalVotingPower := sdk.ZeroRat()
switchVotingPower:= sdk.ZeroRat()

for _,validator :=range k.sk.GetAllValidators(ctx) {
totalVotingPower.Add(validator.GetPower())
totalVotingPower = totalVotingPower.Add(validator.GetPower())
if _,ok := k.GetSwitch(ctx,proposalID,validator.Owner);ok {
switchVotingPower.Add(validator.GetPower())
switchVotingPower = switchVotingPower.Add(validator.GetPower())
}
}

// If more than 95% of validator update , do switch
if switchVotingPower.Quo(totalVotingPower).GT(Threshold) {
return true
Expand Down

0 comments on commit 86ac510

Please sign in to comment.