Skip to content

Conversation

jonatack
Copy link
Member

and rename BCLog::BLOCKSTORE to BLOCKSTORAGE so the enum is the same as its value like the other BCLog enums.

Per discussion in bitcoin-core-dev IRC today from https://bitcoin-irc.chaincode.com/bitcoin-core-dev/2023-05-11#921458.

@DrahtBot
Copy link
Contributor

DrahtBot commented May 11, 2023

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

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK ryanofsky, pinheadmz, achow101
Concept ACK jamesob
Stale ACK vasild

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #27231 (Fix logging RPC and -debugexclude with 0/none values, add test coverage, improve docs by jonatack)
  • #26697 (logging: use bitset for categories by LarryRuane)
  • #10102 (Multiprocess bitcoin by ryanofsky)

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.

@jamesob
Copy link
Contributor

jamesob commented May 12, 2023

Concept ACK; trying to -debug= a nonexistent category bit me earlier today.

Copy link
Contributor

@vasild vasild left a comment

Choose a reason for hiding this comment

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

ACK b9935a4

Copy link
Contributor

@vasild vasild left a comment

Choose a reason for hiding this comment

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

ACK 9c74c94

ryanofsky pushed a commit to ryanofsky/bitcoin that referenced this pull request May 24, 2023
A minimal (but hacky) way to add support for void to Result
originally posted bitcoin#27632 (comment)
fanquake added a commit to bitcoin-core/gui that referenced this pull request May 26, 2023
…al_str>` with `util::Result`

8aa8f73 refactor: Replace std::optional<bilingual_str> with util::Result (Ryan Ofsky)
5f49cb1 util: Add void support to util::Result (MarcoFalke)

Pull request description:

  Replace uses of `std::optional<bilingual_str>` with `util::Result` as suggested bitcoin/bitcoin#25648 (comment), bitcoin/bitcoin#27632 (comment), bitcoin/bitcoin#27632 (comment), bitcoin/bitcoin#24313 (comment)

ACKs for top commit:
  MarcoFalke:
    very nice ACK 8aa8f73 🏏
  TheCharlatan:
    ACK 8aa8f73
  hebasto:
    ACK 8aa8f73, I have reviewed the code and it looks OK.

Tree-SHA512: 6c2f218bc445184ce93ec2b907e61666a05f26f2c9447f69fcb504aa8291b0c693d913f659dfd19813a9e24615546c72cbe2ca419218fd867ff0694c4a1b6a30
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 26, 2023
… with `util::Result`

8aa8f73 refactor: Replace std::optional<bilingual_str> with util::Result (Ryan Ofsky)
5f49cb1 util: Add void support to util::Result (MarcoFalke)

Pull request description:

  Replace uses of `std::optional<bilingual_str>` with `util::Result` as suggested bitcoin#25648 (comment), bitcoin#27632 (comment), bitcoin#27632 (comment), bitcoin#24313 (comment)

ACKs for top commit:
  MarcoFalke:
    very nice ACK 8aa8f73 🏏
  TheCharlatan:
    ACK 8aa8f73
  hebasto:
    ACK 8aa8f73, I have reviewed the code and it looks OK.

Tree-SHA512: 6c2f218bc445184ce93ec2b907e61666a05f26f2c9447f69fcb504aa8291b0c693d913f659dfd19813a9e24615546c72cbe2ca419218fd867ff0694c4a1b6a30
@jonatack jonatack force-pushed the 2023-05-raise-on-invalid-debug-and-loglevel-options branch from 9c74c94 to 1a27bec Compare May 31, 2023 14:39
@jonatack
Copy link
Member Author

jonatack commented Jun 1, 2023

Thank you for the review feedback, @MarcoFalke; addressed, and rebased to current master containing 5f49cb1 (#25977) to use Result with support for <void>. Invalidates previous ACK by @vasild (thanks!)

@achow101
Copy link
Member

achow101 commented Jun 1, 2023

ACK 1a27bec

@DrahtBot DrahtBot requested a review from vasild June 1, 2023 20:20
@pinheadmz pinheadmz self-requested a review June 2, 2023 00:18
Copy link
Member

@pinheadmz pinheadmz left a comment

Choose a reason for hiding this comment

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

ACK 1a27bec

Reviewed code and ran tests locally. Confirmed expected behavior locally with regtest:

--> bcd -regtest -debug=poop
Error: Unsupported logging category -debug=poop
--> bcd -regtest -loglevel=poop
Error: Unsupported global logging level -loglevel=poop. Valid values: info, debug, trace.

Just had a question about workflow/testing below, not a deal breaker.

Show Signature
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

ACK 1a27bec1e9e40166d6ff7f0492115107289e7609
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE5hdzzW4BBA4vG9eM5+KYS2KJyToFAmR6GCQACgkQ5+KYS2KJ
yTr3SQ//W1BkYnevdAkPaNkqd4/k3ELtP5bPb8FY7Xx3HSMBAvE3u5vntGJXD3he
RV82mitdMgoa7qMDT4OktsRGcHRmukPWSJAZWiON2rFkreoZhx7JoDnfokw2Lz01
xDWuO32filsW72EKtJNpc3i5X8GjHrGL1kUIlKL/bfrRPo2iJISB07h3Tg9b2g2K
dKQABPKjoAOWgDUIl2M7LEzyyIwfx5jHfmvGZ1GoKTbLVJ3NHZ+0OjxJJrI3jfjM
voqeKs1NDrcnVM+0ahIqBu42RTF8r48gWGnDCnTV/BnmMCsr3zNhmjmHO7hP39No
hbiJLMn5jsTvrpkoAQzSrexysbO8JwqXjGrh2x9J7A6EPGLIQ7eiB31nthMjUI8x
Fxh5+7YcWoJtb8SH/6NUKvL8688Y2uQrIA2x4uSfS1RvtoshUjfxqXi3C8VSnfHM
dd2K5YosxXYWHukK7ohh/Dr0//g8BLw3C1pesso77kRLpNgyf1u/iqONeuV4CI1O
U6Q1US6OMxBQZ8xNhkGARGCB3UU0l9InxsUAjlkx/LbBPTeMGqyVZcr68dzArYTH
UVQQYhYuxFQffVB/45H4wBtVtQIERa+jiWOQz1OSiiLCA9qQ1cBxv6D/VXpOj9+w
MiLxr+T7oOjqRyjQSXQzwKHRudavjdLC7C3eyJe5HIYxyeQcTgs=
=OynM
-----END PGP SIGNATURE-----

pinheadmz's public key is on keybase

Copy link
Contributor

@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.

Code review ACK 1a27bec. I left a review comment about this adding some argument names to translated strings, which is bad but already happens other places, so it might not be very important to fix.

I do think it would be good if this PR added release notes, because the changes are not backwards compatible and will probably break some existing configurations or misconfigurations.

It also looks like this has had enough code review to be ready to merge. @jonatack you could respond and say if you'd prefer to merge this as-is or make more updates.

@jonatack jonatack force-pushed the 2023-05-raise-on-invalid-debug-and-loglevel-options branch from 1a27bec to a341b29 Compare June 13, 2023 21:15
@jonatack
Copy link
Member Author

jonatack commented Jun 13, 2023

Updated with @ryanofsky's review feedback (thanks!) -- the CI failures look unrelated and perhaps require rebasing to current master (edit: done).

@jonatack jonatack force-pushed the 2023-05-raise-on-invalid-debug-and-loglevel-options branch from a341b29 to 02756cb Compare June 13, 2023 22:39
@jonatack jonatack mentioned this pull request Jun 14, 2023
@jonatack
Copy link
Member Author

jonatack commented Jun 14, 2023

Updated with translation string simplifications and improvements and a release note per @ryanofsky and @MarcoFalke feedback and rebased for the CI. Diff since the previous ACKs: git range-diff 681ecac 1a27bec 8bbfeec

@jonatack jonatack force-pushed the 2023-05-raise-on-invalid-debug-and-loglevel-options branch from 245f44d to 8bbfeec Compare June 14, 2023 14:32
Copy link
Contributor

@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.

Code review ACK 8bbfeec. Looks great! Changes since last review are keeping option names out of translated strings, and adding a release note

@DrahtBot DrahtBot requested review from achow101 and pinheadmz June 15, 2023 15:56
@jonatack jonatack force-pushed the 2023-05-raise-on-invalid-debug-and-loglevel-options branch from 8bbfeec to daa5a65 Compare June 15, 2023 16:29
@jonatack
Copy link
Member Author

jonatack commented Jun 15, 2023

Updated to incorporate @ryanofsky's #27632 (comment) to use format strings in 6cb1c66 to drop a redundant translation argument and remove ambiguity about which of the two arguments a translator is supposed to use (thanks!)

Copy link
Contributor

@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.

Code review ACK daa5a65. Just translated string template cleanup since last review

Copy link
Member

@pinheadmz pinheadmz 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 daa5a65

Confirmed trivial change since last review with
git range-diff 681ecac5c2 daa5a658c0 1a27bec1e9
rebuilt and reran tests as well

Show Signature
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

ACK daa5a658c0e79172e4dea0758246f11281790d29
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE5hdzzW4BBA4vG9eM5+KYS2KJyToFAmSR2uUACgkQ5+KYS2KJ
yTqrdhAAve71Ldk9R/7TcK8NDh8p797syW3+rJfSNV6nb3TYcjMl57iOiYIEVHer
kIqDadhGOMPmw0mKHUqoaAkNgI5E6hJLWx4FWBTbtlUmGAKCwqfD30AmFMqjF4GL
6F+GuexZYMTxc2v0Y0KoXUagXwPGwUaP/NTMgsBkhpBLEQKTdGc8kVpxPLPwEDTa
hxdYl5GgHcYcMT4XkT26RzQMFswIhlmM4XszygIUVmg6JExcllRbaUjVMAAtTouk
lEeFjtTYitWyNwvbeUYr02mh75IncHf6x50CJdVNfHEVEEEfV4utzPhx6wUs94Ru
d+E4s92V0Ku0trn0tWb276I3LXhIeJ/8ESFXnkLF3DMfT0GLJnx78cxcDa49DBt0
+wCUtyssZ519sBnt+gt7MFYZqIomzkZjUTQ2+G9RJTMv9AW+gcYxHFit40Zb7vkm
DSN0M9v3UB4STeiZsH+gdkgvnmjDZHKROfds8dsEbCzgYs7MHzkmiFerDVXZTlcM
P4T+MQ9O15S4o6gc+65187xc30vtr7DSpsxS1pi5VXDwox9sk6paTB9FU1qxN9hA
ZvLTDqUvjYHd5stC9GzcA+jJF9WjjWslRCaoVVptX2GBO0i2a9DajsvtUUqurFAl
RQYhec4+Q7NiZKJP7jgimNXhlhR7XMHRT1tmJN9jD9m90kFM1Mg=
=EsDp
-----END PGP SIGNATURE-----

pinheadmz's public key is on keybase

@achow101
Copy link
Member

ACK daa5a65

@DrahtBot DrahtBot removed the request for review from achow101 June 20, 2023 17:41
@achow101 achow101 merged commit e4bbfb2 into bitcoin:master Jun 20, 2023
@jonatack jonatack deleted the 2023-05-raise-on-invalid-debug-and-loglevel-options branch June 20, 2023 18:00
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 21, 2023
@Sjors
Copy link
Member

Sjors commented Aug 21, 2023

If you liked this PR, you may also like #27277 :-)

@jonatack
Copy link
Member Author

If you liked this PR, you may also like #27277 :-)

Will have a look.

janus pushed a commit to BitgesellOfficial/bitgesell that referenced this pull request Sep 11, 2023
A minimal (but hacky) way to add support for void to Result
originally posted bitcoin/bitcoin#27632 (comment)
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Dec 15, 2023
Summary:
> Useful to encapsulate the function result object (in case of having it) or, in case of failure, the failure reason.
>
> This let us clean lot of boilerplate code, as now instead of returning a boolean and having to add a ref arg for the
> return object and another ref for the error string. We can simply return a 'BResult<Obj>'.
>
> Example of what we currently have:
> ```
> bool doSomething(arg1, arg2, arg3, arg4, &result, &error_string) {
>     do something...
>     if (error) {
>         error_string = "something bad happened";
>         return false;
>     }
>
>     result = goodResult;
>     return true;
> }
> ```
>
> Example of what we will get with this commit:
> ```
> BResult<Obj> doSomething(arg1, arg2, arg3, arg4) {
>     do something...
>     if (error) return {"something happened"};
>
>     // good
>     return {goodResult};
> }
> ```
>
> This allows a similar boilerplate cleanup on the function callers side as well. They don't have to add the extra
> pre-function-call error string and result object declarations to pass the references to the function.

bitcoin/bitcoin@7a45c33

----

> Prepare BResult for non-copyable types

bitcoin/bitcoin@fa8de09

----

> Refactor: Replace BResult with util::Result
>
> Rename `BResult` class to `util::Result` and update the class interface to be
> more compatible with `std::optional` and with a full-featured result class
> implemented in bitcoin/bitcoin#25665. Motivation for
> this change is to update existing `BResult` usages now so they don't have to
> change later when more features are added in #25665.
>
> This change makes the following improvements originally implemented in #25665:
>
> - More explicit API. Drops potentially misleading `BResult` constructor that
>   treats any bilingual string argument as an error. Adds `util::Error`
>   constructor so it is never ambiguous when a result is being assigned an error
>   or non-error value.
>
> - Better type compatibility. Supports `util::Result<bilingual_str>` return
>   values to hold translated messages which are not errors.
>
> - More standard and consistent API. `util::Result` supports most of the same
>   operators and methods as `std::optional`. `BResult` had a less familiar
>   interface with `HasRes`/`GetObj`/`ReleaseObj` methods. The Result/Res/Obj
>   naming was also not internally consistent.
>
> - Better code organization. Puts `src/util/` code in the `util::` namespace so
>   naming reflects code organization and it is obvious where the class is coming
>   from. Drops "B" from name because it is undocumented what it stands for
>   (bilingual?)
>
> - Has unit tests.

bitcoin/bitcoin@a23cca5

----

> util: Add void support to util::Result
>
> A minimal (but hacky) way to add support for void to Result
> originally posted bitcoin/bitcoin#27632 (comment)

bitcoin/bitcoin@5f49cb1

----

This is a partial backport of [[bitcoin/bitcoin#25218 | core#25218]], [[bitcoin/bitcoin#25594 | core#25594]], [[bitcoin/bitcoin#25721 | core#25721]] and [[bitcoin/bitcoin#25977 | core#25977]]

The wallet use cases in the first 3 pull requests are not yet applicable to Bitcoin ABC due to missing dependencies.
The `std::optional<bilingual_str>` use cases from [[bitcoin/bitcoin#25977 | core#25977]] will be backported in their own diff.

Test Plan: `ninja && ninja check`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14991
@bitcoin bitcoin locked and limited conversation to collaborators Aug 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants