You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// OnAcknowledgementPacket will be called on the IBC Actor
57
59
// after the IBC Application handles its own OnAcknowledgementPacket callback
58
60
OnAcknowledgmentPacket(
59
61
ctx sdk.Context,
60
62
packet channeltypes.Packet,
61
63
ack exported.Acknowledgement,
62
-
relayer string
64
+
relayer sdk.AccAddress,
63
65
) error
64
66
65
67
// OnTimeoutPacket will be called on the IBC Actor
66
68
// after the IBC Application handles its own OnTimeoutPacket callback
67
69
OnTimeoutPacket(
68
70
ctx sdk.Context,
69
71
packet channeltypes.Packet,
70
-
relayer string
72
+
relayer sdk.AccAddress,
71
73
) error
72
74
}
73
75
```
74
76
75
-
The CallbackPacketData interface will get created to add `GetSrcCallbackAddress` and `GetDestCallbackAddress` methods. These may return an address
76
-
or they may return the empty string. The address may reference an IBCActor or it may be a regular user address. If the address is not an IBCActor, the actor callback must continue processing (no-op). Any IBC application or middleware that uses these methods must handle these cases. In most cases, the `GetSrcCallbackAddress` will be the sender address and the `GetDestCallbackAddress` will be the receiver address. However, these are named generically so that implementors may choose a different contract address for the callback if they choose.
77
+
The `CallbackPacketData` interface will get created to add `GetSourceCallbackAddress` and `GetDestCallbackAddress` methods. These may return an address
78
+
or they may return the empty string. The address may reference an PacketActor or it may be a regular user address. If the address is not a PacketActor, the actor callback must continue processing (no-op). Any IBC application or middleware that uses these methods must handle these cases. In most cases, the `GetSourceCallbackAddress` will be the sender address and the `GetDestCallbackAddress` will be the receiver address. However, these are named generically so that implementors may choose a different contract address for the callback if they choose.
79
+
80
+
The interface also defines a `UserDefinedGasLimit` method. Any middleware targeting this interface for callback handling should cap the gas that a callback is allowed to take (especially on AcknowledgePacket and TimeoutPacket) so that a custom callback does not prevent the packet lifecycle from completing. However, since this is a global cap it is likely to be very large. Thus, users may specify a smaller limit to cap the amount of fees a relayer must pay in order to complete the packet lifecycle on the user's behalf.
77
81
78
-
The interface also defines a `UserDefinedGasLimit` method. Any middleware targetting this interface for callback handling should cap the gas that a callback is allowed to take (especially on AcknowledgePacket and TimeoutPacket) so that a custom callback does not prevent the packet lifecycle from completing. However, since this is a global cap it is likely to be very large. Thus, users may specify a smaller limit to cap the amount of fees a relayer must pay in order to complete the packet lifecycle on the user's behalf.
82
+
IBC applications which provide the base packet data type must implement the `CallbackPacketData` interface to allow `PacketActor` callbacks.
79
83
80
84
```go
81
-
// Implemented by any packet data type that wants to support
82
-
// PacketActor callbacks
85
+
// Implemented by any packet data type that wants to support PacketActor callbacks
86
+
// PacketActor's will be unable to act on any packet data type that does not implement
87
+
// this interface.
83
88
typeCallbackPacketDatainterface {
84
-
// may return the empty string
85
-
GetSrcCallbackAddress() string
86
-
87
-
// may return the empty string
89
+
// GetSourceCallbackAddress should return the callback address of a packet data on the source chain.
90
+
// This may or may not be the sender of the packet. If no source callback address exists for the packet,
91
+
// an empty string may be returned.
92
+
GetSourceCallbackAddress() string
93
+
94
+
// GetDestCallbackAddress should return the callback address of a packet data on the destination chain.
95
+
// This may or may not be the receiver of the packet. If no dest callback address exists for the packet,
96
+
// an empty string may be returned.
88
97
GetDestCallbackAddress() string
89
98
90
99
// UserDefinedGasLimit allows the sender of the packet to define inside the packet data
@@ -103,7 +112,8 @@ IBC Apps or middleware can then call the IBCActor callbacks like so in their own
103
112
104
113
### Handshake Callbacks
105
114
106
-
The handshake init callbacks (`OnChanOpenInit` and `OnChanCloseInit`) will need to include an additional field so that the initiating actor can be tracked and called upon during handshake completion.
115
+
The `OnChanOpenInit` handshake callback will need to include an additional field so that the initiating actor can be tracked and called upon during handshake completion.
116
+
The actor provided in the `OnChanOpenInit` callback will be the signer of the `MsgChanOpenInit` message.
NOTE: The handshake calls `OnChanOpenTry` and `OnChanOpenConfirm` are explicitly left out as it is still to be determined how the actor of the `OnChanOpenTry` step should be provided. Initially only the initiating side of the channel handshake may support setting a channel actor, future improvements should allow both sides of the channel handshake to set channel actors.
192
+
197
193
### PacketCallbacks
198
194
199
195
No packet callback API will need to change.
200
196
201
197
```go
202
198
// Call the IBCActor recvPacket callback after processing the packet
203
-
// if the recvPacket callback exists and returns an error
204
-
// then return an error ack to revert all packet data processing
199
+
// if the recvPacket callback exists. If the callback returns an error
200
+
// then return an error ack to revert all packet data processing.
205
201
funcOnRecvPacket(
206
202
ctx sdk.Context,
207
203
packet channeltypes.Packet,
@@ -210,10 +206,16 @@ func OnRecvPacket(
210
206
// run any necesssary logic first
211
207
// IBCActor logic will postprocess
212
208
209
+
// postprocessing should only if the underlying application
@@ -367,10 +409,13 @@ Chains are expected to specify a `chainDefinedActorCallbackLimit` to ensure that
367
409
### Negative
368
410
369
411
- Callbacks may now have unbounded gas consumption since the actor may execute arbitrary logic. Chains implementing this feature should take care to place limitations on how much gas an actor callback can consume.
370
-
- Application packets that want to support ADR-8 must additionally have their packet data implement the `CallbackPacketData` interface and register their implementation on the chain codec
371
412
372
413
### Neutral
373
414
415
+
- Application packets that want to support ADR-8 must additionally have their packet data implement the `CallbackPacketData` interface and register their implementation on the chain codec
0 commit comments