Skip to content

Commit ee446c8

Browse files
committed
Remove IbcQuery::ListChannels and ListChannelsResponse
1 parent fcbd69f commit ee446c8

File tree

4 files changed

+7
-76
lines changed

4 files changed

+7
-76
lines changed
Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
type PortIDQuery struct {
22
}
33

4-
// ListChannelsQuery is an IBCQuery that lists all channels that are bound to a given port.
5-
// If `PortID` is unset, this list all channels bound to the contract's port.
6-
// Returns a `ListChannelsResponse`.
7-
// This is the counterpart of [IbcQuery::ListChannels](https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/packages/std/src/ibc.rs#L70-L73).
8-
type ListChannelsQuery struct {
9-
// optional argument
10-
PortID string `json:"port_id,omitempty"`
11-
}
12-
134
type ChannelQuery struct {
145
ChannelID string `json:"channel_id"`
156
// optional argument
@@ -24,7 +15,6 @@ type FeeEnabledChannelQuery struct {
2415
// This is the counterpart of [IbcQuery](https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/packages/std/src/ibc.rs#L61-L83).
2516
type IBCQuery struct {
2617
PortID *PortIDQuery `json:"port_id,omitempty"`
27-
ListChannels *ListChannelsQuery `json:"list_channels,omitempty"`
2818
Channel *ChannelQuery `json:"channel,omitempty"`
2919
FeeEnabledChannel *FeeEnabledChannelQuery `json:"fee_enabled_channel,omitempty"`
3020
}

packages/std/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ pub use crate::query::{
9595
CustomQuery, DecCoin, Delegation, DelegationResponse, DelegationRewardsResponse,
9696
DelegationTotalRewardsResponse, DelegatorReward, DelegatorValidatorsResponse,
9797
DelegatorWithdrawAddressResponse, DenomMetadataResponse, DistributionQuery,
98-
FeeEnabledChannelResponse, FullDelegation, GrpcQuery, IbcQuery, ListChannelsResponse,
99-
PortIdResponse, QueryRequest, StakingQuery, SupplyResponse, Validator, ValidatorResponse,
100-
WasmQuery,
98+
FeeEnabledChannelResponse, FullDelegation, GrpcQuery, IbcQuery, PortIdResponse, QueryRequest,
99+
StakingQuery, SupplyResponse, Validator, ValidatorResponse, WasmQuery,
101100
};
102101
#[cfg(all(feature = "stargate", feature = "cosmwasm_1_2"))]
103102
pub use crate::results::WeightedVoteOption;

packages/std/src/query/ibc.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ pub enum IbcQuery {
1515
///
1616
/// Returns a `PortIdResponse`.
1717
PortId {},
18-
/// Lists all channels that are bound to a given port.
19-
/// If `port_id` is omitted, this list all channels bound to the contract's port.
20-
///
21-
/// Returns a `ListChannelsResponse`.
22-
#[deprecated = "Returns a potentially unbound number of results. If you think you have a valid usecase, please open an issue."]
23-
ListChannels { port_id: Option<String> },
18+
//
19+
// ListChannels was removed in CosmWasm 3 due to potentially unbound number of results.
20+
// See https://github.com/CosmWasm/cosmwasm/issues/2223
21+
//
2422
/// Lists all information for a (portID, channelID) pair.
2523
/// If port_id is omitted, it will default to the contract's own channel.
2624
/// (To save a PortId{} call)
@@ -50,14 +48,6 @@ pub struct PortIdResponse {
5048

5149
impl_response_constructor!(PortIdResponse, port_id: String);
5250

53-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
54-
#[non_exhaustive]
55-
pub struct ListChannelsResponse {
56-
pub channels: Vec<IbcChannel>,
57-
}
58-
59-
impl_response_constructor!(ListChannelsResponse, channels: Vec<IbcChannel>);
60-
6151
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
6252
#[non_exhaustive]
6353
pub struct ChannelResponse {

packages/std/src/testing/mock.rs

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use crate::{
4646
};
4747
use crate::{Attribute, DenomMetadata};
4848
#[cfg(feature = "stargate")]
49-
use crate::{ChannelResponse, IbcQuery, ListChannelsResponse, PortIdResponse};
49+
use crate::{ChannelResponse, IbcQuery, PortIdResponse};
5050
#[cfg(feature = "cosmwasm_1_4")]
5151
use crate::{Decimal256, DelegationRewardsResponse, DelegatorValidatorsResponse};
5252
use crate::{RecoverPubkeyError, StdError, StdResult, SystemError, VerificationError};
@@ -1102,20 +1102,6 @@ impl IbcQuerier {
11021102
let res = ChannelResponse { channel };
11031103
to_json_binary(&res).into()
11041104
}
1105-
#[allow(deprecated)]
1106-
IbcQuery::ListChannels { port_id } => {
1107-
let channels = self
1108-
.channels
1109-
.iter()
1110-
.filter(|c| match port_id {
1111-
Some(p) => c.endpoint.port_id.eq(p),
1112-
None => c.endpoint.port_id == self.port_id,
1113-
})
1114-
.cloned()
1115-
.collect();
1116-
let res = ListChannelsResponse { channels };
1117-
to_json_binary(&res).into()
1118-
}
11191105
IbcQuery::PortId {} => {
11201106
let res = PortIdResponse {
11211107
port_id: self.port_id.clone(),
@@ -2434,40 +2420,6 @@ mod tests {
24342420
assert_eq!(chan.channel, None);
24352421
}
24362422

2437-
#[cfg(feature = "stargate")]
2438-
#[test]
2439-
#[allow(deprecated)]
2440-
fn ibc_querier_channels_matching() {
2441-
let chan1 = mock_ibc_channel("channel-0", IbcOrder::Ordered, "ibc");
2442-
let chan2 = mock_ibc_channel("channel-1", IbcOrder::Ordered, "ibc");
2443-
2444-
let ibc = IbcQuerier::new("myport", &[chan1.clone(), chan2.clone()]);
2445-
2446-
// query channels matching "my_port" (should match both above)
2447-
let query = &IbcQuery::ListChannels {
2448-
port_id: Some("my_port".to_string()),
2449-
};
2450-
let raw = ibc.query(query).unwrap().unwrap();
2451-
let res: ListChannelsResponse = from_json(raw).unwrap();
2452-
assert_eq!(res.channels, vec![chan1, chan2]);
2453-
}
2454-
2455-
#[cfg(feature = "stargate")]
2456-
#[test]
2457-
#[allow(deprecated)]
2458-
fn ibc_querier_channels_no_matching() {
2459-
let chan1 = mock_ibc_channel("channel-0", IbcOrder::Ordered, "ibc");
2460-
let chan2 = mock_ibc_channel("channel-1", IbcOrder::Ordered, "ibc");
2461-
2462-
let ibc = IbcQuerier::new("myport", &[chan1, chan2]);
2463-
2464-
// query channels matching "myport" (should be none)
2465-
let query = &IbcQuery::ListChannels { port_id: None };
2466-
let raw = ibc.query(query).unwrap().unwrap();
2467-
let res: ListChannelsResponse = from_json(raw).unwrap();
2468-
assert_eq!(res.channels, vec![]);
2469-
}
2470-
24712423
#[cfg(feature = "stargate")]
24722424
#[test]
24732425
fn ibc_querier_port() {

0 commit comments

Comments
 (0)