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

feat: adding 09-localhost loopback client module #3229

Merged
merged 62 commits into from
Mar 8, 2023
Merged

feat: adding 09-localhost loopback client module #3229

merged 62 commits into from
Mar 8, 2023

Conversation

damiannolan
Copy link
Member

@damiannolan damiannolan commented Mar 2, 2023

Description

The following PR adds v2 of the 09-localhost light client module.

closes: #3034

Commit Message / Changelog Entry

feat: adding 09-localhost loopback client module [\#3034](https://github.com/cosmos/ibc-go/issues/3034). Please see the 09-localhost documentation [here](https://ibc.cosmos.network/main/ibc/light-clients/localhost/overview.html).
feat: AllowedClients on-chain param allows chains to pause usage of specific client types by removing the client type from the param.
imp: Update all channel events to use `connection_id` attribute. The `packet_connection` attribute has been deprecated.

see the guidelines for commit messages. (view raw markdown for examples)


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 and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

damiannolan and others added 30 commits January 18, 2023 20:20
* adding localhost AppModuleBasic to app.go. adding localhost client to InitGenesis. Fixing update localhost client

* renmaing variable

* adding migration handler for enabling localhost client

* updating to use clienttypes.GetSelfHeight()
* adding initial localhost client testing scaffolding

* add testing placeholders, adapt initialise code, wire AppModuleBasic

* adding happy path test cases, fixing store prefixing in verify membership/non-membership

* formatting

* adding additional test cases

* adding remaining test cases

* adding inline comments
* return an error from 09-localhost client VerifyClientMessage

* fix typo

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
* disallow localhost client creation, adapt tests

* adapting logic to accomodate usage of allowed clients in InitGenesis

* move localhost check to separate conditional
* use temporary relayer tag for e2e testing localhost

* WIP commiting

* updating codec and handling txResp

* WIP scaffold happy path out

* adding some temporary todos

* adding msg response unmarshalling, and adding interchain accounts handshake test

* adding ica send packet testing, cleanup..etc

* adding separate test suite for localhost transfer tests (#3144)

* add separate test suite struct for ICA localhost

* fixing testsuite embedding

* review suggestions - events func and nits

* testcase naming

---------

Co-authored-by: Cian Hatton <cian@interchain.io>
* use temporary relayer tag for e2e testing localhost

* WIP commiting

* updating codec and handling txResp

* WIP scaffold happy path out

* adding some temporary todos

* adding msg response unmarshalling, and adding interchain accounts handshake test

* adding ica send packet testing, cleanup..etc

* adding separate test suite for localhost transfer tests (#3144)

* add separate test suite struct for ICA localhost

* fixing testsuite embedding

* adding test for ica channel close and reopen

---------

Co-authored-by: Cian Hatton <cian@interchain.io>
)

* imp: change validateHeight function name to validateConsensusHeight and improve code documentation

* revert: change code back to how it is on main

Revert code changes as they were unnecessary given that a localhost connection cannot be created via the connection handshake
@@ -15,8 +15,8 @@ const (
Rly = "rly"
Hermes = "hermes"

cosmosRelayerRepository = "ghcr.io/cosmos/relayer"
cosmosRelayerUser = "100:1000" // docker run -it --rm --entrypoint echo ghcr.io/cosmos/relayer "$(id -u):$(id -g)"
cosmosRelayerRepository = "damiannolan/rly" //"ghcr.io/cosmos/relayer"
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@chatton chatton left a comment

Choose a reason for hiding this comment

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

Maybe we can add a link to where the docs will be in the commit message?

And link to the localhost issue with a breakdown of all sub issues

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.

:)

Comment on lines +50 to +51
chain-a-tag: pr-3136 # TODO: needs v7.0.0 (with simapp fixes) when cut
chain-b-tag: pr-3136 # TODO: needs v7.0.0 (with simapp fixes) when cut
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an issue for this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines +53 to +55
if clientID == exported.LocalhostClientID {
return clientID, 0, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Regrets of not starting client identifiers at 1 😅 Would have been very clean with localhost being 0

I kind of think we should consider making this function private (or separating functionality) if it's possible two different client identifiers return 0 for the sequence. Not a concern to handle right now, but in non-test code this is used only to verify the identifier is parseable or to validate the NextClientSequence in 02-client/types/genesis.go#Validate. I would propose only parsing the identifier within that function

#3173 might make this easier to handle

Copy link
Contributor

@chatton chatton left a comment

Choose a reason for hiding this comment

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

LGTM 🥳 🥳 🎈


In the previous release of ibc-go, the localhost `v1` light client module was deprecated and removed. The ibc-go `v7.1.0` release introduces `v2` of the 09-localhost light client module.

<!-- TODO: Update the links to use release version instead of feat branch -->
Copy link
Contributor

Choose a reason for hiding this comment

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

is there an issue for this? This will be a dead link as soon as the branch is deleted.

Copy link
Contributor

Choose a reason for hiding this comment

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

will create one for this so we don't lose it if it doesn't exist.

@chatton chatton merged commit d840c69 into main Mar 8, 2023
@chatton chatton deleted the 09-localhost branch March 8, 2023 16:31
mergify bot pushed a commit that referenced this pull request Mar 8, 2023
feat: adding 09-localhost loopback client module [\#3034](#3034). Please see the 09-localhost documentation [here](https://ibc.cosmos.network/main/ibc/light-clients/localhost/overview.html).
feat: AllowedClients on-chain param allows chains to pause usage of specific client types by removing the client type from the param.
imp: Update all channel events to use `connection_id` attribute. The `packet_connection` attribute has been deprecated.
(cherry picked from commit d840c69)

# Conflicts:
#	.github/workflows/e2e-upgrade.yaml
#	docs/ibc/events.md
#	e2e/relayer/relayer.go
#	e2e/testconfig/testconfig.go
#	e2e/tests/upgrades/upgrade_test.go
#	e2e/testsuite/codec.go
#	e2e/testsuite/grpc_query.go
#	e2e/testsuite/testsuite.go
#	modules/core/02-client/keeper/client.go
#	modules/core/02-client/keeper/proposal.go
#	modules/core/02-client/types/errors.go
#	modules/core/03-connection/keeper/verify.go
#	modules/core/03-connection/types/msgs_test.go
#	modules/core/04-channel/keeper/packet.go
#	modules/core/04-channel/types/msgs.go
colin-axner pushed a commit that referenced this pull request Mar 9, 2023
)

* Adding 09-localhost loopback client module (#3229)

feat: adding 09-localhost loopback client module [\#3034](#3034). Please see the 09-localhost documentation [here](https://ibc.cosmos.network/main/ibc/light-clients/localhost/overview.html).
feat: AllowedClients on-chain param allows chains to pause usage of specific client types by removing the client type from the param.
imp: Update all channel events to use `connection_id` attribute. The `packet_connection` attribute has been deprecated.
(cherry picked from commit d840c69)

# Conflicts:
#	.github/workflows/e2e-upgrade.yaml
#	docs/ibc/events.md
#	e2e/relayer/relayer.go
#	e2e/testconfig/testconfig.go
#	e2e/tests/upgrades/upgrade_test.go
#	e2e/testsuite/codec.go
#	e2e/testsuite/grpc_query.go
#	e2e/testsuite/testsuite.go
#	modules/core/02-client/keeper/client.go
#	modules/core/02-client/keeper/proposal.go
#	modules/core/02-client/types/errors.go
#	modules/core/03-connection/keeper/verify.go
#	modules/core/03-connection/types/msgs_test.go
#	modules/core/04-channel/keeper/packet.go
#	modules/core/04-channel/types/msgs.go

* rm -rf e2e

* rm .github/workflows/e2e-upgrade.yaml

* fix errorsmod -> sdkerrors

* ibcerror -> sdkerror in localhost client_state.go

---------

Co-authored-by: Damian Nolan <damiannolan@gmail.com>
@faddat faddat mentioned this pull request Jun 23, 2023
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add 09-localhost client state implementation
7 participants