Skip to content

Commit

Permalink
Implement ConsensusState for AnyConsensusState (#1298)
Browse files Browse the repository at this point in the history
* impl ConsensusState for AnyConsensusState

* Add link to changelog entry

Co-authored-by: Romain Ruetschi <[email protected]>
  • Loading branch information
yito88 and romac authored Aug 18, 2021
1 parent 882c9c0 commit 1adea5a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Implement `ics02_client::client_consensus::ConsensusState` for `AnyConsensusState` ([#1297])

[#1297]: https://github.com/informalsystems/ibc-rs/issues/1297
14 changes: 12 additions & 2 deletions modules/src/ics02_client/client_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,21 @@ impl ConsensusState for AnyConsensusState {
}

fn root(&self) -> &CommitmentRoot {
todo!()
match self {
Self::Tendermint(cs_state) => cs_state.root(),

#[cfg(any(test, feature = "mocks"))]
Self::Mock(mock_state) => mock_state.root(),
}
}

fn validate_basic(&self) -> Result<(), Infallible> {
todo!()
match self {
Self::Tendermint(cs_state) => cs_state.validate_basic(),

#[cfg(any(test, feature = "mocks"))]
Self::Mock(mock_state) => mock_state.validate_basic(),
}
}

fn wrap_any(self) -> AnyConsensusState {
Expand Down

0 comments on commit 1adea5a

Please sign in to comment.