@agoric/cosmos 0.35.0-u21.0.1 → 0.35.0-u22.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 (114) hide show
  1. package/CHANGELOG.md +11 -187
  2. package/Makefile +2 -2
  3. package/ante/ante.go +2 -2
  4. package/ante/inbound.go +1 -2
  5. package/ante/inbound_test.go +3 -1
  6. package/ante/vm_admission.go +1 -2
  7. package/app/app.go +255 -174
  8. package/app/encoding.go +6 -3
  9. package/app/export.go +50 -21
  10. package/app/genesis.go +7 -5
  11. package/app/params/encoding.go +1 -1
  12. package/app/params/proto.go +6 -4
  13. package/app/sim_test.go +11 -13
  14. package/app/txconfig/tx_config.go +169 -0
  15. package/app/upgrade.go +52 -97
  16. package/app/upgrade_test.go +1 -1
  17. package/cmd/agd/agvm.go +1 -1
  18. package/cmd/agd/main.go +1 -1
  19. package/cmd/libdaemon/main.go +2 -2
  20. package/daemon/cmd/root.go +99 -30
  21. package/daemon/cmd/root_test.go +12 -27
  22. package/daemon/main.go +2 -9
  23. package/git-revision.txt +1 -1
  24. package/go.mod +129 -109
  25. package/go.sum +228 -469
  26. package/package.json +2 -2
  27. package/proto/agoric/swingset/msgs.proto +46 -9
  28. package/proto/agoric/swingset/swingset.proto +7 -2
  29. package/proto/agoric/vbank/vbank.proto +1 -1
  30. package/proto/agoric/vibc/msgs.proto +4 -0
  31. package/tests/e2e/vbank/vbank_test.go +172 -0
  32. package/tests/integrations/types/aminojson_test.go +214 -0
  33. package/tests/integrations/vbank/vbank_test.go +348 -0
  34. package/third_party/proto/amino/amino.proto +6 -1
  35. package/third_party/proto/cosmos/base/v1beta1/coin.proto +18 -5
  36. package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +4 -8
  37. package/third_party/proto/ibc/core/channel/v1/channel.proto +42 -17
  38. package/third_party/proto/ibc/core/client/v1/client.proto +48 -40
  39. package/types/address_hooks.go +2 -2
  40. package/types/address_hooks_test.go +3 -3
  41. package/types/ibc_packet.go +3 -3
  42. package/types/ibc_packet_test.go +3 -3
  43. package/types/kv_entry_helpers.go +3 -3
  44. package/types/kv_entry_helpers_test.go +2 -2
  45. package/types/legacy_address_encoder.go +58 -0
  46. package/vm/proto_json_test.go +1 -1
  47. package/vm/server.go +2 -1
  48. package/x/swingset/abci.go +2 -2
  49. package/x/swingset/client/cli/tx.go +16 -14
  50. package/x/swingset/config.go +1 -1
  51. package/x/swingset/genesis.go +2 -1
  52. package/x/swingset/handler.go +2 -1
  53. package/x/swingset/keeper/extension_snapshotter.go +14 -5
  54. package/x/swingset/keeper/extension_snapshotter_test.go +1 -1
  55. package/x/swingset/keeper/keeper.go +21 -17
  56. package/x/swingset/keeper/keeper_test.go +10 -7
  57. package/x/swingset/keeper/msg_server.go +26 -5
  58. package/x/swingset/keeper/swing_store_exports_handler.go +1 -1
  59. package/x/swingset/keeper/swing_store_exports_handler_test.go +1 -1
  60. package/x/swingset/module.go +20 -22
  61. package/x/swingset/types/codec.go +10 -5
  62. package/x/swingset/types/default-params.go +13 -12
  63. package/x/swingset/types/expected_keepers.go +5 -4
  64. package/x/swingset/types/msgs.go +50 -36
  65. package/x/swingset/types/msgs.pb.go +60 -51
  66. package/x/swingset/types/params_test.go +21 -20
  67. package/x/swingset/types/swingset.pb.go +67 -61
  68. package/x/vbank/genesis.go +12 -8
  69. package/x/vbank/handler.go +2 -1
  70. package/x/vbank/keeper/grpc_query.go +4 -1
  71. package/x/vbank/keeper/keeper.go +108 -23
  72. package/x/vbank/keeper/querier.go +4 -1
  73. package/x/vbank/keeper/rewards.go +6 -2
  74. package/x/vbank/module.go +47 -75
  75. package/x/vbank/types/expected_keepers.go +15 -10
  76. package/x/vbank/types/key.go +3 -0
  77. package/x/vbank/types/params.go +4 -3
  78. package/x/vbank/types/vbank.pb.go +41 -40
  79. package/x/vbank/vbank.go +25 -10
  80. package/x/vbank/vbank_test.go +213 -154
  81. package/x/vibc/handler.go +2 -1
  82. package/x/vibc/keeper/keeper.go +10 -10
  83. package/x/vibc/keeper/migrations.go +1 -1
  84. package/x/vibc/keeper/triggers.go +1 -1
  85. package/x/vibc/module.go +5 -22
  86. package/x/vibc/types/codec.go +2 -1
  87. package/x/vibc/types/expected_keepers.go +7 -5
  88. package/x/vibc/types/ibc_module.go +5 -5
  89. package/x/vibc/types/msgs.go +30 -7
  90. package/x/vibc/types/msgs.pb.go +29 -25
  91. package/x/vibc/types/receiver.go +2 -2
  92. package/x/vlocalchain/handler.go +2 -1
  93. package/x/vlocalchain/keeper/keeper.go +17 -5
  94. package/x/vlocalchain/keeper/keeper_test.go +3 -2
  95. package/x/vlocalchain/types/expected_keepers.go +7 -4
  96. package/x/vlocalchain/vlocalchain_test.go +38 -26
  97. package/x/vstorage/genesis.go +10 -10
  98. package/x/vstorage/handler.go +2 -1
  99. package/x/vstorage/keeper/keeper.go +68 -46
  100. package/x/vstorage/keeper/keeper_test.go +35 -19
  101. package/x/vstorage/module.go +27 -13
  102. package/x/vstorage/testing/queue.go +5 -3
  103. package/x/vstorage/vstorage.go +2 -1
  104. package/x/vstorage/vstorage_test.go +21 -17
  105. package/x/vtransfer/genesis.go +1 -3
  106. package/x/vtransfer/handler.go +3 -2
  107. package/x/vtransfer/ibc_middleware.go +5 -5
  108. package/x/vtransfer/ibc_middleware_test.go +43 -29
  109. package/x/vtransfer/keeper/keeper.go +35 -33
  110. package/x/vtransfer/module.go +8 -11
  111. package/x/vtransfer/types/expected_keepers.go +3 -3
  112. package/x/vtransfer/utils_test.go +26 -11
  113. package/coverage.txt +0 -8531
  114. package/daemon/cmd/testnet.go +0 -539
@@ -0,0 +1,348 @@
1
+ package vbank_test
2
+
3
+ import (
4
+ "fmt"
5
+ "os"
6
+ "testing"
7
+ "time"
8
+
9
+ appmodule "cosmossdk.io/core/appmodule"
10
+ "cosmossdk.io/log"
11
+ sdkmath "cosmossdk.io/math"
12
+ storetypes "cosmossdk.io/store/types"
13
+ "github.com/cometbft/cometbft/crypto/secp256k1"
14
+ cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
15
+ "github.com/cosmos/cosmos-sdk/codec"
16
+ addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
17
+ "github.com/cosmos/cosmos-sdk/runtime"
18
+ "github.com/cosmos/cosmos-sdk/testutil/integration"
19
+ sdk "github.com/cosmos/cosmos-sdk/types"
20
+ moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
21
+ "github.com/cosmos/cosmos-sdk/x/auth"
22
+ authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
23
+ authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
24
+ authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
25
+ "github.com/cosmos/cosmos-sdk/x/bank"
26
+ bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
27
+ banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
28
+ minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
29
+ paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
30
+ paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
31
+ "github.com/stretchr/testify/require"
32
+
33
+ "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset"
34
+ "github.com/Agoric/agoric-sdk/golang/cosmos/x/vbank"
35
+ vbanktypes "github.com/Agoric/agoric-sdk/golang/cosmos/x/vbank/types"
36
+
37
+ vstorage "github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage"
38
+ )
39
+
40
+ var (
41
+ priv1 = secp256k1.GenPrivKey()
42
+ priv2 = secp256k1.GenPrivKey()
43
+ priv3 = secp256k1.GenPrivKey()
44
+ priv4 = secp256k1.GenPrivKey()
45
+ addr1 = sdk.AccAddress(priv1.PubKey().Address()).String()
46
+ addr2 = sdk.AccAddress(priv2.PubKey().Address()).String()
47
+ addr3 = sdk.AccAddress(priv3.PubKey().Address()).String()
48
+ addr4 = sdk.AccAddress(priv4.PubKey().Address()).String()
49
+ )
50
+
51
+ type VbankFixtures struct {
52
+ ctx sdk.Context
53
+ vbankKeeper vbank.Keeper
54
+ bankKeeper bankkeeper.Keeper
55
+ vbankModule vbank.AppModule
56
+ bankModule bank.AppModule
57
+ }
58
+
59
+ func (f *VbankFixtures) advanceBlock(t *testing.T) {
60
+ currentHeight := f.ctx.BlockHeight()
61
+ currentTime := f.ctx.BlockTime()
62
+
63
+ f.ctx = f.ctx.WithBlockHeight(currentHeight + 1).WithBlockTime(currentTime.Add(5 * time.Second))
64
+
65
+ err := f.vbankModule.EndBlock(f.ctx)
66
+
67
+ require.NoError(t, err)
68
+
69
+ }
70
+
71
+ func initVbankFixtures(t *testing.T) VbankFixtures {
72
+ // Create encoding config with all required modules
73
+ encodingCfg := moduletestutil.MakeTestEncodingConfig(
74
+ auth.AppModuleBasic{},
75
+ bank.AppModuleBasic{},
76
+ vbank.AppModuleBasic{},
77
+ )
78
+
79
+ // Define all required store keys
80
+ keys := storetypes.NewKVStoreKeys(
81
+ authtypes.StoreKey,
82
+ banktypes.StoreKey,
83
+ vbank.StoreKey,
84
+ paramstypes.StoreKey,
85
+ vstorage.StoreKey,
86
+ swingset.StoreKey,
87
+ )
88
+ tkeys := storetypes.NewTransientStoreKeys(
89
+ vbanktypes.TStoreKey,
90
+ paramstypes.TStoreKey,
91
+ )
92
+
93
+ logger := log.NewTestLogger(t)
94
+ cms := integration.CreateMultiStore(keys, logger)
95
+
96
+ // Mount transient stores manually
97
+ for _, tkey := range tkeys {
98
+ cms.MountStoreWithDB(tkey, storetypes.StoreTypeTransient, nil)
99
+ }
100
+
101
+ // Load latest version after mounting stores
102
+ if err := cms.LoadLatestVersion(); err != nil {
103
+ t.Fatalf("failed to load multistore: %v", err)
104
+ }
105
+
106
+ newCtx := sdk.NewContext(cms, cmtproto.Header{}, true, logger)
107
+ authority := authtypes.NewModuleAddress("gov")
108
+
109
+ maccPerms := map[string][]string{
110
+ minttypes.ModuleName: {authtypes.Minter},
111
+ vbank.ModuleName: {authtypes.Burner, authtypes.Staking},
112
+ vbanktypes.ReservePoolName: nil,
113
+ vbanktypes.ProvisionPoolName: nil,
114
+ vbanktypes.GiveawayPoolName: nil,
115
+ }
116
+
117
+ // Initialize all keepers
118
+ accountKeeper := authkeeper.NewAccountKeeper(
119
+ encodingCfg.Codec,
120
+ runtime.NewKVStoreService(keys[authtypes.StoreKey]),
121
+ authtypes.ProtoBaseAccount,
122
+ maccPerms,
123
+ addresscodec.NewBech32Codec(sdk.Bech32MainPrefix),
124
+ sdk.Bech32MainPrefix,
125
+ authority.String(),
126
+ )
127
+
128
+ blockedAddresses := BlockedAddresses(maccPerms)
129
+
130
+ bankKeeper := bankkeeper.NewBaseKeeper(
131
+ encodingCfg.Codec,
132
+ runtime.NewKVStoreService(keys[banktypes.StoreKey]),
133
+ accountKeeper,
134
+ blockedAddresses,
135
+ authority.String(),
136
+ logger,
137
+ )
138
+
139
+ vstorageKeeper := vstorage.NewKeeper(
140
+ vstorage.StoreKey,
141
+ runtime.NewKVStoreService(keys[vstorage.StoreKey]),
142
+ )
143
+
144
+ paramsKeeper := initParamsKeeper(encodingCfg.Codec, codec.NewLegacyAmino(), keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey])
145
+
146
+ // Dummy controller function for testing
147
+ callToController := func(ctx sdk.Context, jsonRequest string) (jsonReply string, err error) {
148
+ return `{"ok": true}`, nil
149
+ }
150
+
151
+ // Initialize swingset keeper
152
+ swingSetKeeper := swingset.NewKeeper(
153
+ encodingCfg.Codec,
154
+ runtime.NewKVStoreService(keys[swingset.StoreKey]),
155
+ getSubspace(swingset.ModuleName, paramsKeeper),
156
+ accountKeeper,
157
+ bankKeeper,
158
+ vstorageKeeper,
159
+ vbanktypes.ReservePoolName,
160
+ callToController,
161
+ )
162
+
163
+ // Initialize vbank keeper
164
+ vbankKeeper := vbank.NewKeeper(
165
+ encodingCfg.Codec,
166
+ runtime.NewKVStoreService(keys[vbank.StoreKey]),
167
+ runtime.NewTransientStoreService(tkeys[vbanktypes.TStoreKey]),
168
+ getSubspace(vbank.ModuleName, paramsKeeper),
169
+ accountKeeper,
170
+ bankKeeper,
171
+ authtypes.FeeCollectorName,
172
+ swingSetKeeper.PushAction,
173
+ )
174
+
175
+ // Create app modules
176
+ authModule := auth.NewAppModule(
177
+ encodingCfg.Codec,
178
+ accountKeeper,
179
+ authsims.RandomGenesisAccounts,
180
+ getSubspace(authtypes.ModuleName, paramsKeeper),
181
+ )
182
+ bankModule := bank.NewAppModule(
183
+ encodingCfg.Codec,
184
+ bankKeeper,
185
+ accountKeeper,
186
+ getSubspace(banktypes.ModuleName, paramsKeeper),
187
+ )
188
+ vbankModule := vbank.NewAppModule(vbankKeeper)
189
+
190
+ // Create integration app
191
+ integrationApp := integration.NewIntegrationApp(
192
+ newCtx,
193
+ logger,
194
+ keys,
195
+ encodingCfg.Codec,
196
+ map[string]appmodule.AppModule{
197
+ authtypes.ModuleName: authModule,
198
+ banktypes.ModuleName: bankModule,
199
+ vbank.ModuleName: vbankModule,
200
+ },
201
+ )
202
+
203
+ // Get the SDK context from the integration app
204
+ sdkCtx := sdk.UnwrapSDKContext(integrationApp.Context())
205
+
206
+ // Register message and query servers
207
+ vbanktypes.RegisterMsgServer(integrationApp.MsgServiceRouter(), vbanktypes.UnimplementedMsgServer{})
208
+ vbanktypes.RegisterQueryServer(integrationApp.QueryHelper(), &vbanktypes.UnimplementedQueryServer{})
209
+
210
+ return VbankFixtures{
211
+ ctx: sdkCtx,
212
+ vbankKeeper: vbankKeeper,
213
+ bankKeeper: bankKeeper,
214
+ vbankModule: vbankModule,
215
+ bankModule: bankModule,
216
+ }
217
+ }
218
+
219
+ // BlockedAddresses returns the app's module account addresses that
220
+ // are blocked from receiving funds.
221
+ func BlockedAddresses(maccPerms map[string][]string) map[string]bool {
222
+ modAccAddrs := make(map[string]bool)
223
+ for acc := range maccPerms {
224
+ // The provision and reserve pools are not blocked from receiving funds.
225
+ // NOTE: because of this, these pools must be explicitly
226
+ // initialized as module accounts during bootstrap to avoid
227
+ // implicit creation as a default account when funds are received.
228
+ switch acc {
229
+ case vbanktypes.ProvisionPoolName, vbanktypes.ReservePoolName:
230
+ continue
231
+ }
232
+ modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true
233
+ }
234
+
235
+ return modAccAddrs
236
+ }
237
+
238
+ func getSubspace(moduleName string, paramsKeeper paramskeeper.Keeper) paramstypes.Subspace {
239
+ subspace, _ := paramsKeeper.GetSubspace(moduleName)
240
+ return subspace
241
+ }
242
+
243
+ // initParamsKeeper init params keeper and its subspaces
244
+ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper {
245
+ paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey)
246
+
247
+ paramsKeeper.Subspace(authtypes.ModuleName)
248
+ paramsKeeper.Subspace(banktypes.ModuleName)
249
+ paramsKeeper.Subspace(minttypes.ModuleName)
250
+ paramsKeeper.Subspace(swingset.ModuleName)
251
+ paramsKeeper.Subspace(vbank.ModuleName)
252
+
253
+ return paramsKeeper
254
+ }
255
+
256
+ func Test_EndBlock_Events(t *testing.T) {
257
+ t.Parallel()
258
+ f := initVbankFixtures(t)
259
+
260
+ addr1 := sdk.AccAddress(priv1.PubKey().Address())
261
+ addr2 := sdk.AccAddress(priv2.PubKey().Address())
262
+ addr4 := sdk.AccAddress(priv4.PubKey().Address())
263
+
264
+ adStore := f.vbankKeeper.OpenAddressToUpdateStore(f.ctx)
265
+
266
+ t.Log("Address Update Store contents before:")
267
+ preCount := 0
268
+ iterator := adStore.Iterator(nil, nil)
269
+ for ; iterator.Valid(); iterator.Next() {
270
+ addressBytes := iterator.Key()
271
+ denoms := string(iterator.Value())
272
+
273
+ // Convert raw address bytes to bech32 format for readability
274
+ address, err := f.vbankKeeper.AddressCodec().BytesToString(addressBytes)
275
+ if err != nil {
276
+ address = fmt.Sprintf("(invalid address: %x)", addressBytes)
277
+ }
278
+
279
+ fmt.Fprintf(os.Stderr, "Address: %s, Denoms: %s\n", address, denoms)
280
+ t.Logf("Address: %s, Denoms: %s", address, denoms)
281
+ preCount++
282
+ }
283
+ iterator.Close()
284
+
285
+ require.Equal(t, preCount, 0)
286
+
287
+ // Mint and distribute coins to match unit test setup
288
+ // addr1: 1000 ubld
289
+ f.bankKeeper.MintCoins(f.ctx, "mint", sdk.NewCoins(sdk.NewInt64Coin("ubld", 1000)))
290
+ f.bankKeeper.SendCoinsFromModuleToAccount(f.ctx, "mint", addr1, sdk.NewCoins(sdk.NewInt64Coin("ubld", 1000)))
291
+
292
+ // addr2: 4000 urun and 7 arcadeTokens
293
+ f.bankKeeper.MintCoins(f.ctx, "mint", sdk.NewCoins(
294
+ sdk.NewInt64Coin("urun", 4000),
295
+ sdk.NewInt64Coin("arcadeTokens", 7),
296
+ ))
297
+
298
+ f.bankKeeper.SendCoinsFromModuleToAccount(f.ctx, "mint", addr2, sdk.NewCoins(
299
+ sdk.NewInt64Coin("urun", 4000),
300
+ sdk.NewInt64Coin("arcadeTokens", 7),
301
+ ))
302
+
303
+ // addr1 send to addr4: 1000 urun
304
+ f.bankKeeper.SendCoins(f.ctx, addr1, addr4, sdk.NewCoins(sdk.NewInt64Coin("ubld", 1000)))
305
+
306
+ // Set params
307
+ f.vbankKeeper.SetParams(f.ctx, vbanktypes.Params{
308
+ PerEpochRewardFraction: sdkmath.LegacyZeroDec(),
309
+ AllowedMonitoringAccounts: []string{"*"},
310
+ })
311
+
312
+ // Get the address update store
313
+ f.advanceBlock(t)
314
+ adStore = f.vbankKeeper.OpenAddressToUpdateStore(f.ctx)
315
+
316
+ // Print all entries in the store
317
+ iterator = adStore.Iterator(nil, nil)
318
+ defer iterator.Close()
319
+ postCount := 0
320
+
321
+ t.Logf("addr1: %s", addr1)
322
+ t.Logf("addr2: %s", addr2)
323
+ t.Logf("addr3: %s", addr3)
324
+ t.Logf("addr4: %s", addr4)
325
+ t.Logf("mint: %s", authtypes.NewModuleAddress("mint"))
326
+ expected := map[string]string{
327
+ addr1.String(): "2000ubld",
328
+ addr2.String(): "7arcadeTokens,4000urun",
329
+ addr4.String(): "1000ubld",
330
+ authtypes.NewModuleAddress("mint").String(): "7arcadeTokens,1000ubld,4000urun",
331
+ }
332
+
333
+ for ; iterator.Valid(); iterator.Next() {
334
+ addressBytes := iterator.Key()
335
+ denoms := string(iterator.Value())
336
+
337
+ // Convert raw address bytes to bech32 format for readability
338
+ address, err := f.vbankKeeper.AddressCodec().BytesToString(addressBytes)
339
+ if err != nil {
340
+ address = fmt.Sprintf("(invalid address: %x)", addressBytes)
341
+ }
342
+
343
+ require.Equal(t, expected[address], denoms)
344
+
345
+ postCount++
346
+ }
347
+
348
+ }
@@ -76,4 +76,9 @@ extend google.protobuf.FieldOptions {
76
76
  // out := AminoJSONEncoder(&f);
77
77
  // out == {"baz":""}
78
78
  bool dont_omitempty = 11110005;
79
- }
79
+
80
+ // oneof_name sets the type name for the given field oneof field. This is used
81
+ // by the Amino JSON encoder to encode the type of the oneof field, and must be the same string in
82
+ // the RegisterConcrete() method usage used to register the concrete type.
83
+ string oneof_name = 11110006;
84
+ }
@@ -19,7 +19,7 @@ message Coin {
19
19
  string denom = 1;
20
20
  string amount = 2 [
21
21
  (cosmos_proto.scalar) = "cosmos.Int",
22
- (gogoproto.customtype) = "Int",
22
+ (gogoproto.customtype) = "cosmossdk.io/math.Int",
23
23
  (gogoproto.nullable) = false,
24
24
  (amino.dont_omitempty) = true
25
25
  ];
@@ -33,16 +33,29 @@ message DecCoin {
33
33
  option (gogoproto.equal) = true;
34
34
 
35
35
  string denom = 1;
36
- string amount = 2
37
- [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false];
36
+ string amount = 2 [
37
+ (cosmos_proto.scalar) = "cosmos.Dec",
38
+ (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
39
+ (gogoproto.nullable) = false
40
+ ];
38
41
  }
39
42
 
40
43
  // IntProto defines a Protobuf wrapper around an Int object.
44
+ // Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal.
41
45
  message IntProto {
42
- string int = 1 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false];
46
+ string int = 1 [
47
+ (cosmos_proto.scalar) = "cosmos.Int",
48
+ (gogoproto.customtype) = "cosmossdk.io/math.Int",
49
+ (gogoproto.nullable) = false
50
+ ];
43
51
  }
44
52
 
45
53
  // DecProto defines a Protobuf wrapper around a Dec object.
54
+ // Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal.
46
55
  message DecProto {
47
- string dec = 1 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false];
56
+ string dec = 1 [
57
+ (cosmos_proto.scalar) = "cosmos.Dec",
58
+ (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
59
+ (gogoproto.nullable) = false
60
+ ];
48
61
  }
@@ -7,14 +7,13 @@ import "google/protobuf/timestamp.proto";
7
7
  import "cosmos_proto/cosmos.proto";
8
8
  import "amino/amino.proto";
9
9
 
10
- option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types";
10
+ option go_package = "cosmossdk.io/x/upgrade/types";
11
11
  option (gogoproto.goproto_getters_all) = false;
12
12
 
13
13
  // Plan specifies information about a planned upgrade and when it should occur.
14
14
  message Plan {
15
- option (amino.name) = "cosmos-sdk/Plan";
16
- option (gogoproto.equal) = true;
17
- option (gogoproto.goproto_stringer) = false;
15
+ option (amino.name) = "cosmos-sdk/Plan";
16
+ option (gogoproto.equal) = true;
18
17
 
19
18
  // Sets the name for the upgrade. This name will be used by the upgraded
20
19
  // version of the software to apply any special "on-upgrade" commands during
@@ -53,7 +52,6 @@ message SoftwareUpgradeProposal {
53
52
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
54
53
  option (amino.name) = "cosmos-sdk/SoftwareUpgradeProposal";
55
54
  option (gogoproto.equal) = true;
56
- option (gogoproto.goproto_stringer) = false;
57
55
 
58
56
  // title of the proposal
59
57
  string title = 1;
@@ -74,7 +72,6 @@ message CancelSoftwareUpgradeProposal {
74
72
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
75
73
  option (amino.name) = "cosmos-sdk/CancelSoftwareUpgradeProposal";
76
74
  option (gogoproto.equal) = true;
77
- option (gogoproto.goproto_stringer) = false;
78
75
 
79
76
  // title of the proposal
80
77
  string title = 1;
@@ -87,8 +84,7 @@ message CancelSoftwareUpgradeProposal {
87
84
  //
88
85
  // Since: cosmos-sdk 0.43
89
86
  message ModuleVersion {
90
- option (gogoproto.equal) = true;
91
- option (gogoproto.goproto_stringer) = true;
87
+ option (gogoproto.equal) = true;
92
88
 
93
89
  // name of the app module
94
90
  string name = 1;
@@ -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/v7/modules/core/04-channel/types";
5
+ option go_package = "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types";
6
6
 
7
7
  import "gogoproto/gogo.proto";
8
8
  import "ibc/core/client/v1/client.proto";
@@ -21,9 +21,12 @@ message Channel {
21
21
  Counterparty counterparty = 3 [(gogoproto.nullable) = false];
22
22
  // list of connection identifiers, in order, along which packets sent on
23
23
  // this channel will travel
24
- repeated string connection_hops = 4 [(gogoproto.moretags) = "yaml:\"connection_hops\""];
24
+ repeated string connection_hops = 4;
25
25
  // opaque channel version, which is agreed upon during the handshake
26
26
  string version = 5;
27
+ // upgrade sequence indicates the latest upgrade attempt performed by this channel
28
+ // the value of 0 indicates the channel has never been upgraded
29
+ uint64 upgrade_sequence = 6;
27
30
  }
28
31
 
29
32
  // IdentifiedChannel defines a channel with additional port and channel
@@ -39,17 +42,20 @@ message IdentifiedChannel {
39
42
  Counterparty counterparty = 3 [(gogoproto.nullable) = false];
40
43
  // list of connection identifiers, in order, along which packets sent on
41
44
  // this channel will travel
42
- repeated string connection_hops = 4 [(gogoproto.moretags) = "yaml:\"connection_hops\""];
45
+ repeated string connection_hops = 4;
43
46
  // opaque channel version, which is agreed upon during the handshake
44
47
  string version = 5;
45
48
  // port identifier
46
49
  string port_id = 6;
47
50
  // channel identifier
48
51
  string channel_id = 7;
52
+ // upgrade sequence indicates the latest upgrade attempt performed by this channel
53
+ // the value of 0 indicates the channel has never been upgraded
54
+ uint64 upgrade_sequence = 8;
49
55
  }
50
56
 
51
57
  // State defines if a channel is in one of the following states:
52
- // CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED.
58
+ // CLOSED, INIT, TRYOPEN, OPEN, FLUSHING, FLUSHCOMPLETE or UNINITIALIZED.
53
59
  enum State {
54
60
  option (gogoproto.goproto_enum_prefix) = false;
55
61
 
@@ -65,6 +71,10 @@ enum State {
65
71
  // A channel has been closed and can no longer be used to send or receive
66
72
  // packets.
67
73
  STATE_CLOSED = 4 [(gogoproto.enumvalue_customname) = "CLOSED"];
74
+ // A channel has just accepted the upgrade handshake attempt and is flushing in-flight packets.
75
+ STATE_FLUSHING = 5 [(gogoproto.enumvalue_customname) = "FLUSHING"];
76
+ // A channel has just completed flushing any in-flight packets.
77
+ STATE_FLUSHCOMPLETE = 6 [(gogoproto.enumvalue_customname) = "FLUSHCOMPLETE"];
68
78
  }
69
79
 
70
80
  // Order defines if a channel is ORDERED or UNORDERED
@@ -85,9 +95,9 @@ message Counterparty {
85
95
  option (gogoproto.goproto_getters) = false;
86
96
 
87
97
  // port on the counterparty chain which owns the other end of the channel.
88
- string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
98
+ string port_id = 1;
89
99
  // channel end on the counterparty chain
90
- string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
100
+ string channel_id = 2;
91
101
  }
92
102
 
93
103
  // Packet defines a type that carries data across different chains through IBC
@@ -99,20 +109,19 @@ message Packet {
99
109
  // with a later sequence number.
100
110
  uint64 sequence = 1;
101
111
  // identifies the port on the sending chain.
102
- string source_port = 2 [(gogoproto.moretags) = "yaml:\"source_port\""];
112
+ string source_port = 2;
103
113
  // identifies the channel end on the sending chain.
104
- string source_channel = 3 [(gogoproto.moretags) = "yaml:\"source_channel\""];
114
+ string source_channel = 3;
105
115
  // identifies the port on the receiving chain.
106
- string destination_port = 4 [(gogoproto.moretags) = "yaml:\"destination_port\""];
116
+ string destination_port = 4;
107
117
  // identifies the channel end on the receiving chain.
108
- string destination_channel = 5 [(gogoproto.moretags) = "yaml:\"destination_channel\""];
118
+ string destination_channel = 5;
109
119
  // actual opaque bytes transferred directly to the application module
110
120
  bytes data = 6;
111
121
  // block height after which the packet times out
112
- ibc.core.client.v1.Height timeout_height = 7
113
- [(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false];
122
+ ibc.core.client.v1.Height timeout_height = 7 [(gogoproto.nullable) = false];
114
123
  // block timestamp (in nanoseconds) after which the packet times out
115
- uint64 timeout_timestamp = 8 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];
124
+ uint64 timeout_timestamp = 8;
116
125
  }
117
126
 
118
127
  // PacketState defines the generic type necessary to retrieve and store
@@ -123,9 +132,9 @@ message PacketState {
123
132
  option (gogoproto.goproto_getters) = false;
124
133
 
125
134
  // channel port identifier.
126
- string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
135
+ string port_id = 1;
127
136
  // channel unique identifier.
128
- string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
137
+ string channel_id = 2;
129
138
  // packet sequence.
130
139
  uint64 sequence = 3;
131
140
  // embedded data that represents packet state.
@@ -139,9 +148,9 @@ message PacketId {
139
148
  option (gogoproto.goproto_getters) = false;
140
149
 
141
150
  // channel port identifier
142
- string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
151
+ string port_id = 1;
143
152
  // channel unique identifier
144
- string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
153
+ string channel_id = 2;
145
154
  // packet sequence
146
155
  uint64 sequence = 3;
147
156
  }
@@ -160,3 +169,19 @@ message Acknowledgement {
160
169
  string error = 22;
161
170
  }
162
171
  }
172
+
173
+ // Timeout defines an execution deadline structure for 04-channel handlers.
174
+ // This includes packet lifecycle handlers as well as the upgrade handshake handlers.
175
+ // A valid Timeout contains either one or both of a timestamp and block height (sequence).
176
+ message Timeout {
177
+ // block height after which the packet or upgrade times out
178
+ ibc.core.client.v1.Height height = 1 [(gogoproto.nullable) = false];
179
+ // block timestamp (in nanoseconds) after which the packet or upgrade times out
180
+ uint64 timestamp = 2;
181
+ }
182
+
183
+ // Params defines the set of IBC channel parameters.
184
+ message Params {
185
+ // the relative timeout after which channel upgrades will time out.
186
+ Timeout upgrade_timeout = 1 [(gogoproto.nullable) = false];
187
+ }