Skip to content

Commit

Permalink
Update outdated documentation (#252)
Browse files Browse the repository at this point in the history
* fix #85

* fix #77
  • Loading branch information
colin-axner authored Jul 14, 2021
1 parent cccee90 commit fa404e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 36 deletions.
40 changes: 6 additions & 34 deletions docs/ibc/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ Integrating the IBC module to your SDK-based application is straighforward. The
- Add required modules to the `module.BasicManager`
- Define additional `Keeper` fields for the new modules on the `App` type
- Add the module's `StoreKeys` and initialize their `Keepers`
- Set up corresponding routers and routes for the `ibc` and `evidence` modules
- Set up corresponding routers and routes for the `ibc` module
- Add the modules to the module `Manager`
- Add modules to `Begin/EndBlockers` and `InitGenesis`
- Update the module `SimulationManager` to enable simulations

### Module `BasicManager` and `ModuleAccount` permissions

The first step is to add the following modules to the `BasicManager`: `x/capability`, `x/ibc`,
`x/evidence` and `x/ibc-transfer`. After that, we need to grant `Minter` and `Burner` permissions to
The first step is to add the following modules to the `BasicManager`: `x/capability`, `x/ibc`,
and `x/ibc-transfer`. After that, we need to grant `Minter` and `Burner` permissions to
the `ibc-transfer` `ModuleAccount` to mint and burn relayed tokens.

```go
Expand All @@ -36,7 +36,6 @@ var (
// ...
capability.AppModuleBasic{},
ibc.AppModuleBasic{},
evidence.AppModuleBasic{},
transfer.AppModuleBasic{}, // i.e ibc-transfer module
)

Expand All @@ -60,7 +59,6 @@ type App struct {
// other keepers
// ...
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
EvidenceKeeper evidencekeeper.Keeper // required to set up the client misbehaviour route
TransferKeeper ibctransferkeeper.Keeper // for cross-chain fungible token transfers

// make scoped keepers public for test purposes
Expand Down Expand Up @@ -105,11 +103,6 @@ func NewApp(...args) *App {
)
transferModule := transfer.NewAppModule(app.TransferKeeper)

// Create evidence Keeper for to register the IBC light client misbehaviour evidence route
evidenceKeeper := evidencekeeper.NewKeeper(
appCodec, keys[evidencetypes.StoreKey], &app.StakingKeeper, app.SlashingKeeper,
)

// .. continues
}
```
Expand All @@ -126,12 +119,6 @@ IBC module.
Adding the module routes allows the IBC handler to call the appropriate callback when processing a
channel handshake or a packet.
The second `Router` that is required is the evidence module router. This router handles genenal
evidence submission and routes the business logic to each registered evidence handler. In the case
of IBC, it is required to submit evidence for [light client
misbehaviour](https://github.com/cosmos/ics/tree/master/spec/ics-002-client-semantics#misbehaviour)
in order to freeze a client and prevent further data packets from being sent/received.
Currently, a `Router` is static so it must be initialized and set correctly on app initialization.
Once the `Router` has been set, no new routes can be added.
Expand All @@ -147,19 +134,6 @@ func NewApp(...args) *App {
// No more routes can be added
app.IBCKeeper.SetRouter(ibcRouter)

// create static Evidence routers

evidenceRouter := evidencetypes.NewRouter().
// add IBC ClientMisbehaviour evidence handler
AddRoute(ibcclient.RouterKey, ibcclient.HandlerClientMisbehaviour(app.IBCKeeper.ClientKeeper))

// Setting Router will finalize all routes by sealing router
// No more routes can be added
evidenceKeeper.SetRouter(evidenceRouter)

// set the evidence keeper from the section above
app.EvidenceKeeper = *evidenceKeeper

// .. continues
```
Expand All @@ -176,7 +150,6 @@ func NewApp(...args) *App {
// other modules
// ...
capability.NewAppModule(appCodec, *app.CapabilityKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
ibc.NewAppModule(app.IBCKeeper),
transferModule,
)
Expand All @@ -187,7 +160,6 @@ func NewApp(...args) *App {
// other modules
// ...
capability.NewAppModule(appCodec, *app.CapabilityKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
ibc.NewAppModule(app.IBCKeeper),
transferModule,
)
Expand Down Expand Up @@ -219,10 +191,10 @@ localhost (_aka_ loopback) client.
func NewApp(...args) *App {
// .. continuation from above

// add evidence, staking and ibc modules to BeginBlockers
// add staking and ibc modules to BeginBlockers
app.mm.SetOrderBeginBlockers(
// other modules ...
evidencetypes.ModuleName, stakingtypes.ModuleName, ibchost.ModuleName,
stakingtypes.ModuleName, ibchost.ModuleName,
)

// ...
Expand All @@ -233,7 +205,7 @@ func NewApp(...args) *App {
app.mm.SetOrderInitGenesis(
capabilitytypes.ModuleName,
// other modules ...
ibchost.ModuleName, evidencetypes.ModuleName, ibctransfertypes.ModuleName,
ibchost.ModuleName, ibctransfertypes.ModuleName,
)

// .. continues
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/transfer/spec/01_concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ acting as the "source zone". When the token is sent back to the chain it previou
prefix is removed. This is a backwards movement in the token's timeline and the sender chain is
acting as the "sink zone".

It is strongly recommended to read the full details of [ADR 001: Coin Source Tracing](./../../../../../docs/architecture/adr-001-coin-source-tracing.md) to understand the implications and context of the IBC token representations.
It is strongly recommended to read the full details of [ADR 001: Coin Source Tracing](https://github.com/cosmos/ibc-go/blob/main/docs/architecture/adr-001-coin-source-tracing.md) to understand the implications and context of the IBC token representations.

### UX suggestions for clients

Expand Down Expand Up @@ -96,7 +96,7 @@ The only viable alternative for clients (at the time of writing) to tokens with

## Locked Funds

In some [exceptional cases](./../../../../../docs/architecture/adr-026-ibc-client-recovery-mechanisms.md#exceptional-cases), a client state associated with a given channel cannot be updated. This causes that funds from fungible tokens in that channel will be permanently locked and thus can no longer be transferred.
In some [exceptional cases](https://github.com/cosmos/ibc-go/blob/main/docs/architecture/adr-026-ibc-client-recovery-mechanisms.md#exceptional-cases), a client state associated with a given channel cannot be updated. This causes that funds from fungible tokens in that channel will be permanently locked and thus can no longer be transferred.

To mitigate this, a client update governance proposal can be submitted to update the frozen client
with a new valid header. Once the proposal passes the client state will be unfrozen and the funds
Expand Down

0 comments on commit fa404e5

Please sign in to comment.