Skip to content

Commit 18fb77c

Browse files
authored
Merge pull request #2466 from CosmWasm/rm-ListChannels
Remove IbcQuery::ListChannels and ListChannelsResponse
2 parents fcbd69f + 888b984 commit 18fb77c

File tree

7 files changed

+10
-122
lines changed

7 files changed

+10
-122
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ and this project adheres to
7373
- cosmwasm-std: Remove support for `BankQuery::AllBalances` and
7474
`query_all_balances`. ([#2433])
7575
- cosmwasm-std: source_client instead of channel_id in IBCv2 - ([#2450])
76+
- cosmwasm-std: Remove previously deprecated `IbcQuery::ListChannels` and
77+
`ListChannelsResponse`. ([#2223])
7678

7779
## Fixed
7880

@@ -86,6 +88,7 @@ and this project adheres to
8688
[#2156]: https://github.com/CosmWasm/cosmwasm/issues/2156
8789
[#2195]: https://github.com/CosmWasm/cosmwasm/issues/2195
8890
[#2201]: https://github.com/CosmWasm/cosmwasm/issues/2201
91+
[#2223]: https://github.com/CosmWasm/cosmwasm/issues/2223
8992
[#2237]: https://github.com/CosmWasm/cosmwasm/issues/2237
9093
[#2262]: https://github.com/CosmWasm/cosmwasm/issues/2262
9194
[#2268]: https://github.com/CosmWasm/cosmwasm/issues/2268

contracts/reflect/schema/raw/query.json

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -351,29 +351,6 @@
351351
},
352352
"additionalProperties": false
353353
},
354-
{
355-
"description": "Lists all channels that are bound to a given port. If `port_id` is omitted, this list all channels bound to the contract's port.\n\nReturns a `ListChannelsResponse`.",
356-
"deprecated": true,
357-
"type": "object",
358-
"required": [
359-
"list_channels"
360-
],
361-
"properties": {
362-
"list_channels": {
363-
"type": "object",
364-
"properties": {
365-
"port_id": {
366-
"type": [
367-
"string",
368-
"null"
369-
]
370-
}
371-
},
372-
"additionalProperties": false
373-
}
374-
},
375-
"additionalProperties": false
376-
},
377354
{
378355
"description": "Lists all information for a (portID, channelID) pair. If port_id is omitted, it will default to the contract's own channel. (To save a PortId{} call)\n\nReturns a `ChannelResponse`.",
379356
"type": "object",

contracts/reflect/schema/reflect.json

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,29 +1611,6 @@
16111611
},
16121612
"additionalProperties": false
16131613
},
1614-
{
1615-
"description": "Lists all channels that are bound to a given port. If `port_id` is omitted, this list all channels bound to the contract's port.\n\nReturns a `ListChannelsResponse`.",
1616-
"deprecated": true,
1617-
"type": "object",
1618-
"required": [
1619-
"list_channels"
1620-
],
1621-
"properties": {
1622-
"list_channels": {
1623-
"type": "object",
1624-
"properties": {
1625-
"port_id": {
1626-
"type": [
1627-
"string",
1628-
"null"
1629-
]
1630-
}
1631-
},
1632-
"additionalProperties": false
1633-
}
1634-
},
1635-
"additionalProperties": false
1636-
},
16371614
{
16381615
"description": "Lists all information for a (portID, channelID) pair. If port_id is omitted, it will default to the contract's own channel. (To save a PortId{} call)\n\nReturns a `ChannelResponse`.",
16391616
"type": "object",
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)