@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
@@ -8,67 +8,57 @@ option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/vbank/types";
8
8
 
9
9
  // The module governance/configuration parameters.
10
10
  message Params {
11
- option (gogoproto.equal) = true;
12
- option (gogoproto.goproto_stringer) = false;
11
+ option (gogoproto.equal) = true;
12
+ option (gogoproto.goproto_stringer) = false;
13
13
 
14
- // reward_epoch_duration_blocks is the length of a reward epoch, in blocks.
15
- // A value of zero has the same meaning as a value of one:
16
- // the full reward buffer should be distributed immediately.
17
- int64 reward_epoch_duration_blocks = 1 [
18
- (gogoproto.moretags) = "yaml:\"reward_epoch_duration_blocks\""
19
- ];
14
+ // reward_epoch_duration_blocks is the length of a reward epoch, in blocks.
15
+ // A value of zero has the same meaning as a value of one:
16
+ // the full reward buffer should be distributed immediately.
17
+ int64 reward_epoch_duration_blocks = 1 [(gogoproto.moretags) = "yaml:\"reward_epoch_duration_blocks\""];
20
18
 
21
- // per_epoch_reward_fraction is a fraction of the reward pool to distrubute
22
- // once every reward epoch. If less than zero, use approximately continuous
23
- // per-block distribution.
24
- string per_epoch_reward_fraction = 2 [
25
- (gogoproto.moretags) = "yaml:\"discrete_epoch_reward_fraction\"",
26
- (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
27
- (gogoproto.nullable) = false
28
- ];
19
+ // per_epoch_reward_fraction is a fraction of the reward pool to distrubute
20
+ // once every reward epoch. If less than zero, use approximately continuous
21
+ // per-block distribution.
22
+ string per_epoch_reward_fraction = 2 [
23
+ (gogoproto.moretags) = "yaml:\"discrete_epoch_reward_fraction\"",
24
+ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
25
+ (gogoproto.nullable) = false
26
+ ];
29
27
 
30
- // reward_smoothing_blocks is the number of blocks over which to distribute
31
- // an epoch's rewards. If zero, use the same value as
32
- // reward_epoch_duration_blocks.
33
- int64 reward_smoothing_blocks = 3 [
34
- (gogoproto.moretags) = "yaml:\"reward_smoothing_blocks\""
35
- ];
28
+ // reward_smoothing_blocks is the number of blocks over which to distribute
29
+ // an epoch's rewards. If zero, use the same value as
30
+ // reward_epoch_duration_blocks.
31
+ int64 reward_smoothing_blocks = 3 [(gogoproto.moretags) = "yaml:\"reward_smoothing_blocks\""];
36
32
 
37
- // allowed_monitoring_accounts is an array of account addresses that can be
38
- // monitored for sends and receives. An element of `"*"` will permit any
39
- // address.
40
- repeated string allowed_monitoring_accounts = 4 [
41
- (gogoproto.moretags) = "yaml:\"allowed_monitoring_accounts\""
42
- ];
33
+ // allowed_monitoring_accounts is an array of account addresses that can be
34
+ // monitored for sends and receives. An element of `"*"` will permit any
35
+ // address.
36
+ repeated string allowed_monitoring_accounts = 4 [(gogoproto.moretags) = "yaml:\"allowed_monitoring_accounts\""];
43
37
  }
44
38
 
45
39
  // The current state of the module.
46
40
  message State {
47
- option (gogoproto.equal) = true;
41
+ option (gogoproto.equal) = true;
48
42
 
49
- // rewardPool is the current balance of rewards in the module account.
50
- // NOTE: Tracking manually since there is no bank call for getting a
51
- // module account balance by name.
52
- repeated cosmos.base.v1beta1.Coin reward_pool = 1 [
53
- (gogoproto.nullable) = false,
54
- (gogoproto.moretags) = "yaml:\"reward_pool\"",
55
- (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
56
- ];
43
+ // rewardPool is the current balance of rewards in the module account.
44
+ // NOTE: Tracking manually since there is no bank call for getting a
45
+ // module account balance by name.
46
+ repeated cosmos.base.v1beta1.Coin reward_pool = 1 [
47
+ (gogoproto.nullable) = false,
48
+ (gogoproto.moretags) = "yaml:\"reward_pool\"",
49
+ (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
50
+ ];
57
51
 
58
- // reward_block_amount is the amount of reward, if available, to send to the
59
- // fee collector module on every block.
60
- repeated cosmos.base.v1beta1.Coin reward_block_amount = 2 [
61
- (gogoproto.nullable) = false,
62
- (gogoproto.moretags) = "yaml:\"reward_block_amount\"",
63
- (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
64
- ];
65
-
66
- // last_sequence is a sequence number for communicating with the VM.
67
- uint64 last_sequence = 3 [
68
- (gogoproto.moretags) = "yaml:\"last_sequence\""
69
- ];
52
+ // reward_block_amount is the amount of reward, if available, to send to the
53
+ // fee collector module on every block.
54
+ repeated cosmos.base.v1beta1.Coin reward_block_amount = 2 [
55
+ (gogoproto.nullable) = false,
56
+ (gogoproto.moretags) = "yaml:\"reward_block_amount\"",
57
+ (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
58
+ ];
70
59
 
71
- int64 last_reward_distribution_block = 4 [
72
- (gogoproto.moretags) = "yaml:\"last_reward_distribution_block\""
73
- ];
60
+ // last_sequence is a sequence number for communicating with the VM.
61
+ uint64 last_sequence = 3 [(gogoproto.moretags) = "yaml:\"last_sequence\""];
62
+
63
+ int64 last_reward_distribution_block = 4 [(gogoproto.moretags) = "yaml:\"last_reward_distribution_block\""];
74
64
  }
@@ -14,18 +14,15 @@ service Msg {
14
14
 
15
15
  // MsgSendPacket is an SDK message for sending an outgoing IBC packet
16
16
  message MsgSendPacket {
17
- option (gogoproto.equal) = false;
17
+ option (gogoproto.equal) = false;
18
18
 
19
- ibc.core.channel.v1.Packet packet = 1 [
20
- (gogoproto.nullable) = false,
21
- (gogoproto.jsontag) = "packet",
22
- (gogoproto.moretags) = "yaml:\"packet\""
23
- ];
24
- bytes sender = 2 [
25
- (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress",
26
- (gogoproto.jsontag) = "submitter",
27
- (gogoproto.moretags) = "yaml:\"submitter\""
28
- ];
19
+ ibc.core.channel.v1.Packet packet = 1
20
+ [(gogoproto.nullable) = false, (gogoproto.jsontag) = "packet", (gogoproto.moretags) = "yaml:\"packet\""];
21
+ bytes sender = 2 [
22
+ (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress",
23
+ (gogoproto.jsontag) = "submitter",
24
+ (gogoproto.moretags) = "yaml:\"submitter\""
25
+ ];
29
26
  }
30
27
 
31
28
  // Empty response for SendPacket.
@@ -7,19 +7,16 @@ option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/types
7
7
 
8
8
  // The initial or exported state.
9
9
  message GenesisState {
10
- option (gogoproto.equal) = false;
10
+ option (gogoproto.equal) = false;
11
11
 
12
- repeated DataEntry data = 1 [
13
- (gogoproto.jsontag) = "data",
14
- (gogoproto.moretags) = "yaml:\"data\""
15
- ];
12
+ repeated DataEntry data = 1 [(gogoproto.jsontag) = "data", (gogoproto.moretags) = "yaml:\"data\""];
16
13
  }
17
14
 
18
15
  // A vstorage entry. The only necessary entries are those with data, as the
19
16
  // ancestor nodes are reconstructed on import.
20
17
  message DataEntry {
21
- // A "."-separated path with individual path elements matching
22
- // `[-_A-Za-z0-9]+`
23
- string path = 1;
24
- string value = 2;
18
+ // A "."-separated path with individual path elements matching
19
+ // `[-_A-Za-z0-9]+`
20
+ string path = 1;
21
+ string value = 2;
25
22
  }
@@ -16,95 +16,66 @@ service Query {
16
16
 
17
17
  // Return a formatted representation of a vstorage datum that must be
18
18
  // a valid StreamCell with CapData values, or standalone CapData.
19
- rpc CapData(QueryCapDataRequest)
20
- returns (QueryCapDataResponse) {
21
- option (google.api.http).get = "/agoric/vstorage/capdata/{path}";
19
+ rpc CapData(QueryCapDataRequest) returns (QueryCapDataResponse) {
20
+ option (google.api.http).get = "/agoric/vstorage/capdata/{path}";
22
21
  }
23
22
 
24
23
  // Return the children of a given vstorage path.
25
- rpc Children(QueryChildrenRequest)
26
- returns (QueryChildrenResponse) {
27
- option (google.api.http).get = "/agoric/vstorage/children/{path}";
24
+ rpc Children(QueryChildrenRequest) returns (QueryChildrenResponse) {
25
+ option (google.api.http).get = "/agoric/vstorage/children/{path}";
28
26
  }
29
27
  }
30
28
 
31
29
  // QueryDataRequest is the vstorage path data query.
32
30
  message QueryDataRequest {
33
- string path = 1 [
34
- (gogoproto.jsontag) = "path",
35
- (gogoproto.moretags) = "yaml:\"path\""
36
- ];
31
+ string path = 1 [(gogoproto.jsontag) = "path", (gogoproto.moretags) = "yaml:\"path\""];
37
32
  }
38
33
 
39
34
  // QueryDataResponse is the vstorage path data response.
40
35
  message QueryDataResponse {
41
- string value = 1 [
42
- (gogoproto.jsontag) = "value",
43
- (gogoproto.moretags) = "yaml:\"value\""
44
- ];
36
+ string value = 1 [(gogoproto.jsontag) = "value", (gogoproto.moretags) = "yaml:\"value\""];
45
37
  }
46
38
 
47
39
  // QueryCapDataRequest contains a path and formatting configuration.
48
40
  message QueryCapDataRequest {
49
- string path = 1 [
50
- (gogoproto.jsontag) = "path",
51
- (gogoproto.moretags) = "yaml:\"path\""
52
- ];
41
+ string path = 1 [(gogoproto.jsontag) = "path", (gogoproto.moretags) = "yaml:\"path\""];
53
42
  // mediaType must be an actual media type in the registry at
54
43
  // https://www.iana.org/assignments/media-types/media-types.xhtml
55
44
  // or a special value that does not conflict with the media type syntax.
56
45
  // The only valid value is "JSON Lines", which is also the default.
57
- string media_type = 2 [
58
- (gogoproto.jsontag) = "mediaType",
59
- (gogoproto.moretags) = "yaml:\"mediaType\""
60
- ];
46
+ string media_type = 2 [(gogoproto.jsontag) = "mediaType", (gogoproto.moretags) = "yaml:\"mediaType\""];
61
47
  // itemFormat, if present, must be the special value "flat" to indicate that
62
48
  // the deep structure of each item should be flattened into a single level
63
49
  // with kebab-case keys (e.g., `{ "metrics": { "min": 0, "max": 88 } }` as
64
50
  // `{ "metrics-min": 0, "metrics-max": 88 }`).
65
- string item_format = 3 [
66
- (gogoproto.jsontag) = "itemFormat",
67
- (gogoproto.moretags) = "yaml:\"itemFormat\""
68
- ];
51
+ string item_format = 3 [(gogoproto.jsontag) = "itemFormat", (gogoproto.moretags) = "yaml:\"itemFormat\""];
69
52
  // remotableValueFormat indicates how to transform references to opaque but
70
53
  // distinguishable Remotables into readable embedded representations.
71
- // * "object" represents each Remotable as an `{ id, allegedName }` object, e.g. `{ "id": "board007", "allegedName": "IST brand" }`.
72
- // * "string" represents each Remotable as a string with bracket-wrapped contents including its alleged name and id, e.g. "[Alleged: IST brand <board007>]".
73
- string remotable_value_format = 10 [
74
- (gogoproto.jsontag) = "remotableValueFormat",
75
- (gogoproto.moretags) = "yaml:\"remotableValueFormat\""
76
- ];
54
+ // * "object" represents each Remotable as an `{ id, allegedName }` object, e.g. `{ "id": "board007", "allegedName":
55
+ // "IST brand" }`.
56
+ // * "string" represents each Remotable as a string with bracket-wrapped contents including its alleged name and id,
57
+ // e.g. "[Alleged: IST brand <board007>]".
58
+ string remotable_value_format = 10
59
+ [(gogoproto.jsontag) = "remotableValueFormat", (gogoproto.moretags) = "yaml:\"remotableValueFormat\""];
77
60
  }
78
61
 
79
62
  // QueryCapDataResponse represents the result with the requested formatting,
80
63
  // reserving space for future metadata such as media type.
81
64
  message QueryCapDataResponse {
82
- string block_height = 1 [
83
- (gogoproto.jsontag) = "blockHeight",
84
- (gogoproto.moretags) = "yaml:\"blockHeight\""
85
- ];
86
- string value = 10 [
87
- (gogoproto.jsontag) = "value",
88
- (gogoproto.moretags) = "yaml:\"value\""
89
- ];
65
+ string block_height = 1 [(gogoproto.jsontag) = "blockHeight", (gogoproto.moretags) = "yaml:\"blockHeight\""];
66
+ string value = 10 [(gogoproto.jsontag) = "value", (gogoproto.moretags) = "yaml:\"value\""];
90
67
  }
91
68
 
92
69
  // QueryChildrenRequest is the vstorage path children query.
93
70
  message QueryChildrenRequest {
94
- string path = 1 [
95
- (gogoproto.jsontag) = "path",
96
- (gogoproto.moretags) = "yaml:\"path\""
97
- ];
71
+ string path = 1 [(gogoproto.jsontag) = "path", (gogoproto.moretags) = "yaml:\"path\""];
98
72
 
99
73
  cosmos.base.query.v1beta1.PageRequest pagination = 2;
100
74
  }
101
75
 
102
76
  // QueryChildrenResponse is the vstorage path children response.
103
77
  message QueryChildrenResponse {
104
- repeated string children = 1 [
105
- (gogoproto.jsontag) = "children",
106
- (gogoproto.moretags) = "yaml:\"children\""
107
- ];
78
+ repeated string children = 1 [(gogoproto.jsontag) = "children", (gogoproto.moretags) = "yaml:\"children\""];
108
79
 
109
80
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
110
81
  }
@@ -7,21 +7,15 @@ option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/types
7
7
 
8
8
  // Data is the vstorage node data.
9
9
  message Data {
10
- option (gogoproto.equal) = false;
10
+ option (gogoproto.equal) = false;
11
11
 
12
- string value = 1 [
13
- (gogoproto.jsontag) = "value",
14
- (gogoproto.moretags) = "yaml:\"value\""
15
- ];
12
+ string value = 1 [(gogoproto.jsontag) = "value", (gogoproto.moretags) = "yaml:\"value\""];
16
13
  }
17
14
 
18
15
  // Children are the immediate names (just one level deep) of subnodes leading to
19
16
  // more data from a given vstorage node.
20
17
  message Children {
21
- option (gogoproto.equal) = false;
18
+ option (gogoproto.equal) = false;
22
19
 
23
- repeated string children = 1 [
24
- (gogoproto.jsontag) = "children",
25
- (gogoproto.moretags) = "yaml:\"children\""
26
- ];
20
+ repeated string children = 1 [(gogoproto.jsontag) = "children", (gogoproto.moretags) = "yaml:\"children\""];
27
21
  }
@@ -7,12 +7,12 @@ option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/type
7
7
 
8
8
  // The initial and exported module state.
9
9
  message GenesisState {
10
- option (gogoproto.equal) = false;
10
+ option (gogoproto.equal) = false;
11
11
 
12
- // The list of account addresses that are being watched by the VM.
13
- repeated bytes watched_addresses = 1 [
14
- (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress",
15
- (gogoproto.jsontag) = "watched_addresses",
16
- (gogoproto.moretags) = "yaml:\"watched_addresses\""
17
- ];
12
+ // The list of account addresses that are being watched by the VM.
13
+ repeated bytes watched_addresses = 1 [
14
+ (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress",
15
+ (gogoproto.jsontag) = "watched_addresses",
16
+ (gogoproto.moretags) = "yaml:\"watched_addresses\""
17
+ ];
18
18
  }
@@ -0,0 +1,8 @@
1
+ version: v1
2
+ plugins:
3
+ - name: gocosmos
4
+ out: ..
5
+ opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types
6
+ - name: grpc-gateway
7
+ out: ..
8
+ opt: logtostderr=true,allow_colon_final_segments=true
@@ -0,0 +1,17 @@
1
+ version: v1
2
+ managed:
3
+ enabled: true
4
+ go_package_prefix:
5
+ default: cosmossdk.io/api
6
+ except:
7
+ - buf.build/googleapis/googleapis
8
+ - buf.build/cosmos/gogo-proto
9
+ - buf.build/cosmos/cosmos-proto
10
+ override:
11
+ plugins:
12
+ - name: go-pulsar
13
+ out: ../api
14
+ opt: paths=source_relative
15
+ - name: go-grpc
16
+ out: ../api
17
+ opt: paths=source_relative
@@ -0,0 +1,5 @@
1
+ version: v1
2
+ plugins:
3
+ - name: swagger
4
+ out: ../tmp-swagger-gen
5
+ opt: logtostderr=true,fqn_for_swagger_name=true,simple_operation_ids=true
package/proto/buf.yaml CHANGED
@@ -1,7 +1,13 @@
1
1
  version: v1
2
+ build:
3
+ excludes:
4
+ - google/protobuf
2
5
  breaking:
3
6
  use:
4
7
  - FILE
8
+ ignore:
9
+ - gogoproto
10
+ - google
5
11
  lint:
6
12
  use:
7
13
  - DEFAULT
@@ -13,3 +19,7 @@ lint:
13
19
  - SERVICE_SUFFIX
14
20
  - PACKAGE_VERSION_SUFFIX
15
21
  - RPC_REQUEST_STANDARD_NAME
22
+ ignore:
23
+ - cosmos_proto
24
+ - gogoproto
25
+ - google
@@ -1,31 +1,24 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- set -eo pipefail
4
-
5
- protoc_gen_gocosmos() {
6
- if ! grep "github.com/gogo/protobuf => github.com/regen-network/protobuf" go.mod &> /dev/null; then
7
- echo -e "\tPlease run this command from somewhere inside the ibc-go folder."
8
- return 1
9
- fi
10
-
11
- go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest 2> /dev/null
12
- }
3
+ # How to run manually:
4
+ # docker build --pull --rm -f "contrib/devtools/Dockerfile" -t cosmossdk-proto:latest "contrib/devtools"
5
+ # docker run --rm -v $(pwd):/workspace --workdir /workspace cosmossdk-proto sh ./scripts/protocgen.sh
13
6
 
14
- protoc_gen_gocosmos
7
+ set -eo pipefail
15
8
 
16
- proto_dirs=$(find . -path ./third_party -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
9
+ echo "Generating gogo proto code"
10
+ cd proto
11
+ proto_dirs=$(find . -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
17
12
  for dir in $proto_dirs; do
18
- # NOTE: when migrating to grpc-gateway v2, we will need to remove the
19
- # allow_colon_final_segments=true
20
- # as per https://grpc-ecosystem.github.io/grpc-gateway/docs/development/grpc-gateway_v2_migration_guide/#withlastmatchwins-and-allow_colon_final_segmentstrue-is-now-default-behaviour
21
- protoc \
22
- -I proto \
23
- -I third_party/proto \
24
- --gocosmos_out=plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \
25
- --grpc-gateway_out=logtostderr=true,allow_colon_final_segments=true:. \
26
- $(find "${dir}" -maxdepth 1 -name '*.proto')
13
+ for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do
14
+ echo "Generating gogo proto code for $file"
15
+ buf generate --template buf.gen.gogo.yaml "$file"
16
+ done
27
17
  done
18
+ cd ..
28
19
 
29
20
  # move proto files to the right places
30
21
  cp -r github.com/Agoric/agoric-sdk/golang/cosmos/* ./
31
22
  rm -rf github.com
23
+
24
+ go mod tidy
@@ -0,0 +1,79 @@
1
+ syntax = "proto3";
2
+
3
+ package amino;
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/tx/amino";
10
+
11
+ extend google.protobuf.MessageOptions {
12
+ // name is the string used when registering a concrete
13
+ // type into the Amino type registry, via the Amino codec's
14
+ // `RegisterConcrete()` method. This string MUST be at most 39
15
+ // characters long, or else the message will be rejected by the
16
+ // Ledger hardware device.
17
+ string name = 11110001;
18
+
19
+ // encoding describes the encoding format used by Amino for the given
20
+ // message. The field type is chosen to be a string for
21
+ // flexibility, but it should ideally be short and expected to be
22
+ // machine-readable, for example "base64" or "utf8_json". We
23
+ // highly recommend to use underscores for word separation instead of spaces.
24
+ //
25
+ // If left empty, then the Amino encoding is expected to be the same as the
26
+ // Protobuf one.
27
+ //
28
+ // This annotation should not be confused with the `encoding`
29
+ // one which operates on the field level.
30
+ string message_encoding = 11110002;
31
+ }
32
+
33
+ extend google.protobuf.FieldOptions {
34
+ // encoding describes the encoding format used by Amino for
35
+ // the given field. The field type is chosen to be a string for
36
+ // flexibility, but it should ideally be short and expected to be
37
+ // machine-readable, for example "base64" or "utf8_json". We
38
+ // highly recommend to use underscores for word separation instead of spaces.
39
+ //
40
+ // If left empty, then the Amino encoding is expected to be the same as the
41
+ // Protobuf one.
42
+ //
43
+ // This annotation should not be confused with the
44
+ // `message_encoding` one which operates on the message level.
45
+ string encoding = 11110003;
46
+
47
+ // field_name sets a different field name (i.e. key name) in
48
+ // the amino JSON object for the given field.
49
+ //
50
+ // Example:
51
+ //
52
+ // message Foo {
53
+ // string bar = 1 [(amino.field_name) = "baz"];
54
+ // }
55
+ //
56
+ // Then the Amino encoding of Foo will be:
57
+ // `{"baz":"some value"}`
58
+ string field_name = 11110004;
59
+
60
+ // dont_omitempty sets the field in the JSON object even if
61
+ // its value is empty, i.e. equal to the Golang zero value. To learn what
62
+ // the zero values are, see https://go.dev/ref/spec#The_zero_value.
63
+ //
64
+ // Fields default to `omitempty`, which is the default behavior when this
65
+ // annotation is unset. When set to true, then the field value in the
66
+ // JSON object will be set, i.e. not `undefined`.
67
+ //
68
+ // Example:
69
+ //
70
+ // message Foo {
71
+ // string bar = 1;
72
+ // string baz = 2 [(amino.dont_omitempty) = true];
73
+ // }
74
+ //
75
+ // f := Foo{};
76
+ // out := AminoJSONEncoder(&f);
77
+ // out == {"baz":""}
78
+ bool dont_omitempty = 11110005;
79
+ }
@@ -3,6 +3,7 @@ package cosmos.base.v1beta1;
3
3
 
4
4
  import "gogoproto/gogo.proto";
5
5
  import "cosmos_proto/cosmos.proto";
6
+ import "amino/amino.proto";
6
7
 
7
8
  option go_package = "github.com/cosmos/cosmos-sdk/types";
8
9
  option (gogoproto.goproto_stringer_all) = false;
@@ -16,8 +17,12 @@ message Coin {
16
17
  option (gogoproto.equal) = true;
17
18
 
18
19
  string denom = 1;
19
- string amount = 2
20
- [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false];
20
+ string amount = 2 [
21
+ (cosmos_proto.scalar) = "cosmos.Int",
22
+ (gogoproto.customtype) = "Int",
23
+ (gogoproto.nullable) = false,
24
+ (amino.dont_omitempty) = true
25
+ ];
21
26
  }
22
27
 
23
28
  // DecCoin defines a token with a denomination and a decimal amount.