Skip to content

Commit bea923a

Browse files
fix: remove unnecessary comments (#691)
* fix: remove comments * chore: pass build * chore: pass build --------- Co-authored-by: sabinchitrakar <immortal.infidel@gmail.com>
1 parent a55afe1 commit bea923a

File tree

11 files changed

+8
-80
lines changed

11 files changed

+8
-80
lines changed

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

-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ impl<'a> CwIbcCoreContext<'a> {
399399
}
400400
}
401401

402-
//TODO : Implement Methods
403402
#[allow(dead_code)]
404403
#[allow(unused_variables)]
405404
impl<'a> CwIbcCoreContext<'a> {

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ impl<'a> IbcClient for CwIbcCoreContext<'a> {
194194
error: ClientError::MissingRawConsensusState,
195195
})?;
196196

197-
//Check Client Frozen
198197
if old_client_state.is_frozen() {
199198
return Err(ClientError::ClientFrozen {
200199
client_id: client_id.clone(),
@@ -213,7 +212,7 @@ impl<'a> IbcClient for CwIbcCoreContext<'a> {
213212
time2: now,
214213
})
215214
.map_err(Into::<ContractError>::into)?;
216-
// Check if the latest consensus state is within the trust period.
215+
217216
if old_client_state.expired(duration) {
218217
return Err(ClientError::HeaderNotWithinTrustPeriod {
219218
latest_time: old_consensus_state.timestamp(),
@@ -222,8 +221,6 @@ impl<'a> IbcClient for CwIbcCoreContext<'a> {
222221
.map_err(Into::<ContractError>::into);
223222
};
224223

225-
// Validate the upgraded client state and consensus state and verify proofs against the root
226-
227224
let wasm_exec_message = LightClientMessage::UpgradeClient {
228225
upgraded_client_state: new_client_state.value,
229226
upgraded_consensus_state: new_consensus_state.value,

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,11 @@ impl<'a> CwIbcCoreContext<'a> {
305305
}
306306
}
307307

308-
//TODO : Implement Methods
309-
#[allow(dead_code)]
310-
#[allow(unused_variables)]
311308
impl<'a> CwIbcCoreContext<'a> {
312309
pub fn commitment_prefix(&self, deps: Deps, env: &Env) -> CommitmentPrefix {
313310
let address = self.get_self_address(deps, env);
314311
let prefix = get_address_storage_prefix(&address, StorageKey::Commitments.as_str());
315-
CommitmentPrefix::try_from(prefix).unwrap_or_default() //TODO
312+
CommitmentPrefix::try_from(prefix).unwrap_or_default()
316313
}
317314

318315
fn get_self_address(&self, deps: Deps, env: &Env) -> String {

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl<'a> ValidateChannel for CwIbcCoreContext<'a> {
9292
}
9393
channel_open_init_msg_validate(&channel_end, connection_end)?;
9494
let counter = self.channel_counter(deps.storage)?;
95-
let src_channel = ChannelId::new(counter); // creating new channel_id
95+
let src_channel = ChannelId::new(counter);
9696
let contract_address =
9797
self.lookup_modules(deps.storage, message.port_id.clone().as_bytes().to_vec())?;
9898

@@ -101,7 +101,6 @@ impl<'a> ValidateChannel for CwIbcCoreContext<'a> {
101101
channel_end.state = State::Init;
102102
self.store_channel_end(deps.storage, &src_port, &src_channel, &channel_end)?;
103103

104-
// Generate event for calling on channel open init in x-call
105104
let sub_message =
106105
on_chan_open_init_submessage(&channel_end, &src_port, &src_channel, &connection_id);
107106

@@ -382,7 +381,6 @@ impl<'a> ValidateChannel for CwIbcCoreContext<'a> {
382381
let module_contract_address =
383382
self.lookup_modules(deps.storage, src_port.as_bytes().to_vec())?;
384383

385-
// Generate event for calling on channel open try in x-call
386384
let sub_message =
387385
on_chan_open_ack_submessage(&channel_end, &src_port, &src_channel, &connection_id)?;
388386

@@ -493,7 +491,7 @@ impl<'a> ValidateChannel for CwIbcCoreContext<'a> {
493491
let client = self.get_light_client(deps.as_ref().storage, &client_id)?;
494492
client.verify_channel(deps.as_ref(), verify_channel_state)?;
495493

496-
channel_end.set_state(State::Open); // State Change
494+
channel_end.set_state(State::Open);
497495
self.store_channel_end(deps.storage, &dest_port, &dest_channel, &channel_end)?;
498496
self.store_channel_commitment(deps.storage, &dest_port, &dest_channel, &channel_end)?;
499497
let event = create_channel_event(
@@ -502,10 +500,9 @@ impl<'a> ValidateChannel for CwIbcCoreContext<'a> {
502500
dest_channel.as_str(),
503501
&channel_end,
504502
)?;
505-
// Getting the module address for on channel open try call
503+
506504
let contract_address = self.lookup_modules(deps.storage, dest_port.as_bytes().to_vec())?;
507505

508-
// Generate event for calling on channel open try in x-call
509506
let sub_message = on_chan_open_confirm_submessage(&channel_end, &dest_port, &dest_channel)?;
510507

511508
let data =

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

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub use common::ibc::core::ics04_channel::channel::Counterparty;
1414
use common::ibc::core::ics04_channel::channel::Order;
1515
pub use common::ibc::core::ics04_channel::channel::State;
1616
use common::ibc::core::ics04_channel::error::{ChannelError, PacketError};
17-
//pub use common::ibc::core::ics04_channel::events::*;
1817

1918
use common::ibc::events::IbcEventType;
2019
use cosmwasm_std::Event;

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

-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ impl<'a> CwIbcCoreContext<'a> {
142142
cw_println!(deps, "before packet already received ");
143143

144144
let port_id = packet.destination_port.clone();
145-
// Getting the module address for on packet timeout call
146145
let contract_address = self.lookup_modules(deps.storage, port_id.as_bytes().to_vec())?;
147146

148147
let src = CwEndPoint {

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

-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ impl<'a> CwIbcCoreContext<'a> {
145145
next_seq_recv_verification_result,
146146
)?;
147147

148-
// Getting the module address for on packet timeout call
149148
let contract_address = self.lookup_modules(deps.storage, src_port.as_bytes().to_vec())?;
150149

151150
let src = CwEndPoint {

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

-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ impl<'a> CwIbcCoreContext<'a> {
172172
self.store_channel_end(deps.storage, &src_port, &src_channel, &channel_end)?;
173173
}
174174

175-
// Getting the module address for on packet timeout call
176175
let contract_address = self.lookup_modules(deps.storage, src_port.as_bytes().to_vec())?;
177176

178177
let src = CwEndPoint {

contracts/cosmwasm-vm/cw-ibc-core/src/ics05_port/port.rs

-58
Original file line numberDiff line numberDiff line change
@@ -64,64 +64,6 @@ impl<'a> CwIbcCoreContext<'a> {
6464
.save(store, port_id, &module_id)?)
6565
}
6666

67-
/// This function looks up a module ID based on a given channel message and port ID.
68-
///
69-
/// Arguments:
70-
///
71-
/// * `store`: `store` is a mutable reference to a trait object of type `Storage`. It is used to
72-
/// interact with the storage of the smart contract.
73-
/// * `msg`: A reference to a ChannelMsg enum, which represents different types of messages that can
74-
/// be sent over a channel in the Cosmos SDK.
75-
///
76-
/// Returns:
77-
///
78-
/// a `Result` with either a `ModuleId` or a `ContractError`.
79-
// pub fn lookup_module_channel(
80-
// &self,
81-
// store: &mut dyn Storage,
82-
// msg: &ChannelMsg,
83-
// ) -> Result<ModuleId, ContractError> {
84-
// let port_id = match msg {
85-
// ChannelMsg::OpenInit(msg) => &msg.port_id_on_a,
86-
// ChannelMsg::OpenTry(msg) => &msg.port_id_on_b,
87-
// ChannelMsg::OpenAck(msg) => &msg.port_id_on_a,
88-
// ChannelMsg::OpenConfirm(msg) => &msg.port_id_on_b,
89-
// ChannelMsg::CloseInit(msg) => &msg.port_id_on_a,
90-
// ChannelMsg::CloseConfirm(msg) => &msg.port_id_on_b,
91-
// };
92-
// let module_id = self.lookup_module_by_port(store, port_id)?;
93-
// Ok(module_id)
94-
// }
95-
96-
/// This function looks up a module ID based on a packet message and a storage object.
97-
///
98-
/// Arguments:
99-
///
100-
/// * `store`: A mutable reference to a trait object of type `Storage`. This is likely an interface
101-
/// for interacting with some kind of storage system, such as a database or a key-value store.
102-
/// * `msg`: `msg` is a reference to a `PacketMsg` enum, which represents different types of
103-
/// messages that can be sent or received over a packet-based communication protocol. The function
104-
/// uses this parameter to determine which port ID to use when looking up the corresponding module
105-
/// ID.
106-
///
107-
/// Returns:
108-
///
109-
/// a `Result` containing either a `ModuleId` or a `ContractError`.
110-
// pub fn lookup_module_packet(
111-
// &self,
112-
// store: &mut dyn Storage,
113-
// msg: &PacketMsg,
114-
// ) -> Result<ModuleId, ContractError> {
115-
// let port_id = match msg {
116-
// PacketMsg::Recv(msg) => &msg.packet.port_id_on_b,
117-
// PacketMsg::Ack(msg) => &msg.packet.port_id_on_a,
118-
// PacketMsg::Timeout(msg) => &msg.packet.port_id_on_a,
119-
// PacketMsg::TimeoutOnClose(msg) => &msg.packet.port_id_on_a,
120-
// };
121-
// let module_id = self.lookup_module_by_port(store, &port_id.clone())?;
122-
// Ok(module_id)
123-
// }
124-
12567
/// This function binds a port to a given address and returns a response with relevant attributes.
12668
///
12769
/// Arguments:

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn test_claim_capability() {
5757
.store_capability(&mut deps.storage, name.clone(), address)
5858
.unwrap();
5959
let result = contract.claim_capability(&mut deps.storage, name, address_to_claim);
60-
// only one address to one port
60+
6161
assert!(result.is_err());
6262
}
6363

contracts/cosmwasm-vm/cw-xcall-ibc-connection/tests/test_admin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn update_admin() {
104104
contract
105105
.add_admin(
106106
mock_deps.as_mut().storage,
107-
mock_info.clone(),
107+
mock_info,
108108
admin_one().to_string(),
109109
)
110110
.unwrap();
@@ -144,7 +144,7 @@ fn update_existing_admin() {
144144
contract
145145
.add_admin(
146146
mock_deps.as_mut().storage,
147-
mock_info.clone(),
147+
mock_info,
148148
admin_one().to_string(),
149149
)
150150
.unwrap();

0 commit comments

Comments
 (0)