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

ConsensusState trait should not have a root() method, and ClientState.verify_membership() should not take a root #728

Open
plafer opened this issue Jun 22, 2023 · 3 comments
Labels
A: breaking Admin: breaking change that may impact operators O: decoupling Objective: aims to separate concerns and cause to independent, reusable components O: maintainability Objective: cause to ease modification, fault corrections and improve code understanding

Comments

@plafer
Copy link
Contributor

plafer commented Jun 22, 2023

Not all client's ConsensusState have the concept of a root (e.g. solomachine). Instead of passing the root to verify_membership in the core handlers, we should instead fetch the root in the respective clients when needed (e.g. here in ibc-go's tendermint client).

@plafer plafer added A: breaking Admin: breaking change that may impact operators O: maintainability Objective: cause to ease modification, fault corrections and improve code understanding O: decoupling Objective: aims to separate concerns and cause to independent, reusable components labels Jun 22, 2023
@plafer plafer added this to ibc-rs Jun 22, 2023
@github-project-automation github-project-automation bot moved this to 📥 To Do in ibc-rs Jun 22, 2023
@Farhad-Shabani
Copy link
Member

The question this brings... was wondering what the purpose of the ConsensusState would be if it could live and be defined without the root. Then, logically, why not include the timestamp() in the ClientState (Particularly given that it contains the latest height as well) and move away completely from the ConsensusState?
Isn't the Solomachine a special case? Wouldn't this generalize the concept of ConsensusState too much?

@plafer
Copy link
Contributor Author

plafer commented Jun 28, 2023

The big difference between ClientState and ConsensusState is how they're stored.

  • ClientState: clients/{identifier}/clientState
  • ConsensusState: clients/{identifier}/consensusStates/{height}

Specifically, we remember the history of ConsensusStates (indexed by height), whereas we only remember the latest ClientState. So ClientState.timestamp() would give us the timestamp of the latest ClientState, whereas ConsensusState.timestamp() is the timestamp associated with the ConsensusState at a given height.

The root() is not fundamental to IBC, whereas timestamp() is: it is needed to verify packet timeouts when timing out a packet. So we know for sure that every ConsensusState needs to have a timestamp.

@Farhad-Shabani
Copy link
Member

#784 (comment) related to this issue as well. Worth considering :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: breaking Admin: breaking change that may impact operators O: decoupling Objective: aims to separate concerns and cause to independent, reusable components O: maintainability Objective: cause to ease modification, fault corrections and improve code understanding
Projects
Status: 📥 To Do
Development

No branches or pull requests

2 participants