Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
seanchen1991 committed Sep 3, 2024
1 parent 3ffdf2f commit b326f45
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
5 changes: 1 addition & 4 deletions ibc-clients/ics07-tendermint/src/client_state/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ impl ClientStateCommon for ClientState {
let upgrade_path = &self.inner().upgrade_path;
let (upgrade_path_prefix, upgrade_path) = match upgrade_path.len() {
0 => {
return Err(UpgradeClientError::InvalidUpgradePath {
description: "no upgrade path has been set".to_string(),
}
.into());
return Err(UpgradeClientError::MissingUpgradePath.into());
}
1 => (CommitmentPrefix::empty(), upgrade_path[0].clone()),
2 => (
Expand Down
2 changes: 2 additions & 0 deletions ibc-core/ics02-client/types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ pub enum UpgradeClientError {
InvalidUpgradeProposal { description: String },
/// invalid upgrade plan: `{description}`
InvalidUpgradePlan { description: String },
/// missing upgrade path
MissingUpgradePath,
/// missing upgraded client state
MissingUpgradedClientState,
/// missing upgraded consensus state
Expand Down
8 changes: 4 additions & 4 deletions ibc-core/ics24-host/cosmos/src/upgrade_proposal/proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,27 @@ impl TryFrom<RawUpgradeProposal> for UpgradeProposal {
fn try_from(raw: RawUpgradeProposal) -> Result<Self, Self::Error> {
if raw.title.is_empty() {
return Err(UpgradeClientError::InvalidUpgradeProposal {
description: "title field cannot be empty".to_string(),
description: "missing title field".to_string(),
});
}

if raw.description.is_empty() {
return Err(UpgradeClientError::InvalidUpgradeProposal {
description: "description field cannot be empty".to_string(),
description: "missing description field".to_string(),
});
}

let plan = if let Some(plan) = raw.plan {
plan.try_into()?
} else {
return Err(UpgradeClientError::InvalidUpgradeProposal {
description: "plan field cannot be empty".to_string(),
description: "missing plan field".to_string(),
});
};

let upgraded_client_state = raw.upgraded_client_state.ok_or_else(|| {
UpgradeClientError::InvalidUpgradeProposal {
description: "upgraded client state cannot be empty".to_string(),
description: "missing upgraded client state".to_string(),
}
})?;

Expand Down
3 changes: 1 addition & 2 deletions ibc-primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ pub mod serializers;

pub mod proto {
pub use ibc_proto::google::protobuf::{Any, Duration, Timestamp};
pub use ibc_proto::Error;
pub use ibc_proto::Protobuf;
pub use ibc_proto::{Error, Protobuf};
}

0 comments on commit b326f45

Please sign in to comment.