Skip to content

Commit b44406d

Browse files
committed
fix: build deps
1 parent faef800 commit b44406d

File tree

18 files changed

+92
-614
lines changed

18 files changed

+92
-614
lines changed

Cargo.lock

+2-514
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/cosmwasm-vm/cw-ibc-core/src/ics02_client/handler.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,9 @@ impl<'a> IbcClient for CwIbcCoreContext<'a> {
131131
message: RawMsgUpdateClient,
132132
) -> Result<Response, ContractError> {
133133
let client_id = to_ibc_client_id(&message.client_id)?;
134-
let header = message
135-
.header
136-
.ok_or(ContractError::IbcClientError {
137-
error: ClientError::MissingRawHeader,
138-
})?;
134+
let header = message.header.ok_or(ContractError::IbcClientError {
135+
error: ClientError::MissingRawHeader,
136+
})?;
139137

140138
let client = self.get_light_client(deps.as_ref().storage, &client_id)?;
141139
let client_state = self.client_state(deps.as_ref(), &client_id)?;
@@ -151,7 +149,7 @@ impl<'a> IbcClient for CwIbcCoreContext<'a> {
151149

152150
let sub_msg: SubMsg = client.update_client(&client_id, &header)?;
153151
cw_println!(
154-
deps,
152+
deps.api,
155153
"Called Update Client On Lightclient for client id:{}",
156154
&message.client_id
157155
);
@@ -327,7 +325,7 @@ impl<'a> IbcClient for CwIbcCoreContext<'a> {
327325
cosmwasm_std::SubMsgResult::Ok(result) => match result.data {
328326
Some(data) => {
329327
let update_client_response: UpdateClientResponse = from_binary_response(&data)?;
330-
cw_println!(deps, "Received Client Update Callback with data");
328+
cw_println!(deps.api, "Received Client Update Callback with data");
331329
let client_id: ClientId =
332330
self.get_callback_data(deps.as_ref().storage, EXECUTE_UPDATE_CLIENT)?;
333331
self.clear_callback_data(deps.storage, EXECUTE_UPDATE_CLIENT);

contracts/cosmwasm-vm/cw-ibc-core/src/ics03_connection/handler.rs

+15-11
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl<'a> CwIbcCoreContext<'a> {
208208
connection_end.delay_period(),
209209
);
210210
cw_println!(
211-
deps,
211+
deps.api,
212212
"[ConnOpenAck]: Expected conn end {:?}",
213213
expected_connection_end
214214
);
@@ -338,7 +338,7 @@ impl<'a> CwIbcCoreContext<'a> {
338338
let prefix = self.commitment_prefix(deps.as_ref(), &env);
339339

340340
cw_println!(
341-
deps,
341+
deps.api,
342342
"prefix_on_b is {:?}",
343343
from_utf8(&prefix.clone().into_vec()).unwrap()
344344
);
@@ -354,21 +354,21 @@ impl<'a> CwIbcCoreContext<'a> {
354354
);
355355

356356
cw_println!(
357-
deps,
357+
deps.api,
358358
"[ConnOpenTry]: expected counterpart connection_end:{:?}",
359359
HexString::from_bytes(&expected_connection_end.encode_vec().unwrap())
360360
);
361361

362362
let consensus_state = self.consensus_state(deps.as_ref(), &client_id, &proof_height)?;
363363
cw_println!(
364-
deps,
364+
deps.api,
365365
"[ConnOpenTry]: root: {:?} ",
366366
HexString::from_bytes(consensus_state.root().as_bytes())
367367
);
368368
let counterparty_connection_path =
369369
commitment::connection_path(&counterparty_connection_id.clone().unwrap());
370370
cw_println!(
371-
deps,
371+
deps.api,
372372
"[ConnOpenTry]: connkey: {:?}",
373373
HexString::from_bytes(&counterparty_connection_path)
374374
);
@@ -383,13 +383,13 @@ impl<'a> CwIbcCoreContext<'a> {
383383

384384
// this is verifying tendermint client state and shouldn't have icon-client as an argument
385385
cw_println!(
386-
deps,
386+
deps.api,
387387
"[ConnOpenTry]: payload client state path {:?}",
388388
&counterparty_client_id
389389
);
390390
let client_state_path = commitment::client_state_path(&counterparty_client_id);
391391
cw_println!(
392-
deps,
392+
deps.api,
393393
"[ConnOpenTry]: the clientstate value is {:?}",
394394
message_client_state.value
395395
);
@@ -429,7 +429,7 @@ impl<'a> CwIbcCoreContext<'a> {
429429
let connection_id = self.generate_connection_idenfier(deps.storage)?;
430430

431431
cw_println!(
432-
deps,
432+
deps.api,
433433
"[ConnOpenTryReply]: connection id is{:?}",
434434
connection_id
435435
);
@@ -500,7 +500,7 @@ impl<'a> CwIbcCoreContext<'a> {
500500
}
501501
let prefix = self.commitment_prefix(deps.as_ref(), &env);
502502
cw_println!(
503-
deps,
503+
deps.api,
504504
"[ConnOpenConfirm]: Our Connection {:?}",
505505
connection_end
506506
);
@@ -509,7 +509,11 @@ impl<'a> CwIbcCoreContext<'a> {
509509
let counterparty_client_id = counterparty.client_id();
510510
let counterparty_prefix = counterparty.prefix();
511511
let counterparty_conn_id = counterparty.connection_id().cloned();
512-
cw_println!(deps.api, "[ConnOpenConfirm]: CounterParty {:?}", &counterparty);
512+
cw_println!(
513+
deps.api,
514+
"[ConnOpenConfirm]: CounterParty {:?}",
515+
&counterparty
516+
);
513517

514518
ensure_connection_state(&connection_id, &connection_end, &State::TryOpen)?;
515519

@@ -535,7 +539,7 @@ impl<'a> CwIbcCoreContext<'a> {
535539
client.verify_connection_open_confirm(deps.as_ref(), verify_connection_state, client_id)?;
536540

537541
cw_println!(
538-
deps,
542+
deps.api,
539543
"[ConnOpenConfirmReply]: CounterParty {:?}",
540544
counterparty
541545
);

contracts/cosmwasm-vm/cw-ibc-core/src/ics04_channel/handler.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<'a> ValidateChannel for CwIbcCoreContext<'a> {
6464
) -> Result<cosmwasm_std::Response, ContractError> {
6565
// connection hops should be 1
6666
cw_println!(
67-
deps,
67+
deps.api,
6868
"inside validate channel open init: input parameter: {:?}",
6969
message
7070
);
@@ -180,7 +180,7 @@ impl<'a> ValidateChannel for CwIbcCoreContext<'a> {
180180
let source_channel = channel_end.remote.channel_id.clone().unwrap();
181181

182182
cw_println!(
183-
deps,
183+
deps.api,
184184
"stoed: channel id: {:?} portid :{:?} channel_end :{:?}",
185185
&dest_channel,
186186
&dest_port,

contracts/cosmwasm-vm/cw-ibc-core/src/ics04_channel/packet/receive_packet.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,15 @@ impl<'a> CwIbcCoreContext<'a> {
114114
);
115115
cw_println!(deps.api, "packet is -> {:?}", msg.packet);
116116
cw_println!(
117-
deps,
117+
deps.api,
118118
"packet.data is -> {:?}",
119119
HexString::from_bytes(&packet.data)
120120
);
121-
cw_println!(deps.api, "expected commitement created {:?}", packet.sequence);
121+
cw_println!(
122+
deps.api,
123+
"expected commitement created {:?}",
124+
packet.sequence
125+
);
122126

123127
let commitment_path_on_a = commitment::packet_commitment_path(
124128
&src_port,

contracts/cosmwasm-vm/cw-ibc-core/src/ics04_channel/packet/timeout_on_close.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<'a> CwIbcCoreContext<'a> {
165165
verify_channel_state,
166166
next_seq_recv_verification_result,
167167
)?;
168-
cw_println!(deps, "Light Client Validation Passed");
168+
cw_println!(deps.api, "Light Client Validation Passed");
169169

170170
if let Order::Ordered = channel_end.ordering {
171171
channel_end.state = State::Closed;

contracts/cosmwasm-vm/cw-ibc-core/tests/test_client.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ fn check_for_update_client_message() {
536536

537537
let update_client_message = RawMsgUpdateClient {
538538
client_id: client_id.to_string(),
539-
client_message: Some(client_state.to_any()),
539+
header: Some(client_state.to_any()),
540540
signer: signer.to_string(),
541541
};
542542

@@ -598,7 +598,7 @@ fn fails_on_updating_non_existing_client() {
598598
let signer = Signer::from_str("new_signer").unwrap();
599599
let update_client_message = RawMsgUpdateClient {
600600
client_id: client_id.to_string(),
601-
client_message: Some(client_state.to_any()),
601+
header: Some(client_state.to_any()),
602602
signer: signer.to_string(),
603603
};
604604

contracts/cosmwasm-vm/cw-ibc-core/tests/test_execution_messages.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ fn test_for_update_client_execution_messages() {
182182

183183
let msg_hex = RawMsgUpdateClient {
184184
client_id: "iconclient-0".to_string(),
185-
client_message: Some(signed_header.to_any()),
185+
header: Some(signed_header.to_any()),
186186
signer: "signeraddress".to_string(),
187187
};
188188

contracts/cosmwasm-vm/cw-light-client-common/src/light_client.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::constants::TRUST_LEVEL;
2-
use crate::state::CwContext;
2+
33
use crate::traits::{ConsensusStateUpdate, IContext, ILightClient};
44
use crate::ContractError;
55
use common::icon::icon::lightclient::v1::ConsensusState;
@@ -11,12 +11,11 @@ use cosmwasm_std::Addr;
1111
use cw_common::cw_println;
1212
use prost::Message;
1313

14-
pub struct IconClient<C:IContext> {
14+
pub struct IconClient<C: IContext> {
1515
context: C,
1616
}
1717

18-
impl<C:IContext> IconClient<C> {
19-
18+
impl<C: IContext> IconClient<C> {
2019
pub fn new(context: C) -> Self {
2120
Self { context }
2221
}
@@ -98,7 +97,7 @@ impl<C:IContext> IconClient<C> {
9897
}
9998
}
10099

101-
impl<C:IContext> ILightClient for IconClient<C> {
100+
impl<C: IContext> ILightClient for IconClient<C> {
102101
type Error = crate::ContractError;
103102

104103
fn create_client(

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

+8-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::marker::PhantomData;
22

33
use crate::{
44
state::{CLIENT_STATES, CONFIG, CONSENSUS_STATES, PROCESSED_HEIGHTS, PROCESSED_TIMES},
5-
traits::{Config},
5+
traits::Config,
66
ContractError,
77
};
88
use common::{
@@ -21,21 +21,20 @@ use prost::Message;
2121

2222
pub struct QueryHandler;
2323

24-
2524
impl QueryHandler {
2625
pub fn get_consensus_state(
2726
storage: &dyn Storage,
2827
client_id: &str,
2928
height: u64,
3029
) -> Result<ConsensusState, ContractError> {
3130
let data = CONSENSUS_STATES
32-
.load(storage, (client_id.to_string(), height))
33-
.map_err(|_e| ContractError::ConsensusStateNotFound {
34-
height,
35-
client_id: client_id.to_string(),
36-
})?;
37-
let state = ConsensusState::decode(data.as_slice()).map_err(ContractError::DecodeError)?;
38-
Ok(state)
31+
.load(storage, (client_id.to_string(), height))
32+
.map_err(|_e| ContractError::ConsensusStateNotFound {
33+
height,
34+
client_id: client_id.to_string(),
35+
})?;
36+
let state = ConsensusState::decode(data.as_slice()).map_err(ContractError::DecodeError)?;
37+
Ok(state)
3938
}
4039

4140
pub fn get_client_state(
@@ -77,7 +76,6 @@ impl QueryHandler {
7776
})
7877
}
7978

80-
8179
pub fn get_config(storage: &dyn Storage) -> Result<Config, ContractError> {
8280
CONFIG
8381
.load(storage)

contracts/cosmwasm-vm/cw-light-client-common/src/state.rs

+10-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::marker::PhantomData;
2-
31
use common::icon::icon::lightclient::v1::ClientState;
42
use common::icon::icon::lightclient::v1::ConsensusState;
53

@@ -13,9 +11,8 @@ use cosmwasm_std::Storage;
1311
use cw_storage_plus::{Item, Map};
1412
use debug_print::debug_eprintln;
1513

16-
use prost::Message;
1714
use crate::query_handler::QueryHandler;
18-
15+
use prost::Message;
1916

2017
use crate::traits::Config;
2118
use crate::traits::IContext;
@@ -32,7 +29,6 @@ pub struct CwContext<'a> {
3229
pub storage: &'a mut dyn Storage,
3330
pub api: &'a dyn Api,
3431
pub env: Env,
35-
3632
}
3733

3834
impl<'a> CwContext<'a> {
@@ -46,18 +42,15 @@ impl<'a> CwContext<'a> {
4642
}
4743

4844
impl<'a> IContext for CwContext<'a> {
49-
50-
51-
52-
fn get_client_state(&self, client_id: &str) -> Result<ClientState,ContractError> {
45+
fn get_client_state(&self, client_id: &str) -> Result<ClientState, ContractError> {
5346
QueryHandler::get_client_state(self.storage, client_id)
5447
}
5548

5649
fn insert_client_state(
5750
&mut self,
5851
client_id: &str,
5952
state: ClientState,
60-
) -> Result<(),ContractError> {
53+
) -> Result<(), ContractError> {
6154
let data = state.encode_to_vec();
6255
CLIENT_STATES
6356
.save(self.storage, client_id.to_string(), &data)
@@ -84,7 +77,7 @@ impl<'a> IContext for CwContext<'a> {
8477
.map_err(|_e| ContractError::FailedToSaveClientState)
8578
}
8679

87-
fn get_timestamp_at_height(&self, client_id: &str, height: u64) -> Result<u64,ContractError> {
80+
fn get_timestamp_at_height(&self, client_id: &str, height: u64) -> Result<u64, ContractError> {
8881
QueryHandler::get_timestamp_at_height(self.storage, client_id, height)
8982
}
9083

@@ -106,11 +99,11 @@ impl<'a> IContext for CwContext<'a> {
10699
.map(|addr| addr.to_vec())
107100
}
108101

109-
fn get_config(&self) -> Result<Config,ContractError> {
102+
fn get_config(&self) -> Result<Config, ContractError> {
110103
QueryHandler::get_config(self.storage)
111104
}
112105

113-
fn insert_config(&mut self, config: &Config) -> Result<(),ContractError> {
106+
fn insert_config(&mut self, config: &Config) -> Result<(), ContractError> {
114107
CONFIG
115108
.save(self.storage, config)
116109
.map_err(|_e| ContractError::FailedToSaveConfig)
@@ -162,23 +155,23 @@ impl<'a> IContext for CwContext<'a> {
162155
QueryHandler::get_processed_blocknumber_at_height(self.storage, client_id, height)
163156
}
164157

165-
fn ensure_ibc_host(&self, caller: cosmwasm_std::Addr) -> Result<(),ContractError> {
158+
fn ensure_ibc_host(&self, caller: cosmwasm_std::Addr) -> Result<(), ContractError> {
166159
let config = self.get_config()?;
167160
if caller != config.ibc_host {
168161
return Err(ContractError::Unauthorized {});
169162
}
170163
Ok(())
171164
}
172-
fn ensure_owner(&self, caller: cosmwasm_std::Addr) -> Result<(),ContractError> {
165+
fn ensure_owner(&self, caller: cosmwasm_std::Addr) -> Result<(), ContractError> {
173166
let config = self.get_config()?;
174167
debug_eprintln!("owner {:?} caller {}", config.owner, caller.to_string());
175168
if caller != config.owner {
176169
return Err(ContractError::Unauthorized {});
177170
}
178171
Ok(())
179172
}
180-
fn api(&self)->& dyn Api {
181-
return self.api
173+
fn api(&self) -> &dyn Api {
174+
self.api
182175
}
183176
}
184177

0 commit comments

Comments
 (0)