Skip to content

Commit 66c3370

Browse files
authored
chore: Add deprecation mark (#2247)
1 parent 9f623aa commit 66c3370

File tree

14 files changed

+27
-0
lines changed

14 files changed

+27
-0
lines changed

contracts/burner/src/contract.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub fn instantiate(
1919
#[entry_point]
2020
pub fn migrate(deps: DepsMut, env: Env, msg: MigrateMsg) -> StdResult<Response> {
2121
// get balance and send all to recipient
22+
#[allow(deprecated)]
2223
let balance = deps.querier.query_all_balances(env.contract.address)?;
2324
let send = BankMsg::Send {
2425
to_address: msg.payout.clone(),

contracts/hackatom/src/contract.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ fn do_release(deps: DepsMut, env: Env, info: MessageInfo) -> Result<Response, Ha
102102

103103
if info.sender == state.verifier {
104104
let to_addr = state.beneficiary;
105+
#[allow(deprecated)]
105106
let balance = deps.querier.query_all_balances(env.contract.address)?;
106107

107108
let resp = Response::new()
@@ -268,6 +269,7 @@ fn query_verifier(deps: Deps) -> StdResult<VerifierResponse> {
268269
})
269270
}
270271

272+
#[allow(deprecated)]
271273
fn query_other_balance(deps: Deps, address: String) -> StdResult<AllBalanceResponse> {
272274
deps.querier
273275
.query(&BankQuery::AllBalances { address }.into())

contracts/ibc-reflect/src/contract.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ pub fn ibc_channel_close(
220220
remove_account(deps.storage, channel_id);
221221

222222
// transfer current balance if any (steal the money)
223+
#[allow(deprecated)]
223224
let amount = deps.querier.query_all_balances(&reflect_addr)?;
224225
let messages: Vec<SubMsg<Empty>> = if !amount.is_empty() {
225226
let bank_msg = BankMsg::Send {
@@ -303,6 +304,7 @@ fn receive_who_am_i(deps: DepsMut, caller: String) -> StdResult<IbcReceiveRespon
303304
// processes PacketMsg::Balances variant
304305
fn receive_balances(deps: DepsMut, caller: String) -> StdResult<IbcReceiveResponse> {
305306
let account = load_account(deps.storage, &caller)?;
307+
#[allow(deprecated)]
306308
let balances = deps.querier.query_all_balances(&account)?;
307309
let response = BalancesResponse {
308310
account: account.into(),
@@ -656,6 +658,7 @@ mod tests {
656658
let raw = query(deps.as_ref(), mock_env(), QueryMsg::ListAccounts {}).unwrap();
657659
let res: ListAccountsResponse = from_json(raw).unwrap();
658660
assert_eq!(1, res.accounts.len());
661+
#[allow(deprecated)]
659662
let balance = deps.as_ref().querier.query_all_balances(&account).unwrap();
660663
assert_eq!(funds, balance);
661664

contracts/reflect/schema/raw/query.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@
163163
},
164164
{
165165
"description": "This calls into the native bank module for all denominations. Note that this may be much more expensive than Balance and should be avoided if possible. Return value is AllBalanceResponse.",
166+
"deprecated": true,
166167
"type": "object",
167168
"required": [
168169
"all_balances"
@@ -375,6 +376,7 @@
375376
},
376377
{
377378
"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`.",
379+
"deprecated": true,
378380
"type": "object",
379381
"required": [
380382
"list_channels"

contracts/reflect/schema/reflect.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,7 @@
14231423
},
14241424
{
14251425
"description": "This calls into the native bank module for all denominations. Note that this may be much more expensive than Balance and should be avoided if possible. Return value is AllBalanceResponse.",
1426+
"deprecated": true,
14261427
"type": "object",
14271428
"required": [
14281429
"all_balances"
@@ -1635,6 +1636,7 @@
16351636
},
16361637
{
16371638
"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`.",
1639+
"deprecated": true,
16381640
"type": "object",
16391641
"required": [
16401642
"list_channels"

contracts/reflect/src/contract.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ mod tests {
385385
let deps = mock_dependencies_with_custom_querier(&coins(123, "ucosm"));
386386

387387
// with bank query
388+
#[allow(deprecated)]
388389
let msg = QueryMsg::Chain {
389390
request: BankQuery::AllBalances {
390391
address: MOCK_CONTRACT_ADDR.to_string(),

packages/std/src/query/bank.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub enum BankQuery {
2525
/// This calls into the native bank module for all denominations.
2626
/// Note that this may be much more expensive than Balance and should be avoided if possible.
2727
/// Return value is AllBalanceResponse.
28+
#[deprecated = "Returns a potentially unbound number of results. If you think you have a valid usecase, please open an issue."]
2829
AllBalances { address: String },
2930
/// This calls into the native bank module for querying metadata for a specific bank token.
3031
/// Return value is DenomMetadataResponse

packages/std/src/query/ibc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub enum IbcQuery {
1919
/// If `port_id` is omitted, this list all channels bound to the contract's port.
2020
///
2121
/// Returns a `ListChannelsResponse`.
22+
#[deprecated = "Returns a potentially unbound number of results. If you think you have a valid usecase, please open an issue."]
2223
ListChannels { port_id: Option<String> },
2324
/// Lists all information for a (portID, channelID) pair.
2425
/// If port_id is omitted, it will default to the contract's own channel.

packages/std/src/testing/mock.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ impl BankQuerier {
825825
};
826826
to_json_binary(&bank_res).into()
827827
}
828+
#[allow(deprecated)]
828829
BankQuery::AllBalances { address } => {
829830
// proper error on not found, serialize result on found
830831
let bank_res = AllBalanceResponse {
@@ -936,6 +937,7 @@ impl IbcQuerier {
936937
let res = ChannelResponse { channel };
937938
to_json_binary(&res).into()
938939
}
940+
#[allow(deprecated)]
939941
IbcQuery::ListChannels { port_id } => {
940942
let channels = self
941943
.channels
@@ -1868,6 +1870,7 @@ mod tests {
18681870
}
18691871

18701872
#[test]
1873+
#[allow(deprecated)]
18711874
fn bank_querier_all_balances() {
18721875
let addr = String::from("foobar");
18731876
let balance = vec![coin(123, "ELF"), coin(777, "FLY")];
@@ -1911,6 +1914,7 @@ mod tests {
19111914
}
19121915

19131916
#[test]
1917+
#[allow(deprecated)]
19141918
fn bank_querier_missing_account() {
19151919
let addr = String::from("foobar");
19161920
let balance = vec![coin(123, "ELF"), coin(777, "FLY")];
@@ -2217,6 +2221,7 @@ mod tests {
22172221

22182222
#[cfg(feature = "stargate")]
22192223
#[test]
2224+
#[allow(deprecated)]
22202225
fn ibc_querier_channels_matching() {
22212226
let chan1 = mock_ibc_channel("channel-0", IbcOrder::Ordered, "ibc");
22222227
let chan2 = mock_ibc_channel("channel-1", IbcOrder::Ordered, "ibc");
@@ -2234,6 +2239,7 @@ mod tests {
22342239

22352240
#[cfg(feature = "stargate")]
22362241
#[test]
2242+
#[allow(deprecated)]
22372243
fn ibc_querier_channels_no_matching() {
22382244
let chan1 = mock_ibc_channel("channel-0", IbcOrder::Ordered, "ibc");
22392245
let chan2 = mock_ibc_channel("channel-1", IbcOrder::Ordered, "ibc");

packages/std/src/traits.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,9 @@ impl<'a, C: CustomQuery> QuerierWrapper<'a, C> {
420420
Ok(res.amount)
421421
}
422422

423+
#[deprecated]
423424
pub fn query_all_balances(&self, address: impl Into<String>) -> StdResult<Vec<Coin>> {
425+
#[allow(deprecated)]
424426
let request = BankQuery::AllBalances {
425427
address: address.into(),
426428
}
@@ -706,6 +708,7 @@ mod tests {
706708
let balance = wrapper.query_balance("foo", "ELF").unwrap();
707709
assert_eq!(balance, coin(123, "ELF"));
708710

711+
#[allow(deprecated)]
709712
let all_balances = wrapper.query_all_balances("foo").unwrap();
710713
assert_eq!(all_balances, vec![coin(123, "ELF"), coin(777, "FLY")]);
711714
}

0 commit comments

Comments
 (0)