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 <romain.ruetschi@gmail.com>
  • Loading branch information
yito88 and romac committed Aug 18, 2021
1 parent 32e4c29 commit 69b5e76
Showing 1 changed file with 12 additions and 2 deletions.
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 69b5e76

Please sign in to comment.