@@ -36,24 +36,24 @@ The in-line comments describe the execution flow of packets between the applicat
36
36
``` go
37
37
// Create Transfer Stack
38
38
// SendPacket, since it is originating from the application to core IBC:
39
- // transferKeeper.SendPacket -> callbacks.SendPacket -> fee .SendPacket -> channel.SendPacket
39
+ // transferKeeper.SendPacket -> callbacks.SendPacket -> feeKeeper .SendPacket -> channel.SendPacket
40
40
41
41
// RecvPacket, message that originates from core IBC and goes down to app, the flow is the other way
42
- // channel.RecvPacket -> callbacks .OnRecvPacket -> fee .OnRecvPacket -> transfer.OnRecvPacket
42
+ // channel.RecvPacket -> fee .OnRecvPacket -> callbacks .OnRecvPacket -> transfer.OnRecvPacket
43
43
44
44
// transfer stack contains (from top to bottom):
45
- // - IBC Callbacks Middleware
46
45
// - IBC Fee Middleware
46
+ // - IBC Callbacks Middleware
47
47
// - Transfer
48
48
49
49
// create IBC module from bottom to top of stack
50
50
var transferStack porttypes.IBCModule
51
51
transferStack = transfer.NewIBCModule (app.TransferKeeper )
52
- transferStack = ibcfee.NewIBCMiddleware (transferStack, app.IBCFeeKeeper )
53
- // maxCallbackGas is a hard-coded value that is passed to the callbacks middleware
54
52
transferStack = ibccallbacks.NewIBCMiddleware (transferStack, app.IBCFeeKeeper , app.MockContractKeeper , maxCallbackGas)
53
+ transferICS4Wrapper := transferStack.(porttypes.ICS4Wrapper )
54
+ transferStack = ibcfee.NewIBCMiddleware (transferStack, app.IBCFeeKeeper )
55
55
// Since the callbacks middleware itself is an ics4wrapper, it needs to be passed to the transfer keeper
56
- app.TransferKeeper .WithICS4Wrapper (transferStack.(porttypes. ICS4Wrapper ) )
56
+ app.TransferKeeper .WithICS4Wrapper (transferICS4Wrapper )
57
57
58
58
// Add transfer stack to IBC Router
59
59
ibcRouter.AddRoute (ibctransfertypes.ModuleName , transferStack)
@@ -70,16 +70,19 @@ The usage of `WithICS4Wrapper` after `transferStack`'s configuration is critical
70
70
// SendPacket, since it is originating from the application to core IBC:
71
71
// icaControllerKeeper.SendTx -> callbacks.SendPacket -> fee.SendPacket -> channel.SendPacket
72
72
73
+ // initialize ICA module with mock module as the authentication module on the controller side
73
74
var icaControllerStack porttypes.IBCModule
74
- icaControllerStack = icacontroller. NewIBCMiddleware ( nil , app. ICAControllerKeeper )
75
- icaControllerStack = ibcfee. NewIBCMiddleware (icaControllerStack, app. IBCFeeKeeper )
76
- // maxCallbackGas is a hard-coded value that is passed to the callbacks middleware
75
+ icaControllerStack = ibcmock. NewIBCModule (&mockModule, ibcmock. NewIBCApp ( " " , scopedICAMockKeeper) )
76
+ app. ICAAuthModule = icaControllerStack.(ibcmock. IBCModule )
77
+ icaControllerStack = icacontroller. NewIBCMiddleware (icaControllerStack, app. ICAControllerKeeper )
77
78
icaControllerStack = ibccallbacks.NewIBCMiddleware (icaControllerStack, app.IBCFeeKeeper , app.MockContractKeeper , maxCallbackGas)
79
+ icaICS4Wrapper := icaControllerStack.(porttypes.ICS4Wrapper )
80
+ icaControllerStack = ibcfee.NewIBCMiddleware (icaControllerStack, app.IBCFeeKeeper )
78
81
// Since the callbacks middleware itself is an ics4wrapper, it needs to be passed to the ica controller keeper
79
- app.ICAControllerKeeper .WithICS4Wrapper (icaControllerStack.(porttypes. ICS4Wrapper ) )
82
+ app.ICAControllerKeeper .WithICS4Wrapper (icaICS4Wrapper )
80
83
81
84
// RecvPacket, message that originates from core IBC and goes down to app, the flow is:
82
- // channel.RecvPacket -> callbacks.OnRecvPacket -> fee.OnRecvPacket -> icaHost.OnRecvPacket
85
+ // channel.RecvPacket -> fee.OnRecvPacket -> icaHost.OnRecvPacket
83
86
84
87
var icaHostStack porttypes.IBCModule
85
88
icaHostStack = icahost.NewIBCModule (app.ICAHostKeeper )
0 commit comments