@agoric/cosmos 0.35.0-u21.0 → 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 (113) 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/daemon/cmd/testnet.go +0 -539
@@ -8,16 +8,19 @@ import (
8
8
  "strings"
9
9
  "testing"
10
10
 
11
+ storemetrics "cosmossdk.io/store/metrics"
12
+
11
13
  "github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/types"
12
14
 
13
- "github.com/cosmos/cosmos-sdk/store"
14
- storetypes "github.com/cosmos/cosmos-sdk/store/types"
15
+ "cosmossdk.io/store"
16
+ storetypes "cosmossdk.io/store/types"
17
+ "github.com/cosmos/cosmos-sdk/runtime"
15
18
  sdk "github.com/cosmos/cosmos-sdk/types"
16
19
 
20
+ "cosmossdk.io/log"
17
21
  agorictypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
18
- dbm "github.com/cometbft/cometbft-db"
19
- "github.com/cometbft/cometbft/libs/log"
20
22
  tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
23
+ dbm "github.com/cosmos/cosmos-db"
21
24
  )
22
25
 
23
26
  var (
@@ -32,22 +35,23 @@ type testKit struct {
32
35
  keeper Keeper
33
36
  handler vstorageHandler
34
37
  ctx sdk.Context
35
- cctx context.Context
36
38
  }
37
39
 
38
40
  func makeTestKit() testKit {
39
- keeper := NewKeeper(storeKey)
41
+ kvStoreService := runtime.NewKVStoreService(storeKey)
42
+
43
+ keeper := NewKeeper(storeKey.Name(), kvStoreService)
40
44
  db := dbm.NewMemDB()
41
- ms := store.NewCommitMultiStore(db)
45
+ logger := log.NewNopLogger()
46
+ ms := store.NewCommitMultiStore(db, logger, storemetrics.NewNoOpMetrics())
42
47
  ms.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
43
48
  err := ms.LoadLatestVersion()
44
49
  if err != nil {
45
50
  panic(err)
46
51
  }
47
52
  ctx := sdk.NewContext(ms, tmproto.Header{}, false, log.NewNopLogger())
48
- cctx := sdk.WrapSDKContext(ctx)
49
53
  handler := vstorageHandler{keeper}
50
- return testKit{keeper, handler, ctx, cctx}
54
+ return testKit{keeper, handler, ctx}
51
55
  }
52
56
 
53
57
  func callReceive(
@@ -68,7 +72,7 @@ func callReceive(
68
72
 
69
73
  func TestGetAndHas(t *testing.T) {
70
74
  kit := makeTestKit()
71
- keeper, handler, ctx, cctx := kit.keeper, kit.handler, kit.ctx, kit.cctx
75
+ keeper, handler, ctx := kit.keeper, kit.handler, kit.ctx
72
76
 
73
77
  keeper.SetStorage(ctx, agorictypes.NewKVEntry("foo", "bar"))
74
78
  keeper.SetStorage(ctx, agorictypes.NewKVEntry("empty", ""))
@@ -92,8 +96,8 @@ func TestGetAndHas(t *testing.T) {
92
96
  {label: "extra args", args: []interface{}{"foo", "bar"}, errContains: ptr(`extra`)},
93
97
  }
94
98
  for _, desc := range cases {
95
- got, err := callReceive(handler, cctx, "get", desc.args)
96
- has, hasErr := callReceive(handler, cctx, "has", desc.args)
99
+ got, err := callReceive(handler, ctx, "get", desc.args)
100
+ has, hasErr := callReceive(handler, ctx, "has", desc.args)
97
101
 
98
102
  // Verify get/has error agreement.
99
103
  if (err == nil) != (hasErr == nil) {
@@ -125,7 +129,7 @@ func TestGetAndHas(t *testing.T) {
125
129
 
126
130
  func doTestSet(t *testing.T, method string, expectNotify bool) {
127
131
  kit := makeTestKit()
128
- keeper, handler, ctx, cctx := kit.keeper, kit.handler, kit.ctx, kit.cctx
132
+ keeper, handler, ctx := kit.keeper, kit.handler, kit.ctx
129
133
 
130
134
  type testCase struct {
131
135
  label string
@@ -183,7 +187,7 @@ func doTestSet(t *testing.T, method string, expectNotify bool) {
183
187
  stateChangeEvent("qux", "A"),
184
188
  }
185
189
  for _, desc := range cases {
186
- got, err := callReceive(handler, cctx, method, desc.args)
190
+ got, err := callReceive(handler, ctx, method, desc.args)
187
191
 
188
192
  if desc.errContains == nil {
189
193
  if err != nil {
@@ -208,7 +212,7 @@ func doTestSet(t *testing.T, method string, expectNotify bool) {
208
212
  }
209
213
  wantBackBytes, _ := json.Marshal(value)
210
214
  wantBack := string(wantBackBytes)
211
- gotBack, err := callReceive(handler, cctx, "get", []interface{}{path})
215
+ gotBack, err := callReceive(handler, ctx, "get", []interface{}{path})
212
216
  if err != nil {
213
217
  t.Errorf("%s %s read back %q: got unexpected error %v", method, desc.label, path, err)
214
218
  } else if gotBack != wantBack {
@@ -257,7 +261,7 @@ func TestSetWithoutNotify(t *testing.T) {
257
261
 
258
262
  func TestEntries(t *testing.T) {
259
263
  kit := makeTestKit()
260
- keeper, handler, ctx, cctx := kit.keeper, kit.handler, kit.ctx, kit.cctx
264
+ keeper, handler, ctx := kit.keeper, kit.handler, kit.ctx
261
265
 
262
266
  keeper.SetStorage(ctx, agorictypes.NewKVEntry("key1", "value1"))
263
267
  keeper.SetStorage(ctx, agorictypes.NewKVEntry("key1.child1.grandchild1", "value1grandchild"))
@@ -286,7 +290,7 @@ func TestEntries(t *testing.T) {
286
290
  {path: "nosuchkey", want: `[]`},
287
291
  }
288
292
  for _, desc := range cases {
289
- got, err := callReceive(handler, cctx, "entries", []interface{}{desc.path})
293
+ got, err := callReceive(handler, ctx, "entries", []interface{}{desc.path})
290
294
  if got != desc.want {
291
295
  t.Errorf("%s: got %q; want %q", desc.path, got, desc.want)
292
296
  }
@@ -4,7 +4,6 @@ import (
4
4
  "fmt"
5
5
 
6
6
  "github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/types"
7
- abci "github.com/cometbft/cometbft/abci/types"
8
7
  sdk "github.com/cosmos/cosmos-sdk/types"
9
8
  )
10
9
 
@@ -23,9 +22,8 @@ func DefaultGenesisState() *types.GenesisState {
23
22
  return &types.GenesisState{}
24
23
  }
25
24
 
26
- func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) []abci.ValidatorUpdate {
25
+ func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) {
27
26
  keeper.SetWatchedAddresses(ctx, data.GetWatchedAddresses())
28
- return []abci.ValidatorUpdate{}
29
27
  }
30
28
 
31
29
  func ExportGenesis(ctx sdk.Context, k Keeper) *types.GenesisState {
@@ -3,15 +3,16 @@ package vtransfer
3
3
  import (
4
4
  "fmt"
5
5
 
6
+ sdkioerrors "cosmossdk.io/errors"
6
7
  "github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/keeper"
8
+ "github.com/cosmos/cosmos-sdk/baseapp"
7
9
  sdk "github.com/cosmos/cosmos-sdk/types"
8
10
 
9
- sdkioerrors "cosmossdk.io/errors"
10
11
  sdktypeserrors "github.com/cosmos/cosmos-sdk/types/errors"
11
12
  )
12
13
 
13
14
  // NewHandler returns a handler for "vtransfer" type messages.
14
- func NewHandler(keeper keeper.Keeper) sdk.Handler {
15
+ func NewHandler(keeper keeper.Keeper) baseapp.MsgServiceHandler {
15
16
  return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
16
17
  switch msg := msg.(type) {
17
18
  default:
@@ -3,11 +3,11 @@ package vtransfer
3
3
  import (
4
4
  "github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/keeper"
5
5
  sdk "github.com/cosmos/cosmos-sdk/types"
6
- capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
7
- clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
8
- channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
9
- porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
10
- "github.com/cosmos/ibc-go/v7/modules/core/exported"
6
+ capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
7
+ clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
8
+ channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
9
+ porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
10
+ "github.com/cosmos/ibc-go/v8/modules/core/exported"
11
11
  )
12
12
 
13
13
  // IBCMiddleware (https://ibc.cosmos.network/main/ibc/apps/ibcmodule) forwards
@@ -10,12 +10,12 @@ import (
10
10
  "testing"
11
11
  "text/template"
12
12
 
13
+ "cosmossdk.io/log"
14
+ "cosmossdk.io/store"
13
15
  app "github.com/Agoric/agoric-sdk/golang/cosmos/app"
14
16
  "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
15
- dbm "github.com/cometbft/cometbft-db"
16
- "github.com/cometbft/cometbft/libs/log"
17
+ dbm "github.com/cosmos/cosmos-db"
17
18
  "github.com/cosmos/cosmos-sdk/codec"
18
- "github.com/cosmos/cosmos-sdk/store"
19
19
  "github.com/cosmos/cosmos-sdk/testutil/sims"
20
20
  "github.com/cosmos/cosmos-sdk/testutil/testdata"
21
21
  "github.com/iancoleman/orderedmap"
@@ -26,16 +26,18 @@ import (
26
26
  swingsettypes "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types"
27
27
  vibctypes "github.com/Agoric/agoric-sdk/golang/cosmos/x/vibc/types"
28
28
 
29
+ sdkmath "cosmossdk.io/math"
30
+ abci "github.com/cometbft/cometbft/abci/types"
29
31
  tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
30
32
  "github.com/cosmos/cosmos-sdk/baseapp"
31
33
  sdk "github.com/cosmos/cosmos-sdk/types"
32
34
  authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
33
35
  banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
34
- packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
35
- ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
36
- channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
37
- ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
38
- ibctesting "github.com/cosmos/ibc-go/v7/testing"
36
+ packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types"
37
+ ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
38
+ channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
39
+ ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
40
+ ibctesting "github.com/cosmos/ibc-go/v8/testing"
39
41
  )
40
42
 
41
43
  const (
@@ -106,7 +108,7 @@ func (s *IntegrationTestSuite) nextChannelOffset(instance int) int {
106
108
  return offset
107
109
  }
108
110
 
109
- func SetupAgoricTestingApp(instance int) TestingAppMaker {
111
+ func SetupAgoricTestingApp(t *testing.T, instance int) TestingAppMaker {
110
112
  return func() (ibctesting.TestingApp, map[string]json.RawMessage) {
111
113
  db := dbm.NewMemDB()
112
114
  mockController := func(ctx context.Context, needReply bool, jsonRequest string) (jsonReply string, err error) {
@@ -122,9 +124,9 @@ func SetupAgoricTestingApp(instance int) TestingAppMaker {
122
124
  jsonReply = `true`
123
125
  return jsonReply, nil
124
126
  }
125
- appd := app.NewAgoricApp(mockController, vm.NewAgdServer(), log.TestingLogger(), db, nil,
127
+ appd := app.NewAgoricApp(mockController, vm.NewAgdServer(), log.NewTestLogger(t), db, nil,
126
128
  true, sims.EmptyAppOptions{}, interBlockCacheOpt())
127
- genesisState := app.NewDefaultGenesisState()
129
+ genesisState := app.NewDefaultGenesisState(appd.AppCodec(), appd.BasicModuleManager)
128
130
 
129
131
  t := template.Must(template.New("").Parse(`
130
132
  {
@@ -146,7 +148,7 @@ func SetupAgoricTestingApp(instance int) TestingAppMaker {
146
148
  "connections": [],
147
149
  "next_connection_sequence": "{{.nextConnectionSequence}}",
148
150
  "params": {
149
- "max_expected_time_per_block": "30000000000"
151
+ "max_expected_time_per_block": "30000000000"
150
152
  }
151
153
  },
152
154
  "channel_genesis": {
@@ -155,6 +157,15 @@ func SetupAgoricTestingApp(instance int) TestingAppMaker {
155
157
  "channels": [],
156
158
  "commitments": [],
157
159
  "next_channel_sequence": "{{.nextChannelSequence}}",
160
+ "params": {
161
+ "upgrade_timeout": {
162
+ "height": {
163
+ "revision_number": "0",
164
+ "revision_height": "0"
165
+ },
166
+ "timestamp": "600000000000"
167
+ }
168
+ },
158
169
  "receipts": [],
159
170
  "recv_sequences": [],
160
171
  "send_sequences": []
@@ -184,14 +195,14 @@ func (s *IntegrationTestSuite) SetupTest() {
184
195
 
185
196
  chains := make(map[string]*ibctesting.TestChain)
186
197
  for i := 0; i < 3; i++ {
187
- ibctesting.DefaultTestingAppInit = SetupAgoricTestingApp(i)
198
+ ibctesting.DefaultTestingAppInit = SetupAgoricTestingApp(s.T(), i)
188
199
 
189
200
  chainID := ibctesting.GetChainID(i)
190
201
  chain := ibctesting.NewTestChain(s.T(), s.coordinator, chainID)
191
202
 
192
203
  balance := banktypes.Balance{
193
204
  Address: chain.SenderAccount.GetAddress().String(),
194
- Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))),
205
+ Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000000000000))),
195
206
  }
196
207
 
197
208
  // create application and override files in the IBC test chain
@@ -353,7 +364,7 @@ func (s *IntegrationTestSuite) TransferFromEndpoint(
353
364
  src *ibctesting.Endpoint,
354
365
  data ibctransfertypes.FungibleTokenPacketData,
355
366
  ) error {
356
- tokenAmt, ok := sdk.NewIntFromString(data.Amount)
367
+ tokenAmt, ok := sdkmath.NewIntFromString(data.Amount)
357
368
  s.Require().True(ok)
358
369
 
359
370
  timeoutHeight := src.Counterparty.Chain.GetTimeoutHeight()
@@ -416,11 +427,11 @@ func (s *IntegrationTestSuite) overrideSendPacketData(cdc codec.Codec, data []by
416
427
 
417
428
  func (s *IntegrationTestSuite) mintToAddress(chain *ibctesting.TestChain, addr sdk.AccAddress, denom, amount string) {
418
429
  app := s.GetApp(chain)
419
- tokenAmt, ok := sdk.NewIntFromString(amount)
430
+ tokenAmt, ok := sdkmath.NewIntFromString(amount)
420
431
  s.Require().True(ok)
421
432
  intAmt, err := strconv.ParseInt(amount, 10, 64)
422
433
  s.Require().NoError(err)
423
- coins := sdk.NewCoins(sdk.NewCoin(denom, tokenAmt.Mul(sdk.NewInt(intAmt))))
434
+ coins := sdk.NewCoins(sdk.NewCoin(denom, tokenAmt.Mul(sdkmath.NewInt(intAmt))))
424
435
  err = app.BankKeeper.MintCoins(chain.GetContext(), ibctransfertypes.ModuleName, coins)
425
436
  s.Require().NoError(err)
426
437
  err = app.BankKeeper.SendCoinsFromModuleToAccount(chain.GetContext(), ibctransfertypes.ModuleName, addr, coins)
@@ -577,13 +588,13 @@ func (s *IntegrationTestSuite) TestHops() {
577
588
  err = s.TransferFromEndpoint(sendContext, paths[0].EndpointA, transferData)
578
589
  s.Require().NoError(err)
579
590
 
580
- sendPacket, err := ParsePacketFromEvents(sendContext.EventManager().Events())
591
+ sendPacket, err := ParsePacketFromEvents(sendContext.EventManager().ABCIEvents())
581
592
  s.Require().NoError(err)
582
593
 
583
594
  s.coordinator.CommitBlock(s.chainA)
584
595
 
585
596
  // Relay the packet through the intermediaries to the final destination.
586
- var packetRes *sdk.Result
597
+ var packetRes *abci.ExecTxResult
587
598
  var writeAcknowledgementHeight, writeAcknowledgementTime int64
588
599
  for pathIdx := 0; pathIdx < hops; pathIdx += 1 {
589
600
  nextPath := paths[pathIdx]
@@ -611,7 +622,8 @@ func (s *IntegrationTestSuite) TestHops() {
611
622
  }
612
623
 
613
624
  // The PFM should have received the packet and advertised a send toward the last path.
614
- sendPacket, err = ParsePacketFromEvents(packetRes.GetEvents())
625
+
626
+ sendPacket, err = ParsePacketFromEvents(packetRes.Events)
615
627
  s.Require().NoError(err)
616
628
  }
617
629
 
@@ -621,10 +633,10 @@ func (s *IntegrationTestSuite) TestHops() {
621
633
  expectedAck := channeltypes.NewResultAcknowledgement([]byte{1})
622
634
 
623
635
  {
624
- var events sdk.Events
636
+ var events []abci.Event
625
637
  var ackData []byte
626
638
  if packetRes != nil {
627
- events = packetRes.GetEvents()
639
+ events = packetRes.Events
628
640
  ackData, err = ParseAckFromEvents(events)
629
641
  }
630
642
  if tc.receiverIsTarget {
@@ -636,7 +648,7 @@ func (s *IntegrationTestSuite) TestHops() {
636
648
  err = s.GetApp(s.chainB).VtransferKeeper.ReceiveWriteAcknowledgement(vmAckContext, sendPacket, expectedAck)
637
649
  s.Require().NoError(err)
638
650
 
639
- events = vmAckContext.EventManager().Events()
651
+ events = vmAckContext.EventManager().ABCIEvents()
640
652
  ackData, err = ParseAckFromEvents(events)
641
653
  }
642
654
 
@@ -685,10 +697,10 @@ func (s *IntegrationTestSuite) TestHops() {
685
697
  ackRes, err := acknowledgePacketWithResult(priorPath.EndpointA, ackedPacket, ack.Acknowledgement())
686
698
  s.Require().NoError(err)
687
699
 
688
- ackedPacket, err = ParsePacketFromFilteredEvents(ackRes.GetEvents(), channeltypes.EventTypeWriteAck)
700
+ ackedPacket, err = ParsePacketFromFilteredEvents(ackRes.Events, channeltypes.EventTypeWriteAck)
689
701
  s.Require().NoError(err)
690
702
 
691
- ackData, err := ParseAckFromEvents(ackRes.GetEvents())
703
+ ackData, err := ParseAckFromEvents(ackRes.Events)
692
704
  s.Require().NoError(err)
693
705
  ack = vibctypes.NewRawAcknowledgement(ackData)
694
706
 
@@ -712,13 +724,15 @@ func (s *IntegrationTestSuite) TestHops() {
712
724
  // Verify the resulting events.
713
725
  gotEvents := 0
714
726
  expectedEvents := 2
715
- for _, event := range ackRes.GetEvents() {
727
+ for _, event := range ackRes.Events {
716
728
  if event.Type == ibctransfertypes.EventTypePacket {
717
729
  gotEvents += 1
718
- if gotEvents == 2 && len(event.Attributes) == 1 {
730
+ if gotEvents == 2 && len(event.Attributes) == 2 {
719
731
  // We get a trailing event with a single "success" attribute.
720
732
  s.Require().Equal(ibctransfertypes.AttributeKeyAckSuccess, string(event.Attributes[0].Key))
721
733
  s.Require().Equal("\x01", string(event.Attributes[0].Value))
734
+ s.Require().Equal("msg_index", string(event.Attributes[1].Key))
735
+ s.Require().Equal("0", string(event.Attributes[1].Value))
722
736
  continue
723
737
  }
724
738
  expectedAttrs := 6
@@ -793,7 +807,7 @@ func (s *IntegrationTestSuite) TestHops() {
793
807
  res, err := s.GetApp(s.chainB).BankKeeper.AllBalances(s.chainB.GetContext(), req)
794
808
  s.Require().NoError(err)
795
809
 
796
- amt, ok := sdk.NewIntFromString(transferData.Amount)
810
+ amt, ok := sdkmath.NewIntFromString(transferData.Amount)
797
811
  s.Require().True(ok)
798
812
 
799
813
  // Decode the denom trace to get the denom hash.
@@ -805,7 +819,7 @@ func (s *IntegrationTestSuite) TestHops() {
805
819
  receivedDenom := `ibc/` + hashRes.Hash
806
820
 
807
821
  coins := sdk.NewCoins(sdk.NewCoin(receivedDenom, amt))
808
- s.Require().True(coins.IsEqual(res.Balances))
822
+ s.Require().True(coins.Equal(res.Balances))
809
823
  })
810
824
  }
811
825
  }
@@ -6,27 +6,28 @@ import (
6
6
  "encoding/json"
7
7
  "fmt"
8
8
 
9
+ corestore "cosmossdk.io/core/store"
10
+ sdkioerrors "cosmossdk.io/errors"
11
+ "cosmossdk.io/store/prefix"
12
+ storetypes "cosmossdk.io/store/types"
9
13
  "github.com/cosmos/cosmos-sdk/codec"
10
- "github.com/cosmos/cosmos-sdk/store/prefix"
11
- storetypes "github.com/cosmos/cosmos-sdk/store/types"
14
+ "github.com/cosmos/cosmos-sdk/runtime"
12
15
  sdk "github.com/cosmos/cosmos-sdk/types"
13
-
14
- sdkioerrors "cosmossdk.io/errors"
15
16
  sdktypeserrors "github.com/cosmos/cosmos-sdk/types/errors"
16
17
 
17
- capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
18
- capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
18
+ capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
19
+ capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
19
20
 
20
21
  agtypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
21
22
  "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
22
23
  "github.com/Agoric/agoric-sdk/golang/cosmos/x/vibc"
23
24
  vibctypes "github.com/Agoric/agoric-sdk/golang/cosmos/x/vibc/types"
24
25
 
25
- clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
26
- channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
27
- porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
28
- host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
29
- ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
26
+ clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
27
+ channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
28
+ porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
29
+ host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
30
+ ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
30
31
  )
31
32
 
32
33
  var _ porttypes.ICS4Wrapper = (*Keeper)(nil)
@@ -56,8 +57,8 @@ type Keeper struct {
56
57
 
57
58
  vibcKeeper vibc.Keeper
58
59
 
59
- key storetypes.StoreKey
60
- cdc codec.Codec
60
+ storeService corestore.KVStoreService
61
+ cdc codec.Codec
61
62
 
62
63
  vibcModule porttypes.IBCModule
63
64
 
@@ -137,7 +138,7 @@ func NewICS4Wrapper(k Keeper, down porttypes.ICS4Wrapper) *ics4Wrapper {
137
138
  // NewKeeper creates a new vtransfer Keeper instance
138
139
  func NewKeeper(
139
140
  cdc codec.Codec,
140
- key storetypes.StoreKey,
141
+ storeService corestore.KVStoreService,
141
142
  prototypeVibcKeeper vibc.Keeper,
142
143
  scopedTransferKeeper capabilitykeeper.ScopedKeeper,
143
144
  pushAction vm.ActionPusher,
@@ -150,10 +151,10 @@ func NewKeeper(
150
151
  k := Keeper{
151
152
  ReceiverImpl: vibcKeeper,
152
153
 
153
- vibcKeeper: vibcKeeper,
154
- key: key,
155
- vibcModule: vibc.NewIBCModule(vibcKeeper),
156
- cdc: cdc,
154
+ vibcKeeper: vibcKeeper,
155
+ storeService: storeService,
156
+ vibcModule: vibc.NewIBCModule(vibcKeeper),
157
+ cdc: cdc,
157
158
 
158
159
  debug: &KeeperDebugOptions{
159
160
  OverridePacket: nil,
@@ -208,7 +209,9 @@ func sequencePath(sequence uint64) string {
208
209
  func (k Keeper) PacketStore(ctx sdk.Context, ourOrigin agtypes.PacketOrigin, ourPort string, ourChannel string, sequence uint64) (storetypes.KVStore, []byte) {
209
210
  key := fmt.Sprintf("%s/%s/%s", ourOrigin, channelPath(ourPort, ourChannel), sequencePath(sequence))
210
211
  packetKey := []byte(key)
211
- return prefix.NewStore(ctx.KVStore(k.key), []byte(packetDataStoreKeyPrefix)), packetKey
212
+ kvstore := k.storeService.OpenKVStore(ctx)
213
+ store := runtime.KVStoreAdapter(kvstore)
214
+ return prefix.NewStore(store, []byte(packetDataStoreKeyPrefix)), packetKey
212
215
  }
213
216
 
214
217
  func (k Keeper) PacketStoreFromOrigin(ctx sdk.Context, ourOrigin agtypes.PacketOrigin, packet ibcexported.PacketI) (storetypes.KVStore, []byte) {
@@ -371,19 +374,20 @@ func (k Keeper) InterceptWriteAcknowledgement(ctx sdk.Context, chanCap *capabili
371
374
 
372
375
  // targetIsWatched checks if a target address has been watched by the VM.
373
376
  func (k Keeper) targetIsWatched(ctx sdk.Context, target string) bool {
374
- prefixStore := prefix.NewStore(
375
- ctx.KVStore(k.key),
376
- []byte(watchedAddressStoreKeyPrefix),
377
- )
377
+ kvstore := k.storeService.OpenKVStore(ctx)
378
+ store := runtime.KVStoreAdapter(kvstore)
379
+ prefixStore := prefix.NewStore(store, []byte(watchedAddressStoreKeyPrefix))
378
380
  return prefixStore.Has([]byte(target))
379
381
  }
380
382
 
381
383
  // GetWatchedAdresses returns the watched addresses from the keeper as a slice
382
384
  // of account addresses.
383
385
  func (k Keeper) GetWatchedAddresses(ctx sdk.Context) ([]sdk.AccAddress, error) {
386
+ kvstore := k.storeService.OpenKVStore(ctx)
387
+ store := runtime.KVStoreAdapter(kvstore)
384
388
  addresses := make([]sdk.AccAddress, 0)
385
- prefixStore := prefix.NewStore(ctx.KVStore(k.key), []byte(watchedAddressStoreKeyPrefix))
386
- iterator := sdk.KVStorePrefixIterator(prefixStore, []byte{})
389
+ prefixStore := prefix.NewStore(store, []byte(watchedAddressStoreKeyPrefix))
390
+ iterator := storetypes.KVStorePrefixIterator(prefixStore, []byte{})
387
391
  defer iterator.Close()
388
392
  for ; iterator.Valid(); iterator.Next() {
389
393
  addr, err := sdk.AccAddressFromBech32(string(iterator.Key()))
@@ -398,10 +402,9 @@ func (k Keeper) GetWatchedAddresses(ctx sdk.Context) ([]sdk.AccAddress, error) {
398
402
  // SetWatchedAddresses sets the watched addresses in the keeper from a slice of
399
403
  // SDK account addresses.
400
404
  func (k Keeper) SetWatchedAddresses(ctx sdk.Context, addresses []sdk.AccAddress) {
401
- prefixStore := prefix.NewStore(
402
- ctx.KVStore(k.key),
403
- []byte(watchedAddressStoreKeyPrefix),
404
- )
405
+ kvstore := k.storeService.OpenKVStore(ctx)
406
+ store := runtime.KVStoreAdapter(kvstore)
407
+ prefixStore := prefix.NewStore(store, []byte(watchedAddressStoreKeyPrefix))
405
408
  for _, addr := range addresses {
406
409
  prefixStore.Set([]byte(addr.String()), []byte(watchedAddressSentinel))
407
410
  }
@@ -420,10 +423,9 @@ func (k Keeper) Receive(cctx context.Context, jsonRequest string) (jsonReply str
420
423
  return "", err
421
424
  }
422
425
 
423
- prefixStore := prefix.NewStore(
424
- ctx.KVStore(k.key),
425
- []byte(watchedAddressStoreKeyPrefix),
426
- )
426
+ kvstore := k.storeService.OpenKVStore(ctx)
427
+ store := runtime.KVStoreAdapter(kvstore)
428
+ prefixStore := prefix.NewStore(store, []byte(watchedAddressStoreKeyPrefix))
427
429
  switch msg.Type {
428
430
  case "BRIDGE_TARGET_REGISTER":
429
431
  prefixStore.Set([]byte(msg.Target), []byte(watchedAddressSentinel))
@@ -12,7 +12,6 @@ import (
12
12
  cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
13
13
  "github.com/cosmos/cosmos-sdk/types/module"
14
14
 
15
- abci "github.com/cometbft/cometbft/abci/types"
16
15
  sdk "github.com/cosmos/cosmos-sdk/types"
17
16
  )
18
17
 
@@ -20,12 +19,18 @@ import (
20
19
  var (
21
20
  _ module.AppModule = AppModule{}
22
21
  _ module.AppModuleBasic = AppModuleBasic{}
22
+ _ module.HasGenesis = AppModule{}
23
23
  )
24
24
 
25
25
  // app module Basics object
26
26
  type AppModuleBasic struct {
27
27
  }
28
28
 
29
+ // IsAppModule implements the appmodule.AppModule interface.
30
+ func (am AppModule) IsAppModule() {}
31
+
32
+ // IsOnePerModuleType is a marker function just indicates that this is a one-per-module type.
33
+ func (am AppModule) IsOnePerModuleType() {}
29
34
  func (AppModuleBasic) Name() string {
30
35
  return ModuleName
31
36
  }
@@ -91,18 +96,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
91
96
 
92
97
  func (AppModule) ConsensusVersion() uint64 { return 1 }
93
98
 
94
- func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
95
- }
96
-
97
- func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate {
98
- // Prevent Cosmos SDK internal errors.
99
- return []abci.ValidatorUpdate{}
100
- }
101
-
102
- func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate {
99
+ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) {
103
100
  var genesisState types.GenesisState
104
101
  cdc.MustUnmarshalJSON(data, &genesisState)
105
- return InitGenesis(ctx, am.keeper, &genesisState)
102
+ InitGenesis(ctx, am.keeper, &genesisState)
106
103
  }
107
104
 
108
105
  func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
@@ -2,9 +2,9 @@ package types
2
2
 
3
3
  import (
4
4
  sdk "github.com/cosmos/cosmos-sdk/types"
5
- capability "github.com/cosmos/cosmos-sdk/x/capability/types"
6
- channel "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
7
- ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
5
+ capability "github.com/cosmos/ibc-go/modules/capability/types"
6
+ channel "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
7
+ ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
8
8
  )
9
9
 
10
10
  // ChannelKeeper defines the expected IBC channel keeper