Skip to content

Conversation

@jonatack
Copy link
Member

@jonatack jonatack commented Mar 27, 2020

This PR updates several tests and then removes the getunconfirmedbalance RPC which was deprecated in facfb41 a year ago.

Next steps: remove the deprecated getwalletinfo fields and the getbalance RPC in follow-ups, if there seems to be consensus on those removals.

Update:

getunconfirmedbalance RPC was deprecated in facfb41 a year ago, but following the review comments below, this PR now only updates the test coverage to use getbalances while still leaving basic coverage for getunconfirmedbalance in wallet_balance.py.

That said, I've seen 3 regular contributors confused in the past 10 days by "DEPRECATED" warnings in the code that are not following the deprecation policy in JSON-RPC-interface.md#versioning.

ISTM these warnings should either be removed, or the calls deprecated (-deprecatedrpc), or the policy updated to describe these warnings as a pre-deprecation practice.

@maflcko
Copy link
Member

maflcko commented Mar 27, 2020

Not sure if we should break RPC users because it is convenient for us to delete code

@jonatack
Copy link
Member Author

These were deprecated in the 0.19.0.1 release notes.

- `getbalances` returns an object with all balances (`mine`,
  `untrusted_pending` and `immature`). Please refer to the RPC help of
  `getbalances` for details. The new RPC is intended to replace
  `getbalance`, `getunconfirmedbalance`, and the balance fields in
  `getwalletinfo`.  These old calls and fields may be removed in a
  future version. (#15930, #16239)

Some previous comments on this change:

In any case, it may be a good idea to update the tests.

@maflcko
Copy link
Member

maflcko commented Mar 27, 2020

Yes, they could be (not: must be) removed in the future, but we don't need to be overly aggressive about it when there is no reason to be so. Every API change is going to cause pain for users, encouraging them to not upgrade to the latest version and thus causing harm to everyone involved.

I think they can be removed when 0.19.0 is EOL or at least no longer actively maintained, since at that point we assume that no one is depending on the deprecated API.

I understand an argument for aggressive deprecation and removal when there is a massive maintenance burden (such as wallet accounts) or danger in using the deprecated API, but I don't see any of this apply here.

@jonatack
Copy link
Member Author

Much of the value of this PR (as well as the proposed follow-ups) is in updating the tests, so depending on consensus it can be oriented in that direction as well.

@maflcko
Copy link
Member

maflcko commented Mar 27, 2020

@maflcko
Copy link
Member

maflcko commented Mar 27, 2020

And before removing, it might have to go through a deprecation cycle with -deprecatedrpc according to https://github.com/bitcoin/bitcoin/blob/master/doc/JSON-RPC-interface.md#versioning . I am not going to advocate to start this deprecation cycle now, but I wanted to mention it for completeness.

@jonatack
Copy link
Member Author

Agreed.

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 27, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@sipa
Copy link
Member

sipa commented Mar 28, 2020

I agree we should do a deprecation cycle first (with -deprecatedrpc). I'm neutral on whether we do that now or later. Once we've been through that cycle we should feel fine deleting.

@promag
Copy link
Contributor

promag commented Mar 30, 2020

And before removing, it might have to go through a deprecation cycle with -deprecatedrpc according to https://github.com/bitcoin/bitcoin/blob/master/doc/JSON-RPC-interface.md#versioning . I am not going to advocate to start this deprecation cycle now, but I wanted to mention it for completeness.

Agree, no need to rush here.

jonatack added 3 commits April 5, 2020 19:39
and shift some getunconfirmedbalance calls to getbalances, as the former is
deprecated, while leaving essential coverage for it in test_balances().
@jonatack jonatack force-pushed the remove-deprecated-rpc-getunconfirmedbalance branch from b3afb07 to 0306d78 Compare April 5, 2020 17:43
@jonatack
Copy link
Member Author

jonatack commented Apr 5, 2020

As per the review comments, this PR now only updates the test coverage to use getbalances while still leaving basic coverage for getunconfirmedbalance in wallet_balance.py.

That said, I've seen 3 regular contributors confused in the past 10 days by "DEPRECATED" warnings in the code that are not following the deprecation policy in JSON-RPC-interface.md#versioning.

ISTM these warnings should either be removed, or the calls deprecated (-deprecatedrpc), or the policy updated to describe these warnings as a pre-deprecation practice.

@jonatack jonatack changed the title rpc: remove deprecated getunconfirmedbalance test: shift coverage from getunconfirmedbalance to getbalances Apr 5, 2020
@jnewbery
Copy link
Contributor

jnewbery commented Apr 6, 2020

I think the right thing to do here is to go through a -deprecatedrpc cycle.

@MarcoFalke

I think they can be removed when 0.19.0 is EOL or at least no longer actively maintained, since at that point we assume that no one is depending on the deprecated API.

We can't assume that. Simply writing 'DEPRECATED' in RPC documentation doesn't do anything. No-one who is using that API is going to see that documentation, so they'll continue to use the interface exactly as they have done in the past (and in my experience, even people who do see it don't make any changes to their client behaviour if they don't have to).

I don't think it matters which release we start the -deprecatedrpc cycle in. It's a forcing function to make clients update their code (and gives them at least 6 months to do that).

@jonatack
Copy link
Member Author

jonatack commented Apr 7, 2020

I think the right thing to do here is to go through a -deprecatedrpc cycle.

Simply writing 'DEPRECATED' in RPC documentation doesn't do anything. No-one who is using that API is going to see that documentation, so they'll continue to use the interface exactly as they have done in the past (and in my experience, even people who do see it don't make any changes to their client behaviour if they don't have to).

I don't think it matters which release we start the -deprecatedrpc cycle in. It's a forcing function to make clients update their code (and gives them at least 6 months to do that).

I agree. The test updates in this PR should be done at any rate. Once they are merged, a PR can be opened to begin the deprecation process (or remove the warnings, or update the deprecation documentation if 2-stage soft-then-hard deprecation is the consensus preference).

@jnewbery
Copy link
Contributor

utACK 0306d78

@maflcko maflcko merged commit 6110ae8 into bitcoin:master Apr 13, 2020
@jonatack jonatack deleted the remove-deprecated-rpc-getunconfirmedbalance branch April 13, 2020 22:13
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 13, 2020
…to getbalances

0306d78 Use getbalances in wallet_address_types tests (Jon Atack)
7eacdc5 Shift coverage from getunconfirmedbalance to getbalances in wallet_abandonconflict tests (Jon Atack)
3e6f737 Improve getbalances coverage in wallet_balance tests (Jon Atack)

Pull request description:

  <strike>This PR updates several tests and then removes the `getunconfirmedbalance` RPC which was deprecated in facfb41 a year ago.

  Next steps: remove the deprecated `getwalletinfo` fields and the `getbalance` RPC in follow-ups, if there seems to be consensus on those removals.</strike>

  Update:

  `getunconfirmedbalance` RPC was deprecated in facfb41 a year ago, but following the review comments below, this PR now only updates the test coverage to use `getbalances` while still leaving basic coverage for `getunconfirmedbalance` in wallet_balance.py.

  That said, I've seen 3 regular contributors confused in the past 10 days by "DEPRECATED" warnings in the code that are not following the deprecation policy in [JSON-RPC-interface.md#versioning](https://github.com/bitcoin/bitcoin/blob/master/doc/JSON-RPC-interface.md#versioning).

  ISTM these warnings should either be removed, or the calls deprecated (`-deprecatedrpc`), or the policy updated to describe these warnings as a pre-deprecation practice.

ACKs for top commit:
  jnewbery:
    utACK 0306d78

Tree-SHA512: 692e43e9bed5afa97d905740666e365f0b64e559e1c75a6a398236d9e943894e3477947fc11324f420a6feaffa0c0c1532aa983c50090ca39d06551399e6ddd1
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 15, 2021
Summary:
> Improve getbalances coverage in wallet_balance tests
> and shift some getunconfirmedbalance calls to getbalances, as the former is
> deprecated, while leaving essential coverage for it in test_balances().
>
> Shift coverage from getunconfirmedbalance to getbalances in wallet_abandonconflict tests
>
> Use getbalances in wallet_address_types tests

This is a backport of Core [[bitcoin/bitcoin#18451 | PR18451]]

Test Plan: `test/functional/test_runner.py wallet*`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8927
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants