@agoric/cosmos 0.35.0-upgrade-14-dev-c8f9e7b.0 → 0.35.0-upgrade-16a-dev-fb592e4.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 +121 -77
- package/MAINTAINERS.md +3 -0
- package/Makefile +36 -26
- package/ante/ante.go +7 -9
- package/ante/inbound_test.go +3 -2
- package/ante/vm_admission.go +2 -1
- package/app/app.go +212 -140
- package/app/upgrade.go +76 -0
- package/cmd/agd/agvm.go +42 -0
- package/cmd/agd/main.go +130 -11
- package/cmd/libdaemon/main.go +64 -53
- package/cmd/libdaemon/main_test.go +2 -1
- package/daemon/cmd/root.go +171 -74
- package/daemon/cmd/root_test.go +189 -1
- package/daemon/main.go +4 -2
- package/e2e_test/Makefile +29 -0
- package/e2e_test/README.md +100 -0
- package/e2e_test/go.mod +217 -0
- package/e2e_test/go.sum +1323 -0
- package/e2e_test/ibc_conformance_test.go +56 -0
- package/e2e_test/pfm_test.go +613 -0
- package/e2e_test/util.go +271 -0
- package/git-revision.txt +1 -1
- package/go.mod +22 -11
- package/go.sum +17 -13
- package/package.json +9 -5
- package/proto/agoric/swingset/genesis.proto +4 -0
- package/proto/agoric/swingset/swingset.proto +1 -1
- package/proto/agoric/vlocalchain/.clang-format +7 -0
- package/proto/agoric/vlocalchain/vlocalchain.proto +31 -0
- package/proto/agoric/vtransfer/genesis.proto +18 -0
- package/scripts/protocgen.sh +7 -8
- package/types/kv_entry_helpers.go +42 -0
- package/upgradegaia.sh +8 -8
- package/vm/action.go +5 -4
- package/vm/action_test.go +31 -11
- package/vm/client.go +113 -0
- package/vm/client_test.go +182 -0
- package/vm/controller.go +17 -40
- package/vm/core_proposals.go +22 -2
- package/vm/jsonrpcconn/jsonrpcconn.go +160 -0
- package/vm/jsonrpcconn/jsonrpcconn_test.go +126 -0
- package/vm/proto_json.go +38 -0
- package/vm/proto_json_test.go +103 -0
- package/vm/server.go +124 -0
- package/x/swingset/abci.go +10 -10
- package/x/swingset/alias.go +2 -0
- package/x/swingset/client/cli/tx.go +4 -0
- package/x/swingset/genesis.go +84 -24
- package/x/swingset/handler.go +2 -1
- package/x/swingset/keeper/extension_snapshotter.go +2 -2
- package/x/swingset/keeper/keeper.go +13 -25
- package/x/swingset/keeper/msg_server.go +18 -18
- package/x/swingset/keeper/proposal.go +3 -3
- package/x/swingset/keeper/querier.go +12 -11
- package/x/swingset/keeper/swing_store_exports_handler.go +21 -6
- package/x/swingset/keeper/test_utils.go +16 -0
- package/x/swingset/module.go +7 -7
- package/x/swingset/proposal_handler.go +2 -1
- package/x/swingset/testing/queue.go +17 -0
- package/x/swingset/types/default-params.go +1 -1
- package/x/swingset/types/expected_keepers.go +3 -2
- package/x/swingset/types/genesis.pb.go +78 -25
- package/x/swingset/types/msgs.go +44 -24
- package/x/swingset/types/params.go +2 -1
- package/x/swingset/types/proposal.go +5 -4
- package/x/swingset/types/swingset.pb.go +1 -1
- package/x/vbank/genesis.go +0 -2
- package/x/vbank/handler.go +2 -1
- package/x/vbank/keeper/querier.go +4 -3
- package/x/vbank/module.go +0 -5
- package/x/vbank/types/msgs.go +0 -12
- package/x/vbank/vbank.go +9 -9
- package/x/vbank/vbank_test.go +2 -2
- package/x/vibc/alias.go +3 -0
- package/x/vibc/handler.go +16 -9
- package/x/vibc/keeper/keeper.go +102 -65
- package/x/vibc/keeper/triggers.go +101 -0
- package/x/vibc/module.go +5 -8
- package/x/vibc/types/expected_keepers.go +13 -0
- package/x/vibc/types/ibc_module.go +336 -0
- package/x/vibc/types/receiver.go +170 -0
- package/x/vlocalchain/alias.go +19 -0
- package/x/vlocalchain/handler.go +21 -0
- package/x/vlocalchain/keeper/keeper.go +279 -0
- package/x/vlocalchain/keeper/keeper_test.go +97 -0
- package/x/vlocalchain/types/codec.go +34 -0
- package/x/vlocalchain/types/key.go +27 -0
- package/x/vlocalchain/types/msgs.go +16 -0
- package/x/vlocalchain/types/vlocalchain.pb.go +1072 -0
- package/x/vlocalchain/vlocalchain.go +114 -0
- package/x/vlocalchain/vlocalchain_test.go +434 -0
- package/x/vstorage/handler.go +2 -1
- package/x/vstorage/keeper/grpc_query.go +0 -1
- package/x/vstorage/keeper/keeper.go +13 -20
- package/x/vstorage/keeper/querier.go +6 -5
- package/x/vstorage/keeper/querier_test.go +4 -3
- package/x/vstorage/module.go +0 -5
- package/x/vstorage/testing/queue.go +27 -0
- package/x/vtransfer/alias.go +13 -0
- package/x/vtransfer/genesis.go +39 -0
- package/x/vtransfer/genesis_test.go +12 -0
- package/x/vtransfer/handler.go +20 -0
- package/x/vtransfer/ibc_middleware.go +186 -0
- package/x/vtransfer/ibc_middleware_test.go +448 -0
- package/x/vtransfer/keeper/keeper.go +281 -0
- package/x/vtransfer/module.go +124 -0
- package/x/vtransfer/types/expected_keepers.go +38 -0
- package/x/vtransfer/types/genesis.pb.go +327 -0
- package/x/vtransfer/types/key.go +9 -0
- package/x/vtransfer/types/msgs.go +9 -0
- package/ante/fee.go +0 -96
- package/proto/agoric/lien/genesis.proto +0 -25
- package/proto/agoric/lien/lien.proto +0 -25
- package/x/lien/alias.go +0 -17
- package/x/lien/genesis.go +0 -58
- package/x/lien/genesis_test.go +0 -101
- package/x/lien/keeper/account.go +0 -290
- package/x/lien/keeper/keeper.go +0 -255
- package/x/lien/keeper/keeper_test.go +0 -623
- package/x/lien/lien.go +0 -205
- package/x/lien/lien_test.go +0 -533
- package/x/lien/module.go +0 -115
- package/x/lien/spec/01_concepts.md +0 -146
- package/x/lien/spec/02_messages.md +0 -96
- package/x/lien/types/accountkeeper.go +0 -81
- package/x/lien/types/accountstate.go +0 -27
- package/x/lien/types/expected_keepers.go +0 -18
- package/x/lien/types/genesis.pb.go +0 -567
- package/x/lien/types/key.go +0 -25
- package/x/lien/types/lien.pb.go +0 -403
- package/x/vibc/ibc.go +0 -394
- /package/{src/index.cjs → index.cjs} +0 -0
package/x/vibc/ibc.go
DELETED
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
package vibc
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"encoding/json"
|
|
6
|
-
"fmt"
|
|
7
|
-
|
|
8
|
-
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
9
|
-
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
10
|
-
capability "github.com/cosmos/cosmos-sdk/x/capability/types"
|
|
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"
|
|
14
|
-
|
|
15
|
-
"github.com/cosmos/ibc-go/v6/modules/core/exported"
|
|
16
|
-
|
|
17
|
-
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
var (
|
|
21
|
-
_ porttypes.IBCModule = IBCModule{}
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
type IBCModule struct {
|
|
25
|
-
keeper Keeper
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
type portMessage struct { // comes from swingset's IBC handler
|
|
29
|
-
Type string `json:"type"` // IBC_METHOD
|
|
30
|
-
Method string `json:"method"`
|
|
31
|
-
Packet channeltypes.Packet `json:"packet"`
|
|
32
|
-
RelativeTimeoutNs uint64 `json:"relativeTimeoutNs,string"`
|
|
33
|
-
Order string `json:"order"`
|
|
34
|
-
Hops []string `json:"hops"`
|
|
35
|
-
Version string `json:"version"`
|
|
36
|
-
Ack []byte `json:"ack"`
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
func stringToOrder(order string) channeltypes.Order {
|
|
40
|
-
switch order {
|
|
41
|
-
case "ORDERED":
|
|
42
|
-
return channeltypes.ORDERED
|
|
43
|
-
case "UNORDERED":
|
|
44
|
-
return channeltypes.UNORDERED
|
|
45
|
-
default:
|
|
46
|
-
return channeltypes.NONE
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
func orderToString(order channeltypes.Order) string {
|
|
51
|
-
switch order {
|
|
52
|
-
case channeltypes.ORDERED:
|
|
53
|
-
return "ORDERED"
|
|
54
|
-
case channeltypes.UNORDERED:
|
|
55
|
-
return "UNORDERED"
|
|
56
|
-
default:
|
|
57
|
-
return "NONE"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
func NewIBCModule(keeper Keeper) IBCModule {
|
|
62
|
-
return IBCModule{
|
|
63
|
-
keeper: keeper,
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
func (ch IBCModule) Receive(cctx context.Context, str string) (ret string, err error) {
|
|
68
|
-
// fmt.Println("ibc.go downcall", str)
|
|
69
|
-
ctx := sdk.UnwrapSDKContext(cctx)
|
|
70
|
-
keeper := ch.keeper
|
|
71
|
-
|
|
72
|
-
msg := new(portMessage)
|
|
73
|
-
err = json.Unmarshal([]byte(str), &msg)
|
|
74
|
-
if err != nil {
|
|
75
|
-
return ret, err
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if msg.Type != "IBC_METHOD" {
|
|
79
|
-
return "", fmt.Errorf(`channel handler only accepts messages of "type": "IBC_METHOD"`)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
switch msg.Method {
|
|
83
|
-
case "sendPacket":
|
|
84
|
-
timeoutTimestamp := msg.Packet.TimeoutTimestamp
|
|
85
|
-
if msg.Packet.TimeoutHeight.IsZero() && msg.Packet.TimeoutTimestamp == 0 {
|
|
86
|
-
// Use the relative timeout if no absolute timeout is specifiied.
|
|
87
|
-
timeoutTimestamp = uint64(ctx.BlockTime().UnixNano()) + msg.RelativeTimeoutNs
|
|
88
|
-
}
|
|
89
|
-
|
|
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,
|
|
97
|
-
)
|
|
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
|
-
)
|
|
106
|
-
bytes, err := json.Marshal(&packet)
|
|
107
|
-
if err == nil {
|
|
108
|
-
ret = string(bytes)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
case "receiveExecuted":
|
|
113
|
-
err = keeper.WriteAcknowledgement(ctx, msg.Packet, msg.Ack)
|
|
114
|
-
if err == nil {
|
|
115
|
-
ret = "true"
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
case "startChannelOpenInit":
|
|
119
|
-
err = keeper.ChanOpenInit(
|
|
120
|
-
ctx, stringToOrder(msg.Order), msg.Hops,
|
|
121
|
-
msg.Packet.SourcePort,
|
|
122
|
-
msg.Packet.DestinationPort,
|
|
123
|
-
msg.Version,
|
|
124
|
-
)
|
|
125
|
-
if err == nil {
|
|
126
|
-
ret = "true"
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
case "startChannelCloseInit":
|
|
130
|
-
err = keeper.ChanCloseInit(ctx, msg.Packet.SourcePort, msg.Packet.SourceChannel)
|
|
131
|
-
if err == nil {
|
|
132
|
-
ret = "true"
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
case "bindPort":
|
|
136
|
-
err = keeper.BindPort(ctx, msg.Packet.SourcePort)
|
|
137
|
-
if err == nil {
|
|
138
|
-
ret = "true"
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
case "timeoutExecuted":
|
|
142
|
-
err = keeper.TimeoutExecuted(ctx, msg.Packet)
|
|
143
|
-
if err == nil {
|
|
144
|
-
ret = "true"
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
default:
|
|
148
|
-
err = fmt.Errorf("unrecognized method %s", msg.Method)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// fmt.Println("ibc.go downcall reply", ret, err)
|
|
152
|
-
return
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
func (im IBCModule) PushAction(ctx sdk.Context, action vm.Action) error {
|
|
156
|
-
// fmt.Println("ibc.go upcall", send)
|
|
157
|
-
return im.keeper.PushAction(ctx, action)
|
|
158
|
-
// fmt.Println("ibc.go upcall reply", reply, err)
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// Implement IBCModule callbacks
|
|
162
|
-
func (im IBCModule) OnChanOpenInit(
|
|
163
|
-
ctx sdk.Context,
|
|
164
|
-
order channeltypes.Order,
|
|
165
|
-
connectionHops []string,
|
|
166
|
-
portID string,
|
|
167
|
-
channelID string,
|
|
168
|
-
channelCap *capability.Capability,
|
|
169
|
-
counterparty channeltypes.Counterparty,
|
|
170
|
-
version string,
|
|
171
|
-
) (string, error) {
|
|
172
|
-
return "", sdkerrors.Wrap(
|
|
173
|
-
channeltypes.ErrChannelNotFound,
|
|
174
|
-
fmt.Sprintf("vibc does not allow synthetic channelOpenInit for port %s", portID),
|
|
175
|
-
)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
type channelOpenTryEvent struct {
|
|
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"`
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
func (im IBCModule) OnChanOpenTry(
|
|
190
|
-
ctx sdk.Context,
|
|
191
|
-
order channeltypes.Order,
|
|
192
|
-
connectionHops []string,
|
|
193
|
-
portID,
|
|
194
|
-
channelID string,
|
|
195
|
-
channelCap *capability.Capability,
|
|
196
|
-
counterparty channeltypes.Counterparty,
|
|
197
|
-
counterpartyVersion string,
|
|
198
|
-
) (string, error) {
|
|
199
|
-
event := channelOpenTryEvent{
|
|
200
|
-
Order: orderToString(order),
|
|
201
|
-
ConnectionHops: connectionHops,
|
|
202
|
-
PortID: portID,
|
|
203
|
-
ChannelID: channelID,
|
|
204
|
-
Counterparty: counterparty,
|
|
205
|
-
Version: counterpartyVersion, // TODO: don't just use the counterparty version
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
err := im.PushAction(ctx, event)
|
|
209
|
-
if err != nil {
|
|
210
|
-
return "", err
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Claim channel capability passed back by IBC module
|
|
214
|
-
if err = im.keeper.ClaimCapability(ctx, channelCap, host.ChannelCapabilityPath(portID, channelID)); err != nil {
|
|
215
|
-
return "", sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, err.Error())
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return event.Version, err
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
type channelOpenAckEvent struct {
|
|
222
|
-
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
223
|
-
Event string `json:"event" default:"channelOpenAck"`
|
|
224
|
-
PortID string `json:"portID"`
|
|
225
|
-
ChannelID string `json:"channelID"`
|
|
226
|
-
CounterpartyVersion string `json:"counterpartyVersion"`
|
|
227
|
-
Counterparty channeltypes.Counterparty `json:"counterparty"`
|
|
228
|
-
ConnectionHops []string `json:"connectionHops"`
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
func (im IBCModule) OnChanOpenAck(
|
|
232
|
-
ctx sdk.Context,
|
|
233
|
-
portID,
|
|
234
|
-
channelID string,
|
|
235
|
-
counterpartyChannelID string,
|
|
236
|
-
counterpartyVersion string,
|
|
237
|
-
) error {
|
|
238
|
-
// We don't care if the channel was found. If it wasn't then GetChannel
|
|
239
|
-
// returns an empty channel object that we can still use without crashing.
|
|
240
|
-
channel, _ := im.keeper.GetChannel(ctx, portID, channelID)
|
|
241
|
-
|
|
242
|
-
channel.Counterparty.ChannelId = counterpartyChannelID
|
|
243
|
-
event := channelOpenAckEvent{
|
|
244
|
-
PortID: portID,
|
|
245
|
-
ChannelID: channelID,
|
|
246
|
-
CounterpartyVersion: counterpartyVersion,
|
|
247
|
-
Counterparty: channel.Counterparty,
|
|
248
|
-
ConnectionHops: channel.ConnectionHops,
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
return im.PushAction(ctx, event)
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
type channelOpenConfirmEvent struct {
|
|
255
|
-
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
256
|
-
Event string `json:"event" default:"channelOpenConfirm"`
|
|
257
|
-
PortID string `json:"portID"`
|
|
258
|
-
ChannelID string `json:"channelID"`
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
func (im IBCModule) OnChanOpenConfirm(
|
|
262
|
-
ctx sdk.Context,
|
|
263
|
-
portID,
|
|
264
|
-
channelID string,
|
|
265
|
-
) error {
|
|
266
|
-
event := channelOpenConfirmEvent{
|
|
267
|
-
PortID: portID,
|
|
268
|
-
ChannelID: channelID,
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
return im.PushAction(ctx, event)
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
type channelCloseInitEvent struct {
|
|
275
|
-
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
276
|
-
Event string `json:"event" default:"channelCloseInit"`
|
|
277
|
-
PortID string `json:"portID"`
|
|
278
|
-
ChannelID string `json:"channelID"`
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
func (im IBCModule) OnChanCloseInit(
|
|
282
|
-
ctx sdk.Context,
|
|
283
|
-
portID,
|
|
284
|
-
channelID string,
|
|
285
|
-
) error {
|
|
286
|
-
event := channelCloseInitEvent{
|
|
287
|
-
PortID: portID,
|
|
288
|
-
ChannelID: channelID,
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
err := im.PushAction(ctx, event)
|
|
292
|
-
return err
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
type channelCloseConfirmEvent struct {
|
|
296
|
-
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
297
|
-
Event string `json:"event" default:"channelCloseConfirm"`
|
|
298
|
-
PortID string `json:"portID"`
|
|
299
|
-
ChannelID string `json:"channelID"`
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
func (im IBCModule) OnChanCloseConfirm(
|
|
303
|
-
ctx sdk.Context,
|
|
304
|
-
portID,
|
|
305
|
-
channelID string,
|
|
306
|
-
) error {
|
|
307
|
-
event := channelCloseConfirmEvent{
|
|
308
|
-
PortID: portID,
|
|
309
|
-
ChannelID: channelID,
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
err := im.PushAction(ctx, event)
|
|
313
|
-
return err
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
type receivePacketEvent struct {
|
|
317
|
-
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
318
|
-
Event string `json:"event" default:"receivePacket"`
|
|
319
|
-
Packet channeltypes.Packet `json:"packet"`
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
func (im IBCModule) OnRecvPacket(
|
|
323
|
-
ctx sdk.Context,
|
|
324
|
-
packet channeltypes.Packet,
|
|
325
|
-
relayer sdk.AccAddress,
|
|
326
|
-
) exported.Acknowledgement {
|
|
327
|
-
// Sometimes we receive duplicate packets, just with a
|
|
328
|
-
// missing packet.TimeoutTimestamp. This causes duplicate
|
|
329
|
-
// acks, with one of them being rejected.
|
|
330
|
-
//
|
|
331
|
-
// This turns out to happen when you run both "rly start"
|
|
332
|
-
// and also "rly tx xfer"-- they both are trying to relay
|
|
333
|
-
// the same packets.
|
|
334
|
-
|
|
335
|
-
event := receivePacketEvent{
|
|
336
|
-
Packet: packet,
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
err := im.PushAction(ctx, event)
|
|
340
|
-
if err != nil {
|
|
341
|
-
return channeltypes.NewErrorAcknowledgement(err)
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
return nil
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
type acknowledgementPacketEvent struct {
|
|
348
|
-
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
349
|
-
Event string `json:"event" default:"acknowledgementPacket"`
|
|
350
|
-
Packet channeltypes.Packet `json:"packet"`
|
|
351
|
-
Acknowledgement []byte `json:"acknowledgement"`
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
func (im IBCModule) OnAcknowledgementPacket(
|
|
355
|
-
ctx sdk.Context,
|
|
356
|
-
packet channeltypes.Packet,
|
|
357
|
-
acknowledgement []byte,
|
|
358
|
-
relayer sdk.AccAddress,
|
|
359
|
-
) error {
|
|
360
|
-
event := acknowledgementPacketEvent{
|
|
361
|
-
Packet: packet,
|
|
362
|
-
Acknowledgement: acknowledgement,
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
err := im.PushAction(ctx, event)
|
|
366
|
-
if err != nil {
|
|
367
|
-
return err
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
return nil
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
type timeoutPacketEvent struct {
|
|
374
|
-
vm.ActionHeader `actionType:"IBC_EVENT"`
|
|
375
|
-
Event string `json:"event" default:"timeoutPacket"`
|
|
376
|
-
Packet channeltypes.Packet `json:"packet"`
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
func (im IBCModule) OnTimeoutPacket(
|
|
380
|
-
ctx sdk.Context,
|
|
381
|
-
packet channeltypes.Packet,
|
|
382
|
-
relayer sdk.AccAddress,
|
|
383
|
-
) error {
|
|
384
|
-
event := timeoutPacketEvent{
|
|
385
|
-
Packet: packet,
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
err := im.PushAction(ctx, event)
|
|
389
|
-
if err != nil {
|
|
390
|
-
return err
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
return nil
|
|
394
|
-
}
|
|
File without changes
|