Skip to content

Commit

Permalink
Default trusting period to 2/3 of unbonding period if it is missing f…
Browse files Browse the repository at this point in the history
…rom client settings
  • Loading branch information
ljoss17 committed Nov 28, 2024
1 parent f0cadc7 commit 8770505
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ where

let unbonding_period = chain.query_unbonding_period().await?;

// Should we use a value for `trusting_period` in the config if it is not
// TODO: Should we use a value for `trusting_period` in the config if it is not
// found in the client settings?
// And if both are missing, should we default to another value?
// Current behaviour is to default to 2/3 of unbonding period if the
// trusting period is missing from the client settings.
let trusting_period = create_client_options
.trusting_period
.ok_or_else(|| Chain::raise_error("missing trusting period in client settings"))?;
.unwrap_or(2 * unbonding_period / 3);

#[allow(deprecated)]
let client_state = ClientState::new(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
use cgp::prelude::*;
use core::time::Duration;

use ibc_proto::ibc::lightclients::tendermint::v1::Fraction;

use crate::types::tendermint::{
ProtoTendermintClientState, ProtoTendermintConsensusState, TendermintClientState,
TendermintConsensusState, TendermintHeader,
};
use crate::types::tendermint::{TendermintClientState, TendermintConsensusState, TendermintHeader};

#[derive(Debug, Clone)]
pub struct CosmosUpdateClientPayload {
Expand All @@ -18,15 +12,3 @@ pub struct CosmosCreateClientPayload {
pub client_state: TendermintClientState,
pub consensus_state: TendermintConsensusState,
}

pub struct CosmosCreateClientOptions {
pub max_clock_drift: Duration,
pub trusting_period: Option<Duration>,
pub trust_threshold: Fraction,
}

#[derive(Debug, Clone, HasField)]
pub struct CosmosCreateClientPayloadV2 {
pub client_state: ProtoTendermintClientState,
pub consensus_state: ProtoTendermintConsensusState,
}

0 comments on commit 8770505

Please sign in to comment.