Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Release0.5.0-rc1 : update software upgrade example #380

Merged
merged 2 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 14 additions & 13 deletions examples/irishub-bugfix-2/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ import (
"github.com/cosmos/cosmos-sdk/wire"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/irisnet/irishub/modules/gov"
"github.com/cosmos/cosmos-sdk/x/ibc"
"github.com/cosmos/cosmos-sdk/x/params"
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/stake"
ibcbugfix "github.com/irisnet/irishub/examples/irishub-bugfix-2/ibc"
"github.com/irisnet/irishub/modules/gov"
"github.com/irisnet/irishub/modules/upgrade"

"errors"
"fmt"
"github.com/cosmos/cosmos-sdk/server"
"github.com/irisnet/irishub/modules/gov/params"
"github.com/irisnet/irishub/modules/iparam"
"github.com/irisnet/irishub/modules/upgrade/params"
"github.com/spf13/viper"
bc "github.com/tendermint/tendermint/blockchain"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/node"
sm "github.com/tendermint/tendermint/state"
bc "github.com/tendermint/tendermint/blockchain"
"strings"
"github.com/irisnet/irishub/modules/iparam"
"github.com/irisnet/irishub/modules/gov/params"
"github.com/irisnet/irishub/modules/upgrade/params"
)

const (
Expand Down Expand Up @@ -160,15 +160,16 @@ func NewIrisApp(logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppOptio

upgrade.RegisterModuleList(app.Router())
iparam.SetParamReadWriter(app.paramsKeeper.Setter(),
&govparams.DepositProcedureParameter,
&govparams.VotingProcedureParameter,
&govparams.TallyingProcedureParameter,
&upgradeparams.CurrentUpgradeProposalIdParameter,
&upgradeparams.ProposalAcceptHeightParameter)
&govparams.DepositProcedureParameter,
&govparams.VotingProcedureParameter,
&govparams.TallyingProcedureParameter,
&upgradeparams.CurrentUpgradeProposalIdParameter,
&upgradeparams.ProposalAcceptHeightParameter,
&upgradeparams.SwitchPeriodParameter)

iparam.RegisterGovParamMapping(&govparams.DepositProcedureParameter,
&govparams.VotingProcedureParameter,
&govparams.TallyingProcedureParameter,)
&govparams.VotingProcedureParameter,
&govparams.TallyingProcedureParameter)

return app
}
Expand Down Expand Up @@ -265,7 +266,7 @@ func (app *IrisApp) initChainer(ctx sdk.Context, req abci.RequestInitChain) abci
// load the address to pubkey map
slashing.InitGenesis(ctx, app.slashingKeeper, genesisState.StakeData)

upgrade.InitGenesis(ctx, app.upgradeKeeper, app.Router())
upgrade.InitGenesis(ctx, app.upgradeKeeper, app.Router(), genesisState.UpgradeData)

return abci.ResponseInitChain{
Validators: validators,
Expand Down
14 changes: 10 additions & 4 deletions examples/irishub-bugfix-2/app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ import (
"github.com/cosmos/cosmos-sdk/wire"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/stake"
"github.com/irisnet/irishub/modules/gov"
"github.com/irisnet/irishub/modules/upgrade"
"github.com/irisnet/irishub/types"
"time"
)

// State to Unmarshal
type GenesisState struct {
Accounts []GenesisAccount `json:"accounts"`
StakeData stake.GenesisState `json:"stake"`
Accounts []GenesisAccount `json:"accounts"`
StakeData stake.GenesisState `json:"stake"`
GovData gov.GenesisState `json:"gov"`
UpgradeData upgrade.GenesisState `json:"upgrade"`
}

// GenesisAccount doesn't need pubkey or sequence
Expand Down Expand Up @@ -194,8 +198,10 @@ func IrisAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (genesisState

// create the final app state
genesisState = GenesisState{
Accounts: genaccs,
StakeData: stakeData,
Accounts: genaccs,
StakeData: stakeData,
GovData: gov.DefaultGenesisState(),
UpgradeData: upgrade.DefaultGenesisState(),
}
return
}
Expand Down
25 changes: 13 additions & 12 deletions examples/irishub1/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ import (
"github.com/cosmos/cosmos-sdk/wire"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/irisnet/irishub/modules/gov"
"github.com/cosmos/cosmos-sdk/x/ibc"
"github.com/cosmos/cosmos-sdk/x/params"
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/stake"
bam "github.com/irisnet/irishub/baseapp"
ibc1 "github.com/irisnet/irishub/examples/irishub1/ibc"
"github.com/irisnet/irishub/modules/gov"
"github.com/irisnet/irishub/modules/gov/params"
"github.com/irisnet/irishub/modules/iparam"
"github.com/irisnet/irishub/modules/upgrade"
"github.com/irisnet/irishub/modules/upgrade/params"
"github.com/spf13/viper"
abci "github.com/tendermint/tendermint/abci/types"
bc "github.com/tendermint/tendermint/blockchain"
Expand All @@ -31,9 +34,6 @@ import (
sm "github.com/tendermint/tendermint/state"
tmtypes "github.com/tendermint/tendermint/types"
"strings"
"github.com/irisnet/irishub/modules/iparam"
"github.com/irisnet/irishub/modules/gov/params"
"github.com/irisnet/irishub/modules/upgrade/params"
)

const (
Expand Down Expand Up @@ -157,15 +157,16 @@ func NewIrisApp(logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppOptio

upgrade.RegisterModuleList(app.Router())
iparam.SetParamReadWriter(app.paramsKeeper.Setter(),
&govparams.DepositProcedureParameter,
&govparams.VotingProcedureParameter,
&govparams.TallyingProcedureParameter,
&upgradeparams.CurrentUpgradeProposalIdParameter,
&upgradeparams.ProposalAcceptHeightParameter)
&govparams.DepositProcedureParameter,
&govparams.VotingProcedureParameter,
&govparams.TallyingProcedureParameter,
&upgradeparams.CurrentUpgradeProposalIdParameter,
&upgradeparams.ProposalAcceptHeightParameter,
&upgradeparams.SwitchPeriodParameter)

iparam.RegisterGovParamMapping(&govparams.DepositProcedureParameter,
&govparams.VotingProcedureParameter,
&govparams.TallyingProcedureParameter,)
&govparams.VotingProcedureParameter,
&govparams.TallyingProcedureParameter)

return app
}
Expand Down Expand Up @@ -263,7 +264,7 @@ func (app *IrisApp) initChainer(ctx sdk.Context, req abci.RequestInitChain) abci
// load the address to pubkey map
slashing.InitGenesis(ctx, app.slashingKeeper, genesisState.StakeData)

upgrade.InitGenesis(ctx, app.upgradeKeeper, app.Router())
upgrade.InitGenesis(ctx, app.upgradeKeeper, app.Router(), genesisState.UpgradeData)

return abci.ResponseInitChain{
Validators: validators,
Expand Down
14 changes: 10 additions & 4 deletions examples/irishub1/app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ import (
"github.com/cosmos/cosmos-sdk/wire"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/stake"
"github.com/irisnet/irishub/modules/gov"
"github.com/irisnet/irishub/modules/upgrade"
"github.com/irisnet/irishub/types"
"time"
)

// State to Unmarshal
type GenesisState struct {
Accounts []GenesisAccount `json:"accounts"`
StakeData stake.GenesisState `json:"stake"`
Accounts []GenesisAccount `json:"accounts"`
StakeData stake.GenesisState `json:"stake"`
GovData gov.GenesisState `json:"gov"`
UpgradeData upgrade.GenesisState `json:"upgrade"`
}

// GenesisAccount doesn't need pubkey or sequence
Expand Down Expand Up @@ -194,8 +198,10 @@ func IrisAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (genesisState

// create the final app state
genesisState = GenesisState{
Accounts: genaccs,
StakeData: stakeData,
Accounts: genaccs,
StakeData: stakeData,
GovData: gov.DefaultGenesisState(),
UpgradeData: upgrade.DefaultGenesisState(),
}
return
}
Expand Down