-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: begin removal of internal "spec" directories #634
Changes from 4 commits
7b599cb
b31085d
e58aa86
fbbe26c
b0e5086
c7853f1
8088d46
1e9fb81
f1a93b5
d30a68a
b4a7e19
47df889
d5cd662
e379c23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,10 +37,19 @@ Read on for a detailed explanation of how to write a self-contained IBC applicat | |
|
||
### [Clients](https://github.com/cosmos/ibc-go/blob/main/modules/core/02-client) | ||
|
||
IBC clients are light clients that are identified by a unique client-id. IBC clients track the consensus states of | ||
other blockchains, along with the proof spec necessary to properly verify proofs against the | ||
client's consensus state. A client can be associated with any number of connections to the counterparty | ||
chain. | ||
IBC clients are on-chain light clients. Each light client is identified by a unique client-id. | ||
IBC clients track the consensus states of other blockchains, along with the proof spec necessary to | ||
properly verify proofs against the client's consensus state. A client can be associated with any number | ||
of connections to the counterparty chain. The client identifier is auto generated using the client type | ||
and the global client counter appended in the format: `{client-type}-{N}`. | ||
|
||
A `ClientState` should contain chain specific and light client specific information necessary for verifying updates | ||
and upgrades to the IBC client. The `ClientState` may contain information such as chain-id, latest height, proof specs, | ||
unbonding periods or the status of the light client. The `ClientState` should not contain information that | ||
is specific to a given block at a certain height, this is the function of the `CosnensusState`. Each `ConsensusState` | ||
should be associated with a unique block and should be referenced using a height. IBC clients are given a | ||
client identifier prefixed store to store their associated client state and consensus states along with | ||
any metadata associated with the consensus states. Consensus states are stored using their associated height. | ||
|
||
The supported IBC clients are: | ||
|
||
|
@@ -49,6 +58,60 @@ The supported IBC clients are: | |
* [Localhost (loopback) client](https://github.com/cosmos/ibc-go/blob/main/modules/light-clients/09-localhost): Useful for | ||
testing, simulation, and relaying packets to modules on the same application. | ||
|
||
### IBC Client Heights | ||
|
||
IBC Client Heights are represented by the struct: | ||
|
||
```go | ||
type Height struct { | ||
RevisionNumber uint64 | ||
RevisionHeight uint64 | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
``` | ||
|
||
The `RevisionNumber` represents the revision of the chain that the height is representing. | ||
An revision typically represents a continuous, monotonically increasing range of block-heights. | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
The `RevisionHeight` represents the height of the chain within the given revision. | ||
|
||
On any reset of the `RevisionHeight`, for example, when hard-forking a Tendermint chain, | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
the `RevisionNumber` will get incremented. This allows IBC clients to distinguish between a | ||
block-height `n` of a previous revision of the chain (at revision `p`) and block-height `n` of the current | ||
revision of the chain (at revision `e`). | ||
|
||
`Heights` that share the same revision number can be compared by simply comparing their respective `RevisionHeights`. | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Heights that do not share the same revision number will only be compared using their respective `RevisionNumbers`. | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Thus a height `h` with revision number `e+1` will always be greater than a height `g` with revision number `e`, | ||
**REGARDLESS** of the difference in revision heights. | ||
|
||
Ex: | ||
|
||
```go | ||
Height{RevisionNumber: 3, RevisionHeight: 0} > Height{RevisionNumber: 2, RevisionHeight: 100000000000} | ||
``` | ||
|
||
When a Tendermint chain is running a particular revision, relayers can simply submit headers and proofs with the revision number | ||
given by the chain's chainID, and the revision height given by the Tendermint block height. When a chain updates using a hard-fork | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
and resets its block-height, it is responsible for updating its chain-id to increment the revision number. | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
IBC Tendermint clients then verifies the revision number against their `ChainId` and treat the `RevisionHeight` as the Tendermint block-height. | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Tendermint chains wishing to use revisions to maintain persistent IBC connections even across height-resetting upgrades must format their chain-ids | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
in the following manner: `{chainID}-{revision_number}`. On any height-resetting upgrade, the chainID **MUST** be updated with a higher revision number | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
than the previous value. | ||
|
||
Ex: | ||
|
||
- Before upgrade ChainID: `gaiamainnet-3` | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- After upgrade ChainID: `gaiamainnet-4` | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Clients that do not require revisions, such as the solo-machine client, simply hardcode `0` into the revision number whenever they | ||
need to return an IBC height when implementing IBC interfaces and use the `RevisionHeight` exclusively. | ||
|
||
Other client-types may implement their own logic to verify the IBC Heights that relayers provide in their `Update`, `Misbehavior`, and | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
`Verify` functions respectively. | ||
|
||
The IBC interfaces expect an `ibcexported.Height` interface, however all clients should use the concrete implementation provided in | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
`02-client/types` and reproduced above. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does it mean There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the concrete |
||
|
||
### [Connections](https://github.com/cosmos/ibc-go/blob/main/modules/core/03-connection) | ||
|
||
Connections encapsulate two `ConnectionEnd` objects on two separate blockchains. Each | ||
|
@@ -67,6 +130,8 @@ of a handshake or a packet intended to be relayed to a module on the counterpart | |
process monitors for updates to these paths and relays messages by submitting the data stored | ||
under the path and a proof to the counterparty chain. | ||
|
||
Proofs are passed from core IBC to light-clients as bytes. It is up to light client implementation to interpret these bytes appropriately. | ||
|
||
- The paths that all IBC implementations must use for committing IBC messages is defined in | ||
[ICS-24 Host State Machine Requirements](https://github.com/cosmos/ics/tree/master/spec/core/ics-024-host-requirements). | ||
- The proof format that all implementations must be able to produce and verify is defined in [ICS-23 Proofs](https://github.com/confio/ics23) implementation. | ||
|
@@ -138,11 +203,27 @@ If all handshake steps are successful, the channel is opened on both sides. At e | |
associated with the `ChannelEnd` executes its callback. So | ||
on `ChanOpenInit`, the module on chain A executes its callback `OnChanOpenInit`. | ||
|
||
The channel identifier is auto derived in the format: `channel-{N}` where N is the next sequence to be used. | ||
|
||
Just as ports came with dynamic capabilities, channel initialization returns a dynamic capability | ||
that the module **must** claim so that they can pass in a capability to authenticate channel actions | ||
like sending packets. The channel capability is passed into the callback on the first parts of the | ||
handshake; either `OnChanOpenInit` on the initializing chain or `OnChanOpenTry` on the other chain. | ||
|
||
#### Closing Channels | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Closing a channel occurs in occurs in 2 handshake steps as defined in [ICS 04](https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics). | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
`ChanCloseInit` will close a channel on the executing chain if the channel exists, it is not | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
already closed and the connection it exists upon is OPEN. Channels can only be closed by a | ||
calling module or in the case of a packet timeout on an ORDERED channel. | ||
|
||
`ChanCloseConfirm` is a response to a counterparty channel executing `ChanCloseInit`. The channel | ||
on the executing chain will be closed if the channel exists, the channel is not already closed, | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
the connection the channel exists upon is OPEN and the executing chain successfully verifies | ||
that the counterparty channel has been closed. | ||
|
||
|
||
### [Packets](https://github.com/cosmos/ibc-go/blob/main/modules/core/04-channel) | ||
|
||
Modules communicate with each other by sending packets over IBC channels. All | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!-- | ||
order: 4 | ||
order: 6 | ||
--> | ||
|
||
# Relayer | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
24-host is an implementation of ICS24. | ||
|
||
The storage path supported are defined in [ICS24](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements#path-space). | ||
|
||
Hostname validation is implemented as defined in [ICS 24](https://github.com/cosmos/ibc/tree/master/spec/core/ics-024-host-requirements). | ||
|
||
*/ | ||
package host |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the advice from the Google style guide I think in the two paragraphs above we can replace
should
withmust
andmay
withcan
. For example, where it says "EachConsensusState
should be associated with a unique block" there is no optionality, right? The `ConsensusState cannot not be associated with a unique block; it has to always be associated with a unique block, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we open an issue to do this for all docs in ibc-go? I'm sure there are many places this could be updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, makes sense. We could open a generic issue to make sure documentation follows the Google style guide.