@agoric/cosmos 0.34.2-dev-70d05b1.0.70d05b1 → 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
@@ -3,15 +3,12 @@ package types
3
3
  import (
4
4
  fmt "fmt"
5
5
 
6
- sdkioerrors "cosmossdk.io/errors"
7
6
  agtypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
8
7
  "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
9
- capability "github.com/cosmos/ibc-go/modules/capability/types"
10
- channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
11
- porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
12
- host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
8
+ channeltypes "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"
9
+ porttypes "github.com/cosmos/ibc-go/v10/modules/core/05-port/types"
13
10
 
14
- "github.com/cosmos/ibc-go/v8/modules/core/exported"
11
+ "github.com/cosmos/ibc-go/v10/modules/core/exported"
15
12
 
16
13
  sdk "github.com/cosmos/cosmos-sdk/types"
17
14
  )
@@ -31,7 +28,6 @@ var (
31
28
  )
32
29
 
33
30
  type IBCModuleImpl interface {
34
- ClaimCapability(ctx sdk.Context, channelCap *capability.Capability, path string) error
35
31
  GetChannel(ctx sdk.Context, portID, channelID string) (channeltypes.Channel, bool)
36
32
  PushAction(ctx sdk.Context, action vm.Action) error
37
33
  }
@@ -75,7 +71,6 @@ func (im IBCModule) OnChanOpenInit(
75
71
  connectionHops []string,
76
72
  portID string,
77
73
  channelID string,
78
- channelCap *capability.Capability,
79
74
  counterparty channeltypes.Counterparty,
80
75
  version string,
81
76
  ) (string, error) {
@@ -94,11 +89,6 @@ func (im IBCModule) OnChanOpenInit(
94
89
  return "", err
95
90
  }
96
91
 
97
- // Claim channel capability passed back by IBC module
98
- if err := im.impl.ClaimCapability(ctx, channelCap, host.ChannelCapabilityPath(portID, channelID)); err != nil {
99
- return "", err
100
- }
101
-
102
92
  if !event.AsyncVersions {
103
93
  // We have to supply a synchronous version, so just echo back the one they sent.
104
94
  return event.Version, nil
@@ -126,7 +116,6 @@ func (im IBCModule) OnChanOpenTry(
126
116
  connectionHops []string,
127
117
  portID,
128
118
  channelID string,
129
- channelCap *capability.Capability,
130
119
  counterparty channeltypes.Counterparty,
131
120
  counterpartyVersion string,
132
121
  ) (string, error) {
@@ -145,11 +134,6 @@ func (im IBCModule) OnChanOpenTry(
145
134
  return "", err
146
135
  }
147
136
 
148
- // Claim channel capability passed back by IBC module
149
- if err = im.impl.ClaimCapability(ctx, channelCap, host.ChannelCapabilityPath(portID, channelID)); err != nil {
150
- return "", sdkioerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, err.Error())
151
- }
152
-
153
137
  if !event.AsyncVersions {
154
138
  // We have to supply a synchronous version, so just echo back the one they sent.
155
139
  return event.Version, nil
@@ -265,12 +249,14 @@ type ReceivePacketEvent struct {
265
249
  *vm.ActionHeader `actionType:"IBC_EVENT"`
266
250
  Event string `json:"event" default:"receivePacket"`
267
251
  Target string `json:"target,omitempty"`
252
+ ChannelVersion string `json:"channelVersion"`
268
253
  Packet agtypes.IBCPacket `json:"packet"`
269
254
  Relayer sdk.AccAddress `json:"relayer"`
270
255
  }
271
256
 
272
257
  func (im IBCModule) OnRecvPacket(
273
258
  ctx sdk.Context,
259
+ channelVersion string,
274
260
  packet channeltypes.Packet,
275
261
  relayer sdk.AccAddress,
276
262
  ) exported.Acknowledgement {
@@ -283,6 +269,7 @@ func (im IBCModule) OnRecvPacket(
283
269
  // the same packets.
284
270
 
285
271
  event := ReceivePacketEvent{
272
+ ChannelVersion: channelVersion,
286
273
  Packet: agtypes.CopyToIBCPacket(packet),
287
274
  Relayer: relayer,
288
275
  }
@@ -299,18 +286,21 @@ type AcknowledgementPacketEvent struct {
299
286
  *vm.ActionHeader `actionType:"IBC_EVENT"`
300
287
  Event string `json:"event" default:"acknowledgementPacket"`
301
288
  Target string `json:"target,omitempty"`
289
+ ChannelVersion string `json:"channelVersion"`
302
290
  Packet agtypes.IBCPacket `json:"packet"`
303
291
  Acknowledgement []byte `json:"acknowledgement"`
304
292
  Relayer sdk.AccAddress `json:"relayer"`
305
293
  }
306
294
 
307
295
  func (im IBCModule) OnAcknowledgementPacket(
308
- ctx sdk.Context,
296
+ ctx sdk.Context,
297
+ channelVersion string,
309
298
  packet channeltypes.Packet,
310
299
  acknowledgement []byte,
311
300
  relayer sdk.AccAddress,
312
301
  ) error {
313
302
  event := AcknowledgementPacketEvent{
303
+ ChannelVersion: channelVersion,
314
304
  Packet: agtypes.CopyToIBCPacket(packet),
315
305
  Acknowledgement: acknowledgement,
316
306
  Relayer: relayer,
@@ -328,16 +318,19 @@ type TimeoutPacketEvent struct {
328
318
  *vm.ActionHeader `actionType:"IBC_EVENT"`
329
319
  Event string `json:"event" default:"timeoutPacket"`
330
320
  Target string `json:"target,omitempty"`
321
+ ChannelVersion string `json:"channelVersion"`
331
322
  Packet agtypes.IBCPacket `json:"packet"`
332
323
  Relayer sdk.AccAddress `json:"relayer"`
333
324
  }
334
325
 
335
326
  func (im IBCModule) OnTimeoutPacket(
336
327
  ctx sdk.Context,
328
+ channelVersion string,
337
329
  packet channeltypes.Packet,
338
330
  relayer sdk.AccAddress,
339
331
  ) error {
340
332
  event := TimeoutPacketEvent{
333
+ ChannelVersion: channelVersion,
341
334
  Packet: agtypes.CopyToIBCPacket(packet),
342
335
  Relayer: relayer,
343
336
  }
@@ -8,7 +8,9 @@ import (
8
8
 
9
9
  sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
10
10
 
11
- chanTypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
11
+ agtypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
12
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
13
+ ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
12
14
 
13
15
  "google.golang.org/protobuf/proto"
14
16
  "google.golang.org/protobuf/protoadapt"
@@ -18,6 +20,7 @@ import (
18
20
  const RouterKey = ModuleName // this was defined in your key.go file
19
21
 
20
22
  var _ sdk.Msg = &MsgSendPacket{}
23
+ var _ ibcexported.PacketI = (*Packet)(nil)
21
24
 
22
25
  // Replacing msg.GetSigners() but before we can adopt AddressString.
23
26
  // https://github.com/cosmos/cosmos-sdk/issues/20077#issuecomment-2062601533
@@ -39,10 +42,29 @@ func DefineCustomGetSigners(options *signing.Options) {
39
42
  )
40
43
  }
41
44
 
45
+ func (p Packet) ValidateBasic() error {
46
+ channelPacket := agtypes.CopyToChannelPacket(p);
47
+ return channelPacket.ValidateBasic()
48
+ }
49
+
42
50
  // NewMsgSendPacket returns a new send request
43
- func NewMsgSendPacket(packet chanTypes.Packet, sender sdk.AccAddress) *MsgSendPacket {
51
+ func NewMsgSendPacket(packet ibcexported.PacketI, sender sdk.AccAddress) *MsgSendPacket {
52
+ timeoutHeight := clienttypes.MustParseHeight(packet.GetTimeoutHeight().String())
53
+ localPacket := Packet{
54
+ Sequence: packet.GetSequence(),
55
+ SourcePort: packet.GetSourcePort(),
56
+ SourceChannel: packet.GetSourceChannel(),
57
+ DestinationPort: packet.GetDestPort(),
58
+ DestinationChannel: packet.GetDestChannel(),
59
+ Data: packet.GetData(),
60
+ TimeoutHeight: Height{
61
+ RevisionNumber: timeoutHeight.RevisionNumber,
62
+ RevisionHeight: timeoutHeight.RevisionHeight,
63
+ },
64
+ TimeoutTimestamp: packet.GetTimeoutTimestamp(),
65
+ }
44
66
  return &MsgSendPacket{
45
- Packet: packet,
67
+ Packet: localPacket,
46
68
  Sender: sender,
47
69
  }
48
70
  }
@@ -68,3 +90,38 @@ func (msg MsgSendPacket) GetSigners() []sdk.AccAddress {
68
90
  func (msg MsgSendPacket) Type() string {
69
91
  return "sendpacket"
70
92
  }
93
+
94
+ func (p Packet) GetSequence() uint64 {
95
+ return p.Sequence
96
+ }
97
+
98
+ func (p Packet) GetSourcePort() string {
99
+ return p.SourcePort
100
+ }
101
+
102
+ func (p Packet) GetSourceChannel() string {
103
+ return p.SourceChannel
104
+ }
105
+
106
+ func (p Packet) GetDestPort() string {
107
+ return p.DestinationPort
108
+ }
109
+
110
+ func (p Packet) GetDestChannel() string {
111
+ return p.DestinationChannel
112
+ }
113
+
114
+ func (p Packet) GetData() []byte {
115
+ return p.Data
116
+ }
117
+
118
+ func (p Packet) GetTimeoutHeight() ibcexported.Height {
119
+ return clienttypes.Height{
120
+ RevisionNumber: p.TimeoutHeight.RevisionNumber,
121
+ RevisionHeight: p.TimeoutHeight.RevisionHeight,
122
+ }
123
+ }
124
+
125
+ func (p Packet) GetTimeoutTimestamp() uint64 {
126
+ return p.TimeoutTimestamp
127
+ }