diff --git a/ibc-clients/cw-context/src/handlers.rs b/ibc-clients/cw-context/src/handlers.rs index 4f51109cd..daef24be3 100644 --- a/ibc-clients/cw-context/src/handlers.rs +++ b/ibc-clients/cw-context/src/handlers.rs @@ -176,7 +176,7 @@ where } QueryMsg::ExportMetadata(ExportMetadataMsg {}) => { to_json_binary(&ExportMetadataResponse { - metadata: self.get_metadata()?, + genesis_metadata: self.get_metadata()?, }) } QueryMsg::TimestampAtHeight(msg) => { diff --git a/ibc-clients/cw-context/src/types/response.rs b/ibc-clients/cw-context/src/types/response.rs index bb80510cd..aada9a2ef 100644 --- a/ibc-clients/cw-context/src/types/response.rs +++ b/ibc-clients/cw-context/src/types/response.rs @@ -16,7 +16,7 @@ pub struct StatusResponse { pub struct ExportMetadataResponse { /// The genesis metadata #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option>, + pub genesis_metadata: Option>, } /// The response to [`super::msgs::QueryMsg::TimestampAtHeight`] diff --git a/tests-integration/tests/cosmwasm/fixture.rs b/tests-integration/tests/cosmwasm/fixture.rs index 3cc187167..3a49f6016 100644 --- a/tests-integration/tests/cosmwasm/fixture.rs +++ b/tests-integration/tests/cosmwasm/fixture.rs @@ -8,13 +8,15 @@ use ibc::core::client::types::{Height, Status}; use ibc::core::host::types::identifiers::ChainId; use ibc::core::primitives::Timestamp; use ibc_client_cw::types::{ - CheckForMisbehaviourMsgRaw, ContractError, ExportMetadataMsg, GenesisMetadata, InstantiateMsg, - MigrationPrefix, QueryMsg, QueryResponse, StatusMsg, UpdateStateMsgRaw, - UpdateStateOnMisbehaviourMsgRaw, VerifyClientMessageRaw, + CheckForMisbehaviourMsgRaw, CheckForMisbehaviourResponse, ContractError, ExportMetadataMsg, + ExportMetadataResponse, GenesisMetadata, InstantiateMsg, MigrationPrefix, QueryMsg, StatusMsg, + StatusResponse, UpdateStateMsgRaw, UpdateStateOnMisbehaviourMsgRaw, VerifyClientMessageRaw, + VerifyClientMessageResponse, }; use ibc_client_cw::utils::AnyCodec; use ibc_client_tendermint_cw::entrypoint::TendermintContext; use ibc_testkit::fixtures::clients::tendermint::ClientStateConfig; +use serde::de::DeserializeOwned; use tendermint::Time; use tendermint_testgen::{Generator, Validator}; @@ -139,7 +141,7 @@ impl Fixture { pub fn verify_client_message(&self, deps: Deps<'_>, client_message: Vec) { let resp = self - .query( + .query::( deps, VerifyClientMessageRaw { client_message: client_message.into(), @@ -149,13 +151,11 @@ impl Fixture { .unwrap(); assert!(resp.is_valid); - assert!(resp.status.is_none()); - assert!(resp.found_misbehaviour.is_none()); } pub fn check_for_misbehaviour(&self, deps: Deps<'_>, client_message: Vec) { let resp = self - .query( + .query::( deps, CheckForMisbehaviourMsgRaw { client_message: client_message.into(), @@ -164,23 +164,24 @@ impl Fixture { ) .unwrap(); - assert!(resp.is_valid); - assert_eq!(resp.found_misbehaviour, Some(true)); + assert!(resp.found_misbehaviour); } pub fn check_client_status(&self, deps: Deps<'_>, expected: Status) { - let resp = self.query(deps, StatusMsg {}.into()).unwrap(); + let resp = self + .query::(deps, StatusMsg {}.into()) + .unwrap(); - assert_eq!(resp.status, Some(expected.to_string())); + assert_eq!(resp.status, expected.to_string()); } pub fn get_metadata(&self, deps: Deps<'_>) -> Option> { - self.query(deps, ExportMetadataMsg {}.into()) + self.query::(deps, ExportMetadataMsg {}.into()) .map(|resp| resp.genesis_metadata) .unwrap() } - pub fn query(&self, deps: Deps<'_>, msg: QueryMsg) -> StdResult { + pub fn query(&self, deps: Deps<'_>, msg: QueryMsg) -> StdResult { let ctx = self.ctx_ref(deps); let resp_bytes = ctx diff --git a/tests-integration/tests/cosmwasm/mod.rs b/tests-integration/tests/cosmwasm/mod.rs index e0e3e613f..bf480197a 100644 --- a/tests-integration/tests/cosmwasm/mod.rs +++ b/tests-integration/tests/cosmwasm/mod.rs @@ -9,6 +9,7 @@ use fixture::Fixture; use ibc::core::client::types::{Height, Status}; use ibc_client_cw::types::{ ContractResult, MigrateClientStoreMsg, MigrationPrefix, VerifyClientMessageRaw, + VerifyClientMessageResponse, }; use ibc_client_tendermint_cw::entrypoint::sudo; @@ -107,7 +108,7 @@ fn test_cw_client_expiry() { let client_message = fxt.dummy_client_message(target_height); - let resp = fxt.query( + let resp = fxt.query::( deps.as_ref(), VerifyClientMessageRaw { client_message: client_message.into(), @@ -115,7 +116,7 @@ fn test_cw_client_expiry() { .into(), ); - assert!(resp.is_err()); + assert!(!resp.unwrap().is_valid); // ------------------- Check client status -------------------