Skip to content
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

IBC Upgrade docs #8298

Merged
merged 12 commits into from
Jan 20, 2021
Merged

IBC Upgrade docs #8298

merged 12 commits into from
Jan 20, 2021

Conversation

AdityaSripal
Copy link
Member

@AdityaSripal AdityaSripal commented Jan 11, 2021

Description

Add docs for IBC Upgrades. Includes docs for users who want to upgrade their chain and counterparty clients, as well as a guide for developers who want to create IBC clients with upgrade functionality.

closes: #7877


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes


Note: Since upgrades are only implemented for Tendermint clients, this doc only discusses upgrades on Tendermint chains that would break counterparty IBC Tendermint Clients.

1. Changing the Chain-ID: **Supported**
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future improvements may turn this list to a flowchart

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just left comments for clarification

docs/ibc/upgrades/developer-guide.md Outdated Show resolved Hide resolved
docs/ibc/upgrades/developer-guide.md Outdated Show resolved Hide resolved
docs/ibc/upgrades/developer-guide.md Outdated Show resolved Hide resolved
docs/ibc/upgrades/developer-guide.md Outdated Show resolved Hide resolved
docs/ibc/upgrades/quick-guide.md Outdated Show resolved Hide resolved
4. Changing the ProofSpecs: **Supported**, this should be changed if the proof structure needed to verify IBC proofs is changed across the upgrade. Ex: Switching from an IAVL store, to a SimpleTree Store
5. Changing the UpgradePath: **Supported**, this might involve changing the key under which upgraded clients and consensus states are stored in the upgrade store, or even migrating the upgrade store itself.
6. Migrating the IBC store: **Unsupported**, as the IBC store location is negotiated by the connection.
7. Upgrading to a IBC path-breaking version of IBC: **Unsupported**, as IBC version is negotiated on connection handshake.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it supported so long as the old versions use the old path? Adding support for a new version with new path should be supported

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider chainA and chainB are connected by an IBC channel. chainA decides to upgrade to a different version of IBC such that the paths in 24-host have changed. The client on chainB needs to upgrade its Verification methods to use the new paths.

This is theoretically possible by using the upgraded client state and then "converting" it into a new type that implements the different Verification method.

However, the IBC version that is used is negotiated in the connection. So that field needs to change as well which isn't supported with client upgrades.

Upgrading and breaking IBC paths is theoretically possible, it just isn't implemented yet and client upgrades alone will not upgrade the connection.

Technically the new IBC version could also store information in the old paths as well, and thus create "backwards-compatibility" for old connections, but this wouldn't be path breaking.

cc: @cwgoes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to avoid duplicating storage, though it is possible. Generally upgrading the version of IBC is a completely separate concern from upgrading a particular light client algorithm, and it should be treated as such - for example, the IBC version needs to be agreed on by both ends, while the light client versions are independent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(sorry, I may have misunderstood the original comment - the light client upgrades should support changing paths used by the light client algorithm, but not IBC protocol paths in general, I think)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could add this for clarity. It may not be immediately clear what a IBC path-breaking version of IBC is. But it's really just a non-backwards compatible version of IBC (IBC 2.0) ie we cannot upgrade IBC connection or channel versions with this upgrade mechanism

docs/ibc/upgrades/quick-guide.md Outdated Show resolved Hide resolved
docs/ibc/upgrades/quick-guide.md Show resolved Hide resolved
@@ -0,0 +1,40 @@
# IBC Client Developer Guide to Upgrades
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# IBC Client Developer Guide to Upgrades
# IBC Client Upgrade Guide

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This document is specifically for developers who are trying to implement an IBC client. It is not relevant for end users. Is there a better title you had in mind that makes it clear this is for developers?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it's just that client developer sounds like wallets, exchanges, etc. Maybe light client devs?

docs/ibc/upgrades/developer-guide.md Show resolved Hide resolved
) (upgradedClient ClientState, upgradedConsensus ConsensusState, err error)
```

Note that the clients should have prior knowledge of the merkle path that the upgraded client and upgraded consensus states will use. The height at which the upgrade has occurred should also be encoded in the proof. In the Tendermint client implementation, the upgrade height is encoded in the proof key.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the clients should have prior knowledge of the merkle path that the upgraded client and upgraded consensus states will use

where do clients know this info? I'd be nice to add that

@@ -0,0 +1,8 @@
### Upgrading IBC Chains Overview
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@@ -0,0 +1,44 @@
# How to Upgrade IBC Chains and their Clients
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the difference with the first doc from this title

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doc is intended for the end users of the upgrade process. Relayers and stake holders of the upgrading chain.

## Upgrading Chains


### IBC Client Breaking Upgrades
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should outline the types of upgrades that clients could encounter (planned, unplanned) and with breaking an non-breaking state machine changes. This doc should also document the recommended steps for each of the 4 combinations

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup good point. Currently unplanned upgrades are not supported. All of the cases given only apply if they are planned.

Will write this point in.

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
docs/ibc/upgrades/developer-guide.md Outdated Show resolved Hide resolved
docs/ibc/upgrades/quick-guide.md Show resolved Hide resolved
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

4. Changing the ProofSpecs: **Supported**, this should be changed if the proof structure needed to verify IBC proofs is changed across the upgrade. Ex: Switching from an IAVL store, to a SimpleTree Store
5. Changing the UpgradePath: **Supported**, this might involve changing the key under which upgraded clients and consensus states are stored in the upgrade store, or even migrating the upgrade store itself.
6. Migrating the IBC store: **Unsupported**, as the IBC store location is negotiated by the connection.
7. Upgrading to a IBC path-breaking version of IBC: **Unsupported**, as IBC version is negotiated on connection handshake.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to avoid duplicating storage, though it is possible. Generally upgrading the version of IBC is a completely separate concern from upgrading a particular light client algorithm, and it should be treated as such - for example, the IBC version needs to be agreed on by both ends, while the light client versions are independent.

4. Changing the ProofSpecs: **Supported**, this should be changed if the proof structure needed to verify IBC proofs is changed across the upgrade. Ex: Switching from an IAVL store, to a SimpleTree Store
5. Changing the UpgradePath: **Supported**, this might involve changing the key under which upgraded clients and consensus states are stored in the upgrade store, or even migrating the upgrade store itself.
6. Migrating the IBC store: **Unsupported**, as the IBC store location is negotiated by the connection.
7. Upgrading to a IBC path-breaking version of IBC: **Unsupported**, as IBC version is negotiated on connection handshake.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(sorry, I may have misunderstood the original comment - the light client upgrades should support changing paths used by the light client algorithm, but not IBC protocol paths in general, I think)

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK but see comment

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AdityaSripal AdityaSripal added the A:automerge Automatically merge PR once all prerequisites pass. label Jan 20, 2021
@mergify mergify bot merged commit d4e63ff into master Jan 20, 2021
@mergify mergify bot deleted the aditya/upgrade-docs branch January 20, 2021 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add thorough IBC upgrade documentation
4 participants