@agoric/cosmos 0.35.0-u13.0 → 0.35.0-u14.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.
- package/CHANGELOG.md +43 -0
- package/Makefile +25 -12
- package/ante/ante.go +7 -5
- package/app/app.go +118 -86
- package/app/export.go +13 -6
- package/cmd/agd/main.go +5 -3
- package/cmd/libdaemon/main.go +5 -2
- package/daemon/cmd/genaccounts.go +13 -9
- package/daemon/cmd/root.go +38 -15
- package/daemon/cmd/root_test.go +1 -1
- package/daemon/cmd/testnet.go +17 -6
- package/daemon/main.go +3 -2
- package/git-revision.txt +1 -1
- package/go.mod +95 -64
- package/go.sum +592 -243
- package/package.json +3 -3
- package/proto/agoric/vstorage/query.proto +53 -1
- package/scripts/protocgen.sh +12 -1
- package/third_party/proto/buf.yaml +1 -0
- package/third_party/proto/cosmos/base/query/v1beta1/pagination.proto +4 -1
- package/third_party/proto/cosmos/base/v1beta1/coin.proto +7 -4
- package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +16 -6
- package/third_party/proto/cosmos_proto/cosmos.proto +97 -0
- package/third_party/proto/google/api/annotations.proto +1 -1
- package/third_party/proto/google/api/http.proto +181 -120
- package/third_party/proto/google/api/httpbody.proto +9 -6
- package/third_party/proto/google/protobuf/any.proto +1 -7
- package/third_party/proto/ibc/core/channel/v1/channel.proto +15 -1
- package/third_party/proto/ibc/core/client/v1/client.proto +9 -6
- package/upgradegaia.sh +13 -4
- package/vm/action.go +133 -0
- package/vm/action_test.go +129 -0
- package/vm/controller.go +9 -16
- package/vm/core_proposals.go +31 -0
- package/x/lien/keeper/account.go +3 -3
- package/x/lien/keeper/keeper.go +5 -4
- package/x/lien/keeper/keeper_test.go +9 -9
- package/x/lien/lien.go +6 -4
- package/x/lien/lien_test.go +20 -16
- package/x/swingset/abci.go +25 -33
- package/x/swingset/client/cli/query.go +2 -2
- package/x/swingset/client/cli/tx.go +48 -33
- package/x/swingset/client/proposal_handler.go +2 -17
- package/x/swingset/keeper/keeper.go +30 -15
- package/x/swingset/keeper/keeper_test.go +1 -1
- package/x/swingset/keeper/msg_server.go +21 -51
- package/x/swingset/keeper/proposal.go +14 -8
- package/x/swingset/keeper/querier.go +14 -6
- package/x/swingset/keeper/swing_store_exports_handler.go +5 -1
- package/x/swingset/proposal_handler.go +3 -3
- package/x/swingset/swingset.go +4 -2
- package/x/swingset/types/codec.go +2 -2
- package/x/swingset/types/msgs.pb.go +16 -16
- package/x/swingset/types/proposal.go +5 -5
- package/x/swingset/types/types.go +30 -28
- package/x/vbank/keeper/keeper.go +3 -2
- package/x/vbank/keeper/querier.go +6 -2
- package/x/vbank/keeper/rewards.go +1 -1
- package/x/vbank/vbank.go +19 -17
- package/x/vbank/vbank_test.go +18 -18
- package/x/vibc/handler.go +3 -8
- package/x/vibc/ibc.go +66 -113
- package/x/vibc/keeper/keeper.go +19 -18
- package/x/vibc/types/expected_keepers.go +13 -5
- package/x/vibc/types/msgs.go +1 -1
- package/x/vibc/types/msgs.pb.go +1 -1
- package/x/vstorage/README.md +138 -0
- package/x/vstorage/capdata/capdata.go +298 -0
- package/x/vstorage/capdata/capdata_test.go +352 -0
- package/x/vstorage/client/cli/query.go +51 -4
- package/x/vstorage/keeper/grpc_query.go +221 -0
- package/x/vstorage/keeper/keeper.go +3 -2
- package/x/vstorage/keeper/keeper_grpc_test.go +300 -0
- package/x/vstorage/keeper/keeper_test.go +1 -1
- package/x/vstorage/keeper/querier.go +6 -2
- package/x/vstorage/types/query.pb.go +646 -36
- package/x/vstorage/types/query.pb.gw.go +119 -0
- package/x/vstorage/vstorage.go +16 -15
- package/x/vstorage/vstorage_test.go +5 -5
- /package/{src/index.cjs → index.cjs} +0 -0
package/x/vibc/handler.go
CHANGED
|
@@ -3,6 +3,7 @@ package vibc
|
|
|
3
3
|
import (
|
|
4
4
|
"fmt"
|
|
5
5
|
|
|
6
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
6
7
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
7
8
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
8
9
|
)
|
|
@@ -23,10 +24,8 @@ func NewHandler(keeper Keeper) sdk.Handler {
|
|
|
23
24
|
|
|
24
25
|
type sendPacketAction struct {
|
|
25
26
|
*MsgSendPacket
|
|
26
|
-
|
|
27
|
-
Event
|
|
28
|
-
BlockHeight int64 `json:"blockHeight"`
|
|
29
|
-
BlockTime int64 `json:"blockTime"`
|
|
27
|
+
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
28
|
+
Event string `json:"event" default:"sendPacket"`
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
func handleMsgSendPacket(ctx sdk.Context, keeper Keeper, msg *MsgSendPacket) (*sdk.Result, error) {
|
|
@@ -41,10 +40,6 @@ func handleMsgSendPacket(ctx sdk.Context, keeper Keeper, msg *MsgSendPacket) (*s
|
|
|
41
40
|
|
|
42
41
|
action := &sendPacketAction{
|
|
43
42
|
MsgSendPacket: msg,
|
|
44
|
-
Type: "IBC_EVENT",
|
|
45
|
-
Event: "sendPacket",
|
|
46
|
-
BlockHeight: ctx.BlockHeight(),
|
|
47
|
-
BlockTime: ctx.BlockTime().Unix(),
|
|
48
43
|
}
|
|
49
44
|
// fmt.Fprintf(os.Stderr, "Context is %+v\n", ctx)
|
|
50
45
|
|
package/x/vibc/ibc.go
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
package vibc
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
+
"context"
|
|
4
5
|
"encoding/json"
|
|
5
6
|
"fmt"
|
|
6
7
|
|
|
7
8
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
8
9
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
9
10
|
capability "github.com/cosmos/cosmos-sdk/x/capability/types"
|
|
10
|
-
channeltypes "github.com/cosmos/ibc-go/
|
|
11
|
-
porttypes "github.com/cosmos/ibc-go/
|
|
12
|
-
host "github.com/cosmos/ibc-go/
|
|
11
|
+
channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
|
|
12
|
+
porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types"
|
|
13
|
+
host "github.com/cosmos/ibc-go/v6/modules/core/24-host"
|
|
13
14
|
|
|
14
|
-
"github.com/cosmos/ibc-go/
|
|
15
|
+
"github.com/cosmos/ibc-go/v6/modules/core/exported"
|
|
15
16
|
|
|
16
17
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
17
18
|
)
|
|
@@ -63,8 +64,9 @@ func NewIBCModule(keeper Keeper) IBCModule {
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
func (ch IBCModule) Receive(
|
|
67
|
+
func (ch IBCModule) Receive(cctx context.Context, str string) (ret string, err error) {
|
|
67
68
|
// fmt.Println("ibc.go downcall", str)
|
|
69
|
+
ctx := sdk.UnwrapSDKContext(cctx)
|
|
68
70
|
keeper := ch.keeper
|
|
69
71
|
|
|
70
72
|
msg := new(portMessage)
|
|
@@ -79,29 +81,28 @@ func (ch IBCModule) Receive(ctx *vm.ControllerContext, str string) (ret string,
|
|
|
79
81
|
|
|
80
82
|
switch msg.Method {
|
|
81
83
|
case "sendPacket":
|
|
82
|
-
seq, ok := keeper.GetNextSequenceSend(
|
|
83
|
-
ctx.Context,
|
|
84
|
-
msg.Packet.SourcePort,
|
|
85
|
-
msg.Packet.SourceChannel,
|
|
86
|
-
)
|
|
87
|
-
if !ok {
|
|
88
|
-
return "", fmt.Errorf("unknown sequence number")
|
|
89
|
-
}
|
|
90
|
-
|
|
91
84
|
timeoutTimestamp := msg.Packet.TimeoutTimestamp
|
|
92
85
|
if msg.Packet.TimeoutHeight.IsZero() && msg.Packet.TimeoutTimestamp == 0 {
|
|
93
86
|
// Use the relative timeout if no absolute timeout is specifiied.
|
|
94
|
-
timeoutTimestamp = uint64(ctx.
|
|
87
|
+
timeoutTimestamp = uint64(ctx.BlockTime().UnixNano()) + msg.RelativeTimeoutNs
|
|
95
88
|
}
|
|
96
89
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
msg.Packet.SourcePort,
|
|
100
|
-
msg.Packet.
|
|
101
|
-
msg.Packet.TimeoutHeight,
|
|
90
|
+
seq, err := keeper.SendPacket(
|
|
91
|
+
ctx,
|
|
92
|
+
msg.Packet.SourcePort,
|
|
93
|
+
msg.Packet.SourceChannel,
|
|
94
|
+
msg.Packet.TimeoutHeight,
|
|
95
|
+
timeoutTimestamp,
|
|
96
|
+
msg.Packet.Data,
|
|
102
97
|
)
|
|
103
|
-
err = keeper.SendPacket(ctx.Context, packet)
|
|
104
98
|
if err == nil {
|
|
99
|
+
// synthesize the sent packet
|
|
100
|
+
packet := channeltypes.NewPacket(
|
|
101
|
+
msg.Packet.Data, seq,
|
|
102
|
+
msg.Packet.SourcePort, msg.Packet.SourceChannel,
|
|
103
|
+
msg.Packet.DestinationPort, msg.Packet.DestinationChannel,
|
|
104
|
+
msg.Packet.TimeoutHeight, timeoutTimestamp,
|
|
105
|
+
)
|
|
105
106
|
bytes, err := json.Marshal(&packet)
|
|
106
107
|
if err == nil {
|
|
107
108
|
ret = string(bytes)
|
|
@@ -109,14 +110,14 @@ func (ch IBCModule) Receive(ctx *vm.ControllerContext, str string) (ret string,
|
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
case "receiveExecuted":
|
|
112
|
-
err = keeper.WriteAcknowledgement(ctx
|
|
113
|
+
err = keeper.WriteAcknowledgement(ctx, msg.Packet, msg.Ack)
|
|
113
114
|
if err == nil {
|
|
114
115
|
ret = "true"
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
case "startChannelOpenInit":
|
|
118
119
|
err = keeper.ChanOpenInit(
|
|
119
|
-
ctx
|
|
120
|
+
ctx, stringToOrder(msg.Order), msg.Hops,
|
|
120
121
|
msg.Packet.SourcePort,
|
|
121
122
|
msg.Packet.DestinationPort,
|
|
122
123
|
msg.Version,
|
|
@@ -126,19 +127,19 @@ func (ch IBCModule) Receive(ctx *vm.ControllerContext, str string) (ret string,
|
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
case "startChannelCloseInit":
|
|
129
|
-
err = keeper.ChanCloseInit(ctx
|
|
130
|
+
err = keeper.ChanCloseInit(ctx, msg.Packet.SourcePort, msg.Packet.SourceChannel)
|
|
130
131
|
if err == nil {
|
|
131
132
|
ret = "true"
|
|
132
133
|
}
|
|
133
134
|
|
|
134
135
|
case "bindPort":
|
|
135
|
-
err = keeper.BindPort(ctx
|
|
136
|
+
err = keeper.BindPort(ctx, msg.Packet.SourcePort)
|
|
136
137
|
if err == nil {
|
|
137
138
|
ret = "true"
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
case "timeoutExecuted":
|
|
141
|
-
err = keeper.TimeoutExecuted(ctx
|
|
142
|
+
err = keeper.TimeoutExecuted(ctx, msg.Packet)
|
|
142
143
|
if err == nil {
|
|
143
144
|
ret = "true"
|
|
144
145
|
}
|
|
@@ -151,7 +152,7 @@ func (ch IBCModule) Receive(ctx *vm.ControllerContext, str string) (ret string,
|
|
|
151
152
|
return
|
|
152
153
|
}
|
|
153
154
|
|
|
154
|
-
func (im IBCModule) PushAction(ctx sdk.Context, action vm.
|
|
155
|
+
func (im IBCModule) PushAction(ctx sdk.Context, action vm.Action) error {
|
|
155
156
|
// fmt.Println("ibc.go upcall", send)
|
|
156
157
|
return im.keeper.PushAction(ctx, action)
|
|
157
158
|
// fmt.Println("ibc.go upcall reply", reply, err)
|
|
@@ -175,16 +176,14 @@ func (im IBCModule) OnChanOpenInit(
|
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
type channelOpenTryEvent struct {
|
|
178
|
-
|
|
179
|
-
Event
|
|
180
|
-
Order
|
|
181
|
-
ConnectionHops
|
|
182
|
-
PortID
|
|
183
|
-
ChannelID
|
|
184
|
-
Counterparty
|
|
185
|
-
Version
|
|
186
|
-
BlockHeight int64 `json:"blockHeight"`
|
|
187
|
-
BlockTime int64 `json:"blockTime"`
|
|
179
|
+
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
180
|
+
Event string `json:"event" default:"channelOpenTry"`
|
|
181
|
+
Order string `json:"order"`
|
|
182
|
+
ConnectionHops []string `json:"connectionHops"`
|
|
183
|
+
PortID string `json:"portID"`
|
|
184
|
+
ChannelID string `json:"channelID"`
|
|
185
|
+
Counterparty channeltypes.Counterparty `json:"counterparty"`
|
|
186
|
+
Version string `json:"version"`
|
|
188
187
|
}
|
|
189
188
|
|
|
190
189
|
func (im IBCModule) OnChanOpenTry(
|
|
@@ -198,16 +197,12 @@ func (im IBCModule) OnChanOpenTry(
|
|
|
198
197
|
counterpartyVersion string,
|
|
199
198
|
) (string, error) {
|
|
200
199
|
event := channelOpenTryEvent{
|
|
201
|
-
Type: "IBC_EVENT",
|
|
202
|
-
Event: "channelOpenTry",
|
|
203
200
|
Order: orderToString(order),
|
|
204
201
|
ConnectionHops: connectionHops,
|
|
205
202
|
PortID: portID,
|
|
206
203
|
ChannelID: channelID,
|
|
207
204
|
Counterparty: counterparty,
|
|
208
205
|
Version: counterpartyVersion, // TODO: don't just use the counterparty version
|
|
209
|
-
BlockHeight: ctx.BlockHeight(),
|
|
210
|
-
BlockTime: ctx.BlockTime().Unix(),
|
|
211
206
|
}
|
|
212
207
|
|
|
213
208
|
err := im.PushAction(ctx, event)
|
|
@@ -224,15 +219,13 @@ func (im IBCModule) OnChanOpenTry(
|
|
|
224
219
|
}
|
|
225
220
|
|
|
226
221
|
type channelOpenAckEvent struct {
|
|
227
|
-
|
|
228
|
-
Event string `json:"event"
|
|
222
|
+
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
223
|
+
Event string `json:"event" default:"channelOpenAck"`
|
|
229
224
|
PortID string `json:"portID"`
|
|
230
225
|
ChannelID string `json:"channelID"`
|
|
231
226
|
CounterpartyVersion string `json:"counterpartyVersion"`
|
|
232
227
|
Counterparty channeltypes.Counterparty `json:"counterparty"`
|
|
233
228
|
ConnectionHops []string `json:"connectionHops"`
|
|
234
|
-
BlockHeight int64 `json:"blockHeight"`
|
|
235
|
-
BlockTime int64 `json:"blockTime"`
|
|
236
229
|
}
|
|
237
230
|
|
|
238
231
|
func (im IBCModule) OnChanOpenAck(
|
|
@@ -248,27 +241,21 @@ func (im IBCModule) OnChanOpenAck(
|
|
|
248
241
|
|
|
249
242
|
channel.Counterparty.ChannelId = counterpartyChannelID
|
|
250
243
|
event := channelOpenAckEvent{
|
|
251
|
-
Type: "IBC_EVENT",
|
|
252
|
-
Event: "channelOpenAck",
|
|
253
244
|
PortID: portID,
|
|
254
245
|
ChannelID: channelID,
|
|
255
246
|
CounterpartyVersion: counterpartyVersion,
|
|
256
247
|
Counterparty: channel.Counterparty,
|
|
257
248
|
ConnectionHops: channel.ConnectionHops,
|
|
258
|
-
BlockHeight: ctx.BlockHeight(),
|
|
259
|
-
BlockTime: ctx.BlockTime().Unix(),
|
|
260
249
|
}
|
|
261
250
|
|
|
262
251
|
return im.PushAction(ctx, event)
|
|
263
252
|
}
|
|
264
253
|
|
|
265
254
|
type channelOpenConfirmEvent struct {
|
|
266
|
-
|
|
267
|
-
Event
|
|
268
|
-
PortID
|
|
269
|
-
ChannelID
|
|
270
|
-
BlockHeight int64 `json:"blockHeight"`
|
|
271
|
-
BlockTime int64 `json:"blockTime"`
|
|
255
|
+
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
256
|
+
Event string `json:"event" default:"channelOpenConfirm"`
|
|
257
|
+
PortID string `json:"portID"`
|
|
258
|
+
ChannelID string `json:"channelID"`
|
|
272
259
|
}
|
|
273
260
|
|
|
274
261
|
func (im IBCModule) OnChanOpenConfirm(
|
|
@@ -277,24 +264,18 @@ func (im IBCModule) OnChanOpenConfirm(
|
|
|
277
264
|
channelID string,
|
|
278
265
|
) error {
|
|
279
266
|
event := channelOpenConfirmEvent{
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
PortID: portID,
|
|
283
|
-
ChannelID: channelID,
|
|
284
|
-
BlockHeight: ctx.BlockHeight(),
|
|
285
|
-
BlockTime: ctx.BlockTime().Unix(),
|
|
267
|
+
PortID: portID,
|
|
268
|
+
ChannelID: channelID,
|
|
286
269
|
}
|
|
287
270
|
|
|
288
271
|
return im.PushAction(ctx, event)
|
|
289
272
|
}
|
|
290
273
|
|
|
291
274
|
type channelCloseInitEvent struct {
|
|
292
|
-
|
|
293
|
-
Event
|
|
294
|
-
PortID
|
|
295
|
-
ChannelID
|
|
296
|
-
BlockHeight int64 `json:"blockHeight"`
|
|
297
|
-
BlockTime int64 `json:"blockTime"`
|
|
275
|
+
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
276
|
+
Event string `json:"event" default:"channelCloseInit"`
|
|
277
|
+
PortID string `json:"portID"`
|
|
278
|
+
ChannelID string `json:"channelID"`
|
|
298
279
|
}
|
|
299
280
|
|
|
300
281
|
func (im IBCModule) OnChanCloseInit(
|
|
@@ -303,12 +284,8 @@ func (im IBCModule) OnChanCloseInit(
|
|
|
303
284
|
channelID string,
|
|
304
285
|
) error {
|
|
305
286
|
event := channelCloseInitEvent{
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
PortID: portID,
|
|
309
|
-
ChannelID: channelID,
|
|
310
|
-
BlockHeight: ctx.BlockHeight(),
|
|
311
|
-
BlockTime: ctx.BlockTime().Unix(),
|
|
287
|
+
PortID: portID,
|
|
288
|
+
ChannelID: channelID,
|
|
312
289
|
}
|
|
313
290
|
|
|
314
291
|
err := im.PushAction(ctx, event)
|
|
@@ -316,12 +293,10 @@ func (im IBCModule) OnChanCloseInit(
|
|
|
316
293
|
}
|
|
317
294
|
|
|
318
295
|
type channelCloseConfirmEvent struct {
|
|
319
|
-
|
|
320
|
-
Event
|
|
321
|
-
PortID
|
|
322
|
-
ChannelID
|
|
323
|
-
BlockHeight int64 `json:"blockHeight"`
|
|
324
|
-
BlockTime int64 `json:"blockTime"`
|
|
296
|
+
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
297
|
+
Event string `json:"event" default:"channelCloseConfirm"`
|
|
298
|
+
PortID string `json:"portID"`
|
|
299
|
+
ChannelID string `json:"channelID"`
|
|
325
300
|
}
|
|
326
301
|
|
|
327
302
|
func (im IBCModule) OnChanCloseConfirm(
|
|
@@ -330,12 +305,8 @@ func (im IBCModule) OnChanCloseConfirm(
|
|
|
330
305
|
channelID string,
|
|
331
306
|
) error {
|
|
332
307
|
event := channelCloseConfirmEvent{
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
PortID: portID,
|
|
336
|
-
ChannelID: channelID,
|
|
337
|
-
BlockHeight: ctx.BlockHeight(),
|
|
338
|
-
BlockTime: ctx.BlockTime().Unix(),
|
|
308
|
+
PortID: portID,
|
|
309
|
+
ChannelID: channelID,
|
|
339
310
|
}
|
|
340
311
|
|
|
341
312
|
err := im.PushAction(ctx, event)
|
|
@@ -343,11 +314,9 @@ func (im IBCModule) OnChanCloseConfirm(
|
|
|
343
314
|
}
|
|
344
315
|
|
|
345
316
|
type receivePacketEvent struct {
|
|
346
|
-
|
|
347
|
-
Event
|
|
348
|
-
Packet
|
|
349
|
-
BlockHeight int64 `json:"blockHeight"`
|
|
350
|
-
BlockTime int64 `json:"blockTime"`
|
|
317
|
+
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
318
|
+
Event string `json:"event" default:"receivePacket"`
|
|
319
|
+
Packet channeltypes.Packet `json:"packet"`
|
|
351
320
|
}
|
|
352
321
|
|
|
353
322
|
func (im IBCModule) OnRecvPacket(
|
|
@@ -364,11 +333,7 @@ func (im IBCModule) OnRecvPacket(
|
|
|
364
333
|
// the same packets.
|
|
365
334
|
|
|
366
335
|
event := receivePacketEvent{
|
|
367
|
-
|
|
368
|
-
Event: "receivePacket",
|
|
369
|
-
Packet: packet,
|
|
370
|
-
BlockHeight: ctx.BlockHeight(),
|
|
371
|
-
BlockTime: ctx.BlockTime().Unix(),
|
|
336
|
+
Packet: packet,
|
|
372
337
|
}
|
|
373
338
|
|
|
374
339
|
err := im.PushAction(ctx, event)
|
|
@@ -380,12 +345,10 @@ func (im IBCModule) OnRecvPacket(
|
|
|
380
345
|
}
|
|
381
346
|
|
|
382
347
|
type acknowledgementPacketEvent struct {
|
|
383
|
-
|
|
384
|
-
Event string `json:"event"
|
|
348
|
+
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
349
|
+
Event string `json:"event" default:"acknowledgementPacket"`
|
|
385
350
|
Packet channeltypes.Packet `json:"packet"`
|
|
386
351
|
Acknowledgement []byte `json:"acknowledgement"`
|
|
387
|
-
BlockHeight int64 `json:"blockHeight"`
|
|
388
|
-
BlockTime int64 `json:"blockTime"`
|
|
389
352
|
}
|
|
390
353
|
|
|
391
354
|
func (im IBCModule) OnAcknowledgementPacket(
|
|
@@ -395,12 +358,8 @@ func (im IBCModule) OnAcknowledgementPacket(
|
|
|
395
358
|
relayer sdk.AccAddress,
|
|
396
359
|
) error {
|
|
397
360
|
event := acknowledgementPacketEvent{
|
|
398
|
-
Type: "IBC_EVENT",
|
|
399
|
-
Event: "acknowledgementPacket",
|
|
400
361
|
Packet: packet,
|
|
401
362
|
Acknowledgement: acknowledgement,
|
|
402
|
-
BlockHeight: ctx.BlockHeight(),
|
|
403
|
-
BlockTime: ctx.BlockTime().Unix(),
|
|
404
363
|
}
|
|
405
364
|
|
|
406
365
|
err := im.PushAction(ctx, event)
|
|
@@ -412,11 +371,9 @@ func (im IBCModule) OnAcknowledgementPacket(
|
|
|
412
371
|
}
|
|
413
372
|
|
|
414
373
|
type timeoutPacketEvent struct {
|
|
415
|
-
|
|
416
|
-
Event
|
|
417
|
-
Packet
|
|
418
|
-
BlockHeight int64 `json:"blockHeight"`
|
|
419
|
-
BlockTime int64 `json:"blockTime"`
|
|
374
|
+
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
375
|
+
Event string `json:"event" default:"timeoutPacket"`
|
|
376
|
+
Packet channeltypes.Packet `json:"packet"`
|
|
420
377
|
}
|
|
421
378
|
|
|
422
379
|
func (im IBCModule) OnTimeoutPacket(
|
|
@@ -425,11 +382,7 @@ func (im IBCModule) OnTimeoutPacket(
|
|
|
425
382
|
relayer sdk.AccAddress,
|
|
426
383
|
) error {
|
|
427
384
|
event := timeoutPacketEvent{
|
|
428
|
-
|
|
429
|
-
Event: "timeoutPacket",
|
|
430
|
-
Packet: packet,
|
|
431
|
-
BlockHeight: ctx.BlockHeight(),
|
|
432
|
-
BlockTime: ctx.BlockTime().Unix(),
|
|
385
|
+
Packet: packet,
|
|
433
386
|
}
|
|
434
387
|
|
|
435
388
|
err := im.PushAction(ctx, event)
|
package/x/vibc/keeper/keeper.go
CHANGED
|
@@ -4,15 +4,17 @@ import (
|
|
|
4
4
|
"fmt"
|
|
5
5
|
|
|
6
6
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
7
|
+
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
7
8
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
9
|
|
|
9
10
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
10
11
|
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
|
11
12
|
capability "github.com/cosmos/cosmos-sdk/x/capability/types"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
|
|
14
|
+
channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
|
|
15
|
+
porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types"
|
|
16
|
+
host "github.com/cosmos/ibc-go/v6/modules/core/24-host"
|
|
17
|
+
ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported"
|
|
16
18
|
|
|
17
19
|
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
|
18
20
|
|
|
@@ -22,7 +24,7 @@ import (
|
|
|
22
24
|
|
|
23
25
|
// Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine
|
|
24
26
|
type Keeper struct {
|
|
25
|
-
storeKey
|
|
27
|
+
storeKey storetypes.StoreKey
|
|
26
28
|
cdc codec.Codec
|
|
27
29
|
|
|
28
30
|
channelKeeper types.ChannelKeeper
|
|
@@ -35,7 +37,7 @@ type Keeper struct {
|
|
|
35
37
|
|
|
36
38
|
// NewKeeper creates a new dIBC Keeper instance
|
|
37
39
|
func NewKeeper(
|
|
38
|
-
cdc codec.Codec, key
|
|
40
|
+
cdc codec.Codec, key storetypes.StoreKey,
|
|
39
41
|
channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper,
|
|
40
42
|
bankKeeper bankkeeper.Keeper,
|
|
41
43
|
scopedKeeper capabilitykeeper.ScopedKeeper,
|
|
@@ -57,12 +59,6 @@ func (k Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) s
|
|
|
57
59
|
return k.bankKeeper.GetBalance(ctx, addr, denom)
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
// GetNextSequenceSend defines a wrapper function for the channel Keeper's function
|
|
61
|
-
// in order to expose it to the vibc IBC handler.
|
|
62
|
-
func (k Keeper) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) {
|
|
63
|
-
return k.channelKeeper.GetNextSequenceSend(ctx, portID, channelID)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
62
|
// GetChannel defines a wrapper function for the channel Keeper's function
|
|
67
63
|
// in order to expose it to the vibc IBC handler.
|
|
68
64
|
func (k Keeper) GetChannel(ctx sdk.Context, portID, channelID string) (channeltypes.Channel, bool) {
|
|
@@ -98,15 +94,20 @@ func (k Keeper) ChanOpenInit(ctx sdk.Context, order channeltypes.Order, connecti
|
|
|
98
94
|
|
|
99
95
|
// SendPacket defines a wrapper function for the channel Keeper's function
|
|
100
96
|
// in order to expose it to the vibc IBC handler.
|
|
101
|
-
func (k Keeper) SendPacket(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
func (k Keeper) SendPacket(
|
|
98
|
+
ctx sdk.Context,
|
|
99
|
+
sourcePort string,
|
|
100
|
+
sourceChannel string,
|
|
101
|
+
timeoutHeight clienttypes.Height,
|
|
102
|
+
timeoutTimestamp uint64,
|
|
103
|
+
data []byte,
|
|
104
|
+
) (uint64, error) {
|
|
105
|
+
capName := host.ChannelCapabilityPath(sourcePort, sourceChannel)
|
|
105
106
|
chanCap, ok := k.GetCapability(ctx, capName)
|
|
106
107
|
if !ok {
|
|
107
|
-
return sdkerrors.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "could not retrieve channel capability at: %s", capName)
|
|
108
|
+
return 0, sdkerrors.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "could not retrieve channel capability at: %s", capName)
|
|
108
109
|
}
|
|
109
|
-
return k.channelKeeper.SendPacket(ctx, chanCap,
|
|
110
|
+
return k.channelKeeper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data)
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
var _ ibcexported.Acknowledgement = (*rawAcknowledgement)(nil)
|
|
@@ -3,16 +3,24 @@ package types
|
|
|
3
3
|
import (
|
|
4
4
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
5
5
|
capability "github.com/cosmos/cosmos-sdk/x/capability/types"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
|
|
7
|
+
connection "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types"
|
|
8
|
+
channel "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
|
|
9
|
+
ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported"
|
|
9
10
|
)
|
|
10
11
|
|
|
11
12
|
// ChannelKeeper defines the expected IBC channel keeper
|
|
12
13
|
type ChannelKeeper interface {
|
|
13
14
|
GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channel.Channel, found bool)
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
SendPacket(
|
|
16
|
+
ctx sdk.Context,
|
|
17
|
+
channelCap *capability.Capability,
|
|
18
|
+
sourcePort string,
|
|
19
|
+
sourceChannel string,
|
|
20
|
+
timeoutHeight clienttypes.Height,
|
|
21
|
+
timeoutTimestamp uint64,
|
|
22
|
+
data []byte,
|
|
23
|
+
) (uint64, error)
|
|
16
24
|
WriteAcknowledgement(ctx sdk.Context, channelCap *capability.Capability, packet ibcexported.PacketI, acknowledgement ibcexported.Acknowledgement) error
|
|
17
25
|
ChanOpenInit(ctx sdk.Context, order channel.Order, connectionHops []string, portID string,
|
|
18
26
|
portCap *capability.Capability, counterparty channel.Counterparty, version string) (string, *capability.Capability, error)
|
package/x/vibc/types/msgs.go
CHANGED
|
@@ -4,7 +4,7 @@ import (
|
|
|
4
4
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
5
5
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
6
6
|
|
|
7
|
-
chanTypes "github.com/cosmos/ibc-go/
|
|
7
|
+
chanTypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
|
|
8
8
|
)
|
|
9
9
|
|
|
10
10
|
const RouterKey = ModuleName // this was defined in your key.go file
|
package/x/vibc/types/msgs.pb.go
CHANGED
|
@@ -7,7 +7,7 @@ import (
|
|
|
7
7
|
context "context"
|
|
8
8
|
fmt "fmt"
|
|
9
9
|
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
|
|
10
|
-
types "github.com/cosmos/ibc-go/
|
|
10
|
+
types "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
|
|
11
11
|
_ "github.com/gogo/protobuf/gogoproto"
|
|
12
12
|
grpc1 "github.com/gogo/protobuf/grpc"
|
|
13
13
|
proto "github.com/gogo/protobuf/proto"
|