-
Notifications
You must be signed in to change notification settings - Fork 38.7k
validation: Templatize ValidationState instead of subclassing #17399
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
Conversation
ryanofsky
left a comment
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 aa67e6d736fab1cf125687f3393a3eb259fb8608.
Medium concept ACK. Nice that this eliminates duplicate code. Added #includes and template function might slow down compilation a bit, though.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. |
promag
left a comment
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.
Concept ACK.
|
Concept ACK.
Yes, although this is a quite straightforward use of templates, no boost nested template horrors, so I hope it's not too bad. |
ajtowns
left a comment
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.
Concept ACK
|
Concept ACK. Will review code once @ajtowns's comments are addressed. |
376e209 to
3f2e048
Compare
promag
left a comment
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.
Nice suggestions from @ajtowns!
3f2e048 to
0468628
Compare
|
Concept ACK: new code is easier to reason about |
jnewbery
left a comment
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.
Tested ACK 0468628e8191c574d2568f5e9e7fa15dd43d80f2. Nice tidy up!
One suggestion for getting rid of a now almost-empty file. Can be done in this PR or a follow-up.
promag
left a comment
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 0468628e8191c574d2568f5e9e7fa15dd43d80f2.
Restarted failed job on travis.
0468628 to
2948ebd
Compare
|
utACK 2948ebd |
2948ebd to
1452949
Compare
|
Rebased and updated to account for #17624 in 1452949. |
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 1452949.
About the increase compilation time concern, on my system compare to master it's even a bit slightly slightly faster.
|
ACK 14529499743e071ddc091e5508e1eea4532e754d 🎏 Show signature and timestampSignature: Timestamp of file with hash |
|
utACK 14529499743e071ddc091e5508e1eea4532e754d Since the initialization relies on --- a/src/consensus/validation.h
+++ b/src/consensus/validation.h
@@ -16,7 +16,7 @@
* provider of the transaction should be banned/ignored/disconnected/etc.
*/
enum class TxValidationResult {
- TX_RESULT_UNSET, //!< initial value. Tx has not yet been rejected
+ TX_RESULT_UNSET = 0, //!< initial value. Tx has not yet been rejected. Must be zero/first defined enumerator for default initialization.
TX_CONSENSUS, //!< invalid by consensus rules
/**
* Invalid by a change to consensus rules more recent than SegWit.
@@ -50,7 +50,7 @@ enum class TxValidationResult {
* useful for some other use-cases.
*/
enum class BlockValidationResult {
- BLOCK_RESULT_UNSET, //!< initial value. Block has not yet been rejected
+ BLOCK_RESULT_UNSET = 0, //!< initial value. Block has not yet been rejected. Must be zero/first defined enumerator for default initialization.
BLOCK_CONSENSUS, //!< invalid by consensus rules (excluding any below reasons)
/**
* Invalid by a change to consensus rules more recent than SegWit. |
1452949 to
a975974
Compare
cb77316 to
bf5bc26
Compare
|
code review ACK bf5bc260e914e2413bed4041e5089fdee03a344a |
This removes boilerplate code in the subclasses which otherwise only differ by the result type.
bf5bc26 to
10efc04
Compare
|
ACK 10efc04 🐱 Show signature and timestampSignature: Timestamp of file with hash |
|
ACK 10e85d4 -- patch looks correct |
|
ACK 10efc04 -- looks good to me |
|
ACK 10efc04 code review, build/tests green, nice cleanup |
|
post-merge ACK 10efc04 |
…f subclassing 10efc04 Templatize ValidationState instead of subclassing (Jeffrey Czyz) 10e85d4 Remove ValidationState's constructor (Jeffrey Czyz) 0aed17e Refactor FormatStateMessage into ValidationState (Jeffrey Czyz) Pull request description: This removes boilerplate code in the subclasses which otherwise only differ by the result type. The subclassing was introduced in a27a295. ACKs for top commit: MarcoFalke: ACK 10efc04 🐱 ajtowns: ACK 10efc04 -- looks good to me jonatack: ACK 10efc04 code review, build/tests green, nice cleanup Tree-SHA512: 765dd52dde7d49b9a5c6d99d97c96f4492673e2aed0b0604faa88db0308fa4500a26bf755cca0b896be283874096c215932e1110a2d01dc012cd36a5fce58a42
Summary: Partial backport 1/3 of core [[bitcoin/bitcoin#17399 | PR17399]]: bitcoin/bitcoin@0aed17e Test Plan: ninja all check-all Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D8326
Summary: Partial backport 2/3 of core [[bitcoin/bitcoin#17399 | PR17399]]: bitcoin/bitcoin@10e85d4 Depends on D8326. Test Plan: ninja all check Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D8327
Summary: ``` This removes boilerplate code in the subclasses which otherwise only differ by the result type. ``` Completes backport 3/3 of core [[bitcoin/bitcoin#17399 | PR17399]]: bitcoin/bitcoin@10efc04 Depends on D8327. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Subscribers: majcosta Differential Revision: https://reviews.bitcoinabc.org/D8328
…f subclassing 10efc04 Templatize ValidationState instead of subclassing (Jeffrey Czyz) 10e85d4 Remove ValidationState's constructor (Jeffrey Czyz) 0aed17e Refactor FormatStateMessage into ValidationState (Jeffrey Czyz) Pull request description: This removes boilerplate code in the subclasses which otherwise only differ by the result type. The subclassing was introduced in a27a295. ACKs for top commit: MarcoFalke: ACK 10efc04 🐱 ajtowns: ACK 10efc04 -- looks good to me jonatack: ACK 10efc04 code review, build/tests green, nice cleanup Tree-SHA512: 765dd52dde7d49b9a5c6d99d97c96f4492673e2aed0b0604faa88db0308fa4500a26bf755cca0b896be283874096c215932e1110a2d01dc012cd36a5fce58a42
This removes boilerplate code in the subclasses which otherwise only
differ by the result type.
The subclassing was introduced in a27a295.