diff --git a/Makefile b/Makefile index 9dd5f0384e..011256ad9b 100644 --- a/Makefile +++ b/Makefile @@ -65,28 +65,6 @@ ifeq (race,$(findstring race,$(TENDERMINT_BUILD_OPTIONS))) BUILD_FLAGS += -race endif -# handle cleveldb -ifeq (cleveldb,$(findstring cleveldb,$(TENDERMINT_BUILD_OPTIONS))) - CGO_ENABLED=1 - BUILD_TAGS += cleveldb -endif - -# handle badgerdb -ifeq (badgerdb,$(findstring badgerdb,$(TENDERMINT_BUILD_OPTIONS))) - BUILD_TAGS += badgerdb -endif - -# handle rocksdb -ifeq (rocksdb,$(findstring rocksdb,$(TENDERMINT_BUILD_OPTIONS))) - CGO_ENABLED=1 - BUILD_TAGS += rocksdb -endif - -# handle boltdb -ifeq (boltdb,$(findstring boltdb,$(TENDERMINT_BUILD_OPTIONS))) - BUILD_TAGS += boltdb -endif - # allow users to pass additional flags via the conventional LDFLAGS variable LD_FLAGS += $(LDFLAGS) diff --git a/cmd/tenderdash/commands/inspect.go b/cmd/tenderdash/commands/inspect.go index 84bbb1e18f..541f3bdb70 100644 --- a/cmd/tenderdash/commands/inspect.go +++ b/cmd/tenderdash/commands/inspect.go @@ -43,8 +43,6 @@ func MakeInspectCommand(conf *config.Config, logger log.Logger) *cobra.Command { } cmd.Flags().String("rpc.laddr", conf.RPC.ListenAddress, "RPC listenener address. Port required") - cmd.Flags().String("db-backend", - conf.DBBackend, "database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb") cmd.Flags().String("db-dir", conf.DBPath, "database directory") return cmd diff --git a/cmd/tenderdash/commands/run_node.go b/cmd/tenderdash/commands/run_node.go index 820eb7f8fe..e7962630c3 100644 --- a/cmd/tenderdash/commands/run_node.go +++ b/cmd/tenderdash/commands/run_node.go @@ -81,10 +81,6 @@ func AddNodeFlags(cmd *cobra.Command, conf *cfg.Config) { } func addDBFlags(cmd *cobra.Command, conf *cfg.Config) { - cmd.Flags().String( - "db-backend", - conf.DBBackend, - "database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb") cmd.Flags().String( "db-dir", conf.DBPath, diff --git a/config/config.go b/config/config.go index afc0ced999..ac43d04413 100644 --- a/config/config.go +++ b/config/config.go @@ -9,6 +9,7 @@ import ( "os" "path/filepath" "strings" + "testing" "time" "github.com/dashpay/dashd-go/btcjson" @@ -197,25 +198,12 @@ type BaseConfig struct { //nolint: maligned // - No priv_validator_key.json, priv_validator_state.json Mode string `mapstructure:"mode"` - // Database backend: goleveldb | cleveldb | boltdb | rocksdb + // Database backend: only goleveldb is supported // * goleveldb (github.com/syndtr/goleveldb - most popular implementation) // - pure go // - stable - // * cleveldb (uses levigo wrapper) - // - fast - // - requires gcc - // - use cleveldb build tag (go build -tags cleveldb) - // * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt) - // - EXPERIMENTAL - // - may be faster is some use-cases (random reads - indexer) - // - use boltdb build tag (go build -tags boltdb) - // * rocksdb (uses github.com/tecbot/gorocksdb) - // - EXPERIMENTAL - // - requires gcc - // - use rocksdb build tag (go build -tags rocksdb) - // * badgerdb (uses github.com/dgraph-io/badger) - // - EXPERIMENTAL - // - use badgerdb build tag (go build -tags badgerdb) + // + // Note: we don't remove it from config as we also use `memdb` in some tests. DBBackend string `mapstructure:"db-backend"` // Database directory @@ -356,6 +344,15 @@ func (cfg BaseConfig) ValidateBasic() error { return errors.New("deadlock-detection can't be negative") } + backends := map[string]bool{"goleveldb": true} + if testing.Testing() { + backends["memdb"] = true + } + // check if db_backends contains the db backend + if !backends[cfg.DBBackend] { + return fmt.Errorf("unsupported db backend: %s, only goleveldb is supported", cfg.DBBackend) + } + return nil } diff --git a/config/toml.go b/config/toml.go index 21badab4be..b6be127b28 100644 --- a/config/toml.go +++ b/config/toml.go @@ -101,25 +101,10 @@ moniker = "{{ .BaseConfig.Moniker }}" # - No priv_validator_key.json, priv_validator_state.json mode = "{{ .BaseConfig.Mode }}" -# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb +# Database backend: only goleveldb supported # * goleveldb (github.com/syndtr/goleveldb - most popular implementation) # - pure go # - stable -# * cleveldb (uses levigo wrapper) -# - fast -# - requires gcc -# - use cleveldb build tag (go build -tags cleveldb) -# * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt) -# - EXPERIMENTAL -# - may be faster is some use-cases (random reads - indexer) -# - use boltdb build tag (go build -tags boltdb) -# * rocksdb (uses github.com/tecbot/gorocksdb) -# - EXPERIMENTAL -# - requires gcc -# - use rocksdb build tag (go build -tags rocksdb) -# * badgerdb (uses github.com/dgraph-io/badger) -# - EXPERIMENTAL -# - use badgerdb build tag (go build -tags badgerdb) db-backend = "{{ .BaseConfig.DBBackend }}" # Database directory diff --git a/docs/nodes/configuration.md b/docs/nodes/configuration.md index a55bfb63a2..2a7c33e8ad 100644 --- a/docs/nodes/configuration.md +++ b/docs/nodes/configuration.md @@ -48,25 +48,10 @@ moniker = "sidewinder" # - No priv_validator_key.json, priv_validator_state.json mode = "validator" -# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb +# Database backend: goleveldb # * goleveldb (github.com/syndtr/goleveldb - most popular implementation) # - pure go # - stable -# * cleveldb (uses levigo wrapper) -# - fast -# - requires gcc -# - use cleveldb build tag (go build -tags cleveldb) -# * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt) -# - EXPERIMENTAL -# - may be faster is some use-cases (random reads - indexer) -# - use boltdb build tag (go build -tags boltdb) -# * rocksdb (uses github.com/tecbot/gorocksdb) -# - EXPERIMENTAL -# - requires gcc -# - use rocksdb build tag (go build -tags rocksdb) -# * badgerdb (uses github.com/dgraph-io/badger) -# - EXPERIMENTAL -# - use badgerdb build tag (go build -tags badgerdb) db-backend = "goleveldb" # Database directory @@ -533,29 +518,31 @@ Tendermint will only create blocks if there are transactions, or after waiting This section will cover settings within the p2p section of the `config.toml`. - `external-address` = is the address that will be advertised for other nodes to use. We recommend setting this field with your public IP and p2p port. - - > We recommend setting an external address. When used in a private network, Tendermint Core currently doesn't advertise the node's public address. There is active and ongoing work to improve the P2P system, but this is a helpful workaround for now. + - > We recommend setting an external address. When used in a private network, Tendermint Core currently doesn't advertise the node's public address. There is active and ongoing work to improve the P2P system, but this is a helpful workaround for now. - `persistent-peers` = is a list of comma separated peers that you will always want to be connected to. If you're already connected to the maximum number of peers, persistent peers will not be added. - `pex` = turns the peer exchange reactor on or off. Validator node will want the `pex` turned off so it would not begin gossiping to unknown peers on the network. PeX can also be turned off for statically configured networks with fixed network connectivity. For full nodes on open, dynamic networks, it should be turned on. - `private-peer-ids` = is a comma-separated list of node ids that will _not_ be exposed to other peers (i.e., you will not tell other peers about the ids in this list). This can be filled with a validator's node id. -Recently the Tendermint Team conducted a refactor of the p2p layer. This lead to multiple config parameters being deprecated and/or replaced. +Recently the Tendermint Team conducted a refactor of the p2p layer. This lead to multiple config parameters being deprecated and/or replaced. We will cover the new and deprecated parameters below. + ### New Parameters There are three new parameters, which are enabled if use-legacy is set to false. - `queue-type` = sets a type of queue to use in the p2p layer. There are three options available `fifo`, `priority` and `wdrr`. The default is priority -- `bootstrap-peers` = is a list of comma seperated peers which will be used to bootstrap the address book. +- `bootstrap-peers` = is a list of comma seperated peers which will be used to bootstrap the address book. - `max-connections` = is the max amount of allowed inbound and outbound connections. + ### Deprecated Parameters > Note: For Tendermint 0.35, there are two p2p implementations. The old version is used by default with the deprecated fields. The new implementation uses different config parameters, explained above. -- `max-num-inbound-peers` = is the maximum number of peers you will accept inbound connections from at one time (where they dial your address and initiate the connection). *This was replaced by `max-connections`* -- `max-num-outbound-peers` = is the maximum number of peers you will initiate outbound connects to at one time (where you dial their address and initiate the connection).*This was replaced by `max-connections`* -- `unconditional-peer-ids` = is similar to `persistent-peers` except that these peers will be connected to even if you are already connected to the maximum number of peers. This can be a validator node ID on your sentry node. *Deprecated* -- `seeds` = is a list of comma separated seed nodes that you will connect upon a start and ask for peers. A seed node is a node that does not participate in consensus but only helps propagate peers to nodes in the networks *Deprecated, replaced by bootstrap peers* +- `max-num-inbound-peers` = is the maximum number of peers you will accept inbound connections from at one time (where they dial your address and initiate the connection). _This was replaced by `max-connections`_ +- `max-num-outbound-peers` = is the maximum number of peers you will initiate outbound connects to at one time (where you dial their address and initiate the connection)._This was replaced by `max-connections`_ +- `unconditional-peer-ids` = is similar to `persistent-peers` except that these peers will be connected to even if you are already connected to the maximum number of peers. This can be a validator node ID on your sentry node. _Deprecated_ +- `seeds` = is a list of comma separated seed nodes that you will connect upon a start and ask for peers. A seed node is a node that does not participate in consensus but only helps propagate peers to nodes in the networks _Deprecated, replaced by bootstrap peers_ ## Indexing Settings @@ -590,7 +577,7 @@ the `psql` indexer type. Example: ```shell -$ psql ... -f state/indexer/sink/psql/schema.sql +psql ... -f state/indexer/sink/psql/schema.sql ``` ## Unsafe Consensus Timeout Overrides diff --git a/test/e2e/Makefile b/test/e2e/Makefile index aade8c220e..5f5ca11d5f 100644 --- a/test/e2e/Makefile +++ b/test/e2e/Makefile @@ -26,7 +26,7 @@ docker: -f docker/Dockerfile ../.. node: - GOTRACEBACK=crash $(GO) build -gcflags="all=-N -l" -o build/node -tags badgerdb,boltdb,cleveldb,deadlock ./node + GOTRACEBACK=crash $(GO) build -gcflags="all=-N -l" -o build/node -tags deadlock ./node e2e/app/compile: docker run --rm -it --entrypoint "/src/tenderdash/test/e2e/entrypoint.sh" -w "/src/tenderdash/test/e2e" -v $(ROOT_PATH)/test/e2e:/src/tenderdash/test/e2e tenderdash/e2e-node diff --git a/test/e2e/README.md b/test/e2e/README.md index 3ffb0f67f9..7ef0486a25 100644 --- a/test/e2e/README.md +++ b/test/e2e/README.md @@ -217,7 +217,7 @@ To analyze core dumps: 1. Examine [Dockerfile](docker/Dockerfile) to ensure `ENV TENDERMINT_BUILD_OPTIONS` contains `nostrip` option AND `GOTRACEBACK` is set to `crash`, for example: ```docker - ENV TENDERMINT_BUILD_OPTIONS badgerdb,boltdb,cleveldb,rocksdb,nostrip + ENV TENDERMINT_BUILD_OPTIONS nostrip ENV GOTRACEBACK=crash ``` @@ -255,9 +255,9 @@ Docker does not enable IPv6 by default. To do so, enter the following in It is also possible to run a simple benchmark on a testnet. This is done through the `benchmark` command. This manages the entire process: setting up the environment, starting the test net, waiting for a considerable amount of blocks to be used (currently 100), and then returning the following metrics from the sample of the blockchain: -- Average time to produce a block -- Standard deviation of producing a block -- Minimum and maximum time to produce a block +* Average time to produce a block +* Standard deviation of producing a block +* Minimum and maximum time to produce a block ## Running Individual Nodes diff --git a/test/e2e/generator/generate.go b/test/e2e/generator/generate.go index 2fbc995cd3..1d65fee0f5 100644 --- a/test/e2e/generator/generate.go +++ b/test/e2e/generator/generate.go @@ -36,9 +36,6 @@ var ( // The following specify randomly chosen values for testnet nodes. nodeDatabases = weightedChoice{ "goleveldb": 35, - "badgerdb": 35, - "boltdb": 15, - "cleveldb": 5, } ABCIProtocols = weightedChoice{ "tcp": 20, diff --git a/test/e2e/networks/ci.toml b/test/e2e/networks/ci.toml index 34627da571..eefce82dc6 100644 --- a/test/e2e/networks/ci.toml +++ b/test/e2e/networks/ci.toml @@ -3,7 +3,7 @@ evidence = 5 initial_height = 1000 -initial_state = {initial01 = "a", initial02 = "b", initial03 = "c"} +initial_state = { initial01 = "a", initial02 = "b", initial03 = "c" } queue_type = "simple-priority" abci_protocol = "builtin" initial_core_chain_locked_height = 3400 @@ -41,7 +41,7 @@ block_sync = "v0" perturb = ["disconnect"] [node.validator02] -database = "cleveldb" +database = "goleveldb" persist_interval = 0 perturb = ["restart"] privval_protocol = "tcp" @@ -49,7 +49,7 @@ seeds = ["seed01"] block_sync = "v0" [node.validator03] -database = "badgerdb" +database = "goleveldb" seeds = ["seed01"] persist_interval = 3 perturb = ["kill"] @@ -59,7 +59,7 @@ retain_blocks = 10 [node.validator04] snapshot_interval = 5 -database = "badgerdb" +database = "goleveldb" persistent_peers = ["validator01"] perturb = ["pause"] block_sync = "v0" @@ -67,16 +67,16 @@ privval_protocol = "tcp" [node.validator05] block_sync = "v0" -database = "badgerdb" +database = "goleveldb" state_sync = "p2p" -start_at = 1005 # Becomes part of the validator set at 1010 +start_at = 1005 # Becomes part of the validator set at 1010 perturb = ["pause", "disconnect", "restart"] [node.full01] mode = "full" start_at = 1010 block_sync = "v0" -database = "boltdb" +database = "goleveldb" persistent_peers = ["validator01", "validator02", "validator03", "validator04"] perturb = ["restart"] retain_blocks = 10 diff --git a/test/e2e/networks/dashcore.toml b/test/e2e/networks/dashcore.toml index aa70916364..f07e2c02ef 100644 --- a/test/e2e/networks/dashcore.toml +++ b/test/e2e/networks/dashcore.toml @@ -56,7 +56,7 @@ privval_protocol = "dashcore" [node.validator02] seeds = ["seed01"] -database = "boltdb" +database = "goleveldb" abci_protocol = "tcp" privval_protocol = "dashcore" persist_interval = 0 @@ -64,7 +64,7 @@ perturb = ["restart"] [node.validator03] seeds = ["seed01"] -database = "badgerdb" +database = "goleveldb" # FIXME: should be grpc, disabled due to https://github.com/tendermint/tendermint/issues/5439 #abci_protocol = "grpc" privval_protocol = "dashcore" @@ -74,7 +74,7 @@ perturb = ["kill"] [node.validator04] persistent_peers = ["validator01"] -database = "badgerdb" +database = "goleveldb" abci_protocol = "builtin" privval_protocol = "dashcore" perturb = ["pause"] @@ -82,7 +82,7 @@ perturb = ["pause"] [node.validator05] start_at = 1005 # Becomes part of the validator set at 1010 seeds = ["seed01"] -database = "cleveldb" +database = "goleveldb" block_sync = "v0" state_sync = "p2p" privval_protocol = "dashcore" diff --git a/test/e2e/networks/island.toml b/test/e2e/networks/island.toml index 53fcc57b4a..3546dfbb96 100644 --- a/test/e2e/networks/island.toml +++ b/test/e2e/networks/island.toml @@ -1,5 +1,5 @@ initial_height = 1000 -initial_state = {items={ initial01 = "a", initial02 = "b", initial03 = "c" }} +initial_state = { items = { initial01 = "a", initial02 = "b", initial03 = "c" } } initial_core_chain_locked_height = 3400 [chainlock_updates] @@ -42,40 +42,40 @@ perturb = ["disconnect"] privval_protocol = "dashcore" [node.validator02] -database = "boltdb" +database = "goleveldb" abci_protocol = "tcp" privval_protocol = "dashcore" persist_interval = 0 perturb = ["restart"] [node.validator03] -database = "badgerdb" +database = "goleveldb" privval_protocol = "dashcore" persist_interval = 3 retain_blocks = 3 perturb = ["kill"] [node.validator04] -database = "badgerdb" +database = "goleveldb" abci_protocol = "builtin" privval_protocol = "dashcore" perturb = ["pause"] [node.validator05] start_at = 1005 -database = "cleveldb" +database = "goleveldb" fast_sync = "v0" privval_protocol = "dashcore" perturb = ["kill", "pause", "disconnect", "restart"] [node.validator06] -database = "cleveldb" +database = "goleveldb" fast_sync = "v0" privval_protocol = "dashcore" [node.validator07] start_at = 1005 -database = "cleveldb" +database = "goleveldb" fast_sync = "v0" privval_protocol = "dashcore" perturb = ["pause"] diff --git a/test/e2e/networks/rotate.toml b/test/e2e/networks/rotate.toml index 84a6c2d150..2e725ec190 100644 --- a/test/e2e/networks/rotate.toml +++ b/test/e2e/networks/rotate.toml @@ -120,7 +120,7 @@ privval_protocol = "dashcore" [node.validator02] seeds = ["seed01"] -database = "boltdb" +database = "goleveldb" abci_protocol = "tcp" privval_protocol = "dashcore" persist_interval = 0 @@ -128,7 +128,7 @@ perturb = ["restart"] [node.validator03] seeds = ["seed01"] -database = "badgerdb" +database = "goleveldb" privval_protocol = "dashcore" persist_interval = 3 retain_blocks = 10 @@ -136,14 +136,14 @@ perturb = ["kill"] [node.validator04] persistent_peers = ["validator01"] -database = "cleveldb" +database = "goleveldb" abci_protocol = "builtin" privval_protocol = "dashcore" perturb = ["pause"] [node.validator05] seeds = ["seed01"] -database = "cleveldb" +database = "goleveldb" privval_protocol = "dashcore" perturb = ["disconnect"] diff --git a/test/e2e/pkg/manifest.go b/test/e2e/pkg/manifest.go index d5a6531216..e44b714f5e 100644 --- a/test/e2e/pkg/manifest.go +++ b/test/e2e/pkg/manifest.go @@ -132,8 +132,8 @@ type ManifestNode struct { // this relates to the providers the light client is connected to. PersistentPeers []string `toml:"persistent_peers"` - // Database specifies the database backend: "goleveldb", "cleveldb", - // "rocksdb", "boltdb", or "badgerdb". Defaults to goleveldb. + // Database specifies the database backend; only "goleveldb" is supported. + // Defaults to "goleveldb". Database string `toml:"database"` // PrivvalProtocol specifies the protocol used to sign consensus messages: diff --git a/test/e2e/pkg/testnet.go b/test/e2e/pkg/testnet.go index afa6f7a1f3..a92b7816bd 100644 --- a/test/e2e/pkg/testnet.go +++ b/test/e2e/pkg/testnet.go @@ -536,7 +536,7 @@ func (n Node) Validate(testnet Testnet) error { return fmt.Errorf("unsupported p2p queue type: %s", n.QueueType) } switch n.Database { - case "goleveldb", "cleveldb", "boltdb", "badgerdb", "memdb": + case "goleveldb", "memdb": default: return fmt.Errorf("invalid database setting %q", n.Database) }