Skip to content

Commit

Permalink
Make host_timestamp() abstract (#457)
Browse files Browse the repository at this point in the history
* make host_timestamp abstract

* changelog

* changelog
  • Loading branch information
plafer authored Feb 21, 2023
1 parent 45d5f0d commit 317770c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .changelog/unreleased/breaking-changes/418-host-timestamp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Make ValidationContext::host_timestamp() abstract and remove
ValidationContext::pending_host_consensus_state()
([#418](https://github.com/cosmos/ibc-rs/issues/418))
10 changes: 1 addition & 9 deletions crates/ibc/src/core/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,7 @@ pub trait ValidationContext: Router {
fn host_height(&self) -> Result<Height, ContextError>;

/// Returns the current timestamp of the local chain.
fn host_timestamp(&self) -> Result<Timestamp, ContextError> {
let pending_consensus_state = self
.pending_host_consensus_state()
.expect("host must have pending consensus state");
Ok(pending_consensus_state.timestamp())
}

/// Returns the pending `ConsensusState` of the host (local) chain.
fn pending_host_consensus_state(&self) -> Result<Box<dyn ConsensusState>, ContextError>;
fn host_timestamp(&self) -> Result<Timestamp, ContextError>;

/// Returns the `ConsensusState` of the host (local) chain at a specific height.
fn host_consensus_state(
Expand Down
4 changes: 0 additions & 4 deletions crates/ibc/src/mock/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,10 +824,6 @@ impl ValidationContext for MockContext {
.unwrap())
}

fn pending_host_consensus_state(&self) -> Result<Box<dyn ConsensusState>, ContextError> {
Err(ClientError::ImplementationSpecific.into())
}

fn host_consensus_state(
&self,
height: &Height,
Expand Down

0 comments on commit 317770c

Please sign in to comment.