Skip to content

Conversation

@jonatack
Copy link
Member

@jonatack jonatack commented Apr 12, 2022

  1. Fix lockpair in-param passing in EvaluateSequenceLocks() and other tidy-ups:

  2. add consensus/tx_verify.{h,cpp} to the iwyu (include what you use) CI checks, along with missing include headers to satisfy the checks

  3. apply clang-format to consensus/tx_verify.{h,cpp}

Copy link
Contributor

@w0xlt w0xlt left a comment

Choose a reason for hiding this comment

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

ACK e6dde9a

But why is the first commit (0b095dd) necessary ?

@jonatack
Copy link
Member Author

Thanks @w0xlt! If your question is why are they considered to be missing, see doc/developer-notes.md:

- Every `.cpp` and `.h` file should `#include` every header file it directly uses classes, functions or other
  definitions from, even if those headers are already included indirectly through other headers.

  - *Rationale*: Excluding headers because they are already indirectly included results in compilation
    failures when those indirect dependencies change. Furthermore, it obscures what the real code
    dependencies are.

@w0xlt
Copy link
Contributor

w0xlt commented Apr 12, 2022

@jonatack Thanks for the explanation.

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 12, 2022

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #24567 (Enforce BIP 68 from genesis by MarcoFalke)

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.

@luke-jr
Copy link
Member

luke-jr commented Apr 13, 2022

This is basically just formatting changes? Confused by calling it "fixups" - does it fix anything?

@jonatack
Copy link
Member Author

It seemed like a good description for missing headers and how lockPair is passed; the last one is formatting.

@maflcko
Copy link
Member

maflcko commented Apr 13, 2022

I find the include ones hard to review and there doesn't seem to be any benefit absent a report that compilation fails. If this is something we want to do, it might be better done via #24831. Otherwise we'll have daily pulls to "fix" the includes, remove random ones and add random ones without affecting the resulting binary and only causing merge conflicts.

@jonatack
Copy link
Member Author

jonatack commented Apr 15, 2022

This has enough review for merge? See #24740 for a similar recent example.

(#24831 is a POC/draft; if it were to be merged at some point, we would still need to review the changes and this reduces the burden as that has already been done here.)

(If you disagree, please LMK how best to proceed most productively.)

@fanquake
Copy link
Member

and this reduces the burden as that has already been done here.

This would still need to be touched again, as the includes fixups are not comprehensive. i.e: <cassert> and <cstdint> are missing, among others.

@maflcko
Copy link
Member

maflcko commented Apr 15, 2022

This has enough review for merge? See #24740 for a similar recent example.

#24740 actually fixed an incorrect comment, whereas this pull doesn't fix anything that is wrong?

I don't have a strong opinion, but I still think we should first try iwyu and defer to it instead of doing it with manual review work. In the meantime it might be best to not touch the include stuff unless there is a reproducible compile error.

@fanquake
Copy link
Member

Not sure what to do here. 0b095dd52e846ae7c228bf52144d3470c34b00da should probably either be updated to add all the missing includes, so we don't have to touch them again for IWYU, or be dropped. Besides that, as others have commented, it's not clear what is being fixed, given nothing seems to be broken, so maybe wordings can be improved.

@jonatack jonatack changed the title refactor: consensus/tx_verify.{h,cpp} fixups refactor: consensus/tx_verify.{h,cpp} tidy-ups Apr 21, 2022
@jonatack jonatack force-pushed the consensus-tx_verify-fixups branch from e6dde9a to 5972ba4 Compare April 21, 2022 14:25
@jonatack
Copy link
Member Author

Sorry for not updating sooner. Added a cassert include to the cpp file and renamed the pull and second commit from fixups to tidy-ups. Happy to drop the first commit if preferred.

@jonatack jonatack force-pushed the consensus-tx_verify-fixups branch from 5972ba4 to 16e9e1b Compare May 6, 2022 15:57
@jonatack
Copy link
Member Author

jonatack commented May 6, 2022

Rebased.

@jonatack jonatack force-pushed the consensus-tx_verify-fixups branch from 16e9e1b to 585dd50 Compare June 27, 2022 11:15
@jonatack
Copy link
Member Author

Squashed the three commits down to one.

@fanquake
Copy link
Member

This now contains unrelated changes. Looks like from a rebase.

@jonatack
Copy link
Member Author

Thanks, which changes? I verified that a rebase to master would be clean but didn't rebase.

@fanquake
Copy link
Member

Ah, don't worry, looks like it's just a GitHub bug.

@jonatack
Copy link
Member Author

Cool. Happy to drop some of the diff if people prefer.

@jonatack jonatack force-pushed the consensus-tx_verify-fixups branch from 585dd50 to cce8fbd Compare June 27, 2022 12:59
1. Fix lockpair in-param passing in EvaluateSequenceLocks() and other tidy-ups:

  - pass lockPair by reference to const instead of by value, per
    https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-in

  - make nBlockTime const

  - rename lockPair to lock_pair

  - rename nBlockTime to block_time

  - add brackets to conditional

2. add missing include headers to consensus/tx_verify.{h,cpp} and
   add the files to the iwyu (include what you use) CI checks

3. apply clang-format to consensus/tx_verify.{h,cpp}
@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".

@achow101
Copy link
Member

Closing this as it has not had any activity in a while. If you are interested in continuing work on this, please leave a comment so that it can be reopened.

@achow101 achow101 closed this Oct 12, 2022
@bitcoin bitcoin locked and limited conversation to collaborators Oct 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants