Skip to content

Commit 62a9828

Browse files
committed
chore: pass build
1 parent 16ac231 commit 62a9828

File tree

5 files changed

+26
-27
lines changed

5 files changed

+26
-27
lines changed

contracts/cosmwasm-vm/cw-wasm-light-client/src/context.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use cw_light_client_common::{
99
};
1010

1111
use crate::utils::{
12-
get_client_state_key, get_consensus_state_key, to_wasm_client_state, to_wasm_consensus_state, to_ibc_height,
12+
get_client_state_key, get_consensus_state_key, to_ibc_height, to_wasm_client_state,
13+
to_wasm_consensus_state,
1314
};
1415
pub struct CwContext<'a> {
1516
pub storage: &'a mut dyn Storage,

contracts/cosmwasm-vm/cw-wasm-light-client/src/contract.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ fn process_message(
9393
&path,
9494
)?;
9595
cw_println!(deps_mut.api, "[WasmClient]: Verify Membership Complete");
96-
96+
9797
to_binary(&ContractResult::success()).map_err(ContractError::Std)
9898
}
9999
ExecuteMsg::VerifyNonMembership(msg) => {
@@ -157,11 +157,6 @@ fn process_message(
157157
Ok(result.unwrap())
158158
}
159159

160-
161-
162-
163-
164-
165160
#[cfg_attr(not(feature = "library"), entry_point)]
166161
pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
167162
match msg {

contracts/cosmwasm-vm/cw-wasm-light-client/src/msg.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ impl QueryResponse {
7878
}
7979
}
8080

81-
8281
#[cw_serde]
8382
pub struct ContractResult {
8483
pub is_valid: bool,
@@ -118,7 +117,6 @@ impl ContractResult {
118117
}
119118
}
120119

121-
122120
#[cw_serde]
123121
pub struct InstantiateMsg {}
124122

@@ -173,8 +171,6 @@ pub struct VerifyMembershipMsgRaw {
173171
pub delay_time_period: u64,
174172
}
175173

176-
177-
178174
#[cw_serde]
179175
pub struct VerifyNonMembershipMsgRaw {
180176
#[schemars(with = "String")]
@@ -232,4 +228,4 @@ pub struct VerifyUpgradeAndUpdateStateMsgRaw {
232228
#[schemars(with = "String")]
233229
#[serde(with = "Base64", default)]
234230
pub proof_upgrade_consensus_state: Vec<u8>,
235-
}
231+
}

contracts/cosmwasm-vm/cw-wasm-light-client/src/query_handler.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
use cosmwasm_std::{to_binary, Binary, Deps, Order, StdResult};
42
use cw_light_client_common::{constants::PROCESSED_HEIGHTS, traits::IQueryHandler, ContractError};
53
use ibc::Height;
@@ -8,7 +6,8 @@ use crate::{
86
constants::CLIENT_ID,
97
msg::{GenesisMetadata, QueryResponse},
108
utils::{
11-
decode_client_state, decode_consensus_state, get_client_state_key, get_consensus_state_key, to_ibc_height,
9+
decode_client_state, decode_consensus_state, get_client_state_key, get_consensus_state_key,
10+
to_ibc_height,
1211
},
1312
};
1413

@@ -31,7 +30,7 @@ impl QueryHandler {
3130
pub fn get_genesis_metadata(
3231
storage: &dyn cosmwasm_std::Storage,
3332
client_id: &str,
34-
) -> Result<Vec<GenesisMetadata>,ContractError> {
33+
) -> Result<Vec<GenesisMetadata>, ContractError> {
3534
let heights = PROCESSED_HEIGHTS
3635
.prefix(client_id.to_string())
3736
.keys(storage, None, None, Order::Ascending)

contracts/cosmwasm-vm/cw-wasm-light-client/src/utils.rs

+19-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
use common::{
22
consensus_state::IConsensusState,
3-
43
icon::icon::lightclient::v1::{ClientState, ConsensusState},
54
traits::AnyTypes,
65
};
76
use cw_common::raw_types::Any;
87
use cw_light_client_common::ContractError;
8+
use ibc::Height;
99
use ics07_tendermint_cw::ics23::FakeInner;
1010
use ics08_wasm::client_state::ClientState as WasmClientState;
1111
use prost::Message;
1212
use tendermint_proto::Protobuf;
13-
use ibc::Height;
1413
pub fn get_consensus_state_key(height: Height) -> Vec<u8> {
1514
[
1615
"consensusStates/".to_string().into_bytes(),
@@ -27,10 +26,13 @@ pub fn to_wasm_client_state(
2726
client_state: ClientState,
2827
old_wasm_state: Vec<u8>,
2928
) -> Result<Vec<u8>, ContractError> {
30-
let any = any_from_byte(&*old_wasm_state)?;
31-
let mut wasm_client_state =
32-
WasmClientState::<FakeInner, FakeInner, FakeInner>::decode_vec(&any.value)
33-
.map_err(|e| ContractError::OtherError { error: e.to_string() })?;
29+
let any = any_from_byte(&old_wasm_state)?;
30+
let mut wasm_client_state = WasmClientState::<FakeInner, FakeInner, FakeInner>::decode_vec(
31+
&any.value,
32+
)
33+
.map_err(|e| ContractError::OtherError {
34+
error: e.to_string(),
35+
})?;
3436
wasm_client_state.data = client_state.to_any().encode_to_vec();
3537
wasm_client_state.latest_height = to_ibc_height(client_state.latest_height);
3638
let vec1 = wasm_client_state.to_any().encode_to_vec();
@@ -52,7 +54,9 @@ pub fn decode_client_state(data: &[u8]) -> Result<ClientState, ContractError> {
5254
ics08_wasm::client_state::ClientState::<FakeInner, FakeInner, FakeInner>::decode_vec(
5355
&any.value,
5456
)
55-
.map_err(|e| ContractError::OtherError { error: e.to_string() })?;
57+
.map_err(|e| ContractError::OtherError {
58+
error: e.to_string(),
59+
})?;
5660
let any = Any::decode(&*wasm_state.data).map_err(ContractError::DecodeError)?;
5761
let state = ClientState::from_any(any).map_err(ContractError::DecodeError)?;
5862
Ok(state)
@@ -61,14 +65,18 @@ pub fn decode_client_state(data: &[u8]) -> Result<ClientState, ContractError> {
6165
pub fn decode_consensus_state(value: &[u8]) -> Result<ConsensusState, ContractError> {
6266
let any = Any::decode(&mut &*value).map_err(ContractError::DecodeError)?;
6367
let wasm_consensus_state =
64-
ics08_wasm::consensus_state::ConsensusState::<FakeInner>::decode_vec(&any.value)
65-
.map_err(|e| ContractError::OtherError { error: e.to_string() })?;
66-
let any = Any::decode(&mut &wasm_consensus_state.data[..]).map_err(ContractError::DecodeError)?;
68+
ics08_wasm::consensus_state::ConsensusState::<FakeInner>::decode_vec(&any.value).map_err(
69+
|e| ContractError::OtherError {
70+
error: e.to_string(),
71+
},
72+
)?;
73+
let any =
74+
Any::decode(&mut &wasm_consensus_state.data[..]).map_err(ContractError::DecodeError)?;
6775
let any_consensus_state = ConsensusState::from_any(any).map_err(ContractError::DecodeError)?;
6876
Ok(any_consensus_state)
6977
}
7078

71-
pub fn to_ibc_height(height: u64) -> Height{
79+
pub fn to_ibc_height(height: u64) -> Height {
7280
Height::new(0, height)
7381
}
7482

0 commit comments

Comments
 (0)