From a4f48d1c7633f98b1069d70fe0475d5b894d2f6e Mon Sep 17 00:00:00 2001 From: swelf Date: Thu, 11 Jul 2024 12:59:38 +0300 Subject: [PATCH] removed misleading comments --- .../neutron_interchain_txs/src/contract.rs | 31 +------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 662325b1..c3a2fd19 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -405,25 +405,18 @@ fn sudo_response(deps: DepsMut, request: RequestPacket, data: Binary) -> StdResu .as_str(), ); - // WARNING: RETURNING THIS ERROR CLOSES THE CHANNEL. - // AN ALTERNATIVE IS TO MAINTAIN AN ERRORS QUEUE AND PUT THE FAILED REQUEST THERE - // FOR LATER INSPECTION. // In this particular case, we return an error because not having the sequence id // in the request value implies that a fatal error occurred on Neutron side. let seq_id = request .sequence .ok_or_else(|| StdError::generic_err("sequence not found"))?; - // WARNING: RETURNING THIS ERROR CLOSES THE CHANNEL. - // AN ALTERNATIVE IS TO MAINTAIN AN ERRORS QUEUE AND PUT THE FAILED REQUEST THERE - // FOR LATER INSPECTION. // In this particular case, we return an error because not having the sequence id // in the request value implies that a fatal error occurred on Neutron side. let channel_id = request .source_channel .ok_or_else(|| StdError::generic_err("channel_id not found"))?; - // NOTE: NO ERROR IS RETURNED HERE. THE CHANNEL LIVES ON. // In this particular example, this is a matter of developer's choice. Not being able to read // the payload here means that there was a problem with the contract while submitting an // interchain transaction. You can decide that this is not worth killing the channel, @@ -440,9 +433,6 @@ fn sudo_response(deps: DepsMut, request: RequestPacket, data: Binary) -> StdResu deps.api .debug(format!("WASMDEBUG: sudo_response: sudo payload: {:?}", payload).as_str()); - // WARNING: RETURNING THIS ERROR CLOSES THE CHANNEL. - // AN ALTERNATIVE IS TO MAINTAIN AN ERRORS QUEUE AND PUT THE FAILED REQUEST THERE - // FOR LATER INSPECTION. // In this particular case, we return an error because not being able to parse this data // that a fatal error occurred on Neutron side, or that the remote chain sent us unexpected data. // Both cases require immediate attention. @@ -454,14 +444,10 @@ fn sudo_response(deps: DepsMut, request: RequestPacket, data: Binary) -> StdResu item_types.push(item_type.to_string()); match item_type { "/cosmos.staking.v1beta1.MsgUndelegate" => { - // WARNING: RETURNING THIS ERROR CLOSES THE CHANNEL. - // AN ALTERNATIVE IS TO MAINTAIN AN ERRORS QUEUE AND PUT THE FAILED REQUEST THERE - // FOR LATER INSPECTION. // In this particular case, a mismatch between the string message type and the // serialised data layout looks like a fatal error that has to be investigated. let out: MsgUndelegateResponse = decode_message_response(&item.value)?; - // NOTE: NO ERROR IS RETURNED HERE. THE CHANNEL LIVES ON. // In this particular case, we demonstrate that minor errors should not // close the channel, and should be treated in a forgiving manner. let completion_time = out.completion_time.or_else(|| { @@ -475,9 +461,6 @@ fn sudo_response(deps: DepsMut, request: RequestPacket, data: Binary) -> StdResu .debug(format!("Undelegation completion time: {:?}", completion_time).as_str()); } "/cosmos.staking.v1beta1.MsgDelegateResponse" => { - // WARNING: RETURNING THIS ERROR CLOSES THE CHANNEL. - // AN ALTERNATIVE IS TO MAINTAIN AN ERRORS QUEUE AND PUT THE FAILED REQUEST THERE - // FOR LATER INSPECTION. // In this particular case, a mismatch between the string message type and the // serialised data layout looks like a fatal error that has to be investigated. let _out: MsgDelegateResponse = decode_message_response(&item.value)?; @@ -515,18 +498,12 @@ fn sudo_timeout(deps: DepsMut, _env: Env, request: RequestPacket) -> StdResult StdResult StdResu deps.api .debug(format!("WASMDEBUG: request packet: {:?}", request).as_str()); - // WARNING: RETURNING THIS ERROR CLOSES THE CHANNEL. - // AN ALTERNATIVE IS TO MAINTAIN AN ERRORS QUEUE AND PUT THE FAILED REQUEST THERE - // FOR LATER INSPECTION. + // In this particular case, we return an error because not having the sequence id // in the request value implies that a fatal error occurred on Neutron side. let seq_id = request .sequence .ok_or_else(|| StdError::generic_err("sequence not found"))?; - // WARNING: RETURNING THIS ERROR CLOSES THE CHANNEL. - // AN ALTERNATIVE IS TO MAINTAIN AN ERRORS QUEUE AND PUT THE FAILED REQUEST THERE - // FOR LATER INSPECTION. // In this particular case, we return an error because not having the sequence id // in the request value implies that a fatal error occurred on Neutron side. let channel_id = request