mirror of
				https://github.com/0glabs/0g-chain.git
				synced 2025-10-31 18:27:26 +00:00 
			
		
		
		
	Merge pull request #252 from Kava-Labs/ro-update-sdk-to-v0.37+
Update SDK version
This commit is contained in:
		
						commit
						a9391c5c43
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -13,3 +13,4 @@ | |||||||
| 
 | 
 | ||||||
| # Exclude build files | # Exclude build files | ||||||
| vendor | vendor | ||||||
|  | build | ||||||
|  | |||||||
							
								
								
									
										24
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								Makefile
									
									
									
									
									
								
							| @ -83,10 +83,30 @@ install: go.sum | |||||||
| ### Tools & dependencies
 | ### Tools & dependencies
 | ||||||
| 
 | 
 | ||||||
| go.sum: go.mod | go.sum: go.mod | ||||||
| 	@echo "--> Ensure dependencies have not been modified" | 	@echo "--> Ensuring dependencies have not been modified" | ||||||
| 	@go mod verify | 	@go mod verify | ||||||
| 
 | 
 | ||||||
| clean: | clean: | ||||||
| 	rm -rf build/ | 	rm -rf build/ | ||||||
| 
 | 
 | ||||||
| .PHONY: all build-linux install clean build | ########################################
 | ||||||
|  | ### Testing
 | ||||||
|  | 
 | ||||||
|  | # TODO tidy up cli tests to use same -Enable flag as simulations, or the other way round
 | ||||||
|  | # TODO -mod=readonly ?
 | ||||||
|  | # build dependency needed for cli tests
 | ||||||
|  | test-all: build | ||||||
|  | 	# basic app tests | ||||||
|  | 	@go test ./app -v | ||||||
|  | 	# cli tests | ||||||
|  | 	@go test ./cli_test -tags cli_test -v -p 4 | ||||||
|  | 	# basic simulation (seed "2" happens to not unbond all validators before reaching 100 blocks) | ||||||
|  | 	@go test ./app -run TestFullAppSimulation        -Enabled -Commit -NumBlocks=100 -BlockSize=200 -Seed 2 -v -timeout 24h | ||||||
|  | 	# other sim tests | ||||||
|  | 	@go test ./app -run TestAppImportExport          -Enabled -Commit -NumBlocks=100 -BlockSize=200 -Seed 2 -v -timeout 24h | ||||||
|  | 	@go test ./app -run TestAppSimulationAfterImport -Enabled -Commit -NumBlocks=100 -BlockSize=200 -Seed 2 -v -timeout 24h | ||||||
|  | 	@# AppStateDeterminism does use Seed flag | ||||||
|  | 	@go test ./app -run TestAppStateDeterminism      -Enabled -Commit -NumBlocks=100 -BlockSize=200 -v -timeout 24h | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | .PHONY: all build-linux install clean build test-all | ||||||
							
								
								
									
										172
									
								
								app/app.go
									
									
									
									
									
								
							
							
						
						
									
										172
									
								
								app/app.go
									
									
									
									
									
								
							| @ -6,8 +6,8 @@ import ( | |||||||
| 
 | 
 | ||||||
| 	abci "github.com/tendermint/tendermint/abci/types" | 	abci "github.com/tendermint/tendermint/abci/types" | ||||||
| 	cmn "github.com/tendermint/tendermint/libs/common" | 	cmn "github.com/tendermint/tendermint/libs/common" | ||||||
| 	dbm "github.com/tendermint/tendermint/libs/db" |  | ||||||
| 	"github.com/tendermint/tendermint/libs/log" | 	"github.com/tendermint/tendermint/libs/log" | ||||||
|  | 	dbm "github.com/tendermint/tm-db" | ||||||
| 
 | 
 | ||||||
| 	bam "github.com/cosmos/cosmos-sdk/baseapp" | 	bam "github.com/cosmos/cosmos-sdk/baseapp" | ||||||
| 	"github.com/cosmos/cosmos-sdk/codec" | 	"github.com/cosmos/cosmos-sdk/codec" | ||||||
| @ -18,8 +18,6 @@ import ( | |||||||
| 	"github.com/cosmos/cosmos-sdk/x/bank" | 	"github.com/cosmos/cosmos-sdk/x/bank" | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/crisis" | 	"github.com/cosmos/cosmos-sdk/x/crisis" | ||||||
| 	distr "github.com/cosmos/cosmos-sdk/x/distribution" | 	distr "github.com/cosmos/cosmos-sdk/x/distribution" | ||||||
| 	distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client" |  | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/genaccounts" |  | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/genutil" | 	"github.com/cosmos/cosmos-sdk/x/genutil" | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/gov" | 	"github.com/cosmos/cosmos-sdk/x/gov" | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/mint" | 	"github.com/cosmos/cosmos-sdk/x/mint" | ||||||
| @ -41,7 +39,19 @@ var ( | |||||||
| 	DefaultNodeHome = os.ExpandEnv("$HOME/.kvd") | 	DefaultNodeHome = os.ExpandEnv("$HOME/.kvd") | ||||||
| 
 | 
 | ||||||
| 	// ModuleBasics manages simple versions of full app modules. It's used for things such as codec registration and genesis file verification.
 | 	// ModuleBasics manages simple versions of full app modules. It's used for things such as codec registration and genesis file verification.
 | ||||||
| 	ModuleBasics module.BasicManager | 	ModuleBasics = module.NewBasicManager( | ||||||
|  | 		genutil.AppModuleBasic{}, | ||||||
|  | 		auth.AppModuleBasic{}, | ||||||
|  | 		bank.AppModuleBasic{}, | ||||||
|  | 		staking.AppModuleBasic{}, | ||||||
|  | 		mint.AppModuleBasic{}, | ||||||
|  | 		distr.AppModuleBasic{}, | ||||||
|  | 		gov.NewAppModuleBasic(paramsclient.ProposalHandler, distr.ProposalHandler), | ||||||
|  | 		params.AppModuleBasic{}, | ||||||
|  | 		crisis.AppModuleBasic{}, | ||||||
|  | 		slashing.AppModuleBasic{}, | ||||||
|  | 		supply.AppModuleBasic{}, | ||||||
|  | 	) | ||||||
| 
 | 
 | ||||||
| 	// module account permissions
 | 	// module account permissions
 | ||||||
| 	mAccPerms = map[string][]string{ | 	mAccPerms = map[string][]string{ | ||||||
| @ -54,23 +64,6 @@ var ( | |||||||
| 	} | 	} | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func init() { |  | ||||||
| 	ModuleBasics = module.NewBasicManager( |  | ||||||
| 		genaccounts.AppModuleBasic{}, |  | ||||||
| 		genutil.AppModuleBasic{}, |  | ||||||
| 		auth.AppModuleBasic{}, |  | ||||||
| 		bank.AppModuleBasic{}, |  | ||||||
| 		staking.AppModuleBasic{}, |  | ||||||
| 		mint.AppModuleBasic{}, |  | ||||||
| 		distr.AppModuleBasic{}, |  | ||||||
| 		gov.NewAppModuleBasic(paramsclient.ProposalHandler, distrclient.ProposalHandler), |  | ||||||
| 		params.AppModuleBasic{}, |  | ||||||
| 		crisis.AppModuleBasic{}, |  | ||||||
| 		slashing.AppModuleBasic{}, |  | ||||||
| 		supply.AppModuleBasic{}, |  | ||||||
| 	) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Extended ABCI application
 | // Extended ABCI application
 | ||||||
| type App struct { | type App struct { | ||||||
| 	*bam.BaseApp | 	*bam.BaseApp | ||||||
| @ -79,18 +72,8 @@ type App struct { | |||||||
| 	invCheckPeriod uint | 	invCheckPeriod uint | ||||||
| 
 | 
 | ||||||
| 	// keys to access the substores
 | 	// keys to access the substores
 | ||||||
| 	keyMain     *sdk.KVStoreKey | 	keys  map[string]*sdk.KVStoreKey | ||||||
| 	keyAccount  *sdk.KVStoreKey | 	tkeys map[string]*sdk.TransientStoreKey | ||||||
| 	keySupply   *sdk.KVStoreKey |  | ||||||
| 	keyStaking  *sdk.KVStoreKey |  | ||||||
| 	tkeyStaking *sdk.TransientStoreKey |  | ||||||
| 	keySlashing *sdk.KVStoreKey |  | ||||||
| 	keyMint     *sdk.KVStoreKey |  | ||||||
| 	keyDistr    *sdk.KVStoreKey |  | ||||||
| 	tkeyDistr   *sdk.TransientStoreKey |  | ||||||
| 	keyGov      *sdk.KVStoreKey |  | ||||||
| 	keyParams   *sdk.KVStoreKey |  | ||||||
| 	tkeyParams  *sdk.TransientStoreKey |  | ||||||
| 
 | 
 | ||||||
| 	// keepers from all the modules
 | 	// keepers from all the modules
 | ||||||
| 	accountKeeper  auth.AccountKeeper | 	accountKeeper  auth.AccountKeeper | ||||||
| @ -106,6 +89,9 @@ type App struct { | |||||||
| 
 | 
 | ||||||
| 	// the module manager
 | 	// the module manager
 | ||||||
| 	mm *module.Manager | 	mm *module.Manager | ||||||
|  | 
 | ||||||
|  | 	// simulation manager
 | ||||||
|  | 	sm *module.SimulationManager | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // NewApp returns a reference to an initialized App.
 | // NewApp returns a reference to an initialized App.
 | ||||||
| @ -119,77 +105,74 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, | |||||||
| 	bApp.SetCommitMultiStoreTracer(traceStore) | 	bApp.SetCommitMultiStoreTracer(traceStore) | ||||||
| 	bApp.SetAppVersion(version.Version) | 	bApp.SetAppVersion(version.Version) | ||||||
| 
 | 
 | ||||||
|  | 	keys := sdk.NewKVStoreKeys( | ||||||
|  | 		bam.MainStoreKey, auth.StoreKey, staking.StoreKey, | ||||||
|  | 		supply.StoreKey, mint.StoreKey, distr.StoreKey, slashing.StoreKey, | ||||||
|  | 		gov.StoreKey, params.StoreKey, | ||||||
|  | 	) | ||||||
|  | 	tkeys := sdk.NewTransientStoreKeys(params.TStoreKey) | ||||||
|  | 
 | ||||||
| 	var app = &App{ | 	var app = &App{ | ||||||
| 		BaseApp:        bApp, | 		BaseApp:        bApp, | ||||||
| 		cdc:            cdc, | 		cdc:            cdc, | ||||||
| 		invCheckPeriod: invCheckPeriod, | 		invCheckPeriod: invCheckPeriod, | ||||||
| 		keyMain:        sdk.NewKVStoreKey(bam.MainStoreKey), | 		keys:           keys, | ||||||
| 		keyAccount:     sdk.NewKVStoreKey(auth.StoreKey), | 		tkeys:          tkeys, | ||||||
| 		keySupply:      sdk.NewKVStoreKey(supply.StoreKey), |  | ||||||
| 		keyStaking:     sdk.NewKVStoreKey(staking.StoreKey), |  | ||||||
| 		tkeyStaking:    sdk.NewTransientStoreKey(staking.TStoreKey), |  | ||||||
| 		keyMint:        sdk.NewKVStoreKey(mint.StoreKey), |  | ||||||
| 		keyDistr:       sdk.NewKVStoreKey(distr.StoreKey), |  | ||||||
| 		tkeyDistr:      sdk.NewTransientStoreKey(distr.TStoreKey), |  | ||||||
| 		keySlashing:    sdk.NewKVStoreKey(slashing.StoreKey), |  | ||||||
| 		keyGov:         sdk.NewKVStoreKey(gov.StoreKey), |  | ||||||
| 		keyParams:      sdk.NewKVStoreKey(params.StoreKey), |  | ||||||
| 		tkeyParams:     sdk.NewTransientStoreKey(params.TStoreKey), |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// init params keeper and subspaces
 | 	// init params keeper and subspaces
 | ||||||
| 	app.paramsKeeper = params.NewKeeper(app.cdc, app.keyParams, app.tkeyParams, params.DefaultCodespace) | 	app.paramsKeeper = params.NewKeeper(app.cdc, keys[params.StoreKey], tkeys[params.TStoreKey], params.DefaultCodespace) | ||||||
| 	authSubspace := app.paramsKeeper.Subspace(auth.DefaultParamspace) | 	authSubspace := app.paramsKeeper.Subspace(auth.DefaultParamspace) | ||||||
| 	bankSubspace := app.paramsKeeper.Subspace(bank.DefaultParamspace) | 	bankSubspace := app.paramsKeeper.Subspace(bank.DefaultParamspace) | ||||||
| 	stakingSubspace := app.paramsKeeper.Subspace(staking.DefaultParamspace) | 	stakingSubspace := app.paramsKeeper.Subspace(staking.DefaultParamspace) | ||||||
| 	mintSubspace := app.paramsKeeper.Subspace(mint.DefaultParamspace) | 	mintSubspace := app.paramsKeeper.Subspace(mint.DefaultParamspace) | ||||||
| 	distrSubspace := app.paramsKeeper.Subspace(distr.DefaultParamspace) | 	distrSubspace := app.paramsKeeper.Subspace(distr.DefaultParamspace) | ||||||
| 	slashingSubspace := app.paramsKeeper.Subspace(slashing.DefaultParamspace) | 	slashingSubspace := app.paramsKeeper.Subspace(slashing.DefaultParamspace) | ||||||
| 	govSubspace := app.paramsKeeper.Subspace(gov.DefaultParamspace) | 	govSubspace := app.paramsKeeper.Subspace(gov.DefaultParamspace).WithKeyTable(gov.ParamKeyTable()) | ||||||
| 	crisisSubspace := app.paramsKeeper.Subspace(crisis.DefaultParamspace) | 	crisisSubspace := app.paramsKeeper.Subspace(crisis.DefaultParamspace) | ||||||
| 
 | 
 | ||||||
| 	// add keepers
 | 	// add keepers
 | ||||||
| 	app.accountKeeper = auth.NewAccountKeeper( | 	app.accountKeeper = auth.NewAccountKeeper( | ||||||
| 		app.cdc, | 		app.cdc, | ||||||
| 		app.keyAccount, | 		keys[auth.StoreKey], | ||||||
| 		authSubspace, | 		authSubspace, | ||||||
| 		auth.ProtoBaseAccount) | 		auth.ProtoBaseAccount) | ||||||
| 	app.bankKeeper = bank.NewBaseKeeper( | 	app.bankKeeper = bank.NewBaseKeeper( | ||||||
| 		app.accountKeeper, | 		app.accountKeeper, | ||||||
| 		bankSubspace, | 		bankSubspace, | ||||||
| 		bank.DefaultCodespace) | 		bank.DefaultCodespace, | ||||||
|  | 		app.ModuleAccountAddrs()) | ||||||
| 	app.supplyKeeper = supply.NewKeeper( | 	app.supplyKeeper = supply.NewKeeper( | ||||||
| 		app.cdc, | 		app.cdc, | ||||||
| 		app.keySupply, | 		keys[supply.StoreKey], | ||||||
| 		app.accountKeeper, | 		app.accountKeeper, | ||||||
| 		app.bankKeeper, | 		app.bankKeeper, | ||||||
| 		supply.DefaultCodespace, |  | ||||||
| 		mAccPerms) | 		mAccPerms) | ||||||
| 	stakingKeeper := staking.NewKeeper( | 	stakingKeeper := staking.NewKeeper( | ||||||
| 		app.cdc, | 		app.cdc, | ||||||
| 		app.keyStaking, | 		keys[staking.StoreKey], | ||||||
| 		app.tkeyStaking, |  | ||||||
| 		app.supplyKeeper, | 		app.supplyKeeper, | ||||||
| 		stakingSubspace, | 		stakingSubspace, | ||||||
| 		staking.DefaultCodespace) | 		staking.DefaultCodespace) | ||||||
| 	app.mintKeeper = mint.NewKeeper( | 	app.mintKeeper = mint.NewKeeper( | ||||||
| 		app.cdc, | 		app.cdc, | ||||||
| 		app.keyMint, | 		keys[mint.StoreKey], | ||||||
| 		mintSubspace, | 		mintSubspace, | ||||||
| 		&stakingKeeper, | 		&stakingKeeper, | ||||||
| 		app.supplyKeeper, | 		app.supplyKeeper, | ||||||
| 		auth.FeeCollectorName) | 		auth.FeeCollectorName) | ||||||
| 	app.distrKeeper = distr.NewKeeper( | 	app.distrKeeper = distr.NewKeeper( | ||||||
| 		app.cdc, | 		app.cdc, | ||||||
| 		app.keyDistr, | 		keys[distr.StoreKey], | ||||||
| 		distrSubspace, | 		distrSubspace, | ||||||
| 		&stakingKeeper, | 		&stakingKeeper, | ||||||
| 		app.supplyKeeper, | 		app.supplyKeeper, | ||||||
| 		distr.DefaultCodespace, | 		distr.DefaultCodespace, | ||||||
| 		auth.FeeCollectorName) | 		auth.FeeCollectorName, | ||||||
|  | 		app.ModuleAccountAddrs()) | ||||||
| 	app.slashingKeeper = slashing.NewKeeper( | 	app.slashingKeeper = slashing.NewKeeper( | ||||||
| 		app.cdc, | 		app.cdc, | ||||||
| 		app.keySlashing, | 		keys[slashing.StoreKey], | ||||||
| 		&stakingKeeper, | 		&stakingKeeper, | ||||||
| 		slashingSubspace, | 		slashingSubspace, | ||||||
| 		slashing.DefaultCodespace) | 		slashing.DefaultCodespace) | ||||||
| @ -205,8 +188,7 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, | |||||||
| 		AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)) | 		AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)) | ||||||
| 	app.govKeeper = gov.NewKeeper( | 	app.govKeeper = gov.NewKeeper( | ||||||
| 		app.cdc, | 		app.cdc, | ||||||
| 		app.keyGov, | 		keys[gov.StoreKey], | ||||||
| 		app.paramsKeeper, |  | ||||||
| 		govSubspace, | 		govSubspace, | ||||||
| 		app.supplyKeeper, | 		app.supplyKeeper, | ||||||
| 		&stakingKeeper, | 		&stakingKeeper, | ||||||
| @ -218,19 +200,19 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, | |||||||
| 	app.stakingKeeper = *stakingKeeper.SetHooks( | 	app.stakingKeeper = *stakingKeeper.SetHooks( | ||||||
| 		staking.NewMultiStakingHooks(app.distrKeeper.Hooks(), app.slashingKeeper.Hooks())) | 		staking.NewMultiStakingHooks(app.distrKeeper.Hooks(), app.slashingKeeper.Hooks())) | ||||||
| 
 | 
 | ||||||
| 	// create the module manager
 | 	// create the module manager (Note: Any module instantiated in the module manager that is later modified
 | ||||||
|  | 	// must be passed by reference here.)
 | ||||||
| 	app.mm = module.NewManager( | 	app.mm = module.NewManager( | ||||||
| 		genaccounts.NewAppModule(app.accountKeeper), |  | ||||||
| 		genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx), | 		genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx), | ||||||
| 		auth.NewAppModule(app.accountKeeper), | 		auth.NewAppModule(app.accountKeeper), | ||||||
| 		bank.NewAppModule(app.bankKeeper, app.accountKeeper), | 		bank.NewAppModule(app.bankKeeper, app.accountKeeper), | ||||||
| 		crisis.NewAppModule(app.crisisKeeper), | 		crisis.NewAppModule(&app.crisisKeeper), | ||||||
| 		supply.NewAppModule(app.supplyKeeper, app.accountKeeper), | 		supply.NewAppModule(app.supplyKeeper, app.accountKeeper), | ||||||
| 		distr.NewAppModule(app.distrKeeper, app.supplyKeeper), | 		distr.NewAppModule(app.distrKeeper, app.supplyKeeper), | ||||||
| 		gov.NewAppModule(app.govKeeper, app.supplyKeeper), | 		gov.NewAppModule(app.govKeeper, app.supplyKeeper), | ||||||
| 		mint.NewAppModule(app.mintKeeper), | 		mint.NewAppModule(app.mintKeeper), | ||||||
| 		slashing.NewAppModule(app.slashingKeeper, app.stakingKeeper), | 		slashing.NewAppModule(app.slashingKeeper, app.stakingKeeper), | ||||||
| 		staking.NewAppModule(app.stakingKeeper, app.distrKeeper, app.accountKeeper, app.supplyKeeper), | 		staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper), | ||||||
| 	) | 	) | ||||||
| 
 | 
 | ||||||
| 	// During begin block slashing happens after distr.BeginBlocker so that
 | 	// During begin block slashing happens after distr.BeginBlocker so that
 | ||||||
| @ -238,21 +220,44 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, | |||||||
| 	// CanWithdrawInvariant invariant.
 | 	// CanWithdrawInvariant invariant.
 | ||||||
| 	app.mm.SetOrderBeginBlockers(mint.ModuleName, distr.ModuleName, slashing.ModuleName) | 	app.mm.SetOrderBeginBlockers(mint.ModuleName, distr.ModuleName, slashing.ModuleName) | ||||||
| 
 | 
 | ||||||
| 	app.mm.SetOrderEndBlockers(gov.ModuleName, staking.ModuleName) | 	app.mm.SetOrderEndBlockers(crisis.ModuleName, gov.ModuleName, staking.ModuleName) | ||||||
| 
 | 
 | ||||||
| 	// genutils must occur after staking so that pools are properly
 | 	// Note: genutils must occur after staking so that pools are properly
 | ||||||
| 	// initialized with tokens from genesis accounts.
 | 	// initialized with tokens from genesis accounts.
 | ||||||
| 	app.mm.SetOrderInitGenesis(genaccounts.ModuleName, distr.ModuleName, | 	//
 | ||||||
| 		staking.ModuleName, auth.ModuleName, bank.ModuleName, slashing.ModuleName, | 	// Note: Changing the order of the auth module and modules that use module accounts
 | ||||||
| 		gov.ModuleName, mint.ModuleName, supply.ModuleName, crisis.ModuleName, genutil.ModuleName) | 	// results in subtle changes to the way accounts are loaded from genesis.
 | ||||||
|  | 	app.mm.SetOrderInitGenesis( | ||||||
|  | 		auth.ModuleName, distr.ModuleName, | ||||||
|  | 		staking.ModuleName, bank.ModuleName, slashing.ModuleName, | ||||||
|  | 		gov.ModuleName, mint.ModuleName, supply.ModuleName, crisis.ModuleName, genutil.ModuleName, | ||||||
|  | 	) | ||||||
| 
 | 
 | ||||||
| 	app.mm.RegisterInvariants(&app.crisisKeeper) | 	app.mm.RegisterInvariants(&app.crisisKeeper) | ||||||
| 	app.mm.RegisterRoutes(app.Router(), app.QueryRouter()) | 	app.mm.RegisterRoutes(app.Router(), app.QueryRouter()) | ||||||
| 
 | 
 | ||||||
|  | 	// create the simulation manager and define the order of the modules for deterministic simulations
 | ||||||
|  | 	//
 | ||||||
|  | 	// NOTE: This is not required for apps that don't use the simulator for fuzz testing
 | ||||||
|  | 	// transactions.
 | ||||||
|  | 	app.sm = module.NewSimulationManager( | ||||||
|  | 		auth.NewAppModule(app.accountKeeper), | ||||||
|  | 		bank.NewAppModule(app.bankKeeper, app.accountKeeper), | ||||||
|  | 		supply.NewAppModule(app.supplyKeeper, app.accountKeeper), | ||||||
|  | 		gov.NewAppModule(app.govKeeper, app.supplyKeeper), | ||||||
|  | 		mint.NewAppModule(app.mintKeeper), | ||||||
|  | 		distr.NewAppModule(app.distrKeeper, app.supplyKeeper), | ||||||
|  | 		staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper), | ||||||
|  | 		slashing.NewAppModule(app.slashingKeeper, app.stakingKeeper), | ||||||
|  | 	) | ||||||
|  | 
 | ||||||
|  | 	app.sm.RegisterStoreDecoders() | ||||||
|  | 
 | ||||||
|  | 	// initialize stores
 | ||||||
|  | 	app.MountKVStores(keys) | ||||||
|  | 	app.MountTransientStores(tkeys) | ||||||
|  | 
 | ||||||
| 	// initialize the app
 | 	// initialize the app
 | ||||||
| 	app.MountStores(app.keyMain, app.keyAccount, app.keySupply, app.keyStaking, |  | ||||||
| 		app.keyMint, app.keyDistr, app.keySlashing, app.keyGov, app.keyParams, |  | ||||||
| 		app.tkeyParams, app.tkeyStaking, app.tkeyDistr) |  | ||||||
| 	app.SetInitChainer(app.InitChainer) | 	app.SetInitChainer(app.InitChainer) | ||||||
| 	app.SetBeginBlocker(app.BeginBlocker) | 	app.SetBeginBlocker(app.BeginBlocker) | ||||||
| 	app.SetAnteHandler(auth.NewAnteHandler(app.accountKeeper, app.supplyKeeper, auth.DefaultSigVerificationGasConsumer)) | 	app.SetAnteHandler(auth.NewAnteHandler(app.accountKeeper, app.supplyKeeper, auth.DefaultSigVerificationGasConsumer)) | ||||||
| @ -260,7 +265,7 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, | |||||||
| 
 | 
 | ||||||
| 	// load store
 | 	// load store
 | ||||||
| 	if loadLatest { | 	if loadLatest { | ||||||
| 		err := app.LoadLatestVersion(app.keyMain) | 		err := app.LoadLatestVersion(app.keys[bam.MainStoreKey]) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			cmn.Exit(err.Error()) | 			cmn.Exit(err.Error()) | ||||||
| 		} | 		} | ||||||
| @ -272,10 +277,13 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, | |||||||
| // custom tx codec
 | // custom tx codec
 | ||||||
| func MakeCodec() *codec.Codec { | func MakeCodec() *codec.Codec { | ||||||
| 	var cdc = codec.New() | 	var cdc = codec.New() | ||||||
|  | 
 | ||||||
| 	ModuleBasics.RegisterCodec(cdc) | 	ModuleBasics.RegisterCodec(cdc) | ||||||
| 	sdk.RegisterCodec(cdc) | 	sdk.RegisterCodec(cdc) | ||||||
| 	codec.RegisterCrypto(cdc) | 	codec.RegisterCrypto(cdc) | ||||||
| 	return cdc | 	codec.RegisterEvidences(cdc) | ||||||
|  | 
 | ||||||
|  | 	return cdc.Seal() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func SetBech32AddressPrefixes(config *sdk.Config) { | func SetBech32AddressPrefixes(config *sdk.Config) { | ||||||
| @ -303,15 +311,29 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res | |||||||
| 
 | 
 | ||||||
| // load a particular height
 | // load a particular height
 | ||||||
| func (app *App) LoadHeight(height int64) error { | func (app *App) LoadHeight(height int64) error { | ||||||
| 	return app.LoadVersion(height, app.keyMain) | 	return app.LoadVersion(height, app.keys[bam.MainStoreKey]) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // ModuleAccountAddrs returns all the app's module account addresses.
 | // ModuleAccountAddrs returns all the app's module account addresses.
 | ||||||
| func (app *App) ModuleAccountAddrs() map[string]bool { | func (app *App) ModuleAccountAddrs() map[string]bool { | ||||||
| 	modAccAddrs := make(map[string]bool) | 	modAccAddrs := make(map[string]bool) | ||||||
| 	for acc := range mAccPerms { | 	for acc := range mAccPerms { | ||||||
| 		modAccAddrs[app.supplyKeeper.GetModuleAddress(acc).String()] = true | 		modAccAddrs[supply.NewModuleAddress(acc).String()] = true | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return modAccAddrs | 	return modAccAddrs | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | // Codec returns the application's sealed codec.
 | ||||||
|  | func (app *App) Codec() *codec.Codec { | ||||||
|  | 	return app.cdc | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // GetMaccPerms returns a mapping of the application's module account permissions.
 | ||||||
|  | func GetMaccPerms() map[string][]string { | ||||||
|  | 	perms := make(map[string][]string) | ||||||
|  | 	for k, v := range mAccPerms { | ||||||
|  | 		perms[k] = v | ||||||
|  | 	} | ||||||
|  | 	return perms | ||||||
|  | } | ||||||
|  | |||||||
| @ -5,8 +5,8 @@ import ( | |||||||
| 	"testing" | 	"testing" | ||||||
| 
 | 
 | ||||||
| 	"github.com/stretchr/testify/require" | 	"github.com/stretchr/testify/require" | ||||||
| 	"github.com/tendermint/tendermint/libs/db" |  | ||||||
| 	"github.com/tendermint/tendermint/libs/log" | 	"github.com/tendermint/tendermint/libs/log" | ||||||
|  | 	db "github.com/tendermint/tm-db" | ||||||
| 
 | 
 | ||||||
| 	"github.com/cosmos/cosmos-sdk/codec" | 	"github.com/cosmos/cosmos-sdk/codec" | ||||||
| 
 | 
 | ||||||
| @ -24,6 +24,16 @@ func TestExport(t *testing.T) { | |||||||
| 	require.NoError(t, err, "ExportAppStateAndValidators should not have an error") | 	require.NoError(t, err, "ExportAppStateAndValidators should not have an error") | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // ensure that black listed addresses are properly set in bank keeper
 | ||||||
|  | func TestBlackListedAddrs(t *testing.T) { | ||||||
|  | 	db := db.NewMemDB() | ||||||
|  | 	app := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) | ||||||
|  | 
 | ||||||
|  | 	for acc := range mAccPerms { | ||||||
|  | 		require.True(t, app.bankKeeper.BlacklistedAddr(app.supplyKeeper.GetModuleAddress(acc))) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func setGenesis(app *App) error { | func setGenesis(app *App) error { | ||||||
| 	genesisState := NewDefaultGenesisState() | 	genesisState := NewDefaultGenesisState() | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -124,7 +124,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string | |||||||
| 
 | 
 | ||||||
| 	// Iterate through validators by power descending, reset bond heights, and
 | 	// Iterate through validators by power descending, reset bond heights, and
 | ||||||
| 	// update bond intra-tx counters.
 | 	// update bond intra-tx counters.
 | ||||||
| 	store := ctx.KVStore(app.keyStaking) | 	store := ctx.KVStore(app.keys[staking.StoreKey]) | ||||||
| 	iter := sdk.KVStoreReversePrefixIterator(store, staking.ValidatorsKey) | 	iter := sdk.KVStoreReversePrefixIterator(store, staking.ValidatorsKey) | ||||||
| 	counter := int16(0) | 	counter := int16(0) | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										532
									
								
								app/sim_test.go
									
									
									
									
									
								
							
							
						
						
									
										532
									
								
								app/sim_test.go
									
									
									
									
									
								
							| @ -2,33 +2,38 @@ package app | |||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"flag" |  | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"io" |  | ||||||
| 	"io/ioutil" | 	"io/ioutil" | ||||||
| 	"math/rand" | 	"math/rand" | ||||||
| 	"os" | 	"os" | ||||||
| 	"testing" | 	"testing" | ||||||
| 	"time" |  | ||||||
| 
 | 
 | ||||||
| 	"github.com/stretchr/testify/require" | 	"github.com/stretchr/testify/require" | ||||||
| 
 | 
 | ||||||
| 	abci "github.com/tendermint/tendermint/abci/types" | 	abci "github.com/tendermint/tendermint/abci/types" | ||||||
| 	dbm "github.com/tendermint/tendermint/libs/db" |  | ||||||
| 	"github.com/tendermint/tendermint/libs/log" | 	"github.com/tendermint/tendermint/libs/log" | ||||||
|  | 	dbm "github.com/tendermint/tm-db" | ||||||
| 
 | 
 | ||||||
| 	"github.com/cosmos/cosmos-sdk/baseapp" | 	"github.com/cosmos/cosmos-sdk/baseapp" | ||||||
| 	"github.com/cosmos/cosmos-sdk/simapp" // TODO replace with types from app/genesis.go ?
 | 	"github.com/cosmos/cosmos-sdk/simapp" | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/store" | ||||||
| 	sdk "github.com/cosmos/cosmos-sdk/types" | 	sdk "github.com/cosmos/cosmos-sdk/types" | ||||||
| 	authsim "github.com/cosmos/cosmos-sdk/x/auth/simulation" | 	"github.com/cosmos/cosmos-sdk/x/auth" | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/bank" | 	authsimops "github.com/cosmos/cosmos-sdk/x/auth/simulation/operations" | ||||||
| 	distrsim "github.com/cosmos/cosmos-sdk/x/distribution/simulation" | 	banksimops "github.com/cosmos/cosmos-sdk/x/bank/simulation/operations" | ||||||
| 	govsim "github.com/cosmos/cosmos-sdk/x/gov/simulation" | 	distr "github.com/cosmos/cosmos-sdk/x/distribution" | ||||||
| 	paramsim "github.com/cosmos/cosmos-sdk/x/params/simulation" | 	distrsimops "github.com/cosmos/cosmos-sdk/x/distribution/simulation/operations" | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/x/gov" | ||||||
|  | 	govsimops "github.com/cosmos/cosmos-sdk/x/gov/simulation/operations" | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/x/mint" | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/x/params" | ||||||
|  | 	paramsimops "github.com/cosmos/cosmos-sdk/x/params/simulation/operations" | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/simulation" | 	"github.com/cosmos/cosmos-sdk/x/simulation" | ||||||
| 	slashingsim "github.com/cosmos/cosmos-sdk/x/slashing/simulation" | 	"github.com/cosmos/cosmos-sdk/x/slashing" | ||||||
|  | 	slashingsimops "github.com/cosmos/cosmos-sdk/x/slashing/simulation/operations" | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/staking" | 	"github.com/cosmos/cosmos-sdk/x/staking" | ||||||
| 	stakingsim "github.com/cosmos/cosmos-sdk/x/staking/simulation" | 	stakingsimops "github.com/cosmos/cosmos-sdk/x/staking/simulation/operations" | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/x/supply" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // Simulation parameter constants
 | // Simulation parameter constants
 | ||||||
| @ -53,372 +58,276 @@ const ( | |||||||
| 	OpWeightMsgUnjail                                  = "op_weight_msg_unjail" | 	OpWeightMsgUnjail                                  = "op_weight_msg_unjail" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| var ( |  | ||||||
| 	genesisFile   string |  | ||||||
| 	paramsFile    string |  | ||||||
| 	seed          int64 |  | ||||||
| 	numBlocks     int |  | ||||||
| 	blockSize     int |  | ||||||
| 	enabled       bool |  | ||||||
| 	verbose       bool |  | ||||||
| 	lean          bool |  | ||||||
| 	commit        bool |  | ||||||
| 	period        int |  | ||||||
| 	onOperation   bool // TODO Remove in favor of binary search for invariant violation
 |  | ||||||
| 	allInvariants bool |  | ||||||
| ) |  | ||||||
| 
 |  | ||||||
| func init() { | func init() { | ||||||
| 	flag.StringVar(&genesisFile, "SimulationGenesis", "", "custom simulation genesis file; cannot be used with params file") | 	simapp.GetSimulatorFlags() | ||||||
| 	flag.StringVar(¶msFile, "SimulationParams", "", "custom simulation params file which overrides any random params; cannot be used with genesis") |  | ||||||
| 	flag.Int64Var(&seed, "SimulationSeed", 42, "simulation random seed") |  | ||||||
| 	flag.IntVar(&numBlocks, "SimulationNumBlocks", 500, "number of blocks") |  | ||||||
| 	flag.IntVar(&blockSize, "SimulationBlockSize", 200, "operations per block") |  | ||||||
| 	flag.BoolVar(&enabled, "SimulationEnabled", false, "enable the simulation") |  | ||||||
| 	flag.BoolVar(&verbose, "SimulationVerbose", false, "verbose log output") |  | ||||||
| 	flag.BoolVar(&lean, "SimulationLean", false, "lean simulation log output") |  | ||||||
| 	flag.BoolVar(&commit, "SimulationCommit", false, "have the simulation commit") |  | ||||||
| 	flag.IntVar(&period, "SimulationPeriod", 1, "run slow invariants only once every period assertions") |  | ||||||
| 	flag.BoolVar(&onOperation, "SimulateEveryOperation", false, "run slow invariants every operation") |  | ||||||
| 	flag.BoolVar(&allInvariants, "PrintAllInvariants", false, "print all invariants if a broken invariant is found") |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // helper function for populating input for SimulateFromSeed
 | func testAndRunTxs(app *App, config simulation.Config) []simulation.WeightedOperation { | ||||||
| func getSimulateFromSeedInput(tb testing.TB, w io.Writer, app *App) ( |  | ||||||
| 	testing.TB, io.Writer, *baseapp.BaseApp, simulation.AppStateFn, int64, |  | ||||||
| 	simulation.WeightedOperations, sdk.Invariants, int, int, bool, bool, bool, bool, map[string]bool, |  | ||||||
| ) { |  | ||||||
| 
 |  | ||||||
| 	return tb, w, app.BaseApp, appStateFn, seed, |  | ||||||
| 		testAndRunTxs(app), invariants(app), numBlocks, blockSize, commit, |  | ||||||
| 		lean, onOperation, allInvariants, app.ModuleAccountAddrs() |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func appStateFn( |  | ||||||
| 	r *rand.Rand, accs []simulation.Account, genesisTimestamp time.Time, |  | ||||||
| ) (appState json.RawMessage, simAccs []simulation.Account, chainID string) { |  | ||||||
| 
 |  | ||||||
| 	cdc := MakeCodec() |  | ||||||
| 
 |  | ||||||
| 	switch { |  | ||||||
| 	case paramsFile != "" && genesisFile != "": |  | ||||||
| 		panic("cannot provide both a genesis file and a params file") |  | ||||||
| 
 |  | ||||||
| 	case genesisFile != "": |  | ||||||
| 		appState, simAccs, chainID = simapp.AppStateFromGenesisFileFn(r, accs, genesisTimestamp) |  | ||||||
| 
 |  | ||||||
| 	case paramsFile != "": |  | ||||||
| 		appParams := make(simulation.AppParams) |  | ||||||
| 		bz, err := ioutil.ReadFile(paramsFile) |  | ||||||
| 		if err != nil { |  | ||||||
| 			panic(err) |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		cdc.MustUnmarshalJSON(bz, &appParams) |  | ||||||
| 		appState, simAccs, chainID = appStateRandomizedFn(r, accs, genesisTimestamp, appParams) |  | ||||||
| 
 |  | ||||||
| 	default: |  | ||||||
| 		appParams := make(simulation.AppParams) |  | ||||||
| 		appState, simAccs, chainID = appStateRandomizedFn(r, accs, genesisTimestamp, appParams) |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return appState, simAccs, chainID |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // TODO refactor out random initialization code to the modules
 |  | ||||||
| func appStateRandomizedFn( |  | ||||||
| 	r *rand.Rand, accs []simulation.Account, genesisTimestamp time.Time, appParams simulation.AppParams, |  | ||||||
| ) (json.RawMessage, []simulation.Account, string) { |  | ||||||
| 
 |  | ||||||
| 	cdc := MakeCodec() |  | ||||||
| 	genesisState := simapp.NewDefaultGenesisState() |  | ||||||
| 
 |  | ||||||
| 	var ( |  | ||||||
| 		amount             int64 |  | ||||||
| 		numInitiallyBonded int64 |  | ||||||
| 	) |  | ||||||
| 
 |  | ||||||
| 	appParams.GetOrGenerate(cdc, StakePerAccount, &amount, r, |  | ||||||
| 		func(r *rand.Rand) { amount = int64(r.Intn(1e12)) }) |  | ||||||
| 	appParams.GetOrGenerate(cdc, InitiallyBondedValidators, &amount, r, |  | ||||||
| 		func(r *rand.Rand) { numInitiallyBonded = int64(r.Intn(250)) }) |  | ||||||
| 
 |  | ||||||
| 	numAccs := int64(len(accs)) |  | ||||||
| 	if numInitiallyBonded > numAccs { |  | ||||||
| 		numInitiallyBonded = numAccs |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	fmt.Printf( |  | ||||||
| 		`Selected randomly generated parameters for simulated genesis: |  | ||||||
| { |  | ||||||
|   stake_per_account: "%v", |  | ||||||
|   initially_bonded_validators: "%v" |  | ||||||
| } |  | ||||||
| `, amount, numInitiallyBonded, |  | ||||||
| 	) |  | ||||||
| 
 |  | ||||||
| 	simapp.GenGenesisAccounts(cdc, r, accs, genesisTimestamp, amount, numInitiallyBonded, genesisState) |  | ||||||
| 	simapp.GenAuthGenesisState(cdc, r, appParams, genesisState) |  | ||||||
| 	simapp.GenBankGenesisState(cdc, r, appParams, genesisState) |  | ||||||
| 	simapp.GenSupplyGenesisState(cdc, amount, numInitiallyBonded, int64(len(accs)), genesisState) |  | ||||||
| 	simapp.GenGovGenesisState(cdc, r, appParams, genesisState) |  | ||||||
| 	simapp.GenMintGenesisState(cdc, r, appParams, genesisState) |  | ||||||
| 	simapp.GenDistrGenesisState(cdc, r, appParams, genesisState) |  | ||||||
| 	stakingGen := simapp.GenStakingGenesisState(cdc, r, accs, amount, numAccs, numInitiallyBonded, appParams, genesisState) |  | ||||||
| 	simapp.GenSlashingGenesisState(cdc, r, stakingGen, appParams, genesisState) |  | ||||||
| 
 |  | ||||||
| 	appState, err := MakeCodec().MarshalJSON(genesisState) |  | ||||||
| 	if err != nil { |  | ||||||
| 		panic(err) |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return appState, accs, "simulation" |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func testAndRunTxs(app *App) []simulation.WeightedOperation { |  | ||||||
| 	cdc := MakeCodec() |  | ||||||
| 	ap := make(simulation.AppParams) | 	ap := make(simulation.AppParams) | ||||||
| 
 | 
 | ||||||
| 	if paramsFile != "" { | 	paramChanges := app.sm.GenerateParamChanges(config.Seed) | ||||||
| 		bz, err := ioutil.ReadFile(paramsFile) | 
 | ||||||
|  | 	if config.ParamsFile != "" { | ||||||
|  | 		bz, err := ioutil.ReadFile(config.ParamsFile) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			panic(err) | 			panic(err) | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		cdc.MustUnmarshalJSON(bz, &ap) | 		app.cdc.MustUnmarshalJSON(bz, &ap) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	// nolint: govet
 | ||||||
| 	return []simulation.WeightedOperation{ | 	return []simulation.WeightedOperation{ | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightDeductFee, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightDeductFee, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 5 | 						v = 5 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			authsim.SimulateDeductFee(app.accountKeeper, app.supplyKeeper), | 			authsimops.SimulateDeductFee(app.accountKeeper, app.supplyKeeper), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightMsgSend, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightMsgSend, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 100 | 						v = 100 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			bank.SimulateMsgSend(app.accountKeeper, app.bankKeeper), | 			banksimops.SimulateMsgSend(app.accountKeeper, app.bankKeeper), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightSingleInputMsgMultiSend, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightSingleInputMsgMultiSend, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 10 | 						v = 10 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			bank.SimulateSingleInputMsgMultiSend(app.accountKeeper, app.bankKeeper), | 			banksimops.SimulateSingleInputMsgMultiSend(app.accountKeeper, app.bankKeeper), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightMsgSetWithdrawAddress, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightMsgSetWithdrawAddress, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 50 | 						v = 50 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			distrsim.SimulateMsgSetWithdrawAddress(app.accountKeeper, app.distrKeeper), | 			distrsimops.SimulateMsgSetWithdrawAddress(app.distrKeeper), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightMsgWithdrawDelegationReward, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightMsgWithdrawDelegationReward, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 50 | 						v = 50 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			distrsim.SimulateMsgWithdrawDelegatorReward(app.accountKeeper, app.distrKeeper), | 			distrsimops.SimulateMsgWithdrawDelegatorReward(app.distrKeeper), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightMsgWithdrawValidatorCommission, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightMsgWithdrawValidatorCommission, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 50 | 						v = 50 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			distrsim.SimulateMsgWithdrawValidatorCommission(app.accountKeeper, app.distrKeeper), | 			distrsimops.SimulateMsgWithdrawValidatorCommission(app.distrKeeper), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightSubmitVotingSlashingTextProposal, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightSubmitVotingSlashingTextProposal, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 5 | 						v = 5 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			govsim.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, govsim.SimulateTextProposalContent), | 			govsimops.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, govsimops.SimulateTextProposalContent), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightSubmitVotingSlashingCommunitySpendProposal, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightSubmitVotingSlashingCommunitySpendProposal, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 5 | 						v = 5 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			govsim.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, distrsim.SimulateCommunityPoolSpendProposalContent(app.distrKeeper)), | 			govsimops.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, distrsimops.SimulateCommunityPoolSpendProposalContent(app.distrKeeper)), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightSubmitVotingSlashingParamChangeProposal, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightSubmitVotingSlashingParamChangeProposal, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 5 | 						v = 5 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			govsim.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, paramsim.SimulateParamChangeProposalContent), | 			govsimops.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, paramsimops.SimulateParamChangeProposalContent(paramChanges)), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightMsgDeposit, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightMsgDeposit, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 100 | 						v = 100 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			govsim.SimulateMsgDeposit(app.govKeeper), | 			govsimops.SimulateMsgDeposit(app.govKeeper), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightMsgCreateValidator, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightMsgCreateValidator, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 100 | 						v = 100 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			stakingsim.SimulateMsgCreateValidator(app.accountKeeper, app.stakingKeeper), | 			stakingsimops.SimulateMsgCreateValidator(app.accountKeeper, app.stakingKeeper), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightMsgEditValidator, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightMsgEditValidator, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 5 | 						v = 5 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			stakingsim.SimulateMsgEditValidator(app.stakingKeeper), | 			stakingsimops.SimulateMsgEditValidator(app.stakingKeeper), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightMsgDelegate, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightMsgDelegate, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 100 | 						v = 100 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			stakingsim.SimulateMsgDelegate(app.accountKeeper, app.stakingKeeper), | 			stakingsimops.SimulateMsgDelegate(app.accountKeeper, app.stakingKeeper), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightMsgUndelegate, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightMsgUndelegate, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 100 | 						v = 100 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			stakingsim.SimulateMsgUndelegate(app.accountKeeper, app.stakingKeeper), | 			stakingsimops.SimulateMsgUndelegate(app.accountKeeper, app.stakingKeeper), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightMsgBeginRedelegate, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightMsgBeginRedelegate, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 100 | 						v = 100 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			stakingsim.SimulateMsgBeginRedelegate(app.accountKeeper, app.stakingKeeper), | 			stakingsimops.SimulateMsgBeginRedelegate(app.accountKeeper, app.stakingKeeper), | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			func(_ *rand.Rand) int { | 			func(_ *rand.Rand) int { | ||||||
| 				var v int | 				var v int | ||||||
| 				ap.GetOrGenerate(cdc, OpWeightMsgUnjail, &v, nil, | 				ap.GetOrGenerate(app.cdc, OpWeightMsgUnjail, &v, nil, | ||||||
| 					func(_ *rand.Rand) { | 					func(_ *rand.Rand) { | ||||||
| 						v = 100 | 						v = 100 | ||||||
| 					}) | 					}) | ||||||
| 				return v | 				return v | ||||||
| 			}(nil), | 			}(nil), | ||||||
| 			slashingsim.SimulateMsgUnjail(app.slashingKeeper), | 			slashingsimops.SimulateMsgUnjail(app.slashingKeeper), | ||||||
| 		}, | 		}, | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func invariants(app *App) []sdk.Invariant { | // fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of
 | ||||||
| 	// TODO: fix PeriodicInvariants, it doesn't seem to call individual invariants for a period of 1
 | // an IAVLStore for faster simulation speed.
 | ||||||
| 	// Ref: https://github.com/cosmos/cosmos-sdk/issues/4631
 |  | ||||||
| 	if period == 1 { |  | ||||||
| 		return app.crisisKeeper.Invariants() |  | ||||||
| 	} |  | ||||||
| 	return simulation.PeriodicInvariants(app.crisisKeeper.Invariants(), period, 0) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Pass this in as an option to use a dbStoreAdapter instead of an IAVLStore for simulation speed.
 |  | ||||||
| func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { | func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { | ||||||
| 	bapp.SetFauxMerkleMode() | 	bapp.SetFauxMerkleMode() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // interBlockCacheOpt returns a BaseApp option function that sets the persistent
 | ||||||
|  | // inter-block write-through cache.
 | ||||||
|  | func interBlockCacheOpt() func(*baseapp.BaseApp) { | ||||||
|  | 	return baseapp.SetInterBlockCache(store.NewCommitKVStoreCacheManager()) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // Profile with:
 | // Profile with:
 | ||||||
| // /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/GaiaApp -bench ^BenchmarkFullAppSimulation$ -SimulationCommit=true -cpuprofile cpu.out
 | // /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/GaiaApp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out
 | ||||||
| // TODO does this work
 |  | ||||||
| func BenchmarkFullAppSimulation(b *testing.B) { | func BenchmarkFullAppSimulation(b *testing.B) { | ||||||
| 	logger := log.NewNopLogger() | 	logger := log.NewNopLogger() | ||||||
|  | 	config := simapp.NewConfigFromFlags() | ||||||
| 
 | 
 | ||||||
| 	var db dbm.DB | 	var db dbm.DB | ||||||
| 	dir, _ := ioutil.TempDir("", "goleveldb-app-sim") | 	dir, _ := ioutil.TempDir("", "goleveldb-app-sim") | ||||||
| 	db, _ = sdk.NewLevelDB("Simulation", dir) | 	db, _ = sdk.NewLevelDB("Simulation", dir) | ||||||
| 	defer func() { | 	defer func() { | ||||||
| 		db.Close() | 		db.Close() | ||||||
| 		os.RemoveAll(dir) | 		_ = os.RemoveAll(dir) | ||||||
| 	}() | 	}() | ||||||
| 	app := NewApp(logger, db, nil, true, 0) | 
 | ||||||
|  | 	app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) | ||||||
| 
 | 
 | ||||||
| 	// Run randomized simulation
 | 	// Run randomized simulation
 | ||||||
| 	// TODO parameterize numbers, save for a later PR
 | 	// TODO: parameterize numbers, save for a later PR
 | ||||||
| 	_, err := simulation.SimulateFromSeed(getSimulateFromSeedInput(b, os.Stdout, app)) | 	_, simParams, simErr := simulation.SimulateFromSeed( | ||||||
| 	if err != nil { | 		b, os.Stdout, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), | ||||||
|  | 		testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, | ||||||
|  | 	) | ||||||
|  | 
 | ||||||
|  | 	// export state and params before the simulation error is checked
 | ||||||
|  | 	if config.ExportStatePath != "" { | ||||||
|  | 		if err := ExportStateToJSON(app, config.ExportStatePath); err != nil { | ||||||
| 			fmt.Println(err) | 			fmt.Println(err) | ||||||
| 			b.Fail() | 			b.Fail() | ||||||
| 		} | 		} | ||||||
| 	if commit { | 	} | ||||||
| 		fmt.Println("GoLevelDB Stats") | 
 | ||||||
|  | 	if config.ExportParamsPath != "" { | ||||||
|  | 		if err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath); err != nil { | ||||||
|  | 			fmt.Println(err) | ||||||
|  | 			b.Fail() | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if simErr != nil { | ||||||
|  | 		fmt.Println(simErr) | ||||||
|  | 		b.FailNow() | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if config.Commit { | ||||||
|  | 		fmt.Println("\nGoLevelDB Stats") | ||||||
| 		fmt.Println(db.Stats()["leveldb.stats"]) | 		fmt.Println(db.Stats()["leveldb.stats"]) | ||||||
| 		fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) | 		fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestFullAppSimulation(t *testing.T) { | func TestFullAppSimulation(t *testing.T) { | ||||||
| 	if !enabled { | 	if !simapp.FlagEnabledValue { | ||||||
| 		t.Skip("Skipping application simulation") | 		t.Skip("skipping application simulation") | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	var logger log.Logger | 	var logger log.Logger | ||||||
|  | 	config := simapp.NewConfigFromFlags() | ||||||
| 
 | 
 | ||||||
| 	if verbose { | 	if simapp.FlagVerboseValue { | ||||||
| 		logger = log.TestingLogger() | 		logger = log.TestingLogger() | ||||||
| 	} else { | 	} else { | ||||||
| 		logger = log.NewNopLogger() | 		logger = log.NewNopLogger() | ||||||
| @ -430,32 +339,49 @@ func TestFullAppSimulation(t *testing.T) { | |||||||
| 
 | 
 | ||||||
| 	defer func() { | 	defer func() { | ||||||
| 		db.Close() | 		db.Close() | ||||||
| 		os.RemoveAll(dir) | 		_ = os.RemoveAll(dir) | ||||||
| 	}() | 	}() | ||||||
| 
 | 
 | ||||||
| 	app := NewApp(logger, db, nil, true, 0, fauxMerkleModeOpt) | 	app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) | ||||||
| 	require.Equal(t, "kava", app.Name()) | 	require.Equal(t, "kava", app.Name()) | ||||||
| 
 | 
 | ||||||
| 	// Run randomized simulation
 | 	// Run randomized simulation
 | ||||||
| 	_, err := simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, app)) | 	_, simParams, simErr := simulation.SimulateFromSeed( | ||||||
| 	if commit { | 		t, os.Stdout, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), | ||||||
|  | 		testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, | ||||||
|  | 	) | ||||||
|  | 
 | ||||||
|  | 	// export state and params before the simulation error is checked
 | ||||||
|  | 	if config.ExportStatePath != "" { | ||||||
|  | 		err := ExportStateToJSON(app, config.ExportStatePath) | ||||||
|  | 		require.NoError(t, err) | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if config.ExportParamsPath != "" { | ||||||
|  | 		err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath) | ||||||
|  | 		require.NoError(t, err) | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	require.NoError(t, simErr) | ||||||
|  | 
 | ||||||
|  | 	if config.Commit { | ||||||
| 		// for memdb:
 | 		// for memdb:
 | ||||||
| 		// fmt.Println("Database Size", db.Stats()["database.size"])
 | 		// fmt.Println("Database Size", db.Stats()["database.size"])
 | ||||||
| 		fmt.Println("GoLevelDB Stats") | 		fmt.Println("\nGoLevelDB Stats") | ||||||
| 		fmt.Println(db.Stats()["leveldb.stats"]) | 		fmt.Println(db.Stats()["leveldb.stats"]) | ||||||
| 		fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) | 		fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) | ||||||
| 	} | 	} | ||||||
| 
 |  | ||||||
| 	require.Nil(t, err) |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestAppImportExport(t *testing.T) { | func TestAppImportExport(t *testing.T) { | ||||||
| 	if !enabled { | 	if !simapp.FlagEnabledValue { | ||||||
| 		t.Skip("Skipping application import/export simulation") | 		t.Skip("skipping application import/export simulation") | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	var logger log.Logger | 	var logger log.Logger | ||||||
| 	if verbose { | 	config := simapp.NewConfigFromFlags() | ||||||
|  | 
 | ||||||
|  | 	if simapp.FlagVerboseValue { | ||||||
| 		logger = log.TestingLogger() | 		logger = log.TestingLogger() | ||||||
| 	} else { | 	} else { | ||||||
| 		logger = log.NewNopLogger() | 		logger = log.NewNopLogger() | ||||||
| @ -467,52 +393,65 @@ func TestAppImportExport(t *testing.T) { | |||||||
| 
 | 
 | ||||||
| 	defer func() { | 	defer func() { | ||||||
| 		db.Close() | 		db.Close() | ||||||
| 		os.RemoveAll(dir) | 		_ = os.RemoveAll(dir) | ||||||
| 	}() | 	}() | ||||||
| 
 | 
 | ||||||
| 	app := NewApp(logger, db, nil, true, 0, fauxMerkleModeOpt) | 	app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) | ||||||
| 	require.Equal(t, "kava", app.Name()) | 	require.Equal(t, "kava", app.Name()) | ||||||
| 
 | 
 | ||||||
| 	// Run randomized simulation
 | 	// Run randomized simulation
 | ||||||
| 	_, err := simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, app)) | 	_, simParams, simErr := simulation.SimulateFromSeed( | ||||||
|  | 		t, os.Stdout, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), | ||||||
|  | 		testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, | ||||||
|  | 	) | ||||||
| 
 | 
 | ||||||
| 	if commit { | 	// export state and simParams before the simulation error is checked
 | ||||||
|  | 	if config.ExportStatePath != "" { | ||||||
|  | 		err := ExportStateToJSON(app, config.ExportStatePath) | ||||||
|  | 		require.NoError(t, err) | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if config.ExportParamsPath != "" { | ||||||
|  | 		err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath) | ||||||
|  | 		require.NoError(t, err) | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	require.NoError(t, simErr) | ||||||
|  | 
 | ||||||
|  | 	if config.Commit { | ||||||
| 		// for memdb:
 | 		// for memdb:
 | ||||||
| 		// fmt.Println("Database Size", db.Stats()["database.size"])
 | 		// fmt.Println("Database Size", db.Stats()["database.size"])
 | ||||||
| 		fmt.Println("GoLevelDB Stats") | 		fmt.Println("\nGoLevelDB Stats") | ||||||
| 		fmt.Println(db.Stats()["leveldb.stats"]) | 		fmt.Println(db.Stats()["leveldb.stats"]) | ||||||
| 		fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) | 		fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	require.Nil(t, err) | 	fmt.Printf("exporting genesis...\n") | ||||||
| 	fmt.Printf("Exporting genesis...\n") |  | ||||||
| 
 | 
 | ||||||
| 	appState, _, err := app.ExportAppStateAndValidators(false, []string{}) | 	appState, _, err := app.ExportAppStateAndValidators(false, []string{}) | ||||||
| 	require.NoError(t, err) | 	require.NoError(t, err) | ||||||
| 	fmt.Printf("Importing genesis...\n") | 	fmt.Printf("importing genesis...\n") | ||||||
| 
 | 
 | ||||||
| 	newDir, _ := ioutil.TempDir("", "goleveldb-app-sim-2") | 	newDir, _ := ioutil.TempDir("", "goleveldb-app-sim-2") | ||||||
| 	newDB, _ := sdk.NewLevelDB("Simulation-2", dir) | 	newDB, _ := sdk.NewLevelDB("Simulation-2", dir) | ||||||
| 
 | 
 | ||||||
| 	defer func() { | 	defer func() { | ||||||
| 		newDB.Close() | 		newDB.Close() | ||||||
| 		os.RemoveAll(newDir) | 		_ = os.RemoveAll(newDir) | ||||||
| 	}() | 	}() | ||||||
| 
 | 
 | ||||||
| 	newApp := NewApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt) | 	newApp := NewApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) | ||||||
| 	require.Equal(t, "kava", newApp.Name()) | 	require.Equal(t, "kava", newApp.Name()) | ||||||
| 
 | 
 | ||||||
| 	var genesisState simapp.GenesisState | 	var genesisState simapp.GenesisState | ||||||
| 	err = app.cdc.UnmarshalJSON(appState, &genesisState) | 	err = app.cdc.UnmarshalJSON(appState, &genesisState) | ||||||
| 	if err != nil { | 	require.NoError(t, err) | ||||||
| 		panic(err) |  | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	ctxB := newApp.NewContext(true, abci.Header{}) | 	ctxB := newApp.NewContext(true, abci.Header{Height: app.LastBlockHeight()}) | ||||||
| 	newApp.mm.InitGenesis(ctxB, genesisState) | 	newApp.mm.InitGenesis(ctxB, genesisState) | ||||||
| 
 | 
 | ||||||
| 	fmt.Printf("Comparing stores...\n") | 	fmt.Printf("comparing stores...\n") | ||||||
| 	ctxA := app.NewContext(true, abci.Header{}) | 	ctxA := app.NewContext(true, abci.Header{Height: app.LastBlockHeight()}) | ||||||
| 
 | 
 | ||||||
| 	type StoreKeysPrefixes struct { | 	type StoreKeysPrefixes struct { | ||||||
| 		A        sdk.StoreKey | 		A        sdk.StoreKey | ||||||
| @ -521,38 +460,45 @@ func TestAppImportExport(t *testing.T) { | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	storeKeysPrefixes := []StoreKeysPrefixes{ | 	storeKeysPrefixes := []StoreKeysPrefixes{ | ||||||
| 		{app.keyMain, newApp.keyMain, [][]byte{}}, | 		{app.keys[baseapp.MainStoreKey], newApp.keys[baseapp.MainStoreKey], [][]byte{}}, | ||||||
| 		{app.keyAccount, newApp.keyAccount, [][]byte{}}, | 		{app.keys[auth.StoreKey], newApp.keys[auth.StoreKey], [][]byte{}}, | ||||||
| 		{app.keyStaking, newApp.keyStaking, [][]byte{staking.UnbondingQueueKey, | 		{app.keys[staking.StoreKey], newApp.keys[staking.StoreKey], | ||||||
| 			staking.RedelegationQueueKey, staking.ValidatorQueueKey}}, // ordering may change but it doesn't matter
 | 			[][]byte{ | ||||||
| 		{app.keySlashing, newApp.keySlashing, [][]byte{}}, | 				staking.UnbondingQueueKey, staking.RedelegationQueueKey, staking.ValidatorQueueKey, | ||||||
| 		{app.keyMint, newApp.keyMint, [][]byte{}}, | 			}}, // ordering may change but it doesn't matter
 | ||||||
| 		{app.keyDistr, newApp.keyDistr, [][]byte{}}, | 		{app.keys[slashing.StoreKey], newApp.keys[slashing.StoreKey], [][]byte{}}, | ||||||
| 		{app.keySupply, newApp.keySupply, [][]byte{}}, | 		{app.keys[mint.StoreKey], newApp.keys[mint.StoreKey], [][]byte{}}, | ||||||
| 		{app.keyParams, newApp.keyParams, [][]byte{}}, | 		{app.keys[distr.StoreKey], newApp.keys[distr.StoreKey], [][]byte{}}, | ||||||
| 		{app.keyGov, newApp.keyGov, [][]byte{}}, | 		{app.keys[supply.StoreKey], newApp.keys[supply.StoreKey], [][]byte{}}, | ||||||
|  | 		{app.keys[params.StoreKey], newApp.keys[params.StoreKey], [][]byte{}}, | ||||||
|  | 		{app.keys[gov.StoreKey], newApp.keys[gov.StoreKey], [][]byte{}}, | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	for _, storeKeysPrefix := range storeKeysPrefixes { | 	for _, storeKeysPrefix := range storeKeysPrefixes { | ||||||
| 		storeKeyA := storeKeysPrefix.A | 		storeKeyA := storeKeysPrefix.A | ||||||
| 		storeKeyB := storeKeysPrefix.B | 		storeKeyB := storeKeysPrefix.B | ||||||
| 		prefixes := storeKeysPrefix.Prefixes | 		prefixes := storeKeysPrefix.Prefixes | ||||||
|  | 
 | ||||||
| 		storeA := ctxA.KVStore(storeKeyA) | 		storeA := ctxA.KVStore(storeKeyA) | ||||||
| 		storeB := ctxB.KVStore(storeKeyB) | 		storeB := ctxB.KVStore(storeKeyB) | ||||||
| 		kvA, kvB, count, equal := sdk.DiffKVStores(storeA, storeB, prefixes) |  | ||||||
| 		fmt.Printf("Compared %d key/value pairs between %s and %s\n", count, storeKeyA, storeKeyB) |  | ||||||
| 		require.True(t, equal, simapp.GetSimulationLog(storeKeyA.Name(), app.cdc, newApp.cdc, kvA, kvB)) |  | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
|  | 		failedKVAs, failedKVBs := sdk.DiffKVStores(storeA, storeB, prefixes) | ||||||
|  | 		require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") | ||||||
|  | 
 | ||||||
|  | 		fmt.Printf("compared %d key/value pairs between %s and %s\n", len(failedKVAs), storeKeyA, storeKeyB) | ||||||
|  | 		require.Len(t, failedKVAs, 0, simapp.GetSimulationLog(storeKeyA.Name(), app.sm.StoreDecoders, app.cdc, failedKVAs, failedKVBs)) | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestAppSimulationAfterImport(t *testing.T) { | func TestAppSimulationAfterImport(t *testing.T) { | ||||||
| 	if !enabled { | 	if !simapp.FlagEnabledValue { | ||||||
| 		t.Skip("Skipping application simulation after import") | 		t.Skip("skipping application simulation after import") | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	var logger log.Logger | 	var logger log.Logger | ||||||
| 	if verbose { | 	config := simapp.NewConfigFromFlags() | ||||||
|  | 
 | ||||||
|  | 	if simapp.FlagVerboseValue { | ||||||
| 		logger = log.TestingLogger() | 		logger = log.TestingLogger() | ||||||
| 	} else { | 	} else { | ||||||
| 		logger = log.NewNopLogger() | 		logger = log.NewNopLogger() | ||||||
| @ -563,25 +509,40 @@ func TestAppSimulationAfterImport(t *testing.T) { | |||||||
| 
 | 
 | ||||||
| 	defer func() { | 	defer func() { | ||||||
| 		db.Close() | 		db.Close() | ||||||
| 		os.RemoveAll(dir) | 		_ = os.RemoveAll(dir) | ||||||
| 	}() | 	}() | ||||||
| 
 | 
 | ||||||
| 	app := NewApp(logger, db, nil, true, 0, fauxMerkleModeOpt) | 	app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) | ||||||
| 	require.Equal(t, "kava", app.Name()) | 	require.Equal(t, "kava", app.Name()) | ||||||
| 
 | 
 | ||||||
| 	// Run randomized simulation
 | 	// Run randomized simulation
 | ||||||
| 	stopEarly, err := simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, app)) | 	// Run randomized simulation
 | ||||||
|  | 	stopEarly, simParams, simErr := simulation.SimulateFromSeed( | ||||||
|  | 		t, os.Stdout, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), | ||||||
|  | 		testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, | ||||||
|  | 	) | ||||||
| 
 | 
 | ||||||
| 	if commit { | 	// export state and params before the simulation error is checked
 | ||||||
|  | 	if config.ExportStatePath != "" { | ||||||
|  | 		err := ExportStateToJSON(app, config.ExportStatePath) | ||||||
|  | 		require.NoError(t, err) | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if config.ExportParamsPath != "" { | ||||||
|  | 		err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath) | ||||||
|  | 		require.NoError(t, err) | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	require.NoError(t, simErr) | ||||||
|  | 
 | ||||||
|  | 	if config.Commit { | ||||||
| 		// for memdb:
 | 		// for memdb:
 | ||||||
| 		// fmt.Println("Database Size", db.Stats()["database.size"])
 | 		// fmt.Println("Database Size", db.Stats()["database.size"])
 | ||||||
| 		fmt.Println("GoLevelDB Stats") | 		fmt.Println("\nGoLevelDB Stats") | ||||||
| 		fmt.Println(db.Stats()["leveldb.stats"]) | 		fmt.Println(db.Stats()["leveldb.stats"]) | ||||||
| 		fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) | 		fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	require.Nil(t, err) |  | ||||||
| 
 |  | ||||||
| 	if stopEarly { | 	if stopEarly { | ||||||
| 		// we can't export or import a zero-validator genesis
 | 		// we can't export or import a zero-validator genesis
 | ||||||
| 		fmt.Printf("We can't export or import a zero-validator genesis, exiting test...\n") | 		fmt.Printf("We can't export or import a zero-validator genesis, exiting test...\n") | ||||||
| @ -602,64 +563,80 @@ func TestAppSimulationAfterImport(t *testing.T) { | |||||||
| 
 | 
 | ||||||
| 	defer func() { | 	defer func() { | ||||||
| 		newDB.Close() | 		newDB.Close() | ||||||
| 		os.RemoveAll(newDir) | 		_ = os.RemoveAll(newDir) | ||||||
| 	}() | 	}() | ||||||
| 
 | 
 | ||||||
| 	newApp := NewApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt) | 	newApp := NewApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt) | ||||||
| 	require.Equal(t, "kava", newApp.Name()) | 	require.Equal(t, "kava", newApp.Name()) | ||||||
|  | 
 | ||||||
| 	newApp.InitChain(abci.RequestInitChain{ | 	newApp.InitChain(abci.RequestInitChain{ | ||||||
| 		AppStateBytes: appState, | 		AppStateBytes: appState, | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	// Run randomized simulation on imported app
 | 	// Run randomized simulation on imported app
 | ||||||
| 	_, err = simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, newApp)) | 	_, _, err = simulation.SimulateFromSeed( | ||||||
| 	require.Nil(t, err) | 		t, os.Stdout, newApp.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), | ||||||
|  | 		testAndRunTxs(newApp, config), newApp.ModuleAccountAddrs(), config, | ||||||
|  | 	) | ||||||
|  | 
 | ||||||
|  | 	require.NoError(t, err) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TODO: Make another test for the fuzzer itself, which just has noOp txs
 | // TODO: Make another test for the fuzzer itself, which just has noOp txs
 | ||||||
| // and doesn't depend on the application.
 | // and doesn't depend on the application.
 | ||||||
| func TestAppStateDeterminism(t *testing.T) { | func TestAppStateDeterminism(t *testing.T) { | ||||||
| 	if !enabled { | 	if !simapp.FlagEnabledValue { | ||||||
| 		t.Skip("Skipping application simulation") | 		t.Skip("skipping application simulation") | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	config := simapp.NewConfigFromFlags() | ||||||
|  | 	config.InitialBlockHeight = 1 | ||||||
|  | 	config.ExportParamsPath = "" | ||||||
|  | 	config.OnOperation = false | ||||||
|  | 	config.AllInvariants = false | ||||||
|  | 
 | ||||||
| 	numSeeds := 3 | 	numSeeds := 3 | ||||||
| 	numTimesToRunPerSeed := 5 | 	numTimesToRunPerSeed := 5 | ||||||
| 	appHashList := make([]json.RawMessage, numTimesToRunPerSeed) | 	appHashList := make([]json.RawMessage, numTimesToRunPerSeed) | ||||||
| 
 | 
 | ||||||
| 	for i := 0; i < numSeeds; i++ { | 	for i := 0; i < numSeeds; i++ { | ||||||
| 		seed := rand.Int63() | 		config.Seed = rand.Int63() | ||||||
|  | 
 | ||||||
| 		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, 0) | 			app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) | ||||||
| 
 | 
 | ||||||
| 			// run randomized simulation
 | 			fmt.Printf( | ||||||
| 			simulation.SimulateFromSeed( | 				"running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", | ||||||
| 				t, os.Stdout, app.BaseApp, appStateFn, seed, | 				config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, | ||||||
| 				testAndRunTxs(app), |  | ||||||
| 				[]sdk.Invariant{}, |  | ||||||
| 				50, |  | ||||||
| 				100, |  | ||||||
| 				true, |  | ||||||
| 				false, |  | ||||||
| 				false, |  | ||||||
| 				false, |  | ||||||
| 				app.ModuleAccountAddrs(), |  | ||||||
| 			) | 			) | ||||||
| 
 | 
 | ||||||
|  | 			_, _, err := simulation.SimulateFromSeed( | ||||||
|  | 				t, os.Stdout, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), | ||||||
|  | 				testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, | ||||||
|  | 			) | ||||||
|  | 			require.NoError(t, err) | ||||||
|  | 
 | ||||||
| 			appHash := app.LastCommitID().Hash | 			appHash := app.LastCommitID().Hash | ||||||
| 			appHashList[j] = appHash | 			appHashList[j] = appHash | ||||||
| 		} |  | ||||||
| 
 | 
 | ||||||
| 		for k := 1; k < numTimesToRunPerSeed; k++ { | 			if j != 0 { | ||||||
| 			require.Equal(t, appHashList[0], appHashList[k], "appHash list: %v", appHashList) | 				require.Equal( | ||||||
|  | 					t, appHashList[0], appHashList[j], | ||||||
|  | 					"non-determinism in seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, | ||||||
|  | 				) | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func BenchmarkInvariants(b *testing.B) { | func BenchmarkInvariants(b *testing.B) { | ||||||
| 	logger := log.NewNopLogger() | 	logger := log.NewNopLogger() | ||||||
|  | 
 | ||||||
|  | 	config := simapp.NewConfigFromFlags() | ||||||
|  | 	config.AllInvariants = false | ||||||
|  | 
 | ||||||
| 	dir, _ := ioutil.TempDir("", "goleveldb-app-invariant-bench") | 	dir, _ := ioutil.TempDir("", "goleveldb-app-invariant-bench") | ||||||
| 	db, _ := sdk.NewLevelDB("simulation", dir) | 	db, _ := sdk.NewLevelDB("simulation", dir) | ||||||
| 
 | 
 | ||||||
| @ -668,16 +645,31 @@ func BenchmarkInvariants(b *testing.B) { | |||||||
| 		os.RemoveAll(dir) | 		os.RemoveAll(dir) | ||||||
| 	}() | 	}() | ||||||
| 
 | 
 | ||||||
| 	app := NewApp(logger, db, nil, true, 0) | 	app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) | ||||||
| 
 | 
 | ||||||
| 	// 2. Run parameterized simulation (w/o invariants)
 | 	// 2. Run parameterized simulation (w/o invariants)
 | ||||||
| 	_, err := simulation.SimulateFromSeed( | 	_, simParams, simErr := simulation.SimulateFromSeed( | ||||||
| 		b, ioutil.Discard, app.BaseApp, appStateFn, seed, testAndRunTxs(app), | 		b, ioutil.Discard, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), | ||||||
| 		[]sdk.Invariant{}, numBlocks, blockSize, commit, lean, onOperation, false, | 		testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, | ||||||
| 		app.ModuleAccountAddrs(), |  | ||||||
| 	) | 	) | ||||||
| 	if err != nil { | 
 | ||||||
|  | 	// export state and params before the simulation error is checked
 | ||||||
|  | 	if config.ExportStatePath != "" { | ||||||
|  | 		if err := ExportStateToJSON(app, config.ExportStatePath); err != nil { | ||||||
| 			fmt.Println(err) | 			fmt.Println(err) | ||||||
|  | 			b.Fail() | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if config.ExportParamsPath != "" { | ||||||
|  | 		if err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath); err != nil { | ||||||
|  | 			fmt.Println(err) | ||||||
|  | 			b.Fail() | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if simErr != nil { | ||||||
|  | 		fmt.Println(simErr) | ||||||
| 		b.FailNow() | 		b.FailNow() | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| @ -689,10 +681,12 @@ func BenchmarkInvariants(b *testing.B) { | |||||||
| 	// their respective metadata which makes it useful for testing/benchmarking.
 | 	// their respective metadata which makes it useful for testing/benchmarking.
 | ||||||
| 	for _, cr := range app.crisisKeeper.Routes() { | 	for _, cr := range app.crisisKeeper.Routes() { | ||||||
| 		b.Run(fmt.Sprintf("%s/%s", cr.ModuleName, cr.Route), func(b *testing.B) { | 		b.Run(fmt.Sprintf("%s/%s", cr.ModuleName, cr.Route), func(b *testing.B) { | ||||||
|  | 			for n := 0; n < b.N; n++ { | ||||||
| 				if res, stop := cr.Invar(ctx); stop { | 				if res, stop := cr.Invar(ctx); stop { | ||||||
| 				fmt.Printf("broken invariant at block %d of %d\n%s", ctx.BlockHeight()-1, numBlocks, res) | 					fmt.Printf("broken invariant at block %d of %d\n%s", ctx.BlockHeight()-1, config.NumBlocks, res) | ||||||
| 					b.FailNow() | 					b.FailNow() | ||||||
| 				} | 				} | ||||||
|  | 			} | ||||||
| 		}) | 		}) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										17
									
								
								app/utils.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								app/utils.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | |||||||
|  | package app | ||||||
|  | 
 | ||||||
|  | import ( | ||||||
|  | 	"fmt" | ||||||
|  | 	"io/ioutil" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | // ExportStateToJSON util function to export the app state to JSON
 | ||||||
|  | func ExportStateToJSON(app *App, path string) error { | ||||||
|  | 	fmt.Println("exporting app state...") | ||||||
|  | 	appState, _, err := app.ExportAppStateAndValidators(false, nil) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	return ioutil.WriteFile(path, []byte(appState), 0644) | ||||||
|  | } | ||||||
| @ -3,6 +3,7 @@ | |||||||
| Run the full suite: | Run the full suite: | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | make build | ||||||
| go test -v -p 4 ./cli_test -tags cli_test | go test -v -p 4 ./cli_test -tags cli_test | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| @ -10,4 +11,4 @@ go test -v -p 4 ./cli_test -tags cli_test | |||||||
| 
 | 
 | ||||||
| > NOTE: While the full suite runs in parallel, some of the tests can take up to a minute to complete | > NOTE: While the full suite runs in parallel, some of the tests can take up to a minute to complete | ||||||
| 
 | 
 | ||||||
| > NOTE: The tests will use the `kvd` or `kvcli` binaries in your `$GOPATH/bin`. Or in `$BUILDDIR` if that env var is set. | > NOTE: The tests will use the `kvd` or `kvcli` binaries in the build dir. Or in `$BUILDDIR` if that env var is set. | ||||||
|  | |||||||
| @ -14,15 +14,17 @@ import ( | |||||||
| 	"testing" | 	"testing" | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
| 	"github.com/tendermint/tendermint/crypto/ed25519" |  | ||||||
| 
 |  | ||||||
| 	"github.com/stretchr/testify/require" | 	"github.com/stretchr/testify/require" | ||||||
| 
 | 
 | ||||||
|  | 	"github.com/tendermint/tendermint/crypto/ed25519" | ||||||
|  | 	tmtypes "github.com/tendermint/tendermint/types" | ||||||
|  | 
 | ||||||
| 	"github.com/cosmos/cosmos-sdk/client" | 	"github.com/cosmos/cosmos-sdk/client" | ||||||
| 	"github.com/cosmos/cosmos-sdk/tests" | 	"github.com/cosmos/cosmos-sdk/tests" | ||||||
| 	sdk "github.com/cosmos/cosmos-sdk/types" | 	sdk "github.com/cosmos/cosmos-sdk/types" | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/auth" | 	"github.com/cosmos/cosmos-sdk/x/auth" | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/gov" | 	"github.com/cosmos/cosmos-sdk/x/gov" | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/x/mint" | ||||||
| 
 | 
 | ||||||
| 	"github.com/kava-labs/kava/app" | 	"github.com/kava-labs/kava/app" | ||||||
| ) | ) | ||||||
| @ -45,6 +47,9 @@ func TestGaiaCLIKeysAddMultisig(t *testing.T) { | |||||||
| 		fmt.Sprintf("--multisig=%s,%s", keyBaz, keyBar), | 		fmt.Sprintf("--multisig=%s,%s", keyBaz, keyBar), | ||||||
| 		"--nosort") | 		"--nosort") | ||||||
| 	require.NotEqual(t, f.KeysShow("msig3").Address, f.KeysShow("msig4").Address) | 	require.NotEqual(t, f.KeysShow("msig3").Address, f.KeysShow("msig4").Address) | ||||||
|  | 
 | ||||||
|  | 	// Cleanup testing directories
 | ||||||
|  | 	f.Cleanup() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestGaiaCLIKeysAddRecover(t *testing.T) { | func TestGaiaCLIKeysAddRecover(t *testing.T) { | ||||||
| @ -56,7 +61,10 @@ func TestGaiaCLIKeysAddRecover(t *testing.T) { | |||||||
| 
 | 
 | ||||||
| 	exitSuccess, _, _ = f.KeysAddRecover("test-recover", "dentist task convince chimney quality leave banana trade firm crawl eternal easily") | 	exitSuccess, _, _ = f.KeysAddRecover("test-recover", "dentist task convince chimney quality leave banana trade firm crawl eternal easily") | ||||||
| 	require.True(t, exitSuccess) | 	require.True(t, exitSuccess) | ||||||
| 	require.Equal(t, "k1qcfdf69js922qrdr4yaww3ax7gjml6pd3fmkx7", f.KeyAddress("test-recover").String()) | 	require.Equal(t, "kava1qcfdf69js922qrdr4yaww3ax7gjml6pd39p8lj", f.KeyAddress("test-recover").String()) | ||||||
|  | 
 | ||||||
|  | 	// Cleanup testing directories
 | ||||||
|  | 	f.Cleanup() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestGaiaCLIKeysAddRecoverHDPath(t *testing.T) { | func TestGaiaCLIKeysAddRecoverHDPath(t *testing.T) { | ||||||
| @ -64,16 +72,19 @@ func TestGaiaCLIKeysAddRecoverHDPath(t *testing.T) { | |||||||
| 	f := InitFixtures(t) | 	f := InitFixtures(t) | ||||||
| 
 | 
 | ||||||
| 	f.KeysAddRecoverHDPath("test-recoverHD1", "dentist task convince chimney quality leave banana trade firm crawl eternal easily", 0, 0) | 	f.KeysAddRecoverHDPath("test-recoverHD1", "dentist task convince chimney quality leave banana trade firm crawl eternal easily", 0, 0) | ||||||
| 	require.Equal(t, "k1qcfdf69js922qrdr4yaww3ax7gjml6pd3fmkx7", f.KeyAddress("test-recoverHD1").String()) | 	require.Equal(t, "kava1qcfdf69js922qrdr4yaww3ax7gjml6pd39p8lj", f.KeyAddress("test-recoverHD1").String()) | ||||||
| 
 | 
 | ||||||
| 	f.KeysAddRecoverHDPath("test-recoverH2", "dentist task convince chimney quality leave banana trade firm crawl eternal easily", 1, 5) | 	f.KeysAddRecoverHDPath("test-recoverH2", "dentist task convince chimney quality leave banana trade firm crawl eternal easily", 1, 5) | ||||||
| 	require.Equal(t, "k1pdfav2cjhry9k79nu6r8kgknnjtq6a7rc043x0", f.KeyAddress("test-recoverH2").String()) | 	require.Equal(t, "kava1pdfav2cjhry9k79nu6r8kgknnjtq6a7rcr0qlr", f.KeyAddress("test-recoverH2").String()) | ||||||
| 
 | 
 | ||||||
| 	f.KeysAddRecoverHDPath("test-recoverH3", "dentist task convince chimney quality leave banana trade firm crawl eternal easily", 1, 17) | 	f.KeysAddRecoverHDPath("test-recoverH3", "dentist task convince chimney quality leave banana trade firm crawl eternal easily", 1, 17) | ||||||
| 	require.Equal(t, "k1909k354n6wl8ujzu6kmh49w4d02ax7qvr0zelc", f.KeyAddress("test-recoverH3").String()) | 	require.Equal(t, "kava1909k354n6wl8ujzu6kmh49w4d02ax7qvrrcgx5", f.KeyAddress("test-recoverH3").String()) | ||||||
| 
 | 
 | ||||||
| 	f.KeysAddRecoverHDPath("test-recoverH4", "dentist task convince chimney quality leave banana trade firm crawl eternal easily", 2, 17) | 	f.KeysAddRecoverHDPath("test-recoverH4", "dentist task convince chimney quality leave banana trade firm crawl eternal easily", 2, 17) | ||||||
| 	require.Equal(t, "k1v9plmhvyhgxk3th9ydacm7j4z357s3nhhh77jq", f.KeyAddress("test-recoverH4").String()) | 	require.Equal(t, "kava1v9plmhvyhgxk3th9ydacm7j4z357s3nhhmy0tv", f.KeyAddress("test-recoverH4").String()) | ||||||
|  | 
 | ||||||
|  | 	// Cleanup testing directories
 | ||||||
|  | 	f.Cleanup() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestGaiaCLIMinimumFees(t *testing.T) { | func TestGaiaCLIMinimumFees(t *testing.T) { | ||||||
| @ -93,8 +104,9 @@ func TestGaiaCLIMinimumFees(t *testing.T) { | |||||||
| 	barAddr := f.KeyAddress(keyBar) | 	barAddr := f.KeyAddress(keyBar) | ||||||
| 
 | 
 | ||||||
| 	// Send a transaction that will get rejected
 | 	// Send a transaction that will get rejected
 | ||||||
| 	success, _, _ := f.TxSend(keyFoo, barAddr, sdk.NewInt64Coin(fee2Denom, 10), "-y") | 	success, stdOut, _ := f.TxSend(keyFoo, barAddr, sdk.NewInt64Coin(fee2Denom, 10), "-y") | ||||||
| 	require.False(f.T, success) | 	require.Contains(t, stdOut, "insufficient fees") | ||||||
|  | 	require.True(f.T, success) | ||||||
| 	tests.WaitForNextNBlocksTM(1, f.Port) | 	tests.WaitForNextNBlocksTM(1, f.Port) | ||||||
| 
 | 
 | ||||||
| 	// Ensure tx w/ correct fees pass
 | 	// Ensure tx w/ correct fees pass
 | ||||||
| @ -105,8 +117,9 @@ func TestGaiaCLIMinimumFees(t *testing.T) { | |||||||
| 
 | 
 | ||||||
| 	// Ensure tx w/ improper fees fails
 | 	// Ensure tx w/ improper fees fails
 | ||||||
| 	txFees = fmt.Sprintf("--fees=%s", sdk.NewInt64Coin(feeDenom, 1)) | 	txFees = fmt.Sprintf("--fees=%s", sdk.NewInt64Coin(feeDenom, 1)) | ||||||
| 	success, _, _ = f.TxSend(keyFoo, barAddr, sdk.NewInt64Coin(fooDenom, 10), txFees, "-y") | 	success, stdOut, _ = f.TxSend(keyFoo, barAddr, sdk.NewInt64Coin(fooDenom, 10), txFees, "-y") | ||||||
| 	require.False(f.T, success) | 	require.Contains(t, stdOut, "insufficient fees") | ||||||
|  | 	require.True(f.T, success) | ||||||
| 
 | 
 | ||||||
| 	// Cleanup testing directories
 | 	// Cleanup testing directories
 | ||||||
| 	f.Cleanup() | 	f.Cleanup() | ||||||
| @ -125,10 +138,11 @@ func TestGaiaCLIGasPrices(t *testing.T) { | |||||||
| 
 | 
 | ||||||
| 	// insufficient gas prices (tx fails)
 | 	// insufficient gas prices (tx fails)
 | ||||||
| 	badGasPrice, _ := sdk.NewDecFromStr("0.000003") | 	badGasPrice, _ := sdk.NewDecFromStr("0.000003") | ||||||
| 	success, _, _ := f.TxSend( | 	success, stdOut, _ := f.TxSend( | ||||||
| 		keyFoo, barAddr, sdk.NewInt64Coin(fooDenom, 50), | 		keyFoo, barAddr, sdk.NewInt64Coin(fooDenom, 50), | ||||||
| 		fmt.Sprintf("--gas-prices=%s", sdk.NewDecCoinFromDec(feeDenom, badGasPrice)), "-y") | 		fmt.Sprintf("--gas-prices=%s", sdk.NewDecCoinFromDec(feeDenom, badGasPrice)), "-y") | ||||||
| 	require.False(t, success) | 	require.Contains(t, stdOut, "insufficient fees") | ||||||
|  | 	require.True(t, success) | ||||||
| 
 | 
 | ||||||
| 	// wait for a block confirmation
 | 	// wait for a block confirmation
 | ||||||
| 	tests.WaitForNextNBlocksTM(1, f.Port) | 	tests.WaitForNextNBlocksTM(1, f.Port) | ||||||
| @ -175,11 +189,12 @@ func TestGaiaCLIFeesDeduction(t *testing.T) { | |||||||
| 	require.Equal(t, fooAmt.Int64(), fooAcc.GetCoins().AmountOf(fooDenom).Int64()) | 	require.Equal(t, fooAmt.Int64(), fooAcc.GetCoins().AmountOf(fooDenom).Int64()) | ||||||
| 
 | 
 | ||||||
| 	// insufficient funds (coins + fees) tx fails
 | 	// insufficient funds (coins + fees) tx fails
 | ||||||
| 	largeCoins := sdk.TokensFromTendermintPower(10000000) | 	largeCoins := sdk.TokensFromConsensusPower(10000000) | ||||||
| 	success, _, _ = f.TxSend( | 	success, stdOut, _ := f.TxSend( | ||||||
| 		keyFoo, barAddr, sdk.NewCoin(fooDenom, largeCoins), | 		keyFoo, barAddr, sdk.NewCoin(fooDenom, largeCoins), | ||||||
| 		fmt.Sprintf("--fees=%s", sdk.NewInt64Coin(feeDenom, 2)), "-y") | 		fmt.Sprintf("--fees=%s", sdk.NewInt64Coin(feeDenom, 2)), "-y") | ||||||
| 	require.False(t, success) | 	require.Contains(t, stdOut, "insufficient account funds") | ||||||
|  | 	require.True(t, success) | ||||||
| 
 | 
 | ||||||
| 	// Wait for a block
 | 	// Wait for a block
 | ||||||
| 	tests.WaitForNextNBlocksTM(1, f.Port) | 	tests.WaitForNextNBlocksTM(1, f.Port) | ||||||
| @ -210,11 +225,11 @@ func TestGaiaCLISend(t *testing.T) { | |||||||
| 	barAddr := f.KeyAddress(keyBar) | 	barAddr := f.KeyAddress(keyBar) | ||||||
| 
 | 
 | ||||||
| 	fooAcc := f.QueryAccount(fooAddr) | 	fooAcc := f.QueryAccount(fooAddr) | ||||||
| 	startTokens := sdk.TokensFromTendermintPower(50) | 	startTokens := sdk.TokensFromConsensusPower(50) | ||||||
| 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) | 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) | ||||||
| 
 | 
 | ||||||
| 	// Send some tokens from one account to the other
 | 	// Send some tokens from one account to the other
 | ||||||
| 	sendTokens := sdk.TokensFromTendermintPower(10) | 	sendTokens := sdk.TokensFromConsensusPower(10) | ||||||
| 	f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "-y") | 	f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "-y") | ||||||
| 	tests.WaitForNextNBlocksTM(1, f.Port) | 	tests.WaitForNextNBlocksTM(1, f.Port) | ||||||
| 
 | 
 | ||||||
| @ -228,6 +243,17 @@ func TestGaiaCLISend(t *testing.T) { | |||||||
| 	success, _, _ := f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--dry-run") | 	success, _, _ := f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--dry-run") | ||||||
| 	require.True(t, success) | 	require.True(t, success) | ||||||
| 
 | 
 | ||||||
|  | 	// Test --generate-only
 | ||||||
|  | 	success, stdout, stderr := f.TxSend( | ||||||
|  | 		fooAddr.String(), barAddr, sdk.NewCoin(denom, sendTokens), "--generate-only=true", | ||||||
|  | 	) | ||||||
|  | 	require.Empty(t, stderr) | ||||||
|  | 	require.True(t, success) | ||||||
|  | 	msg := unmarshalStdTx(f.T, stdout) | ||||||
|  | 	require.NotZero(t, msg.Fee.Gas) | ||||||
|  | 	require.Len(t, msg.Msgs, 1) | ||||||
|  | 	require.Len(t, msg.GetSignatures(), 0) | ||||||
|  | 
 | ||||||
| 	// Check state didn't change
 | 	// Check state didn't change
 | ||||||
| 	fooAcc = f.QueryAccount(fooAddr) | 	fooAcc = f.QueryAccount(fooAddr) | ||||||
| 	require.Equal(t, startTokens.Sub(sendTokens), fooAcc.GetCoins().AmountOf(denom)) | 	require.Equal(t, startTokens.Sub(sendTokens), fooAcc.GetCoins().AmountOf(denom)) | ||||||
| @ -255,6 +281,7 @@ func TestGaiaCLISend(t *testing.T) { | |||||||
| 	f.Cleanup() | 	f.Cleanup() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // Note: this was removed from gaia due to update in sdk PR#4062 but is now working
 | ||||||
| func TestGaiaCLIConfirmTx(t *testing.T) { | func TestGaiaCLIConfirmTx(t *testing.T) { | ||||||
| 	t.Parallel() | 	t.Parallel() | ||||||
| 	f := InitFixtures(t) | 	f := InitFixtures(t) | ||||||
| @ -268,12 +295,12 @@ func TestGaiaCLIConfirmTx(t *testing.T) { | |||||||
| 	barAddr := f.KeyAddress(keyBar) | 	barAddr := f.KeyAddress(keyBar) | ||||||
| 
 | 
 | ||||||
| 	fooAcc := f.QueryAccount(fooAddr) | 	fooAcc := f.QueryAccount(fooAddr) | ||||||
| 	startTokens := sdk.TokensFromTendermintPower(50) | 	startTokens := sdk.TokensFromConsensusPower(50) | ||||||
| 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) | 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) | ||||||
| 
 | 
 | ||||||
| 	// send some tokens from one account to the other
 | 	// send some tokens from one account to the other
 | ||||||
| 	sendTokens := sdk.TokensFromTendermintPower(10) | 	sendTokens := sdk.TokensFromConsensusPower(10) | ||||||
| 	f.txSendWithConfirm(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "Y") | 	f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "-y") | ||||||
| 	tests.WaitForNextNBlocksTM(1, f.Port) | 	tests.WaitForNextNBlocksTM(1, f.Port) | ||||||
| 
 | 
 | ||||||
| 	// ensure account balances match expected
 | 	// ensure account balances match expected
 | ||||||
| @ -281,7 +308,7 @@ func TestGaiaCLIConfirmTx(t *testing.T) { | |||||||
| 	require.Equal(t, sendTokens, barAcc.GetCoins().AmountOf(denom)) | 	require.Equal(t, sendTokens, barAcc.GetCoins().AmountOf(denom)) | ||||||
| 
 | 
 | ||||||
| 	// send some tokens from one account to the other (cancelling confirmation)
 | 	// send some tokens from one account to the other (cancelling confirmation)
 | ||||||
| 	f.txSendWithConfirm(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "n") | 	f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "-n") | ||||||
| 	tests.WaitForNextNBlocksTM(1, f.Port) | 	tests.WaitForNextNBlocksTM(1, f.Port) | ||||||
| 
 | 
 | ||||||
| 	// ensure account balances match expected
 | 	// ensure account balances match expected
 | ||||||
| @ -301,13 +328,14 @@ func TestGaiaCLIGasAuto(t *testing.T) { | |||||||
| 	barAddr := f.KeyAddress(keyBar) | 	barAddr := f.KeyAddress(keyBar) | ||||||
| 
 | 
 | ||||||
| 	fooAcc := f.QueryAccount(fooAddr) | 	fooAcc := f.QueryAccount(fooAddr) | ||||||
| 	startTokens := sdk.TokensFromTendermintPower(50) | 	startTokens := sdk.TokensFromConsensusPower(50) | ||||||
| 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) | 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) | ||||||
| 
 | 
 | ||||||
| 	// Test failure with auto gas disabled and very little gas set by hand
 | 	// Test failure with auto gas disabled and very little gas set by hand
 | ||||||
| 	sendTokens := sdk.TokensFromTendermintPower(10) | 	sendTokens := sdk.TokensFromConsensusPower(10) | ||||||
| 	success, _, _ := f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=10", "-y") | 	success, stdOut, _ := f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=10", "-y") | ||||||
| 	require.False(t, success) | 	require.Contains(t, stdOut, "out of gas in location") | ||||||
|  | 	require.True(t, success) | ||||||
| 
 | 
 | ||||||
| 	// Check state didn't change
 | 	// Check state didn't change
 | ||||||
| 	fooAcc = f.QueryAccount(fooAddr) | 	fooAcc = f.QueryAccount(fooAddr) | ||||||
| @ -322,8 +350,9 @@ func TestGaiaCLIGasAuto(t *testing.T) { | |||||||
| 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) | 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) | ||||||
| 
 | 
 | ||||||
| 	// Test failure with 0 gas
 | 	// Test failure with 0 gas
 | ||||||
| 	success, _, _ = f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=0", "-y") | 	success, stdOut, _ = f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=0", "-y") | ||||||
| 	require.False(t, success) | 	require.Contains(t, stdOut, "out of gas in location") | ||||||
|  | 	require.True(t, success) | ||||||
| 
 | 
 | ||||||
| 	// Check state didn't change
 | 	// Check state didn't change
 | ||||||
| 	fooAcc = f.QueryAccount(fooAddr) | 	fooAcc = f.QueryAccount(fooAddr) | ||||||
| @ -360,7 +389,7 @@ func TestGaiaCLICreateValidator(t *testing.T) { | |||||||
| 
 | 
 | ||||||
| 	consPubKey := sdk.MustBech32ifyConsPub(ed25519.GenPrivKey().PubKey()) | 	consPubKey := sdk.MustBech32ifyConsPub(ed25519.GenPrivKey().PubKey()) | ||||||
| 
 | 
 | ||||||
| 	sendTokens := sdk.TokensFromTendermintPower(10) | 	sendTokens := sdk.TokensFromConsensusPower(10) | ||||||
| 	f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "-y") | 	f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "-y") | ||||||
| 	tests.WaitForNextNBlocksTM(1, f.Port) | 	tests.WaitForNextNBlocksTM(1, f.Port) | ||||||
| 
 | 
 | ||||||
| @ -378,7 +407,7 @@ func TestGaiaCLICreateValidator(t *testing.T) { | |||||||
| 	require.Equal(t, 0, len(msg.GetSignatures())) | 	require.Equal(t, 0, len(msg.GetSignatures())) | ||||||
| 
 | 
 | ||||||
| 	// Test --dry-run
 | 	// Test --dry-run
 | ||||||
| 	newValTokens := sdk.TokensFromTendermintPower(2) | 	newValTokens := sdk.TokensFromConsensusPower(2) | ||||||
| 	success, _, _ = f.TxStakingCreateValidator(keyBar, consPubKey, sdk.NewCoin(denom, newValTokens), "--dry-run") | 	success, _, _ = f.TxStakingCreateValidator(keyBar, consPubKey, sdk.NewCoin(denom, newValTokens), "--dry-run") | ||||||
| 	require.True(t, success) | 	require.True(t, success) | ||||||
| 
 | 
 | ||||||
| @ -401,7 +430,7 @@ func TestGaiaCLICreateValidator(t *testing.T) { | |||||||
| 	require.NotZero(t, validatorDelegations[0].Shares) | 	require.NotZero(t, validatorDelegations[0].Shares) | ||||||
| 
 | 
 | ||||||
| 	// unbond a single share
 | 	// unbond a single share
 | ||||||
| 	unbondAmt := sdk.NewCoin(sdk.DefaultBondDenom, sdk.TokensFromTendermintPower(1)) | 	unbondAmt := sdk.NewCoin(sdk.DefaultBondDenom, sdk.TokensFromConsensusPower(1)) | ||||||
| 	success = f.TxStakingUnbond(keyBar, unbondAmt.String(), barVal, "-y") | 	success = f.TxStakingUnbond(keyBar, unbondAmt.String(), barVal, "-y") | ||||||
| 	require.True(t, success) | 	require.True(t, success) | ||||||
| 	tests.WaitForNextNBlocksTM(1, f.Port) | 	tests.WaitForNextNBlocksTM(1, f.Port) | ||||||
| @ -420,6 +449,56 @@ func TestGaiaCLICreateValidator(t *testing.T) { | |||||||
| 	f.Cleanup() | 	f.Cleanup() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func TestGaiaCLIQueryRewards(t *testing.T) { | ||||||
|  | 	t.Parallel() | ||||||
|  | 	f := InitFixtures(t) | ||||||
|  | 	cdc := app.MakeCodec() | ||||||
|  | 
 | ||||||
|  | 	genesisState := f.GenesisState() | ||||||
|  | 	inflationMin := sdk.MustNewDecFromStr("10000.0") | ||||||
|  | 	var mintData mint.GenesisState | ||||||
|  | 	cdc.UnmarshalJSON(genesisState[mint.ModuleName], &mintData) | ||||||
|  | 	mintData.Minter.Inflation = inflationMin | ||||||
|  | 	mintData.Params.InflationMin = inflationMin | ||||||
|  | 	mintData.Params.InflationMax = sdk.MustNewDecFromStr("15000.0") | ||||||
|  | 	mintDataBz, err := cdc.MarshalJSON(mintData) | ||||||
|  | 	require.NoError(t, err) | ||||||
|  | 	genesisState[mint.ModuleName] = mintDataBz | ||||||
|  | 
 | ||||||
|  | 	genFile := filepath.Join(f.GaiadHome, "config", "genesis.json") | ||||||
|  | 	genDoc, err := tmtypes.GenesisDocFromFile(genFile) | ||||||
|  | 	require.NoError(t, err) | ||||||
|  | 	genDoc.AppState, err = cdc.MarshalJSON(genesisState) | ||||||
|  | 	require.NoError(t, genDoc.SaveAs(genFile)) | ||||||
|  | 
 | ||||||
|  | 	// start gaiad server
 | ||||||
|  | 	proc := f.GDStart() | ||||||
|  | 	defer proc.Stop(false) | ||||||
|  | 
 | ||||||
|  | 	fooAddr := f.KeyAddress(keyFoo) | ||||||
|  | 	rewards := f.QueryRewards(fooAddr) | ||||||
|  | 	require.Equal(t, 1, len(rewards.Rewards)) | ||||||
|  | 
 | ||||||
|  | 	f.Cleanup() | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func TestGaiaCLIQuerySupply(t *testing.T) { | ||||||
|  | 	t.Parallel() | ||||||
|  | 	f := InitFixtures(t) | ||||||
|  | 
 | ||||||
|  | 	// start gaiad server
 | ||||||
|  | 	proc := f.GDStart() | ||||||
|  | 	defer proc.Stop(false) | ||||||
|  | 
 | ||||||
|  | 	totalSupply := f.QueryTotalSupply() | ||||||
|  | 	totalSupplyOf := f.QueryTotalSupplyOf(fooDenom) | ||||||
|  | 
 | ||||||
|  | 	require.Equal(t, totalCoins, totalSupply) | ||||||
|  | 	require.True(sdk.IntEq(t, totalCoins.AmountOf(fooDenom), totalSupplyOf)) | ||||||
|  | 
 | ||||||
|  | 	f.Cleanup() | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func TestGaiaCLISubmitProposal(t *testing.T) { | func TestGaiaCLISubmitProposal(t *testing.T) { | ||||||
| 	t.Parallel() | 	t.Parallel() | ||||||
| 	f := InitFixtures(t) | 	f := InitFixtures(t) | ||||||
| @ -435,14 +514,14 @@ func TestGaiaCLISubmitProposal(t *testing.T) { | |||||||
| 	fooAddr := f.KeyAddress(keyFoo) | 	fooAddr := f.KeyAddress(keyFoo) | ||||||
| 
 | 
 | ||||||
| 	fooAcc := f.QueryAccount(fooAddr) | 	fooAcc := f.QueryAccount(fooAddr) | ||||||
| 	startTokens := sdk.TokensFromTendermintPower(50) | 	startTokens := sdk.TokensFromConsensusPower(50) | ||||||
| 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(sdk.DefaultBondDenom)) | 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(sdk.DefaultBondDenom)) | ||||||
| 
 | 
 | ||||||
| 	proposalsQuery := f.QueryGovProposals() | 	proposalsQuery := f.QueryGovProposals() | ||||||
| 	require.Empty(t, proposalsQuery) | 	require.Empty(t, proposalsQuery) | ||||||
| 
 | 
 | ||||||
| 	// Test submit generate only for submit proposal
 | 	// Test submit generate only for submit proposal
 | ||||||
| 	proposalTokens := sdk.TokensFromTendermintPower(5) | 	proposalTokens := sdk.TokensFromConsensusPower(5) | ||||||
| 	success, stdout, stderr := f.TxGovSubmitProposal( | 	success, stdout, stderr := f.TxGovSubmitProposal( | ||||||
| 		fooAddr.String(), "Text", "Test", "test", sdk.NewCoin(denom, proposalTokens), "--generate-only", "-y") | 		fooAddr.String(), "Text", "Test", "test", sdk.NewCoin(denom, proposalTokens), "--generate-only", "-y") | ||||||
| 	require.True(t, success) | 	require.True(t, success) | ||||||
| @ -461,8 +540,8 @@ func TestGaiaCLISubmitProposal(t *testing.T) { | |||||||
| 	tests.WaitForNextNBlocksTM(1, f.Port) | 	tests.WaitForNextNBlocksTM(1, f.Port) | ||||||
| 
 | 
 | ||||||
| 	// Ensure transaction tags can be queried
 | 	// Ensure transaction tags can be queried
 | ||||||
| 	txs := f.QueryTxs(1, 50, "action:submit_proposal", fmt.Sprintf("proposer:%s", fooAddr)) | 	searchResult := f.QueryTxs(1, 50, "message.action:submit_proposal", fmt.Sprintf("message.sender:%s", fooAddr)) | ||||||
| 	require.Len(t, txs, 1) | 	require.Len(t, searchResult.Txs, 1) | ||||||
| 
 | 
 | ||||||
| 	// Ensure deposit was deducted
 | 	// Ensure deposit was deducted
 | ||||||
| 	fooAcc = f.QueryAccount(fooAddr) | 	fooAcc = f.QueryAccount(fooAddr) | ||||||
| @ -482,7 +561,7 @@ func TestGaiaCLISubmitProposal(t *testing.T) { | |||||||
| 	require.Equal(t, proposalTokens, deposit.Amount.AmountOf(denom)) | 	require.Equal(t, proposalTokens, deposit.Amount.AmountOf(denom)) | ||||||
| 
 | 
 | ||||||
| 	// Test deposit generate only
 | 	// Test deposit generate only
 | ||||||
| 	depositTokens := sdk.TokensFromTendermintPower(10) | 	depositTokens := sdk.TokensFromConsensusPower(10) | ||||||
| 	success, stdout, stderr = f.TxGovDeposit(1, fooAddr.String(), sdk.NewCoin(denom, depositTokens), "--generate-only") | 	success, stdout, stderr = f.TxGovDeposit(1, fooAddr.String(), sdk.NewCoin(denom, depositTokens), "--generate-only") | ||||||
| 	require.True(t, success) | 	require.True(t, success) | ||||||
| 	require.Empty(t, stderr) | 	require.Empty(t, stderr) | ||||||
| @ -505,8 +584,8 @@ func TestGaiaCLISubmitProposal(t *testing.T) { | |||||||
| 	require.Equal(t, proposalTokens.Add(depositTokens), deposit.Amount.AmountOf(denom)) | 	require.Equal(t, proposalTokens.Add(depositTokens), deposit.Amount.AmountOf(denom)) | ||||||
| 
 | 
 | ||||||
| 	// Ensure tags are set on the transaction
 | 	// Ensure tags are set on the transaction
 | ||||||
| 	txs = f.QueryTxs(1, 50, "action:deposit", fmt.Sprintf("depositor:%s", fooAddr)) | 	searchResult = f.QueryTxs(1, 50, "message.action:deposit", fmt.Sprintf("message.sender:%s", fooAddr)) | ||||||
| 	require.Len(t, txs, 1) | 	require.Len(t, searchResult.Txs, 1) | ||||||
| 
 | 
 | ||||||
| 	// Ensure account has expected amount of funds
 | 	// Ensure account has expected amount of funds
 | ||||||
| 	fooAcc = f.QueryAccount(fooAddr) | 	fooAcc = f.QueryAccount(fooAddr) | ||||||
| @ -542,8 +621,8 @@ func TestGaiaCLISubmitProposal(t *testing.T) { | |||||||
| 	require.Equal(t, gov.OptionYes, votes[0].Option) | 	require.Equal(t, gov.OptionYes, votes[0].Option) | ||||||
| 
 | 
 | ||||||
| 	// Ensure tags are applied to voting transaction properly
 | 	// Ensure tags are applied to voting transaction properly
 | ||||||
| 	txs = f.QueryTxs(1, 50, "action:vote", fmt.Sprintf("voter:%s", fooAddr)) | 	searchResult = f.QueryTxs(1, 50, "message.action:vote", fmt.Sprintf("message.sender:%s", fooAddr)) | ||||||
| 	require.Len(t, txs, 1) | 	require.Len(t, searchResult.Txs, 1) | ||||||
| 
 | 
 | ||||||
| 	// Ensure no proposals in deposit period
 | 	// Ensure no proposals in deposit period
 | ||||||
| 	proposalsQuery = f.QueryGovProposals("--status=DepositPeriod") | 	proposalsQuery = f.QueryGovProposals("--status=DepositPeriod") | ||||||
| @ -564,6 +643,154 @@ func TestGaiaCLISubmitProposal(t *testing.T) { | |||||||
| 	f.Cleanup() | 	f.Cleanup() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func TestGaiaCLISubmitParamChangeProposal(t *testing.T) { | ||||||
|  | 	t.Parallel() | ||||||
|  | 	f := InitFixtures(t) | ||||||
|  | 
 | ||||||
|  | 	proc := f.GDStart() | ||||||
|  | 	defer proc.Stop(false) | ||||||
|  | 
 | ||||||
|  | 	fooAddr := f.KeyAddress(keyFoo) | ||||||
|  | 	fooAcc := f.QueryAccount(fooAddr) | ||||||
|  | 	startTokens := sdk.TokensFromConsensusPower(50) | ||||||
|  | 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(sdk.DefaultBondDenom)) | ||||||
|  | 
 | ||||||
|  | 	// write proposal to file
 | ||||||
|  | 	proposalTokens := sdk.TokensFromConsensusPower(5) | ||||||
|  | 	proposal := fmt.Sprintf(`{ | ||||||
|  |   "title": "Param Change", | ||||||
|  |   "description": "Update max validators", | ||||||
|  |   "changes": [ | ||||||
|  |     { | ||||||
|  |       "subspace": "staking", | ||||||
|  |       "key": "MaxValidators", | ||||||
|  |       "value": 105 | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   "deposit": [ | ||||||
|  |     { | ||||||
|  |       "denom": "stake", | ||||||
|  |       "amount": "%s" | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
|  | `, proposalTokens.String()) | ||||||
|  | 
 | ||||||
|  | 	proposalFile := WriteToNewTempFile(t, proposal) | ||||||
|  | 
 | ||||||
|  | 	// create the param change proposal
 | ||||||
|  | 	f.TxGovSubmitParamChangeProposal(keyFoo, proposalFile.Name(), sdk.NewCoin(denom, proposalTokens), "-y") | ||||||
|  | 	tests.WaitForNextNBlocksTM(1, f.Port) | ||||||
|  | 
 | ||||||
|  | 	// ensure transaction tags can be queried
 | ||||||
|  | 	txsPage := f.QueryTxs(1, 50, "message.action:submit_proposal", fmt.Sprintf("message.sender:%s", fooAddr)) | ||||||
|  | 	require.Len(t, txsPage.Txs, 1) | ||||||
|  | 
 | ||||||
|  | 	// ensure deposit was deducted
 | ||||||
|  | 	fooAcc = f.QueryAccount(fooAddr) | ||||||
|  | 	require.Equal(t, startTokens.Sub(proposalTokens).String(), fooAcc.GetCoins().AmountOf(sdk.DefaultBondDenom).String()) | ||||||
|  | 
 | ||||||
|  | 	// ensure proposal is directly queryable
 | ||||||
|  | 	proposal1 := f.QueryGovProposal(1) | ||||||
|  | 	require.Equal(t, uint64(1), proposal1.ProposalID) | ||||||
|  | 	require.Equal(t, gov.StatusDepositPeriod, proposal1.Status) | ||||||
|  | 
 | ||||||
|  | 	// ensure correct query proposals result
 | ||||||
|  | 	proposalsQuery := f.QueryGovProposals() | ||||||
|  | 	require.Equal(t, uint64(1), proposalsQuery[0].ProposalID) | ||||||
|  | 
 | ||||||
|  | 	// ensure the correct deposit amount on the proposal
 | ||||||
|  | 	deposit := f.QueryGovDeposit(1, fooAddr) | ||||||
|  | 	require.Equal(t, proposalTokens, deposit.Amount.AmountOf(denom)) | ||||||
|  | 
 | ||||||
|  | 	// Cleanup testing directories
 | ||||||
|  | 	f.Cleanup() | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func TestGaiaCLISubmitCommunityPoolSpendProposal(t *testing.T) { | ||||||
|  | 	t.Parallel() | ||||||
|  | 	f := InitFixtures(t) | ||||||
|  | 
 | ||||||
|  | 	// create some inflation
 | ||||||
|  | 	cdc := app.MakeCodec() | ||||||
|  | 	genesisState := f.GenesisState() | ||||||
|  | 	inflationMin := sdk.MustNewDecFromStr("10000.0") | ||||||
|  | 	var mintData mint.GenesisState | ||||||
|  | 	cdc.UnmarshalJSON(genesisState[mint.ModuleName], &mintData) | ||||||
|  | 	mintData.Minter.Inflation = inflationMin | ||||||
|  | 	mintData.Params.InflationMin = inflationMin | ||||||
|  | 	mintData.Params.InflationMax = sdk.MustNewDecFromStr("15000.0") | ||||||
|  | 	mintDataBz, err := cdc.MarshalJSON(mintData) | ||||||
|  | 	require.NoError(t, err) | ||||||
|  | 	genesisState[mint.ModuleName] = mintDataBz | ||||||
|  | 
 | ||||||
|  | 	genFile := filepath.Join(f.GaiadHome, "config", "genesis.json") | ||||||
|  | 	genDoc, err := tmtypes.GenesisDocFromFile(genFile) | ||||||
|  | 	require.NoError(t, err) | ||||||
|  | 	genDoc.AppState, err = cdc.MarshalJSON(genesisState) | ||||||
|  | 	require.NoError(t, genDoc.SaveAs(genFile)) | ||||||
|  | 
 | ||||||
|  | 	proc := f.GDStart() | ||||||
|  | 	defer proc.Stop(false) | ||||||
|  | 
 | ||||||
|  | 	fooAddr := f.KeyAddress(keyFoo) | ||||||
|  | 	fooAcc := f.QueryAccount(fooAddr) | ||||||
|  | 	startTokens := sdk.TokensFromConsensusPower(50) | ||||||
|  | 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(sdk.DefaultBondDenom)) | ||||||
|  | 
 | ||||||
|  | 	tests.WaitForNextNBlocksTM(3, f.Port) | ||||||
|  | 
 | ||||||
|  | 	// write proposal to file
 | ||||||
|  | 	proposalTokens := sdk.TokensFromConsensusPower(5) | ||||||
|  | 	proposal := fmt.Sprintf(`{ | ||||||
|  |   "title": "Community Pool Spend", | ||||||
|  |   "description": "Spend from community pool", | ||||||
|  |   "recipient": "%s", | ||||||
|  |   "amount": [ | ||||||
|  |     { | ||||||
|  |       "denom": "%s", | ||||||
|  |       "amount": "1" | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   "deposit": [ | ||||||
|  |     { | ||||||
|  |       "denom": "%s", | ||||||
|  |       "amount": "%s" | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
|  | `, fooAddr, sdk.DefaultBondDenom, sdk.DefaultBondDenom, proposalTokens.String()) | ||||||
|  | 	proposalFile := WriteToNewTempFile(t, proposal) | ||||||
|  | 
 | ||||||
|  | 	// create the param change proposal
 | ||||||
|  | 	f.TxGovSubmitCommunityPoolSpendProposal(keyFoo, proposalFile.Name(), sdk.NewCoin(denom, proposalTokens), "-y") | ||||||
|  | 	tests.WaitForNextNBlocksTM(1, f.Port) | ||||||
|  | 
 | ||||||
|  | 	// ensure transaction tags can be queried
 | ||||||
|  | 	txsPage := f.QueryTxs(1, 50, "message.action:submit_proposal", fmt.Sprintf("message.sender:%s", fooAddr)) | ||||||
|  | 	require.Len(t, txsPage.Txs, 1) | ||||||
|  | 
 | ||||||
|  | 	// ensure deposit was deducted
 | ||||||
|  | 	fooAcc = f.QueryAccount(fooAddr) | ||||||
|  | 	require.Equal(t, startTokens.Sub(proposalTokens).String(), fooAcc.GetCoins().AmountOf(sdk.DefaultBondDenom).String()) | ||||||
|  | 
 | ||||||
|  | 	// ensure proposal is directly queryable
 | ||||||
|  | 	proposal1 := f.QueryGovProposal(1) | ||||||
|  | 	require.Equal(t, uint64(1), proposal1.ProposalID) | ||||||
|  | 	require.Equal(t, gov.StatusDepositPeriod, proposal1.Status) | ||||||
|  | 
 | ||||||
|  | 	// ensure correct query proposals result
 | ||||||
|  | 	proposalsQuery := f.QueryGovProposals() | ||||||
|  | 	require.Equal(t, uint64(1), proposalsQuery[0].ProposalID) | ||||||
|  | 
 | ||||||
|  | 	// ensure the correct deposit amount on the proposal
 | ||||||
|  | 	deposit := f.QueryGovDeposit(1, fooAddr) | ||||||
|  | 	require.Equal(t, proposalTokens, deposit.Amount.AmountOf(denom)) | ||||||
|  | 
 | ||||||
|  | 	// Cleanup testing directories
 | ||||||
|  | 	f.Cleanup() | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func TestGaiaCLIQueryTxPagination(t *testing.T) { | func TestGaiaCLIQueryTxPagination(t *testing.T) { | ||||||
| 	t.Parallel() | 	t.Parallel() | ||||||
| 	f := InitFixtures(t) | 	f := InitFixtures(t) | ||||||
| @ -585,32 +812,33 @@ func TestGaiaCLIQueryTxPagination(t *testing.T) { | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// perPage = 15, 2 pages
 | 	// perPage = 15, 2 pages
 | ||||||
| 	txsPage1 := f.QueryTxs(1, 15, fmt.Sprintf("sender:%s", fooAddr)) | 	txsPage1 := f.QueryTxs(1, 15, fmt.Sprintf("message.sender:%s", fooAddr)) | ||||||
| 	require.Len(t, txsPage1, 15) | 	require.Len(t, txsPage1.Txs, 15) | ||||||
| 	txsPage2 := f.QueryTxs(2, 15, fmt.Sprintf("sender:%s", fooAddr)) | 	require.Equal(t, txsPage1.Count, 15) | ||||||
| 	require.Len(t, txsPage2, 15) | 	txsPage2 := f.QueryTxs(2, 15, fmt.Sprintf("message.sender:%s", fooAddr)) | ||||||
| 	require.NotEqual(t, txsPage1, txsPage2) | 	require.Len(t, txsPage2.Txs, 15) | ||||||
| 	txsPage3 := f.QueryTxs(3, 15, fmt.Sprintf("sender:%s", fooAddr)) | 	require.NotEqual(t, txsPage1.Txs, txsPage2.Txs) | ||||||
| 	require.Len(t, txsPage3, 15) |  | ||||||
| 	require.Equal(t, txsPage2, txsPage3) |  | ||||||
| 
 | 
 | ||||||
| 	// perPage = 16, 2 pages
 | 	// perPage = 16, 2 pages
 | ||||||
| 	txsPage1 = f.QueryTxs(1, 16, fmt.Sprintf("sender:%s", fooAddr)) | 	txsPage1 = f.QueryTxs(1, 16, fmt.Sprintf("message.sender:%s", fooAddr)) | ||||||
| 	require.Len(t, txsPage1, 16) | 	require.Len(t, txsPage1.Txs, 16) | ||||||
| 	txsPage2 = f.QueryTxs(2, 16, fmt.Sprintf("sender:%s", fooAddr)) | 	txsPage2 = f.QueryTxs(2, 16, fmt.Sprintf("message.sender:%s", fooAddr)) | ||||||
| 	require.Len(t, txsPage2, 14) | 	require.Len(t, txsPage2.Txs, 14) | ||||||
| 	require.NotEqual(t, txsPage1, txsPage2) | 	require.NotEqual(t, txsPage1.Txs, txsPage2.Txs) | ||||||
| 
 | 
 | ||||||
| 	// perPage = 50
 | 	// perPage = 50
 | ||||||
| 	txsPageFull := f.QueryTxs(1, 50, fmt.Sprintf("sender:%s", fooAddr)) | 	txsPageFull := f.QueryTxs(1, 50, fmt.Sprintf("message.sender:%s", fooAddr)) | ||||||
| 	require.Len(t, txsPageFull, 30) | 	require.Len(t, txsPageFull.Txs, 30) | ||||||
| 	require.Equal(t, txsPageFull, append(txsPage1, txsPage2...)) | 	require.Equal(t, txsPageFull.Txs, append(txsPage1.Txs, txsPage2.Txs...)) | ||||||
| 
 | 
 | ||||||
| 	// perPage = 0
 | 	// perPage = 0
 | ||||||
| 	f.QueryTxsInvalid(errors.New("ERROR: page must greater than 0"), 0, 50, fmt.Sprintf("sender:%s", fooAddr)) | 	f.QueryTxsInvalid(errors.New("ERROR: page must greater than 0"), 0, 50, fmt.Sprintf("message.sender:%s", fooAddr)) | ||||||
| 
 | 
 | ||||||
| 	// limit = 0
 | 	// limit = 0
 | ||||||
| 	f.QueryTxsInvalid(errors.New("ERROR: limit must greater than 0"), 1, 0, fmt.Sprintf("sender:%s", fooAddr)) | 	f.QueryTxsInvalid(errors.New("ERROR: limit must greater than 0"), 1, 0, fmt.Sprintf("message.sender:%s", fooAddr)) | ||||||
|  | 
 | ||||||
|  | 	// Cleanup testing directories
 | ||||||
|  | 	f.Cleanup() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestGaiaCLIValidateSignatures(t *testing.T) { | func TestGaiaCLIValidateSignatures(t *testing.T) { | ||||||
| @ -675,7 +903,7 @@ func TestGaiaCLISendGenerateSignAndBroadcast(t *testing.T) { | |||||||
| 	barAddr := f.KeyAddress(keyBar) | 	barAddr := f.KeyAddress(keyBar) | ||||||
| 
 | 
 | ||||||
| 	// Test generate sendTx with default gas
 | 	// Test generate sendTx with default gas
 | ||||||
| 	sendTokens := sdk.TokensFromTendermintPower(10) | 	sendTokens := sdk.TokensFromConsensusPower(10) | ||||||
| 	success, stdout, stderr := f.TxSend(fooAddr.String(), barAddr, sdk.NewCoin(denom, sendTokens), "--generate-only") | 	success, stdout, stderr := f.TxSend(fooAddr.String(), barAddr, sdk.NewCoin(denom, sendTokens), "--generate-only") | ||||||
| 	require.True(t, success) | 	require.True(t, success) | ||||||
| 	require.Empty(t, stderr) | 	require.Empty(t, stderr) | ||||||
| @ -694,9 +922,9 @@ func TestGaiaCLISendGenerateSignAndBroadcast(t *testing.T) { | |||||||
| 	require.Equal(t, 0, len(msg.GetSignatures())) | 	require.Equal(t, 0, len(msg.GetSignatures())) | ||||||
| 
 | 
 | ||||||
| 	// Test generate sendTx, estimate gas
 | 	// Test generate sendTx, estimate gas
 | ||||||
| 	success, stdout, stderr = f.TxSend(fooAddr.String(), barAddr, sdk.NewCoin(denom, sendTokens), "--gas=auto", "--generate-only") | 	success, stdout, stderr = f.TxSend(fooAddr.String(), barAddr, sdk.NewCoin(denom, sendTokens), "--generate-only") | ||||||
| 	require.True(t, success) | 	require.True(t, success) | ||||||
| 	require.NotEmpty(t, stderr) | 	require.Empty(t, stderr) | ||||||
| 	msg = unmarshalStdTx(t, stdout) | 	msg = unmarshalStdTx(t, stdout) | ||||||
| 	require.True(t, msg.Fee.Gas > 0) | 	require.True(t, msg.Fee.Gas > 0) | ||||||
| 	require.Equal(t, len(msg.Msgs), 1) | 	require.Equal(t, len(msg.Msgs), 1) | ||||||
| @ -730,19 +958,12 @@ func TestGaiaCLISendGenerateSignAndBroadcast(t *testing.T) { | |||||||
| 
 | 
 | ||||||
| 	// Ensure foo has right amount of funds
 | 	// Ensure foo has right amount of funds
 | ||||||
| 	fooAcc := f.QueryAccount(fooAddr) | 	fooAcc := f.QueryAccount(fooAddr) | ||||||
| 	startTokens := sdk.TokensFromTendermintPower(50) | 	startTokens := sdk.TokensFromConsensusPower(50) | ||||||
| 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) | 	require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) | ||||||
| 
 | 
 | ||||||
| 	// Test broadcast
 | 	// Test broadcast
 | ||||||
| 	success, stdout, _ = f.TxBroadcast(signedTxFile.Name()) | 	success, stdout, _ = f.TxBroadcast(signedTxFile.Name()) | ||||||
| 	require.True(t, success) | 	require.True(t, success) | ||||||
| 
 |  | ||||||
| 	var result sdk.TxResponse |  | ||||||
| 
 |  | ||||||
| 	// Unmarshal the response and ensure that gas was properly used
 |  | ||||||
| 	require.Nil(t, app.MakeCodec().UnmarshalJSON([]byte(stdout), &result)) |  | ||||||
| 	require.Equal(t, msg.Fee.Gas, uint64(result.GasUsed)) |  | ||||||
| 	require.Equal(t, msg.Fee.Gas, uint64(result.GasWanted)) |  | ||||||
| 	tests.WaitForNextNBlocksTM(1, f.Port) | 	tests.WaitForNextNBlocksTM(1, f.Port) | ||||||
| 
 | 
 | ||||||
| 	// Ensure account state
 | 	// Ensure account state
 | ||||||
| @ -799,8 +1020,12 @@ func TestGaiaCLIMultisignInsufficientCosigners(t *testing.T) { | |||||||
| 	require.False(t, success) | 	require.False(t, success) | ||||||
| 
 | 
 | ||||||
| 	// Broadcast the transaction
 | 	// Broadcast the transaction
 | ||||||
| 	success, _, _ = f.TxBroadcast(signedTxFile.Name()) | 	success, stdOut, _ := f.TxBroadcast(signedTxFile.Name()) | ||||||
| 	require.False(t, success) | 	require.Contains(t, stdOut, "signature verification failed") | ||||||
|  | 	require.True(t, success) | ||||||
|  | 
 | ||||||
|  | 	// Cleanup testing directories
 | ||||||
|  | 	f.Cleanup() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestGaiaCLIEncode(t *testing.T) { | func TestGaiaCLIEncode(t *testing.T) { | ||||||
| @ -817,7 +1042,7 @@ func TestGaiaCLIEncode(t *testing.T) { | |||||||
| 	barAddr := f.KeyAddress(keyBar) | 	barAddr := f.KeyAddress(keyBar) | ||||||
| 	keyAddr := f.KeyAddress(keyFoo) | 	keyAddr := f.KeyAddress(keyFoo) | ||||||
| 
 | 
 | ||||||
| 	sendTokens := sdk.TokensFromTendermintPower(10) | 	sendTokens := sdk.TokensFromConsensusPower(10) | ||||||
| 	success, stdout, stderr := f.TxSend(keyAddr.String(), barAddr, sdk.NewCoin(denom, sendTokens), "--generate-only", "--memo", "deadbeef") | 	success, stdout, stderr := f.TxSend(keyAddr.String(), barAddr, sdk.NewCoin(denom, sendTokens), "--generate-only", "--memo", "deadbeef") | ||||||
| 	require.True(t, success) | 	require.True(t, success) | ||||||
| 	require.Empty(t, stderr) | 	require.Empty(t, stderr) | ||||||
| @ -901,6 +1126,9 @@ func TestGaiaCLIMultisignSortSignatures(t *testing.T) { | |||||||
| 	// Broadcast the transaction
 | 	// Broadcast the transaction
 | ||||||
| 	success, _, _ = f.TxBroadcast(signedTxFile.Name()) | 	success, _, _ = f.TxBroadcast(signedTxFile.Name()) | ||||||
| 	require.True(t, success) | 	require.True(t, success) | ||||||
|  | 
 | ||||||
|  | 	// Cleanup testing directories
 | ||||||
|  | 	f.Cleanup() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestGaiaCLIMultisign(t *testing.T) { | func TestGaiaCLIMultisign(t *testing.T) { | ||||||
| @ -964,6 +1192,9 @@ func TestGaiaCLIMultisign(t *testing.T) { | |||||||
| 	// Broadcast the transaction
 | 	// Broadcast the transaction
 | ||||||
| 	success, _, _ = f.TxBroadcast(signedTxFile.Name()) | 	success, _, _ = f.TxBroadcast(signedTxFile.Name()) | ||||||
| 	require.True(t, success) | 	require.True(t, success) | ||||||
|  | 
 | ||||||
|  | 	// Cleanup testing directories
 | ||||||
|  | 	f.Cleanup() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestGaiaCLIConfig(t *testing.T) { | func TestGaiaCLIConfig(t *testing.T) { | ||||||
| @ -980,7 +1211,7 @@ func TestGaiaCLIConfig(t *testing.T) { | |||||||
| 	f.CLIConfig("trace", "false") | 	f.CLIConfig("trace", "false") | ||||||
| 	f.CLIConfig("indent", "true") | 	f.CLIConfig("indent", "true") | ||||||
| 
 | 
 | ||||||
| 	config, err := ioutil.ReadFile(path.Join(f.GCLIHome, "config", "config.toml")) | 	config, err := ioutil.ReadFile(path.Join(f.GaiacliHome, "config", "config.toml")) | ||||||
| 	require.NoError(t, err) | 	require.NoError(t, err) | ||||||
| 	expectedConfig := fmt.Sprintf(`broadcast-mode = "block" | 	expectedConfig := fmt.Sprintf(`broadcast-mode = "block" | ||||||
| chain-id = "%s" | chain-id = "%s" | ||||||
| @ -997,6 +1228,7 @@ trust-node = true | |||||||
| 
 | 
 | ||||||
| func TestGaiadCollectGentxs(t *testing.T) { | func TestGaiadCollectGentxs(t *testing.T) { | ||||||
| 	t.Parallel() | 	t.Parallel() | ||||||
|  | 	var customMaxBytes, customMaxGas int64 = 99999999, 1234567 | ||||||
| 	f := NewFixtures(t) | 	f := NewFixtures(t) | ||||||
| 
 | 
 | ||||||
| 	// Initialise temporary directories
 | 	// Initialise temporary directories
 | ||||||
| @ -1016,6 +1248,15 @@ func TestGaiadCollectGentxs(t *testing.T) { | |||||||
| 	// Run init
 | 	// Run init
 | ||||||
| 	f.GDInit(keyFoo) | 	f.GDInit(keyFoo) | ||||||
| 
 | 
 | ||||||
|  | 	// Customise genesis.json
 | ||||||
|  | 
 | ||||||
|  | 	genFile := f.GenesisFile() | ||||||
|  | 	genDoc, err := tmtypes.GenesisDocFromFile(genFile) | ||||||
|  | 	require.NoError(t, err) | ||||||
|  | 	genDoc.ConsensusParams.Block.MaxBytes = customMaxBytes | ||||||
|  | 	genDoc.ConsensusParams.Block.MaxGas = customMaxGas | ||||||
|  | 	genDoc.SaveAs(genFile) | ||||||
|  | 
 | ||||||
| 	// Add account to genesis.json
 | 	// Add account to genesis.json
 | ||||||
| 	f.AddGenesisAccount(f.KeyAddress(keyFoo), startCoins) | 	f.AddGenesisAccount(f.KeyAddress(keyFoo), startCoins) | ||||||
| 
 | 
 | ||||||
| @ -1025,6 +1266,11 @@ func TestGaiadCollectGentxs(t *testing.T) { | |||||||
| 	// Collect gentxs from a custom directory
 | 	// Collect gentxs from a custom directory
 | ||||||
| 	f.CollectGenTxs(fmt.Sprintf("--gentx-dir=%s", gentxDir)) | 	f.CollectGenTxs(fmt.Sprintf("--gentx-dir=%s", gentxDir)) | ||||||
| 
 | 
 | ||||||
|  | 	genDoc, err = tmtypes.GenesisDocFromFile(genFile) | ||||||
|  | 	require.NoError(t, err) | ||||||
|  | 	require.Equal(t, genDoc.ConsensusParams.Block.MaxBytes, customMaxBytes) | ||||||
|  | 	require.Equal(t, genDoc.ConsensusParams.Block.MaxGas, customMaxGas) | ||||||
|  | 
 | ||||||
| 	f.Cleanup(gentxDir) | 	f.Cleanup(gentxDir) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -1058,10 +1304,19 @@ func TestGaiadAddGenesisAccount(t *testing.T) { | |||||||
| 	f.AddGenesisAccount(f.KeyAddress(keyFoo), startCoins) | 	f.AddGenesisAccount(f.KeyAddress(keyFoo), startCoins) | ||||||
| 	f.AddGenesisAccount(f.KeyAddress(keyBar), bazCoins) | 	f.AddGenesisAccount(f.KeyAddress(keyBar), bazCoins) | ||||||
| 	genesisState := f.GenesisState() | 	genesisState := f.GenesisState() | ||||||
| 	require.Equal(t, genesisState.Accounts[0].Address, f.KeyAddress(keyFoo)) | 
 | ||||||
| 	require.Equal(t, genesisState.Accounts[1].Address, f.KeyAddress(keyBar)) | 	cdc := app.MakeCodec() | ||||||
| 	require.True(t, genesisState.Accounts[0].Coins.IsEqual(startCoins)) | 
 | ||||||
| 	require.True(t, genesisState.Accounts[1].Coins.IsEqual(bazCoins)) | 	authGenState := auth.GetGenesisStateFromAppState(cdc, genesisState) | ||||||
|  | 	accounts := authGenState.Accounts | ||||||
|  | 
 | ||||||
|  | 	require.Equal(t, accounts[0].GetAddress(), f.KeyAddress(keyFoo)) | ||||||
|  | 	require.Equal(t, accounts[1].GetAddress(), f.KeyAddress(keyBar)) | ||||||
|  | 	require.True(t, accounts[0].GetCoins().IsEqual(startCoins)) | ||||||
|  | 	require.True(t, accounts[1].GetCoins().IsEqual(bazCoins)) | ||||||
|  | 
 | ||||||
|  | 	// Cleanup testing directories
 | ||||||
|  | 	f.Cleanup() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestSlashingGetParams(t *testing.T) { | func TestSlashingGetParams(t *testing.T) { | ||||||
| @ -1080,6 +1335,9 @@ func TestSlashingGetParams(t *testing.T) { | |||||||
| 	sinfo := f.QuerySigningInfo(f.GDTendermint("show-validator")) | 	sinfo := f.QuerySigningInfo(f.GDTendermint("show-validator")) | ||||||
| 	require.Equal(t, int64(0), sinfo.StartHeight) | 	require.Equal(t, int64(0), sinfo.StartHeight) | ||||||
| 	require.False(t, sinfo.Tombstoned) | 	require.False(t, sinfo.Tombstoned) | ||||||
|  | 
 | ||||||
|  | 	// Cleanup testing directories
 | ||||||
|  | 	f.Cleanup() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestValidateGenesis(t *testing.T) { | func TestValidateGenesis(t *testing.T) { | ||||||
| @ -1091,4 +1349,7 @@ func TestValidateGenesis(t *testing.T) { | |||||||
| 	defer proc.Stop(false) | 	defer proc.Stop(false) | ||||||
| 
 | 
 | ||||||
| 	f.ValidateGenesis() | 	f.ValidateGenesis() | ||||||
|  | 
 | ||||||
|  | 	// Cleanup testing directories
 | ||||||
|  | 	f.Cleanup() | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,2 +0,0 @@ | |||||||
| // Package clitest runs integration tests which make use of CLI commands.
 |  | ||||||
| package clitest |  | ||||||
| @ -3,7 +3,6 @@ package clitest | |||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"go/build" |  | ||||||
| 	"io/ioutil" | 	"io/ioutil" | ||||||
| 	"os" | 	"os" | ||||||
| 	"path/filepath" | 	"path/filepath" | ||||||
| @ -13,21 +12,23 @@ import ( | |||||||
| 
 | 
 | ||||||
| 	"github.com/stretchr/testify/require" | 	"github.com/stretchr/testify/require" | ||||||
| 
 | 
 | ||||||
| 	cmn "github.com/tendermint/tendermint/libs/common" | 	tmtypes "github.com/tendermint/tendermint/types" | ||||||
| 
 | 
 | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/client" | ||||||
| 	clientkeys "github.com/cosmos/cosmos-sdk/client/keys" | 	clientkeys "github.com/cosmos/cosmos-sdk/client/keys" | ||||||
| 	"github.com/cosmos/cosmos-sdk/codec" | 	"github.com/cosmos/cosmos-sdk/codec" | ||||||
| 	"github.com/cosmos/cosmos-sdk/crypto/keys" | 	"github.com/cosmos/cosmos-sdk/crypto/keys" | ||||||
| 	"github.com/cosmos/cosmos-sdk/server" | 	"github.com/cosmos/cosmos-sdk/server" | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/simapp" | ||||||
| 	"github.com/cosmos/cosmos-sdk/tests" | 	"github.com/cosmos/cosmos-sdk/tests" | ||||||
| 	sdk "github.com/cosmos/cosmos-sdk/types" | 	sdk "github.com/cosmos/cosmos-sdk/types" | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/auth" | 	"github.com/cosmos/cosmos-sdk/x/auth" | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/x/distribution" | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/gov" | 	"github.com/cosmos/cosmos-sdk/x/gov" | ||||||
| 	"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/kava-labs/kava/app" | 	"github.com/kava-labs/kava/app" | ||||||
| 	appInit "github.com/kava-labs/kava/init" |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| const ( | const ( | ||||||
| @ -43,16 +44,23 @@ const ( | |||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| var ( | var ( | ||||||
| 	startCoins = sdk.Coins{ | 	totalCoins = sdk.NewCoins( | ||||||
| 		sdk.NewCoin(feeDenom, sdk.TokensFromTendermintPower(1000000)), | 		sdk.NewCoin(fee2Denom, sdk.TokensFromConsensusPower(2000000)), | ||||||
| 		sdk.NewCoin(fee2Denom, sdk.TokensFromTendermintPower(1000000)), | 		sdk.NewCoin(feeDenom, sdk.TokensFromConsensusPower(2000000)), | ||||||
| 		sdk.NewCoin(fooDenom, sdk.TokensFromTendermintPower(1000)), | 		sdk.NewCoin(fooDenom, sdk.TokensFromConsensusPower(2000)), | ||||||
| 		sdk.NewCoin(denom, sdk.TokensFromTendermintPower(150)), | 		sdk.NewCoin(denom, sdk.TokensFromConsensusPower(300).Add(sdk.NewInt(12))), // add coins from inflation
 | ||||||
| 	} | 	) | ||||||
| 
 | 
 | ||||||
| 	vestingCoins = sdk.Coins{ | 	startCoins = sdk.NewCoins( | ||||||
| 		sdk.NewCoin(feeDenom, sdk.TokensFromTendermintPower(500000)), | 		sdk.NewCoin(fee2Denom, sdk.TokensFromConsensusPower(1000000)), | ||||||
| 	} | 		sdk.NewCoin(feeDenom, sdk.TokensFromConsensusPower(1000000)), | ||||||
|  | 		sdk.NewCoin(fooDenom, sdk.TokensFromConsensusPower(1000)), | ||||||
|  | 		sdk.NewCoin(denom, sdk.TokensFromConsensusPower(150)), | ||||||
|  | 	) | ||||||
|  | 
 | ||||||
|  | 	vestingCoins = sdk.NewCoins( | ||||||
|  | 		sdk.NewCoin(feeDenom, sdk.TokensFromConsensusPower(500000)), | ||||||
|  | 	) | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func init() { | func init() { | ||||||
| @ -67,13 +75,15 @@ func init() { | |||||||
| 
 | 
 | ||||||
| // Fixtures is used to setup the testing environment
 | // Fixtures is used to setup the testing environment
 | ||||||
| type Fixtures struct { | type Fixtures struct { | ||||||
|  | 	BuildDir      string | ||||||
|  | 	RootDir       string | ||||||
|  | 	GaiadBinary   string | ||||||
|  | 	GaiacliBinary string | ||||||
| 	ChainID       string | 	ChainID       string | ||||||
| 	RPCAddr       string | 	RPCAddr       string | ||||||
| 	Port          string | 	Port          string | ||||||
| 	AppDaemonBinary string | 	GaiadHome     string | ||||||
| 	AppCliBinary    string | 	GaiacliHome   string | ||||||
| 	GDHome          string |  | ||||||
| 	GCLIHome        string |  | ||||||
| 	P2PAddr       string | 	P2PAddr       string | ||||||
| 	T             *testing.T | 	T             *testing.T | ||||||
| } | } | ||||||
| @ -83,24 +93,26 @@ func NewFixtures(t *testing.T) *Fixtures { | |||||||
| 	tmpDir, err := ioutil.TempDir("", "kava_integration_"+t.Name()+"_") | 	tmpDir, err := ioutil.TempDir("", "kava_integration_"+t.Name()+"_") | ||||||
| 	require.NoError(t, err) | 	require.NoError(t, err) | ||||||
| 
 | 
 | ||||||
| 	// set location of the app binaries
 |  | ||||||
| 	buildDir := os.Getenv("BUILDDIR") |  | ||||||
| 	if buildDir == "" { |  | ||||||
| 		buildDir = filepath.Join(build.Default.GOPATH, "bin") |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	servAddr, port, err := server.FreeTCPAddr() | 	servAddr, port, err := server.FreeTCPAddr() | ||||||
| 	require.NoError(t, err) | 	require.NoError(t, err) | ||||||
| 
 | 
 | ||||||
| 	p2pAddr, _, err := server.FreeTCPAddr() | 	p2pAddr, _, err := server.FreeTCPAddr() | ||||||
| 	require.NoError(t, err) | 	require.NoError(t, err) | ||||||
| 
 | 
 | ||||||
|  | 	buildDir := os.Getenv("BUILDDIR") | ||||||
|  | 	if buildDir == "" { | ||||||
|  | 		buildDir, err = filepath.Abs("../build/") | ||||||
|  | 		require.NoError(t, err) | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	return &Fixtures{ | 	return &Fixtures{ | ||||||
| 		T:             t, | 		T:             t, | ||||||
| 		AppDaemonBinary: filepath.Join(buildDir, "kvd"), | 		BuildDir:      buildDir, | ||||||
| 		AppCliBinary:    filepath.Join(buildDir, "kvcli"), | 		RootDir:       tmpDir, | ||||||
| 		GDHome:          filepath.Join(tmpDir, ".kvd"), | 		GaiadBinary:   filepath.Join(buildDir, "kvd"), | ||||||
| 		GCLIHome:        filepath.Join(tmpDir, ".kvcli"), | 		GaiacliBinary: filepath.Join(buildDir, "kvcli"), | ||||||
|  | 		GaiadHome:     filepath.Join(tmpDir, ".kvd"), | ||||||
|  | 		GaiacliHome:   filepath.Join(tmpDir, ".kvcli"), | ||||||
| 		RPCAddr:       servAddr, | 		RPCAddr:       servAddr, | ||||||
| 		P2PAddr:       p2pAddr, | 		P2PAddr:       p2pAddr, | ||||||
| 		Port:          port, | 		Port:          port, | ||||||
| @ -109,16 +121,16 @@ func NewFixtures(t *testing.T) *Fixtures { | |||||||
| 
 | 
 | ||||||
| // GenesisFile returns the path of the genesis file
 | // GenesisFile returns the path of the genesis file
 | ||||||
| func (f Fixtures) GenesisFile() string { | func (f Fixtures) GenesisFile() string { | ||||||
| 	return filepath.Join(f.GDHome, "config", "genesis.json") | 	return filepath.Join(f.GaiadHome, "config", "genesis.json") | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // GenesisFile returns the application's genesis state
 | // GenesisFile returns the application's genesis state
 | ||||||
| func (f Fixtures) GenesisState() app.GenesisState { | func (f Fixtures) GenesisState() simapp.GenesisState { | ||||||
| 	cdc := codec.New() | 	cdc := codec.New() | ||||||
| 	genDoc, err := appInit.LoadGenesisDoc(cdc, f.GenesisFile()) | 	genDoc, err := tmtypes.GenesisDocFromFile(f.GenesisFile()) | ||||||
| 	require.NoError(f.T, err) | 	require.NoError(f.T, err) | ||||||
| 
 | 
 | ||||||
| 	var appState app.GenesisState | 	var appState simapp.GenesisState | ||||||
| 	require.NoError(f.T, cdc.UnmarshalJSON(genDoc.AppState, &appState)) | 	require.NoError(f.T, cdc.UnmarshalJSON(genDoc.AppState, &appState)) | ||||||
| 	return appState | 	return appState | ||||||
| } | } | ||||||
| @ -151,6 +163,7 @@ func InitFixtures(t *testing.T) (f *Fixtures) { | |||||||
| 
 | 
 | ||||||
| 	f.CLIConfig("chain-id", f.ChainID) | 	f.CLIConfig("chain-id", f.ChainID) | ||||||
| 	f.CLIConfig("broadcast-mode", "block") | 	f.CLIConfig("broadcast-mode", "block") | ||||||
|  | 	f.CLIConfig("trust-node", "true") | ||||||
| 
 | 
 | ||||||
| 	// start an account with tokens
 | 	// start an account with tokens
 | ||||||
| 	f.AddGenesisAccount(f.KeyAddress(keyFoo), startCoins) | 	f.AddGenesisAccount(f.KeyAddress(keyFoo), startCoins) | ||||||
| @ -169,16 +182,15 @@ func InitFixtures(t *testing.T) (f *Fixtures) { | |||||||
| 
 | 
 | ||||||
| // Cleanup is meant to be run at the end of a test to clean up an remaining test state
 | // Cleanup is meant to be run at the end of a test to clean up an remaining test state
 | ||||||
| func (f *Fixtures) Cleanup(dirs ...string) { | func (f *Fixtures) Cleanup(dirs ...string) { | ||||||
| 	clean := append(dirs, f.GDHome, f.GCLIHome) | 	clean := append(dirs, f.RootDir) | ||||||
| 	for _, d := range clean { | 	for _, d := range clean { | ||||||
| 		err := os.RemoveAll(d) | 		require.NoError(f.T, os.RemoveAll(d)) | ||||||
| 		require.NoError(f.T, err) |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Flags returns the flags necessary for making most CLI calls
 | // Flags returns the flags necessary for making most CLI calls
 | ||||||
| func (f *Fixtures) Flags() string { | func (f *Fixtures) Flags() string { | ||||||
| 	return fmt.Sprintf("--home=%s --node=%s", f.GCLIHome, f.RPCAddr) | 	return fmt.Sprintf("--home=%s --node=%s", f.GaiacliHome, f.RPCAddr) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //___________________________________________________________________________________
 | //___________________________________________________________________________________
 | ||||||
| @ -186,17 +198,17 @@ func (f *Fixtures) Flags() string { | |||||||
| 
 | 
 | ||||||
| // UnsafeResetAll is gaiad unsafe-reset-all
 | // UnsafeResetAll is gaiad unsafe-reset-all
 | ||||||
| func (f *Fixtures) UnsafeResetAll(flags ...string) { | func (f *Fixtures) UnsafeResetAll(flags ...string) { | ||||||
| 	cmd := fmt.Sprintf("%s --home=%s unsafe-reset-all", f.AppDaemonBinary, f.GDHome) | 	cmd := fmt.Sprintf("%s --home=%s unsafe-reset-all", f.GaiadBinary, f.GaiadHome) | ||||||
| 	executeWrite(f.T, addFlags(cmd, flags)) | 	executeWrite(f.T, addFlags(cmd, flags)) | ||||||
| 	err := os.RemoveAll(filepath.Join(f.GDHome, "config", "gentx")) | 	err := os.RemoveAll(filepath.Join(f.GaiadHome, "config", "gentx")) | ||||||
| 	require.NoError(f.T, err) | 	require.NoError(f.T, err) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // GDInit is gaiad init
 | // GDInit is gaiad init
 | ||||||
| // NOTE: GDInit sets the ChainID for the Fixtures instance
 | // NOTE: GDInit sets the ChainID for the Fixtures instance
 | ||||||
| func (f *Fixtures) GDInit(moniker string, flags ...string) { | func (f *Fixtures) GDInit(moniker string, flags ...string) { | ||||||
| 	cmd := fmt.Sprintf("%s init -o --home=%s %s", f.AppDaemonBinary, f.GDHome, moniker) | 	cmd := fmt.Sprintf("%s init -o --home=%s %s", f.GaiadBinary, f.GaiadHome, moniker) | ||||||
| 	_, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), app.DefaultKeyPass) | 	_, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
| 
 | 
 | ||||||
| 	var chainID string | 	var chainID string | ||||||
| 	var initRes map[string]json.RawMessage | 	var initRes map[string]json.RawMessage | ||||||
| @ -212,25 +224,25 @@ func (f *Fixtures) GDInit(moniker string, flags ...string) { | |||||||
| 
 | 
 | ||||||
| // AddGenesisAccount is gaiad add-genesis-account
 | // AddGenesisAccount is gaiad add-genesis-account
 | ||||||
| func (f *Fixtures) AddGenesisAccount(address sdk.AccAddress, coins sdk.Coins, flags ...string) { | func (f *Fixtures) AddGenesisAccount(address sdk.AccAddress, coins sdk.Coins, flags ...string) { | ||||||
| 	cmd := fmt.Sprintf("%s add-genesis-account %s %s --home=%s", f.AppDaemonBinary, address, coins, f.GDHome) | 	cmd := fmt.Sprintf("%s add-genesis-account %s %s --home=%s", f.GaiadBinary, address, coins, f.GaiadHome) | ||||||
| 	executeWriteCheckErr(f.T, addFlags(cmd, flags)) | 	executeWriteCheckErr(f.T, addFlags(cmd, flags)) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // GenTx is gaiad gentx
 | // GenTx is gaiad gentx
 | ||||||
| func (f *Fixtures) GenTx(name string, flags ...string) { | func (f *Fixtures) GenTx(name string, flags ...string) { | ||||||
| 	cmd := fmt.Sprintf("%s gentx --name=%s --home=%s --home-client=%s", f.AppDaemonBinary, name, f.GDHome, f.GCLIHome) | 	cmd := fmt.Sprintf("%s gentx --name=%s --home=%s --home-client=%s", f.GaiadBinary, name, f.GaiadHome, f.GaiacliHome) | ||||||
| 	executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass) | 	executeWriteCheckErr(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // CollectGenTxs is gaiad collect-gentxs
 | // CollectGenTxs is gaiad collect-gentxs
 | ||||||
| func (f *Fixtures) CollectGenTxs(flags ...string) { | func (f *Fixtures) CollectGenTxs(flags ...string) { | ||||||
| 	cmd := fmt.Sprintf("%s collect-gentxs --home=%s", f.AppDaemonBinary, f.GDHome) | 	cmd := fmt.Sprintf("%s collect-gentxs --home=%s", f.GaiadBinary, f.GaiadHome) | ||||||
| 	executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass) | 	executeWriteCheckErr(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // GDStart runs gaiad start with the appropriate flags and returns a process
 | // GDStart runs gaiad start with the appropriate flags and returns a process
 | ||||||
| func (f *Fixtures) GDStart(flags ...string) *tests.Process { | func (f *Fixtures) GDStart(flags ...string) *tests.Process { | ||||||
| 	cmd := fmt.Sprintf("%s start --home=%s --rpc.laddr=%v --p2p.laddr=%v", f.AppDaemonBinary, f.GDHome, f.RPCAddr, f.P2PAddr) | 	cmd := fmt.Sprintf("%s start --home=%s --rpc.laddr=%v --p2p.laddr=%v", f.GaiadBinary, f.GaiadHome, f.RPCAddr, f.P2PAddr) | ||||||
| 	proc := tests.GoExecuteTWithStdout(f.T, addFlags(cmd, flags)) | 	proc := tests.GoExecuteTWithStdout(f.T, addFlags(cmd, flags)) | ||||||
| 	tests.WaitForTMStart(f.Port) | 	tests.WaitForTMStart(f.Port) | ||||||
| 	tests.WaitForNextNBlocksTM(1, f.Port) | 	tests.WaitForNextNBlocksTM(1, f.Port) | ||||||
| @ -239,7 +251,7 @@ func (f *Fixtures) GDStart(flags ...string) *tests.Process { | |||||||
| 
 | 
 | ||||||
| // GDTendermint returns the results of gaiad tendermint [query]
 | // GDTendermint returns the results of gaiad tendermint [query]
 | ||||||
| func (f *Fixtures) GDTendermint(query string) string { | func (f *Fixtures) GDTendermint(query string) string { | ||||||
| 	cmd := fmt.Sprintf("%s tendermint %s --home=%s", f.AppDaemonBinary, query, f.GDHome) | 	cmd := fmt.Sprintf("%s tendermint %s --home=%s", f.GaiadBinary, query, f.GaiadHome) | ||||||
| 	success, stdout, stderr := executeWriteRetStdStreams(f.T, cmd) | 	success, stdout, stderr := executeWriteRetStdStreams(f.T, cmd) | ||||||
| 	require.Empty(f.T, stderr) | 	require.Empty(f.T, stderr) | ||||||
| 	require.True(f.T, success) | 	require.True(f.T, success) | ||||||
| @ -248,7 +260,7 @@ func (f *Fixtures) GDTendermint(query string) string { | |||||||
| 
 | 
 | ||||||
| // ValidateGenesis runs gaiad validate-genesis
 | // ValidateGenesis runs gaiad validate-genesis
 | ||||||
| func (f *Fixtures) ValidateGenesis() { | func (f *Fixtures) ValidateGenesis() { | ||||||
| 	cmd := fmt.Sprintf("%s validate-genesis --home=%s", f.AppDaemonBinary, f.GDHome) | 	cmd := fmt.Sprintf("%s validate-genesis --home=%s", f.GaiadBinary, f.GaiadHome) | ||||||
| 	executeWriteCheckErr(f.T, cmd) | 	executeWriteCheckErr(f.T, cmd) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -257,31 +269,31 @@ func (f *Fixtures) ValidateGenesis() { | |||||||
| 
 | 
 | ||||||
| // KeysDelete is gaiacli keys delete
 | // KeysDelete is gaiacli keys delete
 | ||||||
| func (f *Fixtures) KeysDelete(name string, flags ...string) { | func (f *Fixtures) KeysDelete(name string, flags ...string) { | ||||||
| 	cmd := fmt.Sprintf("%s keys delete --home=%s %s", f.AppCliBinary, f.GCLIHome, name) | 	cmd := fmt.Sprintf("%s keys delete --home=%s %s", f.GaiacliBinary, f.GaiacliHome, name) | ||||||
| 	executeWrite(f.T, addFlags(cmd, append(append(flags, "-y"), "-f"))) | 	executeWrite(f.T, addFlags(cmd, append(append(flags, "-y"), "-f"))) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // KeysAdd is gaiacli keys add
 | // KeysAdd is gaiacli keys add
 | ||||||
| func (f *Fixtures) KeysAdd(name string, flags ...string) { | func (f *Fixtures) KeysAdd(name string, flags ...string) { | ||||||
| 	cmd := fmt.Sprintf("%s keys add --home=%s %s", f.AppCliBinary, f.GCLIHome, name) | 	cmd := fmt.Sprintf("%s keys add --home=%s %s", f.GaiacliBinary, f.GaiacliHome, name) | ||||||
| 	executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass) | 	executeWriteCheckErr(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // KeysAddRecover prepares gaiacli keys add --recover
 | // KeysAddRecover prepares gaiacli keys add --recover
 | ||||||
| func (f *Fixtures) KeysAddRecover(name, mnemonic string, flags ...string) (exitSuccess bool, stdout, stderr string) { | func (f *Fixtures) KeysAddRecover(name, mnemonic string, flags ...string) (exitSuccess bool, stdout, stderr string) { | ||||||
| 	cmd := fmt.Sprintf("%s keys add --home=%s --recover %s", f.AppCliBinary, f.GCLIHome, name) | 	cmd := fmt.Sprintf("%s keys add --home=%s --recover %s", f.GaiacliBinary, f.GaiacliHome, name) | ||||||
| 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass, mnemonic) | 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass, mnemonic) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // KeysAddRecoverHDPath prepares gaiacli keys add --recover --account --index
 | // KeysAddRecoverHDPath prepares gaiacli keys add --recover --account --index
 | ||||||
| func (f *Fixtures) KeysAddRecoverHDPath(name, mnemonic string, account uint32, index uint32, flags ...string) { | func (f *Fixtures) KeysAddRecoverHDPath(name, mnemonic string, account uint32, index uint32, flags ...string) { | ||||||
| 	cmd := fmt.Sprintf("%s keys add --home=%s --recover %s --account %d --index %d", f.AppCliBinary, f.GCLIHome, name, account, index) | 	cmd := fmt.Sprintf("%s keys add --home=%s --recover %s --account %d --index %d", f.GaiacliBinary, f.GaiacliHome, name, account, index) | ||||||
| 	executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass, mnemonic) | 	executeWriteCheckErr(f.T, addFlags(cmd, flags), client.DefaultKeyPass, mnemonic) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // KeysShow is gaiacli keys show
 | // KeysShow is gaiacli keys show
 | ||||||
| func (f *Fixtures) KeysShow(name string, flags ...string) keys.KeyOutput { | func (f *Fixtures) KeysShow(name string, flags ...string) keys.KeyOutput { | ||||||
| 	cmd := fmt.Sprintf("%s keys show --home=%s %s", f.AppCliBinary, f.GCLIHome, name) | 	cmd := fmt.Sprintf("%s keys show --home=%s %s", f.GaiacliBinary, f.GaiacliHome, name) | ||||||
| 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | ||||||
| 	var ko keys.KeyOutput | 	var ko keys.KeyOutput | ||||||
| 	err := clientkeys.UnmarshalJSON([]byte(out), &ko) | 	err := clientkeys.UnmarshalJSON([]byte(out), &ko) | ||||||
| @ -302,7 +314,7 @@ func (f *Fixtures) KeyAddress(name string) sdk.AccAddress { | |||||||
| 
 | 
 | ||||||
| // CLIConfig is gaiacli config
 | // CLIConfig is gaiacli config
 | ||||||
| func (f *Fixtures) CLIConfig(key, value string, flags ...string) { | func (f *Fixtures) CLIConfig(key, value string, flags ...string) { | ||||||
| 	cmd := fmt.Sprintf("%s config --home=%s %s %s", f.AppCliBinary, f.GCLIHome, key, value) | 	cmd := fmt.Sprintf("%s config --home=%s %s %s", f.GaiacliBinary, f.GaiacliHome, key, value) | ||||||
| 	executeWriteCheckErr(f.T, addFlags(cmd, flags)) | 	executeWriteCheckErr(f.T, addFlags(cmd, flags)) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -311,41 +323,33 @@ func (f *Fixtures) CLIConfig(key, value string, flags ...string) { | |||||||
| 
 | 
 | ||||||
| // TxSend is gaiacli tx send
 | // TxSend is gaiacli tx send
 | ||||||
| func (f *Fixtures) TxSend(from string, to sdk.AccAddress, amount sdk.Coin, flags ...string) (bool, string, string) { | func (f *Fixtures) TxSend(from string, to sdk.AccAddress, amount sdk.Coin, flags ...string) (bool, string, string) { | ||||||
| 	cmd := fmt.Sprintf("%s tx send %s %s %v --from=%s", f.AppCliBinary, to, amount, f.Flags(), from) | 	cmd := fmt.Sprintf("%s tx send %s %s %s %v", f.GaiacliBinary, from, to, amount, f.Flags()) | ||||||
| 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) | 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (f *Fixtures) txSendWithConfirm( |  | ||||||
| 	from string, to sdk.AccAddress, amount sdk.Coin, confirm string, flags ...string, |  | ||||||
| ) (bool, string, string) { |  | ||||||
| 
 |  | ||||||
| 	cmd := fmt.Sprintf("%s tx send %s %s %v --from=%s", f.AppCliBinary, to, amount, f.Flags(), from) |  | ||||||
| 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), confirm, app.DefaultKeyPass) |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TxSign is gaiacli tx sign
 | // TxSign is gaiacli tx sign
 | ||||||
| func (f *Fixtures) TxSign(signer, fileName string, flags ...string) (bool, string, string) { | func (f *Fixtures) TxSign(signer, fileName string, flags ...string) (bool, string, string) { | ||||||
| 	cmd := fmt.Sprintf("%s tx sign %v --from=%s %v", f.AppCliBinary, f.Flags(), signer, fileName) | 	cmd := fmt.Sprintf("%s tx sign %v --from=%s %v", f.GaiacliBinary, f.Flags(), signer, fileName) | ||||||
| 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) | 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TxBroadcast is gaiacli tx broadcast
 | // TxBroadcast is gaiacli tx broadcast
 | ||||||
| func (f *Fixtures) TxBroadcast(fileName string, flags ...string) (bool, string, string) { | func (f *Fixtures) TxBroadcast(fileName string, flags ...string) (bool, string, string) { | ||||||
| 	cmd := fmt.Sprintf("%s tx broadcast %v %v", f.AppCliBinary, f.Flags(), fileName) | 	cmd := fmt.Sprintf("%s tx broadcast %v %v", f.GaiacliBinary, f.Flags(), fileName) | ||||||
| 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) | 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TxEncode is gaiacli tx encode
 | // TxEncode is gaiacli tx encode
 | ||||||
| func (f *Fixtures) TxEncode(fileName string, flags ...string) (bool, string, string) { | func (f *Fixtures) TxEncode(fileName string, flags ...string) (bool, string, string) { | ||||||
| 	cmd := fmt.Sprintf("%s tx encode %v %v", f.AppCliBinary, f.Flags(), fileName) | 	cmd := fmt.Sprintf("%s tx encode %v %v", f.GaiacliBinary, f.Flags(), fileName) | ||||||
| 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) | 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TxMultisign is gaiacli tx multisign
 | // TxMultisign is gaiacli tx multisign
 | ||||||
| func (f *Fixtures) TxMultisign(fileName, name string, signaturesFiles []string, | func (f *Fixtures) TxMultisign(fileName, name string, signaturesFiles []string, | ||||||
| 	flags ...string) (bool, string, string) { | 	flags ...string) (bool, string, string) { | ||||||
| 
 | 
 | ||||||
| 	cmd := fmt.Sprintf("%s tx multisign %v %s %s %s", f.AppCliBinary, f.Flags(), | 	cmd := fmt.Sprintf("%s tx multisign %v %s %s %s", f.GaiacliBinary, f.Flags(), | ||||||
| 		fileName, name, strings.Join(signaturesFiles, " "), | 		fileName, name, strings.Join(signaturesFiles, " "), | ||||||
| 	) | 	) | ||||||
| 	return executeWriteRetStdStreams(f.T, cmd) | 	return executeWriteRetStdStreams(f.T, cmd) | ||||||
| @ -356,17 +360,17 @@ func (f *Fixtures) TxMultisign(fileName, name string, signaturesFiles []string, | |||||||
| 
 | 
 | ||||||
| // TxStakingCreateValidator is gaiacli tx staking create-validator
 | // TxStakingCreateValidator is gaiacli tx staking create-validator
 | ||||||
| func (f *Fixtures) TxStakingCreateValidator(from, consPubKey string, amount sdk.Coin, flags ...string) (bool, string, string) { | func (f *Fixtures) TxStakingCreateValidator(from, consPubKey string, amount sdk.Coin, flags ...string) (bool, string, string) { | ||||||
| 	cmd := fmt.Sprintf("%s tx staking create-validator %v --from=%s --pubkey=%s", f.AppCliBinary, f.Flags(), from, consPubKey) | 	cmd := fmt.Sprintf("%s tx staking create-validator %v --from=%s --pubkey=%s", f.GaiacliBinary, f.Flags(), from, consPubKey) | ||||||
| 	cmd += fmt.Sprintf(" --amount=%v --moniker=%v --commission-rate=%v", amount, from, "0.05") | 	cmd += fmt.Sprintf(" --amount=%v --moniker=%v --commission-rate=%v", amount, from, "0.05") | ||||||
| 	cmd += fmt.Sprintf(" --commission-max-rate=%v --commission-max-change-rate=%v", "0.20", "0.10") | 	cmd += fmt.Sprintf(" --commission-max-rate=%v --commission-max-change-rate=%v", "0.20", "0.10") | ||||||
| 	cmd += fmt.Sprintf(" --min-self-delegation=%v", "1") | 	cmd += fmt.Sprintf(" --min-self-delegation=%v", "1") | ||||||
| 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) | 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TxStakingUnbond is gaiacli tx staking unbond
 | // TxStakingUnbond is gaiacli tx staking unbond
 | ||||||
| func (f *Fixtures) TxStakingUnbond(from, shares string, validator sdk.ValAddress, flags ...string) bool { | func (f *Fixtures) TxStakingUnbond(from, shares string, validator sdk.ValAddress, flags ...string) bool { | ||||||
| 	cmd := fmt.Sprintf("%s tx staking unbond %s %v --from=%s %v", f.AppCliBinary, validator, shares, from, f.Flags()) | 	cmd := fmt.Sprintf("%s tx staking unbond %s %v --from=%s %v", f.GaiacliBinary, validator, shares, from, f.Flags()) | ||||||
| 	return executeWrite(f.T, addFlags(cmd, flags), app.DefaultKeyPass) | 	return executeWrite(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //___________________________________________________________________________________
 | //___________________________________________________________________________________
 | ||||||
| @ -374,21 +378,49 @@ func (f *Fixtures) TxStakingUnbond(from, shares string, validator sdk.ValAddress | |||||||
| 
 | 
 | ||||||
| // TxGovSubmitProposal is gaiacli tx gov submit-proposal
 | // TxGovSubmitProposal is gaiacli tx gov submit-proposal
 | ||||||
| func (f *Fixtures) TxGovSubmitProposal(from, typ, title, description string, deposit sdk.Coin, flags ...string) (bool, string, string) { | func (f *Fixtures) TxGovSubmitProposal(from, typ, title, description string, deposit sdk.Coin, flags ...string) (bool, string, string) { | ||||||
| 	cmd := fmt.Sprintf("%s tx gov submit-proposal %v --from=%s --type=%s", f.AppCliBinary, f.Flags(), from, typ) | 	cmd := fmt.Sprintf("%s tx gov submit-proposal %v --from=%s --type=%s", f.GaiacliBinary, f.Flags(), from, typ) | ||||||
| 	cmd += fmt.Sprintf(" --title=%s --description=%s --deposit=%s", title, description, deposit) | 	cmd += fmt.Sprintf(" --title=%s --description=%s --deposit=%s", title, description, deposit) | ||||||
| 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) | 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TxGovDeposit is gaiacli tx gov deposit
 | // TxGovDeposit is gaiacli tx gov deposit
 | ||||||
| func (f *Fixtures) TxGovDeposit(proposalID int, from string, amount sdk.Coin, flags ...string) (bool, string, string) { | func (f *Fixtures) TxGovDeposit(proposalID int, from string, amount sdk.Coin, flags ...string) (bool, string, string) { | ||||||
| 	cmd := fmt.Sprintf("%s tx gov deposit %d %s --from=%s %v", f.AppCliBinary, proposalID, amount, from, f.Flags()) | 	cmd := fmt.Sprintf("%s tx gov deposit %d %s --from=%s %v", f.GaiacliBinary, proposalID, amount, from, f.Flags()) | ||||||
| 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) | 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TxGovVote is gaiacli tx gov vote
 | // TxGovVote is gaiacli tx gov vote
 | ||||||
| func (f *Fixtures) TxGovVote(proposalID int, option gov.VoteOption, from string, flags ...string) (bool, string, string) { | func (f *Fixtures) TxGovVote(proposalID int, option gov.VoteOption, from string, flags ...string) (bool, string, string) { | ||||||
| 	cmd := fmt.Sprintf("%s tx gov vote %d %s --from=%s %v", f.AppCliBinary, proposalID, option, from, f.Flags()) | 	cmd := fmt.Sprintf("%s tx gov vote %d %s --from=%s %v", f.GaiacliBinary, proposalID, option, from, f.Flags()) | ||||||
| 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) | 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // TxGovSubmitParamChangeProposal executes a CLI parameter change proposal
 | ||||||
|  | // submission.
 | ||||||
|  | func (f *Fixtures) TxGovSubmitParamChangeProposal( | ||||||
|  | 	from, proposalPath string, deposit sdk.Coin, flags ...string, | ||||||
|  | ) (bool, string, string) { | ||||||
|  | 
 | ||||||
|  | 	cmd := fmt.Sprintf( | ||||||
|  | 		"%s tx gov submit-proposal param-change %s --from=%s %v", | ||||||
|  | 		f.GaiacliBinary, proposalPath, from, f.Flags(), | ||||||
|  | 	) | ||||||
|  | 
 | ||||||
|  | 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // TxGovSubmitCommunityPoolSpendProposal executes a CLI community pool spend proposal
 | ||||||
|  | // submission.
 | ||||||
|  | func (f *Fixtures) TxGovSubmitCommunityPoolSpendProposal( | ||||||
|  | 	from, proposalPath string, deposit sdk.Coin, flags ...string, | ||||||
|  | ) (bool, string, string) { | ||||||
|  | 
 | ||||||
|  | 	cmd := fmt.Sprintf( | ||||||
|  | 		"%s tx gov submit-proposal community-pool-spend %s --from=%s %v", | ||||||
|  | 		f.GaiacliBinary, proposalPath, from, f.Flags(), | ||||||
|  | 	) | ||||||
|  | 
 | ||||||
|  | 	return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //___________________________________________________________________________________
 | //___________________________________________________________________________________
 | ||||||
| @ -396,7 +428,7 @@ func (f *Fixtures) TxGovVote(proposalID int, option gov.VoteOption, from string, | |||||||
| 
 | 
 | ||||||
| // QueryAccount is gaiacli query account
 | // QueryAccount is gaiacli query account
 | ||||||
| func (f *Fixtures) QueryAccount(address sdk.AccAddress, flags ...string) auth.BaseAccount { | func (f *Fixtures) QueryAccount(address sdk.AccAddress, flags ...string) auth.BaseAccount { | ||||||
| 	cmd := fmt.Sprintf("%s query account %s %v", f.AppCliBinary, address, f.Flags()) | 	cmd := fmt.Sprintf("%s query account %s %v", f.GaiacliBinary, address, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | ||||||
| 	var initRes map[string]json.RawMessage | 	var initRes map[string]json.RawMessage | ||||||
| 	err := json.Unmarshal([]byte(out), &initRes) | 	err := json.Unmarshal([]byte(out), &initRes) | ||||||
| @ -414,19 +446,19 @@ func (f *Fixtures) QueryAccount(address sdk.AccAddress, flags ...string) auth.Ba | |||||||
| // gaiacli query txs
 | // gaiacli query txs
 | ||||||
| 
 | 
 | ||||||
| // QueryTxs is gaiacli query txs
 | // QueryTxs is gaiacli query txs
 | ||||||
| func (f *Fixtures) QueryTxs(page, limit int, tags ...string) []sdk.TxResponse { | func (f *Fixtures) QueryTxs(page, limit int, tags ...string) *sdk.SearchTxsResult { | ||||||
| 	cmd := fmt.Sprintf("%s query txs --page=%d --limit=%d --tags='%s' %v", f.AppCliBinary, page, limit, queryTags(tags), f.Flags()) | 	cmd := fmt.Sprintf("%s query txs --page=%d --limit=%d --tags='%s' %v", f.GaiacliBinary, page, limit, queryTags(tags), f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, cmd, "") | 	out, _ := tests.ExecuteT(f.T, cmd, "") | ||||||
| 	var txs []sdk.TxResponse | 	var result sdk.SearchTxsResult | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| 	err := cdc.UnmarshalJSON([]byte(out), &txs) | 	err := cdc.UnmarshalJSON([]byte(out), &result) | ||||||
| 	require.NoError(f.T, err, "out %v\n, err %v", out, err) | 	require.NoError(f.T, err, "out %v\n, err %v", out, err) | ||||||
| 	return txs | 	return &result | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // QueryTxsInvalid query txs with wrong parameters and compare expected error
 | // QueryTxsInvalid query txs with wrong parameters and compare expected error
 | ||||||
| func (f *Fixtures) QueryTxsInvalid(expectedErr error, page, limit int, tags ...string) { | func (f *Fixtures) QueryTxsInvalid(expectedErr error, page, limit int, tags ...string) { | ||||||
| 	cmd := fmt.Sprintf("%s query txs --page=%d --limit=%d --tags='%s' %v", f.AppCliBinary, page, limit, queryTags(tags), f.Flags()) | 	cmd := fmt.Sprintf("%s query txs --page=%d --limit=%d --tags='%s' %v", f.GaiacliBinary, page, limit, queryTags(tags), f.Flags()) | ||||||
| 	_, err := tests.ExecuteT(f.T, cmd, "") | 	_, err := tests.ExecuteT(f.T, cmd, "") | ||||||
| 	require.EqualError(f.T, expectedErr, err) | 	require.EqualError(f.T, expectedErr, err) | ||||||
| } | } | ||||||
| @ -436,7 +468,7 @@ func (f *Fixtures) QueryTxsInvalid(expectedErr error, page, limit int, tags ...s | |||||||
| 
 | 
 | ||||||
| // QueryStakingValidator is gaiacli query staking validator
 | // QueryStakingValidator is gaiacli query staking validator
 | ||||||
| func (f *Fixtures) QueryStakingValidator(valAddr sdk.ValAddress, flags ...string) staking.Validator { | func (f *Fixtures) QueryStakingValidator(valAddr sdk.ValAddress, flags ...string) staking.Validator { | ||||||
| 	cmd := fmt.Sprintf("%s query staking validator %s %v", f.AppCliBinary, valAddr, f.Flags()) | 	cmd := fmt.Sprintf("%s query staking validator %s %v", f.GaiacliBinary, valAddr, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | ||||||
| 	var validator staking.Validator | 	var validator staking.Validator | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -447,7 +479,7 @@ func (f *Fixtures) QueryStakingValidator(valAddr sdk.ValAddress, flags ...string | |||||||
| 
 | 
 | ||||||
| // QueryStakingUnbondingDelegationsFrom is gaiacli query staking unbonding-delegations-from
 | // QueryStakingUnbondingDelegationsFrom is gaiacli query staking unbonding-delegations-from
 | ||||||
| func (f *Fixtures) QueryStakingUnbondingDelegationsFrom(valAddr sdk.ValAddress, flags ...string) []staking.UnbondingDelegation { | func (f *Fixtures) QueryStakingUnbondingDelegationsFrom(valAddr sdk.ValAddress, flags ...string) []staking.UnbondingDelegation { | ||||||
| 	cmd := fmt.Sprintf("%s query staking unbonding-delegations-from %s %v", f.AppCliBinary, valAddr, f.Flags()) | 	cmd := fmt.Sprintf("%s query staking unbonding-delegations-from %s %v", f.GaiacliBinary, valAddr, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | ||||||
| 	var ubds []staking.UnbondingDelegation | 	var ubds []staking.UnbondingDelegation | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -458,7 +490,7 @@ func (f *Fixtures) QueryStakingUnbondingDelegationsFrom(valAddr sdk.ValAddress, | |||||||
| 
 | 
 | ||||||
| // QueryStakingDelegationsTo is gaiacli query staking delegations-to
 | // QueryStakingDelegationsTo is gaiacli query staking delegations-to
 | ||||||
| func (f *Fixtures) QueryStakingDelegationsTo(valAddr sdk.ValAddress, flags ...string) []staking.Delegation { | func (f *Fixtures) QueryStakingDelegationsTo(valAddr sdk.ValAddress, flags ...string) []staking.Delegation { | ||||||
| 	cmd := fmt.Sprintf("%s query staking delegations-to %s %v", f.AppCliBinary, valAddr, f.Flags()) | 	cmd := fmt.Sprintf("%s query staking delegations-to %s %v", f.GaiacliBinary, valAddr, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | ||||||
| 	var delegations []staking.Delegation | 	var delegations []staking.Delegation | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -469,7 +501,7 @@ func (f *Fixtures) QueryStakingDelegationsTo(valAddr sdk.ValAddress, flags ...st | |||||||
| 
 | 
 | ||||||
| // QueryStakingPool is gaiacli query staking pool
 | // QueryStakingPool is gaiacli query staking pool
 | ||||||
| func (f *Fixtures) QueryStakingPool(flags ...string) staking.Pool { | func (f *Fixtures) QueryStakingPool(flags ...string) staking.Pool { | ||||||
| 	cmd := fmt.Sprintf("%s query staking pool %v", f.AppCliBinary, f.Flags()) | 	cmd := fmt.Sprintf("%s query staking pool %v", f.GaiacliBinary, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | ||||||
| 	var pool staking.Pool | 	var pool staking.Pool | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -480,7 +512,7 @@ func (f *Fixtures) QueryStakingPool(flags ...string) staking.Pool { | |||||||
| 
 | 
 | ||||||
| // QueryStakingParameters is gaiacli query staking parameters
 | // QueryStakingParameters is gaiacli query staking parameters
 | ||||||
| func (f *Fixtures) QueryStakingParameters(flags ...string) staking.Params { | func (f *Fixtures) QueryStakingParameters(flags ...string) staking.Params { | ||||||
| 	cmd := fmt.Sprintf("%s query staking params %v", f.AppCliBinary, f.Flags()) | 	cmd := fmt.Sprintf("%s query staking params %v", f.GaiacliBinary, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | ||||||
| 	var params staking.Params | 	var params staking.Params | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -494,7 +526,7 @@ func (f *Fixtures) QueryStakingParameters(flags ...string) staking.Params { | |||||||
| 
 | 
 | ||||||
| // QueryGovParamDeposit is gaiacli query gov param deposit
 | // QueryGovParamDeposit is gaiacli query gov param deposit
 | ||||||
| func (f *Fixtures) QueryGovParamDeposit() gov.DepositParams { | func (f *Fixtures) QueryGovParamDeposit() gov.DepositParams { | ||||||
| 	cmd := fmt.Sprintf("%s query gov param deposit %s", f.AppCliBinary, f.Flags()) | 	cmd := fmt.Sprintf("%s query gov param deposit %s", f.GaiacliBinary, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, cmd, "") | 	out, _ := tests.ExecuteT(f.T, cmd, "") | ||||||
| 	var depositParam gov.DepositParams | 	var depositParam gov.DepositParams | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -505,7 +537,7 @@ func (f *Fixtures) QueryGovParamDeposit() gov.DepositParams { | |||||||
| 
 | 
 | ||||||
| // QueryGovParamVoting is gaiacli query gov param voting
 | // QueryGovParamVoting is gaiacli query gov param voting
 | ||||||
| func (f *Fixtures) QueryGovParamVoting() gov.VotingParams { | func (f *Fixtures) QueryGovParamVoting() gov.VotingParams { | ||||||
| 	cmd := fmt.Sprintf("%s query gov param voting %s", f.AppCliBinary, f.Flags()) | 	cmd := fmt.Sprintf("%s query gov param voting %s", f.GaiacliBinary, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, cmd, "") | 	out, _ := tests.ExecuteT(f.T, cmd, "") | ||||||
| 	var votingParam gov.VotingParams | 	var votingParam gov.VotingParams | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -516,7 +548,7 @@ func (f *Fixtures) QueryGovParamVoting() gov.VotingParams { | |||||||
| 
 | 
 | ||||||
| // QueryGovParamTallying is gaiacli query gov param tallying
 | // QueryGovParamTallying is gaiacli query gov param tallying
 | ||||||
| func (f *Fixtures) QueryGovParamTallying() gov.TallyParams { | func (f *Fixtures) QueryGovParamTallying() gov.TallyParams { | ||||||
| 	cmd := fmt.Sprintf("%s query gov param tallying %s", f.AppCliBinary, f.Flags()) | 	cmd := fmt.Sprintf("%s query gov param tallying %s", f.GaiacliBinary, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, cmd, "") | 	out, _ := tests.ExecuteT(f.T, cmd, "") | ||||||
| 	var tallyingParam gov.TallyParams | 	var tallyingParam gov.TallyParams | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -527,9 +559,9 @@ func (f *Fixtures) QueryGovParamTallying() gov.TallyParams { | |||||||
| 
 | 
 | ||||||
| // QueryGovProposals is gaiacli query gov proposals
 | // QueryGovProposals is gaiacli query gov proposals
 | ||||||
| func (f *Fixtures) QueryGovProposals(flags ...string) gov.Proposals { | func (f *Fixtures) QueryGovProposals(flags ...string) gov.Proposals { | ||||||
| 	cmd := fmt.Sprintf("%s query gov proposals %v", f.AppCliBinary, f.Flags()) | 	cmd := fmt.Sprintf("%s query gov proposals %v", f.GaiacliBinary, f.Flags()) | ||||||
| 	stdout, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | 	stdout, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | ||||||
| 	if strings.Contains(stderr, "No matching proposals found") { | 	if strings.Contains(stderr, "no matching proposals found") { | ||||||
| 		return gov.Proposals{} | 		return gov.Proposals{} | ||||||
| 	} | 	} | ||||||
| 	require.Empty(f.T, stderr) | 	require.Empty(f.T, stderr) | ||||||
| @ -542,7 +574,7 @@ func (f *Fixtures) QueryGovProposals(flags ...string) gov.Proposals { | |||||||
| 
 | 
 | ||||||
| // QueryGovProposal is gaiacli query gov proposal
 | // QueryGovProposal is gaiacli query gov proposal
 | ||||||
| func (f *Fixtures) QueryGovProposal(proposalID int, flags ...string) gov.Proposal { | func (f *Fixtures) QueryGovProposal(proposalID int, flags ...string) gov.Proposal { | ||||||
| 	cmd := fmt.Sprintf("%s query gov proposal %d %v", f.AppCliBinary, proposalID, f.Flags()) | 	cmd := fmt.Sprintf("%s query gov proposal %d %v", f.GaiacliBinary, proposalID, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | ||||||
| 	var proposal gov.Proposal | 	var proposal gov.Proposal | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -553,7 +585,7 @@ func (f *Fixtures) QueryGovProposal(proposalID int, flags ...string) gov.Proposa | |||||||
| 
 | 
 | ||||||
| // QueryGovVote is gaiacli query gov vote
 | // QueryGovVote is gaiacli query gov vote
 | ||||||
| func (f *Fixtures) QueryGovVote(proposalID int, voter sdk.AccAddress, flags ...string) gov.Vote { | func (f *Fixtures) QueryGovVote(proposalID int, voter sdk.AccAddress, flags ...string) gov.Vote { | ||||||
| 	cmd := fmt.Sprintf("%s query gov vote %d %s %v", f.AppCliBinary, proposalID, voter, f.Flags()) | 	cmd := fmt.Sprintf("%s query gov vote %d %s %v", f.GaiacliBinary, proposalID, voter, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | ||||||
| 	var vote gov.Vote | 	var vote gov.Vote | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -564,7 +596,7 @@ func (f *Fixtures) QueryGovVote(proposalID int, voter sdk.AccAddress, flags ...s | |||||||
| 
 | 
 | ||||||
| // QueryGovVotes is gaiacli query gov votes
 | // QueryGovVotes is gaiacli query gov votes
 | ||||||
| func (f *Fixtures) QueryGovVotes(proposalID int, flags ...string) []gov.Vote { | func (f *Fixtures) QueryGovVotes(proposalID int, flags ...string) []gov.Vote { | ||||||
| 	cmd := fmt.Sprintf("%s query gov votes %d %v", f.AppCliBinary, proposalID, f.Flags()) | 	cmd := fmt.Sprintf("%s query gov votes %d %v", f.GaiacliBinary, proposalID, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | ||||||
| 	var votes []gov.Vote | 	var votes []gov.Vote | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -575,7 +607,7 @@ func (f *Fixtures) QueryGovVotes(proposalID int, flags ...string) []gov.Vote { | |||||||
| 
 | 
 | ||||||
| // QueryGovDeposit is gaiacli query gov deposit
 | // QueryGovDeposit is gaiacli query gov deposit
 | ||||||
| func (f *Fixtures) QueryGovDeposit(proposalID int, depositor sdk.AccAddress, flags ...string) gov.Deposit { | func (f *Fixtures) QueryGovDeposit(proposalID int, depositor sdk.AccAddress, flags ...string) gov.Deposit { | ||||||
| 	cmd := fmt.Sprintf("%s query gov deposit %d %s %v", f.AppCliBinary, proposalID, depositor, f.Flags()) | 	cmd := fmt.Sprintf("%s query gov deposit %d %s %v", f.GaiacliBinary, proposalID, depositor, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | ||||||
| 	var deposit gov.Deposit | 	var deposit gov.Deposit | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -586,7 +618,7 @@ func (f *Fixtures) QueryGovDeposit(proposalID int, depositor sdk.AccAddress, fla | |||||||
| 
 | 
 | ||||||
| // QueryGovDeposits is gaiacli query gov deposits
 | // QueryGovDeposits is gaiacli query gov deposits
 | ||||||
| func (f *Fixtures) QueryGovDeposits(propsalID int, flags ...string) []gov.Deposit { | func (f *Fixtures) QueryGovDeposits(propsalID int, flags ...string) []gov.Deposit { | ||||||
| 	cmd := fmt.Sprintf("%s query gov deposits %d %v", f.AppCliBinary, propsalID, f.Flags()) | 	cmd := fmt.Sprintf("%s query gov deposits %d %v", f.GaiacliBinary, propsalID, f.Flags()) | ||||||
| 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | 	out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") | ||||||
| 	var deposits []gov.Deposit | 	var deposits []gov.Deposit | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -600,7 +632,7 @@ func (f *Fixtures) QueryGovDeposits(propsalID int, flags ...string) []gov.Deposi | |||||||
| 
 | 
 | ||||||
| // QuerySigningInfo returns the signing info for a validator
 | // QuerySigningInfo returns the signing info for a validator
 | ||||||
| func (f *Fixtures) QuerySigningInfo(val string) slashing.ValidatorSigningInfo { | func (f *Fixtures) QuerySigningInfo(val string) slashing.ValidatorSigningInfo { | ||||||
| 	cmd := fmt.Sprintf("%s query slashing signing-info %s %s", f.AppCliBinary, val, f.Flags()) | 	cmd := fmt.Sprintf("%s query slashing signing-info %s %s", f.GaiacliBinary, val, f.Flags()) | ||||||
| 	res, errStr := tests.ExecuteT(f.T, cmd, "") | 	res, errStr := tests.ExecuteT(f.T, cmd, "") | ||||||
| 	require.Empty(f.T, errStr) | 	require.Empty(f.T, errStr) | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -612,7 +644,7 @@ func (f *Fixtures) QuerySigningInfo(val string) slashing.ValidatorSigningInfo { | |||||||
| 
 | 
 | ||||||
| // QuerySlashingParams is gaiacli query slashing params
 | // QuerySlashingParams is gaiacli query slashing params
 | ||||||
| func (f *Fixtures) QuerySlashingParams() slashing.Params { | func (f *Fixtures) QuerySlashingParams() slashing.Params { | ||||||
| 	cmd := fmt.Sprintf("%s query slashing params %s", f.AppCliBinary, f.Flags()) | 	cmd := fmt.Sprintf("%s query slashing params %s", f.GaiacliBinary, f.Flags()) | ||||||
| 	res, errStr := tests.ExecuteT(f.T, cmd, "") | 	res, errStr := tests.ExecuteT(f.T, cmd, "") | ||||||
| 	require.Empty(f.T, errStr) | 	require.Empty(f.T, errStr) | ||||||
| 	cdc := app.MakeCodec() | 	cdc := app.MakeCodec() | ||||||
| @ -622,6 +654,47 @@ func (f *Fixtures) QuerySlashingParams() slashing.Params { | |||||||
| 	return params | 	return params | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | //___________________________________________________________________________________
 | ||||||
|  | // query distribution
 | ||||||
|  | 
 | ||||||
|  | // QueryRewards returns the rewards of a delegator
 | ||||||
|  | func (f *Fixtures) QueryRewards(delAddr sdk.AccAddress, flags ...string) distribution.QueryDelegatorTotalRewardsResponse { | ||||||
|  | 	cmd := fmt.Sprintf("%s query distribution rewards %s %s", f.GaiacliBinary, delAddr, f.Flags()) | ||||||
|  | 	res, errStr := tests.ExecuteT(f.T, cmd, "") | ||||||
|  | 	require.Empty(f.T, errStr) | ||||||
|  | 	cdc := app.MakeCodec() | ||||||
|  | 	var rewards distribution.QueryDelegatorTotalRewardsResponse | ||||||
|  | 	err := cdc.UnmarshalJSON([]byte(res), &rewards) | ||||||
|  | 	require.NoError(f.T, err) | ||||||
|  | 	return rewards | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | //___________________________________________________________________________________
 | ||||||
|  | // query supply
 | ||||||
|  | 
 | ||||||
|  | // QueryTotalSupply returns the total supply of coins
 | ||||||
|  | func (f *Fixtures) QueryTotalSupply(flags ...string) (totalSupply sdk.Coins) { | ||||||
|  | 	cmd := fmt.Sprintf("%s query supply total %s", f.GaiacliBinary, f.Flags()) | ||||||
|  | 	res, errStr := tests.ExecuteT(f.T, cmd, "") | ||||||
|  | 	require.Empty(f.T, errStr) | ||||||
|  | 	cdc := app.MakeCodec() | ||||||
|  | 	err := cdc.UnmarshalJSON([]byte(res), &totalSupply) | ||||||
|  | 	require.NoError(f.T, err) | ||||||
|  | 	return totalSupply | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // QueryTotalSupplyOf returns the total supply of a given coin denom
 | ||||||
|  | func (f *Fixtures) QueryTotalSupplyOf(denom string, flags ...string) sdk.Int { | ||||||
|  | 	cmd := fmt.Sprintf("%s query supply total %s %s", f.GaiacliBinary, denom, f.Flags()) | ||||||
|  | 	res, errStr := tests.ExecuteT(f.T, cmd, "") | ||||||
|  | 	require.Empty(f.T, errStr) | ||||||
|  | 	cdc := app.MakeCodec() | ||||||
|  | 	var supplyOf sdk.Int | ||||||
|  | 	err := cdc.UnmarshalJSON([]byte(res), &supplyOf) | ||||||
|  | 	require.NoError(f.T, err) | ||||||
|  | 	return supplyOf | ||||||
|  | } | ||||||
|  | 
 | ||||||
| //___________________________________________________________________________________
 | //___________________________________________________________________________________
 | ||||||
| // executors
 | // executors
 | ||||||
| 
 | 
 | ||||||
| @ -651,10 +724,10 @@ func executeWriteRetStdStreams(t *testing.T, cmdStr string, writes ...string) (b | |||||||
| 
 | 
 | ||||||
| 	// Log output.
 | 	// Log output.
 | ||||||
| 	if len(stdout) > 0 { | 	if len(stdout) > 0 { | ||||||
| 		t.Log("Stdout:", cmn.Green(string(stdout))) | 		t.Log("Stdout:", string(stdout)) | ||||||
| 	} | 	} | ||||||
| 	if len(stderr) > 0 { | 	if len(stderr) > 0 { | ||||||
| 		t.Log("Stderr:", cmn.Red(string(stderr))) | 		t.Log("Stderr:", string(stderr)) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Wait for process to exit
 | 	// Wait for process to exit
 | ||||||
|  | |||||||
| @ -115,6 +115,7 @@ func txCmd(cdc *amino.Codec) *cobra.Command { | |||||||
| 		client.LineBreak, | 		client.LineBreak, | ||||||
| 		authcmd.GetBroadcastCommand(cdc), | 		authcmd.GetBroadcastCommand(cdc), | ||||||
| 		authcmd.GetEncodeCommand(cdc), | 		authcmd.GetEncodeCommand(cdc), | ||||||
|  | 		authcmd.GetDecodeCommand(cdc), | ||||||
| 		client.LineBreak, | 		client.LineBreak, | ||||||
| 	) | 	) | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										141
									
								
								cmd/kvd/add_account.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								cmd/kvd/add_account.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,141 @@ | |||||||
|  | package main | ||||||
|  | 
 | ||||||
|  | import ( | ||||||
|  | 	"errors" | ||||||
|  | 	"fmt" | ||||||
|  | 
 | ||||||
|  | 	"github.com/spf13/cobra" | ||||||
|  | 	"github.com/spf13/viper" | ||||||
|  | 
 | ||||||
|  | 	"github.com/tendermint/tendermint/libs/cli" | ||||||
|  | 
 | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/client/keys" | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/codec" | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/server" | ||||||
|  | 	sdk "github.com/cosmos/cosmos-sdk/types" | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/x/auth" | ||||||
|  | 	authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/x/genutil" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | const ( | ||||||
|  | 	flagClientHome   = "home-client" | ||||||
|  | 	flagVestingStart = "vesting-start-time" | ||||||
|  | 	flagVestingEnd   = "vesting-end-time" | ||||||
|  | 	flagVestingAmt   = "vesting-amount" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | // AddGenesisAccountCmd returns an add-genesis-account cobra Command.
 | ||||||
|  | func AddGenesisAccountCmd( | ||||||
|  | 	ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string, | ||||||
|  | ) *cobra.Command { | ||||||
|  | 
 | ||||||
|  | 	cmd := &cobra.Command{ | ||||||
|  | 		Use:   "add-genesis-account [address_or_key_name] [coin][,[coin]]", | ||||||
|  | 		Short: "Add a genesis account to genesis.json", | ||||||
|  | 		Long: `Add a genesis account to genesis.json. The provided account must specify | ||||||
|  |  the account address or key name and a list of initial coins. If a key name is given, | ||||||
|  |  the address will be looked up in the local Keybase. The list of initial tokens must | ||||||
|  |  contain valid denominations. Accounts may optionally be supplied with vesting parameters. | ||||||
|  |  `, | ||||||
|  | 		Args: cobra.ExactArgs(2), | ||||||
|  | 		RunE: func(_ *cobra.Command, args []string) error { | ||||||
|  | 			config := ctx.Config | ||||||
|  | 			config.SetRoot(viper.GetString(cli.HomeFlag)) | ||||||
|  | 
 | ||||||
|  | 			addr, err := sdk.AccAddressFromBech32(args[0]) | ||||||
|  | 			if err != nil { | ||||||
|  | 				// attempt to lookup address from Keybase if no address was provided
 | ||||||
|  | 				kb, err := keys.NewKeyBaseFromDir(viper.GetString(flagClientHome)) | ||||||
|  | 				if err != nil { | ||||||
|  | 					return err | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
|  | 				info, err := kb.Get(args[0]) | ||||||
|  | 				if err != nil { | ||||||
|  | 					return fmt.Errorf("failed to get address from Keybase: %w", err) | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
|  | 				addr = info.GetAddress() | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			coins, err := sdk.ParseCoins(args[1]) | ||||||
|  | 			if err != nil { | ||||||
|  | 				return fmt.Errorf("failed to parse coins: %w", err) | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			vestingStart := viper.GetInt64(flagVestingStart) | ||||||
|  | 			vestingEnd := viper.GetInt64(flagVestingEnd) | ||||||
|  | 			vestingAmt, err := sdk.ParseCoins(viper.GetString(flagVestingAmt)) | ||||||
|  | 			if err != nil { | ||||||
|  | 				return fmt.Errorf("failed to parse vesting amount: %w", err) | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			// create concrete account type based on input parameters
 | ||||||
|  | 			var genAccount authexported.GenesisAccount | ||||||
|  | 
 | ||||||
|  | 			baseAccount := auth.NewBaseAccount(addr, coins.Sort(), nil, 0, 0) | ||||||
|  | 			if !vestingAmt.IsZero() { | ||||||
|  | 				baseVestingAccount := auth.NewBaseVestingAccount( | ||||||
|  | 					baseAccount, vestingAmt.Sort(), sdk.Coins{}, sdk.Coins{}, vestingEnd, | ||||||
|  | 				) | ||||||
|  | 
 | ||||||
|  | 				switch { | ||||||
|  | 				case vestingStart != 0 && vestingEnd != 0: | ||||||
|  | 					genAccount = auth.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) | ||||||
|  | 
 | ||||||
|  | 				case vestingEnd != 0: | ||||||
|  | 					genAccount = auth.NewDelayedVestingAccountRaw(baseVestingAccount) | ||||||
|  | 
 | ||||||
|  | 				default: | ||||||
|  | 					return errors.New("invalid vesting parameters; must supply start and end time or end time") | ||||||
|  | 				} | ||||||
|  | 			} else { | ||||||
|  | 				genAccount = baseAccount | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if err := genAccount.Validate(); err != nil { | ||||||
|  | 				return fmt.Errorf("failed to validate new genesis account: %w", err) | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			genFile := config.GenesisFile() | ||||||
|  | 			appState, genDoc, err := genutil.GenesisStateFromGenFile(cdc, genFile) | ||||||
|  | 			if err != nil { | ||||||
|  | 				return fmt.Errorf("failed to unmarshal genesis state: %w", err) | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			authGenState := auth.GetGenesisStateFromAppState(cdc, appState) | ||||||
|  | 			if authGenState.Accounts.Contains(addr) { | ||||||
|  | 				return fmt.Errorf("cannot add account at existing address %s", addr) | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			// Add the new account to the set of genesis accounts and sanitize the
 | ||||||
|  | 			// accounts afterwards.
 | ||||||
|  | 			authGenState.Accounts = append(authGenState.Accounts, genAccount) | ||||||
|  | 			authGenState.Accounts = auth.SanitizeGenesisAccounts(authGenState.Accounts) | ||||||
|  | 
 | ||||||
|  | 			authGenStateBz, err := cdc.MarshalJSON(authGenState) | ||||||
|  | 			if err != nil { | ||||||
|  | 				return fmt.Errorf("failed to marshal auth genesis state: %w", err) | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			appState[auth.ModuleName] = authGenStateBz | ||||||
|  | 
 | ||||||
|  | 			appStateJSON, err := cdc.MarshalJSON(appState) | ||||||
|  | 			if err != nil { | ||||||
|  | 				return fmt.Errorf("failed to marshal application genesis state: %w", err) | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			genDoc.AppState = appStateJSON | ||||||
|  | 			return genutil.ExportGenesisFile(genDoc, genFile) | ||||||
|  | 		}, | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") | ||||||
|  | 	cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory") | ||||||
|  | 	cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts") | ||||||
|  | 	cmd.Flags().Uint64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") | ||||||
|  | 	cmd.Flags().Uint64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") | ||||||
|  | 
 | ||||||
|  | 	return cmd | ||||||
|  | } | ||||||
| @ -9,19 +9,18 @@ import ( | |||||||
| 
 | 
 | ||||||
| 	abci "github.com/tendermint/tendermint/abci/types" | 	abci "github.com/tendermint/tendermint/abci/types" | ||||||
| 	"github.com/tendermint/tendermint/libs/cli" | 	"github.com/tendermint/tendermint/libs/cli" | ||||||
| 	dbm "github.com/tendermint/tendermint/libs/db" |  | ||||||
| 	"github.com/tendermint/tendermint/libs/log" | 	"github.com/tendermint/tendermint/libs/log" | ||||||
| 	tmtypes "github.com/tendermint/tendermint/types" | 	tmtypes "github.com/tendermint/tendermint/types" | ||||||
|  | 	dbm "github.com/tendermint/tm-db" | ||||||
| 
 | 
 | ||||||
| 	"github.com/cosmos/cosmos-sdk/baseapp" | 	"github.com/cosmos/cosmos-sdk/baseapp" | ||||||
| 	"github.com/cosmos/cosmos-sdk/client" | 	"github.com/cosmos/cosmos-sdk/client" | ||||||
| 	"github.com/cosmos/cosmos-sdk/server" | 	"github.com/cosmos/cosmos-sdk/server" | ||||||
| 	"github.com/cosmos/cosmos-sdk/store" | 	"github.com/cosmos/cosmos-sdk/store" | ||||||
| 	sdk "github.com/cosmos/cosmos-sdk/types" | 	sdk "github.com/cosmos/cosmos-sdk/types" | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/genaccounts" |  | ||||||
| 	genaccscli "github.com/cosmos/cosmos-sdk/x/genaccounts/client/cli" |  | ||||||
| 	genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" | 	genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" | ||||||
| 	"github.com/cosmos/cosmos-sdk/x/staking" | 	"github.com/cosmos/cosmos-sdk/x/staking" | ||||||
|  | 	"github.com/cosmos/cosmos-sdk/x/auth" | ||||||
| 
 | 
 | ||||||
| 	"github.com/kava-labs/kava/app" | 	"github.com/kava-labs/kava/app" | ||||||
| ) | ) | ||||||
| @ -47,18 +46,18 @@ func main() { | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	rootCmd.AddCommand(genutilcli.InitCmd(ctx, cdc, app.ModuleBasics, app.DefaultNodeHome)) | 	rootCmd.AddCommand(genutilcli.InitCmd(ctx, cdc, app.ModuleBasics, app.DefaultNodeHome)) | ||||||
| 	rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, genaccounts.AppModuleBasic{}, app.DefaultNodeHome)) | 	rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, auth.GenesisAccountIterator{}, app.DefaultNodeHome)) | ||||||
| 	rootCmd.AddCommand(genutilcli.MigrateGenesisCmd(ctx, cdc)) | 	rootCmd.AddCommand(genutilcli.MigrateGenesisCmd(ctx, cdc)) | ||||||
| 	rootCmd.AddCommand(genutilcli.GenTxCmd( | 	rootCmd.AddCommand(genutilcli.GenTxCmd( | ||||||
| 		ctx, | 		ctx, | ||||||
| 		cdc, | 		cdc, | ||||||
| 		app.ModuleBasics, | 		app.ModuleBasics, | ||||||
| 		staking.AppModuleBasic{}, | 		staking.AppModuleBasic{}, | ||||||
| 		genaccounts.AppModuleBasic{}, | 		auth.GenesisAccountIterator{}, | ||||||
| 		app.DefaultNodeHome, | 		app.DefaultNodeHome, | ||||||
| 		app.DefaultCLIHome)) | 		app.DefaultCLIHome)) | ||||||
| 	rootCmd.AddCommand(genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics)) | 	rootCmd.AddCommand(genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics)) | ||||||
| 	rootCmd.AddCommand(genaccscli.AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome)) | 	rootCmd.AddCommand(AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome)) | ||||||
| 	rootCmd.AddCommand(client.NewCompletionCmd(rootCmd, true)) | 	rootCmd.AddCommand(client.NewCompletionCmd(rootCmd, true)) | ||||||
| 
 | 
 | ||||||
| 	server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators) | 	server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators) | ||||||
| @ -74,11 +73,19 @@ func main() { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer) abci.Application { | func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer) abci.Application { | ||||||
|  | 	var cache sdk.MultiStorePersistentCache | ||||||
|  | 
 | ||||||
|  | 	if viper.GetBool(server.FlagInterBlockCache) { | ||||||
|  | 		cache = store.NewCommitKVStoreCacheManager() | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	return app.NewApp( | 	return app.NewApp( | ||||||
| 		logger, db, traceStore, true, invCheckPeriod, | 		logger, db, traceStore, true, 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(uint64(viper.GetInt(server.FlagHaltHeight))), | 		baseapp.SetHaltHeight(viper.GetUint64(server.FlagHaltHeight)), | ||||||
|  | 		baseapp.SetHaltTime(viper.GetUint64(server.FlagHaltTime)), | ||||||
|  | 		baseapp.SetInterBlockCache(cache), | ||||||
| 	) | 	) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										9
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								go.mod
									
									
									
									
									
								
							| @ -1,12 +1,13 @@ | |||||||
| module github.com/kava-labs/kava | module github.com/kava-labs/kava | ||||||
| 
 | 
 | ||||||
| go 1.12 | go 1.13 | ||||||
| 
 | 
 | ||||||
| require ( | require ( | ||||||
| 	github.com/cosmos/cosmos-sdk v0.36.0-rc1 | 	github.com/cosmos/cosmos-sdk v0.34.4-0.20190925161702-9d0bed8f4f4e | ||||||
| 	github.com/spf13/cobra v0.0.5 | 	github.com/spf13/cobra v0.0.5 | ||||||
| 	github.com/spf13/viper v1.4.0 | 	github.com/spf13/viper v1.4.0 | ||||||
| 	github.com/stretchr/testify v1.3.0 | 	github.com/stretchr/testify v1.4.0 | ||||||
| 	github.com/tendermint/go-amino v0.15.0 | 	github.com/tendermint/go-amino v0.15.0 | ||||||
| 	github.com/tendermint/tendermint v0.32.1 | 	github.com/tendermint/tendermint v0.32.3 | ||||||
|  | 	github.com/tendermint/tm-db v0.2.0 | ||||||
| ) | ) | ||||||
|  | |||||||
							
								
								
									
										129
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										129
									
								
								go.sum
									
									
									
									
									
								
							| @ -1,4 +1,6 @@ | |||||||
| cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= | ||||||
|  | github.com/99designs/keyring v1.1.2 h1:JJauROcU6x6Nh9uZb+8JgXFvyo0GUESLo1ixhpA0Kmw= | ||||||
|  | github.com/99designs/keyring v1.1.2/go.mod h1:657DQuMrBZRtuL/voxVyiyb6zpMehlm5vLB9Qwrv904= | ||||||
| github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= | github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= | ||||||
| github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | ||||||
| github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= | github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= | ||||||
| @ -10,7 +12,6 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF | |||||||
| github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= | github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= | ||||||
| github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d h1:1aAija9gr0Hyv4KfQcRcwlmFIrhkDmIj2dz5bkg/s/8= | github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d h1:1aAija9gr0Hyv4KfQcRcwlmFIrhkDmIj2dz5bkg/s/8= | ||||||
| github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d/go.mod h1:icNx/6QdFblhsEjZehARqbNumymUT/ydwlLojFdv7Sk= | github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d/go.mod h1:icNx/6QdFblhsEjZehARqbNumymUT/ydwlLojFdv7Sk= | ||||||
| github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= |  | ||||||
| github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= | github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= | ||||||
| github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= | github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= | ||||||
| github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= | github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= | ||||||
| @ -34,8 +35,8 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz | |||||||
| github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= | github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= | ||||||
| github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= | github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= | ||||||
| github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= | github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= | ||||||
| github.com/cosmos/cosmos-sdk v0.36.0-rc1 h1:hgSXNeVwNYxD0+O9DxRrxJcir9Z7Q5zreLV6G7GrjYA= | github.com/cosmos/cosmos-sdk v0.34.4-0.20190925161702-9d0bed8f4f4e h1:V8WpJTIAjajE2PE+1wWCG5LUYkWQal+aH6uqPUiZ9Qc= | ||||||
| github.com/cosmos/cosmos-sdk v0.36.0-rc1/go.mod h1:UV765S3m9sxCg8rYaBr4XgeHZl2UP6y++Coz9mLlYFc= | github.com/cosmos/cosmos-sdk v0.34.4-0.20190925161702-9d0bed8f4f4e/go.mod h1:gwKdI16dOjylNYJkaHbcx0TcEIHyRs1xyc5qROmjCJE= | ||||||
| github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 h1:Iwin12wRQtyZhH6FV3ykFcdGNlYEzoeR0jN8Vn+JWsI= | github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 h1:Iwin12wRQtyZhH6FV3ykFcdGNlYEzoeR0jN8Vn+JWsI= | ||||||
| github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= | github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= | ||||||
| github.com/cosmos/ledger-cosmos-go v0.10.3 h1:Qhi5yTR5Pg1CaTpd00pxlGwNl4sFRdtK1J96OTjeFFc= | github.com/cosmos/ledger-cosmos-go v0.10.3 h1:Qhi5yTR5Pg1CaTpd00pxlGwNl4sFRdtK1J96OTjeFFc= | ||||||
| @ -43,15 +44,25 @@ github.com/cosmos/ledger-cosmos-go v0.10.3/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0W | |||||||
| github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= | github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= | ||||||
| github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= | github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= | ||||||
| github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= | github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= | ||||||
|  | github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= | ||||||
|  | github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= | ||||||
| github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||||
| github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||||
| github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||||||
| github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||||
| github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= | github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= | ||||||
| github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= | github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= | ||||||
|  | github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a h1:mq+R6XEM6lJX5VlLyZIrUSP8tSuJp82xTK89hvBwJbU= | ||||||
|  | github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= | ||||||
| github.com/etcd-io/bbolt v1.3.2/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= | github.com/etcd-io/bbolt v1.3.2/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= | ||||||
| github.com/etcd-io/bbolt v1.3.3 h1:gSJmxrs37LgTqR/oyJBWok6k6SvXEUerFTbltIhXkBM= | github.com/etcd-io/bbolt v1.3.3 h1:gSJmxrs37LgTqR/oyJBWok6k6SvXEUerFTbltIhXkBM= | ||||||
| github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= | github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= | ||||||
|  | github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= | ||||||
|  | github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= | ||||||
|  | github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= | ||||||
|  | github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= | ||||||
|  | github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= | ||||||
|  | github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= | ||||||
| github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= | github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= | ||||||
| github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= | github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= | ||||||
| github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= | github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= | ||||||
| @ -66,39 +77,43 @@ github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80n | |||||||
| github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= | github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= | ||||||
| github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= | github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= | ||||||
| github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= | github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= | ||||||
| github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= | github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= | ||||||
|  | github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= | ||||||
| github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= | github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= | ||||||
| github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= |  | ||||||
| github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= | github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= | ||||||
|  | github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE= | ||||||
|  | github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= | ||||||
| github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= | ||||||
| github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= | ||||||
| github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= | github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= | ||||||
| github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= | ||||||
| github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129 h1:tT8iWCYw4uOem71yYA3htfH+LNopJvcqZQshm56G5L4= | github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129 h1:tT8iWCYw4uOem71yYA3htfH+LNopJvcqZQshm56G5L4= | ||||||
| github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= | github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= | ||||||
| github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= |  | ||||||
| github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= | ||||||
| github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= |  | ||||||
| github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= | github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= | ||||||
| github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= |  | ||||||
| github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= | ||||||
| github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= | github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= | ||||||
|  | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= | ||||||
| github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= | github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= | ||||||
| github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= | github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= | ||||||
| github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= | github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= | ||||||
| github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= | ||||||
| github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf h1:+RRA9JqSOZFfKrOeqr2z77+8R2RKyh8PG66dcu1V0ck= |  | ||||||
| github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= | github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= | ||||||
| github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= | github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= | ||||||
| github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= | ||||||
| github.com/gorilla/mux v1.7.0 h1:tOSd0UKHQd6urX6ApfOn4XdBMY6Sh1MfxV3kmaazO+U= | github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= | ||||||
| github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= | github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= | ||||||
| github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= | github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= | ||||||
| github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= |  | ||||||
| github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= | github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= | ||||||
|  | github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= | ||||||
|  | github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= | ||||||
| github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= | github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= | ||||||
| github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= | github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= | ||||||
| github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= | github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= | ||||||
|  | github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= | ||||||
|  | github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= | ||||||
|  | github.com/hashicorp/golang-lru v0.5.3 h1:YPkqC67at8FYaadspW/6uE0COsBxS2656RLEr8Bppgk= | ||||||
|  | github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= | ||||||
| github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= | github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= | ||||||
| github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= | github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= | ||||||
| github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= | github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= | ||||||
| @ -106,27 +121,34 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO | |||||||
| github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= | github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= | ||||||
| github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= | github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= | ||||||
| github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= | github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= | ||||||
| github.com/jmhodges/levigo v0.0.0-20161115193449-c42d9e0ca023/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= |  | ||||||
| github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= | github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= | ||||||
| github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= | github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= | ||||||
| github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= | github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= | ||||||
| github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= | github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= | ||||||
| github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= | github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= | ||||||
|  | github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= | ||||||
|  | github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= | ||||||
| github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= | github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= | ||||||
|  | github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= | ||||||
| github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= | ||||||
| github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= | github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= | ||||||
| github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= | ||||||
| github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= | github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= | ||||||
| github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= | github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= | ||||||
|  | github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= | ||||||
| github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | ||||||
| github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | ||||||
|  | github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= | ||||||
| github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | ||||||
|  | github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= | ||||||
|  | github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= | ||||||
| github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= | github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= | ||||||
| github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= | github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= | ||||||
| github.com/mattn/go-isatty v0.0.6 h1:SrwhHcpV4nWrMGdNcC2kXpMfcBVYGDuTArqyhocJgvA= | github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg= | ||||||
| github.com/mattn/go-isatty v0.0.6/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= | github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= | ||||||
| github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= | github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= | ||||||
| github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= | github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= | ||||||
|  | github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= | ||||||
| github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= | github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= | ||||||
| github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= | github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= | ||||||
| github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= | github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= | ||||||
| @ -137,16 +159,15 @@ github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= | |||||||
| github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= | github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= | ||||||
| github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= | github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= | ||||||
| github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= | github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= | ||||||
| github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= |  | ||||||
| github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= | github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= | ||||||
|  | github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= | ||||||
|  | github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= | ||||||
| github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||||||
| github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= | github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= | ||||||
| github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||||||
| github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||||||
| github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||||||
| github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= | github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= | ||||||
| github.com/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740= |  | ||||||
| github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= |  | ||||||
| github.com/prometheus/client_golang v0.9.3 h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8= | github.com/prometheus/client_golang v0.9.3 h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8= | ||||||
| github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= | github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= | ||||||
| github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= | github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= | ||||||
| @ -154,20 +175,14 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx | |||||||
| github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= | github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= | ||||||
| github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= | github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= | ||||||
| github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= | github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= | ||||||
| github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= |  | ||||||
| github.com/prometheus/common v0.2.0 h1:kUZDBDTdBVBYBj5Tmh2NZLlF60mfjA27rM34b+cVwNU= |  | ||||||
| github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= |  | ||||||
| github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM= | github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM= | ||||||
| github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | ||||||
| github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= |  | ||||||
| github.com/prometheus/procfs v0.0.0-20190227231451-bbced9601137 h1:3l8oligPtjd4JuM+OZ+U8sjtwFGJs98cdWsqs6QZRWs= |  | ||||||
| github.com/prometheus/procfs v0.0.0-20190227231451-bbced9601137/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= |  | ||||||
| github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY= | github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY= | ||||||
| github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | ||||||
| github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= | github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= | ||||||
| github.com/rakyll/statik v0.1.4 h1:zCS/YQCxfo/fQjCtGVGIyWGFnRbQ18Y55mhS3XPE+Oo= | github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs= | ||||||
| github.com/rakyll/statik v0.1.4/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= | github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= | ||||||
| github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFEuGCb2mBZbBb24RdNRL08b/wb+xBOYpuk= | github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFEuGCb2mBZbBb24RdNRL08b/wb+xBOYpuk= | ||||||
| github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= | github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= | ||||||
| github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= | github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= | ||||||
| @ -175,6 +190,7 @@ github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= | |||||||
| github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= | github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= | ||||||
| github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= | github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= | ||||||
| github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= | github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= | ||||||
|  | github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= | ||||||
| github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= | github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= | ||||||
| github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= | github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= | ||||||
| github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= | github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= | ||||||
| @ -190,32 +206,40 @@ github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmq | |||||||
| github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= | github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= | ||||||
| github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= | github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= | ||||||
| github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= | github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= | ||||||
|  | github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= | ||||||
|  | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= | ||||||
| github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= | github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= | ||||||
| github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M= |  | ||||||
| github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= | github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= | ||||||
| github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= | github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= | ||||||
| github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= | github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= | ||||||
| github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||||||
| github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||||||
|  | github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= | ||||||
|  | github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= | ||||||
| github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= | ||||||
| github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= |  | ||||||
| github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= | ||||||
| github.com/syndtr/goleveldb v0.0.0-20181105012736-f9080354173f/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= | github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= | ||||||
|  | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= | ||||||
|  | github.com/stumble/gorocksdb v0.0.3 h1:9UU+QA1pqFYJuf9+5p7z1IqdE5k0mma4UAeu2wmX8kA= | ||||||
|  | github.com/stumble/gorocksdb v0.0.3/go.mod h1:v6IHdFBXk5DJ1K4FZ0xi+eY737quiiBxYtSWXadLybY= | ||||||
| github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7bnBzGhf7BbIv9loSFQcieWWYIjLqcAw= | github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7bnBzGhf7BbIv9loSFQcieWWYIjLqcAw= | ||||||
| github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= | github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= | ||||||
| github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= | github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= | ||||||
| github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= | github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= | ||||||
| github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5 h1:u8i49c+BxloX3XQ55cvzFNXplizZP/q00i+IlttUjAU= | github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae h1:AOXNM7c2Vvo45SjAgeWF8Wy+NS7/NCqzRNpUc+HPAec= | ||||||
| github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= | github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= | ||||||
| github.com/tendermint/go-amino v0.14.1 h1:o2WudxNfdLNBwMyl2dqOJxiro5rfrEaU0Ugs6offJMk= |  | ||||||
| github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= | github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= | ||||||
| github.com/tendermint/go-amino v0.15.0 h1:TC4e66P59W7ML9+bxio17CPKnxW3nKIRAYskntMAoRk= | github.com/tendermint/go-amino v0.15.0 h1:TC4e66P59W7ML9+bxio17CPKnxW3nKIRAYskntMAoRk= | ||||||
| github.com/tendermint/go-amino v0.15.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= | github.com/tendermint/go-amino v0.15.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= | ||||||
| github.com/tendermint/iavl v0.12.3-0.20190712145259-c834d3192b52 h1:l3qTzz8KkhZZSeLTJGqh0+iONjGM/tS5vvbunXjAmnA= | github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8= | ||||||
| github.com/tendermint/iavl v0.12.3-0.20190712145259-c834d3192b52/go.mod h1:A9IoWRVTibyXXlfZztHy52RloI85QOrIcsE9dyQh+DY= | github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o= | ||||||
| github.com/tendermint/tendermint v0.31.7/go.mod h1:ymcPyWblXCplCPQjbOYbrF1fWnpslATMVqiGgWbZrlc= |  | ||||||
| github.com/tendermint/tendermint v0.32.1 h1:J8ddXMbCmG6GZjdCl/N1wgdXDU9uO91J2Y5CA9xYfGo= |  | ||||||
| github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU= | github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU= | ||||||
|  | github.com/tendermint/tendermint v0.32.3 h1:GEnWpGQ795h5oTFNbfBLsY0LW/CW2j6p6HtiYNfxsgg= | ||||||
|  | github.com/tendermint/tendermint v0.32.3/go.mod h1:ZK2c29jl1QRYznIRyRWRDsmm1yvtPzBRT00x4t1JToY= | ||||||
|  | github.com/tendermint/tm-db v0.1.1 h1:G3Xezy3sOk9+ekhjZ/kjArYIs1SmwV+1OUgNkj7RgV0= | ||||||
|  | github.com/tendermint/tm-db v0.1.1/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= | ||||||
|  | github.com/tendermint/tm-db v0.2.0 h1:rJxgdqn6fIiVJZy4zLpY1qVlyD0TU6vhkT4kEf71TQQ= | ||||||
|  | github.com/tendermint/tm-db v0.2.0/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= | ||||||
| github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= | github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= | ||||||
| github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= | github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= | ||||||
| github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= | github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= | ||||||
| @ -230,31 +254,30 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= | |||||||
| go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= | go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= | ||||||
| go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= | go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= | ||||||
| golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | ||||||
| golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= |  | ||||||
| golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | ||||||
| golang.org/x/crypto v0.0.0-20181126093934-9eb0be3963ea/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= |  | ||||||
| golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | ||||||
| golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||||||
| golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= |  | ||||||
| golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||||||
|  | golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a h1:YX8ljsm6wXlHZO+aRz9Exqr0evNhKRNe5K/gi+zKh4U= | ||||||
|  | golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||||||
|  | golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= | ||||||
|  | golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | ||||||
| golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= | ||||||
| golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= | ||||||
| golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | ||||||
| golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | ||||||
| golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | ||||||
| golang.org/x/net v0.0.0-20181201002055-351d144fa1fc h1:a3CU5tJYVj92DY2LaA1kUkrsqD5/3mLDhx2NcNqyW+0= |  | ||||||
| golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= |  | ||||||
| golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | ||||||
| golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= |  | ||||||
| golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||||||
| golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||||||
| golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= | golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= | ||||||
|  | golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU= | ||||||
|  | golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | ||||||
| golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= | ||||||
| golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= |  | ||||||
| golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||||
| golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||||
| @ -263,29 +286,32 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h | |||||||
| golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||||
| golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||||
| golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||||
| golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
| golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
|  | golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= | ||||||
|  | golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
| golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= | golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= | ||||||
| golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||||||
| golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= | golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= | ||||||
| golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||||||
|  | golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||||||
| golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||||||
| golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= | ||||||
| golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= | golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= | ||||||
|  | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= | ||||||
| google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= | ||||||
| google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= |  | ||||||
| google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= | ||||||
| google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= | google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= | ||||||
| google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 h1:67iHsV9djwGdZpdZNbLuQj6FOzCaZe3w+vhLjn5AcFA= | google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 h1:67iHsV9djwGdZpdZNbLuQj6FOzCaZe3w+vhLjn5AcFA= | ||||||
| google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= | google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= | ||||||
| google.golang.org/grpc v1.13.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= | google.golang.org/grpc v1.13.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= | ||||||
| google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= |  | ||||||
| google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= | ||||||
| google.golang.org/grpc v1.21.0 h1:G+97AoqBnmZIT91cLG/EkCoK9NSelj64P8bOHHNmGn0= |  | ||||||
| google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= | google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= | ||||||
|  | google.golang.org/grpc v1.22.0 h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw= | ||||||
|  | google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= | ||||||
| gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= | gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= | ||||||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= |  | ||||||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||||
|  | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= | ||||||
| gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||||
| gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= | gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= | ||||||
| gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= | gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= | ||||||
| @ -297,3 +323,4 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | |||||||
| gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= | gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= | ||||||
| gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | ||||||
| honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | ||||||
|  | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | ||||||
|  | |||||||
							
								
								
									
										38
									
								
								simulations/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								simulations/Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,38 @@ | |||||||
|  | FROM golang:alpine AS build-env | ||||||
|  | 
 | ||||||
|  | # Set up dependencies | ||||||
|  | # bash for debugging | ||||||
|  | # git, make for installation | ||||||
|  | # libc-dev, gcc, linux-headers, eudev-dev are used for cgo and ledger installation (possibly) | ||||||
|  | RUN apk add bash git make libc-dev gcc linux-headers eudev-dev jq | ||||||
|  | 
 | ||||||
|  | # Install aws cli | ||||||
|  | RUN apk add python py-pip | ||||||
|  | RUN pip install awscli | ||||||
|  | 
 | ||||||
|  | # Set working directory for the build | ||||||
|  | WORKDIR /root/kava | ||||||
|  | # default home directory is /root | ||||||
|  | 
 | ||||||
|  | COPY go.mod . | ||||||
|  | COPY go.sum . | ||||||
|  | 
 | ||||||
|  | RUN go mod download | ||||||
|  | 
 | ||||||
|  | # Add source files | ||||||
|  | COPY .git .git | ||||||
|  | COPY app app | ||||||
|  | COPY cli_test cli_test | ||||||
|  | COPY cmd cmd | ||||||
|  | COPY app app | ||||||
|  | COPY Makefile . | ||||||
|  | 
 | ||||||
|  | # Install kvd, kvcli | ||||||
|  | ENV LEDGER_ENABLED False | ||||||
|  | RUN make install | ||||||
|  | 
 | ||||||
|  | # Copy in simulation script after to decrease image build time | ||||||
|  | COPY simulations simulations | ||||||
|  | 
 | ||||||
|  | # Run kvd by default, omit entrypoint to ease using container with kvcli | ||||||
|  | CMD ["kvd"] | ||||||
							
								
								
									
										43
									
								
								simulations/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								simulations/README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,43 @@ | |||||||
|  | # How To Run Sims In The Cloud | ||||||
|  | 
 | ||||||
|  | Sims run with AWS batch, with results uploaded to S3 | ||||||
|  | 
 | ||||||
|  | ## AWS Batch | ||||||
|  | 
 | ||||||
|  | In AWS batch you define: | ||||||
|  | 
 | ||||||
|  | - a "compute environment"--just how many machines you want (and of what kind) | ||||||
|  | - a "job queue"--just a place to put jobs (pairs them with a compute environment) | ||||||
|  | - a "job definition"--a template for jobs | ||||||
|  | 
 | ||||||
|  | Then to run stuff you create "jobs" and submit them to a job queue. | ||||||
|  | 
 | ||||||
|  | The number of machines running auto-scales to match the number of jobs. When there are no jobs there are no machines, so you don't pay for anything. | ||||||
|  | 
 | ||||||
|  | Jobs are defined as a docker image (assumed hosted on dockerhub) and a command string.   | ||||||
|  | >e.g. `kava/kava-sim:version1`, `go test ./app` | ||||||
|  | 
 | ||||||
|  | This can run sims but doesn't collect the results. This is handled by a custom script. | ||||||
|  | 
 | ||||||
|  | ## Running sims and uploading to S3 | ||||||
|  | 
 | ||||||
|  | The dockerfile in this repo defines the docker image to run sims. It's just a normal app, but with the aws cli included, and the custom script. | ||||||
|  | 
 | ||||||
|  | The custom script reads some input args, runs a sim and uploads the stdout and stderr to a S3 bucket. | ||||||
|  | 
 | ||||||
|  | AWS Batch allows for "array jobs" which are a way of specifying many duplicates of a job, each with a different index passed in as an env var. | ||||||
|  | 
 | ||||||
|  | ### Steps | ||||||
|  | 
 | ||||||
|  | - create and submit a new array job (based of the job definition) with | ||||||
|  |   - image `kava/kava-sim:<some-version>` | ||||||
|  |   - command `run-then-upload.sh <starting-seed> <num-blocks> <block-size>` | ||||||
|  |   - array size of how many sims you want to run | ||||||
|  | - any changes needed to the code or script necessitates a rebuild: | ||||||
|  |   - `docker build -f simulations/Dockerfile -t kava/kava-sim:<some-version> .` | ||||||
|  |   - `docker push kava/kava-sim:<some-version>` | ||||||
|  | 
 | ||||||
|  | ### Tips | ||||||
|  | 
 | ||||||
|  | - click on the compute environment name, to get details, then click the link ECS Cluster Name to get details on the actual machines running | ||||||
|  | - for array jobs, click the job name to get details of the individual jobs | ||||||
							
								
								
									
										43
									
								
								simulations/run-then-upload.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										43
									
								
								simulations/run-then-upload.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,43 @@ | |||||||
|  | #!/bin/bash | ||||||
|  | 
 | ||||||
|  | # This requires AWS access keys envs to be set (ie AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) | ||||||
|  | # These need to be generated from the AWS console. | ||||||
|  | 
 | ||||||
|  | # For commands passed to the docker container, the working directory is /root/kava (which is the blockchain git repo). | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | # Parse Input Args | ||||||
|  | # get seed | ||||||
|  | startingSeed=$1 | ||||||
|  | # compute the seed from the starting and the job index | ||||||
|  | # add two nums together, hence the $(()), and use 0 as the default value for array index, hence the ${:-} syntax | ||||||
|  | seed=$(($startingSeed+${AWS_BATCH_JOB_ARRAY_INDEX:-0})) | ||||||
|  | echo "seed: " $seed | ||||||
|  | # get sim parameters | ||||||
|  | numBlocks=$2 | ||||||
|  | blockSize=$3 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | # Run The Sim | ||||||
|  | # redirect stdout and stderr to a file | ||||||
|  | go test ./app -run TestFullAppSimulation -Enabled=true -NumBlocks=$numBlocks -BlockSize=$blockSize -Commit=true -Period=5 -Seed=$seed -v -timeout 24h > out.log 2>&1 | ||||||
|  | # get the exit code to determine how to upload results | ||||||
|  | simExitStatus=$? | ||||||
|  | if [ $simExitStatus -eq 0 ];then | ||||||
|  |    echo "simulations passed" | ||||||
|  |    simResult="pass" | ||||||
|  | else | ||||||
|  |    echo "simulation failed" | ||||||
|  |    simResult="fail" | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | # Upload Sim Results To S3 | ||||||
|  | # read in the job id, using a default value if not set | ||||||
|  | jobID=${AWS_BATCH_JOB_ID:-"testJobID:"} | ||||||
|  | # job id format is "job-id:array-job-index", this removes trailing colon (and array index if present) https://stackoverflow.com/questions/3045493/parse-string-with-bash-and-extract-number | ||||||
|  | jobID=$(echo $jobID | sed 's/\(.*\):\d*/\1/') | ||||||
|  | 
 | ||||||
|  | # create the filename from the array job index (which won't be set if this is a normal job) | ||||||
|  | fileName=out$AWS_BATCH_JOB_ARRAY_INDEX.log | ||||||
|  | aws s3 cp out.log s3://simulations-1/$jobID/$simResult/$fileName | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Kevin Davis
						Kevin Davis