@agoric/cosmos 0.34.2-dev-3c8aafe.0 → 0.34.2-dev-74fbe43.0.74fbe43

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 (120) hide show
  1. package/Makefile +6 -2
  2. package/ante/ante.go +2 -2
  3. package/ante/inbound.go +1 -2
  4. package/ante/inbound_test.go +3 -1
  5. package/ante/vm_admission.go +1 -2
  6. package/app/app.go +256 -174
  7. package/app/encoding.go +6 -3
  8. package/app/export.go +50 -21
  9. package/app/genesis.go +7 -5
  10. package/app/params/encoding.go +1 -1
  11. package/app/params/proto.go +6 -4
  12. package/app/sim_test.go +11 -13
  13. package/app/txconfig/tx_config.go +169 -0
  14. package/app/upgrade.go +40 -90
  15. package/cmd/agd/agvm.go +1 -1
  16. package/cmd/agd/main.go +1 -1
  17. package/cmd/libdaemon/main.go +2 -2
  18. package/daemon/cmd/root.go +99 -30
  19. package/daemon/cmd/root_test.go +12 -27
  20. package/daemon/main.go +2 -9
  21. package/git-revision.txt +1 -1
  22. package/go.mod +130 -109
  23. package/go.sum +228 -469
  24. package/package.json +2 -2
  25. package/proto/agoric/swingset/msgs.proto +72 -9
  26. package/proto/agoric/swingset/swingset.proto +7 -2
  27. package/proto/agoric/vbank/vbank.proto +1 -1
  28. package/proto/agoric/vibc/msgs.proto +4 -0
  29. package/scripts/mockgen.sh +4 -0
  30. package/tests/e2e/vbank/vbank_test.go +172 -0
  31. package/tests/integrations/types/aminojson_test.go +214 -0
  32. package/tests/integrations/vbank/vbank_test.go +349 -0
  33. package/third_party/proto/amino/amino.proto +6 -1
  34. package/third_party/proto/cosmos/base/v1beta1/coin.proto +18 -5
  35. package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +4 -8
  36. package/third_party/proto/ibc/core/channel/v1/channel.proto +42 -17
  37. package/third_party/proto/ibc/core/client/v1/client.proto +48 -40
  38. package/types/address_hooks.go +2 -2
  39. package/types/address_hooks_test.go +3 -3
  40. package/types/ibc_packet.go +3 -3
  41. package/types/ibc_packet_test.go +3 -3
  42. package/types/kv_entry_helpers.go +3 -27
  43. package/types/kv_entry_helpers_test.go +2 -2
  44. package/types/legacy_address_encoder.go +58 -0
  45. package/vm/proto_json_test.go +1 -1
  46. package/vm/server.go +2 -1
  47. package/x/swingset/abci.go +2 -2
  48. package/x/swingset/client/cli/tx.go +16 -14
  49. package/x/swingset/config.go +1 -1
  50. package/x/swingset/genesis.go +2 -1
  51. package/x/swingset/handler.go +2 -1
  52. package/x/swingset/keeper/extension_snapshotter.go +14 -5
  53. package/x/swingset/keeper/extension_snapshotter_test.go +1 -1
  54. package/x/swingset/keeper/keeper.go +28 -23
  55. package/x/swingset/keeper/keeper_test.go +10 -7
  56. package/x/swingset/keeper/msg_server.go +52 -5
  57. package/x/swingset/keeper/msg_server_test.go +121 -0
  58. package/x/swingset/keeper/proposal.go +4 -0
  59. package/x/swingset/keeper/querier.go +1 -1
  60. package/x/swingset/keeper/swing_store_exports_handler.go +1 -1
  61. package/x/swingset/keeper/swing_store_exports_handler_test.go +1 -1
  62. package/x/swingset/keeper/test_utils.go +2 -2
  63. package/x/swingset/module.go +20 -22
  64. package/x/swingset/testing/queue.go +5 -2
  65. package/x/swingset/testutil/mocks.go +379 -0
  66. package/x/swingset/types/codec.go +10 -5
  67. package/x/swingset/types/default-params.go +13 -12
  68. package/x/swingset/types/expected_keepers.go +29 -4
  69. package/x/swingset/types/msgs.go +51 -36
  70. package/x/swingset/types/msgs.pb.go +561 -51
  71. package/x/swingset/types/params_test.go +21 -20
  72. package/x/swingset/types/swingset.pb.go +67 -61
  73. package/x/vbank/genesis.go +13 -9
  74. package/x/vbank/handler.go +2 -1
  75. package/x/vbank/keeper/grpc_query.go +4 -1
  76. package/x/vbank/keeper/keeper.go +108 -23
  77. package/x/vbank/keeper/querier.go +4 -1
  78. package/x/vbank/keeper/rewards.go +10 -5
  79. package/x/vbank/module.go +47 -75
  80. package/x/vbank/types/expected_keepers.go +15 -10
  81. package/x/vbank/types/key.go +3 -0
  82. package/x/vbank/types/params.go +4 -3
  83. package/x/vbank/types/vbank.pb.go +41 -40
  84. package/x/vbank/vbank.go +29 -11
  85. package/x/vbank/vbank_test.go +213 -154
  86. package/x/vibc/handler.go +2 -1
  87. package/x/vibc/keeper/keeper.go +10 -10
  88. package/x/vibc/keeper/migrations.go +1 -1
  89. package/x/vibc/keeper/triggers.go +1 -1
  90. package/x/vibc/module.go +5 -22
  91. package/x/vibc/types/codec.go +2 -1
  92. package/x/vibc/types/expected_keepers.go +7 -5
  93. package/x/vibc/types/ibc_module.go +5 -5
  94. package/x/vibc/types/msgs.go +30 -7
  95. package/x/vibc/types/msgs.pb.go +29 -25
  96. package/x/vibc/types/receiver.go +2 -2
  97. package/x/vlocalchain/handler.go +2 -1
  98. package/x/vlocalchain/keeper/keeper.go +17 -5
  99. package/x/vlocalchain/keeper/keeper_test.go +3 -2
  100. package/x/vlocalchain/types/expected_keepers.go +7 -4
  101. package/x/vlocalchain/vlocalchain_test.go +38 -26
  102. package/x/vstorage/genesis.go +10 -10
  103. package/x/vstorage/handler.go +2 -1
  104. package/x/vstorage/keeper/grpc_query.go +1 -1
  105. package/x/vstorage/keeper/keeper.go +72 -50
  106. package/x/vstorage/keeper/keeper_test.go +74 -54
  107. package/x/vstorage/keeper/querier.go +1 -1
  108. package/x/vstorage/module.go +27 -13
  109. package/x/vstorage/testing/queue.go +5 -3
  110. package/x/vstorage/vstorage.go +10 -9
  111. package/x/vstorage/vstorage_test.go +24 -18
  112. package/x/vtransfer/genesis.go +1 -3
  113. package/x/vtransfer/handler.go +3 -2
  114. package/x/vtransfer/ibc_middleware.go +5 -5
  115. package/x/vtransfer/ibc_middleware_test.go +43 -29
  116. package/x/vtransfer/keeper/keeper.go +35 -33
  117. package/x/vtransfer/module.go +8 -11
  118. package/x/vtransfer/types/expected_keepers.go +3 -3
  119. package/x/vtransfer/utils_test.go +26 -11
  120. package/daemon/cmd/testnet.go +0 -539
@@ -0,0 +1,379 @@
1
+ // Code generated by MockGen. DO NOT EDIT.
2
+ // Source: x/swingset/types/expected_keepers.go
3
+ //
4
+ // Generated by this command:
5
+ //
6
+ // mockgen -source=x/swingset/types/expected_keepers.go -package testutil -destination x/swingset/testutil/mocks.go
7
+ //
8
+
9
+ // Package testutil is a generated GoMock package.
10
+ package testutil
11
+
12
+ import (
13
+ context "context"
14
+ reflect "reflect"
15
+
16
+ math "cosmossdk.io/math"
17
+ types "github.com/Agoric/agoric-sdk/golang/cosmos/types"
18
+ types0 "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types"
19
+ types1 "github.com/cosmos/cosmos-sdk/types"
20
+ gomock "go.uber.org/mock/gomock"
21
+ )
22
+
23
+ // MockAccountKeeper is a mock of AccountKeeper interface.
24
+ type MockAccountKeeper struct {
25
+ ctrl *gomock.Controller
26
+ recorder *MockAccountKeeperMockRecorder
27
+ isgomock struct{}
28
+ }
29
+
30
+ // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper.
31
+ type MockAccountKeeperMockRecorder struct {
32
+ mock *MockAccountKeeper
33
+ }
34
+
35
+ // NewMockAccountKeeper creates a new mock instance.
36
+ func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper {
37
+ mock := &MockAccountKeeper{ctrl: ctrl}
38
+ mock.recorder = &MockAccountKeeperMockRecorder{mock}
39
+ return mock
40
+ }
41
+
42
+ // EXPECT returns an object that allows the caller to indicate expected use.
43
+ func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder {
44
+ return m.recorder
45
+ }
46
+
47
+ // GetAccount mocks base method.
48
+ func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types1.AccAddress) types1.AccountI {
49
+ m.ctrl.T.Helper()
50
+ ret := m.ctrl.Call(m, "GetAccount", ctx, addr)
51
+ ret0, _ := ret[0].(types1.AccountI)
52
+ return ret0
53
+ }
54
+
55
+ // GetAccount indicates an expected call of GetAccount.
56
+ func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr any) *gomock.Call {
57
+ mr.mock.ctrl.T.Helper()
58
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr)
59
+ }
60
+
61
+ // NewAccountWithAddress mocks base method.
62
+ func (m *MockAccountKeeper) NewAccountWithAddress(ctx context.Context, addr types1.AccAddress) types1.AccountI {
63
+ m.ctrl.T.Helper()
64
+ ret := m.ctrl.Call(m, "NewAccountWithAddress", ctx, addr)
65
+ ret0, _ := ret[0].(types1.AccountI)
66
+ return ret0
67
+ }
68
+
69
+ // NewAccountWithAddress indicates an expected call of NewAccountWithAddress.
70
+ func (mr *MockAccountKeeperMockRecorder) NewAccountWithAddress(ctx, addr any) *gomock.Call {
71
+ mr.mock.ctrl.T.Helper()
72
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAccountWithAddress", reflect.TypeOf((*MockAccountKeeper)(nil).NewAccountWithAddress), ctx, addr)
73
+ }
74
+
75
+ // SetAccount mocks base method.
76
+ func (m *MockAccountKeeper) SetAccount(ctx context.Context, acc types1.AccountI) {
77
+ m.ctrl.T.Helper()
78
+ m.ctrl.Call(m, "SetAccount", ctx, acc)
79
+ }
80
+
81
+ // SetAccount indicates an expected call of SetAccount.
82
+ func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc any) *gomock.Call {
83
+ mr.mock.ctrl.T.Helper()
84
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), ctx, acc)
85
+ }
86
+
87
+ // MockBankKeeper is a mock of BankKeeper interface.
88
+ type MockBankKeeper struct {
89
+ ctrl *gomock.Controller
90
+ recorder *MockBankKeeperMockRecorder
91
+ isgomock struct{}
92
+ }
93
+
94
+ // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper.
95
+ type MockBankKeeperMockRecorder struct {
96
+ mock *MockBankKeeper
97
+ }
98
+
99
+ // NewMockBankKeeper creates a new mock instance.
100
+ func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper {
101
+ mock := &MockBankKeeper{ctrl: ctrl}
102
+ mock.recorder = &MockBankKeeperMockRecorder{mock}
103
+ return mock
104
+ }
105
+
106
+ // EXPECT returns an object that allows the caller to indicate expected use.
107
+ func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder {
108
+ return m.recorder
109
+ }
110
+
111
+ // GetAllBalances mocks base method.
112
+ func (m *MockBankKeeper) GetAllBalances(ctx context.Context, addr types1.AccAddress) types1.Coins {
113
+ m.ctrl.T.Helper()
114
+ ret := m.ctrl.Call(m, "GetAllBalances", ctx, addr)
115
+ ret0, _ := ret[0].(types1.Coins)
116
+ return ret0
117
+ }
118
+
119
+ // GetAllBalances indicates an expected call of GetAllBalances.
120
+ func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr any) *gomock.Call {
121
+ mr.mock.ctrl.T.Helper()
122
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr)
123
+ }
124
+
125
+ // SendCoinsFromAccountToModule mocks base method.
126
+ func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx context.Context, senderAddr types1.AccAddress, recipientModule string, amt types1.Coins) error {
127
+ m.ctrl.T.Helper()
128
+ ret := m.ctrl.Call(m, "SendCoinsFromAccountToModule", ctx, senderAddr, recipientModule, amt)
129
+ ret0, _ := ret[0].(error)
130
+ return ret0
131
+ }
132
+
133
+ // SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule.
134
+ func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt any) *gomock.Call {
135
+ mr.mock.ctrl.T.Helper()
136
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt)
137
+ }
138
+
139
+ // MockVstorageKeeper is a mock of VstorageKeeper interface.
140
+ type MockVstorageKeeper struct {
141
+ ctrl *gomock.Controller
142
+ recorder *MockVstorageKeeperMockRecorder
143
+ isgomock struct{}
144
+ }
145
+
146
+ // MockVstorageKeeperMockRecorder is the mock recorder for MockVstorageKeeper.
147
+ type MockVstorageKeeperMockRecorder struct {
148
+ mock *MockVstorageKeeper
149
+ }
150
+
151
+ // NewMockVstorageKeeper creates a new mock instance.
152
+ func NewMockVstorageKeeper(ctrl *gomock.Controller) *MockVstorageKeeper {
153
+ mock := &MockVstorageKeeper{ctrl: ctrl}
154
+ mock.recorder = &MockVstorageKeeperMockRecorder{mock}
155
+ return mock
156
+ }
157
+
158
+ // EXPECT returns an object that allows the caller to indicate expected use.
159
+ func (m *MockVstorageKeeper) EXPECT() *MockVstorageKeeperMockRecorder {
160
+ return m.recorder
161
+ }
162
+
163
+ // GetChildren mocks base method.
164
+ func (m *MockVstorageKeeper) GetChildren(ctx types1.Context, path string) []string {
165
+ m.ctrl.T.Helper()
166
+ ret := m.ctrl.Call(m, "GetChildren", ctx, path)
167
+ ret0, _ := ret[0].([]string)
168
+ return ret0
169
+ }
170
+
171
+ // GetChildren indicates an expected call of GetChildren.
172
+ func (mr *MockVstorageKeeperMockRecorder) GetChildren(ctx, path any) *gomock.Call {
173
+ mr.mock.ctrl.T.Helper()
174
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetChildren", reflect.TypeOf((*MockVstorageKeeper)(nil).GetChildren), ctx, path)
175
+ }
176
+
177
+ // GetEntry mocks base method.
178
+ func (m *MockVstorageKeeper) GetEntry(ctx types1.Context, path string) types.KVEntry {
179
+ m.ctrl.T.Helper()
180
+ ret := m.ctrl.Call(m, "GetEntry", ctx, path)
181
+ ret0, _ := ret[0].(types.KVEntry)
182
+ return ret0
183
+ }
184
+
185
+ // GetEntry indicates an expected call of GetEntry.
186
+ func (mr *MockVstorageKeeperMockRecorder) GetEntry(ctx, path any) *gomock.Call {
187
+ mr.mock.ctrl.T.Helper()
188
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetEntry", reflect.TypeOf((*MockVstorageKeeper)(nil).GetEntry), ctx, path)
189
+ }
190
+
191
+ // GetQueueLength mocks base method.
192
+ func (m *MockVstorageKeeper) GetQueueLength(ctx types1.Context, path string) (math.Int, error) {
193
+ m.ctrl.T.Helper()
194
+ ret := m.ctrl.Call(m, "GetQueueLength", ctx, path)
195
+ ret0, _ := ret[0].(math.Int)
196
+ ret1, _ := ret[1].(error)
197
+ return ret0, ret1
198
+ }
199
+
200
+ // GetQueueLength indicates an expected call of GetQueueLength.
201
+ func (mr *MockVstorageKeeperMockRecorder) GetQueueLength(ctx, path any) *gomock.Call {
202
+ mr.mock.ctrl.T.Helper()
203
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueueLength", reflect.TypeOf((*MockVstorageKeeper)(nil).GetQueueLength), ctx, path)
204
+ }
205
+
206
+ // GetStoreName mocks base method.
207
+ func (m *MockVstorageKeeper) GetStoreName() string {
208
+ m.ctrl.T.Helper()
209
+ ret := m.ctrl.Call(m, "GetStoreName")
210
+ ret0, _ := ret[0].(string)
211
+ return ret0
212
+ }
213
+
214
+ // GetStoreName indicates an expected call of GetStoreName.
215
+ func (mr *MockVstorageKeeperMockRecorder) GetStoreName() *gomock.Call {
216
+ mr.mock.ctrl.T.Helper()
217
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStoreName", reflect.TypeOf((*MockVstorageKeeper)(nil).GetStoreName))
218
+ }
219
+
220
+ // HasEntry mocks base method.
221
+ func (m *MockVstorageKeeper) HasEntry(ctx types1.Context, path string) bool {
222
+ m.ctrl.T.Helper()
223
+ ret := m.ctrl.Call(m, "HasEntry", ctx, path)
224
+ ret0, _ := ret[0].(bool)
225
+ return ret0
226
+ }
227
+
228
+ // HasEntry indicates an expected call of HasEntry.
229
+ func (mr *MockVstorageKeeperMockRecorder) HasEntry(ctx, path any) *gomock.Call {
230
+ mr.mock.ctrl.T.Helper()
231
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasEntry", reflect.TypeOf((*MockVstorageKeeper)(nil).HasEntry), ctx, path)
232
+ }
233
+
234
+ // LegacySetStorageAndNotify mocks base method.
235
+ func (m *MockVstorageKeeper) LegacySetStorageAndNotify(ctx types1.Context, entry types.KVEntry) {
236
+ m.ctrl.T.Helper()
237
+ m.ctrl.Call(m, "LegacySetStorageAndNotify", ctx, entry)
238
+ }
239
+
240
+ // LegacySetStorageAndNotify indicates an expected call of LegacySetStorageAndNotify.
241
+ func (mr *MockVstorageKeeperMockRecorder) LegacySetStorageAndNotify(ctx, entry any) *gomock.Call {
242
+ mr.mock.ctrl.T.Helper()
243
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LegacySetStorageAndNotify", reflect.TypeOf((*MockVstorageKeeper)(nil).LegacySetStorageAndNotify), ctx, entry)
244
+ }
245
+
246
+ // PathToEncodedKey mocks base method.
247
+ func (m *MockVstorageKeeper) PathToEncodedKey(path string) []byte {
248
+ m.ctrl.T.Helper()
249
+ ret := m.ctrl.Call(m, "PathToEncodedKey", path)
250
+ ret0, _ := ret[0].([]byte)
251
+ return ret0
252
+ }
253
+
254
+ // PathToEncodedKey indicates an expected call of PathToEncodedKey.
255
+ func (mr *MockVstorageKeeperMockRecorder) PathToEncodedKey(path any) *gomock.Call {
256
+ mr.mock.ctrl.T.Helper()
257
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PathToEncodedKey", reflect.TypeOf((*MockVstorageKeeper)(nil).PathToEncodedKey), path)
258
+ }
259
+
260
+ // PushQueueItem mocks base method.
261
+ func (m *MockVstorageKeeper) PushQueueItem(ctx types1.Context, path, value string) error {
262
+ m.ctrl.T.Helper()
263
+ ret := m.ctrl.Call(m, "PushQueueItem", ctx, path, value)
264
+ ret0, _ := ret[0].(error)
265
+ return ret0
266
+ }
267
+
268
+ // PushQueueItem indicates an expected call of PushQueueItem.
269
+ func (mr *MockVstorageKeeperMockRecorder) PushQueueItem(ctx, path, value any) *gomock.Call {
270
+ mr.mock.ctrl.T.Helper()
271
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PushQueueItem", reflect.TypeOf((*MockVstorageKeeper)(nil).PushQueueItem), ctx, path, value)
272
+ }
273
+
274
+ // SetStorage mocks base method.
275
+ func (m *MockVstorageKeeper) SetStorage(ctx types1.Context, entry types.KVEntry) {
276
+ m.ctrl.T.Helper()
277
+ m.ctrl.Call(m, "SetStorage", ctx, entry)
278
+ }
279
+
280
+ // SetStorage indicates an expected call of SetStorage.
281
+ func (mr *MockVstorageKeeperMockRecorder) SetStorage(ctx, entry any) *gomock.Call {
282
+ mr.mock.ctrl.T.Helper()
283
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetStorage", reflect.TypeOf((*MockVstorageKeeper)(nil).SetStorage), ctx, entry)
284
+ }
285
+
286
+ // MockSwingSetKeeper is a mock of SwingSetKeeper interface.
287
+ type MockSwingSetKeeper struct {
288
+ ctrl *gomock.Controller
289
+ recorder *MockSwingSetKeeperMockRecorder
290
+ isgomock struct{}
291
+ }
292
+
293
+ // MockSwingSetKeeperMockRecorder is the mock recorder for MockSwingSetKeeper.
294
+ type MockSwingSetKeeperMockRecorder struct {
295
+ mock *MockSwingSetKeeper
296
+ }
297
+
298
+ // NewMockSwingSetKeeper creates a new mock instance.
299
+ func NewMockSwingSetKeeper(ctrl *gomock.Controller) *MockSwingSetKeeper {
300
+ mock := &MockSwingSetKeeper{ctrl: ctrl}
301
+ mock.recorder = &MockSwingSetKeeperMockRecorder{mock}
302
+ return mock
303
+ }
304
+
305
+ // EXPECT returns an object that allows the caller to indicate expected use.
306
+ func (m *MockSwingSetKeeper) EXPECT() *MockSwingSetKeeperMockRecorder {
307
+ return m.recorder
308
+ }
309
+
310
+ // ChargeBeans mocks base method.
311
+ func (m *MockSwingSetKeeper) ChargeBeans(ctx types1.Context, beansPerUnit map[string]math.Uint, addr types1.AccAddress, beans math.Uint) error {
312
+ m.ctrl.T.Helper()
313
+ ret := m.ctrl.Call(m, "ChargeBeans", ctx, beansPerUnit, addr, beans)
314
+ ret0, _ := ret[0].(error)
315
+ return ret0
316
+ }
317
+
318
+ // ChargeBeans indicates an expected call of ChargeBeans.
319
+ func (mr *MockSwingSetKeeperMockRecorder) ChargeBeans(ctx, beansPerUnit, addr, beans any) *gomock.Call {
320
+ mr.mock.ctrl.T.Helper()
321
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChargeBeans", reflect.TypeOf((*MockSwingSetKeeper)(nil).ChargeBeans), ctx, beansPerUnit, addr, beans)
322
+ }
323
+
324
+ // ChargeForSmartWallet mocks base method.
325
+ func (m *MockSwingSetKeeper) ChargeForSmartWallet(ctx types1.Context, beansPerUnit map[string]math.Uint, addr types1.AccAddress) error {
326
+ m.ctrl.T.Helper()
327
+ ret := m.ctrl.Call(m, "ChargeForSmartWallet", ctx, beansPerUnit, addr)
328
+ ret0, _ := ret[0].(error)
329
+ return ret0
330
+ }
331
+
332
+ // ChargeForSmartWallet indicates an expected call of ChargeForSmartWallet.
333
+ func (mr *MockSwingSetKeeperMockRecorder) ChargeForSmartWallet(ctx, beansPerUnit, addr any) *gomock.Call {
334
+ mr.mock.ctrl.T.Helper()
335
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChargeForSmartWallet", reflect.TypeOf((*MockSwingSetKeeper)(nil).ChargeForSmartWallet), ctx, beansPerUnit, addr)
336
+ }
337
+
338
+ // GetBeansPerUnit mocks base method.
339
+ func (m *MockSwingSetKeeper) GetBeansPerUnit(ctx types1.Context) map[string]math.Uint {
340
+ m.ctrl.T.Helper()
341
+ ret := m.ctrl.Call(m, "GetBeansPerUnit", ctx)
342
+ ret0, _ := ret[0].(map[string]math.Uint)
343
+ return ret0
344
+ }
345
+
346
+ // GetBeansPerUnit indicates an expected call of GetBeansPerUnit.
347
+ func (mr *MockSwingSetKeeperMockRecorder) GetBeansPerUnit(ctx any) *gomock.Call {
348
+ mr.mock.ctrl.T.Helper()
349
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBeansPerUnit", reflect.TypeOf((*MockSwingSetKeeper)(nil).GetBeansPerUnit), ctx)
350
+ }
351
+
352
+ // GetSmartWalletState mocks base method.
353
+ func (m *MockSwingSetKeeper) GetSmartWalletState(ctx types1.Context, addr types1.AccAddress) types0.SmartWalletState {
354
+ m.ctrl.T.Helper()
355
+ ret := m.ctrl.Call(m, "GetSmartWalletState", ctx, addr)
356
+ ret0, _ := ret[0].(types0.SmartWalletState)
357
+ return ret0
358
+ }
359
+
360
+ // GetSmartWalletState indicates an expected call of GetSmartWalletState.
361
+ func (mr *MockSwingSetKeeperMockRecorder) GetSmartWalletState(ctx, addr any) *gomock.Call {
362
+ mr.mock.ctrl.T.Helper()
363
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSmartWalletState", reflect.TypeOf((*MockSwingSetKeeper)(nil).GetSmartWalletState), ctx, addr)
364
+ }
365
+
366
+ // IsHighPriorityAddress mocks base method.
367
+ func (m *MockSwingSetKeeper) IsHighPriorityAddress(ctx types1.Context, addr types1.AccAddress) (bool, error) {
368
+ m.ctrl.T.Helper()
369
+ ret := m.ctrl.Call(m, "IsHighPriorityAddress", ctx, addr)
370
+ ret0, _ := ret[0].(bool)
371
+ ret1, _ := ret[1].(error)
372
+ return ret0, ret1
373
+ }
374
+
375
+ // IsHighPriorityAddress indicates an expected call of IsHighPriorityAddress.
376
+ func (mr *MockSwingSetKeeperMockRecorder) IsHighPriorityAddress(ctx, addr any) *gomock.Call {
377
+ mr.mock.ctrl.T.Helper()
378
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsHighPriorityAddress", reflect.TypeOf((*MockSwingSetKeeper)(nil).IsHighPriorityAddress), ctx, addr)
379
+ }
@@ -2,6 +2,7 @@ package types
2
2
 
3
3
  import (
4
4
  "github.com/cosmos/cosmos-sdk/codec"
5
+ "github.com/cosmos/cosmos-sdk/codec/legacy"
5
6
  cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
6
7
  cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
7
8
  sdk "github.com/cosmos/cosmos-sdk/types"
@@ -29,10 +30,12 @@ func init() {
29
30
 
30
31
  // RegisterCodec registers concrete types on the Amino codec
31
32
  func RegisterCodec(cdc *codec.LegacyAmino) {
32
- cdc.RegisterConcrete(&MsgDeliverInbound{}, ModuleName+"/DeliverInbound", nil)
33
- cdc.RegisterConcrete(&MsgProvision{}, ModuleName+"/Provision", nil)
34
- cdc.RegisterConcrete(&MsgWalletAction{}, ModuleName+"/WalletAction", nil)
35
- cdc.RegisterConcrete(&MsgWalletSpendAction{}, ModuleName+"/WalletSpendAction", nil)
33
+ legacy.RegisterAminoMsg(cdc, &MsgDeliverInbound{}, ModuleName+"/DeliverInbound")
34
+ legacy.RegisterAminoMsg(cdc, &MsgProvision{}, ModuleName+"/Provision")
35
+ legacy.RegisterAminoMsg(cdc, &MsgWalletAction{}, ModuleName+"/WalletAction")
36
+ legacy.RegisterAminoMsg(cdc, &MsgWalletSpendAction{}, ModuleName+"/WalletSpendAction")
37
+ legacy.RegisterAminoMsg(cdc, &MsgInstallBundle{}, ModuleName+"/InstallBundle")
38
+ cdc.RegisterConcrete(&CoreEvalProposal{}, ModuleName+"/CoreEvalProposal", nil)
36
39
  }
37
40
 
38
41
  // RegisterInterfaces registers the x/swingset interfaces types with the interface registry
@@ -42,8 +45,10 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
42
45
  &MsgProvision{},
43
46
  &MsgWalletAction{},
44
47
  &MsgWalletSpendAction{},
48
+ &MsgInstallBundle{},
45
49
  )
46
- registry.RegisterImplementations(
50
+ registry.RegisterInterface(
51
+ "cosmos.gov.v1beta1.Content",
47
52
  (*govv1beta1.Content)(nil),
48
53
  &CoreEvalProposal{},
49
54
  )
@@ -1,6 +1,7 @@
1
1
  package types
2
2
 
3
3
  import (
4
+ sdkmath "cosmossdk.io/math"
4
5
  sdk "github.com/cosmos/cosmos-sdk/types"
5
6
  )
6
7
 
@@ -43,15 +44,15 @@ const (
43
44
  )
44
45
 
45
46
  var (
46
- DefaultBeansPerXsnapComputron = sdk.NewUint(100)
47
+ DefaultBeansPerXsnapComputron = sdkmath.NewUint(100)
47
48
 
48
49
  // DefaultBeansPerBlockComputeLimit is how many computron beans we allow
49
50
  // before starting a new block. Some analysis (#3459) suggests this leads to
50
51
  // about 2/3rds utilization, based on 5 sec voting time and up to 10 sec of
51
52
  // computation.
52
- DefaultBeansPerBlockComputeLimit = sdk.NewUint(8000000).Mul(DefaultBeansPerXsnapComputron)
53
+ DefaultBeansPerBlockComputeLimit = sdkmath.NewUint(8000000).Mul(DefaultBeansPerXsnapComputron)
53
54
  // observed: 0.385 sec
54
- DefaultBeansPerVatCreation = sdk.NewUint(300000).Mul(DefaultBeansPerXsnapComputron)
55
+ DefaultBeansPerVatCreation = sdkmath.NewUint(300000).Mul(DefaultBeansPerXsnapComputron)
55
56
 
56
57
  // Fees are represented as integer "beans", where each bean is a uniform
57
58
  // fraction of this `fee_unit_price` as controlled by the below
@@ -63,14 +64,14 @@ var (
63
64
  // Larger numbers make for smaller beans, and we expect values to be rather
64
65
  // large for representing fees precisely in beans that each approximate
65
66
  // a "picoUSD"--one trillionth of a USD.
66
- DefaultBeansPerFeeUnit = sdk.NewUint(1_000_000_000_000) // 1e12 (assumes $1 per BLD)
67
+ DefaultBeansPerFeeUnit = sdkmath.NewUint(1_000_000_000_000) // 1e12 (assumes $1 per BLD)
67
68
 
68
- DefaultBeansPerInboundTx = DefaultBeansPerFeeUnit.Quo(sdk.NewUint(100)) // 10e09, ~$0.01
69
- DefaultBeansPerMessage = DefaultBeansPerFeeUnit.Quo(sdk.NewUint(1_000)) // 1e09, ~$0.001
70
- DefaultBeansPerMessageByte = DefaultBeansPerFeeUnit.Quo(sdk.NewUint(50_000)) // 20e06, ~$0.00002
71
- DefaultBeansPerMinFeeDebit = DefaultBeansPerFeeUnit.Quo(sdk.NewUint(5)) // 200e09, ~$0.2
72
- DefaultBeansPerStorageByte = DefaultBeansPerFeeUnit.Quo(sdk.NewUint(500)) // 2e09, ~$0.002
73
- DefaultBeansPerSmartWalletProvision = DefaultBeansPerFeeUnit // 1e12, ~$1
69
+ DefaultBeansPerInboundTx = DefaultBeansPerFeeUnit.Quo(sdkmath.NewUint(100)) // 10e09, ~$0.01
70
+ DefaultBeansPerMessage = DefaultBeansPerFeeUnit.Quo(sdkmath.NewUint(1_000)) // 1e09, ~$0.001
71
+ DefaultBeansPerMessageByte = DefaultBeansPerFeeUnit.Quo(sdkmath.NewUint(50_000)) // 20e06, ~$0.00002
72
+ DefaultBeansPerMinFeeDebit = DefaultBeansPerFeeUnit.Quo(sdkmath.NewUint(5)) // 200e09, ~$0.2
73
+ DefaultBeansPerStorageByte = DefaultBeansPerFeeUnit.Quo(sdkmath.NewUint(500)) // 2e09, ~$0.002
74
+ DefaultBeansPerSmartWalletProvision = DefaultBeansPerFeeUnit // 1e12, ~$1
74
75
 
75
76
  DefaultBootstrapVatConfig = "@agoric/vm-config/decentral-core-config.json"
76
77
 
@@ -83,11 +84,11 @@ var (
83
84
  NewQueueSize(QueueInbound, DefaultInboundQueueMax),
84
85
  }
85
86
 
86
- DefaultVatCleanupDefault = sdk.NewUint(5)
87
+ DefaultVatCleanupDefault = sdkmath.NewUint(5)
87
88
  // DefaultVatCleanupExports = DefaultVatCleanupDefault
88
89
  // DefaultVatCleanupImports = DefaultVatCleanupDefault
89
90
  // DefaultVatCleanupPromises = DefaultVatCleanupDefault
90
- DefaultVatCleanupKv = sdk.NewUint(50)
91
+ DefaultVatCleanupKv = sdkmath.NewUint(50)
91
92
  // DefaultVatCleanupSnapshots = DefaultVatCleanupDefault
92
93
  // DefaultVatCleanupTranscripts = DefaultVatCleanupDefault
93
94
  DefaultVatCleanupBudget = []UintMapEntry{
@@ -1,9 +1,14 @@
1
+ //go:generate mockgen -source=expected_keepers.go -destination=../testutil/mocks.go -package=testutil
2
+
1
3
  package types
2
4
 
3
5
  import (
6
+ "context"
7
+
4
8
  sdkmath "cosmossdk.io/math"
5
9
  sdk "github.com/cosmos/cosmos-sdk/types"
6
- authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
10
+
11
+ agoric "github.com/Agoric/agoric-sdk/golang/cosmos/types"
7
12
  )
8
13
 
9
14
  type SmartWalletState uint8
@@ -15,10 +20,30 @@ const (
15
20
  SmartWalletStateProvisioned
16
21
  )
17
22
 
23
+ // AccountKeeper defines the expected interface for the auth module keeper
18
24
  type AccountKeeper interface {
19
- GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
20
- NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
21
- SetAccount(ctx sdk.Context, acc authtypes.AccountI)
25
+ GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
26
+ NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
27
+ SetAccount(ctx context.Context, acc sdk.AccountI)
28
+ }
29
+
30
+ // BankKeeper defines the expected interface for the bank module keeper
31
+ type BankKeeper interface {
32
+ GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins
33
+ SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
34
+ }
35
+
36
+ // VstorageKeeper defines the expected interface for the vstorage module keeper
37
+ type VstorageKeeper interface {
38
+ PushQueueItem(ctx sdk.Context, path string, value string) error
39
+ HasEntry(ctx sdk.Context, path string) bool
40
+ GetQueueLength(ctx sdk.Context, path string) (sdkmath.Int, error)
41
+ GetEntry(ctx sdk.Context, path string) agoric.KVEntry
42
+ SetStorage(ctx sdk.Context, entry agoric.KVEntry)
43
+ LegacySetStorageAndNotify(ctx sdk.Context, entry agoric.KVEntry)
44
+ PathToEncodedKey(path string) []byte
45
+ GetStoreName() string
46
+ GetChildren(ctx sdk.Context, path string) []string
22
47
  }
23
48
 
24
49
  type SwingSetKeeper interface {
@@ -9,11 +9,16 @@ import (
9
9
 
10
10
  sdkioerrors "cosmossdk.io/errors"
11
11
  sdkmath "cosmossdk.io/math"
12
+ "cosmossdk.io/x/tx/signing"
12
13
 
13
14
  sdk "github.com/cosmos/cosmos-sdk/types"
14
15
  sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
15
16
 
16
17
  "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
18
+
19
+ "google.golang.org/protobuf/proto"
20
+ "google.golang.org/protobuf/protoadapt"
21
+ "google.golang.org/protobuf/reflect/protoreflect"
17
22
  )
18
23
 
19
24
  const RouterKey = ModuleName // this was defined in your key.go file
@@ -24,6 +29,7 @@ var (
24
29
  _ sdk.Msg = &MsgInstallBundle{}
25
30
  _ sdk.Msg = &MsgWalletAction{}
26
31
  _ sdk.Msg = &MsgWalletSpendAction{}
32
+ _ sdk.Msg = &MsgCoreEval{}
27
33
 
28
34
  _ vm.ControllerAdmissionMsg = &MsgDeliverInbound{}
29
35
  _ vm.ControllerAdmissionMsg = &MsgInstallBundle{}
@@ -32,6 +38,42 @@ var (
32
38
  _ vm.ControllerAdmissionMsg = &MsgWalletSpendAction{}
33
39
  )
34
40
 
41
+ // Replacing msg.GetSigners() but before we can adopt AddressString.
42
+ // https://github.com/cosmos/cosmos-sdk/issues/20077#issuecomment-2062601533
43
+ func createSignerFieldFunc(fieldName protoreflect.Name) signing.GetSignersFunc {
44
+ return func(msgIn proto.Message) ([][]byte, error) {
45
+ msg := msgIn.ProtoReflect()
46
+ if !msg.Has(msg.Descriptor().Fields().ByName(fieldName)) {
47
+ return nil, sdkioerrors.Wrapf(sdkerrors.ErrInvalidRequest, "message %T does not have field %s", msgIn, fieldName)
48
+ }
49
+ addr := msg.Get(msg.Descriptor().Fields().ByName(fieldName)).Interface().([]byte)
50
+ return [][]byte{addr}, nil
51
+ }
52
+ }
53
+
54
+ func DefineCustomGetSigners(options *signing.Options) {
55
+ options.DefineCustomGetSigners(
56
+ proto.MessageName(protoadapt.MessageV2Of(&MsgDeliverInbound{})),
57
+ createSignerFieldFunc("submitter"),
58
+ )
59
+ options.DefineCustomGetSigners(
60
+ proto.MessageName(protoadapt.MessageV2Of(&MsgProvision{})),
61
+ createSignerFieldFunc("submitter"),
62
+ )
63
+ options.DefineCustomGetSigners(
64
+ proto.MessageName(protoadapt.MessageV2Of(&MsgInstallBundle{})),
65
+ createSignerFieldFunc("submitter"),
66
+ )
67
+ options.DefineCustomGetSigners(
68
+ proto.MessageName(protoadapt.MessageV2Of(&MsgWalletAction{})),
69
+ createSignerFieldFunc("owner"),
70
+ )
71
+ options.DefineCustomGetSigners(
72
+ proto.MessageName(protoadapt.MessageV2Of(&MsgWalletSpendAction{})),
73
+ createSignerFieldFunc("owner"),
74
+ )
75
+ }
76
+
35
77
  // Contextual information about the message source of an action on an inbound queue.
36
78
  // This context should be unique per inboundQueueRecord.
37
79
  type ActionContext struct {
@@ -46,6 +88,7 @@ type ActionContext struct {
46
88
  // actionContext unique. (for example a counter per block and source module).
47
89
  MsgIdx int `json:"msgIdx"`
48
90
  }
91
+
49
92
  type InboundQueueRecord struct {
50
93
  Action vm.Jsonable `json:"action"`
51
94
  Context ActionContext `json:"context"`
@@ -172,18 +215,6 @@ func (msg MsgDeliverInbound) ValidateBasic() error {
172
215
  return nil
173
216
  }
174
217
 
175
- // GetSignBytes encodes the message for signing
176
- func (msg MsgDeliverInbound) GetSignBytes() []byte {
177
- // FIXME: This compensates for Amino maybe returning nil instead of empty slices.
178
- if msg.Messages == nil {
179
- msg.Messages = []string{}
180
- }
181
- if msg.Nums == nil {
182
- msg.Nums = []uint64{}
183
- }
184
- return sdk.MustSortJSON(ModuleAminoCdc.MustMarshalJSON(&msg))
185
- }
186
-
187
218
  // GetSigners defines whose signature is required
188
219
  func (msg MsgDeliverInbound) GetSigners() []sdk.AccAddress {
189
220
  return []sdk.AccAddress{msg.Submitter}
@@ -222,32 +253,17 @@ func (msg MsgWalletAction) IsHighPriority(ctx sdk.Context, data interface{}) (bo
222
253
  return false, nil
223
254
  }
224
255
 
256
+ // GetSigners defines whose signature is required
225
257
  func (msg MsgWalletAction) GetSigners() []sdk.AccAddress {
226
258
  return []sdk.AccAddress{msg.Owner}
227
259
  }
228
260
 
229
- // GetSignBytes encodes the message for signing
230
- func (msg MsgWalletAction) GetSignBytes() []byte {
231
- return sdk.MustSortJSON(ModuleAminoCdc.MustMarshalJSON(&msg))
232
- }
233
-
234
261
  // Route should return the name of the module
235
262
  func (msg MsgWalletAction) Route() string { return RouterKey }
236
263
 
237
264
  // Type should return the action
238
265
  func (msg MsgWalletAction) Type() string { return "wallet_action" }
239
266
 
240
- // Route should return the name of the module
241
- func (msg MsgWalletSpendAction) Route() string { return RouterKey }
242
-
243
- // Type should return the action
244
- func (msg MsgWalletSpendAction) Type() string { return "wallet_spend_action" }
245
-
246
- // GetSignBytes encodes the message for signing
247
- func (msg MsgWalletSpendAction) GetSignBytes() []byte {
248
- return sdk.MustSortJSON(ModuleAminoCdc.MustMarshalJSON(&msg))
249
- }
250
-
251
267
  // ValidateBasic runs stateless checks on the message
252
268
  func (msg MsgWalletAction) ValidateBasic() error {
253
269
  if msg.Owner.Empty() {
@@ -300,10 +316,17 @@ func (msg MsgWalletSpendAction) IsHighPriority(ctx sdk.Context, data interface{}
300
316
  return keeper.IsHighPriorityAddress(ctx, msg.Owner)
301
317
  }
302
318
 
319
+ // GetSigners defines whose signature is required
303
320
  func (msg MsgWalletSpendAction) GetSigners() []sdk.AccAddress {
304
321
  return []sdk.AccAddress{msg.Owner}
305
322
  }
306
323
 
324
+ // Route should return the name of the module
325
+ func (msg MsgWalletSpendAction) Route() string { return RouterKey }
326
+
327
+ // Type should return the action
328
+ func (msg MsgWalletSpendAction) Type() string { return "wallet_spend_action" }
329
+
307
330
  // ValidateBasic runs stateless checks on the message
308
331
  func (msg MsgWalletSpendAction) ValidateBasic() error {
309
332
  if msg.Owner.Empty() {
@@ -368,14 +391,6 @@ func (msg MsgProvision) IsHighPriority(ctx sdk.Context, data interface{}) (bool,
368
391
  return false, nil
369
392
  }
370
393
 
371
- // GetSignBytes encodes the message for signing
372
- func (msg MsgProvision) GetSignBytes() []byte {
373
- if msg.PowerFlags == nil {
374
- msg.PowerFlags = []string{}
375
- }
376
- return sdk.MustSortJSON(ModuleAminoCdc.MustMarshalJSON(&msg))
377
- }
378
-
379
394
  // GetSigners defines whose signature is required
380
395
  func (msg MsgProvision) GetSigners() []sdk.AccAddress {
381
396
  return []sdk.AccAddress{msg.Submitter}