test: Cover 64-bit flatfile position boundaries #36860

pull john-lawniczak wants to merge 1 commits into bitcoin:master from john-lawniczak:pr/flatfile-boundaries changing 1 files +77 −0
  1. john-lawniczak commented at 5:37 PM on November 13, 2026: none

    This adds regression tests for the 64-bit file positions introduced by bitcoin/bitcoin#36669. Existing flatfile tests use small offsets. The VARINT overflow tests added in bitcoin/bitcoin#36725 don't check that FlatFilePos preserves a 64-bit position or that opening a file uses the full offset.

    The tests check serialization around 2 GiB and 4 GiB, plus zero and UINT64_MAX. They also check opening and seeking around 2 GiB and 4 GiB, including preservation of the position across size(). The file stays one byte so no data is written at a large offset.

    Validation process:

    • On macOS arm64 (Apple Clang 21), Linux x86_64/i386 (GCC 13), and Windows x86_64 (clang-cl 22), flatfile_tests, serialize_tests, streams_tests, and blockmanager_tests pass. Include/test linters, changed-range clang-format, and whitespace checks also pass locally.
    • Before #36669, the existing flatfile tests pass, while the new tests catch rejected serialization and a seek position wrapping to zero at 4 GiB.
    • Casting only the current FlatFileSeq::Open seek offset to uint32_t also makes the new positioning test fail while existing flatfile tests pass on macOS, Linux x86_64, and Windows x86_64.

    On non-Windows systems with 32-bit long, the seek test warns and returns because the current wrapper uses fseek. The serialization test still runs. This behavior was verified on Linux i386. These were focused checks; the full CI matrix has not run.

    CI results: Linux x86_64, Windows x86_64, Linux i386. All jobs tested commit 1d11bd83d892d5bdac759e98321899d60f7c84e8.

  2. test: Cover 64-bit flatfile position boundaries
    Check FlatFilePos serialization against independently encoded 64-bit
    positions at the signed and unsigned 32-bit boundaries and UINT64_MAX.
    
    Exercise FlatFileSeq::Open and AutoFile positioning around 2 GiB and
    4 GiB, including position preservation across size(). Keep the file at
    one byte by never writing past EOF.
    
    Skip large seeks on non-Windows builds with 32-bit long, where the
    current FileSeek64 wrapper still uses fseek. Serialization coverage
    remains enabled.
    
    Follow-up coverage for bitcoin/bitcoin#36669.
    1d11bd83d8
  3. DrahtBot added the label Tests on Nov 13, 2026
  4. DrahtBot commented at 5:37 PM on November 13, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #35003 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35003.svg"></sub> (validation: improve block data I/O error handling in P2P paths by furszy)

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

    LLM Linter (✨ experimental)

    Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

    • src/test/flatfile_tests.cpp: FlatFileSeq seq{m_args.GetDataDirBase(), "large", 100}

    <sup>2026-11-13 17:37:38</sup>

  5. achow101 commented at 9:08 PM on November 14, 2026: member

    This appears to violate our AI policy

  6. achow101 closed this on Nov 14, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-11-16 00:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me