From fa293f3a3ec5a7f018dee36bf54c9fff172d492a Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sun, 1 Jul 2018 12:13:24 -0400 Subject: [PATCH 01/13] update dep for tm v0.22.0 --- Gopkg.lock | 12 +++++++----- Gopkg.toml | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index c48188cb8d..f02a671164 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -241,7 +241,7 @@ "nfs", "xfs" ] - revision = "7d6f385de8bea29190f15ba9931442a0eaef9af7" + revision = "40f013a808ec4fa79def444a1a56de4d1727efcb" [[projects]] branch = "master" @@ -338,7 +338,8 @@ ".", "sha256truncated" ] - revision = "481b89cbbe6a641f7f6cb5db92b30b20f5a2e001" + revision = "2de525d09cca7c45c3f43d178817947a6cfa242c" + version = "v0.8.1" [[projects]] name = "github.com/tendermint/tendermint" @@ -387,7 +388,8 @@ "types", "version" ] - revision = "8412b75b1070ac023405e8228e017ed36531fe1b" + revision = "3a0dff7db2628c20cb0d77db3a01fea7981e5aec" + version = "v0.22.0-rc0" [[projects]] name = "github.com/tendermint/tmlibs" @@ -443,7 +445,7 @@ "netutil", "trace" ] - revision = "97aa3a539ec716117a9d15a4659a911f50d13c3c" + revision = "4cb1c02c05b0e749b0365f61ae859a8e0cfceed9" [[projects]] branch = "master" @@ -510,6 +512,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "578ae0e0126ffd04006b6755a02bc25c95e2eb2ecb4ea99869c4ada133f29f6b" + inputs-digest = "5db688e81022b54f18b174b151ccb66ab9a5b373008089422a5eea1147555f3e" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 85b15a019c..eedc0df761 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -58,11 +58,11 @@ [[constraint]] name = "github.com/tendermint/iavl" - revision = "481b89cbbe6a641f7f6cb5db92b30b20f5a2e001" + version = "=v0.8.1" [[constraint]] name = "github.com/tendermint/tendermint" - revision = "8412b75b1070ac023405e8228e017ed36531fe1b" + version = "=0.22.0-rc0" [[constraint]] name = "github.com/tendermint/tmlibs" From 7a14982901090f20c88a57db5ca0577f7b272adb Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sun, 1 Jul 2018 12:14:28 -0400 Subject: [PATCH 02/13] some changelog updates --- CHANGELOG.md | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b261e7d84b..23b7c89813 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,24 +5,24 @@ *TBD* BREAKING CHANGES -* Change default ports from 466xx to 266xx -* AltBytes renamed to Memo, now a string, max 100 characters, costs a bit of gas -* Transactions now take a list of Messages -* Signers of a transaction now only sign over their account and sequence number -* Removed MsgChangePubKey from auth -* Removed setPubKey from account mapper -* Removed GetMemo from Tx (it is still on StdTx) -* Keybase and Ledger support from go-crypto merged into the SDK in the `crypto` folder -* Gov module REST endpoints changed to be more RESTful -* [cli] rearranged commands under subcommands -* [stake] remove Tick and add EndBlocker -* [stake] introduce concept of unbonding for delegations and validators +* [config] Change default ports from 466xx to 266xx +* [auth] AltBytes renamed to Memo, now a string, max 100 characters, costs a bit of gas +* [types] GetMsg() -> GetMsgs() +* [auth] Signers of a transaction now only sign over their account and sequence number +* [auth] Removed MsgChangePubKey +* [auth] Removed SetPubKey from account mapper +* [types] Removed GetMemo from Tx (it is still on StdTx) +* [keys] Keybase and Ledger support from go-crypto merged into the SDK in the `crypto` folder +* [x/gov] Gov module REST endpoints changed to be more RESTful +* [cli] Rearranged commands under subcommands +* [stake] Remove Tick and add EndBlocker +* [stake] Introduce concept of unbonding for delegations and validators * `gaiacli stake unbond` replaced with `gaiacli stake begin-unbonding` - * introduced: + * Introduced: * `gaiacli stake complete-unbonding` * `gaiacli stake begin-redelegation` * `gaiacli stake complete-redelegation` -* [slashing] update slashing for unbonding period +* [slashing] Update slashing for unbonding period * Slash according to power at time of infraction instead of power at time of discovery * Iterate through unbonding delegations & redelegations which contributed @@ -62,7 +62,18 @@ FEATURES - Ledger keys can be named and tracked locally in the key DB * [gaiacli] added an --async flag to the cli to deliver transactions without waiting for a tendermint response -FIXES +IMPROVEMENTS +* bank module uses go-wire codec instead of 'encoding/json' +* auth module uses go-wire codec instead of 'encoding/json' +* revised use of endblock and beginblock +* [stake] module reorganized to include `types` and `keeper` package +* [stake] keeper always loads the store (instead passing around which doesn't really boost efficiency) +* [stake] edit-validator changes now can use the keyword [do-not-modify] to not modify unspecified `--flag` (aka won't set them to `""` value) +* [types] added common tag constants +* [stake] offload more generic functionality from the handler into the keeper +* added contributing guidelines + +BUG FIXES * [gaia] Added self delegation for validators in the genesis creation * [lcd] tests now don't depend on raw json text * [stake] error strings lower case @@ -78,17 +89,6 @@ FIXES * \#1258 - printing big.rat's can no longer overflow int64 * \#887 - limit the size of rationals that can be passed in from user input -IMPROVEMENTS -* bank module uses go-wire codec instead of 'encoding/json' -* auth module uses go-wire codec instead of 'encoding/json' -* revised use of endblock and beginblock -* [stake] module reorganized to include `types` and `keeper` package -* [stake] keeper always loads the store (instead passing around which doesn't really boost efficiency) -* [stake] edit-validator changes now can use the keyword [do-not-modify] to not modify unspecified `--flag` (aka won't set them to `""` value) -* [types] added common tag constants -* [stake] offload more generic functionality from the handler into the keeper -* added contributing guidelines - ## 0.19.0 *June 13, 2018* From 544454c3bdb411cf363cad6f705aee3fdf205e80 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sun, 1 Jul 2018 12:36:15 -0400 Subject: [PATCH 03/13] version --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index 4966455689..b9de4f9916 100644 --- a/version/version.go +++ b/version/version.go @@ -5,7 +5,7 @@ const Maj = "0" const Min = "20" const Fix = "0" -const Version = "0.20.0-dev" +const Version = "0.20.0" // GitCommit set by build flags var GitCommit = "" From dbabc2e79fdc7fc10fa47d57edbccc36eff3a193 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sun, 1 Jul 2018 12:56:31 -0400 Subject: [PATCH 04/13] update tendermint to fix stopping WAL --- Gopkg.lock | 6 +++--- Gopkg.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index f02a671164..92fe403aea 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -388,8 +388,8 @@ "types", "version" ] - revision = "3a0dff7db2628c20cb0d77db3a01fea7981e5aec" - version = "v0.22.0-rc0" + revision = "af703620d4423478968ab602716a2a51cbb02ac6" + version = "v0.22.0-rc1" [[projects]] name = "github.com/tendermint/tmlibs" @@ -512,6 +512,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "5db688e81022b54f18b174b151ccb66ab9a5b373008089422a5eea1147555f3e" + inputs-digest = "e625f9f13e5ca81fb8ecf6e794e0d1df87d8597a84af2abf70c057e20aa9b852" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index eedc0df761..a9bae1d06f 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -62,7 +62,7 @@ [[constraint]] name = "github.com/tendermint/tendermint" - version = "=0.22.0-rc0" + version = "=0.22.0-rc1" [[constraint]] name = "github.com/tendermint/tmlibs" From 0845d8126e4b53745fc3a10cfe7d5bb38c138c3b Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sun, 1 Jul 2018 15:10:45 -0400 Subject: [PATCH 05/13] server: remove broken start test --- server/start.go | 13 +++++++------ server/start_test.go | 31 +------------------------------ server/test_helpers.go | 24 ------------------------ 3 files changed, 8 insertions(+), 60 deletions(-) diff --git a/server/start.go b/server/start.go index a2cd57f929..c848c9e6ee 100644 --- a/server/start.go +++ b/server/start.go @@ -31,7 +31,8 @@ func StartCmd(ctx *Context, appCreator AppCreator) *cobra.Command { return startStandAlone(ctx, appCreator) } ctx.Logger.Info("Starting ABCI with Tendermint") - return startInProcess(ctx, appCreator) + _, err := startInProcess(ctx, appCreator) + return err }, } @@ -74,12 +75,12 @@ func startStandAlone(ctx *Context, appCreator AppCreator) error { return nil } -func startInProcess(ctx *Context, appCreator AppCreator) error { +func startInProcess(ctx *Context, appCreator AppCreator) (*node.Node, error) { cfg := ctx.Config home := cfg.RootDir app, err := appCreator(home, ctx.Logger) if err != nil { - return err + return nil, err } // Create & start tendermint node @@ -91,15 +92,15 @@ func startInProcess(ctx *Context, appCreator AppCreator) error { node.DefaultMetricsProvider, ctx.Logger.With("module", "node")) if err != nil { - return err + return nil, err } err = n.Start() if err != nil { - return err + return nil, err } // Trap signal, run forever. n.RunForever() - return nil + return n, nil } diff --git a/server/start_test.go b/server/start_test.go index 278c793cbd..3817e1ee89 100644 --- a/server/start_test.go +++ b/server/start_test.go @@ -6,7 +6,6 @@ import ( "testing" "time" - "github.com/spf13/viper" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/server/mock" @@ -45,37 +44,9 @@ func TestStartStandAlone(t *testing.T) { svr.SetLogger(logger.With("module", "abci-server")) svr.Start() - timer := time.NewTimer(time.Duration(5) * time.Second) + timer := time.NewTimer(time.Duration(2) * time.Second) select { case <-timer.C: svr.Stop() } } - -func TestStartWithTendermint(t *testing.T) { - defer setupViper(t)() - - logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)). - With("module", "mock-cmd") - cfg, err := tcmd.ParseConfig() - require.Nil(t, err) - ctx := NewContext(cfg, logger) - cdc := wire.NewCodec() - appInit := AppInit{ - AppGenState: mock.AppGenState, - AppGenTx: mock.AppGenTx, - } - initCmd := InitCmd(ctx, cdc, appInit) - err = initCmd.RunE(nil, nil) - require.NoError(t, err) - - // set up app and start up - viper.Set(flagWithTendermint, true) - startCmd := StartCmd(ctx, mock.NewApp) - svrAddr, _, err := FreeTCPAddr() - require.NoError(t, err) - startCmd.Flags().Set(flagAddress, svrAddr) // set to a new free address - timeout := time.Duration(5) * time.Second - - close(RunOrTimeout(startCmd, timeout, t)) -} diff --git a/server/test_helpers.go b/server/test_helpers.go index 5abf57c17c..8de4672e33 100644 --- a/server/test_helpers.go +++ b/server/test_helpers.go @@ -6,9 +6,7 @@ import ( "net" "os" "testing" - "time" - "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/stretchr/testify/require" "github.com/tendermint/tmlibs/cli" @@ -52,25 +50,3 @@ func setupViper(t *testing.T) func() { } } } - -// Run or Timout RunE of command passed in -func RunOrTimeout(cmd *cobra.Command, timeout time.Duration, t *testing.T) chan error { - done := make(chan error) - go func(out chan<- error) { - // this should NOT exit - err := cmd.RunE(nil, nil) - if err != nil { - out <- err - } - out <- fmt.Errorf("start died for unknown reasons") - }(done) - timer := time.NewTimer(timeout) - - select { - case err := <-done: - require.NoError(t, err) - case <-timer.C: - return done - } - return done -} From f78f30c67a662f92bde872acf2a13350257d195f Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 2 Jul 2018 16:34:06 -0400 Subject: [PATCH 06/13] update for tm v0.22.0. tmlibs->tendermint/libs --- Gopkg.lock | 36 ++++++++++++------- Gopkg.toml | 2 +- baseapp/baseapp.go | 6 ++-- baseapp/baseapp_test.go | 6 ++-- baseapp/helpers.go | 2 +- client/context/helpers.go | 4 +-- client/keys.go | 2 +- client/keys/add.go | 2 +- client/keys/utils.go | 4 +-- client/lcd/lcd_test.go | 2 +- client/lcd/root.go | 4 +-- client/lcd/test_helpers.go | 6 ++-- client/tx/query.go | 2 +- cmd/gaia/app/app.go | 6 ++-- cmd/gaia/cmd/gaiacli/main.go | 2 +- cmd/gaia/cmd/gaiad/main.go | 6 ++-- cmd/gaia/cmd/gaiadebug/hack.go | 6 ++-- crypto/keys/keybase.go | 2 +- crypto/keys/keybase_test.go | 2 +- crypto/keys/mintkey.go | 2 +- docs/core/examples/app1.go | 6 ++-- docs/core/examples/app2.go | 6 ++-- docs/core/examples/app3.go | 6 ++-- docs/core/examples/app4.go | 6 ++-- examples/basecoin/app/app.go | 6 ++-- examples/basecoin/app/app_test.go | 4 +-- examples/basecoin/cmd/basecli/main.go | 2 +- examples/basecoin/cmd/basecoind/main.go | 6 ++-- examples/democoin/app/app.go | 6 ++-- examples/democoin/app/app_test.go | 4 +-- examples/democoin/cmd/democli/main.go | 2 +- examples/democoin/cmd/democoind/main.go | 6 ++-- .../democoin/x/assoc/validator_set_test.go | 2 +- examples/democoin/x/cool/keeper_test.go | 2 +- examples/democoin/x/oracle/oracle_test.go | 2 +- examples/democoin/x/pow/handler_test.go | 2 +- examples/democoin/x/pow/keeper_test.go | 4 +-- .../democoin/x/simplestake/keeper_test.go | 4 +-- examples/kvstore/main.go | 8 ++--- server/constructors.go | 4 +-- server/init.go | 6 ++-- server/init_test.go | 2 +- server/mock/app.go | 4 +-- server/mock/helpers.go | 2 +- server/mock/store.go | 2 +- server/mock/store_test.go | 2 +- server/start.go | 2 +- server/start_test.go | 2 +- server/test_helpers.go | 2 +- server/testnet.go | 2 +- server/util.go | 6 ++-- store/cachekvstore.go | 2 +- store/cachekvstore_test.go | 4 +-- store/dbstoreadapter.go | 2 +- store/firstlast.go | 2 +- store/gaskvstore_test.go | 2 +- store/iavlstore.go | 4 +-- store/iavlstore_test.go | 4 +-- store/memiterator.go | 4 +-- store/prefixstore_test.go | 2 +- store/rootmultistore.go | 4 +-- store/rootmultistore_test.go | 4 +-- tests/gobash.go | 2 +- types/account.go | 4 +-- types/context.go | 2 +- types/context_test.go | 4 +-- types/errors.go | 2 +- types/lib/linear_test.go | 4 +-- types/store.go | 4 +-- types/tags.go | 2 +- x/auth/ante_test.go | 2 +- x/auth/context_test.go | 2 +- x/auth/feekeeper_test.go | 2 +- x/auth/mapper_test.go | 4 +-- x/auth/mock/app.go | 4 +-- x/bank/keeper_test.go | 4 +-- x/ibc/client/cli/relay.go | 2 +- x/ibc/ibc_test.go | 4 +-- x/slashing/client/cli/query.go | 2 +- x/slashing/test_common.go | 4 +-- x/stake/client/cli/query.go | 2 +- x/stake/keeper/test_common.go | 4 +-- 82 files changed, 165 insertions(+), 153 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 92fe403aea..965fc745d9 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -267,8 +267,8 @@ [[projects]] name = "github.com/spf13/cobra" packages = ["."] - revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385" - version = "v0.0.3" + revision = "7b2c5ac9fc04fc5efafb60700713d4fa609b777b" + version = "v0.0.1" [[projects]] branch = "master" @@ -285,8 +285,8 @@ [[projects]] name = "github.com/spf13/viper" packages = ["."] - revision = "b5e8006cbee93ec955a89ab31e0e3ce3204f3736" - version = "v1.0.2" + revision = "25b30aa063fc18e48662b86996252eabdcf2f0c7" + version = "v1.0.0" [[projects]] name = "github.com/stretchr/testify" @@ -355,9 +355,18 @@ "consensus", "consensus/types", "crypto", + "crypto/merkle", "crypto/tmhash", "evidence", + "libs/autofile", + "libs/cli", + "libs/cli/flags", + "libs/clist", + "libs/common", + "libs/db", "libs/events", + "libs/flowrate", + "libs/log", "libs/pubsub", "libs/pubsub/query", "lite", @@ -388,20 +397,17 @@ "types", "version" ] - revision = "af703620d4423478968ab602716a2a51cbb02ac6" - version = "v0.22.0-rc1" + revision = "5923b6288fe8ce9581936ee97c2bf9cf9c02c2f4" + version = "v0.22.0-rc2" [[projects]] name = "github.com/tendermint/tmlibs" packages = [ - "autofile", "bech32", "cli", "cli/flags", - "clist", "common", "db", - "flowrate", "log", "merkle", "merkle/tmhash" @@ -484,9 +490,13 @@ packages = [ ".", "balancer", + "balancer/base", + "balancer/roundrobin", "codes", "connectivity", "credentials", + "encoding", + "encoding/proto", "grpclb/grpc_lb_v1/messages", "grpclog", "internal", @@ -495,13 +505,15 @@ "naming", "peer", "resolver", + "resolver/dns", + "resolver/passthrough", "stats", "status", "tap", "transport" ] - revision = "5b3c4e850e90a4cf6a20ebd46c8b32a0a3afcb9e" - version = "v1.7.5" + revision = "d11072e7ca9811b1100b80ca0269ac831f06d024" + version = "v1.11.3" [[projects]] name = "gopkg.in/yaml.v2" @@ -512,6 +524,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "e625f9f13e5ca81fb8ecf6e794e0d1df87d8597a84af2abf70c057e20aa9b852" + inputs-digest = "e0adc07b8fcd9a48957baaa58a97b3bf1c72af18d06c7943b719794746ded31e" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index a9bae1d06f..910a3d56c2 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -62,7 +62,7 @@ [[constraint]] name = "github.com/tendermint/tendermint" - version = "=0.22.0-rc1" + version = "=0.22.0-rc2" [[constraint]] name = "github.com/tendermint/tmlibs" diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 1b4e701196..afc060cc35 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -8,9 +8,9 @@ import ( "github.com/pkg/errors" abci "github.com/tendermint/tendermint/abci/types" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/baseapp/baseapp_test.go b/baseapp/baseapp_test.go index 0d0b226265..b6032e035b 100644 --- a/baseapp/baseapp_test.go +++ b/baseapp/baseapp_test.go @@ -12,9 +12,9 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" tmtypes "github.com/tendermint/tendermint/types" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/wire" diff --git a/baseapp/helpers.go b/baseapp/helpers.go index 65c18315fd..2d7419a98c 100644 --- a/baseapp/helpers.go +++ b/baseapp/helpers.go @@ -3,7 +3,7 @@ package baseapp import ( "github.com/tendermint/tendermint/abci/server" abci "github.com/tendermint/tendermint/abci/types" - cmn "github.com/tendermint/tmlibs/common" + cmn "github.com/tendermint/tendermint/libs/common" ) // RunForever - BasecoinApp execution and cleanup diff --git a/client/context/helpers.go b/client/context/helpers.go index 8dd813f824..54c1463ee6 100644 --- a/client/context/helpers.go +++ b/client/context/helpers.go @@ -3,7 +3,7 @@ package context import ( "fmt" - "github.com/tendermint/tmlibs/common" + "github.com/tendermint/tendermint/libs/common" "github.com/pkg/errors" @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth" rpcclient "github.com/tendermint/tendermint/rpc/client" ctypes "github.com/tendermint/tendermint/rpc/core/types" - cmn "github.com/tendermint/tmlibs/common" + cmn "github.com/tendermint/tendermint/libs/common" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/keys" diff --git a/client/keys.go b/client/keys.go index 8c11561c5f..a39b074b98 100644 --- a/client/keys.go +++ b/client/keys.go @@ -2,7 +2,7 @@ package client import ( "github.com/cosmos/cosmos-sdk/crypto/keys" - dbm "github.com/tendermint/tmlibs/db" + dbm "github.com/tendermint/tendermint/libs/db" ) // GetKeyBase initializes a keybase based on the given db. diff --git a/client/keys/add.go b/client/keys/add.go index a39a374c82..12ad97ee8a 100644 --- a/client/keys/add.go +++ b/client/keys/add.go @@ -15,7 +15,7 @@ import ( ccrypto "github.com/cosmos/cosmos-sdk/crypto" "github.com/cosmos/cosmos-sdk/crypto/keys" - "github.com/tendermint/tmlibs/cli" + "github.com/tendermint/tendermint/libs/cli" ) const ( diff --git a/client/keys/utils.go b/client/keys/utils.go index c0d7f876fa..aaa7c37f83 100644 --- a/client/keys/utils.go +++ b/client/keys/utils.go @@ -7,8 +7,8 @@ import ( "github.com/spf13/viper" keys "github.com/cosmos/cosmos-sdk/crypto/keys" - "github.com/tendermint/tmlibs/cli" - dbm "github.com/tendermint/tmlibs/db" + "github.com/tendermint/tendermint/libs/cli" + dbm "github.com/tendermint/tendermint/libs/db" "github.com/cosmos/cosmos-sdk/client" diff --git a/client/lcd/lcd_test.go b/client/lcd/lcd_test.go index 1b1a02fefb..229e8d7137 100644 --- a/client/lcd/lcd_test.go +++ b/client/lcd/lcd_test.go @@ -15,7 +15,7 @@ import ( abci "github.com/tendermint/tendermint/abci/types" p2p "github.com/tendermint/tendermint/p2p" ctypes "github.com/tendermint/tendermint/rpc/core/types" - "github.com/tendermint/tmlibs/common" + "github.com/tendermint/tendermint/libs/common" client "github.com/cosmos/cosmos-sdk/client" keys "github.com/cosmos/cosmos-sdk/client/keys" diff --git a/client/lcd/root.go b/client/lcd/root.go index 472c914060..e79ffd2f13 100644 --- a/client/lcd/root.go +++ b/client/lcd/root.go @@ -7,10 +7,10 @@ import ( "github.com/gorilla/mux" "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/log" tmserver "github.com/tendermint/tendermint/rpc/lib/server" - cmn "github.com/tendermint/tmlibs/common" + cmn "github.com/tendermint/tendermint/libs/common" client "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" diff --git a/client/lcd/test_helpers.go b/client/lcd/test_helpers.go index dbdf9b724d..0467262396 100644 --- a/client/lcd/test_helpers.go +++ b/client/lcd/test_helpers.go @@ -24,9 +24,9 @@ import ( "github.com/tendermint/tendermint/proxy" tmrpc "github.com/tendermint/tendermint/rpc/lib/server" tmtypes "github.com/tendermint/tendermint/types" - "github.com/tendermint/tmlibs/cli" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/cli" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/client" keys "github.com/cosmos/cosmos-sdk/client/keys" diff --git a/client/tx/query.go b/client/tx/query.go index e70ecea399..dfe626c38c 100644 --- a/client/tx/query.go +++ b/client/tx/query.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/tendermint/tmlibs/common" + "github.com/tendermint/tendermint/libs/common" "github.com/gorilla/mux" "github.com/spf13/cobra" diff --git a/cmd/gaia/app/app.go b/cmd/gaia/app/app.go index 399c816830..77b179765e 100644 --- a/cmd/gaia/app/app.go +++ b/cmd/gaia/app/app.go @@ -6,9 +6,9 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmtypes "github.com/tendermint/tendermint/types" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" bam "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/cmd/gaia/cmd/gaiacli/main.go b/cmd/gaia/cmd/gaiacli/main.go index 37e3f1664f..4ab5d02b98 100644 --- a/cmd/gaia/cmd/gaiacli/main.go +++ b/cmd/gaia/cmd/gaiacli/main.go @@ -3,7 +3,7 @@ package main import ( "github.com/spf13/cobra" - "github.com/tendermint/tmlibs/cli" + "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/keys" diff --git a/cmd/gaia/cmd/gaiad/main.go b/cmd/gaia/cmd/gaiad/main.go index 1915ef7517..d96275de65 100644 --- a/cmd/gaia/cmd/gaiad/main.go +++ b/cmd/gaia/cmd/gaiad/main.go @@ -7,9 +7,9 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmtypes "github.com/tendermint/tendermint/types" - "github.com/tendermint/tmlibs/cli" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/cli" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/cmd/gaia/app" "github.com/cosmos/cosmos-sdk/server" diff --git a/cmd/gaia/cmd/gaiadebug/hack.go b/cmd/gaia/cmd/gaiadebug/hack.go index 74b42adb38..1f2ef0649d 100644 --- a/cmd/gaia/cmd/gaiadebug/hack.go +++ b/cmd/gaia/cmd/gaiadebug/hack.go @@ -10,9 +10,9 @@ import ( "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" bam "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/crypto/keys/keybase.go b/crypto/keys/keybase.go index 396bb57821..82adc53dda 100644 --- a/crypto/keys/keybase.go +++ b/crypto/keys/keybase.go @@ -8,7 +8,7 @@ import ( "github.com/pkg/errors" tcrypto "github.com/tendermint/tendermint/crypto" - dbm "github.com/tendermint/tmlibs/db" + dbm "github.com/tendermint/tendermint/libs/db" "github.com/cosmos/cosmos-sdk/crypto" "github.com/cosmos/cosmos-sdk/crypto/keys/bip39" diff --git a/crypto/keys/keybase_test.go b/crypto/keys/keybase_test.go index ac0f7fa4da..c910849865 100644 --- a/crypto/keys/keybase_test.go +++ b/crypto/keys/keybase_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto" - dbm "github.com/tendermint/tmlibs/db" + dbm "github.com/tendermint/tendermint/libs/db" ) // TestKeyManagement makes sure we can manipulate these keys well diff --git a/crypto/keys/mintkey.go b/crypto/keys/mintkey.go index 8b0a1870bb..cfba18e092 100644 --- a/crypto/keys/mintkey.go +++ b/crypto/keys/mintkey.go @@ -4,7 +4,7 @@ import ( "encoding/hex" "fmt" - cmn "github.com/tendermint/tmlibs/common" + cmn "github.com/tendermint/tendermint/libs/common" "github.com/cosmos/cosmos-sdk/crypto/keys/bcrypt" "github.com/tendermint/tendermint/crypto" diff --git a/docs/core/examples/app1.go b/docs/core/examples/app1.go index 9daf8d3334..f9eceecdb5 100644 --- a/docs/core/examples/app1.go +++ b/docs/core/examples/app1.go @@ -3,9 +3,9 @@ package app import ( "encoding/json" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" bapp "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/docs/core/examples/app2.go b/docs/core/examples/app2.go index d7490765e5..b4d44dca7b 100644 --- a/docs/core/examples/app2.go +++ b/docs/core/examples/app2.go @@ -6,9 +6,9 @@ import ( "fmt" "github.com/tendermint/tendermint/crypto" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" bapp "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/docs/core/examples/app3.go b/docs/core/examples/app3.go index d871a1cfd3..f99e34b8b2 100644 --- a/docs/core/examples/app3.go +++ b/docs/core/examples/app3.go @@ -1,9 +1,9 @@ package app import ( - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" bapp "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/docs/core/examples/app4.go b/docs/core/examples/app4.go index 007d2842bc..22282738f6 100644 --- a/docs/core/examples/app4.go +++ b/docs/core/examples/app4.go @@ -2,9 +2,9 @@ package app import ( abci "github.com/tendermint/tendermint/abci/types" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" bapp "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/examples/basecoin/app/app.go b/examples/basecoin/app/app.go index 089d1ca23c..a182b83dd7 100644 --- a/examples/basecoin/app/app.go +++ b/examples/basecoin/app/app.go @@ -5,9 +5,9 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmtypes "github.com/tendermint/tendermint/types" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" bam "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/examples/basecoin/app/app_test.go b/examples/basecoin/app/app_test.go index 499c0e4082..0b5d37dc4f 100644 --- a/examples/basecoin/app/app_test.go +++ b/examples/basecoin/app/app_test.go @@ -16,8 +16,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" ) func setGenesis(bapp *BasecoinApp, accs ...auth.BaseAccount) error { diff --git a/examples/basecoin/cmd/basecli/main.go b/examples/basecoin/cmd/basecli/main.go index 1191aab6ab..d99a9178d4 100644 --- a/examples/basecoin/cmd/basecli/main.go +++ b/examples/basecoin/cmd/basecli/main.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" - "github.com/tendermint/tmlibs/cli" + "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/keys" diff --git a/examples/basecoin/cmd/basecoind/main.go b/examples/basecoin/cmd/basecoind/main.go index f3f3de519a..9d026922cc 100644 --- a/examples/basecoin/cmd/basecoind/main.go +++ b/examples/basecoin/cmd/basecoind/main.go @@ -8,9 +8,9 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmtypes "github.com/tendermint/tendermint/types" - "github.com/tendermint/tmlibs/cli" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/cli" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/examples/basecoin/app" "github.com/cosmos/cosmos-sdk/server" diff --git a/examples/democoin/app/app.go b/examples/democoin/app/app.go index 195af0c9ea..100e25435d 100644 --- a/examples/democoin/app/app.go +++ b/examples/democoin/app/app.go @@ -5,9 +5,9 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmtypes "github.com/tendermint/tendermint/types" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" bam "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/examples/democoin/app/app_test.go b/examples/democoin/app/app_test.go index 36aca760f1..a642eff72d 100644 --- a/examples/democoin/app/app_test.go +++ b/examples/democoin/app/app_test.go @@ -14,8 +14,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" ) func setGenesis(bapp *DemocoinApp, trend string, accs ...auth.BaseAccount) error { diff --git a/examples/democoin/cmd/democli/main.go b/examples/democoin/cmd/democli/main.go index cbf43508ba..43f86504eb 100644 --- a/examples/democoin/cmd/democli/main.go +++ b/examples/democoin/cmd/democli/main.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" - "github.com/tendermint/tmlibs/cli" + "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/keys" diff --git a/examples/democoin/cmd/democoind/main.go b/examples/democoin/cmd/democoind/main.go index 92f9618b04..1cc22b8877 100644 --- a/examples/democoin/cmd/democoind/main.go +++ b/examples/democoin/cmd/democoind/main.go @@ -8,9 +8,9 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmtypes "github.com/tendermint/tendermint/types" - "github.com/tendermint/tmlibs/cli" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/cli" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/examples/democoin/app" "github.com/cosmos/cosmos-sdk/server" diff --git a/examples/democoin/x/assoc/validator_set_test.go b/examples/democoin/x/assoc/validator_set_test.go index c20aeb8571..e5932c14b3 100644 --- a/examples/democoin/x/assoc/validator_set_test.go +++ b/examples/democoin/x/assoc/validator_set_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - dbm "github.com/tendermint/tmlibs/db" + dbm "github.com/tendermint/tendermint/libs/db" "github.com/cosmos/cosmos-sdk/examples/democoin/mock" "github.com/cosmos/cosmos-sdk/store" diff --git a/examples/democoin/x/cool/keeper_test.go b/examples/democoin/x/cool/keeper_test.go index ee2e529f26..f0d65a545e 100644 --- a/examples/democoin/x/cool/keeper_test.go +++ b/examples/democoin/x/cool/keeper_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - dbm "github.com/tendermint/tmlibs/db" + dbm "github.com/tendermint/tendermint/libs/db" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/examples/democoin/x/oracle/oracle_test.go b/examples/democoin/x/oracle/oracle_test.go index 228378c34a..ef925c94f4 100644 --- a/examples/democoin/x/oracle/oracle_test.go +++ b/examples/democoin/x/oracle/oracle_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - dbm "github.com/tendermint/tmlibs/db" + dbm "github.com/tendermint/tendermint/libs/db" "github.com/cosmos/cosmos-sdk/examples/democoin/mock" "github.com/cosmos/cosmos-sdk/store" diff --git a/examples/democoin/x/pow/handler_test.go b/examples/democoin/x/pow/handler_test.go index 77a22057bc..283c30ef59 100644 --- a/examples/democoin/x/pow/handler_test.go +++ b/examples/democoin/x/pow/handler_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/log" sdk "github.com/cosmos/cosmos-sdk/types" wire "github.com/cosmos/cosmos-sdk/wire" diff --git a/examples/democoin/x/pow/keeper_test.go b/examples/democoin/x/pow/keeper_test.go index 31ad2fc121..7a9b869849 100644 --- a/examples/democoin/x/pow/keeper_test.go +++ b/examples/democoin/x/pow/keeper_test.go @@ -6,8 +6,8 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/examples/democoin/x/simplestake/keeper_test.go b/examples/democoin/x/simplestake/keeper_test.go index be8e335e2b..4496eb369c 100644 --- a/examples/democoin/x/simplestake/keeper_test.go +++ b/examples/democoin/x/simplestake/keeper_test.go @@ -9,8 +9,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/examples/kvstore/main.go b/examples/kvstore/main.go index c2c56eba5f..47416da057 100644 --- a/examples/kvstore/main.go +++ b/examples/kvstore/main.go @@ -8,10 +8,10 @@ import ( "github.com/spf13/viper" "github.com/tendermint/tendermint/abci/server" - "github.com/tendermint/tmlibs/cli" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/cli" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" bam "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/server/constructors.go b/server/constructors.go index 79e1558c4b..d93a1defec 100644 --- a/server/constructors.go +++ b/server/constructors.go @@ -6,8 +6,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmtypes "github.com/tendermint/tendermint/types" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" ) // AppCreator lets us lazily initialize app, using home dir diff --git a/server/init.go b/server/init.go index ed1727e35e..31d3001e90 100644 --- a/server/init.go +++ b/server/init.go @@ -21,9 +21,9 @@ import ( "github.com/tendermint/tendermint/p2p" pvm "github.com/tendermint/tendermint/privval" tmtypes "github.com/tendermint/tendermint/types" - tmcli "github.com/tendermint/tmlibs/cli" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" + tmcli "github.com/tendermint/tendermint/libs/cli" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" clkeys "github.com/cosmos/cosmos-sdk/client/keys" serverconfig "github.com/cosmos/cosmos-sdk/server/config" diff --git a/server/init_test.go b/server/init_test.go index f05bcb54a1..fb448bf5fa 100644 --- a/server/init_test.go +++ b/server/init_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/server/mock" "github.com/cosmos/cosmos-sdk/wire" diff --git a/server/mock/app.go b/server/mock/app.go index b2d19e2e9e..c99150b979 100644 --- a/server/mock/app.go +++ b/server/mock/app.go @@ -8,8 +8,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" tmtypes "github.com/tendermint/tendermint/types" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" bam "github.com/cosmos/cosmos-sdk/baseapp" gc "github.com/cosmos/cosmos-sdk/server/config" diff --git a/server/mock/helpers.go b/server/mock/helpers.go index 4510f4e905..88aacb4d8e 100644 --- a/server/mock/helpers.go +++ b/server/mock/helpers.go @@ -6,7 +6,7 @@ import ( "os" abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/log" ) // SetupApp returns an application as well as a clean-up function diff --git a/server/mock/store.go b/server/mock/store.go index 9dca581596..d62b9ad23e 100644 --- a/server/mock/store.go +++ b/server/mock/store.go @@ -1,7 +1,7 @@ package mock import ( - dbm "github.com/tendermint/tmlibs/db" + dbm "github.com/tendermint/tendermint/libs/db" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/server/mock/store_test.go b/server/mock/store_test.go index bf6a1007b6..0ea5ffd2c7 100644 --- a/server/mock/store_test.go +++ b/server/mock/store_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/require" - dbm "github.com/tendermint/tmlibs/db" + dbm "github.com/tendermint/tendermint/libs/db" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/server/start.go b/server/start.go index c848c9e6ee..4f90930262 100644 --- a/server/start.go +++ b/server/start.go @@ -11,7 +11,7 @@ import ( "github.com/tendermint/tendermint/node" pvm "github.com/tendermint/tendermint/privval" "github.com/tendermint/tendermint/proxy" - cmn "github.com/tendermint/tmlibs/common" + cmn "github.com/tendermint/tendermint/libs/common" ) const ( diff --git a/server/start_test.go b/server/start_test.go index 3817e1ee89..570071e7bf 100644 --- a/server/start_test.go +++ b/server/start_test.go @@ -12,7 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/wire" "github.com/tendermint/tendermint/abci/server" tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/log" ) func TestStartStandAlone(t *testing.T) { diff --git a/server/test_helpers.go b/server/test_helpers.go index 8de4672e33..d1230898dd 100644 --- a/server/test_helpers.go +++ b/server/test_helpers.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/viper" "github.com/stretchr/testify/require" - "github.com/tendermint/tmlibs/cli" + "github.com/tendermint/tendermint/libs/cli" ) // Get a free address for a test tendermint server diff --git a/server/testnet.go b/server/testnet.go index a60701d246..d102b87ccb 100644 --- a/server/testnet.go +++ b/server/testnet.go @@ -14,7 +14,7 @@ import ( "github.com/cosmos/cosmos-sdk/wire" "github.com/spf13/viper" cfg "github.com/tendermint/tendermint/config" - cmn "github.com/tendermint/tmlibs/common" + cmn "github.com/tendermint/tendermint/libs/common" ) var ( diff --git a/server/util.go b/server/util.go index bd9d48d752..d1ad001c52 100644 --- a/server/util.go +++ b/server/util.go @@ -15,9 +15,9 @@ import ( "github.com/cosmos/cosmos-sdk/wire" tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" cfg "github.com/tendermint/tendermint/config" - "github.com/tendermint/tmlibs/cli" - tmflags "github.com/tendermint/tmlibs/cli/flags" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/cli" + tmflags "github.com/tendermint/tendermint/libs/cli/flags" + "github.com/tendermint/tendermint/libs/log" ) // server context diff --git a/store/cachekvstore.go b/store/cachekvstore.go index aeed6ee5fe..1263cef5f3 100644 --- a/store/cachekvstore.go +++ b/store/cachekvstore.go @@ -5,7 +5,7 @@ import ( "sort" "sync" - cmn "github.com/tendermint/tmlibs/common" + cmn "github.com/tendermint/tendermint/libs/common" ) // If value is nil but deleted is false, it means the parent doesn't have the diff --git a/store/cachekvstore_test.go b/store/cachekvstore_test.go index f9be76dae3..e7958dfcdf 100644 --- a/store/cachekvstore_test.go +++ b/store/cachekvstore_test.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/stretchr/testify/require" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" ) func newCacheKVStore() CacheKVStore { diff --git a/store/dbstoreadapter.go b/store/dbstoreadapter.go index 59369af563..09d48cf9d9 100644 --- a/store/dbstoreadapter.go +++ b/store/dbstoreadapter.go @@ -2,7 +2,7 @@ package store import ( sdk "github.com/cosmos/cosmos-sdk/types" - dbm "github.com/tendermint/tmlibs/db" + dbm "github.com/tendermint/tendermint/libs/db" ) type dbStoreAdapter struct { diff --git a/store/firstlast.go b/store/firstlast.go index e6cb084323..70f6659a87 100644 --- a/store/firstlast.go +++ b/store/firstlast.go @@ -3,7 +3,7 @@ package store import ( "bytes" - cmn "github.com/tendermint/tmlibs/common" + cmn "github.com/tendermint/tendermint/libs/common" ) // Gets the first item. diff --git a/store/gaskvstore_test.go b/store/gaskvstore_test.go index 524dc53237..fe84affa28 100644 --- a/store/gaskvstore_test.go +++ b/store/gaskvstore_test.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - dbm "github.com/tendermint/tmlibs/db" + dbm "github.com/tendermint/tendermint/libs/db" ) func newGasKVStore() KVStore { diff --git a/store/iavlstore.go b/store/iavlstore.go index 5758802c6e..2911598033 100644 --- a/store/iavlstore.go +++ b/store/iavlstore.go @@ -7,8 +7,8 @@ import ( "github.com/tendermint/go-amino" "github.com/tendermint/iavl" abci "github.com/tendermint/tendermint/abci/types" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/store/iavlstore_test.go b/store/iavlstore_test.go index b23f04e5cd..50d690d908 100644 --- a/store/iavlstore_test.go +++ b/store/iavlstore_test.go @@ -7,8 +7,8 @@ import ( "github.com/tendermint/iavl" abci "github.com/tendermint/tendermint/abci/types" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/store/memiterator.go b/store/memiterator.go index a05f3443ed..a72418db63 100644 --- a/store/memiterator.go +++ b/store/memiterator.go @@ -3,8 +3,8 @@ package store import ( "bytes" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" ) // Iterates over iterKVCache items. diff --git a/store/prefixstore_test.go b/store/prefixstore_test.go index 76fb7f481f..f57ab20e40 100644 --- a/store/prefixstore_test.go +++ b/store/prefixstore_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" "github.com/tendermint/iavl" - dbm "github.com/tendermint/tmlibs/db" + dbm "github.com/tendermint/tendermint/libs/db" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/store/rootmultistore.go b/store/rootmultistore.go index 11e089182f..28d9e7e68a 100644 --- a/store/rootmultistore.go +++ b/store/rootmultistore.go @@ -7,8 +7,8 @@ import ( "golang.org/x/crypto/ripemd160" abci "github.com/tendermint/tendermint/abci/types" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/merkle" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/crypto/merkle" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/store/rootmultistore_test.go b/store/rootmultistore_test.go index 197726f4ac..137f04eabb 100644 --- a/store/rootmultistore_test.go +++ b/store/rootmultistore_test.go @@ -5,8 +5,8 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/merkle" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/crypto/merkle" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/tests/gobash.go b/tests/gobash.go index f46bad3c1c..b2d765281a 100644 --- a/tests/gobash.go +++ b/tests/gobash.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/stretchr/testify/require" - cmn "github.com/tendermint/tmlibs/common" + cmn "github.com/tendermint/tendermint/libs/common" ) // Execute the command, return stdout, logging stdout/err to t. diff --git a/types/account.go b/types/account.go index bd7cbb29cd..ce872d8b54 100644 --- a/types/account.go +++ b/types/account.go @@ -6,8 +6,8 @@ import ( "fmt" "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tmlibs/bech32" - cmn "github.com/tendermint/tmlibs/common" + "github.com/tendermint/tendermint/libs/bech32" + cmn "github.com/tendermint/tendermint/libs/common" ) //Address is a go crypto-style Address diff --git a/types/context.go b/types/context.go index 276a664803..e55eff1ab0 100644 --- a/types/context.go +++ b/types/context.go @@ -7,7 +7,7 @@ import ( "github.com/golang/protobuf/proto" abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/log" ) /* diff --git a/types/context_test.go b/types/context_test.go index cad2076640..fb2786cffa 100644 --- a/types/context_test.go +++ b/types/context_test.go @@ -5,8 +5,8 @@ import ( "github.com/stretchr/testify/require" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/store" "github.com/cosmos/cosmos-sdk/types" diff --git a/types/errors.go b/types/errors.go index 392a954d16..6969549d90 100644 --- a/types/errors.go +++ b/types/errors.go @@ -3,7 +3,7 @@ package types import ( "fmt" - cmn "github.com/tendermint/tmlibs/common" + cmn "github.com/tendermint/tendermint/libs/common" abci "github.com/tendermint/tendermint/abci/types" ) diff --git a/types/lib/linear_test.go b/types/lib/linear_test.go index 8b5a63fd41..b14300a987 100644 --- a/types/lib/linear_test.go +++ b/types/lib/linear_test.go @@ -6,8 +6,8 @@ import ( "github.com/stretchr/testify/require" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" abci "github.com/tendermint/tendermint/abci/types" diff --git a/types/store.go b/types/store.go index 5aecd7d093..04de2c7c1a 100644 --- a/types/store.go +++ b/types/store.go @@ -4,8 +4,8 @@ import ( "fmt" abci "github.com/tendermint/tendermint/abci/types" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" ) // NOTE: These are implemented in cosmos-sdk/store. diff --git a/types/tags.go b/types/tags.go index 6bd721a5fc..add0c0ad54 100644 --- a/types/tags.go +++ b/types/tags.go @@ -1,7 +1,7 @@ package types import ( - cmn "github.com/tendermint/tmlibs/common" + cmn "github.com/tendermint/tendermint/libs/common" ) // Type synonym for convenience diff --git a/x/auth/ante_test.go b/x/auth/ante_test.go index 1808afc99c..aebf66f9a2 100644 --- a/x/auth/ante_test.go +++ b/x/auth/ante_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/log" sdk "github.com/cosmos/cosmos-sdk/types" wire "github.com/cosmos/cosmos-sdk/wire" diff --git a/x/auth/context_test.go b/x/auth/context_test.go index 5f432be357..b58547328d 100644 --- a/x/auth/context_test.go +++ b/x/auth/context_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/log" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/auth/feekeeper_test.go b/x/auth/feekeeper_test.go index e935bb4c49..a53839a8b4 100644 --- a/x/auth/feekeeper_test.go +++ b/x/auth/feekeeper_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/log" sdk "github.com/cosmos/cosmos-sdk/types" wire "github.com/cosmos/cosmos-sdk/wire" diff --git a/x/auth/mapper_test.go b/x/auth/mapper_test.go index 4b270f0225..6b242e683b 100644 --- a/x/auth/mapper_test.go +++ b/x/auth/mapper_test.go @@ -6,8 +6,8 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/auth/mock/app.go b/x/auth/mock/app.go index 9c672b5a78..758b1efab8 100644 --- a/x/auth/mock/app.go +++ b/x/auth/mock/app.go @@ -5,8 +5,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" bam "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/bank/keeper_test.go b/x/bank/keeper_test.go index b35298be9d..c545b774f0 100644 --- a/x/bank/keeper_test.go +++ b/x/bank/keeper_test.go @@ -7,8 +7,8 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/ibc/client/cli/relay.go b/x/ibc/client/cli/relay.go index 2dc3129c6e..d434ff35a4 100644 --- a/x/ibc/client/cli/relay.go +++ b/x/ibc/client/cli/relay.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/tendermint/tmlibs/log" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/client/context" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/ibc/ibc_test.go b/x/ibc/ibc_test.go index 33535145d8..4cb708c1bb 100644 --- a/x/ibc/ibc_test.go +++ b/x/ibc/ibc_test.go @@ -7,8 +7,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/slashing/client/cli/query.go b/x/slashing/client/cli/query.go index c1b16eb3a3..3e2023f5eb 100644 --- a/x/slashing/client/cli/query.go +++ b/x/slashing/client/cli/query.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/tendermint/tmlibs/cli" + "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client/context" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/slashing/test_common.go b/x/slashing/test_common.go index 2d192c54df..edf119bc7f 100644 --- a/x/slashing/test_common.go +++ b/x/slashing/test_common.go @@ -9,8 +9,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/stake/client/cli/query.go b/x/stake/client/cli/query.go index c162717efd..bccfd7c2be 100644 --- a/x/stake/client/cli/query.go +++ b/x/stake/client/cli/query.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/tendermint/tmlibs/cli" + "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client/context" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/stake/keeper/test_common.go b/x/stake/keeper/test_common.go index 17b21c6346..aa3c25aba9 100644 --- a/x/stake/keeper/test_common.go +++ b/x/stake/keeper/test_common.go @@ -10,8 +10,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" From 64d5e3fa47cf967c890285c6a53400b9ccafd0f1 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 2 Jul 2018 16:37:24 -0400 Subject: [PATCH 07/13] dev version --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index b9de4f9916..4966455689 100644 --- a/version/version.go +++ b/version/version.go @@ -5,7 +5,7 @@ const Maj = "0" const Min = "20" const Fix = "0" -const Version = "0.20.0" +const Version = "0.20.0-dev" // GitCommit set by build flags var GitCommit = "" From 498aed433e2ba57820842f77c0c65de92957ee95 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 2 Jul 2018 16:46:35 -0400 Subject: [PATCH 08/13] update changelog --- CHANGELOG.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23b7c89813..8fcd911cca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,37 +5,43 @@ *TBD* BREAKING CHANGES -* [config] Change default ports from 466xx to 266xx -* [auth] AltBytes renamed to Memo, now a string, max 100 characters, costs a bit of gas -* [types] GetMsg() -> GetMsgs() -* [auth] Signers of a transaction now only sign over their account and sequence number +* Update Tendermint to v0.22.0 + * Default ports changed from 466xx to 266xx + * Amino JSON uses type names instead of prefix bytes + * ED25519 addresses are the first 20-bytes of the SHA256 of the raw 32-byte + pubkey + * go-crypto, abci, tmlibs have been merged into Tendermint + * Various other fixes +* [auth] Signers of a transaction now only sign over their own account and sequence number * [auth] Removed MsgChangePubKey * [auth] Removed SetPubKey from account mapper +* [auth] AltBytes renamed to Memo, now a string, max 100 characters, costs a bit of gas +* [types] `GetMsg()` -> `GetMsgs()` as txs wrap many messages * [types] Removed GetMemo from Tx (it is still on StdTx) +* [types] renamed rational.Evaluate to rational.Round{Int64, Int} * [keys] Keybase and Ledger support from go-crypto merged into the SDK in the `crypto` folder -* [x/gov] Gov module REST endpoints changed to be more RESTful * [cli] Rearranged commands under subcommands -* [stake] Remove Tick and add EndBlocker -* [stake] Introduce concept of unbonding for delegations and validators +* [x/gov] Gov module REST endpoints changed to be more RESTful +* [x/stake] Remove Tick and add EndBlocker +* [x/stake] Introduce concept of unbonding for delegations and validators * `gaiacli stake unbond` replaced with `gaiacli stake begin-unbonding` * Introduced: * `gaiacli stake complete-unbonding` * `gaiacli stake begin-redelegation` * `gaiacli stake complete-redelegation` -* [slashing] Update slashing for unbonding period +* [x/slashing] Update slashing for unbonding period * Slash according to power at time of infraction instead of power at time of discovery * Iterate through unbonding delegations & redelegations which contributed to an infraction, slash them proportional to their stake at the time * Add REST endpoint to unrevoke a validator previously revoked for downtime * Add REST endpoint to retrieve liveness signing information for a validator -* [types] renamed rational.Evaluate to rational.Round{Int64, Int} FEATURES * [gaiacli] You can now attach a simple text-only memo to any transaction, with the `--memo` flag * [lcd] Queried TXs now include the tx hash to identify each tx * [mockapp] CompleteSetup() no longer takes a testing parameter -* [governance] Implemented MVP +* [x/gov] Implemented MVP * Supported proposal types: just binary (pass/fail) TextProposals for now * Proposals need deposits to be votable; deposits are burned if proposal fails * Delegators delegate votes to validator by default but can override (for their stake) @@ -55,7 +61,7 @@ FEATURES * [server] Default config now creates a profiler at port 6060, and increase p2p send/recv rates * [tests] Add WaitForNextNBlocksTM helper method * [types] Switches internal representation of Int/Uint/Rat to use pointers -* [gaiad] unsafe_reset_all now resets addrbook.json +* [gaiad] `unsafe_reset_all` now resets addrbook.json * [democoin] add x/oracle, x/assoc * [gaiacli] Ledger support added - You can now use a Ledger with `gaiacli --ledger` for all key-related commands From fe7a5a01bdfd10d1d111e4e6e3f469709ce9d8e9 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 2 Jul 2018 17:22:25 -0400 Subject: [PATCH 09/13] update iavl to remove tmlibs dep --- Gopkg.lock | 30 ++++++------------------------ Gopkg.toml | 2 +- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 965fc745d9..a9b4a1f5cf 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -137,7 +137,6 @@ ".", "hcl/ast", "hcl/parser", - "hcl/printer", "hcl/scanner", "hcl/strconv", "hcl/token", @@ -334,12 +333,9 @@ [[projects]] name = "github.com/tendermint/iavl" - packages = [ - ".", - "sha256truncated" - ] - revision = "2de525d09cca7c45c3f43d178817947a6cfa242c" - version = "v0.8.1" + packages = ["."] + revision = "9e5dc3e61f70b285bb25414452d47aca1ff34c1d" + version = "v0.8.2-rc0" [[projects]] name = "github.com/tendermint/tendermint" @@ -359,6 +355,7 @@ "crypto/tmhash", "evidence", "libs/autofile", + "libs/bech32", "libs/cli", "libs/cli/flags", "libs/clist", @@ -400,21 +397,6 @@ revision = "5923b6288fe8ce9581936ee97c2bf9cf9c02c2f4" version = "v0.22.0-rc2" -[[projects]] - name = "github.com/tendermint/tmlibs" - packages = [ - "bech32", - "cli", - "cli/flags", - "common", - "db", - "log", - "merkle", - "merkle/tmhash" - ] - revision = "49596e0a1f48866603813df843c9409fc19805c6" - version = "v0.9.0" - [[projects]] name = "github.com/zondax/ledger-goclient" packages = ["."] @@ -451,7 +433,7 @@ "netutil", "trace" ] - revision = "4cb1c02c05b0e749b0365f61ae859a8e0cfceed9" + revision = "87b3feba568e144938625fc5d80ec92566c1a8fe" [[projects]] branch = "master" @@ -524,6 +506,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "e0adc07b8fcd9a48957baaa58a97b3bf1c72af18d06c7943b719794746ded31e" + inputs-digest = "13ad2a57b6942729e2d08b5c37810d62108aa64a335a4822fcff1ad992c0662b" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 910a3d56c2..486293af71 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -58,7 +58,7 @@ [[constraint]] name = "github.com/tendermint/iavl" - version = "=v0.8.1" + version = "=v0.8.2-rc0" [[constraint]] name = "github.com/tendermint/tendermint" From 60a8a63e62eb6c720e818f45e4a668378aae38b4 Mon Sep 17 00:00:00 2001 From: Jeremiah Andrews Date: Tue, 26 Jun 2018 13:01:45 -0700 Subject: [PATCH 10/13] base variabls / logic, need tests --- store/iavlstore.go | 31 +++++++++++++++++-------------- store/iavlstore_test.go | 13 +++++++------ store/prefixstore_test.go | 2 +- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/store/iavlstore.go b/store/iavlstore.go index 2911598033..16fb8e4f04 100644 --- a/store/iavlstore.go +++ b/store/iavlstore.go @@ -15,7 +15,8 @@ import ( const ( defaultIAVLCacheSize = 10000 - defaultIAVLNumHistory = 1<<53 - 1 // DEPRECATED + defaultIAVLNumRecent = 1000 + defaultIAVLStoreEvery = 10000 ) // load the iavl store @@ -25,7 +26,7 @@ func LoadIAVLStore(db dbm.DB, id CommitID) (CommitStore, error) { if err != nil { return nil, err } - store := newIAVLStore(tree, defaultIAVLNumHistory) + store := newIAVLStore(tree, defaultIAVLNumRecent, defaultIAVLStoreEvery) return store, nil } @@ -43,16 +44,17 @@ type iavlStore struct { // How many old versions we hold onto. // A value of 0 means keep all history. - numHistory int64 + numRecent int64 + + storeEvery int64 } // CONTRACT: tree should be fully loaded. -// TODO: use more numHistory's, so the below nolint can be removed -// nolint: unparam -func newIAVLStore(tree *iavl.VersionedTree, numHistory int64) *iavlStore { +func newIAVLStore(tree *iavl.VersionedTree, numRecent int64, storeEvery int64) *iavlStore { st := &iavlStore{ tree: tree, - numHistory: numHistory, + numRecent: numRecent, + storeEvery: storeEvery, } return st } @@ -67,13 +69,14 @@ func (st *iavlStore) Commit() CommitID { panic(err) } - // Release an old version of history - if st.numHistory > 0 && (st.numHistory < st.tree.Version64()) { - toRelease := version - st.numHistory - err := st.tree.DeleteVersion(toRelease) - if err != nil { - // TODO: Handle with #870 - panic(err) + // Release an old version of history, if not a sync waypoint + if st.numRecent < st.tree.Version64() { + toRelease := version - st.numRecent + if toRelease%st.storeEvery != 0 { + err := st.tree.DeleteVersion(toRelease) + if err != nil { + panic(err) + } } } diff --git a/store/iavlstore_test.go b/store/iavlstore_test.go index 50d690d908..adae84f1ab 100644 --- a/store/iavlstore_test.go +++ b/store/iavlstore_test.go @@ -15,7 +15,8 @@ import ( var ( cacheSize = 100 - numHistory int64 = 5 + numRecent int64 = 5 + storeEvery int64 = 3 ) var ( @@ -45,7 +46,7 @@ func newTree(t *testing.T, db dbm.DB) (*iavl.VersionedTree, CommitID) { func TestIAVLStoreGetSetHasDelete(t *testing.T) { db := dbm.NewMemDB() tree, _ := newTree(t, db) - iavlStore := newIAVLStore(tree, numHistory) + iavlStore := newIAVLStore(tree, numRecent, storeEvery) key := "hello" @@ -70,7 +71,7 @@ func TestIAVLStoreGetSetHasDelete(t *testing.T) { func TestIAVLIterator(t *testing.T) { db := dbm.NewMemDB() tree, _ := newTree(t, db) - iavlStore := newIAVLStore(tree, numHistory) + iavlStore := newIAVLStore(tree, numRecent, storeEvery) iter := iavlStore.Iterator([]byte("aloha"), []byte("hellz")) expected := []string{"aloha", "hello"} var i int @@ -143,7 +144,7 @@ func TestIAVLIterator(t *testing.T) { func TestIAVLSubspaceIterator(t *testing.T) { db := dbm.NewMemDB() tree, _ := newTree(t, db) - iavlStore := newIAVLStore(tree, numHistory) + iavlStore := newIAVLStore(tree, numRecent, storeEvery) iavlStore.Set([]byte("test1"), []byte("test1")) iavlStore.Set([]byte("test2"), []byte("test2")) @@ -202,7 +203,7 @@ func TestIAVLSubspaceIterator(t *testing.T) { func TestIAVLReverseSubspaceIterator(t *testing.T) { db := dbm.NewMemDB() tree, _ := newTree(t, db) - iavlStore := newIAVLStore(tree, numHistory) + iavlStore := newIAVLStore(tree, numRecent, storeEvery) iavlStore.Set([]byte("test1"), []byte("test1")) iavlStore.Set([]byte("test2"), []byte("test2")) @@ -261,7 +262,7 @@ func TestIAVLReverseSubspaceIterator(t *testing.T) { func TestIAVLStoreQuery(t *testing.T) { db := dbm.NewMemDB() tree := iavl.NewVersionedTree(db, cacheSize) - iavlStore := newIAVLStore(tree, numHistory) + iavlStore := newIAVLStore(tree, numRecent, storeEvery) k1, v1 := []byte("key1"), []byte("val1") k2, v2 := []byte("key2"), []byte("val2") diff --git a/store/prefixstore_test.go b/store/prefixstore_test.go index f57ab20e40..1961bb4bb0 100644 --- a/store/prefixstore_test.go +++ b/store/prefixstore_test.go @@ -66,7 +66,7 @@ func testPrefixStore(t *testing.T, baseStore KVStore, prefix []byte) { func TestIAVLStorePrefix(t *testing.T) { db := dbm.NewMemDB() tree := iavl.NewVersionedTree(db, cacheSize) - iavlStore := newIAVLStore(tree, numHistory) + iavlStore := newIAVLStore(tree, numRecent, storeEvery) testPrefixStore(t, iavlStore, []byte("test")) } From 1632b7de1841a38d43a1ea422eaf20a364537cec Mon Sep 17 00:00:00 2001 From: Jeremiah Andrews Date: Tue, 26 Jun 2018 16:26:24 -0700 Subject: [PATCH 11/13] testing pruning --- store/iavlstore.go | 7 ++++++- store/iavlstore_test.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/store/iavlstore.go b/store/iavlstore.go index 16fb8e4f04..8627879361 100644 --- a/store/iavlstore.go +++ b/store/iavlstore.go @@ -15,7 +15,7 @@ import ( const ( defaultIAVLCacheSize = 10000 - defaultIAVLNumRecent = 1000 + defaultIAVLNumRecent = 100 defaultIAVLStoreEvery = 10000 ) @@ -94,6 +94,11 @@ func (st *iavlStore) LastCommitID() CommitID { } } +// VersionExists returns whether or not a given version is stored +func (st *iavlStore) VersionExists(version int64) bool { + return st.tree.VersionExists(version) +} + // Implements Store. func (st *iavlStore) GetStoreType() StoreType { return sdk.StoreTypeIAVL diff --git a/store/iavlstore_test.go b/store/iavlstore_test.go index adae84f1ab..51ec31f071 100644 --- a/store/iavlstore_test.go +++ b/store/iavlstore_test.go @@ -259,6 +259,35 @@ func TestIAVLReverseSubspaceIterator(t *testing.T) { require.Equal(t, len(expected), i) } +func nextVersion(iavl *iavlStore) { + key := cmn.RandBytes(12) + value := cmn.RandBytes(50) + iavl.Set(key, value) + iavl.Commit() +} +func TestIAVLPruning(t *testing.T) { + db := dbm.NewMemDB() + tree := iavl.NewVersionedTree(db, cacheSize) + iavlStore := newIAVLStore(tree, numRecent, storeEvery) + nextVersion(iavlStore) + var i, j int64 + for i = 1; i <= 100; i++ { + for j = 1; j <= i; j++ { + if (i-j) < numRecent || j%storeEvery == int64(0) { + assert.True(t, iavlStore.VersionExists(j), + "Missing version %d with latest version %d. Should save last %d and every %d", + j, i, numRecent, storeEvery) + } else { + assert.False(t, iavlStore.VersionExists(j), + "Unpruned version %d with latest version %d. Should prune all but last %d and every %d", + j, i, numRecent, storeEvery) + } + } + nextVersion(iavlStore) + } + +} + func TestIAVLStoreQuery(t *testing.T) { db := dbm.NewMemDB() tree := iavl.NewVersionedTree(db, cacheSize) From b3e4faec74558a302a0a9f073c512bc99d4a5447 Mon Sep 17 00:00:00 2001 From: Jeremiah Andrews Date: Mon, 2 Jul 2018 15:17:45 -0700 Subject: [PATCH 12/13] addressing comments --- store/iavlstore.go | 16 ++++++-- store/iavlstore_test.go | 85 ++++++++++++++++++++++++++++++++--------- 2 files changed, 80 insertions(+), 21 deletions(-) diff --git a/store/iavlstore.go b/store/iavlstore.go index 8627879361..26a0c9ea17 100644 --- a/store/iavlstore.go +++ b/store/iavlstore.go @@ -43,9 +43,16 @@ type iavlStore struct { tree *iavl.VersionedTree // How many old versions we hold onto. - // A value of 0 means keep all history. + // A value of 0 means keep no recent states numRecent int64 + // Distance between state-sync waypoint states to be stored + // See https://github.com/tendermint/tendermint/issues/828 + // A value of 1 means store every state + // A value of 0 means store no waypoints (node cannot assist in state-sync) + // By default this value should be set the same across all nodes, + // so that nodes can know the waypoints their peers store + // TODO if set to non-default, signal to peers that the node is not suitable as a state sync source storeEvery int64 } @@ -70,9 +77,10 @@ func (st *iavlStore) Commit() CommitID { } // Release an old version of history, if not a sync waypoint - if st.numRecent < st.tree.Version64() { - toRelease := version - st.numRecent - if toRelease%st.storeEvery != 0 { + previous := version - 1 + if st.numRecent < previous { + toRelease := previous - st.numRecent + if st.storeEvery == 0 || toRelease%st.storeEvery != 0 { err := st.tree.DeleteVersion(toRelease) if err != nil { panic(err) diff --git a/store/iavlstore_test.go b/store/iavlstore_test.go index 51ec31f071..f6f236dd8e 100644 --- a/store/iavlstore_test.go +++ b/store/iavlstore_test.go @@ -1,6 +1,7 @@ package store import ( + "fmt" "testing" "github.com/stretchr/testify/require" @@ -260,32 +261,82 @@ func TestIAVLReverseSubspaceIterator(t *testing.T) { } func nextVersion(iavl *iavlStore) { - key := cmn.RandBytes(12) - value := cmn.RandBytes(50) + key := []byte(fmt.Sprintf("Key for tree: %d", iavl.LastCommitID().Version)) + value := []byte(fmt.Sprintf("Value for tree: %d", iavl.LastCommitID().Version)) iavl.Set(key, value) iavl.Commit() } -func TestIAVLPruning(t *testing.T) { +func TestIAVLDefaultPruning(t *testing.T) { + //Expected stored / deleted version numbers for: + //numRecent = 5, storeEvery = 3 + var states = []struct { + stored []int64 + deleted []int64 + }{ + {[]int64{}, []int64{}}, + {[]int64{1}, []int64{}}, + {[]int64{1, 2}, []int64{}}, + {[]int64{1, 2, 3}, []int64{}}, + {[]int64{1, 2, 3, 4}, []int64{}}, + {[]int64{1, 2, 3, 4, 5}, []int64{}}, + {[]int64{1, 2, 3, 4, 5, 6}, []int64{}}, + {[]int64{2, 3, 4, 5, 6, 7}, []int64{1}}, + {[]int64{3, 4, 5, 6, 7, 8}, []int64{1, 2}}, + {[]int64{3, 4, 5, 6, 7, 8, 9}, []int64{1, 2}}, + {[]int64{3, 5, 6, 7, 8, 9, 10}, []int64{1, 2, 4}}, + {[]int64{3, 6, 7, 8, 9, 10, 11}, []int64{1, 2, 4, 5}}, + {[]int64{3, 6, 7, 8, 9, 10, 11, 12}, []int64{1, 2, 4, 5}}, + {[]int64{3, 6, 8, 9, 10, 11, 12, 13}, []int64{1, 2, 4, 5, 7}}, + {[]int64{3, 6, 9, 10, 11, 12, 13, 14}, []int64{1, 2, 4, 5, 7, 8}}, + {[]int64{3, 6, 9, 10, 11, 12, 13, 14, 15}, []int64{1, 2, 4, 5, 7, 8}}, + } db := dbm.NewMemDB() tree := iavl.NewVersionedTree(db, cacheSize) iavlStore := newIAVLStore(tree, numRecent, storeEvery) - nextVersion(iavlStore) - var i, j int64 - for i = 1; i <= 100; i++ { - for j = 1; j <= i; j++ { - if (i-j) < numRecent || j%storeEvery == int64(0) { - assert.True(t, iavlStore.VersionExists(j), - "Missing version %d with latest version %d. Should save last %d and every %d", - j, i, numRecent, storeEvery) - } else { - assert.False(t, iavlStore.VersionExists(j), - "Unpruned version %d with latest version %d. Should prune all but last %d and every %d", - j, i, numRecent, storeEvery) - } + for step, state := range states { + for _, ver := range state.stored { + require.True(t, iavlStore.VersionExists(ver), + "Missing version %d with latest version %d. Should save last %d and every %d", + ver, step, numRecent, storeEvery) + } + for _, ver := range state.deleted { + require.False(t, iavlStore.VersionExists(ver), + "Unpruned version %d with latest version %d. Should prune all but last %d and every %d", + ver, step, numRecent, storeEvery) } nextVersion(iavlStore) } - +} +func TestIAVLNoPrune(t *testing.T) { + db := dbm.NewMemDB() + tree := iavl.NewVersionedTree(db, cacheSize) + iavlStore := newIAVLStore(tree, numRecent, int64(1)) + nextVersion(iavlStore) + for i := 1; i < 100; i++ { + for j := 1; j <= i; j++ { + require.True(t, iavlStore.VersionExists(int64(j)), + "Missing version %d with latest version %d. Should be storing all versions", + j, i) + } + nextVersion(iavlStore) + } +} +func TestIAVLPruneEverything(t *testing.T) { + db := dbm.NewMemDB() + tree := iavl.NewVersionedTree(db, cacheSize) + iavlStore := newIAVLStore(tree, int64(0), int64(0)) + nextVersion(iavlStore) + for i := 1; i < 100; i++ { + for j := 1; j < i; j++ { + require.False(t, iavlStore.VersionExists(int64(j)), + "Unpruned version %d with latest version %d. Should prune all old versions", + j, i) + } + require.True(t, iavlStore.VersionExists(int64(i)), + "Missing current version on step %d, should not prune current state tree", + i) + nextVersion(iavlStore) + } } func TestIAVLStoreQuery(t *testing.T) { From 61ce80135abd09525f59771a25b24fa76c0e1668 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 2 Jul 2018 17:29:47 -0400 Subject: [PATCH 13/13] Merge pull request #1509: Fix basecoin Example --- examples/basecoin/app/app.go | 151 +++++++++++------------- examples/basecoin/app/app_test.go | 93 +++++++-------- examples/basecoin/cmd/basecli/main.go | 14 +-- examples/basecoin/cmd/basecoind/main.go | 9 +- examples/basecoin/types/account.go | 51 ++++---- server/init.go | 2 +- 6 files changed, 153 insertions(+), 167 deletions(-) diff --git a/examples/basecoin/app/app.go b/examples/basecoin/app/app.go index 089d1ca23c..fca5e86393 100644 --- a/examples/basecoin/app/app.go +++ b/examples/basecoin/app/app.go @@ -3,183 +3,174 @@ package app import ( "encoding/json" - abci "github.com/tendermint/tendermint/abci/types" - tmtypes "github.com/tendermint/tendermint/types" - cmn "github.com/tendermint/tmlibs/common" - dbm "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/log" - bam "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/examples/basecoin/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/wire" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/ibc" - "github.com/cosmos/cosmos-sdk/x/slashing" - "github.com/cosmos/cosmos-sdk/x/stake" - - "github.com/cosmos/cosmos-sdk/examples/basecoin/types" + abci "github.com/tendermint/tendermint/abci/types" + tmtypes "github.com/tendermint/tendermint/types" + cmn "github.com/tendermint/tmlibs/common" + dbm "github.com/tendermint/tmlibs/db" + "github.com/tendermint/tmlibs/log" ) const ( appName = "BasecoinApp" ) -// Extended ABCI application +// BasecoinApp implements an extended ABCI application. It contains a BaseApp, +// a codec for serialization, KVStore keys for multistore state management, and +// various mappers and keepers to manage getting, setting, and serializing the +// integral app types. type BasecoinApp struct { *bam.BaseApp cdc *wire.Codec - // keys to access the substores - keyMain *sdk.KVStoreKey - keyAccount *sdk.KVStoreKey - keyIBC *sdk.KVStoreKey - keyStake *sdk.KVStoreKey - keySlashing *sdk.KVStoreKey + // keys to access the multistore + keyMain *sdk.KVStoreKey + keyAccount *sdk.KVStoreKey + keyIBC *sdk.KVStoreKey - // Manage getting and setting accounts + // manage getting and setting accounts accountMapper auth.AccountMapper feeCollectionKeeper auth.FeeCollectionKeeper coinKeeper bank.Keeper ibcMapper ibc.Mapper - stakeKeeper stake.Keeper - slashingKeeper slashing.Keeper } +// NewBasecoinApp returns a reference to a new BasecoinApp given a logger and +// database. Internally, a codec is created along with all the necessary keys. +// In addition, all necessary mappers and keepers are created, routes +// registered, and finally the stores being mounted along with any necessary +// chain initialization. func NewBasecoinApp(logger log.Logger, db dbm.DB) *BasecoinApp { + // create and register app-level codec for TXs and accounts + cdc := MakeCodec() - // Create app-level codec for txs and accounts. - var cdc = MakeCodec() - - // Create your application object. + // create your application type var app = &BasecoinApp{ - BaseApp: bam.NewBaseApp(appName, cdc, logger, db), - cdc: cdc, - keyMain: sdk.NewKVStoreKey("main"), - keyAccount: sdk.NewKVStoreKey("acc"), - keyIBC: sdk.NewKVStoreKey("ibc"), - keyStake: sdk.NewKVStoreKey("stake"), - keySlashing: sdk.NewKVStoreKey("slashing"), + cdc: cdc, + BaseApp: bam.NewBaseApp(appName, cdc, logger, db), + keyMain: sdk.NewKVStoreKey("main"), + keyAccount: sdk.NewKVStoreKey("acc"), + keyIBC: sdk.NewKVStoreKey("ibc"), } - // Define the accountMapper. + // define and attach the mappers and keepers app.accountMapper = auth.NewAccountMapper( cdc, app.keyAccount, // target store &types.AppAccount{}, // prototype ) - - // add accountMapper/handlers app.coinKeeper = bank.NewKeeper(app.accountMapper) app.ibcMapper = ibc.NewMapper(app.cdc, app.keyIBC, app.RegisterCodespace(ibc.DefaultCodespace)) - app.stakeKeeper = stake.NewKeeper(app.cdc, app.keyStake, app.coinKeeper, app.RegisterCodespace(stake.DefaultCodespace)) - app.slashingKeeper = slashing.NewKeeper(app.cdc, app.keySlashing, app.stakeKeeper, app.RegisterCodespace(slashing.DefaultCodespace)) // register message routes app.Router(). AddRoute("bank", bank.NewHandler(app.coinKeeper)). - AddRoute("ibc", ibc.NewHandler(app.ibcMapper, app.coinKeeper)). - AddRoute("stake", stake.NewHandler(app.stakeKeeper)) + AddRoute("ibc", ibc.NewHandler(app.ibcMapper, app.coinKeeper)) - // Initialize BaseApp. + // perform initialization logic app.SetInitChainer(app.initChainer) app.SetBeginBlocker(app.BeginBlocker) app.SetEndBlocker(app.EndBlocker) app.SetAnteHandler(auth.NewAnteHandler(app.accountMapper, app.feeCollectionKeeper)) - app.MountStoresIAVL(app.keyMain, app.keyAccount, app.keyIBC, app.keyStake, app.keySlashing) + + // mount the multistore and load the latest state + app.MountStoresIAVL(app.keyMain, app.keyAccount, app.keyIBC) err := app.LoadLatestVersion(app.keyMain) if err != nil { cmn.Exit(err.Error()) } + return app } -// Custom tx codec +// MakeCodec creates a new wire codec and registers all the necessary types +// with the codec. func MakeCodec() *wire.Codec { - var cdc = wire.NewCodec() - wire.RegisterCrypto(cdc) // Register crypto. - sdk.RegisterWire(cdc) // Register Msgs + cdc := wire.NewCodec() + + wire.RegisterCrypto(cdc) + sdk.RegisterWire(cdc) bank.RegisterWire(cdc) - stake.RegisterWire(cdc) - slashing.RegisterWire(cdc) ibc.RegisterWire(cdc) - // register custom AppAccount + // register custom types cdc.RegisterInterface((*auth.Account)(nil), nil) cdc.RegisterConcrete(&types.AppAccount{}, "basecoin/Account", nil) + return cdc } -// application updates every end block -func (app *BasecoinApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - tags := slashing.BeginBlocker(ctx, req, app.slashingKeeper) - - return abci.ResponseBeginBlock{ - Tags: tags.ToKVPairs(), - } +// BeginBlocker reflects logic to run before any TXs application are processed +// by the application. +func (app *BasecoinApp) BeginBlocker(_ sdk.Context, _ abci.RequestBeginBlock) abci.ResponseBeginBlock { + return abci.ResponseBeginBlock{} } -// application updates every end block -// nolint: unparam -func (app *BasecoinApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - validatorUpdates := stake.EndBlocker(ctx, app.stakeKeeper) - - return abci.ResponseEndBlock{ - ValidatorUpdates: validatorUpdates, - } +// EndBlocker reflects logic to run after all TXs are processed by the +// application. +func (app *BasecoinApp) EndBlocker(_ sdk.Context, _ abci.RequestEndBlock) abci.ResponseEndBlock { + return abci.ResponseEndBlock{} } -// Custom logic for basecoin initialization +// initChainer implements the custom application logic that the BaseApp will +// invoke upon initialization. In this case, it will take the application's +// state provided by 'req' and attempt to deserialize said state. The state +// should contain all the genesis accounts. These accounts will be added to the +// application's account mapper. func (app *BasecoinApp) initChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { stateJSON := req.AppStateBytes genesisState := new(types.GenesisState) err := app.cdc.UnmarshalJSON(stateJSON, genesisState) if err != nil { - panic(err) // TODO https://github.com/cosmos/cosmos-sdk/issues/468 - // return sdk.ErrGenesisParse("").TraceCause(err, "") + // TODO: https://github.com/cosmos/cosmos-sdk/issues/468 + panic(err) } for _, gacc := range genesisState.Accounts { acc, err := gacc.ToAppAccount() if err != nil { - panic(err) // TODO https://github.com/cosmos/cosmos-sdk/issues/468 - // return sdk.ErrGenesisParse("").TraceCause(err, "") + // TODO: https://github.com/cosmos/cosmos-sdk/issues/468 + panic(err) } + acc.AccountNumber = app.accountMapper.GetNextAccountNumber(ctx) app.accountMapper.SetAccount(ctx, acc) } - // load the initial stake information - stake.InitGenesis(ctx, app.stakeKeeper, genesisState.StakeData) - return abci.ResponseInitChain{} } -// Custom logic for state export +// ExportAppStateAndValidators implements custom application logic that exposes +// various parts of the application's state and set of validators. An error is +// returned if any step getting the state or set of validators fails. func (app *BasecoinApp) ExportAppStateAndValidators() (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error) { ctx := app.NewContext(true, abci.Header{}) - - // iterate to get the accounts accounts := []*types.GenesisAccount{} - appendAccount := func(acc auth.Account) (stop bool) { + + appendAccountsFn := func(acc auth.Account) bool { account := &types.GenesisAccount{ Address: acc.GetAddress(), Coins: acc.GetCoins(), } + accounts = append(accounts, account) return false } - app.accountMapper.IterateAccounts(ctx, appendAccount) - genState := types.GenesisState{ - Accounts: accounts, - StakeData: stake.WriteGenesis(ctx, app.stakeKeeper), - } + app.accountMapper.IterateAccounts(ctx, appendAccountsFn) + + genState := types.GenesisState{Accounts: accounts} appState, err = wire.MarshalJSONIndent(app.cdc, genState) if err != nil { return nil, nil, err } - validators = stake.WriteValidators(ctx, app.stakeKeeper) + return appState, validators, err } diff --git a/examples/basecoin/app/app_test.go b/examples/basecoin/app/app_test.go index 499c0e4082..2605dad66a 100644 --- a/examples/basecoin/app/app_test.go +++ b/examples/basecoin/app/app_test.go @@ -1,88 +1,81 @@ package app import ( - "fmt" "os" "testing" - "github.com/stretchr/testify/require" - "github.com/cosmos/cosmos-sdk/examples/basecoin/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/wire" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/stake" - gen "github.com/cosmos/cosmos-sdk/x/stake/types" - + "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" dbm "github.com/tendermint/tmlibs/db" "github.com/tendermint/tmlibs/log" ) -func setGenesis(bapp *BasecoinApp, accs ...auth.BaseAccount) error { - genaccs := make([]*types.GenesisAccount, len(accs)) - for i, acc := range accs { - genaccs[i] = types.NewGenesisAccount(&types.AppAccount{acc, "foobart"}) +func setGenesis(baseApp *BasecoinApp, accounts ...*types.AppAccount) (types.GenesisState, error) { + genAccts := make([]*types.GenesisAccount, len(accounts)) + for i, appAct := range accounts { + genAccts[i] = types.NewGenesisAccount(appAct) } - genesisState := types.GenesisState{ - Accounts: genaccs, - StakeData: stake.DefaultGenesisState(), - } - - stateBytes, err := wire.MarshalJSONIndent(bapp.cdc, genesisState) + genesisState := types.GenesisState{Accounts: genAccts} + stateBytes, err := wire.MarshalJSONIndent(baseApp.cdc, genesisState) if err != nil { - return err + return types.GenesisState{}, err } - // Initialize the chain - vals := []abci.Validator{} - bapp.InitChain(abci.RequestInitChain{Validators: vals, AppStateBytes: stateBytes}) - bapp.Commit() + // initialize and commit the chain + baseApp.InitChain(abci.RequestInitChain{ + Validators: []abci.Validator{}, AppStateBytes: stateBytes, + }) + baseApp.Commit() - return nil + return genesisState, nil } -//_______________________________________________________________________ - func TestGenesis(t *testing.T) { logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)).With("module", "sdk/app") db := dbm.NewMemDB() - bapp := NewBasecoinApp(logger, db) + baseApp := NewBasecoinApp(logger, db) - // Construct some genesis bytes to reflect basecoin/types/AppAccount - pk := crypto.GenPrivKeyEd25519().PubKey() - addr := pk.Address() + // construct a pubkey and an address for the test account + pubkey := crypto.GenPrivKeyEd25519().PubKey() + addr := pubkey.Address() + + // construct some test coins coins, err := sdk.ParseCoins("77foocoin,99barcoin") require.Nil(t, err) - baseAcc := auth.BaseAccount{ - Address: addr, - Coins: coins, - } - acc := &types.AppAccount{baseAcc, "foobart"} - err = setGenesis(bapp, baseAcc) + // create an auth.BaseAccount for the given test account and set it's coins + baseAcct := auth.NewBaseAccountWithAddress(addr) + err = baseAcct.SetCoins(coins) require.Nil(t, err) - // A checkTx context - ctx := bapp.BaseApp.NewContext(true, abci.Header{}) - res1 := bapp.accountMapper.GetAccount(ctx, baseAcc.Address) - require.Equal(t, acc, res1) + // create a new test AppAccount with the given auth.BaseAccount + appAcct := types.NewAppAccount("foobar", baseAcct) + genState, err := setGenesis(baseApp, appAcct) + require.Nil(t, err) + + // create a context for the BaseApp + ctx := baseApp.BaseApp.NewContext(true, abci.Header{}) + res := baseApp.accountMapper.GetAccount(ctx, baseAcct.Address) + require.Equal(t, appAcct, res) // reload app and ensure the account is still there - bapp = NewBasecoinApp(logger, db) - // Initialize stake data with default genesis state - stakedata := gen.DefaultGenesisState() - genState, err := bapp.cdc.MarshalJSON(stakedata) - if err != nil { - panic(err) - } + baseApp = NewBasecoinApp(logger, db) - // InitChain with default stake data. Initializes deliverState and checkState context - bapp.InitChain(abci.RequestInitChain{AppStateBytes: []byte(fmt.Sprintf("{\"stake\": %s}", string(genState)))}) + stateBytes, err := wire.MarshalJSONIndent(baseApp.cdc, genState) + require.Nil(t, err) - ctx = bapp.BaseApp.NewContext(true, abci.Header{}) - res1 = bapp.accountMapper.GetAccount(ctx, baseAcc.Address) - require.Equal(t, acc, res1) + // initialize the chain with the expected genesis state + baseApp.InitChain(abci.RequestInitChain{ + Validators: []abci.Validator{}, AppStateBytes: stateBytes, + }) + + ctx = baseApp.BaseApp.NewContext(true, abci.Header{}) + res = baseApp.accountMapper.GetAccount(ctx, baseAcct.Address) + require.Equal(t, appAcct, res) } diff --git a/examples/basecoin/cmd/basecli/main.go b/examples/basecoin/cmd/basecli/main.go index 1191aab6ab..fef9727a47 100644 --- a/examples/basecoin/cmd/basecli/main.go +++ b/examples/basecoin/cmd/basecli/main.go @@ -3,24 +3,20 @@ package main import ( "os" - "github.com/spf13/cobra" - - "github.com/tendermint/tmlibs/cli" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/lcd" "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/client/tx" - + "github.com/cosmos/cosmos-sdk/examples/basecoin/app" + "github.com/cosmos/cosmos-sdk/examples/basecoin/types" "github.com/cosmos/cosmos-sdk/version" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli" ibccmd "github.com/cosmos/cosmos-sdk/x/ibc/client/cli" stakecmd "github.com/cosmos/cosmos-sdk/x/stake/client/cli" - - "github.com/cosmos/cosmos-sdk/examples/basecoin/app" - "github.com/cosmos/cosmos-sdk/examples/basecoin/types" + "github.com/spf13/cobra" + "github.com/tendermint/tmlibs/cli" ) // rootCmd is the entry point for this binary @@ -82,7 +78,7 @@ func main() { executor := cli.PrepareMainCmd(rootCmd, "BC", os.ExpandEnv("$HOME/.basecli")) err := executor.Execute() if err != nil { - // handle with #870 + // Note: Handle with #870 panic(err) } } diff --git a/examples/basecoin/cmd/basecoind/main.go b/examples/basecoin/cmd/basecoind/main.go index f3f3de519a..2cb37cfe12 100644 --- a/examples/basecoin/cmd/basecoind/main.go +++ b/examples/basecoin/cmd/basecoind/main.go @@ -4,16 +4,14 @@ import ( "encoding/json" "os" + "github.com/cosmos/cosmos-sdk/examples/basecoin/app" + "github.com/cosmos/cosmos-sdk/server" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" tmtypes "github.com/tendermint/tendermint/types" "github.com/tendermint/tmlibs/cli" dbm "github.com/tendermint/tmlibs/db" "github.com/tendermint/tmlibs/log" - - "github.com/cosmos/cosmos-sdk/examples/basecoin/app" - "github.com/cosmos/cosmos-sdk/server" ) func main() { @@ -33,9 +31,10 @@ func main() { // prepare and add flags rootDir := os.ExpandEnv("$HOME/.basecoind") executor := cli.PrepareBaseCmd(rootCmd, "BC", rootDir) + err := executor.Execute() if err != nil { - // handle with #870 + // Note: Handle with #870 panic(err) } } diff --git a/examples/basecoin/types/account.go b/examples/basecoin/types/account.go index 43a8e2e389..8047ed68da 100644 --- a/examples/basecoin/types/account.go +++ b/examples/basecoin/types/account.go @@ -4,18 +4,17 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/wire" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/stake" ) var _ auth.Account = (*AppAccount)(nil) -// Custom extensions for this application. This is just an example of -// extending auth.BaseAccount with custom fields. -// -// This is compatible with the stock auth.AccountStore, since -// auth.AccountStore uses the flexible go-amino library. +// AppAccount is a custom extension for this application. It is an example of +// extending auth.BaseAccount with custom fields. It is compatible with the +// stock auth.AccountStore, since auth.AccountStore uses the flexible go-amino +// library. type AppAccount struct { auth.BaseAccount + Name string `json:"name"` } @@ -23,36 +22,45 @@ type AppAccount struct { func (acc AppAccount) GetName() string { return acc.Name } func (acc *AppAccount) SetName(name string) { acc.Name = name } -// Get the AccountDecoder function for the custom AppAccount +// NewAppAccount returns a reference to a new AppAccount given a name and an +// auth.BaseAccount. +func NewAppAccount(name string, baseAcct auth.BaseAccount) *AppAccount { + return &AppAccount{BaseAccount: baseAcct, Name: name} +} + +// GetAccountDecoder returns the AccountDecoder function for the custom +// AppAccount. func GetAccountDecoder(cdc *wire.Codec) auth.AccountDecoder { - return func(accBytes []byte) (res auth.Account, err error) { + return func(accBytes []byte) (auth.Account, error) { if len(accBytes) == 0 { return nil, sdk.ErrTxDecode("accBytes are empty") } + acct := new(AppAccount) - err = cdc.UnmarshalBinaryBare(accBytes, &acct) + err := cdc.UnmarshalBinaryBare(accBytes, &acct) if err != nil { panic(err) } + return acct, err } } -//___________________________________________________________________________________ - -// State to Unmarshal +// GenesisState reflects the genesis state of the application. type GenesisState struct { - Accounts []*GenesisAccount `json:"accounts"` - StakeData stake.GenesisState `json:"stake"` + Accounts []*GenesisAccount `json:"accounts"` } -// GenesisAccount doesn't need pubkey or sequence +// GenesisAccount reflects a genesis account the application expects in it's +// genesis state. type GenesisAccount struct { Name string `json:"name"` Address sdk.Address `json:"address"` Coins sdk.Coins `json:"coins"` } +// NewGenesisAccount returns a reference to a new GenesisAccount given an +// AppAccount. func NewGenesisAccount(aa *AppAccount) *GenesisAccount { return &GenesisAccount{ Name: aa.Name, @@ -61,14 +69,13 @@ func NewGenesisAccount(aa *AppAccount) *GenesisAccount { } } -// convert GenesisAccount to AppAccount +// ToAppAccount converts a GenesisAccount to an AppAccount. func (ga *GenesisAccount) ToAppAccount() (acc *AppAccount, err error) { - baseAcc := auth.BaseAccount{ - Address: ga.Address, - Coins: ga.Coins.Sort(), - } return &AppAccount{ - BaseAccount: baseAcc, - Name: ga.Name, + Name: ga.Name, + BaseAccount: auth.BaseAccount{ + Address: ga.Address, + Coins: ga.Coins.Sort(), + }, }, nil } diff --git a/server/init.go b/server/init.go index ed1727e35e..8beeb354e6 100644 --- a/server/init.go +++ b/server/init.go @@ -444,7 +444,7 @@ func SimpleAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (appState j "coins": [ { "denom": "mycoin", - "amount": 9007199254740992 + "amount": "9007199254740992" } ] }]