Skip to content

Commit

Permalink
Don't harcdode badger in abci.ApplicationConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrus committed Nov 4, 2023
1 parent 010fd2f commit c70ad95
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 12 deletions.
5 changes: 0 additions & 5 deletions go/consensus/cometbft/db/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ import (
"github.com/oasisprotocol/oasis-core/go/consensus/cometbft/db/badger"
)

// GetBackendName returns the currently configured CometBFT database backend.
func GetBackendName() string {
return badger.BackendName
}

// GetProvider returns the currently configured CometBFT DBProvider.
func GetProvider() (node.DBProvider, error) {
return badger.DBProvider, nil
Expand Down
2 changes: 1 addition & 1 deletion go/consensus/cometbft/full/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func NewArchive(

appConfig := &abci.ApplicationConfig{
DataDir: filepath.Join(srv.dataDir, tmcommon.StateDir),
StorageBackend: db.GetBackendName(),
StorageBackend: config.GlobalConfig.Storage.Backend,

Check warning on line 163 in go/consensus/cometbft/full/archive.go

View check run for this annotation

Codecov / codecov/patch

go/consensus/cometbft/full/archive.go#L163

Added line #L163 was not covered by tests
Pruning: abci.PruneConfig{
Strategy: abci.PruneNone,
PruneInterval: time.Hour * 100, // Irrelevant as pruning is disabled.
Expand Down
2 changes: 1 addition & 1 deletion go/consensus/cometbft/full/full.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ func (t *fullService) lazyInit() error { // nolint: gocyclo

appConfig := &abci.ApplicationConfig{
DataDir: filepath.Join(t.dataDir, tmcommon.StateDir),
StorageBackend: db.GetBackendName(),
StorageBackend: config.GlobalConfig.Storage.Backend,
Pruning: pruneCfg,
HaltEpoch: beaconAPI.EpochTime(config.GlobalConfig.Consensus.HaltEpoch),
HaltHeight: config.GlobalConfig.Consensus.HaltHeight,
Expand Down
2 changes: 1 addition & 1 deletion go/oasis-node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func newTestNode(t *testing.T) *testNode {
config.GlobalConfig.Common.Debug.AllowRoot = true
config.GlobalConfig.Mode = config.ModeCompute
config.GlobalConfig.Runtime.Provisioner = runtimeConfig.RuntimeProvisionerMock
config.GlobalConfig.Storage.Backend = "badger"
config.GlobalConfig.Storage.Backend = "rocksdb"
config.GlobalConfig.Storage.PublicRPCEnabled = true
config.GlobalConfig.Consensus.ListenAddress = "tcp://0.0.0.0:27565"
config.GlobalConfig.Consensus.SupplementarySanity.Enabled = true
Expand Down
5 changes: 1 addition & 4 deletions go/worker/storage/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ func NewLocalBackend(
impl api.LocalBackend
)
switch cfg.Backend {
case database.BackendNameBadgerDB:
cfg.DB = GetLocalBackendDBDir(dataDir, cfg.Backend)
impl, err = database.New(cfg)
case database.BackendNameRocksDB:
case database.BackendNameBadgerDB, database.BackendNameRocksDB:
cfg.DB = GetLocalBackendDBDir(dataDir, cfg.Backend)
impl, err = database.New(cfg)
default:
Expand Down

0 comments on commit c70ad95

Please sign in to comment.