Skip to content

Commit

Permalink
Add Default impl for ProofSpecs
Browse files Browse the repository at this point in the history
  • Loading branch information
hu55a1n1 committed Nov 19, 2021
1 parent 2c109ed commit 3873c11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 7 additions & 1 deletion modules/src/core/ics23_commitment/specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize};
/// Additionally, this type also aids in the conversion from `ProofSpec` types from crate `ics23`
/// into proof specifications as represented in the `ibc_proto` type; see the
/// `From` trait(s) below.
#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize)]
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
pub struct ProofSpecs(Vec<ProtoProofSpec>);

impl ProofSpecs {
Expand All @@ -24,6 +24,12 @@ impl ProofSpecs {
}
}

impl Default for ProofSpecs {
fn default() -> Self {
Self::cosmos()
}
}

/// Converts from the domain type (which is represented as a vector of `ics23::ProofSpec`
/// to the corresponding proto type (vector of `ibc_proto::ProofSpec`).
/// TODO: fix with <https://github.com/informalsystems/ibc-rs/issues/853>
Expand Down
8 changes: 1 addition & 7 deletions relayer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,15 +411,9 @@ pub struct ChainConfig {
pub address_type: AddressType,
}

#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub struct ProofSpecsJson(ProofSpecs);

impl Default for ProofSpecsJson {
fn default() -> Self {
Self(ProofSpecs::cosmos())
}
}

impl From<ProofSpecsJson> for ProofSpecs {
fn from(value: ProofSpecsJson) -> Self {
value.0
Expand Down

0 comments on commit 3873c11

Please sign in to comment.