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

client identifier reuse #358

Merged
merged 14 commits into from
Jan 20, 2021
Merged

client identifier reuse #358

merged 14 commits into from
Jan 20, 2021

Conversation

colin-axner
Copy link
Contributor

@colin-axner colin-axner commented Jan 12, 2021

ref: #349

only handles clients

Comment on lines 226 to 235
consensusStateResp, err := clientutils.QueryConsensusStateABCI(c.CLIContext(0), identifiedClientState.ClientId, consensusStateHeight)
if err != nil {
// consensus state does not exist, try next client
continue
}

if proto.Equal(consensusStateResp.ConsensusState, createClientMsg.ConsensusState) {
// matching client found
return identifiedClientState.ClientId, true
}
Copy link
Member

Choose a reason for hiding this comment

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

Doing this makes it unlikely that the consensus state actually matches. We don't want to rely on the ConsensusState in the CreateClientMsg message.

Why can't we just take the latest consensus state for that client state, we can then just check if that consensus state matches the block at the specified height on chain c. If it does, then we can be sure it's a client of the same chain.

Copy link
Contributor Author

@colin-axner colin-axner Jan 12, 2021

Choose a reason for hiding this comment

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

perfect, exactly the feedback I was hoping for. That makes a lot of sense and should actually make client reuse viable and testing it should become trivial

Copy link
Member

Choose a reason for hiding this comment

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

Ahh it looks like c is the chain that you are sending the CreateClientMsg to. You want to query the header from the other chain, since that is the chain you are creating the client for. Will require a refactor, but still possible.

@lgtm-com
Copy link

lgtm-com bot commented Jan 12, 2021

This pull request introduces 1 alert when merging aa55abc into e24e01b - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@colin-axner
Copy link
Contributor Author

requires upstream fix

@colin-axner
Copy link
Contributor Author

tested locally with the upstream fix and it works for clients. I can do connections/channels in a followup if 0.40.1 is cut before then

@colin-axner colin-axner changed the title identifier reuse client identifier reuse Jan 20, 2021
@colin-axner colin-axner marked this pull request as ready for review January 20, 2021 12:17
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.

utACK

Copy link
Member

@AdityaSripal AdityaSripal left a comment

Choose a reason for hiding this comment

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

Great work!! Just have some nits.

Also some manual tests I eventually would like done (could help you on it next week):

  • if there's an existing client for the chain that has different parameters than desired, then a new client gets created
  • if there's a matching client, but consensus state doesn't match. (2 chains with same chain-id), then new client gets created.

Not blocking the merge on these tests though.

Connections and Channel reuse should be easier to implement.

relayer/client-tx.go Outdated Show resolved Hide resolved
relayer/client-tx.go Show resolved Hide resolved
colin-axner and others added 3 commits January 20, 2021 14:58
Co-authored-by: Aditya <adityasripal@gmail.com>
Co-authored-by: Aditya <adityasripal@gmail.com>
@colin-axner
Copy link
Contributor Author

@AdityaSripal good idea, added #383 so I don't forget. Going to merge for now so others can test on these changes and report any issues if they arise

@colin-axner colin-axner merged commit fb40b39 into master Jan 20, 2021
@colin-axner colin-axner deleted the colin/349-identifier-recycling branch January 20, 2021 14:03
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.

3 participants