-
Notifications
You must be signed in to change notification settings - Fork 245
Final tidy #7515
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
Final tidy #7515
Conversation
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.
Pull request overview
This PR performs comprehensive clang-tidy cleanup following PR #7508. The key changes include:
- Critical fix: Corrected commit secret derivation in
ledger_secret.hto use the full label instead of only 8 characters (though noted as having no security consequence in current usage) - API improvement: Changed HMAC API to accept
std::spaninstead ofstd::vectorfor better flexibility - Code quality improvements: Applied extensive clang-tidy suggestions including proper initialization, const correctness, [[nodiscard]] attributes, simplified control flow, and modern C++ idioms
Reviewed changes
Copilot reviewed 72 out of 72 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/node/ledger_secret.h | Fixed commit secret label usage (critical bug fix) and changed to use std::span |
| src/crypto/hmac.cpp | Updated HMAC implementation to accept std::span parameters |
| include/ccf/crypto/hmac.h | Changed HMAC API signature from vector to span |
| doc/build_apps/crypto.rst | Updated documentation to reflect new HMAC signature |
| .clang-tidy | Simplified HeaderFilterRegex pattern |
| src/node/*.h | Applied clang-tidy cleanups: initialization, const correctness, [[nodiscard]], std::move() |
| src/kv/*.h | Applied similar cleanups to KV store components |
| src/js/*.h | Applied cleanups to JavaScript integration components |
| Multiple other files | Extensive cleanup including: default member initialization, simplified else-after-return, range-based loops, proper casting, override specifiers |
eddyashton
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.
I've skimmed this up and down and side-to-side a few times until my eyes glaze over, and it "looks good to me" (for fuzzy values of "looks", "good", and "me"). Hurrah for never thinking about tidy ever again!
Follow up to #7508 and hopefully last round of cleanups for clang-tidy.
This turned up an unfortunate and embarrassing mistake in the commit evidence derivation (
ledger_secret.h), where we only use the first 8 characters of the label. This is luckily of no security consequence, since we only use this one derivation at the moment, but I have added comments to highlight this if we ever add more.Contains a very small adjustment in the public hmac API (vector to span) that I claim is small enough no to warrant a changelog entry (it is API compatible for all plausible API usage).