diff --git a/light-clients/cf-guest/src/client_def.rs b/light-clients/cf-guest/src/client_def.rs index 6fdfed071..fb1354b64 100644 --- a/light-clients/cf-guest/src/client_def.rs +++ b/light-clients/cf-guest/src/client_def.rs @@ -339,17 +339,6 @@ fn verify_delay_passed( .map_err(|e| e.into()) } -impl GuestClient { - pub fn verify_delay_passed( - ctx: &impl ReaderContext, - height: ibc::Height, - delay_time_period: u64, - delay_block_period: u64, - ) -> Result<(), Ics02ClientError> { - todo!() - } -} - impl Verifier for GuestClient { fn verify(&self, message: &[u8], pubkey: &PK, signature: &PK::Signature) -> bool { let pubkey_in_bytes = pubkey.to_vec(); diff --git a/light-clients/ics07-guest-cw/src/contract.rs b/light-clients/ics07-guest-cw/src/contract.rs index 320e02e37..ee19c8aca 100644 --- a/light-clients/ics07-guest-cw/src/contract.rs +++ b/light-clients/ics07-guest-cw/src/contract.rs @@ -94,7 +94,7 @@ fn process_message( .client_state(&client_id) .map_err(|e| ContractError::Tendermint(e.to_string()))?; let msg = VerifyMembershipMsg::try_from(msg)?; - GuestClient::::verify_delay_passed( + crate::helpers::verify_delay_passed( ctx, msg.height, msg.delay_time_period, @@ -120,7 +120,7 @@ fn process_message( .client_state(&client_id) .map_err(|e| ContractError::Tendermint(e.to_string()))?; let msg = VerifyNonMembershipMsg::try_from(msg)?; - GuestClient::::verify_delay_passed( + crate::helpers::verify_delay_passed( ctx, msg.height, msg.delay_time_period, diff --git a/light-clients/ics07-guest-cw/src/helpers.rs b/light-clients/ics07-guest-cw/src/helpers.rs index 87bc30f7a..7c3f6bca6 100644 --- a/light-clients/ics07-guest-cw/src/helpers.rs +++ b/light-clients/ics07-guest-cw/src/helpers.rs @@ -136,3 +136,26 @@ pub fn prune_oldest_consensus_state( } } } + +pub fn verify_delay_passed( + ctx: &Context, + height: Height, + delay_period_time: u64, + delay_period_height: u64, +) -> Result<(), Ics02Error> { + let current_timestamp = ctx.host_timestamp(); + let current_height = ctx.host_height(); + + let processed_time = ctx.processed_timestamp(height)?; + let processed_height = ctx.processed_height(height)?; + + ClientState::::verify_delay_passed( + current_timestamp, + current_height, + processed_time, + processed_height, + delay_period_time, + delay_period_height, + ) + .map_err(|e| e.into()) +}