-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Raise on invalid -debug and -loglevel config options #27632
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
Raise on invalid -debug and -loglevel config options #27632
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, 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. |
Concept ACK; trying to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK b9935a4
b9935a4
to
9c74c94
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 9c74c94
A minimal (but hacky) way to add support for void to Result originally posted bitcoin#27632 (comment)
…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
… 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
9c74c94
to
1a27bec
Compare
Thank you for the review feedback, @MarcoFalke; addressed, and rebased to current master containing |
ACK 1a27bec |
There was a problem hiding this 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
There was a problem hiding this 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.
1a27bec
to
a341b29
Compare
Updated with @ryanofsky's review feedback (thanks!) -- the CI failures look unrelated and perhaps require rebasing to current master (edit: done). |
a341b29
to
02756cb
Compare
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: |
245f44d
to
8bbfeec
Compare
There was a problem hiding this 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
so the enum name is the same as its value, like the other BCLog enums.
8bbfeec
to
daa5a65
Compare
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!) |
There was a problem hiding this 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
There was a problem hiding this 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
ACK daa5a65 |
If you liked this PR, you may also like #27277 :-) |
Will have a look. |
A minimal (but hacky) way to add support for void to Result originally posted bitcoin/bitcoin#27632 (comment)
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
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.