Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions server/v2/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
serverv2 "cosmossdk.io/server/v2"
grpc "cosmossdk.io/server/v2/api/grpc"
"cosmossdk.io/server/v2/appmanager"
"cosmossdk.io/server/v2/store"
)

type mockInterfaceRegistry struct{}
Expand Down Expand Up @@ -61,12 +62,17 @@ func TestServer(t *testing.T) {
err = grpcServer.Init(&mockApp[transaction.Tx]{}, v, logger)
require.NoError(t, err)

storeServer := store.New[transaction.Tx](nil /* nil appCreator as not using CLI commands */)
err = storeServer.Init(&mockApp[transaction.Tx]{}, v, logger)
require.NoError(t, err)

mockServer := &mockServer{name: "mock-server-1", ch: make(chan string, 100)}

server := serverv2.NewServer(
logger,
serverv2.DefaultServerConfig(),
grpcServer,
storeServer,
mockServer,
)

Expand Down
20 changes: 10 additions & 10 deletions server/v2/testdata/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ max-recv-msg-size = 10485760
# The default value is math.MaxInt32.
max-send-msg-size = 2147483647

[mock-server-1]
# Mock field
mock_field = 'default'
# Mock field two
mock_field_two = 1

[server]
# minimum-gas-prices defines the price which a validator is willing to accept for processing a transaction. A transaction's fees must meet the minimum of any denomination specified in this config (e.g. 0.25token1;0.0001token2).
minimum-gas-prices = '0stake'
Expand All @@ -19,10 +25,10 @@ minimum-gas-prices = '0stake'
app-db-backend = 'goleveldb'

[store.options]
# State storage database type. Currently we support: 0 for SQLite, 1 for Pebble
ss-type = 0
# State commitment database type. Currently we support:0 for iavl, 1 for iavl v2
sc-type = 0
# SState storage database type. Currently we support: "sqlite" and "pebble"
ss-type = 'sqlite'
# State commitment database type. Currently we support: "iavl" and "iavl-v2"
sc-type = 'iavl'

# Pruning options for state storage
[store.options.ss-pruning-option]
Expand All @@ -43,9 +49,3 @@ interval = 100
cache-size = 100000
# If true, the tree will work like no fast storage and always not upgrade fast storage.
skip-fast-storage-upgrade = true

[mock-server-1]
# Mock field
mock_field = 'default'
# Mock field two
mock_field_two = 1
24 changes: 13 additions & 11 deletions store/v2/root/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,28 @@ import (
)

type (
SSType int
SCType int
SSType string
SCType string
)

const (
SSTypeSQLite SSType = 0
SSTypePebble SSType = 1
SSTypeRocks SSType = 2
SCTypeIavl SCType = 0
SCTypeIavlV2 SCType = 1
SSTypeSQLite SSType = "sqlite"
SSTypePebble SSType = "pebble"
SSTypeRocks SSType = "rocksdb"
SCTypeIavl SCType = "iavl"
SCTypeIavlV2 SCType = "iavl-v2"
)

// app.toml config options
type Options struct {
SSType SSType `mapstructure:"ss-type" toml:"ss-type" comment:"State storage database type. Currently we support: 0 for SQLite, 1 for Pebble"`
SCType SCType `mapstructure:"sc-type" toml:"sc-type" comment:"State commitment database type. Currently we support:0 for iavl, 1 for iavl v2"`
SSType SSType `mapstructure:"ss-type" toml:"ss-type" comment:"SState storage database type. Currently we support: \"sqlite\" and \"pebble\""`
SCType SCType `mapstructure:"sc-type" toml:"sc-type" comment:"State commitment database type. Currently we support: \"iavl\" and \"iavl-v2\""`
SSPruningOption *store.PruningOption `mapstructure:"ss-pruning-option" toml:"ss-pruning-option" comment:"Pruning options for state storage"`
SCPruningOption *store.PruningOption `mapstructure:"sc-pruning-option" toml:"sc-pruning-option" comment:"Pruning options for state commitment"`
IavlConfig *iavl.Config `mapstructure:"iavl-config" toml:"iavl-config"`
}

// FactoryOptions are the options for creating a root store.
type FactoryOptions struct {
Logger log.Logger
RootDir string
Expand All @@ -49,10 +50,11 @@ type FactoryOptions struct {
SCRawDB corestore.KVStoreWithBatch
}

// DefaultStoreOptions returns the default options for creating a root store.
func DefaultStoreOptions() Options {
return Options{
SSType: 0,
SCType: 0,
SSType: SSTypeSQLite,
SCType: SCTypeIavl,
SCPruningOption: &store.PruningOption{
KeepRecent: 2,
Interval: 100,
Expand Down