Skip to content

Commit

Permalink
docs(simapp): fixed inline middleware wiring comments (#4361)
Browse files Browse the repository at this point in the history
* docs(callbacks/simapp): fixed inline stack documentation

* docs(testing/simapp): fixed inline stack documentation

* docs(testing/simapp): fixed icacontroller inline stack documentation

* docs(simapp): improved icaController stack's documentation

* docs(callbacks/simapp): review fixes
  • Loading branch information
srdtrk committed Aug 17, 2023
1 parent 9b7d01e commit 0dbd3f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
13 changes: 6 additions & 7 deletions modules/apps/callbacks/testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ func NewSimApp(

// Create Transfer Stack
// SendPacket, since it is originating from the application to core IBC:
// transferKeeper.SendPacket -> fee.SendPacket -> callbacks.SendPacket -> channel.SendPacket
// transferKeeper.SendPacket -> callbacks.SendPacket -> feeKeeper.SendPacket -> channel.SendPacket

// RecvPacket, message that originates from core IBC and goes down to app, the flow is the other way
// channel.RecvPacket -> callbacks.OnRecvPacket -> fee.OnRecvPacket -> transfer.OnRecvPacket
Expand All @@ -545,7 +545,7 @@ func NewSimApp(

// Create Interchain Accounts Stack
// SendPacket, since it is originating from the application to core IBC:
// icaAuthModuleKeeper.SendTx -> icaController.SendPacket -> fee.SendPacket -> callbacks.SendPacket -> channel.SendPacket
// icaControllerKeeper.SendTx -> callbacks.SendPacket -> fee.SendPacket -> channel.SendPacket

// initialize ICA module with mock module as the authentication module on the controller side
var icaControllerStack porttypes.IBCModule
Expand All @@ -558,7 +558,7 @@ func NewSimApp(
app.ICAControllerKeeper.WithICS4Wrapper(icaControllerStack.(porttypes.Middleware))

// RecvPacket, message that originates from core IBC and goes down to app, the flow is:
// channel.RecvPacket -> callbacks.OnRecvPacket -> fee.OnRecvPacket -> icaHost.OnRecvPacket
// channel.RecvPacket -> fee.OnRecvPacket -> icaHost.OnRecvPacket

var icaHostStack porttypes.IBCModule
icaHostStack = icahost.NewIBCModule(app.ICAHostKeeper)
Expand All @@ -574,14 +574,13 @@ func NewSimApp(
AddRoute(ibcmock.ModuleName+icacontrollertypes.SubModuleName, icaControllerStack) // ica with mock auth module stack route to ica (top level of middleware stack)

// Create Mock IBC Fee module stack for testing
// SendPacket, since it is originating from the application to core IBC:
// mockModule.SendPacket -> fee.SendPacket -> channel.SendPacket
// SendPacket, mock module cannot send packets

// OnRecvPacket, message that originates from core IBC and goes down to app, the flow is the otherway
// channel.RecvPacket -> fee.OnRecvPacket -> mockModule.OnRecvPacket
// channel.RecvPacket -> callbacks.OnRecvPacket -> fee.OnRecvPacket -> mockModule.OnRecvPacket

// OnAcknowledgementPacket as this is where fee's are paid out
// mockModule.OnAcknowledgementPacket -> fee.OnAcknowledgementPacket -> channel.OnAcknowledgementPacket
// mockModule.OnAcknowledgementPacket -> callbacks.OnAcknowledgementPacket -> fee.OnAcknowledgementPacket -> channel.OnAcknowledgementPacket

// create fee wrapped mock module
feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort, scopedFeeMockKeeper))
Expand Down
5 changes: 2 additions & 3 deletions testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ func NewSimApp(

// Create Interchain Accounts Stack
// SendPacket, since it is originating from the application to core IBC:
// icaAuthModuleKeeper.SendTx -> icaController.SendPacket -> fee.SendPacket -> channel.SendPacket
// icaControllerKeeper.SendTx -> fee.SendPacket -> channel.SendPacket

// initialize ICA module with mock module as the authentication module on the controller side
var icaControllerStack porttypes.IBCModule
Expand All @@ -560,8 +560,7 @@ func NewSimApp(
AddRoute(ibcmock.ModuleName+icacontrollertypes.SubModuleName, icaControllerStack) // ica with mock auth module stack route to ica (top level of middleware stack)

// Create Mock IBC Fee module stack for testing
// SendPacket, since it is originating from the application to core IBC:
// mockModule.SendPacket -> fee.SendPacket -> channel.SendPacket
// SendPacket, mock module cannot send packets

// OnRecvPacket, message that originates from core IBC and goes down to app, the flow is the otherway
// channel.RecvPacket -> fee.OnRecvPacket -> mockModule.OnRecvPacket
Expand Down

0 comments on commit 0dbd3f8

Please sign in to comment.