@agoric/cosmos 0.35.0-u12.0 → 0.35.0-u14.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/CHANGELOG.md +67 -0
- package/Makefile +25 -12
- package/ante/ante.go +7 -5
- package/ante/inbound_test.go +8 -0
- package/app/app.go +139 -108
- package/app/export.go +13 -9
- package/app/sim_test.go +4 -4
- package/cmd/agd/main.go +5 -3
- package/cmd/libdaemon/main.go +5 -2
- package/daemon/cmd/genaccounts.go +13 -9
- package/daemon/cmd/root.go +38 -17
- package/daemon/cmd/root_test.go +1 -1
- package/daemon/cmd/testnet.go +17 -6
- package/daemon/main.go +3 -2
- package/git-revision.txt +1 -1
- package/go.mod +117 -76
- package/go.sum +858 -210
- package/package.json +3 -3
- package/proto/agoric/vstorage/query.proto +53 -1
- package/scripts/protocgen.sh +12 -1
- package/third_party/proto/buf.yaml +1 -0
- package/third_party/proto/cosmos/base/query/v1beta1/pagination.proto +4 -1
- package/third_party/proto/cosmos/base/v1beta1/coin.proto +7 -4
- package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +16 -6
- package/third_party/proto/cosmos_proto/cosmos.proto +97 -0
- package/third_party/proto/google/api/annotations.proto +1 -1
- package/third_party/proto/google/api/http.proto +181 -120
- package/third_party/proto/google/api/httpbody.proto +9 -6
- package/third_party/proto/google/protobuf/any.proto +1 -7
- package/third_party/proto/ibc/core/channel/v1/channel.proto +15 -1
- package/third_party/proto/ibc/core/client/v1/client.proto +9 -6
- package/upgradegaia.sh +13 -4
- package/vm/action.go +133 -0
- package/vm/action_test.go +129 -0
- package/vm/controller.go +9 -16
- package/vm/core_proposals.go +31 -0
- package/x/lien/keeper/account.go +16 -11
- package/x/lien/keeper/keeper.go +5 -4
- package/x/lien/keeper/keeper_test.go +9 -9
- package/x/lien/lien.go +6 -4
- package/x/lien/lien_test.go +20 -16
- package/x/swingset/abci.go +25 -33
- package/x/swingset/client/cli/query.go +2 -2
- package/x/swingset/client/cli/tx.go +48 -33
- package/x/swingset/client/proposal_handler.go +2 -17
- package/x/swingset/keeper/keeper.go +69 -15
- package/x/swingset/keeper/keeper_test.go +1 -1
- package/x/swingset/keeper/migrations.go +7 -2
- package/x/swingset/keeper/msg_server.go +66 -49
- package/x/swingset/keeper/proposal.go +14 -8
- package/x/swingset/keeper/querier.go +14 -6
- package/x/swingset/keeper/swing_store_exports_handler.go +5 -1
- package/x/swingset/proposal_handler.go +3 -3
- package/x/swingset/swingset.go +4 -2
- package/x/swingset/types/codec.go +2 -2
- package/x/swingset/types/default-params.go +22 -16
- package/x/swingset/types/expected_keepers.go +11 -0
- package/x/swingset/types/msgs.go +43 -2
- package/x/swingset/types/msgs.pb.go +16 -16
- package/x/swingset/types/params.go +74 -0
- package/x/swingset/types/params_test.go +116 -0
- package/x/swingset/types/proposal.go +5 -5
- package/x/swingset/types/types.go +30 -28
- package/x/vbank/keeper/keeper.go +3 -2
- package/x/vbank/keeper/querier.go +6 -2
- package/x/vbank/keeper/rewards.go +1 -1
- package/x/vbank/vbank.go +19 -17
- package/x/vbank/vbank_test.go +18 -18
- package/x/vibc/handler.go +3 -8
- package/x/vibc/ibc.go +79 -126
- package/x/vibc/keeper/keeper.go +19 -18
- package/x/vibc/types/expected_keepers.go +13 -5
- package/x/vibc/types/msgs.go +1 -1
- package/x/vibc/types/msgs.pb.go +1 -1
- package/x/vstorage/README.md +138 -0
- package/x/vstorage/capdata/capdata.go +298 -0
- package/x/vstorage/capdata/capdata_test.go +352 -0
- package/x/vstorage/client/cli/query.go +51 -4
- package/x/vstorage/keeper/grpc_query.go +221 -0
- package/x/vstorage/keeper/keeper.go +3 -2
- package/x/vstorage/keeper/keeper_grpc_test.go +300 -0
- package/x/vstorage/keeper/keeper_test.go +1 -1
- package/x/vstorage/keeper/querier.go +6 -2
- package/x/vstorage/keeper/querier_test.go +112 -0
- package/x/vstorage/types/query.pb.go +646 -36
- package/x/vstorage/types/query.pb.gw.go +119 -0
- package/x/vstorage/vstorage.go +16 -15
- package/x/vstorage/vstorage_test.go +5 -5
- package/x/swingset/legacy/v32/params.go +0 -37
- package/x/swingset/legacy/v32/params_test.go +0 -133
- /package/{src/index.cjs → index.cjs} +0 -0
package/cmd/agd/main.go
CHANGED
|
@@ -9,24 +9,26 @@ import (
|
|
|
9
9
|
gaia "github.com/Agoric/agoric-sdk/golang/cosmos/app"
|
|
10
10
|
"github.com/Agoric/agoric-sdk/golang/cosmos/daemon"
|
|
11
11
|
daemoncmd "github.com/Agoric/agoric-sdk/golang/cosmos/daemon/cmd"
|
|
12
|
+
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
|
12
13
|
)
|
|
13
14
|
|
|
14
15
|
func main() {
|
|
15
16
|
// We need to delegate to our default app for running the actual chain.
|
|
16
|
-
launchVM := func(logger log.Logger) {
|
|
17
|
+
launchVM := func(logger log.Logger, appOpts servertypes.AppOptions) error {
|
|
17
18
|
args := []string{"ag-chain-cosmos", "--home", gaia.DefaultNodeHome}
|
|
18
19
|
args = append(args, os.Args[1:]...)
|
|
19
20
|
|
|
20
21
|
binary, lookErr := FindCosmicSwingsetBinary()
|
|
21
22
|
if lookErr != nil {
|
|
22
|
-
|
|
23
|
+
return lookErr
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
logger.Info("agd delegating to JS executable", "binary", binary, "args", args)
|
|
26
27
|
execErr := syscall.Exec(binary, args, os.Environ())
|
|
27
28
|
if execErr != nil {
|
|
28
|
-
|
|
29
|
+
return execErr
|
|
29
30
|
}
|
|
31
|
+
return nil
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
daemoncmd.OnStartHook = launchVM
|
package/cmd/libdaemon/main.go
CHANGED
|
@@ -10,6 +10,7 @@ package main
|
|
|
10
10
|
import "C"
|
|
11
11
|
|
|
12
12
|
import (
|
|
13
|
+
"context"
|
|
13
14
|
"encoding/json"
|
|
14
15
|
"errors"
|
|
15
16
|
"os"
|
|
@@ -21,6 +22,7 @@ import (
|
|
|
21
22
|
"github.com/Agoric/agoric-sdk/golang/cosmos/daemon"
|
|
22
23
|
daemoncmd "github.com/Agoric/agoric-sdk/golang/cosmos/daemon/cmd"
|
|
23
24
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
25
|
+
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
|
24
26
|
)
|
|
25
27
|
|
|
26
28
|
type goReturn = struct {
|
|
@@ -44,7 +46,7 @@ func RunAgCosmosDaemon(nodePort C.int, toNode C.sendFunc, cosmosArgs []*C.char)
|
|
|
44
46
|
daemoncmd.AppName = "ag-chain-cosmos"
|
|
45
47
|
|
|
46
48
|
// FIXME: Decouple the sending logic from the Cosmos app.
|
|
47
|
-
sendToNode := func(needReply bool, str string) (string, error) {
|
|
49
|
+
sendToNode := func(ctx context.Context, needReply bool, str string) (string, error) {
|
|
48
50
|
var rPort int
|
|
49
51
|
if needReply {
|
|
50
52
|
lastReply++
|
|
@@ -78,10 +80,11 @@ func RunAgCosmosDaemon(nodePort C.int, toNode C.sendFunc, cosmosArgs []*C.char)
|
|
|
78
80
|
// We run in the background, but exit when the job is over.
|
|
79
81
|
// swingset.SendToNode("hello from Initial Go!")
|
|
80
82
|
exitCode := 0
|
|
81
|
-
daemoncmd.OnStartHook = func(logger log.Logger) {
|
|
83
|
+
daemoncmd.OnStartHook = func(logger log.Logger, appOpts servertypes.AppOptions) error {
|
|
82
84
|
// We tried running start, which should never exit, so exit with non-zero
|
|
83
85
|
// code if we ever stop.
|
|
84
86
|
exitCode = 99
|
|
87
|
+
return nil
|
|
85
88
|
}
|
|
86
89
|
daemon.RunWithController(sendToNode)
|
|
87
90
|
// fmt.Fprintln(os.Stderr, "Shutting down Cosmos")
|
|
@@ -10,6 +10,7 @@ import (
|
|
|
10
10
|
|
|
11
11
|
"github.com/cosmos/cosmos-sdk/client"
|
|
12
12
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
|
13
|
+
"github.com/cosmos/cosmos-sdk/codec"
|
|
13
14
|
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
|
14
15
|
"github.com/cosmos/cosmos-sdk/server"
|
|
15
16
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
@@ -27,14 +28,14 @@ const (
|
|
|
27
28
|
)
|
|
28
29
|
|
|
29
30
|
// AddGenesisAccountCmd returns add-genesis-account cobra Command.
|
|
30
|
-
func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command {
|
|
31
|
+
func AddGenesisAccountCmd(cdc codec.Codec, defaultNodeHome string) *cobra.Command {
|
|
31
32
|
cmd := &cobra.Command{
|
|
32
|
-
Use: "add-genesis-account
|
|
33
|
+
Use: "add-genesis-account <address_or_key_name> <coin>[,...]",
|
|
33
34
|
Short: "Add a genesis account to genesis.json",
|
|
34
|
-
Long: `Add a genesis account to genesis.json.
|
|
35
|
-
the
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
Long: `Add a genesis account to genesis.json.
|
|
36
|
+
If the address is specified by name, it will be looked up in the local Keybase.
|
|
37
|
+
The comma-separated list of initial tokens must contain valid denominations.
|
|
38
|
+
Accounts may optionally be supplied with vesting parameters.
|
|
38
39
|
`,
|
|
39
40
|
Args: cobra.ExactArgs(2),
|
|
40
41
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
@@ -54,17 +55,20 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
// attempt to lookup address from Keybase if no address was provided
|
|
57
|
-
kb, err := keyring.New(sdk.KeyringServiceName(), keyringBackend, clientCtx.KeyringDir, inBuf)
|
|
58
|
+
kb, err := keyring.New(sdk.KeyringServiceName(), keyringBackend, clientCtx.KeyringDir, inBuf, cdc)
|
|
58
59
|
if err != nil {
|
|
59
60
|
return err
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
info, err := kb.Key(args[0])
|
|
63
64
|
if err != nil {
|
|
64
|
-
return fmt.Errorf("failed to get
|
|
65
|
+
return fmt.Errorf("failed to get key from Keybase: %s", err)
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
addr = info.GetAddress()
|
|
68
|
+
addr, err = info.GetAddress()
|
|
69
|
+
if err != nil {
|
|
70
|
+
return fmt.Errorf("failed to get address from Keybase: %s", err)
|
|
71
|
+
}
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
coins, err := sdk.ParseCoinsNormalized(args[1])
|
package/daemon/cmd/root.go
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package cmd
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
+
"context"
|
|
4
5
|
"errors"
|
|
5
6
|
"io"
|
|
6
7
|
"os"
|
|
@@ -14,21 +15,24 @@ import (
|
|
|
14
15
|
"github.com/cosmos/cosmos-sdk/client/debug"
|
|
15
16
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
|
16
17
|
"github.com/cosmos/cosmos-sdk/client/keys"
|
|
18
|
+
"github.com/cosmos/cosmos-sdk/client/pruning"
|
|
17
19
|
"github.com/cosmos/cosmos-sdk/client/rpc"
|
|
20
|
+
"github.com/cosmos/cosmos-sdk/client/snapshot"
|
|
18
21
|
"github.com/cosmos/cosmos-sdk/server"
|
|
19
22
|
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
|
20
23
|
"github.com/cosmos/cosmos-sdk/snapshots"
|
|
24
|
+
snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types"
|
|
21
25
|
"github.com/cosmos/cosmos-sdk/store"
|
|
22
26
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
23
27
|
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
|
|
24
28
|
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
25
29
|
vestingcli "github.com/cosmos/cosmos-sdk/x/auth/vesting/client/cli"
|
|
26
30
|
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
|
27
|
-
"github.com/cosmos/cosmos-sdk/x/crisis"
|
|
28
31
|
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
|
|
29
32
|
"github.com/spf13/cast"
|
|
30
33
|
"github.com/spf13/cobra"
|
|
31
34
|
"github.com/spf13/viper"
|
|
35
|
+
tmcfg "github.com/tendermint/tendermint/config"
|
|
32
36
|
tmcli "github.com/tendermint/tendermint/libs/cli"
|
|
33
37
|
"github.com/tendermint/tendermint/libs/log"
|
|
34
38
|
dbm "github.com/tendermint/tm-db"
|
|
@@ -38,11 +42,11 @@ import (
|
|
|
38
42
|
)
|
|
39
43
|
|
|
40
44
|
// Sender is a function that sends a request to the controller.
|
|
41
|
-
type Sender func(needReply bool, str string) (string, error)
|
|
45
|
+
type Sender func(ctx context.Context, needReply bool, str string) (string, error)
|
|
42
46
|
|
|
43
47
|
var AppName = "agd"
|
|
44
|
-
var OnStartHook func(
|
|
45
|
-
var OnExportHook func(
|
|
48
|
+
var OnStartHook func(log.Logger, servertypes.AppOptions) error
|
|
49
|
+
var OnExportHook func(log.Logger, servertypes.AppOptions) error
|
|
46
50
|
|
|
47
51
|
// NewRootCmd creates a new root command for simd. It is called once in the
|
|
48
52
|
// main function.
|
|
@@ -60,7 +64,7 @@ func NewRootCmd(sender Sender) (*cobra.Command, params.EncodingConfig) {
|
|
|
60
64
|
|
|
61
65
|
rootCmd := &cobra.Command{
|
|
62
66
|
Use: AppName,
|
|
63
|
-
Short: "
|
|
67
|
+
Short: "Agoric Cosmos App",
|
|
64
68
|
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
|
|
65
69
|
// set the default command outputs
|
|
66
70
|
cmd.SetOut(cmd.OutOrStdout())
|
|
@@ -81,7 +85,8 @@ func NewRootCmd(sender Sender) (*cobra.Command, params.EncodingConfig) {
|
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
customAppTemplate, customAppConfig := initAppConfig()
|
|
84
|
-
|
|
88
|
+
customTMConfig := initTendermintConfig()
|
|
89
|
+
return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customTMConfig)
|
|
85
90
|
},
|
|
86
91
|
}
|
|
87
92
|
|
|
@@ -90,6 +95,12 @@ func NewRootCmd(sender Sender) (*cobra.Command, params.EncodingConfig) {
|
|
|
90
95
|
return rootCmd, encodingConfig
|
|
91
96
|
}
|
|
92
97
|
|
|
98
|
+
func initTendermintConfig() *tmcfg.Config {
|
|
99
|
+
cfg := tmcfg.DefaultConfig()
|
|
100
|
+
// customize config here
|
|
101
|
+
return cfg
|
|
102
|
+
}
|
|
103
|
+
|
|
93
104
|
// initAppConfig helps to override default appConfig template and configs.
|
|
94
105
|
// return "", nil if no custom configuration is required for the application.
|
|
95
106
|
func initAppConfig() (string, interface{}) {
|
|
@@ -117,22 +128,26 @@ func initRootCmd(sender Sender, rootCmd *cobra.Command, encodingConfig params.En
|
|
|
117
128
|
cfg := sdk.GetConfig()
|
|
118
129
|
cfg.Seal()
|
|
119
130
|
|
|
131
|
+
ac := appCreator{
|
|
132
|
+
encCfg: encodingConfig,
|
|
133
|
+
sender: sender,
|
|
134
|
+
}
|
|
135
|
+
|
|
120
136
|
rootCmd.AddCommand(
|
|
121
137
|
genutilcli.InitCmd(gaia.ModuleBasics, gaia.DefaultNodeHome),
|
|
122
138
|
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, gaia.DefaultNodeHome),
|
|
139
|
+
genutilcli.MigrateGenesisCmd(),
|
|
123
140
|
genutilcli.GenTxCmd(gaia.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, gaia.DefaultNodeHome),
|
|
124
141
|
genutilcli.ValidateGenesisCmd(gaia.ModuleBasics),
|
|
125
|
-
AddGenesisAccountCmd(gaia.DefaultNodeHome),
|
|
142
|
+
AddGenesisAccountCmd(encodingConfig.Marshaler, gaia.DefaultNodeHome),
|
|
126
143
|
tmcli.NewCompletionCmd(rootCmd, true),
|
|
127
144
|
testnetCmd(gaia.ModuleBasics, banktypes.GenesisBalancesIterator{}),
|
|
128
145
|
debug.Cmd(),
|
|
129
146
|
config.Cmd(),
|
|
147
|
+
pruning.Cmd(ac.newApp, gaia.DefaultNodeHome),
|
|
148
|
+
snapshot.Cmd(ac.newApp),
|
|
130
149
|
)
|
|
131
150
|
|
|
132
|
-
ac := appCreator{
|
|
133
|
-
encCfg: encodingConfig,
|
|
134
|
-
sender: sender,
|
|
135
|
-
}
|
|
136
151
|
server.AddCommands(rootCmd, gaia.DefaultNodeHome, ac.newApp, ac.appExport, addModuleInitFlags)
|
|
137
152
|
|
|
138
153
|
hasVMController := sender != nil
|
|
@@ -155,7 +170,6 @@ func initRootCmd(sender Sender, rootCmd *cobra.Command, encodingConfig params.En
|
|
|
155
170
|
}
|
|
156
171
|
|
|
157
172
|
func addModuleInitFlags(startCmd *cobra.Command) {
|
|
158
|
-
crisis.AddModuleInitFlags(startCmd)
|
|
159
173
|
}
|
|
160
174
|
|
|
161
175
|
func queryCommand() *cobra.Command {
|
|
@@ -201,6 +215,7 @@ func txCommand() *cobra.Command {
|
|
|
201
215
|
authcmd.GetBroadcastCommand(),
|
|
202
216
|
authcmd.GetEncodeCommand(),
|
|
203
217
|
authcmd.GetDecodeCommand(),
|
|
218
|
+
authcmd.GetAuxToFeeCommand(),
|
|
204
219
|
flags.LineBreak,
|
|
205
220
|
vestingcli.GetTxCmd(),
|
|
206
221
|
)
|
|
@@ -223,7 +238,9 @@ func (ac appCreator) newApp(
|
|
|
223
238
|
appOpts servertypes.AppOptions,
|
|
224
239
|
) servertypes.Application {
|
|
225
240
|
if OnStartHook != nil {
|
|
226
|
-
OnStartHook(logger)
|
|
241
|
+
if err := OnStartHook(logger, appOpts); err != nil {
|
|
242
|
+
panic(err)
|
|
243
|
+
}
|
|
227
244
|
}
|
|
228
245
|
|
|
229
246
|
var cache sdk.MultiStorePersistentCache
|
|
@@ -260,6 +277,10 @@ func (ac appCreator) newApp(
|
|
|
260
277
|
if err != nil {
|
|
261
278
|
panic(err)
|
|
262
279
|
}
|
|
280
|
+
snapshotOptions := snapshottypes.NewSnapshotOptions(
|
|
281
|
+
cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)),
|
|
282
|
+
cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)),
|
|
283
|
+
)
|
|
263
284
|
|
|
264
285
|
return gaia.NewAgoricApp(
|
|
265
286
|
ac.sender,
|
|
@@ -276,9 +297,7 @@ func (ac appCreator) newApp(
|
|
|
276
297
|
baseapp.SetInterBlockCache(cache),
|
|
277
298
|
baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))),
|
|
278
299
|
baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))),
|
|
279
|
-
baseapp.
|
|
280
|
-
baseapp.SetSnapshotInterval(cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval))),
|
|
281
|
-
baseapp.SetSnapshotKeepRecent(cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent))),
|
|
300
|
+
baseapp.SetSnapshot(snapshotStore, snapshotOptions),
|
|
282
301
|
)
|
|
283
302
|
}
|
|
284
303
|
|
|
@@ -360,7 +379,9 @@ func (ac appCreator) appExport(
|
|
|
360
379
|
appOpts servertypes.AppOptions,
|
|
361
380
|
) (servertypes.ExportedApp, error) {
|
|
362
381
|
if OnExportHook != nil {
|
|
363
|
-
OnExportHook(logger)
|
|
382
|
+
if err := OnExportHook(logger, appOpts); err != nil {
|
|
383
|
+
return servertypes.ExportedApp{}, err
|
|
384
|
+
}
|
|
364
385
|
}
|
|
365
386
|
|
|
366
387
|
homePath, ok := appOpts.Get(flags.FlagHome).(string)
|
package/daemon/cmd/root_test.go
CHANGED
package/daemon/cmd/testnet.go
CHANGED
|
@@ -37,7 +37,7 @@ import (
|
|
|
37
37
|
|
|
38
38
|
var (
|
|
39
39
|
flagNodeDirPrefix = "node-dir-prefix"
|
|
40
|
-
flagNumValidators = "
|
|
40
|
+
flagNumValidators = "validator-count"
|
|
41
41
|
flagOutputDir = "output-dir"
|
|
42
42
|
flagNodeDaemonHome = "node-daemon-home"
|
|
43
43
|
flagStartingIPAddress = "starting-ip-address"
|
|
@@ -48,13 +48,13 @@ func testnetCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalance
|
|
|
48
48
|
cmd := &cobra.Command{
|
|
49
49
|
Use: "testnet",
|
|
50
50
|
Short: fmt.Sprintf("Initialize files for a %s testnet", AppName),
|
|
51
|
-
Long: `testnet will create
|
|
51
|
+
Long: `testnet will create one directory per validator and populate each with
|
|
52
52
|
necessary files (private validator, genesis, config, etc.).
|
|
53
53
|
|
|
54
54
|
Note, strict routability for addresses is turned off in the config file.
|
|
55
55
|
|
|
56
56
|
Example:
|
|
57
|
-
agd testnet
|
|
57
|
+
agd testnet -n 4 --output-dir ./output --starting-ip-address 192.168.10.2
|
|
58
58
|
`,
|
|
59
59
|
RunE: func(cmd *cobra.Command, _ []string) error {
|
|
60
60
|
clientCtx, err := client.GetClientQueryContext(cmd)
|
|
@@ -74,6 +74,13 @@ Example:
|
|
|
74
74
|
numValidators, _ := cmd.Flags().GetInt(flagNumValidators)
|
|
75
75
|
algo, _ := cmd.Flags().GetString(flags.FlagKeyAlgorithm)
|
|
76
76
|
|
|
77
|
+
if cmd.Flags().Changed("v") {
|
|
78
|
+
if cmd.Flags().Changed(flagNumValidators) {
|
|
79
|
+
return fmt.Errorf("--%s and --v are mutually exclusive", flagNumValidators)
|
|
80
|
+
}
|
|
81
|
+
numValidators, _ = cmd.Flags().GetInt("v")
|
|
82
|
+
}
|
|
83
|
+
|
|
77
84
|
return InitTestnet(
|
|
78
85
|
clientCtx, cmd, config, mbm, genBalIterator, outputDir, chainID, minGasPrices,
|
|
79
86
|
nodeDirPrefix, nodeDaemonHome, startingIPAddress, keyringBackend, algo, numValidators,
|
|
@@ -81,9 +88,13 @@ Example:
|
|
|
81
88
|
},
|
|
82
89
|
}
|
|
83
90
|
|
|
84
|
-
cmd.Flags().
|
|
91
|
+
cmd.Flags().IntP(flagNumValidators, "n", 4, "Number of validators to initialize the testnet with")
|
|
92
|
+
cmd.Flags().Int("v", 4, fmt.Sprintf("Alias for --%s", flagNumValidators))
|
|
93
|
+
if vFlag := cmd.Flags().Lookup("v"); vFlag != nil {
|
|
94
|
+
vFlag.Deprecated = fmt.Sprintf("use --%s", flagNumValidators)
|
|
95
|
+
}
|
|
85
96
|
cmd.Flags().StringP(flagOutputDir, "o", "./mytestnet", "Directory to store initialization data for the testnet")
|
|
86
|
-
cmd.Flags().String(flagNodeDirPrefix, "node", "Prefix the
|
|
97
|
+
cmd.Flags().String(flagNodeDirPrefix, "node", "Prefix for the name of per-validator subdirectories (to be number-suffixed like node0, node1, ...)")
|
|
87
98
|
cmd.Flags().String(flagNodeDaemonHome, AppName, "Home directory of the node's daemon configuration")
|
|
88
99
|
cmd.Flags().String(flagStartingIPAddress, "192.168.0.1", "Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)")
|
|
89
100
|
cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created")
|
|
@@ -167,7 +178,7 @@ func InitTestnet(
|
|
|
167
178
|
memo := fmt.Sprintf("%s@%s:26656", nodeIDs[i], ip)
|
|
168
179
|
genFiles = append(genFiles, nodeConfig.GenesisFile())
|
|
169
180
|
|
|
170
|
-
kb, err := keyring.New(sdk.KeyringServiceName(), keyringBackend, nodeDir, inBuf)
|
|
181
|
+
kb, err := keyring.New(sdk.KeyringServiceName(), keyringBackend, nodeDir, inBuf, clientCtx.Codec)
|
|
171
182
|
if err != nil {
|
|
172
183
|
return err
|
|
173
184
|
}
|
package/daemon/main.go
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package daemon
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
+
"context"
|
|
4
5
|
"fmt"
|
|
5
6
|
"os"
|
|
6
7
|
"os/signal"
|
|
@@ -17,7 +18,7 @@ import (
|
|
|
17
18
|
)
|
|
18
19
|
|
|
19
20
|
// DefaultController is a stub controller.
|
|
20
|
-
var DefaultController = func(needReply bool, str string) (string, error) {
|
|
21
|
+
var DefaultController = func(ctx context.Context, needReply bool, str string) (string, error) {
|
|
21
22
|
return "", fmt.Errorf("Controller not configured; did you mean to use `ag-chain-cosmos` instead?")
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -42,7 +43,7 @@ func RunWithController(sendToController cmd.Sender) {
|
|
|
42
43
|
config.Seal()
|
|
43
44
|
|
|
44
45
|
rootCmd, _ := cmd.NewRootCmd(sendToController)
|
|
45
|
-
if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil {
|
|
46
|
+
if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {
|
|
46
47
|
switch e := err.(type) {
|
|
47
48
|
case server.ErrorCode:
|
|
48
49
|
os.Exit(e.Code)
|
package/git-revision.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
b3a6f3374
|