Skip to content

Commit 0ca95ee

Browse files
authored
feat(server/v2) Add prune cmd to serverv2 (#20736)
1 parent 2c236af commit 0ca95ee

File tree

21 files changed

+527
-59
lines changed

21 files changed

+527
-59
lines changed

runtime/v2/builder.go

+27
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import (
55
"encoding/json"
66
"fmt"
77
"io"
8+
"path/filepath"
9+
10+
"github.com/spf13/viper"
811

912
"cosmossdk.io/core/appmodule"
1013
appmodulev2 "cosmossdk.io/core/appmodule/v2"
@@ -13,6 +16,7 @@ import (
1316
"cosmossdk.io/server/v2/appmanager"
1417
"cosmossdk.io/server/v2/stf"
1518
"cosmossdk.io/server/v2/stf/branch"
19+
"cosmossdk.io/store/v2/db"
1620
rootstore "cosmossdk.io/store/v2/root"
1721
)
1822

@@ -22,6 +26,7 @@ import (
2226
type AppBuilder[T transaction.Tx] struct {
2327
app *App[T]
2428
storeOptions *rootstore.FactoryOptions
29+
viper *viper.Viper
2530

2631
// the following fields are used to overwrite the default
2732
branch func(state store.ReaderMap) store.WriterMap
@@ -119,6 +124,28 @@ func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) {
119124
}
120125
a.app.stf = stf
121126

127+
v := a.viper
128+
home := v.GetString(FlagHome)
129+
130+
storeOpts := rootstore.DefaultStoreOptions()
131+
if err := v.Sub("store.options").Unmarshal(&storeOpts); err != nil {
132+
return nil, fmt.Errorf("failed to store options: %w", err)
133+
}
134+
135+
scRawDb, err := db.NewDB(db.DBType(v.GetString("store.app-db-backend")), "application", filepath.Join(home, "data"), nil)
136+
if err != nil {
137+
panic(err)
138+
}
139+
140+
storeOptions := &rootstore.FactoryOptions{
141+
Logger: a.app.logger,
142+
RootDir: home,
143+
Options: storeOpts,
144+
StoreKeys: append(a.app.storeKeys, "stf"),
145+
SCRawDB: scRawDb,
146+
}
147+
a.storeOptions = storeOptions
148+
122149
rs, err := rootstore.CreateRootStore(a.storeOptions)
123150
if err != nil {
124151
return nil, fmt.Errorf("failed to create root store: %w", err)

runtime/v2/go.mod

+16-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ replace (
88
cosmossdk.io/core => ../../core
99
cosmossdk.io/core/testing => ../../core/testing
1010
cosmossdk.io/log => ../../log
11+
cosmossdk.io/server/v2 => ../../server/v2
1112
cosmossdk.io/server/v2/appmanager => ../../server/v2/appmanager
1213
cosmossdk.io/server/v2/stf => ../../server/v2/stf
1314
cosmossdk.io/store/v2 => ../../store/v2
@@ -30,7 +31,8 @@ require (
3031
cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000
3132
cosmossdk.io/x/tx v0.13.3
3233
github.com/cosmos/gogoproto v1.5.0
33-
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
34+
github.com/spf13/viper v1.19.0
35+
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc
3436
google.golang.org/grpc v1.64.1
3537
google.golang.org/protobuf v1.34.2
3638
)
@@ -55,6 +57,7 @@ require (
5557
github.com/cosmos/ics23/go v0.10.0 // indirect
5658
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
5759
github.com/emicklei/dot v1.6.2 // indirect
60+
github.com/fsnotify/fsnotify v1.7.0 // indirect
5861
github.com/getsentry/sentry-go v0.27.0 // indirect
5962
github.com/gogo/protobuf v1.3.2 // indirect
6063
github.com/golang/snappy v0.0.4 // indirect
@@ -63,15 +66,19 @@ require (
6366
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
6467
github.com/hashicorp/go-metrics v0.5.3 // indirect
6568
github.com/hashicorp/golang-lru v1.0.2 // indirect
69+
github.com/hashicorp/hcl v1.0.0 // indirect
6670
github.com/klauspost/compress v1.17.8 // indirect
6771
github.com/kr/pretty v0.3.1 // indirect
6872
github.com/kr/text v0.2.0 // indirect
6973
github.com/linxGnu/grocksdb v1.8.14 // indirect
74+
github.com/magiconair/properties v1.8.7 // indirect
7075
github.com/mattn/go-colorable v0.1.13 // indirect
7176
github.com/mattn/go-isatty v0.0.20 // indirect
7277
github.com/mattn/go-sqlite3 v1.14.22 // indirect
78+
github.com/mitchellh/mapstructure v1.5.0 // indirect
7379
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
7480
github.com/onsi/gomega v1.28.1 // indirect
81+
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
7582
github.com/pkg/errors v0.9.1 // indirect
7683
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
7784
github.com/prometheus/client_golang v1.19.1 // indirect
@@ -80,18 +87,26 @@ require (
8087
github.com/prometheus/procfs v0.15.1 // indirect
8188
github.com/rogpeppe/go-internal v1.12.0 // indirect
8289
github.com/rs/zerolog v1.33.0 // indirect
90+
github.com/sagikazarmark/locafero v0.4.0 // indirect
91+
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
92+
github.com/sourcegraph/conc v0.3.0 // indirect
93+
github.com/spf13/afero v1.11.0 // indirect
8394
github.com/spf13/cast v1.6.0 // indirect
95+
github.com/spf13/pflag v1.0.5 // indirect
8496
github.com/stretchr/testify v1.9.0 // indirect
97+
github.com/subosito/gotenv v1.6.0 // indirect
8598
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
8699
github.com/tendermint/go-amino v0.16.0 // indirect
87100
github.com/tidwall/btree v1.7.0 // indirect
101+
go.uber.org/multierr v1.11.0 // indirect
88102
golang.org/x/crypto v0.25.0 // indirect
89103
golang.org/x/net v0.27.0 // indirect
90104
golang.org/x/sync v0.7.0 // indirect
91105
golang.org/x/sys v0.22.0 // indirect
92106
golang.org/x/text v0.16.0 // indirect
93107
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect
94108
google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect
109+
gopkg.in/ini.v1 v1.67.0 // indirect
95110
gopkg.in/yaml.v3 v3.0.1 // indirect
96111
sigs.k8s.io/yaml v1.4.0 // indirect
97112
)

runtime/v2/go.sum

+35-2
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b
121121
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
122122
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
123123
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
124+
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
125+
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
124126
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
125127
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
126128
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
@@ -141,6 +143,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
141143
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
142144
github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ=
143145
github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA=
146+
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
147+
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
144148
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
145149
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
146150
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
@@ -150,6 +154,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D
150154
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
151155
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
152156
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
157+
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
158+
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
153159
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
154160
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
155161
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
@@ -174,6 +180,8 @@ github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA=
174180
github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
175181
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
176182
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
183+
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
184+
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
177185
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
178186
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
179187
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
@@ -209,19 +217,39 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99
209217
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
210218
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
211219
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
220+
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
221+
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
222+
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
223+
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
212224
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
213225
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
226+
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
227+
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
228+
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
229+
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
214230
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
215231
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
232+
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
233+
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
234+
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
235+
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
216236
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
217237
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
238+
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
239+
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
240+
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
218241
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
219242
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
220243
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
221244
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
245+
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
222246
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
247+
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
248+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
223249
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
224250
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
251+
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
252+
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
225253
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs=
226254
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48=
227255
github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E=
@@ -231,14 +259,16 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU
231259
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
232260
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
233261
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
262+
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
263+
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
234264
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
235265
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
236266
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
237267
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
238268
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
239269
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
240-
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM=
241-
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
270+
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg=
271+
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
242272
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
243273
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
244274
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -329,6 +359,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8
329359
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
330360
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
331361
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
362+
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
363+
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
332364
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
333365
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
334366
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
@@ -337,6 +369,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
337369
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
338370
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
339371
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
372+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
340373
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
341374
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
342375
gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU=

runtime/v2/module.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"slices"
77

88
"github.com/cosmos/gogoproto/proto"
9+
"github.com/spf13/viper"
910
"google.golang.org/grpc"
1011
"google.golang.org/protobuf/reflect/protodesc"
1112
"google.golang.org/protobuf/reflect/protoregistry"
@@ -28,7 +29,6 @@ import (
2829
"cosmossdk.io/depinject/appconfig"
2930
"cosmossdk.io/runtime/v2/services"
3031
"cosmossdk.io/server/v2/stf"
31-
rootstorev2 "cosmossdk.io/store/v2/root"
3232
)
3333

3434
var (
@@ -151,7 +151,7 @@ type AppInputs struct {
151151
InterfaceRegistrar registry.InterfaceRegistrar
152152
LegacyAmino legacy.Amino
153153
Logger log.Logger
154-
StoreOptions *rootstorev2.FactoryOptions `optional:"true"`
154+
Viper *viper.Viper `optional:"true"`
155155
}
156156

157157
func SetupAppBuilder(inputs AppInputs) {
@@ -163,10 +163,8 @@ func SetupAppBuilder(inputs AppInputs) {
163163
app.moduleManager.RegisterInterfaces(inputs.InterfaceRegistrar)
164164
app.moduleManager.RegisterLegacyAminoCodec(inputs.LegacyAmino)
165165

166-
if inputs.StoreOptions != nil {
167-
inputs.AppBuilder.storeOptions = inputs.StoreOptions
168-
inputs.AppBuilder.storeOptions.StoreKeys = inputs.AppBuilder.app.storeKeys
169-
inputs.AppBuilder.storeOptions.StoreKeys = append(inputs.AppBuilder.storeOptions.StoreKeys, "stf")
166+
if inputs.Viper != nil {
167+
inputs.AppBuilder.viper = inputs.Viper
170168
}
171169
}
172170

runtime/v2/types.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import (
1212
"cosmossdk.io/x/tx/signing"
1313
)
1414

15-
const ModuleName = "runtime"
15+
const (
16+
ModuleName = "runtime"
17+
FlagHome = "home"
18+
)
1619

1720
// ValidateProtoAnnotations validates that the proto annotations are correct.
1821
// More specifically, it verifies:

server/v2/go.mod

+24-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ replace (
99
cosmossdk.io/log => ../../log
1010
cosmossdk.io/server/v2/appmanager => ./appmanager
1111
cosmossdk.io/server/v2/stf => ./stf
12+
cosmossdk.io/store/v2 => ../../store/v2
13+
cosmossdk.io/store/v2/db => ../../store/v2/db
1214
cosmossdk.io/x/tx => ../../x/tx
1315
)
1416

@@ -18,6 +20,7 @@ require (
1820
cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000
1921
cosmossdk.io/log v1.3.1
2022
cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000
23+
cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000
2124
github.com/cosmos/cosmos-proto v1.0.0-beta.5
2225
github.com/cosmos/gogogateway v1.2.0
2326
github.com/cosmos/gogoproto v1.5.0
@@ -42,25 +45,43 @@ require (
4245
)
4346

4447
require (
48+
cosmossdk.io/errors v1.0.1 // indirect
4549
github.com/DataDog/datadog-go v3.2.0+incompatible // indirect
50+
github.com/DataDog/zstd v1.5.5 // indirect
4651
github.com/beorn7/perks v1.0.1 // indirect
4752
github.com/cespare/xxhash/v2 v2.3.0 // indirect
53+
github.com/cockroachdb/errors v1.11.1 // indirect
54+
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
55+
github.com/cockroachdb/pebble v1.1.0 // indirect
56+
github.com/cockroachdb/redact v1.1.5 // indirect
57+
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
58+
github.com/cosmos/cosmos-db v1.0.2 // indirect
59+
github.com/cosmos/iavl v1.2.0 // indirect
60+
github.com/cosmos/ics23/go v0.10.0 // indirect
4861
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
62+
github.com/emicklei/dot v1.6.1 // indirect
4963
github.com/fatih/color v1.15.0 // indirect
5064
github.com/fsnotify/fsnotify v1.7.0 // indirect
65+
github.com/getsentry/sentry-go v0.27.0 // indirect
5166
github.com/gogo/googleapis v1.4.1 // indirect
5267
github.com/gogo/protobuf v1.3.2 // indirect
68+
github.com/golang/snappy v0.0.4 // indirect
69+
github.com/google/btree v1.1.2 // indirect
5370
github.com/google/go-cmp v0.6.0 // indirect
5471
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
55-
github.com/hashicorp/go-uuid v1.0.1 // indirect
5672
github.com/hashicorp/golang-lru v1.0.2 // indirect
5773
github.com/hashicorp/hcl v1.0.0 // indirect
5874
github.com/hashicorp/yamux v0.1.1 // indirect
5975
github.com/inconshreveable/mousetrap v1.1.0 // indirect
6076
github.com/jhump/protoreflect v1.15.3 // indirect
77+
github.com/klauspost/compress v1.17.7 // indirect
78+
github.com/kr/pretty v0.3.1 // indirect
79+
github.com/kr/text v0.2.0 // indirect
80+
github.com/linxGnu/grocksdb v1.8.14 // indirect
6181
github.com/magiconair/properties v1.8.7 // indirect
6282
github.com/mattn/go-colorable v0.1.13 // indirect
6383
github.com/mattn/go-isatty v0.0.20 // indirect
84+
github.com/mattn/go-sqlite3 v1.14.22 // indirect
6485
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
6586
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
6687
github.com/oklog/run v1.1.0 // indirect
@@ -75,8 +96,10 @@ require (
7596
github.com/spf13/afero v1.11.0 // indirect
7697
github.com/spf13/cast v1.6.0 // indirect
7798
github.com/subosito/gotenv v1.6.0 // indirect
99+
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
78100
github.com/tidwall/btree v1.7.0 // indirect
79101
go.uber.org/multierr v1.11.0 // indirect
102+
golang.org/x/crypto v0.25.0 // indirect
80103
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect
81104
golang.org/x/net v0.27.0 // indirect
82105
golang.org/x/sys v0.22.0 // indirect

0 commit comments

Comments
 (0)