Skip to content

Conversation

fjahr
Copy link
Contributor

@fjahr fjahr commented Jul 20, 2025

This contains four commits from #28792 that can be easily reviewed and merged independently. I hope splitting this change off can make this part move a bit faster and reduce frequency of needed rebases for #28792.

The commits in order:

  • Add additional unit test vectors to the asmap interpreter (written by sipa). This helps to ensure that the further refactors in Embed default ASMap as binary dump header file #28792 don't change behavior.
  • Modernizes the logging in util/asmap.cpp, I added this while touching the rest of the file all over anyway.
  • Fixes the behavior of the GetPathArg function when an path arg is given "1" (for example -asmap=1), which would be interpreted as a path but should be interpreted as using the are without a parameter which activates the fallback. There is no explicit test added here because this is tested implicitly in the tests added in Embed default ASMap as binary dump header file #28792.
  • Adds an AutoFile::size helper function

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 20, 2025

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

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33026.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK sipa, achow101
Stale ACK nervana21

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #31868 ([IBD] specialize block serialization by l0rinc)
  • #29641 (scripted-diff: Use LogInfo over LogPrintf [WIP, NOMERGE, DRAFT] by maflcko)
  • #28792 (Embed default ASMap as binary dump header file by fjahr)

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.

@nervana21
Copy link
Contributor

tACK 942d95d

I thoroughly reviewed and understood all code changes. I ran the tests locally and they all passed.

fanquake added a commit that referenced this pull request Jul 24, 2025
b59dc21 doc: Fix typos in asmap README (nervana21)

Pull request description:

  This minor PR fixes some spelling mistakes found while reviewing #33026.

ACKs for top commit:
  fanquake:
    ACK b59dc21

Tree-SHA512: e76f7f97c10f3e506d024da0cbf804f4975cf07f31f0dd0abad6fcb97a5fa1032087459dba46de3715f6275d47e2fde4d8db3d38341540110d87fd5669855359
@@ -273,7 +273,7 @@ fs::path ArgsManager::GetPathArg(std::string arg, const fs::path& default_value)
{
if (IsArgNegated(arg)) return fs::path{};
std::string path_str = GetArg(arg, "");
if (path_str.empty()) return default_value;
if (path_str.empty() || path_str == "1") return default_value;
Copy link
Member

Choose a reason for hiding this comment

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

In 74932c6: Seems a bit awkaward to add an (undocumented) special case here for asmap? Can't we just fail if the value given isn't a valid path, or stop supporting this behaviour? cc @ryanofsky

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can drop this is other reviewers agree that it's confusing. I personally think this is the more intuitive behavior for path args independently of asmap because our bool args all work with both -foo and -foo=1 afaik. If the user wants to use -asmap (or any path arg) as a bool then I think they would expect it to work the same as the other bool params. Fwiw, I discovered this because I wrote a functional test that covered -asmap=1 and I actually expected it work, only after it didn't I added this.

Copy link
Member

@sipa sipa left a comment

Choose a reason for hiding this comment

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

utACK 734737b

@achow101
Copy link
Member

ACK 734737b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants