-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Drop CAutoFile #28904
Drop CAutoFile #28904
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. 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. |
@@ -30,7 +30,6 @@ | |||
#include <vector> | |||
|
|||
class BlockValidationState; | |||
class CAutoFile; |
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.
nit: in e25bb16: I don't think deleting this is correct, according to iwyu? My understanding is that it may be fine to have a return type in C++ forward declared without including the full header, as long as the function whose return type is forward declared is never called without having the full header. But I could be wrong?
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.
It's not buggy, because blockstorage.h includes dbwrapper.h which includes streams.h; but I think it should just be including streams.h directly, and that seems to be what iwyu is recommending?
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 know it isn't buggy, but it seems fragile to rely on dbwrapper
having the include. iwyu used to be happy with a fwd decl, so maybe just keep it as-is?
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.
A fwd decl should be enough, see also https://godbolt.org/z/7Txqjrh8e, unless I am missing something?
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 don't think you're missing anything; but I don't really see the point of including a fwd declaration when that's not enough to be able to use the function, especially when the full header's already included indirectly? The tidy job says:
+#include "flatfile.h"
+#include "streams.h"
+#include "uint256.h"
which seems reasonable to me? When I run iwyu locally, it also seems to suggest primitives/block.h (rather than class CBlock
), which is already included via chain.h anyway, so seems fine.
I've just pushed an update that gets closer to what iwyu suggests.
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.
The tidy job says:
For reference, on master it doesn't say that. See for example https://cirrus-ci.com/task/5754375344226304 (https://api.cirrus-ci.com/v1/task/5754375344226304/logs/ci.log):
The full include-list for node/blockstorage.h:
#include <attributes.h> // for LIFETIMEBOUND
#include <chain.h> // for CBlockFileInfo, CBlockIndex
#include <dbwrapper.h> // for CDBWrapper
#include <kernel/blockmanager_opts.h> // for BlockManagerOpts
#include <kernel/chainparams.h> // for CChainParams
#include <kernel/cs_main.h> // for cs_main
#include <kernel/messagestartchars.h> // for MessageStartChars
#include <stddef.h> // for size_t
#include <sync.h> // for EXCLUSIVE_LOCKS_REQUIRED, GUARDED_BY, RecursiveMutex
#include <util/fs.h> // for path
#include <util/hasher.h> // for BlockHasher
#include <algorithm> // for max
#include <array> // for array, tuple_size_v
#include <atomic> // for atomic, atomic_bool
#include <cstdint> // for uint64_t, uint8_t
#include <functional> // for function
#include <iosfwd> // for ostream
#include <limits> // for numeric_limits
#include <map> // for multimap
#include <memory> // for unique_ptr
#include <optional> // for optional, nullopt
#include <set> // for set
#include <string> // for string, hash
#include <unordered_map> // for unordered_map
#include <utility> // for move, pair
#include <vector> // for vector
#include "flatfile.h" // for FlatFilePos (ptr only), FlatFileSeq
#include "uint256.h" // for uint256, operator==
class BlockValidationState; // lines 32-32
class CAutoFile; // lines 33-33
class CBlock; // lines 34-34
class CBlockHeader;
class CBlockUndo; // lines 35-35
class Chainstate; // lines 37-37
class ChainstateManager; // lines 38-38
namespace Consensus { struct Params; } // lines 42-42
namespace util { class SignalInterrupt; } // lines 45-45
Anyway, it is just a style nit and anything that compiles should be fine here.
@@ -55,7 +55,7 @@ static void LoadExternalBlockFile(benchmark::Bench& bench) | |||
bench.run([&] { | |||
// "rb" is "binary, O_RDONLY", positioned to the start of the file. | |||
// The file will be closed by LoadExternalBlockFile(). | |||
CAutoFile file{fsbridge::fopen(blkfile, "rb"), CLIENT_VERSION}; | |||
AutoFile file{fsbridge::fopen(blkfile, "rb")}; | |||
testing_setup->m_node.chainman->LoadExternalBlockFile(file, &pos, &blocks_with_unknown_parent); |
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.
nit: This is related to the blockmanager commit, so could just squash 8a8d9d0 into the previous commit?
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
ACK 6b70cf7 🚾
Show signature
Signature:
untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: ACK 6b70cf77b5beda5bd25246aefed2633410d4126f 🚾
9vtH9miHsZeyTpMvrJOhEJfjd/q6MlP9nJvViqeqkdhzvUvH5m1DR9I/+rVIopqsS4/EIsnuNZognM5WPJ0ODw==
Also bump includes per suggestions from iwyu.
6b70cf7
to
4eb2a9e
Compare
re-ACK 4eb2a9e 🖼 Show signatureSignature:
|
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 4eb2a9e
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 4eb2a9e
Looks like a nice cleanup, but I'm not familiar with the history of |
serialization flags embedded in the version-integer and type-integer are gone, serialization now uses params-serialization, so the ser-version and ser-type code can be deleted. |
Continuing the move away from
GetVersion()
, replace uses ofCAutoFile
withAutoFile
.