Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interfaces: Describe and follow some code conventions #18278

Merged
merged 6 commits into from Mar 23, 2020

Conversation

ryanofsky
Copy link
Contributor

@ryanofsky ryanofsky commented Mar 6, 2020

This PR is part of the process separation project.

This PR doesn't change behavior at all, it just cleans up code in src/interfaces to simplify #10102, and documents coding conventions there better

@hebasto
Copy link
Member

hebasto commented Mar 6, 2020

Concept ACK.

@ryanofsky ryanofsky force-pushed the pr/ipc-conv branch 2 times, most recently from 671f390 to 2427e93 Compare March 6, 2020 15:21
@practicalswift
Copy link
Contributor

Concept ACK

On behalf of the eternal stream of future generations of Bitcoin Core developers: thank you for cleaning up the code base :)

Copy link
Member

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 2427e93.

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 6, 2020

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@ryanofsky
Copy link
Contributor Author

Rebased 2427e93 -> 60ae4c0 (pr/ipc-conv.3 -> pr/ipc-conv.4, compare) due to conflict with #18241

@ryanofsky ryanofsky mentioned this pull request Mar 6, 2020
Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 60ae4c0.

It seems AppVeyor fail is unrelated to this PR changes.

src/interfaces/chain.h Show resolved Hide resolved
@@ -204,7 +204,7 @@ class Node
virtual std::unique_ptr<Wallet> loadWallet(const std::string& name, std::string& error, std::vector<std::string>& warnings) = 0;

//! Create a wallet from file
virtual WalletCreationStatus createWallet(const SecureString& passphrase, uint64_t wallet_creation_flags, const std::string& name, std::string& error, std::vector<std::string>& warnings, std::unique_ptr<Wallet>& result) = 0;
virtual std::unique_ptr<Wallet> createWallet(const SecureString& passphrase, uint64_t wallet_creation_flags, const std::string& name, std::string& error, std::vector<std::string>& warnings, WalletCreationStatus& status) = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: considering a new signature of the refactored function could a more appropriate semantically name be chosen?
newWallet or smth similar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #18278 (comment)

nit: considering a new signature of the refactored function could a more appropriate semantically name be chosen?
newWallet or smth similar?

Unclear why that name is more semantically appropriate, but not knowing this, it seems reasonable for the interface wrapper method name to have the same name as the function it is wrapping

Copy link
Contributor Author

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for review

Updated 60ae4c0 -> 43c3b39 (pr/ipc-conv.4 -> pr/ipc-conv.5, compare) adding suggested wrapping

src/interfaces/chain.h Show resolved Hide resolved
@@ -204,7 +204,7 @@ class Node
virtual std::unique_ptr<Wallet> loadWallet(const std::string& name, std::string& error, std::vector<std::string>& warnings) = 0;

//! Create a wallet from file
virtual WalletCreationStatus createWallet(const SecureString& passphrase, uint64_t wallet_creation_flags, const std::string& name, std::string& error, std::vector<std::string>& warnings, std::unique_ptr<Wallet>& result) = 0;
virtual std::unique_ptr<Wallet> createWallet(const SecureString& passphrase, uint64_t wallet_creation_flags, const std::string& name, std::string& error, std::vector<std::string>& warnings, WalletCreationStatus& status) = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #18278 (comment)

nit: considering a new signature of the refactored function could a more appropriate semantically name be chosen?
newWallet or smth similar?

Unclear why that name is more semantically appropriate, but not knowing this, it seems reasonable for the interface wrapper method name to have the same name as the function it is wrapping

@ryanofsky
Copy link
Contributor Author

Rebased 43c3b39 -> 25f1a84 (pr/ipc-conv.5 -> pr/ipc-conv.6, compare) due to confilct with #18115

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK 25f1a84

Replace by privateKeysDisabled method to avoid need for GUI to reference
internal wallet flags.

Also remove adjacent WalletModel canGetAddresses wrapper that serves no purpose
and make Wallet::canGetAddresses non-const so it can be implemented by IPC
classes in bitcoin#10102.
Avoid overloading method name to work more easily with IPC framework
…ther interfaces methods

This also simplifies bitcoin#10102 removing overrides needed to deal with inconsistent
case convention
Make output argument last argument so it works more easily with IPC framework
in bitcoin#10102, and for consistency with other methods
Move output arguments after input arguments for consistency with other methods,
and to work more easily with IPC framework in bitcoin#10102
@ryanofsky
Copy link
Contributor Author

Rebased 25f1a84 -> 3dc27a1 (pr/ipc-conv.6 -> pr/ipc-conv.7, compare) due to conflict with #17477

@hebasto
Copy link
Member

hebasto commented Mar 23, 2020

re-ACK 3dc27a1, the only change since the previous review is rebasing.

@maflcko
Copy link
Member

maflcko commented Mar 23, 2020

ACK 3dc27a1 🕍

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

ACK 3dc27a15242a22b5301904375e5880372e9b7f4d 🕍
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgv6Qv+N5ucWCeIaDagqqWUUjRwyJrTq8kr9yZWzQIsZ9zBbrnaxsr106m6Gc8T
NEmKSbDdgLK+oXFFDRYmO7kvVib0hUoVcfZfq42vSEfqg5mMBKUG6DFAGseKh0Fg
LdsvKuczDSeb/L52uIrdQe/ptzpjCqJvHHiScn7SoOidAiyjFWwdhOtBwV7oRuF9
UgGD10K5O7hy70rmn9JOG7GPI1T5NYG2ZgAy7w2n2ChBNeNv9mSse/pDKOgrbhS8
97Fsl5P+SQq2Fi3aQDLBRd5/sj2nu0BpoKCoowJsRHE4GOeAngdZI6f1EOpYLamH
s91MQOTXMgN3VFvhnKSNSVesNmMbvGs4aCyLSXQvPh4ni7jpwjpPf7czl3IItn0L
KnrgUg7uVquxU2FXOvRaVmKo1/PvicrhWYp2Vh8QN06yi91ALoqUqiWHBkdKiwN6
KoAfUKas0Xn+xgg4h+RKNYh5SFLjNEzResi9+ED5KfDW+sjFR9vzElOHiEf/u+Lb
F661+ybw
=ipNG
-----END PGP SIGNATURE-----

Timestamp of file with hash a78b9d76a84ed28d935046f7fd167bda964ff54cc7339f5435a9c7c3e22c90ed -

@maflcko maflcko merged commit ac579ad into bitcoin:master Mar 23, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 28, 2020
…tions

3dc27a1 doc: Add internal interface conventions to developer notes (Russell Yanofsky)
1dca9dc refactor: Change createWallet, fillPSBT argument order (Russell Yanofsky)
96dfe5c refactor: Change Chain::broadcastTransaction param order (Russell Yanofsky)
6ceb219 refactor: Rename Chain::Notifications methods to be consistent with other interfaces methods (Russell Yanofsky)
1c2ab1a refactor: Rename Node::disconnect methods (Russell Yanofsky)
77e4b06 refactor: Get rid of Wallet::IsWalletFlagSet method (Russell Yanofsky)

Pull request description:

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10).

  This PR doesn't change behavior at all, it just cleans up code in [`src/interfaces`](https://github.com/bitcoin/bitcoin/tree/master/src/interfaces) to simplify bitcoin#10102, and [documents](https://github.com/ryanofsky/bitcoin/blob/pr/ipc-conv/doc/developer-notes.md#internal-interface-guidelines) coding conventions there better

ACKs for top commit:
  hebasto:
    re-ACK 3dc27a1, the only change since the [previous](bitcoin#18278 (review)) review is rebasing.
  MarcoFalke:
    ACK 3dc27a1 🕍

Tree-SHA512: 62e6a0f2488e3924e559d2074ed460b92e7a0a5d98eab492221cb20d59d04bbe32aef2a8aeba5e4ea9168cfa91acd5bc973dce6677be0180bd7a919354df53ed
@ryanofsky ryanofsky moved this from In progress to Done in Process Separation Apr 10, 2020
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 21, 2020
Summary:
Replace by privateKeysDisabled method to avoid need for GUI to reference
internal wallet flags.

Also remove adjacent WalletModel canGetAddresses wrapper that serves no purpose
and make Wallet::canGetAddresses non-const so it can be implemented by IPC
classes in #10102.

Backport of Core [[bitcoin/bitcoin#18278 | PR18278]] part [1/6] : bitcoin/bitcoin@77e4b06

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8019
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 21, 2020
Summary:
Avoid overloading method name to work more easily with IPC framework

Backport of Core [[bitcoin/bitcoin#18278 | PR18278]] part [2/6] : bitcoin/bitcoin@1c2ab1a

Depends on D8019

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8020
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 21, 2020
…ther interfaces methods

Summary:
This also simplifies #10102 removing overrides needed to deal with inconsistent
case convention

Backport of Core [[bitcoin/bitcoin#18278 | PR18278]] part [3/6] : bitcoin/bitcoin@6ceb219

Depends on D8020

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8021
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 21, 2020
Summary:
Make output argument last argument so it works more easily with IPC framework
in #10102, and for consistency with other methods

Backport of Core [[bitcoin/bitcoin#18278 | PR18278]] part [4/6] : bitcoin/bitcoin@96dfe5c

Depends on D8021

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8022
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 21, 2020
Summary:
Move output arguments after input arguments for consistency with other methods,
and to work more easily with IPC framework in #10102

Backport of Core [[bitcoin/bitcoin#18278 | PR18278]] part [5/6] : bitcoin/bitcoin@1dca9dc

Depends on D8022

The Qt part of PSBT has not been ported so it is absent from this patch. This shouldn't be a problem, because it is a compilation error and trivial to fix, so it can be don then.

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8023
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 21, 2020
Summary:
Backport of Core [[bitcoin/bitcoin#18278 | PR18278]] part [6/6] : bitcoin/bitcoin@3dc27a1

Depends on D8023

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8024
@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
Development

Successfully merging this pull request may close these issues.

None yet

7 participants