@agoric/cosmos 0.35.0-u19.2 → 0.35.0-u21.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 (124) hide show
  1. package/.clang-format +116 -0
  2. package/CHANGELOG.md +18 -18
  3. package/Makefile +38 -67
  4. package/ante/ante.go +2 -2
  5. package/ante/inbound_test.go +1 -1
  6. package/app/app.go +173 -142
  7. package/app/export.go +6 -6
  8. package/app/genesis.go +4 -0
  9. package/app/sim_test.go +299 -50
  10. package/app/upgrade.go +142 -96
  11. package/app/upgrade_test.go +63 -0
  12. package/cmd/agd/agvm.go +1 -1
  13. package/cmd/agd/main.go +1 -1
  14. package/cmd/libdaemon/main.go +34 -1
  15. package/daemon/cmd/root.go +26 -35
  16. package/daemon/cmd/root_test.go +5 -4
  17. package/daemon/cmd/testnet.go +221 -95
  18. package/daemon/main.go +1 -0
  19. package/git-revision.txt +1 -1
  20. package/go.mod +93 -58
  21. package/go.sum +148 -95
  22. package/package.json +6 -3
  23. package/proto/agoric/swingset/genesis.proto +7 -11
  24. package/proto/agoric/swingset/msgs.proto +56 -75
  25. package/proto/agoric/swingset/query.proto +7 -10
  26. package/proto/agoric/swingset/swingset.proto +79 -108
  27. package/proto/agoric/vbank/genesis.proto +5 -5
  28. package/proto/agoric/vbank/msgs.proto +1 -2
  29. package/proto/agoric/vbank/vbank.proto +42 -52
  30. package/proto/agoric/vibc/msgs.proto +8 -11
  31. package/proto/agoric/vstorage/genesis.proto +6 -9
  32. package/proto/agoric/vstorage/query.proto +19 -48
  33. package/proto/agoric/vstorage/vstorage.proto +4 -10
  34. package/proto/agoric/vtransfer/genesis.proto +7 -7
  35. package/proto/buf.gen.gogo.yaml +8 -0
  36. package/proto/buf.gen.pulsar.yaml +17 -0
  37. package/proto/buf.gen.swagger.yaml +5 -0
  38. package/proto/buf.yaml +10 -0
  39. package/scripts/protocgen.sh +14 -21
  40. package/third_party/proto/amino/amino.proto +79 -0
  41. package/third_party/proto/cosmos/base/v1beta1/coin.proto +7 -2
  42. package/third_party/proto/cosmos/ics23/v1/proofs.proto +243 -0
  43. package/third_party/proto/cosmos/msg/v1/msg.proto +30 -0
  44. package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +17 -5
  45. package/third_party/proto/cosmos_proto/cosmos.proto +16 -1
  46. package/third_party/proto/gogoproto/gogo.proto +2 -2
  47. package/third_party/proto/google/protobuf/any.proto +6 -3
  48. package/third_party/proto/ibc/core/channel/v1/channel.proto +1 -1
  49. package/third_party/proto/ibc/core/client/v1/client.proto +4 -2
  50. package/types/address_hooks.go +5 -12
  51. package/types/address_hooks_test.go +34 -34
  52. package/types/codec.go +23 -0
  53. package/types/ibc_packet.go +64 -0
  54. package/types/ibc_packet_test.go +117 -0
  55. package/vm/client.go +32 -7
  56. package/vm/proto_json.go +2 -2
  57. package/x/swingset/abci.go +1 -1
  58. package/x/swingset/alias.go +0 -1
  59. package/x/swingset/config.go +1 -1
  60. package/x/swingset/keeper/extension_snapshotter.go +1 -1
  61. package/x/swingset/keeper/extension_snapshotter_test.go +1 -1
  62. package/x/swingset/keeper/keeper.go +1 -1
  63. package/x/swingset/keeper/keeper_test.go +1 -1
  64. package/x/swingset/keeper/querier.go +1 -30
  65. package/x/swingset/keeper/swing_store_exports_handler.go +1 -1
  66. package/x/swingset/keeper/swing_store_exports_handler_test.go +1 -1
  67. package/x/swingset/module.go +1 -14
  68. package/x/swingset/types/default-params.go +24 -16
  69. package/x/swingset/types/genesis.pb.go +2 -2
  70. package/x/swingset/types/msgs.pb.go +4 -3
  71. package/x/swingset/types/msgs_test.go +1 -1
  72. package/x/swingset/types/query.pb.go +4 -3
  73. package/x/swingset/types/swingset.pb.go +2 -2
  74. package/x/vbank/genesis.go +1 -1
  75. package/x/vbank/keeper/querier.go +1 -21
  76. package/x/vbank/module.go +1 -16
  77. package/x/vbank/types/genesis.pb.go +2 -2
  78. package/x/vbank/types/msgs.pb.go +3 -2
  79. package/x/vbank/types/query.pb.go +4 -3
  80. package/x/vbank/types/vbank.pb.go +2 -2
  81. package/x/vbank/vbank_test.go +95 -16
  82. package/x/vibc/keeper/keeper.go +8 -5
  83. package/x/vibc/keeper/migrations.go +36 -0
  84. package/x/vibc/keeper/triggers.go +6 -32
  85. package/x/vibc/module.go +9 -17
  86. package/x/vibc/types/expected_keepers.go +6 -10
  87. package/x/vibc/types/ibc_module.go +30 -20
  88. package/x/vibc/types/msgs.go +1 -1
  89. package/x/vibc/types/msgs.pb.go +5 -4
  90. package/x/vibc/types/receiver.go +17 -17
  91. package/x/vlocalchain/keeper/keeper.go +3 -3
  92. package/x/vlocalchain/types/vlocalchain.pb.go +1 -1
  93. package/x/vlocalchain/vlocalchain_test.go +6 -6
  94. package/x/vstorage/README.md +0 -8
  95. package/x/vstorage/alias.go +0 -1
  96. package/x/vstorage/client/cli/query.go +1 -1
  97. package/x/vstorage/genesis.go +1 -1
  98. package/x/vstorage/keeper/keeper.go +40 -5
  99. package/x/vstorage/keeper/keeper_test.go +24 -24
  100. package/x/vstorage/keeper/querier.go +1 -32
  101. package/x/vstorage/keeper/querier_test.go +41 -6
  102. package/x/vstorage/module.go +1 -14
  103. package/x/vstorage/types/genesis.pb.go +2 -2
  104. package/x/vstorage/types/path_keys.go +7 -8
  105. package/x/vstorage/types/query.pb.go +8 -5
  106. package/x/vstorage/types/vstorage.pb.go +2 -2
  107. package/x/vstorage/vstorage_test.go +3 -3
  108. package/x/vtransfer/genesis.go +1 -1
  109. package/x/vtransfer/handler.go +4 -2
  110. package/x/vtransfer/ibc_middleware.go +4 -4
  111. package/x/vtransfer/ibc_middleware_test.go +14 -16
  112. package/x/vtransfer/keeper/keeper.go +38 -48
  113. package/x/vtransfer/module.go +1 -14
  114. package/x/vtransfer/types/expected_keepers.go +2 -18
  115. package/x/vtransfer/types/genesis.pb.go +2 -2
  116. package/x/vtransfer/utils_test.go +15 -15
  117. package/daemon/cmd/genaccounts.go +0 -195
  118. package/e2e_test/Makefile +0 -29
  119. package/e2e_test/README.md +0 -100
  120. package/e2e_test/go.mod +0 -239
  121. package/e2e_test/go.sum +0 -1323
  122. package/e2e_test/ibc_conformance_test.go +0 -56
  123. package/e2e_test/pfm_test.go +0 -613
  124. package/e2e_test/util.go +0 -271
@@ -0,0 +1,243 @@
1
+ syntax = "proto3";
2
+
3
+ package cosmos.ics23.v1;
4
+
5
+ option go_package = "github.com/cosmos/ics23/go;ics23";
6
+
7
+ enum HashOp {
8
+ // NO_HASH is the default if no data passed. Note this is an illegal argument some places.
9
+ NO_HASH = 0;
10
+ SHA256 = 1;
11
+ SHA512 = 2;
12
+ KECCAK256 = 3;
13
+ RIPEMD160 = 4;
14
+ BITCOIN = 5; // ripemd160(sha256(x))
15
+ SHA512_256 = 6;
16
+ BLAKE2B_512 = 7;
17
+ BLAKE2S_256 = 8;
18
+ BLAKE3 = 9;
19
+ }
20
+
21
+ /**
22
+ LengthOp defines how to process the key and value of the LeafOp
23
+ to include length information. After encoding the length with the given
24
+ algorithm, the length will be prepended to the key and value bytes.
25
+ (Each one with it's own encoded length)
26
+ */
27
+ enum LengthOp {
28
+ // NO_PREFIX don't include any length info
29
+ NO_PREFIX = 0;
30
+ // VAR_PROTO uses protobuf (and go-amino) varint encoding of the length
31
+ VAR_PROTO = 1;
32
+ // VAR_RLP uses rlp int encoding of the length
33
+ VAR_RLP = 2;
34
+ // FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer
35
+ FIXED32_BIG = 3;
36
+ // FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer
37
+ FIXED32_LITTLE = 4;
38
+ // FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer
39
+ FIXED64_BIG = 5;
40
+ // FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer
41
+ FIXED64_LITTLE = 6;
42
+ // REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output)
43
+ REQUIRE_32_BYTES = 7;
44
+ // REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output)
45
+ REQUIRE_64_BYTES = 8;
46
+ }
47
+
48
+ /**
49
+ ExistenceProof takes a key and a value and a set of steps to perform on it.
50
+ The result of peforming all these steps will provide a "root hash", which can
51
+ be compared to the value in a header.
52
+
53
+ Since it is computationally infeasible to produce a hash collission for any of the used
54
+ cryptographic hash functions, if someone can provide a series of operations to transform
55
+ a given key and value into a root hash that matches some trusted root, these key and values
56
+ must be in the referenced merkle tree.
57
+
58
+ The only possible issue is maliablity in LeafOp, such as providing extra prefix data,
59
+ which should be controlled by a spec. Eg. with lengthOp as NONE,
60
+ prefix = FOO, key = BAR, value = CHOICE
61
+ and
62
+ prefix = F, key = OOBAR, value = CHOICE
63
+ would produce the same value.
64
+
65
+ With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field
66
+ in the ProofSpec is valuable to prevent this mutability. And why all trees should
67
+ length-prefix the data before hashing it.
68
+ */
69
+ message ExistenceProof {
70
+ bytes key = 1;
71
+ bytes value = 2;
72
+ LeafOp leaf = 3;
73
+ repeated InnerOp path = 4;
74
+ }
75
+
76
+ /*
77
+ NonExistenceProof takes a proof of two neighbors, one left of the desired key,
78
+ one right of the desired key. If both proofs are valid AND they are neighbors,
79
+ then there is no valid proof for the given key.
80
+ */
81
+ message NonExistenceProof {
82
+ bytes key = 1; // TODO: remove this as unnecessary??? we prove a range
83
+ ExistenceProof left = 2;
84
+ ExistenceProof right = 3;
85
+ }
86
+
87
+ /*
88
+ CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages
89
+ */
90
+ message CommitmentProof {
91
+ oneof proof {
92
+ ExistenceProof exist = 1;
93
+ NonExistenceProof nonexist = 2;
94
+ BatchProof batch = 3;
95
+ CompressedBatchProof compressed = 4;
96
+ }
97
+ }
98
+
99
+ /**
100
+ LeafOp represents the raw key-value data we wish to prove, and
101
+ must be flexible to represent the internal transformation from
102
+ the original key-value pairs into the basis hash, for many existing
103
+ merkle trees.
104
+
105
+ key and value are passed in. So that the signature of this operation is:
106
+ leafOp(key, value) -> output
107
+
108
+ To process this, first prehash the keys and values if needed (ANY means no hash in this case):
109
+ hkey = prehashKey(key)
110
+ hvalue = prehashValue(value)
111
+
112
+ Then combine the bytes, and hash it
113
+ output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue)
114
+ */
115
+ message LeafOp {
116
+ HashOp hash = 1;
117
+ HashOp prehash_key = 2;
118
+ HashOp prehash_value = 3;
119
+ LengthOp length = 4;
120
+ // prefix is a fixed bytes that may optionally be included at the beginning to differentiate
121
+ // a leaf node from an inner node.
122
+ bytes prefix = 5;
123
+ }
124
+
125
+ /**
126
+ InnerOp represents a merkle-proof step that is not a leaf.
127
+ It represents concatenating two children and hashing them to provide the next result.
128
+
129
+ The result of the previous step is passed in, so the signature of this op is:
130
+ innerOp(child) -> output
131
+
132
+ The result of applying InnerOp should be:
133
+ output = op.hash(op.prefix || child || op.suffix)
134
+
135
+ where the || operator is concatenation of binary data,
136
+ and child is the result of hashing all the tree below this step.
137
+
138
+ Any special data, like prepending child with the length, or prepending the entire operation with
139
+ some value to differentiate from leaf nodes, should be included in prefix and suffix.
140
+ If either of prefix or suffix is empty, we just treat it as an empty string
141
+ */
142
+ message InnerOp {
143
+ HashOp hash = 1;
144
+ bytes prefix = 2;
145
+ bytes suffix = 3;
146
+ }
147
+
148
+ /**
149
+ ProofSpec defines what the expected parameters are for a given proof type.
150
+ This can be stored in the client and used to validate any incoming proofs.
151
+
152
+ verify(ProofSpec, Proof) -> Proof | Error
153
+
154
+ As demonstrated in tests, if we don't fix the algorithm used to calculate the
155
+ LeafHash for a given tree, there are many possible key-value pairs that can
156
+ generate a given hash (by interpretting the preimage differently).
157
+ We need this for proper security, requires client knows a priori what
158
+ tree format server uses. But not in code, rather a configuration object.
159
+ */
160
+ message ProofSpec {
161
+ // any field in the ExistenceProof must be the same as in this spec.
162
+ // except Prefix, which is just the first bytes of prefix (spec can be longer)
163
+ LeafOp leaf_spec = 1;
164
+ InnerSpec inner_spec = 2;
165
+ // max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries)
166
+ // the max_depth is interpreted as 128 if set to 0
167
+ int32 max_depth = 3;
168
+ // min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries)
169
+ int32 min_depth = 4;
170
+ // prehash_key_before_comparison is a flag that indicates whether to use the
171
+ // prehash_key specified by LeafOp to compare lexical ordering of keys for
172
+ // non-existence proofs.
173
+ bool prehash_key_before_comparison = 5;
174
+ }
175
+
176
+ /*
177
+ InnerSpec contains all store-specific structure info to determine if two proofs from a
178
+ given store are neighbors.
179
+
180
+ This enables:
181
+
182
+ isLeftMost(spec: InnerSpec, op: InnerOp)
183
+ isRightMost(spec: InnerSpec, op: InnerOp)
184
+ isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp)
185
+ */
186
+ message InnerSpec {
187
+ // Child order is the ordering of the children node, must count from 0
188
+ // iavl tree is [0, 1] (left then right)
189
+ // merk is [0, 2, 1] (left, right, here)
190
+ repeated int32 child_order = 1;
191
+ int32 child_size = 2;
192
+ int32 min_prefix_length = 3;
193
+ // the max prefix length must be less than the minimum prefix length + child size
194
+ int32 max_prefix_length = 4;
195
+ // empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0)
196
+ bytes empty_child = 5;
197
+ // hash is the algorithm that must be used for each InnerOp
198
+ HashOp hash = 6;
199
+ }
200
+
201
+ /*
202
+ BatchProof is a group of multiple proof types than can be compressed
203
+ */
204
+ message BatchProof {
205
+ repeated BatchEntry entries = 1;
206
+ }
207
+
208
+ // Use BatchEntry not CommitmentProof, to avoid recursion
209
+ message BatchEntry {
210
+ oneof proof {
211
+ ExistenceProof exist = 1;
212
+ NonExistenceProof nonexist = 2;
213
+ }
214
+ }
215
+
216
+ /****** all items here are compressed forms *******/
217
+
218
+ message CompressedBatchProof {
219
+ repeated CompressedBatchEntry entries = 1;
220
+ repeated InnerOp lookup_inners = 2;
221
+ }
222
+
223
+ // Use BatchEntry not CommitmentProof, to avoid recursion
224
+ message CompressedBatchEntry {
225
+ oneof proof {
226
+ CompressedExistenceProof exist = 1;
227
+ CompressedNonExistenceProof nonexist = 2;
228
+ }
229
+ }
230
+
231
+ message CompressedExistenceProof {
232
+ bytes key = 1;
233
+ bytes value = 2;
234
+ LeafOp leaf = 3;
235
+ // these are indexes into the lookup_inners table in CompressedBatchProof
236
+ repeated int32 path = 4;
237
+ }
238
+
239
+ message CompressedNonExistenceProof {
240
+ bytes key = 1; // TODO: remove this as unnecessary??? we prove a range
241
+ CompressedExistenceProof left = 2;
242
+ CompressedExistenceProof right = 3;
243
+ }
@@ -0,0 +1,30 @@
1
+ syntax = "proto3";
2
+
3
+ package cosmos.msg.v1;
4
+
5
+ import "google/protobuf/descriptor.proto";
6
+
7
+ // TODO(fdymylja): once we fully migrate to protov2 the go_package needs to be updated.
8
+ // We need this right now because gogoproto codegen needs to import the extension.
9
+ option go_package = "github.com/cosmos/cosmos-sdk/types/msgservice";
10
+
11
+ extend google.protobuf.ServiceOptions {
12
+ // service indicates that the service is a Msg service and that requests
13
+ // must be transported via blockchain transactions rather than gRPC.
14
+ // Tooling can use this annotation to distinguish between Msg services and
15
+ // other types of services via reflection.
16
+ bool service = 11110000;
17
+ }
18
+
19
+ extend google.protobuf.MessageOptions {
20
+ // signer must be used in cosmos messages in order
21
+ // to signal to external clients which fields in a
22
+ // given cosmos message must be filled with signer
23
+ // information (address).
24
+ // The field must be the protobuf name of the message
25
+ // field extended with this MessageOption.
26
+ // The field must either be of string kind, or of message
27
+ // kind in case the signer information is contained within
28
+ // a message inside the cosmos message.
29
+ repeated string signer = 11110000;
30
+ }
@@ -5,12 +5,14 @@ import "google/protobuf/any.proto";
5
5
  import "gogoproto/gogo.proto";
6
6
  import "google/protobuf/timestamp.proto";
7
7
  import "cosmos_proto/cosmos.proto";
8
+ import "amino/amino.proto";
8
9
 
9
10
  option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types";
10
11
  option (gogoproto.goproto_getters_all) = false;
11
12
 
12
13
  // Plan specifies information about a planned upgrade and when it should occur.
13
14
  message Plan {
15
+ option (amino.name) = "cosmos-sdk/Plan";
14
16
  option (gogoproto.equal) = true;
15
17
  option (gogoproto.goproto_stringer) = false;
16
18
 
@@ -26,10 +28,10 @@ message Plan {
26
28
  // Deprecated: Time based upgrades have been deprecated. Time based upgrade logic
27
29
  // has been removed from the SDK.
28
30
  // If this field is not empty, an error will be thrown.
29
- google.protobuf.Timestamp time = 2 [deprecated = true, (gogoproto.stdtime) = true, (gogoproto.nullable) = false];
31
+ google.protobuf.Timestamp time = 2
32
+ [deprecated = true, (gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true];
30
33
 
31
34
  // The height at which the upgrade must be performed.
32
- // Only used if Time is not set.
33
35
  int64 height = 3;
34
36
 
35
37
  // Any application specific upgrade info to be included on-chain
@@ -49,12 +51,18 @@ message Plan {
49
51
  message SoftwareUpgradeProposal {
50
52
  option deprecated = true;
51
53
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
54
+ option (amino.name) = "cosmos-sdk/SoftwareUpgradeProposal";
52
55
  option (gogoproto.equal) = true;
53
56
  option (gogoproto.goproto_stringer) = false;
54
57
 
55
- string title = 1;
58
+ // title of the proposal
59
+ string title = 1;
60
+
61
+ // description of the proposal
56
62
  string description = 2;
57
- Plan plan = 3 [(gogoproto.nullable) = false];
63
+
64
+ // plan of the proposal
65
+ Plan plan = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
58
66
  }
59
67
 
60
68
  // CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software
@@ -64,10 +72,14 @@ message SoftwareUpgradeProposal {
64
72
  message CancelSoftwareUpgradeProposal {
65
73
  option deprecated = true;
66
74
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
75
+ option (amino.name) = "cosmos-sdk/CancelSoftwareUpgradeProposal";
67
76
  option (gogoproto.equal) = true;
68
77
  option (gogoproto.goproto_stringer) = false;
69
78
 
70
- string title = 1;
79
+ // title of the proposal
80
+ string title = 1;
81
+
82
+ // description of the proposal
71
83
  string description = 2;
72
84
  }
73
85
 
@@ -5,6 +5,12 @@ import "google/protobuf/descriptor.proto";
5
5
 
6
6
  option go_package = "github.com/cosmos/cosmos-proto;cosmos_proto";
7
7
 
8
+ extend google.protobuf.MethodOptions {
9
+
10
+ // method_added_in is used to indicate from which version the method was added.
11
+ string method_added_in = 93001;
12
+ }
13
+
8
14
  extend google.protobuf.MessageOptions {
9
15
 
10
16
  // implements_interface is used to indicate the type name of the interface
@@ -13,6 +19,9 @@ extend google.protobuf.MessageOptions {
13
19
  // interfaces. Interfaces should be declared using a declare_interface
14
20
  // file option.
15
21
  repeated string implements_interface = 93001;
22
+
23
+ // message_added_in is used to indicate from which version the message was added.
24
+ string message_added_in = 93002;
16
25
  }
17
26
 
18
27
  extend google.protobuf.FieldOptions {
@@ -27,6 +36,9 @@ extend google.protobuf.FieldOptions {
27
36
  // generators may choose to use this information to map this field to a
28
37
  // language-specific type representing the scalar.
29
38
  string scalar = 93002;
39
+
40
+ // field_added_in is used to indicate from which version the field was added.
41
+ string field_added_in = 93003;
30
42
  }
31
43
 
32
44
  extend google.protobuf.FileOptions {
@@ -46,6 +58,9 @@ extend google.protobuf.FileOptions {
46
58
  // expected that the declaration will be found in a protobuf file named
47
59
  // a/b/scalars.proto in the file descriptor set.
48
60
  repeated ScalarDescriptor declare_scalar = 793022;
61
+
62
+ // file_added_in is used to indicate from which the version the file was added.
63
+ string file_added_in = 793023;
49
64
  }
50
65
 
51
66
  // InterfaceDescriptor describes an interface type to be used with
@@ -94,4 +109,4 @@ enum ScalarType {
94
109
  SCALAR_TYPE_UNSPECIFIED = 0;
95
110
  SCALAR_TYPE_STRING = 1;
96
111
  SCALAR_TYPE_BYTES = 2;
97
- }
112
+ }
@@ -1,7 +1,7 @@
1
1
  // Protocol Buffers for Go with Gadgets
2
2
  //
3
3
  // Copyright (c) 2013, The GoGo Authors. All rights reserved.
4
- // http://github.com/gogo/protobuf
4
+ // http://github.com/cosmos/gogoproto
5
5
  //
6
6
  // Redistribution and use in source and binary forms, with or without
7
7
  // modification, are permitted provided that the following conditions are
@@ -33,7 +33,7 @@ import "google/protobuf/descriptor.proto";
33
33
 
34
34
  option java_package = "com.google.protobuf";
35
35
  option java_outer_classname = "GoGoProtos";
36
- option go_package = "github.com/gogo/protobuf/gogoproto";
36
+ option go_package = "github.com/cosmos/gogoproto/gogoproto";
37
37
 
38
38
  extend google.protobuf.EnumOptions {
39
39
  optional bool goproto_enum_prefix = 62001;
@@ -33,7 +33,7 @@ syntax = "proto3";
33
33
  package google.protobuf;
34
34
 
35
35
  option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36
- option go_package = "types";
36
+ option go_package = "google.golang.org/protobuf/types/known/anypb";
37
37
  option java_package = "com.google.protobuf";
38
38
  option java_outer_classname = "AnyProto";
39
39
  option java_multiple_files = true;
@@ -77,10 +77,13 @@ option objc_class_prefix = "GPB";
77
77
  // Example 4: Pack and unpack a message in Go
78
78
  //
79
79
  // foo := &pb.Foo{...}
80
- // any, err := ptypes.MarshalAny(foo)
80
+ // any, err := anypb.New(foo)
81
+ // if err != nil {
82
+ // ...
83
+ // }
81
84
  // ...
82
85
  // foo := &pb.Foo{}
83
- // if err := ptypes.UnmarshalAny(any, foo); err != nil {
86
+ // if err := any.UnmarshalTo(foo); err != nil {
84
87
  // ...
85
88
  // }
86
89
  //
@@ -2,7 +2,7 @@ syntax = "proto3";
2
2
 
3
3
  package ibc.core.channel.v1;
4
4
 
5
- option go_package = "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types";
5
+ option go_package = "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types";
6
6
 
7
7
  import "gogoproto/gogo.proto";
8
8
  import "ibc/core/client/v1/client.proto";
@@ -2,7 +2,7 @@ syntax = "proto3";
2
2
 
3
3
  package ibc.core.client.v1;
4
4
 
5
- option go_package = "github.com/cosmos/ibc-go/v6/modules/core/02-client/types";
5
+ option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types";
6
6
 
7
7
  import "gogoproto/gogo.proto";
8
8
  import "google/protobuf/any.proto";
@@ -98,6 +98,8 @@ message Height {
98
98
 
99
99
  // Params defines the set of IBC light client parameters.
100
100
  message Params {
101
- // allowed_clients defines the list of allowed client state types.
101
+ // allowed_clients defines the list of allowed client state types which can be created
102
+ // and interacted with. If a client type is removed from the allowed clients list, usage
103
+ // of this client will be disabled until it is added again to the list.
102
104
  repeated string allowed_clients = 1 [(gogoproto.moretags) = "yaml:\"allowed_clients\""];
103
105
  }
@@ -7,10 +7,8 @@ import (
7
7
  "github.com/cosmos/cosmos-sdk/codec"
8
8
  "github.com/cosmos/cosmos-sdk/types/bech32"
9
9
 
10
- transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
11
- clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
12
- channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
13
- ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported"
10
+ transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
11
+ ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
14
12
  )
15
13
 
16
14
  type AddressRole string
@@ -176,7 +174,7 @@ func extractBaseTransferData(transferData transfertypes.FungibleTokenPacketData,
176
174
  // address is exactly the original address.
177
175
  // If newPacket is not nil, it is populated with a new transfer packet whose
178
176
  // corresponding Sender or Receiver is replaced with the extracted base address.
179
- func ExtractBaseAddressFromPacket(cdc codec.Codec, packet ibcexported.PacketI, role AddressRole, newPacket *channeltypes.Packet) (string, error) {
177
+ func ExtractBaseAddressFromPacket(cdc codec.Codec, packet ibcexported.PacketI, role AddressRole, newPacket *IBCPacket) (string, error) {
180
178
  var newDataP *[]byte
181
179
  if newPacket != nil {
182
180
  // Capture the data for the new packet.
@@ -192,13 +190,8 @@ func ExtractBaseAddressFromPacket(cdc codec.Codec, packet ibcexported.PacketI, r
192
190
  }
193
191
 
194
192
  // Create a new packet with the new transfer packet data.
195
- *newPacket = channeltypes.NewPacket(
196
- *newDataP, packet.GetSequence(),
197
- packet.GetSourcePort(), packet.GetSourceChannel(),
198
- packet.GetDestPort(), packet.GetDestChannel(),
199
- clienttypes.MustParseHeight(packet.GetTimeoutHeight().String()),
200
- packet.GetTimeoutTimestamp(),
201
- )
193
+ *newPacket = CopyToIBCPacket(packet)
194
+ newPacket.Data = *newDataP
202
195
 
203
196
  return target, nil
204
197
  }
@@ -8,11 +8,11 @@ import (
8
8
  codec "github.com/cosmos/cosmos-sdk/codec"
9
9
  cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
10
10
 
11
- transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
12
- clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
13
- channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
11
+ transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
12
+ clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
13
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
14
14
 
15
- "github.com/Agoric/agoric-sdk/golang/cosmos/types"
15
+ agtypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
16
16
  )
17
17
 
18
18
  func TestSplitHookedAddress(t *testing.T) {
@@ -49,7 +49,7 @@ func TestSplitHookedAddress(t *testing.T) {
49
49
  for _, tc := range cases {
50
50
  tc := tc
51
51
  t.Run(tc.name, func(t *testing.T) {
52
- baseAddr, hookData, err := types.SplitHookedAddress(tc.hook)
52
+ baseAddr, hookData, err := agtypes.SplitHookedAddress(tc.hook)
53
53
  if len(tc.err) > 0 {
54
54
  require.Error(t, err)
55
55
  require.Equal(t, tc.err, err.Error())
@@ -90,9 +90,9 @@ func TestExtractBaseAddress(t *testing.T) {
90
90
  for _, s := range suffixes {
91
91
  s := s
92
92
  t.Run(b.name+" "+s.hookStr, func(t *testing.T) {
93
- addrHook, err := types.JoinHookedAddress(b.addr, []byte(s.hookStr))
93
+ addrHook, err := agtypes.JoinHookedAddress(b.addr, []byte(s.hookStr))
94
94
  require.NoError(t, err)
95
- addr, err := types.ExtractBaseAddress(addrHook)
95
+ addr, err := agtypes.ExtractBaseAddress(addrHook)
96
96
  if s.isErr {
97
97
  require.Error(t, err)
98
98
  } else {
@@ -101,7 +101,7 @@ func TestExtractBaseAddress(t *testing.T) {
101
101
  require.NotEqual(t, b.addr, addr)
102
102
  } else {
103
103
  require.Equal(t, b.addr, addr)
104
- addr, hookData, err := types.SplitHookedAddress(addrHook)
104
+ addr, hookData, err := agtypes.SplitHookedAddress(addrHook)
105
105
  require.NoError(t, err)
106
106
  require.Equal(t, b.addr, addr)
107
107
  require.Equal(t, s.hookStr, string(hookData))
@@ -121,48 +121,48 @@ func TestExtractBaseAddressFromPacket(t *testing.T) {
121
121
 
122
122
  cosmosAddr := "cosmos1qqxuevtt"
123
123
  cosmosHookStr := "?foo=bar&baz=bot#fragment"
124
- cosmosHook, err := types.JoinHookedAddress(cosmosAddr, []byte(cosmosHookStr))
124
+ cosmosHook, err := agtypes.JoinHookedAddress(cosmosAddr, []byte(cosmosHookStr))
125
125
  require.NoError(t, err)
126
- addr, hookData, err := types.SplitHookedAddress(cosmosHook)
126
+ addr, hookData, err := agtypes.SplitHookedAddress(cosmosHook)
127
127
  require.NoError(t, err)
128
128
  require.Equal(t, cosmosAddr, addr)
129
129
  require.Equal(t, cosmosHookStr, string(hookData))
130
130
 
131
131
  agoricAddr := "agoric1qqp0e5ys"
132
132
  agoricHookStr := "?bingo=again"
133
- agoricHook, err := types.JoinHookedAddress(agoricAddr, []byte(agoricHookStr))
133
+ agoricHook, err := agtypes.JoinHookedAddress(agoricAddr, []byte(agoricHookStr))
134
134
  require.NoError(t, err)
135
- addr, hookData, err = types.SplitHookedAddress(agoricHook)
135
+ addr, hookData, err = agtypes.SplitHookedAddress(agoricHook)
136
136
  require.NoError(t, err)
137
137
  require.Equal(t, agoricAddr, addr)
138
138
  require.Equal(t, agoricHookStr, string(hookData))
139
139
 
140
140
  cases := []struct {
141
141
  name string
142
- addrs map[types.AddressRole]struct{ addr, baseAddr string }
142
+ addrs map[agtypes.AddressRole]struct{ addr, baseAddr string }
143
143
  }{
144
144
  {"sender has params",
145
- map[types.AddressRole]struct{ addr, baseAddr string }{
146
- types.RoleSender: {cosmosHook, "cosmos1qqxuevtt"},
147
- types.RoleReceiver: {"agoric1qqp0e5ys", "agoric1qqp0e5ys"},
145
+ map[agtypes.AddressRole]struct{ addr, baseAddr string }{
146
+ agtypes.RoleSender: {cosmosHook, "cosmos1qqxuevtt"},
147
+ agtypes.RoleReceiver: {"agoric1qqp0e5ys", "agoric1qqp0e5ys"},
148
148
  },
149
149
  },
150
150
  {"receiver has params",
151
- map[types.AddressRole]struct{ addr, baseAddr string }{
152
- types.RoleSender: {"cosmos1qqxuevtt", "cosmos1qqxuevtt"},
153
- types.RoleReceiver: {agoricHook, "agoric1qqp0e5ys"},
151
+ map[agtypes.AddressRole]struct{ addr, baseAddr string }{
152
+ agtypes.RoleSender: {"cosmos1qqxuevtt", "cosmos1qqxuevtt"},
153
+ agtypes.RoleReceiver: {agoricHook, "agoric1qqp0e5ys"},
154
154
  },
155
155
  },
156
156
  {"both are base",
157
- map[types.AddressRole]struct{ addr, baseAddr string }{
158
- types.RoleSender: {"cosmos1qqxuevtt", "cosmos1qqxuevtt"},
159
- types.RoleReceiver: {"agoric1qqp0e5ys", "agoric1qqp0e5ys"},
157
+ map[agtypes.AddressRole]struct{ addr, baseAddr string }{
158
+ agtypes.RoleSender: {"cosmos1qqxuevtt", "cosmos1qqxuevtt"},
159
+ agtypes.RoleReceiver: {"agoric1qqp0e5ys", "agoric1qqp0e5ys"},
160
160
  },
161
161
  },
162
162
  {"both have params",
163
- map[types.AddressRole]struct{ addr, baseAddr string }{
164
- types.RoleSender: {agoricHook, "agoric1qqp0e5ys"},
165
- types.RoleReceiver: {cosmosHook, "cosmos1qqxuevtt"},
163
+ map[agtypes.AddressRole]struct{ addr, baseAddr string }{
164
+ agtypes.RoleSender: {agoricHook, "agoric1qqp0e5ys"},
165
+ agtypes.RoleReceiver: {cosmosHook, "cosmos1qqxuevtt"},
166
166
  },
167
167
  },
168
168
  }
@@ -170,29 +170,29 @@ func TestExtractBaseAddressFromPacket(t *testing.T) {
170
170
  for _, tc := range cases {
171
171
  tc := tc
172
172
  t.Run(tc.name, func(t *testing.T) {
173
- ftPacketData := transfertypes.NewFungibleTokenPacketData("denom", "100", tc.addrs[types.RoleSender].addr, tc.addrs[types.RoleReceiver].addr, "my-favourite-memo")
173
+ ftPacketData := transfertypes.NewFungibleTokenPacketData("denom", "100", tc.addrs[agtypes.RoleSender].addr, tc.addrs[agtypes.RoleReceiver].addr, "my-favourite-memo")
174
174
  packetBz := ftPacketData.GetBytes()
175
- packet := channeltypes.NewPacket(packetBz, 1234, "my-port", "my-channel", "their-port", "their-channel", clienttypes.NewHeight(133, 445), 10999)
175
+ packet := agtypes.MakeIBCPacket(packetBz, 1234, "my-port", "my-channel", "their-port", "their-channel", clienttypes.NewHeight(133, 445), 10999)
176
176
 
177
177
  for role, addrs := range tc.addrs {
178
178
  addrs := addrs
179
179
  role := role
180
180
 
181
181
  t.Run(string(role), func(t *testing.T) {
182
- baseAddr, err := types.ExtractBaseAddress(addrs.addr)
182
+ baseAddr, err := agtypes.ExtractBaseAddress(addrs.addr)
183
183
  require.NoError(t, err)
184
184
  require.Equal(t, addrs.baseAddr, baseAddr)
185
185
 
186
- packetBaseAddr0, err := types.ExtractBaseAddressFromData(cdc, packet.GetData(), role, nil)
186
+ packetBaseAddr0, err := agtypes.ExtractBaseAddressFromData(cdc, packet.GetData(), role, nil)
187
187
  require.NoError(t, err)
188
188
  require.Equal(t, addrs.baseAddr, packetBaseAddr0)
189
189
 
190
- packetBaseAddr1, err := types.ExtractBaseAddressFromPacket(cdc, packet, role, nil)
190
+ packetBaseAddr1, err := agtypes.ExtractBaseAddressFromPacket(cdc, packet, role, nil)
191
191
  require.NoError(t, err)
192
192
  require.Equal(t, addrs.baseAddr, packetBaseAddr1)
193
193
 
194
- var newPacket channeltypes.Packet
195
- packetBaseAddr2, err := types.ExtractBaseAddressFromPacket(cdc, packet, role, &newPacket)
194
+ var newPacket agtypes.IBCPacket
195
+ packetBaseAddr2, err := agtypes.ExtractBaseAddressFromPacket(cdc, packet, role, &newPacket)
196
196
  require.NoError(t, err)
197
197
  require.Equal(t, addrs.baseAddr, packetBaseAddr2)
198
198
 
@@ -203,10 +203,10 @@ func TestExtractBaseAddressFromPacket(t *testing.T) {
203
203
  // Check that the only difference between the packet data is the baseAddr.
204
204
  packetData := basePacketData
205
205
  switch role {
206
- case types.RoleSender:
206
+ case agtypes.RoleSender:
207
207
  require.Equal(t, addrs.baseAddr, basePacketData.Sender)
208
208
  packetData.Sender = addrs.addr
209
- case types.RoleReceiver:
209
+ case agtypes.RoleReceiver:
210
210
  require.Equal(t, addrs.baseAddr, basePacketData.Receiver)
211
211
  packetData.Receiver = addrs.addr
212
212
  default: