blockstorage: XOR blocksdir *.dat files #28052

pull maflcko wants to merge 3 commits into bitcoin:master from maflcko:2306-fs_stuff- changing 10 files +97 −16
  1. maflcko commented at 8:07 am on July 8, 2023: member

    Currently the *.dat files in the blocksdir store the data received from remote peers as-is. This may be problematic when a program other than Bitcoin Core tries to interpret them by accident. For example, an anti-virus program or other program may scan them and move them into quarantine, or delete them, or corrupt them. This may cause Bitcoin Core to fail a reorg, or fail to reply to block requests (via P2P, RPC, REST, …).

    Fix this, similar to #6650, by rolling a random XOR pattern over the dat files when writing or reading them.

    Obviously this can only protect against programs that accidentally and unintentionally are trying to mess with the dat files. Any program that intentionally wants to mess with the dat files can still trivially do so.

    The XOR pattern is only applied when the blocksdir is freshly created, and there is an option to disable it (on creation), so that people can disable it, if needed.

  2. DrahtBot commented at 8:07 am on July 8, 2023: contributor

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

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See 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.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #28687 (C++20 std::views::reverse by stickies-v)

    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.

  3. maflcko renamed this:
    XOR blocksdir *.dat files
    blockstorage: XOR blocksdir *.dat files
    on Jul 8, 2023
  4. DrahtBot added the label Block storage on Jul 8, 2023
  5. DrahtBot added the label CI failed on Jul 8, 2023
  6. maflcko force-pushed on Jul 8, 2023
  7. jamesob commented at 5:19 pm on July 8, 2023: member
    Concept ACK. Certainly worth doing.
  8. sipa marked this as ready for review on Jul 8, 2023
  9. sipa commented at 5:28 pm on July 8, 2023: member

    Oops, I clicked wrong.

    I just meant to Concept ACK.

  10. maflcko marked this as a draft on Jul 9, 2023
  11. luke-jr commented at 6:02 pm on July 9, 2023: member
    AFAIK there is software which reads these files intentionally. IMO they can be expected to adapt, but having the option to disable it seems like a good idea in case they aren’t ready right away.
  12. TheCharlatan commented at 8:30 am on July 10, 2023: contributor
    Strong Concept ACK.
  13. maflcko force-pushed on Jul 10, 2023
  14. maflcko commented at 10:21 am on July 10, 2023: member

    Thanks for the feedback so far. I’ve kept the option to disable, but made it a simple bool instead of allowing the user to pick the XOR-key.

    If someone is interested, a new commit can be added to upgrade the linearize scripts to read the XOR-key.

  15. DrahtBot added the label Needs rebase on Jul 11, 2023
  16. maflcko force-pushed on Jul 12, 2023
  17. DrahtBot removed the label Needs rebase on Jul 12, 2023
  18. dergoegge commented at 12:19 pm on July 13, 2023: member
    Concept ACK
  19. DrahtBot added the label Needs rebase on Jul 31, 2023
  20. maflcko force-pushed on Aug 1, 2023
  21. maflcko commented at 2:06 pm on August 1, 2023: member
    Rebased on the latest #https://github.com/bitcoin/bitcoin/pull/28060
  22. DrahtBot removed the label Needs rebase on Aug 1, 2023
  23. fanquake referenced this in commit ceda819886 on Aug 1, 2023
  24. DrahtBot removed the label CI failed on Aug 1, 2023
  25. in test/functional/feature_reindex.py:44 in f0d2c3f73e outdated
    39@@ -39,9 +40,18 @@ def out_of_order(self):
    40         # we're generating them rather than getting them from peers), so to
    41         # test out-of-order handling, swap blocks 1 and 2 on disk.
    42         blk0 = self.nodes[0].blocks_path / "blk00000.dat"
    43+        with open(self.nodes[0].blocks_path / "xor.key", "rb") as xor_f:
    44+            xor_dat = deser_string(xor_f)
    


    maflcko commented at 4:39 pm on August 1, 2023:

    I guess it may be simpler to serialize and deserialize the xor key as a raw byte span (without the size indicator). This should make it even easier to read in external scripts, for example in vanilla python.

    Edit: And readers can assume it to be constant size. For example:

    0NUM_XOR_BYTES{8}
    

    maflcko commented at 8:06 am on August 2, 2023:
    Done
  26. maflcko force-pushed on Aug 1, 2023
  27. darosior commented at 7:23 am on August 2, 2023: member
    Concept ACK.
  28. maflcko marked this as ready for review on Aug 2, 2023
  29. maflcko force-pushed on Aug 2, 2023
  30. maflcko force-pushed on Aug 2, 2023
  31. maflcko commented at 8:25 am on August 2, 2023: member
    Rebased, and made every commit a refactor, except for the one that has release notes and test changes :)
  32. willcl-ark commented at 1:53 pm on August 2, 2023: member

    Concept ACK.

    I’ve not reviewed the code in detail yet, but this is a nice followup to #28060.

    It seems to work well so far. I wrote a quick-n-dirty python script to manually xor my data dir using the same 8 byte key from this pull, and Bitcoin Core at commit fa3c1d230a didn’t have any problems reading the xored blocks or key afterwards.

  33. sidhujag referenced this in commit 3a522e929e on Aug 9, 2023
  34. DrahtBot added the label CI failed on Sep 10, 2023
  35. maflcko force-pushed on Sep 11, 2023
  36. kristapsk commented at 11:29 am on September 11, 2023: contributor
    Concept ACK
  37. DrahtBot removed the label CI failed on Sep 11, 2023
  38. fanquake referenced this in commit 8209e86eeb on Sep 14, 2023
  39. DrahtBot added the label Needs rebase on Sep 14, 2023
  40. maflcko force-pushed on Sep 14, 2023
  41. DrahtBot removed the label Needs rebase on Sep 14, 2023
  42. DrahtBot added the label CI failed on Sep 14, 2023
  43. maflcko force-pushed on Sep 14, 2023
  44. maflcko commented at 3:14 pm on September 14, 2023: member
    Given that most of this is refactoring, which makes sense on its own, I’ve split that up into #28483 and turned this pull into a draft for now.
  45. maflcko marked this as a draft on Sep 14, 2023
  46. DrahtBot removed the label CI failed on Sep 14, 2023
  47. fanquake referenced this in commit c9f288244b on Sep 26, 2023
  48. DrahtBot added the label Needs rebase on Sep 26, 2023
  49. maflcko marked this as ready for review on Sep 28, 2023
  50. maflcko force-pushed on Sep 28, 2023
  51. DrahtBot added the label CI failed on Sep 28, 2023
  52. DrahtBot removed the label Needs rebase on Sep 28, 2023
  53. DrahtBot removed the label CI failed on Sep 28, 2023
  54. maflcko force-pushed on Oct 4, 2023
  55. pablomartin4btc commented at 7:55 pm on October 26, 2023: member

    tACK fa9f3f70011842e2c4358d15ab4639734d976f5c

     02023-10-26T18:07:06Z init message: Verifying blocks…
     12023-10-26T18:07:06Z Verifying last 6 blocks at level 3
     22023-10-26T18:07:06Z Verification progress: 0%
     32023-10-26T18:07:06Z ERROR: ReadBlockFromDisk: Deserialize or I/O error - ReadCompactSize(): size too large: iostream error at FlatFilePos(nFile=5, nPos=62189381)
     42023-10-26T18:07:06Z Verification error: ReadBlockFromDisk failed at 160000, hash=0000003ca3c99aff040f2563c2ad8f8ec88bd0fd6b8f0895cfaf1ef90353a62c
     52023-10-26T18:07:06Z : Corrupted block database detected.
     6Please restart with -reindex or -reindex-chainstate to recover.
     7: Corrupted block database detected.
     8Please restart with -reindex or -reindex-chainstate to recover.
     92023-10-26T18:07:06Z Aborted block database rebuild. Exiting.
    102023-10-26T18:07:06Z Shutdown: In progress...
    112023-10-26T18:07:06Z scheduler thread exit
    122023-10-26T18:07:06Z Flushed fee estimates to fee_estimates.dat.
    132023-10-26T18:07:06Z Shutdown: done
    

    2023-10-26T18:12:03Z Using xor key for *.dat files: '0000000000000000'

    Now, considering the possibility of the XOR key file getting corrupted (for example, accidentally opening it with an app that offers to ‘fix’ a corruption) or being deleted, especially on a fresh run when a random XOR key is generated (which I’ve also tested), wouldn’t it be better to save the key in the .conf or settings?

    Before having that thought, I was considering proposing to give the option to the user to specify the filename, but that would add complexity, and I’m not sure if it’s worth it.

  56. DrahtBot requested review from sipa on Oct 26, 2023
  57. DrahtBot requested review from jamesob on Oct 26, 2023
  58. DrahtBot requested review from willcl-ark on Oct 26, 2023
  59. DrahtBot requested review from dergoegge on Oct 26, 2023
  60. DrahtBot requested review from darosior on Oct 26, 2023
  61. DrahtBot requested review from TheCharlatan on Oct 26, 2023
  62. maflcko commented at 8:23 am on October 27, 2023: member

    wouldn’t it be better to save the key in the .conf or settings?

    The key is not a configuration or setting that is supposed to be modified by a user or that can be changed at all. Once it is persisted to storage, it is set in stone for all (future) dat files.

  63. DrahtBot added the label Needs rebase on Oct 30, 2023
  64. maflcko force-pushed on Oct 30, 2023
  65. DrahtBot removed the label Needs rebase on Oct 30, 2023
  66. pablomartin4btc commented at 4:48 pm on October 30, 2023: member
    re ACK fa6b180beb20d64962c2b5440eeacb31ed889a81
  67. maflcko force-pushed on Nov 22, 2023
  68. lrs955 commented at 12:31 pm on November 23, 2023: none

    why not save the xor key inside the leveldb block database?

    wouldn’t it be better to save the key in the .conf or settings?

    The key is not a configuration or setting that is supposed to be modified by a user or that can be changed at all. Once it is persisted to storage, it is set in stone for all (future) dat files.

  69. maflcko commented at 12:34 pm on November 23, 2023: member

    why not save the xor key inside the leveldb block database?

    Just seems more complicated with no benefit?

  70. lrs955 commented at 6:17 pm on November 23, 2023: none

    why not save the xor key inside the leveldb block database?

    Just seems more complicated with no benefit?

    I understand. Maybe im wrong but isn’t also the xor pattern of the chainstate saved in the database itself? Different leveldb database but still in a key a database.

  71. DrahtBot added the label CI failed on Dec 13, 2023
  72. DrahtBot removed the label CI failed on Dec 14, 2023
  73. DrahtBot added the label Needs rebase on Dec 14, 2023
  74. maflcko force-pushed on Mar 22, 2024
  75. DrahtBot removed the label Needs rebase on Mar 22, 2024
  76. willcl-ark commented at 2:15 pm on March 22, 2024: member
    While you’re re-touching, I think it could be worth adding an entry to doc/files.md too, especially as losing/not backing-up this file results in requiring a full reindex?
  77. maflcko commented at 3:03 pm on March 22, 2024: member

    especially as losing/not backing-up this file results in requiring a full reindex?

    I don’t think this is true. The xor key can trivially be restored by xor-ing the first 8 bytes of the first block file with the first 8 bytes of the first block file of a datadir created with the xor disabled. This works, because the first block written should be the genesis block, always.

    In python:

    0>>> bytes(a ^ b for a,b in zip(open('blk00000.dat', 'rb').read()[:8], open('clean-blk00000.dat', 'rb').read()[:8])).hex()
    1'228b70bf9c1abb3f'
    2>>> open('xor.key', 'rb').read().hex()  # double-check
    3'228b70bf9c1abb3f'
    
  78. maflcko force-pushed on Mar 22, 2024
  79. maflcko commented at 4:12 pm on March 22, 2024: member

    doc/files.md

    Done

  80. in src/node/blockstorage.cpp:1164 in faaf3cf535 outdated
    1169+    if (!fs::is_empty(opts.blocks_dir) || opts.xor_key == false) std::fill(xor_key.begin(), xor_key.end(), std::byte{});
    1170+    const fs::path xor_key_path{opts.blocks_dir / "xor.dat"};
    1171+    if (fs::exists(xor_key_path)) {
    1172+        // A pre-existing xor key file has priority.
    1173+        AutoFile xor_key_file{fsbridge::fopen(xor_key_path, "rb")};
    1174+        xor_key_file >> xor_key;
    


    willcl-ark commented at 9:25 am on May 1, 2024:

    Jjust noting here that if the user specifies -blocksxor=01234567 and a file-based key already exists in the datadir, the key from the file is silently used.

    This is the correct behaviour IMO, but wonder if we should log that the user-set option has been overridden?

    As @maflcko pointed out to me previously, even if a user mistakenly thought they were using a custom xor key set as a CL option and removed the key file, they could still restore it. So I don’t see any dangers with this current behaviour.


    maflcko commented at 9:52 am on May 1, 2024:

    -blocksxor=01234567

    The option is boolean, so I guess it could throw here. In any case, the setting won’t have an effect on an existing blocksdir, even on -reindex. Maybe the manpage can be adjusted to clarify this?


    hodlinator commented at 10:24 pm on July 16, 2024:

    (In response to #28052 (review))

    Tested bitcoind -blocksxor=01234567, which does not throw. Evaluates to true. Discussion seems to have stalled since #12713 https://github.com/bitcoin/bitcoin/blob/6f9db1ebcab4064065ccd787161bf2b87e03cc1f/src/common/args.cpp#L43-L63


    maflcko commented at 5:53 am on July 17, 2024:
    See #16545
  81. willcl-ark approved
  82. willcl-ark commented at 9:38 am on May 1, 2024: member

    ACK faaf3cf535999c2c9a84337414c8b35435384862

    Nice change with the same rationale as the previous mempool XOR changes (preventing anti-virus falsely flagging/modifying block files).

    One non-blocking comment left as a result of manual testing.

  83. DrahtBot requested review from pablomartin4btc on May 1, 2024
  84. in test/functional/feature_reindex.py:42 in faaf3cf535 outdated
    38@@ -39,9 +39,19 @@ def out_of_order(self):
    39         # we're generating them rather than getting them from peers), so to
    40         # test out-of-order handling, swap blocks 1 and 2 on disk.
    41         blk0 = self.nodes[0].blocks_path / "blk00000.dat"
    42+        with open(self.nodes[0].blocks_path / "xor.dat", "rb") as xor_f:
    


    TheCharlatan commented at 3:05 pm on May 11, 2024:
    Just a comment: This test implicitly checks if the blockfiles are XORed. Would a simple additional check on the undo data make sense?

    maflcko commented at 1:46 pm on July 5, 2024:
    Yes, ideally in a separate, new test.
  85. in src/node/blockstorage.cpp:1188 in faaf3cf535 outdated
    1183+            strprintf("The blocksdir XOR-key can not be disabled when a random key was already stored! "
    1184+                      "Stored key: '%s', stored path: '%s'.",
    1185+                      HexStr(xor_key), fs::PathToString(xor_key_path)),
    1186+        };
    1187+    }
    1188+    LogInfo("Using xor key for *.dat files: '%s'\n", HexStr(xor_key));
    


    TheCharlatan commented at 7:24 pm on May 11, 2024:

    Nit: This prints as:

    0Using xor key for *.dat files: '0000000000000000'`
    

    But the log lines informing the user on data obfuscation in the other DBs use:

    0Using obfuscation key for /home/drgrid/.bitcoin/blocks/index: 0000000000000000
    1Using obfuscation key for /home/drgrid/.bitcoin/chainstate: a3b154cf1d9714d7
    

    I think it would be nice to be consistent here, both by listing the full directory and using the same text.


    maflcko commented at 2:07 pm on July 5, 2024:
    I’d say DB obfuscation is different from *.dat obfuscation, but I’ve made the messages a bit more similar. Thanks!
  86. in src/node/blockstorage.cpp:1169 in faaf3cf535 outdated
    1164+    std::array<std::byte, 8> xor_key{};
    1165+
    1166+    // Initialize random fresh key, ...
    1167+    FastRandomContext{}.fillrand(xor_key);
    1168+    // ... but allow legacy or user-disabled key.
    1169+    if (!fs::is_empty(opts.blocks_dir) || opts.xor_key == false) std::fill(xor_key.begin(), xor_key.end(), std::byte{});
    


    TheCharlatan commented at 7:48 pm on May 11, 2024:

    Nit: I found this a bit hard to follow and a bit unfortunate that a new random key would be generated every time whether it were used or not. How about:

     0@@ -1166,4 +1165,0 @@ static auto InitBlocksdirXorKey(const BlockManager::Options& opts)
     1-    // Initialize random fresh key, ...
     2-    FastRandomContext{}.fillrand(xor_key);
     3-    // ... but allow legacy or user-disabled key.
     4-    if (!fs::is_empty(opts.blocks_dir) || opts.xor_key == false) std::fill(xor_key.begin(), xor_key.end(), std::byte{});
     5@@ -1171 +1167,8 @@ static auto InitBlocksdirXorKey(const BlockManager::Options& opts)
     6-    if (fs::exists(xor_key_path)) {
     7+    bool key_exists = fs::exists(xor_key_path);
     8+
     9+    if (!key_exists && opts.xor_key && fs::is_empty(opts.blocks_dir)) {
    10+        // Initialize random fresh key, ...
    11+        FastRandomContext{}.fillrand(xor_key);
    12+    }
    13+
    14+    if (key_exists) {
    

    maflcko commented at 2:06 pm on July 5, 2024:
    Good feedback. I’ve inverted the if condition (and branch). Hope it is clearer now?

    TheCharlatan commented at 3:22 pm on July 26, 2024:
    Thanks, this is clearer now.
  87. TheCharlatan approved
  88. TheCharlatan commented at 7:50 pm on May 11, 2024: contributor
    ACK faaf3cf535999c2c9a84337414c8b35435384862
  89. DrahtBot added the label Needs rebase on May 20, 2024
  90. maflcko force-pushed on Jul 5, 2024
  91. DrahtBot removed the label Needs rebase on Jul 5, 2024
  92. in src/kernel/blockmanager_opts.h:17 in fae8e0a982 outdated
    13@@ -14,12 +14,15 @@ class CChainParams;
    14 
    15 namespace kernel {
    16 
    17+static constexpr bool DEFAULT_XOR_KEY_BLOCKSDIR{true};
    


    hodlinator commented at 9:15 pm on July 16, 2024:

    Including “KEY” makes me think the variable would itself contain the default XOR pattern.

    0static constexpr bool DEFAULT_XOR_BLOCKSDIR{true};
    

    Same goes for bool xor_key below.. would call it bool xored_on_disk or something.


    maflcko commented at 6:28 am on July 17, 2024:
    Thanks, taken!

    hodlinator commented at 7:26 am on July 17, 2024:
    Good to see the removal of == true as well in InitBlocksdirXorKey(). :+1:
  93. in src/init.cpp:1557 in fae8e0a982 outdated
    1550@@ -1544,7 +1551,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
    1551         }
    1552         LogPrintf("* Using %.1f MiB for in-memory UTXO set (plus up to %.1f MiB of unused mempool space)\n", cache_sizes.coins * (1.0 / 1024 / 1024), mempool_opts.max_size_bytes * (1.0 / 1024 / 1024));
    1553 
    1554-        node.chainman = std::make_unique<ChainstateManager>(*Assert(node.shutdown), chainman_opts, blockman_opts);
    1555+        try {
    1556+            node.chainman = std::make_unique<ChainstateManager>(*Assert(node.shutdown), chainman_opts, blockman_opts);
    1557+        } catch (std::exception& e) {
    1558+            return InitError(strprintf(Untranslated("Internal error: %s"), e.what()));
    


    hodlinator commented at 9:17 pm on July 16, 2024:

    Error messages should be as specific as possible to aid troubleshooting.

    0            return InitError(strprintf(Untranslated("Failed to initialize ChainstateManager: %s"), e.what()));
    

    maflcko commented at 6:27 am on July 17, 2024:
    Thanks, taken!
  94. in src/node/blockstorage.cpp:1183 in fae8e0a982 outdated
    1178+        // A pre-existing xor key file has priority.
    1179+        AutoFile xor_key_file{fsbridge::fopen(xor_key_path, "rb")};
    1180+        xor_key_file >> xor_key;
    1181+    } else {
    1182+        // Create initial or missing xor key file
    1183+        AutoFile xor_key_file{fsbridge::fopen(xor_key_path, "wbx")};
    


    hodlinator commented at 10:13 pm on July 16, 2024:
    (https://cplusplus.com/reference/cstdio/fopen/ stated that “x” was only part of C2011, not C++. But it is included from C++17 according to https://en.cppreference.com/w/cpp/io/c/fopen).

    maflcko commented at 6:27 am on July 17, 2024:
    Thanks, but actually it doesn’t work when running on Windows. Added a new commit with a workaround.
  95. hodlinator commented at 10:31 pm on July 16, 2024: contributor

    Concept ACK fae8e0a9825d107431f3f33e4f70fe54d02ab3e3 (Haven’t had time to look at the tests yet).

    Appreciate the robustness of InitBlocksdirXorKey() after some testing of removing the blocks/xor.dat file, re-running bitcoind. hexdumping it, removing the whole blocks/ directory, rerunning, hexdumping again etc.

  96. maflcko force-pushed on Jul 17, 2024
  97. in src/node/blockstorage.cpp:1164 in fa986c918a outdated
    1159+{
    1160+    // Bytes are serialized without length indicator, so this is also the exact
    1161+    // size of the XOR-key file.
    1162+    std::array<std::byte, 8> xor_key{};
    1163+
    1164+    if (fs::is_empty(opts.blocks_dir) && opts.use_xor) {
    


    hodlinator commented at 7:28 am on July 17, 2024:

    nit: Could put cheapest condition first:

    0    if (opts.use_xor && fs::is_empty(opts.blocks_dir)) {
    

    maflcko commented at 8:34 am on July 17, 2024:
    May do if I have to re-touch. This is only called once per process, so shouldn’t matter.

    maflcko commented at 8:43 am on July 17, 2024:
    Thanks, done!
  98. in test/functional/feature_reindex.py:76 in fa986c918a outdated
    74+            b_new[b3_start:b4_start] = b[b2_start:b3_start]
    75+            b_new = util_xor(b_new, xor_dat)
    76             bf.seek(b2_start)
    77-            bf.write(b[b3_start:b4_start])
    78-            bf.write(b[b2_start:b3_start])
    79+            bf.write(b_new[b2_start:b4_start])
    


    hodlinator commented at 8:04 am on July 17, 2024:

    Smaller change if we make util_xor() take an offset:

     0diff --git a/test/functional/feature_reindex.py b/test/functional/feature_reindex.py
     1index f079a5e343..9f3f5357ba 100755
     2--- a/test/functional/feature_reindex.py
     3+++ b/test/functional/feature_reindex.py
     4@@ -43,15 +43,15 @@ class ReindexTest(BitcoinTestFramework):
     5             NUM_XOR_BYTES = 8 # From InitBlocksdirXorKey::xor_key.size()
     6             xor_dat = xor_f.read(NUM_XOR_BYTES)
     7 
     8-        def util_xor(data, key):
     9+        def util_xor(data, key, offset):
    10             data = bytearray(data)
    11             for i in range(len(data)):
    12-                data[i] ^= key[i % len(key)]
    13+                data[i] ^= key[(i + offset) % len(key)]
    14             return bytes(data)
    15 
    16         with open(blk0, 'r+b') as bf:
    17             # Read at least the first few blocks (including genesis)
    18-            b = util_xor(bf.read(2000), xor_dat)
    19+            b = util_xor(bf.read(2000), xor_dat, 0)
    20 
    21             # Find the offsets of blocks 2, 3, and 4 (the first 3 blocks beyond genesis)
    22             # by searching for the regtest marker bytes (see pchMessageStart).
    23@@ -68,12 +68,9 @@ class ReindexTest(BitcoinTestFramework):
    24             assert_equal(b3_start - b2_start, b4_start - b3_start)
    25 
    26             # Swap the second and third blocks (don't disturb the genesis block).
    27-            b_new = bytearray(b)
    28-            b_new[b2_start:b3_start] = b[b3_start:b4_start]
    29-            b_new[b3_start:b4_start] = b[b2_start:b3_start]
    30-            b_new = util_xor(b_new, xor_dat)
    31             bf.seek(b2_start)
    32-            bf.write(b_new[b2_start:b4_start])
    33+            bf.write(util_xor(b[b3_start:b4_start], xor_dat, b2_start))
    34+            bf.write(util_xor(b[b2_start:b3_start], xor_dat, b3_start))
    35 
    36         # The reindexing code should detect and accommodate out of order blocks.
    37         with self.nodes[0].assert_debug_log([
    

    maflcko commented at 8:43 am on July 17, 2024:
    Thanks, done!
  99. hodlinator approved
  100. hodlinator commented at 8:09 am on July 17, 2024: contributor
    ACK fa986c918a239cabda198f044b6eb9739c298be9
  101. DrahtBot requested review from willcl-ark on Jul 17, 2024
  102. DrahtBot requested review from TheCharlatan on Jul 17, 2024
  103. maflcko force-pushed on Jul 17, 2024
  104. hodlinator approved
  105. hodlinator commented at 9:05 am on July 17, 2024: contributor
    re-ACK fa9d4aa9a1a8df6343f615572479db9c8e26b19d
  106. DrahtBot added the label Needs rebase on Jul 26, 2024
  107. maflcko force-pushed on Jul 26, 2024
  108. Return XOR AutoFile from BlockManager::Open*File()
    This is a refactor, because the XOR key is empty.
    fa7f7ac040
  109. maflcko force-pushed on Jul 26, 2024
  110. DrahtBot added the label CI failed on Jul 26, 2024
  111. DrahtBot commented at 10:32 am on July 26, 2024: contributor

    🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/27958379841

    Make sure to run all tests locally, according to the documentation.

    The failure may happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  112. in src/node/blockstorage.cpp:1155 in fab2287c6e outdated
    1150+    // Bytes are serialized without length indicator, so this is also the exact
    1151+    // size of the XOR-key file.
    1152+    std::array<std::byte, 8> xor_key{};
    1153+
    1154+    if (opts.use_xor && fs::is_empty(opts.blocks_dir)) {
    1155+        // Only use random fresh key when the boolean option is set and when on
    


    TheCharlatan commented at 10:37 am on July 26, 2024:
    Typo nit: s/and when on/and on/

    maflcko commented at 3:31 pm on July 26, 2024:
    Thanks, fixed
  113. maflcko force-pushed on Jul 26, 2024
  114. maflcko commented at 2:19 pm on July 26, 2024: member
    Shuffled the format string to work around the linter bug.
  115. TheCharlatan approved
  116. TheCharlatan commented at 3:21 pm on July 26, 2024: contributor
    Re-ACK fa51f311ee4f2295c7bd82f46e27dc043a33f955
  117. DrahtBot requested review from hodlinator on Jul 26, 2024
  118. Add -blocksxor boolean option fa359255fe
  119. mingw: Document mode wbx workaround fa895c7283
  120. maflcko force-pushed on Jul 26, 2024
  121. TheCharlatan approved
  122. TheCharlatan commented at 3:35 pm on July 26, 2024: contributor

    Re-ACK fa895c72832f9555b52d5bb1dba1093f73de3136

    Just a typo fix since last push.

  123. DrahtBot removed the label Needs rebase on Jul 26, 2024
  124. DrahtBot removed the label CI failed on Jul 26, 2024
  125. hodlinator approved
  126. hodlinator commented at 9:23 pm on July 26, 2024: contributor

    ACK fa895c72832f9555b52d5bb1dba1093f73de3136

    git range-diff fa9d4aa9a1a8df6343f615572479db9c8e26b19d~3 fa9d4aa9a1a8df6343f615572479db9c8e26b19d fa895c72832f9555b52d5bb1dba1093f73de3136

    Confirmed only thing that really changed was:

    • Merging with mainly 7aa8994c6fceae5cf8fb7e661371cdb19d2cb482 - " refactor: Add FlatFileSeq member variables in BlockManager "
    • Correcting CAutoFile -> AutoFile in commit message
    • Comment typo in InitBlocksdirXorKey
    • LogInfo format string re-jiggling.

    Passed make check & test_runner.py.


    It would be nice to get to the bottom with why

    0LogInfo("Using obfuscation key for %s/*.dat files: '%s'\n", fs::PathToString(opts.blocks_dir), HexStr(xor_key));
    

    was worse than

    0LogInfo("Using obfuscation key for blocksdir *.dat files (%s): '%s'\n", fs::PathToString(opts.blocks_dir), HexStr(xor_key));
    

    and fix test/lint/run-lint-format-strings.py in the longer term.

  127. achow101 commented at 9:35 pm on August 5, 2024: member
    ACK fa895c72832f9555b52d5bb1dba1093f73de3136
  128. achow101 merged this on Aug 5, 2024
  129. achow101 closed this on Aug 5, 2024

  130. maflcko deleted the branch on Aug 7, 2024
  131. maflcko commented at 9:16 am on August 7, 2024: member

    Follow-up ideas for this pull requests are:

  132. hodlinator commented at 1:18 pm on August 7, 2024: contributor
    Is there some label or something that can assist people in discovering this kind of follow-up work on closed/merged PRs?
  133. maflcko commented at 1:22 pm on August 7, 2024: member

    Is there some label or something that can assist people in discovering this kind of follow-up work on closed/merged PRs?

    I’ve moved it to an issue, see https://github.com/bitcoin/bitcoin/issues/30599


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: 2024-12-22 00:12 UTC

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