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

feat(store): migrate db backends to store/db and remove the cosmos-db deps completely #21765

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions client/pruning/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"fmt"
"path/filepath"

dbm "github.com/cosmos/cosmos-db"
"github.com/spf13/cobra"
"github.com/spf13/viper"

corestore "cosmossdk.io/core/store"
"cosmossdk.io/log"
dbm "cosmossdk.io/store/db"
pruningtypes "cosmossdk.io/store/pruning/types"
"cosmossdk.io/store/rootmulti"

Expand Down Expand Up @@ -108,7 +108,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`,
return cmd
}

func openDB(rootDir string, backendType dbm.BackendType) (corestore.KVStoreWithBatch, error) {
func openDB(rootDir string, backendType dbm.DBType) (corestore.KVStoreWithBatch, error) {
dataDir := filepath.Join(rootDir, "data")
return dbm.NewDB("application", backendType, dataDir)
return dbm.NewDB("application", backendType, dataDir, nil)
}
6 changes: 3 additions & 3 deletions client/snapshot/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"path/filepath"
"strconv"

dbm "github.com/cosmos/cosmos-db"
"github.com/spf13/cobra"

corestore "cosmossdk.io/core/store"
"cosmossdk.io/log"
dbm "cosmossdk.io/store/db"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server"
Expand Down Expand Up @@ -50,7 +50,7 @@ func RestoreSnapshotCmd[T servertypes.Application](appCreator servertypes.AppCre
return cmd
}

func openDB(rootDir string, backendType dbm.BackendType) (corestore.KVStoreWithBatch, error) {
func openDB(rootDir string, backendType dbm.DBType) (corestore.KVStoreWithBatch, error) {
dataDir := filepath.Join(rootDir, "data")
return dbm.NewDB("application", backendType, dataDir)
return dbm.NewDB("application", backendType, dataDir, nil)
}
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ require (
github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f
github.com/cometbft/cometbft/api v1.0.0-rc.1
github.com/cosmos/btcutil v1.0.5
github.com/cosmos/cosmos-db v1.0.3-0.20240911104526-ddc3f09bfc22
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/crypto v0.1.2
github.com/cosmos/go-bip39 v1.0.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-db v1.0.3-0.20240911104526-ddc3f09bfc22 h1:V3WlarcZwlYYt3dUsStxm0FAFXVeEcvgwfmR6upxm5M=
github.com/cosmos/cosmos-db v1.0.3-0.20240911104526-ddc3f09bfc22/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/crypto v0.1.2 h1:Yn500sPY+9sKVdhiPUSDtt8JOpBGMB515dOmla4zfls=
Expand Down
13 changes: 9 additions & 4 deletions orm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ go 1.23
require (
cosmossdk.io/api v0.7.5
cosmossdk.io/core v1.0.0-alpha.2
cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000
cosmossdk.io/depinject v1.0.0
cosmossdk.io/errors v1.0.1
github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33
cosmossdk.io/store v1.1.1
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.6.0
github.com/iancoleman/strcase v0.3.0
github.com/regen-network/gocuke v1.1.1
github.com/stretchr/testify v1.9.0
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
google.golang.org/grpc v1.66.2
google.golang.org/protobuf v1.34.2
gotest.tools/v3 v3.5.1
Expand Down Expand Up @@ -42,15 +43,14 @@ require (
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/linxGnu/grocksdb v1.9.3 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/gomega v1.20.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.20.3 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.59.1 // indirect
Expand All @@ -59,6 +59,7 @@ require (
github.com/spf13/cast v1.7.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tidwall/btree v1.7.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
Expand All @@ -67,3 +68,7 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace cosmossdk.io/core/testing => ../core/testing

replace cosmossdk.io/store => ../store
17 changes: 8 additions & 9 deletions orm/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwP
github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo=
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ=
github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 h1:NnqmEOIzUPazzBrhGenzI1AQCBtJ0Hbnb/DDoykpko0=
github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro=
Expand Down Expand Up @@ -76,12 +74,10 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU=
github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
Expand Down Expand Up @@ -131,8 +127,9 @@ github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTw
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4=
github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
Expand All @@ -158,14 +155,16 @@ github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDd
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48=
github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E=
github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME=
github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI=
github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ=
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM=
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
Expand Down
2 changes: 1 addition & 1 deletion orm/internal/testkv/leveldb.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package testkv
import (
"testing"

dbm "github.com/cosmos/cosmos-db"
"gotest.tools/v3/assert"

"cosmossdk.io/orm/model/ormtable"
dbm "cosmossdk.io/store/db"
)

func NewGoLevelDBBackend(tb testing.TB) ormtable.Backend {
Expand Down
9 changes: 4 additions & 5 deletions orm/internal/testkv/mem.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package testkv

import (
dbm "github.com/cosmos/cosmos-db"

coretesting "cosmossdk.io/core/testing"
"cosmossdk.io/orm/model/ormtable"
)

Expand All @@ -11,8 +10,8 @@ import (
// are really two separate backing stores.
func NewSplitMemBackend() ormtable.Backend {
return ormtable.NewBackend(ormtable.BackendOptions{
CommitmentStore: TestStore{dbm.NewMemDB()},
IndexStore: TestStore{dbm.NewMemDB()},
CommitmentStore: TestStore{coretesting.NewMemDB()},
IndexStore: TestStore{coretesting.NewMemDB()},
})
}

Expand All @@ -21,7 +20,7 @@ func NewSplitMemBackend() ormtable.Backend {
// where only a single KV-store is available to modules.
func NewSharedMemBackend() ormtable.Backend {
return ormtable.NewBackend(ormtable.BackendOptions{
CommitmentStore: TestStore{dbm.NewMemDB()},
CommitmentStore: TestStore{coretesting.NewMemDB()},
// commit store is automatically used as the index store
})
}
6 changes: 3 additions & 3 deletions orm/model/ormdb/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"strings"
"testing"

dbm "github.com/cosmos/cosmos-db"
"github.com/golang/mock/gomock"
"gotest.tools/v3/assert"
"gotest.tools/v3/golden"
Expand All @@ -18,6 +17,7 @@ import (
ormv1alpha1 "cosmossdk.io/api/cosmos/orm/v1alpha1"
"cosmossdk.io/core/genesis"
corestore "cosmossdk.io/core/store"
coretesting "cosmossdk.io/core/testing"
"cosmossdk.io/depinject"
"cosmossdk.io/depinject/appconfig"
_ "cosmossdk.io/orm" // required for ORM module registration
Expand Down Expand Up @@ -389,13 +389,13 @@ func TestGetBackendResolver(t *testing.T) {
},
},
}, ormdb.ModuleDBOptions{
MemoryStoreService: testStoreService{db: dbm.NewMemDB()},
MemoryStoreService: testStoreService{db: coretesting.NewMemDB()},
})
assert.NilError(t, err)
}

func ProvideTestRuntime() corestore.KVStoreService {
return testStoreService{db: dbm.NewMemDB()}
return testStoreService{db: coretesting.NewMemDB()}
}

func TestAppConfigModule(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions orm/model/ormtable/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ import (
"fmt"
"testing"

dbm "github.com/cosmos/cosmos-db"
"google.golang.org/protobuf/proto"
"gotest.tools/v3/assert"

"cosmossdk.io/core/store"
coretesting "cosmossdk.io/core/testing"
"cosmossdk.io/orm/internal/testkv"
"cosmossdk.io/orm/internal/testpb"
"cosmossdk.io/orm/model/ormtable"
"cosmossdk.io/orm/testing/ormtest"
"cosmossdk.io/orm/types/kv"
dbm "cosmossdk.io/store/db"
)

func initBalanceTable(tb testing.TB) testpb.BalanceTable {
Expand Down Expand Up @@ -241,7 +242,7 @@ func getBalance(store kv.Store, address, denom string) (*testpb.Balance, error)

func BenchmarkManualInsertMemory(b *testing.B) {
benchManual(b, func() (store.KVStore, error) {
return testkv.TestStore{Db: dbm.NewMemDB()}, nil
return testkv.TestStore{Db: coretesting.NewMemDB()}, nil
})
}

Expand Down
6 changes: 3 additions & 3 deletions orm/model/ormtable/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"strings"
"testing"

dbm "github.com/cosmos/cosmos-db"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/testing/protocmp"
Expand All @@ -17,6 +16,7 @@ import (
"pgregory.net/rapid"

queryv1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1"
coretesting "cosmossdk.io/core/testing"
sdkerrors "cosmossdk.io/errors"
"cosmossdk.io/orm/encoding/ormkv"
"cosmossdk.io/orm/internal/testkv"
Expand Down Expand Up @@ -742,8 +742,8 @@ func TestReadonly(t *testing.T) {
})
assert.NilError(t, err)
readBackend := ormtable.NewReadBackend(ormtable.ReadBackendOptions{
CommitmentStoreReader: testkv.TestStore{Db: dbm.NewMemDB()},
IndexStoreReader: testkv.TestStore{Db: dbm.NewMemDB()},
CommitmentStoreReader: testkv.TestStore{Db: coretesting.NewMemDB()},
IndexStoreReader: testkv.TestStore{Db: coretesting.NewMemDB()},
})
ctx := ormtable.WrapContextDefault(readBackend)
assert.ErrorIs(t, ormerrors.ReadOnly, table.Insert(ctx, &testpb.ExampleTable{}))
Expand Down
5 changes: 3 additions & 2 deletions server/constructors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"path/filepath"
"testing"

dbm "github.com/cosmos/cosmos-db"
"github.com/stretchr/testify/require"

dbm "cosmossdk.io/store/db"
)

func Test_OpenDB(t *testing.T) {
t.Parallel()
_, err := OpenDB(t.TempDir(), dbm.GoLevelDBBackend)
_, err := OpenDB(t.TempDir(), dbm.DBTypeGoLevelDB)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

Update remaining occurrences of GoLevelDBBackend for consistency

The rename from GoLevelDBBackend to DBTypeGoLevelDB is not fully consistent across the codebase. While most files have been updated, two test-related files still use the old naming:

  • orm/model/ormtable/bench_test.go
  • orm/internal/testkv/leveldb.go

Please update these files to use DBTypeGoLevelDB for consistency. Additionally, conduct a thorough review of all test files to ensure they align with the new naming convention.

Analysis chain

Verify the consistency of the GoLevelDBBackend rename across the codebase.

The change from dbm.GoLevelDBBackend to dbm.DBTypeGoLevelDB aligns with the updates in the store/db package. However, please ensure that this change is consistently applied across the codebase wherever the OpenDB function is used with the GoLevelDBBackend argument.

Run the following script to verify the consistency of the change:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the `GoLevelDBBackend` rename across the codebase.

# Test: Search for the old usage. Expect: No occurrences of `GoLevelDBBackend`.
rg --type go $'GoLevelDBBackend' || echo "No occurrences of 'GoLevelDBBackend' found."

# Test: Search for the new usage. Expect: Only occurrences of `DBTypeGoLevelDB`.
rg --type go -A 5 $'DBTypeGoLevelDB'

Length of output: 2848

require.NoError(t, err)
}

Expand Down
2 changes: 1 addition & 1 deletion server/mock/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
"path/filepath"

abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
dbm "github.com/cosmos/cosmos-db"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protodesc"
"google.golang.org/protobuf/reflect/protoregistry"
"google.golang.org/protobuf/types/descriptorpb"

"cosmossdk.io/log"
dbm "cosmossdk.io/store/db"
storetypes "cosmossdk.io/store/types"

bam "github.com/cosmos/cosmos-sdk/baseapp"
Expand Down
4 changes: 2 additions & 2 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
sm "github.com/cometbft/cometbft/state"
"github.com/cometbft/cometbft/store"
cmttypes "github.com/cometbft/cometbft/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/hashicorp/go-metrics"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
Expand All @@ -40,6 +39,7 @@ import (

corestore "cosmossdk.io/core/store"
"cosmossdk.io/log"
dbm "cosmossdk.io/store/db"
pruningtypes "cosmossdk.io/store/pruning/types"

"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -120,7 +120,7 @@ const (
type StartCmdOptions[T types.Application] struct {
// DBOpener can be used to customize db opening, for example customize db options or support different db backends,
// default to the builtin db opener.
DBOpener func(rootDir string, backendType dbm.BackendType) (corestore.KVStoreWithBatch, error)
DBOpener func(rootDir string, backendType dbm.DBType) (corestore.KVStoreWithBatch, error)
// PostSetup can be used to setup extra services under the same cancellable context,
// it's not called in stand-alone mode, only for in-process mode.
PostSetup func(app T, svrCtx *Context, clientCtx client.Context, ctx context.Context, g *errgroup.Group) error
Expand Down
Loading
Loading