Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(db)!: remove support for cleveldb, boltdb, rocksdb, badgerdb #974

Merged
merged 6 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/bls/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
steps:
- uses: actions/setup-go@v2
with:
go-version: "1.23"
go-version: "1.23.2"
- uses: actions/checkout@v2
with:
submodules: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
- uses: actions/setup-go@v5.1.0
with:
go-version: "1.23"
go-version: "1.23.2"
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
steps:
- uses: actions/setup-go@v5.1.0
with:
go-version: "1.23"
go-version: "1.23.2"
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
Expand All @@ -79,7 +79,7 @@ jobs:
steps:
- uses: actions/setup-go@v5.1.0
with:
go-version: "1.23"
go-version: "1.23.2"
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
- uses: actions/setup-go@v5.1.0
with:
go-version: "1.23"
go-version: "1.23.2"

- uses: actions/checkout@v4

Expand All @@ -49,7 +49,7 @@ jobs:
steps:
- uses: actions/setup-go@v5.1.0
with:
go-version: "1.23"
go-version: "1.23.2"

- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
steps:
- uses: actions/setup-go@v5.1.0
with:
go-version: "1.23"
go-version: "1.23.2"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.7.1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
submodules: true
- uses: actions/setup-go@v5.1.0
with:
go-version: "^1.23"
go-version: "^1.23.2"
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- uses: actions/setup-go@v5.1.0
with:
go-version: "1.23"
go-version: "1.23.2"

- name: Build
uses: goreleaser/goreleaser-action@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/setup-go@v5.1.0
with:
go-version: "1.23"
go-version: "1.23.2"
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion DOCKER/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# * image - creates final image of minimal size

ARG ALPINE_VERSION=3.19
ARG GOLANG_VERSION=1.23
ARG GOLANG_VERSION=1.23.2
#################################
# STAGE 1: install dependencies #
#################################
Expand Down
22 changes: 0 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ requirements if installing from source.

| Requirement | Notes |
|-------------|------------------|
| Go version | Go1.23 or higher |
| Go version | Go1.23.2 or higher |

## Versioning

Expand Down
2 changes: 1 addition & 1 deletion STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Sometimes it's necessary to rename libraries to avoid naming collisions or ambig
* Use [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports)
* Separate imports into blocks - one for the standard lib, one for external libs and one for application libs.
* Here are some common library labels for consistency:
* dbm "github.com/tendermint/tm-db"
* dbm "github.com/cometbft/cometbft-db"
* tmcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
* tmcfg "github.com/tendermint/tendermint/config/tendermint"
* tmtypes "github.com/tendermint/tendermint/types"
Expand Down
2 changes: 1 addition & 1 deletion abci/example/kvstore/kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (

sync "github.com/sasha-s/go-deadlock"

dbm "github.com/cometbft/cometbft-db"
"github.com/dashpay/dashd-go/btcjson"
"github.com/gogo/protobuf/proto"
dbm "github.com/tendermint/tm-db"

"github.com/dashpay/tenderdash/abci/example/code"
abci "github.com/dashpay/tenderdash/abci/types"
Expand Down
2 changes: 1 addition & 1 deletion abci/example/kvstore/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"io"
"net/url"

dbm "github.com/tendermint/tm-db"
dbm "github.com/cometbft/cometbft-db"

"github.com/dashpay/tenderdash/abci/types"
"github.com/dashpay/tenderdash/crypto"
Expand Down
2 changes: 1 addition & 1 deletion abci/example/kvstore/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"bytes"
"testing"

dbm "github.com/cometbft/cometbft-db"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
dbm "github.com/tendermint/tm-db"

"github.com/dashpay/tenderdash/crypto"
tmbytes "github.com/dashpay/tenderdash/libs/bytes"
Expand Down
2 changes: 1 addition & 1 deletion abci/example/kvstore/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io"
"os"

dbm "github.com/tendermint/tm-db"
dbm "github.com/cometbft/cometbft-db"
)

// StoreFactory is a factory that offers a reader to read data from, or writer to write data to it.
Expand Down
2 changes: 0 additions & 2 deletions cmd/tenderdash/commands/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/tenderdash/commands/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"syscall"
"time"

dbm "github.com/cometbft/cometbft-db"
"github.com/spf13/cobra"
dbm "github.com/tendermint/tm-db"

"github.com/dashpay/tenderdash/config"
dashcore "github.com/dashpay/tenderdash/dash/core"
Expand Down
2 changes: 1 addition & 1 deletion cmd/tenderdash/commands/reindex_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path/filepath"
"strings"

dbm "github.com/cometbft/cometbft-db"
"github.com/spf13/cobra"
dbm "github.com/tendermint/tm-db"

abcitypes "github.com/dashpay/tenderdash/abci/types"
tmcfg "github.com/dashpay/tenderdash/config"
Expand Down
2 changes: 1 addition & 1 deletion cmd/tenderdash/commands/reindex_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"errors"
"testing"

dbm "github.com/cometbft/cometbft-db"
"github.com/spf13/cobra"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
dbm "github.com/tendermint/tm-db"

abcitypes "github.com/dashpay/tenderdash/abci/types"
"github.com/dashpay/tenderdash/config"
Expand Down
4 changes: 0 additions & 4 deletions cmd/tenderdash/commands/run_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
29 changes: 13 additions & 16 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"strings"
"testing"
"time"

"github.com/dashpay/dashd-go/btcjson"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion config/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package config
import (
"context"

dbm "github.com/tendermint/tm-db"
dbm "github.com/cometbft/cometbft-db"

"github.com/dashpay/tenderdash/libs/log"
"github.com/dashpay/tenderdash/libs/service"
Expand Down
17 changes: 1 addition & 16 deletions config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dash/quorum/validator_conn_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"testing"
"time"

dbm "github.com/cometbft/cometbft-db"
"github.com/stretchr/testify/assert"
testifymock "github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
dbm "github.com/tendermint/tm-db"

abciclient "github.com/dashpay/tenderdash/abci/client"
abci "github.com/dashpay/tenderdash/abci/types"
Expand Down
Loading
Loading