@agoric/cosmos 0.34.2-dev-c5dea1c.0.c5dea1c → 0.34.2-dev-4ea2a82.0.4ea2a82

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 (46) hide show
  1. package/Makefile +1 -0
  2. package/ante/ante.go +2 -2
  3. package/app/app.go +73 -96
  4. package/app/sim_test.go +0 -2
  5. package/app/upgrade.go +6 -6
  6. package/daemon/cmd/root_test.go +1 -0
  7. package/git-revision.txt +1 -1
  8. package/go.mod +83 -116
  9. package/go.sum +162 -130
  10. package/go.work +39 -0
  11. package/go.work.sum +2636 -0
  12. package/package.json +2 -2
  13. package/proto/Dockerfile +14 -0
  14. package/proto/agoric/swingset/msgs.proto +1 -0
  15. package/proto/agoric/vbank/msgs.proto +5 -1
  16. package/proto/agoric/vibc/msgs.proto +45 -2
  17. package/scripts/protocgen.sh +10 -1
  18. package/tests/integrations/types/aminojson_test.go +18 -2
  19. package/third_party/proto/cosmos/base/query/v1beta1/pagination.proto +2 -3
  20. package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +2 -3
  21. package/third_party/proto/ibc/core/channel/v1/channel.proto +6 -22
  22. package/third_party/proto/ibc/core/client/v1/client.proto +6 -53
  23. package/types/address_hooks.go +2 -2
  24. package/types/address_hooks_test.go +3 -3
  25. package/types/ibc_packet.go +3 -3
  26. package/types/ibc_packet_test.go +3 -3
  27. package/x/swingset/types/msgs.pb.go +90 -89
  28. package/x/vbank/types/msgs.pb.go +10 -8
  29. package/x/vibc/alias.go +0 -1
  30. package/x/vibc/keeper/dynamic_router.go +176 -0
  31. package/x/vibc/keeper/dynamic_router_test.go +240 -0
  32. package/x/vibc/keeper/keeper.go +40 -81
  33. package/x/vibc/keeper/migrations.go +1 -1
  34. package/x/vibc/keeper/scope.go +114 -0
  35. package/x/vibc/keeper/triggers.go +8 -4
  36. package/x/vibc/types/expected_keepers.go +7 -20
  37. package/x/vibc/types/ibc_module.go +13 -20
  38. package/x/vibc/types/msgs.go +60 -3
  39. package/x/vibc/types/msgs.pb.go +683 -31
  40. package/x/vibc/types/receiver.go +2 -2
  41. package/x/vlocalchain/vlocalchain_test.go +1 -1
  42. package/x/vtransfer/ibc_middleware.go +15 -17
  43. package/x/vtransfer/ibc_middleware_test.go +30 -53
  44. package/x/vtransfer/keeper/keeper.go +19 -28
  45. package/x/vtransfer/types/expected_keepers.go +15 -8
  46. package/x/vtransfer/utils_test.go +4 -9
@@ -7,9 +7,9 @@ import (
7
7
 
8
8
  "github.com/Agoric/agoric-sdk/golang/cosmos/types"
9
9
  "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
10
- channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
10
+ channeltypes "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"
11
11
 
12
- "github.com/cosmos/ibc-go/v8/modules/core/exported"
12
+ "github.com/cosmos/ibc-go/v10/modules/core/exported"
13
13
 
14
14
  sdk "github.com/cosmos/cosmos-sdk/types"
15
15
  )
@@ -24,7 +24,7 @@ import (
24
24
  authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
25
25
  banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
26
26
  stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
27
- transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
27
+ transfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
28
28
 
29
29
  tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
30
30
  "github.com/cosmos/gogoproto/jsonpb"
@@ -3,11 +3,10 @@ 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/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"
6
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
7
+ channeltypes "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"
8
+ porttypes "github.com/cosmos/ibc-go/v10/modules/core/05-port/types"
9
+ "github.com/cosmos/ibc-go/v10/modules/core/exported"
11
10
  )
12
11
 
13
12
  // IBCMiddleware (https://ibc.cosmos.network/main/ibc/apps/ibcmodule) forwards
@@ -57,11 +56,10 @@ func (im IBCMiddleware) OnChanOpenInit(
57
56
  connectionHops []string,
58
57
  portID string,
59
58
  channelID string,
60
- chanCap *capabilitytypes.Capability,
61
59
  counterparty channeltypes.Counterparty,
62
60
  version string,
63
61
  ) (string, error) {
64
- return im.ibcModule.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, version)
62
+ return im.ibcModule.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, counterparty, version)
65
63
  }
66
64
 
67
65
  // OnChanOpenTry implements the IBCModule interface.
@@ -71,11 +69,10 @@ func (im IBCMiddleware) OnChanOpenTry(
71
69
  connectionHops []string,
72
70
  portID,
73
71
  channelID string,
74
- chanCap *capabilitytypes.Capability,
75
72
  counterparty channeltypes.Counterparty,
76
73
  counterpartyVersion string,
77
74
  ) (string, error) {
78
- return im.ibcModule.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion)
75
+ return im.ibcModule.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, counterparty, counterpartyVersion)
79
76
  }
80
77
 
81
78
  // OnChanOpenAck implements the IBCModule interface.
@@ -125,29 +122,32 @@ func (im IBCMiddleware) OnChanCloseConfirm(
125
122
  // OnRecvPacket implements the IBCModule interface.
126
123
  func (im IBCMiddleware) OnRecvPacket(
127
124
  ctx sdk.Context,
125
+ channelVersion string,
128
126
  packet channeltypes.Packet,
129
127
  relayer sdk.AccAddress,
130
128
  ) exported.Acknowledgement {
131
- return im.vtransferKeeper.InterceptOnRecvPacket(ctx, im.ibcModule, packet, relayer)
129
+ return im.vtransferKeeper.InterceptOnRecvPacket(ctx, im.ibcModule, channelVersion, packet, relayer)
132
130
  }
133
131
 
134
132
  // OnAcknowledgementPacket implements the IBCModule interface.
135
133
  func (im IBCMiddleware) OnAcknowledgementPacket(
136
134
  ctx sdk.Context,
135
+ channelVersion string,
137
136
  packet channeltypes.Packet,
138
137
  acknowledgement []byte,
139
138
  relayer sdk.AccAddress,
140
139
  ) error {
141
- return im.vtransferKeeper.InterceptOnAcknowledgementPacket(ctx, im.ibcModule, packet, acknowledgement, relayer)
140
+ return im.vtransferKeeper.InterceptOnAcknowledgementPacket(ctx, im.ibcModule, channelVersion, packet, acknowledgement, relayer)
142
141
  }
143
142
 
144
143
  // OnTimeoutPacket implements the IBCModule interface.
145
144
  func (im IBCMiddleware) OnTimeoutPacket(
146
145
  ctx sdk.Context,
146
+ channelVersion string,
147
147
  packet channeltypes.Packet,
148
148
  relayer sdk.AccAddress,
149
149
  ) error {
150
- return im.vtransferKeeper.InterceptOnTimeoutPacket(ctx, im.ibcModule, packet, relayer)
150
+ return im.vtransferKeeper.InterceptOnTimeoutPacket(ctx, im.ibcModule, channelVersion, packet, relayer)
151
151
  }
152
152
 
153
153
  // WriteAcknowledgement implements the ICS4 Wrapper interface.
@@ -156,13 +156,12 @@ func (im IBCMiddleware) OnTimeoutPacket(
156
156
  // because they support packet initiation.
157
157
  func (im IBCMiddleware) WriteAcknowledgement(
158
158
  ctx sdk.Context,
159
- chanCap *capabilitytypes.Capability,
160
159
  packet exported.PacketI,
161
160
  ack exported.Acknowledgement,
162
161
  ) error {
163
- syncAck, origPacket := im.vtransferKeeper.InterceptWriteAcknowledgement(ctx, chanCap, packet, ack)
162
+ syncAck, origPacket := im.vtransferKeeper.InterceptWriteAcknowledgement(ctx, packet, ack)
164
163
  if syncAck != nil {
165
- return im.vtransferKeeper.WriteAcknowledgement(ctx, chanCap, origPacket, syncAck)
164
+ return im.vtransferKeeper.WriteAcknowledgement(ctx, origPacket, syncAck)
166
165
  }
167
166
  return nil
168
167
  }
@@ -174,14 +173,13 @@ func (im IBCMiddleware) WriteAcknowledgement(
174
173
  // SendPacket implements the ICS4 Wrapper interface.
175
174
  func (im IBCMiddleware) SendPacket(
176
175
  ctx sdk.Context,
177
- chanCap *capabilitytypes.Capability,
178
176
  sourcePort string,
179
177
  sourceChannel string,
180
178
  timeoutHeight clienttypes.Height,
181
179
  timeoutTimestamp uint64,
182
180
  data []byte,
183
181
  ) (uint64, error) {
184
- return im.vtransferKeeper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data)
182
+ return im.vtransferKeeper.SendPacket(ctx, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data)
185
183
  }
186
184
 
187
185
  // GetAppVersion implements the ICS4 Wrapper interface.
@@ -28,16 +28,15 @@ import (
28
28
 
29
29
  sdkmath "cosmossdk.io/math"
30
30
  abci "github.com/cometbft/cometbft/abci/types"
31
- tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
32
31
  "github.com/cosmos/cosmos-sdk/baseapp"
33
32
  sdk "github.com/cosmos/cosmos-sdk/types"
34
33
  authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
35
34
  banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
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"
35
+ packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v10/packetforward/types"
36
+ ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
37
+ channeltypes "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"
38
+ ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
39
+ ibctesting "github.com/cosmos/ibc-go/v10/testing"
41
40
  )
42
41
 
43
42
  const (
@@ -85,6 +84,7 @@ func (s *IntegrationTestSuite) cacheEndpoint(a, b int, endpoint *ibctesting.Endp
85
84
  amap := s.endpoints[a]
86
85
  if amap == nil {
87
86
  amap = make(map[int]*ibctesting.Endpoint)
87
+ s.endpoints[a] = amap
88
88
  }
89
89
  amap[b] = endpoint
90
90
  }
@@ -108,7 +108,7 @@ func (s *IntegrationTestSuite) nextChannelOffset(instance int) int {
108
108
  return offset
109
109
  }
110
110
 
111
- func SetupAgoricTestingApp(t *testing.T, instance int) TestingAppMaker {
111
+ func SetupAgoricTestingApp(t *testing.T, instance int) ibctesting.AppCreator {
112
112
  return func() (ibctesting.TestingApp, map[string]json.RawMessage) {
113
113
  db := dbm.NewMemDB()
114
114
  mockController := func(ctx context.Context, needReply bool, jsonRequest string) (jsonReply string, err error) {
@@ -157,15 +157,6 @@ func SetupAgoricTestingApp(t *testing.T, instance int) TestingAppMaker {
157
157
  "channels": [],
158
158
  "commitments": [],
159
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
- },
169
160
  "receipts": [],
170
161
  "recv_sequences": [],
171
162
  "send_sequences": []
@@ -218,14 +209,10 @@ func (s *IntegrationTestSuite) SetupTest() {
218
209
  )
219
210
 
220
211
  chain.App = app
221
- chain.QueryServer = app.GetIBCKeeper()
222
212
  chain.TxConfig = app.GetTxConfig()
223
213
  chain.Codec = app.AppCodec()
224
- chain.CurrentHeader = tmproto.Header{
225
- ChainID: chainID,
226
- Height: 1,
227
- Time: s.coordinator.CurrentTime.UTC(),
228
- }
214
+ chain.ProposedHeader.Height = 1
215
+ chain.ProposedHeader.Time = chain.Coordinator.CurrentTime.UTC()
229
216
 
230
217
  s.coordinator.CommitBlock(chain)
231
218
 
@@ -261,13 +248,7 @@ func (s *IntegrationTestSuite) NewTransferPath(endpointAChainIdx, endpointBChain
261
248
  endpointAChain := s.coordinator.GetChain(ibctesting.GetChainID(endpointAChainIdx))
262
249
  endpointBChain := s.coordinator.GetChain(ibctesting.GetChainID(endpointBChainIdx))
263
250
 
264
- chAOffset := s.nextChannelOffset(endpointAChainIdx)
265
- chBOffset := s.nextChannelOffset(endpointBChainIdx)
266
251
  path := ibctesting.NewPath(endpointAChain, endpointBChain)
267
- _, _, channelASeq := computeSequences(endpointAChainIdx)
268
- _, _, channelBSeq := computeSequences(endpointBChainIdx)
269
- path.EndpointA.ChannelID = fmt.Sprintf("channel-%d", channelASeq+chAOffset)
270
- path.EndpointB.ChannelID = fmt.Sprintf("channel-%d", channelBSeq+chBOffset)
271
252
  path.EndpointA.ChannelConfig.PortID = ibctesting.TransferPort
272
253
  path.EndpointB.ChannelConfig.PortID = ibctesting.TransferPort
273
254
  path.EndpointA.ChannelConfig.Version = "ics20-1"
@@ -278,14 +259,17 @@ func (s *IntegrationTestSuite) NewTransferPath(endpointAChainIdx, endpointBChain
278
259
  s.coordinator.SetupConnections(path)
279
260
  s.cacheEndpoint(endpointAChainIdx, endpointBChainIdx, path.EndpointA)
280
261
  s.cacheEndpoint(endpointBChainIdx, endpointAChainIdx, path.EndpointB)
281
- } else {
282
- path.EndpointA.ClientID = endpoint.ClientID
283
- path.EndpointA.ConnectionID = endpoint.ConnectionID
284
-
285
- path.EndpointB.ClientID = endpoint.Counterparty.ClientID
286
- path.EndpointB.ConnectionID = endpoint.Counterparty.ConnectionID
262
+ s.coordinator.CreateTransferChannels(path)
263
+ endpoint = s.getEndpoint(endpointAChainIdx, endpointBChainIdx)
287
264
  }
288
- s.coordinator.CreateChannels(path)
265
+
266
+ path.EndpointA.ClientID = endpoint.ClientID
267
+ path.EndpointA.ConnectionID = endpoint.ConnectionID
268
+ path.EndpointA.ChannelID = endpoint.ChannelID
269
+
270
+ path.EndpointB.ClientID = endpoint.Counterparty.ClientID
271
+ path.EndpointB.ConnectionID = endpoint.Counterparty.ConnectionID
272
+ path.EndpointB.ChannelID = endpoint.Counterparty.ChannelID
289
273
 
290
274
  s.coordinator.CommitBlock(endpointAChain, endpointBChain)
291
275
 
@@ -414,15 +398,11 @@ func (s *IntegrationTestSuite) overrideSendPacketData(cdc codec.Codec, data []by
414
398
  return nil, err
415
399
  }
416
400
 
417
- if !bytes.Equal(data, bz) {
418
- newBz, err := cdc.MarshalJSON(&newFtpd)
419
- if err != nil {
420
- return nil, err
421
- }
422
- return newBz, nil
401
+ if !bytes.Equal(bz, data) {
402
+ return bz, nil
423
403
  }
424
404
 
425
- return nil, fmt.Errorf("failed to find a way to permute packet data: %s", string(data))
405
+ return cdc.MarshalJSON(&newFtpd)
426
406
  }
427
407
 
428
408
  func (s *IntegrationTestSuite) mintToAddress(chain *ibctesting.TestChain, addr sdk.AccAddress, denom, amount string) {
@@ -473,7 +453,6 @@ func (s *IntegrationTestSuite) TestHops() {
473
453
 
474
454
  for hops := 1; hops <= 2; hops += 1 {
475
455
  for _, tc := range testCases {
476
- tc := tc
477
456
  name := fmt.Sprintf("%s_%dHop", tc.name, hops)
478
457
  s.Run(name, func() {
479
458
  _, _, baseSenderAddr := testdata.KeyTestPubAddr()
@@ -602,8 +581,8 @@ func (s *IntegrationTestSuite) TestHops() {
602
581
  s.Require().NoError(err)
603
582
  s.coordinator.CommitBlock(nextPath.EndpointB.Chain)
604
583
 
605
- writeAcknowledgementHeight = nextPath.EndpointB.Chain.CurrentHeader.Height
606
- writeAcknowledgementTime = nextPath.EndpointB.Chain.CurrentHeader.Time.Unix()
584
+ writeAcknowledgementHeight = nextPath.EndpointB.Chain.GetContext().BlockHeight()
585
+ writeAcknowledgementTime = nextPath.EndpointB.Chain.GetContext().BlockTime().Unix()
607
586
 
608
587
  packetRes, err = nextPath.EndpointB.RecvPacketWithResult(sendPacket)
609
588
  s.Require().NoError(err)
@@ -711,8 +690,8 @@ func (s *IntegrationTestSuite) TestHops() {
711
690
  err = paths[0].EndpointA.UpdateClient()
712
691
  s.Require().NoError(err)
713
692
 
714
- acknowledgementHeight := s.chainA.CurrentHeader.Height
715
- acknowledgementTime := s.chainA.CurrentHeader.Time.Unix()
693
+ acknowledgementHeight := s.chainA.GetContext().BlockHeight()
694
+ acknowledgementTime := s.chainA.GetContext().BlockTime().Unix()
716
695
 
717
696
  // Prove the initial packet's acknowledgement.
718
697
  ackRes, err := acknowledgePacketWithResult(paths[0].EndpointA, ackedPacket, ack.Acknowledgement())
@@ -739,11 +718,8 @@ func (s *IntegrationTestSuite) TestHops() {
739
718
  gotAttrs := 0
740
719
  for _, attr := range event.Attributes {
741
720
  switch string(attr.Key) {
742
- case "module":
743
- s.Require().Equal(ibctransfertypes.ModuleName, string(attr.Value))
744
- gotAttrs += 1
745
- case ibctransfertypes.AttributeKeyAckSuccess:
746
- s.Require().Equal("\x01", string(attr.Value))
721
+ case ibctransfertypes.AttributeKeyAck:
722
+ s.Require().Equal("result:\"\\001\" ", string(attr.Value))
747
723
  gotAttrs += 1
748
724
  case ibctransfertypes.AttributeKeyMemo:
749
725
  s.Require().Equal(transferData.Memo, string(attr.Value))
@@ -751,7 +727,7 @@ func (s *IntegrationTestSuite) TestHops() {
751
727
  case ibctransfertypes.AttributeKeyReceiver:
752
728
  s.Require().Equal(transferData.Receiver, string(attr.Value))
753
729
  gotAttrs += 1
754
- case "sender": // ibctransfertypes.AttributeKeySender:
730
+ case ibctransfertypes.AttributeKeySender:
755
731
  s.Require().Equal(transferData.Sender, string(attr.Value))
756
732
  gotAttrs += 1
757
733
  case ibctransfertypes.AttributeKeyDenom:
@@ -784,6 +760,7 @@ func (s *IntegrationTestSuite) TestHops() {
784
760
  BlockTime: acknowledgementTime,
785
761
  },
786
762
  Event: "acknowledgementPacket",
763
+ ChannelVersion: paths[0].EndpointA.ChannelConfig.Version,
787
764
  Target: baseSender,
788
765
  Packet: types.CopyToIBCPacket(expectedPacket),
789
766
  Acknowledgement: ack.Acknowledgement(),
@@ -15,19 +15,17 @@ import (
15
15
  sdk "github.com/cosmos/cosmos-sdk/types"
16
16
  sdktypeserrors "github.com/cosmos/cosmos-sdk/types/errors"
17
17
 
18
- capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
19
- capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
20
-
21
18
  agtypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
22
19
  "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
23
20
  "github.com/Agoric/agoric-sdk/golang/cosmos/x/vibc"
21
+ vibckeeper "github.com/Agoric/agoric-sdk/golang/cosmos/x/vibc/keeper"
24
22
  vibctypes "github.com/Agoric/agoric-sdk/golang/cosmos/x/vibc/types"
25
23
 
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"
24
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
25
+ channeltypes "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"
26
+ porttypes "github.com/cosmos/ibc-go/v10/modules/core/05-port/types"
27
+ host "github.com/cosmos/ibc-go/v10/modules/core/24-host"
28
+ ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
31
29
  )
32
30
 
33
31
  var _ porttypes.ICS4Wrapper = (*Keeper)(nil)
@@ -79,7 +77,6 @@ type ics4Wrapper struct {
79
77
 
80
78
  func (i4 *ics4Wrapper) SendPacket(
81
79
  ctx sdk.Context,
82
- chanCap *capabilitytypes.Capability,
83
80
  sourcePort string,
84
81
  sourceChannel string,
85
82
  timeoutHeight clienttypes.Height,
@@ -101,7 +98,7 @@ func (i4 *ics4Wrapper) SendPacket(
101
98
  }
102
99
 
103
100
  // Send the stripped data to the next wrapper.
104
- sequence, err = i4.ICS4Wrapper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, strippedData)
101
+ sequence, err = i4.ICS4Wrapper.SendPacket(ctx, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, strippedData)
105
102
  if err != nil {
106
103
  return sequence, err
107
104
  }
@@ -117,7 +114,6 @@ func (i4 *ics4Wrapper) SendPacket(
117
114
 
118
115
  func (i4 *ics4Wrapper) WriteAcknowledgement(
119
116
  ctx sdk.Context,
120
- chanCap *capabilitytypes.Capability,
121
117
  packet ibcexported.PacketI,
122
118
  ack ibcexported.Acknowledgement,
123
119
  ) error {
@@ -127,7 +123,7 @@ func (i4 *ics4Wrapper) WriteAcknowledgement(
127
123
  origPacket.Data = packetStore.Get(packetKey)
128
124
  packetStore.Delete(packetKey)
129
125
  }
130
- return i4.ICS4Wrapper.WriteAcknowledgement(ctx, chanCap, origPacket, ack)
126
+ return i4.ICS4Wrapper.WriteAcknowledgement(ctx, origPacket, ack)
131
127
  }
132
128
 
133
129
  // NewICS4Wrapper creates a new ICS4Wrapper instance
@@ -140,14 +136,13 @@ func NewKeeper(
140
136
  cdc codec.Codec,
141
137
  storeService corestore.KVStoreService,
142
138
  prototypeVibcKeeper vibc.Keeper,
143
- scopedTransferKeeper capabilitykeeper.ScopedKeeper,
144
139
  pushAction vm.ActionPusher,
145
140
  ) Keeper {
146
141
  wrappedPushAction := wrapActionPusher(pushAction)
147
142
 
148
143
  // This vibcKeeper is used to send notifications from the vtransfer middleware
149
144
  // to the VM.
150
- vibcKeeper := prototypeVibcKeeper.WithScope(nil, scopedTransferKeeper, wrappedPushAction)
145
+ vibcKeeper := prototypeVibcKeeper.WithScope(vibckeeper.NewDynamicPortScope(nil, nil, wrappedPushAction))
151
146
  k := Keeper{
152
147
  ReceiverImpl: vibcKeeper,
153
148
 
@@ -235,7 +230,7 @@ func (k Keeper) PacketStoreFromOrigin(ctx sdk.Context, ourOrigin agtypes.PacketO
235
230
  // Many error acknowledgments are sent synchronously, but most cases instead return nil
236
231
  // to tell the IBC system that acknowledgment is async (i.e., that WriteAcknowledgement
237
232
  // will be called later, after the VM has dealt with the packet).
238
- func (k Keeper) InterceptOnRecvPacket(ctx sdk.Context, ibcModule porttypes.IBCModule, packet ibcexported.PacketI, relayer sdk.AccAddress) ibcexported.Acknowledgement {
233
+ func (k Keeper) InterceptOnRecvPacket(ctx sdk.Context, ibcModule porttypes.IBCModule, channelVersion string, packet ibcexported.PacketI, relayer sdk.AccAddress) ibcexported.Acknowledgement {
239
234
  // Pass every (stripped-receiver) inbound packet to the wrapped IBC module.
240
235
  var strippedPacket agtypes.IBCPacket
241
236
  _, err := agtypes.ExtractBaseAddressFromPacket(k.cdc, packet, agtypes.RoleReceiver, &strippedPacket)
@@ -245,26 +240,20 @@ func (k Keeper) InterceptOnRecvPacket(ctx sdk.Context, ibcModule porttypes.IBCMo
245
240
 
246
241
  portID := packet.GetDestPort()
247
242
  channelID := packet.GetDestChannel()
248
- capName := host.ChannelCapabilityPath(portID, channelID)
249
- chanCap, ok := k.vibcKeeper.GetCapability(ctx, capName)
250
- if !ok {
251
- err := sdkioerrors.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "could not retrieve channel capability at: %s", capName)
252
- return channeltypes.NewErrorAcknowledgement(err)
253
- }
254
243
 
255
244
  if !k.debug.DoNotStore && !bytes.Equal(strippedPacket.GetData(), packet.GetData()) {
256
245
  packetStore, packetKey := k.PacketStore(ctx, agtypes.PacketDst, portID, channelID, packet.GetSequence())
257
246
  packetStore.Set(packetKey, packet.GetData())
258
247
  }
259
248
 
260
- ack := ibcModule.OnRecvPacket(ctx, agtypes.CopyToChannelPacket(strippedPacket), relayer)
249
+ ack := ibcModule.OnRecvPacket(ctx, channelVersion, agtypes.CopyToChannelPacket(strippedPacket), relayer)
261
250
  if ack == nil {
262
251
  // Already declared to be an async ack. Will be cleaned up by ics4Wrapper.WriteAcknowledgement.
263
252
  return nil
264
253
  }
265
254
 
266
255
  // Give the VM a chance to write (or override) the ack.
267
- syncAck, _ := k.InterceptWriteAcknowledgement(ctx, chanCap, packet, ack)
256
+ syncAck, _ := k.InterceptWriteAcknowledgement(ctx, packet, ack)
268
257
  return syncAck
269
258
  }
270
259
 
@@ -273,6 +262,7 @@ func (k Keeper) InterceptOnRecvPacket(ctx sdk.Context, ibcModule porttypes.IBCMo
273
262
  func (k Keeper) InterceptOnAcknowledgementPacket(
274
263
  ctx sdk.Context,
275
264
  ibcModule porttypes.IBCModule,
265
+ channelVersion string,
276
266
  packet ibcexported.PacketI,
277
267
  acknowledgement []byte,
278
268
  relayer sdk.AccAddress,
@@ -289,7 +279,7 @@ func (k Keeper) InterceptOnAcknowledgementPacket(
289
279
  packetStore.Delete(packetKey)
290
280
  }
291
281
 
292
- modErr := ibcModule.OnAcknowledgementPacket(ctx, agtypes.CopyToChannelPacket(packet), acknowledgement, relayer)
282
+ modErr := ibcModule.OnAcknowledgementPacket(ctx, channelVersion, agtypes.CopyToChannelPacket(packet), acknowledgement, relayer)
293
283
 
294
284
  // If the sender is not a watched account, we're done.
295
285
  if !k.targetIsWatched(ctx, baseSender) {
@@ -297,7 +287,7 @@ func (k Keeper) InterceptOnAcknowledgementPacket(
297
287
  }
298
288
 
299
289
  // Trigger VM with the original packet, regardless of errors in the ibcModule.
300
- vmErr := k.vibcKeeper.TriggerOnAcknowledgementPacket(ctx, baseSender, origPacket, acknowledgement, relayer)
290
+ vmErr := k.vibcKeeper.TriggerOnAcknowledgementPacket(ctx, baseSender, channelVersion, origPacket, acknowledgement, relayer)
301
291
 
302
292
  // Any error from the VM is trumped by one from the wrapped IBC module.
303
293
  if modErr != nil {
@@ -311,6 +301,7 @@ func (k Keeper) InterceptOnAcknowledgementPacket(
311
301
  func (k Keeper) InterceptOnTimeoutPacket(
312
302
  ctx sdk.Context,
313
303
  ibcModule porttypes.IBCModule,
304
+ channelVersion string,
314
305
  packet ibcexported.PacketI,
315
306
  relayer sdk.AccAddress,
316
307
  ) error {
@@ -327,7 +318,7 @@ func (k Keeper) InterceptOnTimeoutPacket(
327
318
  }
328
319
 
329
320
  // Pass every stripped-sender timeout to the wrapped IBC module.
330
- modErr := ibcModule.OnTimeoutPacket(ctx, agtypes.CopyToChannelPacket(packet), relayer)
321
+ modErr := ibcModule.OnTimeoutPacket(ctx, channelVersion, agtypes.CopyToChannelPacket(packet), relayer)
331
322
 
332
323
  // If the sender is not a watched account, we're done.
333
324
  if !k.targetIsWatched(ctx, baseSender) {
@@ -335,7 +326,7 @@ func (k Keeper) InterceptOnTimeoutPacket(
335
326
  }
336
327
 
337
328
  // Trigger VM with the original packet, regardless of errors in the app.
338
- vmErr := k.vibcKeeper.TriggerOnTimeoutPacket(ctx, baseSender, origPacket, relayer)
329
+ vmErr := k.vibcKeeper.TriggerOnTimeoutPacket(ctx, baseSender, channelVersion, origPacket, relayer)
339
330
 
340
331
  // Any error from the VM is trumped by one from the wrapped IBC module.
341
332
  if modErr != nil {
@@ -346,7 +337,7 @@ func (k Keeper) InterceptOnTimeoutPacket(
346
337
 
347
338
  // InterceptWriteAcknowledgement checks to see if the packet's receiver is a
348
339
  // targeted account, and if so, delegates to the VM.
349
- func (k Keeper) InterceptWriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet ibcexported.PacketI, ack ibcexported.Acknowledgement) (ibcexported.Acknowledgement, ibcexported.PacketI) {
340
+ func (k Keeper) InterceptWriteAcknowledgement(ctx sdk.Context, packet ibcexported.PacketI, ack ibcexported.Acknowledgement) (ibcexported.Acknowledgement, ibcexported.PacketI) {
350
341
  // Get the base receiver from the packet, without computing a stripped packet.
351
342
  baseReceiver, err := agtypes.ExtractBaseAddressFromPacket(k.cdc, packet, agtypes.RoleReceiver, nil)
352
343
 
@@ -2,21 +2,28 @@ package types
2
2
 
3
3
  import (
4
4
  sdk "github.com/cosmos/cosmos-sdk/types"
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"
5
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
6
+ channel "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"
7
+ ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
8
8
  )
9
9
 
10
10
  // ChannelKeeper defines the expected IBC channel keeper
11
11
  type ChannelKeeper interface {
12
12
  GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channel.Channel, found bool)
13
13
  GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
14
- SendPacket(ctx sdk.Context, channelCap *capability.Capability, packet ibcexported.PacketI) error
15
- WriteAcknowledgement(ctx sdk.Context, channelCap *capability.Capability, packet ibcexported.PacketI, acknowledgement ibcexported.Acknowledgement) error
14
+ SendPacket(
15
+ ctx sdk.Context,
16
+ sourcePort string,
17
+ sourceChannel string,
18
+ timeoutHeight clienttypes.Height,
19
+ timeoutTimestamp uint64,
20
+ data []byte,
21
+ ) (uint64, error)
22
+ WriteAcknowledgement(ctx sdk.Context, packet ibcexported.PacketI, acknowledgement ibcexported.Acknowledgement) error
16
23
  ChanOpenInit(ctx sdk.Context, order channel.Order, connectionHops []string, portID string,
17
- portCap *capability.Capability, counterparty channel.Counterparty, version string) (string, *capability.Capability, error)
24
+ counterparty channel.Counterparty, version string) (string, error)
18
25
  WriteOpenInitChannel(ctx sdk.Context, portID, channelID string, order channel.Order,
19
26
  connectionHops []string, counterparty channel.Counterparty, version string)
20
- ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capability.Capability) error
21
- TimeoutExecuted(ctx sdk.Context, channelCap *capability.Capability, packet ibcexported.PacketI) error
27
+ ChanCloseInit(ctx sdk.Context, portID, channelID string) error
28
+ TimeoutExecuted(ctx sdk.Context, packet channel.Packet) error
22
29
  }
@@ -6,10 +6,10 @@ import (
6
6
  "strconv"
7
7
 
8
8
  abci "github.com/cometbft/cometbft/abci/types"
9
- clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
10
- channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
11
- host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
12
- ibctesting "github.com/cosmos/ibc-go/v8/testing"
9
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
10
+ channeltypes "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"
11
+ host "github.com/cosmos/ibc-go/v10/modules/core/24-host"
12
+ ibctesting "github.com/cosmos/ibc-go/v10/testing"
13
13
  )
14
14
 
15
15
  // acknowledgePacketWithResult sends a MsgAcknowledgement to the channel associated with the endpoint.
@@ -44,8 +44,6 @@ func ParseAckFromFilteredEvents(events []abci.Event, filteredType string) ([]byt
44
44
  return nil, fmt.Errorf("failed to parse hex ack: %w", err)
45
45
  }
46
46
  return hexAck, nil
47
- case channeltypes.AttributeKeyAck: //nolint:staticcheck // DEPRECATED
48
- return []byte(attr.Value), nil
49
47
  }
50
48
  }
51
49
  }
@@ -75,9 +73,6 @@ func ParsePacketFromFilteredEvents(events []abci.Event, filteredType string) (ch
75
73
  }
76
74
  packet.Data = hexData
77
75
 
78
- case channeltypes.AttributeKeyData: //nolint:staticcheck // DEPRECATED
79
- packet.Data = []byte(attr.Value)
80
-
81
76
  case channeltypes.AttributeKeySequence:
82
77
  seq, err := strconv.ParseUint(attr.Value, 10, 64)
83
78
  if err != nil {