SpanReader in deserialization benchmarks
13c8df4d5arefactor: replace `DataStream` with `SpanReader` in block deserialization tests (Lőrinc)2529f25555refactor: use `SpanReader` in `PrevectorDeserialize` (Lőrinc)b8eb6c2081refactor: use `SpanReader` in `TestBlockAndIndex` (Lőrinc)61d678a6e3refactor: use `DataStream::clear` in `::read` and `::ignore` (Lőrinc) Pull request description: ### Problem Block deserialization benches still read immutable fixture bytes through `DataStream`, which keeps around mutable stream semantics and old compaction-oriented setup that these call sites do not need anymore. ### Fix We first remove the stale `Rewind()` parameter and failure path, which reduces rewinding to a simple reset of the read position that `clear()` can reuse. We then route fully consumed `read()` and `ignore()` paths through `clear()`, remove the leftover compaction references and dummy-byte workaround, and finally switch the block deserialization benchmark readers to `SpanReader`. `DeserializeBlockTest` can then deserialize directly from the fixture bytes without an untimed setup phase, while `CheckBlockTest` still keeps setup only to rebuild a fresh `CBlock` before the timed `CheckBlock()` call. ### Context This follows the same direction as #34483 and is a follow-up to https://github.com/bitcoin/bitcoin/pull/34208. The modified benchmarks retain their previous timing. ### Benchmarks The affected benchmarks speeds don't seem to be affected by the changes. <details><summary>Before & After</summary> > Before: ```bash | ns/op | op/s | err% | total | benchmark |--------------------:|--------------------:|--------:|----------:|:---------- | 37,591,891.96 | 26.60 | 1.0% | 11.07 | `BlockToJsonVerboseWrite` | 155,664.09 | 6,424.09 | 0.1% | 10.99 | `BlockToJsonVerbosity1` | 28,620,345.39 | 34.94 | 0.1% | 10.99 | `BlockToJsonVerbosity2` | 28,637,604.74 | 34.92 | 0.1% | 11.01 | `BlockToJsonVerbosity3` | ns/block | block/s | err% | total | benchmark |--------------------:|--------------------:|--------:|----------:|:---------- | 530,167.00 | 1,886.20 | 4.7% | 0.01 | `CheckBlockTest` | 1,439,417.00 | 694.73 | 0.7% | 0.02 | `DeserializeBlockTest` | ns/op | op/s | err% | total | benchmark |--------------------:|--------------------:|--------:|----------:|:---------- | 269.95 | 3,704,375.43 | 0.4% | 11.01 | `PrevectorDeserializeNontrivial` | 14.90 | 67,114,436.52 | 0.0% | 10.88 | `PrevectorDeserializeTrivial` ``` > After: ```bash | ns/op | op/s | err% | total | benchmark |--------------------:|--------------------:|--------:|----------:|:---------- | 37,114,824.07 | 26.94 | 1.8% | 10.89 | `BlockToJsonVerboseWrite` | 154,881.99 | 6,456.53 | 0.2% | 10.99 | `BlockToJsonVerbosity1` | 28,546,697.37 | 35.03 | 0.2% | 10.98 | `BlockToJsonVerbosity2` | 28,547,328.27 | 35.03 | 0.3% | 11.02 | `BlockToJsonVerbosity3` | ns/block | block/s | err% | total | benchmark |--------------------:|--------------------:|--------:|----------:|:---------- | 522,750.00 | 1,912.96 | 4.7% | 0.01 | `CheckBlockTest` | 1,404,510.54 | 711.99 | 0.1% | 11.00 | `DeserializeBlockTest` | ns/op | op/s | err% | total | benchmark |--------------------:|--------------------:|--------:|----------:|:---------- | 273.52 | 3,655,991.66 | 0.4% | 11.00 | `PrevectorDeserializeNontrivial` | 14.31 | 69,863,193.52 | 1.4% | 11.03 | `PrevectorDeserializeTrivial` ``` </details> ACKs for top commit: maflcko: review ACK13c8df4d5a🐠 sedited: Re-ACK13c8df4d5aTree-SHA512: b469874908c694b6b7f45e686519bdce0c0f4da2ca56b3f7f9897c7f27bb19a787f9821466995f15414343d508f15616b24b7fd8f0fa389ade8698c8f190b669
Bitcoin Core integration/staging tree
For an immediately usable, binary version of the Bitcoin Core software, see https://bitcoincore.org/en/download/.
What is Bitcoin Core?
Bitcoin Core connects to the Bitcoin peer-to-peer network to download and fully validate blocks and transactions. It also includes a wallet and graphical user interface, which can be optionally built.
Further information about Bitcoin Core is available in the doc folder.
License
Bitcoin Core is released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/license/MIT.
Development Process
The master branch is regularly built (see doc/build-*.md for instructions) and tested, but it is not guaranteed to be
completely stable. Tags are created
regularly from release branches to indicate new official, stable release versions of Bitcoin Core.
The https://github.com/bitcoin-core/gui repository is used exclusively for the development of the GUI. Its master branch is identical in all monotree repositories. Release branches and tags do not exist, so please do not fork that repository unless it is for development reasons.
The contribution workflow is described in CONTRIBUTING.md and useful hints for developers can be found in doc/developer-notes.md.
Testing
Testing and code review is the bottleneck for development; we get more pull requests than we can review and test on short notice. Please be patient and help out by testing other people's pull requests, and remember this is a security-critical project where any mistake might cost people lots of money.
Automated Testing
Developers are strongly encouraged to write unit tests for new code, and to
submit new unit tests for old code. Unit tests can be compiled and run
(assuming they weren't disabled during the generation of the build system) with: ctest. Further details on running
and extending unit tests can be found in /src/test/README.md.
There are also regression and integration tests, written
in Python.
These tests can be run (if the test dependencies are installed) with: build/test/functional/test_runner.py
(assuming build is your build directory).
The CI (Continuous Integration) systems make sure that every pull request is tested on Windows, Linux, and macOS. The CI must pass on all commits before merge to avoid unrelated CI failures on new pull requests.
Manual Quality Assurance (QA) Testing
Changes should be tested by somebody other than the developer who wrote the code. This is especially important for large or high-risk changes. It is useful to add a test plan to the pull request description if testing the changes is not straightforward.
Translations
Changes to translations as well as new translations can be submitted to Bitcoin Core's Transifex page.
Translations are periodically pulled from Transifex and merged into the git repository. See the translation process for details on how this works.
Important: We do not accept translation changes as GitHub pull requests because the next pull from Transifex would automatically overwrite them again.