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
12 changes: 9 additions & 3 deletions runtime/v2/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
type AppBuilder[T transaction.Tx] struct {
app *App[T]
config server.DynamicConfig
storeOptions rootstore.Options
storeOptions *rootstore.Options

// the following fields are used to overwrite the default
branch func(state store.ReaderMap) store.WriterMap
Expand Down Expand Up @@ -131,10 +131,16 @@ func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) {
panic(err)
}

var storeOptions rootstore.Options
if a.storeOptions != nil {
storeOptions = *a.storeOptions
} else {
storeOptions = rootstore.DefaultStoreOptions()
}
factoryOptions := &rootstore.FactoryOptions{
Logger: a.app.logger,
RootDir: home,
Options: a.storeOptions,
Options: storeOptions,
StoreKeys: append(a.app.storeKeys, "stf"),
SCRawDB: scRawDb,
}
Expand Down Expand Up @@ -216,7 +222,7 @@ func AppBuilderWithPostTxExec[T transaction.Tx](postTxExec func(ctx context.Cont
}
}

func AppBuilderWithStoreOptions[T transaction.Tx](opts rootstore.Options) AppBuilderOption[T] {
func AppBuilderWithStoreOptions[T transaction.Tx](opts *rootstore.Options) AppBuilderOption[T] {
return func(a *AppBuilder[T]) {
a.storeOptions = opts
}
Expand Down
4 changes: 2 additions & 2 deletions simapp/v2/app_di.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func NewSimApp[T transaction.Tx](
app = &SimApp[T]{}
appBuilder *runtime.AppBuilder[T]
err error
storeOptions = root.DefaultStoreOptions()
storeOptions = &root.Options{}

// merge the AppConfig and other configuration in one config
appConfig = depinject.Configs(
Expand Down Expand Up @@ -191,7 +191,7 @@ func NewSimApp[T transaction.Tx](
}

if sub := viper.Sub("store.options"); sub != nil {
err = sub.Unmarshal(&storeOptions)
err = sub.Unmarshal(storeOptions)
if err != nil {
panic(err)
}
Expand Down
8 changes: 2 additions & 6 deletions simapp/v2/simdv2/cmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,9 @@ import (
v2 "github.com/cosmos/cosmos-sdk/x/genutil/v2/cli"
)

func newApp[T transaction.Tx](
logger log.Logger, viper *viper.Viper,
) serverv2.AppI[T] {
func newApp[T transaction.Tx](logger log.Logger, viper *viper.Viper) serverv2.AppI[T] {
viper.Set(serverv2.FlagHome, simapp.DefaultNodeHome)

return serverv2.AppI[T](
simapp.NewSimApp[T](logger, viper))
return serverv2.AppI[T](simapp.NewSimApp[T](logger, viper))
}

func initRootCmd[T transaction.Tx](
Expand Down
4 changes: 2 additions & 2 deletions testutil/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func GetRequestWithHeaders(url string, headers map[string]string) ([]byte, error
// GetRequest defines a wrapper around an HTTP GET request with a provided URL.
// An error is returned if the request or reading the body fails.
func GetRequest(url string) ([]byte, error) {
res, err := http.Get(url)
res, err := http.Get(url)
if err != nil {
return nil, err
}
Expand All @@ -61,7 +61,7 @@ func GetRequest(url string) ([]byte, error) {
// PostRequest defines a wrapper around an HTTP POST request with a provided URL and data.
// An error is returned if the request or reading the body fails.
func PostRequest(url, contentType string, data []byte) ([]byte, error) {
res, err := http.Post(url, contentType, bytes.NewBuffer(data))
res, err := http.Post(url, contentType, bytes.NewBuffer(data))
if err != nil {
return nil, fmt.Errorf("error while sending post request: %w", err)
}
Expand Down