@agoric/cosmos 0.35.0-upgrade-14-dev-8be87aa.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 +62 -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
@@ -87,6 +87,78 @@ func local_request_Query_Data_0(ctx context.Context, marshaler runtime.Marshaler
87
87
 
88
88
  }
89
89
 
90
+ var (
91
+ filter_Query_CapData_0 = &utilities.DoubleArray{Encoding: map[string]int{"path": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
92
+ )
93
+
94
+ func request_Query_CapData_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
95
+ var protoReq QueryCapDataRequest
96
+ var metadata runtime.ServerMetadata
97
+
98
+ var (
99
+ val string
100
+ ok bool
101
+ err error
102
+ _ = err
103
+ )
104
+
105
+ val, ok = pathParams["path"]
106
+ if !ok {
107
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path")
108
+ }
109
+
110
+ protoReq.Path, err = runtime.String(val)
111
+
112
+ if err != nil {
113
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path", err)
114
+ }
115
+
116
+ if err := req.ParseForm(); err != nil {
117
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
118
+ }
119
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CapData_0); err != nil {
120
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
121
+ }
122
+
123
+ msg, err := client.CapData(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
124
+ return msg, metadata, err
125
+
126
+ }
127
+
128
+ func local_request_Query_CapData_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
129
+ var protoReq QueryCapDataRequest
130
+ var metadata runtime.ServerMetadata
131
+
132
+ var (
133
+ val string
134
+ ok bool
135
+ err error
136
+ _ = err
137
+ )
138
+
139
+ val, ok = pathParams["path"]
140
+ if !ok {
141
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "path")
142
+ }
143
+
144
+ protoReq.Path, err = runtime.String(val)
145
+
146
+ if err != nil {
147
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "path", err)
148
+ }
149
+
150
+ if err := req.ParseForm(); err != nil {
151
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
152
+ }
153
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CapData_0); err != nil {
154
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
155
+ }
156
+
157
+ msg, err := server.CapData(ctx, &protoReq)
158
+ return msg, metadata, err
159
+
160
+ }
161
+
90
162
  var (
91
163
  filter_Query_Children_0 = &utilities.DoubleArray{Encoding: map[string]int{"path": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
92
164
  )
@@ -188,6 +260,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
188
260
 
189
261
  })
190
262
 
263
+ mux.Handle("GET", pattern_Query_CapData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
264
+ ctx, cancel := context.WithCancel(req.Context())
265
+ defer cancel()
266
+ var stream runtime.ServerTransportStream
267
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
268
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
269
+ rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
270
+ if err != nil {
271
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
272
+ return
273
+ }
274
+ resp, md, err := local_request_Query_CapData_0(rctx, inboundMarshaler, server, req, pathParams)
275
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
276
+ ctx = runtime.NewServerMetadataContext(ctx, md)
277
+ if err != nil {
278
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
279
+ return
280
+ }
281
+
282
+ forward_Query_CapData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
283
+
284
+ })
285
+
191
286
  mux.Handle("GET", pattern_Query_Children_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
192
287
  ctx, cancel := context.WithCancel(req.Context())
193
288
  defer cancel()
@@ -272,6 +367,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
272
367
 
273
368
  })
274
369
 
370
+ mux.Handle("GET", pattern_Query_CapData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
371
+ ctx, cancel := context.WithCancel(req.Context())
372
+ defer cancel()
373
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
374
+ rctx, err := runtime.AnnotateContext(ctx, mux, req)
375
+ if err != nil {
376
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
377
+ return
378
+ }
379
+ resp, md, err := request_Query_CapData_0(rctx, inboundMarshaler, client, req, pathParams)
380
+ ctx = runtime.NewServerMetadataContext(ctx, md)
381
+ if err != nil {
382
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
383
+ return
384
+ }
385
+
386
+ forward_Query_CapData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
387
+
388
+ })
389
+
275
390
  mux.Handle("GET", pattern_Query_Children_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
276
391
  ctx, cancel := context.WithCancel(req.Context())
277
392
  defer cancel()
@@ -298,11 +413,15 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
298
413
  var (
299
414
  pattern_Query_Data_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"agoric", "vstorage", "data", "path"}, "", runtime.AssumeColonVerbOpt(false)))
300
415
 
416
+ pattern_Query_CapData_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"agoric", "vstorage", "capdata", "path"}, "", runtime.AssumeColonVerbOpt(false)))
417
+
301
418
  pattern_Query_Children_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"agoric", "vstorage", "children", "path"}, "", runtime.AssumeColonVerbOpt(false)))
302
419
  )
303
420
 
304
421
  var (
305
422
  forward_Query_Data_0 = runtime.ForwardResponseMessage
306
423
 
424
+ forward_Query_CapData_0 = runtime.ForwardResponseMessage
425
+
307
426
  forward_Query_Children_0 = runtime.ForwardResponseMessage
308
427
  )
@@ -1,6 +1,7 @@
1
1
  package vstorage
2
2
 
3
3
  import (
4
+ "context"
4
5
  "encoding/json"
5
6
  "errors"
6
7
  "fmt"
@@ -8,7 +9,6 @@ import (
8
9
  sdk "github.com/cosmos/cosmos-sdk/types"
9
10
 
10
11
  agoric "github.com/Agoric/agoric-sdk/golang/cosmos/types"
11
- "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
12
12
  )
13
13
 
14
14
  type vstorageHandler struct {
@@ -41,7 +41,8 @@ func unmarshalSinglePathFromArgs(args []json.RawMessage, path *string) error {
41
41
  return json.Unmarshal(args[0], path)
42
42
  }
43
43
 
44
- func (sh vstorageHandler) Receive(cctx *vm.ControllerContext, str string) (ret string, err error) {
44
+ func (sh vstorageHandler) Receive(cctx context.Context, str string) (ret string, err error) {
45
+ ctx := sdk.UnwrapSDKContext(cctx)
45
46
  keeper := sh.keeper
46
47
  msg := new(vstorageMessage)
47
48
  err = json.Unmarshal([]byte(str), &msg)
@@ -56,7 +57,7 @@ func (sh vstorageHandler) Receive(cctx *vm.ControllerContext, str string) (ret s
56
57
  case sdk.ErrorOutOfGas:
57
58
  err = fmt.Errorf(
58
59
  "out of gas in location: %v; gasUsed: %d",
59
- rType.Descriptor, cctx.Context.GasMeter().GasConsumed(),
60
+ rType.Descriptor, ctx.GasMeter().GasConsumed(),
60
61
  )
61
62
  default:
62
63
  // Not ErrorOutOfGas, so panic again.
@@ -74,7 +75,7 @@ func (sh vstorageHandler) Receive(cctx *vm.ControllerContext, str string) (ret s
74
75
  if err != nil {
75
76
  return
76
77
  }
77
- keeper.SetStorageAndNotify(cctx.Context, entry)
78
+ keeper.SetStorageAndNotify(ctx, entry)
78
79
  }
79
80
  return "true", nil
80
81
 
@@ -89,7 +90,7 @@ func (sh vstorageHandler) Receive(cctx *vm.ControllerContext, str string) (ret s
89
90
  return
90
91
  }
91
92
  //fmt.Printf("giving Keeper.SetStorage(%s) %s\n", entry.Path(), entry.Value())
92
- keeper.LegacySetStorageAndNotify(cctx.Context, entry)
93
+ keeper.LegacySetStorageAndNotify(ctx, entry)
93
94
  }
94
95
  return "true", nil
95
96
 
@@ -100,7 +101,7 @@ func (sh vstorageHandler) Receive(cctx *vm.ControllerContext, str string) (ret s
100
101
  if err != nil {
101
102
  return
102
103
  }
103
- keeper.SetStorage(cctx.Context, entry)
104
+ keeper.SetStorage(ctx, entry)
104
105
  }
105
106
  return "true", nil
106
107
 
@@ -115,7 +116,7 @@ func (sh vstorageHandler) Receive(cctx *vm.ControllerContext, str string) (ret s
115
116
  err = fmt.Errorf("no value for append entry with path: %q", entry.Key())
116
117
  return
117
118
  }
118
- err = keeper.AppendStorageValueAndNotify(cctx.Context, entry.Key(), entry.StringValue())
119
+ err = keeper.AppendStorageValueAndNotify(ctx, entry.Key(), entry.StringValue())
119
120
  if err != nil {
120
121
  return
121
122
  }
@@ -130,7 +131,7 @@ func (sh vstorageHandler) Receive(cctx *vm.ControllerContext, str string) (ret s
130
131
  return
131
132
  }
132
133
 
133
- entry := keeper.GetEntry(cctx.Context, path)
134
+ entry := keeper.GetEntry(ctx, path)
134
135
  bz, err := json.Marshal(entry.Value())
135
136
  if err != nil {
136
137
  return "", err
@@ -161,7 +162,7 @@ func (sh vstorageHandler) Receive(cctx *vm.ControllerContext, str string) (ret s
161
162
  if err != nil {
162
163
  return
163
164
  }
164
- value := keeper.HasStorage(cctx.Context, path)
165
+ value := keeper.HasStorage(ctx, path)
165
166
  if !value {
166
167
  return "false", nil
167
168
  }
@@ -174,7 +175,7 @@ func (sh vstorageHandler) Receive(cctx *vm.ControllerContext, str string) (ret s
174
175
  if err != nil {
175
176
  return
176
177
  }
177
- children := keeper.GetChildren(cctx.Context, path)
178
+ children := keeper.GetChildren(ctx, path)
178
179
  if children.Children == nil {
179
180
  return "[]", nil
180
181
  }
@@ -190,10 +191,10 @@ func (sh vstorageHandler) Receive(cctx *vm.ControllerContext, str string) (ret s
190
191
  if err != nil {
191
192
  return
192
193
  }
193
- children := keeper.GetChildren(cctx.Context, path)
194
+ children := keeper.GetChildren(ctx, path)
194
195
  entries := make([]agoric.KVEntry, len(children.Children))
195
196
  for i, child := range children.Children {
196
- entry := keeper.GetEntry(cctx.Context, fmt.Sprintf("%s.%s", path, child))
197
+ entry := keeper.GetEntry(ctx, fmt.Sprintf("%s.%s", path, child))
197
198
  if !entry.HasValue() {
198
199
  entries[i] = agoric.NewKVEntryWithNoValue(child)
199
200
  } else {
@@ -212,10 +213,10 @@ func (sh vstorageHandler) Receive(cctx *vm.ControllerContext, str string) (ret s
212
213
  if err != nil {
213
214
  return
214
215
  }
215
- children := keeper.GetChildren(cctx.Context, path)
216
+ children := keeper.GetChildren(ctx, path)
216
217
  vals := make([]*string, len(children.Children))
217
218
  for i, child := range children.Children {
218
- vals[i] = keeper.GetEntry(cctx.Context, fmt.Sprintf("%s.%s", path, child)).Value()
219
+ vals[i] = keeper.GetEntry(ctx, fmt.Sprintf("%s.%s", path, child)).Value()
219
220
  }
220
221
  bytes, err := json.Marshal(vals)
221
222
  if err != nil {
@@ -229,7 +230,7 @@ func (sh vstorageHandler) Receive(cctx *vm.ControllerContext, str string) (ret s
229
230
  if err != nil {
230
231
  return
231
232
  }
232
- children := keeper.GetChildren(cctx.Context, path)
233
+ children := keeper.GetChildren(ctx, path)
233
234
  if children.Children == nil {
234
235
  return "0", nil
235
236
  }
@@ -1,6 +1,7 @@
1
1
  package vstorage
2
2
 
3
3
  import (
4
+ "context"
4
5
  "encoding/json"
5
6
  "fmt"
6
7
  "reflect"
@@ -14,7 +15,6 @@ import (
14
15
  sdk "github.com/cosmos/cosmos-sdk/types"
15
16
 
16
17
  agorictypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
17
- "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
18
18
  "github.com/tendermint/tendermint/libs/log"
19
19
  tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
20
20
  dbm "github.com/tendermint/tm-db"
@@ -32,27 +32,27 @@ type testKit struct {
32
32
  keeper Keeper
33
33
  handler vstorageHandler
34
34
  ctx sdk.Context
35
- cctx *vm.ControllerContext
35
+ cctx context.Context
36
36
  }
37
37
 
38
38
  func makeTestKit() testKit {
39
39
  keeper := NewKeeper(storeKey)
40
40
  db := dbm.NewMemDB()
41
41
  ms := store.NewCommitMultiStore(db)
42
- ms.MountStoreWithDB(storeKey, sdk.StoreTypeIAVL, db)
42
+ ms.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
43
43
  err := ms.LoadLatestVersion()
44
44
  if err != nil {
45
45
  panic(err)
46
46
  }
47
47
  ctx := sdk.NewContext(ms, tmproto.Header{}, false, log.NewNopLogger())
48
- cctx := &vm.ControllerContext{Context: ctx}
48
+ cctx := sdk.WrapSDKContext(ctx)
49
49
  handler := vstorageHandler{keeper}
50
50
  return testKit{keeper, handler, ctx, cctx}
51
51
  }
52
52
 
53
53
  func callReceive(
54
54
  handler vstorageHandler,
55
- cctx *vm.ControllerContext,
55
+ cctx context.Context,
56
56
  method string,
57
57
  args []interface{},
58
58
  ) (string, error) {