@agoric/cosmos 0.34.1 → 0.34.2-calypso-dev-dabccdc.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 (193) hide show
  1. package/MAINTAINERS.md +3 -0
  2. package/Makefile +67 -41
  3. package/agoric/config.go +35 -0
  4. package/ante/ante.go +65 -0
  5. package/ante/expected_keepers.go +26 -0
  6. package/ante/inbound.go +137 -0
  7. package/ante/inbound_test.go +228 -0
  8. package/ante/vm_admission.go +65 -0
  9. package/app/app.go +396 -211
  10. package/app/export.go +13 -9
  11. package/app/sim_test.go +4 -4
  12. package/app/upgrade.go +215 -0
  13. package/binding.gyp.in +29 -4
  14. package/buf.work.yaml +4 -0
  15. package/cmd/agd/agvm.go +42 -0
  16. package/cmd/agd/find_binary.go +22 -7
  17. package/cmd/agd/main.go +133 -10
  18. package/cmd/libdaemon/main.go +67 -53
  19. package/cmd/libdaemon/main_test.go +37 -0
  20. package/daemon/cmd/genaccounts.go +22 -18
  21. package/daemon/cmd/root.go +253 -52
  22. package/daemon/cmd/root_test.go +190 -2
  23. package/daemon/cmd/testnet.go +17 -6
  24. package/daemon/main.go +6 -3
  25. package/e2e_test/Makefile +29 -0
  26. package/e2e_test/README.md +100 -0
  27. package/e2e_test/go.mod +217 -0
  28. package/e2e_test/go.sum +1323 -0
  29. package/e2e_test/ibc_conformance_test.go +56 -0
  30. package/e2e_test/pfm_test.go +613 -0
  31. package/e2e_test/util.go +271 -0
  32. package/git-revision.txt +1 -0
  33. package/go.mod +207 -0
  34. package/go.sum +1877 -0
  35. package/package.json +13 -21
  36. package/proto/agoric/swingset/genesis.proto +14 -0
  37. package/proto/agoric/swingset/swingset.proto +6 -3
  38. package/proto/agoric/vlocalchain/.clang-format +7 -0
  39. package/proto/agoric/vlocalchain/vlocalchain.proto +31 -0
  40. package/proto/agoric/vstorage/query.proto +53 -1
  41. package/proto/agoric/vtransfer/genesis.proto +18 -0
  42. package/scripts/protocgen.sh +16 -6
  43. package/third_party/proto/buf.yaml +1 -0
  44. package/third_party/proto/cosmos/base/query/v1beta1/pagination.proto +4 -1
  45. package/third_party/proto/cosmos/base/v1beta1/coin.proto +7 -4
  46. package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +16 -6
  47. package/third_party/proto/cosmos_proto/cosmos.proto +97 -0
  48. package/third_party/proto/google/api/annotations.proto +1 -1
  49. package/third_party/proto/google/api/http.proto +181 -120
  50. package/third_party/proto/google/api/httpbody.proto +9 -6
  51. package/third_party/proto/google/protobuf/any.proto +1 -7
  52. package/third_party/proto/ibc/core/channel/v1/channel.proto +15 -1
  53. package/third_party/proto/ibc/core/client/v1/client.proto +9 -6
  54. package/tools/tools.go +11 -0
  55. package/types/events.go +41 -0
  56. package/types/kv_entry.go +114 -0
  57. package/types/kv_entry_helpers.go +276 -0
  58. package/types/kv_entry_helpers_test.go +237 -0
  59. package/types/kv_entry_test.go +143 -0
  60. package/upgradegaia.sh +75 -0
  61. package/vm/action.go +134 -0
  62. package/vm/action_test.go +149 -0
  63. package/vm/client.go +113 -0
  64. package/vm/client_test.go +182 -0
  65. package/vm/controller.go +49 -0
  66. package/vm/core_proposals.go +51 -0
  67. package/vm/jsonrpcconn/jsonrpcconn.go +160 -0
  68. package/vm/jsonrpcconn/jsonrpcconn_test.go +126 -0
  69. package/vm/proto_json.go +38 -0
  70. package/vm/proto_json_test.go +103 -0
  71. package/vm/server.go +124 -0
  72. package/x/swingset/abci.go +26 -37
  73. package/x/swingset/alias.go +9 -6
  74. package/x/swingset/client/cli/query.go +2 -2
  75. package/x/swingset/client/cli/tx.go +52 -33
  76. package/x/swingset/client/proposal_handler.go +2 -17
  77. package/x/swingset/genesis.go +163 -37
  78. package/x/swingset/handler.go +2 -1
  79. package/x/swingset/keeper/extension_snapshotter.go +309 -0
  80. package/x/swingset/keeper/extension_snapshotter_test.go +104 -0
  81. package/x/swingset/keeper/keeper.go +95 -48
  82. package/x/swingset/keeper/keeper_test.go +77 -0
  83. package/x/swingset/keeper/migrations.go +7 -2
  84. package/x/swingset/keeper/msg_server.go +71 -56
  85. package/x/swingset/keeper/proposal.go +15 -9
  86. package/x/swingset/keeper/querier.go +24 -15
  87. package/x/swingset/keeper/swing_store_exports_handler.go +872 -0
  88. package/x/swingset/keeper/swing_store_exports_handler_test.go +247 -0
  89. package/x/swingset/keeper/test_utils.go +16 -0
  90. package/x/swingset/module.go +33 -11
  91. package/x/swingset/proposal_handler.go +5 -4
  92. package/x/swingset/swingset.go +73 -0
  93. package/x/swingset/testing/queue.go +17 -0
  94. package/x/swingset/types/codec.go +2 -2
  95. package/x/swingset/types/default-params.go +23 -17
  96. package/x/swingset/types/expected_keepers.go +14 -2
  97. package/x/swingset/types/genesis.pb.go +361 -18
  98. package/x/swingset/types/msgs.go +87 -26
  99. package/x/swingset/types/msgs.pb.go +16 -16
  100. package/x/swingset/types/params.go +76 -1
  101. package/x/swingset/types/params_test.go +116 -0
  102. package/x/swingset/types/proposal.go +10 -9
  103. package/x/swingset/types/swingset.pb.go +83 -81
  104. package/x/swingset/types/types.go +30 -28
  105. package/x/vbank/genesis.go +0 -2
  106. package/x/vbank/handler.go +2 -1
  107. package/x/vbank/keeper/keeper.go +3 -2
  108. package/x/vbank/keeper/querier.go +9 -4
  109. package/x/vbank/keeper/rewards.go +1 -1
  110. package/x/vbank/module.go +0 -5
  111. package/x/vbank/types/msgs.go +0 -12
  112. package/x/vbank/vbank.go +34 -32
  113. package/x/vbank/vbank_test.go +20 -20
  114. package/x/vibc/alias.go +3 -0
  115. package/x/vibc/handler.go +17 -15
  116. package/x/vibc/keeper/keeper.go +113 -89
  117. package/x/vibc/keeper/triggers.go +101 -0
  118. package/x/vibc/module.go +5 -8
  119. package/x/vibc/types/expected_keepers.go +28 -6
  120. package/x/vibc/types/ibc_module.go +336 -0
  121. package/x/vibc/types/msgs.go +1 -1
  122. package/x/vibc/types/msgs.pb.go +1 -1
  123. package/x/vibc/types/receiver.go +170 -0
  124. package/x/vlocalchain/alias.go +19 -0
  125. package/x/vlocalchain/handler.go +21 -0
  126. package/x/vlocalchain/keeper/keeper.go +279 -0
  127. package/x/vlocalchain/keeper/keeper_test.go +97 -0
  128. package/x/vlocalchain/types/codec.go +34 -0
  129. package/x/vlocalchain/types/key.go +27 -0
  130. package/x/vlocalchain/types/msgs.go +16 -0
  131. package/x/vlocalchain/types/vlocalchain.pb.go +1072 -0
  132. package/x/vlocalchain/vlocalchain.go +114 -0
  133. package/x/vlocalchain/vlocalchain_test.go +434 -0
  134. package/x/vstorage/README.md +138 -0
  135. package/x/vstorage/capdata/capdata.go +298 -0
  136. package/x/vstorage/capdata/capdata_test.go +352 -0
  137. package/x/vstorage/client/cli/query.go +51 -4
  138. package/x/vstorage/genesis.go +0 -3
  139. package/x/vstorage/handler.go +2 -1
  140. package/x/vstorage/keeper/grpc_query.go +220 -0
  141. package/x/vstorage/keeper/keeper.go +75 -57
  142. package/x/vstorage/keeper/keeper_grpc_test.go +300 -0
  143. package/x/vstorage/keeper/keeper_test.go +40 -62
  144. package/x/vstorage/keeper/querier.go +39 -14
  145. package/x/vstorage/keeper/querier_test.go +113 -0
  146. package/x/vstorage/module.go +0 -5
  147. package/x/vstorage/testing/queue.go +27 -0
  148. package/x/vstorage/types/path_keys.go +22 -10
  149. package/x/vstorage/types/path_keys_test.go +84 -18
  150. package/x/vstorage/types/query.pb.go +646 -36
  151. package/x/vstorage/types/query.pb.gw.go +119 -0
  152. package/x/vstorage/types/types.go +0 -66
  153. package/x/vstorage/vstorage.go +33 -35
  154. package/x/vstorage/vstorage_test.go +19 -19
  155. package/x/vtransfer/alias.go +13 -0
  156. package/x/vtransfer/genesis.go +39 -0
  157. package/x/vtransfer/genesis_test.go +12 -0
  158. package/x/vtransfer/handler.go +20 -0
  159. package/x/vtransfer/ibc_middleware.go +186 -0
  160. package/x/vtransfer/ibc_middleware_test.go +448 -0
  161. package/x/vtransfer/keeper/keeper.go +281 -0
  162. package/x/vtransfer/module.go +124 -0
  163. package/x/vtransfer/types/expected_keepers.go +38 -0
  164. package/x/vtransfer/types/genesis.pb.go +327 -0
  165. package/x/vtransfer/types/key.go +9 -0
  166. package/x/vtransfer/types/msgs.go +9 -0
  167. package/app/const.go +0 -6
  168. package/cmd/helper/main.go +0 -21
  169. package/proto/agoric/lien/genesis.proto +0 -25
  170. package/proto/agoric/lien/lien.proto +0 -25
  171. package/x/lien/alias.go +0 -17
  172. package/x/lien/genesis.go +0 -58
  173. package/x/lien/genesis_test.go +0 -101
  174. package/x/lien/keeper/account.go +0 -285
  175. package/x/lien/keeper/keeper.go +0 -254
  176. package/x/lien/keeper/keeper_test.go +0 -623
  177. package/x/lien/lien.go +0 -203
  178. package/x/lien/lien_test.go +0 -529
  179. package/x/lien/module.go +0 -115
  180. package/x/lien/spec/01_concepts.md +0 -146
  181. package/x/lien/spec/02_messages.md +0 -96
  182. package/x/lien/types/accountkeeper.go +0 -81
  183. package/x/lien/types/accountstate.go +0 -27
  184. package/x/lien/types/expected_keepers.go +0 -18
  185. package/x/lien/types/genesis.pb.go +0 -567
  186. package/x/lien/types/key.go +0 -25
  187. package/x/lien/types/lien.pb.go +0 -403
  188. package/x/swingset/keeper/snapshotter.go +0 -491
  189. package/x/swingset/keeper/snapshotter_test.go +0 -185
  190. package/x/swingset/legacy/v32/params.go +0 -37
  191. package/x/swingset/legacy/v32/params_test.go +0 -133
  192. package/x/vibc/ibc.go +0 -442
  193. /package/{src/index.cjs → index.cjs} +0 -0
@@ -25,8 +25,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
25
25
 
26
26
  // The initial or exported state.
27
27
  type GenesisState struct {
28
- Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
29
- State State `protobuf:"bytes,3,opt,name=state,proto3" json:"state"`
28
+ Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
29
+ State State `protobuf:"bytes,3,opt,name=state,proto3" json:"state"`
30
+ SwingStoreExportData []*SwingStoreExportDataEntry `protobuf:"bytes,4,rep,name=swing_store_export_data,json=swingStoreExportData,proto3" json:"swingStoreExportData"`
31
+ SwingStoreExportDataHash string `protobuf:"bytes,5,opt,name=swing_store_export_data_hash,json=swingStoreExportDataHash,proto3" json:"swingStoreExportDataHash"`
30
32
  }
31
33
 
32
34
  func (m *GenesisState) Reset() { *m = GenesisState{} }
@@ -76,29 +78,105 @@ func (m *GenesisState) GetState() State {
76
78
  return State{}
77
79
  }
78
80
 
81
+ func (m *GenesisState) GetSwingStoreExportData() []*SwingStoreExportDataEntry {
82
+ if m != nil {
83
+ return m.SwingStoreExportData
84
+ }
85
+ return nil
86
+ }
87
+
88
+ func (m *GenesisState) GetSwingStoreExportDataHash() string {
89
+ if m != nil {
90
+ return m.SwingStoreExportDataHash
91
+ }
92
+ return ""
93
+ }
94
+
95
+ // A SwingStore "export data" entry.
96
+ type SwingStoreExportDataEntry struct {
97
+ Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
98
+ Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
99
+ }
100
+
101
+ func (m *SwingStoreExportDataEntry) Reset() { *m = SwingStoreExportDataEntry{} }
102
+ func (m *SwingStoreExportDataEntry) String() string { return proto.CompactTextString(m) }
103
+ func (*SwingStoreExportDataEntry) ProtoMessage() {}
104
+ func (*SwingStoreExportDataEntry) Descriptor() ([]byte, []int) {
105
+ return fileDescriptor_49b057311de9d296, []int{1}
106
+ }
107
+ func (m *SwingStoreExportDataEntry) XXX_Unmarshal(b []byte) error {
108
+ return m.Unmarshal(b)
109
+ }
110
+ func (m *SwingStoreExportDataEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
111
+ if deterministic {
112
+ return xxx_messageInfo_SwingStoreExportDataEntry.Marshal(b, m, deterministic)
113
+ } else {
114
+ b = b[:cap(b)]
115
+ n, err := m.MarshalToSizedBuffer(b)
116
+ if err != nil {
117
+ return nil, err
118
+ }
119
+ return b[:n], nil
120
+ }
121
+ }
122
+ func (m *SwingStoreExportDataEntry) XXX_Merge(src proto.Message) {
123
+ xxx_messageInfo_SwingStoreExportDataEntry.Merge(m, src)
124
+ }
125
+ func (m *SwingStoreExportDataEntry) XXX_Size() int {
126
+ return m.Size()
127
+ }
128
+ func (m *SwingStoreExportDataEntry) XXX_DiscardUnknown() {
129
+ xxx_messageInfo_SwingStoreExportDataEntry.DiscardUnknown(m)
130
+ }
131
+
132
+ var xxx_messageInfo_SwingStoreExportDataEntry proto.InternalMessageInfo
133
+
134
+ func (m *SwingStoreExportDataEntry) GetKey() string {
135
+ if m != nil {
136
+ return m.Key
137
+ }
138
+ return ""
139
+ }
140
+
141
+ func (m *SwingStoreExportDataEntry) GetValue() string {
142
+ if m != nil {
143
+ return m.Value
144
+ }
145
+ return ""
146
+ }
147
+
79
148
  func init() {
80
149
  proto.RegisterType((*GenesisState)(nil), "agoric.swingset.GenesisState")
150
+ proto.RegisterType((*SwingStoreExportDataEntry)(nil), "agoric.swingset.SwingStoreExportDataEntry")
81
151
  }
82
152
 
83
153
  func init() { proto.RegisterFile("agoric/swingset/genesis.proto", fileDescriptor_49b057311de9d296) }
84
154
 
85
155
  var fileDescriptor_49b057311de9d296 = []byte{
86
- // 234 bytes of a gzipped FileDescriptorProto
87
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4d, 0x4c, 0xcf, 0x2f,
88
- 0xca, 0x4c, 0xd6, 0x2f, 0x2e, 0xcf, 0xcc, 0x4b, 0x2f, 0x4e, 0x2d, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b,
89
- 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x87, 0x48, 0xeb, 0xc1, 0xa4,
90
- 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x72, 0xfa, 0x20, 0x16, 0x44, 0x99, 0x94, 0x1c, 0xba,
91
- 0x29, 0x30, 0x06, 0x44, 0x5e, 0xa9, 0x9e, 0x8b, 0xc7, 0x1d, 0x62, 0x6e, 0x70, 0x49, 0x62, 0x49,
92
- 0xaa, 0x90, 0x29, 0x17, 0x5b, 0x41, 0x62, 0x51, 0x62, 0x6e, 0xb1, 0x04, 0x93, 0x02, 0xa3, 0x06,
93
- 0xb7, 0x91, 0xb8, 0x1e, 0x9a, 0x3d, 0x7a, 0x01, 0x60, 0x69, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19,
94
- 0x82, 0xa0, 0x8a, 0x85, 0x8c, 0xb8, 0x58, 0x8b, 0x41, 0xfa, 0x25, 0x98, 0xc1, 0xba, 0xc4, 0x30,
95
- 0x74, 0x81, 0x4d, 0x87, 0x6a, 0x82, 0x28, 0xb5, 0x62, 0x79, 0xb1, 0x40, 0x9e, 0xc1, 0x29, 0xf4,
96
- 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e,
97
- 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xac, 0xd3, 0x33, 0x4b, 0x32, 0x4a,
98
- 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x1d, 0x21, 0xbe, 0x80, 0x98, 0xaa, 0x5b, 0x9c, 0x92, 0xad,
99
- 0x9f, 0x9e, 0x9f, 0x93, 0x98, 0x97, 0xae, 0x9f, 0x9c, 0x5f, 0x9c, 0x9b, 0x5f, 0xac, 0x5f, 0x81,
100
- 0xf0, 0x60, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x7b, 0xc6, 0x80, 0x00, 0x00, 0x00,
101
- 0xff, 0xff, 0x65, 0xe6, 0xb9, 0x87, 0x46, 0x01, 0x00, 0x00,
156
+ // 363 bytes of a gzipped FileDescriptorProto
157
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcd, 0x4a, 0xc3, 0x40,
158
+ 0x14, 0x85, 0x93, 0xfe, 0x41, 0xa7, 0x82, 0x12, 0x8a, 0x8d, 0xa5, 0x26, 0xa5, 0xab, 0x22, 0x98,
159
+ 0x40, 0xc5, 0x8d, 0xae, 0x8c, 0x16, 0x5d, 0x4a, 0x8a, 0x1b, 0x11, 0xc2, 0xb4, 0x1d, 0x26, 0xa1,
160
+ 0x6d, 0x26, 0xe4, 0x4e, 0xb5, 0xc5, 0x97, 0xf0, 0x11, 0x7c, 0x9c, 0x2e, 0xbb, 0x14, 0x17, 0x45,
161
+ 0xda, 0x8d, 0xf4, 0x29, 0x24, 0x33, 0x2d, 0x42, 0x7f, 0x76, 0x27, 0xf9, 0xce, 0x39, 0x37, 0xdc,
162
+ 0x1b, 0x74, 0x8a, 0x29, 0x8b, 0x83, 0x8e, 0x0d, 0x6f, 0x41, 0x48, 0x81, 0x70, 0x9b, 0x92, 0x90,
163
+ 0x40, 0x00, 0x56, 0x14, 0x33, 0xce, 0xb4, 0x43, 0x89, 0xad, 0x35, 0x2e, 0x17, 0x29, 0xa3, 0x4c,
164
+ 0x30, 0x3b, 0x51, 0xd2, 0x56, 0x36, 0x36, 0x5b, 0xd6, 0x42, 0xf2, 0xda, 0x77, 0x0a, 0x1d, 0xdc,
165
+ 0xcb, 0xe2, 0x16, 0xc7, 0x9c, 0x68, 0x97, 0x28, 0x17, 0xe1, 0x18, 0x0f, 0x40, 0x4f, 0x55, 0xd5,
166
+ 0x7a, 0xa1, 0x51, 0xb2, 0x36, 0x06, 0x59, 0x8f, 0x02, 0x3b, 0x99, 0xc9, 0xcc, 0x54, 0xdc, 0x95,
167
+ 0x59, 0x6b, 0xa0, 0x2c, 0x24, 0x79, 0x3d, 0x2d, 0x52, 0xc7, 0x5b, 0x29, 0xd1, 0xbe, 0x0a, 0x49,
168
+ 0xab, 0xf6, 0x8e, 0x4a, 0x02, 0x7b, 0xc0, 0x59, 0x4c, 0x3c, 0x32, 0x8a, 0x58, 0xcc, 0xbd, 0x2e,
169
+ 0xe6, 0x58, 0xcf, 0x54, 0xd3, 0xf5, 0x42, 0xe3, 0x6c, 0xbb, 0x25, 0x11, 0xad, 0xc4, 0xde, 0x14,
170
+ 0xee, 0x3b, 0xcc, 0x71, 0x33, 0xe4, 0xf1, 0xd8, 0xd1, 0x97, 0x33, 0xb3, 0x08, 0x3b, 0xb0, 0xbb,
171
+ 0xf3, 0xad, 0xf6, 0x82, 0x2a, 0x7b, 0x86, 0x7b, 0x3e, 0x06, 0x5f, 0xcf, 0x56, 0xd5, 0x7a, 0xde,
172
+ 0xa9, 0x2c, 0x67, 0xa6, 0xbe, 0x2b, 0xff, 0x80, 0xc1, 0x77, 0xf7, 0x92, 0xab, 0xcc, 0xef, 0xa7,
173
+ 0xa9, 0xd4, 0x6e, 0xd1, 0xc9, 0xde, 0x0f, 0xd6, 0x8e, 0x50, 0xba, 0x47, 0xc6, 0xba, 0x9a, 0xcc,
174
+ 0x71, 0x13, 0xa9, 0x15, 0x51, 0xf6, 0x15, 0xf7, 0x87, 0x44, 0x6c, 0x3e, 0xef, 0xca, 0x07, 0xe7,
175
+ 0x69, 0x32, 0x37, 0xd4, 0xe9, 0xdc, 0x50, 0x7f, 0xe6, 0x86, 0xfa, 0xb1, 0x30, 0x94, 0xe9, 0xc2,
176
+ 0x50, 0xbe, 0x16, 0x86, 0xf2, 0x7c, 0x4d, 0x03, 0xee, 0x0f, 0xdb, 0x56, 0x87, 0x0d, 0xec, 0x1b,
177
+ 0x79, 0x66, 0xb9, 0xaf, 0x73, 0xe8, 0xf6, 0x6c, 0xca, 0xfa, 0x38, 0xa4, 0x76, 0x87, 0xc1, 0x80,
178
+ 0x81, 0x3d, 0xfa, 0xff, 0x03, 0xf8, 0x38, 0x22, 0xd0, 0xce, 0x89, 0xfb, 0x5f, 0xfc, 0x05, 0x00,
179
+ 0x00, 0xff, 0xff, 0x1b, 0x95, 0x41, 0xea, 0x67, 0x02, 0x00, 0x00,
102
180
  }
103
181
 
104
182
  func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@@ -121,6 +199,27 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
121
199
  _ = i
122
200
  var l int
123
201
  _ = l
202
+ if len(m.SwingStoreExportDataHash) > 0 {
203
+ i -= len(m.SwingStoreExportDataHash)
204
+ copy(dAtA[i:], m.SwingStoreExportDataHash)
205
+ i = encodeVarintGenesis(dAtA, i, uint64(len(m.SwingStoreExportDataHash)))
206
+ i--
207
+ dAtA[i] = 0x2a
208
+ }
209
+ if len(m.SwingStoreExportData) > 0 {
210
+ for iNdEx := len(m.SwingStoreExportData) - 1; iNdEx >= 0; iNdEx-- {
211
+ {
212
+ size, err := m.SwingStoreExportData[iNdEx].MarshalToSizedBuffer(dAtA[:i])
213
+ if err != nil {
214
+ return 0, err
215
+ }
216
+ i -= size
217
+ i = encodeVarintGenesis(dAtA, i, uint64(size))
218
+ }
219
+ i--
220
+ dAtA[i] = 0x22
221
+ }
222
+ }
124
223
  {
125
224
  size, err := m.State.MarshalToSizedBuffer(dAtA[:i])
126
225
  if err != nil {
@@ -144,6 +243,43 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
144
243
  return len(dAtA) - i, nil
145
244
  }
146
245
 
246
+ func (m *SwingStoreExportDataEntry) Marshal() (dAtA []byte, err error) {
247
+ size := m.Size()
248
+ dAtA = make([]byte, size)
249
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
250
+ if err != nil {
251
+ return nil, err
252
+ }
253
+ return dAtA[:n], nil
254
+ }
255
+
256
+ func (m *SwingStoreExportDataEntry) MarshalTo(dAtA []byte) (int, error) {
257
+ size := m.Size()
258
+ return m.MarshalToSizedBuffer(dAtA[:size])
259
+ }
260
+
261
+ func (m *SwingStoreExportDataEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) {
262
+ i := len(dAtA)
263
+ _ = i
264
+ var l int
265
+ _ = l
266
+ if len(m.Value) > 0 {
267
+ i -= len(m.Value)
268
+ copy(dAtA[i:], m.Value)
269
+ i = encodeVarintGenesis(dAtA, i, uint64(len(m.Value)))
270
+ i--
271
+ dAtA[i] = 0x12
272
+ }
273
+ if len(m.Key) > 0 {
274
+ i -= len(m.Key)
275
+ copy(dAtA[i:], m.Key)
276
+ i = encodeVarintGenesis(dAtA, i, uint64(len(m.Key)))
277
+ i--
278
+ dAtA[i] = 0xa
279
+ }
280
+ return len(dAtA) - i, nil
281
+ }
282
+
147
283
  func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
148
284
  offset -= sovGenesis(v)
149
285
  base := offset
@@ -165,6 +301,33 @@ func (m *GenesisState) Size() (n int) {
165
301
  n += 1 + l + sovGenesis(uint64(l))
166
302
  l = m.State.Size()
167
303
  n += 1 + l + sovGenesis(uint64(l))
304
+ if len(m.SwingStoreExportData) > 0 {
305
+ for _, e := range m.SwingStoreExportData {
306
+ l = e.Size()
307
+ n += 1 + l + sovGenesis(uint64(l))
308
+ }
309
+ }
310
+ l = len(m.SwingStoreExportDataHash)
311
+ if l > 0 {
312
+ n += 1 + l + sovGenesis(uint64(l))
313
+ }
314
+ return n
315
+ }
316
+
317
+ func (m *SwingStoreExportDataEntry) Size() (n int) {
318
+ if m == nil {
319
+ return 0
320
+ }
321
+ var l int
322
+ _ = l
323
+ l = len(m.Key)
324
+ if l > 0 {
325
+ n += 1 + l + sovGenesis(uint64(l))
326
+ }
327
+ l = len(m.Value)
328
+ if l > 0 {
329
+ n += 1 + l + sovGenesis(uint64(l))
330
+ }
168
331
  return n
169
332
  }
170
333
 
@@ -269,6 +432,186 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
269
432
  return err
270
433
  }
271
434
  iNdEx = postIndex
435
+ case 4:
436
+ if wireType != 2 {
437
+ return fmt.Errorf("proto: wrong wireType = %d for field SwingStoreExportData", wireType)
438
+ }
439
+ var msglen int
440
+ for shift := uint(0); ; shift += 7 {
441
+ if shift >= 64 {
442
+ return ErrIntOverflowGenesis
443
+ }
444
+ if iNdEx >= l {
445
+ return io.ErrUnexpectedEOF
446
+ }
447
+ b := dAtA[iNdEx]
448
+ iNdEx++
449
+ msglen |= int(b&0x7F) << shift
450
+ if b < 0x80 {
451
+ break
452
+ }
453
+ }
454
+ if msglen < 0 {
455
+ return ErrInvalidLengthGenesis
456
+ }
457
+ postIndex := iNdEx + msglen
458
+ if postIndex < 0 {
459
+ return ErrInvalidLengthGenesis
460
+ }
461
+ if postIndex > l {
462
+ return io.ErrUnexpectedEOF
463
+ }
464
+ m.SwingStoreExportData = append(m.SwingStoreExportData, &SwingStoreExportDataEntry{})
465
+ if err := m.SwingStoreExportData[len(m.SwingStoreExportData)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
466
+ return err
467
+ }
468
+ iNdEx = postIndex
469
+ case 5:
470
+ if wireType != 2 {
471
+ return fmt.Errorf("proto: wrong wireType = %d for field SwingStoreExportDataHash", wireType)
472
+ }
473
+ var stringLen uint64
474
+ for shift := uint(0); ; shift += 7 {
475
+ if shift >= 64 {
476
+ return ErrIntOverflowGenesis
477
+ }
478
+ if iNdEx >= l {
479
+ return io.ErrUnexpectedEOF
480
+ }
481
+ b := dAtA[iNdEx]
482
+ iNdEx++
483
+ stringLen |= uint64(b&0x7F) << shift
484
+ if b < 0x80 {
485
+ break
486
+ }
487
+ }
488
+ intStringLen := int(stringLen)
489
+ if intStringLen < 0 {
490
+ return ErrInvalidLengthGenesis
491
+ }
492
+ postIndex := iNdEx + intStringLen
493
+ if postIndex < 0 {
494
+ return ErrInvalidLengthGenesis
495
+ }
496
+ if postIndex > l {
497
+ return io.ErrUnexpectedEOF
498
+ }
499
+ m.SwingStoreExportDataHash = string(dAtA[iNdEx:postIndex])
500
+ iNdEx = postIndex
501
+ default:
502
+ iNdEx = preIndex
503
+ skippy, err := skipGenesis(dAtA[iNdEx:])
504
+ if err != nil {
505
+ return err
506
+ }
507
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
508
+ return ErrInvalidLengthGenesis
509
+ }
510
+ if (iNdEx + skippy) > l {
511
+ return io.ErrUnexpectedEOF
512
+ }
513
+ iNdEx += skippy
514
+ }
515
+ }
516
+
517
+ if iNdEx > l {
518
+ return io.ErrUnexpectedEOF
519
+ }
520
+ return nil
521
+ }
522
+ func (m *SwingStoreExportDataEntry) Unmarshal(dAtA []byte) error {
523
+ l := len(dAtA)
524
+ iNdEx := 0
525
+ for iNdEx < l {
526
+ preIndex := iNdEx
527
+ var wire uint64
528
+ for shift := uint(0); ; shift += 7 {
529
+ if shift >= 64 {
530
+ return ErrIntOverflowGenesis
531
+ }
532
+ if iNdEx >= l {
533
+ return io.ErrUnexpectedEOF
534
+ }
535
+ b := dAtA[iNdEx]
536
+ iNdEx++
537
+ wire |= uint64(b&0x7F) << shift
538
+ if b < 0x80 {
539
+ break
540
+ }
541
+ }
542
+ fieldNum := int32(wire >> 3)
543
+ wireType := int(wire & 0x7)
544
+ if wireType == 4 {
545
+ return fmt.Errorf("proto: SwingStoreExportDataEntry: wiretype end group for non-group")
546
+ }
547
+ if fieldNum <= 0 {
548
+ return fmt.Errorf("proto: SwingStoreExportDataEntry: illegal tag %d (wire type %d)", fieldNum, wire)
549
+ }
550
+ switch fieldNum {
551
+ case 1:
552
+ if wireType != 2 {
553
+ return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
554
+ }
555
+ var stringLen uint64
556
+ for shift := uint(0); ; shift += 7 {
557
+ if shift >= 64 {
558
+ return ErrIntOverflowGenesis
559
+ }
560
+ if iNdEx >= l {
561
+ return io.ErrUnexpectedEOF
562
+ }
563
+ b := dAtA[iNdEx]
564
+ iNdEx++
565
+ stringLen |= uint64(b&0x7F) << shift
566
+ if b < 0x80 {
567
+ break
568
+ }
569
+ }
570
+ intStringLen := int(stringLen)
571
+ if intStringLen < 0 {
572
+ return ErrInvalidLengthGenesis
573
+ }
574
+ postIndex := iNdEx + intStringLen
575
+ if postIndex < 0 {
576
+ return ErrInvalidLengthGenesis
577
+ }
578
+ if postIndex > l {
579
+ return io.ErrUnexpectedEOF
580
+ }
581
+ m.Key = string(dAtA[iNdEx:postIndex])
582
+ iNdEx = postIndex
583
+ case 2:
584
+ if wireType != 2 {
585
+ return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
586
+ }
587
+ var stringLen uint64
588
+ for shift := uint(0); ; shift += 7 {
589
+ if shift >= 64 {
590
+ return ErrIntOverflowGenesis
591
+ }
592
+ if iNdEx >= l {
593
+ return io.ErrUnexpectedEOF
594
+ }
595
+ b := dAtA[iNdEx]
596
+ iNdEx++
597
+ stringLen |= uint64(b&0x7F) << shift
598
+ if b < 0x80 {
599
+ break
600
+ }
601
+ }
602
+ intStringLen := int(stringLen)
603
+ if intStringLen < 0 {
604
+ return ErrInvalidLengthGenesis
605
+ }
606
+ postIndex := iNdEx + intStringLen
607
+ if postIndex < 0 {
608
+ return ErrInvalidLengthGenesis
609
+ }
610
+ if postIndex > l {
611
+ return io.ErrUnexpectedEOF
612
+ }
613
+ m.Value = string(dAtA[iNdEx:postIndex])
614
+ iNdEx = postIndex
272
615
  default:
273
616
  iNdEx = preIndex
274
617
  skippy, err := skipGenesis(dAtA[iNdEx:])
@@ -7,6 +7,7 @@ import (
7
7
  "io"
8
8
  "strings"
9
9
 
10
+ sdkioerrors "cosmossdk.io/errors"
10
11
  "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
11
12
  sdk "github.com/cosmos/cosmos-sdk/types"
12
13
  sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
@@ -28,6 +29,25 @@ var (
28
29
  _ vm.ControllerAdmissionMsg = &MsgWalletSpendAction{}
29
30
  )
30
31
 
32
+ // Contextual information about the message source of an action on an inbound queue.
33
+ // This context should be unique per inboundQueueRecord.
34
+ type ActionContext struct {
35
+ // The block height in which the corresponding action was enqueued
36
+ BlockHeight int64 `json:"blockHeight"`
37
+ // The hash of the cosmos transaction that included the message
38
+ // If the action didn't result from a transaction message, a substitute value
39
+ // may be used. For example the VBANK_BALANCE_UPDATE actions use `x/vbank`.
40
+ TxHash string `json:"txHash"`
41
+ // The index of the message within the transaction. If the action didn't
42
+ // result from a cosmos transaction, a number should be chosen to make the
43
+ // actionContext unique. (for example a counter per block and source module).
44
+ MsgIdx int `json:"msgIdx"`
45
+ }
46
+ type InboundQueueRecord struct {
47
+ Action vm.Jsonable `json:"action"`
48
+ Context ActionContext `json:"context"`
49
+ }
50
+
31
51
  const (
32
52
  // bundleUncompressedSizeLimit is the (exclusive) limit on uncompressed bundle size.
33
53
  // We must ensure there is an exclusive int64 limit in order to detect an underflow.
@@ -48,6 +68,33 @@ func chargeAdmission(ctx sdk.Context, keeper SwingSetKeeper, addr sdk.AccAddress
48
68
  return keeper.ChargeBeans(ctx, addr, beans)
49
69
  }
50
70
 
71
+ // checkSmartWalletProvisioned verifies if a smart wallet message (MsgWalletAction
72
+ // and MsgWalletSpendAction) can be delivered for the owner's address. A message
73
+ // is allowed if a smart wallet is already provisioned for the address, or if the
74
+ // provisioning fee is charged successfully.
75
+ // All messages for non-provisioned smart wallets allowed here will result in
76
+ // an auto-provision action generated by the msg server.
77
+ func checkSmartWalletProvisioned(ctx sdk.Context, keeper SwingSetKeeper, addr sdk.AccAddress) error {
78
+ walletState := keeper.GetSmartWalletState(ctx, addr)
79
+
80
+ switch walletState {
81
+ case SmartWalletStateProvisioned:
82
+ // The address already has a smart wallet
83
+ return nil
84
+ case SmartWalletStatePending:
85
+ // A provision (either explicit or automatic) may be pending execution in
86
+ // the controller, or if we ever allow multiple swingset messages per
87
+ // transaction, a previous message may have provisioned the wallet.
88
+ return nil
89
+ default:
90
+ // Charge for the smart wallet.
91
+ // This is a separate charge from the smart wallet action which triggered the check
92
+ // TODO: Currently this call does not mark the smart wallet provisioning as
93
+ // pending, resulting in multiple provisioning charges for the owner.
94
+ return keeper.ChargeForSmartWallet(ctx, addr)
95
+ }
96
+ }
97
+
51
98
  func NewMsgDeliverInbound(msgs *Messages, submitter sdk.AccAddress) *MsgDeliverInbound {
52
99
  return &MsgDeliverInbound{
53
100
  Messages: msgs.Messages,
@@ -61,7 +108,7 @@ func NewMsgDeliverInbound(msgs *Messages, submitter sdk.AccAddress) *MsgDeliverI
61
108
  func (msg MsgDeliverInbound) CheckAdmissibility(ctx sdk.Context, data interface{}) error {
62
109
  keeper, ok := data.(SwingSetKeeper)
63
110
  if !ok {
64
- return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "data must be a SwingSetKeeper, not a %T", data)
111
+ return sdkioerrors.Wrapf(sdkerrors.ErrInvalidRequest, "data must be a SwingSetKeeper, not a %T", data)
65
112
  }
66
113
 
67
114
  /*
@@ -93,14 +140,14 @@ func (msg MsgDeliverInbound) Type() string { return "eventualSend" }
93
140
  // ValidateBasic runs stateless checks on the message
94
141
  func (msg MsgDeliverInbound) ValidateBasic() error {
95
142
  if msg.Submitter.Empty() {
96
- return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "Submitter address cannot be empty")
143
+ return sdkioerrors.Wrap(sdkerrors.ErrInvalidAddress, "Submitter address cannot be empty")
97
144
  }
98
145
  if len(msg.Messages) != len(msg.Nums) {
99
- return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "Messages and Nums must be the same length")
146
+ return sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, "Messages and Nums must be the same length")
100
147
  }
101
148
  for _, m := range msg.Messages {
102
149
  if len(m) == 0 {
103
- return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "Messages cannot be empty")
150
+ return sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, "Messages cannot be empty")
104
151
  }
105
152
  }
106
153
  return nil
@@ -134,7 +181,12 @@ func NewMsgWalletAction(owner sdk.AccAddress, action string) *MsgWalletAction {
134
181
  func (msg MsgWalletAction) CheckAdmissibility(ctx sdk.Context, data interface{}) error {
135
182
  keeper, ok := data.(SwingSetKeeper)
136
183
  if !ok {
137
- return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "data must be a SwingSetKeeper, not a %T", data)
184
+ return sdkioerrors.Wrapf(sdkerrors.ErrInvalidRequest, "data must be a SwingSetKeeper, not a %T", data)
185
+ }
186
+
187
+ err := checkSmartWalletProvisioned(ctx, keeper, msg.Owner)
188
+ if err != nil {
189
+ return err
138
190
  }
139
191
 
140
192
  return chargeAdmission(ctx, keeper, msg.Owner, []string{msg.Action}, 0)
@@ -179,13 +231,13 @@ func (msg MsgWalletSpendAction) GetSignBytes() []byte {
179
231
  // ValidateBasic runs stateless checks on the message
180
232
  func (msg MsgWalletAction) ValidateBasic() error {
181
233
  if msg.Owner.Empty() {
182
- return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "Owner address cannot be empty")
234
+ return sdkioerrors.Wrap(sdkerrors.ErrInvalidAddress, "Owner address cannot be empty")
183
235
  }
184
236
  if len(strings.TrimSpace(msg.Action)) == 0 {
185
- return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "Action cannot be empty")
237
+ return sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, "Action cannot be empty")
186
238
  }
187
239
  if !json.Valid([]byte(msg.Action)) {
188
- return sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, "Wallet action must be valid JSON")
240
+ return sdkioerrors.Wrap(sdkerrors.ErrJSONUnmarshal, "Wallet action must be valid JSON")
189
241
  }
190
242
  return nil
191
243
  }
@@ -201,7 +253,12 @@ func NewMsgWalletSpendAction(owner sdk.AccAddress, spendAction string) *MsgWalle
201
253
  func (msg MsgWalletSpendAction) CheckAdmissibility(ctx sdk.Context, data interface{}) error {
202
254
  keeper, ok := data.(SwingSetKeeper)
203
255
  if !ok {
204
- return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "data must be a SwingSetKeeper, not a %T", data)
256
+ return sdkioerrors.Wrapf(sdkerrors.ErrInvalidRequest, "data must be a SwingSetKeeper, not a %T", data)
257
+ }
258
+
259
+ err := checkSmartWalletProvisioned(ctx, keeper, msg.Owner)
260
+ if err != nil {
261
+ return err
205
262
  }
206
263
 
207
264
  return chargeAdmission(ctx, keeper, msg.Owner, []string{msg.SpendAction}, 0)
@@ -216,7 +273,7 @@ func (msg MsgWalletSpendAction) GetInboundMsgCount() int32 {
216
273
  func (msg MsgWalletSpendAction) IsHighPriority(ctx sdk.Context, data interface{}) (bool, error) {
217
274
  keeper, ok := data.(SwingSetKeeper)
218
275
  if !ok {
219
- return false, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "data must be a SwingSetKeeper, not a %T", data)
276
+ return false, sdkioerrors.Wrapf(sdkerrors.ErrInvalidRequest, "data must be a SwingSetKeeper, not a %T", data)
220
277
  }
221
278
 
222
279
  return keeper.IsHighPriorityAddress(ctx, msg.Owner)
@@ -229,13 +286,13 @@ func (msg MsgWalletSpendAction) GetSigners() []sdk.AccAddress {
229
286
  // ValidateBasic runs stateless checks on the message
230
287
  func (msg MsgWalletSpendAction) ValidateBasic() error {
231
288
  if msg.Owner.Empty() {
232
- return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "Owner address cannot be empty")
289
+ return sdkioerrors.Wrap(sdkerrors.ErrInvalidAddress, "Owner address cannot be empty")
233
290
  }
234
291
  if len(strings.TrimSpace(msg.SpendAction)) == 0 {
235
- return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "Spend action cannot be empty")
292
+ return sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, "Spend action cannot be empty")
236
293
  }
237
294
  if !json.Valid([]byte(msg.SpendAction)) {
238
- return sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, "Wallet spend action must be valid JSON")
295
+ return sdkioerrors.Wrap(sdkerrors.ErrJSONUnmarshal, "Wallet spend action must be valid JSON")
239
296
  }
240
297
  return nil
241
298
  }
@@ -258,21 +315,25 @@ func (msg MsgProvision) Type() string { return "provision" }
258
315
  // ValidateBasic runs stateless checks on the message
259
316
  func (msg MsgProvision) ValidateBasic() error {
260
317
  if msg.Submitter.Empty() {
261
- return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "Submitter address cannot be empty")
318
+ return sdkioerrors.Wrap(sdkerrors.ErrInvalidAddress, "Submitter address cannot be empty")
262
319
  }
263
320
  if msg.Address.Empty() {
264
- return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "Peer address cannot be empty")
321
+ return sdkioerrors.Wrap(sdkerrors.ErrInvalidAddress, "Peer address cannot be empty")
265
322
  }
266
323
  if len(msg.Nickname) == 0 {
267
- return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "Nickname cannot be empty")
324
+ return sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, "Nickname cannot be empty")
268
325
  }
269
326
  return nil
270
327
  }
271
328
 
272
329
  // CheckAdmissibility implements the vm.ControllerAdmissionMsg interface.
273
330
  func (msg MsgProvision) CheckAdmissibility(ctx sdk.Context, data interface{}) error {
274
- // We have our own fee charging mechanism within Swingset itself,
275
- // so there are no admission restriction here.
331
+ // TODO: consider disallowing a provision message for a smart wallet if the
332
+ // smart wallet is already provisioned or pending provisioning. However we
333
+ // currently do not track whether a smart wallet is pending provisioning.
334
+
335
+ // For explicitly provisioning, swingset will take care of charging,
336
+ // so we skip admission fees.
276
337
  return nil
277
338
  }
278
339
 
@@ -310,7 +371,7 @@ func NewMsgInstallBundle(bundleJson string, submitter sdk.AccAddress) *MsgInstal
310
371
  func (msg MsgInstallBundle) CheckAdmissibility(ctx sdk.Context, data interface{}) error {
311
372
  keeper, ok := data.(SwingSetKeeper)
312
373
  if !ok {
313
- return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "data must be a SwingSetKeeper, not a %T", data)
374
+ return sdkioerrors.Wrapf(sdkerrors.ErrInvalidRequest, "data must be a SwingSetKeeper, not a %T", data)
314
375
  }
315
376
  return chargeAdmission(ctx, keeper, msg.Submitter, []string{msg.Bundle}, msg.ExpectedUncompressedSize())
316
377
  }
@@ -334,23 +395,23 @@ func (msg MsgInstallBundle) Type() string { return "installBundle" }
334
395
  // ValidateBasic runs stateless checks on the message
335
396
  func (msg MsgInstallBundle) ValidateBasic() error {
336
397
  if msg.Submitter.Empty() {
337
- return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "Submitter address cannot be empty")
398
+ return sdkioerrors.Wrap(sdkerrors.ErrInvalidAddress, "Submitter address cannot be empty")
338
399
  }
339
400
  if len(msg.Bundle) == 0 && len(msg.CompressedBundle) == 0 {
340
- return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "Bundle cannot be empty")
401
+ return sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, "Bundle cannot be empty")
341
402
  }
342
403
  if len(msg.Bundle) != 0 && len(msg.CompressedBundle) != 0 {
343
- return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "Cannot submit both a compressed and an uncompressed bundle at the same time")
404
+ return sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, "Cannot submit both a compressed and an uncompressed bundle at the same time")
344
405
  }
345
406
  if len(msg.Bundle) > 0 && msg.UncompressedSize != 0 {
346
- return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "Uncompressed size cannot be set without a compressed bundle")
407
+ return sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, "Uncompressed size cannot be set without a compressed bundle")
347
408
  }
348
409
  if len(msg.CompressedBundle) > 0 && !(msg.UncompressedSize > 0) {
349
- return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "Uncompressed size must be positive")
410
+ return sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, "Uncompressed size must be positive")
350
411
  }
351
412
  if msg.UncompressedSize >= bundleUncompressedSizeLimit {
352
413
  // must enforce a limit to avoid overflow when computing its successor in Uncompress()
353
- return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "Uncompressed size out of range")
414
+ return sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, "Uncompressed size out of range")
354
415
  }
355
416
  // We don't check the accuracy of the uncompressed size here, since it could comsume significant CPU.
356
417
  return nil
@@ -413,7 +474,7 @@ func (msg *MsgInstallBundle) Uncompress() error {
413
474
  return err
414
475
  }
415
476
  if n != msg.UncompressedSize {
416
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Uncompressed size does not match expected value")
477
+ return sdkioerrors.Wrap(sdkerrors.ErrInvalidRequest, "Uncompressed size does not match expected value")
417
478
  }
418
479
  msg.Bundle = buf.String()
419
480
  msg.CompressedBundle = []byte{}