mirror of
				https://github.com/0glabs/0g-chain.git
				synced 2025-11-04 14:37:27 +00:00 
			
		
		
		
	app: upgrade module
This commit is contained in:
		
							parent
							
								
									8ef03e4181
								
							
						
					
					
						commit
						769f3271f9
					
				
							
								
								
									
										30
									
								
								app/app.go
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								app/app.go
									
									
									
									
									
								
							@ -30,6 +30,8 @@ import (
 | 
				
			|||||||
	"github.com/cosmos/cosmos-sdk/x/slashing"
 | 
						"github.com/cosmos/cosmos-sdk/x/slashing"
 | 
				
			||||||
	"github.com/cosmos/cosmos-sdk/x/staking"
 | 
						"github.com/cosmos/cosmos-sdk/x/staking"
 | 
				
			||||||
	"github.com/cosmos/cosmos-sdk/x/supply"
 | 
						"github.com/cosmos/cosmos-sdk/x/supply"
 | 
				
			||||||
 | 
						"github.com/cosmos/cosmos-sdk/x/upgrade"
 | 
				
			||||||
 | 
						upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/kava-labs/kava/x/auction"
 | 
						"github.com/kava-labs/kava/x/auction"
 | 
				
			||||||
	"github.com/kava-labs/kava/x/bep3"
 | 
						"github.com/kava-labs/kava/x/bep3"
 | 
				
			||||||
@ -61,10 +63,14 @@ var (
 | 
				
			|||||||
		staking.AppModuleBasic{},
 | 
							staking.AppModuleBasic{},
 | 
				
			||||||
		mint.AppModuleBasic{},
 | 
							mint.AppModuleBasic{},
 | 
				
			||||||
		distr.AppModuleBasic{},
 | 
							distr.AppModuleBasic{},
 | 
				
			||||||
		gov.NewAppModuleBasic(paramsclient.ProposalHandler, distr.ProposalHandler, committee.ProposalHandler),
 | 
							gov.NewAppModuleBasic(
 | 
				
			||||||
 | 
								paramsclient.ProposalHandler, distr.ProposalHandler, committee.ProposalHandler,
 | 
				
			||||||
 | 
								upgradeclient.ProposalHandler,
 | 
				
			||||||
 | 
							),
 | 
				
			||||||
		params.AppModuleBasic{},
 | 
							params.AppModuleBasic{},
 | 
				
			||||||
		crisis.AppModuleBasic{},
 | 
							crisis.AppModuleBasic{},
 | 
				
			||||||
		slashing.AppModuleBasic{},
 | 
							slashing.AppModuleBasic{},
 | 
				
			||||||
 | 
							upgrade.AppModuleBasic{},
 | 
				
			||||||
		supply.AppModuleBasic{},
 | 
							supply.AppModuleBasic{},
 | 
				
			||||||
		evidence.AppModuleBasic{},
 | 
							evidence.AppModuleBasic{},
 | 
				
			||||||
		auction.AppModuleBasic{},
 | 
							auction.AppModuleBasic{},
 | 
				
			||||||
@ -118,6 +124,7 @@ type App struct {
 | 
				
			|||||||
	distrKeeper     distr.Keeper
 | 
						distrKeeper     distr.Keeper
 | 
				
			||||||
	govKeeper       gov.Keeper
 | 
						govKeeper       gov.Keeper
 | 
				
			||||||
	crisisKeeper    crisis.Keeper
 | 
						crisisKeeper    crisis.Keeper
 | 
				
			||||||
 | 
						upgradeKeeper   upgrade.Keeper
 | 
				
			||||||
	paramsKeeper    params.Keeper
 | 
						paramsKeeper    params.Keeper
 | 
				
			||||||
	evidenceKeeper  evidence.Keeper
 | 
						evidenceKeeper  evidence.Keeper
 | 
				
			||||||
	vvKeeper        validatorvesting.Keeper
 | 
						vvKeeper        validatorvesting.Keeper
 | 
				
			||||||
@ -138,7 +145,7 @@ type App struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// NewApp returns a reference to an initialized App.
 | 
					// NewApp returns a reference to an initialized App.
 | 
				
			||||||
func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
 | 
					func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
 | 
				
			||||||
	invCheckPeriod uint,
 | 
						skipUpgradeHeights map[int64]bool, invCheckPeriod uint,
 | 
				
			||||||
	baseAppOptions ...func(*bam.BaseApp)) *App {
 | 
						baseAppOptions ...func(*bam.BaseApp)) *App {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cdc := MakeCodec()
 | 
						cdc := MakeCodec()
 | 
				
			||||||
@ -150,9 +157,9 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
 | 
				
			|||||||
	keys := sdk.NewKVStoreKeys(
 | 
						keys := sdk.NewKVStoreKeys(
 | 
				
			||||||
		bam.MainStoreKey, auth.StoreKey, staking.StoreKey,
 | 
							bam.MainStoreKey, auth.StoreKey, staking.StoreKey,
 | 
				
			||||||
		supply.StoreKey, mint.StoreKey, distr.StoreKey, slashing.StoreKey,
 | 
							supply.StoreKey, mint.StoreKey, distr.StoreKey, slashing.StoreKey,
 | 
				
			||||||
		gov.StoreKey, params.StoreKey, evidence.StoreKey, validatorvesting.StoreKey,
 | 
							gov.StoreKey, params.StoreKey, upgrade.StoreKey, evidence.StoreKey,
 | 
				
			||||||
		auction.StoreKey, cdp.StoreKey, pricefeed.StoreKey, bep3.StoreKey,
 | 
							validatorvesting.StoreKey, auction.StoreKey, cdp.StoreKey, pricefeed.StoreKey,
 | 
				
			||||||
		kavadist.StoreKey, incentive.StoreKey, committee.StoreKey,
 | 
							bep3.StoreKey, kavadist.StoreKey, incentive.StoreKey, committee.StoreKey,
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
	tkeys := sdk.NewTransientStoreKeys(params.TStoreKey)
 | 
						tkeys := sdk.NewTransientStoreKeys(params.TStoreKey)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -236,6 +243,11 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
 | 
				
			|||||||
		app.supplyKeeper,
 | 
							app.supplyKeeper,
 | 
				
			||||||
		auth.FeeCollectorName,
 | 
							auth.FeeCollectorName,
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
 | 
						app.upgradeKeeper = upgrade.NewKeeper(
 | 
				
			||||||
 | 
							skipUpgradeHeights,
 | 
				
			||||||
 | 
							keys[upgrade.StoreKey],
 | 
				
			||||||
 | 
							app.cdc,
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// create evidence keeper with router
 | 
						// create evidence keeper with router
 | 
				
			||||||
	evidenceKeeper := evidence.NewKeeper(
 | 
						evidenceKeeper := evidence.NewKeeper(
 | 
				
			||||||
@ -269,6 +281,7 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
 | 
				
			|||||||
		AddRoute(gov.RouterKey, gov.ProposalHandler).
 | 
							AddRoute(gov.RouterKey, gov.ProposalHandler).
 | 
				
			||||||
		AddRoute(params.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
 | 
							AddRoute(params.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
 | 
				
			||||||
		AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)).
 | 
							AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)).
 | 
				
			||||||
 | 
							AddRoute(upgrade.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper)).
 | 
				
			||||||
		AddRoute(committee.RouterKey, committee.NewProposalHandler(app.committeeKeeper))
 | 
							AddRoute(committee.RouterKey, committee.NewProposalHandler(app.committeeKeeper))
 | 
				
			||||||
	app.govKeeper = gov.NewKeeper(
 | 
						app.govKeeper = gov.NewKeeper(
 | 
				
			||||||
		app.cdc,
 | 
							app.cdc,
 | 
				
			||||||
@ -347,6 +360,7 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
 | 
				
			|||||||
		slashing.NewAppModule(app.slashingKeeper, app.accountKeeper, app.stakingKeeper),
 | 
							slashing.NewAppModule(app.slashingKeeper, app.accountKeeper, app.stakingKeeper),
 | 
				
			||||||
		distr.NewAppModule(app.distrKeeper, app.accountKeeper, app.supplyKeeper, app.stakingKeeper),
 | 
							distr.NewAppModule(app.distrKeeper, app.accountKeeper, app.supplyKeeper, app.stakingKeeper),
 | 
				
			||||||
		staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper),
 | 
							staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper),
 | 
				
			||||||
 | 
							upgrade.NewAppModule(app.upgradeKeeper),
 | 
				
			||||||
		evidence.NewAppModule(app.evidenceKeeper),
 | 
							evidence.NewAppModule(app.evidenceKeeper),
 | 
				
			||||||
		validatorvesting.NewAppModule(app.vvKeeper, app.accountKeeper),
 | 
							validatorvesting.NewAppModule(app.vvKeeper, app.accountKeeper),
 | 
				
			||||||
		auction.NewAppModule(app.auctionKeeper, app.accountKeeper, app.supplyKeeper),
 | 
							auction.NewAppModule(app.auctionKeeper, app.accountKeeper, app.supplyKeeper),
 | 
				
			||||||
@ -363,7 +377,11 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
 | 
				
			|||||||
	// CanWithdrawInvariant invariant.
 | 
						// CanWithdrawInvariant invariant.
 | 
				
			||||||
	// Auction.BeginBlocker will close out expired auctions and pay debt back to cdp.
 | 
						// Auction.BeginBlocker will close out expired auctions and pay debt back to cdp.
 | 
				
			||||||
	// So it should be run before cdp.BeginBlocker which cancels out debt with stable and starts more auctions.
 | 
						// So it should be run before cdp.BeginBlocker which cancels out debt with stable and starts more auctions.
 | 
				
			||||||
	app.mm.SetOrderBeginBlockers(mint.ModuleName, distr.ModuleName, slashing.ModuleName, validatorvesting.ModuleName, kavadist.ModuleName, auction.ModuleName, cdp.ModuleName, bep3.ModuleName, incentive.ModuleName, committee.ModuleName)
 | 
						app.mm.SetOrderBeginBlockers(
 | 
				
			||||||
 | 
							upgrade.ModuleName, mint.ModuleName, distr.ModuleName, slashing.ModuleName,
 | 
				
			||||||
 | 
							validatorvesting.ModuleName, kavadist.ModuleName, auction.ModuleName, cdp.ModuleName,
 | 
				
			||||||
 | 
							bep3.ModuleName, incentive.ModuleName, committee.ModuleName,
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	app.mm.SetOrderEndBlockers(crisis.ModuleName, gov.ModuleName, staking.ModuleName, pricefeed.ModuleName)
 | 
						app.mm.SetOrderEndBlockers(crisis.ModuleName, gov.ModuleName, staking.ModuleName, pricefeed.ModuleName)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -16,11 +16,11 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func TestExport(t *testing.T) {
 | 
					func TestExport(t *testing.T) {
 | 
				
			||||||
	db := db.NewMemDB()
 | 
						db := db.NewMemDB()
 | 
				
			||||||
	app := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0)
 | 
						app := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, 0)
 | 
				
			||||||
	setGenesis(app)
 | 
						setGenesis(app)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Making a new app object with the db, so that initchain hasn't been called
 | 
						// Making a new app object with the db, so that initchain hasn't been called
 | 
				
			||||||
	newApp := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0)
 | 
						newApp := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, 0)
 | 
				
			||||||
	_, _, err := newApp.ExportAppStateAndValidators(false, []string{})
 | 
						_, _, err := newApp.ExportAppStateAndValidators(false, []string{})
 | 
				
			||||||
	require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
 | 
						require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -28,7 +28,7 @@ func TestExport(t *testing.T) {
 | 
				
			|||||||
// ensure that black listed addresses are properly set in bank keeper
 | 
					// ensure that black listed addresses are properly set in bank keeper
 | 
				
			||||||
func TestBlackListedAddrs(t *testing.T) {
 | 
					func TestBlackListedAddrs(t *testing.T) {
 | 
				
			||||||
	db := db.NewMemDB()
 | 
						db := db.NewMemDB()
 | 
				
			||||||
	app := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0)
 | 
						app := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for acc := range mAccPerms {
 | 
						for acc := range mAccPerms {
 | 
				
			||||||
		require.True(t, app.bankKeeper.BlacklistedAddr(app.supplyKeeper.GetModuleAddress(acc)))
 | 
							require.True(t, app.bankKeeper.BlacklistedAddr(app.supplyKeeper.GetModuleAddress(acc)))
 | 
				
			||||||
 | 
				
			|||||||
@ -80,7 +80,7 @@ func TestFullAppSimulation(t *testing.T) {
 | 
				
			|||||||
		require.NoError(t, os.RemoveAll(dir))
 | 
							require.NoError(t, os.RemoveAll(dir))
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt)
 | 
						app := NewApp(logger, db, nil, true, map[int64]bool{}, simapp.FlagPeriodValue, fauxMerkleModeOpt)
 | 
				
			||||||
	require.Equal(t, appName, app.Name())
 | 
						require.Equal(t, appName, app.Name())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// run randomized simulation
 | 
						// run randomized simulation
 | 
				
			||||||
@ -112,7 +112,7 @@ func TestAppImportExport(t *testing.T) {
 | 
				
			|||||||
		require.NoError(t, os.RemoveAll(dir))
 | 
							require.NoError(t, os.RemoveAll(dir))
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt)
 | 
						app := NewApp(logger, db, nil, true, map[int64]bool{}, simapp.FlagPeriodValue, fauxMerkleModeOpt)
 | 
				
			||||||
	require.Equal(t, appName, app.Name())
 | 
						require.Equal(t, appName, app.Name())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Run randomized simulation
 | 
						// Run randomized simulation
 | 
				
			||||||
@ -146,7 +146,7 @@ func TestAppImportExport(t *testing.T) {
 | 
				
			|||||||
		require.NoError(t, os.RemoveAll(newDir))
 | 
							require.NoError(t, os.RemoveAll(newDir))
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	newApp := NewApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt)
 | 
						newApp := NewApp(log.NewNopLogger(), newDB, nil, true, map[int64]bool{}, simapp.FlagPeriodValue, fauxMerkleModeOpt)
 | 
				
			||||||
	require.Equal(t, appName, newApp.Name())
 | 
						require.Equal(t, appName, newApp.Name())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var genesisState GenesisState
 | 
						var genesisState GenesisState
 | 
				
			||||||
@ -207,7 +207,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
 | 
				
			|||||||
		require.NoError(t, os.RemoveAll(dir))
 | 
							require.NoError(t, os.RemoveAll(dir))
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt)
 | 
						app := NewApp(logger, db, nil, true, map[int64]bool{}, simapp.FlagPeriodValue, fauxMerkleModeOpt)
 | 
				
			||||||
	require.Equal(t, appName, app.Name())
 | 
						require.Equal(t, appName, app.Name())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Run randomized simulation
 | 
						// Run randomized simulation
 | 
				
			||||||
@ -246,7 +246,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
 | 
				
			|||||||
		require.NoError(t, os.RemoveAll(newDir))
 | 
							require.NoError(t, os.RemoveAll(newDir))
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	newApp := NewApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt)
 | 
						newApp := NewApp(log.NewNopLogger(), newDB, nil, true, map[int64]bool{}, simapp.FlagPeriodValue, fauxMerkleModeOpt)
 | 
				
			||||||
	require.Equal(t, appName, newApp.Name())
 | 
						require.Equal(t, appName, newApp.Name())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	newApp.InitChain(abci.RequestInitChain{
 | 
						newApp.InitChain(abci.RequestInitChain{
 | 
				
			||||||
@ -279,7 +279,7 @@ func TestAppStateDeterminism(t *testing.T) {
 | 
				
			|||||||
	for j := 0; j < numTimesToRunPerSeed; j++ {
 | 
						for j := 0; j < numTimesToRunPerSeed; j++ {
 | 
				
			||||||
		logger := log.NewNopLogger()
 | 
							logger := log.NewNopLogger()
 | 
				
			||||||
		db := dbm.NewMemDB()
 | 
							db := dbm.NewMemDB()
 | 
				
			||||||
		app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt())
 | 
							app := NewApp(logger, db, nil, true, map[int64]bool{}, simapp.FlagPeriodValue, interBlockCacheOpt())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		fmt.Printf(
 | 
							fmt.Printf(
 | 
				
			||||||
			"running non-determinism simulation; seed %d: attempt: %d/%d\n",
 | 
								"running non-determinism simulation; seed %d: attempt: %d/%d\n",
 | 
				
			||||||
 | 
				
			|||||||
@ -27,6 +27,7 @@ import (
 | 
				
			|||||||
	"github.com/cosmos/cosmos-sdk/x/slashing"
 | 
						"github.com/cosmos/cosmos-sdk/x/slashing"
 | 
				
			||||||
	"github.com/cosmos/cosmos-sdk/x/staking"
 | 
						"github.com/cosmos/cosmos-sdk/x/staking"
 | 
				
			||||||
	"github.com/cosmos/cosmos-sdk/x/supply"
 | 
						"github.com/cosmos/cosmos-sdk/x/supply"
 | 
				
			||||||
 | 
						"github.com/cosmos/cosmos-sdk/x/upgrade"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/kava-labs/kava/x/auction"
 | 
						"github.com/kava-labs/kava/x/auction"
 | 
				
			||||||
	"github.com/kava-labs/kava/x/bep3"
 | 
						"github.com/kava-labs/kava/x/bep3"
 | 
				
			||||||
@ -58,10 +59,11 @@ func NewTestApp() TestApp {
 | 
				
			|||||||
	SetBip44CoinType(config)
 | 
						SetBip44CoinType(config)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	db := tmdb.NewMemDB()
 | 
						db := tmdb.NewMemDB()
 | 
				
			||||||
	app := NewApp(log.NewNopLogger(), db, nil, true, 0)
 | 
						app := NewApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, 0)
 | 
				
			||||||
	return TestApp{App: *app}
 | 
						return TestApp{App: *app}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// nolint
 | 
				
			||||||
func (tApp TestApp) GetAccountKeeper() auth.AccountKeeper { return tApp.accountKeeper }
 | 
					func (tApp TestApp) GetAccountKeeper() auth.AccountKeeper { return tApp.accountKeeper }
 | 
				
			||||||
func (tApp TestApp) GetBankKeeper() bank.Keeper           { return tApp.bankKeeper }
 | 
					func (tApp TestApp) GetBankKeeper() bank.Keeper           { return tApp.bankKeeper }
 | 
				
			||||||
func (tApp TestApp) GetSupplyKeeper() supply.Keeper       { return tApp.supplyKeeper }
 | 
					func (tApp TestApp) GetSupplyKeeper() supply.Keeper       { return tApp.supplyKeeper }
 | 
				
			||||||
@ -71,6 +73,7 @@ func (tApp TestApp) GetMintKeeper() mint.Keeper           { return tApp.mintKeep
 | 
				
			|||||||
func (tApp TestApp) GetDistrKeeper() distribution.Keeper  { return tApp.distrKeeper }
 | 
					func (tApp TestApp) GetDistrKeeper() distribution.Keeper  { return tApp.distrKeeper }
 | 
				
			||||||
func (tApp TestApp) GetGovKeeper() gov.Keeper             { return tApp.govKeeper }
 | 
					func (tApp TestApp) GetGovKeeper() gov.Keeper             { return tApp.govKeeper }
 | 
				
			||||||
func (tApp TestApp) GetCrisisKeeper() crisis.Keeper       { return tApp.crisisKeeper }
 | 
					func (tApp TestApp) GetCrisisKeeper() crisis.Keeper       { return tApp.crisisKeeper }
 | 
				
			||||||
 | 
					func (tApp TestApp) GetUpgradeKeeper() upgrade.Keeper     { return tApp.upgradeKeeper }
 | 
				
			||||||
func (tApp TestApp) GetParamsKeeper() params.Keeper       { return tApp.paramsKeeper }
 | 
					func (tApp TestApp) GetParamsKeeper() params.Keeper       { return tApp.paramsKeeper }
 | 
				
			||||||
func (tApp TestApp) GetVVKeeper() validatorvesting.Keeper { return tApp.vvKeeper }
 | 
					func (tApp TestApp) GetVVKeeper() validatorvesting.Keeper { return tApp.vvKeeper }
 | 
				
			||||||
func (tApp TestApp) GetAuctionKeeper() auction.Keeper     { return tApp.auctionKeeper }
 | 
					func (tApp TestApp) GetAuctionKeeper() auction.Keeper     { return tApp.auctionKeeper }
 | 
				
			||||||
 | 
				
			|||||||
@ -47,20 +47,22 @@ func main() {
 | 
				
			|||||||
		PersistentPreRunE: server.PersistentPreRunEFn(ctx),
 | 
							PersistentPreRunE: server.PersistentPreRunEFn(ctx),
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rootCmd.AddCommand(genutilcli.InitCmd(ctx, cdc, app.ModuleBasics, app.DefaultNodeHome))
 | 
						rootCmd.AddCommand(
 | 
				
			||||||
	rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, auth.GenesisAccountIterator{}, app.DefaultNodeHome))
 | 
							genutilcli.InitCmd(ctx, cdc, app.ModuleBasics, app.DefaultNodeHome),
 | 
				
			||||||
	rootCmd.AddCommand(genutilcli.MigrateGenesisCmd(ctx, cdc))
 | 
							genutilcli.CollectGenTxsCmd(ctx, cdc, auth.GenesisAccountIterator{}, app.DefaultNodeHome),
 | 
				
			||||||
	rootCmd.AddCommand(genutilcli.GenTxCmd(
 | 
							genutilcli.MigrateGenesisCmd(ctx, cdc),
 | 
				
			||||||
 | 
							genutilcli.GenTxCmd(
 | 
				
			||||||
			ctx,
 | 
								ctx,
 | 
				
			||||||
			cdc,
 | 
								cdc,
 | 
				
			||||||
			app.ModuleBasics,
 | 
								app.ModuleBasics,
 | 
				
			||||||
			staking.AppModuleBasic{},
 | 
								staking.AppModuleBasic{},
 | 
				
			||||||
			auth.GenesisAccountIterator{},
 | 
								auth.GenesisAccountIterator{},
 | 
				
			||||||
			app.DefaultNodeHome,
 | 
								app.DefaultNodeHome,
 | 
				
			||||||
		app.DefaultCLIHome))
 | 
								app.DefaultCLIHome),
 | 
				
			||||||
	rootCmd.AddCommand(genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics))
 | 
							genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics),
 | 
				
			||||||
	rootCmd.AddCommand(AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome))
 | 
							AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome),
 | 
				
			||||||
	rootCmd.AddCommand(flags.NewCompletionCmd(rootCmd, true))
 | 
							flags.NewCompletionCmd(rootCmd, true),
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators)
 | 
						server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -81,8 +83,13 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer) abci.Application
 | 
				
			|||||||
		cache = store.NewCommitKVStoreCacheManager()
 | 
							cache = store.NewCommitKVStoreCacheManager()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						skipUpgradeHeights := make(map[int64]bool)
 | 
				
			||||||
 | 
						for _, h := range viper.GetIntSlice(server.FlagUnsafeSkipUpgrades) {
 | 
				
			||||||
 | 
							skipUpgradeHeights[int64(h)] = true
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return app.NewApp(
 | 
						return app.NewApp(
 | 
				
			||||||
		logger, db, traceStore, true, invCheckPeriod,
 | 
							logger, db, traceStore, true, skipUpgradeHeights, invCheckPeriod,
 | 
				
			||||||
		baseapp.SetPruning(store.NewPruningOptionsFromString(viper.GetString("pruning"))),
 | 
							baseapp.SetPruning(store.NewPruningOptionsFromString(viper.GetString("pruning"))),
 | 
				
			||||||
		baseapp.SetMinGasPrices(viper.GetString(server.FlagMinGasPrices)),
 | 
							baseapp.SetMinGasPrices(viper.GetString(server.FlagMinGasPrices)),
 | 
				
			||||||
		baseapp.SetHaltHeight(viper.GetUint64(server.FlagHaltHeight)),
 | 
							baseapp.SetHaltHeight(viper.GetUint64(server.FlagHaltHeight)),
 | 
				
			||||||
@ -96,13 +103,13 @@ func exportAppStateAndTMValidators(
 | 
				
			|||||||
) (json.RawMessage, []tmtypes.GenesisValidator, error) {
 | 
					) (json.RawMessage, []tmtypes.GenesisValidator, error) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if height != -1 {
 | 
						if height != -1 {
 | 
				
			||||||
		tempApp := app.NewApp(logger, db, traceStore, false, uint(1))
 | 
							tempApp := app.NewApp(logger, db, traceStore, false, map[int64]bool{}, uint(1))
 | 
				
			||||||
		err := tempApp.LoadHeight(height)
 | 
							err := tempApp.LoadHeight(height)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, nil, err
 | 
								return nil, nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return tempApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
 | 
							return tempApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	tempApp := app.NewApp(logger, db, traceStore, true, uint(1))
 | 
						tempApp := app.NewApp(logger, db, traceStore, true, map[int64]bool{}, uint(1))
 | 
				
			||||||
	return tempApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
 | 
						return tempApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user