Skip to content

Conversation

@jnewbery
Copy link
Contributor

generate_wif_key is a wallet utility function. Move it from the EC key module to the wallet util module.

This fixes the circular dependency issue in #17977

jnewbery added 3 commits June 10, 2020 11:54
generate_wif_key is a wallet utility function. Move
it from the EC key module to the wallet util module.
@jnewbery
Copy link
Contributor Author

requesting review from @laanwj and @MarcoFalke

@maflcko
Copy link
Member

maflcko commented Jun 10, 2020

Concept ACK on moving wif to wallet_util, but it was simply not clear to me that base58 is not allowed to be moved into its own module. I think in the past we had more issues due to files being used for too much (main.cpp, util.cpp, ...) than files being used for too little. The question might be stylistic, so I will refrain from having an opinion. I am fine with keeping base58 in a separate module or moving it back.

@DrahtBot DrahtBot added the Tests label Jun 10, 2020
@sipa
Copy link
Member

sipa commented Jun 10, 2020

ACK on moving the wif key functions elsewhere.

I don't understand what the problem is with base58 being its own module, though. It's used by both addresses and wifs, so it doesn't logically belong in an address module imho.

@promag
Copy link
Contributor

promag commented Jun 10, 2020

ACK with or without revert commit.

@DrahtBot
Copy link
Contributor

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.

@maflcko
Copy link
Member

maflcko commented Jun 11, 2020

ACK, checked that the base58 import is removed from key.py. Still no opinion on whether base58 should be its own module, but the diff here has minimal risk of breaking anything. With two ACKs without commit hash (presumably Concept ACKS?), this seems good to merge.

ACK 3a83a01 🍪

git diff e380818~2 e380818 # Empty diff
git show b216b0b --color-moved=dimmed-zebra # Sort only
git show 3a83a01 --color-moved=dimmed-zebra # move-only, but I also checked that the base58 import is removed from key.py

Show signature and timestamp

Signature:

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

ACK 3a83a01694160f2e722e1bc90a328bd569b8e109 🍪

git diff e38081846d889fcbbbc6ca4a4d3bca26807fde2f~2 e38081846d889fcbbbc6ca4a4d3bca26807fde2f  # Empty diff
git show b216b0b71f7853d747af8b712fc250c699f3c320 --color-moved=dimmed-zebra  # Sort only
git show 3a83a01694160f2e722e1bc90a328bd569b8e109 --color-moved=dimmed-zebra  # move-only, but I also checked that the base58 import is removed from key.py
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUhfigwAhrV4/KY2hjqXWg1UJZEpP3Oz4KWQNfOPfbS0WwtB+VYz0SASnrq/IYW4
wa1oY38GAfKfB87z+++AmTjuwCogIB3/ECoZo8kwDpX+xdT6TaDOK36avpOf9AfN
XJ9rijDz/7mcBgrgiXjhLPtDITLL5WP11lJwznEZnlPuQ2xCCDLsDHOHHR3v3+ev
2v5BA7oSw5Z57UULWFOFQQG+yW4lraMo5QlbCP+qE8eQnMOp0hoFg3E0l/9Wp9sL
4SNp83nxz1TZqQoQ6Fztp6EBaDwnr6MqT7ozd5GcKYNU5QhYCiMq8F04tL9QlH3K
St/2lKJ89vaAtb8wEIX4heRc/nqDW/XZNDZmabTsUaxGUeSuccyLQWFQsV1EeTiY
NEq1EVaVqEyIEcFCo9LC9GEIDMF9OtynEuvZ8UW4oYX29QRJGlLiVMXlwIyC2v2e
s8Qew3steCB8A365aieTTnQ17npDauJiXrziW308U2PeyC+0+SDBHOiQ969M45f3
CI2MxfgZ
=GPz1
-----END PGP SIGNATURE-----

Timestamp of file with hash 76d45088bfafa8e8052c083456bfaa4b4070774a3659dbdbb4b426b5da10df55 -

@maflcko maflcko merged commit 85f7db2 into bitcoin:master Jun 11, 2020
@jnewbery
Copy link
Contributor Author

I don't understand what the problem is with base58 being its own module

No problem, but I think ideally base58, bech32 and higher abstract level address functionality could all exist in the same module with no issues. base58 is used almost nowhere apart from addresses (wallet import format is the one exception I can think of) and similarly for bech32. There's already confusion between the different modules (why is encode(), which encodes a segwit address in segwit_addr.py, but program_to_witness(), which encodes a witness program to an address in address.py? Why are ADDRESS_BCRT1_UNSPENDABLE, etc in address.py when they're segwit addresses?)

@maflcko
Copy link
Member

maflcko commented Jun 11, 2020

Generally, as long as we don't have a guideline of how the test framework classes should be structured into modules, I consider the specifics to be of stylistic nature. (Stylistic specifics are completely up to the author of the commit to decide on. Stylistic feedback may be accepted from reviewers, but it is also valid to simply reject stylistic feedback)

I wouldn't mind merging address and segwit_addr into one module or whatever else is decided to be done. Though, as long as there is no guideline, we shouldn't classify changes concerning modularization as right vs. wrong.

@jnewbery jnewbery deleted the 2020-06-generate-wif-key branch June 11, 2020 18:07
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 11, 2020
3a83a01 [tests] move generate_wif_key to wallet_util.py (John Newbery)
b216b0b [tests] sort imports in rpc_createmultisig.py (John Newbery)
e380818 Revert "[TESTS] Move base58 to own module to break circular dependency" (John Newbery)

Pull request description:

  generate_wif_key is a wallet utility function. Move it from the EC key module to the wallet util module.

  This fixes the circular dependency issue in bitcoin#17977

ACKs for top commit:
  MarcoFalke:
    ACK 3a83a01 🍪

Tree-SHA512: 24985dffb75202721ccc0c6c5b52f1fa5d1ce7963bccde24389feb913cab4dad0c265274ca67892c46c8b64e6a065a0f23263a89be4fb9134dfefbdbe5c7238a
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Aug 25, 2021
Summary:
generate_wif_key is a wallet utility function. Move
it from the EC key module to the wallet util module.

This is a backport of [[bitcoin/bitcoin#19239 | core#19239]]

Backport note: the revert commit is not relevant, we haven't backported [[bitcoin/bitcoin#19230 | core#19230]]

Test Plan: `ninja check-functional-extended`

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants