@agoric/cosmos 0.34.2-dev-0561702.0 → 0.34.2-dev-c9b43a3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/daemon/cmd/root.go +3 -0
- package/daemon/cmd/root_test.go +189 -1
- package/git-revision.txt +1 -1
- package/package.json +2 -2
package/daemon/cmd/root.go
CHANGED
|
@@ -323,6 +323,9 @@ func (ac appCreator) newApp(
|
|
|
323
323
|
baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))),
|
|
324
324
|
baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))),
|
|
325
325
|
baseapp.SetSnapshot(snapshotStore, snapshotOptions),
|
|
326
|
+
baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(server.FlagIAVLCacheSize))),
|
|
327
|
+
baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(server.FlagDisableIAVLFastNode))),
|
|
328
|
+
baseapp.SetIAVLLazyLoading(cast.ToBool(appOpts.Get(server.FlagIAVLLazyLoading))),
|
|
326
329
|
)
|
|
327
330
|
}
|
|
328
331
|
|
package/daemon/cmd/root_test.go
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
package cmd_test
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
+
"bytes"
|
|
5
|
+
"io"
|
|
6
|
+
"os"
|
|
4
7
|
"testing"
|
|
8
|
+
"text/template"
|
|
5
9
|
|
|
10
|
+
"github.com/spf13/pflag"
|
|
11
|
+
"github.com/stretchr/testify/require"
|
|
12
|
+
|
|
13
|
+
"github.com/cosmos/cosmos-sdk/server"
|
|
6
14
|
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
|
|
15
|
+
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
|
|
16
|
+
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
|
17
|
+
"github.com/tendermint/tendermint/libs/log"
|
|
18
|
+
dbm "github.com/tendermint/tm-db"
|
|
7
19
|
|
|
8
20
|
app "github.com/Agoric/agoric-sdk/golang/cosmos/app"
|
|
9
21
|
"github.com/Agoric/agoric-sdk/golang/cosmos/daemon/cmd"
|
|
10
|
-
"github.com/stretchr/testify/require"
|
|
11
22
|
)
|
|
12
23
|
|
|
13
24
|
func TestRootCmdConfig(t *testing.T) {
|
|
@@ -21,3 +32,180 @@ func TestRootCmdConfig(t *testing.T) {
|
|
|
21
32
|
|
|
22
33
|
require.NoError(t, svrcmd.Execute(rootCmd, "", app.DefaultNodeHome))
|
|
23
34
|
}
|
|
35
|
+
|
|
36
|
+
func TestCLIFlags(t *testing.T) {
|
|
37
|
+
// List of flags we have so far observed as used by the base cosmos sdk
|
|
38
|
+
// Before adding any flag to this list, the author should audit if explicit
|
|
39
|
+
// handling should not be added in the Agoric app (most likely in root.go)
|
|
40
|
+
expectedFlagNames := map[string]interface{}{
|
|
41
|
+
"abci": "",
|
|
42
|
+
"abci-client-type": "",
|
|
43
|
+
"address": "",
|
|
44
|
+
"app-db-backend": "",
|
|
45
|
+
"cpu-profile": "",
|
|
46
|
+
"db_backend": "",
|
|
47
|
+
"db_dir": "",
|
|
48
|
+
"fast_sync": "",
|
|
49
|
+
"genesis_hash": "",
|
|
50
|
+
"grpc-only": "",
|
|
51
|
+
"halt-height": "",
|
|
52
|
+
"halt-time": "",
|
|
53
|
+
"home": "",
|
|
54
|
+
"iavl-cache-size": "",
|
|
55
|
+
"iavl-disable-fastnode": "",
|
|
56
|
+
"iavl-lazy-loading": "",
|
|
57
|
+
"index-events": "",
|
|
58
|
+
"inter-block-cache": "",
|
|
59
|
+
"inv-check-period": "",
|
|
60
|
+
"min-retain-blocks": "",
|
|
61
|
+
"minimum-gas-prices": "",
|
|
62
|
+
"moniker": "",
|
|
63
|
+
"priv_validator_laddr": "",
|
|
64
|
+
"proxy_app": "",
|
|
65
|
+
"pruning": "default",
|
|
66
|
+
"pruning-interval": "",
|
|
67
|
+
"pruning-keep-recent": "",
|
|
68
|
+
"trace": "",
|
|
69
|
+
"trace-store": "",
|
|
70
|
+
"transport": "",
|
|
71
|
+
"unsafe-skip-upgrades": "",
|
|
72
|
+
"with-tendermint": "",
|
|
73
|
+
|
|
74
|
+
"api.address": "",
|
|
75
|
+
"api.enable": "",
|
|
76
|
+
"api.enabled-unsafe-cors": "",
|
|
77
|
+
"api.max-open-connections": "",
|
|
78
|
+
"api.rpc-max-body-bytes": "",
|
|
79
|
+
"api.rpc-read-timeout": "",
|
|
80
|
+
"api.rpc-write-timeout": "",
|
|
81
|
+
"api.swagger": "",
|
|
82
|
+
|
|
83
|
+
"consensus.create_empty_blocks": "",
|
|
84
|
+
"consensus.create_empty_blocks_interval": "",
|
|
85
|
+
"consensus.double_sign_check_height": "",
|
|
86
|
+
|
|
87
|
+
"grpc-web.address": "",
|
|
88
|
+
"grpc-web.enable": "",
|
|
89
|
+
"grpc-web.enable-unsafe-cors": "",
|
|
90
|
+
|
|
91
|
+
"grpc.address": "",
|
|
92
|
+
"grpc.enable": "",
|
|
93
|
+
"grpc.max-recv-msg-size": "",
|
|
94
|
+
"grpc.max-send-msg-size": "",
|
|
95
|
+
|
|
96
|
+
"p2p.external-address": "",
|
|
97
|
+
"p2p.laddr": "",
|
|
98
|
+
"p2p.persistent_peers": "",
|
|
99
|
+
"p2p.pex": "",
|
|
100
|
+
"p2p.private_peer_ids": "",
|
|
101
|
+
"p2p.seed_mode": "",
|
|
102
|
+
"p2p.seeds": "",
|
|
103
|
+
"p2p.unconditional_peer_ids": "",
|
|
104
|
+
"p2p.upnp": "",
|
|
105
|
+
|
|
106
|
+
"rpc.grpc_laddr": "",
|
|
107
|
+
"rpc.laddr": "",
|
|
108
|
+
"rpc.pprof_laddr": "",
|
|
109
|
+
"rpc.unsafe": "",
|
|
110
|
+
|
|
111
|
+
"rosetta.address": "",
|
|
112
|
+
"rosetta.blockchain": "",
|
|
113
|
+
"rosetta.denom-to-suggest": "",
|
|
114
|
+
"rosetta.enable-fee-suggestion": "",
|
|
115
|
+
"rosetta.enable": "",
|
|
116
|
+
"rosetta.gas-to-suggest": "",
|
|
117
|
+
"rosetta.network": "",
|
|
118
|
+
"rosetta.offline": "",
|
|
119
|
+
"rosetta.retries": "",
|
|
120
|
+
|
|
121
|
+
"state-sync.snapshot-interval": "",
|
|
122
|
+
"state-sync.snapshot-keep-recent": "",
|
|
123
|
+
|
|
124
|
+
"store.streamers": "",
|
|
125
|
+
|
|
126
|
+
"streamers.file.fsync": "",
|
|
127
|
+
"streamers.file.keys": "",
|
|
128
|
+
"streamers.file.output-metadata": "",
|
|
129
|
+
"streamers.file.prefix": "",
|
|
130
|
+
"streamers.file.stop-node-on-error": "",
|
|
131
|
+
"streamers.file.write_dir": "",
|
|
132
|
+
|
|
133
|
+
"telemetry.enable-hostname-label": "",
|
|
134
|
+
"telemetry.enable-hostname": "",
|
|
135
|
+
"telemetry.enable-service-label": "",
|
|
136
|
+
"telemetry.enabled": "",
|
|
137
|
+
"telemetry.global-labels": "",
|
|
138
|
+
"telemetry.prometheus-retention-time": "",
|
|
139
|
+
"telemetry.service-name": "",
|
|
140
|
+
}
|
|
141
|
+
unknownFlagNames := []string{}
|
|
142
|
+
missingFlagNames := map[string]bool{}
|
|
143
|
+
for name := range expectedFlagNames {
|
|
144
|
+
missingFlagNames[name] = true
|
|
145
|
+
}
|
|
146
|
+
readFlag := func(name string) interface{} {
|
|
147
|
+
if defaultValue, found := expectedFlagNames[name]; found {
|
|
148
|
+
delete(missingFlagNames, name)
|
|
149
|
+
return defaultValue
|
|
150
|
+
}
|
|
151
|
+
unknownFlagNames = append(unknownFlagNames, name)
|
|
152
|
+
return nil
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
homeDir, err := os.MkdirTemp("", "cosmos-sdk-home")
|
|
156
|
+
if err != nil {
|
|
157
|
+
panic(err)
|
|
158
|
+
}
|
|
159
|
+
defer os.RemoveAll(homeDir)
|
|
160
|
+
|
|
161
|
+
// First get the command line flags that the base cosmos-sdk defines
|
|
162
|
+
dummyAppCreator := func(
|
|
163
|
+
logger log.Logger,
|
|
164
|
+
db dbm.DB,
|
|
165
|
+
traceStore io.Writer,
|
|
166
|
+
appOpts servertypes.AppOptions,
|
|
167
|
+
) servertypes.Application {
|
|
168
|
+
return new(app.GaiaApp)
|
|
169
|
+
}
|
|
170
|
+
cmd := server.StartCmd(dummyAppCreator, homeDir)
|
|
171
|
+
flags := cmd.Flags()
|
|
172
|
+
flags.SortFlags = true
|
|
173
|
+
flags.VisitAll(func(flag *pflag.Flag) {
|
|
174
|
+
readFlag(flag.Name)
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
// Then get the options parsing the default config file.
|
|
178
|
+
serverCtx := server.NewDefaultContext()
|
|
179
|
+
// appTemplate, appConfig := initAppConfig()
|
|
180
|
+
appTemplate := serverconfig.DefaultConfigTemplate
|
|
181
|
+
appConfig := serverconfig.DefaultConfig()
|
|
182
|
+
configTemplate := template.Must(template.New("").Parse(appTemplate))
|
|
183
|
+
var buffer bytes.Buffer
|
|
184
|
+
if err := configTemplate.Execute(&buffer, appConfig); err != nil {
|
|
185
|
+
panic(err)
|
|
186
|
+
}
|
|
187
|
+
serverCtx.Viper.SetConfigType("toml")
|
|
188
|
+
if err := serverCtx.Viper.MergeConfig(&buffer); err != nil {
|
|
189
|
+
panic(err)
|
|
190
|
+
}
|
|
191
|
+
for _, configKey := range serverCtx.Viper.AllKeys() {
|
|
192
|
+
readFlag(configKey)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if len(unknownFlagNames) != 0 {
|
|
196
|
+
t.Error(
|
|
197
|
+
"unknown CLI flags in cosmos-sdk; incorporate as needed and update this test",
|
|
198
|
+
unknownFlagNames,
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
if len(missingFlagNames) != 0 {
|
|
202
|
+
missing := []string{}
|
|
203
|
+
for name := range missingFlagNames {
|
|
204
|
+
missing = append(missing, name)
|
|
205
|
+
}
|
|
206
|
+
t.Error(
|
|
207
|
+
"expected CLI flags missing from cosmos-sdk; remove from this test",
|
|
208
|
+
missing,
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
}
|
package/git-revision.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
c9b43a3
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cosmos",
|
|
3
|
-
"version": "0.34.2-dev-
|
|
3
|
+
"version": "0.34.2-dev-c9b43a3.0+c9b43a3",
|
|
4
4
|
"description": "Connect JS to the Cosmos blockchain SDK",
|
|
5
5
|
"parsers": {
|
|
6
6
|
"js": "mjs"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"typeCoverage": {
|
|
40
40
|
"atLeast": 0
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "c9b43a36e52c1d40da87c465d60f4ce458f551ab"
|
|
43
43
|
}
|