@agoric/cosmos 0.34.2-dev-4ea2a82.0.4ea2a82 → 0.34.2-dev-2858da6.0.2858da6
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.
- package/Makefile +0 -1
- package/ante/ante.go +2 -2
- package/app/app.go +96 -73
- package/app/sim_test.go +2 -0
- package/app/upgrade.go +6 -6
- package/daemon/cmd/root_test.go +0 -1
- package/git-revision.txt +1 -1
- package/go.mod +116 -83
- package/go.sum +130 -162
- package/package.json +2 -2
- package/proto/agoric/swingset/msgs.proto +0 -1
- package/proto/agoric/vbank/msgs.proto +1 -5
- package/proto/agoric/vibc/msgs.proto +2 -45
- package/scripts/protocgen.sh +1 -10
- package/tests/integrations/types/aminojson_test.go +2 -18
- package/third_party/proto/cosmos/base/query/v1beta1/pagination.proto +3 -2
- package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +3 -2
- package/third_party/proto/ibc/core/channel/v1/channel.proto +22 -6
- package/third_party/proto/ibc/core/client/v1/client.proto +53 -6
- package/types/address_hooks.go +2 -2
- package/types/address_hooks_test.go +3 -3
- package/types/ibc_packet.go +3 -3
- package/types/ibc_packet_test.go +3 -3
- package/x/swingset/types/msgs.pb.go +89 -90
- package/x/vbank/types/msgs.pb.go +8 -10
- package/x/vibc/alias.go +1 -0
- package/x/vibc/keeper/keeper.go +81 -40
- package/x/vibc/keeper/migrations.go +1 -1
- package/x/vibc/keeper/triggers.go +4 -8
- package/x/vibc/types/expected_keepers.go +20 -7
- package/x/vibc/types/ibc_module.go +20 -13
- package/x/vibc/types/msgs.go +3 -60
- package/x/vibc/types/msgs.pb.go +31 -683
- package/x/vibc/types/receiver.go +2 -2
- package/x/vlocalchain/vlocalchain_test.go +1 -1
- package/x/vtransfer/ibc_middleware.go +17 -15
- package/x/vtransfer/ibc_middleware_test.go +53 -30
- package/x/vtransfer/keeper/keeper.go +28 -19
- package/x/vtransfer/types/expected_keepers.go +8 -15
- package/x/vtransfer/utils_test.go +9 -4
- package/go.work +0 -39
- package/go.work.sum +0 -2636
- package/proto/Dockerfile +0 -14
- package/x/vibc/keeper/dynamic_router.go +0 -176
- package/x/vibc/keeper/dynamic_router_test.go +0 -240
- package/x/vibc/keeper/scope.go +0 -114
|
@@ -4,9 +4,10 @@ import (
|
|
|
4
4
|
context "context"
|
|
5
5
|
|
|
6
6
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
capability "github.com/cosmos/ibc-go/modules/capability/types"
|
|
8
|
+
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
|
|
9
|
+
channel "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
|
|
10
|
+
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
|
|
10
11
|
)
|
|
11
12
|
|
|
12
13
|
type BankKeeper interface {
|
|
@@ -19,22 +20,23 @@ type ChannelKeeper interface {
|
|
|
19
20
|
GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channel.Channel, found bool)
|
|
20
21
|
SendPacket(
|
|
21
22
|
ctx sdk.Context,
|
|
23
|
+
channelCap *capability.Capability,
|
|
22
24
|
sourcePort string,
|
|
23
25
|
sourceChannel string,
|
|
24
26
|
timeoutHeight clienttypes.Height,
|
|
25
27
|
timeoutTimestamp uint64,
|
|
26
28
|
data []byte,
|
|
27
29
|
) (uint64, error)
|
|
28
|
-
WriteAcknowledgement(ctx sdk.Context, packet ibcexported.PacketI, acknowledgement ibcexported.Acknowledgement) error
|
|
30
|
+
WriteAcknowledgement(ctx sdk.Context, channelCap *capability.Capability, packet ibcexported.PacketI, acknowledgement ibcexported.Acknowledgement) error
|
|
29
31
|
ChanOpenInit(ctx sdk.Context, order channel.Order, connectionHops []string, portID string,
|
|
30
|
-
counterparty channel.Counterparty, version string) (string, error)
|
|
32
|
+
portCap *capability.Capability, counterparty channel.Counterparty, version string) (string, *capability.Capability, error)
|
|
31
33
|
WriteOpenInitChannel(ctx sdk.Context, portID, channelID string, order channel.Order,
|
|
32
34
|
connectionHops []string, counterparty channel.Counterparty, version string)
|
|
33
35
|
WriteOpenTryChannel(ctx sdk.Context, portID, channelID string, order channel.Order,
|
|
34
36
|
connectionHops []string, counterparty channel.Counterparty, version string)
|
|
35
37
|
WriteOpenAckChannel(ctx sdk.Context, portID, channelID, counterpartyVersion, counterpartyChannelID string)
|
|
36
|
-
ChanCloseInit(ctx sdk.Context, portID, channelID string) error
|
|
37
|
-
TimeoutExecuted(ctx sdk.Context, packet
|
|
38
|
+
ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capability.Capability) error
|
|
39
|
+
TimeoutExecuted(ctx sdk.Context, channelCap *capability.Capability, packet ibcexported.PacketI) error
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
// ClientKeeper defines the expected IBC client keeper
|
|
@@ -42,3 +44,14 @@ type ClientKeeper interface {
|
|
|
42
44
|
GetParams(ctx sdk.Context) clienttypes.Params
|
|
43
45
|
SetParams(ctx sdk.Context, params clienttypes.Params)
|
|
44
46
|
}
|
|
47
|
+
|
|
48
|
+
// PortKeeper defines the expected IBC port keeper
|
|
49
|
+
type PortKeeper interface {
|
|
50
|
+
BindPort(ctx sdk.Context, portID string) *capability.Capability
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ScopedKeeper defines the expected scoped capability keeper
|
|
54
|
+
type ScopedKeeper interface {
|
|
55
|
+
ClaimCapability(ctx sdk.Context, cap *capability.Capability, name string) error
|
|
56
|
+
GetCapability(ctx sdk.Context, name string) (*capability.Capability, bool)
|
|
57
|
+
}
|
|
@@ -3,12 +3,15 @@ package types
|
|
|
3
3
|
import (
|
|
4
4
|
fmt "fmt"
|
|
5
5
|
|
|
6
|
+
sdkioerrors "cosmossdk.io/errors"
|
|
6
7
|
agtypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
7
8
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
8
|
-
|
|
9
|
-
|
|
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"
|
|
10
13
|
|
|
11
|
-
"github.com/cosmos/ibc-go/
|
|
14
|
+
"github.com/cosmos/ibc-go/v8/modules/core/exported"
|
|
12
15
|
|
|
13
16
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
14
17
|
)
|
|
@@ -28,6 +31,7 @@ var (
|
|
|
28
31
|
)
|
|
29
32
|
|
|
30
33
|
type IBCModuleImpl interface {
|
|
34
|
+
ClaimCapability(ctx sdk.Context, channelCap *capability.Capability, path string) error
|
|
31
35
|
GetChannel(ctx sdk.Context, portID, channelID string) (channeltypes.Channel, bool)
|
|
32
36
|
PushAction(ctx sdk.Context, action vm.Action) error
|
|
33
37
|
}
|
|
@@ -71,6 +75,7 @@ func (im IBCModule) OnChanOpenInit(
|
|
|
71
75
|
connectionHops []string,
|
|
72
76
|
portID string,
|
|
73
77
|
channelID string,
|
|
78
|
+
channelCap *capability.Capability,
|
|
74
79
|
counterparty channeltypes.Counterparty,
|
|
75
80
|
version string,
|
|
76
81
|
) (string, error) {
|
|
@@ -89,6 +94,11 @@ func (im IBCModule) OnChanOpenInit(
|
|
|
89
94
|
return "", err
|
|
90
95
|
}
|
|
91
96
|
|
|
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
|
+
|
|
92
102
|
if !event.AsyncVersions {
|
|
93
103
|
// We have to supply a synchronous version, so just echo back the one they sent.
|
|
94
104
|
return event.Version, nil
|
|
@@ -116,6 +126,7 @@ func (im IBCModule) OnChanOpenTry(
|
|
|
116
126
|
connectionHops []string,
|
|
117
127
|
portID,
|
|
118
128
|
channelID string,
|
|
129
|
+
channelCap *capability.Capability,
|
|
119
130
|
counterparty channeltypes.Counterparty,
|
|
120
131
|
counterpartyVersion string,
|
|
121
132
|
) (string, error) {
|
|
@@ -134,6 +145,11 @@ func (im IBCModule) OnChanOpenTry(
|
|
|
134
145
|
return "", err
|
|
135
146
|
}
|
|
136
147
|
|
|
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
|
+
|
|
137
153
|
if !event.AsyncVersions {
|
|
138
154
|
// We have to supply a synchronous version, so just echo back the one they sent.
|
|
139
155
|
return event.Version, nil
|
|
@@ -249,14 +265,12 @@ type ReceivePacketEvent struct {
|
|
|
249
265
|
*vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
250
266
|
Event string `json:"event" default:"receivePacket"`
|
|
251
267
|
Target string `json:"target,omitempty"`
|
|
252
|
-
ChannelVersion string `json:"channelVersion"`
|
|
253
268
|
Packet agtypes.IBCPacket `json:"packet"`
|
|
254
269
|
Relayer sdk.AccAddress `json:"relayer"`
|
|
255
270
|
}
|
|
256
271
|
|
|
257
272
|
func (im IBCModule) OnRecvPacket(
|
|
258
273
|
ctx sdk.Context,
|
|
259
|
-
channelVersion string,
|
|
260
274
|
packet channeltypes.Packet,
|
|
261
275
|
relayer sdk.AccAddress,
|
|
262
276
|
) exported.Acknowledgement {
|
|
@@ -269,7 +283,6 @@ func (im IBCModule) OnRecvPacket(
|
|
|
269
283
|
// the same packets.
|
|
270
284
|
|
|
271
285
|
event := ReceivePacketEvent{
|
|
272
|
-
ChannelVersion: channelVersion,
|
|
273
286
|
Packet: agtypes.CopyToIBCPacket(packet),
|
|
274
287
|
Relayer: relayer,
|
|
275
288
|
}
|
|
@@ -286,21 +299,18 @@ type AcknowledgementPacketEvent struct {
|
|
|
286
299
|
*vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
287
300
|
Event string `json:"event" default:"acknowledgementPacket"`
|
|
288
301
|
Target string `json:"target,omitempty"`
|
|
289
|
-
ChannelVersion string `json:"channelVersion"`
|
|
290
302
|
Packet agtypes.IBCPacket `json:"packet"`
|
|
291
303
|
Acknowledgement []byte `json:"acknowledgement"`
|
|
292
304
|
Relayer sdk.AccAddress `json:"relayer"`
|
|
293
305
|
}
|
|
294
306
|
|
|
295
307
|
func (im IBCModule) OnAcknowledgementPacket(
|
|
296
|
-
ctx sdk.Context,
|
|
297
|
-
channelVersion string,
|
|
308
|
+
ctx sdk.Context,
|
|
298
309
|
packet channeltypes.Packet,
|
|
299
310
|
acknowledgement []byte,
|
|
300
311
|
relayer sdk.AccAddress,
|
|
301
312
|
) error {
|
|
302
313
|
event := AcknowledgementPacketEvent{
|
|
303
|
-
ChannelVersion: channelVersion,
|
|
304
314
|
Packet: agtypes.CopyToIBCPacket(packet),
|
|
305
315
|
Acknowledgement: acknowledgement,
|
|
306
316
|
Relayer: relayer,
|
|
@@ -318,19 +328,16 @@ type TimeoutPacketEvent struct {
|
|
|
318
328
|
*vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
319
329
|
Event string `json:"event" default:"timeoutPacket"`
|
|
320
330
|
Target string `json:"target,omitempty"`
|
|
321
|
-
ChannelVersion string `json:"channelVersion"`
|
|
322
331
|
Packet agtypes.IBCPacket `json:"packet"`
|
|
323
332
|
Relayer sdk.AccAddress `json:"relayer"`
|
|
324
333
|
}
|
|
325
334
|
|
|
326
335
|
func (im IBCModule) OnTimeoutPacket(
|
|
327
336
|
ctx sdk.Context,
|
|
328
|
-
channelVersion string,
|
|
329
337
|
packet channeltypes.Packet,
|
|
330
338
|
relayer sdk.AccAddress,
|
|
331
339
|
) error {
|
|
332
340
|
event := TimeoutPacketEvent{
|
|
333
|
-
ChannelVersion: channelVersion,
|
|
334
341
|
Packet: agtypes.CopyToIBCPacket(packet),
|
|
335
342
|
Relayer: relayer,
|
|
336
343
|
}
|
package/x/vibc/types/msgs.go
CHANGED
|
@@ -8,9 +8,7 @@ import (
|
|
|
8
8
|
|
|
9
9
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
|
|
13
|
-
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
|
|
11
|
+
chanTypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
|
|
14
12
|
|
|
15
13
|
"google.golang.org/protobuf/proto"
|
|
16
14
|
"google.golang.org/protobuf/protoadapt"
|
|
@@ -20,7 +18,6 @@ import (
|
|
|
20
18
|
const RouterKey = ModuleName // this was defined in your key.go file
|
|
21
19
|
|
|
22
20
|
var _ sdk.Msg = &MsgSendPacket{}
|
|
23
|
-
var _ ibcexported.PacketI = (*Packet)(nil)
|
|
24
21
|
|
|
25
22
|
// Replacing msg.GetSigners() but before we can adopt AddressString.
|
|
26
23
|
// https://github.com/cosmos/cosmos-sdk/issues/20077#issuecomment-2062601533
|
|
@@ -42,29 +39,10 @@ func DefineCustomGetSigners(options *signing.Options) {
|
|
|
42
39
|
)
|
|
43
40
|
}
|
|
44
41
|
|
|
45
|
-
func (p Packet) ValidateBasic() error {
|
|
46
|
-
channelPacket := agtypes.CopyToChannelPacket(p);
|
|
47
|
-
return channelPacket.ValidateBasic()
|
|
48
|
-
}
|
|
49
|
-
|
|
50
42
|
// NewMsgSendPacket returns a new send request
|
|
51
|
-
func NewMsgSendPacket(packet
|
|
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
|
-
}
|
|
43
|
+
func NewMsgSendPacket(packet chanTypes.Packet, sender sdk.AccAddress) *MsgSendPacket {
|
|
66
44
|
return &MsgSendPacket{
|
|
67
|
-
Packet:
|
|
45
|
+
Packet: packet,
|
|
68
46
|
Sender: sender,
|
|
69
47
|
}
|
|
70
48
|
}
|
|
@@ -90,38 +68,3 @@ func (msg MsgSendPacket) GetSigners() []sdk.AccAddress {
|
|
|
90
68
|
func (msg MsgSendPacket) Type() string {
|
|
91
69
|
return "sendpacket"
|
|
92
70
|
}
|
|
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
|
-
}
|