Skip to content

Commit

Permalink
Merge branch 'v1.3-dev' into fix/lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek authored Nov 6, 2024
2 parents 0e8ac6f + d28d5a8 commit dacfd53
Show file tree
Hide file tree
Showing 123 changed files with 276 additions and 2,275 deletions.
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/[email protected]
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/[email protected]
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/[email protected]
with:
go-version: "1.23"
go-version: "1.23.2"
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/check-generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ jobs:
steps:
- uses: actions/[email protected]
with:
go-version: "1.23"
go-version: "1.23.2"

- uses: actions/checkout@v4

- name: "Check generated mocks"
run: |
set -euo pipefail
readonly MOCKERY=2.46.2 # N.B. no leading "v"
readonly MOCKERY=2.46.3 # N.B. no leading "v"
curl -sL "https://github.com/vektra/mockery/releases/download/v${MOCKERY}/mockery_${MOCKERY}_Linux_x86_64.tar.gz" | tar -C /usr/local/bin -xzf -
make mockery 2>/dev/null
if ! git diff --stat --exit-code ; then
if ! git diff --exit-code ; then
echo ">> ERROR:"
echo ">>"
echo ">> Generated mocks require update (either Mockery or source files may have changed)."
Expand All @@ -49,7 +49,7 @@ jobs:
steps:
- uses: actions/[email protected]
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/[email protected]
with:
go-version: "1.23"
go-version: "1.23.2"

- name: Set up Docker Buildx
uses: docker/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
with:
go-version: "1.23"
go-version: "1.23.2"
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
Expand Down
71 changes: 71 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
with-expecter: false
dir: "{{.InterfaceDir}}/mocks"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
filename: "{{.InterfaceName | lower}}.go"
log-level: "warn"
disable-version-string: true
all: false
packages:
github.com/dashpay/tenderdash/abci/client:
interfaces:
Client:
github.com/dashpay/tenderdash/abci/types:
interfaces:
Application:
github.com/dashpay/tenderdash/dash/core:
interfaces:
Client:
github.com/dashpay/tenderdash/internal/consensus:
interfaces:
Gossiper:
github.com/dashpay/tenderdash/internal/consensus/versioned/selectproposer:
interfaces:
ProposerSelector:
github.com/dashpay/tenderdash/internal/evidence:
interfaces:
BlockStore:
github.com/dashpay/tenderdash/internal/mempool:
interfaces:
Mempool:
github.com/dashpay/tenderdash/internal/p2p:
interfaces:
Transport:
Connection:
Channel:
github.com/dashpay/tenderdash/internal/p2p/client:
interfaces:
Client:
BlockClient:
SnapshotClient:
github.com/dashpay/tenderdash/internal/state:
interfaces:
BlockStore:
EvidencePool:
Executor:
Store:
github.com/dashpay/tenderdash/internal/state/indexer:
interfaces:
EventSink:
github.com/dashpay/tenderdash/internal/statesync:
interfaces:
StateProvider:
github.com/dashpay/tenderdash/libs/store:
interfaces:
Store:
github.com/dashpay/tenderdash/light/provider:
interfaces:
Provider:
github.com/dashpay/tenderdash/light/rpc:
interfaces:
LightClient:
github.com/dashpay/tenderdash/rpc/client:
interfaces:
Client:
RemoteClient:
github.com/dashpay/tenderdash/types:
interfaces:
Store:
PrivValidator:
BlockEventPublisher:
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
24 changes: 1 addition & 23 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 Expand Up @@ -336,7 +314,7 @@ build-docker:
###############################################################################

mockery:
go generate -run="./scripts/mockery_generate.sh" ./...
./scripts/mockery_generate.sh
.PHONY: mockery

###############################################################################
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
5 changes: 3 additions & 2 deletions cmd/tenderdash/commands/reindex_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ 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"
"github.com/dashpay/tenderdash/internal/state/indexer"
indexermocks "github.com/dashpay/tenderdash/internal/state/indexer/mocks"
"github.com/dashpay/tenderdash/internal/state/mocks"
"github.com/dashpay/tenderdash/libs/log"
"github.com/dashpay/tenderdash/proto/tendermint/state"
Expand Down Expand Up @@ -136,7 +137,7 @@ func TestLoadBlockStore(t *testing.T) {
func TestReIndexEvent(t *testing.T) {
mockBlockStore := &mocks.BlockStore{}
mockStateStore := &mocks.Store{}
mockEventSink := &mocks.EventSink{}
mockEventSink := &indexermocks.EventSink{}

mockBlockStore.
On("Base").Return(base).
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
Loading

0 comments on commit dacfd53

Please sign in to comment.