From 1536f96e8b64707f859e0f54c028c922e6532c5d Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Fri, 19 Jul 2019 15:47:58 +0100 Subject: [PATCH 001/685] Merge PR #80: Build with Go 1.12.7 --- contrib/gitian-build.sh | 2 +- contrib/gitian-descriptors/gitian-darwin.yml | 4 ++-- contrib/gitian-descriptors/gitian-linux.yml | 4 ++-- contrib/gitian-descriptors/gitian-windows.yml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/gitian-build.sh b/contrib/gitian-build.sh index c5e8e2da9b..7280a766df 100755 --- a/contrib/gitian-build.sh +++ b/contrib/gitian-build.sh @@ -8,7 +8,7 @@ set -euo pipefail GITIAN_CACHE_DIRNAME='.gitian-builder-cache' -GO_DEBIAN_RELEASE='1.12.5-1' +GO_DEBIAN_RELEASE='1.12.7-1' GO_TARBALL="golang-debian-${GO_DEBIAN_RELEASE}.tar.gz" GO_TARBALL_URL="https://salsa.debian.org/go-team/compiler/golang/-/archive/debian/${GO_DEBIAN_RELEASE}/${GO_TARBALL}" diff --git a/contrib/gitian-descriptors/gitian-darwin.yml b/contrib/gitian-descriptors/gitian-darwin.yml index d15e2975a3..b97f1d6883 100644 --- a/contrib/gitian-descriptors/gitian-darwin.yml +++ b/contrib/gitian-descriptors/gitian-darwin.yml @@ -23,11 +23,11 @@ remotes: - "url": "https://github.com/cosmos/gaia.git" "dir": "gaia" files: -- "golang-debian-1.12.5-1.tar.gz" +- "golang-debian-1.12.7-1.tar.gz" script: | set -e -o pipefail - GO_SRC_RELEASE=golang-debian-1.12.5-1 + GO_SRC_RELEASE=golang-debian-1.12.7-1 GO_SRC_TARBALL="${GO_SRC_RELEASE}.tar.gz" # Compile go and configure the environment export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 74936af993..9619fa3b88 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -23,11 +23,11 @@ remotes: - "url": "https://github.com/cosmos/gaia.git" "dir": "gaia" files: -- "golang-debian-1.12.5-1.tar.gz" +- "golang-debian-1.12.7-1.tar.gz" script: | set -e -o pipefail - GO_SRC_RELEASE=golang-debian-1.12.5-1 + GO_SRC_RELEASE=golang-debian-1.12.7-1 GO_SRC_TARBALL="${GO_SRC_RELEASE}.tar.gz" # Compile go and configure the environment export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" diff --git a/contrib/gitian-descriptors/gitian-windows.yml b/contrib/gitian-descriptors/gitian-windows.yml index 34760d6844..79c138df66 100644 --- a/contrib/gitian-descriptors/gitian-windows.yml +++ b/contrib/gitian-descriptors/gitian-windows.yml @@ -23,11 +23,11 @@ remotes: - "url": "https://github.com/cosmos/gaia.git" "dir": "gaia" files: -- "golang-debian-1.12.5-1.tar.gz" +- "golang-debian-1.12.7-1.tar.gz" script: | set -e -o pipefail - GO_SRC_RELEASE=golang-debian-1.12.5-1 + GO_SRC_RELEASE=golang-debian-1.12.7-1 GO_SRC_TARBALL="${GO_SRC_RELEASE}.tar.gz" # Compile go and configure the environment export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" From 10cde2212ea72db7f153d19dd9e4bf80a52d162d Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Mon, 5 Aug 2019 11:50:11 -0400 Subject: [PATCH 002/685] Merge PR #86: Update SDK to version latest master --- app/app.go | 115 +++++++-------- app/app_test.go | 2 +- app/export.go | 3 +- app/sim_test.go | 293 ++++++++++++++++++++++++++++----------- app/utils.go | 29 +++- cli_test/cli_test.go | 3 - cli_test/test_helpers.go | 1 + cmd/gaiad/main.go | 2 +- cmd/gaiad/replay.go | 4 +- cmd/gaiad/testnet.go | 8 +- go.mod | 15 +- go.sum | 41 ++++-- lcd_test/helpers.go | 9 +- lcd_test/helpers_test.go | 129 ++++++++--------- lcd_test/lcd_test.go | 56 ++------ sims.mk | 28 ++-- 16 files changed, 426 insertions(+), 312 deletions(-) diff --git a/app/app.go b/app/app.go index c867d330dd..a832f27c89 100644 --- a/app/app.go +++ b/app/app.go @@ -6,7 +6,7 @@ import ( abci "github.com/tendermint/tendermint/abci/types" cmn "github.com/tendermint/tendermint/libs/common" - dbm "github.com/tendermint/tendermint/libs/db" + dbm "github.com/tendermint/tm-db" "github.com/tendermint/tendermint/libs/log" bam "github.com/cosmos/cosmos-sdk/baseapp" @@ -19,7 +19,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/crisis" 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/gov" @@ -40,23 +39,9 @@ var ( // default home directories for gaiad DefaultNodeHome = os.ExpandEnv("$HOME/.gaiad") - // The ModuleBasicManager is in charge of setting up basic, + // The module BasicManager is in charge of setting up basic, // non-dependant module elements, such as codec registration // and genesis verification. - ModuleBasics module.BasicManager - - // module account permissions - maccPerms = map[string][]string{ - auth.FeeCollectorName: nil, - distr.ModuleName: nil, - mint.ModuleName: {supply.Minter}, - staking.BondedPoolName: {supply.Burner, supply.Staking}, - staking.NotBondedPoolName: {supply.Burner, supply.Staking}, - gov.ModuleName: {supply.Burner}, - } -) - -func init() { ModuleBasics = module.NewBasicManager( genaccounts.AppModuleBasic{}, genutil.AppModuleBasic{}, @@ -65,13 +50,23 @@ func init() { staking.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, - gov.NewAppModuleBasic(paramsclient.ProposalHandler, distrclient.ProposalHandler), + gov.NewAppModuleBasic(paramsclient.ProposalHandler, distr.ProposalHandler), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, supply.AppModuleBasic{}, ) -} + + // module account permissions + maccPerms = map[string][]string{ + auth.FeeCollectorName: nil, + distr.ModuleName: nil, + mint.ModuleName: {supply.Minter}, + staking.BondedPoolName: {supply.Burner, supply.Staking}, + staking.NotBondedPoolName: {supply.Burner, supply.Staking}, + gov.ModuleName: {supply.Burner}, + } +) // custom tx codec func MakeCodec() *codec.Codec { @@ -90,18 +85,8 @@ type GaiaApp struct { invCheckPeriod uint // keys to access the substores - keyMain *sdk.KVStoreKey - keyAccount *sdk.KVStoreKey - 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 + keys map[string]*sdk.KVStoreKey + tkeys map[string]*sdk.TransientStoreKey // keepers accountKeeper auth.AccountKeeper @@ -129,26 +114,23 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b bApp.SetCommitMultiStoreTracer(traceStore) bApp.SetAppVersion(version.Version) - var app = &GaiaApp{ + keys := sdk.NewKVStoreKeys( + bam.MainStoreKey, auth.StoreKey, staking.StoreKey, + supply.StoreKey, mint.StoreKey, distr.StoreKey, slashing.StoreKey, + gov.StoreKey, params.StoreKey, + ) + tkeys := sdk.NewTransientStoreKeys(staking.TStoreKey, params.TStoreKey) + + app := &GaiaApp{ BaseApp: bApp, cdc: cdc, invCheckPeriod: invCheckPeriod, - keyMain: sdk.NewKVStoreKey(bam.MainStoreKey), - keyAccount: sdk.NewKVStoreKey(auth.StoreKey), - 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), + keys: keys, + tkeys: tkeys, } // 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) bankSubspace := app.paramsKeeper.Subspace(bank.DefaultParamspace) stakingSubspace := app.paramsKeeper.Subspace(staking.DefaultParamspace) @@ -159,16 +141,19 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b crisisSubspace := app.paramsKeeper.Subspace(crisis.DefaultParamspace) // add keepers - app.accountKeeper = auth.NewAccountKeeper(app.cdc, app.keyAccount, authSubspace, auth.ProtoBaseAccount) - app.bankKeeper = bank.NewBaseKeeper(app.accountKeeper, bankSubspace, bank.DefaultCodespace) - app.supplyKeeper = supply.NewKeeper(app.cdc, app.keySupply, app.accountKeeper, app.bankKeeper, supply.DefaultCodespace, maccPerms) - stakingKeeper := staking.NewKeeper(app.cdc, app.keyStaking, app.tkeyStaking, - app.supplyKeeper, stakingSubspace, staking.DefaultCodespace) - app.mintKeeper = mint.NewKeeper(app.cdc, app.keyMint, mintSubspace, &stakingKeeper, app.supplyKeeper, auth.FeeCollectorName) - app.distrKeeper = distr.NewKeeper(app.cdc, app.keyDistr, distrSubspace, &stakingKeeper, - app.supplyKeeper, distr.DefaultCodespace, auth.FeeCollectorName) - app.slashingKeeper = slashing.NewKeeper(app.cdc, app.keySlashing, &stakingKeeper, - slashingSubspace, slashing.DefaultCodespace) + app.accountKeeper = auth.NewAccountKeeper(app.cdc, keys[auth.StoreKey], authSubspace, auth.ProtoBaseAccount) + app.bankKeeper = bank.NewBaseKeeper(app.accountKeeper, bankSubspace, bank.DefaultCodespace, app.ModuleAccountAddrs()) + app.supplyKeeper = supply.NewKeeper(app.cdc, keys[supply.StoreKey], app.accountKeeper, app.bankKeeper, maccPerms) + stakingKeeper := staking.NewKeeper( + app.cdc, keys[staking.StoreKey], tkeys[staking.TStoreKey], + app.supplyKeeper, stakingSubspace, staking.DefaultCodespace, + ) + app.mintKeeper = mint.NewKeeper(app.cdc, keys[mint.StoreKey], mintSubspace, &stakingKeeper, app.supplyKeeper, auth.FeeCollectorName) + app.distrKeeper = distr.NewKeeper(app.cdc, keys[distr.StoreKey], distrSubspace, &stakingKeeper, + app.supplyKeeper, distr.DefaultCodespace, auth.FeeCollectorName, app.ModuleAccountAddrs()) + app.slashingKeeper = slashing.NewKeeper( + app.cdc, keys[slashing.StoreKey], &stakingKeeper, slashingSubspace, slashing.DefaultCodespace, + ) app.crisisKeeper = crisis.NewKeeper(crisisSubspace, invCheckPeriod, app.supplyKeeper, auth.FeeCollectorName) // register the proposal types @@ -176,13 +161,16 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b govRouter.AddRoute(gov.RouterKey, gov.ProposalHandler). AddRoute(params.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)). AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)) - app.govKeeper = gov.NewKeeper(app.cdc, app.keyGov, app.paramsKeeper, govSubspace, - app.supplyKeeper, &stakingKeeper, gov.DefaultCodespace, govRouter) + app.govKeeper = gov.NewKeeper( + app.cdc, keys[gov.StoreKey], app.paramsKeeper, govSubspace, + app.supplyKeeper, &stakingKeeper, gov.DefaultCodespace, govRouter, + ) // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks app.stakingKeeper = *stakingKeeper.SetHooks( - staking.NewMultiStakingHooks(app.distrKeeper.Hooks(), app.slashingKeeper.Hooks())) + staking.NewMultiStakingHooks(app.distrKeeper.Hooks(), app.slashingKeeper.Hooks()), + ) app.mm = module.NewManager( genaccounts.NewAppModule(app.accountKeeper), @@ -215,9 +203,8 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b app.mm.RegisterRoutes(app.Router(), app.QueryRouter()) // initialize stores - 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.MountKVStores(keys) + app.MountTransientStores(tkeys) // initialize BaseApp app.SetInitChainer(app.InitChainer) @@ -226,11 +213,12 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b app.SetEndBlocker(app.EndBlocker) if loadLatest { - err := app.LoadLatestVersion(app.keyMain) + err := app.LoadLatestVersion(app.keys[bam.MainStoreKey]) if err != nil { cmn.Exit(err.Error()) } } + return app } @@ -248,12 +236,13 @@ func (app *GaiaApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.R func (app *GaiaApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { var genesisState simapp.GenesisState app.cdc.MustUnmarshalJSON(req.AppStateBytes, &genesisState) + return app.mm.InitGenesis(ctx, genesisState) } // load a particular height func (app *GaiaApp) 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. diff --git a/app/app_test.go b/app/app_test.go index 3b73774725..93b536db94 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tm-db" "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/codec" diff --git a/app/export.go b/app/export.go index 5b2bf4836b..9d312bce62 100644 --- a/app/export.go +++ b/app/export.go @@ -16,7 +16,6 @@ import ( // export the state of gaia for a genesis file func (app *GaiaApp) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList []string, ) (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error) { - // as if they could withdraw from the start of the next block ctx := app.NewContext(true, abci.Header{Height: app.LastBlockHeight()}) @@ -125,7 +124,7 @@ func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []st // Iterate through validators by power descending, reset bond heights, and // update bond intra-tx counters. - store := ctx.KVStore(app.keyStaking) + store := ctx.KVStore(app.keys[staking.StoreKey]) iter := sdk.KVStoreReversePrefixIterator(store, staking.ValidatorsKey) counter := int16(0) diff --git a/app/sim_test.go b/app/sim_test.go index 0e067bfefd..73c0f03b73 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -14,70 +14,77 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + dbm "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth" authsim "github.com/cosmos/cosmos-sdk/x/auth/simulation" "github.com/cosmos/cosmos-sdk/x/bank" + distr "github.com/cosmos/cosmos-sdk/x/distribution" distrsim "github.com/cosmos/cosmos-sdk/x/distribution/simulation" + "github.com/cosmos/cosmos-sdk/x/gov" govsim "github.com/cosmos/cosmos-sdk/x/gov/simulation" + "github.com/cosmos/cosmos-sdk/x/mint" + "github.com/cosmos/cosmos-sdk/x/params" paramsim "github.com/cosmos/cosmos-sdk/x/params/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/cosmos/cosmos-sdk/x/slashing" slashingsim "github.com/cosmos/cosmos-sdk/x/slashing/simulation" "github.com/cosmos/cosmos-sdk/x/staking" stakingsim "github.com/cosmos/cosmos-sdk/x/staking/simulation" -) - -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 + "github.com/cosmos/cosmos-sdk/x/supply" ) func init() { - flag.StringVar(&genesisFile, "SimulationGenesis", "", "custom simulation genesis file; cannot be used with params file") - 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.StringVar(&genesisFile, "Genesis", "", "custom simulation genesis file; cannot be used with params file") + flag.StringVar(¶msFile, "Params", "", "custom simulation params file which overrides any random params; cannot be used with genesis") + flag.StringVar(&exportParamsPath, "ExportParamsPath", "", "custom file path to save the exported params JSON") + flag.IntVar(&exportParamsHeight, "ExportParamsHeight", 0, "height to which export the randomly generated params") + flag.StringVar(&exportStatePath, "ExportStatePath", "", "custom file path to save the exported app state JSON") + flag.StringVar(&exportStatsPath, "ExportStatsPath", "", "custom file path to save the exported simulation statistics JSON") + flag.Int64Var(&seed, "Seed", 42, "simulation random seed") + flag.IntVar(&initialBlockHeight, "InitialBlockHeight", 1, "initial block to start the simulation") + flag.IntVar(&numBlocks, "NumBlocks", 500, "number of new blocks to simulate from the initial block height") + flag.IntVar(&blockSize, "BlockSize", 200, "operations per block") + flag.BoolVar(&enabled, "Enabled", false, "enable the simulation") + flag.BoolVar(&verbose, "Verbose", false, "verbose log output") + flag.BoolVar(&lean, "Lean", false, "lean simulation log output") + flag.BoolVar(&commit, "Commit", false, "have the simulation commit") + flag.IntVar(&period, "Period", 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") + flag.Int64Var(&genesisTime, "GenesisTime", 0, "override genesis UNIX time instead of using a random UNIX time") } // helper function for populating input for SimulateFromSeed func getSimulateFromSeedInput(tb testing.TB, w io.Writer, app *GaiaApp) ( testing.TB, io.Writer, *baseapp.BaseApp, simulation.AppStateFn, int64, - simulation.WeightedOperations, sdk.Invariants, int, int, bool, bool, bool, bool, map[string]bool, -) { + simulation.WeightedOperations, sdk.Invariants, int, int, int, int, string, + bool, bool, bool, bool, bool, map[string]bool) { + + exportParams := exportParamsPath != "" return tb, w, app.BaseApp, appStateFn, seed, - testAndRunTxs(app), invariants(app), numBlocks, blockSize, commit, - lean, onOperation, allInvariants, app.ModuleAccountAddrs() + testAndRunTxs(app), invariants(app), + initialBlockHeight, numBlocks, exportParamsHeight, blockSize, + exportStatsPath, exportParams, 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) { + r *rand.Rand, accs []simulation.Account, +) (appState json.RawMessage, simAccs []simulation.Account, chainID string, genesisTimestamp time.Time) { cdc := MakeCodec() + if genesisTime == 0 { + genesisTimestamp = simulation.RandTimestamp(r) + } else { + genesisTimestamp = time.Unix(genesisTime, 0) + } + switch { case paramsFile != "" && genesisFile != "": panic("cannot provide both a genesis file and a params file") @@ -100,7 +107,7 @@ func appStateFn( appState, simAccs, chainID = appStateRandomizedFn(r, accs, genesisTimestamp, appParams) } - return appState, simAccs, chainID + return appState, simAccs, chainID, genesisTimestamp } // TODO refactor out random initialization code to the modules @@ -361,7 +368,7 @@ func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { } // 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 func BenchmarkFullAppSimulation(b *testing.B) { logger := log.NewNopLogger() @@ -375,14 +382,46 @@ func BenchmarkFullAppSimulation(b *testing.B) { app := NewGaiaApp(logger, db, nil, true, 0) // Run randomized simulation - // TODO parameterize numbers, save for a later PR - _, err := simulation.SimulateFromSeed(getSimulateFromSeedInput(b, os.Stdout, app)) - if err != nil { - fmt.Println(err) - b.Fail() + // TODO: parameterize numbers, save for a later PR + _, params, simErr := simulation.SimulateFromSeed(getSimulateFromSeedInput(b, os.Stdout, app)) + + // export state and params before the simulation error is checked + if exportStatePath != "" { + fmt.Println("Exporting app state...") + appState, _, err := app.ExportAppStateAndValidators(false, nil) + if err != nil { + fmt.Println(err) + b.Fail() + } + err = ioutil.WriteFile(exportStatePath, []byte(appState), 0644) + if err != nil { + fmt.Println(err) + b.Fail() + } } + + if exportParamsPath != "" { + fmt.Println("Exporting simulation params...") + paramsBz, err := json.MarshalIndent(params, "", " ") + if err != nil { + fmt.Println(err) + b.Fail() + } + + err = ioutil.WriteFile(exportParamsPath, paramsBz, 0644) + if err != nil { + fmt.Println(err) + b.Fail() + } + } + + if simErr != nil { + fmt.Println(simErr) + b.FailNow() + } + if commit { - fmt.Println("GoLevelDB Stats") + fmt.Println("\nGoLevelDB Stats") fmt.Println(db.Stats()["leveldb.stats"]) fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) } @@ -414,16 +453,37 @@ func TestFullAppSimulation(t *testing.T) { require.Equal(t, "GaiaApp", app.Name()) // Run randomized simulation - _, err := simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, app)) + _, params, simErr := simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, app)) + + // export state and params before the simulation error is checked + if exportStatePath != "" { + fmt.Println("Exporting app state...") + appState, _, err := app.ExportAppStateAndValidators(false, nil) + require.NoError(t, err) + + err = ioutil.WriteFile(exportStatePath, []byte(appState), 0644) + require.NoError(t, err) + } + + if exportParamsPath != "" { + fmt.Println("Exporting simulation params...") + fmt.Println(params) + paramsBz, err := json.MarshalIndent(params, "", " ") + require.NoError(t, err) + + err = ioutil.WriteFile(exportParamsPath, paramsBz, 0644) + require.NoError(t, err) + } + + require.NoError(t, simErr) + if commit { // for memdb: // fmt.Println("Database Size", db.Stats()["database.size"]) - fmt.Println("GoLevelDB Stats") + fmt.Println("\nGoLevelDB Stats") fmt.Println(db.Stats()["leveldb.stats"]) fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) } - - require.Nil(t, err) } func TestAppImportExport(t *testing.T) { @@ -448,20 +508,40 @@ func TestAppImportExport(t *testing.T) { }() app := NewGaiaApp(logger, db, nil, true, 0, fauxMerkleModeOpt) - require.Equal(t, "GaiaApp", app.Name()) + require.Equal(t, "SimApp", app.Name()) // Run randomized simulation - _, err := simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, app)) + _, simParams, simErr := simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, app)) + + // export state and simParams before the simulation error is checked + if exportStatePath != "" { + fmt.Println("Exporting app state...") + appState, _, err := app.ExportAppStateAndValidators(false, nil) + require.NoError(t, err) + + err = ioutil.WriteFile(exportStatePath, []byte(appState), 0644) + require.NoError(t, err) + } + + if exportParamsPath != "" { + fmt.Println("Exporting simulation params...") + simParamsBz, err := json.MarshalIndent(simParams, "", " ") + require.NoError(t, err) + + err = ioutil.WriteFile(exportParamsPath, simParamsBz, 0644) + require.NoError(t, err) + } + + require.NoError(t, simErr) if commit { // for memdb: // fmt.Println("Database Size", db.Stats()["database.size"]) - fmt.Println("GoLevelDB Stats") + fmt.Println("\nGoLevelDB Stats") fmt.Println(db.Stats()["leveldb.stats"]) fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) } - require.Nil(t, err) fmt.Printf("Exporting genesis...\n") appState, _, err := app.ExportAppStateAndValidators(false, []string{}) @@ -477,7 +557,7 @@ func TestAppImportExport(t *testing.T) { }() newApp := NewGaiaApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt) - require.Equal(t, "GaiaApp", newApp.Name()) + require.Equal(t, "SimApp", newApp.Name()) var genesisState simapp.GenesisState err = app.cdc.UnmarshalJSON(appState, &genesisState) @@ -498,16 +578,18 @@ func TestAppImportExport(t *testing.T) { } storeKeysPrefixes := []StoreKeysPrefixes{ - {app.keyMain, newApp.keyMain, [][]byte{}}, - {app.keyAccount, newApp.keyAccount, [][]byte{}}, - {app.keyStaking, newApp.keyStaking, [][]byte{staking.UnbondingQueueKey, - staking.RedelegationQueueKey, staking.ValidatorQueueKey}}, // ordering may change but it doesn't matter - {app.keySlashing, newApp.keySlashing, [][]byte{}}, - {app.keyMint, newApp.keyMint, [][]byte{}}, - {app.keyDistr, newApp.keyDistr, [][]byte{}}, - {app.keySupply, newApp.keySupply, [][]byte{}}, - {app.keyParams, newApp.keyParams, [][]byte{}}, - {app.keyGov, newApp.keyGov, [][]byte{}}, + {app.keys[baseapp.MainStoreKey], newApp.keys[baseapp.MainStoreKey], [][]byte{}}, + {app.keys[auth.StoreKey], newApp.keys[auth.StoreKey], [][]byte{}}, + {app.keys[staking.StoreKey], newApp.keys[staking.StoreKey], + [][]byte{ + staking.UnbondingQueueKey, staking.RedelegationQueueKey, staking.ValidatorQueueKey, + }}, // ordering may change but it doesn't matter + {app.keys[slashing.StoreKey], newApp.keys[slashing.StoreKey], [][]byte{}}, + {app.keys[mint.StoreKey], newApp.keys[mint.StoreKey], [][]byte{}}, + {app.keys[distr.StoreKey], newApp.keys[distr.StoreKey], [][]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 { @@ -516,9 +598,9 @@ func TestAppImportExport(t *testing.T) { prefixes := storeKeysPrefix.Prefixes storeA := ctxA.KVStore(storeKeyA) 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)) + failedKVs := sdk.DiffKVStores(storeA, storeB, prefixes) + fmt.Printf("Compared %d key/value pairs between %s and %s\n", len(failedKVs)/2, storeKeyA, storeKeyB) + require.Len(t, failedKVs, 0, simapp.GetSimulationLog(storeKeyA.Name(), app.cdc, newApp.cdc, failedKVs)) } } @@ -547,18 +629,37 @@ func TestAppSimulationAfterImport(t *testing.T) { require.Equal(t, "GaiaApp", app.Name()) // Run randomized simulation - stopEarly, err := simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, app)) + stopEarly, params, simErr := simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, app)) + + // export state and params before the simulation error is checked + if exportStatePath != "" { + fmt.Println("Exporting app state...") + appState, _, err := app.ExportAppStateAndValidators(false, nil) + require.NoError(t, err) + + err = ioutil.WriteFile(exportStatePath, []byte(appState), 0644) + require.NoError(t, err) + } + + if exportParamsPath != "" { + fmt.Println("Exporting simulation params...") + paramsBz, err := json.MarshalIndent(params, "", " ") + require.NoError(t, err) + + err = ioutil.WriteFile(exportParamsPath, paramsBz, 0644) + require.NoError(t, err) + } + + require.NoError(t, simErr) if commit { // for memdb: // fmt.Println("Database Size", db.Stats()["database.size"]) - fmt.Println("GoLevelDB Stats") + fmt.Println("\nGoLevelDB Stats") fmt.Println(db.Stats()["leveldb.stats"]) fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) } - require.Nil(t, err) - if stopEarly { // 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") @@ -589,7 +690,7 @@ func TestAppSimulationAfterImport(t *testing.T) { }) // Run randomized simulation on imported app - _, err = simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, newApp)) + _, _, err = simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, newApp)) require.Nil(t, err) } @@ -611,24 +712,16 @@ func TestAppStateDeterminism(t *testing.T) { db := dbm.NewMemDB() app := NewGaiaApp(logger, db, nil, true, 0) - // run randomized simulation + // Run randomized simulation simulation.SimulateFromSeed( t, os.Stdout, app.BaseApp, appStateFn, seed, - testAndRunTxs(app), - []sdk.Invariant{}, - 50, - 100, - true, - false, - false, - false, - app.ModuleAccountAddrs(), + testAndRunTxs(app), []sdk.Invariant{}, + 1, 50, 100, 0, "", + false, true, false, false, false, app.ModuleAccountAddrs(), ) - appHash := app.LastCommitID().Hash appHashList[j] = appHash } - for k := 1; k < numTimesToRunPerSeed; k++ { require.Equal(t, appHashList[0], appHashList[k], "appHash list: %v", appHashList) } @@ -646,15 +739,47 @@ func BenchmarkInvariants(b *testing.B) { }() app := NewGaiaApp(logger, db, nil, true, 0) + exportParams := exportParamsPath != "" // 2. Run parameterized simulation (w/o invariants) - _, err := simulation.SimulateFromSeed( + _, params, simErr := simulation.SimulateFromSeed( b, ioutil.Discard, app.BaseApp, appStateFn, seed, testAndRunTxs(app), - []sdk.Invariant{}, numBlocks, blockSize, commit, lean, onOperation, false, - app.ModuleAccountAddrs(), + []sdk.Invariant{}, initialBlockHeight, numBlocks, exportParamsHeight, blockSize, + exportStatsPath, exportParams, commit, lean, onOperation, false, app.ModuleAccountAddrs(), ) - if err != nil { - fmt.Println(err) + + // export state and params before the simulation error is checked + if exportStatePath != "" { + fmt.Println("Exporting app state...") + appState, _, err := app.ExportAppStateAndValidators(false, nil) + if err != nil { + fmt.Println(err) + b.Fail() + } + err = ioutil.WriteFile(exportStatePath, []byte(appState), 0644) + if err != nil { + fmt.Println(err) + b.Fail() + } + } + + if exportParamsPath != "" { + fmt.Println("Exporting simulation params...") + paramsBz, err := json.MarshalIndent(params, "", " ") + if err != nil { + fmt.Println(err) + b.Fail() + } + + err = ioutil.WriteFile(exportParamsPath, paramsBz, 0644) + if err != nil { + fmt.Println(err) + b.Fail() + } + } + + if simErr != nil { + fmt.Println(simErr) b.FailNow() } diff --git a/app/utils.go b/app/utils.go index da1450cb6e..d6dbfe37d3 100644 --- a/app/utils.go +++ b/app/utils.go @@ -4,23 +4,44 @@ package app import ( "io" - dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + dbm "github.com/tendermint/tm-db" - bam "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking" ) +var ( + genesisFile string + paramsFile string + exportParamsPath string + exportParamsHeight int + exportStatePath string + exportStatsPath string + seed int64 + initialBlockHeight int + 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 + genesisTime int64 +) + // DONTCOVER // NewGaiaAppUNSAFE is used for debugging purposes only. // // NOTE: to not use this function with non-test code func NewGaiaAppUNSAFE(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, - invCheckPeriod uint, baseAppOptions ...func(*bam.BaseApp), + invCheckPeriod uint, baseAppOptions ...func(*baseapp.BaseApp), ) (gapp *GaiaApp, keyMain, keyStaking *sdk.KVStoreKey, stakingKeeper staking.Keeper) { gapp = NewGaiaApp(logger, db, traceStore, loadLatest, invCheckPeriod, baseAppOptions...) - return gapp, gapp.keyMain, gapp.keyStaking, gapp.stakingKeeper + return gapp, gapp.keys[baseapp.MainStoreKey], gapp.keys[staking.StoreKey], gapp.stakingKeeper } diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index a31ad3fe61..7269e5a706 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -778,9 +778,6 @@ func TestGaiaCLIQueryTxPagination(t *testing.T) { txsPage2 := f.QueryTxs(2, 15, fmt.Sprintf("message.sender:%s", fooAddr)) require.Len(t, txsPage2.Txs, 15) require.NotEqual(t, txsPage1.Txs, txsPage2.Txs) - txsPage3 := f.QueryTxs(3, 15, fmt.Sprintf("message.sender:%s", fooAddr)) - require.Len(t, txsPage3.Txs, 15) - require.Equal(t, txsPage2.Txs, txsPage3.Txs) // perPage = 16, 2 pages txsPage1 = f.QueryTxs(1, 16, fmt.Sprintf("message.sender:%s", fooAddr)) diff --git a/cli_test/test_helpers.go b/cli_test/test_helpers.go index 966928d746..c7ae1680a8 100644 --- a/cli_test/test_helpers.go +++ b/cli_test/test_helpers.go @@ -157,6 +157,7 @@ func InitFixtures(t *testing.T) (f *Fixtures) { f.CLIConfig("chain-id", f.ChainID) f.CLIConfig("broadcast-mode", "block") + f.CLIConfig("trust-node", "true") // start an account with tokens f.AddGenesisAccount(f.KeyAddress(keyFoo), startCoins) diff --git a/cmd/gaiad/main.go b/cmd/gaiad/main.go index 0978f8171e..4564b23afb 100644 --- a/cmd/gaiad/main.go +++ b/cmd/gaiad/main.go @@ -9,9 +9,9 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/cli" - dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" tmtypes "github.com/tendermint/tendermint/types" + dbm "github.com/tendermint/tm-db" "github.com/cosmos/gaia/app" diff --git a/cmd/gaiad/replay.go b/cmd/gaiad/replay.go index 3e01532918..934f7340b7 100644 --- a/cmd/gaiad/replay.go +++ b/cmd/gaiad/replay.go @@ -11,10 +11,10 @@ import ( "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" - bcm "github.com/tendermint/tendermint/blockchain" cmn "github.com/tendermint/tendermint/libs/common" "github.com/tendermint/tendermint/proxy" tmsm "github.com/tendermint/tendermint/state" + tmstore "github.com/tendermint/tendermint/store" tm "github.com/tendermint/tendermint/types" "github.com/cosmos/gaia/app" @@ -154,7 +154,7 @@ func replayTxs(rootDir string) error { // Create block store fmt.Fprintln(os.Stderr, "Creating block store") - blockStore := bcm.NewBlockStore(bcDB) + blockStore := tmstore.NewBlockStore(bcDB) tz := []time.Duration{0, 0, 0} for i := int(state.LastBlockHeight) + 1; ; i++ { diff --git a/cmd/gaiad/testnet.go b/cmd/gaiad/testnet.go index eb4abc2b24..ca55c66135 100644 --- a/cmd/gaiad/testnet.go +++ b/cmd/gaiad/testnet.go @@ -28,6 +28,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/genaccounts" "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/staking" ) @@ -42,7 +43,8 @@ var ( // get cmd to initialize all files for tendermint testnet and application func testnetCmd(ctx *server.Context, cdc *codec.Codec, - mbm module.BasicManager, genAccIterator genutil.GenesisAccountsIterator) *cobra.Command { + mbm module.BasicManager, genAccIterator genutiltypes.GenesisAccountsIterator, +) *cobra.Command { cmd := &cobra.Command{ Use: "testnet", @@ -96,7 +98,7 @@ const nodeDirPerm = 0755 // Initialize the testnet func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, - mbm module.BasicManager, genAccIterator genutil.GenesisAccountsIterator, + mbm module.BasicManager, genAccIterator genutiltypes.GenesisAccountsIterator, outputDir, chainID, minGasPrices, nodeDirPrefix, nodeDaemonHome, nodeCLIHome, startingIPAddress string, numValidators int) error { @@ -287,7 +289,7 @@ func collectGenFiles( cdc *codec.Codec, config *tmconfig.Config, chainID string, monikers, nodeIDs []string, valPubKeys []crypto.PubKey, numValidators int, outputDir, nodeDirPrefix, nodeDaemonHome string, - genAccIterator genutil.GenesisAccountsIterator) error { + genAccIterator genutiltypes.GenesisAccountsIterator) error { var appState json.RawMessage genTime := tmtime.Now() diff --git a/go.mod b/go.mod index 08df35d69a..90a747d310 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,11 @@ module github.com/cosmos/gaia go 1.12 require ( + github.com/aws/aws-sdk-go v1.21.9 // indirect github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c // indirect - github.com/cosmos/cosmos-sdk v0.28.2-0.20190718124356-a922dad3468b + github.com/cosmos/cosmos-sdk v0.28.2-0.20190803135615-4b354a782bcd github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect + github.com/cosmos/tools/cmd/runsim v0.0.0-20190802160424-c5def0673f0a // indirect github.com/go-kit/kit v0.9.0 // indirect github.com/golang/mock v1.3.1 // indirect github.com/gorilla/mux v1.7.3 // indirect @@ -19,20 +21,21 @@ require ( github.com/pkg/errors v0.8.1 github.com/prometheus/common v0.6.0 // indirect github.com/prometheus/procfs v0.0.3 // indirect - github.com/rakyll/statik v0.1.6 // indirect github.com/rcrowley/go-metrics v0.0.0-20190704165056-9c2d0518ed81 // indirect github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa github.com/spf13/afero v1.2.2 // indirect github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.4.0 + github.com/stretchr/objx v0.2.0 // indirect github.com/stretchr/testify v1.3.0 github.com/tendermint/go-amino v0.15.0 - github.com/tendermint/tendermint v0.32.1 + github.com/tendermint/tendermint v0.32.2 + github.com/tendermint/tm-db v0.1.1 golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect - golang.org/x/net v0.0.0-20190628185345-da137c7871d7 // indirect - golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb // indirect + golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect + golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect golang.org/x/text v0.3.2 // indirect + golang.org/x/tools v0.0.0-20190802220118-1d1727260058 // indirect google.golang.org/appengine v1.4.0 // indirect google.golang.org/genproto v0.0.0-20190701230453-710ae3a149df // indirect - google.golang.org/grpc v1.22.0 // indirect ) diff --git a/go.sum b/go.sum index f542ab8ac9..67afe12444 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,9 @@ github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBA github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/aws/aws-sdk-go v1.20.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.21.9 h1:+HXP97l4IbJvccwwNoweEknroEcX8QLwExcnc+Kxobg= +github.com/aws/aws-sdk-go v1.21.9/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= 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/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -37,8 +40,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-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/cosmos/cosmos-sdk v0.28.2-0.20190718124356-a922dad3468b h1:Xdy1RNh4+it+umYuygHprhzpgbmZIMJHykS11FVViVc= -github.com/cosmos/cosmos-sdk v0.28.2-0.20190718124356-a922dad3468b/go.mod h1:UV765S3m9sxCg8rYaBr4XgeHZl2UP6y++Coz9mLlYFc= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190803135615-4b354a782bcd h1:YQdSHOk1eCDG+QBrkIVXIg9cZ+0W3A6PNQTfsR+tOYA= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190803135615-4b354a782bcd/go.mod h1:RkWDqk5VawCuk6G+Mr7kWkE+1i5oHhxdOriaRibAvPg= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -46,6 +49,8 @@ github.com/cosmos/ledger-cosmos-go v0.10.3 h1:Qhi5yTR5Pg1CaTpd00pxlGwNl4sFRdtK1J github.com/cosmos/ledger-cosmos-go v0.10.3/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= 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/tools/cmd/runsim v0.0.0-20190802160424-c5def0673f0a h1:gYJxAVZN6ZBPP2FTAN2criusPhS9UYrNCOv0nUphmzA= +github.com/cosmos/tools/cmd/runsim v0.0.0-20190802160424-c5def0673f0a/go.mod h1:J/WXP5By/qBDT9MkxIOq6HLhukR8GW+KfPnY7NAXM4s= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= 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= @@ -85,7 +90,8 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y 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/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/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -110,7 +116,8 @@ 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/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= 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= @@ -128,6 +135,10 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN 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/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/lusis/go-slackbot v0.0.0-20180109053408-401027ccfef5/go.mod h1:c2mYKRyMb1BPkO5St0c/ps62L4S0W2NAkaTXj9qEI+0= +github.com/lusis/slack-test v0.0.0-20190426140909-c40012f20018/go.mod h1:sFlOUpQL1YcjhFVXhg1CG8ZASEs/Mf1oVb6H75JL/zg= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -142,6 +153,8 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nlopes/slack v0.5.0 h1:NbIae8Kd0NpqaEI3iUrsuS0KbcEDhzhc939jLW5fNm0= +github.com/nlopes/slack v0.5.0/go.mod h1:jVI4BBK3lSktibKahxBF74txcK2vyvkza1z/+rRnVAM= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -190,7 +203,6 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE= github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rakyll/statik v0.1.4/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs= github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= @@ -225,10 +237,10 @@ 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/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.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= 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/syndtr/goleveldb v0.0.0-20181105012736-f9080354173f/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= 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/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= @@ -238,11 +250,14 @@ github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5/go.mod h1:z4YtwM 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/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.3-0.20190712145259-c834d3192b52/go.mod h1:A9IoWRVTibyXXlfZztHy52RloI85QOrIcsE9dyQh+DY= -github.com/tendermint/tendermint v0.31.7/go.mod h1:ymcPyWblXCplCPQjbOYbrF1fWnpslATMVqiGgWbZrlc= +github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8= +github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o= 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.2 h1:FvZWdksfDg/65vKKr5Lgo57keARFnmhrUEXHwyrV1QY= +github.com/tendermint/tendermint v0.32.2/go.mod h1:NwMyx58S8VJ7tEpFKqRVlVWKO9N9zjTHu+Dx96VsnOE= +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/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/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= @@ -258,10 +273,10 @@ go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/ 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-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-20190228161510-8dd112bcdc25/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/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/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -279,8 +294,11 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn 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-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 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/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/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/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= @@ -298,6 +316,8 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb h1:fgwFCsaw9buMuxNd6+DQfAuSFqbNiQZpcgJQAgJsK6k= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa h1:KIDDMLT1O0Nr7TSxp8xM5tJcdn8tgyAONntO829og1M= +golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -309,6 +329,7 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 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-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190802220118-1d1727260058/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= diff --git a/lcd_test/helpers.go b/lcd_test/helpers.go index e685cafd3a..2eb0d4a5f3 100644 --- a/lcd_test/helpers.go +++ b/lcd_test/helpers.go @@ -10,12 +10,14 @@ import ( "sort" "strings" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/lcd" "github.com/cosmos/cosmos-sdk/codec" crkeys "github.com/cosmos/cosmos-sdk/crypto/keys" "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/simapp" + "github.com/cosmos/cosmos-sdk/store" "github.com/cosmos/cosmos-sdk/tests" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" @@ -37,7 +39,6 @@ import ( "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/crypto/secp256k1" "github.com/tendermint/tendermint/libs/cli" - dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" nm "github.com/tendermint/tendermint/node" "github.com/tendermint/tendermint/p2p" @@ -46,6 +47,7 @@ import ( ctypes "github.com/tendermint/tendermint/rpc/core/types" tmrpc "github.com/tendermint/tendermint/rpc/lib/server" tmtypes "github.com/tendermint/tendermint/types" + dbm "github.com/tendermint/tm-db" gapp "github.com/cosmos/gaia/app" ) @@ -70,7 +72,7 @@ func InitializeLCD(nValidators int, initAddrs []sdk.AccAddress, minting bool, po logger = log.NewFilter(logger, log.AllowError()) db := dbm.NewMemDB() - app := gapp.NewGaiaApp(logger, db, nil, true, 0) + app := gapp.NewGaiaApp(logger, db, nil, true, 0, baseapp.SetPruning(store.PruneNothing)) cdc = gapp.MakeCodec() genDoc, valConsPubKeys, valOperAddrs, privVal, err := defaultGenesis(config, nValidators, initAddrs, minting) @@ -227,7 +229,8 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd supplyDataBz := genesisState[supply.ModuleName] var supplyData supply.GenesisState cdc.MustUnmarshalJSON(supplyDataBz, &supplyData) - supplyData.Supply.Total = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, totalSupply)) + + supplyData.Supply = supplyData.Supply.SetTotal(sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, totalSupply))) supplyDataBz = cdc.MustMarshalJSON(supplyData) genesisState[supply.ModuleName] = supplyDataBz diff --git a/lcd_test/helpers_test.go b/lcd_test/helpers_test.go index 54a854aae0..05044f297b 100644 --- a/lcd_test/helpers_test.go +++ b/lcd_test/helpers_test.go @@ -33,8 +33,6 @@ import ( "github.com/spf13/viper" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/p2p" - ctypes "github.com/tendermint/tendermint/rpc/core/types" ) @@ -65,15 +63,15 @@ func Request(t *testing.T, port, method, path string, payload []byte) (*http.Res // ICS 0 - Tendermint // ---------------------------------------------------------------------- // GET /node_info The properties of the connected node -func getNodeInfo(t *testing.T, port string) p2p.DefaultNodeInfo { +func getNodeInfo(t *testing.T, port string) rpc.NodeInfoResponse { res, body := Request(t, port, "GET", "/node_info", nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - var nodeInfo p2p.DefaultNodeInfo + var nodeInfo rpc.NodeInfoResponse err := cdc.UnmarshalJSON([]byte(body), &nodeInfo) - require.Nil(t, err, "Couldn't parse node info") + require.Nil(t, err, "failed parse node info") - require.NotEqual(t, p2p.DefaultNodeInfo{}, nodeInfo, "res: %v", res) + require.NotEqual(t, rpc.NodeInfoResponse{}, nodeInfo, "res: %v", res) return nodeInfo } @@ -81,11 +79,12 @@ func getNodeInfo(t *testing.T, port string) p2p.DefaultNodeInfo { func getSyncStatus(t *testing.T, port string, syncing bool) { res, body := Request(t, port, "GET", "/syncing", nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - if syncing { - require.Equal(t, "true", body) - return - } - require.Equal(t, "false", body) + + var syncResp rpc.SyncingResponse + err := cdc.UnmarshalJSON([]byte(body), &syncResp) + require.Nil(t, err, "failed parse syncing info") + + require.Equal(t, syncResp.Syncing, syncing) } // GET /blocks/latest Get the latest block @@ -113,6 +112,13 @@ func getBlock(t *testing.T, port string, height int, expectFail bool) ctypes.Res return resultBlock } +func extractResultFromResponse(t *testing.T, body []byte) []byte { + var resp rest.ResponseWithHeight + require.NoError(t, cdc.UnmarshalJSON([]byte(body), &resp)) + + return resp.Result +} + // GET /validatorsets/{height} Get a validator set a certain height // GET /validatorsets/latest Get the latest validator set func getValidatorSets(t *testing.T, port string, height int, expectFail bool) rpc.ResultValidatorsOutput { @@ -122,8 +128,8 @@ func getValidatorSets(t *testing.T, port string, height int, expectFail bool) rp } else { url = "/validatorsets/latest" } - var resultVals rpc.ResultValidatorsOutput + var resultVals rpc.ResultValidatorsOutput res, body := Request(t, port, "GET", url, nil) if expectFail { @@ -133,8 +139,8 @@ func getValidatorSets(t *testing.T, port string, height int, expectFail bool) rp require.Equal(t, http.StatusOK, res.StatusCode, body) - err := cdc.UnmarshalJSON([]byte(body), &resultVals) - require.Nil(t, err, "Couldn't parse validatorset") + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &resultVals) + require.Nil(t, err, "Couldn't parse validator set") require.NotEqual(t, rpc.ResultValidatorsOutput{}, resultVals) return resultVals @@ -254,21 +260,11 @@ func updateKey(t *testing.T, port, name, oldPassword, newPassword string, fail b require.Equal(t, http.StatusOK, res.StatusCode, body) } -// DELETE /keys/{name} Remove an account -func deleteKey(t *testing.T, port, name, password string) { - dk := clientkeys.NewDeleteKeyReq(password) - req, err := cdc.MarshalJSON(dk) - require.NoError(t, err) - keyEndpoint := fmt.Sprintf("/keys/%s", name) - res, body := Request(t, port, "DELETE", keyEndpoint, req) - require.Equal(t, http.StatusOK, res.StatusCode, body) -} - // GET /auth/accounts/{address} Get the account information on blockchain func getAccount(t *testing.T, port string, addr sdk.AccAddress) (acc auth.Account) { res, body := Request(t, port, "GET", fmt.Sprintf("/auth/accounts/%s", addr.String()), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - require.Nil(t, cdc.UnmarshalJSON([]byte(body), &acc)) + require.Nil(t, cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &acc)) return acc } @@ -547,7 +543,7 @@ func getDelegatorDelegations(t *testing.T, port string, delegatorAddr sdk.AccAdd var dels staking.DelegationResponses - err := cdc.UnmarshalJSON([]byte(body), &dels) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &dels) require.Nil(t, err) return dels @@ -560,7 +556,7 @@ func getDelegatorUnbondingDelegations(t *testing.T, port string, delegatorAddr s var ubds []staking.UnbondingDelegation - err := cdc.UnmarshalJSON([]byte(body), &ubds) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &ubds) require.Nil(t, err) return ubds @@ -585,7 +581,7 @@ func getRedelegations(t *testing.T, port string, delegatorAddr sdk.AccAddress, s require.Equal(t, http.StatusOK, res.StatusCode, body) var redels staking.RedelegationResponses - err := cdc.UnmarshalJSON([]byte(body), &redels) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &redels) require.Nil(t, err) return redels @@ -598,7 +594,7 @@ func getDelegatorValidators(t *testing.T, port string, delegatorAddr sdk.AccAddr var bondedValidators []staking.Validator - err := cdc.UnmarshalJSON([]byte(body), &bondedValidators) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &bondedValidators) require.Nil(t, err) return bondedValidators @@ -610,7 +606,7 @@ func getDelegatorValidator(t *testing.T, port string, delegatorAddr sdk.AccAddre require.Equal(t, http.StatusOK, res.StatusCode, body) var bondedValidator staking.Validator - err := cdc.UnmarshalJSON([]byte(body), &bondedValidator) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &bondedValidator) require.Nil(t, err) return bondedValidator @@ -642,7 +638,7 @@ func getDelegation(t *testing.T, port string, delegatorAddr sdk.AccAddress, vali require.Equal(t, http.StatusOK, res.StatusCode, body) var bond staking.DelegationResponse - err := cdc.UnmarshalJSON([]byte(body), &bond) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &bond) require.Nil(t, err) return bond @@ -659,7 +655,7 @@ func getUnbondingDelegation(t *testing.T, port string, delegatorAddr sdk.AccAddr require.Equal(t, http.StatusOK, res.StatusCode, body) var unbond staking.UnbondingDelegation - err := cdc.UnmarshalJSON([]byte(body), &unbond) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &unbond) require.Nil(t, err) return unbond @@ -671,7 +667,7 @@ func getValidators(t *testing.T, port string) []staking.Validator { require.Equal(t, http.StatusOK, res.StatusCode, body) var validators []staking.Validator - err := cdc.UnmarshalJSON([]byte(body), &validators) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &validators) require.Nil(t, err) return validators @@ -683,7 +679,7 @@ func getValidator(t *testing.T, port string, validatorAddr sdk.ValAddress) staki require.Equal(t, http.StatusOK, res.StatusCode, body) var validator staking.Validator - err := cdc.UnmarshalJSON([]byte(body), &validator) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &validator) require.Nil(t, err) return validator @@ -695,7 +691,7 @@ func getValidatorDelegations(t *testing.T, port string, validatorAddr sdk.ValAdd require.Equal(t, http.StatusOK, res.StatusCode, body) var delegations []staking.Delegation - err := cdc.UnmarshalJSON([]byte(body), &delegations) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &delegations) require.Nil(t, err) return delegations @@ -707,34 +703,12 @@ func getValidatorUnbondingDelegations(t *testing.T, port string, validatorAddr s require.Equal(t, http.StatusOK, res.StatusCode, body) var ubds []staking.UnbondingDelegation - err := cdc.UnmarshalJSON([]byte(body), &ubds) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &ubds) require.Nil(t, err) return ubds } -// GET /staking/pool Get the current state of the staking pool -func getStakingPool(t *testing.T, port string) staking.Pool { - res, body := Request(t, port, "GET", "/staking/pool", nil) - require.Equal(t, http.StatusOK, res.StatusCode, body) - require.NotNil(t, body) - var pool staking.Pool - err := cdc.UnmarshalJSON([]byte(body), &pool) - require.Nil(t, err) - return pool -} - -// GET /staking/parameters Get the current staking parameter values -func getStakingParams(t *testing.T, port string) staking.Params { - res, body := Request(t, port, "GET", "/staking/parameters", nil) - require.Equal(t, http.StatusOK, res.StatusCode, body) - - var params staking.Params - err := cdc.UnmarshalJSON([]byte(body), ¶ms) - require.Nil(t, err) - return params -} - // ---------------------------------------------------------------------- // ICS 22 - Gov // ---------------------------------------------------------------------- @@ -860,7 +834,7 @@ func getProposalsAll(t *testing.T, port string) []gov.Proposal { require.Equal(t, http.StatusOK, res.StatusCode, body) var proposals []gov.Proposal - err := cdc.UnmarshalJSON([]byte(body), &proposals) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &proposals) require.Nil(t, err) return proposals } @@ -871,7 +845,7 @@ func getProposalsFilterDepositor(t *testing.T, port string, depositorAddr sdk.Ac require.Equal(t, http.StatusOK, res.StatusCode, body) var proposals []gov.Proposal - err := cdc.UnmarshalJSON([]byte(body), &proposals) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &proposals) require.Nil(t, err) return proposals } @@ -882,7 +856,7 @@ func getProposalsFilterVoter(t *testing.T, port string, voterAddr sdk.AccAddress require.Equal(t, http.StatusOK, res.StatusCode, body) var proposals []gov.Proposal - err := cdc.UnmarshalJSON([]byte(body), &proposals) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &proposals) require.Nil(t, err) return proposals } @@ -893,7 +867,7 @@ func getProposalsFilterVoterDepositor(t *testing.T, port string, voterAddr, depo require.Equal(t, http.StatusOK, res.StatusCode, body) var proposals []gov.Proposal - err := cdc.UnmarshalJSON([]byte(body), &proposals) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &proposals) require.Nil(t, err) return proposals } @@ -904,7 +878,7 @@ func getProposalsFilterStatus(t *testing.T, port string, status gov.ProposalStat require.Equal(t, http.StatusOK, res.StatusCode, body) var proposals []gov.Proposal - err := cdc.UnmarshalJSON([]byte(body), &proposals) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &proposals) require.Nil(t, err) return proposals } @@ -949,7 +923,7 @@ func getDeposits(t *testing.T, port string, proposalID uint64) []gov.Deposit { res, body := Request(t, port, "GET", fmt.Sprintf("/gov/proposals/%d/deposits", proposalID), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) var deposits []gov.Deposit - err := cdc.UnmarshalJSON([]byte(body), &deposits) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &deposits) require.Nil(t, err) return deposits } @@ -958,9 +932,11 @@ func getDeposits(t *testing.T, port string, proposalID uint64) []gov.Deposit { func getTally(t *testing.T, port string, proposalID uint64) gov.TallyResult { res, body := Request(t, port, "GET", fmt.Sprintf("/gov/proposals/%d/tally", proposalID), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) + var tally gov.TallyResult - err := cdc.UnmarshalJSON([]byte(body), &tally) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &tally) require.Nil(t, err) + return tally } @@ -1005,7 +981,7 @@ func getVotes(t *testing.T, port string, proposalID uint64) []gov.Vote { res, body := Request(t, port, "GET", fmt.Sprintf("/gov/proposals/%d/votes", proposalID), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) var votes []gov.Vote - err := cdc.UnmarshalJSON([]byte(body), &votes) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &votes) require.Nil(t, err) return votes } @@ -1014,9 +990,11 @@ func getVotes(t *testing.T, port string, proposalID uint64) []gov.Vote { func getProposal(t *testing.T, port string, proposalID uint64) gov.Proposal { res, body := Request(t, port, "GET", fmt.Sprintf("/gov/proposals/%d", proposalID), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) + var proposal gov.Proposal - err := cdc.UnmarshalJSON([]byte(body), &proposal) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &proposal) require.Nil(t, err) + return proposal } @@ -1024,9 +1002,11 @@ func getProposal(t *testing.T, port string, proposalID uint64) gov.Proposal { func getDeposit(t *testing.T, port string, proposalID uint64, depositorAddr sdk.AccAddress) gov.Deposit { res, body := Request(t, port, "GET", fmt.Sprintf("/gov/proposals/%d/deposits/%s", proposalID, depositorAddr), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) + var deposit gov.Deposit - err := cdc.UnmarshalJSON([]byte(body), &deposit) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &deposit) require.Nil(t, err) + return deposit } @@ -1034,9 +1014,11 @@ func getDeposit(t *testing.T, port string, proposalID uint64, depositorAddr sdk. func getVote(t *testing.T, port string, proposalID uint64, voterAddr sdk.AccAddress) gov.Vote { res, body := Request(t, port, "GET", fmt.Sprintf("/gov/proposals/%d/votes/%s", proposalID, voterAddr), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) + var vote gov.Vote - err := cdc.UnmarshalJSON([]byte(body), &vote) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &vote) require.Nil(t, err) + return vote } @@ -1046,7 +1028,7 @@ func getProposer(t *testing.T, port string, proposalID uint64) gcutils.Proposer require.Equal(t, http.StatusOK, res.StatusCode, body) var proposer gcutils.Proposer - err := cdc.UnmarshalJSON([]byte(body), &proposer) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &proposer) require.Nil(t, err) return proposer @@ -1058,8 +1040,9 @@ func getDepositParam(t *testing.T, port string) gov.DepositParams { require.Equal(t, http.StatusOK, res.StatusCode, body) var depositParams gov.DepositParams - err := cdc.UnmarshalJSON([]byte(body), &depositParams) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &depositParams) require.Nil(t, err) + return depositParams } @@ -1094,7 +1077,7 @@ func getSigningInfo(t *testing.T, port string, validatorPubKey string) slashing. require.Equal(t, http.StatusOK, res.StatusCode, body) var signingInfo slashing.ValidatorSigningInfo - err := cdc.UnmarshalJSON([]byte(body), &signingInfo) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &signingInfo) require.Nil(t, err) return signingInfo @@ -1109,7 +1092,7 @@ func getSigningInfoList(t *testing.T, port string) []slashing.ValidatorSigningIn require.Equal(t, http.StatusOK, res.StatusCode, body) var signingInfo []slashing.ValidatorSigningInfo - err := cdc.UnmarshalJSON([]byte(body), &signingInfo) + err := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &signingInfo) require.Nil(t, err) return signingInfo diff --git a/lcd_test/lcd_test.go b/lcd_test/lcd_test.go index 5411250bb9..bd76de050a 100644 --- a/lcd_test/lcd_test.go +++ b/lcd_test/lcd_test.go @@ -7,7 +7,6 @@ import ( "fmt" "net/http" "os" - "regexp" "strings" "testing" "time" @@ -45,35 +44,6 @@ func init() { version.Version = os.Getenv("VERSION") } -func TestVersion(t *testing.T) { - // skip the test if the VERSION environment variable has not been set - if version.Version == "" { - t.SkipNow() - } - - cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{}, true) - require.NoError(t, err) - defer cleanup() - - // node info - res, body := Request(t, port, "GET", "/version", nil) - require.Equal(t, http.StatusOK, res.StatusCode, body) - - reg, err := regexp.Compile(`\d+\.\d+\.\d+.*`) - require.Nil(t, err) - match := reg.MatchString(body) - require.True(t, match, body, body) - - // node info - res, body = Request(t, port, "GET", "/node_version", nil) - require.Equal(t, http.StatusOK, res.StatusCode, body) - - reg, err = regexp.Compile(`\d+\.\d+\.\d+.*`) - require.Nil(t, err) - match = reg.MatchString(body) - require.True(t, match, body) -} - func TestNodeStatus(t *testing.T) { cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{}, true) require.NoError(t, err) @@ -452,7 +422,7 @@ func TestBonding(t *testing.T) { acc = getAccount(t, port, addr) coins := acc.GetCoins() expectedBalance := initialBalance[0].Sub(fees[0]) - require.Equal(t, expectedBalance.Amount.Sub(delTokens), coins.AmountOf(sdk.DefaultBondDenom)) + require.Equal(t, expectedBalance.Amount.Sub(delTokens).String(), coins.AmountOf(sdk.DefaultBondDenom).String()) expectedBalance = coins[0] // query delegation @@ -1036,12 +1006,12 @@ func TestDistributionFlow(t *testing.T) { var rewards sdk.DecCoins res, body := Request(t, port, "GET", fmt.Sprintf("/distribution/validators/%s/outstanding_rewards", valAddr), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - require.NoError(t, cdc.UnmarshalJSON([]byte(body), &rewards)) + require.NoError(t, cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &rewards)) var valDistInfo distrrest.ValidatorDistInfo res, body = Request(t, port, "GET", "/distribution/validators/"+valAddr.String(), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - require.NoError(t, cdc.UnmarshalJSON([]byte(body), &valDistInfo)) + require.NoError(t, cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &valDistInfo)) require.Equal(t, valDistInfo.OperatorAddress.String(), sdk.AccAddress(valAddr).String()) // Delegate some coins @@ -1058,40 +1028,40 @@ func TestDistributionFlow(t *testing.T) { // Query outstanding rewards changed res, body = Request(t, port, "GET", fmt.Sprintf("/distribution/validators/%s/outstanding_rewards", valAddr), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - require.NoError(t, cdc.UnmarshalJSON([]byte(body), &rewards)) + require.NoError(t, cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &rewards)) // Query validator distribution info res, body = Request(t, port, "GET", "/distribution/validators/"+valAddr.String(), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - require.NoError(t, cdc.UnmarshalJSON([]byte(body), &valDistInfo)) + require.NoError(t, cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &valDistInfo)) // Query validator's rewards res, body = Request(t, port, "GET", fmt.Sprintf("/distribution/validators/%s/rewards", valAddr), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - require.NoError(t, cdc.UnmarshalJSON([]byte(body), &rewards)) + require.NoError(t, cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &rewards)) // Query self-delegation res, body = Request(t, port, "GET", fmt.Sprintf("/distribution/delegators/%s/rewards/%s", operAddr, valAddr), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - require.NoError(t, cdc.UnmarshalJSON([]byte(body), &rewards)) + require.NoError(t, cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &rewards)) // Query delegation res, body = Request(t, port, "GET", fmt.Sprintf("/distribution/delegators/%s/rewards/%s", addr, valAddr), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - require.NoError(t, cdc.UnmarshalJSON([]byte(body), &rewards)) + require.NoError(t, cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &rewards)) // Query delegator's rewards total var delRewards disttypes.QueryDelegatorTotalRewardsResponse res, body = Request(t, port, "GET", fmt.Sprintf("/distribution/delegators/%s/rewards", operAddr), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - require.NoError(t, json.Unmarshal([]byte(body), &delRewards)) + require.NoError(t, json.Unmarshal(extractResultFromResponse(t, []byte(body)), &delRewards)) // Query delegator's withdrawal address var withdrawAddr string res, body = Request(t, port, "GET", fmt.Sprintf("/distribution/delegators/%s/withdraw_address", operAddr), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - require.NoError(t, cdc.UnmarshalJSON([]byte(body), &withdrawAddr)) + require.NoError(t, cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &withdrawAddr)) require.Equal(t, operAddr.String(), withdrawAddr) // Withdraw delegator's rewards @@ -1112,19 +1082,19 @@ func TestMintingQueries(t *testing.T) { require.Equal(t, http.StatusOK, res.StatusCode, body) var params mint.Params - require.NoError(t, cdc.UnmarshalJSON([]byte(body), ¶ms)) + require.NoError(t, cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), ¶ms)) res, body = Request(t, port, "GET", "/minting/inflation", nil) require.Equal(t, http.StatusOK, res.StatusCode, body) var inflation sdk.Dec - require.NoError(t, cdc.UnmarshalJSON([]byte(body), &inflation)) + require.NoError(t, cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &inflation)) res, body = Request(t, port, "GET", "/minting/annual-provisions", nil) require.Equal(t, http.StatusOK, res.StatusCode, body) var annualProvisions sdk.Dec - require.NoError(t, cdc.UnmarshalJSON([]byte(body), &annualProvisions)) + require.NoError(t, cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &annualProvisions)) } func TestAccountBalanceQuery(t *testing.T) { diff --git a/sims.mk b/sims.mk index 4a8d7f9653..5ec88251f5 100644 --- a/sims.mk +++ b/sims.mk @@ -7,25 +7,25 @@ SIMAPP = github.com/cosmos/gaia/app sim-gaia-nondeterminism: @echo "Running nondeterminism test..." - @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -SimulationEnabled=true -v -timeout 10m + @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true -v -timeout 10m sim-gaia-custom-genesis-fast: @echo "Running custom genesis simulation..." @echo "By default, ${HOME}/.gaiad/config/genesis.json will be used." - @go test -mod=readonly github.com/cosmos/gaia/app -run TestFullGaiaSimulation -SimulationGenesis=${HOME}/.gaiad/config/genesis.json \ - -SimulationEnabled=true -SimulationNumBlocks=100 -SimulationBlockSize=200 -SimulationCommit=true -SimulationSeed=99 -SimulationPeriod=5 -v -timeout 24h + @go test -mod=readonly $(SIMAPP) -run TestFullGaiaSimulation -Genesis=${HOME}/.gaiad/config/genesis.json \ + -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h sim-gaia-fast: @echo "Running quick Gaia simulation. This may take several minutes..." - @go test -mod=readonly github.com/cosmos/gaia/app -run TestFullGaiaSimulation -SimulationEnabled=true -SimulationNumBlocks=100 -SimulationBlockSize=200 -SimulationCommit=true -SimulationSeed=99 -SimulationPeriod=5 -v -timeout 24h + @go test -mod=readonly $(SIMAPP) -run TestFullGaiaSimulation -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h sim-gaia-import-export: runsim @echo "Running Gaia import/export simulation. This may take several minutes..." - $(GOPATH)/bin/runsim 25 5 TestGaiaImportExport + $(GOPATH)/bin/runsim $(SIMAPP) 25 5 TestGaiaImportExport sim-gaia-simulation-after-import: runsim @echo "Running Gaia simulation-after-import. This may take several minutes..." - $(GOPATH)/bin/runsim 25 5 TestGaiaSimulationAfterImport + $(GOPATH)/bin/runsim $(SIMAPP) 25 5 TestGaiaSimulationAfterImport sim-gaia-custom-genesis-multi-seed: runsim @echo "Running multi-seed custom genesis simulation..." @@ -34,26 +34,26 @@ sim-gaia-custom-genesis-multi-seed: runsim sim-gaia-multi-seed: runsim @echo "Running multi-seed Gaia simulation. This may take awhile!" - $(GOPATH)/bin/runsim 400 5 TestFullGaiaSimulation + $(GOPATH)/bin/runsim $(SIMAPP) 400 5 TestFullGaiaSimulation sim-benchmark-invariants: @echo "Running simulation invariant benchmarks..." - @go test -mod=readonly github.com/cosmos/gaia/app -benchmem -bench=BenchmarkInvariants -run=^$ \ - -SimulationEnabled=true -SimulationNumBlocks=1000 -SimulationBlockSize=200 \ - -SimulationCommit=true -SimulationSeed=57 -v -timeout 24h + @go test -mod=readonly $(SIMAPP) -benchmem -bench=BenchmarkInvariants -run=^$ \ + -Enabled=true -NumBlocks=1000 -BlockSize=200 \ + -Commit=true -Seed=57 -v -timeout 24h SIM_NUM_BLOCKS ?= 500 SIM_BLOCK_SIZE ?= 200 SIM_COMMIT ?= true sim-gaia-benchmark: @echo "Running Gaia benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" - @go test -mod=readonly -benchmem -run=^$$ github.com/cosmos/gaia/app -bench ^BenchmarkFullGaiaSimulation$$ \ - -SimulationEnabled=true -SimulationNumBlocks=$(SIM_NUM_BLOCKS) -SimulationBlockSize=$(SIM_BLOCK_SIZE) -SimulationCommit=$(SIM_COMMIT) -timeout 24h + @go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullGaiaSimulation$$ \ + -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h sim-gaia-profile: @echo "Running Gaia benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" - @go test -mod=readonly -benchmem -run=^$$ github.com/cosmos/gaia/app -bench ^BenchmarkFullGaiaSimulation$$ \ - -SimulationEnabled=true -SimulationNumBlocks=$(SIM_NUM_BLOCKS) -SimulationBlockSize=$(SIM_BLOCK_SIZE) -SimulationCommit=$(SIM_COMMIT) -timeout 24h -cpuprofile cpu.out -memprofile mem.out + @go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullGaiaSimulation$$ \ + -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h -cpuprofile cpu.out -memprofile mem.out .PHONY: runsim sim-gaia-nondeterminism sim-gaia-custom-genesis-fast sim-gaia-fast sim-gaia-import-export \ From 0ce07d569c0440d6b236cfbfad24378e8a3c2f62 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Mon, 5 Aug 2019 13:29:46 -0400 Subject: [PATCH 003/685] Merge PR #87: Update SDK and call RegisterEvidences --- app/app.go | 5 ++++- go.mod | 2 +- go.sum | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index a832f27c89..69ccfe8eb0 100644 --- a/app/app.go +++ b/app/app.go @@ -6,8 +6,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" cmn "github.com/tendermint/tendermint/libs/common" - dbm "github.com/tendermint/tm-db" "github.com/tendermint/tendermint/libs/log" + dbm "github.com/tendermint/tm-db" bam "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" @@ -71,9 +71,12 @@ var ( // custom tx codec func MakeCodec() *codec.Codec { var cdc = codec.New() + ModuleBasics.RegisterCodec(cdc) sdk.RegisterCodec(cdc) codec.RegisterCrypto(cdc) + codec.RegisterEvidences(cdc) + return cdc } diff --git a/go.mod b/go.mod index 90a747d310..8393f1f087 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.12 require ( github.com/aws/aws-sdk-go v1.21.9 // indirect github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c // indirect - github.com/cosmos/cosmos-sdk v0.28.2-0.20190803135615-4b354a782bcd + github.com/cosmos/cosmos-sdk v0.28.2-0.20190805164234-478eda1f7e3e github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/cosmos/tools/cmd/runsim v0.0.0-20190802160424-c5def0673f0a // indirect github.com/go-kit/kit v0.9.0 // indirect diff --git a/go.sum b/go.sum index 67afe12444..8f187fec0a 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,8 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/cosmos-sdk v0.28.2-0.20190803135615-4b354a782bcd h1:YQdSHOk1eCDG+QBrkIVXIg9cZ+0W3A6PNQTfsR+tOYA= github.com/cosmos/cosmos-sdk v0.28.2-0.20190803135615-4b354a782bcd/go.mod h1:RkWDqk5VawCuk6G+Mr7kWkE+1i5oHhxdOriaRibAvPg= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190805164234-478eda1f7e3e h1:PLg7n+5Ndp9sOZ4dxxP3TsPiBz9bYikgALG9HPu+55Q= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190805164234-478eda1f7e3e/go.mod h1:RkWDqk5VawCuk6G+Mr7kWkE+1i5oHhxdOriaRibAvPg= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= From d4556022bbd23caac2fa9db364075e656a3f99ef Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Mon, 5 Aug 2019 13:45:54 -0400 Subject: [PATCH 004/685] Merge PR #88: Update SDK Version --- go.mod | 7 +------ go.sum | 25 ++----------------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/go.mod b/go.mod index 8393f1f087..40188c9136 100644 --- a/go.mod +++ b/go.mod @@ -3,11 +3,9 @@ module github.com/cosmos/gaia go 1.12 require ( - github.com/aws/aws-sdk-go v1.21.9 // indirect github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c // indirect - github.com/cosmos/cosmos-sdk v0.28.2-0.20190805164234-478eda1f7e3e + github.com/cosmos/cosmos-sdk v0.28.2-0.20190805171329-cf1980273fac github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect - github.com/cosmos/tools/cmd/runsim v0.0.0-20190802160424-c5def0673f0a // indirect github.com/go-kit/kit v0.9.0 // indirect github.com/golang/mock v1.3.1 // indirect github.com/gorilla/mux v1.7.3 // indirect @@ -26,7 +24,6 @@ require ( github.com/spf13/afero v1.2.2 // indirect github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.4.0 - github.com/stretchr/objx v0.2.0 // indirect github.com/stretchr/testify v1.3.0 github.com/tendermint/go-amino v0.15.0 github.com/tendermint/tendermint v0.32.2 @@ -35,7 +32,5 @@ require ( golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect golang.org/x/text v0.3.2 // indirect - golang.org/x/tools v0.0.0-20190802220118-1d1727260058 // indirect - google.golang.org/appengine v1.4.0 // indirect google.golang.org/genproto v0.0.0-20190701230453-710ae3a149df // indirect ) diff --git a/go.sum b/go.sum index 8f187fec0a..4001c7ca85 100644 --- a/go.sum +++ b/go.sum @@ -10,9 +10,6 @@ github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBA github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/aws/aws-sdk-go v1.20.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.21.9 h1:+HXP97l4IbJvccwwNoweEknroEcX8QLwExcnc+Kxobg= -github.com/aws/aws-sdk-go v1.21.9/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= 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/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -40,10 +37,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-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/cosmos/cosmos-sdk v0.28.2-0.20190803135615-4b354a782bcd h1:YQdSHOk1eCDG+QBrkIVXIg9cZ+0W3A6PNQTfsR+tOYA= -github.com/cosmos/cosmos-sdk v0.28.2-0.20190803135615-4b354a782bcd/go.mod h1:RkWDqk5VawCuk6G+Mr7kWkE+1i5oHhxdOriaRibAvPg= -github.com/cosmos/cosmos-sdk v0.28.2-0.20190805164234-478eda1f7e3e h1:PLg7n+5Ndp9sOZ4dxxP3TsPiBz9bYikgALG9HPu+55Q= -github.com/cosmos/cosmos-sdk v0.28.2-0.20190805164234-478eda1f7e3e/go.mod h1:RkWDqk5VawCuk6G+Mr7kWkE+1i5oHhxdOriaRibAvPg= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190805171329-cf1980273fac h1:e8SeYmlsfdizyFaENu1+X1IZSYQoXQhAybihWnsyOa4= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190805171329-cf1980273fac/go.mod h1:RkWDqk5VawCuk6G+Mr7kWkE+1i5oHhxdOriaRibAvPg= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -51,8 +46,6 @@ github.com/cosmos/ledger-cosmos-go v0.10.3 h1:Qhi5yTR5Pg1CaTpd00pxlGwNl4sFRdtK1J github.com/cosmos/ledger-cosmos-go v0.10.3/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= 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/tools/cmd/runsim v0.0.0-20190802160424-c5def0673f0a h1:gYJxAVZN6ZBPP2FTAN2criusPhS9UYrNCOv0nUphmzA= -github.com/cosmos/tools/cmd/runsim v0.0.0-20190802160424-c5def0673f0a/go.mod h1:J/WXP5By/qBDT9MkxIOq6HLhukR8GW+KfPnY7NAXM4s= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= 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= @@ -90,7 +83,6 @@ github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 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.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -118,8 +110,6 @@ 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/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= 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= @@ -139,8 +129,6 @@ 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/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/lusis/go-slackbot v0.0.0-20180109053408-401027ccfef5/go.mod h1:c2mYKRyMb1BPkO5St0c/ps62L4S0W2NAkaTXj9qEI+0= -github.com/lusis/slack-test v0.0.0-20190426140909-c40012f20018/go.mod h1:sFlOUpQL1YcjhFVXhg1CG8ZASEs/Mf1oVb6H75JL/zg= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -155,8 +143,6 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nlopes/slack v0.5.0 h1:NbIae8Kd0NpqaEI3iUrsuS0KbcEDhzhc939jLW5fNm0= -github.com/nlopes/slack v0.5.0/go.mod h1:jVI4BBK3lSktibKahxBF74txcK2vyvkza1z/+rRnVAM= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -239,7 +225,6 @@ 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/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.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= 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= @@ -254,7 +239,6 @@ github.com/tendermint/go-amino v0.15.0 h1:TC4e66P59W7ML9+bxio17CPKnxW3nKIRAYsknt github.com/tendermint/go-amino v0.15.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8= github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o= -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.2 h1:FvZWdksfDg/65vKKr5Lgo57keARFnmhrUEXHwyrV1QY= github.com/tendermint/tendermint v0.32.2/go.mod h1:NwMyx58S8VJ7tEpFKqRVlVWKO9N9zjTHu+Dx96VsnOE= @@ -296,8 +280,6 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn 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-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -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/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -316,8 +298,6 @@ golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb h1:fgwFCsaw9buMuxNd6+DQfAuSFqbNiQZpcgJQAgJsK6k= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa h1:KIDDMLT1O0Nr7TSxp8xM5tJcdn8tgyAONntO829og1M= golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -331,7 +311,6 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 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-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190802220118-1d1727260058/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= From 7b1465968b626b5836f27e9e7c16605263b2a23f Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Tue, 6 Aug 2019 20:23:22 -0400 Subject: [PATCH 005/685] Merge PR #90: Updates reflecting sdk v0.36.0-rc4 --- app/app.go | 18 +++++++++++------- app/sim_test.go | 10 +++++----- go.mod | 3 ++- go.sum | 4 ++-- lcd_test/helpers.go | 25 ++++++++++++++----------- lcd_test/helpers_test.go | 2 +- 6 files changed, 35 insertions(+), 27 deletions(-) diff --git a/app/app.go b/app/app.go index 69ccfe8eb0..d1cdefaa1b 100644 --- a/app/app.go +++ b/app/app.go @@ -175,12 +175,14 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b staking.NewMultiStakingHooks(app.distrKeeper.Hooks(), app.slashingKeeper.Hooks()), ) + // NOTE: Any module instantiated in the module manager that is later modified + // must be passed by reference here. app.mm = module.NewManager( genaccounts.NewAppModule(app.accountKeeper), genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx), auth.NewAppModule(app.accountKeeper), bank.NewAppModule(app.bankKeeper, app.accountKeeper), - crisis.NewAppModule(app.crisisKeeper), + crisis.NewAppModule(&app.crisisKeeper), supply.NewAppModule(app.supplyKeeper, app.accountKeeper), distr.NewAppModule(app.distrKeeper, app.supplyKeeper), gov.NewAppModule(app.govKeeper, app.supplyKeeper), @@ -194,13 +196,15 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b // CanWithdrawInvariant invariant. 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 - // initialized with tokens from genesis accounts. - app.mm.SetOrderInitGenesis(genaccounts.ModuleName, distr.ModuleName, - staking.ModuleName, auth.ModuleName, bank.ModuleName, slashing.ModuleName, - gov.ModuleName, mint.ModuleName, supply.ModuleName, crisis.ModuleName, genutil.ModuleName) + // NOTE: The genutils module must occur after staking so that pools are + // properly initialized with tokens from genesis accounts. + app.mm.SetOrderInitGenesis( + genaccounts.ModuleName, distr.ModuleName, staking.ModuleName, + auth.ModuleName, bank.ModuleName, slashing.ModuleName, gov.ModuleName, + mint.ModuleName, supply.ModuleName, crisis.ModuleName, genutil.ModuleName, + ) app.mm.RegisterInvariants(&app.crisisKeeper) app.mm.RegisterRoutes(app.Router(), app.QueryRouter()) diff --git a/app/sim_test.go b/app/sim_test.go index 73c0f03b73..a844381f68 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -377,7 +377,7 @@ func BenchmarkFullAppSimulation(b *testing.B) { db, _ = sdk.NewLevelDB("Simulation", dir) defer func() { db.Close() - os.RemoveAll(dir) + _ = os.RemoveAll(dir) }() app := NewGaiaApp(logger, db, nil, true, 0) @@ -446,7 +446,7 @@ func TestFullAppSimulation(t *testing.T) { defer func() { db.Close() - os.RemoveAll(dir) + _ = os.RemoveAll(dir) }() app := NewGaiaApp(logger, db, nil, true, 0, fauxMerkleModeOpt) @@ -504,7 +504,7 @@ func TestAppImportExport(t *testing.T) { defer func() { db.Close() - os.RemoveAll(dir) + _ = os.RemoveAll(dir) }() app := NewGaiaApp(logger, db, nil, true, 0, fauxMerkleModeOpt) @@ -565,11 +565,11 @@ func TestAppImportExport(t *testing.T) { panic(err) } - ctxB := newApp.NewContext(true, abci.Header{}) + ctxB := newApp.NewContext(true, abci.Header{Height: app.LastBlockHeight()}) newApp.mm.InitGenesis(ctxB, genesisState) fmt.Printf("Comparing stores...\n") - ctxA := app.NewContext(true, abci.Header{}) + ctxA := app.NewContext(true, abci.Header{Height: app.LastBlockHeight()}) type StoreKeysPrefixes struct { A sdk.StoreKey diff --git a/go.mod b/go.mod index 40188c9136..81fb7ec229 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.12 require ( github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c // indirect - github.com/cosmos/cosmos-sdk v0.28.2-0.20190805171329-cf1980273fac + github.com/cosmos/cosmos-sdk v0.28.2-0.20190806205118-0dcf1583878e github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/go-kit/kit v0.9.0 // indirect github.com/golang/mock v1.3.1 // indirect @@ -32,5 +32,6 @@ require ( golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect golang.org/x/text v0.3.2 // indirect + google.golang.org/appengine v1.4.0 // indirect google.golang.org/genproto v0.0.0-20190701230453-710ae3a149df // indirect ) diff --git a/go.sum b/go.sum index 4001c7ca85..7f7386d102 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,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-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/cosmos/cosmos-sdk v0.28.2-0.20190805171329-cf1980273fac h1:e8SeYmlsfdizyFaENu1+X1IZSYQoXQhAybihWnsyOa4= -github.com/cosmos/cosmos-sdk v0.28.2-0.20190805171329-cf1980273fac/go.mod h1:RkWDqk5VawCuk6G+Mr7kWkE+1i5oHhxdOriaRibAvPg= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190806205118-0dcf1583878e h1:Lq7i6tN5ay+1enr3BwYWmMOkmsmWuKGO+BlqYI7hsD4= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190806205118-0dcf1583878e/go.mod h1:RkWDqk5VawCuk6G+Mr7kWkE+1i5oHhxdOriaRibAvPg= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= diff --git a/lcd_test/helpers.go b/lcd_test/helpers.go index 2eb0d4a5f3..40479dfd01 100644 --- a/lcd_test/helpers.go +++ b/lcd_test/helpers.go @@ -29,7 +29,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/mint" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/supply" - "github.com/pkg/errors" "github.com/spf13/viper" @@ -225,25 +224,29 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd accs = append(accs, acc) } - // supply data - supplyDataBz := genesisState[supply.ModuleName] - var supplyData supply.GenesisState - cdc.MustUnmarshalJSON(supplyDataBz, &supplyData) - - supplyData.Supply = supplyData.Supply.SetTotal(sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, totalSupply))) - supplyDataBz = cdc.MustMarshalJSON(supplyData) - genesisState[supply.ModuleName] = supplyDataBz - // distr data distrDataBz := genesisState[distr.ModuleName] var distrData distr.GenesisState cdc.MustUnmarshalJSON(distrDataBz, &distrData) - distrData.FeePool.CommunityPool = sdk.DecCoins{sdk.DecCoin{Denom: "test", Amount: sdk.NewDecFromInt(sdk.NewInt(10))}} + + commPoolAmt := sdk.NewInt(10) + distrData.FeePool.CommunityPool = sdk.DecCoins{sdk.NewDecCoin(sdk.DefaultBondDenom, commPoolAmt)} distrDataBz = cdc.MustMarshalJSON(distrData) genesisState[distr.ModuleName] = distrDataBz + + // staking and genesis accounts genesisState[staking.ModuleName] = cdc.MustMarshalJSON(stakingData) genesisState[genaccounts.ModuleName] = cdc.MustMarshalJSON(accs) + // supply data + supplyDataBz := genesisState[supply.ModuleName] + var supplyData supply.GenesisState + cdc.MustUnmarshalJSON(supplyDataBz, &supplyData) + + supplyData.Supply = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, totalSupply.Add(commPoolAmt))) + supplyDataBz = cdc.MustMarshalJSON(supplyData) + genesisState[supply.ModuleName] = supplyDataBz + // mint genesis (none set within genesisState) mintData := mint.DefaultGenesisState() inflationMin := sdk.ZeroDec() diff --git a/lcd_test/helpers_test.go b/lcd_test/helpers_test.go index 05044f297b..d9dcbdf9e1 100644 --- a/lcd_test/helpers_test.go +++ b/lcd_test/helpers_test.go @@ -809,7 +809,7 @@ func doSubmitCommunityPoolSpendProposal( Proposer: proposerAddr, Recipient: proposerAddr, Deposit: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, amount)}, - Amount: sdk.Coins{sdk.NewCoin("test", sdk.NewInt(5))}, + Amount: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(5))}, } req, err := cdc.MarshalJSON(pr) From 0e0de2b26c06fdb66a537f859ef51134516f32c9 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Thu, 8 Aug 2019 18:51:38 +0100 Subject: [PATCH 006/685] Merge PR #93: localnet-start requires build-linux --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6ad33fa599..e045fb43b8 100644 --- a/Makefile +++ b/Makefile @@ -158,7 +158,7 @@ build-docker-gaiadnode: $(MAKE) -C networks/local # Run a 4-node testnet locally -localnet-start: localnet-stop +localnet-start: build-linux localnet-stop @if ! [ -f build/node0/gaiad/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/gaiad:Z tendermint/gaiadnode testnet --v 4 -o . --starting-ip-address 192.168.10.2 ; fi docker-compose up -d From 9c82ff236633e6a3e060bf574992be139a7a2947 Mon Sep 17 00:00:00 2001 From: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Date: Fri, 9 Aug 2019 17:00:50 +0200 Subject: [PATCH 007/685] Merge PR #94: update Gaia to latest SDK master --- app/app.go | 4 ++-- app/sim_test.go | 27 ++++++++++++++++++--------- go.mod | 16 ++++++++++------ go.sum | 30 ++++++++++++++++++++++-------- lcd_test/lcd_test.go | 27 +++++++++++---------------- sims.mk | 5 +++-- 6 files changed, 66 insertions(+), 43 deletions(-) diff --git a/app/app.go b/app/app.go index d1cdefaa1b..5d4f51fba3 100644 --- a/app/app.go +++ b/app/app.go @@ -140,7 +140,7 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b mintSubspace := app.paramsKeeper.Subspace(mint.DefaultParamspace) distrSubspace := app.paramsKeeper.Subspace(distr.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) // add keepers @@ -165,7 +165,7 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b AddRoute(params.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)). AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)) app.govKeeper = gov.NewKeeper( - app.cdc, keys[gov.StoreKey], app.paramsKeeper, govSubspace, + app.cdc, keys[gov.StoreKey], govSubspace, app.supplyKeeper, &stakingKeeper, gov.DefaultCodespace, govRouter, ) diff --git a/app/sim_test.go b/app/sim_test.go index a844381f68..14f1bbd946 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -553,7 +553,7 @@ func TestAppImportExport(t *testing.T) { defer func() { newDB.Close() - os.RemoveAll(newDir) + _ = os.RemoveAll(newDir) }() newApp := NewGaiaApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt) @@ -622,7 +622,7 @@ func TestAppSimulationAfterImport(t *testing.T) { defer func() { db.Close() - os.RemoveAll(dir) + _ = os.RemoveAll(dir) }() app := NewGaiaApp(logger, db, nil, true, 0, fauxMerkleModeOpt) @@ -680,7 +680,7 @@ func TestAppSimulationAfterImport(t *testing.T) { defer func() { newDB.Close() - os.RemoveAll(newDir) + _ = os.RemoveAll(newDir) }() newApp := NewGaiaApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt) @@ -707,21 +707,30 @@ func TestAppStateDeterminism(t *testing.T) { for i := 0; i < numSeeds; i++ { seed := rand.Int63() + for j := 0; j < numTimesToRunPerSeed; j++ { logger := log.NewNopLogger() db := dbm.NewMemDB() app := NewGaiaApp(logger, db, nil, true, 0) + fmt.Printf( + "Running non-determinism simulation; seed: %d/%d (%d), attempt: %d/%d\n", + i+1, numSeeds, seed, j+1, numTimesToRunPerSeed, + ) + // Run randomized simulation - simulation.SimulateFromSeed( - t, os.Stdout, app.BaseApp, appStateFn, seed, - testAndRunTxs(app), []sdk.Invariant{}, - 1, 50, 100, 0, "", - false, true, false, false, false, app.ModuleAccountAddrs(), + _, _, err := simulation.SimulateFromSeed( + t, os.Stdout, app.BaseApp, appStateFn, seed, testAndRunTxs(app), + []sdk.Invariant{}, 1, numBlocks, exportParamsHeight, + blockSize, "", false, commit, lean, + false, false, app.ModuleAccountAddrs(), ) + require.NoError(t, err) + appHash := app.LastCommitID().Hash appHashList[j] = appHash } + for k := 1; k < numTimesToRunPerSeed; k++ { require.Equal(t, appHashList[0], appHashList[k], "appHash list: %v", appHashList) } @@ -735,7 +744,7 @@ func BenchmarkInvariants(b *testing.B) { defer func() { db.Close() - os.RemoveAll(dir) + _ = os.RemoveAll(dir) }() app := NewGaiaApp(logger, db, nil, true, 0) diff --git a/go.mod b/go.mod index 81fb7ec229..087eb066cf 100644 --- a/go.mod +++ b/go.mod @@ -3,23 +3,26 @@ module github.com/cosmos/gaia go 1.12 require ( - github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c // indirect - github.com/cosmos/cosmos-sdk v0.28.2-0.20190806205118-0dcf1583878e + github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect + github.com/cosmos/cosmos-sdk v0.28.2-0.20190808195118-e4c8bd72b72b github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/go-kit/kit v0.9.0 // indirect github.com/golang/mock v1.3.1 // indirect github.com/gorilla/mux v1.7.3 // indirect + github.com/libp2p/go-buffer-pool v0.0.2 // indirect github.com/magiconair/properties v1.8.1 // indirect github.com/mattn/go-isatty v0.0.8 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect github.com/onsi/ginkgo v1.8.0 // indirect github.com/onsi/gomega v1.5.0 // indirect github.com/otiai10/copy v1.0.1 github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776 // indirect github.com/pelletier/go-toml v1.4.0 // indirect github.com/pkg/errors v0.8.1 - github.com/prometheus/common v0.6.0 // indirect - github.com/prometheus/procfs v0.0.3 // indirect - github.com/rcrowley/go-metrics v0.0.0-20190704165056-9c2d0518ed81 // indirect + github.com/prometheus/client_golang v1.1.0 // indirect + github.com/rcrowley/go-metrics v0.0.0-20190706150252-9beb055b7962 // indirect + github.com/rs/cors v1.7.0 // indirect github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa github.com/spf13/afero v1.2.2 // indirect github.com/spf13/cobra v0.0.5 @@ -33,5 +36,6 @@ require ( golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect golang.org/x/text v0.3.2 // indirect google.golang.org/appengine v1.4.0 // indirect - google.golang.org/genproto v0.0.0-20190701230453-710ae3a149df // indirect + google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64 // indirect + google.golang.org/grpc v1.22.1 // indirect ) diff --git a/go.sum b/go.sum index 7f7386d102..37fcfd4909 100644 --- a/go.sum +++ b/go.sum @@ -15,11 +15,13 @@ github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d/go.mod h1:icNx/6Q 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/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c h1:aEbSeNALREWXk0G7UdNhR3ayBV7tZ4M2PNmnrCAph6Q= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= +github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a h1:We35J+0yvVFrEXbtViYUW8H/wNOhqjIF3PsrW4yYmGw= +github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng= @@ -37,8 +39,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-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/cosmos/cosmos-sdk v0.28.2-0.20190806205118-0dcf1583878e h1:Lq7i6tN5ay+1enr3BwYWmMOkmsmWuKGO+BlqYI7hsD4= -github.com/cosmos/cosmos-sdk v0.28.2-0.20190806205118-0dcf1583878e/go.mod h1:RkWDqk5VawCuk6G+Mr7kWkE+1i5oHhxdOriaRibAvPg= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190808195118-e4c8bd72b72b h1:3EwQDRIcdry+J2Ey3cRaFTanHC8x0e9IVh69xO3oCmA= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190808195118-e4c8bd72b72b/go.mod h1:RkWDqk5VawCuk6G+Mr7kWkE+1i5oHhxdOriaRibAvPg= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -115,6 +117,7 @@ github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+ 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/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -129,6 +132,8 @@ 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/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/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -140,7 +145,9 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 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/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -172,6 +179,8 @@ github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4 github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.1.0 h1:BQ53HtBmfOitExawJ6LokA4x8ov/z0SYYb0+HxJfRI8= +github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -194,11 +203,13 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs= github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rcrowley/go-metrics v0.0.0-20190704165056-9c2d0518ed81 h1:zQTtDd7fQiF9e80lbl+ShnD9/5NSq5r1EhcS8955ECg= -github.com/rcrowley/go-metrics v0.0.0-20190704165056-9c2d0518ed81/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20190706150252-9beb055b7962 h1:eUm8ma4+yPknhXtkYlWh3tMkE6gBjXZToDned9s2gbQ= +github.com/rcrowley/go-metrics v0.0.0-20190706150252-9beb055b7962/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= 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.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= 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/snikch/goodman v0.0.0-20171125024755-10e37e294daa h1:YJfZp12Z3AFhSBeXOlv4BO55RMwPn2NoQeDsrdWnBtY= @@ -298,6 +309,7 @@ golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa h1:KIDDMLT1O0Nr7TSxp8xM5tJcdn8tgyAONntO829og1M= golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -316,13 +328,15 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 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-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190701230453-710ae3a149df h1:k3DT34vxk64+4bD5x+fRy6U0SXxZehzUHRSYUJcKfII= -google.golang.org/genproto v0.0.0-20190701230453-710ae3a149df/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64 h1:iKtrH9Y8mcbADOP0YFaEMth7OfuHY9xHOwNj4znpM1A= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/grpc v1.13.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 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= +google.golang.org/grpc v1.22.1 h1:/7cs52RnTJmD43s3uxzlq2U7nqVTd/37viQwMrMNlOM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 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= diff --git a/lcd_test/lcd_test.go b/lcd_test/lcd_test.go index bd76de050a..e4b2f3d0a3 100644 --- a/lcd_test/lcd_test.go +++ b/lcd_test/lcd_test.go @@ -568,10 +568,9 @@ func TestSubmitProposal(t *testing.T) { // check if tx was committed require.Equal(t, uint32(0), resultTx.Code) - var proposalID uint64 bz, err := hex.DecodeString(resultTx.Data) require.NoError(t, err) - cdc.MustUnmarshalBinaryLengthPrefixed(bz, &proposalID) + proposalID := gov.GetProposalIDFromBytes(bz) // verify balance acc = getAccount(t, port, addr) @@ -607,10 +606,9 @@ func TestSubmitCommunityPoolSpendProposal(t *testing.T) { // check if tx was committed require.Equal(t, uint32(0), resultTx.Code) - var proposalID uint64 bz, err := hex.DecodeString(resultTx.Data) require.NoError(t, err) - cdc.MustUnmarshalBinaryLengthPrefixed(bz, &proposalID) + proposalID := gov.GetProposalIDFromBytes(bz) // verify balance acc = getAccount(t, port, addr) @@ -646,10 +644,9 @@ func TestSubmitParamChangeProposal(t *testing.T) { // check if tx was committed require.Equal(t, uint32(0), resultTx.Code) - var proposalID uint64 bz, err := hex.DecodeString(resultTx.Data) require.NoError(t, err) - cdc.MustUnmarshalBinaryLengthPrefixed(bz, &proposalID) + proposalID := gov.GetProposalIDFromBytes(bz) // verify balance acc = getAccount(t, port, addr) @@ -685,10 +682,9 @@ func TestDeposit(t *testing.T) { // check if tx was committed require.Equal(t, uint32(0), resultTx.Code) - var proposalID uint64 bz, err := hex.DecodeString(resultTx.Data) require.NoError(t, err) - cdc.MustUnmarshalBinaryLengthPrefixed(bz, &proposalID) + proposalID := gov.GetProposalIDFromBytes(bz) // verify balance acc = getAccount(t, port, addr) @@ -746,10 +742,9 @@ func TestVote(t *testing.T) { // check if tx was committed require.Equal(t, uint32(0), resultTx.Code) - var proposalID uint64 bz, err := hex.DecodeString(resultTx.Data) require.NoError(t, err) - cdc.MustUnmarshalBinaryLengthPrefixed(bz, &proposalID) + proposalID := gov.GetProposalIDFromBytes(bz) // verify balance acc = getAccount(t, port, addr) @@ -853,25 +848,25 @@ func TestProposalsQuery(t *testing.T) { // Addr1 proposes (and deposits) proposals #1 and #2 resultTx := doSubmitProposal(t, port, seeds[0], names[0], passwords[0], addrs[0], halfMinDeposit, fees) - var proposalID1 uint64 bz, err := hex.DecodeString(resultTx.Data) require.NoError(t, err) - cdc.MustUnmarshalBinaryLengthPrefixed(bz, &proposalID1) + + proposalID1 := gov.GetProposalIDFromBytes(bz) tests.WaitForHeight(resultTx.Height+1, port) resultTx = doSubmitProposal(t, port, seeds[0], names[0], passwords[0], addrs[0], halfMinDeposit, fees) - var proposalID2 uint64 bz, err = hex.DecodeString(resultTx.Data) require.NoError(t, err) - cdc.MustUnmarshalBinaryLengthPrefixed(bz, &proposalID2) + + proposalID2 := gov.GetProposalIDFromBytes(bz) tests.WaitForHeight(resultTx.Height+1, port) // Addr2 proposes (and deposits) proposals #3 resultTx = doSubmitProposal(t, port, seeds[1], names[1], passwords[1], addrs[1], halfMinDeposit, fees) - var proposalID3 uint64 bz, err = hex.DecodeString(resultTx.Data) require.NoError(t, err) - cdc.MustUnmarshalBinaryLengthPrefixed(bz, &proposalID3) + + proposalID3 := gov.GetProposalIDFromBytes(bz) tests.WaitForHeight(resultTx.Height+1, port) // Addr2 deposits on proposals #2 & #3 diff --git a/sims.mk b/sims.mk index 5ec88251f5..29d2e9b5aa 100644 --- a/sims.mk +++ b/sims.mk @@ -6,8 +6,9 @@ SIMAPP = github.com/cosmos/gaia/app sim-gaia-nondeterminism: - @echo "Running nondeterminism test..." - @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true -v -timeout 10m + @echo "Running non-determinism test..." + @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \ + -NumBlocks=100 -BlockSize=200 -Commit=true -v -timeout 24h sim-gaia-custom-genesis-fast: @echo "Running custom genesis simulation..." From c1a20dca243fd8d69159b07d6ed2253b61ebe9c8 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Tue, 13 Aug 2019 10:21:03 -0400 Subject: [PATCH 008/685] Merge PR #98: Cleanup installation docs --- docs/installation.md | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/docs/installation.md b/docs/installation.md index 3142069757..e550774cec 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -1,10 +1,14 @@ -## Install Gaia +# Install Gaia -This guide will explain how to install the `gaiad` and `gaiacli` entrypoints onto your system. With these installed on a server, you can participate in the mainnet as either a [Full Node](./join-mainnet.md) or a [Validator](./validators/validator-setup.md). +This guide will explain how to install the `gaiad` and `gaiacli` entrypoints +onto your system. With these installed on a server, you can participate in the +mainnet as either a [Full Node](./join-mainnet.md) or a +[Validator](./validators/validator-setup.md). -### Install Go +## Install Go -Install `go` by following the [official docs](https://golang.org/doc/install). Remember to set your `$GOPATH` and `$PATH` environment variables, for example: +Install `go` by following the [official docs](https://golang.org/doc/install). +Remember to set your `$GOPATH` and `$PATH` environment variables, for example: ```bash mkdir -p $HOME/go/bin @@ -17,9 +21,10 @@ source ~/.bash_profile **Go 1.12+** is required for the Cosmos SDK. ::: -### Install the binaries +## Install the binaries -Next, let's install the latest version of Gaia. Make sure you `git checkout` the correct [released version](https://github.com/cosmos/gaia/releases). +Next, let's install the latest version of Gaia. Make sure you `git checkout` the +correct [released version](https://github.com/cosmos/gaia/releases). ```bash git clone -b https://github.com/cosmos/gaia @@ -37,14 +42,17 @@ $ gaiacli version --long `gaiacli` for instance should output something similar to: -``` -cosmos-sdk: 0.33.0 -git commit: 7b4104aced52aa5b59a96c28b5ebeea7877fc4f0 -build tags: netgo ledger -go version go1.12 linux/amd64 +```shell +name: gaia +server_name: gaiad +client_name: gaiacli +version: 1.0.0 +commit: 89e6316a27343304d332aadfe2869847bf52331c +build_tags: netgo,ledger +go: go version go1.12.5 darwin/amd64 ``` -##### Build Tags +### Build Tags Build tags indicate special features that have been enabled in the binary. @@ -57,7 +65,7 @@ Build tags indicate special features that have been enabled in the binary. **Do not use snap at this time to install the binaries for production until we have a reproducible binary system.** -### Developer Workflow +## Developer Workflow To test any changes made in the SDK or Tendermint, a `replace` clause needs to be added to `go.mod` providing the correct import path. @@ -66,6 +74,6 @@ To test any changes made in the SDK or Tendermint, a `replace` clause needs to b - Run `make clean install` or `make clean build` - Test changes -### Next +## Next Now you can [join the mainnet](./join-mainnet.md), [the public testnet](./join-testnet.md) or [create you own testnet](./deploy-testnet.md) From 5f24b24976e3ea782226c15ab39fdb276cfd4a30 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Tue, 13 Aug 2019 14:09:56 -0400 Subject: [PATCH 009/685] Merge PR #99: Update SDK version to latest master --- cli_test/cli_test.go | 33 ++++++++++++++++++++------------- cmd/gaiad/testnet.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- lcd_test/helpers.go | 5 ++--- lcd_test/lcd_test.go | 7 +++---- 6 files changed, 29 insertions(+), 24 deletions(-) diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index 7269e5a706..971f588146 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -105,8 +105,9 @@ func TestGaiaCLIMinimumFees(t *testing.T) { barAddr := f.KeyAddress(keyBar) // Send a transaction that will get rejected - success, _, _ := f.TxSend(keyFoo, barAddr, sdk.NewInt64Coin(fee2Denom, 10), "-y") - require.False(f.T, success) + success, stdOut, _ := f.TxSend(keyFoo, barAddr, sdk.NewInt64Coin(fee2Denom, 10), "-y") + require.Contains(t, stdOut, "insufficient fees") + require.True(f.T, success) tests.WaitForNextNBlocksTM(1, f.Port) // Ensure tx w/ correct fees pass @@ -118,7 +119,8 @@ func TestGaiaCLIMinimumFees(t *testing.T) { // Ensure tx w/ improper fees fails txFees = fmt.Sprintf("--fees=%s", sdk.NewInt64Coin(feeDenom, 1)) success, _, _ = 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 f.Cleanup() @@ -137,10 +139,11 @@ func TestGaiaCLIGasPrices(t *testing.T) { // insufficient gas prices (tx fails) badGasPrice, _ := sdk.NewDecFromStr("0.000003") - success, _, _ := f.TxSend( + success, stdOut, _ := f.TxSend( keyFoo, barAddr, sdk.NewInt64Coin(fooDenom, 50), 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 tests.WaitForNextNBlocksTM(1, f.Port) @@ -188,10 +191,11 @@ func TestGaiaCLIFeesDeduction(t *testing.T) { // insufficient funds (coins + fees) tx fails largeCoins := sdk.TokensFromConsensusPower(10000000) - success, _, _ = f.TxSend( + success, stdOut, _ := f.TxSend( keyFoo, barAddr, sdk.NewCoin(fooDenom, largeCoins), 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 tests.WaitForNextNBlocksTM(1, f.Port) @@ -295,8 +299,9 @@ func TestGaiaCLIGasAuto(t *testing.T) { // Test failure with auto gas disabled and very little gas set by hand sendTokens := sdk.TokensFromConsensusPower(10) - success, _, _ := f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=10", "-y") - require.False(t, success) + success, stdOut, _ := f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=10", "-y") + require.Contains(t, stdOut, "out of gas in location") + require.True(t, success) // Check state didn't change fooAcc = f.QueryAccount(fooAddr) @@ -311,8 +316,9 @@ func TestGaiaCLIGasAuto(t *testing.T) { require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) // Test failure with 0 gas - success, _, _ = f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=0", "-y") - require.False(t, success) + success, stdOut, _ = f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=0", "-y") + require.Contains(t, stdOut, "out of gas in location") + require.True(t, success) // Check state didn't change fooAcc = f.QueryAccount(fooAddr) @@ -980,8 +986,9 @@ func TestGaiaCLIMultisignInsufficientCosigners(t *testing.T) { require.False(t, success) // Broadcast the transaction - success, _, _ = f.TxBroadcast(signedTxFile.Name()) - require.False(t, success) + success, stdOut, _ := f.TxBroadcast(signedTxFile.Name()) + require.Contains(t, stdOut, "signature verification failed") + require.True(t, success) // Cleanup testing directories f.Cleanup() diff --git a/cmd/gaiad/testnet.go b/cmd/gaiad/testnet.go index ca55c66135..c7cef604aa 100644 --- a/cmd/gaiad/testnet.go +++ b/cmd/gaiad/testnet.go @@ -206,7 +206,7 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, sdk.ValAddress(addr), valPubKeys[i], sdk.NewCoin(sdk.DefaultBondDenom, valTokens), - staking.NewDescription(nodeDirName, "", "", ""), + staking.NewDescription(nodeDirName, "", "", "", ""), staking.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), sdk.OneInt(), ) diff --git a/go.mod b/go.mod index 087eb066cf..8e7df88471 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.12 require ( github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect - github.com/cosmos/cosmos-sdk v0.28.2-0.20190808195118-e4c8bd72b72b + github.com/cosmos/cosmos-sdk v0.28.2-0.20190813160135-f90d969ded97 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/go-kit/kit v0.9.0 // indirect github.com/golang/mock v1.3.1 // indirect diff --git a/go.sum b/go.sum index 37fcfd4909..e017755f86 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,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-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/cosmos/cosmos-sdk v0.28.2-0.20190808195118-e4c8bd72b72b h1:3EwQDRIcdry+J2Ey3cRaFTanHC8x0e9IVh69xO3oCmA= -github.com/cosmos/cosmos-sdk v0.28.2-0.20190808195118-e4c8bd72b72b/go.mod h1:RkWDqk5VawCuk6G+Mr7kWkE+1i5oHhxdOriaRibAvPg= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190813160135-f90d969ded97 h1:v1/qbsNvfIWMAHEi1GwgBAVCo0NrrrV6uZkSdcIREyU= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190813160135-f90d969ded97/go.mod h1:RkWDqk5VawCuk6G+Mr7kWkE+1i5oHhxdOriaRibAvPg= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= diff --git a/lcd_test/helpers.go b/lcd_test/helpers.go index 40479dfd01..dd6acccd73 100644 --- a/lcd_test/helpers.go +++ b/lcd_test/helpers.go @@ -32,7 +32,6 @@ import ( "github.com/pkg/errors" "github.com/spf13/viper" - "github.com/tendermint/go-amino" tmcfg "github.com/tendermint/tendermint/config" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" @@ -172,7 +171,7 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd sdk.ValAddress(operAddr), pubKey, sdk.NewCoin(sdk.DefaultBondDenom, startTokens), - staking.NewDescription(fmt.Sprintf("validator-%d", i+1), "", "", ""), + staking.NewDescription(fmt.Sprintf("validator-%d", i+1), "", "", "", ""), staking.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), sdk.OneInt(), ) @@ -354,7 +353,7 @@ func registerRoutes(rs *lcd.RestServer) { gapp.ModuleBasics.RegisterRESTRoutes(rs.CliCtx, rs.Mux) } -var cdc = amino.NewCodec() +var cdc = codec.New() func init() { ctypes.RegisterAmino(cdc) diff --git a/lcd_test/lcd_test.go b/lcd_test/lcd_test.go index e4b2f3d0a3..96cf1f7171 100644 --- a/lcd_test/lcd_test.go +++ b/lcd_test/lcd_test.go @@ -116,7 +116,7 @@ func TestCoinSend(t *testing.T) { // test failure with too little gas res, body, _ = doTransferWithGas(t, port, seed, name1, memo, pw, addr, "100", 0, false, true, fees) - require.Equal(t, http.StatusInternalServerError, res.StatusCode, body) + require.Equal(t, http.StatusOK, res.StatusCode, body) require.Nil(t, err) // test failure with negative gas @@ -129,12 +129,11 @@ func TestCoinSend(t *testing.T) { // test failure with 0 gas res, body, _ = doTransferWithGas(t, port, seed, name1, memo, pw, addr, "0", 0, false, true, fees) - require.Equal(t, http.StatusInternalServerError, res.StatusCode, body) + require.Equal(t, http.StatusOK, res.StatusCode, body) // test failure with wrong adjustment res, body, _ = doTransferWithGas(t, port, seed, name1, memo, pw, addr, client.GasFlagAuto, 0.1, false, true, fees) - - require.Equal(t, http.StatusInternalServerError, res.StatusCode, body) + require.Equal(t, http.StatusOK, res.StatusCode, body) // run simulation and test success with estimated gas res, body, _ = doTransferWithGas( From f6edd14385db162222137eca0700c8d780429feb Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Tue, 13 Aug 2019 14:40:30 -0400 Subject: [PATCH 010/685] Merge PR #101: v1.0.0 Changelog Updates --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .../breaking/gaiacli/3715-query-distr-rew | 2 - .../breaking/gaiacli/40-rest-server-s---c | 1 - .../breaking/gaiacli/4027-gaiad-and-gaiac | 1 - .../breaking/gaiacli/4142-Turn-gaiacli-tx | 2 - .../4228-merge-gaiakeyutil-into-gaiacli | 2 - .pending/breaking/gaiad/3985-ValidatorPowerR | 1 - .pending/breaking/gaiad/4027-gaiad-and-gaiac | 2 - .pending/breaking/gaiad/4159-use-module-patt | 1 - .pending/breaking/gaiad/4272-Merge-gaiarepla | 2 - .pending/breaking/rest/3715-Update-distribu | 3 - .pending/breaking/rest/3942-Support-query-t | 1 - .pending/breaking/rest/4049-update-tag | 1 - .pending/breaking/rest/The-auth-accounts-ad | 2 - .../bugfixes/gaiacli/3945-There-s-no-chec | 1 - .../bugfixes/gaiacli/4190-Fix-redelegatio | 1 - .../bugfixes/gaiacli/4219-Empty-mnemonic- | 1 - .../gaiacli/4345-Improved-NanoX-detection | 1 - .pending/bugfixes/gaiad/4113-Fix-incorrect-G | 1 - .pending/features/gaiad/Add-migrate-command- | 2 - .pending/features/gaiad/Update-Gaia-for-comm | 1 - .../3426-remove-redundant-account-check | 1 - .../gaiacli/4227-Support-for-Ledger-App-1.5 | 1 - .../improvements/gaiad/4042-Add-description | 1 - .../improvements/gaiad/4062-Remove-cmd-gaia | 1 - .../improvements/gaiad/4064-Remove-dep-and- | 1 - .../improvements/gaiad/4080-add-missing-inv | 1 - .../improvements/gaiad/4343-Upgrade-toolcha | 1 - ...07-Return-200-status-code-on-empty-results | 1 - .../improvements/rest/4123-Fix-typo-url-er | 1 - .../improvements/rest/4129-Translate-doc-c | 1 - .../improvements/rest/4141-Fix-txs-encode- | 1 - CHANGELOG.md | 85 +++++++++++++++++++ CONTRIBUTING.md | 48 ++++++----- contrib/devtools/Makefile | 6 +- 35 files changed, 115 insertions(+), 66 deletions(-) delete mode 100644 .pending/breaking/gaiacli/3715-query-distr-rew delete mode 100644 .pending/breaking/gaiacli/40-rest-server-s---c delete mode 100644 .pending/breaking/gaiacli/4027-gaiad-and-gaiac delete mode 100644 .pending/breaking/gaiacli/4142-Turn-gaiacli-tx delete mode 100644 .pending/breaking/gaiacli/4228-merge-gaiakeyutil-into-gaiacli delete mode 100644 .pending/breaking/gaiad/3985-ValidatorPowerR delete mode 100644 .pending/breaking/gaiad/4027-gaiad-and-gaiac delete mode 100644 .pending/breaking/gaiad/4159-use-module-patt delete mode 100644 .pending/breaking/gaiad/4272-Merge-gaiarepla delete mode 100644 .pending/breaking/rest/3715-Update-distribu delete mode 100644 .pending/breaking/rest/3942-Support-query-t delete mode 100644 .pending/breaking/rest/4049-update-tag delete mode 100644 .pending/breaking/rest/The-auth-accounts-ad delete mode 100644 .pending/bugfixes/gaiacli/3945-There-s-no-chec delete mode 100644 .pending/bugfixes/gaiacli/4190-Fix-redelegatio delete mode 100644 .pending/bugfixes/gaiacli/4219-Empty-mnemonic- delete mode 100644 .pending/bugfixes/gaiacli/4345-Improved-NanoX-detection delete mode 100644 .pending/bugfixes/gaiad/4113-Fix-incorrect-G delete mode 100644 .pending/features/gaiad/Add-migrate-command- delete mode 100644 .pending/features/gaiad/Update-Gaia-for-comm delete mode 100644 .pending/improvements/gaiacli/3426-remove-redundant-account-check delete mode 100644 .pending/improvements/gaiacli/4227-Support-for-Ledger-App-1.5 delete mode 100644 .pending/improvements/gaiad/4042-Add-description delete mode 100644 .pending/improvements/gaiad/4062-Remove-cmd-gaia delete mode 100644 .pending/improvements/gaiad/4064-Remove-dep-and- delete mode 100644 .pending/improvements/gaiad/4080-add-missing-inv delete mode 100644 .pending/improvements/gaiad/4343-Upgrade-toolcha delete mode 100644 .pending/improvements/rest/2007-Return-200-status-code-on-empty-results delete mode 100644 .pending/improvements/rest/4123-Fix-typo-url-er delete mode 100644 .pending/improvements/rest/4129-Translate-doc-c delete mode 100644 .pending/improvements/rest/4141-Fix-txs-encode- create mode 100644 CHANGELOG.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 162c727419..24eb3aae1f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -9,7 +9,7 @@ v If a checkbox is n/a - please still include it but + a little note why - [ ] Linked to github-issue with discussion and accepted design OR link to spec that describes this work. - [ ] Wrote tests - [ ] Updated relevant documentation (`docs/`) -- [ ] Added a relevant changelog entry: `clog add [section] [stanza] [message]` +- [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md` - [ ] Reviewed `Files changed` in the github PR explorer ______ diff --git a/.pending/breaking/gaiacli/3715-query-distr-rew b/.pending/breaking/gaiacli/3715-query-distr-rew deleted file mode 100644 index 5303400b68..0000000000 --- a/.pending/breaking/gaiacli/3715-query-distr-rew +++ /dev/null @@ -1,2 +0,0 @@ -#3715 query distr rewards returns per-validator -rewards along with rewards total amount. diff --git a/.pending/breaking/gaiacli/40-rest-server-s---c b/.pending/breaking/gaiacli/40-rest-server-s---c deleted file mode 100644 index 8ea8de243a..0000000000 --- a/.pending/breaking/gaiacli/40-rest-server-s---c +++ /dev/null @@ -1 +0,0 @@ -#40 rest-server's --cors option is now gone. diff --git a/.pending/breaking/gaiacli/4027-gaiad-and-gaiac b/.pending/breaking/gaiacli/4027-gaiad-and-gaiac deleted file mode 100644 index cd973541a7..0000000000 --- a/.pending/breaking/gaiacli/4027-gaiad-and-gaiac +++ /dev/null @@ -1 +0,0 @@ -#4027 gaiacli version command dooes not return the checksum of the go.sum file anymore. diff --git a/.pending/breaking/gaiacli/4142-Turn-gaiacli-tx b/.pending/breaking/gaiacli/4142-Turn-gaiacli-tx deleted file mode 100644 index ed4c73b5bd..0000000000 --- a/.pending/breaking/gaiacli/4142-Turn-gaiacli-tx +++ /dev/null @@ -1,2 +0,0 @@ -#4142 Turn gaiacli tx send's --from into a required argument. -New shorter syntax: `gaiacli tx send FROM TO AMOUNT` diff --git a/.pending/breaking/gaiacli/4228-merge-gaiakeyutil-into-gaiacli b/.pending/breaking/gaiacli/4228-merge-gaiakeyutil-into-gaiacli deleted file mode 100644 index e986900a8e..0000000000 --- a/.pending/breaking/gaiacli/4228-merge-gaiakeyutil-into-gaiacli +++ /dev/null @@ -1,2 +0,0 @@ -#4228 Merge gaiakeyutil functionality into gaiacli keys. -Drop `gaiakeyutil` in favor of new `gaiacli keys parse` command. Syntax and semantic are preserved. diff --git a/.pending/breaking/gaiad/3985-ValidatorPowerR b/.pending/breaking/gaiad/3985-ValidatorPowerR deleted file mode 100644 index 99cc8f5708..0000000000 --- a/.pending/breaking/gaiad/3985-ValidatorPowerR +++ /dev/null @@ -1 +0,0 @@ -#3985 ValidatorPowerRank uses potential consensus power \ No newline at end of file diff --git a/.pending/breaking/gaiad/4027-gaiad-and-gaiac b/.pending/breaking/gaiad/4027-gaiad-and-gaiac deleted file mode 100644 index e31db9becd..0000000000 --- a/.pending/breaking/gaiad/4027-gaiad-and-gaiac +++ /dev/null @@ -1,2 +0,0 @@ -#4027 gaiad version command does not return the checksum of the go.sum file shipped along with the source release tarball. -Go modules feature guarantees dependencies reproducibility and as long as binaries are built via the Makefile shipped with the sources, no dependendencies can break such guarantee. diff --git a/.pending/breaking/gaiad/4159-use-module-patt b/.pending/breaking/gaiad/4159-use-module-patt deleted file mode 100644 index 1a3d4398da..0000000000 --- a/.pending/breaking/gaiad/4159-use-module-patt +++ /dev/null @@ -1 +0,0 @@ -#4159 use module pattern and module manager for initialization \ No newline at end of file diff --git a/.pending/breaking/gaiad/4272-Merge-gaiarepla b/.pending/breaking/gaiad/4272-Merge-gaiarepla deleted file mode 100644 index 5aecf7bc16..0000000000 --- a/.pending/breaking/gaiad/4272-Merge-gaiarepla +++ /dev/null @@ -1,2 +0,0 @@ -#4272 Merge gaiareplay functionality into gaiad replay. -Drop `gaiareplay` in favor of new `gaiad replay` command. diff --git a/.pending/breaking/rest/3715-Update-distribu b/.pending/breaking/rest/3715-Update-distribu deleted file mode 100644 index 1c562efa45..0000000000 --- a/.pending/breaking/rest/3715-Update-distribu +++ /dev/null @@ -1,3 +0,0 @@ -#3715 Update /distribution/delegators/{delegatorAddr}/rewards GET endpoint -as per new specs. For a given delegation, the endpoint now returns the -comprehensive list of validator-reward tuples along with the grand total. diff --git a/.pending/breaking/rest/3942-Support-query-t b/.pending/breaking/rest/3942-Support-query-t deleted file mode 100644 index a5ab311473..0000000000 --- a/.pending/breaking/rest/3942-Support-query-t +++ /dev/null @@ -1 +0,0 @@ -#3942 Update pagination data in txs query. diff --git a/.pending/breaking/rest/4049-update-tag b/.pending/breaking/rest/4049-update-tag deleted file mode 100644 index 6a200b715b..0000000000 --- a/.pending/breaking/rest/4049-update-tag +++ /dev/null @@ -1 +0,0 @@ -#4049 update tag MsgWithdrawValidatorCommission to match type \ No newline at end of file diff --git a/.pending/breaking/rest/The-auth-accounts-ad b/.pending/breaking/rest/The-auth-accounts-ad deleted file mode 100644 index 32b88a52fc..0000000000 --- a/.pending/breaking/rest/The-auth-accounts-ad +++ /dev/null @@ -1,2 +0,0 @@ -The `/auth/accounts/{address}` now returns a `height` in the response. The -account is now nested under `account`. diff --git a/.pending/bugfixes/gaiacli/3945-There-s-no-chec b/.pending/bugfixes/gaiacli/3945-There-s-no-chec deleted file mode 100644 index e8ab060541..0000000000 --- a/.pending/bugfixes/gaiacli/3945-There-s-no-chec +++ /dev/null @@ -1 +0,0 @@ -#3945 There's no check for chain-id in TxBuilder.SignStdTx \ No newline at end of file diff --git a/.pending/bugfixes/gaiacli/4190-Fix-redelegatio b/.pending/bugfixes/gaiacli/4190-Fix-redelegatio deleted file mode 100644 index c9106a0382..0000000000 --- a/.pending/bugfixes/gaiacli/4190-Fix-redelegatio +++ /dev/null @@ -1 +0,0 @@ -#4190 Fix redelegations-from by using the correct params and query endpoint. diff --git a/.pending/bugfixes/gaiacli/4219-Empty-mnemonic- b/.pending/bugfixes/gaiacli/4219-Empty-mnemonic- deleted file mode 100644 index c0509645a3..0000000000 --- a/.pending/bugfixes/gaiacli/4219-Empty-mnemonic- +++ /dev/null @@ -1 +0,0 @@ -#4219 Return an error when an empty mnemonic is provided during key recovery. diff --git a/.pending/bugfixes/gaiacli/4345-Improved-NanoX-detection b/.pending/bugfixes/gaiacli/4345-Improved-NanoX-detection deleted file mode 100644 index 98c5fa5fb9..0000000000 --- a/.pending/bugfixes/gaiacli/4345-Improved-NanoX-detection +++ /dev/null @@ -1 +0,0 @@ -#4345 Improved Ledger Nano X detection diff --git a/.pending/bugfixes/gaiad/4113-Fix-incorrect-G b/.pending/bugfixes/gaiad/4113-Fix-incorrect-G deleted file mode 100644 index 2a5d1680b7..0000000000 --- a/.pending/bugfixes/gaiad/4113-Fix-incorrect-G +++ /dev/null @@ -1 +0,0 @@ -#4113 Fix incorrect `$GOBIN` in `Install Go` \ No newline at end of file diff --git a/.pending/features/gaiad/Add-migrate-command- b/.pending/features/gaiad/Add-migrate-command- deleted file mode 100644 index 4a2bc192cb..0000000000 --- a/.pending/features/gaiad/Add-migrate-command- +++ /dev/null @@ -1,2 +0,0 @@ -Add `migrate` command to `gaiad` to provide the ability to migrate exported -genesis state from one version to another. diff --git a/.pending/features/gaiad/Update-Gaia-for-comm b/.pending/features/gaiad/Update-Gaia-for-comm deleted file mode 100644 index 95e1ec14d6..0000000000 --- a/.pending/features/gaiad/Update-Gaia-for-comm +++ /dev/null @@ -1 +0,0 @@ -Update Gaia for community pool spend proposals per Cosmos Hub governance proposal #7 "Activate the Community Pool" \ No newline at end of file diff --git a/.pending/improvements/gaiacli/3426-remove-redundant-account-check b/.pending/improvements/gaiacli/3426-remove-redundant-account-check deleted file mode 100644 index adf96e7675..0000000000 --- a/.pending/improvements/gaiacli/3426-remove-redundant-account-check +++ /dev/null @@ -1 +0,0 @@ -#4068 Remove redundant account check on `gaiacli` diff --git a/.pending/improvements/gaiacli/4227-Support-for-Ledger-App-1.5 b/.pending/improvements/gaiacli/4227-Support-for-Ledger-App-1.5 deleted file mode 100644 index 97bc1e81b1..0000000000 --- a/.pending/improvements/gaiacli/4227-Support-for-Ledger-App-1.5 +++ /dev/null @@ -1 +0,0 @@ -#4227 Support for Ledger App v1.5 diff --git a/.pending/improvements/gaiad/4042-Add-description b/.pending/improvements/gaiad/4042-Add-description deleted file mode 100644 index 03ed9cc618..0000000000 --- a/.pending/improvements/gaiad/4042-Add-description +++ /dev/null @@ -1 +0,0 @@ -#4042 Update docs and scripts to include the correct `GO111MODULE=on` environment variable. diff --git a/.pending/improvements/gaiad/4062-Remove-cmd-gaia b/.pending/improvements/gaiad/4062-Remove-cmd-gaia deleted file mode 100644 index b0d5e7c9ec..0000000000 --- a/.pending/improvements/gaiad/4062-Remove-cmd-gaia +++ /dev/null @@ -1 +0,0 @@ -#4066 Fix 'ExportGenesisFile() incorrectly overwrites genesis' diff --git a/.pending/improvements/gaiad/4064-Remove-dep-and- b/.pending/improvements/gaiad/4064-Remove-dep-and- deleted file mode 100644 index 2a219ea2d1..0000000000 --- a/.pending/improvements/gaiad/4064-Remove-dep-and- +++ /dev/null @@ -1 +0,0 @@ -#4064 Remove `dep` and `vendor` from `doc` and `version`. diff --git a/.pending/improvements/gaiad/4080-add-missing-inv b/.pending/improvements/gaiad/4080-add-missing-inv deleted file mode 100644 index 48c8172da0..0000000000 --- a/.pending/improvements/gaiad/4080-add-missing-inv +++ /dev/null @@ -1 +0,0 @@ -#4080 add missing invariants during simulations \ No newline at end of file diff --git a/.pending/improvements/gaiad/4343-Upgrade-toolcha b/.pending/improvements/gaiad/4343-Upgrade-toolcha deleted file mode 100644 index 484d522c0d..0000000000 --- a/.pending/improvements/gaiad/4343-Upgrade-toolcha +++ /dev/null @@ -1 +0,0 @@ -#4343 Upgrade toolchain to Go 1.12.5. diff --git a/.pending/improvements/rest/2007-Return-200-status-code-on-empty-results b/.pending/improvements/rest/2007-Return-200-status-code-on-empty-results deleted file mode 100644 index af20022008..0000000000 --- a/.pending/improvements/rest/2007-Return-200-status-code-on-empty-results +++ /dev/null @@ -1 +0,0 @@ -#2007 Return 200 status code on empty results diff --git a/.pending/improvements/rest/4123-Fix-typo-url-er b/.pending/improvements/rest/4123-Fix-typo-url-er deleted file mode 100644 index 8f25a8f05e..0000000000 --- a/.pending/improvements/rest/4123-Fix-typo-url-er +++ /dev/null @@ -1 +0,0 @@ -#4123 Fix typo, url error and outdated command description of doc clients. \ No newline at end of file diff --git a/.pending/improvements/rest/4129-Translate-doc-c b/.pending/improvements/rest/4129-Translate-doc-c deleted file mode 100644 index ab2710210f..0000000000 --- a/.pending/improvements/rest/4129-Translate-doc-c +++ /dev/null @@ -1 +0,0 @@ -#4129 Translate doc clients to chinese. \ No newline at end of file diff --git a/.pending/improvements/rest/4141-Fix-txs-encode- b/.pending/improvements/rest/4141-Fix-txs-encode- deleted file mode 100644 index 0c19a16242..0000000000 --- a/.pending/improvements/rest/4141-Fix-txs-encode- +++ /dev/null @@ -1 +0,0 @@ -#4141 Fix /txs/encode endpoint \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000..9106cbb26d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,85 @@ + + +# Changelog + +## [Unreleased] + +## [1.0.0] - 2019-08-13 + +### Bug Fixes + +* (gaiad) [\#4113](https://github.com/cosmos/cosmos-sdk/issues/4113) Fix incorrect `$GOBIN` in `Install Go` +* (gaiacli) [\#3945](https://github.com/cosmos/cosmos-sdk/issues/3945) There's no check for chain-id in TxBuilder.SignStdTx +* (gaiacli) [\#4190](https://github.com/cosmos/cosmos-sdk/issues/4190) Fix redelegations-from by using the correct params and query endpoint. +* (gaiacli) [\#4219](https://github.com/cosmos/cosmos-sdk/issues/4219) Return an error when an empty mnemonic is provided during key recovery. +* (gaiacli) [\#4345](https://github.com/cosmos/cosmos-sdk/issues/4345) Improved Ledger Nano X detection + +### Breaking Changes + +* (sdk) Update SDK version to v0.36.0 +* (gaiad) [\#3985](https://github.com/cosmos/cosmos-sdk/issues/3985) ValidatorPowerRank uses potential consensus power +* (gaiad) [\#4027](https://github.com/cosmos/cosmos-sdk/issues/4027) gaiad version command does not return the checksum of the go.sum file shipped along with the source release tarball. + Go modules feature guarantees dependencies reproducibility and as long as binaries are built via the Makefile shipped with the sources, no dependendencies can break such guarantee. +* (gaiad) [\#4159](https://github.com/cosmos/cosmos-sdk/issues/4159) use module pattern and module manager for initialization +* (gaiad) [\#4272](https://github.com/cosmos/cosmos-sdk/issues/4272) Merge gaiareplay functionality into gaiad replay. + Drop `gaiareplay` in favor of new `gaiad replay` command. +* (gaiacli) [\#3715](https://github.com/cosmos/cosmos-sdk/issues/3715) query distr rewards returns per-validator + rewards along with rewards total amount. +* (gaiacli) [\#40](https://github.com/cosmos/cosmos-sdk/issues/40) rest-server's --cors option is now gone. +* (gaiacli) [\#4027](https://github.com/cosmos/cosmos-sdk/issues/4027) gaiacli version command dooes not return the checksum of the go.sum file anymore. +* (gaiacli) [\#4142](https://github.com/cosmos/cosmos-sdk/issues/4142) Turn gaiacli tx send's --from into a required argument. + New shorter syntax: `gaiacli tx send FROM TO AMOUNT` +* (gaiacli) [\#4228](https://github.com/cosmos/cosmos-sdk/issues/4228) Merge gaiakeyutil functionality into gaiacli keys. + Drop `gaiakeyutil` in favor of new `gaiacli keys parse` command. Syntax and semantic are preserved. +* (rest) [\#3715](https://github.com/cosmos/cosmos-sdk/issues/3715) Update /distribution/delegators/{delegatorAddr}/rewards GET endpoint + as per new specs. For a given delegation, the endpoint now returns the + comprehensive list of validator-reward tuples along with the grand total. +* (rest) [\#3942](https://github.com/cosmos/cosmos-sdk/issues/3942) Update pagination data in txs query. +* (rest) [\#4049](https://github.com/cosmos/cosmos-sdk/issues/4049) update tag MsgWithdrawValidatorCommission to match type +* (rest) The `/auth/accounts/{address}` now returns a `height` in the response. The + account is now nested under `account`. + +### Features + +* (gaiad) Add `migrate` command to `gaiad` to provide the ability to migrate exported + genesis state from one version to another. +* (gaiad) Update Gaia for community pool spend proposals per Cosmos Hub governance proposal [\#7](https://github.com/cosmos/cosmos-sdk/issues/7) "Activate the Community Pool" + +### Improvements + +* (gaiad) [\#4042](https://github.com/cosmos/cosmos-sdk/issues/4042) Update docs and scripts to include the correct `GO111MODULE=on` environment variable. +* (gaiad) [\#4066](https://github.com/cosmos/cosmos-sdk/issues/4066) Fix 'ExportGenesisFile() incorrectly overwrites genesis' +* (gaiad) [\#4064](https://github.com/cosmos/cosmos-sdk/issues/4064) Remove `dep` and `vendor` from `doc` and `version`. +* (gaiad) [\#4080](https://github.com/cosmos/cosmos-sdk/issues/4080) add missing invariants during simulations +* (gaiad) [\#4343](https://github.com/cosmos/cosmos-sdk/issues/4343) Upgrade toolchain to Go 1.12.5. +* (gaiacli) [\#4068](https://github.com/cosmos/cosmos-sdk/issues/4068) Remove redundant account check on `gaiacli` +* (gaiacli) [\#4227](https://github.com/cosmos/cosmos-sdk/issues/4227) Support for Ledger App v1.5 +* (rest) [\#2007](https://github.com/cosmos/cosmos-sdk/issues/2007) Return 200 status code on empty results +* (rest) [\#4123](https://github.com/cosmos/cosmos-sdk/issues/4123) Fix typo, url error and outdated command description of doc clients. +* (rest) [\#4129](https://github.com/cosmos/cosmos-sdk/issues/4129) Translate doc clients to chinese. +* (rest) [\#4141](https://github.com/cosmos/cosmos-sdk/issues/4141) Fix /txs/encode endpoint + + + +[Unreleased]: https://github.com/cosmos/gaia/compare/v1.0.0...HEAD +[1.0.0]: https://github.com/cosmos/gaia/releases/tag/v1.0.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 410845f0a6..7b8e818fe0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,17 +1,18 @@ # Contributing -* [Pull Requests](#pull-requests) - * [Process for reviewing PRs](#process-for-reviewing-prs) - * [Updating Documentation](#updating-documentation) -* [Forking](#forking) -* [Dependencies](#dependencies) -* [Testing](#testing) -* [Branching Model and Release](#branching-model-and-release) - * [PR Targeting](#pr-targeting) - * [Development Procedure](#development-procedure) - * [Pull Merge Procedure](#pull-merge-procedure) - * [Release Procedure](#release-procedure) - * [Point Release Procedure](#point-release-procedure) +- [Contributing](#contributing) + - [Pull Requests](#pull-requests) + - [Process for reviewing PRs](#process-for-reviewing-prs) + - [Updating Documentation](#updating-documentation) + - [Forking](#forking) + - [Dependencies](#dependencies) + - [Testing](#testing) + - [Branching Model and Release](#branching-model-and-release) + - [PR Targeting](#pr-targeting) + - [Development Procedure](#development-procedure) + - [Pull Merge Procedure](#pull-merge-procedure) + - [Release Procedure](#release-procedure) + - [Point Release Procedure](#point-release-procedure) Thank you for considering making contributions to Gaia and related repositories! @@ -182,14 +183,21 @@ only pull requests targeted directly against master. - merge pull request ### Release Procedure - - start on `master` - - create the release candidate branch `rc/v*` (going forward known as **RC**) and ensure it's protected against pushing from anyone except the release manager/coordinator. **no PRs targeting this branch should be merged unless exceptional circumstances arise** - - on the `RC` branch, use `clog` to prepare the `CHANGELOG.md` and kick off a large round of simulation testing (e.g. 400 seeds for 2k blocks). - - if errors are found during the simulation testing, commit the fixes to `master` and create a new `RC` branch (making sure to increment the `rcN`) - - after simulation has successfully completed, create the release branch (`release/vX.XX.X`) from the `RC` branch - - merge the release branch to `master` to incorporate the `CHANGELOG.md` updates - - delete the `RC` branches - + +- Start on `master` +- Create the release candidate branch `rc/v*` (going forward known as **RC**) + and ensure it's protected against pushing from anyone except the release + manager/coordinator + - **no PRs targeting this branch should be merged unless exceptional circumstances arise** +- On the `RC` branch, prepare a new version section in the `CHANGELOG.md` and + kick off a large round of simulation testing (e.g. 400 seeds for 2k blocks) +- If errors are found during the simulation testing, commit the fixes to `master` + and create a new `RC` branch (making sure to increment the `rcN`) +- After simulation has successfully completed, create the release branch + (`release/vX.XX.X`) from the `RC` branch +- Merge the release branch to `master` to incorporate the `CHANGELOG.md` updates +- Delete the `RC` branches + ### Point Release Procedure At the moment, only a single major release will be supported, so all point diff --git a/contrib/devtools/Makefile b/contrib/devtools/Makefile index 105024837f..a5a8c5ef8f 100644 --- a/contrib/devtools/Makefile +++ b/contrib/devtools/Makefile @@ -46,7 +46,6 @@ TOOLS_DESTDIR ?= $(GOPATH)/bin GOLANGCI_LINT = $(TOOLS_DESTDIR)/golangci-lint GOIMPORTS = $(TOOLS_DESTDIR)/goimports -CLOG = $(TOOLS_DESTDIR)/clog RUNSIM = $(TOOLS_DESTDIR)/runsim all: tools @@ -61,16 +60,13 @@ $(GOLANGCI_LINT): $(mkfile_dir)/install-golangci-lint.sh $(GOIMPORTS): go get golang.org/x/tools/cmd/goimports@v0.0.0-20190628034336-212fb13d595e -$(CLOG): - go get github.com/cosmos/tools/cmd/clog/ - $(RUNSIM): go get github.com/cosmos/tools/cmd/runsim/ golangci-lint: $(GOLANGCI_LINT) tools-clean: - rm -f $(GOIMPORTS) $(CLOG) $(GOLANGCI_LINT) + rm -f $(GOIMPORTS) $(GOLANGCI_LINT) rm -f tools-stamp .PHONY: all tools tools-clean From 72a5f93310b846240f102900bcd0c24e1e7e0817 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Wed, 14 Aug 2019 11:36:27 -0400 Subject: [PATCH 011/685] Merge PR #102: Remove clog config --- .clog.yaml | 10 ---------- CHANGELOG.md | 15 +++++++++++++-- CONTRIBUTING.md | 39 +++++++++++++++++++++------------------ 3 files changed, 34 insertions(+), 30 deletions(-) delete mode 100644 .clog.yaml diff --git a/.clog.yaml b/.clog.yaml deleted file mode 100644 index 1c7cc76cb9..0000000000 --- a/.clog.yaml +++ /dev/null @@ -1,10 +0,0 @@ -sections: - breaking: Breaking Changes - features: Features - improvements: Improvements - bugfixes: Bugfixes - -tags: - - gaiad - - gaiacli - - rest diff --git a/CHANGELOG.md b/CHANGELOG.md index 9106cbb26d..0b28cf80e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,17 @@ The latest version comes first. The release date of each version is displayed. Mention whether you follow Semantic Versioning. +Usage: + +Change log entries are to be added to the Unreleased section under the +appropriate stanza (see below). Each entry should ideally include a tag and +the Github issue reference in the following format: + +* () \# message + +The issue numbers will later be link-ified during the release process so you do +not have to worry about including a link manually, but you can if you wish. + Types of changes (Stanzas): "Features" for new features. @@ -24,7 +35,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] -## [1.0.0] - 2019-08-13 +## [v1.0.0] - 2019-08-13 ### Bug Fixes @@ -82,4 +93,4 @@ Ref: https://keepachangelog.com/en/1.0.0/ [Unreleased]: https://github.com/cosmos/gaia/compare/v1.0.0...HEAD -[1.0.0]: https://github.com/cosmos/gaia/releases/tag/v1.0.0 +[v1.0.0]: https://github.com/cosmos/gaia/releases/tag/v1.0.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7b8e818fe0..26b787a9c1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,24 +21,27 @@ Contributing to this repo can mean many things such as participated in discussion or proposing code changes. To ensure a smooth workflow for all contributors, the general procedure for contributing has been established: - 1. either [open](https://github.com/cosmos/gaia/issues/new/choose) or - [find](https://github.com/cosmos/gaia/issues) an issue you'd like to help with, - 2. participate in thoughtful discussion on that issue, - 3. if you would then like to contribute code: - 1. if a the issue is a proposal, ensure that the proposal has been accepted, - 2. ensure that nobody else has already begun working on this issue, if they have - make sure to contact them to collaborate, - 3. if nobody has been assigned the issue and you would like to work on it - make a comment on the issue to inform the community of your intentions - to begin work, - 4. follow standard github best practices: fork the repo, branch from the - top of `master`, make some commits, and submit a PR to `master`, - - for core developers working within the Gaia repo, - to ensure a clear ownership of branches, branches must be named with the convention `yourname/{issue-}feature-name`. - 5. submit your PR early and make sure it's opened as a `Draft`, even if it's - incomplete, this indicates to the community you're working on something and - allows them to provide comments early in the development process. When the code - is complete it should be marked as ready-for-review using Github's `Mark Ready` feature. +1. Either [open](https://github.com/cosmos/gaia/issues/new/choose) or + [find](https://github.com/cosmos/gaia/issues) an issue you'd like to help with +2. Participate in thoughtful discussion on that issue +3. If you would like to contribute: + 1. If a the issue is a proposal, ensure that the proposal has been accepted + 2. Ensure that nobody else has already begun working on this issue, if they have + make sure to contact them to collaborate + 3. If nobody has been assigned the issue and you would like to work on it + make a comment on the issue to inform the community of your intentions + to begin work + 4. Follow standard Github best practices: fork the repo, branch from the + HEAD of `master`, make some commits, and submit a PR to `master` + - For core developers working within the cosmos-sdk repo, to ensure a clear + ownership of branches, branches must be named with the convention + `{moniker}/{issue#}-branch-name` + 5. Be sure to submit the PR in `Draft` mode submit your PR early, even if + it's incomplete as this indicates to the community you're working on + something and allows them to provide comments early in the development process + 6. When the code is complete it can be marked `Ready for Review` + 7. Be sure to include a relevant change log entry in the `Unreleased` section + of `CHANGELOG.md` (see file for log format) Note that for very small or blatantly obvious problems (such as typos) it is not required to an open issue to submit a PR, but be aware that for more complex From 5cad07140d546e926ab68ada88a2892c8d5885bd Mon Sep 17 00:00:00 2001 From: colin axner Date: Thu, 15 Aug 2019 15:30:10 -0700 Subject: [PATCH 012/685] Merge PR #105: Fix Module Account Blacklisting in GaiaApp --- app/app.go | 2 +- app/app_test.go | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index 5d4f51fba3..048e8d9b3c 100644 --- a/app/app.go +++ b/app/app.go @@ -256,7 +256,7 @@ func (app *GaiaApp) LoadHeight(height int64) error { func (app *GaiaApp) ModuleAccountAddrs() map[string]bool { modAccAddrs := make(map[string]bool) for acc := range maccPerms { - modAccAddrs[app.supplyKeeper.GetModuleAddress(acc).String()] = true + modAccAddrs[supply.NewModuleAddress(acc).String()] = true } return modAccAddrs diff --git a/app/app_test.go b/app/app_test.go index 93b536db94..2e8f877b53 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/tendermint/tm-db" "github.com/tendermint/tendermint/libs/log" + "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp" @@ -25,6 +25,16 @@ func TestGaiadExport(t *testing.T) { 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 := NewGaiaApp(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(gapp *GaiaApp) error { genesisState := simapp.NewDefaultGenesisState() From 2247203879a24432b4cf89298923959a1725ff78 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Sat, 17 Aug 2019 23:13:58 +0200 Subject: [PATCH 013/685] Merge PR #107: Update Build Pipeline with Go 1.12.9 --- contrib/gitian-build.sh | 2 +- contrib/gitian-descriptors/gitian-darwin.yml | 4 ++-- contrib/gitian-descriptors/gitian-linux.yml | 4 ++-- contrib/gitian-descriptors/gitian-windows.yml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/gitian-build.sh b/contrib/gitian-build.sh index 7280a766df..a396cafa5d 100755 --- a/contrib/gitian-build.sh +++ b/contrib/gitian-build.sh @@ -8,7 +8,7 @@ set -euo pipefail GITIAN_CACHE_DIRNAME='.gitian-builder-cache' -GO_DEBIAN_RELEASE='1.12.7-1' +GO_DEBIAN_RELEASE='1.12.9-1' GO_TARBALL="golang-debian-${GO_DEBIAN_RELEASE}.tar.gz" GO_TARBALL_URL="https://salsa.debian.org/go-team/compiler/golang/-/archive/debian/${GO_DEBIAN_RELEASE}/${GO_TARBALL}" diff --git a/contrib/gitian-descriptors/gitian-darwin.yml b/contrib/gitian-descriptors/gitian-darwin.yml index b97f1d6883..ad02496987 100644 --- a/contrib/gitian-descriptors/gitian-darwin.yml +++ b/contrib/gitian-descriptors/gitian-darwin.yml @@ -23,11 +23,11 @@ remotes: - "url": "https://github.com/cosmos/gaia.git" "dir": "gaia" files: -- "golang-debian-1.12.7-1.tar.gz" +- "golang-debian-1.12.9-1.tar.gz" script: | set -e -o pipefail - GO_SRC_RELEASE=golang-debian-1.12.7-1 + GO_SRC_RELEASE=golang-debian-1.12.9-1 GO_SRC_TARBALL="${GO_SRC_RELEASE}.tar.gz" # Compile go and configure the environment export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 9619fa3b88..ba03f92d23 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -23,11 +23,11 @@ remotes: - "url": "https://github.com/cosmos/gaia.git" "dir": "gaia" files: -- "golang-debian-1.12.7-1.tar.gz" +- "golang-debian-1.12.9-1.tar.gz" script: | set -e -o pipefail - GO_SRC_RELEASE=golang-debian-1.12.7-1 + GO_SRC_RELEASE=golang-debian-1.12.9-1 GO_SRC_TARBALL="${GO_SRC_RELEASE}.tar.gz" # Compile go and configure the environment export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" diff --git a/contrib/gitian-descriptors/gitian-windows.yml b/contrib/gitian-descriptors/gitian-windows.yml index 79c138df66..ce04b28e15 100644 --- a/contrib/gitian-descriptors/gitian-windows.yml +++ b/contrib/gitian-descriptors/gitian-windows.yml @@ -23,11 +23,11 @@ remotes: - "url": "https://github.com/cosmos/gaia.git" "dir": "gaia" files: -- "golang-debian-1.12.7-1.tar.gz" +- "golang-debian-1.12.9-1.tar.gz" script: | set -e -o pipefail - GO_SRC_RELEASE=golang-debian-1.12.7-1 + GO_SRC_RELEASE=golang-debian-1.12.9-1 GO_SRC_TARBALL="${GO_SRC_RELEASE}.tar.gz" # Compile go and configure the environment export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" From 4bc0bb52b3b9daca96f39c0de18e1e09d1801a23 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Thu, 22 Aug 2019 08:51:53 -0400 Subject: [PATCH 014/685] Merge PR #110: Update CHANGELOG - v2.0.0 --- CHANGELOG.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b28cf80e7..102c79ee97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,17 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +## [v2.0.0] - 2019-08-22 + +### Bug Fixes + +* [\#104](https://github.com/cosmos/gaia/issues/104) Fix `ModuleAccountAddrs` to +not rely on the `x/supply` keeper to get module account addresses for blacklisting. + +### Breaking Changes + +* (sdk) Update SDK version to v0.37.0 + ## [v1.0.0] - 2019-08-13 ### Bug Fixes @@ -92,5 +103,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ -[Unreleased]: https://github.com/cosmos/gaia/compare/v1.0.0...HEAD +[Unreleased]: https://github.com/cosmos/gaia/compare/v2.0.0...HEAD +[v2.0.0]: https://github.com/cosmos/gaia/releases/tag/v2.0.0 [v1.0.0]: https://github.com/cosmos/gaia/releases/tag/v1.0.0 From d624ca1980ababf8ac6b4d1713b76e157f3d695c Mon Sep 17 00:00:00 2001 From: Aditya Date: Fri, 30 Aug 2019 16:02:00 +0000 Subject: [PATCH 015/685] Merge PR #114: split BREAKING CHANGES into subsections --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 102c79ee97..53dd902fdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,8 @@ Types of changes (Stanzas): "Improvements" for changes in existing functionality. "Deprecated" for soon-to-be removed features. "Bug Fixes" for any bug fixes. -"Breaking" for breaking API changes. +"Client Breaking" for breaking CLI commands and REST routes. +"State Machine Breaking" for breaking the AppState Ref: https://keepachangelog.com/en/1.0.0/ --> @@ -42,7 +43,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [\#104](https://github.com/cosmos/gaia/issues/104) Fix `ModuleAccountAddrs` to not rely on the `x/supply` keeper to get module account addresses for blacklisting. -### Breaking Changes +### State Machine Breaking Changes * (sdk) Update SDK version to v0.37.0 From 6fa598873025ac38cc7dee32ef1d0a1f43773ccf Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Tue, 10 Sep 2019 14:56:58 -0400 Subject: [PATCH 016/685] Merge PR #119: Upgrade go to 1.13 & Latest SDK Master --- .circleci/config.yml | 351 +++++++++++++--------------- CHANGELOG.md | 10 + Makefile | 2 - README.md | 2 +- app/app.go | 44 +++- app/app_test.go | 4 +- app/export.go | 2 +- app/sim_test.go | 473 +++++++++++++------------------------- app/utils.go | 35 ++- cli_test/test_helpers.go | 2 +- cmd/gaiad/main.go | 10 +- contrib/devtools/Makefile | 2 +- go.mod | 19 +- go.sum | 57 +++-- sims.mk | 35 +-- 15 files changed, 450 insertions(+), 598 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d058ce7fd..bc64953cc7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,198 +1,161 @@ -version: 2 +version: 2.1 -defaults: &linux_defaults - working_directory: /go/src/github.com/cosmos/gaia - docker: - - image: circleci/golang:1.12 - environment: - GO111MODULE: 'on' +executors: + golang: + docker: + - image: circleci/golang:1.13 + working_directory: /go/src/github.com/cosmos/cosmos-sdk + mac: + macos: + xcode: "10.3.0" + working_directory: /Users/distiller/project/src/github.com/cosmos/cosmos-sdk + environment: + GO_VERSION: "1.13" + docs: + docker: + - image: tendermintdev/jq_curl + environment: + AWS_REGION: us-east-1 -############ -# -# Configure macos integration tests - -macos_config: &macos_defaults - macos: - xcode: "10.1.0" - working_directory: /Users/distiller/project/src/github.com/cosmos/cosmos-sdk - environment: - GO_VERSION: "1.12.5" - -set_macos_env: &macos_env - run: - name: Set environment - command: | - echo 'export PATH=$PATH:$HOME/go/bin' >> $BASH_ENV - echo 'export GOPATH=$HOME/project' >> $BASH_ENV - echo 'export PATH=$PATH:$HOME/go/bin:$GOPATH/bin' >> $BASH_ENV - echo 'export GO111MODULE=on' - -############ -# -# Configure docs deployment - -docs_update: &docs_deploy - working_directory: ~/repo - docker: - - image: tendermintdev/jq_curl - environment: - AWS_REGION: us-east-1 +commands: + make: + parameters: + description: + type: string + target: + type: string + steps: + - attach_workspace: + at: /tmp/bin + - restore_cache: + name: "Restore source code cache" + keys: + - go-src-v1-{{ .Revision }} + - checkout + - restore_cache: + name: "Restore go modules cache" + keys: + - go-mod-v1-{{ checksum "go.sum" }} + - run: + name: << parameters.description >> + command: | + export BINDIR=/tmp/bin + make << parameters.target >> + mac_set_env: + steps: + - run: + name: "Set environment" + command: | + echo 'export PATH=$PATH:$HOME/go/bin' >> $BASH_ENV + echo 'export GOPATH=$HOME/project' >> $BASH_ENV + echo 'export PATH=$PATH:$HOME/go/bin:$GOPATH/bin' >> $BASH_ENV + echo 'export GO111MODULE=on' jobs: setup_dependencies: - <<: *linux_defaults + executor: golang steps: - - run: mkdir -p /tmp/workspace/bin - - run: mkdir -p /tmp/workspace/profiles - checkout - restore_cache: + name: "Restore go modules cache" keys: - go-mod-v1-{{ checksum "go.sum" }} - run: - name: binaries + name: Cache go modules + command: make go-mod-cache + - run: + name: Build + command: make build + - run: + name: "Git garbage collection" + command: git gc + - run: + name: "Build tools binaries" command: | - export PATH=/tmp/workspace/bin:$PATH - make go-mod-cache - make install + make tools - save_cache: + name: "Save go modules cache" key: go-mod-v1-{{ checksum "go.sum" }} paths: - "/go/pkg/mod" + - save_cache: + name: "Save source code cache" + key: go-src-v1-{{ .Revision }} + paths: + - ".git" - run: - name: tools command: | - make tools TOOLS_DESTDIR=/tmp/workspace/bin - cp $GOPATH/bin/runsim /tmp/workspace/bin/ + mkdir -p /tmp/bin + cp -r /go/bin/* /tmp/bin - persist_to_workspace: - root: /tmp/workspace + root: "/tmp/bin" paths: - - bin - - profiles + - "." - integration_tests: - <<: *linux_defaults - parallelism: 1 + test_sim_nondeterminism: + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - - checkout - - restore_cache: - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: - name: Test cli - command: | - export BUILDDIR=`pwd`/build - make check-build + - make: + target: test_sim_nondeterminism + description: "Test Gaia non-determinism simulations" - test_sim_gaia_nondeterminism: - <<: *linux_defaults - parallelism: 1 + test_sim_import_export: + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - - checkout - - restore_cache: - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: - name: Test individual module simulations - command: | - make sim-gaia-nondeterminism + - make: + target: test_sim_import_export + description: "Test Gaia import/export simulation" - test_sim_gaia_fast: - <<: *linux_defaults - parallelism: 1 + test_sim_after_import: + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - - checkout - - restore_cache: - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: - name: Test full Gaia simulation - command: | - make sim-gaia-fast + - make: + target: test_sim_after_import + description: "Test Gaia simulation after importing state" - test_sim_gaia_import_export: - <<: *linux_defaults - parallelism: 1 + test_sim_multi_seed_short: + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - - checkout - - restore_cache: - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: - name: Test Gaia import/export simulation - command: | - /tmp/workspace/bin/runsim -j 4 github.com/cosmos/gaia/app 50 5 TestGaiaImportExport + - make: + target: test_sim_multi_seed_short + description: "Test Gaia multi-seed simulation (short-lived)" - test_sim_gaia_simulation_after_import: - <<: *linux_defaults - parallelism: 1 + test_sim_multi_seed_long: + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - - checkout - - restore_cache: - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: - name: Test Gaia import/export simulation - command: | - /tmp/workspace/bin/runsim -j 4 github.com/cosmos/gaia/app 50 5 TestGaiaSimulationAfterImport - - test_sim_gaia_multi_seed_long: - <<: *linux_defaults - parallelism: 1 - steps: - - attach_workspace: - at: /tmp/workspace - - checkout - - restore_cache: - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: - name: Test multi-seed Gaia simulation long - command: | - /tmp/workspace/bin/runsim -j 4 github.com/cosmos/gaia/app 500 50 TestFullGaiaSimulation + - make: + target: test_sim_multi_seed_long + description: "Test Gaia multi-seed simulation (long-lived)" - test_sim_gaia_multi_seed: - <<: *linux_defaults - parallelism: 1 + integration_tests: + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - checkout - restore_cache: keys: - go-mod-v1-{{ checksum "go.sum" }} - run: - name: Test multi-seed Gaia simulation short + name: Test CLI integration command: | - /tmp/workspace/bin/runsim -j 4 github.com/cosmos/gaia/app 50 10 TestFullGaiaSimulation + export BUILDDIR=`pwd`/build + make check-build test_cover: - <<: *linux_defaults + executor: golang parallelism: 4 steps: - - attach_workspace: - at: /tmp/workspace - checkout - - run: mkdir -p /tmp/logs - restore_cache: keys: - go-mod-v1-{{ checksum "go.sum" }} - run: - name: Run tests + name: Run tests with coverage command: | export VERSION="$(git describe --tags --long | sed 's/v\(.*\)/\1/')" export GO111MODULE=on - for pkg in $(go list ./... | grep -v github.com/cosmos/gaia/cli_test | grep -v '/simulation' | circleci tests split --split-by=timings); do + mkdir -p /tmp/logs /tmp/workspace/profiles + for pkg in $(go list ./... | grep -v '/simulation' | circleci tests split); do id=$(echo "$pkg" | sed 's|[/.]|_|g') go test -mod=readonly -timeout 8m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic -tags='ledger test_ledger_mock' "$pkg" | tee "/tmp/logs/$id-$RANDOM.log" done @@ -204,8 +167,7 @@ jobs: path: /tmp/logs upload_coverage: - <<: *linux_defaults - parallelism: 1 + executor: golang steps: - attach_workspace: at: /tmp/workspace @@ -224,44 +186,45 @@ jobs: - run: name: filter out DONTCOVER command: | - excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER' | xargs realpath --relative-to=$GOPATH/src)" + excludelist="$(find . -type f -name '*.go' | xargs grep -l 'DONTCOVER')" for filename in ${excludelist}; do - echo "Excluding ${filename} ..." - sed -i "\%${filename}:%d" coverage.txt + filename=$(echo $filename | sed 's/^./github.com\/cosmos\/gaia/g') + echo "Excluding ${filename} from coverage report..." + sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt done - run: name: upload command: bash <(curl -s https://codecov.io/bash) -f coverage.txt localnet: - working_directory: /home/circleci/.go_workspace/src/github.com/cosmos/cosmos-sdk - machine: - image: circleci/classic:latest - environment: - GOPATH: /home/circleci/.go_workspace/ - GOOS: linux - GOARCH: amd64 - GO_VERSION: "1.12.5" - parallelism: 1 - steps: - - checkout - - run: - name: run localnet and exit on failure - command: | - pushd /tmp - wget https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz - sudo tar -xvf go$GO_VERSION.linux-amd64.tar.gz - sudo rm -rf /usr/local/go - sudo mv go /usr/local - popd - set -x - make tools - make build-linux - make localnet-start - ./contrib/localnet-blocks-test.sh 40 5 10 localhost + working_directory: /home/circleci/.go_workspace/src/github.com/cosmos/gaia + machine: + image: circleci/classic:latest + environment: + GOPATH: /home/circleci/.go_workspace/ + GOOS: linux + GOARCH: amd64 + GO_VERSION: "1.13" + parallelism: 1 + steps: + - checkout + - run: + name: run localnet and exit on failure + command: | + pushd /tmp + wget https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz + sudo tar -xvf go$GO_VERSION.linux-amd64.tar.gz + sudo rm -rf /usr/local/go + sudo mv go /usr/local + popd + set -x + make tools + make build-linux + make localnet-start + ./contrib/localnet-blocks-test.sh 40 5 10 localhost deploy_docs: - <<: *docs_deploy + executor: docs steps: - checkout - run: @@ -285,9 +248,9 @@ jobs: fi macos_ci: - <<: *macos_defaults + executor: mac steps: - - *macos_env + - mac_set_env - run: name: Install go command: | @@ -305,8 +268,7 @@ jobs: make install - run: name: Integration tests - command: - source $BASH_ENV + command: source $BASH_ENV make check-build - run: name: Test full gaia simulation @@ -315,7 +277,7 @@ jobs: make sim-gaia-fast docker_image: - <<: *linux_defaults + executor: golang steps: - attach_workspace: at: /tmp/workspace @@ -333,12 +295,12 @@ jobs: docker build . else docker build -t tendermint/gaia:$GAIAD_VERSION . - docker login --password-stdin -u $DOCKER_USER <<<$DOCKER_PASS + docker login --password-stdin -u $DOCKER_USER \<<<$DOCKER_PASS docker push tendermint/gaia:$GAIAD_VERSION fi docker_tagged: - <<: *linux_defaults + executor: golang steps: - attach_workspace: at: /tmp/workspace @@ -347,11 +309,11 @@ jobs: docker_layer_caching: true - run: | docker build -t tendermint/gaia:$CIRCLE_TAG . - docker login --password-stdin -u $DOCKER_USER <<<$DOCKER_PASS + docker login --password-stdin -u $DOCKER_USER \<<$DOCKER_PASS docker push tendermint/gaia:$CIRCLE_TAG reproducible_builds: - <<: *linux_defaults + executor: golang steps: - attach_workspace: at: /tmp/workspace @@ -379,7 +341,7 @@ jobs: # overrides the .gaiad directory. # # contract_tests: -# <<: *linux_defaults +# executor: golang # steps: # - attach_workspace: # at: /tmp/workspace @@ -434,29 +396,28 @@ workflows: - integration_tests: requires: - setup_dependencies - - test_sim_gaia_nondeterminism: + - test_sim_nondeterminism: requires: - setup_dependencies - - test_sim_gaia_fast: + - test_sim_import_export: requires: - setup_dependencies - - test_sim_gaia_import_export: + - test_sim_after_import: requires: - setup_dependencies - - test_sim_gaia_simulation_after_import: + - test_sim_multi_seed_short: requires: - setup_dependencies - - test_sim_gaia_multi_seed: - requires: - - setup_dependencies - - test_sim_gaia_multi_seed_long: + - test_sim_multi_seed_long: requires: - setup_dependencies + # These filters ensure that the long sim only runs during release filters: branches: + ignore: /.*/ + tags: only: - - master - - develop + - /^v.*/ - test_cover: requires: - setup_dependencies diff --git a/CHANGELOG.md b/CHANGELOG.md index 53dd902fdb..e3fb5a53a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,16 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Improvements + +* [\#119](https://github.com/cosmos/gaia/pull/119) Refactor and upgrade Circle CI +configuration. + +### Features + +* (gaiad) [\#119](https://github.com/cosmos/gaia/pull/119) Add support for the `--halt-time` and +`--inter-block-cache` CLI flags and configuration. + ## [v2.0.0] - 2019-08-22 ### Bug Fixes diff --git a/Makefile b/Makefile index e045fb43b8..9b6854b7f6 100644 --- a/Makefile +++ b/Makefile @@ -93,8 +93,6 @@ install: go.sum check-ledger install-debug: go.sum go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiadebug - - ######################################## ### Tools & dependencies diff --git a/README.md b/README.md index 3c2b82021f..ca6dd6a8d0 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This repository hosts `Gaia`, the first implementation of the Cosmos Hub. -**Note**: Requires [Go 1.12+](https://golang.org/dl/) +**Note**: Requires [Go 1.13+](https://golang.org/dl/) **DISCLAIMER**: The current version of Gaia running the Cosmos Hub (v0.34.x) is __NOT__ maintained in this repository. Gaia and the [Cosmos SDK](https://github.com/cosmos/cosmos-sdk/) diff --git a/app/app.go b/app/app.go index 048e8d9b3c..a9c0c2400e 100644 --- a/app/app.go +++ b/app/app.go @@ -68,7 +68,8 @@ var ( } ) -// custom tx codec +// MakeCodec creates the application codec. The codec is sealed before it is +// returned. func MakeCodec() *codec.Codec { var cdc = codec.New() @@ -77,10 +78,10 @@ func MakeCodec() *codec.Codec { codec.RegisterCrypto(cdc) codec.RegisterEvidences(cdc) - return cdc + return cdc.Seal() } -// Extended ABCI application +// GaiaApp extended ABCI application type GaiaApp struct { *bam.BaseApp cdc *codec.Codec @@ -105,6 +106,9 @@ type GaiaApp struct { // the module manager mm *module.Manager + + // simulation manager + sm *module.SimulationManager } // NewGaiaApp returns a reference to an initialized GaiaApp. @@ -188,7 +192,7 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b gov.NewAppModule(app.govKeeper, app.supplyKeeper), mint.NewAppModule(app.mintKeeper), 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 @@ -209,6 +213,24 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b app.mm.RegisterInvariants(&app.crisisKeeper) 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( + genaccounts.NewAppModule(app.accountKeeper), + 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) @@ -261,3 +283,17 @@ func (app *GaiaApp) ModuleAccountAddrs() map[string]bool { return modAccAddrs } + +// Codec returns the application's sealed codec. +func (app *GaiaApp) Codec() *codec.Codec { + return app.cdc +} + +// GetMaccPerms returns a mapping of the application's module account permissions. +func GetMaccPerms() map[string][]string { + modAccPerms := make(map[string][]string) + for k, v := range maccPerms { + modAccPerms[k] = v + } + return modAccPerms +} diff --git a/app/app_test.go b/app/app_test.go index 2e8f877b53..1388fe02e3 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/log" - "github.com/tendermint/tm-db" + db "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp" @@ -36,7 +36,6 @@ func TestBlackListedAddrs(t *testing.T) { } func setGenesis(gapp *GaiaApp) error { - genesisState := simapp.NewDefaultGenesisState() stateBytes, err := codec.MarshalJSONIndent(gapp.cdc, genesisState) if err != nil { @@ -50,6 +49,7 @@ func setGenesis(gapp *GaiaApp) error { AppStateBytes: stateBytes, }, ) + gapp.Commit() return nil } diff --git a/app/export.go b/app/export.go index 9d312bce62..f8e7e7490c 100644 --- a/app/export.go +++ b/app/export.go @@ -13,7 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" ) -// export the state of gaia for a genesis file +// ExportAppStateAndValidators export the state of gaia for a genesis file func (app *GaiaApp) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList []string, ) (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error) { // as if they could withdraw from the start of the next block diff --git a/app/sim_test.go b/app/sim_test.go index 14f1bbd946..00273beed9 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -2,14 +2,11 @@ package app import ( "encoding/json" - "flag" "fmt" - "io" "io/ioutil" "math/rand" "os" "testing" - "time" "github.com/stretchr/testify/require" @@ -19,358 +16,242 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/simapp" + "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - authsim "github.com/cosmos/cosmos-sdk/x/auth/simulation" - "github.com/cosmos/cosmos-sdk/x/bank" + authsimops "github.com/cosmos/cosmos-sdk/x/auth/simulation/operations" + banksimops "github.com/cosmos/cosmos-sdk/x/bank/simulation/operations" distr "github.com/cosmos/cosmos-sdk/x/distribution" - distrsim "github.com/cosmos/cosmos-sdk/x/distribution/simulation" + distrsimops "github.com/cosmos/cosmos-sdk/x/distribution/simulation/operations" "github.com/cosmos/cosmos-sdk/x/gov" - govsim "github.com/cosmos/cosmos-sdk/x/gov/simulation" + govsimops "github.com/cosmos/cosmos-sdk/x/gov/simulation/operations" "github.com/cosmos/cosmos-sdk/x/mint" "github.com/cosmos/cosmos-sdk/x/params" - paramsim "github.com/cosmos/cosmos-sdk/x/params/simulation" + paramsimops "github.com/cosmos/cosmos-sdk/x/params/simulation/operations" "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/cosmos/cosmos-sdk/x/slashing" - slashingsim "github.com/cosmos/cosmos-sdk/x/slashing/simulation" + slashingsimops "github.com/cosmos/cosmos-sdk/x/slashing/simulation/operations" "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" ) func init() { - flag.StringVar(&genesisFile, "Genesis", "", "custom simulation genesis file; cannot be used with params file") - flag.StringVar(¶msFile, "Params", "", "custom simulation params file which overrides any random params; cannot be used with genesis") - flag.StringVar(&exportParamsPath, "ExportParamsPath", "", "custom file path to save the exported params JSON") - flag.IntVar(&exportParamsHeight, "ExportParamsHeight", 0, "height to which export the randomly generated params") - flag.StringVar(&exportStatePath, "ExportStatePath", "", "custom file path to save the exported app state JSON") - flag.StringVar(&exportStatsPath, "ExportStatsPath", "", "custom file path to save the exported simulation statistics JSON") - flag.Int64Var(&seed, "Seed", 42, "simulation random seed") - flag.IntVar(&initialBlockHeight, "InitialBlockHeight", 1, "initial block to start the simulation") - flag.IntVar(&numBlocks, "NumBlocks", 500, "number of new blocks to simulate from the initial block height") - flag.IntVar(&blockSize, "BlockSize", 200, "operations per block") - flag.BoolVar(&enabled, "Enabled", false, "enable the simulation") - flag.BoolVar(&verbose, "Verbose", false, "verbose log output") - flag.BoolVar(&lean, "Lean", false, "lean simulation log output") - flag.BoolVar(&commit, "Commit", false, "have the simulation commit") - flag.IntVar(&period, "Period", 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") - flag.Int64Var(&genesisTime, "GenesisTime", 0, "override genesis UNIX time instead of using a random UNIX time") + simapp.GetSimulatorFlags() } -// helper function for populating input for SimulateFromSeed -func getSimulateFromSeedInput(tb testing.TB, w io.Writer, app *GaiaApp) ( - testing.TB, io.Writer, *baseapp.BaseApp, simulation.AppStateFn, int64, - simulation.WeightedOperations, sdk.Invariants, int, int, int, int, string, - bool, bool, bool, bool, bool, map[string]bool) { - - exportParams := exportParamsPath != "" - - return tb, w, app.BaseApp, appStateFn, seed, - testAndRunTxs(app), invariants(app), - initialBlockHeight, numBlocks, exportParamsHeight, blockSize, - exportStatsPath, exportParams, commit, lean, onOperation, allInvariants, app.ModuleAccountAddrs() -} - -func appStateFn( - r *rand.Rand, accs []simulation.Account, -) (appState json.RawMessage, simAccs []simulation.Account, chainID string, genesisTimestamp time.Time) { - - cdc := MakeCodec() - - if genesisTime == 0 { - genesisTimestamp = simulation.RandTimestamp(r) - } else { - genesisTimestamp = time.Unix(genesisTime, 0) - } - - 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, genesisTimestamp -} - -// 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 *GaiaApp) []simulation.WeightedOperation { - cdc := MakeCodec() +func testAndRunTxs(app *GaiaApp, config simulation.Config) []simulation.WeightedOperation { ap := make(simulation.AppParams) - if paramsFile != "" { - bz, err := ioutil.ReadFile(paramsFile) + paramChanges := app.sm.GenerateParamChanges(config.Seed) + + if config.ParamsFile != "" { + bz, err := ioutil.ReadFile(config.ParamsFile) if err != nil { panic(err) } - cdc.MustUnmarshalJSON(bz, &ap) + app.cdc.MustUnmarshalJSON(bz, &ap) } + // nolint: govet return []simulation.WeightedOperation{ { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightDeductFee, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightDeductFee, &v, nil, func(_ *rand.Rand) { v = 5 }) return v }(nil), - authsim.SimulateDeductFee(app.accountKeeper, app.supplyKeeper), + authsimops.SimulateDeductFee(app.accountKeeper, app.supplyKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgSend, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgSend, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - bank.SimulateMsgSend(app.accountKeeper, app.bankKeeper), + banksimops.SimulateMsgSend(app.accountKeeper, app.bankKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightSingleInputMsgMultiSend, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightSingleInputMsgMultiSend, &v, nil, func(_ *rand.Rand) { v = 10 }) return v }(nil), - bank.SimulateSingleInputMsgMultiSend(app.accountKeeper, app.bankKeeper), + banksimops.SimulateSingleInputMsgMultiSend(app.accountKeeper, app.bankKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgSetWithdrawAddress, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgSetWithdrawAddress, &v, nil, func(_ *rand.Rand) { v = 50 }) return v }(nil), - distrsim.SimulateMsgSetWithdrawAddress(app.accountKeeper, app.distrKeeper), + distrsimops.SimulateMsgSetWithdrawAddress(app.distrKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgWithdrawDelegationReward, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgWithdrawDelegationReward, &v, nil, func(_ *rand.Rand) { v = 50 }) return v }(nil), - distrsim.SimulateMsgWithdrawDelegatorReward(app.accountKeeper, app.distrKeeper), + distrsimops.SimulateMsgWithdrawDelegatorReward(app.distrKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgWithdrawValidatorCommission, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgWithdrawValidatorCommission, &v, nil, func(_ *rand.Rand) { v = 50 }) return v }(nil), - distrsim.SimulateMsgWithdrawValidatorCommission(app.accountKeeper, app.distrKeeper), + distrsimops.SimulateMsgWithdrawValidatorCommission(app.distrKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightSubmitVotingSlashingTextProposal, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightSubmitVotingSlashingTextProposal, &v, nil, func(_ *rand.Rand) { v = 5 }) return v }(nil), - govsim.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, govsim.SimulateTextProposalContent), + govsimops.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, govsimops.SimulateTextProposalContent), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightSubmitVotingSlashingCommunitySpendProposal, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightSubmitVotingSlashingCommunitySpendProposal, &v, nil, func(_ *rand.Rand) { v = 5 }) return v }(nil), - govsim.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, distrsim.SimulateCommunityPoolSpendProposalContent(app.distrKeeper)), + govsimops.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, distrsimops.SimulateCommunityPoolSpendProposalContent(app.distrKeeper)), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightSubmitVotingSlashingParamChangeProposal, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightSubmitVotingSlashingParamChangeProposal, &v, nil, func(_ *rand.Rand) { v = 5 }) return v }(nil), - govsim.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, paramsim.SimulateParamChangeProposalContent), + govsimops.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, paramsimops.SimulateParamChangeProposalContent(paramChanges)), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgDeposit, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgDeposit, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - govsim.SimulateMsgDeposit(app.govKeeper), + govsimops.SimulateMsgDeposit(app.govKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgCreateValidator, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgCreateValidator, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - stakingsim.SimulateMsgCreateValidator(app.accountKeeper, app.stakingKeeper), + stakingsimops.SimulateMsgCreateValidator(app.accountKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgEditValidator, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgEditValidator, &v, nil, func(_ *rand.Rand) { v = 5 }) return v }(nil), - stakingsim.SimulateMsgEditValidator(app.stakingKeeper), + stakingsimops.SimulateMsgEditValidator(app.stakingKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgDelegate, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgDelegate, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - stakingsim.SimulateMsgDelegate(app.accountKeeper, app.stakingKeeper), + stakingsimops.SimulateMsgDelegate(app.accountKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgUndelegate, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgUndelegate, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - stakingsim.SimulateMsgUndelegate(app.accountKeeper, app.stakingKeeper), + stakingsimops.SimulateMsgUndelegate(app.accountKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgBeginRedelegate, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgBeginRedelegate, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - stakingsim.SimulateMsgBeginRedelegate(app.accountKeeper, app.stakingKeeper), + stakingsimops.SimulateMsgBeginRedelegate(app.accountKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgUnjail, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgUnjail, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - slashingsim.SimulateMsgUnjail(app.slashingKeeper), + slashingsimops.SimulateMsgUnjail(app.slashingKeeper), }, } } -func invariants(app *GaiaApp) []sdk.Invariant { - // TODO: fix PeriodicInvariants, it doesn't seem to call individual invariants for a period of 1 - // 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. +// fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of +// an IAVLStore for faster simulation speed. func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { 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: // /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/GaiaApp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out func BenchmarkFullAppSimulation(b *testing.B) { logger := log.NewNopLogger() + config := simapp.NewConfigFromFlags() var db dbm.DB dir, _ := ioutil.TempDir("", "goleveldb-app-sim") @@ -379,37 +260,26 @@ func BenchmarkFullAppSimulation(b *testing.B) { db.Close() _ = os.RemoveAll(dir) }() - app := NewGaiaApp(logger, db, nil, true, 0) + + app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) // Run randomized simulation // TODO: parameterize numbers, save for a later PR - _, params, simErr := simulation.SimulateFromSeed(getSimulateFromSeedInput(b, os.Stdout, app)) + _, simParams, simErr := simulation.SimulateFromSeed( + 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 exportStatePath != "" { - fmt.Println("Exporting app state...") - appState, _, err := app.ExportAppStateAndValidators(false, nil) - if err != nil { - fmt.Println(err) - b.Fail() - } - err = ioutil.WriteFile(exportStatePath, []byte(appState), 0644) - if err != nil { + if config.ExportStatePath != "" { + if err := ExportStateToJSON(app, config.ExportStatePath); err != nil { fmt.Println(err) b.Fail() } } - if exportParamsPath != "" { - fmt.Println("Exporting simulation params...") - paramsBz, err := json.MarshalIndent(params, "", " ") - if err != nil { - fmt.Println(err) - b.Fail() - } - - err = ioutil.WriteFile(exportParamsPath, paramsBz, 0644) - if err != nil { + if config.ExportParamsPath != "" { + if err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath); err != nil { fmt.Println(err) b.Fail() } @@ -420,7 +290,7 @@ func BenchmarkFullAppSimulation(b *testing.B) { b.FailNow() } - if commit { + if config.Commit { fmt.Println("\nGoLevelDB Stats") fmt.Println(db.Stats()["leveldb.stats"]) fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) @@ -428,13 +298,14 @@ func BenchmarkFullAppSimulation(b *testing.B) { } func TestFullAppSimulation(t *testing.T) { - if !enabled { - t.Skip("Skipping application simulation") + if !simapp.FlagEnabledValue { + t.Skip("skipping application simulation") } var logger log.Logger + config := simapp.NewConfigFromFlags() - if verbose { + if simapp.FlagVerboseValue { logger = log.TestingLogger() } else { logger = log.NewNopLogger() @@ -449,35 +320,29 @@ func TestFullAppSimulation(t *testing.T) { _ = os.RemoveAll(dir) }() - app := NewGaiaApp(logger, db, nil, true, 0, fauxMerkleModeOpt) + app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) require.Equal(t, "GaiaApp", app.Name()) // Run randomized simulation - _, params, simErr := 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, + ) // export state and params before the simulation error is checked - if exportStatePath != "" { - fmt.Println("Exporting app state...") - appState, _, err := app.ExportAppStateAndValidators(false, nil) - require.NoError(t, err) - - err = ioutil.WriteFile(exportStatePath, []byte(appState), 0644) + if config.ExportStatePath != "" { + err := ExportStateToJSON(app, config.ExportStatePath) require.NoError(t, err) } - if exportParamsPath != "" { - fmt.Println("Exporting simulation params...") - fmt.Println(params) - paramsBz, err := json.MarshalIndent(params, "", " ") - require.NoError(t, err) - - err = ioutil.WriteFile(exportParamsPath, paramsBz, 0644) + if config.ExportParamsPath != "" { + err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath) require.NoError(t, err) } require.NoError(t, simErr) - if commit { + if config.Commit { // for memdb: // fmt.Println("Database Size", db.Stats()["database.size"]) fmt.Println("\nGoLevelDB Stats") @@ -487,12 +352,14 @@ func TestFullAppSimulation(t *testing.T) { } func TestAppImportExport(t *testing.T) { - if !enabled { - t.Skip("Skipping application import/export simulation") + if !simapp.FlagEnabledValue { + t.Skip("skipping application import/export simulation") } var logger log.Logger - if verbose { + config := simapp.NewConfigFromFlags() + + if simapp.FlagVerboseValue { logger = log.TestingLogger() } else { logger = log.NewNopLogger() @@ -507,34 +374,29 @@ func TestAppImportExport(t *testing.T) { _ = os.RemoveAll(dir) }() - app := NewGaiaApp(logger, db, nil, true, 0, fauxMerkleModeOpt) + app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) require.Equal(t, "SimApp", app.Name()) // Run randomized simulation - _, simParams, simErr := 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, + ) // export state and simParams before the simulation error is checked - if exportStatePath != "" { - fmt.Println("Exporting app state...") - appState, _, err := app.ExportAppStateAndValidators(false, nil) - require.NoError(t, err) - - err = ioutil.WriteFile(exportStatePath, []byte(appState), 0644) + if config.ExportStatePath != "" { + err := ExportStateToJSON(app, config.ExportStatePath) require.NoError(t, err) } - if exportParamsPath != "" { - fmt.Println("Exporting simulation params...") - simParamsBz, err := json.MarshalIndent(simParams, "", " ") - require.NoError(t, err) - - err = ioutil.WriteFile(exportParamsPath, simParamsBz, 0644) + if config.ExportParamsPath != "" { + err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath) require.NoError(t, err) } require.NoError(t, simErr) - if commit { + if config.Commit { // for memdb: // fmt.Println("Database Size", db.Stats()["database.size"]) fmt.Println("\nGoLevelDB Stats") @@ -542,11 +404,11 @@ func TestAppImportExport(t *testing.T) { fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) } - fmt.Printf("Exporting genesis...\n") + fmt.Printf("exporting genesis...\n") appState, _, err := app.ExportAppStateAndValidators(false, []string{}) require.NoError(t, err) - fmt.Printf("Importing genesis...\n") + fmt.Printf("importing genesis...\n") newDir, _ := ioutil.TempDir("", "goleveldb-app-sim-2") newDB, _ := sdk.NewLevelDB("Simulation-2", dir) @@ -556,19 +418,17 @@ func TestAppImportExport(t *testing.T) { _ = os.RemoveAll(newDir) }() - newApp := NewGaiaApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt) + newApp := NewGaiaApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) require.Equal(t, "SimApp", newApp.Name()) var genesisState simapp.GenesisState err = app.cdc.UnmarshalJSON(appState, &genesisState) - if err != nil { - panic(err) - } + require.NoError(t, err) ctxB := newApp.NewContext(true, abci.Header{Height: app.LastBlockHeight()}) newApp.mm.InitGenesis(ctxB, genesisState) - fmt.Printf("Comparing stores...\n") + fmt.Printf("comparing stores...\n") ctxA := app.NewContext(true, abci.Header{Height: app.LastBlockHeight()}) type StoreKeysPrefixes struct { @@ -596,22 +456,27 @@ func TestAppImportExport(t *testing.T) { storeKeyA := storeKeysPrefix.A storeKeyB := storeKeysPrefix.B prefixes := storeKeysPrefix.Prefixes + storeA := ctxA.KVStore(storeKeyA) storeB := ctxB.KVStore(storeKeyB) - failedKVs := sdk.DiffKVStores(storeA, storeB, prefixes) - fmt.Printf("Compared %d key/value pairs between %s and %s\n", len(failedKVs)/2, storeKeyA, storeKeyB) - require.Len(t, failedKVs, 0, simapp.GetSimulationLog(storeKeyA.Name(), app.cdc, newApp.cdc, failedKVs)) - } + 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) { - if !enabled { - t.Skip("Skipping application simulation after import") + if !simapp.FlagEnabledValue { + t.Skip("skipping application simulation after import") } var logger log.Logger - if verbose { + config := simapp.NewConfigFromFlags() + + if simapp.FlagVerboseValue { logger = log.TestingLogger() } else { logger = log.NewNopLogger() @@ -625,34 +490,30 @@ func TestAppSimulationAfterImport(t *testing.T) { _ = os.RemoveAll(dir) }() - app := NewGaiaApp(logger, db, nil, true, 0, fauxMerkleModeOpt) + app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) require.Equal(t, "GaiaApp", app.Name()) // Run randomized simulation - stopEarly, params, simErr := 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, + ) // export state and params before the simulation error is checked - if exportStatePath != "" { - fmt.Println("Exporting app state...") - appState, _, err := app.ExportAppStateAndValidators(false, nil) - require.NoError(t, err) - - err = ioutil.WriteFile(exportStatePath, []byte(appState), 0644) + if config.ExportStatePath != "" { + err := ExportStateToJSON(app, config.ExportStatePath) require.NoError(t, err) } - if exportParamsPath != "" { - fmt.Println("Exporting simulation params...") - paramsBz, err := json.MarshalIndent(params, "", " ") - require.NoError(t, err) - - err = ioutil.WriteFile(exportParamsPath, paramsBz, 0644) + if config.ExportParamsPath != "" { + err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath) require.NoError(t, err) } require.NoError(t, simErr) - if commit { + if config.Commit { // for memdb: // fmt.Println("Database Size", db.Stats()["database.size"]) fmt.Println("\nGoLevelDB Stats") @@ -685,103 +546,101 @@ func TestAppSimulationAfterImport(t *testing.T) { newApp := NewGaiaApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt) require.Equal(t, "GaiaApp", newApp.Name()) + newApp.InitChain(abci.RequestInitChain{ AppStateBytes: appState, }) // Run randomized simulation on imported app - _, _, err = simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, newApp)) - require.Nil(t, err) + _, _, err = simulation.SimulateFromSeed( + 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 // and doesn't depend on the application. func TestAppStateDeterminism(t *testing.T) { - if !enabled { - t.Skip("Skipping application simulation") + if !simapp.FlagEnabledValue { + t.Skip("skipping application simulation") } + config := simapp.NewConfigFromFlags() + config.InitialBlockHeight = 1 + config.ExportParamsPath = "" + config.OnOperation = false + config.AllInvariants = false + numSeeds := 3 numTimesToRunPerSeed := 5 appHashList := make([]json.RawMessage, numTimesToRunPerSeed) for i := 0; i < numSeeds; i++ { - seed := rand.Int63() + config.Seed = rand.Int63() for j := 0; j < numTimesToRunPerSeed; j++ { logger := log.NewNopLogger() db := dbm.NewMemDB() - app := NewGaiaApp(logger, db, nil, true, 0) + app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) fmt.Printf( - "Running non-determinism simulation; seed: %d/%d (%d), attempt: %d/%d\n", - i+1, numSeeds, seed, j+1, numTimesToRunPerSeed, + "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", + config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, ) - // Run randomized simulation _, _, err := simulation.SimulateFromSeed( - t, os.Stdout, app.BaseApp, appStateFn, seed, testAndRunTxs(app), - []sdk.Invariant{}, 1, numBlocks, exportParamsHeight, - blockSize, "", false, commit, lean, - false, false, app.ModuleAccountAddrs(), + 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 appHashList[j] = appHash - } - for k := 1; k < numTimesToRunPerSeed; k++ { - require.Equal(t, appHashList[0], appHashList[k], "appHash list: %v", appHashList) + if j != 0 { + 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) { logger := log.NewNopLogger() + + config := simapp.NewConfigFromFlags() + config.AllInvariants = false + dir, _ := ioutil.TempDir("", "goleveldb-app-invariant-bench") db, _ := sdk.NewLevelDB("simulation", dir) defer func() { db.Close() - _ = os.RemoveAll(dir) + os.RemoveAll(dir) }() - app := NewGaiaApp(logger, db, nil, true, 0) - exportParams := exportParamsPath != "" + app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) // 2. Run parameterized simulation (w/o invariants) - _, params, simErr := simulation.SimulateFromSeed( - b, ioutil.Discard, app.BaseApp, appStateFn, seed, testAndRunTxs(app), - []sdk.Invariant{}, initialBlockHeight, numBlocks, exportParamsHeight, blockSize, - exportStatsPath, exportParams, commit, lean, onOperation, false, app.ModuleAccountAddrs(), + _, simParams, simErr := simulation.SimulateFromSeed( + b, ioutil.Discard, 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 exportStatePath != "" { - fmt.Println("Exporting app state...") - appState, _, err := app.ExportAppStateAndValidators(false, nil) - if err != nil { - fmt.Println(err) - b.Fail() - } - err = ioutil.WriteFile(exportStatePath, []byte(appState), 0644) - if err != nil { + if config.ExportStatePath != "" { + if err := ExportStateToJSON(app, config.ExportStatePath); err != nil { fmt.Println(err) b.Fail() } } - if exportParamsPath != "" { - fmt.Println("Exporting simulation params...") - paramsBz, err := json.MarshalIndent(params, "", " ") - if err != nil { - fmt.Println(err) - b.Fail() - } - - err = ioutil.WriteFile(exportParamsPath, paramsBz, 0644) - if err != nil { + if config.ExportParamsPath != "" { + if err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath); err != nil { fmt.Println(err) b.Fail() } @@ -801,7 +660,7 @@ func BenchmarkInvariants(b *testing.B) { for _, cr := range app.crisisKeeper.Routes() { b.Run(fmt.Sprintf("%s/%s", cr.ModuleName, cr.Route), func(b *testing.B) { 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() } }) diff --git a/app/utils.go b/app/utils.go index d6dbfe37d3..6f9350e1b7 100644 --- a/app/utils.go +++ b/app/utils.go @@ -2,38 +2,29 @@ package app import ( + "fmt" "io" + "io/ioutil" "github.com/tendermint/tendermint/libs/log" dbm "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/baseapp" + bam "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking" ) -var ( - genesisFile string - paramsFile string - exportParamsPath string - exportParamsHeight int - exportStatePath string - exportStatsPath string - seed int64 - initialBlockHeight int - 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 - genesisTime int64 -) +// ExportStateToJSON util function to export the app state to JSON +func ExportStateToJSON(app *GaiaApp, path string) error { + fmt.Println("exporting app state...") + appState, _, err := app.ExportAppStateAndValidators(false, nil) + if err != nil { + return err + } -// DONTCOVER + return ioutil.WriteFile(path, []byte(appState), 0644) +} // NewGaiaAppUNSAFE is used for debugging purposes only. // @@ -43,5 +34,5 @@ func NewGaiaAppUNSAFE(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLa ) (gapp *GaiaApp, keyMain, keyStaking *sdk.KVStoreKey, stakingKeeper staking.Keeper) { gapp = NewGaiaApp(logger, db, traceStore, loadLatest, invCheckPeriod, baseAppOptions...) - return gapp, gapp.keys[baseapp.MainStoreKey], gapp.keys[staking.StoreKey], gapp.stakingKeeper + return gapp, gapp.keys[bam.MainStoreKey], gapp.keys[staking.StoreKey], gapp.stakingKeeper } diff --git a/cli_test/test_helpers.go b/cli_test/test_helpers.go index c7ae1680a8..43c2716f78 100644 --- a/cli_test/test_helpers.go +++ b/cli_test/test_helpers.go @@ -555,7 +555,7 @@ func (f *Fixtures) QueryGovParamTallying() gov.TallyParams { func (f *Fixtures) QueryGovProposals(flags ...string) gov.Proposals { cmd := fmt.Sprintf("%s query gov proposals %v", f.GaiacliBinary, f.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{} } require.Empty(f.T, stderr) diff --git a/cmd/gaiad/main.go b/cmd/gaiad/main.go index 4564b23afb..bc442fc720 100644 --- a/cmd/gaiad/main.go +++ b/cmd/gaiad/main.go @@ -72,11 +72,19 @@ func main() { } 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.NewGaiaApp( logger, db, traceStore, true, invCheckPeriod, baseapp.SetPruning(store.NewPruningOptionsFromString(viper.GetString("pruning"))), 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), ) } diff --git a/contrib/devtools/Makefile b/contrib/devtools/Makefile index a5a8c5ef8f..c329690a7f 100644 --- a/contrib/devtools/Makefile +++ b/contrib/devtools/Makefile @@ -61,7 +61,7 @@ $(GOIMPORTS): go get golang.org/x/tools/cmd/goimports@v0.0.0-20190628034336-212fb13d595e $(RUNSIM): - go get github.com/cosmos/tools/cmd/runsim/ + go install github.com/cosmos/tools/cmd/runsim/ golangci-lint: $(GOLANGCI_LINT) diff --git a/go.mod b/go.mod index 8e7df88471..7734d017f8 100644 --- a/go.mod +++ b/go.mod @@ -1,24 +1,19 @@ module github.com/cosmos/gaia -go 1.12 +go 1.13 require ( github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect - github.com/cosmos/cosmos-sdk v0.28.2-0.20190813160135-f90d969ded97 + github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/go-kit/kit v0.9.0 // indirect github.com/golang/mock v1.3.1 // indirect - github.com/gorilla/mux v1.7.3 // indirect github.com/libp2p/go-buffer-pool v0.0.2 // indirect github.com/magiconair/properties v1.8.1 // indirect - github.com/mattn/go-isatty v0.0.8 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.1 // indirect github.com/onsi/ginkgo v1.8.0 // indirect github.com/onsi/gomega v1.5.0 // indirect github.com/otiai10/copy v1.0.1 github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776 // indirect - github.com/pelletier/go-toml v1.4.0 // indirect github.com/pkg/errors v0.8.1 github.com/prometheus/client_golang v1.1.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20190706150252-9beb055b7962 // indirect @@ -27,15 +22,13 @@ require ( github.com/spf13/afero v1.2.2 // indirect github.com/spf13/cobra v0.0.5 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/tendermint v0.32.2 + github.com/tendermint/tendermint v0.32.3 github.com/tendermint/tm-db v0.1.1 - golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect - golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect - golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect + golang.org/x/crypto v0.0.0-20190909091759-094676da4a83 // indirect + golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect golang.org/x/text v0.3.2 // indirect - google.golang.org/appengine v1.4.0 // indirect google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64 // indirect google.golang.org/grpc v1.22.1 // indirect ) diff --git a/go.sum b/go.sum index e017755f86..ed5a869f79 100644 --- a/go.sum +++ b/go.sum @@ -13,7 +13,6 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 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/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/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -39,8 +38,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-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/cosmos/cosmos-sdk v0.28.2-0.20190813160135-f90d969ded97 h1:v1/qbsNvfIWMAHEi1GwgBAVCo0NrrrV6uZkSdcIREyU= -github.com/cosmos/cosmos-sdk v0.28.2-0.20190813160135-f90d969ded97/go.mod h1:RkWDqk5VawCuk6G+Mr7kWkE+1i5oHhxdOriaRibAvPg= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb h1:VKEfR1unkvgquOUgGcuXq6gPXDd7L125MSuCSEmthNM= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb/go.mod h1:De67lt7tcfjIhSv58L/96UEdMvR3GZhOtvHntfEglDA= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -53,6 +52,7 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2 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/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= 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/etcd-io/bbolt v1.3.2/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= @@ -74,8 +74,9 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V 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/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.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/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -96,15 +97,17 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw 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/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= 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.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= 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-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/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/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= @@ -120,6 +123,7 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= 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/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= @@ -130,16 +134,14 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN 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/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/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-isatty v0.0.6/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg= +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/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -175,9 +177,7 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE 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/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0 h1:BQ53HtBmfOitExawJ6LokA4x8ov/z0SYYb0+HxJfRI8= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= @@ -186,15 +186,11 @@ 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/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-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0 h1:kRhiuYSXR3+uv2IbVbZhUxK5zVD/2pp3Gd2PpvPkpEo= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= 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/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE= @@ -206,7 +202,6 @@ github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqn github.com/rcrowley/go-metrics v0.0.0-20190706150252-9beb055b7962 h1:eUm8ma4+yPknhXtkYlWh3tMkE6gBjXZToDned9s2gbQ= github.com/rcrowley/go-metrics v0.0.0-20190706150252-9beb055b7962/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -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.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= @@ -237,22 +232,23 @@ github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/y 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/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.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 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/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/crypto v0.0.0-20180820045704-3764759f34a5 h1:u8i49c+BxloX3XQ55cvzFNXplizZP/q00i+IlttUjAU= -github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae h1:AOXNM7c2Vvo45SjAgeWF8Wy+NS7/NCqzRNpUc+HPAec= +github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= 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/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8= github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o= github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU= -github.com/tendermint/tendermint v0.32.2 h1:FvZWdksfDg/65vKKr5Lgo57keARFnmhrUEXHwyrV1QY= -github.com/tendermint/tendermint v0.32.2/go.mod h1:NwMyx58S8VJ7tEpFKqRVlVWKO9N9zjTHu+Dx96VsnOE= +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/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -274,8 +270,8 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/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/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/crypto v0.0.0-20190909091759-094676da4a83 h1:mgAKeshyNqWKdENOnQsg+8dRTwZFIwFaO3HNl52sweA= +golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -284,7 +280,6 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r 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-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -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-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -292,8 +287,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/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/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= @@ -307,21 +302,22 @@ 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-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-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa h1:KIDDMLT1O0Nr7TSxp8xM5tJcdn8tgyAONntO829og1M= -golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/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/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 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-20180917221912-90fa682c2a6e/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-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 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-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A= 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.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -333,7 +329,6 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/grpc v1.13.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 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= google.golang.org/grpc v1.22.1 h1:/7cs52RnTJmD43s3uxzlq2U7nqVTd/37viQwMrMNlOM= google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= diff --git a/sims.mk b/sims.mk index 29d2e9b5aa..2c26332fef 100644 --- a/sims.mk +++ b/sims.mk @@ -3,39 +3,40 @@ ######################################## ### Simulations +BINDIR ?= $(GOPATH)/bin SIMAPP = github.com/cosmos/gaia/app -sim-gaia-nondeterminism: +test_sim_nondeterminism: @echo "Running non-determinism test..." @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \ - -NumBlocks=100 -BlockSize=200 -Commit=true -v -timeout 24h + -NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h -sim-gaia-custom-genesis-fast: +test_sim_custom_genesis_fast: @echo "Running custom genesis simulation..." @echo "By default, ${HOME}/.gaiad/config/genesis.json will be used." @go test -mod=readonly $(SIMAPP) -run TestFullGaiaSimulation -Genesis=${HOME}/.gaiad/config/genesis.json \ -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h -sim-gaia-fast: - @echo "Running quick Gaia simulation. This may take several minutes..." - @go test -mod=readonly $(SIMAPP) -run TestFullGaiaSimulation -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h - -sim-gaia-import-export: runsim +test_sim_import_export: runsim @echo "Running Gaia import/export simulation. This may take several minutes..." - $(GOPATH)/bin/runsim $(SIMAPP) 25 5 TestGaiaImportExport + @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestGaiaImportExport -sim-gaia-simulation-after-import: runsim +test_sim_after_import: runsim @echo "Running Gaia simulation-after-import. This may take several minutes..." - $(GOPATH)/bin/runsim $(SIMAPP) 25 5 TestGaiaSimulationAfterImport + @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestGaiaSimulationAfterImport -sim-gaia-custom-genesis-multi-seed: runsim +test_sim_custom_genesis_multi_seed: runsim @echo "Running multi-seed custom genesis simulation..." @echo "By default, ${HOME}/.gaiad/config/genesis.json will be used." - $(GOPATH)/bin/runsim -g ${HOME}/.gaiad/config/genesis.json 400 5 TestFullGaiaSimulation + @$(BINDIR)/runsim -Jobs=4 -Genesis=${HOME}/.gaiad/config/genesis.json 400 5 TestFullGaiaSimulation + +test_sim_multi_seed_long: runsim + @echo "Running multi-seed application simulation. This may take awhile!" + @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 500 50 TestFullAppSimulation -sim-gaia-multi-seed: runsim - @echo "Running multi-seed Gaia simulation. This may take awhile!" - $(GOPATH)/bin/runsim $(SIMAPP) 400 5 TestFullGaiaSimulation +test_sim_multi_seed_short: runsim + @echo "Running multi-seed application simulation. This may take awhile!" + @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 50 10 TestFullAppSimulation sim-benchmark-invariants: @echo "Running simulation invariant benchmarks..." @@ -46,6 +47,7 @@ sim-benchmark-invariants: SIM_NUM_BLOCKS ?= 500 SIM_BLOCK_SIZE ?= 200 SIM_COMMIT ?= true + sim-gaia-benchmark: @echo "Running Gaia benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" @go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullGaiaSimulation$$ \ @@ -56,7 +58,6 @@ sim-gaia-profile: @go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullGaiaSimulation$$ \ -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h -cpuprofile cpu.out -memprofile mem.out - .PHONY: runsim sim-gaia-nondeterminism sim-gaia-custom-genesis-fast sim-gaia-fast sim-gaia-import-export \ sim-gaia-simulation-after-import sim-gaia-custom-genesis-multi-seed sim-gaia-multi-seed \ sim-benchmark-invariants sim-gaia-benchmark sim-gaia-profile From f35c63d67254c42e55544eb214ed23abe0294b9f Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Thu, 12 Sep 2019 15:16:11 +0200 Subject: [PATCH 017/685] Merge PR #124: devtools' Makefile cleanup --- contrib/devtools/Makefile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/contrib/devtools/Makefile b/contrib/devtools/Makefile index c329690a7f..34115ec280 100644 --- a/contrib/devtools/Makefile +++ b/contrib/devtools/Makefile @@ -17,8 +17,8 @@ endif GOPATH ?= $(shell $(GO) env GOPATH) GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com -GOLANGCI_LINT_VERSION := v1.17.1 -GOLANGCI_LINT_HASHSUM := f5fa647a12f658924d9f7d6b9628d505ab118e8e049e43272de6526053ebe08d +GOLANGCI_LINT_VERSION := v1.18.0 +GOLANGCI_LINT_HASHSUM := 8d21cc95da8d3daf8321ac40091456fc26123c964d7c2281d339d431f2f4c840 ### # Functions @@ -45,28 +45,24 @@ mkfile_dir := $(shell cd $(shell dirname $(mkfile_path)); pwd) TOOLS_DESTDIR ?= $(GOPATH)/bin GOLANGCI_LINT = $(TOOLS_DESTDIR)/golangci-lint -GOIMPORTS = $(TOOLS_DESTDIR)/goimports RUNSIM = $(TOOLS_DESTDIR)/runsim all: tools tools: tools-stamp -tools-stamp: $(GOIMPORTS) $(RUNSIM) +tools-stamp: $(RUNSIM) touch $@ $(GOLANGCI_LINT): $(mkfile_dir)/install-golangci-lint.sh bash $(mkfile_dir)/install-golangci-lint.sh $(TOOLS_DESTDIR) $(GOLANGCI_LINT_VERSION) $(GOLANGCI_LINT_HASHSUM) -$(GOIMPORTS): - go get golang.org/x/tools/cmd/goimports@v0.0.0-20190628034336-212fb13d595e - $(RUNSIM): go install github.com/cosmos/tools/cmd/runsim/ golangci-lint: $(GOLANGCI_LINT) tools-clean: - rm -f $(GOIMPORTS) $(GOLANGCI_LINT) + rm -f $(GOLANGCI_LINT) rm -f tools-stamp .PHONY: all tools tools-clean From 6970ebe19b46c726e9fd520da786b6a4d04966a9 Mon Sep 17 00:00:00 2001 From: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Date: Sun, 15 Sep 2019 03:19:46 +0300 Subject: [PATCH 018/685] Merge PR #122: Genesis Account Command + Types --- app/app.go | 10 +- app/app_test.go | 4 +- app/genesis.go | 11 ++ app/sim_test.go | 44 ++++---- cli_test/cli_test.go | 11 +- cmd/gaiad/genaccounts.go | 142 ++++++++++++++++++++++++++ cmd/gaiad/main.go | 29 +++--- cmd/gaiad/replay.go | 4 +- cmd/gaiad/testnet.go | 34 +++--- docs/genesis-state.md | 22 +--- docs/translations/cn/genesis-state.md | 16 --- docs/translations/kr/genesis.md | 16 --- go.mod | 2 +- go.sum | 9 +- lcd_test/helpers.go | 60 ++++++----- 15 files changed, 269 insertions(+), 145 deletions(-) create mode 100644 app/genesis.go create mode 100644 cmd/gaiad/genaccounts.go diff --git a/app/app.go b/app/app.go index a9c0c2400e..865dad5f71 100644 --- a/app/app.go +++ b/app/app.go @@ -19,7 +19,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/crisis" distr "github.com/cosmos/cosmos-sdk/x/distribution" - "github.com/cosmos/cosmos-sdk/x/genaccounts" "github.com/cosmos/cosmos-sdk/x/genutil" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/mint" @@ -43,7 +42,6 @@ var ( // non-dependant module elements, such as codec registration // and genesis verification. ModuleBasics = module.NewBasicManager( - genaccounts.AppModuleBasic{}, genutil.AppModuleBasic{}, auth.AppModuleBasic{}, bank.AppModuleBasic{}, @@ -182,7 +180,6 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b // NOTE: Any module instantiated in the module manager that is later modified // must be passed by reference here. app.mm = module.NewManager( - genaccounts.NewAppModule(app.accountKeeper), genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx), auth.NewAppModule(app.accountKeeper), bank.NewAppModule(app.bankKeeper, app.accountKeeper), @@ -205,9 +202,9 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. app.mm.SetOrderInitGenesis( - genaccounts.ModuleName, distr.ModuleName, staking.ModuleName, - auth.ModuleName, bank.ModuleName, slashing.ModuleName, gov.ModuleName, - mint.ModuleName, supply.ModuleName, crisis.ModuleName, genutil.ModuleName, + distr.ModuleName, staking.ModuleName, auth.ModuleName, bank.ModuleName, + slashing.ModuleName, gov.ModuleName, mint.ModuleName, supply.ModuleName, + crisis.ModuleName, genutil.ModuleName, ) app.mm.RegisterInvariants(&app.crisisKeeper) @@ -218,7 +215,6 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b // NOTE: This is not required for apps that don't use the simulator for fuzz testing // transactions. app.sm = module.NewSimulationManager( - genaccounts.NewAppModule(app.accountKeeper), auth.NewAppModule(app.accountKeeper), bank.NewAppModule(app.bankKeeper, app.accountKeeper), supply.NewAppModule(app.supplyKeeper, app.accountKeeper), diff --git a/app/app_test.go b/app/app_test.go index 1388fe02e3..7f8b971d2c 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -28,10 +28,10 @@ func TestGaiadExport(t *testing.T) { // ensure that black listed addresses are properly set in bank keeper func TestBlackListedAddrs(t *testing.T) { db := db.NewMemDB() - app := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) + gapp := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) for acc := range maccPerms { - require.True(t, app.bankKeeper.BlacklistedAddr(app.supplyKeeper.GetModuleAddress(acc))) + require.True(t, gapp.bankKeeper.BlacklistedAddr(gapp.supplyKeeper.GetModuleAddress(acc))) } } diff --git a/app/genesis.go b/app/genesis.go new file mode 100644 index 0000000000..97258ac992 --- /dev/null +++ b/app/genesis.go @@ -0,0 +1,11 @@ +package app + +import "encoding/json" + +// GenesisState defines a type alias for the Gaia genesis application state. +type GenesisState map[string]json.RawMessage + +// NewDefaultGenesisState generates the default state for the application. +func NewDefaultGenesisState() GenesisState { + return ModuleBasics.DefaultGenesis() +} diff --git a/app/sim_test.go b/app/sim_test.go index 00273beed9..2924d24f3e 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -261,18 +261,18 @@ func BenchmarkFullAppSimulation(b *testing.B) { _ = os.RemoveAll(dir) }() - app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) + gapp := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) // Run randomized simulation // TODO: parameterize numbers, save for a later PR _, simParams, simErr := simulation.SimulateFromSeed( - b, os.Stdout, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), - testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, + b, os.Stdout, gapp.BaseApp, simapp.AppStateFn(gapp.Codec(), gapp.sm), + testAndRunTxs(gapp, config), gapp.ModuleAccountAddrs(), config, ) // export state and params before the simulation error is checked if config.ExportStatePath != "" { - if err := ExportStateToJSON(app, config.ExportStatePath); err != nil { + if err := ExportStateToJSON(gapp, config.ExportStatePath); err != nil { fmt.Println(err) b.Fail() } @@ -320,18 +320,18 @@ func TestFullAppSimulation(t *testing.T) { _ = os.RemoveAll(dir) }() - app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) - require.Equal(t, "GaiaApp", app.Name()) + gapp := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) + require.Equal(t, "GaiaApp", gapp.Name()) // Run randomized simulation _, simParams, simErr := simulation.SimulateFromSeed( - t, os.Stdout, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), - testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, + t, os.Stdout, gapp.BaseApp, simapp.AppStateFn(gapp.Codec(), gapp.sm), + testAndRunTxs(gapp, config), gapp.ModuleAccountAddrs(), config, ) // export state and params before the simulation error is checked if config.ExportStatePath != "" { - err := ExportStateToJSON(app, config.ExportStatePath) + err := ExportStateToJSON(gapp, config.ExportStatePath) require.NoError(t, err) } @@ -490,19 +490,19 @@ func TestAppSimulationAfterImport(t *testing.T) { _ = os.RemoveAll(dir) }() - app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) - require.Equal(t, "GaiaApp", app.Name()) + gapp := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) + require.Equal(t, "GaiaApp", gapp.Name()) // Run randomized simulation // 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, + t, os.Stdout, gapp.BaseApp, simapp.AppStateFn(gapp.Codec(), gapp.sm), + testAndRunTxs(gapp, config), gapp.ModuleAccountAddrs(), config, ) // export state and params before the simulation error is checked if config.ExportStatePath != "" { - err := ExportStateToJSON(app, config.ExportStatePath) + err := ExportStateToJSON(gapp, config.ExportStatePath) require.NoError(t, err) } @@ -529,7 +529,7 @@ func TestAppSimulationAfterImport(t *testing.T) { fmt.Printf("Exporting genesis...\n") - appState, _, err := app.ExportAppStateAndValidators(true, []string{}) + appState, _, err := gapp.ExportAppStateAndValidators(true, []string{}) if err != nil { panic(err) } @@ -553,7 +553,7 @@ func TestAppSimulationAfterImport(t *testing.T) { // Run randomized simulation on imported app _, _, err = simulation.SimulateFromSeed( - t, os.Stdout, newApp.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), + t, os.Stdout, newApp.BaseApp, simapp.AppStateFn(gapp.Codec(), gapp.sm), testAndRunTxs(newApp, config), newApp.ModuleAccountAddrs(), config, ) @@ -623,17 +623,17 @@ func BenchmarkInvariants(b *testing.B) { os.RemoveAll(dir) }() - app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) + gapp := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) // 2. Run parameterized simulation (w/o invariants) _, simParams, simErr := simulation.SimulateFromSeed( - b, ioutil.Discard, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), - testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, + b, ioutil.Discard, gapp.BaseApp, simapp.AppStateFn(gapp.Codec(), gapp.sm), + testAndRunTxs(gapp, config), gapp.ModuleAccountAddrs(), config, ) // export state and params before the simulation error is checked if config.ExportStatePath != "" { - if err := ExportStateToJSON(app, config.ExportStatePath); err != nil { + if err := ExportStateToJSON(gapp, config.ExportStatePath); err != nil { fmt.Println(err) b.Fail() } @@ -651,13 +651,13 @@ func BenchmarkInvariants(b *testing.B) { b.FailNow() } - ctx := app.NewContext(true, abci.Header{Height: app.LastBlockHeight() + 1}) + ctx := gapp.NewContext(true, abci.Header{Height: gapp.LastBlockHeight() + 1}) // 3. Benchmark each invariant separately // // NOTE: We use the crisis keeper as it has all the invariants registered with // their respective metadata which makes it useful for testing/benchmarking. - for _, cr := range app.crisisKeeper.Routes() { + for _, cr := range gapp.crisisKeeper.Routes() { b.Run(fmt.Sprintf("%s/%s", cr.ModuleName, cr.Route), func(b *testing.B) { if res, stop := cr.Invar(ctx); stop { fmt.Printf("broken invariant at block %d of %d\n%s", ctx.BlockHeight()-1, config.NumBlocks, res) diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index 971f588146..b4a5aed8a2 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -25,7 +25,6 @@ import ( "github.com/cosmos/cosmos-sdk/tests" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/genaccounts" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/mint" ) @@ -1272,12 +1271,12 @@ func TestGaiadAddGenesisAccount(t *testing.T) { genesisState := f.GenesisState() cdc := app.MakeCodec() - accounts := genaccounts.GetGenesisStateFromAppState(cdc, genesisState) + accounts := auth.GetGenesisStateFromAppState(cdc, genesisState).Accounts - require.Equal(t, accounts[0].Address, f.KeyAddress(keyFoo)) - require.Equal(t, accounts[1].Address, f.KeyAddress(keyBar)) - require.True(t, accounts[0].Coins.IsEqual(startCoins)) - require.True(t, accounts[1].Coins.IsEqual(bazCoins)) + 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() diff --git a/cmd/gaiad/genaccounts.go b/cmd/gaiad/genaccounts.go new file mode 100644 index 0000000000..5c8192dee6 --- /dev/null +++ b/cmd/gaiad/genaccounts.go @@ -0,0 +1,142 @@ +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 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 +} diff --git a/cmd/gaiad/main.go b/cmd/gaiad/main.go index bc442fc720..2be4370ae2 100644 --- a/cmd/gaiad/main.go +++ b/cmd/gaiad/main.go @@ -20,13 +20,11 @@ import ( "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/genaccounts" - genaccscli "github.com/cosmos/cosmos-sdk/x/genaccounts/client/cli" + "github.com/cosmos/cosmos-sdk/x/auth" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" "github.com/cosmos/cosmos-sdk/x/staking" ) -// gaiad custom flags const flagInvCheckPeriod = "inv-check-period" var invCheckPeriod uint @@ -49,14 +47,18 @@ func main() { } 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.GenTxCmd(ctx, cdc, app.ModuleBasics, staking.AppModuleBasic{}, - genaccounts.AppModuleBasic{}, app.DefaultNodeHome, app.DefaultCLIHome)) + rootCmd.AddCommand( + genutilcli.GenTxCmd( + ctx, cdc, app.ModuleBasics, staking.AppModuleBasic{}, + auth.GenesisAccountIterator{}, app.DefaultNodeHome, app.DefaultCLIHome, + ), + ) 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(testnetCmd(ctx, cdc, app.ModuleBasics, genaccounts.AppModuleBasic{})) + rootCmd.AddCommand(testnetCmd(ctx, cdc, app.ModuleBasics, auth.GenesisAccountIterator{})) rootCmd.AddCommand(replayCmd()) server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators) @@ -93,13 +95,14 @@ func exportAppStateAndTMValidators( ) (json.RawMessage, []tmtypes.GenesisValidator, error) { if height != -1 { - gApp := app.NewGaiaApp(logger, db, traceStore, false, uint(1)) - err := gApp.LoadHeight(height) + gapp := app.NewGaiaApp(logger, db, traceStore, false, uint(1)) + err := gapp.LoadHeight(height) if err != nil { return nil, nil, err } - return gApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) + return gapp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) } - gApp := app.NewGaiaApp(logger, db, traceStore, true, uint(1)) - return gApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) + + gapp := app.NewGaiaApp(logger, db, traceStore, true, uint(1)) + return gapp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) } diff --git a/cmd/gaiad/replay.go b/cmd/gaiad/replay.go index 934f7340b7..5e161d0578 100644 --- a/cmd/gaiad/replay.go +++ b/cmd/gaiad/replay.go @@ -92,7 +92,7 @@ func replayTxs(rootDir string) error { // Application fmt.Fprintln(os.Stderr, "Creating application") - myapp := app.NewGaiaApp( + gapp := app.NewGaiaApp( ctx.Logger, appDB, traceStoreWriter, true, uint(1), baseapp.SetPruning(store.PruneEverything), // nothing ) @@ -109,7 +109,7 @@ func replayTxs(rootDir string) error { } // tmsm.SaveState(tmDB, genState) - cc := proxy.NewLocalClientCreator(myapp) + cc := proxy.NewLocalClientCreator(gapp) proxyApp := proxy.NewAppConns(cc) err = proxyApp.Start() if err != nil { diff --git a/cmd/gaiad/testnet.go b/cmd/gaiad/testnet.go index c7cef604aa..53a56f07ad 100644 --- a/cmd/gaiad/testnet.go +++ b/cmd/gaiad/testnet.go @@ -26,7 +26,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/genaccounts" + authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/staking" @@ -114,8 +114,8 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, gaiaConfig.MinGasPrices = minGasPrices var ( - accs []genaccounts.GenesisAccount - genFiles []string + genAccounts []authexported.GenesisAccount + genFiles []string ) // generate private keys, node IDs, and initial transactions @@ -193,13 +193,11 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, accTokens := sdk.TokensFromConsensusPower(1000) accStakingTokens := sdk.TokensFromConsensusPower(500) - accs = append(accs, genaccounts.GenesisAccount{ - Address: addr, - Coins: sdk.Coins{ - sdk.NewCoin(fmt.Sprintf("%stoken", nodeDirName), accTokens), - sdk.NewCoin(sdk.DefaultBondDenom, accStakingTokens), - }, - }) + coins := sdk.Coins{ + sdk.NewCoin(fmt.Sprintf("%stoken", nodeDirName), accTokens), + sdk.NewCoin(sdk.DefaultBondDenom, accStakingTokens), + } + genAccounts = append(genAccounts, auth.NewBaseAccount(addr, coins.Sort(), nil, 0, 0)) valTokens := sdk.TokensFromConsensusPower(100) msg := staking.NewMsgCreateValidator( @@ -210,10 +208,12 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, staking.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), sdk.OneInt(), ) + kb, err := keys.NewKeyBaseFromDir(clientDir) if err != nil { return err } + tx := auth.NewStdTx([]sdk.Msg{msg}, auth.StdFee{}, []auth.StdSignature{}, memo) txBldr := auth.NewTxBuilderFromCLI().WithChainID(chainID).WithMemo(memo).WithKeybase(kb) @@ -241,7 +241,7 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, srvconfig.WriteConfigFile(gaiaConfigFilePath, gaiaConfig) } - if err := initGenFiles(cdc, mbm, chainID, accs, genFiles, numValidators); err != nil { + if err := initGenFiles(cdc, mbm, chainID, genAccounts, genFiles, numValidators); err != nil { return err } @@ -257,13 +257,19 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, return nil } -func initGenFiles(cdc *codec.Codec, mbm module.BasicManager, chainID string, - accs []genaccounts.GenesisAccount, genFiles []string, numValidators int) error { +func initGenFiles( + cdc *codec.Codec, mbm module.BasicManager, chainID string, + genAccounts []authexported.GenesisAccount, genFiles []string, numValidators int, +) error { appGenState := mbm.DefaultGenesis() // set the accounts in the genesis state - appGenState = genaccounts.SetGenesisStateInAppState(cdc, appGenState, accs) + authDataBz := appGenState[auth.ModuleName] + var authGenState auth.GenesisState + cdc.MustUnmarshalJSON(authDataBz, &authGenState) + authGenState.Accounts = genAccounts + appGenState[auth.ModuleName] = cdc.MustMarshalJSON(authGenState) appGenStateJSON, err := codec.MarshalJSONIndent(cdc, appGenState) if err != nil { diff --git a/docs/genesis-state.md b/docs/genesis-state.md index fdd2628394..f73d8583d3 100644 --- a/docs/genesis-state.md +++ b/docs/genesis-state.md @@ -9,7 +9,6 @@ The Gaia genesis state is defined as follows: ```go type GenesisState struct { - Accounts []GenesisAccount `json:"accounts"` AuthData auth.GenesisState `json:"auth"` BankData bank.GenesisState `json:"bank"` StakingData staking.GenesisState `json:"staking"` @@ -27,23 +26,10 @@ which internally calls each module's `InitGenesis` providing its own respective ## Accounts -Genesis accounts defined in the `GenesisState` are defined as follows: - -```go -type GenesisAccount struct { - Address sdk.AccAddress `json:"address"` - Coins sdk.Coins `json:"coins"` - Sequence uint64 `json:"sequence_number"` - AccountNumber uint64 `json:"account_number"` - - // vesting account fields - OriginalVesting sdk.Coins `json:"original_vesting"` // total vesting coins upon initialization - DelegatedFree sdk.Coins `json:"delegated_free"` // delegated vested coins at time of delegation - DelegatedVesting sdk.Coins `json:"delegated_vesting"` // delegated vesting coins at time of delegation - StartTime int64 `json:"start_time"` // vesting start time (UNIX Epoch time) - EndTime int64 `json:"end_time"` // vesting end time (UNIX Epoch time) -} -``` +Genesis accounts are defined in the `GenesisState` of the `x/auth` module and +exist under the `accounts` key. There is no single concrete implementation of a +genesis account but they all implement the `GenesisAccount` interface defined by +`x/auth`. Each account must have a valid and unique account number in addition to a sequence number (nonce) and address. diff --git a/docs/translations/cn/genesis-state.md b/docs/translations/cn/genesis-state.md index 168d434ee6..07831e1bbe 100644 --- a/docs/translations/cn/genesis-state.md +++ b/docs/translations/cn/genesis-state.md @@ -2,22 +2,6 @@ Gaia 创世状态`GenesisState`由账户、各种模块状态和元数据组成,例如创世交易。 每个模块可以指定自己的`GenesisState`。 此外,每个模块可以指定自己的创世状态有效性验证、导入和导出功能。 -Gaia 创世状态定义如下: - -```go -type GenesisState struct { - Accounts []GenesisAccount `json:"accounts"` - AuthData auth.GenesisState `json:"auth"` - BankData bank.GenesisState `json:"bank"` - StakingData staking.GenesisState `json:"staking"` - MintData mint.GenesisState `json:"mint"` - DistrData distr.GenesisState `json:"distribution"` - GovData gov.GenesisState `json:"gov"` - SlashingData slashing.GenesisState `json:"slashing"` - GenTxs []json.RawMessage `json:"gentxs"` -} -``` - 在 Gaia 的 ABCI`initChainer`定义中调用`initFromGenesisState`,它在内部调用每个模块的`InitGenesis`,提供它自己的`GenesisState`作为参数。 ## 账户(Accounts) diff --git a/docs/translations/kr/genesis.md b/docs/translations/kr/genesis.md index 7dd9384f5d..6fa981a8ab 100644 --- a/docs/translations/kr/genesis.md +++ b/docs/translations/kr/genesis.md @@ -2,22 +2,6 @@ Gaia의 제네시스 스테이트인 `GenesisState`는 계정 정보, 모듈 스테이트 그리고 제네시스 트랜잭션 같은 메타데이터 등으로 구성됩니다. 각 모듈은 각자의 `GenesisState`를 지정할 수 있습니다. 또한, 각 모듈은 각자의 제네시스 스테이트 검증, 임포트, 엑스포트 기능 등을 지정할 수 있습니다. -Gaia 제네시스 스테이트는 다음과 같이 정의됩니다: - -```go -type GenesisState struct { - Accounts []GenesisAccount `json:"accounts"` - AuthData auth.GenesisState `json:"auth"` - BankData bank.GenesisState `json:"bank"` - StakingData staking.GenesisState `json:"staking"` - MintData mint.GenesisState `json:"mint"` - DistrData distr.GenesisState `json:"distr"` - GovData gov.GenesisState `json:"gov"` - SlashingData slashing.GenesisState `json:"slashing"` - GenTxs []json.RawMessage `json:"gentxs"` -} -``` - ABCI `initChainer`에서는 Gaia의 `initFromGenesisState`를 기반으로 각 모듈의 `InitGenesis`를 호출해 각 모듈들의 `GenesisState`를 파라미터 값으로 불러옵니다. ## 계정 diff --git a/go.mod b/go.mod index 7734d017f8..b0befef6fc 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.13 require ( github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect - github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb + github.com/cosmos/cosmos-sdk v0.34.4-0.20190913222629-1028283e6fc1 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/go-kit/kit v0.9.0 // indirect github.com/golang/mock v1.3.1 // indirect diff --git a/go.sum b/go.sum index ed5a869f79..92855c6e1d 100644 --- a/go.sum +++ b/go.sum @@ -38,8 +38,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-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/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb h1:VKEfR1unkvgquOUgGcuXq6gPXDd7L125MSuCSEmthNM= -github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb/go.mod h1:De67lt7tcfjIhSv58L/96UEdMvR3GZhOtvHntfEglDA= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190913222629-1028283e6fc1 h1:nvpz1FYhr4GPneKZrrIyZ5leN1p+fVeGeMp+kvku79Q= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190913222629-1028283e6fc1/go.mod h1:WFgmzqlpCWWhon5UF59Nu3olrxCUB3+S/GzTeUyfs1U= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -74,6 +74,7 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V 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/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.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= @@ -100,6 +101,7 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= 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.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= 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= @@ -168,6 +170,7 @@ github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776/go.mod h1:3HNVkVOU7vZ github.com/otiai10/mint v1.2.3/go.mod h1:YnfyPNhBvnY8bW4SGQHCs/aAFhkgySlMZbrF5U0bOVw= github.com/otiai10/mint v1.2.4 h1:DxYL0itZyPaR5Z9HILdxSoHx+gNs6Yx+neOGS3IVUk0= github.com/otiai10/mint v1.2.4/go.mod h1:d+b7n/0R3tdyUYYylALXpWQ/kTN+QobSq/4SRGBkR3M= +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.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= @@ -303,6 +306,7 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h 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-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/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= @@ -319,6 +323,7 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= diff --git a/lcd_test/helpers.go b/lcd_test/helpers.go index dd6acccd73..28ed3a2446 100644 --- a/lcd_test/helpers.go +++ b/lcd_test/helpers.go @@ -10,27 +10,27 @@ import ( "sort" "strings" + "github.com/pkg/errors" + "github.com/spf13/viper" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/lcd" "github.com/cosmos/cosmos-sdk/codec" crkeys "github.com/cosmos/cosmos-sdk/crypto/keys" "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/store" "github.com/cosmos/cosmos-sdk/tests" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" + authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/crisis" distr "github.com/cosmos/cosmos-sdk/x/distribution" - "github.com/cosmos/cosmos-sdk/x/genaccounts" "github.com/cosmos/cosmos-sdk/x/genutil" "github.com/cosmos/cosmos-sdk/x/mint" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/supply" - "github.com/pkg/errors" - "github.com/spf13/viper" tmcfg "github.com/tendermint/tendermint/config" "github.com/tendermint/tendermint/crypto" @@ -47,7 +47,7 @@ import ( tmtypes "github.com/tendermint/tendermint/types" dbm "github.com/tendermint/tm-db" - gapp "github.com/cosmos/gaia/app" + "github.com/cosmos/gaia/app" ) // TODO: Make InitializeTestLCD safe to call in multiple tests at the same time @@ -70,8 +70,8 @@ func InitializeLCD(nValidators int, initAddrs []sdk.AccAddress, minting bool, po logger = log.NewFilter(logger, log.AllowError()) db := dbm.NewMemDB() - app := gapp.NewGaiaApp(logger, db, nil, true, 0, baseapp.SetPruning(store.PruneNothing)) - cdc = gapp.MakeCodec() + gapp := app.NewGaiaApp(logger, db, nil, true, 0, baseapp.SetPruning(store.PruneNothing)) + cdc = app.MakeCodec() genDoc, valConsPubKeys, valOperAddrs, privVal, err := defaultGenesis(config, nValidators, initAddrs, minting) if err != nil { @@ -96,7 +96,7 @@ func InitializeLCD(nValidators int, initAddrs []sdk.AccAddress, minting bool, po // TODO Set to false once the upstream Tendermint proof verification issue is fixed. viper.Set(client.FlagTrustNode, true) - node, err := startTM(config, logger, genDoc, privVal, app) + node, err := startTM(config, logger, genDoc, privVal, gapp) if err != nil { return } @@ -151,7 +151,7 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd // append any additional (non-proposing) validators var genTxs []auth.StdTx - var accs []genaccounts.GenesisAccount + var genAccounts []authexported.GenesisAccount totalSupply := sdk.ZeroInt() @@ -165,6 +165,7 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd pubKey = ed25519.GenPrivKey().PubKey() power = 1 } + startTokens := sdk.TokensFromConsensusPower(power) msg := staking.NewMsgCreateValidator( @@ -175,29 +176,32 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd staking.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), sdk.OneInt(), ) + stdSignMsg := auth.StdSignMsg{ ChainID: genDoc.ChainID, Msgs: []sdk.Msg{msg}, } + var sig []byte sig, err = operPrivKey.Sign(stdSignMsg.Bytes()) if err != nil { return } + transaction := auth.NewStdTx([]sdk.Msg{msg}, auth.StdFee{}, []auth.StdSignature{{Signature: sig, PubKey: operPrivKey.PubKey()}}, "") genTxs = append(genTxs, transaction) valConsPubKeys = append(valConsPubKeys, pubKey) valOperAddrs = append(valOperAddrs, sdk.ValAddress(operAddr)) - accAuth := auth.NewBaseAccountWithAddress(sdk.AccAddress(operAddr)) + account := auth.NewBaseAccountWithAddress(sdk.AccAddress(operAddr)) accTokens := sdk.TokensFromConsensusPower(150) totalSupply = totalSupply.Add(accTokens) - accAuth.Coins = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, accTokens)) - accs = append(accs, genaccounts.NewGenesisAccount(&accAuth)) + account.Coins = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, accTokens)) + genAccounts = append(genAccounts, &account) } - genesisState := simapp.NewDefaultGenesisState() + genesisState := app.NewDefaultGenesisState() genDoc.AppState, err = cdc.MarshalJSON(genesisState) if err != nil { return @@ -208,21 +212,28 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd return } - // add some tokens to init accounts - stakingDataBz := genesisState[staking.ModuleName] - var stakingData staking.GenesisState - cdc.MustUnmarshalJSON(stakingDataBz, &stakingData) - // add some tokens to init accounts for _, addr := range initAddrs { accAuth := auth.NewBaseAccountWithAddress(addr) accTokens := sdk.TokensFromConsensusPower(100) accAuth.Coins = sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, accTokens)} totalSupply = totalSupply.Add(accTokens) - acc := genaccounts.NewGenesisAccount(&accAuth) - accs = append(accs, acc) + + genAccounts = append(genAccounts, &accAuth) } + // auth genesis state: params and genesis accounts + authDataBz := genesisState[auth.ModuleName] + var authGenState auth.GenesisState + cdc.MustUnmarshalJSON(authDataBz, &authGenState) + authGenState.Accounts = genAccounts + genesisState[auth.ModuleName] = cdc.MustMarshalJSON(authGenState) + + stakingDataBz := genesisState[staking.ModuleName] + var stakingData staking.GenesisState + cdc.MustUnmarshalJSON(stakingDataBz, &stakingData) + genesisState[staking.ModuleName] = cdc.MustMarshalJSON(stakingData) + // distr data distrDataBz := genesisState[distr.ModuleName] var distrData distr.GenesisState @@ -233,10 +244,6 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd distrDataBz = cdc.MustMarshalJSON(distrData) genesisState[distr.ModuleName] = distrDataBz - // staking and genesis accounts - genesisState[staking.ModuleName] = cdc.MustMarshalJSON(stakingData) - genesisState[genaccounts.ModuleName] = cdc.MustMarshalJSON(accs) - // supply data supplyDataBz := genesisState[supply.ModuleName] var supplyData supply.GenesisState @@ -289,6 +296,7 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd if err != nil { return } + genDoc.AppState = appState return } @@ -300,7 +308,7 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd // TODO: Clean up the WAL dir or enable it to be not persistent! func startTM( tmcfg *tmcfg.Config, logger log.Logger, genDoc *tmtypes.GenesisDoc, - privVal tmtypes.PrivValidator, app *gapp.GaiaApp, + privVal tmtypes.PrivValidator, app *app.GaiaApp, ) (*nm.Node, error) { genDocProvider := func() (*tmtypes.GenesisDoc, error) { return genDoc, nil } @@ -350,7 +358,7 @@ func startLCD(logger log.Logger, listenAddr string, cdc *codec.Codec) (net.Liste func registerRoutes(rs *lcd.RestServer) { client.RegisterRoutes(rs.CliCtx, rs.Mux) authrest.RegisterTxRoutes(rs.CliCtx, rs.Mux) - gapp.ModuleBasics.RegisterRESTRoutes(rs.CliCtx, rs.Mux) + app.ModuleBasics.RegisterRESTRoutes(rs.CliCtx, rs.Mux) } var cdc = codec.New() From b4728108f1cbcf2347301a450ac26b74ea857b05 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Tue, 17 Sep 2019 19:07:46 +0100 Subject: [PATCH 019/685] Merge PR #125: Standardize and cleanup makefile --- .circleci/config.yml | 94 ++++++++++++++++++++++---------------------- Makefile | 17 ++++---- sims.mk | 26 ++++++------ 3 files changed, 68 insertions(+), 69 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bc64953cc7..11a66e1fdc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,7 +53,7 @@ commands: echo 'export GO111MODULE=on' jobs: - setup_dependencies: + setup-dependencies: executor: golang steps: - checkout @@ -93,42 +93,42 @@ jobs: paths: - "." - test_sim_nondeterminism: + test-sim-nondeterminism: executor: golang steps: - make: - target: test_sim_nondeterminism + target: test-sim-nondeterminism description: "Test Gaia non-determinism simulations" - test_sim_import_export: + test-sim-import-export: executor: golang steps: - make: - target: test_sim_import_export + target: test-sim-import-export description: "Test Gaia import/export simulation" - test_sim_after_import: + test-sim-after-import: executor: golang steps: - make: - target: test_sim_after_import + target: test-sim-after-import description: "Test Gaia simulation after importing state" - test_sim_multi_seed_short: + test-sim-multi-seed-short: executor: golang steps: - make: - target: test_sim_multi_seed_short + target: test-sim-multi-seed-short description: "Test Gaia multi-seed simulation (short-lived)" - test_sim_multi_seed_long: + test-sim-multi-seed-long: executor: golang steps: - make: - target: test_sim_multi_seed_long + target: test-sim-multi-seed-long description: "Test Gaia multi-seed simulation (long-lived)" - integration_tests: + integration-tests: executor: golang steps: - checkout @@ -139,9 +139,9 @@ jobs: name: Test CLI integration command: | export BUILDDIR=`pwd`/build - make check-build + make test-build - test_cover: + test-cover: executor: golang parallelism: 4 steps: @@ -166,7 +166,7 @@ jobs: - store_artifacts: path: /tmp/logs - upload_coverage: + upload-coverage: executor: golang steps: - attach_workspace: @@ -223,7 +223,7 @@ jobs: make localnet-start ./contrib/localnet-blocks-test.sh 40 5 10 localhost - deploy_docs: + deploy-docs: executor: docs steps: - checkout @@ -247,7 +247,7 @@ jobs: echo "Website build started" fi - macos_ci: + macos-ci: executor: mac steps: - mac_set_env @@ -269,14 +269,14 @@ jobs: - run: name: Integration tests command: source $BASH_ENV - make check-build + make test-build - run: name: Test full gaia simulation command: | source $BASH_ENV make sim-gaia-fast - docker_image: + docker-image: executor: golang steps: - attach_workspace: @@ -299,7 +299,7 @@ jobs: docker push tendermint/gaia:$GAIAD_VERSION fi - docker_tagged: + docker-tagged: executor: golang steps: - attach_workspace: @@ -312,7 +312,7 @@ jobs: docker login --password-stdin -u $DOCKER_USER \<<$DOCKER_PASS docker push tendermint/gaia:$CIRCLE_TAG - reproducible_builds: + reproducible-builds: executor: golang steps: - attach_workspace: @@ -362,10 +362,10 @@ workflows: version: 2 test-suite: jobs: - - docker_image: + - docker-image: requires: - - setup_dependencies - - docker_tagged: + - setup-dependencies + - docker-tagged: filters: tags: only: @@ -374,43 +374,43 @@ workflows: ignore: - /.*/ requires: - - setup_dependencies - - macos_ci: + - setup-dependencies + - macos-ci: filters: branches: only: - master - develop - - deploy_docs: + - deploy-docs: filters: branches: only: - master - develop - - setup_dependencies: + - setup-dependencies: # filters here are needed to enable this job also for tags filters: tags: only: - /^v.*/ - - integration_tests: + - integration-tests: requires: - - setup_dependencies - - test_sim_nondeterminism: + - setup-dependencies + - test-sim-nondeterminism: requires: - - setup_dependencies - - test_sim_import_export: + - setup-dependencies + - test-sim-import-export: requires: - - setup_dependencies - - test_sim_after_import: + - setup-dependencies + - test-sim-after-import: requires: - - setup_dependencies - - test_sim_multi_seed_short: + - setup-dependencies + - test-sim-multi-seed-short: requires: - - setup_dependencies - - test_sim_multi_seed_long: + - setup-dependencies + - test-sim-multi-seed-long: requires: - - setup_dependencies + - setup-dependencies # These filters ensure that the long sim only runs during release filters: branches: @@ -418,20 +418,20 @@ workflows: tags: only: - /^v.*/ - - test_cover: + - test-cover: requires: - - setup_dependencies + - setup-dependencies - localnet - - upload_coverage: + - upload-coverage: requires: - - test_cover - - reproducible_builds: + - test-cover + - reproducible-builds: filters: branches: only: - master requires: - - setup_dependencies + - setup-dependencies # - contract_tests: # requires: -# - setup_dependencies +# - setup-dependencies diff --git a/Makefile b/Makefile index 9b6854b7f6..0df09ade34 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,7 @@ else go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests ./cmd/contract_tests endif -install: go.sum check-ledger +install: go.sum go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiad go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiacli @@ -119,19 +119,19 @@ distclean: clean ### Testing -check: check-unit check-build -check-all: check check-race check-cover +test: test-unit test-build +test-all: check test-race test-cover -check-unit: +test-unit: @VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock' ./... -check-race: +test-race: @VERSION=$(VERSION) go test -mod=readonly -race -tags='ledger test_ledger_mock' ./... -check-cover: +test-cover: @go test -mod=readonly -timeout 30m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' ./... -check-build: build +test-build: build @go test -mod=readonly -p 4 `go list ./cli_test/...` -tags=cli_test -v @@ -193,5 +193,4 @@ include sims.mk .PHONY: all build-linux install install-debug \ go-mod-cache draw-deps clean build \ setup-transactions setup-contract-tests-data start-gaia run-lcd-contract-tests contract-tests \ - check check-all check-build check-cover check-ledger check-unit check-race - + test test-all test-build test-cover test-unit test-race diff --git a/sims.mk b/sims.mk index 2c26332fef..70e094833f 100644 --- a/sims.mk +++ b/sims.mk @@ -6,39 +6,39 @@ BINDIR ?= $(GOPATH)/bin SIMAPP = github.com/cosmos/gaia/app -test_sim_nondeterminism: +test-sim-nondeterminism: @echo "Running non-determinism test..." @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \ -NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h -test_sim_custom_genesis_fast: +test-sim-custom-genesis-fast: @echo "Running custom genesis simulation..." @echo "By default, ${HOME}/.gaiad/config/genesis.json will be used." @go test -mod=readonly $(SIMAPP) -run TestFullGaiaSimulation -Genesis=${HOME}/.gaiad/config/genesis.json \ -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h -test_sim_import_export: runsim +test-sim-import-export: runsim @echo "Running Gaia import/export simulation. This may take several minutes..." @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestGaiaImportExport -test_sim_after_import: runsim +test-sim-after-import: runsim @echo "Running Gaia simulation-after-import. This may take several minutes..." @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestGaiaSimulationAfterImport -test_sim_custom_genesis_multi_seed: runsim +test-sim-custom-genesis-multi-seed: runsim @echo "Running multi-seed custom genesis simulation..." @echo "By default, ${HOME}/.gaiad/config/genesis.json will be used." @$(BINDIR)/runsim -Jobs=4 -Genesis=${HOME}/.gaiad/config/genesis.json 400 5 TestFullGaiaSimulation -test_sim_multi_seed_long: runsim +test-sim-multi-seed-long: runsim @echo "Running multi-seed application simulation. This may take awhile!" @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 500 50 TestFullAppSimulation -test_sim_multi_seed_short: runsim +test-sim-multi-seed-short: runsim @echo "Running multi-seed application simulation. This may take awhile!" @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 50 10 TestFullAppSimulation -sim-benchmark-invariants: +test-sim-benchmark-invariants: @echo "Running simulation invariant benchmarks..." @go test -mod=readonly $(SIMAPP) -benchmem -bench=BenchmarkInvariants -run=^$ \ -Enabled=true -NumBlocks=1000 -BlockSize=200 \ @@ -48,16 +48,16 @@ SIM_NUM_BLOCKS ?= 500 SIM_BLOCK_SIZE ?= 200 SIM_COMMIT ?= true -sim-gaia-benchmark: +test-sim-gaia-benchmark: @echo "Running Gaia benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" @go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullGaiaSimulation$$ \ -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h -sim-gaia-profile: +test-sim-gaia-profile: @echo "Running Gaia benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" @go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullGaiaSimulation$$ \ -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h -cpuprofile cpu.out -memprofile mem.out -.PHONY: runsim sim-gaia-nondeterminism sim-gaia-custom-genesis-fast sim-gaia-fast sim-gaia-import-export \ - sim-gaia-simulation-after-import sim-gaia-custom-genesis-multi-seed sim-gaia-multi-seed \ - sim-benchmark-invariants sim-gaia-benchmark sim-gaia-profile +.PHONY: runsim test-sim-gaia-nondeterminism test-sim-gaia-custom-genesis-fast test-sim-gaia-fast sim-gaia-import-export \ + test-sim-gaia-simulation-after-import test-sim-gaia-custom-genesis-multi-seed test-sim-gaia-multi-seed \ + test-sim-benchmark-invariants test-sim-gaia-benchmark test-sim-gaia-profile From 49990da31bf370bc96a526f20032a0b67d72ce16 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Thu, 19 Sep 2019 10:08:22 -0400 Subject: [PATCH 020/685] Merge PR #132: Bump SDK version to 01d8a230b22b --- CHANGELOG.md | 2 ++ app/app.go | 3 +-- cmd/gaiacli/main.go | 1 + go.mod | 5 +++-- go.sum | 14 ++++++++++++-- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3fb5a53a1..718355c71b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,8 @@ configuration. * (gaiad) [\#119](https://github.com/cosmos/gaia/pull/119) Add support for the `--halt-time` and `--inter-block-cache` CLI flags and configuration. +* (gaiacli) [\#132](https://github.com/cosmos/gaia/pull/132) Add `tx decode` command to decode +Base64 encoded transactions. ## [v2.0.0] - 2019-08-22 diff --git a/app/app.go b/app/app.go index 865dad5f71..9ed09e4bb0 100644 --- a/app/app.go +++ b/app/app.go @@ -150,8 +150,7 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest b app.bankKeeper = bank.NewBaseKeeper(app.accountKeeper, bankSubspace, bank.DefaultCodespace, app.ModuleAccountAddrs()) app.supplyKeeper = supply.NewKeeper(app.cdc, keys[supply.StoreKey], app.accountKeeper, app.bankKeeper, maccPerms) stakingKeeper := staking.NewKeeper( - app.cdc, keys[staking.StoreKey], tkeys[staking.TStoreKey], - app.supplyKeeper, stakingSubspace, staking.DefaultCodespace, + app.cdc, keys[staking.StoreKey], app.supplyKeeper, stakingSubspace, staking.DefaultCodespace, ) app.mintKeeper = mint.NewKeeper(app.cdc, keys[mint.StoreKey], mintSubspace, &stakingKeeper, app.supplyKeeper, auth.FeeCollectorName) app.distrKeeper = distr.NewKeeper(app.cdc, keys[distr.StoreKey], distrSubspace, &stakingKeeper, diff --git a/cmd/gaiacli/main.go b/cmd/gaiacli/main.go index 6d94f7a25d..fa215a2c10 100644 --- a/cmd/gaiacli/main.go +++ b/cmd/gaiacli/main.go @@ -117,6 +117,7 @@ func txCmd(cdc *amino.Codec) *cobra.Command { client.LineBreak, authcmd.GetBroadcastCommand(cdc), authcmd.GetEncodeCommand(cdc), + authcmd.GetDecodeCommand(cdc), client.LineBreak, ) diff --git a/go.mod b/go.mod index b0befef6fc..9d7cf4336b 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.13 require ( github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect - github.com/cosmos/cosmos-sdk v0.34.4-0.20190913222629-1028283e6fc1 + github.com/cosmos/cosmos-sdk v0.34.4-0.20190919132138-01d8a230b22b github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/go-kit/kit v0.9.0 // indirect github.com/golang/mock v1.3.1 // indirect @@ -23,9 +23,10 @@ require ( github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.4.0 github.com/stretchr/testify v1.4.0 + github.com/stumble/gorocksdb v0.0.3 // indirect github.com/tendermint/go-amino v0.15.0 github.com/tendermint/tendermint v0.32.3 - github.com/tendermint/tm-db v0.1.1 + github.com/tendermint/tm-db v0.2.0 golang.org/x/crypto v0.0.0-20190909091759-094676da4a83 // indirect golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect golang.org/x/text v0.3.2 // indirect diff --git a/go.sum b/go.sum index 92855c6e1d..0806384dc0 100644 --- a/go.sum +++ b/go.sum @@ -38,8 +38,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-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/cosmos/cosmos-sdk v0.34.4-0.20190913222629-1028283e6fc1 h1:nvpz1FYhr4GPneKZrrIyZ5leN1p+fVeGeMp+kvku79Q= -github.com/cosmos/cosmos-sdk v0.34.4-0.20190913222629-1028283e6fc1/go.mod h1:WFgmzqlpCWWhon5UF59Nu3olrxCUB3+S/GzTeUyfs1U= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190919132138-01d8a230b22b h1:+vzemThBY7WDFh+4eC6M9q8mY/dXL1l+LdbHAgbzoGs= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190919132138-01d8a230b22b/go.mod h1:hLa/KFwAexWiSpZbCTjFeJeDiKKKi5aGcswe3R7xxDw= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -58,6 +58,12 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8 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/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.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= @@ -238,6 +244,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 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/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= @@ -254,6 +262,8 @@ github.com/tendermint/tendermint v0.32.3 h1:GEnWpGQ795h5oTFNbfBLsY0LW/CW2j6p6Hti 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/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= From 08259c487d32265b0198cfe8ba96955911b98291 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 20 Sep 2019 08:57:46 -0400 Subject: [PATCH 021/685] Bump github.com/otiai10/copy from 1.0.1 to 1.0.2 (#135) Bumps [github.com/otiai10/copy](https://github.com/otiai10/copy) from 1.0.1 to 1.0.2. - [Release notes](https://github.com/otiai10/copy/releases) - [Commits](https://github.com/otiai10/copy/compare/v1.0.1...v1.0.2) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 9d7cf4336b..3676c01a19 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/magiconair/properties v1.8.1 // indirect github.com/onsi/ginkgo v1.8.0 // indirect github.com/onsi/gomega v1.5.0 // indirect - github.com/otiai10/copy v1.0.1 + github.com/otiai10/copy v1.0.2 github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776 // indirect github.com/pkg/errors v0.8.1 github.com/prometheus/client_golang v1.1.0 // indirect diff --git a/go.sum b/go.sum index 0806384dc0..97b34b092e 100644 --- a/go.sum +++ b/go.sum @@ -170,12 +170,15 @@ github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/otiai10/copy v1.0.1 h1:gtBjD8aq4nychvRZ2CyJvFWAw0aja+VHazDdruZKGZA= github.com/otiai10/copy v1.0.1/go.mod h1:8bMCJrAqOtN/d9oyh5HR7HhLQMvcGMpGdwRDYsfOCHc= +github.com/otiai10/copy v1.0.2 h1:DDNipYy6RkIkjMwy+AWzgKiNTyj2RUI9yEMeETEpVyc= +github.com/otiai10/copy v1.0.2/go.mod h1:c7RpqBkwMom4bYTSkLSym4VSJz/XtncWRAj/J4PEIMY= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776 h1:o59bHXu8Ejas8Kq6pjoVJQ9/neN66SM8AKh6wI42BBs= github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776/go.mod h1:3HNVkVOU7vZeFXocWuvtcS0XSFLcf2XUSDHkq9t1jU4= github.com/otiai10/mint v1.2.3/go.mod h1:YnfyPNhBvnY8bW4SGQHCs/aAFhkgySlMZbrF5U0bOVw= github.com/otiai10/mint v1.2.4 h1:DxYL0itZyPaR5Z9HILdxSoHx+gNs6Yx+neOGS3IVUk0= github.com/otiai10/mint v1.2.4/go.mod h1:d+b7n/0R3tdyUYYylALXpWQ/kTN+QobSq/4SRGBkR3M= +github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= 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.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= From a79a2473763a14afeb6c130cce5c9aec149e6220 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Fri, 20 Sep 2019 09:47:15 -0400 Subject: [PATCH 022/685] Merge PR #136: Sanitize Makefile runsim --- contrib/devtools/Makefile | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/contrib/devtools/Makefile b/contrib/devtools/Makefile index 34115ec280..2bd8b5c493 100644 --- a/contrib/devtools/Makefile +++ b/contrib/devtools/Makefile @@ -43,9 +43,8 @@ mkfile_dir := $(shell cd $(shell dirname $(mkfile_path)); pwd) ### TOOLS_DESTDIR ?= $(GOPATH)/bin - -GOLANGCI_LINT = $(TOOLS_DESTDIR)/golangci-lint -RUNSIM = $(TOOLS_DESTDIR)/runsim +GOLANGCI_LINT = $(TOOLS_DESTDIR)/golangci-lint +RUNSIM = $(TOOLS_DESTDIR)/runsim all: tools @@ -54,15 +53,23 @@ tools-stamp: $(RUNSIM) touch $@ $(GOLANGCI_LINT): $(mkfile_dir)/install-golangci-lint.sh - bash $(mkfile_dir)/install-golangci-lint.sh $(TOOLS_DESTDIR) $(GOLANGCI_LINT_VERSION) $(GOLANGCI_LINT_HASHSUM) - + @echo "Installing golangci-lint..." + @bash $(mkfile_dir)/install-golangci-lint.sh $(TOOLS_DESTDIR) $(GOLANGCI_LINT_VERSION) $(GOLANGCI_LINT_HASHSUM) + +# Install the runsim binary with a temporary workaround of entering an outside +# directory as the "go get" command ignores the -mod option and will polute the +# go.{mod, sum} files. +# +# ref: https://github.com/golang/go/issues/30515 $(RUNSIM): - go install github.com/cosmos/tools/cmd/runsim/ + @echo "Installing runsim..." + @(cd /tmp && go get github.com/cosmos/tools/cmd/runsim@v1.0.0) golangci-lint: $(GOLANGCI_LINT) tools-clean: rm -f $(GOLANGCI_LINT) + rm -f $(RUNSIM) rm -f tools-stamp .PHONY: all tools tools-clean From baa9364a8a0b3b632c4af9e3010c51b934419c74 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2019 08:40:06 -0700 Subject: [PATCH 023/685] Merge PR #138: Bump github.com/tendermint/tendermint from 0.32.3 to 0.32.4 * Bump github.com/tendermint/tendermint from 0.32.3 to 0.32.4 Bumps [github.com/tendermint/tendermint](https://github.com/tendermint/tendermint) from 0.32.3 to 0.32.4. - [Release notes](https://github.com/tendermint/tendermint/releases) - [Changelog](https://github.com/tendermint/tendermint/blob/master/CHANGELOG.md) - [Commits](https://github.com/tendermint/tendermint/compare/v0.32.3...v0.32.4) Signed-off-by: dependabot-preview[bot] * Update go.{mod, sum} --- go.mod | 7 +------ go.sum | 11 ++++++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 3676c01a19..6e79eaa521 100644 --- a/go.mod +++ b/go.mod @@ -6,10 +6,7 @@ require ( github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect github.com/cosmos/cosmos-sdk v0.34.4-0.20190919132138-01d8a230b22b github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect - github.com/go-kit/kit v0.9.0 // indirect github.com/golang/mock v1.3.1 // indirect - github.com/libp2p/go-buffer-pool v0.0.2 // indirect - github.com/magiconair/properties v1.8.1 // indirect github.com/onsi/ginkgo v1.8.0 // indirect github.com/onsi/gomega v1.5.0 // indirect github.com/otiai10/copy v1.0.2 @@ -17,7 +14,6 @@ require ( github.com/pkg/errors v0.8.1 github.com/prometheus/client_golang v1.1.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20190706150252-9beb055b7962 // indirect - github.com/rs/cors v1.7.0 // indirect github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa github.com/spf13/afero v1.2.2 // indirect github.com/spf13/cobra v0.0.5 @@ -25,11 +21,10 @@ require ( github.com/stretchr/testify v1.4.0 github.com/stumble/gorocksdb v0.0.3 // indirect github.com/tendermint/go-amino v0.15.0 - github.com/tendermint/tendermint v0.32.3 + github.com/tendermint/tendermint v0.32.4 github.com/tendermint/tm-db v0.2.0 golang.org/x/crypto v0.0.0-20190909091759-094676da4a83 // indirect golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect golang.org/x/text v0.3.2 // indirect google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64 // indirect - google.golang.org/grpc v1.22.1 // indirect ) diff --git a/go.sum b/go.sum index 97b34b092e..c0265b5a53 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,7 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -168,16 +169,14 @@ github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/otiai10/copy v1.0.1 h1:gtBjD8aq4nychvRZ2CyJvFWAw0aja+VHazDdruZKGZA= -github.com/otiai10/copy v1.0.1/go.mod h1:8bMCJrAqOtN/d9oyh5HR7HhLQMvcGMpGdwRDYsfOCHc= github.com/otiai10/copy v1.0.2 h1:DDNipYy6RkIkjMwy+AWzgKiNTyj2RUI9yEMeETEpVyc= github.com/otiai10/copy v1.0.2/go.mod h1:c7RpqBkwMom4bYTSkLSym4VSJz/XtncWRAj/J4PEIMY= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776 h1:o59bHXu8Ejas8Kq6pjoVJQ9/neN66SM8AKh6wI42BBs= github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776/go.mod h1:3HNVkVOU7vZeFXocWuvtcS0XSFLcf2XUSDHkq9t1jU4= -github.com/otiai10/mint v1.2.3/go.mod h1:YnfyPNhBvnY8bW4SGQHCs/aAFhkgySlMZbrF5U0bOVw= github.com/otiai10/mint v1.2.4 h1:DxYL0itZyPaR5Z9HILdxSoHx+gNs6Yx+neOGS3IVUk0= github.com/otiai10/mint v1.2.4/go.mod h1:d+b7n/0R3tdyUYYylALXpWQ/kTN+QobSq/4SRGBkR3M= +github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -263,6 +262,8 @@ github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJk 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/tendermint v0.32.4 h1:KwZIMtT+ROvfMYO3wine6F9hak3SpngcRcAIzys1J3I= +github.com/tendermint/tendermint v0.32.4/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE= 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= @@ -348,8 +349,8 @@ google.golang.org/grpc v1.13.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmE google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.22.1 h1:/7cs52RnTJmD43s3uxzlq2U7nqVTd/37viQwMrMNlOM= -google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1 h1:q4XQuHFC6I28BKZpo6IYyb3mNO+l7lSOxRuYTCiDfXk= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 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= From 3e3fae888d394d2d55ec7146984707aecdda4497 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Wed, 25 Sep 2019 16:51:12 -0700 Subject: [PATCH 024/685] Merge PR #137: Add CHANGELOG updates from v2.0.1 --- CHANGELOG.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 718355c71b..f3d1f52670 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,18 +36,25 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] -### Improvements - -* [\#119](https://github.com/cosmos/gaia/pull/119) Refactor and upgrade Circle CI -configuration. - ### Features -* (gaiad) [\#119](https://github.com/cosmos/gaia/pull/119) Add support for the `--halt-time` and -`--inter-block-cache` CLI flags and configuration. +* (gaiad) [\#119](https://github.com/cosmos/gaia/pull/119) Add support for the `--inter-block-cache` CLI +flag and configuration. * (gaiacli) [\#132](https://github.com/cosmos/gaia/pull/132) Add `tx decode` command to decode Base64 encoded transactions. +## [v2.0.1] - 2019-09-20 + +### Features + +* (gaiad) [\#119](https://github.com/cosmos/gaia/pull/119) Add support for the `--halt-time` CLI flag and configuration. + +### Improvements + +* [\#119](https://github.com/cosmos/gaia/pull/119) Refactor and upgrade Circle CI +configuration. +* (sdk) Update SDK version to v0.37.1 + ## [v2.0.0] - 2019-08-22 ### Bug Fixes @@ -116,6 +123,7 @@ not rely on the `x/supply` keeper to get module account addresses for blacklisti -[Unreleased]: https://github.com/cosmos/gaia/compare/v2.0.0...HEAD +[Unreleased]: https://github.com/cosmos/gaia/compare/v2.0.1...HEAD +[v2.0.1]: https://github.com/cosmos/gaia/releases/tag/v2.0.1 [v2.0.0]: https://github.com/cosmos/gaia/releases/tag/v2.0.0 [v1.0.0]: https://github.com/cosmos/gaia/releases/tag/v1.0.0 From 5e817641bb5256b80dab6928f45a65ba6b907786 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Thu, 26 Sep 2019 18:15:07 -0700 Subject: [PATCH 025/685] Merge PR #141: Upgrade golangci-lint to latest release (1.19.1) --- contrib/devtools/Makefile | 3 +-- contrib/devtools/install-golangci-lint.sh | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/contrib/devtools/Makefile b/contrib/devtools/Makefile index 2bd8b5c493..293cb813f9 100644 --- a/contrib/devtools/Makefile +++ b/contrib/devtools/Makefile @@ -17,7 +17,6 @@ endif GOPATH ?= $(shell $(GO) env GOPATH) GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com -GOLANGCI_LINT_VERSION := v1.18.0 GOLANGCI_LINT_HASHSUM := 8d21cc95da8d3daf8321ac40091456fc26123c964d7c2281d339d431f2f4c840 ### @@ -54,7 +53,7 @@ tools-stamp: $(RUNSIM) $(GOLANGCI_LINT): $(mkfile_dir)/install-golangci-lint.sh @echo "Installing golangci-lint..." - @bash $(mkfile_dir)/install-golangci-lint.sh $(TOOLS_DESTDIR) $(GOLANGCI_LINT_VERSION) $(GOLANGCI_LINT_HASHSUM) + @bash $(mkfile_dir)/install-golangci-lint.sh $(TOOLS_DESTDIR) $(GOLANGCI_LINT_HASHSUM) # Install the runsim binary with a temporary workaround of entering an outside # directory as the "go get" command ignores the -mod option and will polute the diff --git a/contrib/devtools/install-golangci-lint.sh b/contrib/devtools/install-golangci-lint.sh index b95713828e..427a2cf15a 100644 --- a/contrib/devtools/install-golangci-lint.sh +++ b/contrib/devtools/install-golangci-lint.sh @@ -2,19 +2,24 @@ set -euo pipefail +installer="$(mktemp)" +trap "rm -f ${installer}" EXIT + +GOBIN="${1}" +CURL="$(which curl)" +HASHSUM="${2}" + f_sha256() { local l_file l_file=$1 python -sBc "import hashlib;print(hashlib.sha256(open('$l_file','rb').read()).hexdigest())" } -installer="$(mktemp)" -trap "rm -f ${installer}" EXIT - -GOBIN="${1}" -VERSION="${2}" -HASHSUM="${3}" -CURL="$(which curl)" +get_latest_release() { + "${CURL}" --silent "https://api.github.com/repos/$1/releases/latest" | \ + grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' +} +VERSION="$(get_latest_release golangci/golangci-lint)" echo "Downloading golangci-lint ${VERSION} installer ..." >&2 "${CURL}" -sfL "https://raw.githubusercontent.com/golangci/golangci-lint/${VERSION}/install.sh" > "${installer}" From 8b97a667be0a87a3f7ffa57e65114851b2121529 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Wed, 2 Oct 2019 12:43:23 -0400 Subject: [PATCH 026/685] Merge PR #144: Bump SDK version to latest master (532ea1872) --- .circleci/config.yml | 10 ++++----- go.mod | 5 ++--- go.sum | 33 ++++++++++++++++++++++------- networks/local/gaiadnode/Dockerfile | 18 +++++++++++----- networks/local/gaiadnode/wrapper.sh | 8 +++---- 5 files changed, 47 insertions(+), 27 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 11a66e1fdc..e5ae7805d0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,11 +4,11 @@ executors: golang: docker: - image: circleci/golang:1.13 - working_directory: /go/src/github.com/cosmos/cosmos-sdk + working_directory: /go/src/github.com/cosmos/gaia mac: macos: xcode: "10.3.0" - working_directory: /Users/distiller/project/src/github.com/cosmos/cosmos-sdk + working_directory: /Users/distiller/project/src/github.com/cosmos/gaia environment: GO_VERSION: "1.13" docs: @@ -209,7 +209,7 @@ jobs: steps: - checkout - run: - name: run localnet and exit on failure + name: Run a localnet and test liveness command: | pushd /tmp wget https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz @@ -218,9 +218,7 @@ jobs: sudo mv go /usr/local popd set -x - make tools - make build-linux - make localnet-start + make clean localnet-start ./contrib/localnet-blocks-test.sh 40 5 10 localhost deploy-docs: diff --git a/go.mod b/go.mod index 6e79eaa521..f0e5f91140 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.13 require ( github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect - github.com/cosmos/cosmos-sdk v0.34.4-0.20190919132138-01d8a230b22b + github.com/cosmos/cosmos-sdk v0.34.4-0.20191002161644-532ea18724d2 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/golang/mock v1.3.1 // indirect github.com/onsi/ginkgo v1.8.0 // indirect @@ -19,9 +19,8 @@ require ( github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.4.0 github.com/stretchr/testify v1.4.0 - github.com/stumble/gorocksdb v0.0.3 // indirect github.com/tendermint/go-amino v0.15.0 - github.com/tendermint/tendermint v0.32.4 + github.com/tendermint/tendermint v0.32.5 github.com/tendermint/tm-db v0.2.0 golang.org/x/crypto v0.0.0-20190909091759-094676da4a83 // indirect golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect diff --git a/go.sum b/go.sum index c0265b5a53..73b285c1b1 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,8 @@ bou.ke/monkey v1.0.1 h1:zEMLInw9xvNakzUUPjfS4Ds6jYPqCFx3m7bRmG5NH2U= bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg= 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/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -39,8 +41,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-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/cosmos/cosmos-sdk v0.34.4-0.20190919132138-01d8a230b22b h1:+vzemThBY7WDFh+4eC6M9q8mY/dXL1l+LdbHAgbzoGs= -github.com/cosmos/cosmos-sdk v0.34.4-0.20190919132138-01d8a230b22b/go.mod h1:hLa/KFwAexWiSpZbCTjFeJeDiKKKi5aGcswe3R7xxDw= +github.com/cosmos/cosmos-sdk v0.34.4-0.20191002161644-532ea18724d2 h1:Nkjruzu7lfS7pJkX1KwXXezqS5fUfl2mXBcmxXBGAnM= +github.com/cosmos/cosmos-sdk v0.34.4-0.20191002161644-532ea18724d2/go.mod h1:tqwT2CRtU5MUGJixicDH30WggsyXdnmujmO9bFREeVc= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -49,6 +51,8 @@ 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/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= 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 v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -56,6 +60,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= 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/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.3 h1:gSJmxrs37LgTqR/oyJBWok6k6SvXEUerFTbltIhXkBM= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= @@ -80,6 +86,8 @@ 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-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +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.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -115,6 +123,8 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad 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/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= @@ -131,6 +141,8 @@ github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlT github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= 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.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -143,7 +155,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN 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/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -153,6 +164,7 @@ github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg 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/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/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= @@ -236,12 +248,16 @@ github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmq 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/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.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/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.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.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= @@ -260,10 +276,8 @@ github.com/tendermint/go-amino v0.15.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoM github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8= github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o= 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/tendermint v0.32.4 h1:KwZIMtT+ROvfMYO3wine6F9hak3SpngcRcAIzys1J3I= -github.com/tendermint/tendermint v0.32.4/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE= +github.com/tendermint/tendermint v0.32.5 h1:2hCLwuzfCKZxXSe/+iMEl+ChJWKJx6g/Wcvq3NMxVN4= +github.com/tendermint/tendermint v0.32.5/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE= 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= @@ -287,6 +301,7 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/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/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83 h1:mgAKeshyNqWKdENOnQsg+8dRTwZFIwFaO3HNl52sweA= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -320,6 +335,7 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h 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-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= @@ -337,7 +353,6 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -364,5 +379,7 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl 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/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3 h1:fvjTMHxHEw/mxHbtzPi3JCcKXQRAnQTBRo6YCJSVHKI= +gopkg.in/yaml.v2 v2.2.3/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-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/networks/local/gaiadnode/Dockerfile b/networks/local/gaiadnode/Dockerfile index d82036a460..72f02fa5d1 100644 --- a/networks/local/gaiadnode/Dockerfile +++ b/networks/local/gaiadnode/Dockerfile @@ -1,9 +1,17 @@ -FROM alpine:3.7 -MAINTAINER Greg Szabo +#FROM alpine:3.10.2 +# +#RUN apk update && \ +# apk upgrade && \ +# apk --no-cache add curl jq file -RUN apk update && \ - apk upgrade && \ - apk --no-cache add curl jq file +# Changed from Alpine to Ubuntu because the keyring PR is linking to libc +# Alpine uses muslc instead of libc + +FROM ubuntu:18.04 + +RUN apt-get update && \ + apt-get -y upgrade && \ + apt-get -y install curl jq file VOLUME [ /gaiad ] WORKDIR /gaiad diff --git a/networks/local/gaiadnode/wrapper.sh b/networks/local/gaiadnode/wrapper.sh index b3e90a2a0c..93511b921e 100755 --- a/networks/local/gaiadnode/wrapper.sh +++ b/networks/local/gaiadnode/wrapper.sh @@ -25,11 +25,9 @@ fi ## export GAIADHOME="/gaiad/node${ID}/gaiad" -if [ -d "`dirname ${GAIADHOME}/${LOG}`" ]; then - "$BINARY" --home "$GAIADHOME" "$@" | tee "${GAIADHOME}/${LOG}" +if [ -d "$(dirname "${GAIADHOME}"/"${LOG}")" ]; then + "${BINARY}" --home "${GAIADHOME}" "$@" | tee "${GAIADHOME}/${LOG}" else - "$BINARY" --home "$GAIADHOME" "$@" + "${BINARY}" --home "${GAIADHOME}" "$@" fi -chmod 777 -R /gaiad - From 9e728535fec5089e7f83ea8b9c5d06447ce5a4f1 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Sat, 12 Oct 2019 23:05:11 -0400 Subject: [PATCH 027/685] Merge PR #155: changelog add v2.0.2 section --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3d1f52670..cea677e191 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,13 @@ flag and configuration. * (gaiacli) [\#132](https://github.com/cosmos/gaia/pull/132) Add `tx decode` command to decode Base64 encoded transactions. +## [v2.0.2] - 2019-10-12 + +### Improvements + +* (sdk) Bump SDK version to [v0.37.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.37.3). +* (tendermint) Bump Tendermint version to [v0.32.6](https://github.com/tendermint/tendermint/releases/tag/v0.32.6). + ## [v2.0.1] - 2019-09-20 ### Features @@ -123,7 +130,8 @@ not rely on the `x/supply` keeper to get module account addresses for blacklisti -[Unreleased]: https://github.com/cosmos/gaia/compare/v2.0.1...HEAD +[Unreleased]: https://github.com/cosmos/gaia/compare/v2.0.2...HEAD +[v2.0.2]: https://github.com/cosmos/gaia/releases/tag/v2.0.2 [v2.0.1]: https://github.com/cosmos/gaia/releases/tag/v2.0.1 [v2.0.0]: https://github.com/cosmos/gaia/releases/tag/v2.0.0 [v1.0.0]: https://github.com/cosmos/gaia/releases/tag/v1.0.0 From c9b984444c60fca89ca4424bca91ae162bb05c68 Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 14 Oct 2019 17:50:32 +0200 Subject: [PATCH 028/685] Merge PR #158: fix version to golangci --- .golangci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index ce8010e7ab..c91ff46035 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -15,3 +15,6 @@ linters-settings: min-confidence: 1.1 run: tests: false + +service: + golangci-lint-version: 1.19.x From dffe3b2258edc4c0a0db92cc14517f95141eae99 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2019 11:51:59 -0400 Subject: [PATCH 029/685] Bump github.com/tendermint/tendermint from 0.32.5 to 0.32.6 (#154) Bumps [github.com/tendermint/tendermint](https://github.com/tendermint/tendermint) from 0.32.5 to 0.32.6. - [Release notes](https://github.com/tendermint/tendermint/releases) - [Changelog](https://github.com/tendermint/tendermint/blob/master/CHANGELOG.md) - [Commits](https://github.com/tendermint/tendermint/compare/v0.32.5...v0.32.6) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f0e5f91140..df0a84f769 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/spf13/viper v1.4.0 github.com/stretchr/testify v1.4.0 github.com/tendermint/go-amino v0.15.0 - github.com/tendermint/tendermint v0.32.5 + github.com/tendermint/tendermint v0.32.6 github.com/tendermint/tm-db v0.2.0 golang.org/x/crypto v0.0.0-20190909091759-094676da4a83 // indirect golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect diff --git a/go.sum b/go.sum index 73b285c1b1..e77d6aa56c 100644 --- a/go.sum +++ b/go.sum @@ -278,6 +278,8 @@ github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJk github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU= github.com/tendermint/tendermint v0.32.5 h1:2hCLwuzfCKZxXSe/+iMEl+ChJWKJx6g/Wcvq3NMxVN4= github.com/tendermint/tendermint v0.32.5/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE= +github.com/tendermint/tendermint v0.32.6 h1:HozXi0USWvKrWuEh5ratnJV10ykkTy4nwXUi0UvPVzg= +github.com/tendermint/tendermint v0.32.6/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE= 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= From 532ccbe2e9e859f956f41a7a3ddc53f11e9fa82e Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 15 Oct 2019 14:24:48 +0200 Subject: [PATCH 030/685] Merge PR #159: remove fix golangci-lint bot version --- .golangci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index c91ff46035..ce8010e7ab 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -15,6 +15,3 @@ linters-settings: min-confidence: 1.1 run: tests: false - -service: - golangci-lint-version: 1.19.x From 474835c6cea17475cb0286e4a2721b63c8ea4a9a Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Tue, 15 Oct 2019 17:06:08 -0400 Subject: [PATCH 031/685] Merge PR #153: Bump SDK Version to Latest Master --- app/app.go | 8 ++++++-- cmd/gaiad/genaccounts.go | 12 +++++++----- go.mod | 4 ++-- go.sum | 40 ++++++++++++++-------------------------- lcd_test/helpers_test.go | 5 +++-- 5 files changed, 32 insertions(+), 37 deletions(-) diff --git a/app/app.go b/app/app.go index 9ed09e4bb0..6ba0e34a91 100644 --- a/app/app.go +++ b/app/app.go @@ -16,6 +16,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" + authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/crisis" distr "github.com/cosmos/cosmos-sdk/x/distribution" @@ -75,6 +76,7 @@ func MakeCodec() *codec.Codec { sdk.RegisterCodec(cdc) codec.RegisterCrypto(cdc) codec.RegisterEvidences(cdc) + authvesting.RegisterCodec(cdc) return cdc.Seal() } @@ -110,8 +112,10 @@ type GaiaApp struct { } // NewGaiaApp returns a reference to an initialized GaiaApp. -func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, - invCheckPeriod uint, baseAppOptions ...func(*bam.BaseApp)) *GaiaApp { +func NewGaiaApp( + logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, + invCheckPeriod uint, baseAppOptions ...func(*bam.BaseApp), +) *GaiaApp { cdc := MakeCodec() diff --git a/cmd/gaiad/genaccounts.go b/cmd/gaiad/genaccounts.go index 5c8192dee6..6c7f7fa389 100644 --- a/cmd/gaiad/genaccounts.go +++ b/cmd/gaiad/genaccounts.go @@ -15,6 +15,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" + authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting" "github.com/cosmos/cosmos-sdk/x/genutil" ) @@ -76,16 +77,17 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa baseAccount := auth.NewBaseAccount(addr, coins.Sort(), nil, 0, 0) if !vestingAmt.IsZero() { - baseVestingAccount := auth.NewBaseVestingAccount( - baseAccount, vestingAmt.Sort(), sdk.Coins{}, sdk.Coins{}, vestingEnd, - ) + baseVestingAccount, err := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) + if err != nil { + return fmt.Errorf("failed to create base vesting account: %w", err) + } switch { case vestingStart != 0 && vestingEnd != 0: - genAccount = auth.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) + genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) case vestingEnd != 0: - genAccount = auth.NewDelayedVestingAccountRaw(baseVestingAccount) + genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount) default: return errors.New("invalid vesting parameters; must supply start and end time or end time") diff --git a/go.mod b/go.mod index df0a84f769..a664f7c36f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.13 require ( github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect - github.com/cosmos/cosmos-sdk v0.34.4-0.20191002161644-532ea18724d2 + github.com/cosmos/cosmos-sdk v0.34.4-0.20191015202154-28347bf5f736 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/golang/mock v1.3.1 // indirect github.com/onsi/ginkgo v1.8.0 // indirect @@ -19,7 +19,7 @@ require ( github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.4.0 github.com/stretchr/testify v1.4.0 - github.com/tendermint/go-amino v0.15.0 + github.com/tendermint/go-amino v0.15.1 github.com/tendermint/tendermint v0.32.6 github.com/tendermint/tm-db v0.2.0 golang.org/x/crypto v0.0.0-20190909091759-094676da4a83 // indirect diff --git a/go.sum b/go.sum index e77d6aa56c..1a24de7639 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,3 @@ -bou.ke/monkey v1.0.1 h1:zEMLInw9xvNakzUUPjfS4Ds6jYPqCFx3m7bRmG5NH2U= bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/99designs/keyring v1.1.2 h1:JJauROcU6x6Nh9uZb+8JgXFvyo0GUESLo1ixhpA0Kmw= @@ -41,8 +40,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-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/cosmos/cosmos-sdk v0.34.4-0.20191002161644-532ea18724d2 h1:Nkjruzu7lfS7pJkX1KwXXezqS5fUfl2mXBcmxXBGAnM= -github.com/cosmos/cosmos-sdk v0.34.4-0.20191002161644-532ea18724d2/go.mod h1:tqwT2CRtU5MUGJixicDH30WggsyXdnmujmO9bFREeVc= +github.com/cosmos/cosmos-sdk v0.34.4-0.20191015202154-28347bf5f736 h1:LPdkBmnrEw9bDH4KshLiRVuy9EJrJyWS+8T0YpZkGGE= +github.com/cosmos/cosmos-sdk v0.34.4-0.20191015202154-28347bf5f736/go.mod h1:DATGOvgReTZJ+NJRi+Z4Pi6DxuabkOU51MZhyP4qtY0= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -57,7 +56,6 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2 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/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= 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/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a h1:mq+R6XEM6lJX5VlLyZIrUSP8tSuJp82xTK89hvBwJbU= @@ -89,10 +87,10 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me 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.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= 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/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= +github.com/gogo/protobuf v1.3.1/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/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -116,7 +114,6 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= 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.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= 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= @@ -160,8 +157,8 @@ github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoR github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW10= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= 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/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -186,14 +183,12 @@ github.com/otiai10/copy v1.0.2/go.mod h1:c7RpqBkwMom4bYTSkLSym4VSJz/XtncWRAj/J4P github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776 h1:o59bHXu8Ejas8Kq6pjoVJQ9/neN66SM8AKh6wI42BBs= github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776/go.mod h1:3HNVkVOU7vZeFXocWuvtcS0XSFLcf2XUSDHkq9t1jU4= -github.com/otiai10/mint v1.2.4 h1:DxYL0itZyPaR5Z9HILdxSoHx+gNs6Yx+neOGS3IVUk0= github.com/otiai10/mint v1.2.4/go.mod h1:d+b7n/0R3tdyUYYylALXpWQ/kTN+QobSq/4SRGBkR3M= github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= -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.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= -github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= +github.com/pelletier/go-toml v1.5.0 h1:5BakdOZdtKJ1FFk6QdL8iSGrMWsXgchNJcrnarjbmJQ= +github.com/pelletier/go-toml v1.5.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= 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/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -246,7 +241,6 @@ github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tL github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= 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/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= @@ -271,16 +265,13 @@ github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrn github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae h1:AOXNM7c2Vvo45SjAgeWF8Wy+NS7/NCqzRNpUc+HPAec= github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= 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/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= +github.com/tendermint/go-amino v0.15.1 h1:D2uk35eT4iTsvJd9jWIetzthE5C0/k2QmMFkCN+4JgQ= +github.com/tendermint/go-amino v0.15.1/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8= github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o= github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU= -github.com/tendermint/tendermint v0.32.5 h1:2hCLwuzfCKZxXSe/+iMEl+ChJWKJx6g/Wcvq3NMxVN4= -github.com/tendermint/tendermint v0.32.5/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE= github.com/tendermint/tendermint v0.32.6 h1:HozXi0USWvKrWuEh5ratnJV10ykkTy4nwXUi0UvPVzg= github.com/tendermint/tendermint v0.32.6/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE= -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= @@ -338,10 +329,9 @@ golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/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/sys v0.0.0-20191008105621-543471e840be h1:QAcqgptGM8IQBC9K/RC4o+O9YmqEm0diQn9QmZw/0mU= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -353,7 +343,6 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 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-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A= 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.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -379,9 +368,8 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= 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/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3 h1:fvjTMHxHEw/mxHbtzPi3JCcKXQRAnQTBRo6YCJSVHKI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= +gopkg.in/yaml.v2 v2.2.4/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-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/lcd_test/helpers_test.go b/lcd_test/helpers_test.go index d9dcbdf9e1..72531ccaf2 100644 --- a/lcd_test/helpers_test.go +++ b/lcd_test/helpers_test.go @@ -20,6 +20,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth" authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" authcutils "github.com/cosmos/cosmos-sdk/x/auth/client/utils" + authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" bankrest "github.com/cosmos/cosmos-sdk/x/bank/client/rest" distrrest "github.com/cosmos/cosmos-sdk/x/distribution/client/rest" "github.com/cosmos/cosmos-sdk/x/gov" @@ -261,7 +262,7 @@ func updateKey(t *testing.T, port, name, oldPassword, newPassword string, fail b } // GET /auth/accounts/{address} Get the account information on blockchain -func getAccount(t *testing.T, port string, addr sdk.AccAddress) (acc auth.Account) { +func getAccount(t *testing.T, port string, addr sdk.AccAddress) (acc authexported.Account) { res, body := Request(t, port, "GET", fmt.Sprintf("/auth/accounts/%s", addr.String()), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) require.Nil(t, cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &acc)) @@ -394,7 +395,7 @@ func doTransferWithGasAccAuto( // signAndBroadcastGenTx accepts a successfully generated unsigned tx, signs it, // and broadcasts it. func signAndBroadcastGenTx( - t *testing.T, port, name, pwd, genTx string, acc auth.Account, gasAdjustment float64, simulate bool, + t *testing.T, port, name, pwd, genTx string, acc authexported.Account, gasAdjustment float64, simulate bool, ) (resp *http.Response, body string) { chainID := viper.GetString(client.FlagChainID) From 24ae45599a9c32bda1066d64fc842830c16799a6 Mon Sep 17 00:00:00 2001 From: Marko Date: Fri, 18 Oct 2019 14:59:06 +0200 Subject: [PATCH 032/685] Merge PR #163: Remove mention of voyager --- docs/validators/validator-faq.md | 126 +++++++++++++++---------------- 1 file changed, 62 insertions(+), 64 deletions(-) diff --git a/docs/validators/validator-faq.md b/docs/validators/validator-faq.md index 3fae15a1a0..4115cab05f 100644 --- a/docs/validators/validator-faq.md +++ b/docs/validators/validator-faq.md @@ -16,7 +16,7 @@ The Cosmos Hub is a public Proof-Of-Stake (PoS) blockchain, meaning that the wei Any user in the system can declare their intention to become a validator by sending a `create-validator` transaction. From there, they become validator candidates. -The weight (i.e. voting power) of a validator determines whether or not they are an active validator. Initially, only the top 100 validators with the most voting power will be active validators. +The weight (i.e. voting power) of a validator determines whether or not they are an active validator. Initially, only the top 100 validators with the most voting power will be active validators. ### What is a full-node? @@ -38,31 +38,31 @@ Delegators play a critical role in the system, as they are responsible for choos Any participant in the network can signal that they want to become a validator by sending a `create-validator` transaction, where they must fill out the following parameters: -* **Validator's `PubKey`:** The private key associated with this Tendermint `PubKey` is used to sign _prevotes_ and _precommits_. -* **Validator's Address:** Application level address. This is the address used to identify your validator publicly. The private key associated with this address is used to delegate, unbond, claim rewards, and participate in governance. -* **Validator's name (moniker)** -* **Validator's website (Optional)** -* **Validator's description (Optional)** -* **Initial commission rate**: The commission rate on block rewards and fees charged to delegators. -* **Maximum commission:** The maximum commission rate which this validator can charge. This parameter cannot be changed after `create-validator` is processed. -* **Commission max change rate:** The maximum daily increase of the validator commission. This parameter cannot be changed after `create-validator` is processed. -* **Minimum self-delegation:** Minimum amount of Atoms the validator needs to have bonded at all time. If the validator's self-delegated stake falls below this limit, their entire staking pool will unbond. +- **Validator's `PubKey`:** The private key associated with this Tendermint `PubKey` is used to sign _prevotes_ and _precommits_. +- **Validator's Address:** Application level address. This is the address used to identify your validator publicly. The private key associated with this address is used to delegate, unbond, claim rewards, and participate in governance. +- **Validator's name (moniker)** +- **Validator's website (Optional)** +- **Validator's description (Optional)** +- **Initial commission rate**: The commission rate on block rewards and fees charged to delegators. +- **Maximum commission:** The maximum commission rate which this validator can charge. This parameter cannot be changed after `create-validator` is processed. +- **Commission max change rate:** The maximum daily increase of the validator commission. This parameter cannot be changed after `create-validator` is processed. +- **Minimum self-delegation:** Minimum amount of Atoms the validator needs to have bonded at all time. If the validator's self-delegated stake falls below this limit, their entire staking pool will unbond. Once a validator is created, Atom holders can delegate atoms to them, effectively adding stake to their pool. The total stake of an address is the combination of Atoms bonded by delegators and Atoms self-bonded by the entity which designated themselves. -Out of all validator candidates that signaled themselves, the 100 with the most total stake are the ones who are designated as validators. They become **validators** If a validator's total stake falls below the top 100 then that validator loses their validator privileges: they don't participate in consensus and generate rewards any more. Over time, the maximum number of validators will increase, according to the following schedule (*Note: this schedule can be changed by governance*): +Out of all validator candidates that signaled themselves, the 100 with the most total stake are the ones who are designated as validators. They become **validators** If a validator's total stake falls below the top 100 then that validator loses their validator privileges: they don't participate in consensus and generate rewards any more. Over time, the maximum number of validators will increase, according to the following schedule (_Note: this schedule can be changed by governance_): -* **Year 0:** 100 -* **Year 1:** 113 -* **Year 2:** 127 -* **Year 3:** 144 -* **Year 4:** 163 -* **Year 5:** 184 -* **Year 6:** 208 -* **Year 7:** 235 -* **Year 8:** 265 -* **Year 9:** 300 -* **Year 10:** 300 +- **Year 0:** 100 +- **Year 1:** 113 +- **Year 2:** 127 +- **Year 3:** 144 +- **Year 4:** 163 +- **Year 5:** 184 +- **Year 6:** 208 +- **Year 7:** 235 +- **Year 8:** 265 +- **Year 9:** 300 +- **Year 10:** 300 ## Testnet @@ -76,10 +76,9 @@ We view testnet participation as a great way to signal to the community that you In short, there are two types of keys: -- **Tendermint Key**: This is a unique key used to sign consensus votes. - + It is associated with a public key `cosmosvalconspub` (Get this value with `gaiad tendermint show-validator`) - + It is generated when the node is created with gaiad init. - +- **Tendermint Key**: This is a unique key used to sign consensus votes. + - It is associated with a public key `cosmosvalconspub` (Get this value with `gaiad tendermint show-validator`) + - It is generated when the node is created with gaiad init. - **Application key**: This key is created from `gaiacli` and used to sign transactions. Application keys are associated with a public key prefixed by `cosmospub` and an address prefixed by `cosmos`. Both are derived from account keys generated by `gaiacli keys add`. Note: A validator's operator key is directly tied to an application key, but @@ -90,26 +89,25 @@ uses reserved prefixes solely for this purpose: `cosmosvaloper` and `cosmosvalop After a validator is created with a `create-validator` transaction, they can be in three states: - `in validator set`: Validator is in the active set and participates in consensus. Validator is earning rewards and can be slashed for misbehaviour. -- `jailed`: Validator misbehaved and is in jail, i.e. outisde of the validator set. If the jailing is due to being offline for too long, the validator can send an `unjail` transaction in order to re-enter the validator set. If the jailing is due to double signing, the validator cannot unjail. +- `jailed`: Validator misbehaved and is in jail, i.e. outisde of the validator set. If the jailing is due to being offline for too long, the validator can send an `unjail` transaction in order to re-enter the validator set. If the jailing is due to double signing, the validator cannot unjail. - `unbonded`: Validator is not in the active set, and therefore not signing blocs. Validator cannot be slashed, and does not earn any reward. It is still possible to delegate Atoms to this validator. Un-delegating from an `unbonded` validator is immediate. - ### What is 'self-delegation'? How can I increase my 'self-delegation'? Self-delegation is delegation from a validator to themselves. This amount can be increases by sending a `delegate` transaction from your validator's `application` application key. ### Is there a minimum amount of Atoms that must be delegated to be an active (=bonded) validator? -The minimum is `1 atom`. +The minimum is `1 atom`. ### How will delegators choose their validators? Delegators are free to choose validators according to their own subjective criteria. This said, criteria anticipated to be important include: -* **Amount of self-delegated Atoms:** Number of Atoms a validator self-delegated to themselves. A validator with a higher amount of self-delegated Atoms has more skin in the game, making them more liable for their actions. -* **Amount of delegated Atoms:** Total number of Atoms delegated to a validator. A high voting power shows that the community trusts this validator, but it also means that this validator is a bigger target for hackers. Bigger validators also decrease the decentralisation of the network. -* **Commission rate:** Commission applied on revenue by validators before it is distributed to their delegators. -* **Track record:** Delegators will likely look at the track record of the validators they plan to delegate to. This includes seniority, past votes on proposals, historical average uptime and how often the node was compromised. +- **Amount of self-delegated Atoms:** Number of Atoms a validator self-delegated to themselves. A validator with a higher amount of self-delegated Atoms has more skin in the game, making them more liable for their actions. +- **Amount of delegated Atoms:** Total number of Atoms delegated to a validator. A high voting power shows that the community trusts this validator, but it also means that this validator is a bigger target for hackers. Bigger validators also decrease the decentralisation of the network. +- **Commission rate:** Commission applied on revenue by validators before it is distributed to their delegators. +- **Track record:** Delegators will likely look at the track record of the validators they plan to delegate to. This includes seniority, past votes on proposals, historical average uptime and how often the node was compromised. Apart from these criteria, there will be a possibility for validators to signal a website address to complete their resume. Validators will need to build reputation one way or another to attract delegators. For example, it would be a good practice for validators to have their setup audited by third parties. Note though, that the Tendermint team will not approve or conduct any audit themselves. For more on due diligence, see [this blog post](https://medium.com/@interchain_io/3d0faf10ce6f) @@ -123,14 +121,14 @@ No, they do not. Each delegator will value validators based on their own criteri Validators have two main responsibilities: -* **Be able to constantly run a correct version of the software:**Validators need to make sure that their servers are always online and their private keys are not compromised. -* **Actively participate in governance:** Validators are required to vote on every proposal. +- **Be able to constantly run a correct version of the software:**Validators need to make sure that their servers are always online and their private keys are not compromised. +- **Actively participate in governance:** Validators are required to vote on every proposal. Additionally, validators are expected to be active members of the community. They should always be up-to-date with the current state of the ecosystem so that they can easily adapt to any change. ### What does 'participate in governance' entail? -Validators and delegators on the Cosmos Hub can vote on proposals to change operational parameters (such as the block gas limit), coordinate upgrades, or make a decision on any given matter. +Validators and delegators on the Cosmos Hub can vote on proposals to change operational parameters (such as the block gas limit), coordinate upgrades, or make a decision on any given matter. Validators play a special role in the governance system. Being the pillars of the system, they are required to vote on every proposal. It is especially important since delegators who do not vote will inherit the vote of their validator. @@ -144,7 +142,7 @@ Validators, and by association delegators, receive block rewards, fees, and have By delegating to a validator, a user delegates voting power. The more voting power a validator have, the more weight they have in the consensus and governance processes. This does not mean that the validator has custody of their delegators' Atoms. **By no means can a validator run away with its delegator's funds**. -Even though delegated funds cannot be stolen by their validators, delegators are still liable if their validators misbehave. +Even though delegated funds cannot be stolen by their validators, delegators are still liable if their validators misbehave. ### How often will a validator be chosen to propose the next block? Does it go up with the quantity of bonded Atoms? @@ -152,7 +150,7 @@ The validator that is selected to propose the next block is called proposer. Eac ### Will validators of the Cosmos Hub ever be required to validate other zones in the Cosmos ecosystem? -Yes, they will. If governance decides so, validators of the Cosmos hub may be required to validate additional zones in the Cosmos ecosystem. +Yes, they will. If governance decides so, validators of the Cosmos hub may be required to validate additional zones in the Cosmos ecosystem. ## Incentives @@ -160,8 +158,8 @@ Yes, they will. If governance decides so, validators of the Cosmos hub may be re Each member of a validator's staking pool earns different types of revenue: -* **Block rewards:** Native tokens of applications run by validators (e.g. Atoms on the Cosmos Hub) are inflated to produce block provisions. These provisions exist to incentivize Atom holders to bond their stake, as non-bonded Atom will be diluted over time. -* **Transaction fees:** The Cosmos Hub maintains a whitelist of token that are accepted as fee payment. The initial fee token is the `atom`. +- **Block rewards:** Native tokens of applications run by validators (e.g. Atoms on the Cosmos Hub) are inflated to produce block provisions. These provisions exist to incentivize Atom holders to bond their stake, as non-bonded Atom will be diluted over time. +- **Transaction fees:** The Cosmos Hub maintains a whitelist of token that are accepted as fee payment. The initial fee token is the `atom`. This total revenue is divided among validators' staking pools according to each validator's weight. Then, within each validator's staking pool the revenue is divided among delegators in proportion to each delegator's stake. A commission on delegators' revenue is applied by the validator before it is distributed. @@ -173,7 +171,7 @@ Validators also play a major role in governance. If a delegator does not vote, t ### What are validators commission? -Revenue received by a validator's pool is split between the validator and their delegators. The validator can apply a commission on the part of the revenue that goes to their delegators. This commission is set as a percentage. Each validator is free to set their initial commission, maximum daily commission change rate and maximum commission. The Cosmos Hub enforces the parameter that each validator sets. Only the commission rate can change after the validator is created. +Revenue received by a validator's pool is split between the validator and their delegators. The validator can apply a commission on the part of the revenue that goes to their delegators. This commission is set as a percentage. Each validator is free to set their initial commission, maximum daily commission change rate and maximum commission. The Cosmos Hub enforces the parameter that each validator sets. Only the commission rate can change after the validator is created. ### How are block rewards distributed? @@ -181,11 +179,11 @@ Block rewards are distributed proportionally to all validators relative to their Let us take an example where we have 10 validators with equal voting power and a commission rate of 1%. Let us also assume that the reward for a block is 1000 Atoms and that each validator has 20% of self-bonded Atoms. These tokens do not go directly to the proposer. Instead, they are evenly spread among validators. So now each validator's pool has 100 Atoms. These 100 Atoms will be distributed according to each participant's stake: -* Commission: `100*80%*1% = 0.8 Atoms` -* Validator gets: `100\*20% + Commission = 20.8 Atoms` -* All delegators get: `100\*80% - Commission = 79.2 Atoms` +- Commission: `100*80%*1% = 0.8 Atoms` +- Validator gets: `100\*20% + Commission = 20.8 Atoms` +- All delegators get: `100\*80% - Commission = 79.2 Atoms` -Then, each delegator can claim their part of the 79.2 Atoms in proportion to their stake in the validator's staking pool. +Then, each delegator can claim their part of the 79.2 Atoms in proportion to their stake in the validator's staking pool. ### How are fees distributed? @@ -197,7 +195,7 @@ Let's take a concrete example to illustrate the aforementioned concept. In this First, a 2% tax is applied. The corresponding Atoms go to the reserve pool. Reserve pool's funds can be allocated through governance to fund bounties and upgrades. -* `2% * 1025.51020408 = 20.51020408` Atoms go to the reserve pool. +- `2% * 1025.51020408 = 20.51020408` Atoms go to the reserve pool. 1005 Atoms now remain. Let's assume that the proposer included 100% of the signatures in its block. It thus obtains the full bonus of 5%. @@ -205,23 +203,23 @@ We have to solve this simple equation to find the reward R for each validator: `9*R + R + R*5% = 1005 ⇔ R = 1005/10.05 = 100` -* For the proposer validator: - * The pool obtains `R + R * 5%`: 105 Atoms - * Commission: `105 * 80% * 1%` = 0.84 Atoms - * Validator's reward: `105 * 20% + Commission` = 21.84 Atoms - * Delegators' rewards: `105 * 80% - Commission` = 83.16 Atoms (each delegator will be able to claim its portion of these rewards in proportion to their stake) -* For each non-proposer validator: - * The pool obtains R: 100 Atoms - * Commission: `100 * 80% * 1%` = 0.8 Atoms - * Validator's reward: `100 * 20% + Commission` = 20.8 Atoms - * Delegators' rewards: `100 * 80% - Commission` = 79.2 Atoms (each delegator will be able to claim their portion of these rewards in proportion to their stake) +- For the proposer validator: + - The pool obtains `R + R * 5%`: 105 Atoms + - Commission: `105 * 80% * 1%` = 0.84 Atoms + - Validator's reward: `105 * 20% + Commission` = 21.84 Atoms + - Delegators' rewards: `105 * 80% - Commission` = 83.16 Atoms (each delegator will be able to claim its portion of these rewards in proportion to their stake) +- For each non-proposer validator: + - The pool obtains R: 100 Atoms + - Commission: `100 * 80% * 1%` = 0.8 Atoms + - Validator's reward: `100 * 20% + Commission` = 20.8 Atoms + - Delegators' rewards: `100 * 80% - Commission` = 79.2 Atoms (each delegator will be able to claim their portion of these rewards in proportion to their stake) ### What are the slashing conditions? If a validator misbehaves, their delegated stake will be partially slashed. There are currently two faults that can result in slashing of funds for a validator and their delegators: -* **Double signing:** If someone reports on chain A that a validator signed two blocks at the same height on chain A and chain B, and if chain A and chain B share a common ancestor, then this validator will get slashed by 5% on chain A. -* **Downtime:** If a validator misses more than 95% of the last 10.000 blocks, they will get slashed by 0.01%. +- **Double signing:** If someone reports on chain A that a validator signed two blocks at the same height on chain A and chain B, and if chain A and chain B share a common ancestor, then this validator will get slashed by 5% on chain A. +- **Downtime:** If a validator misses more than 95% of the last 10.000 blocks, they will get slashed by 0.01%. ### Do validators need to self-delegate Atoms? @@ -233,8 +231,8 @@ In order for delegators to have some guarantee about how much skin-in-the-game t For now the community is expected to behave in a smart and self-preserving way. When a mining pool in Bitcoin gets too much mining power the community usually stops contributing to that pool. The Cosmos Hub will rely on the same effect initially. Other mechanisms are in place to smoothen this process as much as possible: -* **Penalty-free re-delegation:** This is to allow delegators to easily switch from one validator to another, in order to reduce validator stickiness. -* **UI warning:** Users will be warned by Cosmos Voyager if they want to delegate to a validator that already has a significant amount of staking power. +- **Penalty-free re-delegation:** This is to allow delegators to easily switch from one validator to another, in order to reduce validator stickiness. +- **UI warning:** Wallets can implement warnings that will be displayed to users if they want to delegate to a validator that already has a significant amount of staking power. ## Technical Requirements @@ -264,10 +262,10 @@ A successful validator operation will require the efforts of multiple highly ski Validators should expect to run an HSM that supports ed25519 keys. Here are potential options: -* YubiHSM 2 -* Ledger Nano S -* Ledger BOLOS SGX enclave -* Thales nShield support +- YubiHSM 2 +- Ledger Nano S +- Ledger BOLOS SGX enclave +- Thales nShield support The Tendermint team does not recommend one solution above the other. The community is encouraged to bolster the effort to improve HSMs and the security of key management. From f41a660cdd5bea173139965ade55bd25d1ee3429 Mon Sep 17 00:00:00 2001 From: Andrew Yurisich <46486335+captain-kark@users.noreply.github.com> Date: Fri, 18 Oct 2019 15:30:09 +0200 Subject: [PATCH 033/685] Add instructions how to unset ldflags for builds (#147) Include a reminder to unset LDFLAGS before running 'make install' --- .github/PULL_REQUEST_TEMPLATE.md | 4 ++-- docs/installation.md | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 24eb3aae1f..0f6760e8bc 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,10 +1,10 @@ -- Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/gaia/blob/develop/CONTRIBUTING.md#pr-targeting)) +- Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/gaia/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] Linked to github-issue with discussion and accepted design OR link to spec that describes this work. - [ ] Wrote tests diff --git a/docs/installation.md b/docs/installation.md index e550774cec..39602e1166 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -31,7 +31,23 @@ git clone -b https://github.com/cosmos/gaia cd gaia && make install ``` -> _NOTE_: If you have issues at this step, please check that you have the latest stable version of GO installed. +If this command fails due to the following error message, you might have already set `LDFLAGS` prior to running this step. + +``` +# github.com/cosmos/gaia/cmd/gaiad +flag provided but not defined: -L +usage: link [options] main.o +... +make: *** [install] Error 2 +``` + +Unset this environment variable and try again. + +``` +LDFLAGS="" make install +``` + +> _NOTE_: If you still have issues at this step, please check that you have the latest stable version of GO installed. That will install the `gaiad` and `gaiacli` binaries. Verify that everything is OK: From 01f32a2061940eb983e9e257969e8aa73e7125c7 Mon Sep 17 00:00:00 2001 From: dogemos <42988601+dogemos@users.noreply.github.com> Date: Sun, 20 Oct 2019 19:58:56 +0900 Subject: [PATCH 034/685] Update new commands & minor fixes (#165) Changes in gaia delegator's guide: - Update document to latest commands - Fix minor typos - Change wording for better clarity - Update index --- docs/translations/kr/delegator-guide-cli.md | 131 +++++++++++++------- 1 file changed, 89 insertions(+), 42 deletions(-) diff --git a/docs/translations/kr/delegator-guide-cli.md b/docs/translations/kr/delegator-guide-cli.md index 7f6000a758..33ebfbce84 100644 --- a/docs/translations/kr/delegator-guide-cli.md +++ b/docs/translations/kr/delegator-guide-cli.md @@ -1,16 +1,16 @@ # 위임자 가이드라인 (CLI) -이 분서는 위임자가 커맨드라인 인터페이스(CLI, Command-Line Interface)를 통해 코스모스 허브와 소통하기 위해 필요한 모든 정보를 포함하고 있습니다. +이 문서는 위임자가 커맨드라인 인터페이스(CLI, Command-Line Interface)를 통해 코스모스 허브와 소통하기 위해 필요한 모든 정보를 포함하고 있습니다. 또한 계정 관리, 코스모스 펀드레이저로 받은 계정을 복구하는 방법, 그리고 렛저 나노 하드웨어 지갑 사용법 또한 포함되어있습니다. __중요__: 이 문서에 설명되어있는 모든 단계를 신중하게 진행하십시오. 특정 행동의 실수는 소유하고 있는 아톰의 손실을 초래할 수 있습니다. 진행 전 이 문서에 있는 모든 절차를 자세히 확인하시고 필요시 코스모스 팀에게 연락하십시오. **이 문서는 참고용 정보를 제공하기 위해 번역된 영어 원문의 번역본입니다. 이 문서에 포함되어있는 정보의 완결성은 보장되지 않으며, 개인의 행동에 따른 손실을 책임지지 않습니다. 꼭 영어 원문을 참고하시기 바랍니다. 만약 이 문서의 정보와 영어 원문의 정보가 다른 경우, 영어 문서의 정보가 상위 권한을 가지게 됩니다.** -CLI를 사용하는 위임자는 매우 실험적인 블록체인 기술이 사용되고 있는 코스모스 허브를 사용하게됩니다. 코스모스 허브는 우수한 기술을 기반으로 다수의 보안 감사를 진행했으나 문제, 업데이트 그리고 버그가 존재할 수 있습니다. 또한 블록체인 기술을 사용하는 것은 상당한 기술적 배경을 필요로 하며, 공식 팀의 컨트롤 밖에 있는 리스크가 따릅니다. 유저는 이 소프트웨어를 사용함으로써 암호학 기반 소프트웨어를 사용하는 리스크를 인지하고 있음을 인정하는 것입니다. (참고 문서: [인터체인 코스모스 펀드레이저 약관](https://github.com/cosmos/cosmos/blob/master/fundraiser/Interchain%20Cosmos%20Contribution%20Terms%20-%20FINAL.pdf)) +CLI를 사용하는 위임자는 매우 실험적인 블록체인 기술이 사용되고 있는 코스모스 허브를 사용하게됩니다. 코스모스 허브는 우수한 기술을 기반으로 다수의 보안 감사를 진행했으나 문제, 업데이트 그리고 버그가 존재할 수 있습니다. 또한 블록체인 기술을 사용하는 것은 상당한 기술적 배경을 필요로 하며, 공식 팀의 컨트롤 밖에 있는 리스크가 따릅니다. 유저는 이 소프트웨어를 사용함으로써 암호학 기반 소프트웨어를 사용하는 리스크를 인지하고 있음을 인정하는 것입니다. (참고 문서: [인터체인 코스모스 펀드레이저 약관](https://github.com/cosmos/cosmos/blob/master/fundraiser/Interchain%20Cosmos%20Contribution%20Terms%20-%20FINAL.pdf)). 인터체인 재단(Interchain Foundation)과 텐더민트 팀은 소프트웨어 사용으로 발생하는 모든 손실에 대해서 책임을 지지 않습니다. Apache 2.0 라이선스 기반의 오픈소스 소프트웨어를 사용하는 것은 각 개인의 책임이며, 소프트웨어는 그 어떤 보증과 조건이 없는 'As Is(있는 그대로)' 기반으로 제공됩니다. -모든 행동은 신중하고 침착하게 진행하시기 바랍니다. +모든 절차는 신중하게 진행하시기 바랍니다. ## 목차 @@ -20,12 +20,14 @@ CLI를 사용하는 위임자는 매우 실험적인 블록체인 기술이 사 + [계정 생성하기](#creating-an-account) - [코스모스 허브 네트워크 액세스하기](#accessing-the-cosmos-hub-network) + [자체 풀노드 운영하기](#running-your-own-full-node) - + [다른 풀노드와 연결하기](#connecting-to-a-remote-full-node) + + [원격 풀노드 연결하기](#connecting-to-a-remote-full-node) - [`gaiacli` 설정하기](#setting-up-gaiacli) - [상태(state) 조회하기](#querying-the-state) -- [아톰 위임하기 / 위임 철회(unbond)하기 / 보상 수령하기](#bonding-atoms-and-withdrawing-rewards) -- [거버넌스에 참여하기](#participating-in-governance) -- [오프라인 컴퓨터에서 트랜잭션 서명하기](#signing-transactions-from-an-offline-computer) +- [트랜잭션 전송하기](#sending-transactions) + + [가스(Gas)와 수수료 관련 정보](#a-note-on-gas-and-fees) + + [아톰 위임 및 위임 보상 수령하기](#bonding-atoms-and-withdrawing-rewards) + + [거버넌스에 참여하기](#participating-in-governance) + + [오프라인 컴퓨터에서 트랜잭션 서명하기](#signing-transactions-from-an-offline-computer) ## `gaiacli` 설치하기 @@ -39,6 +41,12 @@ CLI를 사용하는 위임자는 매우 실험적인 블록체인 기술이 사 [**소스에서 설치하기**](https://cosmos.network/docs/gaia/installation.html) +::: tip `gaiacli`는 터미널 환경에서 사용됩니다. 다음과 같이 터미널을 실행하세요: + +- **윈도우**: `시작` > `모든 프로그램` > `악세서리` > `명령 프롬프트` +- **맥OS**: `파인더` > `애플리케이션` > `유틸리티` > `터미널` +- **리눅스**: `Ctrl` + `Alt` + `T`::: + ## 코스모스 계정 모든 코스모스 계정에는 12개 또는 24개의 단어로 이루어진 '시드(Seed)'가 할당됩니다. 이 시드 단어(또는 시드 키)를 기반으로 다수의 코스모스 계정을 생성할 수 있습니다 (예를들어: 다수의 프라이빗 키/퍼블릭 키 쌍). 이런 형태의 월렛은 HD(Hierarchical deterministic) 월렛이라고 불립니다 (HD 월렛에 대한 자세한 정보는 [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)를 참고하세요). @@ -97,7 +105,7 @@ CLI를 사용하는 위임자는 매우 실험적인 블록체인 기술이 사 모든 렛저 기기에는 (코스모스 허브를 포함한) 다수의 블록체인에서 계정을 생성하기 위해 사용되는 시드키가 있습니다. 통상 시드키는 렛저 기기를 처음 활성화 할때 생성하지만, 유저가 시드키를 직접 입력하는 것 또한 가능합니다. 이제 펀드레이저를 통해 받은 시드키를 어떻게 렛저 하드웨어 지갑에 입력하는지 알아보겠습니다. ::: warning -*참고: 이번 단계를 진행하실때 **한번도 사용되지 않은 신규 기기를 사용하는 것을 권장합니다**. 한 렛저 기기에는 하나의 시드키만을 입력할 수 있습니다. 만약 이미 사용하시던 하드웨어 지갑을 사용하시기를 바라는 경우, `Settings`>`Device`>`Reset All`를 통해 리셋을 진행한 후 펀드레이저 시드를 입력할 수 있습니다. **렛저 기기를 리셋할 경우, 기존에 사용했던 시드키는 기기에서 삭제됩니다. 리셋을 진행하기 전 기존 기기의 시드키를 백업하셨는지 확인하신 후 진행하시기 바랍니다.** 백업 되지 않은 상태로 기기를 리셋하는 경우, 관련 계정의 자산을 잃을 수 있습니다.* +*참고: 이번 단계를 진행하실때 **신규 기기를 사용하는 것을 권장합니다**. 한 렛저 기기에는 하나의 시드키만을 입력할 수 있습니다. 만약 이미 사용하시던 하드웨어 지갑을 사용하시기를 바라는 경우, `Settings`>`Device`>`Reset All`를 통해 리셋을 진행한 후 펀드레이저 시드를 입력할 수 있습니다. **렛저 기기를 리셋할 경우, 기존에 사용했던 시드키는 기기에서 삭제됩니다. 리셋을 진행하기 전 기존 기기의 시드키를 백업하셨는지 확인하신 후 진행하시기 바랍니다.** 백업 되지 않은 상태로 기기를 리셋하는 경우, 관련 계정의 자산을 잃을 수 있습니다.* ::: @@ -123,7 +131,7 @@ CLI를 사용하는 위임자는 매우 실험적인 블록체인 기술이 사 컴퓨터를 이용해 펀드레이저 시드키를 복구하시고 컴퓨터에 프라이빗 키를 저장사기 위해서는 다음 명령어를 실행하세요: ```bash -gaiacli keys add <키 명칭 지정(YourKeyName)> --recover +gaiacli keys add <키_명칭(YourKeyName)> --recover ``` 명령어를 입력하셨다면 프로그램이 지금 생성(복구)하시는 계정의 프라이빗 키를 암호화할때 사용될 비밀번호를 입력할 것을 요청합니다. 해당 계정을 이용해 트랜잭션을 보낼때마다 이 비밀번호를 입력하셔야 합니다. 만약 비밀번호를 잃어버리셨다면 시드키를 사용해 계정을 다시 복구할 수 있습니다. @@ -151,7 +159,7 @@ gaiacli keys add <키 명칭 지정(YourKeyName)> --recover 계정을 생성하기 위해서는 다음 명령어를 실행하십시오: ```bash -gaiacli keys add <키 명칭 지정(yourKeyName)> --ledger +gaiacli keys add <키_명칭(yourKeyName)> --ledger ``` - `` 은 계정의 이름입니다. 이는 시드키로부터 키 페어를 파생할때 레퍼런스로 사용됩니다. 이 이름은 토큰을 전송할때 보내는 계정을 구분하기 위해서 사용됩니다. @@ -166,7 +174,7 @@ gaiacli keys add <키 명칭 지정(yourKeyName)> --ledger 계정을 생성하기 위해서는 다음 명령어를 입력하세요: ```bash -gaiacli keys add <키 명칭 지정(yourKeyName)> +gaiacli keys add <키_명칭(yourKeyName)> ``` 위 명령어는 새로운 24단어로 구성된 시드키를 생성하고, 계정 `0`의 프라이빗 키와 퍼블릭 키를 저장합니다. 이후, 디스크에 저장될 계정 `0`의 프라이빗 키를 암호화할때 사용될 비밀번호를 입력할 것을 요청합니다. 해당 계정을 이용해 트랜잭션을 보낼때마다 이 비밀번호를 입력하셔야 합니다. 만약 비밀번호를 잃어버리셨다면 시드키를 사용해 계정을 다시 복구할 수 있습니다. @@ -191,7 +199,7 @@ rm ~/.bash_history 동일한 시드키로 추가적인 계정을 생성하기 원한다면, 다음 명령어를 사용하세요: ```bash -gaiacli keys add <키 명칭 지정(yourKeyName)> --recover --account 1 +gaiacli keys add <키_명칭(yourKeyName)> --recover --account 1 ``` 해당 명령어는 비밀번호와 시드키를 입력할 것을 요청할 것입니다. 이 외에 추가적인 계정을 생성하시기 원한다면 account 플래그의 번호를 바꾸십시오. @@ -211,7 +219,7 @@ gaiacli keys add <키 명칭 지정(yourKeyName)> --recover --account 1 [풀노드를 운영하는 절차](https://cosmos.network/docs/gaia/join-mainnet.html)와 [`gaiad`를 설치하는 방법](https://cosmos.network/docs/gaia/installation.html)은 첨부된 링크를 확인하세요. -### 외부 풀노드에 연결하기 +### 원격 풀노드 연결하기 만약 본인이 직접 풀노드를 운영하는 것을 원하지 않는다면 다른 사람의 풀노드에 연결을 할 수 있습니다. 이 과정에서는 신뢰할 수 있는 풀노드 운영자에만 연결하세요. 악의적인 풀노드 운영자는 트랜잭션을 막거나 틀린 정보를 전달할 가능성이 있습니다. 하지만 프라이빗 키는 당신의 컴퓨터/렛저 기기에 저장되어 있기 때문에 풀노드 운영자는 절대로 자금을 탈취할 수 없습니다. 검증된 검증인, 월렛 제공자, 거래소 등의 풀노드에만 연결하는 것을 추천드립니다. @@ -268,18 +276,18 @@ gaiacli query account gaiacli query validators // 검증인 주소로 (예시: cosmos10snjt8dmpr5my0h76xj48ty80uzwhraqalu4eg) 검증인 정보 조회 -gaiacli query validator <검증인 주소(validatorAddress)> +gaiacli query validator <검증인_주소(validatorAddress)> // 위임자 주소로 (예시: cosmos10snjt8dmpr5my0h76xj48ty80uzwhraqalu4eg) 계정의 모든 위임 기록 조회 -gaiacli query delegations <위임자 주소(delegatorAddress)> +gaiacli query delegations <위임자_주소(delegatorAddress)> // 위임자가 특정 검증인에게 위임한 기록 조회 -gaiacli query delegations <위임자 주소(delegatorAddress)> <검증인 주소(validatorAddress)> +gaiacli query delegations <위임자_주소(delegatorAddress)> <검증인_주소(validatorAddress)> // 위임자 주소로 (예시: cosmos10snjt8dmpr5my0h76xj48ty80uzwhraqalu4eg) 위임자 리워드 조회 -gaiacli query distribution rewards <위임자 주소(delegatorAddress)> +gaiacli query distribution rewards <위임자_주소(delegatorAddress)> -// 예치금(deposit)을 대기중인 모든 프로포절 조회 +// 보증금(deposit)을 대기중인 모든 프로포절 조회 gaiacli query proposals --status deposit_period // 투표가 가능한 모든 프로포절 조회 @@ -322,8 +330,25 @@ gaiacli query 메인넷 권장 `gas-prices`는 `0.025uatom` 입니다. ::: +### 토큰 전송하기 + +::: tip **아톰을 위임하거나 위임 보상을 수령하기 전에 `gaiacli`를 설치하시고 계정을 만드셔야 합니다**::: + +:::warning 참고: 다음 명령어는 온라인 상태인 컴퓨터에서 실행되어야 합니다. 해당 명령은 렛저 하드웨어 월렛 기기를 사용해 실행하는 것을 추천드립니다. 오프라인으로 트랜잭션을 발생하는 방법을 확인하기 위해서는 [여기](#signing-transactions-from-an-offline-computer)를 참고하세요 + +```bash +//특정 수량의 토큰을 지정한 주소로 전송하기 +//파라미터 값 예시(실제 토큰 전송시 사용하지 마세요!): <수신자_주소_예시>=cosmos16m93fezfiezhvnjajzrfyszml8qm92a0w67ntjhd3d0 <수량_예시>=1000000uatom +//플래그 값 예시: <가스_가격(gasPrice)>=0.025uatom + +gaiacli tx send <수신자_주소> <보내는_수량> --from <키_이름> --gas auto --gas-adjustment 1.5 --gas-prices <가스_가격(gasPrice)> +``` + ### 아톰 위임하기 / 리워드 수령하기 + +::: tip **아톰을 위임하거나 위임 보상을 수령하기 전에 `gaiacli`를 설치하시고 계정을 만드셔야 합니다**::: + ::: warning **아톰을 위임하기 전에 [위임자 faq](https://cosmos.network/resources/delegators)를 먼저 확인하시고 위임에 따르는 책임과 위험을 사전에 인지하시기 바랍니다** ::: @@ -333,18 +358,32 @@ gaiacli query ::: ```bash -// 아톰 위임하기 -// 각 플래그 값 예시: <위임할 수량(amountToBound)> = 10000uatom, <검증인의 bech32 주소(bech32AddressOfValidator)> = cosmosvaloper18thamkhnj9wz8pa4nhnp9rldprgant57pk2m8s, <가스 가격(gasPrice)> = 0.025uatom +// 특정 검증인에게 아톰 위임하기 +// 플래그 값 예시: <검증인_주소(validatorAddress)>= cosmosvaloper18thamkhnj9wz8pa4nhnp9rldprgant57pk2m8s, <위임할_수량(amountToBound)>=10000000uatom, <가스_가격(gasPrice)>=0.025uatom -gaiacli tx staking --amount <위임할 수량(amountToBond)> --validator <검증인의 bech32 주소(bech32AddressOfValidator)> --from <위임자 키 명칭(delegatorKeyName)> --gas auto --gas-prices <가스 가격(gasPrice)> +gaiacli tx staking delegate <검증인_주소(validatorAddress> <위임할_수량(amountToBond)> --from <위임자_키_명칭(delegatorKeyName)> --gas auto --gas-adjustment 1.5 --gas-prices <가스_가격(gasPrice)> -// 리워드 수령하기 +// 위임된 아톰을 다른 검증인에게 재위임 하기 +// 이미 검증인에게 위임이 된 상태에서만 사용하실 수 있습니다 +// 재위임은 즉시 반영됩니다. 재위임 대기 기간은 없습니다 +// 재위임을 진행하신 후, 동일한 아톰에 대한 재위임은 3주 후 가능합니다. +// 플래그 값 예시: <기존_검증인_주소(srcValidatorAddress)>=cosmosvaloper18thamkhnj9wz8pa4nhnp9rldprgant57pk2m8s, <재위임할_수량>=100000000uatom, <가스_가격(gasPrice)>=0.025uatom -gaiacli tx distribution withdraw-rewards --from <위임자 키 명칭(delegatorKeyName)> -``` +gaiacli tx staking redelegate <기존_검증인_주소(srcValidatorAddress)> <이동할_검증인_주소(destValidatorAddress)> <재위임할_수량(amountToRedelegate)> --from <위임자_키_명칭(delegatorKeyName)> --gas auto --gas-adjustment 1.5 --gas-prices <가스_가격(gasPrice)> + +// 모든 리워드 수령하기 +// 플래그 값 예시: <가스_가격(gasPrice)>=0.025uatom + +gaiacli tx distribution withdraw-all-rewards --from <위임자_키_명칭(delegatorKeyName)> --gas auto --gas-adjustment 1.5 --gas-prices <가스_가격(gasPrice)> + +// 특정 검증인으로 부터 위임 취소하기 +// 위임 취소가 완료되기 위해서는 3주의 기간이 걸리며, 위임 취소가 진행중인 기간에는 해당 아톰을 전송하실 수 없습니다. +// 플래그 값 예시: <검증인_주소(validatorAddress)>=cosmosvaloper18thamkhnj9wz8pa4nhnp9rldprgant57pk2m8s, <위임_취소할_수량(amountToUnbond)>=10000000uatom, <가스_가격(gasPrice)>=0.025uatom + +gaiacli tx staking unbond <검증인_주소(validatorAddress)> <위임_취소할_수량(amountToUnbond)> --from <위임자_키_명칭(delegatorKeyName)> --gas auto --gas-adjustment 1.5 --gas-prices <가스_가격(gasPrice)> ::: tip -렛저 기기를 사용해 트랜잭션을 발생하시는 경우, 기기에서 트랜잭션을 확인하는 과정이 추가적으로 발생됩니다. 기기에서 트랜잭션을 서명하셔야 네트워크로 전파됩니다 +렛저 기기를 사용해 트랜잭션을 발생하시는 경우, 렛저 기기에서 트랜잭션을 확인하는 과정이 추가적으로 발생됩니다. 컴퓨터에 연결되어 있는 기기에서 트랜잭션을 서명하셔야 네트워크로 전파됩니다. ::: 해당 트랜잭션이 성공적으로 진행된 것을 확인하기 위해서는 다음 조회 명령어를 사용하세요: @@ -354,15 +393,15 @@ gaiacli tx distribution withdraw-rewards --from <위임자 키 명칭(delegatorK gaiacli query account // 위임을 진행하셨다면 스테이킹 잔고가 표시됩니다 (스테이킹 확인 명령어) -gaiacli query delegations <위임자 주소(delegatorAddress)> +gaiacli query delegations <위임자_주소(delegatorAddress)> // 트랜잭션이 블록체인에 포함되었으면 해당 tx 정보를 전달합니다 // 트랜잭션을 생성하셨을때 표시되었던 tx hash를 입력하세요 (트랜잭션 확인 명령어) -gaiacli query tx +gaiacli query tx <트랜잭션_해시(txHash)> ``` -만약 외부 풀노드를 통해서 블록체인을 사용하신 경우 블록 익스플로러를 통해 트랜잭션을 확인하십시오. +만약 원격 풀노드를 사용해 트랜잭션을 전송하신 경우, 블록 익스플로러를 통해 트랜잭션을 확인하십시오. ## 거버넌스 참가하기 @@ -374,13 +413,13 @@ gaiacli query tx - `파라미터 프로포절(Parameter Proposals)`: 네트워크의 기존 파라미터 값을 변경하는 것을 제안하기 위해서 사용됩니다. - `소프트웨어 업그레이드 프로포절(Software Upgrade Proposal)`: 코스모스 허브의 소프트웨어를 업그레이드 하는 것을 제안하기 위해서 사용됩니다. -모든 아톰 보유자는 프로포절을 제안할 수 있습니다. 특정 프로포절의 투표가 활성화되기 위해서는 `minDeposit`값에 정의된 예치금 보다 높은 `deposit` 비용이 예치되어야 합니다. `deposit`은 프로포절 제안자 외에도 예치를 할 수 있습니다. 만약 제안자가 충분하지 않은 `deposit`을 예치한 경우, 프로포절은 `deposit_period` 상태로 들어가 추가 예치금을 대기합니다. 모든 아톰 보유자는 `depositTx` 트랜잭션을 통해 예치금을 추가할 수 있습니다. +모든 아톰 보유자는 프로포절을 제안할 수 있습니다. 특정 프로포절의 투표가 활성화되기 위해서는 `minDeposit`값에 정의된 보증금 보다 높은 `deposit` 비용이 예치되어야 합니다. `deposit`은 프로포절 제안자 외에도 보증금을 추가할 수 있습니다. 만약 제안자가 필요한 보증금 보다 낮은 보증금을 입금한 경우, 프로포절은 `deposit_period` 상태로 들어가 추가 보증금 입금을 대기합니다. 모든 아톰 보유자는 `depositTx` 트랜잭션을 통해 보증금을 추가할 수 있습니다. 프로포절의 `deposit`이 `minDeposit`을 도달하게 되면 해당 프로포절의 2주 간의 `voting_period`(투표 기간)이 시작됩니다. **위임된 아톰**의 보유자는 해당 프로포절에 투표를 행사할 수 있으며, `Yes`, `No`, `NoWithVeto` 또는 `Abstain` 표를 선택할 수 있습니다. 각 표는 투표자의 위임된 아톰 수량을 반영하게 됩니다. 만약 위임자가 직접 투표를 진행하지 않은 경우, 위임자는 검증인의 표를 따르게 됩니다. 하지만 모든 위임자는 직접 투표를 행사하여 검증인의 표와 다른 표를 행사할 수 있습니다. 투표 기간이 끝난 후, 프로포절이 50% 이상의 `Yes`표를 받았고 (`Abstain` 표를 제외하고) `NoWithVeto` (`Abstain` 표를 제외하고) 표가 33.33% 이하일 경우 통과하게 됩니다. -### 거버넌스 트랜잭션 +### 거버넌스 참여하기 ::: warning **참고: 다음 명령어는 온라인 상태인 컴퓨터에서만 진행이 가능합니다. 해당 명령은 렛저 하드웨어 월렛 기기를 사용해 실행하는 것을 추천드립니다. 오프라인으로 트랜잭션을 발생하는 방법을 확인하기 위해서는 [여기](#signing-transactions-from-an-offline-computer)를 참고하세요.** @@ -388,33 +427,41 @@ gaiacli query tx ```bash // 프로포절 제안하기 -// <프로포절 종류(type)>=text/parameter_change/software_upgrade -// 플래그 값 예시: <가스 가격(gasPrice)>=0.025uatom +// <프로포절_종류(type)>=text/parameter_change/software_upgrade +// 플래그 값 예시: <가스_가격(gasPrice)>=0.025uatom -gaiacli tx gov submit-proposal --title "Test Proposal" --description "My awesome proposal" --type <프로포절 종류(type)> --deposit=10000000uatom --gas auto --gas-prices <가스 가격(gasPrice)> --from <위임자 키 명칭(delegatorKeyName)> +gaiacli tx gov submit-proposal --title "Test Proposal" --description "My awesome proposal" --type <프로포절_종류(type)> --deposit=10000000uatom --gas auto --gas-prices <가스_가격(gasPrice)> --from <위임자_키_명칭(delegatorKeyName)> -// 프로포절의 예치금 추가하기 +// 프로포절의 보증금 추가하기 // 프로포절의 proposalID 조회: $gaiacli query gov proposals --status deposit_period -// 파라미터 값 예시: <예치금(deposit)>=10000000uatom +// 파라미터 값 예시: <보증금(deposit)>=10000000uatom -gaiacli tx gov deposit <프로포절 ID(proposalID)> <추가할 예치금(deposit)> --gas auto --gas-prices <가스 가격(gasPrice)> --from <위임자 키 명칭(delegatorKeyName)> +gaiacli tx gov deposit <프로포절_ID(proposalID)> <추가할_보증금(deposit)> --gas auto --gas-prices <가스_가격(gasPrice)> --from <위임자_키_명칭(delegatorKeyName)> // 프로포절에 투표하기 // 프로포절의 proposalID 조회: $gaiacli query gov proposals --status voting_period -// <표 선택(option)>=yes/no/no_with_veto/abstain +// <표_선택(option)>=yes/no/no_with_veto/abstain -gaiacli tx gov vote <프로포절 ID(proposalID)> <표 선택(option)> --gas auto --gas-prices <가스 가격(gasPrice)> --from <위임자 키 명칭(delegatorKeyName)> +gaiacli tx gov vote <프로포절_ID(proposalID)> <표_선택(option)> --gas auto --gas-prices <가스_가격(gasPrice)> --from <위임자_키_명칭(delegatorKeyName)> ``` ## 오프라인 컴퓨터에서 트랜잭션 서명하기 -렛저 기기가 없거나 오프라인 컴퓨터에서 프라이빗 키를 관리하고 싶으신 경우, 다음 절차를 따라하세요. 우선 **온라인** 컴퓨터에서 미서명 트랜잭션을 다음과 같이 생성하십시오 (예시 명령어에는 본딩 트랜잭션이 포함되어 있습니다): +렛저 기기가 없거나 오프라인 컴퓨터에서 프라이빗 키를 관리하고 싶으신 경우, 다음 절차를 따라하세요. 우선 **온라인** 컴퓨터에서 미서명 트랜잭션을 다음과 같이 생성하십시오 (다음 예시에서는 위임 트랜잭션을 예시로 사용합니다): ```bash // 아톰 본딩하기 // 플래그 값 예시: <본딩할 수량(amountToBond)>=10000000uatom, <위임할 검증인의 bech32 주소(bech32AddressOfValidator)>=cosmosvaloper18thamkhnj9wz8pa4nhnp9rldprgant57pk2m8s, <가스 가격(gasPrice)>=0.025uatom -gaiacli tx staking --amount <본딩할 수량(amountToBond)> --validator <위임할 검증인의 bech32 주소(bech32AddressOfValidator)> --gas auto --gas-prices <가스 가격(gasPrice)> --generate-only > unsignedTX.json +gaiacli tx staking delegate <검증인_주소(validatorAddress)> <위임할_수량(amountToBond)> --from <위임자_주소(delegatorAddress)> --gas auto --gas-adjustment 1.5 --gas-prices <가스_가격(gasPrice)> --generate-only > unsignedTX.json +``` + +서명을 진행하기 위해서는 `chain-id`, `account-number`, 그리고 `sequence` 값이 필요합니다. `chain-id`는 트랜잭션을 전송할 블록체인의 고유 식별 번호입니다. `account-number`는 계정이 처음 자산을 받을 때 생성되는 고유 번호입니다. `sequence`는 리플레이 공격을 방지하기 위해 전송한 트랜잭션의 수량을 기록하는데 사용됩니다. + +체인 아이디(chain-id) 값은 해당 블록체인의 제네시스 파일에서 받으실 수 있습니다 (현재 기준 코스모스 허브는 `cosmoshub-2`). account-number와 sequence는 계정 조회 명령어를 사용해 확인하실 수 있습니다. + +```bash +gaiacli query account <계정_주소(yourAddress)> --chain-id cosmoshub-2 ``` 이후 서명이 진행되지 않은 `unsignedTx.json` 파일을 복사하신 후 (USB 등을 이용하여) 오프라인 컴퓨터로 이동하십시오. 만약 오프라인 컴퓨터에 아직 계정을 생성하지 않으셨을 경우, [이 항목](#using-a-computer)을 참고하여 오프라인 컴퓨터에서 계정을 생성하세요. 안전을 위해서 서명하기 전에 다음 명령어를 실행해 트랜잭션의 파라미터를 한번 더 확인하십시오: @@ -426,11 +473,11 @@ cat unsignedTx.json 이제 다음 명령어를 실행해 트랜잭션을 서명합니다: ```bash -gaiacli tx sign unsignedTx.json --from <위임자 키 명칭(delegatorKeyName)> > signedTx.json +gaiacli tx sign unsignedTx.json --from <위임자_키_명칭(delegatorKeyName)> --offline --chain-id cosmoshub-2 --sequence <시퀀스(sequence)> --account-number <계정_번호(accountNumber)> > signedTx.json ``` 서명된 `signedTx.json` 파일을 복사하시고 다시 온라인 컴퓨터로 이동하세요. 다음 명령어를 실행해 해당 트랜잭션을 네트워크에 전파하세요: ```bash gaiacli tx broadcast signedTx.json -``` \ No newline at end of file +``` From 364c3a7b419e3139ae2adcfd705497d05abfb053 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Mon, 21 Oct 2019 03:50:43 +0200 Subject: [PATCH 035/685] Merge PR #166: Update reproducible builds to go1.13 --- contrib/gitian-build.sh | 8 ++++---- contrib/gitian-descriptors/gitian-darwin.yml | 12 ++++-------- contrib/gitian-descriptors/gitian-linux.yml | 12 ++++-------- contrib/gitian-descriptors/gitian-windows.yml | 12 ++++-------- 4 files changed, 16 insertions(+), 28 deletions(-) diff --git a/contrib/gitian-build.sh b/contrib/gitian-build.sh index a396cafa5d..af09891f99 100755 --- a/contrib/gitian-build.sh +++ b/contrib/gitian-build.sh @@ -8,15 +8,15 @@ set -euo pipefail GITIAN_CACHE_DIRNAME='.gitian-builder-cache' -GO_DEBIAN_RELEASE='1.12.9-1' -GO_TARBALL="golang-debian-${GO_DEBIAN_RELEASE}.tar.gz" -GO_TARBALL_URL="https://salsa.debian.org/go-team/compiler/golang/-/archive/debian/${GO_DEBIAN_RELEASE}/${GO_TARBALL}" +GO_RELEASE='1.13' +GO_TARBALL="go${GO_RELEASE}.linux-amd64.tar.gz" +GO_TARBALL_URL="https://dl.google.com/go/${GO_TARBALL}" # Defaults DEFAULT_SIGN_COMMAND='gpg --detach-sign' DEFAULT_GAIA_SIGS=${GAIA_SIGS:-'gaia.sigs'} -DEFAULT_GITIAN_REPO='https://github.com/devrandom/gitian-builder' +DEFAULT_GITIAN_REPO='https://github.com/cosmos/gitian-builder' DEFAULT_GBUILD_FLAGS='' DEFAULT_SIGS_REPO='https://github.com/cosmos/gaia.sigs' diff --git a/contrib/gitian-descriptors/gitian-darwin.yml b/contrib/gitian-descriptors/gitian-darwin.yml index ad02496987..af1a65c976 100644 --- a/contrib/gitian-descriptors/gitian-darwin.yml +++ b/contrib/gitian-descriptors/gitian-darwin.yml @@ -23,23 +23,18 @@ remotes: - "url": "https://github.com/cosmos/gaia.git" "dir": "gaia" files: -- "golang-debian-1.12.9-1.tar.gz" +- "go1.13.linux-amd64.tar.gz" script: | set -e -o pipefail - GO_SRC_RELEASE=golang-debian-1.12.9-1 + GO_SRC_RELEASE=go1.13.linux-amd64 GO_SRC_TARBALL="${GO_SRC_RELEASE}.tar.gz" # Compile go and configure the environment export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" export BUILD_DIR=`pwd` tar xf "${GO_SRC_TARBALL}" rm -f "${GO_SRC_TARBALL}" - [ -d "${GO_SRC_RELEASE}/" ] - mv "${GO_SRC_RELEASE}/" go/ - pushd go/ - QUILT_PATCHES=debian/patches quilt push -a - fakeroot debian/rules build RUN_TESTS=false GOCACHE=/tmp/go-cache - popd + [ -d go/ ] export GOOS=darwin export GOROOT=${BUILD_DIR}/go @@ -95,6 +90,7 @@ script: | pushd ${distsrc} for prog in gaiacli gaiad; do GOARCH=${arch} GOROOT_FINAL=${GOROOT} go build -a \ + -trimpath \ -gcflags=all=-trimpath=${GOPATH} \ -asmflags=all=-trimpath=${GOPATH} \ -mod=readonly -tags "netgo ledger" \ diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index ba03f92d23..74a0165ad9 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -23,23 +23,18 @@ remotes: - "url": "https://github.com/cosmos/gaia.git" "dir": "gaia" files: -- "golang-debian-1.12.9-1.tar.gz" +- "go1.13.linux-amd64.tar.gz" script: | set -e -o pipefail - GO_SRC_RELEASE=golang-debian-1.12.9-1 + GO_SRC_RELEASE=go1.13.linux-amd64 GO_SRC_TARBALL="${GO_SRC_RELEASE}.tar.gz" # Compile go and configure the environment export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" export BUILD_DIR=`pwd` tar xf "${GO_SRC_TARBALL}" rm -f "${GO_SRC_TARBALL}" - [ -d "${GO_SRC_RELEASE}/" ] - mv "${GO_SRC_RELEASE}/" go/ - pushd go/ - QUILT_PATCHES=debian/patches quilt push -a - fakeroot debian/rules build RUN_TESTS=false GOCACHE=/tmp/go-cache - popd + [ -d go/ ] export GOROOT=${BUILD_DIR}/go export GOPATH=${BUILD_DIR}/gopath @@ -94,6 +89,7 @@ script: | pushd ${distsrc} for prog in gaiacli gaiad; do GOARCH=${arch} GOROOT_FINAL=${GOROOT} go build -a \ + -trimpath \ -gcflags=all=-trimpath=${GOPATH} \ -asmflags=all=-trimpath=${GOPATH} \ -mod=readonly -tags "netgo ledger" \ diff --git a/contrib/gitian-descriptors/gitian-windows.yml b/contrib/gitian-descriptors/gitian-windows.yml index ce04b28e15..a4a6ebac50 100644 --- a/contrib/gitian-descriptors/gitian-windows.yml +++ b/contrib/gitian-descriptors/gitian-windows.yml @@ -23,23 +23,18 @@ remotes: - "url": "https://github.com/cosmos/gaia.git" "dir": "gaia" files: -- "golang-debian-1.12.9-1.tar.gz" +- "go1.13.linux-amd64.tar.gz" script: | set -e -o pipefail - GO_SRC_RELEASE=golang-debian-1.12.9-1 + GO_SRC_RELEASE=go1.13.linux-amd64 GO_SRC_TARBALL="${GO_SRC_RELEASE}.tar.gz" # Compile go and configure the environment export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" export BUILD_DIR=`pwd` tar xf "${GO_SRC_TARBALL}" rm -f "${GO_SRC_TARBALL}" - [ -d "${GO_SRC_RELEASE}/" ] - mv "${GO_SRC_RELEASE}/" go/ - pushd go/ - QUILT_PATCHES=debian/patches quilt push -a - fakeroot debian/rules build RUN_TESTS=false GOCACHE=/tmp/go-cache - popd + [ -d go/ ] export GOOS=windows export GOROOT=${BUILD_DIR}/go @@ -96,6 +91,7 @@ script: | for prog in gaiacli gaiad; do exe=${prog}.exe GOARCH=${arch} GOROOT_FINAL=${GOROOT} go build -a \ + -trimpath \ -gcflags=all=-trimpath=${GOPATH} \ -asmflags=all=-trimpath=${GOPATH} \ -mod=readonly -tags "netgo ledger" \ From bd10ee5c62a1206c03a21d0f71a9e9308765cdb7 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Mon, 21 Oct 2019 15:37:54 +0200 Subject: [PATCH 036/685] Merge PR #167: Fix MacOS CI build --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e5ae7805d0..c0254659ab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -272,7 +272,7 @@ jobs: name: Test full gaia simulation command: | source $BASH_ENV - make sim-gaia-fast + make test-sim-gaia-fast docker-image: executor: golang From 43f6078ca5db01f18e9d72f8dcdff33105e70901 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Wed, 23 Oct 2019 15:33:32 +0200 Subject: [PATCH 037/685] Merge PR #170: Fix Makefile's all target dependencies --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0df09ade34..f656a37567 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)' # The below include contains the tools target. include contrib/devtools/Makefile -all: install lint check +all: install lint test build: go.sum ifeq ($(OS),Windows_NT) From 69d18954e0be21c9a528fca00ac2bc59b4613133 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Fri, 25 Oct 2019 14:22:08 +0100 Subject: [PATCH 038/685] Merge PR #171: Update gitian-builder repository's location --- contrib/gitian-build.sh | 4 ++-- contrib/gitian-descriptors/gitian-darwin.yml | 4 ++-- contrib/gitian-descriptors/gitian-linux.yml | 4 ++-- contrib/gitian-descriptors/gitian-windows.yml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/contrib/gitian-build.sh b/contrib/gitian-build.sh index af09891f99..2e0516b082 100755 --- a/contrib/gitian-build.sh +++ b/contrib/gitian-build.sh @@ -8,7 +8,7 @@ set -euo pipefail GITIAN_CACHE_DIRNAME='.gitian-builder-cache' -GO_RELEASE='1.13' +GO_RELEASE='1.13.3' GO_TARBALL="go${GO_RELEASE}.linux-amd64.tar.gz" GO_TARBALL_URL="https://dl.google.com/go/${GO_TARBALL}" @@ -16,7 +16,7 @@ GO_TARBALL_URL="https://dl.google.com/go/${GO_TARBALL}" DEFAULT_SIGN_COMMAND='gpg --detach-sign' DEFAULT_GAIA_SIGS=${GAIA_SIGS:-'gaia.sigs'} -DEFAULT_GITIAN_REPO='https://github.com/cosmos/gitian-builder' +DEFAULT_GITIAN_REPO='https://github.com/tendermint/gitian-builder' DEFAULT_GBUILD_FLAGS='' DEFAULT_SIGS_REPO='https://github.com/cosmos/gaia.sigs' diff --git a/contrib/gitian-descriptors/gitian-darwin.yml b/contrib/gitian-descriptors/gitian-darwin.yml index af1a65c976..e7f81a2ce8 100644 --- a/contrib/gitian-descriptors/gitian-darwin.yml +++ b/contrib/gitian-descriptors/gitian-darwin.yml @@ -23,11 +23,11 @@ remotes: - "url": "https://github.com/cosmos/gaia.git" "dir": "gaia" files: -- "go1.13.linux-amd64.tar.gz" +- "go1.13.3.linux-amd64.tar.gz" script: | set -e -o pipefail - GO_SRC_RELEASE=go1.13.linux-amd64 + GO_SRC_RELEASE=go1.13.3.linux-amd64 GO_SRC_TARBALL="${GO_SRC_RELEASE}.tar.gz" # Compile go and configure the environment export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 74a0165ad9..10e1c926e4 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -23,11 +23,11 @@ remotes: - "url": "https://github.com/cosmos/gaia.git" "dir": "gaia" files: -- "go1.13.linux-amd64.tar.gz" +- "go1.13.3.linux-amd64.tar.gz" script: | set -e -o pipefail - GO_SRC_RELEASE=go1.13.linux-amd64 + GO_SRC_RELEASE=go1.13.3.linux-amd64 GO_SRC_TARBALL="${GO_SRC_RELEASE}.tar.gz" # Compile go and configure the environment export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" diff --git a/contrib/gitian-descriptors/gitian-windows.yml b/contrib/gitian-descriptors/gitian-windows.yml index a4a6ebac50..3841ad6e53 100644 --- a/contrib/gitian-descriptors/gitian-windows.yml +++ b/contrib/gitian-descriptors/gitian-windows.yml @@ -23,11 +23,11 @@ remotes: - "url": "https://github.com/cosmos/gaia.git" "dir": "gaia" files: -- "go1.13.linux-amd64.tar.gz" +- "go1.13.3.linux-amd64.tar.gz" script: | set -e -o pipefail - GO_SRC_RELEASE=go1.13.linux-amd64 + GO_SRC_RELEASE=go1.13.3.linux-amd64 GO_SRC_TARBALL="${GO_SRC_RELEASE}.tar.gz" # Compile go and configure the environment export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" From b873cb16ec12163c5bf67f05e9dd6d74a0e38af5 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2019 14:46:38 -0400 Subject: [PATCH 039/685] Bump github.com/tendermint/tendermint from 0.32.6 to 0.32.7 (#173) Bumps [github.com/tendermint/tendermint](https://github.com/tendermint/tendermint) from 0.32.6 to 0.32.7. - [Release notes](https://github.com/tendermint/tendermint/releases) - [Changelog](https://github.com/tendermint/tendermint/blob/v0.32.7/CHANGELOG.md) - [Commits](https://github.com/tendermint/tendermint/compare/v0.32.6...v0.32.7) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index a664f7c36f..51de107fa5 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/spf13/viper v1.4.0 github.com/stretchr/testify v1.4.0 github.com/tendermint/go-amino v0.15.1 - github.com/tendermint/tendermint v0.32.6 + github.com/tendermint/tendermint v0.32.7 github.com/tendermint/tm-db v0.2.0 golang.org/x/crypto v0.0.0-20190909091759-094676da4a83 // indirect golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect diff --git a/go.sum b/go.sum index 1a24de7639..6d9d27746c 100644 --- a/go.sum +++ b/go.sum @@ -272,6 +272,8 @@ github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJk github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU= github.com/tendermint/tendermint v0.32.6 h1:HozXi0USWvKrWuEh5ratnJV10ykkTy4nwXUi0UvPVzg= github.com/tendermint/tendermint v0.32.6/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE= +github.com/tendermint/tendermint v0.32.7 h1:Szu5Fm1L3pvn3t4uQxPAcP+7ndZEQKgLie/yokM56rU= +github.com/tendermint/tendermint v0.32.7/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE= 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= From d518038d0bac440f2f3826fb35ec0f5981efbc03 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Mon, 4 Nov 2019 10:42:10 -0700 Subject: [PATCH 040/685] Merge PR #175: Bump SDK to latest master --- app/params.go | 37 ++++++++++---------- app/sim_test.go | 82 +++++++++++++++++++++----------------------- cli_test/cli_test.go | 5 +-- go.mod | 2 +- go.sum | 22 ++++++------ 5 files changed, 73 insertions(+), 75 deletions(-) diff --git a/app/params.go b/app/params.go index e896ca7acc..c56d333727 100644 --- a/app/params.go +++ b/app/params.go @@ -2,22 +2,23 @@ package app // Simulation parameter constants const ( - StakePerAccount = "stake_per_account" - InitiallyBondedValidators = "initially_bonded_validators" - OpWeightDeductFee = "op_weight_deduct_fee" - OpWeightMsgSend = "op_weight_msg_send" - OpWeightSingleInputMsgMultiSend = "op_weight_single_input_msg_multisend" - OpWeightMsgSetWithdrawAddress = "op_weight_msg_set_withdraw_address" - OpWeightMsgWithdrawDelegationReward = "op_weight_msg_withdraw_delegation_reward" - OpWeightMsgWithdrawValidatorCommission = "op_weight_msg_withdraw_validator_commission" - OpWeightSubmitVotingSlashingTextProposal = "op_weight_submit_voting_slashing_text_proposal" - OpWeightSubmitVotingSlashingCommunitySpendProposal = "op_weight_submit_voting_slashing_community_spend_proposal" - OpWeightSubmitVotingSlashingParamChangeProposal = "op_weight_submit_voting_slashing_param_change_proposal" - OpWeightMsgDeposit = "op_weight_msg_deposit" - OpWeightMsgCreateValidator = "op_weight_msg_create_validator" - OpWeightMsgEditValidator = "op_weight_msg_edit_validator" - OpWeightMsgDelegate = "op_weight_msg_delegate" - OpWeightMsgUndelegate = "op_weight_msg_undelegate" - OpWeightMsgBeginRedelegate = "op_weight_msg_begin_redelegate" - OpWeightMsgUnjail = "op_weight_msg_unjail" + StakePerAccount = "stake_per_account" + InitiallyBondedValidators = "initially_bonded_validators" + OpWeightDeductFee = "op_weight_deduct_fee" + OpWeightMsgSend = "op_weight_msg_send" + OpWeightMsgMultiSend = "op_weight_msg_multisend" + OpWeightMsgSetWithdrawAddress = "op_weight_msg_set_withdraw_address" + OpWeightMsgWithdrawDelegationReward = "op_weight_msg_withdraw_delegation_reward" + OpWeightMsgWithdrawValidatorCommission = "op_weight_msg_withdraw_validator_commission" + OpWeightSubmitTextProposal = "op_weight_submit_text_proposal" + OpWeightSubmitCommunitySpendProposal = "op_weight_submit_community_spend_proposal" + OpWeightSubmitParamChangeProposal = "op_weight_submit_param_change_proposal" + OpWeightMsgDeposit = "op_weight_msg_deposit" + OpWeightMsgVote = "op_weight_msg_vote" + OpWeightMsgCreateValidator = "op_weight_msg_create_validator" + OpWeightMsgEditValidator = "op_weight_msg_edit_validator" + OpWeightMsgDelegate = "op_weight_msg_delegate" + OpWeightMsgUndelegate = "op_weight_msg_undelegate" + OpWeightMsgBeginRedelegate = "op_weight_msg_begin_redelegate" + OpWeightMsgUnjail = "op_weight_msg_unjail" ) diff --git a/app/sim_test.go b/app/sim_test.go index 2924d24f3e..01c521e00b 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -9,7 +9,6 @@ import ( "testing" "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" dbm "github.com/tendermint/tm-db" @@ -19,20 +18,19 @@ import ( "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - authsimops "github.com/cosmos/cosmos-sdk/x/auth/simulation/operations" - banksimops "github.com/cosmos/cosmos-sdk/x/bank/simulation/operations" + banksim "github.com/cosmos/cosmos-sdk/x/bank/simulation" distr "github.com/cosmos/cosmos-sdk/x/distribution" - distrsimops "github.com/cosmos/cosmos-sdk/x/distribution/simulation/operations" + distrsim "github.com/cosmos/cosmos-sdk/x/distribution/simulation" "github.com/cosmos/cosmos-sdk/x/gov" - govsimops "github.com/cosmos/cosmos-sdk/x/gov/simulation/operations" + govsim "github.com/cosmos/cosmos-sdk/x/gov/simulation" "github.com/cosmos/cosmos-sdk/x/mint" "github.com/cosmos/cosmos-sdk/x/params" - paramsimops "github.com/cosmos/cosmos-sdk/x/params/simulation/operations" + paramsim "github.com/cosmos/cosmos-sdk/x/params/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/cosmos/cosmos-sdk/x/slashing" - slashingsimops "github.com/cosmos/cosmos-sdk/x/slashing/simulation/operations" + slashingsim "github.com/cosmos/cosmos-sdk/x/slashing/simulation" "github.com/cosmos/cosmos-sdk/x/staking" - stakingsimops "github.com/cosmos/cosmos-sdk/x/staking/simulation/operations" + stakingsim "github.com/cosmos/cosmos-sdk/x/staking/simulation" "github.com/cosmos/cosmos-sdk/x/supply" ) @@ -59,112 +57,112 @@ func testAndRunTxs(app *GaiaApp, config simulation.Config) []simulation.Weighted { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(app.cdc, OpWeightDeductFee, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgSend, &v, nil, func(_ *rand.Rand) { - v = 5 + v = 100 }) return v }(nil), - authsimops.SimulateDeductFee(app.accountKeeper, app.supplyKeeper), + banksim.SimulateMsgSend(app.accountKeeper, app.bankKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(app.cdc, OpWeightMsgSend, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgMultiSend, &v, nil, func(_ *rand.Rand) { - v = 100 + v = 40 }) return v }(nil), - banksimops.SimulateMsgSend(app.accountKeeper, app.bankKeeper), + banksim.SimulateMsgMultiSend(app.accountKeeper, app.bankKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(app.cdc, OpWeightSingleInputMsgMultiSend, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgSetWithdrawAddress, &v, nil, func(_ *rand.Rand) { - v = 10 + v = 50 }) return v }(nil), - banksimops.SimulateSingleInputMsgMultiSend(app.accountKeeper, app.bankKeeper), + distrsim.SimulateMsgSetWithdrawAddress(app.accountKeeper, app.distrKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(app.cdc, OpWeightMsgSetWithdrawAddress, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgWithdrawDelegationReward, &v, nil, func(_ *rand.Rand) { v = 50 }) return v }(nil), - distrsimops.SimulateMsgSetWithdrawAddress(app.distrKeeper), + distrsim.SimulateMsgWithdrawDelegatorReward(app.accountKeeper, app.distrKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(app.cdc, OpWeightMsgWithdrawDelegationReward, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgWithdrawValidatorCommission, &v, nil, func(_ *rand.Rand) { v = 50 }) return v }(nil), - distrsimops.SimulateMsgWithdrawDelegatorReward(app.distrKeeper), + distrsim.SimulateMsgWithdrawValidatorCommission(app.accountKeeper, app.distrKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(app.cdc, OpWeightMsgWithdrawValidatorCommission, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightSubmitTextProposal, &v, nil, func(_ *rand.Rand) { - v = 50 + v = 20 }) return v }(nil), - distrsimops.SimulateMsgWithdrawValidatorCommission(app.distrKeeper), + govsim.SimulateSubmitProposal(app.accountKeeper, app.govKeeper, govsim.SimulateTextProposalContent), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(app.cdc, OpWeightSubmitVotingSlashingTextProposal, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightSubmitCommunitySpendProposal, &v, nil, func(_ *rand.Rand) { - v = 5 + v = 20 }) return v }(nil), - govsimops.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, govsimops.SimulateTextProposalContent), + govsim.SimulateSubmitProposal(app.accountKeeper, app.govKeeper, distrsim.SimulateCommunityPoolSpendProposalContent(app.distrKeeper)), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(app.cdc, OpWeightSubmitVotingSlashingCommunitySpendProposal, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightSubmitParamChangeProposal, &v, nil, func(_ *rand.Rand) { - v = 5 + v = 20 }) return v }(nil), - govsimops.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, distrsimops.SimulateCommunityPoolSpendProposalContent(app.distrKeeper)), + govsim.SimulateSubmitProposal(app.accountKeeper, app.govKeeper, paramsim.SimulateParamChangeProposalContent(paramChanges)), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(app.cdc, OpWeightSubmitVotingSlashingParamChangeProposal, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgDeposit, &v, nil, func(_ *rand.Rand) { - v = 5 + v = 100 }) return v }(nil), - govsimops.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, paramsimops.SimulateParamChangeProposalContent(paramChanges)), + govsim.SimulateMsgDeposit(app.accountKeeper, app.govKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(app.cdc, OpWeightMsgDeposit, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgVote, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - govsimops.SimulateMsgDeposit(app.govKeeper), + govsim.SimulateMsgVote(app.accountKeeper, app.govKeeper), }, { func(_ *rand.Rand) int { @@ -175,18 +173,18 @@ func testAndRunTxs(app *GaiaApp, config simulation.Config) []simulation.Weighted }) return v }(nil), - stakingsimops.SimulateMsgCreateValidator(app.accountKeeper, app.stakingKeeper), + stakingsim.SimulateMsgCreateValidator(app.accountKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { var v int ap.GetOrGenerate(app.cdc, OpWeightMsgEditValidator, &v, nil, func(_ *rand.Rand) { - v = 5 + v = 20 }) return v }(nil), - stakingsimops.SimulateMsgEditValidator(app.stakingKeeper), + stakingsim.SimulateMsgEditValidator(app.accountKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { @@ -197,7 +195,7 @@ func testAndRunTxs(app *GaiaApp, config simulation.Config) []simulation.Weighted }) return v }(nil), - stakingsimops.SimulateMsgDelegate(app.accountKeeper, app.stakingKeeper), + stakingsim.SimulateMsgDelegate(app.accountKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { @@ -208,7 +206,7 @@ func testAndRunTxs(app *GaiaApp, config simulation.Config) []simulation.Weighted }) return v }(nil), - stakingsimops.SimulateMsgUndelegate(app.accountKeeper, app.stakingKeeper), + stakingsim.SimulateMsgUndelegate(app.accountKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { @@ -219,7 +217,7 @@ func testAndRunTxs(app *GaiaApp, config simulation.Config) []simulation.Weighted }) return v }(nil), - stakingsimops.SimulateMsgBeginRedelegate(app.accountKeeper, app.stakingKeeper), + stakingsim.SimulateMsgBeginRedelegate(app.accountKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { @@ -230,7 +228,7 @@ func testAndRunTxs(app *GaiaApp, config simulation.Config) []simulation.Weighted }) return v }(nil), - slashingsimops.SimulateMsgUnjail(app.slashingKeeper), + slashingsim.SimulateMsgUnjail(app.accountKeeper, app.slashingKeeper, app.stakingKeeper), }, } } diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index b4a5aed8a2..908cd03a13 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -602,8 +602,9 @@ func TestGaiaCLISubmitProposal(t *testing.T) { tests.WaitForNextNBlocksTM(1, f.Port) // Test limit on proposals query - proposalsQuery = f.QueryGovProposals("--limit=1") - require.Equal(t, uint64(2), proposalsQuery[0].ProposalID) + proposalsQuery = f.QueryGovProposals("--limit=2") + require.Len(t, proposalsQuery, 2) + require.Equal(t, uint64(1), proposalsQuery[0].ProposalID) f.Cleanup() } diff --git a/go.mod b/go.mod index 51de107fa5..5fae1c2006 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.13 require ( github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect - github.com/cosmos/cosmos-sdk v0.34.4-0.20191015202154-28347bf5f736 + github.com/cosmos/cosmos-sdk v0.34.4-0.20191031200835-02c6c9fafd58 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/golang/mock v1.3.1 // indirect github.com/onsi/ginkgo v1.8.0 // indirect diff --git a/go.sum b/go.sum index 6d9d27746c..23fd330106 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg= 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/99designs/keyring v1.1.3 h1:mEV3iyZWjkxQ7R8ia8GcG97vCX5zQQ7n4o8R2BylwQY= +github.com/99designs/keyring v1.1.3/go.mod h1:657DQuMrBZRtuL/voxVyiyb6zpMehlm5vLB9Qwrv904= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -40,13 +40,13 @@ 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-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/cosmos/cosmos-sdk v0.34.4-0.20191015202154-28347bf5f736 h1:LPdkBmnrEw9bDH4KshLiRVuy9EJrJyWS+8T0YpZkGGE= -github.com/cosmos/cosmos-sdk v0.34.4-0.20191015202154-28347bf5f736/go.mod h1:DATGOvgReTZJ+NJRi+Z4Pi6DxuabkOU51MZhyP4qtY0= +github.com/cosmos/cosmos-sdk v0.34.4-0.20191031200835-02c6c9fafd58 h1:B3fXc6Y9ztj9glE2ANU0+NQJ0M1BXaG5LpnyKFwHW4M= +github.com/cosmos/cosmos-sdk v0.34.4-0.20191031200835-02c6c9fafd58/go.mod h1:PuN72vbZxlorpnHmoIl6RjzVMXEOMejmwORJlZ74K7Q= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= -github.com/cosmos/ledger-cosmos-go v0.10.3 h1:Qhi5yTR5Pg1CaTpd00pxlGwNl4sFRdtK1J96OTjeFFc= -github.com/cosmos/ledger-cosmos-go v0.10.3/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= +github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= +github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= 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/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= @@ -187,8 +187,8 @@ github.com/otiai10/mint v1.2.4/go.mod h1:d+b7n/0R3tdyUYYylALXpWQ/kTN+QobSq/4SRGB github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.5.0 h1:5BakdOZdtKJ1FFk6QdL8iSGrMWsXgchNJcrnarjbmJQ= -github.com/pelletier/go-toml v1.5.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= +github.com/pelletier/go-toml v1.6.0 h1:aetoXYr0Tv7xRU/V4B4IZJ2QcbtMUFoNb3ORp7TzIK4= +github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= 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/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -262,16 +262,14 @@ github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7 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/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= -github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae h1:AOXNM7c2Vvo45SjAgeWF8Wy+NS7/NCqzRNpUc+HPAec= -github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= github.com/tendermint/go-amino v0.15.1 h1:D2uk35eT4iTsvJd9jWIetzthE5C0/k2QmMFkCN+4JgQ= github.com/tendermint/go-amino v0.15.1/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8= github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o= github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU= -github.com/tendermint/tendermint v0.32.6 h1:HozXi0USWvKrWuEh5ratnJV10ykkTy4nwXUi0UvPVzg= -github.com/tendermint/tendermint v0.32.6/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE= github.com/tendermint/tendermint v0.32.7 h1:Szu5Fm1L3pvn3t4uQxPAcP+7ndZEQKgLie/yokM56rU= github.com/tendermint/tendermint v0.32.7/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE= github.com/tendermint/tm-db v0.1.1/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= From 5c4b08266f90cc7f2e5cab8fc3b5e192dda46d9b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2019 15:30:47 -0500 Subject: [PATCH 041/685] Bump github.com/spf13/viper from 1.4.0 to 1.5.0 (#179) Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.4.0 to 1.5.0. - [Release notes](https://github.com/spf13/viper/releases) - [Commits](https://github.com/spf13/viper/compare/v1.4.0...v1.5.0) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 5fae1c2006..bfef81451c 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa github.com/spf13/afero v1.2.2 // indirect github.com/spf13/cobra v0.0.5 - github.com/spf13/viper v1.4.0 + github.com/spf13/viper v1.5.0 github.com/stretchr/testify v1.4.0 github.com/tendermint/go-amino v0.15.1 github.com/tendermint/tendermint v0.32.7 diff --git a/go.sum b/go.sum index 23fd330106..1fc4ba1357 100644 --- a/go.sum +++ b/go.sum @@ -248,6 +248,8 @@ github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7Sr 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/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.5.0 h1:GpsTwfsQ27oS/Aha/6d1oD7tpKIqWnOA6tgOX9HHkt4= +github.com/spf13/viper v1.5.0/go.mod h1:AkYRkVJF8TkSG/xet6PzXX+l39KhhXa2pdqVSxnTcn4= 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.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= @@ -258,6 +260,8 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy 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/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= 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/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= From c48202e1aa7e22aacf566ca9a96283d35afddb9d Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Mon, 4 Nov 2019 14:32:53 -0700 Subject: [PATCH 042/685] Merge PR #182: add v2.0.3 section --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cea677e191..2dc7d12da0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,13 @@ flag and configuration. * (gaiacli) [\#132](https://github.com/cosmos/gaia/pull/132) Add `tx decode` command to decode Base64 encoded transactions. +## [v2.0.3] - 2019-11-04 + +### Improvements + +* (sdk) Bump SDK version to [v0.37.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.37.4). +* (tendermint) Bump Tendermint version to [v0.32.7](https://github.com/tendermint/tendermint/releases/tag/v0.32.7). + ## [v2.0.2] - 2019-10-12 ### Improvements @@ -130,7 +137,8 @@ not rely on the `x/supply` keeper to get module account addresses for blacklisti -[Unreleased]: https://github.com/cosmos/gaia/compare/v2.0.2...HEAD +[Unreleased]: https://github.com/cosmos/gaia/compare/v2.0.3...HEAD +[v2.0.3]: https://github.com/cosmos/gaia/releases/tag/v2.0.3 [v2.0.2]: https://github.com/cosmos/gaia/releases/tag/v2.0.2 [v2.0.1]: https://github.com/cosmos/gaia/releases/tag/v2.0.1 [v2.0.0]: https://github.com/cosmos/gaia/releases/tag/v2.0.0 From a88a62bde2a6dac91c24d3ea251850e6d659cc92 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Sat, 9 Nov 2019 19:27:34 -0500 Subject: [PATCH 043/685] Merge PR #190: Bump SDK version to latest master --- CHANGELOG.md | 1 + app/app.go | 31 ++++++++++++++++++++++--------- go.mod | 2 +- go.sum | 6 ++++-- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dc7d12da0..e044aef970 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ flag and configuration. * (gaiacli) [\#132](https://github.com/cosmos/gaia/pull/132) Add `tx decode` command to decode Base64 encoded transactions. +* (modules) [\#190](https://github.com/cosmos/gaia/pull/190) Introduce use of the `x/evidence` module. ## [v2.0.3] - 2019-11-04 diff --git a/app/app.go b/app/app.go index 6ba0e34a91..8a8d111981 100644 --- a/app/app.go +++ b/app/app.go @@ -20,6 +20,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/crisis" distr "github.com/cosmos/cosmos-sdk/x/distribution" + "github.com/cosmos/cosmos-sdk/x/evidence" "github.com/cosmos/cosmos-sdk/x/genutil" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/mint" @@ -54,6 +55,7 @@ var ( crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, supply.AppModuleBasic{}, + evidence.AppModuleBasic{}, ) // module account permissions @@ -90,7 +92,7 @@ type GaiaApp struct { // keys to access the substores keys map[string]*sdk.KVStoreKey - tkeys map[string]*sdk.TransientStoreKey + tKeys map[string]*sdk.TransientStoreKey // keepers accountKeeper auth.AccountKeeper @@ -103,6 +105,7 @@ type GaiaApp struct { govKeeper gov.Keeper crisisKeeper crisis.Keeper paramsKeeper params.Keeper + evidenceKeeper *evidence.Keeper // the module manager mm *module.Manager @@ -124,22 +127,22 @@ func NewGaiaApp( 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, + bam.MainStoreKey, auth.StoreKey, staking.StoreKey, supply.StoreKey, + mint.StoreKey, distr.StoreKey, slashing.StoreKey, gov.StoreKey, + params.StoreKey, evidence.StoreKey, ) - tkeys := sdk.NewTransientStoreKeys(staking.TStoreKey, params.TStoreKey) + tKeys := sdk.NewTransientStoreKeys(staking.TStoreKey, params.TStoreKey) app := &GaiaApp{ BaseApp: bApp, cdc: cdc, invCheckPeriod: invCheckPeriod, keys: keys, - tkeys: tkeys, + tKeys: tKeys, } // init params keeper and subspaces - app.paramsKeeper = params.NewKeeper(app.cdc, keys[params.StoreKey], tkeys[params.TStoreKey], params.DefaultCodespace) + app.paramsKeeper = params.NewKeeper(app.cdc, keys[params.StoreKey], tKeys[params.TStoreKey], params.DefaultCodespace) authSubspace := app.paramsKeeper.Subspace(auth.DefaultParamspace) bankSubspace := app.paramsKeeper.Subspace(bank.DefaultParamspace) stakingSubspace := app.paramsKeeper.Subspace(staking.DefaultParamspace) @@ -148,6 +151,7 @@ func NewGaiaApp( slashingSubspace := app.paramsKeeper.Subspace(slashing.DefaultParamspace) govSubspace := app.paramsKeeper.Subspace(gov.DefaultParamspace).WithKeyTable(gov.ParamKeyTable()) crisisSubspace := app.paramsKeeper.Subspace(crisis.DefaultParamspace) + evidenceSubspace := app.paramsKeeper.Subspace(evidence.DefaultParamspace) // add keepers app.accountKeeper = auth.NewAccountKeeper(app.cdc, keys[auth.StoreKey], authSubspace, auth.ProtoBaseAccount) @@ -164,6 +168,14 @@ func NewGaiaApp( ) app.crisisKeeper = crisis.NewKeeper(crisisSubspace, invCheckPeriod, app.supplyKeeper, auth.FeeCollectorName) + // create evidence keeper with evidence router + app.evidenceKeeper = evidence.NewKeeper( + app.cdc, keys[evidence.StoreKey], evidenceSubspace, evidence.DefaultCodespace, + ) + evidenceRouter := evidence.NewRouter() + // TODO: Register evidence routes. + app.evidenceKeeper.SetRouter(evidenceRouter) + // register the proposal types govRouter := gov.NewRouter() govRouter.AddRoute(gov.RouterKey, gov.ProposalHandler). @@ -193,6 +205,7 @@ func NewGaiaApp( mint.NewAppModule(app.mintKeeper), slashing.NewAppModule(app.slashingKeeper, app.stakingKeeper), staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper), + evidence.NewAppModule(*app.evidenceKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -207,7 +220,7 @@ func NewGaiaApp( app.mm.SetOrderInitGenesis( distr.ModuleName, staking.ModuleName, auth.ModuleName, bank.ModuleName, slashing.ModuleName, gov.ModuleName, mint.ModuleName, supply.ModuleName, - crisis.ModuleName, genutil.ModuleName, + crisis.ModuleName, genutil.ModuleName, evidence.ModuleName, ) app.mm.RegisterInvariants(&app.crisisKeeper) @@ -232,7 +245,7 @@ func NewGaiaApp( // initialize stores app.MountKVStores(keys) - app.MountTransientStores(tkeys) + app.MountTransientStores(tKeys) // initialize BaseApp app.SetInitChainer(app.InitChainer) diff --git a/go.mod b/go.mod index bfef81451c..3d4bb2ad86 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.13 require ( github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect - github.com/cosmos/cosmos-sdk v0.34.4-0.20191031200835-02c6c9fafd58 + github.com/cosmos/cosmos-sdk v0.34.4-0.20191108144056-d81d46192a0c github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/golang/mock v1.3.1 // indirect github.com/onsi/ginkgo v1.8.0 // indirect diff --git a/go.sum b/go.sum index 1fc4ba1357..43fbc60899 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,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-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/cosmos/cosmos-sdk v0.34.4-0.20191031200835-02c6c9fafd58 h1:B3fXc6Y9ztj9glE2ANU0+NQJ0M1BXaG5LpnyKFwHW4M= -github.com/cosmos/cosmos-sdk v0.34.4-0.20191031200835-02c6c9fafd58/go.mod h1:PuN72vbZxlorpnHmoIl6RjzVMXEOMejmwORJlZ74K7Q= +github.com/cosmos/cosmos-sdk v0.34.4-0.20191108144056-d81d46192a0c h1:XYIUjgiFabdbRTvhqeY9Dc7k95bvFbgC47mv/Dk13S8= +github.com/cosmos/cosmos-sdk v0.34.4-0.20191108144056-d81d46192a0c/go.mod h1:0sLtjU+qex1OfpGQHjWhJByx74IoH78R742PEAdoQJk= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -375,5 +375,7 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c= +gopkg.in/yaml.v2 v2.2.5/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-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 5bc422e6868d04747e50b467e8eeb31ae2fe98a3 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Tue, 12 Nov 2019 14:47:21 -0500 Subject: [PATCH 044/685] Migration Instructions/Doc: cosmoshub-2 (#185) * add hub-2 migration instructions * add readme * update to use v2.0.3 * add min go version * commit suggestions from @winslyn --- docs/migration/README.md | 5 + docs/migration/cosmoshub-2.md | 214 ++++++++++++++++++++++++++++++++++ 2 files changed, 219 insertions(+) create mode 100644 docs/migration/README.md create mode 100644 docs/migration/cosmoshub-2.md diff --git a/docs/migration/README.md b/docs/migration/README.md new file mode 100644 index 0000000000..4ac7f564c0 --- /dev/null +++ b/docs/migration/README.md @@ -0,0 +1,5 @@ +# Migration Instructions + +This directory houses Cosmos Hub major upgrade migration instructions. + +- [Upgrading from `cosmoshub-2` to `cosmoshub-3`](cosmoshub-2.md) diff --git a/docs/migration/cosmoshub-2.md b/docs/migration/cosmoshub-2.md new file mode 100644 index 0000000000..9905d42bfc --- /dev/null +++ b/docs/migration/cosmoshub-2.md @@ -0,0 +1,214 @@ +# Cosmos Hub 2 Upgrade Instructions + +The following document describes the necessary steps involved that full-node operators +must take in order to upgrade from `cosmoshub-2` to `cosmoshub-3`. The Tendermint team +will post an official updated genesis file, but it is recommended that validators +execute the following instructions in order to verify the resulting genesis file. + +There is a strong social consensus around proposal [PLACEHOLDER] on `cosmoshub-2`. +This indicates that the upgrade procedure should be performed on [PLACEHOLDER] on block [PLACEHOLDER]. + + - [Preliminary](#preliminary) + - [Major Updates](#major-updates) + - [Risks](#risks) + - [Recovery](#recovery) + - [Upgrade Procedure](#upgrade-procedure) + - [Notes for Service Providers](#notes-for-service-providers) + +## Preliminary + +Many changes have occurred to the Cosmos SDK and the Gaia application since the latest +major upgrade (`cosmoshub-2`). These changes notably consist of many new features, +protocol changes, and application structural changes that favor developer ergonomics +and application development. + +First and foremost, the [Cosmos SDK](https://github.com/cosmos/cosmos-sdk/) and the +[Gaia](https://github.com/cosmos/gaia) application have been split into separate +repositories. This allows for both the Cosmos SDK and Gaia to evolve naturally +and independently. Thus, any future [releases](https://github.com/cosmos/gaia/releases) +of Gaia going forward, including this one, will be built and tagged from this +repository not the Cosmos SDK. + +Since the Cosmos SDK and Gaia have now been split into separate repositories, their +versioning will also naturally diverge. In an attempt to decrease community confusion and strive for +semantic versioning, the [Cosmos SDK](https://github.com/cosmos/cosmos-sdk/) will continue +on its current versioning path (i.e. v0.36.x ) and the [Gaia](https://github.com/cosmos/gaia) +application will become v2.0.x. + +__[Gaia](https://github.com/cosmos/gaia) application v2.0.3 is +what full node operators will upgrade to and run in this next major upgrade__. + +## Major Updates + +There are many notable features and changes in the upcoming release of the SDK. Many of these +are discussed at a high level in July's Cosmos development update found +[here](https://blog.cosmos.network/cosmos-development-update-july-2019-8df2ade5ba0a). + +Some of the biggest changes to take note on when upgrading as a developer or client are the the following: + +- **Tagging/Events**: The entire system of what we used to call tags has been replaced by a more + robust and flexible system called events. Any client that depended on querying or subscribing to + tags should take note on the new format as old queries will not work and must be updated. More in + depth docs on the events system can be found [here](https://github.com/tendermint/tendermint/blob/master/rpc/core/events.go). + In addition, each module documents its own events in the specs (e.g. [slashing](https://github.com/cosmos/cosmos-sdk/blob/v0.36.0/docs/spec/slashing/06_events.md)). +- **Height Queries**: Both the CLI and REST clients now (re-)enable height queries via the + `--height` and `?height` arguments respectively. An important note to keep in mind are that height + queries against pruning nodes will return errors when a pruned height is queried against. When no + height is provided, the latest height will be used by default keeping current behavior intact. In + addition, many REST responses now wrap the query results in a new structure `{"height": ..., "result": ...}`. + That is, the height is now returned to the client for which the resource was queried at. + +## Risks + +As a validator performing the upgrade procedure on your consensus nodes carries a heightened risk of +double-signing and being slashed. The most important piece of this procedure is verifying your +software version and genesis file hash before starting your validator and signing. + +The riskiest thing a validator can do is discover that they made a mistake and repeat the upgrade +procedure again during the network startup. If you discover a mistake in the process, the best thing +to do is wait for the network to start before correcting it. If the network is halted and you have +started with a different genesis file than the expected one, seek advice from a Tendermint developer +before resetting your validator. + +## Recovery + +Prior to exporting `cosmoshub-2` state, validators are encouraged to take a full data snapshot at the +export height before proceeding. Snapshotting depends heavily on infrastructure, but generally this +can be done by backing up the `.gaiacli` and `.gaiad` directories. + +In the event that the upgrade does not succeed, validators and operators must downgrade back to +v0.34.6+ of the _Cosmos SDK_ and restore to their latest snapshot before restarting their nodes. + +## Upgrade Procedure + +__Note__: It is assumed you are currently operating a full-node running v0.34.6+ of the _Cosmos SDK_. + +- The version/commit hash of Gaia v2.0.3: `2f6783e298f25ff4e12cb84549777053ab88749a` +- The upgrade height as agreed upon by governance: **[PLACEHOLDER]** +- You may obtain the canonical UTC timestamp of the exported block by any of the following methods: + - Block explorer (e.g. [Hubble](https://hubble.figment.network/cosmos/chains/cosmoshub-2/blocks/[PLACEHOLDER]?format=json&kind=block)) + - Through manually querying an RPC node (e.g. `/block?height=[PLACEHOLDER]`) + - Through manually querying a Gaia REST client (e.g. `/blocks/[PLACEHOLDER]`) + +1. Verify you are currently running the correct version (v0.34.6+) of the _Cosmos SDK_: + + ```shell + $ gaiad version --long + cosmos-sdk: 0.34.6 + git commit: 80234baf91a15dd9a7df8dca38677b66b8d148c1 + vendor hash: f60176672270c09455c01e9d880079ba36130df4f5cd89df58b6701f50b13aad + build tags: netgo ledger + go version go1.12.2 linux/amd64 + ``` + +2. Export existing state from `cosmoshub-2`: + + **NOTE**: It is recommended for validators and operators to take a full data snapshot at the export + height before proceeding in case the upgrade does not go as planned or if not enough voting power + comes online in a sufficient and agreed upon amount of time. In such a case, the chain will fallback + to continue operating `cosmoshub-2`. See [Recovery](#recovery) for details on how to proceed. + + Before exporting state via the following command, the `gaiad` binary must be stopped! + + ```shell + $ gaiad export --for-zero-height --height=[PLACEHOLDER] > cosmoshub_2_genesis_export.json + ``` + +3. Verify the SHA256 of the (sorted) exported genesis file: + + ```shell + $ jq -S -c -M '' cosmoshub_2_genesis_export.json | shasum -a 256 + [PLACEHOLDER] cosmoshub_2_genesis_export.json + ``` + +4. At this point you now have a valid exported genesis state! All further steps now require +v2.0.3 of [Gaia](https://github.com/cosmos/gaia). + + **NOTE**: Go [1.13+](https://golang.org/dl/) is required! + + ```shell + $ git clone https://github.com/cosmos/gaia.git; git checkout v2.0.3; make install + ``` + +5. Verify you are currently running the correct version (v2.0.3) of the _Gaia_: + + ```shell + $ gaiad version --long + name: gaia + server_name: gaiad + client_name: gaiacli + version: 2.0.3 + commit: 2f6783e298f25ff4e12cb84549777053ab88749a + build_tags: netgo,ledger + go: go version go1.13.3 darwin/amd64 + ``` + +6. Migrate exported state from the current v0.34.6+ version to the new v2.0.3 version: + + ```shell + $ gaiad migrate v0.36 cosmoshub_2_genesis_export.json --chain-id=cosmoshub-3 --genesis-time=[PLACEHOLDER]> genesis.json + ``` + + **NOTE**: The `migrate` command takes an input genesis state and migrates it to a targeted version. + Both v0.36 and v0.37 are compatible as far as state structure is concerned. + + Genesis time should be computed relative to the blocktime of [PLACEHOLDER]. The genesis time shall be + the blocktime of [PLACEHOLDER] + [PLACEHOLDER] minutes with the subseconds truncated. + + An example shell command(tested on OS X Mojave) to compute this values is: + + ```shell + curl https://stargate.cosmos.network:26657/block\?height\=1933000 | jq -r '.result["block_meta"]["header"]["time"]'|xargs -0 date -v +60M -j -f "%Y-%m-%dT%H:%M:%S" +"%Y-%m-%dT%H:%M:%SZ" + ``` + +7. Now we must update all parameters that have been agreed upon through governance. There is only a +single parameter, `max_validators`, that we're upgrading based on [proposal 10](https://www.mintscan.io/proposals/10) + + ```shell + $ cat genesis.json | jq '.app_state["staking"]["params"]["max_validators"]=125' > tmp_genesis.json && mv tmp_genesis.json genesis.json + ``` + +8. Verify the SHA256 of the final genesis JSON: + + ```shell + $ jq -S -c -M '' genesis.json | shasum -a 256 + [PLACEHOLDER] genesis.json + ``` + +9. Reset state: + + **NOTE**: Be sure you have a complete backed up state of your node before proceeding with this step. + See [Recovery](#recovery) for details on how to proceed. + + ```shell + $ gaiad unsafe-reset-all + ``` + +10. Move the new `genesis.json` to your `.gaiad/config/` directory +11. Replace the `db_backend` on `.gaiad/config/config.toml` to: + + ```toml + db_backend = "goleveldb" + ``` + +12. Note, if you have any application configuration in `gaiad.toml`, that file has now been renamed to `app.toml`: + + ```shell + $ mv .gaiad/config/gaiad.toml .gaiad/config/app.toml + ``` + +## Notes for Service Providers + +1. The transition from `cosmoshub-2` to `cosmoshub-3` contains an unusual amount of API breakage. + After this upgrade will maintain the CosmosSDK API stability guarantee to avoid breaking APIs for at + least 6 months and hopefully long. +2. Anyone running signing infrastructure(wallets and exchanges) should be conscious that the `type:` + field on `StdTx` will have changed from `"type":"auth/StdTx","value":...` to `"type":"cosmos-sdk/StdTx","value":...` +3. As mentioned in the notes and SDK CHANGELOG, many queries to cosmos cli are wrapped with `height` fields now. +4. We highly recommend standing up a [testnet](https://github.com/cosmos/gaia/blob/master/docs/deploy-testnet.md) + with the `gaia-2.0` release or joining the gaia-13006 testnet. More info for joining the testnet can be + found in the [riot validator room](https://riot.im/app/#/room/#cosmos-validators:matrix.org). +5. We expect that developers with iOS or Android based apps may have to notify their users of downtime + and ship an upgrade for cosmoshub-3 compatibility unless they have some kind of switch they can throw + for the new tx formats. Server side applications should experience briefer service interruptions and + be able to just spin up new nodes and migrate to the new apis From 1069c5b88a706ed44e1eb81f4de14176f9e78ac9 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Thu, 14 Nov 2019 08:00:46 -0800 Subject: [PATCH 045/685] Merge PR #193: Add @fedekunze to CODEOWNERS --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1b5c56f02d..5233beb348 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # CODEOWNERS: https://help.github.com/articles/about-codeowners/ # Primary repo maintainers -* @alessio @alexanderbez @rigelrozanski @jackzampolin \ No newline at end of file +* @alessio @alexanderbez @rigelrozanski @jackzampolin @fedekunze From 967fc43f1afc0972ca6a35342f01024ae734f7fd Mon Sep 17 00:00:00 2001 From: Marko Date: Thu, 14 Nov 2019 21:04:50 +0100 Subject: [PATCH 046/685] Merge PR #188: Add linting to CI * Add some linting to gaia - closes #187 Signed-off-by: Marko Baricevic * fail tests * tests pass * address PR comments * some more strictness --- .golangci.yml | 60 ++++++++++++++++++++++++++++++----- app/app.go | 6 ++-- app/app_test.go | 5 +-- app/benchmarks/txsize_test.go | 5 ++- app/export.go | 12 ++++--- app/sim_test.go | 55 ++++++++++++++++++++++++-------- cli_test/test_helpers.go | 5 ++- cmd/contract_tests/main.go | 1 + cmd/gaiad/replay.go | 5 ++- cmd/gaiad/testnet.go | 1 + cmd/gaiadebug/hack.go | 17 +++------- cmd/gaiadebug/main.go | 14 ++++---- lcd_test/helpers.go | 18 ++++++----- lcd_test/helpers_test.go | 25 ++++++--------- lcd_test/lcd_test.go | 12 ++++--- 15 files changed, 160 insertions(+), 81 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index ce8010e7ab..c177059086 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,17 +1,61 @@ linters: - disable-all: true enable: + - bodyclose + - deadcode + - depguard + - dogsled - errcheck + - goconst + - gocritic + - gofmt + - goimports - golint + - gosec + - gosimple + - govet - ineffassign - - unconvert + - interfacer - misspell + - maligned + - nakedret + - prealloc + - scopelint + - staticcheck + - structcheck + - stylecheck + - typecheck + - unconvert + - unused + - varcheck + +issues: + exclude-rules: + - text: "Use of weak random number generator" + linters: + - gosec + - text: "ST1003:" + linters: + - stylecheck + linters-settings: - gocyclo: - min-complexity: 11 + dogsled: + max-blank-identifiers: 3 + maligned: + # print struct with more effective memory layout or not, false by default + suggest-new: true errcheck: - ignore: fmt:.*,io/ioutil:^Read.*,github.com/spf13/cobra:MarkFlagRequired,github.com/spf13/viper:BindPFlag + # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; + # default is false: such cases aren't reported by default. + check-blank: true golint: - min-confidence: 1.1 -run: - tests: false + # minimal confidence for issues, default is 0.8 + min-confidence: 0 + prealloc: + # XXX: we don't recommend using this linter before doing performance profiling. + # For most programs usage of prealloc will be a premature optimization. + + # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. + # True by default. + simple: false + range-loops: true # Report preallocation suggestions on range loops, true by default + for-loops: true # Report preallocation suggestions on for loops, false by default diff --git a/app/app.go b/app/app.go index 8a8d111981..57366c2332 100644 --- a/app/app.go +++ b/app/app.go @@ -34,13 +34,13 @@ import ( const appName = "GaiaApp" var ( - // default home directories for gaiacli + // DefaultCLIHome default home directories for gaiacli DefaultCLIHome = os.ExpandEnv("$HOME/.gaiacli") - // default home directories for gaiad + // DefaultNodeHome default home directories for gaiad DefaultNodeHome = os.ExpandEnv("$HOME/.gaiad") - // The module BasicManager is in charge of setting up basic, + // ModuleBasics The module BasicManager is in charge of setting up basic, // non-dependant module elements, such as codec registration // and genesis verification. ModuleBasics = module.NewBasicManager( diff --git a/app/app_test.go b/app/app_test.go index 7f8b971d2c..1052573b3b 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -17,11 +17,12 @@ import ( func TestGaiadExport(t *testing.T) { db := db.NewMemDB() gapp := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) - setGenesis(gapp) + err := setGenesis(gapp) + require.NoError(t, err) // Making a new app object with the db, so that initchain hasn't been called newGapp := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) - _, _, err := newGapp.ExportAppStateAndValidators(false, []string{}) + _, _, err = newGapp.ExportAppStateAndValidators(false, []string{}) require.NoError(t, err, "ExportAppStateAndValidators should not have an error") } diff --git a/app/benchmarks/txsize_test.go b/app/benchmarks/txsize_test.go index f1d658c7b0..4863cedc6d 100644 --- a/app/benchmarks/txsize_test.go +++ b/app/benchmarks/txsize_test.go @@ -31,7 +31,10 @@ func ExampleTxSendSize() { fee := auth.NewStdFee(gas, coins) signBytes := auth.StdSignBytes("example-chain-ID", 1, 1, fee, []sdk.Msg{msg1}, "") - sig, _ := priv1.Sign(signBytes) + sig, err := priv1.Sign(signBytes) + if err != nil { + return + } sigs := []auth.StdSignature{{nil, sig}} tx := auth.NewStdTx([]sdk.Msg{msg1}, fee, sigs, "") fmt.Println(len(cdc.MustMarshalBinaryBare([]sdk.Msg{msg1}))) diff --git a/app/export.go b/app/export.go index f8e7e7490c..90e0f24c75 100644 --- a/app/export.go +++ b/app/export.go @@ -60,14 +60,20 @@ func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []st // withdraw all validator commission app.stakingKeeper.IterateValidators(ctx, func(_ int64, val staking.ValidatorI) (stop bool) { - _, _ = app.distrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) + _, err := app.distrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) + if err != nil { + log.Fatal(err) + } return false }) // withdraw all delegator rewards dels := app.stakingKeeper.GetAllDelegations(ctx) for _, delegation := range dels { - _, _ = app.distrKeeper.WithdrawDelegationRewards(ctx, delegation.DelegatorAddress, delegation.ValidatorAddress) + _, err := app.distrKeeper.WithdrawDelegationRewards(ctx, delegation.DelegatorAddress, delegation.ValidatorAddress) + if err != nil { + log.Fatal(err) + } } // clear validator slash events @@ -128,7 +134,6 @@ func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []st iter := sdk.KVStoreReversePrefixIterator(store, staking.ValidatorsKey) counter := int16(0) - var valConsAddrs []sdk.ConsAddress for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(iter.Key()[1:]) validator, found := app.stakingKeeper.GetValidator(ctx, addr) @@ -137,7 +142,6 @@ func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []st } validator.UnbondingHeight = 0 - valConsAddrs = append(valConsAddrs, validator.ConsAddress()) if applyWhiteList && !whiteListMap[addr.String()] { validator.Jailed = true } diff --git a/app/sim_test.go b/app/sim_test.go index 01c521e00b..0ade11ea04 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -252,8 +252,16 @@ func BenchmarkFullAppSimulation(b *testing.B) { config := simapp.NewConfigFromFlags() var db dbm.DB - dir, _ := ioutil.TempDir("", "goleveldb-app-sim") - db, _ = sdk.NewLevelDB("Simulation", dir) + dir, err := ioutil.TempDir("", "goleveldb-app-sim") + if err != nil { + fmt.Println(err) + b.Fail() + } + db, err = sdk.NewLevelDB("Simulation", dir) + if err != nil { + fmt.Println(err) + b.Fail() + } defer func() { db.Close() _ = os.RemoveAll(dir) @@ -310,8 +318,10 @@ func TestFullAppSimulation(t *testing.T) { } var db dbm.DB - dir, _ := ioutil.TempDir("", "goleveldb-app-sim") - db, _ = sdk.NewLevelDB("Simulation", dir) + dir, err := ioutil.TempDir("", "goleveldb-app-sim") + require.NoError(t, err) + db, err = sdk.NewLevelDB("Simulation", dir) + require.NoError(t, err) defer func() { db.Close() @@ -364,8 +374,10 @@ func TestAppImportExport(t *testing.T) { } var db dbm.DB - dir, _ := ioutil.TempDir("", "goleveldb-app-sim") - db, _ = sdk.NewLevelDB("Simulation", dir) + dir, err := ioutil.TempDir("", "goleveldb-app-sim") + require.NoError(t, err) + db, err = sdk.NewLevelDB("Simulation", dir) + require.NoError(t, err) defer func() { db.Close() @@ -408,8 +420,10 @@ func TestAppImportExport(t *testing.T) { require.NoError(t, err) fmt.Printf("importing genesis...\n") - newDir, _ := ioutil.TempDir("", "goleveldb-app-sim-2") - newDB, _ := sdk.NewLevelDB("Simulation-2", dir) + newDir, err := ioutil.TempDir("", "goleveldb-app-sim-2") + require.NoError(t, err) + newDB, err := sdk.NewLevelDB("Simulation-2", dir) + require.NoError(t, err) defer func() { newDB.Close() @@ -480,8 +494,10 @@ func TestAppSimulationAfterImport(t *testing.T) { logger = log.NewNopLogger() } - dir, _ := ioutil.TempDir("", "goleveldb-app-sim") - db, _ := sdk.NewLevelDB("Simulation", dir) + dir, err := ioutil.TempDir("", "goleveldb-app-sim") + require.NoError(t, err) + db, err := sdk.NewLevelDB("Simulation", dir) + require.NoError(t, err) defer func() { db.Close() @@ -534,8 +550,10 @@ func TestAppSimulationAfterImport(t *testing.T) { fmt.Printf("Importing genesis...\n") - newDir, _ := ioutil.TempDir("", "goleveldb-app-sim-2") - newDB, _ := sdk.NewLevelDB("Simulation-2", dir) + newDir, err := ioutil.TempDir("", "goleveldb-app-sim-2") + require.NoError(t, err) + newDB, err := sdk.NewLevelDB("Simulation-2", dir) + require.NoError(t, err) defer func() { newDB.Close() @@ -613,8 +631,16 @@ func BenchmarkInvariants(b *testing.B) { config := simapp.NewConfigFromFlags() config.AllInvariants = false - dir, _ := ioutil.TempDir("", "goleveldb-app-invariant-bench") - db, _ := sdk.NewLevelDB("simulation", dir) + dir, err := ioutil.TempDir("", "goleveldb-app-invariant-bench") + if err != nil { + fmt.Println(err) + b.Fail() + } + db, err := sdk.NewLevelDB("simulation", dir) + if err != nil { + fmt.Println(err) + b.Fail() + } defer func() { db.Close() @@ -656,6 +682,7 @@ func BenchmarkInvariants(b *testing.B) { // NOTE: We use the crisis keeper as it has all the invariants registered with // their respective metadata which makes it useful for testing/benchmarking. for _, cr := range gapp.crisisKeeper.Routes() { + cr := cr b.Run(fmt.Sprintf("%s/%s", cr.ModuleName, cr.Route), func(b *testing.B) { if res, stop := cr.Invar(ctx); stop { fmt.Printf("broken invariant at block %d of %d\n%s", ctx.BlockHeight()-1, config.NumBlocks, res) diff --git a/cli_test/test_helpers.go b/cli_test/test_helpers.go index 43c2716f78..b385a46207 100644 --- a/cli_test/test_helpers.go +++ b/cli_test/test_helpers.go @@ -45,6 +45,7 @@ const ( ) var ( + // nolint:varcheck,deadcode,unused totalCoins = sdk.NewCoins( sdk.NewCoin(fee2Denom, sdk.TokensFromConsensusPower(2000000)), sdk.NewCoin(feeDenom, sdk.TokensFromConsensusPower(2000000)), @@ -171,7 +172,7 @@ func InitFixtures(t *testing.T) (f *Fixtures) { f.GenTx(keyFoo) f.CollectGenTxs() - return + return f } // Cleanup is meant to be run at the end of a test to clean up an remaining test state @@ -757,6 +758,7 @@ func WriteToNewTempFile(t *testing.T, s string) *os.File { return fp } +//nolint:deadcode,unused func marshalStdTx(t *testing.T, stdTx auth.StdTx) []byte { cdc := app.MakeCodec() bz, err := cdc.MarshalBinaryBare(stdTx) @@ -764,6 +766,7 @@ func marshalStdTx(t *testing.T, stdTx auth.StdTx) []byte { return bz } +//nolint:deadcode,unused func unmarshalStdTx(t *testing.T, s string) (stdTx auth.StdTx) { cdc := app.MakeCodec() require.Nil(t, cdc.UnmarshalJSON([]byte(s), &stdTx)) diff --git a/cmd/contract_tests/main.go b/cmd/contract_tests/main.go index 740c771f34..4f27b03387 100644 --- a/cmd/contract_tests/main.go +++ b/cmd/contract_tests/main.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "github.com/snikch/goodman/hooks" "github.com/snikch/goodman/transaction" ) diff --git a/cmd/gaiad/replay.go b/cmd/gaiad/replay.go index 5e161d0578..011c722c13 100644 --- a/cmd/gaiad/replay.go +++ b/cmd/gaiad/replay.go @@ -116,7 +116,10 @@ func replayTxs(rootDir string) error { return err } defer func() { - _ = proxyApp.Stop() + err = proxyApp.Stop() + if err != nil { + return + } }() state := tmsm.LoadState(tmDB) diff --git a/cmd/gaiad/testnet.go b/cmd/gaiad/testnet.go index 53a56f07ad..e1d42439b4 100644 --- a/cmd/gaiad/testnet.go +++ b/cmd/gaiad/testnet.go @@ -113,6 +113,7 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, gaiaConfig := srvconfig.DefaultConfig() gaiaConfig.MinGasPrices = minGasPrices + //nolint:prealloc var ( genAccounts []authexported.GenesisAccount genFiles []string diff --git a/cmd/gaiadebug/hack.go b/cmd/gaiadebug/hack.go index 89afc4de96..c5e196e516 100644 --- a/cmd/gaiadebug/hack.go +++ b/cmd/gaiadebug/hack.go @@ -1,7 +1,6 @@ package main import ( - "encoding/base64" "encoding/hex" "fmt" "os" @@ -14,7 +13,6 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/libs/log" @@ -26,7 +24,7 @@ import ( func runHackCmd(cmd *cobra.Command, args []string) error { if len(args) != 1 { - return fmt.Errorf("Expected 1 arg") + return fmt.Errorf("expected 1 arg") } // ".gaiad" @@ -88,16 +86,11 @@ func runHackCmd(cmd *cobra.Command, args []string) error { } } -func base64ToPub(b64 string) ed25519.PubKeyEd25519 { - data, _ := base64.StdEncoding.DecodeString(b64) - var pubKey ed25519.PubKeyEd25519 - copy(pubKey[:], data) - return pubKey - -} - func hexToBytes(h string) []byte { - trouble, _ := hex.DecodeString(h) + trouble, err := hex.DecodeString(h) + if err != nil { + return nil + } return trouble } diff --git a/cmd/gaiadebug/main.go b/cmd/gaiadebug/main.go index 44fc8734c5..caee734ce3 100644 --- a/cmd/gaiadebug/main.go +++ b/cmd/gaiadebug/main.go @@ -73,7 +73,7 @@ var rawBytesCmd = &cobra.Command{ func runRawBytesCmd(cmd *cobra.Command, args []string) error { if len(args) != 1 { - return fmt.Errorf("Expected single arg") + return fmt.Errorf("expected single arg") } stringBytes := args[0] stringBytes = strings.Trim(stringBytes, "[") @@ -94,7 +94,7 @@ func runRawBytesCmd(cmd *cobra.Command, args []string) error { func runPubKeyCmd(cmd *cobra.Command, args []string) error { if len(args) != 1 { - return fmt.Errorf("Expected single arg") + return fmt.Errorf("expected single arg") } pubkeyString := args[0] @@ -116,7 +116,7 @@ func runPubKeyCmd(cmd *cobra.Command, args []string) error { var err5 error pubKeyI, err5 = sdk.GetConsPubKeyBech32(pubkeyString) if err5 != nil { - return fmt.Errorf(`Expected hex, base64, or bech32. Got errors: + return fmt.Errorf(`expected hex, base64, or bech32. Got errors: hex: %v, base64: %v bech32 Acc: %v @@ -168,7 +168,7 @@ func runPubKeyCmd(cmd *cobra.Command, args []string) error { func runAddrCmd(cmd *cobra.Command, args []string) error { if len(args) != 1 { - return fmt.Errorf("Expected single arg") + return fmt.Errorf("expected single arg") } addrString := args[0] @@ -185,7 +185,7 @@ func runAddrCmd(cmd *cobra.Command, args []string) error { addr, err3 = sdk.ValAddressFromBech32(addrString) if err3 != nil { - return fmt.Errorf(`Expected hex or bech32. Got errors: + return fmt.Errorf(`expected hex or bech32. Got errors: hex: %v, bech32 acc: %v bech32 val: %v @@ -207,7 +207,7 @@ func runAddrCmd(cmd *cobra.Command, args []string) error { func runTxCmd(cmd *cobra.Command, args []string) error { if len(args) != 1 { - return fmt.Errorf("Expected single arg") + return fmt.Errorf("expected single arg") } txString := args[0] @@ -218,7 +218,7 @@ func runTxCmd(cmd *cobra.Command, args []string) error { var err2 error txBytes, err2 = base64.StdEncoding.DecodeString(txString) if err2 != nil { - return fmt.Errorf(`Expected hex or base64. Got errors: + return fmt.Errorf(`expected hex or base64. Got errors: hex: %v, base64: %v `, err, err2) diff --git a/lcd_test/helpers.go b/lcd_test/helpers.go index 28ed3a2446..dea38486f2 100644 --- a/lcd_test/helpers.go +++ b/lcd_test/helpers.go @@ -134,7 +134,7 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd privVal.Reset() if nValidators < 1 { - err = errors.New("InitializeLCD must use at least one validator") + err = errors.New("initializeLCD must use at least one validator") return } @@ -150,9 +150,11 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd } // append any additional (non-proposing) validators - var genTxs []auth.StdTx - var genAccounts []authexported.GenesisAccount - + //nolint:prealloc + var ( + genTxs []auth.StdTx + genAccounts []authexported.GenesisAccount + ) totalSupply := sdk.ZeroInt() for i := 0; i < nValidators; i++ { @@ -280,14 +282,14 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd if !(mintData.Params.InflationMax.Equal(sdk.MustNewDecFromStr("15000.0")) && mintData.Minter.Inflation.Equal(sdk.MustNewDecFromStr("10000.0")) && mintData.Params.InflationMin.Equal(sdk.MustNewDecFromStr("10000.0"))) { - err = errors.New("Mint parameters does not correspond to their defaults") + err = errors.New("mint parameters does not correspond to their defaults") return } } else { if !(mintData.Params.InflationMax.Equal(sdk.ZeroDec()) && mintData.Minter.Inflation.Equal(sdk.ZeroDec()) && mintData.Params.InflationMin.Equal(sdk.ZeroDec())) { - err = errors.New("Mint parameters not equal to decimal 0") + err = errors.New("mint parameters not equal to decimal 0") return } } @@ -298,7 +300,7 @@ func defaultGenesis(config *tmcfg.Config, nValidators int, initAddrs []sdk.AccAd } genDoc.AppState = appState - return + return genDoc, valConsPubKeys, valOperAddrs, privVal, err } // startTM creates and starts an in-process Tendermint node with memDB and @@ -412,7 +414,7 @@ func CreateAddrs(kb crkeys.Keybase, numAddrs int) (addrs []sdk.AccAddress, seeds passwords = append(passwords, addrSeeds[i].Password) } - return + return addrs, seeds, names, passwords, errs } // AddrSeed combines an Address with the mnemonic of the private key to that address diff --git a/lcd_test/helpers_test.go b/lcd_test/helpers_test.go index 72531ccaf2..3a3fdd4ffe 100644 --- a/lcd_test/helpers_test.go +++ b/lcd_test/helpers_test.go @@ -1,3 +1,4 @@ +//nolint:unused,deadcode,bodyclose package lcdtest import ( @@ -115,7 +116,7 @@ func getBlock(t *testing.T, port string, height int, expectFail bool) ctypes.Res func extractResultFromResponse(t *testing.T, body []byte) []byte { var resp rest.ResponseWithHeight - require.NoError(t, cdc.UnmarshalJSON([]byte(body), &resp)) + require.NoError(t, cdc.UnmarshalJSON(body, &resp)) return resp.Result } @@ -155,6 +156,7 @@ func getTransaction(t *testing.T, port string, hash string) sdk.TxResponse { err := cdc.UnmarshalJSON([]byte(body), &tx) require.NoError(t, err) + return tx } @@ -176,6 +178,7 @@ func getTransactions(t *testing.T, port string, tags ...string) *sdk.SearchTxsRe require.Equal(t, http.StatusOK, res.StatusCode, body) err := cdc.UnmarshalJSON([]byte(body), &result) + require.NoError(t, err) return &result } @@ -190,6 +193,7 @@ func getKeys(t *testing.T, port string) []keys.KeyOutput { var m []keys.KeyOutput err := cdc.UnmarshalJSON([]byte(body), &m) require.Nil(t, err) + return m } @@ -205,6 +209,7 @@ func doKeysPost(t *testing.T, port, name, password, mnemonic string, account int var resp keys.KeyOutput err = cdc.UnmarshalJSON([]byte(body), &resp) require.Nil(t, err, body) + return resp } @@ -212,10 +217,10 @@ func doKeysPost(t *testing.T, port, name, password, mnemonic string, account int func getKeysSeed(t *testing.T, port string) string { res, body := Request(t, port, "GET", "/keys/seed", nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - reg, err := regexp.Compile(`([a-z]+ ){12}`) - require.Nil(t, err) + reg := regexp.MustCompile(`([a-z]+ ){12}`) match := reg.MatchString(body) require.True(t, match, "Returned seed has wrong format", body) + return body } @@ -244,6 +249,7 @@ func getKey(t *testing.T, port, name string) keys.KeyOutput { var resp keys.KeyOutput err := cdc.UnmarshalJSON([]byte(body), &resp) require.Nil(t, err) + return resp } @@ -259,6 +265,7 @@ func updateKey(t *testing.T, port, name, oldPassword, newPassword string, fail b return } require.Equal(t, http.StatusOK, res.StatusCode, body) + } // GET /auth/accounts/{address} Get the account information on blockchain @@ -1129,10 +1136,6 @@ func doUnjail( return txResp } -type unjailReq struct { - BaseReq rest.BaseReq `json:"base_req"` -} - // ICS24 - fee distribution // POST /distribution/delegators/{delgatorAddr}/rewards Withdraw delegator rewards @@ -1165,11 +1168,3 @@ func doWithdrawDelegatorAllRewards( return txResp } - -func mustParseDecCoins(dcstring string) sdk.DecCoins { - dcoins, err := sdk.ParseDecCoins(dcstring) - if err != nil { - panic(err) - } - return dcoins -} diff --git a/lcd_test/lcd_test.go b/lcd_test/lcd_test.go index 96cf1f7171..2b2439ab8f 100644 --- a/lcd_test/lcd_test.go +++ b/lcd_test/lcd_test.go @@ -1,3 +1,4 @@ +//nolint:bodyclose package lcdtest import ( @@ -269,12 +270,13 @@ func TestEncodeTx(t *testing.T) { require.NoError(t, err) defer cleanup() - res, body, _ := doTransferWithGas(t, port, seed, name1, memo, "", addr, "2", 1, false, false, fees) + _, body, _ := doTransferWithGas(t, port, seed, name1, memo, "", addr, "2", 1, false, false, fees) var tx auth.StdTx require.Nil(t, cdc.UnmarshalJSON([]byte(body), &tx)) - encodedJSON, _ := cdc.MarshalJSON(tx) - res, body = Request(t, port, "POST", "/txs/encode", encodedJSON) + encodedJSON, err := cdc.MarshalJSON(tx) + require.NoError(t, err) + res, body := Request(t, port, "POST", "/txs/encode", encodedJSON) // Make sure it came back ok, and that we can decode it back to the transaction // 200 response. @@ -491,7 +493,6 @@ func TestBonding(t *testing.T) { //require.Equal(t, rdTokens.ToDec(), delTokensAfterRedelegation) // verify balance after paying fees - acc = getAccount(t, port, addr) expectedBalance = expectedBalance.Sub(fees[0]) require.True(t, expectedBalance.Amount.LT(coins.AmountOf(sdk.DefaultBondDenom)) || @@ -820,7 +821,8 @@ func TestUnjail(t *testing.T) { // NOTE: any less than this and it fails tests.WaitForHeight(3, port) - pkString, _ := sdk.Bech32ifyConsPub(valPubKeys[0]) + pkString, err := sdk.Bech32ifyConsPub(valPubKeys[0]) + require.NoError(t, err) signingInfo := getSigningInfo(t, port, pkString) tests.WaitForHeight(4, port) require.Equal(t, true, signingInfo.IndexOffset > 0) From 71f3b4f0fc5130f8d1a94e999035ad54cacc5b7a Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Mon, 18 Nov 2019 11:34:26 +0000 Subject: [PATCH 047/685] Drop on-disk keybase in favor of keyring (#164) * Port to new keyring * modify add-genesis-account to use keyring * Adapt lcd tests to use keyring * Attempt to fix localnet ci job * Revert "Attempt to fix localnet ci job" This reverts commit c299dd9ffb2a77a1f3b9b33bb71ef104261ed1fc. * Try pass env var to docker container * localnet does need COSMOS_SDK_TEST_KEYRING to function properly * Revert tiny change * Simplify tests * Refresh against sdk's respective branch latest commit * Refresh against sdk branch's latest commit * Attempt to reduce diff size * Refresh against latest commit * Update against latest commit * Refresh against sdk's latest master * Avoid create temporary keybase * Revert "Avoid create temporary keybase" This reverts commit c3f6d77f373370fea521edabe60c532c676cd9a6. * Update docs * Remove unnecessary arguments * Remove unnecessary arguments * Code cleanup * Refresh sdk module, add upgrade module * Refresh deps * Fix merge * Cleanup, AddrSeed does not need Password anymore --- Makefile | 3 +- cli_test/cli_test.go | 3 +- cli_test/test_helpers.go | 10 +-- cmd/gaiacli/main.go | 1 + cmd/gaiad/genaccounts.go | 6 +- cmd/gaiad/main.go | 1 + cmd/gaiad/testnet.go | 27 ++----- docs/delegator-guide-cli.md | 25 +++++- docs/gaiacli.md | 21 ++++- go.mod | 2 +- go.sum | 4 +- lcd_test/helpers.go | 15 ++-- lcd_test/helpers_test.go | 137 +++++++++++-------------------- lcd_test/lcd_test.go | 156 ++++++++++++++++++------------------ 14 files changed, 191 insertions(+), 220 deletions(-) diff --git a/Makefile b/Makefile index f656a37567..8135f115bc 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ LEDGER_ENABLED ?= true SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g') export GO111MODULE = on +export COSMOS_SDK_TEST_KEYRING = y # process build tags @@ -157,7 +158,7 @@ build-docker-gaiadnode: # Run a 4-node testnet locally localnet-start: build-linux localnet-stop - @if ! [ -f build/node0/gaiad/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/gaiad:Z tendermint/gaiadnode testnet --v 4 -o . --starting-ip-address 192.168.10.2 ; fi + @if ! [ -f build/node0/gaiad/config/genesis.json ]; then docker run -e COSMOS_SDK_TEST_KEYRING=y --rm -v $(CURDIR)/build:/gaiad:Z tendermint/gaiadnode testnet --v 4 -o . --starting-ip-address 192.168.10.2 ; fi docker-compose up -d # Stop testnet diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index 908cd03a13..eb14217a3f 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -828,9 +828,8 @@ func TestGaiaCLIValidateSignatures(t *testing.T) { defer os.Remove(unsignedTxFile.Name()) // validate we can successfully sign - success, stdout, stderr = f.TxSign(keyFoo, unsignedTxFile.Name()) + success, stdout, _ = f.TxSign(keyFoo, unsignedTxFile.Name()) require.True(t, success) - require.Empty(t, stderr) stdTx := unmarshalStdTx(t, stdout) require.Equal(t, len(stdTx.Msgs), 1) require.Equal(t, 1, len(stdTx.GetSignatures())) diff --git a/cli_test/test_helpers.go b/cli_test/test_helpers.go index b385a46207..411c6e9332 100644 --- a/cli_test/test_helpers.go +++ b/cli_test/test_helpers.go @@ -226,13 +226,13 @@ func (f *Fixtures) AddGenesisAccount(address sdk.AccAddress, coins sdk.Coins, fl // GenTx is gaiad gentx func (f *Fixtures) GenTx(name string, flags ...string) { 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), client.DefaultKeyPass) + executeWriteCheckErr(f.T, addFlags(cmd, flags)) } // CollectGenTxs is gaiad collect-gentxs func (f *Fixtures) CollectGenTxs(flags ...string) { cmd := fmt.Sprintf("%s collect-gentxs --home=%s", f.GaiadBinary, f.GaiadHome) - executeWriteCheckErr(f.T, addFlags(cmd, flags), client.DefaultKeyPass) + executeWriteCheckErr(f.T, addFlags(cmd, flags)) } // GDStart runs gaiad start with the appropriate flags and returns a process @@ -271,19 +271,19 @@ func (f *Fixtures) KeysDelete(name string, flags ...string) { // KeysAdd is gaiacli keys add func (f *Fixtures) KeysAdd(name string, flags ...string) { cmd := fmt.Sprintf("%s keys add --home=%s %s", f.GaiacliBinary, f.GaiacliHome, name) - executeWriteCheckErr(f.T, addFlags(cmd, flags), client.DefaultKeyPass) + executeWriteCheckErr(f.T, addFlags(cmd, flags)) } // KeysAddRecover prepares gaiacli keys add --recover 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.GaiacliBinary, f.GaiacliHome, name) - return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass, mnemonic) + return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), mnemonic) } // KeysAddRecoverHDPath prepares gaiacli keys add --recover --account --index 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.GaiacliBinary, f.GaiacliHome, name, account, index) - executeWriteCheckErr(f.T, addFlags(cmd, flags), client.DefaultKeyPass, mnemonic) + executeWriteCheckErr(f.T, addFlags(cmd, flags), mnemonic) } // KeysShow is gaiacli keys show diff --git a/cmd/gaiacli/main.go b/cmd/gaiacli/main.go index fa215a2c10..ecfadad8d2 100644 --- a/cmd/gaiacli/main.go +++ b/cmd/gaiacli/main.go @@ -38,6 +38,7 @@ func main() { config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub) config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub) config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub) + config.SetKeyringServiceName("gaia") config.Seal() // TODO: setup keybase, viper object, etc. to be passed into diff --git a/cmd/gaiad/genaccounts.go b/cmd/gaiad/genaccounts.go index 6c7f7fa389..92c5c3b8f6 100644 --- a/cmd/gaiad/genaccounts.go +++ b/cmd/gaiad/genaccounts.go @@ -1,6 +1,7 @@ package main import ( + "bufio" "errors" "fmt" @@ -40,14 +41,15 @@ the address will be looked up in the local Keybase. The list of initial tokens m contain valid denominations. Accounts may optionally be supplied with vesting parameters. `, Args: cobra.ExactArgs(2), - RunE: func(_ *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, args []string) error { config := ctx.Config config.SetRoot(viper.GetString(cli.HomeFlag)) addr, err := sdk.AccAddressFromBech32(args[0]) + inBuf := bufio.NewReader(cmd.InOrStdin()) if err != nil { // attempt to lookup address from Keybase if no address was provided - kb, err := keys.NewKeyBaseFromDir(viper.GetString(flagClientHome)) + kb, err := keys.NewKeyringFromDir(viper.GetString(flagClientHome), inBuf) if err != nil { return err } diff --git a/cmd/gaiad/main.go b/cmd/gaiad/main.go index 2be4370ae2..24670bef15 100644 --- a/cmd/gaiad/main.go +++ b/cmd/gaiad/main.go @@ -36,6 +36,7 @@ func main() { config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub) config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub) config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub) + config.SetKeyringServiceName("gaia") config.Seal() ctx := server.NewDefaultContext() diff --git a/cmd/gaiad/testnet.go b/cmd/gaiad/testnet.go index e1d42439b4..ab6c4261f2 100644 --- a/cmd/gaiad/testnet.go +++ b/cmd/gaiad/testnet.go @@ -119,6 +119,7 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, genFiles []string ) + inBuf := bufio.NewReader(cmd.InOrStdin()) // generate private keys, node IDs, and initial transactions for i := 0; i < numValidators; i++ { nodeDirName := fmt.Sprintf("%s%d", nodeDirPrefix, i) @@ -157,24 +158,13 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, memo := fmt.Sprintf("%s@%s:26656", nodeIDs[i], ip) genFiles = append(genFiles, config.GenesisFile()) - buf := bufio.NewReader(cmd.InOrStdin()) - prompt := fmt.Sprintf( - "Password for account '%s' (default %s):", nodeDirName, client.DefaultKeyPass, - ) - - keyPass, err := client.GetPassword(prompt, buf) - if err != nil && keyPass != "" { - // An error was returned that either failed to read the password from - // STDIN or the given password is not empty but failed to meet minimum - // length requirements. + kb, err := keys.NewKeyringFromDir(clientDir, inBuf) + if err != nil { return err } - if keyPass == "" { - keyPass = client.DefaultKeyPass - } - - addr, secret, err := server.GenerateSaveCoinKey(clientDir, nodeDirName, keyPass, true) + keyPass := client.DefaultKeyPass + addr, secret, err := server.GenerateSaveCoinKey(kb, nodeDirName, keyPass, true) if err != nil { _ = os.RemoveAll(outputDir) return err @@ -210,13 +200,8 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, sdk.OneInt(), ) - kb, err := keys.NewKeyBaseFromDir(clientDir) - if err != nil { - return err - } - tx := auth.NewStdTx([]sdk.Msg{msg}, auth.StdFee{}, []auth.StdSignature{}, memo) - txBldr := auth.NewTxBuilderFromCLI().WithChainID(chainID).WithMemo(memo).WithKeybase(kb) + txBldr := auth.NewTxBuilderFromCLI(inBuf).WithChainID(chainID).WithMemo(memo).WithKeybase(kb) signedTx, err := txBldr.SignStdTx(nodeDirName, client.DefaultKeyPass, tx, false) if err != nil { diff --git a/docs/delegator-guide-cli.md b/docs/delegator-guide-cli.md index 59e8d870c3..f1964a8217 100644 --- a/docs/delegator-guide-cli.md +++ b/docs/delegator-guide-cli.md @@ -150,11 +150,20 @@ To restore an account using a fundraiser mnemonic and store the associated encry gaiacli keys add --recover ``` -You will be prompted to input a passphrase that is used to encrypt the private key of account `0` on disk. Each time you want to send a transaction, this password will be required. If you lose the password, you can always recover the private key with the mnemonic. - - `` is the name of the account. It is a reference to the account number used to derive the key pair from the mnemonic. You will use this name to identify your account when you want to send a transaction. - You can add the optional `--account` flag to specify the path (`0`, `1`, `2`, ...) you want to use to generate your account. By default, account `0` is generated. +The private key of account `0` will be saved in your operating system's credentials storage. +Each time you want to send a transaction, you will need to unlock your system's credentials store. +If you lose access to your credentials storage, you can always recover the private key with the +mnemonic. + +::: tip +**You may not be prompted for password each time you send a transaction since most operating systems +unlock user's credentials store upon login by default. If you want to change your credentials +store security policies please refer to your operating system manual.** +::: + ### Creating an Account To create an account, you just need to have `gaiacli` installed. Before creating it, you need to know where you intend to store and interact with your private keys. The best options are to store them in an offline dedicated computer or a ledger device. Storing them on your regular online computer involves more risk, since anyone who infiltrates your computer through the internet could exfiltrate your private keys and steal your funds. @@ -197,7 +206,17 @@ To generate an account, just use the following command: gaiacli keys add ``` -The command will generate a 24-words mnemonic and save the private and public keys for account `0` at the same time. You will be prompted to input a passphrase that is used to encrypt the private key of account `0` on disk. Each time you want to send a transaction, this password will be required. If you lose the password, you can always recover the private key with the mnemonic. +The command will generate a 24-words mnemonic and save the private and public keys for account `0` +at the same time. +Each time you want to send a transaction, you will need to unlock your system's credentials store. +If you lose access to your credentials storage, you can always recover the private key with the +mnemonic. + +::: tip +**You may not be prompted for password each time you send a transaction since most operating systems +unlock user's credentials store upon login by default. If you want to change your credentials +store security policies please refer to your operating system manual.** +::: ::: danger **Do not lose or share your 12 words with anyone. To prevent theft or loss of funds, it is best to ensure that you keep multiple copies of your mnemonic, and store it in a safe, secure place and that only you know how to access. If someone is able to gain access to your mnemonic, they will be able to gain access to your private keys and control the accounts associated with them.** diff --git a/docs/gaiacli.md b/docs/gaiacli.md index 502d7c45b1..568157f923 100644 --- a/docs/gaiacli.md +++ b/docs/gaiacli.md @@ -62,6 +62,19 @@ There are three types of key representations that are used: - Get this value with `gaiad tendermint show-validator` - e.g. `cosmosvalconspub1zcjduepq0ms2738680y72v44tfyqm3c9ppduku8fs6sr73fx7m666sjztznqzp2emf` +#### Migrate Keys From Legacy On-Disk Keybase To OS Built-in Secret Store + +Older versions of `gaiacli` used store keys in the user's home directory. If you are migrating +from an old version of `gaiacli` you will need to migrate your old keys into your operating system's +credentials storage by running the following command: + +```bash +gaiacli keys migrate +``` + +The command will prompt for every passphrase. If a passphrase is incorrect, it will skip the +respective key. + #### Generate Keys You'll need an account private and public key pair \(a.k.a. `sk, pk` respectively\) to be able to receive funds, send txs, bond tx, etc. @@ -72,10 +85,10 @@ To generate a new _secp256k1_ key: gaiacli keys add ``` -Next, you will have to create a passphrase to protect the key on disk. The output of the above -command will contain a _seed phrase_. It is recommended to save the _seed phrase_ in a safe -place so that in case you forget the password, you could eventually regenerate the key from -the seed phrase with the following command: +The output of the above command will contain a _seed phrase_. It is recommended to save the _seed +phrase_ in a safe place so that in case you forget the password of the operating system's +credentials store, you could eventually regenerate the key from the seed phrase with the +following command: ```bash gaiacli keys add --recover diff --git a/go.mod b/go.mod index 3d4bb2ad86..08401ad8c8 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.13 require ( github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect - github.com/cosmos/cosmos-sdk v0.34.4-0.20191108144056-d81d46192a0c + github.com/cosmos/cosmos-sdk v0.34.4-0.20191114141721-d4c831e63ad3 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/golang/mock v1.3.1 // indirect github.com/onsi/ginkgo v1.8.0 // indirect diff --git a/go.sum b/go.sum index 43fbc60899..cb9df7b1c9 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,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-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/cosmos/cosmos-sdk v0.34.4-0.20191108144056-d81d46192a0c h1:XYIUjgiFabdbRTvhqeY9Dc7k95bvFbgC47mv/Dk13S8= -github.com/cosmos/cosmos-sdk v0.34.4-0.20191108144056-d81d46192a0c/go.mod h1:0sLtjU+qex1OfpGQHjWhJByx74IoH78R742PEAdoQJk= +github.com/cosmos/cosmos-sdk v0.34.4-0.20191114141721-d4c831e63ad3 h1:vjzTX8arh3cEAHSbxazdRRLS67Gl4JoNY6tcNyjqmms= +github.com/cosmos/cosmos-sdk v0.34.4-0.20191114141721-d4c831e63ad3/go.mod h1:0sLtjU+qex1OfpGQHjWhJByx74IoH78R742PEAdoQJk= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= diff --git a/lcd_test/helpers.go b/lcd_test/helpers.go index dea38486f2..80c18a5312 100644 --- a/lcd_test/helpers.go +++ b/lcd_test/helpers.go @@ -371,19 +371,19 @@ func init() { // CreateAddr adds an address to the key store and returns an address and seed. // It also requires that the key could be created. -func CreateAddr(name, password string, kb crkeys.Keybase) (sdk.AccAddress, string, error) { +func CreateAddr(name string, kb crkeys.Keybase) (sdk.AccAddress, string, error) { var ( err error info crkeys.Info seed string ) - info, seed, err = kb.CreateMnemonic(name, crkeys.English, password, crkeys.Secp256k1) + info, seed, err = kb.CreateMnemonic(name, crkeys.English, client.DefaultKeyPass, crkeys.Secp256k1) return sdk.AccAddress(info.GetPubKey().Address()), seed, err } // CreateAddr adds multiple address to the key store and returns the addresses and associated seeds in lexographical order by address. // It also requires that the keys could be created. -func CreateAddrs(kb crkeys.Keybase, numAddrs int) (addrs []sdk.AccAddress, seeds, names, passwords []string, errs []error) { +func CreateAddrs(kb crkeys.Keybase, numAddrs int) (addrs []sdk.AccAddress, seeds, names []string, errs []error) { var ( err error info crkeys.Info @@ -394,12 +394,11 @@ func CreateAddrs(kb crkeys.Keybase, numAddrs int) (addrs []sdk.AccAddress, seeds for i := 0; i < numAddrs; i++ { name := fmt.Sprintf("test%d", i) - password := "1234567890" - info, seed, err = kb.CreateMnemonic(name, crkeys.English, password, crkeys.Secp256k1) + info, seed, err = kb.CreateMnemonic(name, crkeys.English, client.DefaultKeyPass, crkeys.Secp256k1) if err != nil { errs = append(errs, err) } - addrSeeds = append(addrSeeds, AddrSeed{Address: sdk.AccAddress(info.GetPubKey().Address()), Seed: seed, Name: name, Password: password}) + addrSeeds = append(addrSeeds, AddrSeed{Address: sdk.AccAddress(info.GetPubKey().Address()), Seed: seed, Name: name}) } if len(errs) > 0 { return @@ -411,10 +410,9 @@ func CreateAddrs(kb crkeys.Keybase, numAddrs int) (addrs []sdk.AccAddress, seeds addrs = append(addrs, addrSeeds[i].Address) seeds = append(seeds, addrSeeds[i].Seed) names = append(names, addrSeeds[i].Name) - passwords = append(passwords, addrSeeds[i].Password) } - return addrs, seeds, names, passwords, errs + return addrs, seeds, names, errs } // AddrSeed combines an Address with the mnemonic of the private key to that address @@ -422,7 +420,6 @@ type AddrSeed struct { Address sdk.AccAddress Seed string Name string - Password string } // AddrSeedSlice implements `Interface` in sort package. diff --git a/lcd_test/helpers_test.go b/lcd_test/helpers_test.go index 3a3fdd4ffe..2d36445bf8 100644 --- a/lcd_test/helpers_test.go +++ b/lcd_test/helpers_test.go @@ -6,14 +6,12 @@ import ( "fmt" "io/ioutil" "net/http" - "regexp" "strings" "testing" "github.com/cosmos/cosmos-sdk/client" clientkeys "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys" crkeys "github.com/cosmos/cosmos-sdk/crypto/keys" sdk "github.com/cosmos/cosmos-sdk/types" @@ -213,61 +211,6 @@ func doKeysPost(t *testing.T, port, name, password, mnemonic string, account int return resp } -// GET /keys/seed Create a new seed to create a new account defaultValidFor -func getKeysSeed(t *testing.T, port string) string { - res, body := Request(t, port, "GET", "/keys/seed", nil) - require.Equal(t, http.StatusOK, res.StatusCode, body) - reg := regexp.MustCompile(`([a-z]+ ){12}`) - match := reg.MatchString(body) - require.True(t, match, "Returned seed has wrong format", body) - - return body -} - -// POST /keys/{name}/recove Recover a account from a seed -func doRecoverKey(t *testing.T, port, recoverName, recoverPassword, mnemonic string, account uint32, index uint32) { - pk := clientkeys.NewRecoverKey(recoverPassword, mnemonic, int(account), int(index)) - req, err := cdc.MarshalJSON(pk) - require.NoError(t, err) - - res, body := Request(t, port, "POST", fmt.Sprintf("/keys/%s/recover", recoverName), req) - - require.Equal(t, http.StatusOK, res.StatusCode, body) - var resp keys.KeyOutput - err = codec.Cdc.UnmarshalJSON([]byte(body), &resp) - require.Nil(t, err, body) - - addr1Bech32 := resp.Address - _, err = sdk.AccAddressFromBech32(addr1Bech32) - require.NoError(t, err, "Failed to return a correct bech32 address") -} - -// GET /keys/{name} Get a certain locally stored account -func getKey(t *testing.T, port, name string) keys.KeyOutput { - res, body := Request(t, port, "GET", fmt.Sprintf("/keys/%s", name), nil) - require.Equal(t, http.StatusOK, res.StatusCode, body) - var resp keys.KeyOutput - err := cdc.UnmarshalJSON([]byte(body), &resp) - require.Nil(t, err) - - return resp -} - -// PUT /keys/{name} Update the password for this account in the KMS -func updateKey(t *testing.T, port, name, oldPassword, newPassword string, fail bool) { - kr := clientkeys.NewUpdateKeyReq(oldPassword, newPassword) - req, err := cdc.MarshalJSON(kr) - require.NoError(t, err) - keyEndpoint := fmt.Sprintf("/keys/%s", name) - res, body := Request(t, port, "PUT", keyEndpoint, req) - if fail { - require.Equal(t, http.StatusUnauthorized, res.StatusCode, body) - return - } - require.Equal(t, http.StatusOK, res.StatusCode, body) - -} - // GET /auth/accounts/{address} Get the account information on blockchain func getAccount(t *testing.T, port string, addr sdk.AccAddress) (acc authexported.Account) { res, body := Request(t, port, "GET", fmt.Sprintf("/auth/accounts/%s", addr.String()), nil) @@ -294,12 +237,11 @@ func doBroadcast(t *testing.T, port string, tx auth.StdTx) (*http.Response, stri // doTransfer performs a balance transfer with auto gas calculation. It also signs // the tx and broadcasts it. func doTransfer( - t *testing.T, port, seed, name, memo, pwd string, addr sdk.AccAddress, fees sdk.Coins, + t *testing.T, port, name, memo string, addr sdk.AccAddress, fees sdk.Coins, + kb crkeys.Keybase, ) (sdk.AccAddress, sdk.TxResponse) { - resp, body, recvAddr := doTransferWithGas( - t, port, seed, name, memo, pwd, addr, "", 1.0, false, true, fees, - ) + resp, body, recvAddr := doTransferWithGas(t, port, name, memo, addr, "", 1.0, false, true, fees, kb) require.Equal(t, http.StatusOK, resp.StatusCode, body) var txResp sdk.TxResponse @@ -314,14 +256,15 @@ func doTransfer( // signed and broadcasted. The sending account's number and sequence are // determined prior to generating the tx. func doTransferWithGas( - t *testing.T, port, seed, name, memo, pwd string, addr sdk.AccAddress, + t *testing.T, port, name, memo string, addr sdk.AccAddress, gas string, gasAdjustment float64, simulate, broadcast bool, fees sdk.Coins, + kb crkeys.Keybase, ) (resp *http.Response, body string, receiveAddr sdk.AccAddress) { // create receive address - kb := crkeys.NewInMemory() + kb2 := crkeys.NewInMemory() - receiveInfo, _, err := kb.CreateMnemonic( + receiveInfo, _, err := kb2.CreateMnemonic( "receive_address", crkeys.English, client.DefaultKeyPass, crkeys.SigningAlgo("secp256k1"), ) require.Nil(t, err) @@ -352,7 +295,7 @@ func doTransferWithGas( } // sign and broadcast - resp, body = signAndBroadcastGenTx(t, port, name, pwd, body, acc, gasAdjustment, simulate) + resp, body = signAndBroadcastGenTx(t, port, name, body, acc, gasAdjustment, simulate, kb) return resp, body, receiveAddr } @@ -360,15 +303,16 @@ func doTransferWithGas( // automatically determines the account's number and sequence when generating the // tx. func doTransferWithGasAccAuto( - t *testing.T, port, seed, name, memo, pwd string, addr sdk.AccAddress, + t *testing.T, port, name, memo string, addr sdk.AccAddress, gas string, gasAdjustment float64, simulate, broadcast bool, fees sdk.Coins, + kb crkeys.Keybase, ) (resp *http.Response, body string, receiveAddr sdk.AccAddress) { // create receive address - kb := crkeys.NewInMemory() + kb2 := crkeys.NewInMemory() acc := getAccount(t, port, addr) - receiveInfo, _, err := kb.CreateMnemonic( + receiveInfo, _, err := kb2.CreateMnemonic( "receive_address", crkeys.English, client.DefaultKeyPass, crkeys.SigningAlgo("secp256k1"), ) require.Nil(t, err) @@ -395,14 +339,15 @@ func doTransferWithGasAccAuto( } // sign and broadcast - resp, body = signAndBroadcastGenTx(t, port, name, pwd, body, acc, gasAdjustment, simulate) + resp, body = signAndBroadcastGenTx(t, port, name, body, acc, gasAdjustment, simulate, kb) return resp, body, receiveAddr } // signAndBroadcastGenTx accepts a successfully generated unsigned tx, signs it, // and broadcasts it. func signAndBroadcastGenTx( - t *testing.T, port, name, pwd, genTx string, acc authexported.Account, gasAdjustment float64, simulate bool, + t *testing.T, port, name, genTx string, acc authexported.Account, + gasAdjustment float64, simulate bool, kb crkeys.Keybase, ) (resp *http.Response, body string) { chainID := viper.GetString(client.FlagChainID) @@ -422,9 +367,9 @@ func signAndBroadcastGenTx( tx.Memo, tx.Fee.Amount, nil, - ) + ).WithKeybase(kb) - signedTx, err := txbldr.SignStdTx(name, pwd, tx, false) + signedTx, err := txbldr.SignStdTx(name, client.DefaultKeyPass, tx, false) require.NoError(t, err) return doBroadcast(t, port, signedTx) @@ -436,8 +381,9 @@ func signAndBroadcastGenTx( // POST /staking/delegators/{delegatorAddr}/delegations Submit delegation func doDelegate( - t *testing.T, port, name, pwd string, delAddr sdk.AccAddress, + t *testing.T, port, name string, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Int, fees sdk.Coins, + kb crkeys.Keybase, ) sdk.TxResponse { acc := getAccount(t, port, delAddr) @@ -461,7 +407,7 @@ func doDelegate( require.Equal(t, http.StatusOK, resp.StatusCode, body) // sign and broadcast - resp, body = signAndBroadcastGenTx(t, port, name, pwd, body, acc, client.DefaultGasAdjustment, false) + resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb) require.Equal(t, http.StatusOK, resp.StatusCode, body) var txResp sdk.TxResponse @@ -473,8 +419,9 @@ func doDelegate( // POST /staking/delegators/{delegatorAddr}/delegations Submit delegation func doUndelegate( - t *testing.T, port, name, pwd string, delAddr sdk.AccAddress, + t *testing.T, port, name string, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Int, fees sdk.Coins, + kb crkeys.Keybase, ) sdk.TxResponse { acc := getAccount(t, port, delAddr) @@ -497,7 +444,7 @@ func doUndelegate( resp, body := Request(t, port, "POST", fmt.Sprintf("/staking/delegators/%s/unbonding_delegations", delAddr), req) require.Equal(t, http.StatusOK, resp.StatusCode, body) - resp, body = signAndBroadcastGenTx(t, port, name, pwd, body, acc, client.DefaultGasAdjustment, false) + resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb) require.Equal(t, http.StatusOK, resp.StatusCode, body) var txResp sdk.TxResponse @@ -509,8 +456,9 @@ func doUndelegate( // POST /staking/delegators/{delegatorAddr}/delegations Submit delegation func doBeginRedelegation( - t *testing.T, port, name, pwd string, delAddr sdk.AccAddress, valSrcAddr, + t *testing.T, port, name string, delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress, amount sdk.Int, fees sdk.Coins, + kb crkeys.Keybase, ) sdk.TxResponse { acc := getAccount(t, port, delAddr) @@ -534,7 +482,7 @@ func doBeginRedelegation( resp, body := Request(t, port, "POST", fmt.Sprintf("/staking/delegators/%s/redelegations", delAddr), req) require.Equal(t, http.StatusOK, resp.StatusCode, body) - resp, body = signAndBroadcastGenTx(t, port, name, pwd, body, acc, client.DefaultGasAdjustment, false) + resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb) require.Equal(t, http.StatusOK, resp.StatusCode, body) var txResp sdk.TxResponse @@ -722,8 +670,9 @@ func getValidatorUnbondingDelegations(t *testing.T, port string, validatorAddr s // ---------------------------------------------------------------------- // POST /gov/proposals Submit a proposal func doSubmitProposal( - t *testing.T, port, seed, name, pwd string, proposerAddr sdk.AccAddress, + t *testing.T, port, name string, proposerAddr sdk.AccAddress, amount sdk.Int, fees sdk.Coins, + kb crkeys.Keybase, ) sdk.TxResponse { acc := getAccount(t, port, proposerAddr) @@ -749,7 +698,7 @@ func doSubmitProposal( resp, body := Request(t, port, "POST", "/gov/proposals", req) require.Equal(t, http.StatusOK, resp.StatusCode, body) - resp, body = signAndBroadcastGenTx(t, port, name, pwd, body, acc, client.DefaultGasAdjustment, false) + resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb) require.Equal(t, http.StatusOK, resp.StatusCode, body) var txResp sdk.TxResponse @@ -760,8 +709,9 @@ func doSubmitProposal( } func doSubmitParamChangeProposal( - t *testing.T, port, seed, name, pwd string, proposerAddr sdk.AccAddress, + t *testing.T, port, name string, proposerAddr sdk.AccAddress, amount sdk.Int, fees sdk.Coins, + kb crkeys.Keybase, ) sdk.TxResponse { acc := getAccount(t, port, proposerAddr) @@ -788,7 +738,7 @@ func doSubmitParamChangeProposal( resp, body := Request(t, port, "POST", "/gov/proposals/param_change", req) require.Equal(t, http.StatusOK, resp.StatusCode, body) - resp, body = signAndBroadcastGenTx(t, port, name, pwd, body, acc, client.DefaultGasAdjustment, false) + resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb) require.Equal(t, http.StatusOK, resp.StatusCode, body) var txResp sdk.TxResponse @@ -799,8 +749,9 @@ func doSubmitParamChangeProposal( } func doSubmitCommunityPoolSpendProposal( - t *testing.T, port, seed, name, pwd string, proposerAddr sdk.AccAddress, + t *testing.T, port, name string, proposerAddr sdk.AccAddress, amount sdk.Int, fees sdk.Coins, + kb crkeys.Keybase, ) sdk.TxResponse { acc := getAccount(t, port, proposerAddr) @@ -826,7 +777,7 @@ func doSubmitCommunityPoolSpendProposal( resp, body := Request(t, port, "POST", "/gov/proposals/community_pool_spend", req) require.Equal(t, http.StatusOK, resp.StatusCode, body) - resp, body = signAndBroadcastGenTx(t, port, name, pwd, body, acc, client.DefaultGasAdjustment, false) + resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb) require.Equal(t, http.StatusOK, resp.StatusCode, body) var txResp sdk.TxResponse @@ -893,8 +844,9 @@ func getProposalsFilterStatus(t *testing.T, port string, status gov.ProposalStat // POST /gov/proposals/{proposalId}/deposits Deposit tokens to a proposal func doDeposit( - t *testing.T, port, seed, name, pwd string, proposerAddr sdk.AccAddress, + t *testing.T, port, name string, proposerAddr sdk.AccAddress, proposalID uint64, amount sdk.Int, fees sdk.Coins, + kb crkeys.Keybase, ) sdk.TxResponse { acc := getAccount(t, port, proposerAddr) @@ -916,7 +868,7 @@ func doDeposit( resp, body := Request(t, port, "POST", fmt.Sprintf("/gov/proposals/%d/deposits", proposalID), req) require.Equal(t, http.StatusOK, resp.StatusCode, body) - resp, body = signAndBroadcastGenTx(t, port, name, pwd, body, acc, client.DefaultGasAdjustment, false) + resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb) require.Equal(t, http.StatusOK, resp.StatusCode, body) var txResp sdk.TxResponse @@ -950,8 +902,9 @@ func getTally(t *testing.T, port string, proposalID uint64) gov.TallyResult { // POST /gov/proposals/{proposalId}/votes Vote a proposal func doVote( - t *testing.T, port, seed, name, pwd string, proposerAddr sdk.AccAddress, + t *testing.T, port, name string, proposerAddr sdk.AccAddress, proposalID uint64, option string, fees sdk.Coins, + kb crkeys.Keybase, ) sdk.TxResponse { // get the account to get the sequence @@ -974,7 +927,7 @@ func doVote( resp, body := Request(t, port, "POST", fmt.Sprintf("/gov/proposals/%d/votes", proposalID), req) require.Equal(t, http.StatusOK, resp.StatusCode, body) - resp, body = signAndBroadcastGenTx(t, port, name, pwd, body, acc, client.DefaultGasAdjustment, false) + resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb) require.Equal(t, http.StatusOK, resp.StatusCode, body) var txResp sdk.TxResponse @@ -1109,7 +1062,7 @@ func getSigningInfoList(t *testing.T, port string) []slashing.ValidatorSigningIn // TODO: Test this functionality, it is not currently in any of the tests // POST /slashing/validators/{validatorAddr}/unjail Unjail a jailed validator func doUnjail( - t *testing.T, port, seed, name, pwd string, valAddr sdk.ValAddress, fees sdk.Coins, + t *testing.T, port, name string, valAddr sdk.ValAddress, fees sdk.Coins, ) sdk.TxResponse { acc := getAccount(t, port, sdk.AccAddress(valAddr.Bytes())) @@ -1126,7 +1079,7 @@ func doUnjail( resp, body := Request(t, port, "POST", fmt.Sprintf("/slashing/validators/%s/unjail", valAddr.String()), req) require.Equal(t, http.StatusOK, resp.StatusCode, body) - resp, body = signAndBroadcastGenTx(t, port, name, pwd, body, acc, client.DefaultGasAdjustment, false) + resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, nil) require.Equal(t, http.StatusOK, resp.StatusCode, body) var txResp sdk.TxResponse @@ -1140,7 +1093,7 @@ func doUnjail( // POST /distribution/delegators/{delgatorAddr}/rewards Withdraw delegator rewards func doWithdrawDelegatorAllRewards( - t *testing.T, port, seed, name, pwd string, delegatorAddr sdk.AccAddress, fees sdk.Coins, + t *testing.T, port, name string, delegatorAddr sdk.AccAddress, fees sdk.Coins, ) sdk.TxResponse { // get the account to get the sequence acc := getAccount(t, port, delegatorAddr) @@ -1159,7 +1112,7 @@ func doWithdrawDelegatorAllRewards( resp, body := Request(t, port, "POST", fmt.Sprintf("/distribution/delegators/%s/rewards", delegatorAddr), req) require.Equal(t, http.StatusOK, resp.StatusCode, body) - resp, body = signAndBroadcastGenTx(t, port, name, pwd, body, acc, client.DefaultGasAdjustment, false) + resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, nil) require.Equal(t, http.StatusOK, resp.StatusCode, body) var txResp sdk.TxResponse diff --git a/lcd_test/lcd_test.go b/lcd_test/lcd_test.go index 2b2439ab8f..3d6f92b828 100644 --- a/lcd_test/lcd_test.go +++ b/lcd_test/lcd_test.go @@ -35,7 +35,6 @@ import ( const ( name1 = "test1" memo = "LCD test tx" - pw = client.DefaultKeyPass ) var fees = sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)} @@ -45,6 +44,11 @@ func init() { version.Version = os.Getenv("VERSION") } +func TestMain(m *testing.M) { + os.Setenv("COSMOS_SDK_TEST_KEYRING", "y") + os.Exit(m.Run()) +} + func TestNodeStatus(t *testing.T) { cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{}, true) require.NoError(t, err) @@ -74,9 +78,9 @@ func TestValidators(t *testing.T) { } func TestCoinSend(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, seed, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) @@ -94,7 +98,7 @@ func TestCoinSend(t *testing.T) { initialBalance := acc.GetCoins() // create TX - receiveAddr, resultTx := doTransfer(t, port, seed, name1, memo, pw, addr, fees) + receiveAddr, resultTx := doTransfer(t, port, name1, memo, addr, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // check if tx was committed @@ -116,30 +120,28 @@ func TestCoinSend(t *testing.T) { require.Equal(t, int64(1), coins2[0].Amount.Int64()) // test failure with too little gas - res, body, _ = doTransferWithGas(t, port, seed, name1, memo, pw, addr, "100", 0, false, true, fees) + res, body, _ = doTransferWithGas(t, port, name1, memo, addr, "100", 0, false, true, fees, kb) require.Equal(t, http.StatusOK, res.StatusCode, body) require.Nil(t, err) // test failure with negative gas - res, body, _ = doTransferWithGas(t, port, seed, name1, memo, pw, addr, "-200", 0, false, false, fees) + res, body, _ = doTransferWithGas(t, port, name1, memo, addr, "-200", 0, false, false, fees, kb) require.Equal(t, http.StatusBadRequest, res.StatusCode, body) // test failure with negative adjustment - res, body, _ = doTransferWithGas(t, port, seed, name1, memo, pw, addr, "10000", -0.1, true, false, fees) + res, body, _ = doTransferWithGas(t, port, name1, memo, addr, "10000", -0.1, true, false, fees, kb) require.Equal(t, http.StatusBadRequest, res.StatusCode, body) // test failure with 0 gas - res, body, _ = doTransferWithGas(t, port, seed, name1, memo, pw, addr, "0", 0, false, true, fees) + res, body, _ = doTransferWithGas(t, port, name1, memo, addr, "0", 0, false, true, fees, kb) require.Equal(t, http.StatusOK, res.StatusCode, body) // test failure with wrong adjustment - res, body, _ = doTransferWithGas(t, port, seed, name1, memo, pw, addr, client.GasFlagAuto, 0.1, false, true, fees) + res, body, _ = doTransferWithGas(t, port, name1, memo, addr, client.GasFlagAuto, 0.1, false, true, fees, kb) require.Equal(t, http.StatusOK, res.StatusCode, body) // run simulation and test success with estimated gas - res, body, _ = doTransferWithGas( - t, port, seed, name1, memo, pw, addr, "10000", 1.0, true, false, fees, - ) + res, body, _ = doTransferWithGas(t, port, name1, memo, addr, "10000", 1.0, true, false, fees, kb) require.Equal(t, http.StatusOK, res.StatusCode, body) var gasEstResp rest.GasEstimateResponse @@ -151,7 +153,7 @@ func TestCoinSend(t *testing.T) { // run successful tx gas := fmt.Sprintf("%d", gasEstResp.GasEstimate) - res, body, _ = doTransferWithGas(t, port, seed, name1, memo, pw, addr, gas, 1.0, false, true, fees) + res, body, _ = doTransferWithGas(t, port, name1, memo, addr, gas, 1.0, false, true, fees, kb) require.Equal(t, http.StatusOK, res.StatusCode, body) err = cdc.UnmarshalJSON([]byte(body), &resultTx) @@ -166,9 +168,9 @@ func TestCoinSend(t *testing.T) { } func TestCoinSendAccAuto(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, seed, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) @@ -179,7 +181,7 @@ func TestCoinSendAccAuto(t *testing.T) { // send a transfer tx without specifying account number and sequence res, body, _ := doTransferWithGasAccAuto( - t, port, seed, name1, memo, pw, addr, "200000", 1.0, false, true, fees, + t, port, name1, memo, addr, "200000", 1.0, false, true, fees, kb, ) require.Equal(t, http.StatusOK, res.StatusCode, body) @@ -193,16 +195,16 @@ func TestCoinSendAccAuto(t *testing.T) { } func TestCoinMultiSendGenerateOnly(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, seed, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) defer cleanup() // generate only - res, body, _ := doTransferWithGas(t, port, seed, "", memo, "", addr, "200000", 1, false, false, fees) + res, body, _ := doTransferWithGas(t, port, "", memo, addr, "200000", 1, false, false, fees, kb) require.Equal(t, http.StatusOK, res.StatusCode, body) var stdTx auth.StdTx @@ -218,9 +220,9 @@ func TestCoinMultiSendGenerateOnly(t *testing.T) { } func TestCoinSendGenerateSignAndBroadcast(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, seed, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) @@ -228,9 +230,7 @@ func TestCoinSendGenerateSignAndBroadcast(t *testing.T) { acc := getAccount(t, port, addr) // simulate tx - res, body, _ := doTransferWithGas( - t, port, seed, name1, memo, "", addr, client.GasFlagAuto, 1.0, true, false, fees, - ) + res, body, _ := doTransferWithGas(t, port, name1, memo, addr, client.GasFlagAuto, 1.0, true, false, fees, kb) require.Equal(t, http.StatusOK, res.StatusCode, body) var gasEstResp rest.GasEstimateResponse @@ -239,7 +239,7 @@ func TestCoinSendGenerateSignAndBroadcast(t *testing.T) { // generate tx gas := fmt.Sprintf("%d", gasEstResp.GasEstimate) - res, body, _ = doTransferWithGas(t, port, seed, name1, memo, "", addr, gas, 1, false, false, fees) + res, body, _ = doTransferWithGas(t, port, name1, memo, addr, gas, 1, false, false, fees, kb) require.Equal(t, http.StatusOK, res.StatusCode, body) var tx auth.StdTx @@ -252,7 +252,7 @@ func TestCoinSendGenerateSignAndBroadcast(t *testing.T) { require.NotZero(t, tx.Fee.Gas) gasEstimate := int64(tx.Fee.Gas) - _, body = signAndBroadcastGenTx(t, port, name1, pw, body, acc, 1.0, false) + _, body = signAndBroadcastGenTx(t, port, name1, body, acc, 1.0, false, kb) // check if tx was committed var txResp sdk.TxResponse @@ -262,15 +262,15 @@ func TestCoinSendGenerateSignAndBroadcast(t *testing.T) { } func TestEncodeTx(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, seed, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) defer cleanup() - _, body, _ := doTransferWithGas(t, port, seed, name1, memo, "", addr, "2", 1, false, false, fees) + _, body, _ := doTransferWithGas(t, port, name1, memo, addr, "2", 1, false, false, fees, kb) var tx auth.StdTx require.Nil(t, cdc.UnmarshalJSON([]byte(body), &tx)) @@ -298,9 +298,9 @@ func TestEncodeTx(t *testing.T) { } func TestTxs(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, seed, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) @@ -322,7 +322,7 @@ func TestTxs(t *testing.T) { require.Equal(t, emptyTxs, txResult.Txs) // create tx - receiveAddr, resultTx := doTransfer(t, port, seed, name1, memo, pw, addr, fees) + receiveAddr, resultTx := doTransfer(t, port, name1, memo, addr, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // check if tx is queryable @@ -384,9 +384,9 @@ func TestValidatorQuery(t *testing.T) { } func TestBonding(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, _, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, valPubKeys, operAddrs, port, err := InitializeLCD(2, []sdk.AccAddress{addr}, false) @@ -406,7 +406,7 @@ func TestBonding(t *testing.T) { // create bond TX delTokens := sdk.TokensFromConsensusPower(60) - resultTx := doDelegate(t, port, name1, pw, addr, operAddrs[0], delTokens, fees) + resultTx := doDelegate(t, port, name1, addr, operAddrs[0], delTokens, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) require.Equal(t, uint32(0), resultTx.Code) @@ -448,7 +448,7 @@ func TestBonding(t *testing.T) { // testing unbonding unbondingTokens := sdk.TokensFromConsensusPower(30) - resultTx = doUndelegate(t, port, name1, pw, addr, operAddrs[0], unbondingTokens, fees) + resultTx = doUndelegate(t, port, name1, addr, operAddrs[0], unbondingTokens, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) require.Equal(t, uint32(0), resultTx.Code) @@ -478,7 +478,7 @@ func TestBonding(t *testing.T) { // test redelegation rdTokens := sdk.TokensFromConsensusPower(30) - resultTx = doBeginRedelegation(t, port, name1, pw, addr, operAddrs[0], operAddrs[1], rdTokens, fees) + resultTx = doBeginRedelegation(t, port, name1, addr, operAddrs[0], operAddrs[1], rdTokens, fees, kb) require.Equal(t, uint32(0), resultTx.Code) tests.WaitForHeight(resultTx.Height+1, port) @@ -549,9 +549,9 @@ func TestBonding(t *testing.T) { } func TestSubmitProposal(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, seed, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) @@ -562,7 +562,7 @@ func TestSubmitProposal(t *testing.T) { // create SubmitProposal TX proposalTokens := sdk.TokensFromConsensusPower(5) - resultTx := doSubmitProposal(t, port, seed, name1, pw, addr, proposalTokens, fees) + resultTx := doSubmitProposal(t, port, name1, addr, proposalTokens, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // check if tx was committed @@ -587,9 +587,9 @@ func TestSubmitProposal(t *testing.T) { } func TestSubmitCommunityPoolSpendProposal(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, seed, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) @@ -600,7 +600,7 @@ func TestSubmitCommunityPoolSpendProposal(t *testing.T) { // create proposal tx proposalTokens := sdk.TokensFromConsensusPower(5) - resultTx := doSubmitCommunityPoolSpendProposal(t, port, seed, name1, pw, addr, proposalTokens, fees) + resultTx := doSubmitCommunityPoolSpendProposal(t, port, name1, addr, proposalTokens, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // check if tx was committed @@ -625,9 +625,9 @@ func TestSubmitCommunityPoolSpendProposal(t *testing.T) { } func TestSubmitParamChangeProposal(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, seed, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) @@ -638,7 +638,7 @@ func TestSubmitParamChangeProposal(t *testing.T) { // create proposal tx proposalTokens := sdk.TokensFromConsensusPower(5) - resultTx := doSubmitParamChangeProposal(t, port, seed, name1, pw, addr, proposalTokens, fees) + resultTx := doSubmitParamChangeProposal(t, port, name1, addr, proposalTokens, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // check if tx was committed @@ -663,9 +663,9 @@ func TestSubmitParamChangeProposal(t *testing.T) { } func TestDeposit(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, seed, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) @@ -676,7 +676,7 @@ func TestDeposit(t *testing.T) { // create SubmitProposal TX proposalTokens := sdk.TokensFromConsensusPower(5) - resultTx := doSubmitProposal(t, port, seed, name1, pw, addr, proposalTokens, fees) + resultTx := doSubmitProposal(t, port, name1, addr, proposalTokens, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // check if tx was committed @@ -699,7 +699,7 @@ func TestDeposit(t *testing.T) { // create SubmitProposal TX depositTokens := sdk.TokensFromConsensusPower(5) - resultTx = doDeposit(t, port, seed, name1, pw, addr, proposalID, depositTokens, fees) + resultTx = doDeposit(t, port, name1, addr, proposalID, depositTokens, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // verify balance after deposit and fee @@ -723,9 +723,9 @@ func TestDeposit(t *testing.T) { } func TestVote(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, seed, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, operAddrs, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) @@ -736,7 +736,7 @@ func TestVote(t *testing.T) { // create SubmitProposal TX proposalTokens := sdk.TokensFromConsensusPower(10) - resultTx := doSubmitProposal(t, port, seed, name1, pw, addr, proposalTokens, fees) + resultTx := doSubmitProposal(t, port, name1, addr, proposalTokens, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // check if tx was committed @@ -759,7 +759,7 @@ func TestVote(t *testing.T) { require.Equal(t, gov.StatusVotingPeriod, proposal.Status) // vote - resultTx = doVote(t, port, seed, name1, pw, addr, proposalID, "Yes", fees) + resultTx = doVote(t, port, name1, addr, proposalID, "Yes", fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // verify balance after vote and fee @@ -783,7 +783,7 @@ func TestVote(t *testing.T) { // create bond TX delTokens := sdk.TokensFromConsensusPower(60) - resultTx = doDelegate(t, port, name1, pw, addr, operAddrs[0], delTokens, fees) + resultTx = doDelegate(t, port, name1, addr, operAddrs[0], delTokens, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // verify balance @@ -797,7 +797,7 @@ func TestVote(t *testing.T) { require.Equal(t, delTokens, tally.Yes, "tally should be equal to the amount delegated") // change vote option - resultTx = doVote(t, port, seed, name1, pw, addr, proposalID, "No", fees) + resultTx = doVote(t, port, name1, addr, proposalID, "No", fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // verify balance @@ -811,9 +811,9 @@ func TestVote(t *testing.T) { } func TestUnjail(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, _, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, valPubKeys, _, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) @@ -833,9 +833,9 @@ func TestUnjail(t *testing.T) { } func TestProposalsQuery(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addrs, seeds, names, passwords, errors := CreateAddrs(kb, 2) + addrs, _, names, errors := CreateAddrs(kb, 2) require.Empty(t, errors) cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{addrs[0], addrs[1]}, true) @@ -848,14 +848,14 @@ func TestProposalsQuery(t *testing.T) { getTallyingParam(t, port) // Addr1 proposes (and deposits) proposals #1 and #2 - resultTx := doSubmitProposal(t, port, seeds[0], names[0], passwords[0], addrs[0], halfMinDeposit, fees) + resultTx := doSubmitProposal(t, port, names[0], addrs[0], halfMinDeposit, fees, kb) bz, err := hex.DecodeString(resultTx.Data) require.NoError(t, err) proposalID1 := gov.GetProposalIDFromBytes(bz) tests.WaitForHeight(resultTx.Height+1, port) - resultTx = doSubmitProposal(t, port, seeds[0], names[0], passwords[0], addrs[0], halfMinDeposit, fees) + resultTx = doSubmitProposal(t, port, names[0], addrs[0], halfMinDeposit, fees, kb) bz, err = hex.DecodeString(resultTx.Data) require.NoError(t, err) @@ -863,7 +863,7 @@ func TestProposalsQuery(t *testing.T) { tests.WaitForHeight(resultTx.Height+1, port) // Addr2 proposes (and deposits) proposals #3 - resultTx = doSubmitProposal(t, port, seeds[1], names[1], passwords[1], addrs[1], halfMinDeposit, fees) + resultTx = doSubmitProposal(t, port, names[1], addrs[1], halfMinDeposit, fees, kb) bz, err = hex.DecodeString(resultTx.Data) require.NoError(t, err) @@ -871,10 +871,10 @@ func TestProposalsQuery(t *testing.T) { tests.WaitForHeight(resultTx.Height+1, port) // Addr2 deposits on proposals #2 & #3 - resultTx = doDeposit(t, port, seeds[1], names[1], passwords[1], addrs[1], proposalID2, halfMinDeposit, fees) + resultTx = doDeposit(t, port, names[1], addrs[1], proposalID2, halfMinDeposit, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) - resultTx = doDeposit(t, port, seeds[1], names[1], passwords[1], addrs[1], proposalID3, halfMinDeposit, fees) + resultTx = doDeposit(t, port, names[1], addrs[1], proposalID3, halfMinDeposit, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // check deposits match proposal and individual deposits @@ -897,7 +897,7 @@ func TestProposalsQuery(t *testing.T) { // increasing the amount of the deposit should update the existing one depositTokens := sdk.TokensFromConsensusPower(1) - resultTx = doDeposit(t, port, seeds[0], names[0], passwords[0], addrs[0], proposalID1, depositTokens, fees) + resultTx = doDeposit(t, port, names[0], addrs[0], proposalID1, depositTokens, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) deposits = getDeposits(t, port, proposalID1) @@ -915,13 +915,13 @@ func TestProposalsQuery(t *testing.T) { require.Equal(t, proposalID3, proposals[1].ProposalID) // Addr1 votes on proposals #2 & #3 - resultTx = doVote(t, port, seeds[0], names[0], passwords[0], addrs[0], proposalID2, "Yes", fees) + resultTx = doVote(t, port, names[0], addrs[0], proposalID2, "Yes", fees, kb) tests.WaitForHeight(resultTx.Height+1, port) - resultTx = doVote(t, port, seeds[0], names[0], passwords[0], addrs[0], proposalID3, "Yes", fees) + resultTx = doVote(t, port, names[0], addrs[0], proposalID3, "Yes", fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // Addr2 votes on proposal #3 - resultTx = doVote(t, port, seeds[1], names[1], passwords[1], addrs[1], proposalID3, "Yes", fees) + resultTx = doVote(t, port, names[1], addrs[1], proposalID3, "Yes", fees, kb) tests.WaitForHeight(resultTx.Height+1, port) // Test query all proposals @@ -988,9 +988,9 @@ func TestDistributionGetParams(t *testing.T) { } func TestDistributionFlow(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, seed, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, valAddrs, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) @@ -1012,12 +1012,12 @@ func TestDistributionFlow(t *testing.T) { // Delegate some coins delTokens := sdk.TokensFromConsensusPower(60) - resultTx := doDelegate(t, port, name1, pw, addr, valAddr, delTokens, fees) + resultTx := doDelegate(t, port, name1, addr, valAddr, delTokens, fees, kb) tests.WaitForHeight(resultTx.Height+1, port) require.Equal(t, uint32(0), resultTx.Code) // send some coins - _, resultTx = doTransfer(t, port, seed, name1, memo, pw, addr, fees) + _, resultTx = doTransfer(t, port, name1, memo, addr, fees, kb) tests.WaitForHeight(resultTx.Height+5, port) require.Equal(t, uint32(0), resultTx.Code) @@ -1061,14 +1061,14 @@ func TestDistributionFlow(t *testing.T) { require.Equal(t, operAddr.String(), withdrawAddr) // Withdraw delegator's rewards - resultTx = doWithdrawDelegatorAllRewards(t, port, seed, name1, pw, addr, fees) + resultTx = doWithdrawDelegatorAllRewards(t, port, name1, addr, fees) require.Equal(t, uint32(0), resultTx.Code) } func TestMintingQueries(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, _, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) @@ -1094,9 +1094,9 @@ func TestMintingQueries(t *testing.T) { } func TestAccountBalanceQuery(t *testing.T) { - kb, err := keys.NewKeyBaseFromDir(InitClientHome("")) + kb, err := keys.NewKeyringFromDir(InitClientHome(""), nil) require.NoError(t, err) - addr, _, err := CreateAddr(name1, pw, kb) + addr, _, err := CreateAddr(name1, kb) require.NoError(t, err) cleanup, _, _, port, err := InitializeLCD(1, []sdk.AccAddress{addr}, true) require.NoError(t, err) From 9100142381e28ecf768d4aad44a9229a1a08d919 Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 19 Nov 2019 14:25:15 +0100 Subject: [PATCH 048/685] Remove gaiadebug (#191) * Remove gaiadebug - remove gaiadebug in favor of placing the commands in gaiad and gaiacli Signed-off-by: Marko Baricevic * update go.sum --- CHANGELOG.md | 5 + cmd/gaiacli/main.go | 1 + cmd/gaiad/main.go | 2 + cmd/gaiadebug/README.md | 35 ------ cmd/gaiadebug/hack.go | 96 --------------- cmd/gaiadebug/main.go | 257 ---------------------------------------- 6 files changed, 8 insertions(+), 388 deletions(-) delete mode 100644 cmd/gaiadebug/README.md delete mode 100644 cmd/gaiadebug/hack.go delete mode 100644 cmd/gaiadebug/main.go diff --git a/CHANGELOG.md b/CHANGELOG.md index e044aef970..876d15f020 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,11 @@ flag and configuration. * (gaiacli) [\#132](https://github.com/cosmos/gaia/pull/132) Add `tx decode` command to decode Base64 encoded transactions. * (modules) [\#190](https://github.com/cosmos/gaia/pull/190) Introduce use of the `x/evidence` module. +* (gaiad) [\#191](https://github.com/cosmos/gaia/pull/191) Add debug commands to gaiad: + - `pubkey`: decode pubkey from base64, hex or bech32 + - `addr`: convert a address between hex and bech32 + - `raw-bytes` convert raw-bytes to hex +* (gaiacli) [\#191](https://github.com/cosmos/gaia/pull/191) Add cmd `decode-tx`, decodes a tx from hex or base64 ## [v2.0.3] - 2019-11-04 diff --git a/cmd/gaiacli/main.go b/cmd/gaiacli/main.go index ecfadad8d2..4f418237c1 100644 --- a/cmd/gaiacli/main.go +++ b/cmd/gaiacli/main.go @@ -119,6 +119,7 @@ func txCmd(cdc *amino.Codec) *cobra.Command { authcmd.GetBroadcastCommand(cdc), authcmd.GetEncodeCommand(cdc), authcmd.GetDecodeCommand(cdc), + authcmd.GetDecodeTxCmd(cdc), client.LineBreak, ) diff --git a/cmd/gaiad/main.go b/cmd/gaiad/main.go index 24670bef15..bb53ea635c 100644 --- a/cmd/gaiad/main.go +++ b/cmd/gaiad/main.go @@ -17,6 +17,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/debug" "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" @@ -61,6 +62,7 @@ func main() { rootCmd.AddCommand(client.NewCompletionCmd(rootCmd, true)) rootCmd.AddCommand(testnetCmd(ctx, cdc, app.ModuleBasics, auth.GenesisAccountIterator{})) rootCmd.AddCommand(replayCmd()) + rootCmd.AddCommand(debug.Cmd(cdc)) server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators) diff --git a/cmd/gaiadebug/README.md b/cmd/gaiadebug/README.md deleted file mode 100644 index c2f0b8bc06..0000000000 --- a/cmd/gaiadebug/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# Gaiadebug - -Simple tool for simple debugging. - -We try to accept both hex and base64 formats and provide a useful response. - -Note we often encode bytes as hex in the logs, but as base64 in the JSON. - -## Pubkeys - -The following give the same result: - -``` -gaiadebug pubkey TZTQnfqOsi89SeoXVnIw+tnFJnr4X8qVC0U8AsEmFk4= -gaiadebug pubkey 4D94D09DFA8EB22F3D49EA17567230FAD9C5267AF85FCA950B453C02C126164E -``` - -## Txs - -Pass in a hex/base64 tx and get back the full JSON - -``` -gaiadebug tx -``` - -## Hack - -This is a command with boilerplate for using Go as a scripting language to hack -on an existing Gaia state. - -Currently we have an example for the state of gaia-6001 after it -[crashed](https://github.com/cosmos/cosmos-sdk/blob/master/cmd/gaia/testnets/STATUS.md#june-13-2018-230-est---published-postmortem-of-gaia-6001-failure). -If you run `gaiadebug hack $HOME/.gaiad` on that -state, it will do a binary search on the state history to find when the state -invariant was violated. diff --git a/cmd/gaiadebug/hack.go b/cmd/gaiadebug/hack.go deleted file mode 100644 index c5e196e516..0000000000 --- a/cmd/gaiadebug/hack.go +++ /dev/null @@ -1,96 +0,0 @@ -package main - -import ( - "encoding/hex" - "fmt" - "os" - "path" - - "github.com/cosmos/cosmos-sdk/store" - - "github.com/cosmos/cosmos-sdk/baseapp" - - "github.com/spf13/cobra" - "github.com/spf13/viper" - abci "github.com/tendermint/tendermint/abci/types" - - "github.com/tendermint/tendermint/libs/log" - - sdk "github.com/cosmos/cosmos-sdk/types" - - gaia "github.com/cosmos/gaia/app" -) - -func runHackCmd(cmd *cobra.Command, args []string) error { - - if len(args) != 1 { - return fmt.Errorf("expected 1 arg") - } - - // ".gaiad" - dataDir := args[0] - dataDir = path.Join(dataDir, "data") - - // load the app - logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)) - db, err := sdk.NewLevelDB("gaia", dataDir) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - app, keyMain, keyStaking, stakingKeeper := gaia.NewGaiaAppUNSAFE( - logger, db, nil, false, 0, baseapp.SetPruning(store.NewPruningOptionsFromString(viper.GetString("pruning")))) - - // print some info - id := app.LastCommitID() - lastBlockHeight := app.LastBlockHeight() - fmt.Println("ID", id) - fmt.Println("LastBlockHeight", lastBlockHeight) - - //---------------------------------------------------- - // XXX: start hacking! - //---------------------------------------------------- - // eg. gaia-6001 testnet bug - // We paniced when iterating through the "bypower" keys. - // The following powerKey was there, but the corresponding "trouble" validator did not exist. - // So here we do a binary search on the past states to find when the powerKey first showed up ... - - // operator of the validator the bonds, gets jailed, later unbonds, and then later is still found in the bypower store - trouble := hexToBytes("D3DC0FF59F7C3B548B7AFA365561B87FD0208AF8") - // this is his "bypower" key - powerKey := hexToBytes("05303030303030303030303033FFFFFFFFFFFF4C0C0000FFFED3DC0FF59F7C3B548B7AFA365561B87FD0208AF8") - - topHeight := lastBlockHeight - bottomHeight := int64(0) - checkHeight := topHeight - for { - // load the given version of the state - err = app.LoadVersion(checkHeight, keyMain) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - ctx := app.NewContext(true, abci.Header{}) - - // check for the powerkey and the validator from the store - store := ctx.KVStore(keyStaking) - res := store.Get(powerKey) - val, _ := stakingKeeper.GetValidator(ctx, trouble) - fmt.Println("checking height", checkHeight, res, val) - if res == nil { - bottomHeight = checkHeight - } else { - topHeight = checkHeight - } - checkHeight = (topHeight + bottomHeight) / 2 - } -} - -func hexToBytes(h string) []byte { - trouble, err := hex.DecodeString(h) - if err != nil { - return nil - } - return trouble - -} diff --git a/cmd/gaiadebug/main.go b/cmd/gaiadebug/main.go deleted file mode 100644 index caee734ce3..0000000000 --- a/cmd/gaiadebug/main.go +++ /dev/null @@ -1,257 +0,0 @@ -package main - -import ( - "bytes" - "encoding/base64" - "encoding/hex" - "encoding/json" - "fmt" - "os" - "strconv" - "strings" - - "github.com/spf13/cobra" - "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/ed25519" - - gaia "github.com/cosmos/gaia/app" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" -) - -func init() { - - config := sdk.GetConfig() - config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub) - config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub) - config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub) - config.Seal() - - rootCmd.AddCommand(txCmd) - rootCmd.AddCommand(pubkeyCmd) - rootCmd.AddCommand(addrCmd) - rootCmd.AddCommand(hackCmd) - rootCmd.AddCommand(rawBytesCmd) -} - -var rootCmd = &cobra.Command{ - Use: "gaiadebug", - Short: "Gaia debug tool", - SilenceUsage: true, -} - -var txCmd = &cobra.Command{ - Use: "tx", - Short: "Decode a gaia tx from hex or base64", - RunE: runTxCmd, -} - -var pubkeyCmd = &cobra.Command{ - Use: "pubkey", - Short: "Decode a pubkey from hex, base64, or bech32", - RunE: runPubKeyCmd, -} - -var addrCmd = &cobra.Command{ - Use: "addr", - Short: "Convert an address between hex and bech32", - RunE: runAddrCmd, -} - -var hackCmd = &cobra.Command{ - Use: "hack", - Short: "Boilerplate to Hack on an existing state by scripting some Go...", - RunE: runHackCmd, -} - -var rawBytesCmd = &cobra.Command{ - Use: "raw-bytes", - Short: "Convert raw bytes output (eg. [10 21 13 255]) to hex", - RunE: runRawBytesCmd, -} - -func runRawBytesCmd(cmd *cobra.Command, args []string) error { - if len(args) != 1 { - return fmt.Errorf("expected single arg") - } - stringBytes := args[0] - stringBytes = strings.Trim(stringBytes, "[") - stringBytes = strings.Trim(stringBytes, "]") - spl := strings.Split(stringBytes, " ") - - byteArray := []byte{} - for _, s := range spl { - b, err := strconv.Atoi(s) - if err != nil { - return err - } - byteArray = append(byteArray, byte(b)) - } - fmt.Printf("%X\n", byteArray) - return nil -} - -func runPubKeyCmd(cmd *cobra.Command, args []string) error { - if len(args) != 1 { - return fmt.Errorf("expected single arg") - } - - pubkeyString := args[0] - var pubKeyI crypto.PubKey - - // try hex, then base64, then bech32 - pubkeyBytes, err := hex.DecodeString(pubkeyString) - if err != nil { - var err2 error - pubkeyBytes, err2 = base64.StdEncoding.DecodeString(pubkeyString) - if err2 != nil { - var err3 error - pubKeyI, err3 = sdk.GetAccPubKeyBech32(pubkeyString) - if err3 != nil { - var err4 error - pubKeyI, err4 = sdk.GetValPubKeyBech32(pubkeyString) - - if err4 != nil { - var err5 error - pubKeyI, err5 = sdk.GetConsPubKeyBech32(pubkeyString) - if err5 != nil { - return fmt.Errorf(`expected hex, base64, or bech32. Got errors: - hex: %v, - base64: %v - bech32 Acc: %v - bech32 Val: %v - bech32 Cons: %v`, - err, err2, err3, err4, err5) - } - - } - } - - } - } - - var pubKey ed25519.PubKeyEd25519 - if pubKeyI == nil { - copy(pubKey[:], pubkeyBytes) - } else { - pubKey = pubKeyI.(ed25519.PubKeyEd25519) - pubkeyBytes = pubKey[:] - } - - cdc := gaia.MakeCodec() - pubKeyJSONBytes, err := cdc.MarshalJSON(pubKey) - if err != nil { - return err - } - accPub, err := sdk.Bech32ifyAccPub(pubKey) - if err != nil { - return err - } - valPub, err := sdk.Bech32ifyValPub(pubKey) - if err != nil { - return err - } - - consenusPub, err := sdk.Bech32ifyConsPub(pubKey) - if err != nil { - return err - } - fmt.Println("Address:", pubKey.Address()) - fmt.Printf("Hex: %X\n", pubkeyBytes) - fmt.Println("JSON (base64):", string(pubKeyJSONBytes)) - fmt.Println("Bech32 Acc:", accPub) - fmt.Println("Bech32 Validator Operator:", valPub) - fmt.Println("Bech32 Validator Consensus:", consenusPub) - return nil -} - -func runAddrCmd(cmd *cobra.Command, args []string) error { - if len(args) != 1 { - return fmt.Errorf("expected single arg") - } - - addrString := args[0] - var addr []byte - - // try hex, then bech32 - var err error - addr, err = hex.DecodeString(addrString) - if err != nil { - var err2 error - addr, err2 = sdk.AccAddressFromBech32(addrString) - if err2 != nil { - var err3 error - addr, err3 = sdk.ValAddressFromBech32(addrString) - - if err3 != nil { - return fmt.Errorf(`expected hex or bech32. Got errors: - hex: %v, - bech32 acc: %v - bech32 val: %v - `, err, err2, err3) - - } - } - } - - accAddr := sdk.AccAddress(addr) - valAddr := sdk.ValAddress(addr) - - fmt.Println("Address:", addr) - fmt.Printf("Address (hex): %X\n", addr) - fmt.Printf("Bech32 Acc: %s\n", accAddr) - fmt.Printf("Bech32 Val: %s\n", valAddr) - return nil -} - -func runTxCmd(cmd *cobra.Command, args []string) error { - if len(args) != 1 { - return fmt.Errorf("expected single arg") - } - - txString := args[0] - - // try hex, then base64 - txBytes, err := hex.DecodeString(txString) - if err != nil { - var err2 error - txBytes, err2 = base64.StdEncoding.DecodeString(txString) - if err2 != nil { - return fmt.Errorf(`expected hex or base64. Got errors: - hex: %v, - base64: %v - `, err, err2) - } - } - - var tx = auth.StdTx{} - cdc := gaia.MakeCodec() - - err = cdc.UnmarshalBinaryLengthPrefixed(txBytes, &tx) - if err != nil { - return err - } - - bz, err := cdc.MarshalJSON(tx) - if err != nil { - return err - } - - buf := bytes.NewBuffer([]byte{}) - err = json.Indent(buf, bz, "", " ") - if err != nil { - return err - } - - fmt.Println(buf.String()) - return nil -} - -func main() { - err := rootCmd.Execute() - if err != nil { - os.Exit(1) - } - os.Exit(0) -} From 779542375703b444aa4420de582e6defb0d77d73 Mon Sep 17 00:00:00 2001 From: dogemos <42988601+dogemos@users.noreply.github.com> Date: Wed, 20 Nov 2019 01:45:43 +0900 Subject: [PATCH 049/685] Update Gaia Docs and KR translation (#194) * Update deploy-testnet.md * [DOCS] Fix EN typos, Update KR documentation * * Fix EN docs typo * KR Translation for new docs * Fix reprecated code examples * More doc updates, new document translations --- docs/gaiacli.md | 4 +- docs/genesis.md | 4 +- docs/hd-wallets.md | 2 +- docs/join-mainnet.md | 2 +- docs/ledger.md | 6 +- docs/translations/kr/deploy-testnet.md | 57 ++-- docs/translations/kr/gaiacli.md | 329 ++++++++++++------- docs/translations/kr/genesis-state.md | 30 ++ docs/translations/kr/genesis.md | 344 ++++++++++++++++++-- docs/translations/kr/hd-wallets.md | 58 ++++ docs/translations/kr/installation.md | 61 +++- docs/translations/kr/join-mainnet.md | 176 ++++++++++ docs/translations/kr/ledger.md | 185 ++++++++++- docs/translations/kr/upgrade-node.md | 94 ++++++ docs/translations/kr/validators/security.md | 6 +- 15 files changed, 1160 insertions(+), 198 deletions(-) create mode 100644 docs/translations/kr/genesis-state.md create mode 100644 docs/translations/kr/hd-wallets.md create mode 100644 docs/translations/kr/join-mainnet.md create mode 100644 docs/translations/kr/upgrade-node.md diff --git a/docs/gaiacli.md b/docs/gaiacli.md index 568157f923..8e6e23fa4f 100644 --- a/docs/gaiacli.md +++ b/docs/gaiacli.md @@ -17,7 +17,7 @@ It allows you to set a default value for each given flag. First, set up the address of the full-node you want to connect to: ```bash -gaiacli config node :: # example: gaiacli config node https://77.87.106.33:26657 ``` @@ -164,7 +164,7 @@ and `block` makes the client wait for the tx to be committed (or timing out). It is important to note that the `block` mode should **not** be used in most circumstances. This is because broadcasting can timeout but the tx may still be -included in a block. This can result in many undesirable situations. Therefor, it +included in a block. This can result in many undesirable situations. Therefore, it is best to use `sync` or `async` and query by tx hash to determine when the tx is included in a block. diff --git a/docs/genesis.md b/docs/genesis.md index 163c9699a3..abcca4bcb6 100644 --- a/docs/genesis.md +++ b/docs/genesis.md @@ -38,7 +38,7 @@ Next, the genesis file defines consensus parameters. Consensus parameters regrou + `max_bytes`: Maximum number of bytes per block. + `max_gas`: Gas limit per block. Each transaction included in the block will consume some gas. The total gas used by transactions included in a block cannot exceed this limit. - `evidence` - + `max_age`: An evidence is a proof that a validator signed two different blocks at the same height (and round). This is an explicitely malicious behaviour that is punished at the state-machine level. The `max_age` defines the maximum number of **blocks** after which an evidence is not valid anymore. + + `max_age`: An evidence is a proof that a validator signed two different blocks at the same height (and round). This is an explicitly malicious behaviour that is punished at the state-machine level. The `max_age` defines the maximum number of **blocks** after which an evidence is not valid anymore. - `validator` + `pub_key_types`: The types of pubkey (`ed25519`, `secp256k1`, ...) that are accepted for validators. Currently only `ed25519` is accepted. @@ -159,7 +159,7 @@ Let us break down the parameters: + `bond_denom`: Denomination of the staking token. - `last_total_power`: Total amount of voting power. Generally `0` in genesis (except if genesis was generated using a previous state). - `last_validator_powers`: Power of each validator in last known state. Generally `null` in genesis (except if genesis was generated using a previous state). -- `validators`: List of last knoww validators. Generally `null` in genesis (except if genesis was generated using a previous state). +- `validators`: List of last known validators. Generally `null` in genesis (except if genesis was generated using a previous state). - `bonds`: List of last known delegation. Generally `null` in genesis (except if genesis was generated using a previous state). - `unbonding_delegations`: List of last known unbonding delegations. Generally `null` in genesis (except if genesis was generated using a previous state). - `redelegations`: List of last known redelegations. Generally `null` in genesis (except if genesis was generated using a previous state). diff --git a/docs/hd-wallets.md b/docs/hd-wallets.md index 9e4c7dddbc..41c382c70c 100644 --- a/docs/hd-wallets.md +++ b/docs/hd-wallets.md @@ -1,6 +1,6 @@ # HD Wallets -Accounts in Cosmos are Hierarichial Deterministic (HD) Wallets. Originally specified in Bitcoin's [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki), HD wallets are a special kind of wallet that let users derive any number of accounts from a single seed. To understand what that means, let us first define some terminology: +Accounts in Cosmos are Hierarchical Deterministic (HD) Wallets. Originally specified in Bitcoin's [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki), HD wallets are a special kind of wallet that let users derive any number of accounts from a single seed. To understand what that means, let us first define some terminology: - **Wallet**: Set of accounts obtained from a given seed. - **Account**: A pair of public key/private key. diff --git a/docs/join-mainnet.md b/docs/join-mainnet.md index aa947d703b..94f1f90ce0 100644 --- a/docs/join-mainnet.md +++ b/docs/join-mainnet.md @@ -52,7 +52,7 @@ Your full node has been initialized! ### Copy the Genesis File -Fetch the testnet's `genesis.json` file into `gaiad`'s config directory. +Fetch the mainnet's `genesis.json` file into `gaiad`'s config directory. ```bash mkdir -p $HOME/.gaiad/config diff --git a/docs/ledger.md b/docs/ledger.md index a5633a7979..0a57bfa331 100644 --- a/docs/ledger.md +++ b/docs/ledger.md @@ -48,7 +48,7 @@ gaiacli keys add --ledger ledger cosmos1... cosmospub1... ``` -Cosmos uses [HD Wallets](./hd-wallets.md). This means you can setup many accounts using the same Ledger seed. To create another account from your Ledger device, run; +Cosmos uses [HD Wallets](./hd-wallets.md). This means you can setup many accounts using the same Ledger seed. To create another account from your Ledger device, run: ```bash gaiacli keys add --ledger @@ -66,7 +66,7 @@ Confirm that the address displayed on the device matches that displayed when you ### Connect to a full node -Next, you need to configure gaiacli with the URL of a Cosmos full node and the appropriate `chain_id`. In this example we connect to the public load balanced full node operated by Chorus One on the `cosmoshub-2` chain. But you can point your `gaiacli` to any Cosmos full node. Be sure that the `chain_id` is set to the same chain as the full node. +Next, you need to configure gaiacli with the URL of a Cosmos full node and the appropriate `chain_id`. In this example we connect to the public load balanced full node operated by Chorus One on the `cosmoshub-2` chain. But you can point your `gaiacli` to any Cosmos full node. Be sure that the `chain-id` is set to the same chain as the full node. ```bash gaiacli config node https://cosmos.chorus.one:26657 @@ -76,7 +76,7 @@ gaiacli config chain_id cosmoshub-2 Test your connection with a query such as: ``` bash -`gaiacli query staking validators` +gaiacli query staking validators ``` ::: tip diff --git a/docs/translations/kr/deploy-testnet.md b/docs/translations/kr/deploy-testnet.md index 303847d769..229e8f2f20 100755 --- a/docs/translations/kr/deploy-testnet.md +++ b/docs/translations/kr/deploy-testnet.md @@ -1,6 +1,6 @@ # 자체 테스트넷 구축하기 -해당 문서는 `gaiad` 노드 네트워크를 구축하는 세가지 방법을 제시합니다. 각 모델은 다른 이용 사례에 특화되어 있습니다. +해당 문서는 `gaiad` 노드 네트워크를 구축하는 세가지 방법을 설명합니다. 각 테스트넷 모델은 다른 테스트 목적에 최적화 되어있습니다. 1. 싱글-노드, 로컬, 수동 테스트넷 2. 멀티-노드, 로컬, 자동 테스트넷 @@ -10,9 +10,19 @@ > 참고: 현재 `remote` 관련 정보는 최신 릴리즈와 호환성이 맞지 않을 수 있으므로 참고하시기 바랍니다. +## Docker 이미지 + +컨테이너 형태로 Gaia 디플로이를 원하시는 경우, `build` 단계를 건너뛰시고 공식 이미지 파일을 설치하실 수 있습니다. $TAG은 설치하시려는 버전을 의미합니다. + +- `docker run -it -v ~/.gaiad:/root/.gaiad -v ~/.gaiacli:/root/.gaiacli tendermint:$TAG gaiad init` +- `docker run -it -p 26657:26657 -p 26656:26656 -v ~/.gaiad:/root/.gaiad -v ~/.gaiacli:/root/.gaiacli tendermint:$TAG gaiad start` +- `docker run -it -v ~/.gaiad:/root/.gaiad -v ~/.gaiacli:/root/.gaiacli tendermint:$TAG gaiacli version` + +각 이미지는 자체적인 docker-compose 스택을 빌드하는데 사용하실 수 있습니다. + ## 싱글-노드, 로컬, 수동 테스트넷 -이 가이드는 하나의 검증인 노드를 로컬 환경에서 운영하는 방식을 알려드립니다. 이런 환경은 테스트/개발 환경을 구축하는데 이용될 수 있습니다. +이 가이드는 한 개의 검증인 노드로 구성된 테스트넷을 로컬 환경에서 운영하는 방식을 알려드립니다. 테스트 용도 또는 개발 용도로 이용될 수 있습니다. ### 필수 사항 @@ -22,27 +32,26 @@ ### 제네시스 파일 만들기, 네트워크 시작하기 ```bash -# You can run all of these commands from your home directory +# 모든 명령어는 홈 디렉토리에서 실행하실 수 있습니다 cd $HOME -# Initialize the genesis.json file that will help you to bootstrap the network +# 네트워크를 시작할 genesis.json 파일을 초기화하기 gaiad init --chain-id=testing testing -# Create a key to hold your validator account +# 밸리데이터 키 생성하기 gaiacli keys add validator -# Add that key into the genesis.app_state.accounts array in the genesis file -# NOTE: this command lets you set the number of coins. Make sure this account has some coins -# with the genesis.app_state.staking.params.bond_denom denom, the default is staking -gaiad add-genesis-account $(gaiacli keys show validator -a) 1000stake,1000validatortoken +# 해당 키를 제네시스 파일에 있는 genesis.app_state.accounts 어레이(array)에 추가하세요 +# 참고: 이 명령어는 코인 수량을 설정할 수 있게 합니다. 위 계정에 코인 잔고를 포함하세요 +# genesis.app_state.staking.params.bond_denom의 기본 설정은 is staking gaiad add-genesis-account $(gaiacli keys show validator -a) 1000stake,1000validatortoken 입니다. -# Generate the transaction that creates your validator +# 밸리데이터 생성 트랜잭션 실행 gaiad gentx --name validator -# Add the generated bonding transaction to the genesis file +# 제네시스 파일에 초기 본딩 트랜잭션 추가하기 gaiad collect-gentxs -# Now its safe to start `gaiad` +# 이제 `gaiad`를 실행하실 수 있습니다. gaiad start ``` @@ -62,11 +71,9 @@ gaiad start `localnet` 커맨드를 운영하기 위한 `gaiad` 바이너리(리눅스)와 `tendermint/gaiadnode` docker 이미지를 생성합니다. 해당 바이너리는 컨테이너에 마운팅 되며 업데이트를 통해 이미지를 리빌드 하실 수 있습니다. -Build the `gaiad` binary (linux) and the `tendermint/gaiadnode` docker image required for running the `localnet` commands. This binary will be mounted into the container and can be updated rebuilding the image, so you only need to build the image once. - ```bash # Work from the SDK repo -cd $GOPATH/src/github.com/cosmos/cosmos-sdk +cd $GOPATH/src/github.com/cosmos/gaia # Build the linux binary in ./build make build-linux @@ -181,7 +188,7 @@ BINARY=gaiafoo make localnet-start 다음 환경은 [네트워크 디렉터리](https://github.com/cosmos/cosmos-sdk/tree/develop/networks)에서 실행하셔야 합니다. -### Terraform 과 Ansible +### Terraform과 Ansible 자동 디플로이멘트(deployment)는 [Terraform](https://www.terraform.io/)를 이용해 AWS 서버를 만든 후 [Ansible](http://www.ansible.com/)을 이용해 해당 서버에서 테스트넷을 생성하고 관리하여 운영됩니다. @@ -202,35 +209,33 @@ export SSH_PUBLIC_FILE="$HOME/.ssh/id_rsa.pub" 해당 명령은 `terraform` 과 `ansible`에서 이용됩니다.. -### 리모트 네트워크 만들기 +### 리모트 네트워크 생성하기 ``` SERVERS=1 REGION_LIMIT=1 make validators-start ``` -테스트넷 이름은 --chain-id에서 이용될 값이며, 클러스터 이름은 AWS 서버 관리 태그에서 이용될 값입니다. 코드는 각 존의 - -The testnet name is what's going to be used in --chain-id, while the cluster name is the administrative tag in AWS for the servers. The code will create SERVERS amount of servers in each availability zone up to the number of REGION_LIMITs, starting at us-east-2. (us-east-1 is excluded.) The below BaSH script does the same, but sometimes it's more comfortable for input. +테스트넷 이름은 --chain-id에서 이용될 값이며, 클러스터 이름은 AWS 서버 관리 태그에서 이용될 값입니다. cluster name은 서버의 AWS 관리용 태그입니다. 해당 코드는 SERVERS 개수에 비례하는 서버를 REGION_LIMIT 값까지 us-east-2 리전부터 생성합니다 (us-east-1는 제외됩니다). 다음 BaSH 스크립트는 동일한 명령을 실행하나, 개인 선호도에 따라 입력하기 편하실 수 있습니다. ``` ./new-testnet.sh "$TESTNET_NAME" "$CLUSTER_NAME" 1 1 ``` -### Quickly see the /status endpoint +### /status 엔드포인트 빠르게 확인하기 ``` make validators-status ``` -### Delete servers +### 서버 삭제하기 ``` make validators-stop ``` -### Logging +### 로깅 -You can ship logs to Logz.io, an Elastic stack (Elastic search, Logstash and Kibana) service provider. You can set up your nodes to log there automatically. Create an account and get your API key from the notes on [this page](https://app.logz.io/#/dashboard/data-sources/Filebeat), then: +로그는 Elastic stack (Elastic search, Logstash, Kibana) 서비스를 제공하는 Logz.io로 내보내실 수 있습니다. 또한, 노드가 자동으로 해당 서비스에 로깅을 진행하실 수 있습니다. 계정을 생성하시고 [이 페이지](https://app.logz.io/#/dashboard/data-sources/Filebeat)의 노트에서 API키를 받으신 후: ``` yum install systemd-devel || echo "This will only work on RHEL-based systems." @@ -240,9 +245,9 @@ go get github.com/mheese/journalbeat ansible-playbook -i inventory/digital_ocean.py -l remotenet logzio.yml -e LOGZIO_TOKEN=ABCDEFGHIJKLMNOPQRSTUVWXYZ012345 ``` -### Monitoring +### 모니터링 -You can install the DataDog agent with: +다음과 같이 DataDog 에이전트를 설치하실 수 있습니다: ``` make datadog-install diff --git a/docs/translations/kr/gaiacli.md b/docs/translations/kr/gaiacli.md index 481a025664..ea8fe8904c 100755 --- a/docs/translations/kr/gaiacli.md +++ b/docs/translations/kr/gaiacli.md @@ -2,27 +2,41 @@ ## Gaia CLI -::: tip 참고 -다음과 같은 에러 메시지가 나오는 경우: +`gaiacli`는 사용자가 풀노드를 통해 코스모스 허브 네트워크를 사용할 수 있게하는 도구입니다. 풀노드는 사용자가 직접 운영하거나 원격 풀노드에 연결하여 사용하실 수 있습니다. `gaiacli`를 설치하기 위해서는 [다음 과정](./installation.md)을 참고하세요. + +### gaiacli 설정하기 + +`gaiacli`를 설정하는데 사용되는 주 명령어는 다음과 같습니다: ```bash -Must specify these options: --chain-id when --trust-node is false +gaiacli config <플래그(flag)> <값(value)> ``` -라이트 클라이언트 증거를 검증할지 선택하셔야 합니다. 만약 쿼리를 요청하고 있는 노드를 신뢰할 수 있다면, `--trust-node=true`를 입력하시고, 그렇지 않다면 `--chain-id`를 입력하세요. -::: +위 명령어는 각 플래그의 기본 값을 설정할 수 있도록 합니다. + +우선 연결할 풀노드의 주소를 설정하겠습니다: + +```bash +gaiacli config node <호스트(host)>:<포트(port)> + +# 예시: gaiacli config node https://77.87.106.33:26657 +``` -`gaiacli`는 코스모스 테스트넷에서 이루어지는 트랜잭션과 계정을 관리하는 커맨드 라인 인터페이스입니다. 다음은 유용할 수 있는 `gaiacli` 명령어입니다: +자체적으로 풀노드를 운영하시는 경우, 주소 값에 `tcp://localhost:26657`을 입력하세요. -`gaiacli`의 설정 파일은 `$HOME/.gaiacli/config/config.toml` 경로에 저장되며, 파일 수정 또는 `gaiacli config` 명령어를 통해 수정할 수 있습니다: +이후, `--trust-node` 플래그의 기본 값을 설정하겠습니다: ```bash -gaiacli config chain-id gaia-9004 +gaiacli config trust-node true + +# 연결하시는 원격 풀노드를 신뢰하시는 경우, true를 선택하세요. 신뢰하지 않는 경우 false를 선택하세요. ``` -명령어 사용에 관련한 정보는 help를 참고하세요: `gaiacli config --help`. +마지막으로 연결하려는 블록체인의 `chain-id` 값을 설정하겠습니다: -이 문서에는 유용한 `gaiacli` 명령어와 예시가 포함되어있습니다. +```bash +gaiacli config chain-id cosmoshub-2 +``` ### 키(Keys) @@ -55,24 +69,26 @@ gaiacli config chain-id gaia-9004 새로운 _secp256k1_ 키를 생성하기 위해서는: ```bash -gaiacli keys add +gaiacli keys add <계정_명칭(account_name)> ``` +이제 해당 키를 안전하게 디스크에 보관하기 위해서 비밀번호를 설정합니다. + 새로운 키를 생성하는 과정에서 나오는 _시트키(seed phrase)_ 는 안전하게 저장하시길 바랍니다. 시드키는 다음과 같은 명령을 실행하여 잊어버린 퍼블릭/프라이빗 키를 복구하는데 이용됩니다: ```bash gaiacli keys add --recover ``` -이제 프라이빗 키를 확인하고 ``을 찾으면 됩니다: +이제 프라이빗 키를 확인하고 `<계정_명칭(account_name)>`을 찾으면 됩니다: ```bash -gaiacli keys show +gaiacli keys show <계정_명칭(account_name)> ``` -검증인 운영자 주소는 다음과 같이 확인하시고: +검증인 운영자 주소는 다음과 같이 확인하실 수 있습니다: -```shell +```bash gaiacli keys show --bech=val ``` @@ -119,9 +135,15 @@ gaiacli keys show --multisig-threshold K name1 name2 name3 [...] 멀티시그 트랜잭션를 생성, 서명, 전파하는 방법은 [멀티시그 트랜잭션](#멀티시그-트랜잭션) 항목을 참고하세요. +### 트랜잭션 전파 + +트랜잭션을 전파할때 `gaiacli`에서 `--broadcast-mode`를 사용하실 수 있습니다. `--broadcast-mode`는 `sync`(동기, 기본 값), `async`(비동기), 또는 `block`(보류) 값으로 설정될 수 있습니다. `sync` 값은 클라이언트가 CheckTx 리턴 값을 돌려주고, `async` 값은 클라이언트가 즉시 반응을 알려주며, `block` 값은 트랜잭션이 커밋(또는 타임이웃)될 때까지 대기합니다. + +대다수의 상황에서 `block` 모드는 사용하지 _않을 것을_ 추천드립니다. 이는 트랜잭션이 타임아웃 되었어도 블록에 포함되있을 수 있으며 이 과정에서 원하지 않은 문제가 발생할 가능성이 존재합니다. 대다수의 상황에서는 `sync` 또는 `async`를 사용하신 후 트랜잭션 해시 값을 조회하여 트랜잭션이 블록에 포함된 것을 확인하시는 것을 추천드립니다. + ### 수수료와 가스 -각 트랜잭션은 수수료(fee)를 지정하거나 가스 가격(gas price)을 지정할 수 있지만, 두 값을 함께 지정하는 것은 불가능합니다. 대다수의 유저는 본인이 지불하고 싶은 수수료 금액을 지정할 것으로 예상되며, 이 경우에는 수수료(fee)를 지정하는 방식으로 트랜잭션을 생성하면 됩니다. +각 트랜잭션은 수수료(fee)를 지정하거나 가스 가격(gas price)을 지정할 수 있지만, 두 값을 함께 지정하는 것은 불가능합니다. 각 검증인은 최소 가스 가격(minimum gas price)를 (다수 토큰 사용 가능) 설정할 수 있으며 이 값을 기준으로 `CheckTx` 단계에서 특정 트랜잭션을 블록에 포함시킬지 확인합니다. `gasPrices >= minGasPrices`일때 검증인은 트랜잭션을 처리합니다. 참고로 트랜잭션 전파시 검증인이 요구하는 토큰 중 하나를 수수료 지불 토큰으로 사용하셔야 합니다. @@ -130,13 +152,13 @@ __참고__: 위와 같은 메커니즘에서 일부 검증인은 멤풀에 있 예시) ```bash -gaiacli tx send ... --fees=100photino +gaiacli tx send ... --fees=5000uatom ``` 또는 ```bash -gaiacli tx send ... --gas-prices=1uatom +gaiacli tx send ... --gas-prices=0.025uatom ``` ### 계정 @@ -150,7 +172,7 @@ gaiacli tx send ... --gas-prices=1uatom 주소에 토큰을 받으신 후 잔고를 확인하시려면 다음 명령어를 입력하시면 됩니다: ```bash -gaiacli query account +gaiacli query account <코스모스_주소(account_cosmos)> ``` ::: warning 참고 @@ -162,9 +184,8 @@ gaiacli query account 한 계정에서 다른 계정으로 토큰/코인을 전송하기 위해서는 다음 명령어를 이용하시면 됩니다: ```bash -gaiacli tx send 10faucetToken \ - --chain-id= \ - --from= \ +gaiacli tx send <보내는_사람_키_명칭_또는_주소(sender_key_name_or_address)> 10faucetToken \ + --chain-id=<체인_아이디(chain_id)> \ ``` ::: warning 참고 @@ -178,51 +199,51 @@ gaiacli tx send 10faucetToke 이제 토큰을 전송한 계정과 토큰을 받은 계정의 잔고를 확인합니다: ```bash -gaiacli query account -gaiacli query account +gaiacli query account <보내는_주소(account_cosmos)> +gaiacli query account <수신자_주소(destination_cosmos)> ``` 특정 블록 높의에서의 잔고를 확인하고 싶으시다면 `--block` 플래그를 사용하실 수 있습니다: ```bash -gaiacli query account --block= +gaiacli query account <코스모스_주소(account_cosmos)> --block=<블록_높이(block_height)> ``` 트랜잭션을 실제 전파하지 않고 시뮬레이션을 하시려면 명령어 뒤에 `--dry-run` 플래그를 추가하세요: ```bash -gaiacli tx send 10faucetToken \ - --chain-id= \ - --from= \ +gaiacli tx send <보내는_사람_키_명칭_또는_주소(sender_key_name_or_address)> 10faucetToken \ + --chain-id=<체인_아이디(chain-id)> \ --dry-run ``` 또한 트랜잭션을 빌드한 후 해당 트랜잭션을 JSON 포맷으로 STDOUT에 프린트 하시기를 원하면 `--generate-only`를 명령어에 추가하시면 됩니다: ```bash -gaiacli tx send 10faucetToken \ - --chain-id= \ - --from= \ +gaiacli tx send <보내는이_주소(sender_address)> <수신자_주소(destination_cosmosaccaddr)> 10faucetToken \ + --chain-id=<체인_아이디(chain-id)> \ --generate-only > unsignedSendTx.json ``` ::: tip 참고 -시뮬레이션은 퍼블릭 키를 필요로 하고 generate only는 키베이스를 사용하지 않기 때문에 시뮬레이션은 tx generate only 기능과 함께 사용될 수 없습니다. +`--generate-only` 명령어는 `gaiacli`가 로컬 키베이스를 액세스하지 않습니다. `--generate-only` 플래그를 사용하시는 경우, `<보내는_사람_키_명칭_또는_주소(sender_key_name_or_address)>` 값은 키 명칭이 아닌 주소 값을 입력하세요. ::: + 이제 `--generate-only`를 통해 프린트된 트랜잭션 파일을 서명하시려면 다음 명령어를 통해 키를 입력하시면 됩니다: ```bash gaiacli tx sign \ - --chain-id= \ - --from= + --chain-id=<체인_아이디(chain-id)> \ + --from=<키_명칭(key_name)> \ unsignedSendTx.json > signedSendTx.json ``` -트랜잭션의 서명을 검증하기 위해서는: +해당 트랜잭션의 서명은 다음 명령어를 통해 검증하실 수 있습니다: ```bash -gaiacli tx sign --validate-signatures signedSendTx.json +gaiacli tx sign --validate-signatures + signedSendTx.json ``` 서명된 트랜잭션을 노드로 전파하기 위해서는 JSON 파일을 다음 명령어를 통해 전달하면 됩니다: @@ -237,24 +258,24 @@ gaiacli tx broadcast --node= signedSendTx.json 트랜잭션 검색 명령을 이용하여 모든 트랜잭션에 추가되는 특정 `tags` 세트를 검색할 수 있습니다. -각 태그의 키-값 페어는 `:` 형태로 이루어집니다. 더 상세한 검색을 원하실 경우 `&` 를 사용하여 태그를 추가할 수 있습니다. +각 태그의 키-값 페어는 `<태그(tag)>:<값(value)>` 형태로 이루어집니다. 더 상세한 검색을 원하실 경우 `&` 를 사용하여 태그를 추가할 수 있습니다. `tag`를 이용한 트랜잭션 조회는 다음과 같이 합니다: ```bash -gaiacli query txs --tags=':' +gaiacli query txs --tags='<태그(tag)>:<값(value)>' ``` 다수의 `tags`를 이용하실 경우: ```bash -gaiacli query txs --tags=':&:' +gaiacli query txs --tags='<태그1>:<값1>&<태그2>:<값2>' ``` 페이지네이션은 `page`와 `limit` 값으로 지원됩니다. ```bash -gaiacli query txs --tags=':' --page=1 --limit=20 +gaiacli query txs --tags='<태그(tag)>:<값(value)>' --page=1 --limit=20 ``` ::: tip 참고 @@ -286,7 +307,7 @@ gaiacli query tx [hash] 제일링 된 검증인을 언제일 하기 위해서는: ```bash -gaiacli tx slashing unjail --from +gaiacli tx slashing unjail --from <검증인_오퍼레이터_주소(validator-operator-addr)> ``` #### 서명 정보 @@ -294,7 +315,7 @@ gaiacli tx slashing unjail --from +gaiacli query slashing signing-info <검증인_pubkey(validator-pubkey)> ``` #### 슬래싱 파라미터 조회 @@ -305,6 +326,26 @@ gaiacli query slashing signing-info gaiacli query slashing params ``` +### 민팅 + +민팅/인플레이션 파라미터 값은 다음과 같이 조회하실 수 있습니다: + +```bash +gaiacli query minting params +``` + +현재 인플레이션 값은 다음과 같이 조회하실 수 있습니다: + +```bash +gaiacli query minting inflation +``` + +현재 프로비젼(provisions) 값은 다음과 같이 조회하실 수 있습니다: + +```bash +gaiacli query minting annual-provisions +``` + ### 스테이킹 #### 검증인 세팅하기 @@ -312,7 +353,7 @@ gaiacli query slashing params #### 검증인에게 위임하기 -메인넷에서는 `atom`을 특정 검증인에게 위임할 수 있습니다. 스테이킹에 참여하는 [위임인](/resources/delegators-faq)은 검증인 보상의 일부를 받을 수 있습니다. 관련 정보는 [코스모스 토큰 모델](https://github.com/cosmos/cosmos/raw/master/Cosmos_Token_Model.pdf)에서 확인하세요. +메인넷에서는 `atom`을 특정 검증인에게 위임할 수 있습니다. 스테이킹에 참여하는 [위임자](/resources/delegators-faq)는 검증인 보상의 일부를 받을 수 있습니다. 관련 정보는 [코스모스 토큰 모델](https://github.com/cosmos/cosmos/raw/master/Cosmos_Token_Model.pdf)에서 확인하세요. ##### 검증인 조회하기 @@ -325,23 +366,23 @@ gaiacli query staking validators 특정 검증인에 대한 정보를 원하실 경우 다음 명령을 실행하세요: ```bash -gaiacli query staking validator +gaiacli query staking validator ``` #### 토큰 본딩하기 -테스트넷의 경우 `atom`이 아닌 `stake`를 위임합니다. 특정 테스트넷 검증인에게 토큰을 본딩하기 위해서는: +코스모스 허브 메인넷에서는 `uatom` 단위로 위임이 가능하며 `1atom = 1000000uatom`입니다. 테스트넷 검증인에게 위임하는 방법은 다음과 같습니다. ```bash gaiacli tx staking delegate \ --amount=10000000uatom \ - --validator= \ - --from= \ - --chain-id= + --validator=<검증인_주소(validator)> \ + --from=<키_명칭(key_name)> \ + --chain-id=<체인_아이디(chain-id)> ``` -`` 는 검증 대상 검증인의 운영자 주소입니다. 로컬 테스트넷을 운영하시는 경우, 다음 명령어로 관련 주소를 확인하실 수 있습니다: +`` 는 위임 대상 검증인의 검증인 운영자 주소(valoper)입니다. 로컬 테스트넷을 운영하시는 경우, 다음 명령어로 관련 주소를 확인하실 수 있습니다: ```bash gaiacli keys show [name] --bech val @@ -351,36 +392,31 @@ gaiacli keys show [name] --bech val 토큰이 본딩되고 있는 기간 동안에는 다른 본딩된 토큰과 함께 하나의 '풀'을 이룹니다. 검증인들과 위임인들은 해당 풀의 소유량에 비례하는 보상을 받게 됩니다. - -::: tip 참고 -보유하고 있는 `stake` 이상을 사용하지 마세요. `stake`가 더 필요한 경우 [Faucet](https://faucetcosmos.network/)에서 추가로 받으실 수 있습니다! -::: - ##### 위임 조회 위임 요청을 검증인에게 전송한 경우, 관련 정보를 다음 명령을 통해 조회하실 수 있습니다: ```bash -gaiacli query staking delegation +gaiacli query staking delegation <위임자_코스모스_주소(delegator_addr)> <검증인_주소(validator_addr)> ``` -만약 특정 검증인에 대한 모든 위임 상태를 확인하고 싶으실 경우 다음 명령을 이용하세요: +만약 모든 위임 상태를 확인하고 싶으실 경우 다음 명령을 이용하세요: ```bash -gaiacli query staking delegation +gaiacli query staking delegation <위임자_코스모스_주소(delegator_addr)> ``` #### 토큰 언본딩 하기 -만약 특정 검증인이 악의적인 행동을 했거나 또는 본인이 개인적인 이유로 일부 토큰을 언본딩을 워하는 경우 다음 명령어를 통해 토큰을 언본딩 할 수 있습니다. 언본딩은 정확한 수량인 `shares-amount`(예시, `12.1`) 또는 언본딩을 원하는 물량의 비율인 `shares-fraction`(예시, `0.25`) 값으로 표현될 수 있습니다. +만약 특정 검증인이 악의적인 행동을 했거나 또는 본인이 개인적인 이유로 일부 토큰을 언본딩을 워하는 경우 다음 명령어를 통해 토큰을 언본딩 할 수 있습니다: ```bash gaiacli tx staking unbond \ - \ + <검증인_주소(validator_addr)> \ 10atom \ - --from= \ - --chain-id= + --from=<키_명칭(key_name)> \ + --chain-id=<체인_아이디(chain_id)> ``` 언본딩은 언본딩 기간이 끝나는 대로 완료됩니다. @@ -390,19 +426,19 @@ gaiacli tx staking unbond \ 언본딩 절차를 시작하신 후 관련 정보를 조회하는 방법은 다음과 같습니다: ```bash -gaiacli query staking unbonding-delegation +gaiacli query staking unbonding-delegation <위임자_주소(delegator-addr)> <검증인_주소(validator_addr)> ``` 또는 특정 위임자의 모든 언본딩 정보를 확인하고 싶으신 경우: ```bash -gaiacli query staking unbonding-delegations +gaiacli query staking unbonding-delegations <위임자_주소(account_cosmos)> ``` 추가적으로 특정 검증인으로 부터 언본딩하는 정보를 확인하고 싶으신 경우: ```bash -gaiacli query staking unbonding-delegations-from +gaiacli query staking unbonding-delegations-from <검증인_cosmosval_주소(account_cosmosval)> ``` #### 재위임(Redelegate) 하기 @@ -411,11 +447,11 @@ gaiacli query staking unbonding-delegations-from \ - \ + <기존_검증인_valoper_주소(src_validator_operator_addr)> \ + <대상_검증인_valoper_주소(dst_validator_operator_addr)> \ 10atom \ - --from= \ - --chain-id= + --from=<키_명칭(key_name)> \ + --chain-id=<체인_아이디(chain_id)> ``` 위 예시와 같이 재위임될 토큰의 수량은 특정 수량(`shares-amount`) 또는 일정 비율(`shares-fraction`)로 표현될 수 있습니다. @@ -427,19 +463,19 @@ gaiacli tx staking redelegate \ 재위임을 시작하신 후, 다음 명령을 통해서 관련 정보를 조회하실 수 있습니다: ```bash -gaiacli query staking redelegation +gaiacli query staking redelegation <위임자_주소(delegator_addr)> <기존_검증인_주소(src_val_addr)> <대상_검증인_주소(dst_val_addr)> ``` 특정 위임자의 모든 검증인에 대한 재위임을 확인하고 싶으신 경우: ```bash -gaiacli query staking redelegations +gaiacli query staking redelegations <위임자_주소(account_cosmos)> ``` 특정 검증인에 대한 재위임을 확인하고 싶으신 경우: ```bash - gaiacli query staking redelegations-from + gaiacli query staking redelegations-from <검증인_주소(account_cosmosval)> ``` #### 파라미터 조회 @@ -477,48 +513,92 @@ gaiacli query staking pool 특정 검증인에 대한 모든 위임은 다음 명령으로 조회가 가능합니다: ```bash - gaiacli query delegations-to + gaiacli query delegations-to <검증인_주소(account_cosmosval)> ``` ### 거버넌스 -거버넌스는 코스모스 허브의 유저가 소프트웨어 업그레이드, 메인넷 파라미터 또는 문서 형태의 프로포절 등에 대한 합의를 하는 절차입니다. 유저는 프로포절에 대한 투표를 함으로 이 절차에 참여할 수 있으며, 투표권은 메인넷 아톰 홀더들에게만 주어집니다. +거버넌스는 코스모스 허브의 유저가 소프트웨어 업그레이드, 메인넷 파라미터 또는 문서 형태의 프로포절 등에 대한 합의를 하는 절차입니다. 유저는 프로포절에 대한 투표를 함으로 이 절차에 참여할 수 있으며, 투표권은 메인넷 아톰 홀더들에게 주어집니다. 다음은 투표 절차에 대한 정보입니다: - 투표권은 본딩된 `Atom`을 소유한 유저에게만 주어지며, `본딩된 아톰 1개 = 1표` 기준으로 집계됩니다 -- 투표권을 행사하지 않은 위임인들은 본인이 위임한 검증인들의 투표를 따르게 됩니다 -- **검증인은 모든 프로포절에 투표를 해야합니다.** 프로포절에 투표를 하지 않는 검증인들은 부분적 슬래싱 페널티를 받게 됩니다 +- 투표권을 행사하지 않은 위임자는 본인이 위임한 검증인의 투표를 따르게 됩니다 - 표는 각 프로포절의 투표 마감 시점(메인넷 기준 2주)에서 집계됩니다. 각 계정은 투표기간 중 표를 변경할 수 있으며(트랜잭션 수수료는 부과됩니다), 가장 마지막 표가 유효한 표로 집계됩니다 - 투표자들은 `Yes`, `No`, `NoWithVeto`와 `Abstain` 중에서 하나를 선택하여 투표할 수 있습니다 -- 프로포절은 `(YesVote/(YesVotes+NoVotes+NoWithVetoVotes))>1/2` 또는 `(NoWithVetoVotes/(YesVotes+NoVotes+NoWithVetoVotes))<1/3`일 경우에만 통과하며, 이 외의 경우 부결됩니다. +- 프로포절은 다음 조건을 충족할 경우에만 통과한 것으로 간주됩니다: + - `(YesVote/(YesVotes+NoVotes+NoWithVetoVotes)) > 1/2` + - `(NoWithVetoVotes/(YesVotes+NoVotes+NoWithVetoVotes)) < 1/3` + - `((YesVotes+NoVotes+NoWithVetoVotes) / totalBondedStake) >= quorum` 거버넌스 절차에 대한 더 자세한 정보는 [거버넌스 모듈 스펙](./../spec/governance)을 확인하세요. #### 거버넌스 프로포절 생성하기 -새로운 거버넌스 프로포절을 생성하기 위해서는 프로포절 정보와 일정의 보증금을 예치해야 합니다: - -- `title`: 프로포절 제목 -- `description`: 프로포절 설명 -- `type`: 프로포절 유형. _Text_ 형태여야 합니다 (_SoftwareUpgrade_ 와 _ParameterChange_ 는 아직 지원되지 않습니다). +새로운 거버넌스 프로포절을 생성하기 위해서는 프로포절 제목, 프로포절 내용 그리고 보증금을 예치해야 합니다. 거버넌스 모듈 외의 모듈에서 프로포절 타입과 핸들러를 도입할 수 있습니다 (예, 파라미터 변경), 거버넌스 모듈 자체는 `Text` 프로포절을 지원합니다. 거버넌스 외 모듈의 프로포절은 `submit-proposal` 위에 명령을 추가할 수 있습니다. ```bash gaiacli tx gov submit-proposal \ - --title= \ - --description= \ - --type= \ - --deposit=<40000000uatom(예치금 수량)> \ - --from= \ - --chain-id= + --title=<제목(title)> \ + --description=<설명(description)> \ + --type="Text" \ + --deposit="1000000uatom" \ + --from=<키_명칭(name)> \ + --chain-id=<체인_아이디(chain_id)> +``` + +또한 `--proposal` 플래그를 이용해 프로포절이 포함된 JSON 파일을 직접적으로 제공할 수도 있습니다. + +파라미터 변경 프로포절의 경우 내용을 CLI 인풋으로 입력하기 어렵기 때문에 프로포절 파일을 제출해야 합니다. + +```bash +gaiacli tx gov submit-proposal param-change <프로포절/파일/경로/프로포절.json> \ + --from=<키_명칭(key_name)> \ + --chain-id=<체인_아이디(chain_id)> +``` + +`proposal.json` 파일 형식은 다음과 같습니다: + +```json +{ + "title": "Param Change", + "description": "Update max validators", + "changes": [ + { + "subspace": "staking", + "key": "MaxValidators", + "value": 105 + } + ], + "deposit": [ + { + "denom": "stake", + "amount": "10000000" + } + ] +} ``` +::: danger 경고 + +현재 파라미터 변경 프로포절은 _검토_ 되지만, _검증_ 되지는 않기 때문에 모든 `값`은 유효하다는 것을 미리 확인해야 합니다(예, 올바른 타입과 한도 내). 예) `MaxValidator`(최대 검증인) 값은 소수점이 아닌 integer 값이어야 합니다. + +파라미터 변경 프로포절 검토 단계에서 이런 문제가 발견될 것 확률이 높지만, 참고할 필요는 있습니다. + +::: + +::: tip 참고 + +`SoftwareUpgrade` 프로포절은 현재 개발되지 않은 상황이므로 지원되지 않으며, 형태는 `Text` 프로포절과 동일합니다. + +::: + ##### 프로포절 조회 프로포절이 생성된 후 관련 정보를 조회하는 방법은 다음과 같습니다: ```bash -gaiacli query gov proposal +gaiacli query gov proposal <프로포절_ID(proposal_id)> ``` 모든 프로포절에 대한 조회를 하기 위해서는: @@ -532,17 +612,17 @@ gaiacli query gov proposals 특정 거버넌스 프로포절의 제안자를 확인하기 위해서는: ```bash -gaiacli query gov proposer +gaiacli query gov proposer <프로포절_ID(proposal_id)> ``` #### 보증금 추가하기 -프로포절이 네트워크에 전파되기 위해서는 해당 프로포절의 보증금이 `minDeposit` 값 이상이어야 합니다 (현재 기본 값은 `10 stake`입니다). 만약 사전에 생성한 프로포절이 해당 기준을 충족하지 못하였다면 추후에 보증금을 추가 예치하여 활성화할 수 있습니다. 프로포절의 보증금이 최소 값을 도달하면 해당 프로포절의 투표는 활성화 됩니다: +프로포절이 네트워크에 전파되기 위해서는 해당 프로포절의 보증금이 `minDeposit` 값 이상이어야 합니다 (현재 기본 값은 `512000000uatom`입니다). 만약 사전에 생성한 프로포절이 해당 기준을 충족하지 못하였다면 추후에 보증금을 추가 예치하여 활성화할 수 있습니다. 프로포절의 보증금이 최소 값을 도달하면 해당 프로포절의 투표는 활성화 됩니다: ```bash -gaiacli tx gov deposit <200000000uatom(금액)> \ - --from= \ - --chain-id= +gaiacli tx gov deposit <프로포절_ID(proposal_id)> "10000000uatom" \ + --from=<키_명칭(name)> \ + --chain-id=<체인_ID(chain_id)> ``` > _참고_: 기본 보증금 기준을 충족하지 못한 프로포절은 `MaxDepositPeriod`이 지나면 자동으로 삭제됩니다. @@ -552,13 +632,13 @@ gaiacli tx gov deposit <200000000uatom(금액)> \ 새로운 프로포절이 생성된 후, 해당 프로포절에 대한 보증금은 다음과 같이 조회할 수 있습니다: ```bash -gaiacli query gov deposits +gaiacli query gov deposits <프로포절_ID(proposal_id)> ``` 특정 주소에 대한 보증금은 다음과 같이 확인하실 수 있습니다: ```bash -gaiacli query gov deposit +gaiacli query gov deposit <프로포절_ID(proposal_id)> <보증금_제공자_주소(depositor_address)> ``` #### 프로포절 투표하기 @@ -567,9 +647,9 @@ gaiacli query gov deposit \ - --from= \ - --chain-id= +gaiacli tx gov vote <프로포절_ID(proposal_id)> \ + --from=<키_명칭(key_name)> \ + --chain-id=<체인_아이디(chain-id)> ``` ##### 표 조회하기 @@ -577,20 +657,20 @@ gaiacli tx gov vote \ 특정 표와 관련한 정보를 조회하기 위해서는: ```bash -gaiacli query gov vote +gaiacli query gov vote <프로포절_ID(proposal_id)> <투표자_주소(voter_address)> ``` 과거 프로포절에 대한 표 정보를 확인하기 위해서는: ```bash -gaiacli query gov votes +gaiacli query gov votes <프로포절_ID(proposal_id)> ``` #### 프로포절 결과 조회하기 -특정 프로포절에 대한 결과를 확인하기 위해서는: +특정 프로포절에 대한 결과를 확인하기 위해서는 `tally` 명령어를 사용하실 수 있습니다: ```bash -gaiacli query gov tally +gaiacli query gov tally <프로포절_ID(proposal_id)> ``` #### 거버넌스 파라미터 조회하기 @@ -613,6 +693,14 @@ gaiacli query gov param deposit gaiacli query distribution params ``` +#### 커뮤니티 풀 잔고 조회 + +거버넌스 소유권에 있는 커뮤니티 풀 자산을 조회하기 위해서는 다음 명령어를 사용하세요: + +```bash +gaiacli query distribution params +``` + #### 수령되지 않은 리워드를 받기 수령하지 않은 리워드를 수령하기 위해서는: @@ -626,7 +714,7 @@ gaiacli query distribution outstanding-rewards 특정 검증인의 커미션을 조회하기 위해서는: ```bash -gaiacli query distribution commission +gaiacli query distribution commission <검증인_주소(validator_address)> ``` #### 검증인 슬래싱 조회 @@ -634,7 +722,7 @@ gaiacli query distribution commission 특정 검증인의 슬래싱 기록을 조회하기 위해서는: ```bash -gaiacli query distribution slashes +gaiacli query distribution slashes <검증인_주소(validator_address)> <시작_블록_높이(start_height)> <끝_블록_높이(end_height)> ``` #### 특정 검증인에서 수령되지 않은 리워드 조회 @@ -642,7 +730,7 @@ gaiacli query distribution slashes +gaiacli query distribution rewards <위임자_주소(delegator_address)> <검증인_주소(validator_address)> ``` #### 위임자의 수령 대기중인 모든 리워드 조회 @@ -650,7 +738,7 @@ gaiacli query distribution rewards +gaiacli query distribution rewards <위임자_주소(delegator_address)> ``` ### 멀티시그 트랜잭션 @@ -659,7 +747,7 @@ gaiacli query distribution rewards 예를 들어 멀티시그 키가 `p1`, `p2`, `p3` 키로 이루어진다면, `p1` 키 보유자는 `p2`와 `p3`의 키가 있어야 멀티시그 계정의 퍼블릭 키를 생성할 수 있습니다. -``` +```bash gaiacli keys add \ --pubkey=cosmospub1addwnpepqtd28uwa0yxtwal5223qqr5aqf5y57tc7kk7z8qd4zplrdlk5ez5kdnlrj4 \ p2 @@ -667,9 +755,8 @@ gaiacli keys add \ --pubkey=cosmospub1addwnpepqgj04jpm9wrdml5qnss9kjxkmxzywuklnkj0g3a3f8l5wx9z4ennz84ym5t \ p3 gaiacli keys add \ - --multisig-threshold=2 + --multisig-threshold=2 \ --multisig=p1,p2,p3 - p1p2p3 ``` 이제 새로운 멀티시그 키 `p1p2p3`이 보관되었으며 이 주소를 기반으로 멀티 트랜잭션이 서명됩니다: @@ -678,11 +765,19 @@ gaiacli keys add \ gaiacli keys show --address p1p2p3 ``` +멀티시그 주소의 투표 통과 기준, pubkey 투표자 그리고 각자 투표권 부게를 확인하기 위해서는 JSON 아웃풋을 확인하거나 `--show-multisig` 플래그를 사용하실 수 있습니다: + +```bash +gaiacli keys show p1p2p3 -o json + +gaiacli keys show p1p2p3 --show-multisig +``` + 위 주소를 기반으로 멀티시그 트랜잭션을 생성하는 과정의 첫 단계는 다음과 같습니다: ```bash gaiacli tx send cosmos1570v2fq3twt0f0x02vhxpuzc9jc4yl30q2qned 10000000uatom \ - --from= \ + --from=<멀티시그_주소(multisig_address)> \ --generate-only > unsignedTx.json ``` @@ -690,20 +785,20 @@ gaiacli tx send cosmos1570v2fq3twt0f0x02vhxpuzc9jc4yl30q2qned 10000000uatom \ ```bash gaiacli tx sign \ - --multisig= \ - --name=p1 \ - --output-document=p1signature.json \ - unsignedTx.json + unsignedTx.json \ + --multisig=<멀티시그_주소(multisig_address)> \ + --from=p1 \ + --output-document=p1signature.json ``` 서명이 생성된 후, `p1`은 `unsignedTx.json`과 `p1signature.json`을 `p2` 또는 `p3`에게 전다합니다. `p2`와 `p3`은 이를 기반으로 서명을 진행합니다: ```bash gaiacli tx sign \ - --multisig= \ + unsignedTx.json \ + --multisig=<멀티시그_주소(multisig_address)> \ --name=p2 \ - --output-document=p2signature.json \ - unsignedTx.json + --output-document=p2signature.json ``` `p1p2p3`은 3명 중 2명의 서명을 필요로 하는 멀티시그 키입니다. 그렇기 때문에 `p1`이 서명한 트랜잭션에 하나의 프라이빗 키만 더해지면 트랜잭션이 유효합니다. 이제 다른 키 보유자들은 필요한 서명 파일을 결합하여 멀티시그 트랜잭션을 생성할 수 있습니다: diff --git a/docs/translations/kr/genesis-state.md b/docs/translations/kr/genesis-state.md new file mode 100644 index 0000000000..e323baa38c --- /dev/null +++ b/docs/translations/kr/genesis-state.md @@ -0,0 +1,30 @@ +# Gaia 제네시스 상태 + +Gaia genesis state, 또는 `GenesisState`는 다수의 계정, 모듈 상태 그리고 제네시스 트랜잭션 같은 메타데이터가 포함되어 있습니다. 각 모듈은 각자의 `GenesisState`를 지정할 수 있습니다. 또한, 각 모듈은 제네시스 상태 검증, 불러오기(import), 내보내기(export) 기능을 지정할 수 있습니다. + +Gaia 제네시스 상태는 다음과 같이 정의됩니다: + +```go +type GenesisState struct { + AuthData auth.GenesisState `json:"auth"` + BankData bank.GenesisState `json:"bank"` + StakingData staking.GenesisState `json:"staking"` + MintData mint.GenesisState `json:"mint"` + DistrData distr.GenesisState `json:"distribution"` + GovData gov.GenesisState `json:"gov"` + SlashingData slashing.GenesisState `json:"slashing"` + GenTxs []json.RawMessage `json:"gentxs"` +} +``` + +ABCI에서는 `initFromGenesisState`의 `initChainer`의 정의가 호출되며 내부적으로 각 모듈의 `InitGenesis`를 호출하여 각자의 `GenesisState`를 파라미터 값으로 지정합니다. + +## 계정(Accounts) + +제네시스 계정은 `x/auth` 모듈의 `GenesisState`에 정의되며 `accounts` 키 내에 존재합니다. 제네시스 계정의 표준 정의는 없으나 모든 제네시스 계정은 `x/auth`가 정의한 `GenesisAccount`를 사용합니다. + +각 계정은 유효하고 고유한 계정 번호(account number), 시퀀스 번호(sequence number / nonce)와 주소가 있어야 합니다. + +또한, 계정은 베스팅(락업) 형태로 존재할 수 있으며, 이 경우 필수 락업 정보를 정의해야 합니다. 베스팅 계정은 최소 `OriginalVesting`과 `EndTime` 값을 제공해야 합니다. 만약 `StartTime`이 정의되는 경우, 해당 계정은 지속적 베스팅 계정으로 취급되며 지정된 스케줄에 따라 지속적으로 토큰의 락업을 해제합니다. 정의되는 `StartTime`은 `EndTime`값보다 적어야 하지만, 미래에 시작될 수도 있습니다. 즉, 락업 해제는 제네시스 시간과 동일하지 않아도 무관합니다. 만약 Export된 상태(state)가 아닌 신규 상태에서 시작되는 체인일 경우, `OriginalVesting` 값은 `Coin` 값과 동일하거나 적어야 합니다. + + diff --git a/docs/translations/kr/genesis.md b/docs/translations/kr/genesis.md index 6fa981a8ab..d80618ed69 100644 --- a/docs/translations/kr/genesis.md +++ b/docs/translations/kr/genesis.md @@ -1,31 +1,333 @@ -# Gaia 제네시스 스테이트 +# 제네시스 파일 -Gaia의 제네시스 스테이트인 `GenesisState`는 계정 정보, 모듈 스테이트 그리고 제네시스 트랜잭션 같은 메타데이터 등으로 구성됩니다. 각 모듈은 각자의 `GenesisState`를 지정할 수 있습니다. 또한, 각 모듈은 각자의 제네시스 스테이트 검증, 임포트, 엑스포트 기능 등을 지정할 수 있습니다. +이 문서는 코스모스 허브 메인넷의 제네시스 파일의 구조를 설명합니다. 또한, 자체 gaia 테스트넷을 운영하기 위해 자체적으로 제네시스 파일을 작성하는 방법을 설명합니다. -ABCI `initChainer`에서는 Gaia의 `initFromGenesisState`를 기반으로 각 모듈의 `InitGenesis`를 호출해 각 모듈들의 `GenesisState`를 파라미터 값으로 불러옵니다. +참고로 기본 설정이 적용된 제네시스 파일을 사용해 테스트넷을 운영하기 위해서는 다음 명령어를 입력할 수 있습니다: -## 계정 +```bash +gaiad init <명칭(moniker)> --chain-id <체인_아이디(chain-id)> +``` + +제네시스 파일은 `~/.gaiad/config/genesis.toml`에 저장됩니다. + +## 제네시스 파일은 무엇인가? + +제네시스 파일은 블록체인 초기 상태(state)를 정의하는 JSON 파일입니다. 이는 실질적으로 블록 높이 `0`을 뜻하며, 첫 블록이 생성되는 `1` 블록은 제네시스 파일을 패런트(parent)로 참조합니다. + +제네시스 파일에 정의된 상태는 토큰 분배, 제네시스 시간, 기본 파라미터 값 등의 모든 필수 정보를 포함하고 있습니다. 각 정보를 항목별로 정리합니다. + +## 제네시스 시간과 체인 아이디 + +`genesis_time`은 제네시스 파일 상단에 정의됩니다. 제네시스 타임은 블록체인이 시작되는 `UTC` 기준 시간을 정의합니다. 해당 시간에 도달하면 제네시스 검증인은 온라인어 컨센서스 과정에 참여를 시작합니다. 블록체인은 제네시스 검증인의 2/3 이상이 (보팅 파워 기준으로) 온라인될 경우에 시작됩니다. + +```json +"genesis_time": "2019-03-13T17:00:00.000000000Z", +``` + +`chain_id`는 블록체인의 고유 식별 정보입니다. 동일한 소프트웨어를 운영하는 다양한 체인을 구별하기 위해 사용됩니다. + +```json +"chain_id": "cosmoshub-2", +``` + +## 컨센서스 파라미터 + +이후 제네시스 파일은 컨센서스 파라미터 값을 정의합니다. 컨센서스 파라미터는 모든 합의 계층(`gaia`의 경우 `Tendermint` 계층) 관련 값을 리그룹(regroup)합니다. 파라미터 값에 대해 알아보겠습니다: + +- `block` + + `max_bytes`: 블록 최대 바이트 크기 + + `max_gas`: 블록 가스 한도(gas limit). 블록에 포함되는 모든 트랜잭션은 가스를 소모합니다. 블록에 포함되어있는 트랜잭션들의 총 가스 사용량은 이 한도를 초과할 수 없습니다. +- `evidence` + + `max_age`: 증거(evidence)는 검증인이 동일한 블록 높이와 합의 라운드(round)에서 두개의 블록을 동시했다는 증거입니다. 위와 같은 행동은 명백한 악의적 행동으로 간주되며 스테이트 머신 계층에서 페널티를 부과합니다. `max_age` 값은 증거 유효성이 유지되는 최대 _블록_ 개수를 의미합니다. +- `validator` + + `pub_key_types`: 검증인이 사용할 수 있는 pubkey 형태입니다(`ed25519`, `secp256k1`, ...). 현재 `ed25519`만 지원됩니다. + +```json +"consensus_params": { + "block_size": { + "max_bytes": "150000", + "max_gas": "1500000" + }, + "evidence": { + "max_age": "1000000" + }, + "validator": { + "pub_key_types": [ + "ed25519" + ] + } + }, +``` + +## 애플리케이션 상태 + +애플리케이션 상태(application state)는 스테이트 머신(상태 기계, state machine)의 초기 상태를 정의합니다. + +### 제네시스 계정 + +이 항목에서는 초기 토큰 분배가 정의됩니다. 수동으로 제네시스 파일에 계정을 추가할 수 있지만, 다음 명령어를 통해 계정을 추가할 수도 있습니다: + +```bash +// 예시: gaiad add-genesis-account cosmos1qs8tnw2t8l6amtzvdemnnsq9dzk0ag0z37gh3h 10000000uatom + +gaiad add-genesis-account <계정_주소(account_address)> <수량(amount)> <단위(denom)> +``` + +위 명령어는 `app_state` 항목 내 `accounts` 리스트에 아이템을 추가합니다. + +```json +"accounts": [ + { + "address": "cosmos1qs8tnw2t8l6amtzvdemnnsq9dzk0ag0z37gh3h", + "coins": [ + { + "denom": "uatom", + "amount": "10000000" + } + ], + "sequence_number": "0", + "account_number": "0", + "original_vesting": [ + { + "denom": "uatom", + "amount": "26306000000" + } + ], + "delegated_free": null, + "delegated_vesting": null, + "start_time": "0", + "end_time": "10000" + } +] +``` + +각 파라미터 값을 항목별로 설명하겠습니다: + +- `sequence_number`: 이 숫자는 계정이 전송한 트랜잭션 수를 추적하는데 사용됩니다. 트랜잭션이 블록에 포함될 때마다 숫자가 증가하며 리플레이 공격(replay attack)을 방지하기 위해 사용됩니다. 기본 값은 `0` 입니다. +- `account_number`: 계정 고유 식별번호입니다. 해당 계정의 첫 트랜잭션이 블록에 포함될때 생성됩니다. +- `original_vesting`: `gaia`는 베스팅(락업) 기능을 지원합니다. 락업 계정이 소유한 토큰 수량을 지정하고, 토큰 전송이 가능할때까지의 시간을 정할 수 있습니다. 락업된 토큰의 스테이킹은 지원됩니다. 기본 값은 `null`입니다. +- `delegated_free`: 락업이 풀린 후 전송될 수 있는 위임된 수량을 뜻합니다. 대부분 제네시스 상황에서는 `null`이 표준 값입니다. +- `delegated_vesting`: 아직 락업이 진행중인 위임된 수량을 뜻합니다. 대분분 제네시스 상황에서는 `null`이 표준 값입니다. +- `start_time`: 락업이 풀리는 시점의 블록 높이입니다. 대부분 제네시스 상황에서는 `0`이 표준 값입니다. +- `end_time`: 락업 기간이 마감되는 시점의 블록 높이입니다. 락업이 없는 계정의 표준 값은 `0`입니다. + +### 뱅크(Bank) + +`bank` 모듈은 토큰을 관리합니다. 이 항목에서 정의될 파라미터는 제네시스 시작시 전송 가능여부를 정의하는 것입니다. -`GenesisState`에서 제네시스 계정은 다음과 같이 정의됩니다: +```json +"bank": { + "send_enabled": false + } +``` + +### 스테이킹(Staking) + +`staking` 모듈은 스테이트 머신의 지분증명(proof-of-stake) 로직의 대다수를 처리합니다. 이 항목은 다음과 같습니다: + +```json +"staking": { + "pool": { + "not_bonded_tokens": "10000000", + "bonded_tokens": "0" + }, + "params": { + "unbonding_time": "1814400000000000", + "max_validators": 100, + "max_entries": 7, + "bond_denom": "uatom" + }, + "last_total_power": "0", + "last_validator_powers": null, + "validators": null, + "bonds": null, + "unbonding_delegations": null, + "redelegations": null, + "exported": false + } +``` + +각 파라미터 값에 대해 알아보겠습니다: + +- `pool` + + `not_bonded_tokens`: 제네시스 시점에서 위임되지 않은 토큰의 수량을 정의합니다. 대부분의 상황에서 이 값은 스테이킹 토큰의 총 발행량을 뜻합니다 (이 예시에서는 `uatom` 단위로 정의됩니다). + + `bonded_tokens`: 제네시스 시점에서 위임된 토큰의 수량입니다. 대부분 상황에서 이 값은 `0`입니다. +- `params` + + `unbonding_time`: 토큰의 언본딩이 완료될 때까지의 기간을 _나노초(nanosecond)_ 단위로 정의합니다. + + `max_validators`: 최대 검증인 수입니다. + + `max_entries`: 특정 검증인/위임자 쌍에서 동시에 진행될 수 있는 최대 언본딩/재위임 회수. + + `bond_denom`: 스테이킹 토큰 단위. +- `last_total_power`: 보팅 파워 수치. 통상 제네시스 시점에서 `0`입니다 (다만, 과거 블록체인 상태를 기반으로 제네시스가 생성되었을 경우 다를 수 있습니다). +- `last_validator_powers`: 각 검증인의 가장 최근 보팅 파워 수치입니다. 통상 제네시스 시점에서 `null`입니다. (다만, 과거 블록체인 상태를 기반으로 제네시스가 생성되었을 경우 다를 수 있습니다). +- `validators`: 가장 최근 검증인 목록. 통상 제네시스 시점에서 `null`입니다. (다만, 과거 블록체인 상태를 기반으로 제네시스가 생성되었을 경우 다를 수 있습니다). +- `bonds`: 가장 최근 위임 목록입니다. 통상 제네시스 시점에서 `null`입니다. (다만, 과거 블록체인 상태를 기반으로 제네시스가 생성되었을 경우 다를 수 있습니다). +- `unbonding_delegations`: 가장 최근 위임 취소 목록입니다. 통상 제네시스 시점에서 `null`입니다. (다만, 과거 블록체인 상태를 기반으로 제네시스가 생성되었을 경우 다를 수 있습니다). +- `redelegations`: 가장 최근 재위임 목록입니다. 통상 제네시스 시점에서 `null`입니다. (다만, 과거 블록체인 상태를 기반으로 제네시스가 생성되었을 경우 다를 수 있습니다). +- `exported`: 제네시스 파일이 과거 상태를 기반을 내보내어 작성된 여부. + +### 민트(mint) -```go -type GenesisAccount struct { - Address sdk.AccAddress `json:"address"` - Coins sdk.Coins `json:"coins"` - Sequence uint64 `json:"sequence_number"` - AccountNumber uint64 `json:"account_number"` +`mint` 모듈은 토큰 발행량의 인플레이션 관련 로직을 처리합니다. 제네시스 파일의 `mint` 항목은 다음과 같습니다: - // vesting account fields - OriginalVesting sdk.Coins `json:"original_vesting"` // total vesting coins upon initialization - DelegatedFree sdk.Coins `json:"delegated_free"` // delegated vested coins at time of delegation - DelegatedVesting sdk.Coins `json:"delegated_vesting"` // delegated vesting coins at time of delegation - StartTime int64 `json:"start_time"` // vesting start time (UNIX Epoch time) - EndTime int64 `json:"end_time"` // vesting end time (UNIX Epoch time) -} +```json +"mint": { + "minter": { + "inflation": "0.070000000000000000", + "annual_provisions": "0.000000000000000000" + }, + "params": { + "mint_denom": "uatom", + "inflation_rate_change": "0.130000000000000000", + "inflation_max": "0.200000000000000000", + "inflation_min": "0.070000000000000000", + "goal_bonded": "0.670000000000000000", + "blocks_per_year": "6311520" + } + } ``` -각 계정은 시퀀스 수(sequence number (nonce))와 주소 외에도 유효한 고유 계정 번호를 보유해야 합니다. +각 파라미터 값에 대해 알아보겠습니다: + +- `minter` + + `inflation`: 토큰 총 발행량의 기본 연간 인플레이션 % (주 단위 복리 기준). `0.070000000000000000` 값은 주 단위 복리 기준으로 연간 `7%` 인플레이션을 뜻합니다. + + `annual_provisions`: 매 블록마다 계산됨. 기본 값은 `0.000000000000000000`으로 시작합니다. +- `params` + + `mint_denom`: 인플레이션 대상 스테이킹 토큰의 단위. + + `inflation_rate_change`: 연간 인플레이션 변화율. + + `inflation_max`: 인플레이션 최대 수치. + + `inflation_min`: 인플레이션 최소 수치. + + `goal_bonded`: 총 발행량 중 위임 목표 % 수치. 만약 현재 위임 비율이 해당 이 값보다 낮은 경우, 인플레이션은 `inflation_rate_change` 값을 따라 `inflation_max`까지 증가합니다. 반대로 현재 위임 비율이 이 수치보다 높을 경우 `inflation_rate_change` 값을 따라 `inflation_min`까지 감소합니다. + + `blocks_per_year`: 연간 생성되는 블록 예상 수치. 스테이킹 토큰 인플레이션으로 발생하는 토큰을 각 블록당 지급(블록 프로비젼, block provisions)하는데 계산하는 용도로 사용됩니다. + +### 분배(distribution) + +`distribution` 모듈은 블록당 위임 보상(block provision)을 검증인과 위임자에게 분배하는 로직을 처리합니다. 제네시스 파일의 `distribution` 항목은 다음과 같습니다: + +```json + "distribution": { + "fee_pool": { + "community_pool": null + }, + "community_tax": "0.020000000000000000", + "base_proposer_reward": "0.010000000000000000", + "bonus_proposer_reward": "0.040000000000000000", + "withdraw_addr_enabled": false, + "delegator_withdraw_infos": null, + "previous_proposer": "", + "outstanding_rewards": null, + "validator_accumulated_commissions": null, + "validator_historical_rewards": null, + "validator_current_rewards": null, + "delegator_starting_infos": null, + "validator_slash_events": null + } +``` + +각 파라미터 값에 대해 알아보겠습니다: + +- `fee_pool` + + `community_pool`: 커뮤니티 풀은 임무 수행(개발, 커뮤니티 빌딩, 등)의 보상으로 제공될 수 있는 토큰 자금입니다. 토큰 풀의 사용은 거버넌스 프로포절을 통해 결정됩니다. 통상 제네시스 시점에서 `null`입니다. +- `community_tax`: 블록 보상과 수수료 중 커뮤니티 풀로 예치될 '세금' %. +- `base_proposer_reward`: 유효한 블록의 트랜잭션 수수료 중 블록 프로포저에게 지급될 리워드. 값이 `0.010000000000000000`인 경우, 수수료의 1%가 블록 프로포저에게 지급됩니다. +- `bonus_proposer_reward`: 유효한 블록의 트랜잭션 수수료 중 블록 프로포저에게 지급될 리워드의 _최대 한도_. 보너스 수량은 블록 프로포저가 포함한 `precommit` 수량에 비례합니다. 만약 프로포저가 보팅 파워 기준으로`precommit`의 2/3을 포함한 경우 (2/3는 유효한 블록을 생성하기 위한 최소 한도입니다), `base_proposer_reward` 만큼의 보너스를 지급 받습니다. 보너스는 블록 프로포저가 `precommit`의 100%를 포함하는 경우 최대 `bonus_proposer_reward`까지 선의적(linearly)으로 증가합니다. +- `withdraw_addr_enabled`: 파라미터 값이 `true`인 경우, 위임자는 위임 보상을 받을 별도의 주소를 지정할 수 있습니다. 제네시스에서 토큰 전송 기능을 비활성화하기 원하시는 경우, 토큰 전송 잠금 기능을 우회할 수 있으니 `false`로 설정하세요. +- `delegator_withdraw_infos`: 위임자들의 보상 출금 주소 목록입니다. 과거 상태에서 제네시스가 생성되지 않은 경우 `null` 값이 기본 값입니다. +- `previous_proposer`: 지난 블록의 프로포저입니다. 과거 상태에서 제네시스가 생성되지 않은 경우 `""` 값으로 입력하세요 +- `outstanding_rewards`: 보상 출금이 진행되지 않은 리워드입니다. 과거 상태에서 제네시스가 생성되지 않은 경우 `null` 값이 기본 설정입니다. +- `validator_accumulated_commission`: 검증인 커미션 중 출금되지 않은 커미션입니다. 과거 상태에서 제네시스가 생성되지 않은 경우 `null` 값이 기본 설정입니다. +- `validator_historical_rewards`: `distribution` 모듈 연산 용도로 사용되는 검증인 과거 리워드 정보입니다. 과거 상태에서 제네시스가 생성되지 않은 경우 `null` 값이 기본 설정입니다. +- `validators_current_rewards`: `distribution` 모듈 연산 용도로 사용되는 검증인 현재 리워드 정보입니다. 과거 상태에서 제네시스가 생성되지 않은 경우 `null` 값이 기본 설정입니다. +- `delegator_starting_infos`: 검증인 검증 기간, 위임자 스테이킹 토큰 수량, creation height (슬래싱이 발생한 경우 확인용) 정보입니다. `distribution` 모듈 연산 용도로 사용되는 검증인 과거 리워드 정보입니다. 과거 상태에서 제네시스가 생성되지 않은 경우 `null` 값이 기본 설정입니다. +- `validator_slash_events`: 과거 검증인의 슬래싱 정보입니다. `distribution` 모듈 연산 용도로 사용되는 검증인 과거 리워드 정보입니다. 과거 상태에서 제네시스가 생성되지 않은 경우 `null` 값이 기본 설정입니다. + +### 거버넌스(governance) -만약 계정이 베스팅 계정인 경우, 필수 베스팅 정보가 제공되어야 합니다. 베스팅 계정은 최소 `OriginalVestin` 값과 `EndTime` 값이 정의되어야 합니다. 먄약 `StartTime`이 함께 정의된 경우, 계정은 "연속되는(continuous)" 베스팅 계정으로 처리되며, 지정된 스케줄 안에서 꾸준히 토큰을 언락합니다. 여기에서 `StartTime`의 값은 `EndTime`의 값 보다 작아야 하지만, `StartTime`의 값은 미래 값으로 지정할 수는 있습니다 (제네시스 시간과 동일하지 않아도 괜찮습니다). 새로운 스테이트(엑스포트 되지 않은 스테이트)에서 시작하는 체인의 경우, `OriginalVestin`의 값은 `Coins`의 값과 동일하거나 적어야 합니다. +`gov` 모듈은 모든 거버넌스 관련 트랜잭션을 처리합니다. 제네시스 파일의 기본 `gov` 항목은 다음과 같습니다: + +```json +"gov": { + "starting_proposal_id": "1", + "deposits": null, + "votes": null, + "proposals": null, + "deposit_params": { + "min_deposit": [ + { + "denom": "uatom", + "amount": "512000000" + } + ], + "max_deposit_period": "1209600000000000" + }, + "voting_params": { + "voting_period": "1209600000000000" + }, + "tally_params": { + "quorum": "0.4", + "threshold": "0.5", + "veto": "0.334", + "governance_penalty": "0.0" + } + } +``` + +각 파라미터 값에 대해 알아보겠습니다: + +- `starting_proposal_id`: 이 파라미터는 첫 프로포절의 ID를 정의합니다. 각 프로포절은 고유한 ID를 보유합니다. +- `deposits`: 각 프로포절 ID에 대한 보증금 목록입니다. 과거 상태에서 제네시스가 생성되지 않은 경우 `null` 값이 기본 설정입니다. +- `votes`: 각 프로포절 ID에 대한 투표 목록입니다. 과거 상태에서 제네시스가 생성되지 않은 경우 `null` 값이 기본 설정입니다. +- `votes`: 각 프로포절 ID에 대한 투표 목록입니다. 과거 상태에서 제네시스가 생성되지 않은 경우 `null` 값이 기본 설정입니다. +- `proposals`: 각 프로포절 ID에 대한 프로포절 목록입니다. +- `deposit_params` + + `min_deposit`: 프로포절의 `voting period` 단계를 시작하기 위해 필요한 최소 보증금 수량입니다. 만약 다수 단위를 적용할 경우 `OR` 연산자를 사용하세요. + + `max_deposit_period`: 프로포절 보증금 추가가 가능한 기간 (**나노초(nanosecond)** 단위로 입력). 이 기간이 지난 이후에는 프로포절 보증금 추가가 불가능합니다. +- `voting_params` + + `voting_period`: 프로포절의 투표 기간(**나노초(nanosecond)** 단위로 입력). +- `tally_params` + + `quorum`: 프로포절 투표 결과가 유효하기 위한 위임된 스테이킹 토큰의 투표율. + + `threshold`: 프로포절 투표가 통과하기 위해 필요한 최소 `YES` 투표 %. + + `veto`: 프로포절 투표 결과가 유효하기 위한 `NO_WITH_VETO` 투표 %의 최대 한도. + + `governance_penalty`: 프로포절 투표에 참여하지 않은 검증인들에 부과하는 페널티. + +### 슬래싱(slashing) + +`slashing` 모듈은 검증인의 악의적인 행동으로 발생하는 위임자 슬래싱 페널티 로직을 처리합니다. + +```json +"slashing": { + "params": { + "max_evidence_age": "1814400000000000", + "signed_blocks_window": "10000", + "min_signed_per_window": "0.050000000000000000", + "downtime_jail_duration": "600000000000", + "slash_fraction_double_sign": "0.050000000000000000", + "slash_fraction_downtime": "0.000100000000000000" + }, + "signing_infos": {}, + "missed_blocks": {} + } +``` + +각 파라미터 값에 대해 알아보겠습니다: + +- `params` + + `max_evidence_age`: 증거 최대 유효기간 (**나노초(nanosecond)** 단위) + + `signed_blocks_window`: 오프라인 검증인 판단을 위해 검토되는 최근 블록 개수. + + `min_signed_per_window`: 검증인이 온라인으로 간주되기 위해`singed_blocks_window` 내에 포함되어야하는 최소 `precommit` %. + + `downtime_jail_duration`: 다운 타임 슬래싱으로 발생하는 제일(jail) 기간(**나노초(nanosecond)** 단위. + + `slash_fraction_double_sign`: 검증인이 더블 사이닝을 할 경우 슬래싱되는 위임자 위임량의 % 단위. + + `slash_fraction_downtime`: 검증인이 오프라인인 경우 슬래싱되는 위임자 워임량의 % 단위. +- `signing_infos`: `slashing` 모듈이 사용하는 각 검증인의 정보. 과거 상태에서 제네시스가 생성되지 않은 경우 `{}` 값이 기본 설정입니다. +- `missed_blocks`: `slashing` 모듈이 사용하는 missed blocks 정보. 과거 상태에서 제네시스가 생성되지 않은 경우 `{}` 값이 기본 설정입니다. + +### 제네시스 트랜잭션(genesis transactions) + +기본적인 상태에서 제네시스 파일은 `gentx`를 포함하지 않습니다. `gentx`는 제네시스 파일 내 `accounts` 항목에 있는 스테이킹 토큰을 검증인에게 위임하는 트랜잭션입니다. 실질적으로 제네시스에서 검증인을 생성하는데 사용됩니다. 유효한 `gentx`를 보유한 검증인(보팅 파워 기준)의 2/3가 `genesis_time` 이후 온라인되면 블록체인이 시작됩니다. + +`gentx`는 수동으로 제네시스 파일에 추가되거나 다음 명령어를 사용해 추가할 수 있습니다: + +```bash +gaiad collect-gentxs +``` - \ No newline at end of file +위 명령어는 `~/.gaiad/config/gentx`에 있는 모든 `gentxs`를 제네시스 파일에 추가합니다. 제네시스 트랜잭션을 생성하기 위해서는 [여기](./validators/validator-setup.md#participate-in-genesis-as-a-validator)를 확인하세요. \ No newline at end of file diff --git a/docs/translations/kr/hd-wallets.md b/docs/translations/kr/hd-wallets.md new file mode 100644 index 0000000000..23f2926248 --- /dev/null +++ b/docs/translations/kr/hd-wallets.md @@ -0,0 +1,58 @@ +# HD 지갑 + +코스모스의 계정은 HD 월렛(Hierarchical Deterministic Wallet) 표준을 사용합니다. HD 월렛은 비트코인의 [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)로 부터 정의되며, 유저가 하나의 시드로부터 다수의 계정을 생성할 수 있게 하는 시스템입니다. 더 자세하게 알아보기 위해서 관련 명칭을 설명하겠습니다: + +- **지갑(Wallet)**: 특정 시드로부터 생성된 계정. +- **계정(Account)**: 퍼블릭 키/프라이빗 키 쌍. +- **프라이빗 키(Private Key)**: 프라이빗 키는 메시지를 서명할때 사용되는 비밀 정보입니다. 블록체인 업계에서 프라이빗 키는 계정의 소유자를 식별하는데 사용됩니다. 유저의 프라이빗 키는 절대 다른 이에게 알려지면 안됩니다. +- **퍼블릭 키(Public Key)**: 퍼블릭 키는 프라이빗 키로부터 일방적 수학 함수를 적용해 얻게되는 정보입니다. 퍼블릭 키를 기반으로 주소가 만들어지게 되며, 퍼블릭 키를 기반으로 프라이빗 키를 찾는 것은 불가능 합니다. +- **주소(Address)**: 주소는 쉽게 읽을 수 있는 prefix가 적용된 공개 string이며, 계정을 식별하는데 사용됩니다. 퍼블릭 키를 기반으로 수학적 함수를 적용해 생성됩니다. +- **디지털 서명(Digital Signature)**: 디지털 서명은 소유자의 프라이빗 키를 노출하지 않고 메시지를 서명한 프라이빗 키의 소유자를 검증하는 암호학적 정보입니다. +- **시드(Seed)**: 네모닉(mnemonic)과 동일합니다. +- **네모닉(Mnemonic)**: 네모닉은 프라이빗 키를 생성하는 단어 시리즈입니다. 모든 지갑은 관련 네모닉에서 생성됩니다. 네모닉은 절대 분실하면 안됩니다. 종이에 직접 적으시고 안전한 장소에 보관하세요. 분실 후 네모닉을 북구하는 방법은 없으며, 네모닉이 타인에게 노출될 경우, 해당 네모닉과 관련된 모든 계정의 소유권을 가지게 됩니다. + +모든 HD 지갑은 특정 시드에서 생성됩니다. 이 시드로 부터 유저는 결정론적으로 계쩡을 생성할 수 있습니다. 시드로 부터 계정을 생성하기 위해서는 일방형 수학적 변환을 사용합니다. 어떤 계정을 생성할지 결정하기 위해서 유저는 특정 `path`를 정의합니다. 대다수의 `path`는 `integer` (`0`, `1`, `2`, ...) 값입니다. + +예를 들어, `path` 값이 `0`으로 지정된 경우, 지갑은 시드로부터 `Private Key 0`을 생성합니다. 이후 `Private Key 0`으로부터 `Public Key 0`을 생성하며, 마지막으로 `Public Key 0`으로 부터`Address 0`가 생성됩니다. 이 모든 과정을 일방적으로만 진행될 수 있습니다. 즉, `Address`로 부터 `Public Key`를 찾을 수 없고, `Public Key`로 부터 `Private Key` 값을 찾을 수 없스비낟. + + +``` + Account 0 Account 1 Account 2 + ++------------------+ +------------------+ +------------------+ +| | | | | | +| Address 0 | | Address 1 | | Address 2 | +| ^ | | ^ | | ^ | +| | | | | | | | | +| | | | | | | | | +| | | | | | | | | +| + | | + | | + | +| Public key 0 | | Public key 1 | | Public key 2 | +| ^ | | ^ | | ^ | +| | | | | | | | | +| | | | | | | | | +| | | | | | | | | +| + | | + | | + | +| Private key 0 | | Private key 1 | | Private key 2 | +| ^ | | ^ | | ^ | ++------------------+ +------------------+ +------------------+ + | | | + | | | + | | | + +--------------------------------------------------------------------+ + | + | + +---------+---------+ + | | + | Mnemonic (Seed) | + | | + +-------------------+ +``` + +시드로부터 계정을 생성하는 과정은 결정론적(deterministic)입니다. 즉, 동일한 시드로 부터 동일한 `path`를 입력한 경우, 생성되는 `private key`는 언제나 동일합니다. + +계정에 보관되어있는 자산은 프라이빗 키를 사용해 관리됩니다. 프라이빗 키는 네모닉으로 부터 일방적 함수를 적용해 생성됩니다. 만약 프라이빗 키를 분실하신 경우, 네모닉을 사용해 프라이빗 키를 다시 찾을 수 있으나, 네모닉을 분실하신 경우 연관된 모든 프라이빗 키에 대한 소유권을 잃으실 수 있습니다. 또한 유저의 네모닉이 타인에게 노출이된 경우, 네모닉과 연관된 모든 계정의 소유권을 가지게 됩니다. + +::: danger +**24 단어로 구성된 네모닉을 누구와도 공유하지 마세요. 자산의 도난과 분실을 예방하기 위해서 다수의 네모닉 키를 안전한 곳에 보관하는 것이 좋습니다. 만약 타인이 당신의 네모닉을 소유하게 되면, 연관된 모든 계정의 소유권을 함께 가지게 됩니다.** +::: diff --git a/docs/translations/kr/installation.md b/docs/translations/kr/installation.md index b28a96fde6..4896589b00 100755 --- a/docs/translations/kr/installation.md +++ b/docs/translations/kr/installation.md @@ -10,33 +10,82 @@ mkdir -p $HOME/go/bin echo "export GOPATH=$HOME/go" >> ~/.bash_profile echo "export PATH=\$PATH:\$GOPATH/bin" >> ~/.bash_profile -echo "export GO111MODULE=on" >> ~/.bash_profile source ~/.bash_profile ``` ::: tip -코스모스 SDK를 운영하기 위해서는 **Go 1.11.ㅎ+** 이상 버전이 필요합니다. +코스모스 SDK를 운영하기 위해서는 **Go 1.12+** 이상 버전이 필요합니다. ::: ### 바이너리 설치하기 -다음은 최신 Gaia 버전을 설치하는 것입니다. 예시에서는 최신 스테이블 릴리즈가 포함되어있는 `master` 브랜치를 이용해 진행됩니다. 필요에 따라 `git checkout`을 통해 [최신 릴리즈](https://github.com/cosmos/cosmos-sdk/releases)가 설치되어있는지 확인하세요. +다음은 최신 Gaia 버전을 설치하는 것입니다. 필요에 따라 `git checkout`을 통해 올바른 [릴리즈 버전](https://github.com/cosmos/gaia/releases)이 설치되어있는지 확인하세요. ```bash git clone -b https://github.com/cosmos/gaia cd gaia && make install ``` +만약 다음과 같은 에러 메시지로 명령어가 실패하는 경우, 이미 `LDFLAGS`를 설정하셨을 수 있습니다. + +``` +# github.com/cosmos/gaia/cmd/gaiad +flag provided but not defined: -L +usage: link [options] main.o +... +make: *** [install] Error 2 +``` + +해당 환경변수를 언세팅 하신 후 다시 시도해보세요. + +``` +LDFLAGS="" make install +``` + > *참고*: 여기에서 문제가 발생한다면, Go의 최신 스테이블 버전이 설치되어있는지 확인하십시오. 위 절차를 따라하시면 `gaiad`와 `gaiacli` 바이너리가 설치될 것입니다. 설치가 잘 되어있는지 확인하십시오: ```bash -$ gaiad version -$ gaiacli version +$ gaiad version --long +$ gaiacli version --long ``` +`gaiacli` 명령어는 다음과 비슷한 아웃풋을 내보냅니다: + +```shell +name: gaia +server_name: gaiad +client_name: gaiacli +version: 1.0.0 +commit: 89e6316a27343304d332aadfe2869847bf52331c +build_tags: netgo,ledger +go: go version go1.12.5 darwin/amd64 +``` + +### 빌드 태그 + +빌드 태그는 해당 바이너리에서 활성화된 특별 기능을 표기합니다. + +| 빌드 태그 | 설명 | +| --------- | ----------------------------------------------- | +| netgo | Name resolution이 오직 Go 코드만을 사용합니다 | +| ledger | 렛저 기기(하드웨어 지갑)이 지원됩니다 | + +### snap을 사용해 바이너리 설치하기 (리눅스에만 해당) + +**재현가능한 바이너리 시스템이 완벽하게 구현되기 전까지 snap 바이너리를 실제 노드 운용에 사용하지 않으시는 것을 추천드립니다.** + +## 개발자 워크플로우 + +코스모스 SDK 또는 텐더민트의 변경 사항을 테스팅하기 위해서는 `replace` 항목이 `go.mod`에 추가하여 올바른 import path를 제공해야합니다. + +- 변경 사항 적용 +- `go.mod`에 `replace github.com/cosmos/cosmos-sdk => /path/to/clone/cosmos-sdk` 추가 +- `make clean install` 또는 `make clean build` 실행 +- 변경 사항 테스트 + ### 다음 절차 -축하합니다! 이제 [퍼블릭 테스트넷](./join-testnet.md)에 참가하시거나 or [프라이빗 테스트넷](./deploy-testnet.md)을 운영하실 수 있습니다. +축하합니다! 이제 [메인넷](./join-mainnet.md)에 참가하거나[퍼블릭 테스트넷](./join-testnet.md)에 참가하시거나 [자체 테스트넷](./deploy-testnet.md)을 운영하실 수 있습니다. diff --git a/docs/translations/kr/join-mainnet.md b/docs/translations/kr/join-mainnet.md new file mode 100644 index 0000000000..9619775c6e --- /dev/null +++ b/docs/translations/kr/join-mainnet.md @@ -0,0 +1,176 @@ +# 최신 퍼블릭 테스트넷에 참가하기 + +::: tip 최신 테스트넷 +최신 테스트넷에 대한 정보는 다음의 [테스트넷 리포](https://github.com/cosmos/testnets)를 참고하세요. 어떤 코스모스 SDK 버전과 제네시스 파일에 대한 정보가 포합되어있습니다. +::: + +::: warning +**여기에서 더 진행하시기 전에 [gaia](./installation.md)가 꼭 설치되어있어야 합니다.** +::: + +## 새로운 노드 세팅하기 + + +다음 절차는 새로운 풀노드를 처음부터 세팅하는 절차입니다. + +우선 노드를 실행하고 필요한 config 파일을 생성합니다: + + +```bash +gaiad init +``` + +::: warning 참고 +`--moniker`는 ASCII 캐릭터만을 지원합니다. Unicode 캐릭터를 이용하는 경우 노드 접근이 불가능할 수 있으니 참고하세요. +::: + +`moniker`는 `~/.gaiad/config/config.toml` 파일을 통해 추후에 변경이 가능합니다: + +```toml +# A custom human readable name for this node +moniker = "" +``` + +최소 가스 가격보다 낮은 트랜잭션을 거절하는 스팸 방지 메커니즘을 활성화 하시려면 `~/.gaiad/config/gaiad.toml` 파일을 변경하시면 됩니다: + +``` +# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +##### main base config options ##### + +# The minimum gas prices a validator is willing to accept for processing a +# transaction. A transaction's fees must meet the minimum of any denomination +# specified in this config (e.g. 10uatom). + +minimum-gas-prices = "" +``` + +이제 풀노드가 활성화 되었습니다! + +## 제네시스와 시드 + +### 제네시스 파일 복사하기 + +테스트넷의 `genesis.json`파일을 `gaiad`의 config 디렉토리로 가져옵니다. + +```bash +mkdir -p $HOME/.gaiad/config +curl https://raw.githubusercontent.com/cosmos/launch/master/genesis.json > $HOME/.gaiad/config/genesis.json +``` + +위 예시에서는 최신 테스트넷에 대한 정보가 포함되어있는 [launch repo](https://github.com/cosmos/launch)의 `latest` 디렉토리를 이용하는 것을 참고하세요. + +::: tip +만약 다른 퍼블릭 테스트넷에 연결하신다면 [여기](./join-testnet.md)에 있는 정보를 확인하세요. +::: + +설정이 올바르게 작동하는지 확인하기 위해서는 다음을 실행하세요: + +```bash +gaiad start +``` +### 시드 노드 추가하기 + +이제 노드가 다른 피어들을 찾는 방법을 알아야합니다. `$HOME/.gaiad/config/config.toml`에 안정적인 시드 노드들을 추가할 차례입니다. [`launch`](https://github.com/cosmos/launch) repo에 몇 개 시드 노드 링크가 포함되어있습니다. + +만약 해당 시드가 작동하지 않는다면, 추가적인 시드와 피어들을 코스모스 허브 익스플로러에서 확인하세요(목록은 [launch](https://cosmos.network/launch) 페이지에 있습니다.) + +이 외에도 [밸리데이터 라이엇 채팅방](https://riot.im/app/#/room/#cosmos-validators:matrix.org)을 통해서 피어 요청을 할 수 있습니다. + +시드와 피어에 대한 더 많은 정보를 원하시면 [여기](https://github.com/tendermint/tendermint/blob/develop/docs/tendermint-core/using-tendermint.md#peers)를 확인하세요. + +### 가스와 수수료에 대해서 + +::: warning +코스모스 메인넷에서는 `uatom` 단위가 표준 단위로 사용됩니다. `1atom = 1,000,000uatom`으로 환산됩니다. +::: + +코스모스 허브 네트워크는 트랜잭션 처리를 위해 트랜잭션 수수료를 부과합니다. 해당 수수료는 트랜잭션을 실행하기 위한 가스로 사용됩니다. 공식은 다음과 같습니다: + + +``` +수수료(Fee) = 가스(Gas) * 가스 값(GasPrices) +``` + +위 공식에서 `gas`는 전송하는 트랜잭션에 따라 다릅니다. 다른 형태의 트랜잭션은 각자 다른 `gas`량을 필요로 합니다. `gas` 수량은 트랜잭션이 실행될때 계산됨으로 사전에 정확한 값을 확인할 수 있는 방법은 없습니다. 다만, `gas` 플래그의 값을 `auto`로 설정함으로 예상 값을 추출할 수는 있습니다. 예상 값을 수정하기 위해서는 `--gas-adjustment` (기본 값 `1.0`) 플래그 값을 변경하셔서 트랜잭션이 충분한 가스를 확보할 수 있도록 하십시오. + +`gasPrice`는 각 `gas` 유닛의 가격입니다. 각 검증인은 직접 최소 가스 가격인 `min-gas-price`를 설정하며, 트랜잭션의 `gasPrice`가 설정한 `min-gas-price`보다 높을때 트랜잭션을 처리합니다. + +트랜잭션 피(`fees`)는 `gas` 수량과 `gasPrice`를 곱한 값입니다. 유저는 3개의 값 중 2개의 값을 입력하게 됩니다. `gasPrice`가 높을수록 트랜잭션이 블록에 포함될 확률이 높아집니다. + +::: tip +메인넷 권장 `gas-prices`는 `0.025uatom` 입니다. +::: + +## 최소 가스 가격(`minimum-gas-prices`) 설정하기 + +풀노드는 컨펌되지 않은 트랜잭션을 멤풀에 보관합니다. 스팸 트랜잭션으로부터 풀노드를 보호하기 위해서 노드 멤풀에 보관되기 위한 트랜잭션의 최소 가스 가격(`minimum-gas-prices`)을 설정할 것을 권장합니다. 해당 파라미터는 `~/.gaiad/config/gaiad.toml`에서 설정하실 수 있씁니다. + +기본 권장 `minimum-gas-prices`는 `0.025uatom`이지만, 추후 바꾸실 수 있습니다. + +## 풀노드 운영하기 + +다음 커맨드로 풀노드를 시작하세요: + +```bash +gaiad start +``` + +모든 것이 잘 작동하고 있는지 확인하기 위해서는: + +```bash +gaiacli status +``` + +네트워크 상태를 [코스모스 익스플로러](https://cosmos.network/launch)에서 확인하세요. + +## 상태 내보내기(Export State) + +Gaia는 현재 애플리케이션의 상태를 JSON파일 형태로 내보낼 수 있습니다. 이런 데이터는 수동 분석과 새로운 네트워크의 제네시스 파일로 이용될 때 유용할 수 있습니다. + +현재 상태를 내보내기 위해서는: + +```bash +gaiad export > [filename].json +``` + +특정 블록 높이의 상태를 내보낼 수 있습니다(해당 블록 처리 후 상태): + +```bash +gaiad export --height [height] > [filename].json +``` + +만약 해당 상태를 기반으로 새로운 네트워크를 시작하시려 한다면, `--for-zero-height` 플래그를 이용하셔서 내보내기를 실행해주세요: + +```bash +gaiad export --height [height] --for-zero-height > [filename].json +``` + +## 메인넷 검증하기 + +각 폴노드에서 invariant를 실행하여 검증 중 위험한 상황이 발생하는 것을 방지하세요. Invariant를 사용하여 메인넷의 상태(state)가 올바른 상태인 것을 확인합니다. 중요한 invariant 검증 중 하나는 프로토콜 예상 범위 밖에서 새로운 아톰이 생성되거나 사라지는 행위를 미리 감지하고 예빵합니다. 이 외에도 다양한 invariant check가 모듈 내 내장되어있습니다. + +Invariant check는 블록체인 연산력을 상당하게 소모하기 때문에, 기본적으로 비활성화 되어있습니다. Invariant check를 실행한 상태로 노드를 시작하기 원하시는 경우 `assert-invariants-blockly` 플래그를 추가하세요: + +```bash +gaiad start --assert-invariants-blockly +``` + +만약 노드 내 invariant가 문제를 감지하는 경우, 노드는 패닉하여 메인넷을 중지하는 트랜잭션을 전송합니다. 예시 메시지는 다음과 같습니다: + +```bash +invariant broken: + loose token invariance: + pool.NotBondedTokens: 100 + sum of account tokens: 101 + CRITICAL please submit the following transaction: + gaiacli tx crisis invariant-broken staking supply + +``` + +Invariant-broken 트랜잭션을 전송하는 경우 블록체인이 중지되기 떄문에 수수료가 없습니다. + +## 검증인 노드로 업그레이드 하기 + +이제 풀노드 설정을 완료하셨습니다. 원하신다면 풀노드를 코스모스 검증인으로 업그레이드 하실 수 있습니다. 보팅 파워 상위 100위 검증인은 코스모스 허브의 새로운 블록 프로포즈 과정에 참여할 수 있습니다. [검증인 세팅하기](./validators/validator-setup.md)를 확인하세요. diff --git a/docs/translations/kr/ledger.md b/docs/translations/kr/ledger.md index 6bb0d0ff05..ff6fea7d3a 100755 --- a/docs/translations/kr/ledger.md +++ b/docs/translations/kr/ledger.md @@ -1,30 +1,183 @@ # 레저(Ledger) 나노 하드웨어 지갑 지원 -### 레저 시드를 이용한 계정 키 관리 +암호화폐 자산을 하드웨어 지갑을 사용하여 보관하는 것은 보안을 상당히 향상합니다. 렛저 기기는 시드와 프라이빗 키를 보관하는 '영역' 역할을 하며, 트래잭션을 기기 내에서 서명합니다. 민감한 정보는 절대로 렛저 기기 밖으로 노출되지 않습니다. 이 문서는 코스모스 렛저 앱을 Gaia CLI 환경에서 사용하거나 [Lunie.io](https://lunie.io/#/) 웹 지갑에서 사용하는 방법을 설명합니다. -이제 `gaiacli` 가 레저(Ledger) 시드를 통한 계정 키 관리를 지원합니다. 해당 기능을 이용하시기 위해서는 다음이 필요합니다: +모든 렛저 기기의 핵심에는 프라이빗 키를 생성하는데 사용되는 네모닉 시드 단어가 있습니다. 이 시드 단어는 처음 렛저 기기를 활성화할때 생성됩니다(또는 직접 입력됩니다). 이 네모닉 시드는 코스모스와 호환되며 이를 기반으로 코스모스 계정을 생성하실 수 있쓰빈다. -- 이용하실 네트워크와 연결된 `gaiad` 인스턴스. -- 사용하시는 `gaiad` 인스턴스와 연동된 `gaiacli` 인스턴스. -- `ledger-cosmos` 앱이 설치된 레저 나노 기기. - * 레저 기기에 코스모스 앱을 설치하기 위해서는 [`ledger-cosmos`](https://github.com/cosmos/ledger-cosmos/blob/master/docs/BUILD.md) 깃허브 레포지토리를 확인하세요. - * 실전 운용 가능한 앱 버전은 추후 [레저 앱스토어](https://www.ledgerwallet.com/apps)를 통해 배포될 예정입니다. - -> **참고:** 코스모스 키는 [BIP 44 Hierarchical Deterministic wallet 스펙](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)에 파생되었습니다. 관련 패스에 대한 정보는 [hd package](https://github.com/cosmos/cosmos-sdk/blob/develop/crypto/keys/hd/hdpath.go#L30)를 참고하세요. +::: danger +12 단어 시드키를 분실하거나 그 누구와도 공유하지 마세요. 자금 탈취와 손실을 예방하기 위해서는 다수의 시드키 사본을 만드시고 금고 같이 본인만이 알 수 있는 안전한 곳에 보관하는 것을 추천합니다. 누군가 시드키를 가지게 된 경우, 관련 프라이빗 키와 모든 계정의 소유권을 가지게 됩니다. +::: -코스모스 앱을 레저 기기에 성공적으로 설치하시고, `gaiacli` 에서 레저와 연결하는데 성공하셨다면 다음과 같이 레저 키를 생성하실 수 있습니다: +## Gaia CLI + Ledger Nano + +코스모스 허브 네트워크에서 새로운 계정을 생성하고 트랜잭션을 전송하는데 사용되는 도구는 `gaiacli`입니다. 다음은 `gaiacli`를 사용하는데 필요한 정보입니다. 만약 CLI 기반 도구가 익숙하지 않으신 경우, 하단에 있는 Lunie.io 지갑 사용법을 참고하세요. + +### 시작하기 전에 + +- [렛저 기기에 코스모스 앱 설치하기](https://github.com/cosmos/ledger-cosmos/blob/master/README.md#installing) +- [Golang 설치하기](https://golang.org/doc/install) +- [Gaia 설치하기](https://cosmos.network/docs/cosmos-hub/installation.html) + +다음 명령어를 입력하여 Gaiacli가 올바르게 설치된 것을 확인하세요: + +```bash +gaiacli version --long + +➜ cosmos-sdk: 0.34.3 +git commit: 67ab0b1e1d1e5b898c8cbdede35ad5196dba01b2 +vendor hash: 0341b356ad7168074391ca7507f40b050e667722 +build tags: netgo ledger +go version go1.11.5 darwin/amd64 + +``` + +### 렛저 키 추가하기 + +- 렛저 기기를 연결하시고 잠금해제 하세요 +- 렛저 기기에서 코스모스 앱을 실행하세요 +- 렛저키를 사용해 Gaiacli에서 새로운 계정을 생성하세요 + +::: tip +_키 명칭(keyName)_ 파라미터에 의미있는 값을 입력하세요. `ledger` 플래그는 `gaiacli`가 렛저 기기의 시드를 사용해 계정을 생성할 것을 알립니다. +::: + +```bash +gaiacli keys add --ledger + +➜ NAME: TYPE: ADDRESS: PUBKEY: +<키_명칭(keyName)> ledger cosmos1... cosmospub1... +``` + +코스모스는 [HD Wallets](./hd-wallets.md) 표준을 사용합니다. HD Wallet은 하나의 렛저 시드로부터 다수의 계정을 생성할 수 있게 합니다. 같은 렛저 기기에서 추가 계정을 생성하기 위해서는 다음 명령어를 실행하세요: + +```bash +gaiacli keys add <새로운_키_명칭(secondKeyName)> --ledger +``` + +### 주소 확인하기 + +다음 명령어를 실행하여 렛저 기기에서 주소를 확인하세요. 렛저 키 명칭을 `키_명칭` 값에 입력하여 해당 키의 주소를 확인하세요. `-d` 플래그는 렛저 `1.5.0` 버전 이상 기기에서만 지원됩니다. + +```bash +gaiacli keys show -d +``` + +키를 새로 생성했을때 표기된 주소와 기기에서 표기된 주소가 일치하는지 확인하세요. + +### 풀노드에 연결하기 + +이제 gaiacli를 코스모스 풀노드의 주소와 `chain-id`값을 설정해야 합니다. 이 예시에서는 코러스원 검증인이 운영하는 공개 노드를 사용해 `cosmoshub-2`에 연결하는 방법을 알아보겠습니다. 단, `gaiacli`는 다른 풀노드에 연결하실 수 있다는 점을 참고하세요. Gaiacli에서 설정하는 `chain-id`와 풀노드의 `chain-id`은 동일해야합니다. + +```bash +gaiacli config node https://cosmos.chorus.one:26657 +gaiacli config chain_id cosmoshub-2 +``` + +다음과 같은 명령어를 입력하여 연결 상태를 조회하세요: + +``` bash +gaiacli query staking validators +``` + +::: tip +자체 풀노드를 로컬 환경에서 운영하기 위해서는 다음 [글](https://cosmos.network/docs/cosmos-hub/join-mainnet.html#setting-up-a-new-node)을 참고하세요. +::: + +### 트랜잭션 서명하기 + +이제 트랜잭션을 서명하고 전송할 수 있습니다. Gaiacli를 사용해 트랜잭션을 전송하기 위해서는 `tx send` 명령어를 사용하세요. + +``` bash +gaiacli tx send --help # to see all available options. +``` + +::: tip +다음 명령어를 실행하기 전 렛저 기기에 비밀번호를 입력하시고 코스모스 앱을 실행하세요 +::: + +렛저의 `키_명칭(keyName)`을 지정하여 Gaia와 코스모스 렛저 앱을 연결하고 트랜잭션을 서명하세요. ```bash -$ gaiacli keys add {{ .Key.Name }} --ledger -NAME: TYPE: ADDRESS: PUBKEY: -{{ .Key.Name }} ledger cosmos1aw64xxr80lwqqdk8u2xhlrkxqaxamkr3e2g943 cosmospub1addwnpepqvhs678gh9aqrjc2tg2vezw86csnvgzqq530ujkunt5tkuc7lhjkz5mj629 +gaiacli tx send <키_명칭(keyName)> <수신자_주소(destinationAddress)> <수량(amount)><단위(denomination)> ``` -이 키는 레저가 연결되고 잠금 해제된 상태에서면 사용이 가능합니다. 해당 키를 이용해 코인을 전송하시려면 다음 명령을 실행하세요: +만약 `confirm transaction before signing`이 표기되는 경우, `Y`를 입력하여 진행하세요. + +이후, 렛저 기기에서 트랜잭션 내용을 확인하고 승인합니다. 화면에 표기되는 트랜잭션 내용 JSON을 확인하세요. 각 값을 하나씩 확인하실 수 있습니다. 하단 내용을 확인하여 표준 트랜잭션 내용을 확인하세요. + +이제 [네트워크에서 트랜잭션을 전송](./delegator-guide-cli.md#sending-transactions)할 준비가 되었습니다. + +### 자산 받기 + +렛저 기기의 코스모스 계정으로 자산을 받기 위해서는 다음 명령어를 입력하여 주소를 확인하세요 (`TYPE ledger`로 표기되는 주소): + +```bash +gaiacli keys list + +➜ NAME: TYPE: ADDRESS: PUBKEY: +<키_명칭(keyName)> ledger cosmos1... cosmospub1... +``` + +### 추가 참고 문서 + +`gaiacli`를 어떻게 사용해야되실지 모르시겠나요? 명령어 값을 비운 상태로 입력하여 각 명령어의 정보를 확인하실 수 있습니다. + +::: tip +`gaiacli` 명령어는 중첩된 형태로 존재합니다. `$ gaiacli` 명령어는 최상위 명령어만을 표기합니다(status, config, query, tx). 하위 명령어에 대한 정보는 해당 명령어에 help 명령어를 추가하여 확인할 수 있습니다. + +예를 들어 `query` 명령어에 대한 정보를 확인하기 위해서는: + +```bash +gaiacli query --help +``` +또는 `tx`(트랜잭션) 명령어를 확인하기 위해서는: ```bash -$ gaiacli tx send { .Destination.AccAddr } 10000000uatom --from { .Key.Name } --chain-id=gaia-7000 +gaiacli tx --help ``` -레저 기기에서 해당 트랜잭션을 검토하신 후 서명이 되었다면 트랜잭션 결과를 레저 기기에서 확인하실 수 있습니다. +를 입력하세요. + +# Lunie.io + +Lunie 웹 지갑은 렛저 나노 S 기기를 사용해 서명하는 것을 지원합니다. 다음은 (Lunie.io)[https://lunie.io] 지갑을 Ledger 기기로 사용하는 방법을 정리합니다. + +### 기기 연결하기 + +- 렛저 기기를 컴퓨터에 연결하시고, 비밀번호를 입력하여 잠금해제한 후 코스모스 앱을 실행하세요 +- 웹 브라우저에서 [https://lunie.io](https://lunie.io)를 가세요 +- "Sign In"을 클릭하세요 +- "Sign in with Ledger Nano S"를 선택하세요 + +### 주소 확인하기 + +다음 명령어를 실행하여 렛저 기기에서 주소를 확인하세요. 렛저 키 명칭을 `키_명칭` 값에 입력하여 해당 키의 주소를 확인하세요. `-d` 플래그는 렛저 `1.5.0` 버전 이상 기기에서만 지원됩니다. + +```bash +gaiacli keys show -d +``` + +렛저에 표기되는 주소와 Lunie.io에 표기되는 주소가 동일한지 먼저 확인하시고 다음 단계를 진행하세요. 확인이 된 경우, Lunie에서 렛저 키를 사용해 트랜잭션을 서명할 수 있습니다. + +Lunie에 대해 더 알고싶으시면 이 [투토리얼](https://medium.com/easy2stake/how-to-delegate-re-delegate-un-delegate-cosmos-atoms-with-the-lunie-web-wallet-eb72369e52db)을 참고하셔서 아톰 위임과 Lunie 웹 지갑에 대해서 더 알아보세요. + +# 코스모스 표준 트랜잭션 + +코스모스의 트랜잭션은 코스모스 SDK의[표준 트랜잭션 타입(Standard Transaction Type)](https://godoc.org/github.com/cosmos/cosmos-sdk/x/auth#StdTx)를 응용합니다. 렛저 기기는 이 오브젝트의 시리얼화된 JSON을 기기에서 표기하며, 트랜잭션 서명 전 검토하실 수 있습니다. 각 필드에 대한 설명은 다음과 같습니다: + +- `chain-id`: 트랜잭션을 전송할 체인, (예, `gaia-13003` 테스트넷 또는 `cosmoshub-2` 메인넷) +- `account_number`: 계정에 최초로 자금을 입금할때 생성되는 계정의 고유 글로벌 ID +- `sequence`: 계정의 논스 값. 이후 발생하는 트랜잭션 마다 이 값은 증가합니다. +- `fee`: 트랜잭션 수수료, 가스 수량, 그리고 수수료의 단위를 설명하는 JSON 오브젝트 +- `memo`: (선택 값) 트랜잭션 태깅 등의 용도로 사용되는 텍스트 값 +- `msgs_/`: 트랜잭션에 포함된 메시지 어레이. 더블클릭하여 하위 JSON 값을 확인하실 수 있습니다. + +# 지원 + +추가적인 지원이 필요하신 경우, 코스모스 포럼의 [과거 글](https://forum.cosmos.network/search?q=ledger)을 참고하세요. + +[텔레그램 채널](https://t.me/cosmosproject)을 통해 문의하시거나 다음 커뮤니티 가이드를 참고하세요: + +- [Ztake](https://medium.com/@miranugumanova) - [How to Redelegate Cosmos Atoms with the Lunie Web Wallet](https://medium.com/@miranugumanova/how-to-re-delegate-cosmos-atoms-with-lunie-web-wallet-8303752832c5) +- [Cryptium Labs](https://medium.com/cryptium-cosmos) - [How to store your ATOMS on your Ledger and delegate with the command line](https://medium.com/cryptium-cosmos/how-to-store-your-cosmos-atoms-on-your-ledger-and-delegate-with-the-command-line-929eb29705f) diff --git a/docs/translations/kr/upgrade-node.md b/docs/translations/kr/upgrade-node.md new file mode 100644 index 0000000000..e07064fb21 --- /dev/null +++ b/docs/translations/kr/upgrade-node.md @@ -0,0 +1,94 @@ +# 노드 업그레이드 하기 + +이 문서는 `gaiad` 풀노드를 새로운 버전으로 업그레이드하는 절차를 설명합니다. + +## 소프트웨어 업그레이드 + +우선 `gaiad` 인스턴스를 중지하세요. 이후 소프트웨어를 업그레이드하세요: + +```bash +cd $GOPATH/src/github.com/cosmos/gaia +git fetch --all && git checkout +make install +``` + +::: tip +*참고*: 이번 단계에서 문제가 발생하는 경우, 최신 스테이블 버전의 Go가 설치되어있는지 확인하세요. +::: + +최신 퍼블릭 테스트넷에 필요한 버전 정보를 확인하기 위해서는 [테스트넷 리포](https://github.com/cosmos/testnets)를 참고하시고, 각 릴리즈에 대한 자세한 정보는 [Gaia 릴리즈 페이지](https://github.com/cosmos/Gaia/releases)를 참고하세요. + +이제 풀노드가 깔끔하게 업그레이드되었습니다. + +## 제네시스 파일 업그레이드하기 + +::: warning +만약 업그레이드를 진행하는 새로운 버전에 'breaking change'가 포함되어있는 경우, 블록체인을 재시작해야합니다. 만약 'breaking change'가 없는 경우, [리스타트](#restart)로 넘어가셔도 좋습니다. + +제네시스 파일을 업그레이드하기 위해서는 신뢰할 수 있는 소스에서 받으시거나 로컬 환경에서 내보내실 수 있습니다. + +### 신뢰하는 소스에서 받기 + +메인넷을 참가하시는 경우, [mainnet repo](https://github.com/cosmos/launch)에서 제네시스를 받으세요. 만약 퍼블릭 테스트넷을 참가하시는 경우, [testnet repo](https://github.com/cosmos/testnets)에서 올바른 테스트넷 제네시스 파일을 받으세요. 이 외의 경우, 신뢰할 수 있는 소스에서 제네시스 파일을 받으세요. + +새로운 제네시스 파일을 `new_genesis.json`으로 저장하세요. 이후, 오래된 `genesis.json`을 `new_genesis.json`으로 바꾸세요. + +```bash +cd $HOME/.gaiad/config +cp -f genesis.json new_genesis.json +mv new_genesis.json genesis.json +``` + +이제 [reset data](#reset-data) 항목으로 넘어가세요. + +### 로컬 환경에서 새로운 제네시스 내보내기 + +만약 과거 네트워크 버전에서 노드를 운영하셨고 로컬 환경에서 과거 네트워크의 제네시스 파일을 내보내시는 경우, 다음 명령어를 사용하세요: + +```bash +cd $HOME/.gaiad/config +gaiad export --for-zero-height --height=<내보내는_블록_높이(export-height)> > new_genesis.json +``` + +위 명령어는 특정 블록 높이(`<내보내는_블록_높이(export-height)>`)의 상태를 기반으로 새로운 제네시스 파일을 생성합니다. 이 제네시스 파일은 새로운 네트워크를 시작하는데 사용됩니다. + +이제 오래된 `genesis.json`을 `new_genesis.json`으로 바꾸세요: + +```bash +cp -f genesis.json new_genesis.json +mv new_genesis.json genesis.json +``` + +이 상태에서 내보낸 제네시스 파일을 새로운 버전과 호환되는 제네시스 파일로 변환하는 스크립트를 실행하셔야될 수 있습니다. 예를 들어, `Account` 타입의 형태가 바뀐경우, 스크립트는 account store에서 인코딩된 계정을 확인하고, 언마셜하고, 타입을 업데이트한 후 다시 마셜링을 진행한 다음에 복구하는 작업을 진행합니다. 스크립트의 예시는 [여기](https://github.com/cosmos/cosmos-sdk/blob/master/contrib/export/v0.33.x-to-v0.34.0.py).를 참고하세요 + + +## 데이터 리셋하기 + +:::warning +만약 업그레이드하는 <새로운_버전(new_version)>에 'breaking change'가 포함되는 않은 경우, 데이터를 리셋할 필요가 없습니다. 만약 'breaking change'가 포함되지 않은 경우, 바로 [Restart](#restart) 항목으로 넘어가세요. +::: + +::: warning +메인넷에서 **검증인 노드**를 운영하시는 경우, `gaiad unsafe-reset-all` 명령어를 실행하실때 주의를 기울이세요. `chain-id`를 변경하지 않는 이상 이 명령어를 실행할 필요가 없습니다. +::: + +::: danger 중요 +각 노드가 고유한 `priv_validator.json` 파일을 가지고 있는 것을 확인하세요. 절대로 과거 노드에서 `priv_validator.json`을 복사하여 다수의 신규 노드에 붙혀넣지 마세요. 다수의 동일한 `priv_validator.json`을 가진 노드가 존재하는 경우 더블 사이닝으로 슬래싱될 수 있습니다. +::: + +우선 오래된 파일을 삭제하시고 데이터를 리셋하세요. +**만약 검증인 노드를 운영하시는 경우, 이 단계를 진행하기 전 따르는 위험을 충분히 숙지하고 진행하세요**. + +```bash +gaiad unsafe-reset-all +``` + +이제 노드는 `priv_validator.json`과 `config.toml`외의 모들 파일이 리셋되었습니다. 업그레이드된 노드는 기존의 연결되었던 센트리 노드와 풀 노드가 존재하는 경우 연결을 시도할 수 있으나, 함께 업그레이드가 진행되지 않으면 연결이 실패할 수 있습니다. + +## 노드 다시 시작하기 + +노드를 다시 시작하기 위해서는 다음 명령어를 실행하세요: + +```bash +gaiad start +``` diff --git a/docs/translations/kr/validators/security.md b/docs/translations/kr/validators/security.md index 14085db2fa..c677df9061 100755 --- a/docs/translations/kr/validators/security.md +++ b/docs/translations/kr/validators/security.md @@ -27,8 +27,8 @@ 검증인 노드는 해당 노드의 `config.toml`을 수정해야 합니다: ```bash -# Comma separated list of nodes to keep persistent connections to -# Do not add private peers to this list if you don't want them advertised +# 지속적으로 연결할 노드 목록, 다수의 노드는 `,`로 분리 +# 프라이빗 피어는 노출의 위험이 존재하니 이 목록에 추가하지 마세요. persistent_peers =[list of sentry nodes] # Set true to enable the peer-exchange reactor @@ -39,7 +39,7 @@ pex = false ```bash # Comma separated list of peer IDs to keep private (will not be gossiped to other peers) -private_peer_ids = "ipaddress of validator nodes" +private_peer_ids = "프라이빗_피어_노드_ID" ``` ## 환경 변수 From d6dfa141e2ae38a1ff9f53fca8078c0822671b95 Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 19 Nov 2019 18:03:55 +0100 Subject: [PATCH 050/685] Forgot to delete debug cmd in makefile (#198) Remove install-debug target from Makefile. --- Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile b/Makefile index 8135f115bc..a306b37720 100644 --- a/Makefile +++ b/Makefile @@ -91,9 +91,6 @@ install: go.sum go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiad go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiacli -install-debug: go.sum - go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiadebug - ######################################## ### Tools & dependencies From 4307d9a50aafeb45f5a54ec9eff90bbb8923d69e Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Tue, 19 Nov 2019 22:20:03 +0100 Subject: [PATCH 051/685] Rename gaia{d,cli} to wasm{d,cli}, GaiaApp->WasmApp --- Makefile | 18 +++++++-------- app/app.go | 34 ++++++++++++++--------------- app/app_test.go | 10 ++++----- app/export.go | 4 ++-- app/sim_test.go | 26 +++++++++++----------- app/utils.go | 10 ++++----- cmd/{gaiacli => wasmcli}/main.go | 12 +++++----- cmd/{gaiad => wasmd}/genaccounts.go | 0 cmd/{gaiad => wasmd}/main.go | 16 +++++++------- cmd/{gaiad => wasmd}/replay.go | 4 ++-- cmd/{gaiad => wasmd}/testnet.go | 14 ++++++------ go.mod | 2 +- 12 files changed, 75 insertions(+), 75 deletions(-) rename cmd/{gaiacli => wasmcli}/main.go (94%) rename cmd/{gaiad => wasmd}/genaccounts.go (100%) rename cmd/{gaiad => wasmd}/main.go (90%) rename cmd/{gaiad => wasmd}/replay.go (98%) rename cmd/{gaiad => wasmd}/testnet.go (96%) diff --git a/Makefile b/Makefile index a306b37720..6a57a865b3 100644 --- a/Makefile +++ b/Makefile @@ -48,9 +48,9 @@ build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags)) # process linker flags -ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=gaia \ - -X github.com/cosmos/cosmos-sdk/version.ServerName=gaiad \ - -X github.com/cosmos/cosmos-sdk/version.ClientName=gaiacli \ +ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=wasm \ + -X github.com/cosmos/cosmos-sdk/version.ServerName=wasmd \ + -X github.com/cosmos/cosmos-sdk/version.ClientName=wasmcli \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" @@ -70,11 +70,11 @@ all: install lint test build: go.sum ifeq ($(OS),Windows_NT) - go build -mod=readonly $(BUILD_FLAGS) -o build/gaiad.exe ./cmd/gaiad - go build -mod=readonly $(BUILD_FLAGS) -o build/gaiacli.exe ./cmd/gaiacli + go build -mod=readonly $(BUILD_FLAGS) -o build/wasmd.exe ./cmd/wasmd + go build -mod=readonly $(BUILD_FLAGS) -o build/wasmcli.exe ./cmd/wasmcli else - go build -mod=readonly $(BUILD_FLAGS) -o build/gaiad ./cmd/gaiad - go build -mod=readonly $(BUILD_FLAGS) -o build/gaiacli ./cmd/gaiacli + go build -mod=readonly $(BUILD_FLAGS) -o build/wasmd ./cmd/wasmd + go build -mod=readonly $(BUILD_FLAGS) -o build/wasmcli ./cmd/wasmcli endif build-linux: go.sum @@ -88,8 +88,8 @@ else endif install: go.sum - go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiad - go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiacli + go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmd + go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmcli ######################################## ### Tools & dependencies diff --git a/app/app.go b/app/app.go index 57366c2332..6494df7f9e 100644 --- a/app/app.go +++ b/app/app.go @@ -31,14 +31,14 @@ import ( "github.com/cosmos/cosmos-sdk/x/supply" ) -const appName = "GaiaApp" +const appName = "WasmApp" var ( - // DefaultCLIHome default home directories for gaiacli - DefaultCLIHome = os.ExpandEnv("$HOME/.gaiacli") + // DefaultCLIHome default home directories for wasmcli + DefaultCLIHome = os.ExpandEnv("$HOME/.wasmcli") - // DefaultNodeHome default home directories for gaiad - DefaultNodeHome = os.ExpandEnv("$HOME/.gaiad") + // DefaultNodeHome default home directories for wasmd + DefaultNodeHome = os.ExpandEnv("$HOME/.wasmd") // ModuleBasics The module BasicManager is in charge of setting up basic, // non-dependant module elements, such as codec registration @@ -83,8 +83,8 @@ func MakeCodec() *codec.Codec { return cdc.Seal() } -// GaiaApp extended ABCI application -type GaiaApp struct { +// WasmApp extended ABCI application +type WasmApp struct { *bam.BaseApp cdc *codec.Codec @@ -114,11 +114,11 @@ type GaiaApp struct { sm *module.SimulationManager } -// NewGaiaApp returns a reference to an initialized GaiaApp. -func NewGaiaApp( +// NewWasmApp returns a reference to an initialized WasmApp. +func NewWasmApp( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, invCheckPeriod uint, baseAppOptions ...func(*bam.BaseApp), -) *GaiaApp { +) *WasmApp { cdc := MakeCodec() @@ -133,7 +133,7 @@ func NewGaiaApp( ) tKeys := sdk.NewTransientStoreKeys(staking.TStoreKey, params.TStoreKey) - app := &GaiaApp{ + app := &WasmApp{ BaseApp: bApp, cdc: cdc, invCheckPeriod: invCheckPeriod, @@ -264,17 +264,17 @@ func NewGaiaApp( } // application updates every begin block -func (app *GaiaApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { +func (app *WasmApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) } // application updates every end block -func (app *GaiaApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { +func (app *WasmApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { return app.mm.EndBlock(ctx, req) } // application update at chain initialization -func (app *GaiaApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { +func (app *WasmApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { var genesisState simapp.GenesisState app.cdc.MustUnmarshalJSON(req.AppStateBytes, &genesisState) @@ -282,12 +282,12 @@ func (app *GaiaApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci } // load a particular height -func (app *GaiaApp) LoadHeight(height int64) error { +func (app *WasmApp) LoadHeight(height int64) error { return app.LoadVersion(height, app.keys[bam.MainStoreKey]) } // ModuleAccountAddrs returns all the app's module account addresses. -func (app *GaiaApp) ModuleAccountAddrs() map[string]bool { +func (app *WasmApp) ModuleAccountAddrs() map[string]bool { modAccAddrs := make(map[string]bool) for acc := range maccPerms { modAccAddrs[supply.NewModuleAddress(acc).String()] = true @@ -297,7 +297,7 @@ func (app *GaiaApp) ModuleAccountAddrs() map[string]bool { } // Codec returns the application's sealed codec. -func (app *GaiaApp) Codec() *codec.Codec { +func (app *WasmApp) Codec() *codec.Codec { return app.cdc } diff --git a/app/app_test.go b/app/app_test.go index 1052573b3b..84aecfeee0 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -14,14 +14,14 @@ import ( abci "github.com/tendermint/tendermint/abci/types" ) -func TestGaiadExport(t *testing.T) { +func TestWasmddExport(t *testing.T) { db := db.NewMemDB() - gapp := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) + gapp := NewWasmdApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) err := setGenesis(gapp) require.NoError(t, err) // Making a new app object with the db, so that initchain hasn't been called - newGapp := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) + newGapp := NewWasmdApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) _, _, err = newGapp.ExportAppStateAndValidators(false, []string{}) require.NoError(t, err, "ExportAppStateAndValidators should not have an error") } @@ -29,14 +29,14 @@ func TestGaiadExport(t *testing.T) { // ensure that black listed addresses are properly set in bank keeper func TestBlackListedAddrs(t *testing.T) { db := db.NewMemDB() - gapp := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) + gapp := NewWasmdApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) for acc := range maccPerms { require.True(t, gapp.bankKeeper.BlacklistedAddr(gapp.supplyKeeper.GetModuleAddress(acc))) } } -func setGenesis(gapp *GaiaApp) error { +func setGenesis(gapp *WasmApp) error { genesisState := simapp.NewDefaultGenesisState() stateBytes, err := codec.MarshalJSONIndent(gapp.cdc, genesisState) if err != nil { diff --git a/app/export.go b/app/export.go index 90e0f24c75..40b21603a7 100644 --- a/app/export.go +++ b/app/export.go @@ -14,7 +14,7 @@ import ( ) // ExportAppStateAndValidators export the state of gaia for a genesis file -func (app *GaiaApp) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList []string, +func (app *WasmApp) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList []string, ) (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error) { // as if they could withdraw from the start of the next block ctx := app.NewContext(true, abci.Header{Height: app.LastBlockHeight()}) @@ -35,7 +35,7 @@ func (app *GaiaApp) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteLis // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated // in favour of export at a block height -func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string) { +func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string) { applyWhiteList := false //Check if there is a whitelist diff --git a/app/sim_test.go b/app/sim_test.go index 0ade11ea04..a180cfeebe 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -38,7 +38,7 @@ func init() { simapp.GetSimulatorFlags() } -func testAndRunTxs(app *GaiaApp, config simulation.Config) []simulation.WeightedOperation { +func testAndRunTxs(app *WasmApp, config simulation.Config) []simulation.WeightedOperation { ap := make(simulation.AppParams) paramChanges := app.sm.GenerateParamChanges(config.Seed) @@ -246,7 +246,7 @@ func interBlockCacheOpt() func(*baseapp.BaseApp) { } // Profile with: -// /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/GaiaApp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out +// /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/WasmApp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out func BenchmarkFullAppSimulation(b *testing.B) { logger := log.NewNopLogger() config := simapp.NewConfigFromFlags() @@ -267,7 +267,7 @@ func BenchmarkFullAppSimulation(b *testing.B) { _ = os.RemoveAll(dir) }() - gapp := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) + gapp := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) // Run randomized simulation // TODO: parameterize numbers, save for a later PR @@ -328,8 +328,8 @@ func TestFullAppSimulation(t *testing.T) { _ = os.RemoveAll(dir) }() - gapp := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) - require.Equal(t, "GaiaApp", gapp.Name()) + gapp := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) + require.Equal(t, "WasmApp", gapp.Name()) // Run randomized simulation _, simParams, simErr := simulation.SimulateFromSeed( @@ -384,7 +384,7 @@ func TestAppImportExport(t *testing.T) { _ = os.RemoveAll(dir) }() - app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) + app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) require.Equal(t, "SimApp", app.Name()) // Run randomized simulation @@ -430,7 +430,7 @@ func TestAppImportExport(t *testing.T) { _ = os.RemoveAll(newDir) }() - newApp := NewGaiaApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) + newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) require.Equal(t, "SimApp", newApp.Name()) var genesisState simapp.GenesisState @@ -504,8 +504,8 @@ func TestAppSimulationAfterImport(t *testing.T) { _ = os.RemoveAll(dir) }() - gapp := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) - require.Equal(t, "GaiaApp", gapp.Name()) + gapp := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) + require.Equal(t, "WasmApp", gapp.Name()) // Run randomized simulation // Run randomized simulation @@ -560,8 +560,8 @@ func TestAppSimulationAfterImport(t *testing.T) { _ = os.RemoveAll(newDir) }() - newApp := NewGaiaApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt) - require.Equal(t, "GaiaApp", newApp.Name()) + newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt) + require.Equal(t, "WasmApp", newApp.Name()) newApp.InitChain(abci.RequestInitChain{ AppStateBytes: appState, @@ -599,7 +599,7 @@ func TestAppStateDeterminism(t *testing.T) { for j := 0; j < numTimesToRunPerSeed; j++ { logger := log.NewNopLogger() db := dbm.NewMemDB() - app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) + app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) fmt.Printf( "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", @@ -647,7 +647,7 @@ func BenchmarkInvariants(b *testing.B) { os.RemoveAll(dir) }() - gapp := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) + gapp := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) // 2. Run parameterized simulation (w/o invariants) _, simParams, simErr := simulation.SimulateFromSeed( diff --git a/app/utils.go b/app/utils.go index 6f9350e1b7..dc55116537 100644 --- a/app/utils.go +++ b/app/utils.go @@ -16,7 +16,7 @@ import ( ) // ExportStateToJSON util function to export the app state to JSON -func ExportStateToJSON(app *GaiaApp, path string) error { +func ExportStateToJSON(app *WasmApp, path string) error { fmt.Println("exporting app state...") appState, _, err := app.ExportAppStateAndValidators(false, nil) if err != nil { @@ -26,13 +26,13 @@ func ExportStateToJSON(app *GaiaApp, path string) error { return ioutil.WriteFile(path, []byte(appState), 0644) } -// NewGaiaAppUNSAFE is used for debugging purposes only. +// NewWasmAppUNSAFE is used for debugging purposes only. // // NOTE: to not use this function with non-test code -func NewGaiaAppUNSAFE(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, +func NewWasmAppUNSAFE(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, invCheckPeriod uint, baseAppOptions ...func(*baseapp.BaseApp), -) (gapp *GaiaApp, keyMain, keyStaking *sdk.KVStoreKey, stakingKeeper staking.Keeper) { +) (gapp *WasmApp, keyMain, keyStaking *sdk.KVStoreKey, stakingKeeper staking.Keeper) { - gapp = NewGaiaApp(logger, db, traceStore, loadLatest, invCheckPeriod, baseAppOptions...) + gapp = NewWasmApp(logger, db, traceStore, loadLatest, invCheckPeriod, baseAppOptions...) return gapp, gapp.keys[bam.MainStoreKey], gapp.keys[staking.StoreKey], gapp.stakingKeeper } diff --git a/cmd/gaiacli/main.go b/cmd/wasmcli/main.go similarity index 94% rename from cmd/gaiacli/main.go rename to cmd/wasmcli/main.go index 4f418237c1..fd3b9ce378 100644 --- a/cmd/gaiacli/main.go +++ b/cmd/wasmcli/main.go @@ -23,7 +23,7 @@ import ( "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/libs/cli" - "github.com/cosmos/gaia/app" + "github.com/cosmwasm/wasmd/app" ) func main() { @@ -38,7 +38,7 @@ func main() { config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub) config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub) config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub) - config.SetKeyringServiceName("gaia") + config.SetKeyringServiceName("wasmd") config.Seal() // TODO: setup keybase, viper object, etc. to be passed into @@ -46,8 +46,8 @@ func main() { // with the cdc rootCmd := &cobra.Command{ - Use: "gaiacli", - Short: "Command line interface for interacting with gaiad", + Use: "wasmcli", + Short: "Command line interface for interacting with wasmd", } // Add --chain-id to persistent flags and mark it required @@ -71,8 +71,8 @@ func main() { client.NewCompletionCmd(rootCmd, true), ) - // Add flags and prefix all env exposed with GA - executor := cli.PrepareMainCmd(rootCmd, "GA", app.DefaultCLIHome) + // Add flags and prefix all env exposed with WM + executor := cli.PrepareMainCmd(rootCmd, "WM", app.DefaultCLIHome) err := executor.Execute() if err != nil { diff --git a/cmd/gaiad/genaccounts.go b/cmd/wasmd/genaccounts.go similarity index 100% rename from cmd/gaiad/genaccounts.go rename to cmd/wasmd/genaccounts.go diff --git a/cmd/gaiad/main.go b/cmd/wasmd/main.go similarity index 90% rename from cmd/gaiad/main.go rename to cmd/wasmd/main.go index bb53ea635c..ceee7bf7e7 100644 --- a/cmd/gaiad/main.go +++ b/cmd/wasmd/main.go @@ -13,7 +13,7 @@ import ( tmtypes "github.com/tendermint/tendermint/types" dbm "github.com/tendermint/tm-db" - "github.com/cosmos/gaia/app" + "github.com/cosmwasm/wasmd/app" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" @@ -37,14 +37,14 @@ func main() { config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub) config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub) config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub) - config.SetKeyringServiceName("gaia") + config.SetKeyringServiceName("wasmd") config.Seal() ctx := server.NewDefaultContext() cobra.EnableCommandSorting = false rootCmd := &cobra.Command{ - Use: "gaiad", - Short: "Gaia Daemon (server)", + Use: "wasmd", + Short: "Wasm Daemon (server)", PersistentPreRunE: server.PersistentPreRunEFn(ctx), } @@ -67,7 +67,7 @@ func main() { server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators) // prepare and add flags - executor := cli.PrepareBaseCmd(rootCmd, "GA", app.DefaultNodeHome) + executor := cli.PrepareBaseCmd(rootCmd, "WM", app.DefaultNodeHome) rootCmd.PersistentFlags().UintVar(&invCheckPeriod, flagInvCheckPeriod, 0, "Assert registered invariants every N blocks") err := executor.Execute() @@ -83,7 +83,7 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer) abci.Application cache = store.NewCommitKVStoreCacheManager() } - return app.NewGaiaApp( + return app.NewWasmApp( logger, db, traceStore, true, invCheckPeriod, baseapp.SetPruning(store.NewPruningOptionsFromString(viper.GetString("pruning"))), baseapp.SetMinGasPrices(viper.GetString(server.FlagMinGasPrices)), @@ -98,7 +98,7 @@ func exportAppStateAndTMValidators( ) (json.RawMessage, []tmtypes.GenesisValidator, error) { if height != -1 { - gapp := app.NewGaiaApp(logger, db, traceStore, false, uint(1)) + gapp := app.NewWasmApp(logger, db, traceStore, false, uint(1)) err := gapp.LoadHeight(height) if err != nil { return nil, nil, err @@ -106,6 +106,6 @@ func exportAppStateAndTMValidators( return gapp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) } - gapp := app.NewGaiaApp(logger, db, traceStore, true, uint(1)) + gapp := app.NewWasmApp(logger, db, traceStore, true, uint(1)) return gapp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) } diff --git a/cmd/gaiad/replay.go b/cmd/wasmd/replay.go similarity index 98% rename from cmd/gaiad/replay.go rename to cmd/wasmd/replay.go index 011c722c13..76f844165f 100644 --- a/cmd/gaiad/replay.go +++ b/cmd/wasmd/replay.go @@ -17,7 +17,7 @@ import ( tmstore "github.com/tendermint/tendermint/store" tm "github.com/tendermint/tendermint/types" - "github.com/cosmos/gaia/app" + "github.com/cosmwasm/wasmd/app" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/server" @@ -92,7 +92,7 @@ func replayTxs(rootDir string) error { // Application fmt.Fprintln(os.Stderr, "Creating application") - gapp := app.NewGaiaApp( + gapp := app.NewWasmApp( ctx.Logger, appDB, traceStoreWriter, true, uint(1), baseapp.SetPruning(store.PruneEverything), // nothing ) diff --git a/cmd/gaiad/testnet.go b/cmd/wasmd/testnet.go similarity index 96% rename from cmd/gaiad/testnet.go rename to cmd/wasmd/testnet.go index ab6c4261f2..28760e85be 100644 --- a/cmd/gaiad/testnet.go +++ b/cmd/wasmd/testnet.go @@ -48,7 +48,7 @@ func testnetCmd(ctx *server.Context, cdc *codec.Codec, cmd := &cobra.Command{ Use: "testnet", - Short: "Initialize files for a Gaiad testnet", + Short: "Initialize files for a Wasmd testnet", Long: `testnet will create "v" number of directories and populate each with necessary files (private validator, genesis, config, etc.). @@ -80,9 +80,9 @@ Example: "Directory to store initialization data for the testnet") cmd.Flags().String(flagNodeDirPrefix, "node", "Prefix the directory name for each node with (node results in node0, node1, ...)") - cmd.Flags().String(flagNodeDaemonHome, "gaiad", + cmd.Flags().String(flagNodeDaemonHome, "wasmd", "Home directory of the node's daemon configuration") - cmd.Flags().String(flagNodeCLIHome, "gaiacli", + cmd.Flags().String(flagNodeCLIHome, "wasmcli", "Home directory of the node's cli configuration") cmd.Flags().String(flagStartingIPAddress, "192.168.0.1", "Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)") @@ -110,8 +110,8 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, nodeIDs := make([]string, numValidators) valPubKeys := make([]crypto.PubKey, numValidators) - gaiaConfig := srvconfig.DefaultConfig() - gaiaConfig.MinGasPrices = minGasPrices + wasmConfig := srvconfig.DefaultConfig() + wasmConfig.MinGasPrices = minGasPrices //nolint:prealloc var ( @@ -223,8 +223,8 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, // TODO: Rename config file to server.toml as it's not particular to Gaia // (REF: https://github.com/cosmos/cosmos-sdk/issues/4125). - gaiaConfigFilePath := filepath.Join(nodeDir, "config/gaiad.toml") - srvconfig.WriteConfigFile(gaiaConfigFilePath, gaiaConfig) + wasmConfigFilePath := filepath.Join(nodeDir, "config/gaiad.toml") + srvconfig.WriteConfigFile(wasmConfigFilePath, wasmConfig) } if err := initGenFiles(cdc, mbm, chainID, genAccounts, genFiles, numValidators); err != nil { diff --git a/go.mod b/go.mod index 08401ad8c8..d1d0ee72d4 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/cosmos/gaia +module github.com/cosmwasm/wasmd go 1.13 From b2086bb6b40ca74a3959927ca7219bfe0b60c7d9 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Tue, 19 Nov 2019 22:29:50 +0100 Subject: [PATCH 052/685] Search and replace gaiad/cl with wasmd/cli --- .circleci/config.yml | 14 +- .github/CODEOWNERS | 2 +- .github/ISSUE_TEMPLATE/bug-report.md | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .gitignore | 2 +- CHANGELOG.md | 80 +++---- CONTRIBUTING.md | 12 +- Dockerfile | 14 +- Makefile | 14 +- README.md | 8 +- app/app_test.go | 8 +- app/benchmarks/txsize_test.go | 2 +- cli_test/README.md | 16 +- cli_test/cli_test.go | 38 +-- cli_test/test_helpers.go | 112 ++++----- cmd/wasmd/testnet.go | 4 +- contrib/gitian-build.sh | 2 +- contrib/gitian-descriptors/gitian-darwin.yml | 10 +- contrib/gitian-descriptors/gitian-linux.yml | 10 +- contrib/gitian-descriptors/gitian-windows.yml | 10 +- docker-compose.yml | 40 ++-- docs/DOCS_README.md | 12 +- docs/README.md | 2 +- docs/delegator-guide-cli.md | 110 ++++----- docs/deploy-testnet.md | 84 +++---- docs/gaiacli.md | 216 +++++++++--------- docs/genesis.md | 12 +- docs/installation.md | 20 +- docs/join-mainnet.md | 32 +-- docs/join-testnet.md | 8 +- docs/keys.md | 2 +- docs/launch/blog-1-cn.md | 4 +- docs/launch/blog-1-en.md | 6 +- docs/launch/blog-1-kr.md | 4 +- docs/launch/blog-2-en.md | 2 +- docs/ledger.md | 42 ++-- docs/migration/cosmoshub-2.md | 40 ++-- docs/reproducible-builds.md | 2 +- docs/translations/cn/delegator-guide-cli.md | 102 ++++----- docs/translations/cn/deploy-testnet.md | 74 +++--- docs/translations/cn/gaiacli.md | 200 ++++++++-------- docs/translations/cn/genesis.md | 12 +- docs/translations/cn/installation.md | 12 +- docs/translations/cn/join-mainnet.md | 28 +-- docs/translations/cn/join-testnet.md | 4 +- docs/translations/cn/launch/blog-1-cn.md | 4 +- docs/translations/cn/ledger.md | 8 +- .../cn/validators/validator-faq.md | 6 +- .../cn/validators/validator-setup.md | 40 ++-- docs/translations/cn/what-is-gaia.md | 4 +- docs/translations/kr/delegator-guide-cli.md | 106 ++++----- docs/translations/kr/deploy-testnet.md | 76 +++--- docs/translations/kr/gaiacli.md | 208 ++++++++--------- docs/translations/kr/genesis.md | 12 +- docs/translations/kr/installation.md | 20 +- docs/translations/kr/join-mainnet.md | 32 +-- docs/translations/kr/join-testnet.md | 30 +-- docs/translations/kr/keys.md | 2 +- docs/translations/kr/ledger.md | 36 +-- docs/translations/kr/upgrade-node.md | 20 +- .../kr/validators/validator-faq.md | 6 +- .../kr/validators/validator-setup.md | 64 +++--- docs/translations/kr/what-is-gaia.md | 4 +- docs/upgrade-node.md | 20 +- docs/validators/kms/kms_ledger.md | 16 +- docs/validators/validator-faq.md | 6 +- docs/validators/validator-setup.md | 40 ++-- docs/what-is-gaia.md | 4 +- lcd_test/helpers.go | 14 +- lcd_test/testdata/setup.sh | 14 +- networks/Makefile | 12 +- networks/local/Makefile | 4 +- networks/local/gaiadnode/Dockerfile | 4 +- networks/local/gaiadnode/wrapper.sh | 8 +- networks/new-testnet.sh | 2 +- networks/remote/ansible/logzio.yml | 2 +- .../ansible/roles/add-lcd/handlers/main.yml | 6 +- .../ansible/roles/add-lcd/tasks/main.yml | 8 +- .../add-lcd/templates/gaiacli.service.j2 | 8 +- .../ansible/roles/clear-config/tasks/main.yml | 8 +- .../roles/extract-config/tasks/main.yml | 8 +- .../roles/increase-openfiles/tasks/main.yml | 4 +- .../roles/logzio/templates/journalbeat.yml.j2 | 2 +- .../roles/setup-fullnodes/files/gaiad.service | 8 +- .../roles/setup-fullnodes/handlers/main.yml | 2 +- .../roles/setup-fullnodes/tasks/main.yml | 22 +- .../setup-validators/files/gaiad.service | 8 +- .../roles/setup-validators/handlers/main.yml | 2 +- .../roles/setup-validators/tasks/main.yml | 24 +- .../files/conf.d/http_check.d/conf.yaml | 4 +- .../files/conf.d/process.d/conf.yaml | 8 +- .../roles/upgrade-gaiad/handlers/main.yml | 4 +- .../roles/upgrade-gaiad/tasks/main.yml | 16 +- networks/remote/ansible/start.yml | 2 +- networks/remote/ansible/stop.yml | 2 +- networks/remote/ansible/upgrade-gaia.yml | 2 +- networks/remote/ansible/upgrade-gaiad.yml | 2 +- .../remote/terraform-app/files/terraform.sh | 2 +- .../remote/terraform-aws/files/terraform.sh | 2 +- networks/remote/terraform-do/Makefile | 10 +- .../remote/terraform-do/files/terraform.sh | 2 +- networks/upgrade-gaiad.sh | 6 +- sims.mk | 10 +- 103 files changed, 1219 insertions(+), 1219 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c0254659ab..e1096ccdfc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,11 +4,11 @@ executors: golang: docker: - image: circleci/golang:1.13 - working_directory: /go/src/github.com/cosmos/gaia + working_directory: /go/src/github.com/cosmwasm/wasmd mac: macos: xcode: "10.3.0" - working_directory: /Users/distiller/project/src/github.com/cosmos/gaia + working_directory: /Users/distiller/project/src/github.com/cosmwasm/wasmd environment: GO_VERSION: "1.13" docs: @@ -197,7 +197,7 @@ jobs: command: bash <(curl -s https://codecov.io/bash) -f coverage.txt localnet: - working_directory: /home/circleci/.go_workspace/src/github.com/cosmos/gaia + working_directory: /home/circleci/.go_workspace/src/github.com/cosmwasm/wasmd machine: image: circleci/classic:latest environment: @@ -329,14 +329,14 @@ jobs: rm -rf gitian-build-${os}/ done - store_artifacts: - path: /go/src/github.com/cosmos/gaia/gaia-darwin-res.yml + path: /go/src/github.com/cosmwasm/wasmd/gaia-darwin-res.yml - store_artifacts: - path: /go/src/github.com/cosmos/gaia/gaia-linux-res.yml + path: /go/src/github.com/cosmwasm/wasmd/gaia-linux-res.yml - store_artifacts: - path: /go/src/github.com/cosmos/gaia/gaia-windows-res.yml + path: /go/src/github.com/cosmwasm/wasmd/gaia-windows-res.yml # FIXME: The `setup-contract-tests-data` make target is broken as it completely -# overrides the .gaiad directory. +# overrides the .wasmd directory. # # contract_tests: # executor: golang diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5233beb348..a6be25e244 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # CODEOWNERS: https://help.github.com/articles/about-codeowners/ # Primary repo maintainers -* @alessio @alexanderbez @rigelrozanski @jackzampolin @fedekunze +* @ethanfrey diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index d6d9c6feb5..6a8a64a3e7 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -16,7 +16,7 @@ v Please also ensure that this is not a duplicate issue :) ## Version - + ## Steps to Reproduce diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0f6760e8bc..94301cbac0 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,7 +4,7 @@ v Before smashing the submit button please review the checkboxes. v If a checkbox is n/a - please still include it but + a little note why ☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --> -- Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/gaia/blob/master/CONTRIBUTING.md#pr-targeting)) +- Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmwasm/wasmd/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] Linked to github-issue with discussion and accepted design OR link to spec that describes this work. - [ ] Wrote tests diff --git a/.gitignore b/.gitignore index 96722f977c..e28bc13c55 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,7 @@ tools-stamp # Data - ideally these don't exist baseapp/data/* client/lcd/keys/* -cmd/gaiacli/statik/statik.go +cmd/wasmcli/statik/statik.go mytestnet # Testing diff --git a/CHANGELOG.md b/CHANGELOG.md index 876d15f020..ece140c461 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,16 +38,16 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features -* (gaiad) [\#119](https://github.com/cosmos/gaia/pull/119) Add support for the `--inter-block-cache` CLI +* (wasmd) [\#119](https://github.com/cosmwasm/wasmd/pull/119) Add support for the `--inter-block-cache` CLI flag and configuration. -* (gaiacli) [\#132](https://github.com/cosmos/gaia/pull/132) Add `tx decode` command to decode +* (wasmcli) [\#132](https://github.com/cosmwasm/wasmd/pull/132) Add `tx decode` command to decode Base64 encoded transactions. -* (modules) [\#190](https://github.com/cosmos/gaia/pull/190) Introduce use of the `x/evidence` module. -* (gaiad) [\#191](https://github.com/cosmos/gaia/pull/191) Add debug commands to gaiad: +* (modules) [\#190](https://github.com/cosmwasm/wasmd/pull/190) Introduce use of the `x/evidence` module. +* (wasmd) [\#191](https://github.com/cosmwasm/wasmd/pull/191) Add debug commands to wasmd: - `pubkey`: decode pubkey from base64, hex or bech32 - `addr`: convert a address between hex and bech32 - `raw-bytes` convert raw-bytes to hex -* (gaiacli) [\#191](https://github.com/cosmos/gaia/pull/191) Add cmd `decode-tx`, decodes a tx from hex or base64 +* (wasmcli) [\#191](https://github.com/cosmwasm/wasmd/pull/191) Add cmd `decode-tx`, decodes a tx from hex or base64 ## [v2.0.3] - 2019-11-04 @@ -67,11 +67,11 @@ Base64 encoded transactions. ### Features -* (gaiad) [\#119](https://github.com/cosmos/gaia/pull/119) Add support for the `--halt-time` CLI flag and configuration. +* (wasmd) [\#119](https://github.com/cosmwasm/wasmd/pull/119) Add support for the `--halt-time` CLI flag and configuration. ### Improvements -* [\#119](https://github.com/cosmos/gaia/pull/119) Refactor and upgrade Circle CI +* [\#119](https://github.com/cosmwasm/wasmd/pull/119) Refactor and upgrade Circle CI configuration. * (sdk) Update SDK version to v0.37.1 @@ -79,7 +79,7 @@ configuration. ### Bug Fixes -* [\#104](https://github.com/cosmos/gaia/issues/104) Fix `ModuleAccountAddrs` to +* [\#104](https://github.com/cosmwasm/wasmd/issues/104) Fix `ModuleAccountAddrs` to not rely on the `x/supply` keeper to get module account addresses for blacklisting. ### State Machine Breaking Changes @@ -90,29 +90,29 @@ not rely on the `x/supply` keeper to get module account addresses for blacklisti ### Bug Fixes -* (gaiad) [\#4113](https://github.com/cosmos/cosmos-sdk/issues/4113) Fix incorrect `$GOBIN` in `Install Go` -* (gaiacli) [\#3945](https://github.com/cosmos/cosmos-sdk/issues/3945) There's no check for chain-id in TxBuilder.SignStdTx -* (gaiacli) [\#4190](https://github.com/cosmos/cosmos-sdk/issues/4190) Fix redelegations-from by using the correct params and query endpoint. -* (gaiacli) [\#4219](https://github.com/cosmos/cosmos-sdk/issues/4219) Return an error when an empty mnemonic is provided during key recovery. -* (gaiacli) [\#4345](https://github.com/cosmos/cosmos-sdk/issues/4345) Improved Ledger Nano X detection +* (wasmd) [\#4113](https://github.com/cosmos/cosmos-sdk/issues/4113) Fix incorrect `$GOBIN` in `Install Go` +* (wasmcli) [\#3945](https://github.com/cosmos/cosmos-sdk/issues/3945) There's no check for chain-id in TxBuilder.SignStdTx +* (wasmcli) [\#4190](https://github.com/cosmos/cosmos-sdk/issues/4190) Fix redelegations-from by using the correct params and query endpoint. +* (wasmcli) [\#4219](https://github.com/cosmos/cosmos-sdk/issues/4219) Return an error when an empty mnemonic is provided during key recovery. +* (wasmcli) [\#4345](https://github.com/cosmos/cosmos-sdk/issues/4345) Improved Ledger Nano X detection ### Breaking Changes * (sdk) Update SDK version to v0.36.0 -* (gaiad) [\#3985](https://github.com/cosmos/cosmos-sdk/issues/3985) ValidatorPowerRank uses potential consensus power -* (gaiad) [\#4027](https://github.com/cosmos/cosmos-sdk/issues/4027) gaiad version command does not return the checksum of the go.sum file shipped along with the source release tarball. +* (wasmd) [\#3985](https://github.com/cosmos/cosmos-sdk/issues/3985) ValidatorPowerRank uses potential consensus power +* (wasmd) [\#4027](https://github.com/cosmos/cosmos-sdk/issues/4027) wasmd version command does not return the checksum of the go.sum file shipped along with the source release tarball. Go modules feature guarantees dependencies reproducibility and as long as binaries are built via the Makefile shipped with the sources, no dependendencies can break such guarantee. -* (gaiad) [\#4159](https://github.com/cosmos/cosmos-sdk/issues/4159) use module pattern and module manager for initialization -* (gaiad) [\#4272](https://github.com/cosmos/cosmos-sdk/issues/4272) Merge gaiareplay functionality into gaiad replay. - Drop `gaiareplay` in favor of new `gaiad replay` command. -* (gaiacli) [\#3715](https://github.com/cosmos/cosmos-sdk/issues/3715) query distr rewards returns per-validator +* (wasmd) [\#4159](https://github.com/cosmos/cosmos-sdk/issues/4159) use module pattern and module manager for initialization +* (wasmd) [\#4272](https://github.com/cosmos/cosmos-sdk/issues/4272) Merge gaiareplay functionality into wasmd replay. + Drop `gaiareplay` in favor of new `wasmd replay` command. +* (wasmcli) [\#3715](https://github.com/cosmos/cosmos-sdk/issues/3715) query distr rewards returns per-validator rewards along with rewards total amount. -* (gaiacli) [\#40](https://github.com/cosmos/cosmos-sdk/issues/40) rest-server's --cors option is now gone. -* (gaiacli) [\#4027](https://github.com/cosmos/cosmos-sdk/issues/4027) gaiacli version command dooes not return the checksum of the go.sum file anymore. -* (gaiacli) [\#4142](https://github.com/cosmos/cosmos-sdk/issues/4142) Turn gaiacli tx send's --from into a required argument. - New shorter syntax: `gaiacli tx send FROM TO AMOUNT` -* (gaiacli) [\#4228](https://github.com/cosmos/cosmos-sdk/issues/4228) Merge gaiakeyutil functionality into gaiacli keys. - Drop `gaiakeyutil` in favor of new `gaiacli keys parse` command. Syntax and semantic are preserved. +* (wasmcli) [\#40](https://github.com/cosmos/cosmos-sdk/issues/40) rest-server's --cors option is now gone. +* (wasmcli) [\#4027](https://github.com/cosmos/cosmos-sdk/issues/4027) wasmcli version command dooes not return the checksum of the go.sum file anymore. +* (wasmcli) [\#4142](https://github.com/cosmos/cosmos-sdk/issues/4142) Turn wasmcli tx send's --from into a required argument. + New shorter syntax: `wasmcli tx send FROM TO AMOUNT` +* (wasmcli) [\#4228](https://github.com/cosmos/cosmos-sdk/issues/4228) Merge gaiakeyutil functionality into wasmcli keys. + Drop `gaiakeyutil` in favor of new `wasmcli keys parse` command. Syntax and semantic are preserved. * (rest) [\#3715](https://github.com/cosmos/cosmos-sdk/issues/3715) Update /distribution/delegators/{delegatorAddr}/rewards GET endpoint as per new specs. For a given delegation, the endpoint now returns the comprehensive list of validator-reward tuples along with the grand total. @@ -123,19 +123,19 @@ not rely on the `x/supply` keeper to get module account addresses for blacklisti ### Features -* (gaiad) Add `migrate` command to `gaiad` to provide the ability to migrate exported +* (wasmd) Add `migrate` command to `wasmd` to provide the ability to migrate exported genesis state from one version to another. -* (gaiad) Update Gaia for community pool spend proposals per Cosmos Hub governance proposal [\#7](https://github.com/cosmos/cosmos-sdk/issues/7) "Activate the Community Pool" +* (wasmd) Update Gaia for community pool spend proposals per Cosmos Hub governance proposal [\#7](https://github.com/cosmos/cosmos-sdk/issues/7) "Activate the Community Pool" ### Improvements -* (gaiad) [\#4042](https://github.com/cosmos/cosmos-sdk/issues/4042) Update docs and scripts to include the correct `GO111MODULE=on` environment variable. -* (gaiad) [\#4066](https://github.com/cosmos/cosmos-sdk/issues/4066) Fix 'ExportGenesisFile() incorrectly overwrites genesis' -* (gaiad) [\#4064](https://github.com/cosmos/cosmos-sdk/issues/4064) Remove `dep` and `vendor` from `doc` and `version`. -* (gaiad) [\#4080](https://github.com/cosmos/cosmos-sdk/issues/4080) add missing invariants during simulations -* (gaiad) [\#4343](https://github.com/cosmos/cosmos-sdk/issues/4343) Upgrade toolchain to Go 1.12.5. -* (gaiacli) [\#4068](https://github.com/cosmos/cosmos-sdk/issues/4068) Remove redundant account check on `gaiacli` -* (gaiacli) [\#4227](https://github.com/cosmos/cosmos-sdk/issues/4227) Support for Ledger App v1.5 +* (wasmd) [\#4042](https://github.com/cosmos/cosmos-sdk/issues/4042) Update docs and scripts to include the correct `GO111MODULE=on` environment variable. +* (wasmd) [\#4066](https://github.com/cosmos/cosmos-sdk/issues/4066) Fix 'ExportGenesisFile() incorrectly overwrites genesis' +* (wasmd) [\#4064](https://github.com/cosmos/cosmos-sdk/issues/4064) Remove `dep` and `vendor` from `doc` and `version`. +* (wasmd) [\#4080](https://github.com/cosmos/cosmos-sdk/issues/4080) add missing invariants during simulations +* (wasmd) [\#4343](https://github.com/cosmos/cosmos-sdk/issues/4343) Upgrade toolchain to Go 1.12.5. +* (wasmcli) [\#4068](https://github.com/cosmos/cosmos-sdk/issues/4068) Remove redundant account check on `wasmcli` +* (wasmcli) [\#4227](https://github.com/cosmos/cosmos-sdk/issues/4227) Support for Ledger App v1.5 * (rest) [\#2007](https://github.com/cosmos/cosmos-sdk/issues/2007) Return 200 status code on empty results * (rest) [\#4123](https://github.com/cosmos/cosmos-sdk/issues/4123) Fix typo, url error and outdated command description of doc clients. * (rest) [\#4129](https://github.com/cosmos/cosmos-sdk/issues/4129) Translate doc clients to chinese. @@ -143,9 +143,9 @@ not rely on the `x/supply` keeper to get module account addresses for blacklisti -[Unreleased]: https://github.com/cosmos/gaia/compare/v2.0.3...HEAD -[v2.0.3]: https://github.com/cosmos/gaia/releases/tag/v2.0.3 -[v2.0.2]: https://github.com/cosmos/gaia/releases/tag/v2.0.2 -[v2.0.1]: https://github.com/cosmos/gaia/releases/tag/v2.0.1 -[v2.0.0]: https://github.com/cosmos/gaia/releases/tag/v2.0.0 -[v1.0.0]: https://github.com/cosmos/gaia/releases/tag/v1.0.0 +[Unreleased]: https://github.com/cosmwasm/wasmd/compare/v2.0.3...HEAD +[v2.0.3]: https://github.com/cosmwasm/wasmd/releases/tag/v2.0.3 +[v2.0.2]: https://github.com/cosmwasm/wasmd/releases/tag/v2.0.2 +[v2.0.1]: https://github.com/cosmwasm/wasmd/releases/tag/v2.0.1 +[v2.0.0]: https://github.com/cosmwasm/wasmd/releases/tag/v2.0.0 +[v1.0.0]: https://github.com/cosmwasm/wasmd/releases/tag/v1.0.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 26b787a9c1..3e508a749a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,8 +21,8 @@ Contributing to this repo can mean many things such as participated in discussion or proposing code changes. To ensure a smooth workflow for all contributors, the general procedure for contributing has been established: -1. Either [open](https://github.com/cosmos/gaia/issues/new/choose) or - [find](https://github.com/cosmos/gaia/issues) an issue you'd like to help with +1. Either [open](https://github.com/cosmwasm/wasmd/issues/new/choose) or + [find](https://github.com/cosmwasm/wasmd/issues) an issue you'd like to help with 2. Participate in thoughtful discussion on that issue 3. If you would like to contribute: 1. If a the issue is a proposal, ensure that the proposal has been accepted @@ -54,7 +54,7 @@ tools` for installing the linting tools. Other notes: - Looking for a good place to start contributing? How about checking out some - [good first issues](https://github.com/cosmos/gaia/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) + [good first issues](https://github.com/cosmwasm/wasmd/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) - Please make sure to use `gofmt` before every commit - the easiest way to do this is have your editor run it for you upon saving a file. Additionally please ensure that your code is lint compliant by running `make lint` @@ -92,12 +92,12 @@ Please note that Go requires code to live under absolute paths, which complicate While my fork lives at `https://github.com/rigeyrigerige/gaia`, the code should never exist at `$GOPATH/src/github.com/rigeyrigerige/gaia`. Instead, we use `git remote` to add the fork as a new remote for the original repo, -`$GOPATH/src/github.com/cosmos/gaia `, and do all the work there. +`$GOPATH/src/github.com/cosmwasm/wasmd `, and do all the work there. For instance, to create a fork and work on a branch of it, I would: - Create the fork on github, using the fork button. - - Go to the original repo checked out locally (i.e. `$GOPATH/src/github.com/cosmos/gaia`) + - Go to the original repo checked out locally (i.e. `$GOPATH/src/github.com/cosmwasm/wasmd`) - `git remote rename origin upstream` - `git remote add origin git@github.com:rigeyrigerige/gaia.git` @@ -177,7 +177,7 @@ only pull requests targeted directly against master. - `master` must never fail `make test` or `make test_cli` - `master` should not fail `make lint` - no `--force` onto `master` (except when reverting a broken commit, which should seldom happen) - - create a development branch either on github.com/cosmos/gaia, or your fork (using `git remote add origin`) + - create a development branch either on github.com/cosmwasm/wasmd, or your fork (using `git remote add origin`) - before submitting a pull request, begin `git rebase` on top of `master` ### Pull Merge Procedure diff --git a/Dockerfile b/Dockerfile index c123dbf65e..d732d85458 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ # Simple usage with a mounted data directory: # > docker build -t gaia . -# > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.gaiad:/root/.gaiad -v ~/.gaiacli:/root/.gaiacli gaia gaiad init -# > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.gaiad:/root/.gaiad -v ~/.gaiacli:/root/.gaiacli gaia gaiad start +# > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.wasmd:/root/.wasmd -v ~/.wasmcli:/root/.wasmcli gaia wasmd init +# > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.wasmd:/root/.wasmd -v ~/.wasmcli:/root/.wasmcli gaia wasmd start FROM golang:alpine AS build-env # Set up dependencies ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python # Set working directory for the build -WORKDIR /go/src/github.com/cosmos/gaia +WORKDIR /go/src/github.com/cosmwasm/wasmd # Add source files COPY . . @@ -26,8 +26,8 @@ RUN apk add --update ca-certificates WORKDIR /root # Copy over binaries from the build-env -COPY --from=build-env /go/bin/gaiad /usr/bin/gaiad -COPY --from=build-env /go/bin/gaiacli /usr/bin/gaiacli +COPY --from=build-env /go/bin/wasmd /usr/bin/wasmd +COPY --from=build-env /go/bin/wasmcli /usr/bin/wasmcli -# Run gaiad by default, omit entrypoint to ease using container with gaiacli -CMD ["gaiad"] +# Run wasmd by default, omit entrypoint to ease using container with wasmcli +CMD ["wasmd"] diff --git a/Makefile b/Makefile index 6a57a865b3..a43bb838ea 100644 --- a/Makefile +++ b/Makefile @@ -105,7 +105,7 @@ go.sum: go.mod draw-deps: @# requires brew install graphviz or apt-get install graphviz go get github.com/RobotsAndPencils/goviz - @goviz -i ./cmd/gaiad -d 2 | dot -Tpng -o dependency-graph.png + @goviz -i ./cmd/wasmd -d 2 | dot -Tpng -o dependency-graph.png clean: rm -rf snapcraft-local.yaml build/ @@ -150,12 +150,12 @@ benchmark: ######################################## ### Local validator nodes using docker and docker-compose -build-docker-gaiadnode: +build-docker-wasmdnode: $(MAKE) -C networks/local # Run a 4-node testnet locally localnet-start: build-linux localnet-stop - @if ! [ -f build/node0/gaiad/config/genesis.json ]; then docker run -e COSMOS_SDK_TEST_KEYRING=y --rm -v $(CURDIR)/build:/gaiad:Z tendermint/gaiadnode testnet --v 4 -o . --starting-ip-address 192.168.10.2 ; fi + @if ! [ -f build/node0/wasmd/config/genesis.json ]; then docker run -e COSMOS_SDK_TEST_KEYRING=y --rm -v $(CURDIR)/build:/wasmd:Z tendermint/wasmdnode testnet --v 4 -o . --starting-ip-address 192.168.10.2 ; fi docker-compose up -d # Stop testnet @@ -167,11 +167,11 @@ setup-contract-tests-data: rm -rf /tmp/contract_tests ; \ mkdir /tmp/contract_tests ; \ cp "${GOPATH}/pkg/mod/${SDK_PACK}/client/lcd/swagger-ui/swagger.yaml" /tmp/contract_tests/swagger.yaml ; \ - ./build/gaiad init --home /tmp/contract_tests/.gaiad --chain-id lcd contract-tests ; \ + ./build/wasmd init --home /tmp/contract_tests/.wasmd --chain-id lcd contract-tests ; \ tar -xzf lcd_test/testdata/state.tar.gz -C /tmp/contract_tests/ start-gaia: setup-contract-tests-data - ./build/gaiad --home /tmp/contract_tests/.gaiad start & + ./build/wasmd --home /tmp/contract_tests/.wasmd start & @sleep 2s setup-transactions: start-gaia @@ -179,11 +179,11 @@ setup-transactions: start-gaia run-lcd-contract-tests: @echo "Running Gaia LCD for contract tests" - ./build/gaiacli rest-server --laddr tcp://0.0.0.0:8080 --home /tmp/contract_tests/.gaiacli --node http://localhost:26657 --chain-id lcd --trust-node true + ./build/wasmcli rest-server --laddr tcp://0.0.0.0:8080 --home /tmp/contract_tests/.wasmcli --node http://localhost:26657 --chain-id lcd --trust-node true contract-tests: setup-transactions @echo "Running Gaia LCD for contract tests" - dredd && pkill gaiad + dredd && pkill wasmd # include simulations include sims.mk diff --git a/README.md b/README.md index ca6dd6a8d0..f63365f032 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,10 @@ [![CircleCI](https://circleci.com/gh/cosmos/gaia/tree/master.svg?style=shield)](https://circleci.com/gh/cosmos/gaia/tree/master) [![codecov](https://codecov.io/gh/cosmos/gaia/branch/master/graph/badge.svg)](https://codecov.io/gh/cosmos/gaia) -[![Go Report Card](https://goreportcard.com/badge/github.com/cosmos/gaia)](https://goreportcard.com/report/github.com/cosmos/gaia) -[![license](https://img.shields.io/github/license/cosmos/gaia.svg)](https://github.com/cosmos/gaia/blob/master/LICENSE) -[![LoC](https://tokei.rs/b1/github/cosmos/gaia)](https://github.com/cosmos/gaia) -[![GolangCI](https://golangci.com/badges/github.com/cosmos/gaia.svg)](https://golangci.com/r/github.com/cosmos/gaia) +[![Go Report Card](https://goreportcard.com/badge/github.com/cosmwasm/wasmd)](https://goreportcard.com/report/github.com/cosmwasm/wasmd) +[![license](https://img.shields.io/github/license/cosmos/gaia.svg)](https://github.com/cosmwasm/wasmd/blob/master/LICENSE) +[![LoC](https://tokei.rs/b1/github/cosmos/gaia)](https://github.com/cosmwasm/wasmd) +[![GolangCI](https://golangci.com/badges/github.com/cosmwasm/wasmd.svg)](https://golangci.com/r/github.com/cosmwasm/wasmd) [![riot.im](https://img.shields.io/badge/riot.im-JOIN%20CHAT-green.svg)](https://riot.im/app/#/room/#cosmos-sdk:matrix.org) This repository hosts `Gaia`, the first implementation of the Cosmos Hub. diff --git a/app/app_test.go b/app/app_test.go index 84aecfeee0..dd1fb0696c 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -14,14 +14,14 @@ import ( abci "github.com/tendermint/tendermint/abci/types" ) -func TestWasmddExport(t *testing.T) { +func TestWasmdExport(t *testing.T) { db := db.NewMemDB() - gapp := NewWasmdApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) + gapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) err := setGenesis(gapp) require.NoError(t, err) // Making a new app object with the db, so that initchain hasn't been called - newGapp := NewWasmdApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) + newGapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) _, _, err = newGapp.ExportAppStateAndValidators(false, []string{}) require.NoError(t, err, "ExportAppStateAndValidators should not have an error") } @@ -29,7 +29,7 @@ func TestWasmddExport(t *testing.T) { // ensure that black listed addresses are properly set in bank keeper func TestBlackListedAddrs(t *testing.T) { db := db.NewMemDB() - gapp := NewWasmdApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) + gapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) for acc := range maccPerms { require.True(t, gapp.bankKeeper.BlacklistedAddr(gapp.supplyKeeper.GetModuleAddress(acc))) diff --git a/app/benchmarks/txsize_test.go b/app/benchmarks/txsize_test.go index 4863cedc6d..4cc225bef9 100644 --- a/app/benchmarks/txsize_test.go +++ b/app/benchmarks/txsize_test.go @@ -5,7 +5,7 @@ import ( "github.com/tendermint/tendermint/crypto/secp256k1" - "github.com/cosmos/gaia/app" + "github.com/cosmwasm/wasmd/app" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" diff --git a/cli_test/README.md b/cli_test/README.md index 67975c4da0..7cc84d1de3 100644 --- a/cli_test/README.md +++ b/cli_test/README.md @@ -10,9 +10,9 @@ go test -mod=readonly -p 4 `go list ./cli_test/...` -tags=cli_test ### Test Structure -This integration suite [uses a thin wrapper](https://godoc.org/github.com/cosmos/cosmos-sdk/tests) over the [`os/exec`](https://golang.org/pkg/os/exec/) package. This allows the integration test to run against built binaries (both `gaiad` and `gaiacli` are used) while being written in golang. This allows tests to take advantage of the various golang code we have for operations like marshal/unmarshal, crypto, etc... +This integration suite [uses a thin wrapper](https://godoc.org/github.com/cosmos/cosmos-sdk/tests) over the [`os/exec`](https://golang.org/pkg/os/exec/) package. This allows the integration test to run against built binaries (both `wasmd` and `wasmcli` are used) while being written in golang. This allows tests to take advantage of the various golang code we have for operations like marshal/unmarshal, crypto, etc... -> NOTE: The tests will use whatever `gaiad` or `gaiacli` binaries are available in your `$PATH`. You can check which binary will be run by the suite by running `which gaiad` or `which gaiacli`. If you have your `$GOPATH` properly setup they should be in `$GOPATH/bin/gaia*`. This will ensure that your test uses the latest binary you have built +> NOTE: The tests will use whatever `wasmd` or `wasmcli` binaries are available in your `$PATH`. You can check which binary will be run by the suite by running `which wasmd` or `which wasmcli`. If you have your `$GOPATH` properly setup they should be in `$GOPATH/bin/gaia*`. This will ensure that your test uses the latest binary you have built Tests generally follow this structure: @@ -21,7 +21,7 @@ func TestMyNewCommand(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server + // start wasmd server proc := f.GDStart() defer proc.Stop(false) @@ -34,18 +34,18 @@ func TestMyNewCommand(t *testing.T) { This boilerplate above: - Ensures the tests run in parallel. Because the tests are calling out to `os/exec` for many operations these tests can take a long time to run. -- Creates `.gaiad` and `.gaiacli` folders in a new temp folder. -- Uses `gaiacli` to create 2 accounts for use in testing: `foo` and `bar` +- Creates `.wasmd` and `.wasmcli` folders in a new temp folder. +- Uses `wasmcli` to create 2 accounts for use in testing: `foo` and `bar` - Creates a genesis file with coins (`1000footoken,1000feetoken,150stake`) controlled by the `foo` key - Generates an initial bonding transaction (`gentx`) to make the `foo` key a validator at genesis -- Starts `gaiad` and stops it once the test exits +- Starts `wasmd` and stops it once the test exits - Cleans up test state on a successful run ### Notes when adding/running tests - Because the tests run against a built binary, you should make sure you build every time the code changes and you want to test again, otherwise you will be testing against an older version. If you are adding new tests this can easily lead to confusing test results. -- The [`test_helpers.go`](./test_helpers.go) file is organized according to the format of `gaiacli` and `gaiad` commands. There are comments with section headers describing the different areas. Helper functions to call CLI functionality are generally named after the command (e.g. `gaiacli query staking validator` would be `QueryStakingValidator`). Try to keep functions grouped by their position in the command tree. +- The [`test_helpers.go`](./test_helpers.go) file is organized according to the format of `wasmcli` and `wasmd` commands. There are comments with section headers describing the different areas. Helper functions to call CLI functionality are generally named after the command (e.g. `wasmcli query staking validator` would be `QueryStakingValidator`). Try to keep functions grouped by their position in the command tree. - Test state that is needed by `tx` and `query` commands (`home`, `chain_id`, etc...) is stored on the `Fixtures` object. This makes constructing your new tests almost trivial. -- Sometimes if you exit a test early there can be still running `gaiad` and `gaiacli` processes that will interrupt subsequent runs. Still running `gaiacli` processes will block access to the keybase while still running `gaiad` processes will block ports and prevent new tests from spinning up. You can ensure new tests spin up clean by running `pkill -9 gaiad && pkill -9 gaiacli` before each test run. +- Sometimes if you exit a test early there can be still running `wasmd` and `wasmcli` processes that will interrupt subsequent runs. Still running `wasmcli` processes will block access to the keybase while still running `wasmd` processes will block ports and prevent new tests from spinning up. You can ensure new tests spin up clean by running `pkill -9 wasmd && pkill -9 wasmcli` before each test run. - Most `query` and `tx` commands take a variadic `flags` argument. This pattern allows for the creation of a general function which is easily modified by adding flags. See the `TxSend` function and its use for a good example. - `Tx*` functions follow a general pattern and return `(success bool, stdout string, stderr string)`. This allows for easy testing of multiple different flag configurations. See `TestGaiaCLICreateValidator` or `TestGaiaCLISubmitProposal` for a good example of the pattern. diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index eb14217a3f..1f0fc429f1 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -19,7 +19,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/cosmos/gaia/app" + "github.com/cosmwasm/wasmd/app" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/tests" @@ -91,7 +91,7 @@ func TestGaiaCLIMinimumFees(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server with minimum fees + // start wasmd server with minimum fees minGasPrice, _ := sdk.NewDecFromStr("0.000006") fees := fmt.Sprintf( "--minimum-gas-prices=%s,%s", @@ -129,7 +129,7 @@ func TestGaiaCLIGasPrices(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server with minimum fees + // start wasmd server with minimum fees minGasPrice, _ := sdk.NewDecFromStr("0.000006") proc := f.GDStart(fmt.Sprintf("--minimum-gas-prices=%s", sdk.NewDecCoinFromDec(feeDenom, minGasPrice))) defer proc.Stop(false) @@ -163,7 +163,7 @@ func TestGaiaCLIFeesDeduction(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server with minimum fees + // start wasmd server with minimum fees minGasPrice, _ := sdk.NewDecFromStr("0.000006") proc := f.GDStart(fmt.Sprintf("--minimum-gas-prices=%s", sdk.NewDecCoinFromDec(feeDenom, minGasPrice))) defer proc.Stop(false) @@ -216,7 +216,7 @@ func TestGaiaCLISend(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server + // start wasmd server proc := f.GDStart() defer proc.Stop(false) @@ -285,7 +285,7 @@ func TestGaiaCLIGasAuto(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server + // start wasmd server proc := f.GDStart() defer proc.Stop(false) @@ -345,7 +345,7 @@ func TestGaiaCLICreateValidator(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server + // start wasmd server proc := f.GDStart() defer proc.Stop(false) @@ -436,7 +436,7 @@ func TestGaiaCLIQueryRewards(t *testing.T) { genDoc.AppState, err = cdc.MarshalJSON(genesisState) require.NoError(t, genDoc.SaveAs(genFile)) - // start gaiad server + // start wasmd server proc := f.GDStart() defer proc.Stop(false) @@ -451,7 +451,7 @@ func TestGaiaCLIQuerySupply(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server + // start wasmd server proc := f.GDStart() defer proc.Stop(false) @@ -468,7 +468,7 @@ func TestGaiaCLISubmitProposal(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server + // start wasmd server proc := f.GDStart() defer proc.Stop(false) @@ -761,7 +761,7 @@ func TestGaiaCLIQueryTxPagination(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server + // start wasmd server proc := f.GDStart() defer proc.Stop(false) @@ -811,7 +811,7 @@ func TestGaiaCLIValidateSignatures(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server + // start wasmd server proc := f.GDStart() defer proc.Stop(false) @@ -860,7 +860,7 @@ func TestGaiaCLISendGenerateSignAndBroadcast(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server + // start wasmd server proc := f.GDStart() defer proc.Stop(false) @@ -944,7 +944,7 @@ func TestGaiaCLIMultisignInsufficientCosigners(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server with minimum fees + // start wasmd server with minimum fees proc := f.GDStart() defer proc.Stop(false) @@ -997,7 +997,7 @@ func TestGaiaCLIEncode(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server + // start wasmd server proc := f.GDStart() defer proc.Stop(false) @@ -1035,7 +1035,7 @@ func TestGaiaCLIMultisignSortSignatures(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server with minimum fees + // start wasmd server with minimum fees proc := f.GDStart() defer proc.Stop(false) @@ -1100,7 +1100,7 @@ func TestGaiaCLIMultisign(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server with minimum fees + // start wasmd server with minimum fees proc := f.GDStart() defer proc.Stop(false) @@ -1286,7 +1286,7 @@ func TestSlashingGetParams(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server + // start wasmd server proc := f.GDStart() defer proc.Stop(false) @@ -1307,7 +1307,7 @@ func TestValidateGenesis(t *testing.T) { t.Parallel() f := InitFixtures(t) - // start gaiad server + // start wasmd server proc := f.GDStart() defer proc.Stop(false) diff --git a/cli_test/test_helpers.go b/cli_test/test_helpers.go index 411c6e9332..05617c5955 100644 --- a/cli_test/test_helpers.go +++ b/cli_test/test_helpers.go @@ -16,7 +16,7 @@ import ( tmtypes "github.com/tendermint/tendermint/types" - "github.com/cosmos/gaia/app" + "github.com/cosmwasm/wasmd/app" clientkeys "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/codec" @@ -104,10 +104,10 @@ func NewFixtures(t *testing.T) *Fixtures { T: t, BuildDir: buildDir, RootDir: tmpDir, - GaiadBinary: filepath.Join(buildDir, "gaiad"), - GaiacliBinary: filepath.Join(buildDir, "gaiacli"), - GaiadHome: filepath.Join(tmpDir, ".gaiad"), - GaiacliHome: filepath.Join(tmpDir, ".gaiacli"), + GaiadBinary: filepath.Join(buildDir, "wasmd"), + GaiacliBinary: filepath.Join(buildDir, "wasmcli"), + GaiadHome: filepath.Join(tmpDir, ".wasmd"), + GaiacliHome: filepath.Join(tmpDir, ".wasmcli"), RPCAddr: servAddr, P2PAddr: p2pAddr, Port: port, @@ -189,9 +189,9 @@ func (f *Fixtures) Flags() string { } //___________________________________________________________________________________ -// gaiad +// wasmd -// UnsafeResetAll is gaiad unsafe-reset-all +// UnsafeResetAll is wasmd unsafe-reset-all func (f *Fixtures) UnsafeResetAll(flags ...string) { cmd := fmt.Sprintf("%s --home=%s unsafe-reset-all", f.GaiadBinary, f.GaiadHome) executeWrite(f.T, addFlags(cmd, flags)) @@ -199,7 +199,7 @@ func (f *Fixtures) UnsafeResetAll(flags ...string) { require.NoError(f.T, err) } -// GDInit is gaiad init +// GDInit is wasmd init // NOTE: GDInit sets the ChainID for the Fixtures instance func (f *Fixtures) GDInit(moniker string, flags ...string) { cmd := fmt.Sprintf("%s init -o --home=%s %s", f.GaiadBinary, f.GaiadHome, moniker) @@ -217,25 +217,25 @@ func (f *Fixtures) GDInit(moniker string, flags ...string) { f.ChainID = chainID } -// AddGenesisAccount is gaiad add-genesis-account +// AddGenesisAccount is wasmd add-genesis-account func (f *Fixtures) AddGenesisAccount(address sdk.AccAddress, coins sdk.Coins, flags ...string) { cmd := fmt.Sprintf("%s add-genesis-account %s %s --home=%s", f.GaiadBinary, address, coins, f.GaiadHome) executeWriteCheckErr(f.T, addFlags(cmd, flags)) } -// GenTx is gaiad gentx +// GenTx is wasmd gentx func (f *Fixtures) GenTx(name string, flags ...string) { 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)) } -// CollectGenTxs is gaiad collect-gentxs +// CollectGenTxs is wasmd collect-gentxs func (f *Fixtures) CollectGenTxs(flags ...string) { cmd := fmt.Sprintf("%s collect-gentxs --home=%s", f.GaiadBinary, f.GaiadHome) executeWriteCheckErr(f.T, addFlags(cmd, flags)) } -// GDStart runs gaiad start with the appropriate flags and returns a process +// GDStart runs wasmd start with the appropriate flags and returns a process func (f *Fixtures) GDStart(flags ...string) *tests.Process { 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)) @@ -244,7 +244,7 @@ func (f *Fixtures) GDStart(flags ...string) *tests.Process { return proc } -// GDTendermint returns the results of gaiad tendermint [query] +// GDTendermint returns the results of wasmd tendermint [query] func (f *Fixtures) GDTendermint(query string) string { cmd := fmt.Sprintf("%s tendermint %s --home=%s", f.GaiadBinary, query, f.GaiadHome) success, stdout, stderr := executeWriteRetStdStreams(f.T, cmd) @@ -253,40 +253,40 @@ func (f *Fixtures) GDTendermint(query string) string { return strings.TrimSpace(stdout) } -// ValidateGenesis runs gaiad validate-genesis +// ValidateGenesis runs wasmd validate-genesis func (f *Fixtures) ValidateGenesis() { cmd := fmt.Sprintf("%s validate-genesis --home=%s", f.GaiadBinary, f.GaiadHome) executeWriteCheckErr(f.T, cmd) } //___________________________________________________________________________________ -// gaiacli keys +// wasmcli keys -// KeysDelete is gaiacli keys delete +// KeysDelete is wasmcli keys delete func (f *Fixtures) KeysDelete(name string, flags ...string) { cmd := fmt.Sprintf("%s keys delete --home=%s %s", f.GaiacliBinary, f.GaiacliHome, name) executeWrite(f.T, addFlags(cmd, append(append(flags, "-y"), "-f"))) } -// KeysAdd is gaiacli keys add +// KeysAdd is wasmcli keys add func (f *Fixtures) KeysAdd(name string, flags ...string) { cmd := fmt.Sprintf("%s keys add --home=%s %s", f.GaiacliBinary, f.GaiacliHome, name) executeWriteCheckErr(f.T, addFlags(cmd, flags)) } -// KeysAddRecover prepares gaiacli keys add --recover +// KeysAddRecover prepares wasmcli keys add --recover 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.GaiacliBinary, f.GaiacliHome, name) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), mnemonic) } -// KeysAddRecoverHDPath prepares gaiacli keys add --recover --account --index +// KeysAddRecoverHDPath prepares wasmcli keys add --recover --account --index 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.GaiacliBinary, f.GaiacliHome, name, account, index) executeWriteCheckErr(f.T, addFlags(cmd, flags), mnemonic) } -// KeysShow is gaiacli keys show +// KeysShow is wasmcli keys show func (f *Fixtures) KeysShow(name string, flags ...string) keys.KeyOutput { cmd := fmt.Sprintf("%s keys show --home=%s %s", f.GaiacliBinary, f.GaiacliHome, name) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") @@ -305,42 +305,42 @@ func (f *Fixtures) KeyAddress(name string) sdk.AccAddress { } //___________________________________________________________________________________ -// gaiacli config +// wasmcli config -// CLIConfig is gaiacli config +// CLIConfig is wasmcli config func (f *Fixtures) CLIConfig(key, value string, flags ...string) { cmd := fmt.Sprintf("%s config --home=%s %s %s", f.GaiacliBinary, f.GaiacliHome, key, value) executeWriteCheckErr(f.T, addFlags(cmd, flags)) } //___________________________________________________________________________________ -// gaiacli tx send/sign/broadcast +// wasmcli tx send/sign/broadcast -// TxSend is gaiacli tx send +// TxSend is wasmcli tx send 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 %s %v", f.GaiacliBinary, from, to, amount, f.Flags()) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } -// TxSign is gaiacli tx sign +// TxSign is wasmcli tx sign func (f *Fixtures) TxSign(signer, fileName string, flags ...string) (bool, string, string) { cmd := fmt.Sprintf("%s tx sign %v --from=%s %v", f.GaiacliBinary, f.Flags(), signer, fileName) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } -// TxBroadcast is gaiacli tx broadcast +// TxBroadcast is wasmcli tx broadcast func (f *Fixtures) TxBroadcast(fileName string, flags ...string) (bool, string, string) { cmd := fmt.Sprintf("%s tx broadcast %v %v", f.GaiacliBinary, f.Flags(), fileName) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } -// TxEncode is gaiacli tx encode +// TxEncode is wasmcli tx encode func (f *Fixtures) TxEncode(fileName string, flags ...string) (bool, string, string) { cmd := fmt.Sprintf("%s tx encode %v %v", f.GaiacliBinary, f.Flags(), fileName) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } -// TxMultisign is gaiacli tx multisign +// TxMultisign is wasmcli tx multisign func (f *Fixtures) TxMultisign(fileName, name string, signaturesFiles []string, flags ...string) (bool, string, string) { @@ -351,9 +351,9 @@ func (f *Fixtures) TxMultisign(fileName, name string, signaturesFiles []string, } //___________________________________________________________________________________ -// gaiacli tx staking +// wasmcli tx staking -// TxStakingCreateValidator is gaiacli tx staking create-validator +// TxStakingCreateValidator is wasmcli tx staking create-validator 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.GaiacliBinary, f.Flags(), from, consPubKey) cmd += fmt.Sprintf(" --amount=%v --moniker=%v --commission-rate=%v", amount, from, "0.05") @@ -362,29 +362,29 @@ func (f *Fixtures) TxStakingCreateValidator(from, consPubKey string, amount sdk. return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } -// TxStakingUnbond is gaiacli tx staking unbond +// TxStakingUnbond is wasmcli tx staking unbond 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.GaiacliBinary, validator, shares, from, f.Flags()) return executeWrite(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } //___________________________________________________________________________________ -// gaiacli tx gov +// wasmcli tx gov -// TxGovSubmitProposal is gaiacli tx gov submit-proposal +// TxGovSubmitProposal is wasmcli tx gov submit-proposal 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.GaiacliBinary, f.Flags(), from, typ) cmd += fmt.Sprintf(" --title=%s --description=%s --deposit=%s", title, description, deposit) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } -// TxGovDeposit is gaiacli tx gov deposit +// TxGovDeposit is wasmcli tx gov deposit 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.GaiacliBinary, proposalID, amount, from, f.Flags()) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } -// TxGovVote is gaiacli tx gov vote +// TxGovVote is wasmcli tx gov vote 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.GaiacliBinary, proposalID, option, from, f.Flags()) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) @@ -419,9 +419,9 @@ func (f *Fixtures) TxGovSubmitCommunityPoolSpendProposal( } //___________________________________________________________________________________ -// gaiacli query account +// wasmcli query account -// QueryAccount is gaiacli query account +// QueryAccount is wasmcli query account func (f *Fixtures) QueryAccount(address sdk.AccAddress, flags ...string) auth.BaseAccount { cmd := fmt.Sprintf("%s query account %s %v", f.GaiacliBinary, address, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") @@ -438,9 +438,9 @@ func (f *Fixtures) QueryAccount(address sdk.AccAddress, flags ...string) auth.Ba } //___________________________________________________________________________________ -// gaiacli query txs +// wasmcli query txs -// QueryTxs is gaiacli query txs +// QueryTxs is wasmcli query txs 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.GaiacliBinary, page, limit, queryTags(tags), f.Flags()) out, _ := tests.ExecuteT(f.T, cmd, "") @@ -459,9 +459,9 @@ func (f *Fixtures) QueryTxsInvalid(expectedErr error, page, limit int, tags ...s } //___________________________________________________________________________________ -// gaiacli query staking +// wasmcli query staking -// QueryStakingValidator is gaiacli query staking validator +// QueryStakingValidator is wasmcli query staking validator func (f *Fixtures) QueryStakingValidator(valAddr sdk.ValAddress, flags ...string) staking.Validator { cmd := fmt.Sprintf("%s query staking validator %s %v", f.GaiacliBinary, valAddr, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") @@ -472,7 +472,7 @@ func (f *Fixtures) QueryStakingValidator(valAddr sdk.ValAddress, flags ...string return validator } -// QueryStakingUnbondingDelegationsFrom is gaiacli query staking unbonding-delegations-from +// QueryStakingUnbondingDelegationsFrom is wasmcli query staking unbonding-delegations-from func (f *Fixtures) QueryStakingUnbondingDelegationsFrom(valAddr sdk.ValAddress, flags ...string) []staking.UnbondingDelegation { cmd := fmt.Sprintf("%s query staking unbonding-delegations-from %s %v", f.GaiacliBinary, valAddr, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") @@ -483,7 +483,7 @@ func (f *Fixtures) QueryStakingUnbondingDelegationsFrom(valAddr sdk.ValAddress, return ubds } -// QueryStakingDelegationsTo is gaiacli query staking delegations-to +// QueryStakingDelegationsTo is wasmcli query staking delegations-to func (f *Fixtures) QueryStakingDelegationsTo(valAddr sdk.ValAddress, flags ...string) []staking.Delegation { cmd := fmt.Sprintf("%s query staking delegations-to %s %v", f.GaiacliBinary, valAddr, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") @@ -494,7 +494,7 @@ func (f *Fixtures) QueryStakingDelegationsTo(valAddr sdk.ValAddress, flags ...st return delegations } -// QueryStakingPool is gaiacli query staking pool +// QueryStakingPool is wasmcli query staking pool func (f *Fixtures) QueryStakingPool(flags ...string) staking.Pool { cmd := fmt.Sprintf("%s query staking pool %v", f.GaiacliBinary, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") @@ -505,7 +505,7 @@ func (f *Fixtures) QueryStakingPool(flags ...string) staking.Pool { return pool } -// QueryStakingParameters is gaiacli query staking parameters +// QueryStakingParameters is wasmcli query staking parameters func (f *Fixtures) QueryStakingParameters(flags ...string) staking.Params { cmd := fmt.Sprintf("%s query staking params %v", f.GaiacliBinary, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") @@ -517,9 +517,9 @@ func (f *Fixtures) QueryStakingParameters(flags ...string) staking.Params { } //___________________________________________________________________________________ -// gaiacli query gov +// wasmcli query gov -// QueryGovParamDeposit is gaiacli query gov param deposit +// QueryGovParamDeposit is wasmcli query gov param deposit func (f *Fixtures) QueryGovParamDeposit() gov.DepositParams { cmd := fmt.Sprintf("%s query gov param deposit %s", f.GaiacliBinary, f.Flags()) out, _ := tests.ExecuteT(f.T, cmd, "") @@ -530,7 +530,7 @@ func (f *Fixtures) QueryGovParamDeposit() gov.DepositParams { return depositParam } -// QueryGovParamVoting is gaiacli query gov param voting +// QueryGovParamVoting is wasmcli query gov param voting func (f *Fixtures) QueryGovParamVoting() gov.VotingParams { cmd := fmt.Sprintf("%s query gov param voting %s", f.GaiacliBinary, f.Flags()) out, _ := tests.ExecuteT(f.T, cmd, "") @@ -541,7 +541,7 @@ func (f *Fixtures) QueryGovParamVoting() gov.VotingParams { return votingParam } -// QueryGovParamTallying is gaiacli query gov param tallying +// QueryGovParamTallying is wasmcli query gov param tallying func (f *Fixtures) QueryGovParamTallying() gov.TallyParams { cmd := fmt.Sprintf("%s query gov param tallying %s", f.GaiacliBinary, f.Flags()) out, _ := tests.ExecuteT(f.T, cmd, "") @@ -552,7 +552,7 @@ func (f *Fixtures) QueryGovParamTallying() gov.TallyParams { return tallyingParam } -// QueryGovProposals is gaiacli query gov proposals +// QueryGovProposals is wasmcli query gov proposals func (f *Fixtures) QueryGovProposals(flags ...string) gov.Proposals { cmd := fmt.Sprintf("%s query gov proposals %v", f.GaiacliBinary, f.Flags()) stdout, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), "") @@ -567,7 +567,7 @@ func (f *Fixtures) QueryGovProposals(flags ...string) gov.Proposals { return out } -// QueryGovProposal is gaiacli query gov proposal +// QueryGovProposal is wasmcli query gov proposal func (f *Fixtures) QueryGovProposal(proposalID int, flags ...string) gov.Proposal { cmd := fmt.Sprintf("%s query gov proposal %d %v", f.GaiacliBinary, proposalID, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") @@ -578,7 +578,7 @@ func (f *Fixtures) QueryGovProposal(proposalID int, flags ...string) gov.Proposa return proposal } -// QueryGovVote is gaiacli query gov vote +// QueryGovVote is wasmcli query 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.GaiacliBinary, proposalID, voter, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") @@ -589,7 +589,7 @@ func (f *Fixtures) QueryGovVote(proposalID int, voter sdk.AccAddress, flags ...s return vote } -// QueryGovVotes is gaiacli query gov votes +// QueryGovVotes is wasmcli query gov votes func (f *Fixtures) QueryGovVotes(proposalID int, flags ...string) []gov.Vote { cmd := fmt.Sprintf("%s query gov votes %d %v", f.GaiacliBinary, proposalID, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") @@ -600,7 +600,7 @@ func (f *Fixtures) QueryGovVotes(proposalID int, flags ...string) []gov.Vote { return votes } -// QueryGovDeposit is gaiacli query gov deposit +// QueryGovDeposit is wasmcli query 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.GaiacliBinary, proposalID, depositor, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") @@ -611,7 +611,7 @@ func (f *Fixtures) QueryGovDeposit(proposalID int, depositor sdk.AccAddress, fla return deposit } -// QueryGovDeposits is gaiacli query gov deposits +// QueryGovDeposits is wasmcli query gov deposits func (f *Fixtures) QueryGovDeposits(propsalID int, flags ...string) []gov.Deposit { cmd := fmt.Sprintf("%s query gov deposits %d %v", f.GaiacliBinary, propsalID, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") @@ -637,7 +637,7 @@ func (f *Fixtures) QuerySigningInfo(val string) slashing.ValidatorSigningInfo { return sinfo } -// QuerySlashingParams is gaiacli query slashing params +// QuerySlashingParams is wasmcli query slashing params func (f *Fixtures) QuerySlashingParams() slashing.Params { cmd := fmt.Sprintf("%s query slashing params %s", f.GaiacliBinary, f.Flags()) res, errStr := tests.ExecuteT(f.T, cmd, "") diff --git a/cmd/wasmd/testnet.go b/cmd/wasmd/testnet.go index 28760e85be..997ab2e0eb 100644 --- a/cmd/wasmd/testnet.go +++ b/cmd/wasmd/testnet.go @@ -55,7 +55,7 @@ necessary files (private validator, genesis, config, etc.). Note, strict routability for addresses is turned off in the config file. Example: - gaiad testnet --v 4 --output-dir ./output --starting-ip-address 192.168.10.2 + wasmd testnet --v 4 --output-dir ./output --starting-ip-address 192.168.10.2 `, RunE: func(cmd *cobra.Command, _ []string) error { config := ctx.Config @@ -223,7 +223,7 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, // TODO: Rename config file to server.toml as it's not particular to Gaia // (REF: https://github.com/cosmos/cosmos-sdk/issues/4125). - wasmConfigFilePath := filepath.Join(nodeDir, "config/gaiad.toml") + wasmConfigFilePath := filepath.Join(nodeDir, "config/wasmd.toml") srvconfig.WriteConfigFile(wasmConfigFilePath, wasmConfig) } diff --git a/contrib/gitian-build.sh b/contrib/gitian-build.sh index 2e0516b082..f97a9d6937 100755 --- a/contrib/gitian-build.sh +++ b/contrib/gitian-build.sh @@ -18,7 +18,7 @@ DEFAULT_SIGN_COMMAND='gpg --detach-sign' DEFAULT_GAIA_SIGS=${GAIA_SIGS:-'gaia.sigs'} DEFAULT_GITIAN_REPO='https://github.com/tendermint/gitian-builder' DEFAULT_GBUILD_FLAGS='' -DEFAULT_SIGS_REPO='https://github.com/cosmos/gaia.sigs' +DEFAULT_SIGS_REPO='https://github.com/cosmwasm/wasmd.sigs' # Overrides diff --git a/contrib/gitian-descriptors/gitian-darwin.yml b/contrib/gitian-descriptors/gitian-darwin.yml index e7f81a2ce8..133a20336b 100644 --- a/contrib/gitian-descriptors/gitian-darwin.yml +++ b/contrib/gitian-descriptors/gitian-darwin.yml @@ -20,7 +20,7 @@ packages: - "xxd" - "quilt" remotes: -- "url": "https://github.com/cosmos/gaia.git" +- "url": "https://github.com/cosmwasm/wasmd.git" "dir": "gaia" files: - "go1.13.3.linux-amd64.tar.gz" @@ -65,7 +65,7 @@ script: | popd # Prepare GOPATH and install deps - distsrc=${GOPATH}/src/github.com/cosmos/gaia + distsrc=${GOPATH}/src/github.com/cosmwasm/wasmd mkdir -p ${distsrc} pushd ${distsrc} tar --strip-components=1 -xf $SOURCEDIST @@ -75,8 +75,8 @@ script: | # Configure LDFLAGS for reproducible builds LDFLAGS="-extldflags=-static -buildid=${VERSION} -s -w \ -X github.com/cosmos/cosmos-sdk/version.Name=gaia \ - -X github.com/cosmos/cosmos-sdk/version.ServerName=gaiad \ - -X github.com/cosmos/cosmos-sdk/version.ClientName=gaiacli \ + -X github.com/cosmos/cosmos-sdk/version.ServerName=wasmd \ + -X github.com/cosmos/cosmos-sdk/version.ClientName=wasmcli \ -X github.com/cosmos/cosmos-sdk/version.Version=${VERSION} \ -X github.com/cosmos/cosmos-sdk/version.Commit=${COMMIT} \ -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger" @@ -88,7 +88,7 @@ script: | # Build gaia tool suite pushd ${distsrc} - for prog in gaiacli gaiad; do + for prog in wasmcli wasmd; do GOARCH=${arch} GOROOT_FINAL=${GOROOT} go build -a \ -trimpath \ -gcflags=all=-trimpath=${GOPATH} \ diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 10e1c926e4..b8306b67d3 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -20,7 +20,7 @@ packages: - "xxd" - "quilt" remotes: -- "url": "https://github.com/cosmos/gaia.git" +- "url": "https://github.com/cosmwasm/wasmd.git" "dir": "gaia" files: - "go1.13.3.linux-amd64.tar.gz" @@ -64,7 +64,7 @@ script: | popd # Prepare GOPATH and install deps - distsrc=${GOPATH}/src/github.com/cosmos/gaia + distsrc=${GOPATH}/src/github.com/cosmwasm/wasmd mkdir -p ${distsrc} pushd ${distsrc} tar --strip-components=1 -xf $SOURCEDIST @@ -74,8 +74,8 @@ script: | # Configure LDFLAGS for reproducible builds LDFLAGS="-extldflags=-static -buildid=${VERSION} -s -w \ -X github.com/cosmos/cosmos-sdk/version.Name=gaia \ - -X github.com/cosmos/cosmos-sdk/version.ServerName=gaiad \ - -X github.com/cosmos/cosmos-sdk/version.ClientName=gaiacli \ + -X github.com/cosmos/cosmos-sdk/version.ServerName=wasmd \ + -X github.com/cosmos/cosmos-sdk/version.ClientName=wasmcli \ -X github.com/cosmos/cosmos-sdk/version.Version=${VERSION} \ -X github.com/cosmos/cosmos-sdk/version.Commit=${COMMIT} \ -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger" @@ -87,7 +87,7 @@ script: | # Build gaia tool suite pushd ${distsrc} - for prog in gaiacli gaiad; do + for prog in wasmcli wasmd; do GOARCH=${arch} GOROOT_FINAL=${GOROOT} go build -a \ -trimpath \ -gcflags=all=-trimpath=${GOPATH} \ diff --git a/contrib/gitian-descriptors/gitian-windows.yml b/contrib/gitian-descriptors/gitian-windows.yml index 3841ad6e53..ada6fb69ad 100644 --- a/contrib/gitian-descriptors/gitian-windows.yml +++ b/contrib/gitian-descriptors/gitian-windows.yml @@ -20,7 +20,7 @@ packages: - "xxd" - "quilt" remotes: -- "url": "https://github.com/cosmos/gaia.git" +- "url": "https://github.com/cosmwasm/wasmd.git" "dir": "gaia" files: - "go1.13.3.linux-amd64.tar.gz" @@ -65,7 +65,7 @@ script: | popd # Prepare GOPATH and install deps - distsrc=${GOPATH}/src/github.com/cosmos/gaia + distsrc=${GOPATH}/src/github.com/cosmwasm/wasmd mkdir -p ${distsrc} pushd ${distsrc} tar --strip-components=1 -xf $SOURCEDIST @@ -75,8 +75,8 @@ script: | # Configure LDFLAGS for reproducible builds LDFLAGS="-extldflags=-static -buildid=${VERSION} -s -w \ -X github.com/cosmos/cosmos-sdk/version.Name=gaia \ - -X github.com/cosmos/cosmos-sdk/version.ServerName=gaiad \ - -X github.com/cosmos/cosmos-sdk/version.ClientName=gaiacli \ + -X github.com/cosmos/cosmos-sdk/version.ServerName=wasmd \ + -X github.com/cosmos/cosmos-sdk/version.ClientName=wasmcli \ -X github.com/cosmos/cosmos-sdk/version.Version=${VERSION} \ -X github.com/cosmos/cosmos-sdk/version.Commit=${COMMIT} \ -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger" @@ -88,7 +88,7 @@ script: | # Build gaia tool suite pushd ${distsrc} - for prog in gaiacli gaiad; do + for prog in wasmcli wasmd; do exe=${prog}.exe GOARCH=${arch} GOROOT_FINAL=${GOROOT} go build -a \ -trimpath \ diff --git a/docker-compose.yml b/docker-compose.yml index a0001416e2..b90c9dff65 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,58 +1,58 @@ version: '3' services: - gaiadnode0: - container_name: gaiadnode0 - image: "tendermint/gaiadnode" + wasmdnode0: + container_name: wasmdnode0 + image: "tendermint/wasmdnode" ports: - "26656-26657:26656-26657" environment: - ID=0 - - LOG=${LOG:-gaiad.log} + - LOG=${LOG:-wasmd.log} volumes: - - ./build:/gaiad:Z + - ./build:/wasmd:Z networks: localnet: ipv4_address: 192.168.10.2 - gaiadnode1: - container_name: gaiadnode1 - image: "tendermint/gaiadnode" + wasmdnode1: + container_name: wasmdnode1 + image: "tendermint/wasmdnode" ports: - "26659-26660:26656-26657" environment: - ID=1 - - LOG=${LOG:-gaiad.log} + - LOG=${LOG:-wasmd.log} volumes: - - ./build:/gaiad:Z + - ./build:/wasmd:Z networks: localnet: ipv4_address: 192.168.10.3 - gaiadnode2: - container_name: gaiadnode2 - image: "tendermint/gaiadnode" + wasmdnode2: + container_name: wasmdnode2 + image: "tendermint/wasmdnode" environment: - ID=2 - - LOG=${LOG:-gaiad.log} + - LOG=${LOG:-wasmd.log} ports: - "26661-26662:26656-26657" volumes: - - ./build:/gaiad:Z + - ./build:/wasmd:Z networks: localnet: ipv4_address: 192.168.10.4 - gaiadnode3: - container_name: gaiadnode3 - image: "tendermint/gaiadnode" + wasmdnode3: + container_name: wasmdnode3 + image: "tendermint/wasmdnode" environment: - ID=3 - - LOG=${LOG:-gaiad.log} + - LOG=${LOG:-wasmd.log} ports: - "26663-26664:26656-26657" volumes: - - ./build:/gaiad:Z + - ./build:/wasmd:Z networks: localnet: ipv4_address: 192.168.10.5 diff --git a/docs/DOCS_README.md b/docs/DOCS_README.md index 505a3b7897..bf049bed43 100644 --- a/docs/DOCS_README.md +++ b/docs/DOCS_README.md @@ -1,6 +1,6 @@ # Updating the docs -If you want to open a PR on Gaia to update the documentation, please follow the guidelines in the [`CONTRIBUTING.md`](https://github.com/cosmos/gaia/tree/master/CONTRIBUTING.md) +If you want to open a PR on Gaia to update the documentation, please follow the guidelines in the [`CONTRIBUTING.md`](https://github.com/cosmwasm/wasmd/tree/master/CONTRIBUTING.md) ## Docs Build Workflow @@ -8,7 +8,7 @@ The documentation for Gaia is hosted at: - https://hub.cosmos.network/docs/ -built from the files in this (`/docs`) directory for [master](https://github.com/cosmos/gaia/tree/master/docs) +built from the files in this (`/docs`) directory for [master](https://github.com/cosmwasm/wasmd/tree/master/docs) ### How It Works @@ -94,7 +94,7 @@ then navigate to localhost:8080 in your browser. First, run `make tools` from the root of repo, to install the swagger-ui tool. -Then, edit the `swagger.yaml` manually; it is found [here](https://github.com/cosmos/gaia/blob/master/cmd/gaiacli/swagger-ui/swagger.yaml) +Then, edit the `swagger.yaml` manually; it is found [here](https://github.com/cosmwasm/wasmd/blob/master/cmd/wasmcli/swagger-ui/swagger.yaml) Finally, run `make update-gaia-lite-docs` from the root of the repo. @@ -114,10 +114,10 @@ much as possible with its [counterpart in the Tendermint Core repo](https://gith make tools ``` 2. Edit API docs - 1. Directly Edit API docs manually: `cmd/gaiacli/swagger-ui/swagger.yaml`. + 1. Directly Edit API docs manually: `cmd/wasmcli/swagger-ui/swagger.yaml`. 2. Edit API docs within the [Swagger Editor](https://editor.swagger.io/). Please refer to this [document](https://swagger.io/docs/specification/2-0/basic-structure/) for the correct structure in `.yaml`. -3. Download `swagger.yaml` and replace the old `swagger.yaml` under fold `cmd/gaiacli/swagger-ui`. -4. Compile gaiacli +3. Download `swagger.yaml` and replace the old `swagger.yaml` under fold `cmd/wasmcli/swagger-ui`. +4. Compile wasmcli ```bash make install ``` diff --git a/docs/README.md b/docs/README.md index 518e1450e8..e69e25ffef 100644 --- a/docs/README.md +++ b/docs/README.md @@ -29,7 +29,7 @@ Welcome to the documentation of the **Cosmos Hub application: `gaia`**. # Contribute -See [this file](https://github.com/cosmos/gaia/blob/master/docs/DOCS_README.md) for details of the build process and +See [this file](https://github.com/cosmwasm/wasmd/blob/master/docs/DOCS_README.md) for details of the build process and considerations when making changes. # Version diff --git a/docs/delegator-guide-cli.md b/docs/delegator-guide-cli.md index f1964a8217..766bf04044 100644 --- a/docs/delegator-guide-cli.md +++ b/docs/delegator-guide-cli.md @@ -29,14 +29,14 @@ Please exercise extreme caution! ## Table of Contents -- [Installing `gaiacli`](#installing-gaiacli) +- [Installing `wasmcli`](#installing-wasmcli) - [Cosmos Accounts](#cosmos-accounts) + [Restoring an Account from the Fundraiser](#restoring-an-account-from-the-fundraiser) + [Creating an Account](#creating-an-account) - [Accessing the Cosmos Hub Network](#accessing-the-cosmos-hub-network) + [Running Your Own Full-Node](#running-your-own-full-node) + [Connecting to a Remote Full-Node](#connecting-to-a-remote-full-node) -- [Setting Up `gaiacli`](#setting-up-gaiacli) +- [Setting Up `wasmcli`](#setting-up-wasmcli) - [Querying the State](#querying-the-state) - [Sending Transactions](#sending-transactions) + [A Note on Gas and Fees](#a-note-on-gas-and-fees) @@ -44,12 +44,12 @@ Please exercise extreme caution! + [Participating in Governance](#participating-in-governance) + [Signing Transactions from an Offline Computer](#signing-transactions-from-an-offline-computer) -## Installing `gaiacli` +## Installing `wasmcli` -`gaiacli`: This is the command-line interface to interact with a `gaiad` full-node. +`wasmcli`: This is the command-line interface to interact with a `wasmd` full-node. ::: warning -**Please check that you download the latest stable release of `gaiacli` that is available** +**Please check that you download the latest stable release of `wasmcli` that is available** ::: [**Download the binaries**] @@ -58,7 +58,7 @@ Not available yet. [**Install from source**](https://cosmos.network/docs/cosmos-hub/installation.html) ::: tip -`gaiacli` is used from a terminal. To open the terminal, follow these steps: +`wasmcli` is used from a terminal. To open the terminal, follow these steps: - **Windows**: `Start` > `All Programs` > `Accessories` > `Command Prompt` - **MacOS**: `Finder` > `Applications` > `Utilities` > `Terminal` - **Linux**: `Ctrl` + `Alt` + `T` @@ -147,7 +147,7 @@ Next, click [here](#using-a-ledger-device) to learn how to generate an account. To restore an account using a fundraiser mnemonic and store the associated encrypted private key on a computer, use the following command: ```bash -gaiacli keys add --recover +wasmcli keys add --recover ``` - `` is the name of the account. It is a reference to the account number used to derive the key pair from the mnemonic. You will use this name to identify your account when you want to send a transaction. @@ -166,7 +166,7 @@ store security policies please refer to your operating system manual.** ### Creating an Account -To create an account, you just need to have `gaiacli` installed. Before creating it, you need to know where you intend to store and interact with your private keys. The best options are to store them in an offline dedicated computer or a ledger device. Storing them on your regular online computer involves more risk, since anyone who infiltrates your computer through the internet could exfiltrate your private keys and steal your funds. +To create an account, you just need to have `wasmcli` installed. Before creating it, you need to know where you intend to store and interact with your private keys. The best options are to store them in an offline dedicated computer or a ledger device. Storing them on your regular online computer involves more risk, since anyone who infiltrates your computer through the internet could exfiltrate your private keys and steal your funds. #### Using a Ledger Device @@ -174,7 +174,7 @@ To create an account, you just need to have `gaiacli` installed. Before creating **Only use Ledger devices that you bought factory new or trust fully** ::: -When you initialize your ledger, a 24-word mnemonic is generated and stored in the device. This mnemonic is compatible with Cosmos and Cosmos accounts can be derived from it. Therefore, all you have to do is make your ledger compatible with `gaiacli`. To do so, you need to go through the following steps: +When you initialize your ledger, a 24-word mnemonic is generated and stored in the device. This mnemonic is compatible with Cosmos and Cosmos accounts can be derived from it. Therefore, all you have to do is make your ledger compatible with `wasmcli`. To do so, you need to go through the following steps: 1. Download the Ledger Live app [here](https://www.ledger.com/pages/ledger-live). 2. Connect your ledger via USB and update to the latest firmware @@ -184,7 +184,7 @@ When you initialize your ledger, a 24-word mnemonic is generated and stored in t Then, to create an account, use the following command: ```bash -gaiacli keys add --ledger +wasmcli keys add --ledger ``` ::: warning @@ -203,7 +203,7 @@ gaiacli keys add --ledger To generate an account, just use the following command: ```bash -gaiacli keys add +wasmcli keys add ``` The command will generate a 24-words mnemonic and save the private and public keys for account `0` @@ -238,7 +238,7 @@ rm ~/.bash_history You can generate more accounts from the same mnemonic using the following command: ```bash -gaiacli keys add --recover --account 1 +wasmcli keys add --recover --account 1 ``` This command will prompt you to input a passphrase as well as your mnemonic. Change the account number to generate a different account. @@ -256,30 +256,30 @@ In order to query the state and send transactions, you need a way to access the This is the most secure option, but comes with relatively high resource requirements. In order to run your own full-node, you need good bandwidth and at least 1TB of disk space. -You will find the tutorial on how to install `gaiad` [here](https://cosmos.network/docs/cosmos-hub/installation.html), and the guide to run a full-node [here](https://cosmos.network/docs/cosmos-hub/join-mainnet.html). +You will find the tutorial on how to install `wasmd` [here](https://cosmos.network/docs/cosmos-hub/installation.html), and the guide to run a full-node [here](https://cosmos.network/docs/cosmos-hub/join-mainnet.html). ### Connecting to a Remote Full-Node If you do not want or cannot run your own node, you can connect to someone else's full-node. You should pick an operator you trust, because a malicious operator could return incorrect query results or censor your transactions. However, they will never be able to steal your funds, as your private keys are stored locally on your computer or ledger device. Possible options of full-node operators include validators, wallet providers or exchanges. -In order to connect to the full-node, you will need an address of the following form: `https://77.87.106.33:26657` (*Note: This is a placeholder*). This address has to be communicated by the full-node operator you choose to trust. You will use this address in the [following section](#setting-up-gaiacli). +In order to connect to the full-node, you will need an address of the following form: `https://77.87.106.33:26657` (*Note: This is a placeholder*). This address has to be communicated by the full-node operator you choose to trust. You will use this address in the [following section](#setting-up-wasmcli). -## Setting Up `gaiacli` +## Setting Up `wasmcli` ::: tip -**Before setting up `gaiacli`, make sure you have set up a way to [access the Cosmos Hub network](#accessing-the-cosmos-hub-network)** +**Before setting up `wasmcli`, make sure you have set up a way to [access the Cosmos Hub network](#accessing-the-cosmos-hub-network)** ::: ::: warning -**Please check that you are always using the latest stable release of `gaiacli`** +**Please check that you are always using the latest stable release of `wasmcli`** ::: -`gaiacli` is the tool that enables you to interact with the node that runs on the Cosmos Hub network, whether you run it yourself or not. Let us set it up properly. +`wasmcli` is the tool that enables you to interact with the node that runs on the Cosmos Hub network, whether you run it yourself or not. Let us set it up properly. -In order to set up `gaiacli`, use the following command: +In order to set up `wasmcli`, use the following command: ```bash -gaiacli config +wasmcli config ``` It allows you to set a default value for each given flag. @@ -287,9 +287,9 @@ It allows you to set a default value for each given flag. First, set up the address of the full-node you want to connect to: ```bash -gaiacli config node :: +wasmcli query account // query the list of validators -gaiacli query staking validators +wasmcli query staking validators // query the information of a validator given their address (e.g. cosmosvaloper1n5pepvmgsfd3p2tqqgvt505jvymmstf6s9gw27) -gaiacli query staking validator +wasmcli query staking validator // query all delegations made from a delegator given their address (e.g. cosmos10snjt8dmpr5my0h76xj48ty80uzwhraqalu4eg) -gaiacli query staking delegations +wasmcli query staking delegations // query a specific delegation made from a delegator (e.g. cosmos10snjt8dmpr5my0h76xj48ty80uzwhraqalu4eg) to a validator (e.g. cosmosvaloper1n5pepvmgsfd3p2tqqgvt505jvymmstf6s9gw27) given their addresses -gaiacli query staking delegation +wasmcli query staking delegation // query the rewards of a delegator given a delegator address (e.g. cosmos10snjt8dmpr5my0h76xj48ty80uzwhraqalu4eg) -gaiacli query distribution rewards +wasmcli query distribution rewards // query all proposals currently open for depositing -gaiacli query gov proposals --status deposit_period +wasmcli query gov proposals --status deposit_period // query all proposals currently open for voting -gaiacli query gov proposals --status voting_period +wasmcli query gov proposals --status voting_period // query a proposal given its proposalID -gaiacli query gov proposal +wasmcli query gov proposal ``` For more commands, just type: ```bash -gaiacli query +wasmcli query ``` For each command, you can use the `-h` or `--help` flag to get more information. @@ -380,7 +380,7 @@ For mainnet, the recommended `gas-prices` is `0.025uatom`. ### Sending Tokens ::: tip -**Before you can bond atoms and withdraw rewards, you need to [set up `gaiacli`](#setting-up-gaiacli) and [create an account](#creating-an-account)** +**Before you can bond atoms and withdraw rewards, you need to [set up `wasmcli`](#setting-up-wasmcli) and [create an account](#creating-an-account)** ::: ::: warning @@ -392,13 +392,13 @@ For mainnet, the recommended `gas-prices` is `0.025uatom`. // Ex value for parameters (do not actually use these values in your tx!!): =cosmos16m93fezfiezhvnjajzrfyszml8qm92a0w67ntjhd3d0 =1000000uatom // Ex value for flags: =0.025uatom -gaiacli tx send --from --gas auto --gas-adjustment 1.5 --gas-prices +wasmcli tx send --from --gas auto --gas-adjustment 1.5 --gas-prices ``` ### Bonding Atoms and Withdrawing Rewards ::: tip -**Before you can bond atoms and withdraw rewards, you need to [set up `gaiacli`](#setting-up-gaiacli) and [create an account](#creating-an-account)** +**Before you can bond atoms and withdraw rewards, you need to [set up `wasmcli`](#setting-up-wasmcli) and [create an account](#creating-an-account)** ::: ::: warning @@ -413,7 +413,7 @@ gaiacli tx send --from --gas auto --gas-adju // Bond a certain amount of Atoms to a given validator // ex value for flags: =cosmosvaloper18thamkhnj9wz8pa4nhnp9rldprgant57pk2m8s, =10000000uatom, =0.025uatom -gaiacli tx staking delegate --from --gas auto --gas-adjustment 1.5 --gas-prices +wasmcli tx staking delegate --from --gas auto --gas-adjustment 1.5 --gas-prices // Redelegate a certain amount of Atoms from a validator to another @@ -422,19 +422,19 @@ gaiacli tx staking delegate --from =cosmosvaloper18thamkhnj9wz8pa4nhnp9rldprgant57pk2m8s, =100000000uatom, =0.025uatom -gaiacli tx staking redelegate --from --gas auto --gas-adjustment 1.5 --gas-prices +wasmcli tx staking redelegate --from --gas auto --gas-adjustment 1.5 --gas-prices // Withdraw all rewards // ex value for flag: =0.025uatom -gaiacli tx distribution withdraw-all-rewards --from --gas auto --gas-adjustment 1.5 --gas-prices +wasmcli tx distribution withdraw-all-rewards --from --gas auto --gas-adjustment 1.5 --gas-prices // Unbond a certain amount of Atoms from a given validator // You will have to wait 3 weeks before your Atoms are fully unbonded and transferrable // ex value for flags: =cosmosvaloper18thamkhnj9wz8pa4nhnp9rldprgant57pk2m8s, =10000000uatom, =0.025uatom -gaiacli tx staking unbond --from --gas auto --gas-adjustment 1.5 --gas-prices +wasmcli tx staking unbond --from --gas auto --gas-adjustment 1.5 --gas-prices ``` ::: warning @@ -445,14 +445,14 @@ To confirm that your transaction went through, you can use the following queries ```bash // your balance should change after you bond Atoms or withdraw rewards -gaiacli query account +wasmcli query account // you should have delegations after you bond Atom -gaiacli query staking delegations +wasmcli query staking delegations // this returns your tx if it has been included // use the tx hash that was displayed when you created the tx -gaiacli query tx +wasmcli query tx ``` @@ -489,19 +489,19 @@ At the end of the voting period, the proposal is accepted if there are more than // =text/parameter_change/software_upgrade // ex value for flag: =0.025uatom -gaiacli tx gov submit-proposal --title "Test Proposal" --description "My awesome proposal" --type --deposit=10000000uatom --gas auto --gas-adjustment 1.5 --gas-prices --from +wasmcli tx gov submit-proposal --title "Test Proposal" --description "My awesome proposal" --type --deposit=10000000uatom --gas auto --gas-adjustment 1.5 --gas-prices --from // Increase deposit of a proposal -// Retrieve proposalID from $gaiacli query gov proposals --status deposit_period +// Retrieve proposalID from $wasmcli query gov proposals --status deposit_period // ex value for parameter: =10000000uatom -gaiacli tx gov deposit --gas auto --gas-adjustment 1.5 --gas-prices --from +wasmcli tx gov deposit --gas auto --gas-adjustment 1.5 --gas-prices --from // Vote on a proposal -// Retrieve proposalID from $gaiacli query gov proposals --status voting_period +// Retrieve proposalID from $wasmcli query gov proposals --status voting_period //