-
Notifications
You must be signed in to change notification settings - Fork 579
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
feat: make 09-localhost stateless #6683
Merged
colin-axner
merged 26 commits into
main
from
gjermund/5959-make-localhost-a-stateless-implementation
Jul 3, 2024
Merged
Changes from 10 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
614fb22
Remove client state from localhost light client
gjermundgaraba 952423f
Initial store upgrade for v9 localhost statelessness
gjermundgaraba cc1fa35
Merge branch 'main' into gjermund/5959-make-localhost-a-stateless-imp…
gjermundgaraba fe6519f
Remove localhost creation and self state proof
gjermundgaraba 249518b
Wire up migrations
gjermundgaraba 251825d
Update docs for 09-localhost for 09-localhost
gjermundgaraba 465a80c
Merge branch 'main' into gjermund/5959-make-localhost-a-stateless-imp…
gjermundgaraba bb92f22
lint
gjermundgaraba 93082f5
Merge branch 'main' into gjermund/5959-make-localhost-a-stateless-imp…
gjermundgaraba 0847cbe
Merge branch 'main' into gjermund/5959-make-localhost-a-stateless-imp…
gjermundgaraba f573061
Merge branch 'main' into gjermund/5959-make-localhost-a-stateless-imp…
crodriguezvega 84c3236
refactor: simplify migrations, remove unnecessary iteration over clie…
colin-axner ec25710
refactor: remove localhost client state from queries
colin-axner c207393
refactor: remove localhost client state, condense localhost impl into…
colin-axner 8321f41
rename: MigrateToStatelessLocalhost
colin-axner c58f93a
lint
colin-axner 261231e
Merge branch 'main' of github.com:cosmos/ibc-go into gjermund/5959-ma…
colin-axner 58ca2d9
Update docs/docs/05-migrations/13-v8-to-v9.md
colin-axner ab99084
Update docs/docs/05-migrations/13-v8-to-v9.md
colin-axner 61f8ea6
review: docs + linting cleanups
colin-axner 79b809f
Merge branch 'gjermund/5959-make-localhost-a-stateless-implementation…
colin-axner c107950
Merge branch 'main' of github.com:cosmos/ibc-go into gjermund/5959-ma…
colin-axner fdd7806
refactor: remove unused func
colin-axner a66ccff
Update modules/core/02-client/keeper/migrations.go
colin-axner 6028aa0
markdown lint
colin-axner e00c792
Merge branch 'gjermund/5959-make-localhost-a-stateless-implementation…
colin-axner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,33 +14,44 @@ | |
Learn about the 09-localhost light client module. | ||
::: | ||
|
||
The 09-localhost light client module implements a localhost loopback client with the ability to send and receive IBC packets to and from the same state machine. | ||
The 09-localhost light client module implements a stateless localhost loopback client with the ability to send and | ||
receive IBC packets to and from the same state machine. | ||
|
||
### Context | ||
|
||
In a multichain environment, application developers will be used to developing cross-chain applications through IBC. From their point of view, whether or not they are interacting with multiple modules on the same chain or on different chains should not matter. The localhost client module enables a unified interface to interact with different applications on a single chain, using the familiar IBC application layer semantics. | ||
In a multichain environment, application developers will be used to developing cross-chain applications through IBC. | ||
From their point of view, whether or not they are interacting with multiple modules on the same chain or on different | ||
chains should not matter. The localhost client module enables a unified interface to interact with different | ||
applications on a single chain, using the familiar IBC application layer semantics. | ||
|
||
### Implementation | ||
|
||
There exists a [single sentinel `ClientState`](03-client-state.md) instance with the client identifier `09-localhost`. | ||
There exists a [single sentinel `ClientState`](03-client-state.md) with the client identifier `09-localhost`. The light | ||
client is stateless, so the `ClientState` is constructed on demand when required. | ||
|
||
To supplement this, a [sentinel `ConnectionEnd` is stored in core IBC](04-connection.md) state with the connection identifier `connection-localhost`. This enables IBC applications to create channels directly on top of the sentinel connection which leverage the 09-localhost loopback functionality. | ||
To supplement this, a [sentinel `ConnectionEnd` is stored in core IBC](04-connection.md) state with the connection | ||
identifier `connection-localhost`. This enables IBC applications to create channels directly on top of the sentinel | ||
connection which leverage the 09-localhost loopback functionality. | ||
|
||
[State verification](05-state-verification.md) for channel state in handshakes or processing packets is reduced in complexity, the `09-localhost` client can simply compare bytes stored under the standardized key paths. | ||
[State verification](05-state-verification.md) for channel state in handshakes or processing packets is reduced in | ||
complexity, the `09-localhost` client can simply compare bytes stored under the standardized key paths. | ||
|
||
### Localhost vs *regular* client | ||
|
||
The localhost client aims to provide a unified approach to interacting with applications on a single chain, as the IBC application layer provides for cross-chain interactions. To achieve this unified interface though, there are a number of differences under the hood compared to a 'regular' IBC client (excluding `06-solomachine` and `09-localhost` itself). | ||
The localhost client aims to provide a unified approach to interacting with applications on a single chain, as the IBC | ||
application layer provides for cross-chain interactions. To achieve this unified interface though, there are a number of | ||
differences under the hood compared to a 'regular' IBC client (excluding `06-solomachine` and `09-localhost` itself). | ||
|
||
The table below lists some important differences: | ||
|
||
| | Regular client | Localhost | | ||
| -------------------------------------------- | --------------------------------------------------------------------------- | --------- | | ||
| Number of clients | Many instances of a client *type* corresponding to different counterparties | A single sentinel client with the client identifier `09-localhost`| | ||
| Client creation | Relayer (permissionless) | `ClientState` is instantiated in the `InitGenesis` handler of the 02-client submodule in core IBC | | ||
| Client updates | Relayer submits headers using `MsgUpdateClient` | Latest height is updated periodically through the ABCI [`BeginBlock`](https://docs.cosmos.network/v0.47/building-modules/beginblock-endblock) interface of the 02-client submodule in core IBC | | ||
| Number of connections | Many connections, 1 (or more) per client | A single sentinel connection with the connection identifier `connection-localhost` | | ||
| Connection creation | Connection handshake, provided underlying client | Sentinel `ConnectionEnd` is created and set in store in the `InitGenesis` handler of the 03-connection submodule in core IBC | | ||
| Counterparty | Underlying client, representing another chain | Client with identifier `09-localhost` in same chain | | ||
| `VerifyMembership` and `VerifyNonMembership` | Performs proof verification using consensus state roots | Performs state verification using key-value lookups in the core IBC store | | ||
| Integration | Expected to register codec types using the `AppModuleBasic` interface | Registers codec types within the core IBC module | | ||
| | Regular client | Localhost | | ||
|----------------------------------------------|-----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------| | ||
| Number of clients | Many instances of a client *type* corresponding to different counterparties | A single sentinel client with the client identifier `09-localhost` | | ||
| Client creation | Relayer (permissionless) | Implicitly made available by the 02-client submodule in core IBC | | ||
| Client updates | Relayer submits headers using `MsgUpdateClient` | No client updates are required as the `ClientState` is constructed with the latest height when queried | | ||
| Number of connections | Many connections, 1 (or more) per client | A single sentinel connection with the connection identifier `connection-localhost` | | ||
| Connection creation | Connection handshake, provided underlying client | Sentinel `ConnectionEnd` is created and set in store in the `InitGenesis` handler of the 03-connection submodule in core IBC | | ||
| Counterparty | Underlying client, representing another chain | Client with identifier `09-localhost` in same chain | | ||
| `VerifyMembership` and `VerifyNonMembership` | Performs proof verification using consensus state roots | Performs state verification using key-value lookups in the core IBC store | | ||
| Integration | Expected to register codec types using the `AppModuleBasic` interface | Registers codec types within the core IBC module | | ||
| `ClientState` storage | `ClientState` stored and directly provable with `VerifyMembership` | Stateless, so `ClientState` is not provable directly with `VerifyMembership` | | ||
Check failure on line 57 in docs/docs/03-light-clients/02-localhost/01-overview.md GitHub Actions / lintFiles should end with a single newline character
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,3 +141,10 @@ | |
|
||
The `ExportMetadataMsg` struct has been removed and is no longer required for contracts to implement. Core IBC will handle exporting all key/value's written to the store by a light client contract. | ||
The `ZeroCustomFields` interface function has been removed from the `ClientState` interface. Core IBC only used this function to set tendermint client states when scheduling an IBC software upgrade. The interface function has been replaced by a type assertion. | ||
|
||
### 09-localhost | ||
|
||
The `09-localhost` light client has been made stateless and will no longer updating the client on every block. The `ClientState` is constructed on demand when required. | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
The `ClientState` itself is therefore no longer provable direcly with `VerifyMembership` or `VerifyNonMembership`. | ||
|
||
Previously stored client state date is pruned automatically on IBC module store migration from `ConsensusVersion` 6 to 7. | ||
Check failure on line 150 in docs/docs/05-migrations/13-v8-to-v9.md GitHub Actions / lintFiles should end with a single newline character
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
unsure if we want to delete this file, but left for now