@agoric/cosmos 0.35.0-upgrade-14-dev-0169c7e.0 → 0.35.0-upgrade-14-dev-c8f9e7b.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.
Files changed (74) hide show
  1. package/Makefile +25 -12
  2. package/ante/ante.go +7 -5
  3. package/app/app.go +60 -47
  4. package/app/export.go +13 -6
  5. package/cmd/agd/main.go +5 -3
  6. package/cmd/libdaemon/main.go +5 -2
  7. package/daemon/cmd/genaccounts.go +13 -9
  8. package/daemon/cmd/root.go +27 -11
  9. package/daemon/cmd/root_test.go +1 -1
  10. package/daemon/cmd/testnet.go +17 -6
  11. package/daemon/main.go +3 -2
  12. package/git-revision.txt +1 -1
  13. package/go.mod +95 -64
  14. package/go.sum +592 -243
  15. package/package.json +2 -2
  16. package/proto/agoric/vstorage/query.proto +53 -1
  17. package/scripts/protocgen.sh +12 -1
  18. package/third_party/proto/buf.yaml +1 -0
  19. package/third_party/proto/cosmos/base/query/v1beta1/pagination.proto +4 -1
  20. package/third_party/proto/cosmos/base/v1beta1/coin.proto +7 -4
  21. package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +16 -6
  22. package/third_party/proto/cosmos_proto/cosmos.proto +97 -0
  23. package/third_party/proto/google/api/annotations.proto +1 -1
  24. package/third_party/proto/google/api/http.proto +181 -120
  25. package/third_party/proto/google/api/httpbody.proto +9 -6
  26. package/third_party/proto/google/protobuf/any.proto +1 -7
  27. package/third_party/proto/ibc/core/channel/v1/channel.proto +15 -1
  28. package/third_party/proto/ibc/core/client/v1/client.proto +9 -6
  29. package/upgradegaia.sh +13 -4
  30. package/vm/action.go +24 -21
  31. package/vm/action_test.go +5 -5
  32. package/vm/controller.go +9 -10
  33. package/x/lien/keeper/account.go +3 -3
  34. package/x/lien/keeper/keeper.go +5 -4
  35. package/x/lien/keeper/keeper_test.go +8 -8
  36. package/x/lien/lien.go +6 -4
  37. package/x/lien/lien_test.go +20 -16
  38. package/x/swingset/client/cli/query.go +2 -2
  39. package/x/swingset/client/cli/tx.go +48 -33
  40. package/x/swingset/client/proposal_handler.go +2 -17
  41. package/x/swingset/keeper/keeper.go +8 -11
  42. package/x/swingset/keeper/keeper_test.go +1 -1
  43. package/x/swingset/keeper/msg_server.go +2 -4
  44. package/x/swingset/keeper/proposal.go +10 -0
  45. package/x/swingset/keeper/querier.go +14 -6
  46. package/x/swingset/proposal_handler.go +3 -3
  47. package/x/swingset/swingset.go +4 -2
  48. package/x/swingset/types/codec.go +2 -2
  49. package/x/swingset/types/msgs.pb.go +16 -16
  50. package/x/swingset/types/proposal.go +5 -5
  51. package/x/swingset/types/types.go +30 -28
  52. package/x/vbank/keeper/keeper.go +3 -2
  53. package/x/vbank/keeper/querier.go +6 -2
  54. package/x/vbank/keeper/rewards.go +1 -1
  55. package/x/vbank/vbank.go +11 -10
  56. package/x/vbank/vbank_test.go +8 -8
  57. package/x/vibc/ibc.go +27 -26
  58. package/x/vibc/keeper/keeper.go +19 -18
  59. package/x/vibc/types/expected_keepers.go +13 -5
  60. package/x/vibc/types/msgs.go +1 -1
  61. package/x/vibc/types/msgs.pb.go +1 -1
  62. package/x/vstorage/README.md +138 -0
  63. package/x/vstorage/capdata/capdata.go +298 -0
  64. package/x/vstorage/capdata/capdata_test.go +352 -0
  65. package/x/vstorage/client/cli/query.go +51 -4
  66. package/x/vstorage/keeper/grpc_query.go +221 -0
  67. package/x/vstorage/keeper/keeper.go +3 -2
  68. package/x/vstorage/keeper/keeper_grpc_test.go +300 -0
  69. package/x/vstorage/keeper/keeper_test.go +1 -1
  70. package/x/vstorage/keeper/querier.go +6 -2
  71. package/x/vstorage/types/query.pb.go +646 -36
  72. package/x/vstorage/types/query.pb.gw.go +119 -0
  73. package/x/vstorage/vstorage.go +16 -15
  74. package/x/vstorage/vstorage_test.go +5 -5
package/Makefile CHANGED
@@ -98,44 +98,57 @@ proto-lint: proto-tools
98
98
  proto-check-breaking: proto-tools
99
99
  ${BIN}/buf breaking --against $(PR_TARGET_REPO)#branch=$(PR_TARGET_BRANCH),subdir=golang/cosmos
100
100
 
101
- TMVER := $(shell go list -m all | sed -ne 's!^github\.com/tendermint/tendermint \(.*\)!\1!p')
102
- COSMOSVER = $(shell go list -m all | sed -ne 's!^github\.com/cosmos/cosmos-sdk \(.*\)!\1!p')
103
- IBCVER = 832044782f10
104
- t:
105
- echo "X$(COSMOSVER)X"
106
-
107
- TM_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/tendermint/tendermint)/proto/tendermint
108
- GOGO_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/gogo/protobuf)
109
- IBC_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/cosmos/ibc-go/v4)/proto/ibc/core
101
+ GOGO_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/gogo/protobuf)
102
+ # GOOGLE_API_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/googleapis/googleapis)/google/api
103
+ IBC_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/cosmos/ibc-go/v6)/proto/ibc/core
104
+ COSMOS_PROTO_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/cosmos/cosmos-proto)/proto/cosmos_proto
110
105
  COSMOS_SDK_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/cosmos/cosmos-sdk)/proto/cosmos
111
106
 
107
+ COSMOS_PROTO_TYPES = third_party/proto/cosmos_proto
112
108
  GOGO_PROTO_TYPES = third_party/proto/gogoproto
109
+ GOOGLE_API_TYPES = third_party/proto/google/api
110
+ GOOGLE_PROTO_TYPES = third_party/proto/google/protobuf
113
111
  IBC_CHANNEL_TYPES = third_party/proto/ibc/core/channel/v1
114
112
  IBC_CLIENT_TYPES = third_party/proto/ibc/core/client/v1
115
- SDK_QUERY_TYPES = third_party/proto/cosmos/base/query/v1beta1
113
+ SDK_BASE_TYPES = third_party/proto/cosmos/base/v1beta1
114
+ SDK_QUERY_TYPES = third_party/proto/cosmos/base/query/v1beta1
116
115
  SDK_UPGRADE_TYPES = third_party/proto/cosmos/upgrade/v1beta1
117
116
 
118
117
  proto-update-deps:
118
+ mkdir -p $(COSMOS_PROTO_TYPES)
119
+ curl -sSL $(COSMOS_PROTO_PROTO_URL)/cosmos.proto > $(COSMOS_PROTO_TYPES)/cosmos.proto
120
+
119
121
  mkdir -p $(GOGO_PROTO_TYPES)
120
122
  curl -sSL $(GOGO_PROTO_URL)/gogoproto/gogo.proto > $(GOGO_PROTO_TYPES)/gogo.proto
121
123
 
124
+ # Downloading from a not-a-go-module is problematic. These files are artifacts for now.
125
+ # mkdir -p $(GOOGLE_API_TYPES)
126
+ # curl -sSL $(GOOGLE_API_URL)/annotations.proto > $(GOOGLE_API_TYPES)/annotations.proto
127
+ # curl -sSL $(GOOGLE_API_URL)/http.proto > $(GOOGLE_API_TYPES)/http.proto
128
+ # curl -sSL $(GOOGLE_API_URL)/httpbody.proto > $(GOOGLE_API_TYPES)/httpbody.proto
129
+
130
+ mkdir -p $(GOOGLE_PROTO_TYPES)
131
+ curl -sSL $(GOGO_PROTO_URL)/protobuf/google/protobuf/any.proto > $(GOOGLE_PROTO_TYPES)/any.proto
132
+
122
133
  mkdir -p $(IBC_CHANNEL_TYPES)
123
134
  curl -sSL $(IBC_PROTO_URL)/channel/v1/channel.proto > $(IBC_CHANNEL_TYPES)/channel.proto
124
135
 
125
136
  mkdir -p $(IBC_CLIENT_TYPES)
126
137
  curl -sSL $(IBC_PROTO_URL)/client/v1/client.proto > $(IBC_CLIENT_TYPES)/client.proto
127
138
 
139
+ mkdir -p $(SDK_BASE_TYPES)
140
+ curl -sSL $(COSMOS_SDK_PROTO_URL)/base/v1beta1/coin.proto > $(SDK_BASE_TYPES)/coin.proto
141
+
128
142
  mkdir -p $(SDK_QUERY_TYPES)
129
143
  curl -sSL $(COSMOS_SDK_PROTO_URL)/base/query/v1beta1/pagination.proto > $(SDK_QUERY_TYPES)/pagination.proto
130
144
 
131
145
  mkdir -p $(SDK_UPGRADE_TYPES)
132
146
  curl -sSL $(COSMOS_SDK_PROTO_URL)/upgrade/v1beta1/upgrade.proto > $(SDK_UPGRADE_TYPES)/upgrade.proto
133
147
 
134
-
135
148
  UNAME_S ?= $(shell uname -s)
136
149
  UNAME_M ?= $(shell uname -m)
137
150
 
138
- BUF_VERSION ?= 0.56.0
151
+ BUF_VERSION ?= 1.0.0
139
152
 
140
153
  PROTOC_VERSION ?= 3.11.2
141
154
  ifeq ($(UNAME_S),Linux)
package/ante/ante.go CHANGED
@@ -4,8 +4,8 @@ import (
4
4
  sdk "github.com/cosmos/cosmos-sdk/types"
5
5
  sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
6
6
  "github.com/cosmos/cosmos-sdk/x/auth/ante"
7
- ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante"
8
- ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
7
+ ibcante "github.com/cosmos/ibc-go/v6/modules/core/ante"
8
+ ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
9
9
  )
10
10
 
11
11
  // HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
@@ -43,8 +43,10 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
43
43
 
44
44
  anteDecorators := []sdk.AnteDecorator{
45
45
  ante.NewSetUpContextDecorator(),
46
- ante.NewRejectExtensionOptionsDecorator(),
47
- ante.NewMempoolFeeDecorator(),
46
+ ante.NewExtensionOptionsDecorator(nil), // reject all extensions
47
+ // former ante.NewMempoolFeeDecorator()
48
+ // replaced as in https://github.com/provenance-io/provenance/pull/1016
49
+ ante.NewDeductFeeDecorator(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, nil),
48
50
  ante.NewValidateBasicDecorator(),
49
51
  ante.NewTxTimeoutHeightDecorator(),
50
52
  ante.NewValidateMemoDecorator(opts.AccountKeeper),
@@ -58,7 +60,7 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
58
60
  ante.NewSigVerificationDecorator(opts.AccountKeeper, opts.SignModeHandler),
59
61
  NewAdmissionDecorator(opts.AdmissionData),
60
62
  ante.NewIncrementSequenceDecorator(opts.AccountKeeper),
61
- ibcante.NewAnteDecorator(opts.IBCKeeper),
63
+ ibcante.NewRedundantRelayDecorator(opts.IBCKeeper),
62
64
  }
63
65
 
64
66
  return sdk.ChainAnteDecorators(anteDecorators...), nil
package/app/app.go CHANGED
@@ -1,6 +1,7 @@
1
1
  package gaia
2
2
 
3
3
  import (
4
+ "context"
4
5
  "encoding/json"
5
6
  "fmt"
6
7
  "io"
@@ -13,8 +14,8 @@ import (
13
14
 
14
15
  "github.com/cosmos/cosmos-sdk/baseapp"
15
16
  "github.com/cosmos/cosmos-sdk/client"
17
+ nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
16
18
  "github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
17
- "github.com/cosmos/cosmos-sdk/client/rpc"
18
19
  "github.com/cosmos/cosmos-sdk/codec"
19
20
  "github.com/cosmos/cosmos-sdk/codec/types"
20
21
  "github.com/cosmos/cosmos-sdk/server/api"
@@ -28,7 +29,6 @@ import (
28
29
  "github.com/cosmos/cosmos-sdk/version"
29
30
  "github.com/cosmos/cosmos-sdk/x/auth"
30
31
  "github.com/cosmos/cosmos-sdk/x/auth/ante"
31
- authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
32
32
  authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
33
33
  authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
34
34
  authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
@@ -58,8 +58,11 @@ import (
58
58
  "github.com/cosmos/cosmos-sdk/x/genutil"
59
59
  genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
60
60
  "github.com/cosmos/cosmos-sdk/x/gov"
61
+ govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
61
62
  govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
62
63
  govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
64
+ govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
65
+ govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
63
66
  "github.com/cosmos/cosmos-sdk/x/mint"
64
67
  mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
65
68
  minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
@@ -78,22 +81,22 @@ import (
78
81
  upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
79
82
  upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
80
83
  upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
81
- ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts"
82
-
83
- icahost "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host"
84
- icahostkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/keeper"
85
- icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
86
- icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types"
87
- "github.com/cosmos/ibc-go/v4/modules/apps/transfer"
88
- ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper"
89
- ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
90
- ibc "github.com/cosmos/ibc-go/v4/modules/core"
91
- ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client"
92
- ibcclientclient "github.com/cosmos/ibc-go/v4/modules/core/02-client/client"
93
- ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
94
- porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types"
95
- ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
96
- ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
84
+ ica "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts"
85
+
86
+ icahost "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host"
87
+ icahostkeeper "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/keeper"
88
+ icahosttypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/types"
89
+ icatypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types"
90
+ "github.com/cosmos/ibc-go/v6/modules/apps/transfer"
91
+ ibctransferkeeper "github.com/cosmos/ibc-go/v6/modules/apps/transfer/keeper"
92
+ ibctransfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
93
+ ibc "github.com/cosmos/ibc-go/v6/modules/core"
94
+ ibcclient "github.com/cosmos/ibc-go/v6/modules/core/02-client"
95
+ ibcclientclient "github.com/cosmos/ibc-go/v6/modules/core/02-client/client"
96
+ ibcclienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
97
+ porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types"
98
+ ibchost "github.com/cosmos/ibc-go/v6/modules/core/24-host"
99
+ ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
97
100
  "github.com/gorilla/mux"
98
101
  "github.com/rakyll/statik/fs"
99
102
  "github.com/spf13/cast"
@@ -148,15 +151,15 @@ var (
148
151
  staking.AppModuleBasic{},
149
152
  mint.AppModuleBasic{},
150
153
  distr.AppModuleBasic{},
151
- gov.NewAppModuleBasic(
154
+ gov.NewAppModuleBasic([]govclient.ProposalHandler{
152
155
  paramsclient.ProposalHandler,
153
156
  distrclient.ProposalHandler,
154
- upgradeclient.ProposalHandler,
155
- upgradeclient.CancelProposalHandler,
157
+ upgradeclient.LegacyProposalHandler,
158
+ upgradeclient.LegacyCancelProposalHandler,
156
159
  ibcclientclient.UpdateClientProposalHandler,
157
160
  ibcclientclient.UpgradeProposalHandler,
158
161
  swingsetclient.CoreEvalProposalHandler,
159
- ),
162
+ }),
160
163
  params.AppModuleBasic{},
161
164
  slashing.AppModuleBasic{},
162
165
  feegrantmodule.AppModuleBasic{},
@@ -218,9 +221,9 @@ type GaiaApp struct { // nolint: golint
218
221
  invCheckPeriod uint
219
222
 
220
223
  // keys to access the substores
221
- keys map[string]*sdk.KVStoreKey
222
- tkeys map[string]*sdk.TransientStoreKey
223
- memKeys map[string]*sdk.MemoryStoreKey
224
+ keys map[string]*storetypes.KVStoreKey
225
+ tkeys map[string]*storetypes.TransientStoreKey
226
+ memKeys map[string]*storetypes.MemoryStoreKey
224
227
 
225
228
  // keepers
226
229
  AccountKeeper authkeeper.AccountKeeper
@@ -284,7 +287,7 @@ func NewGaiaApp(
284
287
  appOpts servertypes.AppOptions,
285
288
  baseAppOptions ...func(*baseapp.BaseApp),
286
289
  ) *GaiaApp {
287
- defaultController := func(needReply bool, str string) (string, error) {
290
+ defaultController := func(ctx context.Context, needReply bool, str string) (string, error) {
288
291
  fmt.Fprintln(os.Stderr, "FIXME: Would upcall to controller with", str)
289
292
  return "", nil
290
293
  }
@@ -296,7 +299,7 @@ func NewGaiaApp(
296
299
  }
297
300
 
298
301
  func NewAgoricApp(
299
- sendToController func(bool, string) (string, error),
302
+ sendToController func(context.Context, bool, string) (string, error),
300
303
  logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool,
301
304
  homePath string, invCheckPeriod uint, encodingConfig gaiaappparams.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp),
302
305
  ) *GaiaApp {
@@ -340,7 +343,7 @@ func NewAgoricApp(
340
343
 
341
344
  // set the BaseApp's parameter store
342
345
  bApp.SetParamStore(
343
- app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable()),
346
+ app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()),
344
347
  )
345
348
 
346
349
  // add capability keeper and ScopeToModule for ibc module
@@ -358,6 +361,7 @@ func NewAgoricApp(
358
361
  app.GetSubspace(authtypes.ModuleName),
359
362
  authtypes.ProtoBaseAccount,
360
363
  maccPerms,
364
+ appName,
361
365
  )
362
366
  wrappedAccountKeeper := lien.NewWrappedAccountKeeper(innerAk)
363
367
  app.AccountKeeper = wrappedAccountKeeper
@@ -372,6 +376,7 @@ func NewAgoricApp(
372
376
  keys[authzkeeper.StoreKey],
373
377
  appCodec,
374
378
  app.BaseApp.MsgServiceRouter(),
379
+ app.AccountKeeper,
375
380
  )
376
381
  app.FeeGrantKeeper = feegrantkeeper.NewKeeper(
377
382
  appCodec,
@@ -403,7 +408,6 @@ func NewAgoricApp(
403
408
  &stakingKeeper,
404
409
  // This is the pool to distribute from immediately. DO NOT ALTER.
405
410
  vbanktypes.GiveawayPoolName,
406
- app.ModuleAccountAddrs(),
407
411
  )
408
412
  app.SlashingKeeper = slashingkeeper.NewKeeper(
409
413
  appCodec,
@@ -417,6 +421,7 @@ func NewAgoricApp(
417
421
  appCodec,
418
422
  homePath,
419
423
  app.BaseApp,
424
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
420
425
  )
421
426
 
422
427
  // register the staking hooks
@@ -440,7 +445,7 @@ func NewAgoricApp(
440
445
  app.CheckControllerInited(true)
441
446
  // We use SwingSet-level metering to charge the user for the call.
442
447
  defer vm.SetControllerContext(ctx)()
443
- return sendToController(true, str)
448
+ return sendToController(sdk.WrapSDKContext(ctx), true, str)
444
449
  }
445
450
 
446
451
  setBootstrapNeeded := func() {
@@ -472,7 +477,7 @@ func NewAgoricApp(
472
477
  if err != nil {
473
478
  return "", err
474
479
  }
475
- return sendToController(true, string(bz))
480
+ return sendToController(context.Background(), true, string(bz))
476
481
  },
477
482
  )
478
483
 
@@ -522,14 +527,15 @@ func NewAgoricApp(
522
527
  app.lienPort = vm.RegisterPortHandler("lien", lien.NewPortHandler(app.LienKeeper))
523
528
 
524
529
  // register the proposal types
525
- govRouter := govtypes.NewRouter()
530
+ govRouter := govv1beta1.NewRouter()
526
531
  govRouter.
527
- AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
532
+ AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler).
528
533
  AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
529
534
  AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
530
535
  AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
531
536
  AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
532
537
  AddRoute(swingsettypes.RouterKey, swingset.NewSwingSetProposalHandler(app.SwingSetKeeper))
538
+ govConfig := govtypes.DefaultConfig()
533
539
 
534
540
  app.GovKeeper = govkeeper.NewKeeper(
535
541
  appCodec,
@@ -539,6 +545,8 @@ func NewAgoricApp(
539
545
  app.BankKeeper,
540
546
  &stakingKeeper,
541
547
  govRouter,
548
+ app.BaseApp.MsgServiceRouter(),
549
+ govConfig,
542
550
  )
543
551
 
544
552
  app.TransferKeeper = ibctransferkeeper.NewKeeper(
@@ -559,6 +567,7 @@ func NewAgoricApp(
559
567
  appCodec, keys[icahosttypes.StoreKey],
560
568
  app.GetSubspace(icahosttypes.SubModuleName),
561
569
  app.IBCKeeper.ChannelKeeper,
570
+ app.IBCKeeper.ChannelKeeper,
562
571
  &app.IBCKeeper.PortKeeper,
563
572
  app.AccountKeeper,
564
573
  scopedICAHostKeeper,
@@ -597,12 +606,16 @@ func NewAgoricApp(
597
606
  app.BaseApp.DeliverTx,
598
607
  encodingConfig.TxConfig,
599
608
  ),
600
- auth.NewAppModule(appCodec, app.AccountKeeper, nil),
609
+ // NOTE: using innerAk here instead of app.AccountKeeper
610
+ // since migration method doesn't know how to unwrap the account keeper.
611
+ // Needs access to some struct fields.
612
+ // (Alternative is to add accessor methods to the AccountKeeper interface.)
613
+ auth.NewAppModule(appCodec, innerAk, nil),
601
614
  vesting.NewAppModule(app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
602
615
  bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper),
603
616
  capability.NewAppModule(appCodec, *app.CapabilityKeeper),
604
617
  gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper),
605
- mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
618
+ mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil),
606
619
  slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
607
620
  distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
608
621
  staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
@@ -734,7 +747,7 @@ func NewAgoricApp(
734
747
  feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
735
748
  authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
736
749
  gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper),
737
- mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
750
+ mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil),
738
751
  staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
739
752
  distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
740
753
  slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
@@ -1100,21 +1113,21 @@ func (app *GaiaApp) InterfaceRegistry() types.InterfaceRegistry {
1100
1113
  // GetKey returns the KVStoreKey for the provided store key.
1101
1114
  //
1102
1115
  // NOTE: This is solely to be used for testing purposes.
1103
- func (app *GaiaApp) GetKey(storeKey string) *sdk.KVStoreKey {
1116
+ func (app *GaiaApp) GetKey(storeKey string) *storetypes.KVStoreKey {
1104
1117
  return app.keys[storeKey]
1105
1118
  }
1106
1119
 
1107
1120
  // GetTKey returns the TransientStoreKey for the provided store key.
1108
1121
  //
1109
1122
  // NOTE: This is solely to be used for testing purposes.
1110
- func (app *GaiaApp) GetTKey(storeKey string) *sdk.TransientStoreKey {
1123
+ func (app *GaiaApp) GetTKey(storeKey string) *storetypes.TransientStoreKey {
1111
1124
  return app.tkeys[storeKey]
1112
1125
  }
1113
1126
 
1114
1127
  // GetMemKey returns the MemStoreKey for the provided mem key.
1115
1128
  //
1116
1129
  // NOTE: This is solely used for testing purposes.
1117
- func (app *GaiaApp) GetMemKey(storeKey string) *sdk.MemoryStoreKey {
1130
+ func (app *GaiaApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey {
1118
1131
  return app.memKeys[storeKey]
1119
1132
  }
1120
1133
 
@@ -1135,16 +1148,16 @@ func (app *GaiaApp) SimulationManager() *module.SimulationManager {
1135
1148
  // API server.
1136
1149
  func (app *GaiaApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
1137
1150
  clientCtx := apiSvr.ClientCtx
1138
- rpc.RegisterRoutes(clientCtx, apiSvr.Router)
1139
- // Register legacy tx routes.
1140
- authrest.RegisterTxRoutes(clientCtx, apiSvr.Router)
1141
1151
  // Register new tx routes from grpc-gateway.
1142
1152
  authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
1153
+
1143
1154
  // Register new tendermint queries routes from grpc-gateway.
1144
1155
  tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
1145
1156
 
1146
- // Register legacy and grpc-gateway routes for all modules.
1147
- ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router)
1157
+ // Register node gRPC service for grpc-gateway.
1158
+ nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
1159
+
1160
+ // Register grpc-gateway routes for all modules.
1148
1161
  ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
1149
1162
 
1150
1163
  // register swagger API from root so that other applications can override easily
@@ -1160,7 +1173,7 @@ func (app *GaiaApp) RegisterTxService(clientCtx client.Context) {
1160
1173
 
1161
1174
  // RegisterTendermintService implements the Application.RegisterTendermintService method.
1162
1175
  func (app *GaiaApp) RegisterTendermintService(clientCtx client.Context) {
1163
- tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry)
1176
+ tmservice.RegisterTendermintService(clientCtx, app.BaseApp.GRPCQueryRouter(), app.interfaceRegistry, app.Query)
1164
1177
  }
1165
1178
 
1166
1179
  // RegisterSwaggerAPI registers swagger route with API Server
@@ -1184,7 +1197,7 @@ func GetMaccPerms() map[string][]string {
1184
1197
  }
1185
1198
 
1186
1199
  // initParamsKeeper init params keeper and its subspaces
1187
- func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) paramskeeper.Keeper {
1200
+ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper {
1188
1201
  paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey)
1189
1202
 
1190
1203
  paramsKeeper.Subspace(authtypes.ModuleName)
@@ -1193,7 +1206,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
1193
1206
  paramsKeeper.Subspace(minttypes.ModuleName)
1194
1207
  paramsKeeper.Subspace(distrtypes.ModuleName)
1195
1208
  paramsKeeper.Subspace(slashingtypes.ModuleName)
1196
- paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable())
1209
+ paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypesv1.ParamKeyTable())
1197
1210
  paramsKeeper.Subspace(ibctransfertypes.ModuleName)
1198
1211
  paramsKeeper.Subspace(ibchost.ModuleName)
1199
1212
  paramsKeeper.Subspace(icahosttypes.SubModuleName)
package/app/export.go CHANGED
@@ -44,9 +44,10 @@ func (app *GaiaApp) ExportAppStateAndValidators(
44
44
  }, err
45
45
  }
46
46
 
47
- // prepare for fresh start at zero height
48
- // NOTE zero height genesis is a temporary feature which will be deprecated
49
- // in favour of export at a block height
47
+ // prepForZeroHeightGenesis prepares for a fresh start at zero height.
48
+ //
49
+ // NOTE: Zero height genesis is a temporary feature which will be deprecated
50
+ // in favour of export at a block height.
50
51
  func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
51
52
  applyAllowedAddrs := false
52
53
 
@@ -106,7 +107,9 @@ func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [
106
107
  feePool.CommunityPool = feePool.CommunityPool.Add(scraps...)
107
108
  app.DistrKeeper.SetFeePool(ctx, feePool)
108
109
 
109
- app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator())
110
+ if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()); err != nil {
111
+ panic(err)
112
+ }
110
113
  return false
111
114
  })
112
115
 
@@ -120,8 +123,12 @@ func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [
120
123
  if err != nil {
121
124
  panic(err)
122
125
  }
123
- app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr)
124
- app.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr)
126
+ if err := app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr); err != nil {
127
+ panic(err)
128
+ }
129
+ if err := app.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr); err != nil {
130
+ panic(err)
131
+ }
125
132
  }
126
133
 
127
134
  // reset context height
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
- panic(lookErr)
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
- panic(execErr)
29
+ return execErr
29
30
  }
31
+ return nil
30
32
  }
31
33
 
32
34
  daemoncmd.OnStartHook = launchVM
@@ -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 [address_or_key_name] [coin][,[coin]]",
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. The provided account must specify
35
- the account address or key name and a list of initial coins. If a key name is given,
36
- the address will be looked up in the local Keybase. The list of initial tokens must
37
- contain valid denominations. Accounts may optionally be supplied with vesting parameters.
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 address from Keybase: %s", err)
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])