Commit Graph

11 Commits

Author SHA1 Message Date
MarcoFalke
08227ba83d Merge bitcoin/bitcoin#23760: util: move MapIntoRange() for reuse in fuzz tests
df2307cdc3d08233d17beb9a50c144baaef1f44e util: move MapIntoRange() for reuse in fuzz tests (fanquake)

Pull request description:

ACKs for top commit:
  shaavan:
    ACK df2307cdc3d08233d17beb9a50c144baaef1f44e

Tree-SHA512: 31bf18f50a82e442ff025d6be0db5666b463a1fc16ec6b2112c77bb815515d27f8a537a0c9934c7daa3f4d526b47e8d6333f75a13b271e6efa550f8e71504b0a
2023-04-17 11:17:34 -05:00
Kittywhiskers Van Gogh
b50f00a2d5 merge bitcoin#18190: Add fuzzing harness for Golomb-Rice coding (GolombRiceEncode/GolombRiceDecode) 2022-07-15 21:24:21 +05:30
Wladimir J. van der Laan
52318c950f Merge #15532: Remove sharp edge (uninit member) when using the compiler-generated ctor for BlockFilter
82c3b3f8e07f0572327275841333256fa3e679e3 Remove sharp edge (uninitialized m_filter_type) when using the compiler-generated constructor for BlockFilter (practicalswift)

Pull request description:

  Remove sharp edge (uninitialised member `m_filter_type`) when using the compiler-generated constructor for `BlockFilter`.

  Before (but after added test):

  ```
  $ src/test/test_bitcoin -t blockfilter_tests/blockfilter_basic_test
  Running 1 test case...
  test/blockfilter_tests.cpp(118): error: in "blockfilter_tests/blockfilter_basic_test": check default_ctor_block_filter_1.GetFilterType() == default_ctor_block_filter_2.GetFilterType() has failed [ != ]

  *** 1 failure is detected in the test module "Bitcoin Test Suite"
  ```

  After:

  ```
  $ src/test/test_bitcoin -t blockfilter_tests/blockfilter_basic_test
  Running 1 test case...

  *** No errors detected
  ```

Tree-SHA512: 21d41f036b0bf12adcf1a788d84747353f2023cb85fd8ea6c97222967032e8bf54e7910cadb45dfcecd78e5b5dca86685f78cad0596b6d1a08f910ebf20d90aa
2021-10-13 23:44:38 -05:00
Kittywhiskers Van Gogh
b2ae73cff4 merge bitcoin#17687: fix Fatal LevelDB error when specifying -blockfilterindex twice 2021-09-18 09:18:30 +05:30
Kittywhiskers Van Gogh
21c7e57493 bitcoin#14121: Index for BIP 157 block filters
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-08-12 12:44:03 +05:30
Kittywhiskers Van Gogh
99409f52e5 bitcoin#14172: Refactor and add tests for BlockFilter construction 2021-08-12 12:44:02 +05:30
Kittywhiskers Van Gogh
680319643f merge bitcoin#14074: Use std::unordered_set instead of set in blockfilter interface 2021-06-27 12:03:15 +05:30
Kittywhiskers Van Gogh
56f1b2d01c Partial #19326: Simplify hash.h interface using Spans 2021-05-20 10:15:17 +05:30
Wladimir J. van der Laan
ea90d1b6c1 Merge #14073: blockfilter: Avoid out-of-bounds script access.
f05599557a8305d16bd5965921583af9d012fc27 blockfilter: Omit empty scripts from filter contents. (Jim Posen)

Pull request description:

  Caught during review of #12254 by @TheBlueMatt. https://github.com/bitcoin/bitcoin/pull/12254#discussion_r212830981

Tree-SHA512: cfc9e3eeaba12a14fd3d2e1ccce1a1f89e8cf44cc340ceec05d2d5fa61d27ff64e355603f4ad2184ff73c0ed23dfdab6e2103bddc48f3b76cb13b88d428770ac
2020-06-13 14:08:18 -05:00
Pasta
223dfc94dc Rename BlockFilterType::BASIC to BASIC_FILTER
bls dependency defines a macro BASIC as 1 in relic_conf.h.
This caused blockfilter.h to not compile after macro expansion when it says BASIC = 0.

Maybe there is a fancy C++ way to solve this, but renaming it seemed good to me :)

Signed-off-by: Pasta <pasta@dashboost.org>
2020-06-13 14:08:18 -05:00
Wladimir J. van der Laan
17929071d4 Merge #12254: BIP 158: Compact Block Filters for Light Clients
254c85b68794ada713dbdae415db72adf5fcbaf3 bench: Benchmark GCS filter creation and matching. (Jim Posen)
f33b717a85363e067316c133a542559d2f4aaeca blockfilter: Optimization on compilers with int128 support. (Jim Posen)
97b64d67daf0336dfb64b132f3e4d6a4c1967da4 blockfilter: Unit test against BIP 158 test vectors. (Jim Posen)
a4afb9cadbaecb0676e6475ab8d32a52faecb47a blockfilter: Additional helper methods to compute hash and header. (Jim Posen)
cd09c7925b5af4104834971cfe072251e3ac2bda blockfilter: Serialization methods on BlockFilter. (Jim Posen)
c1855f6052aca806fdb51be01b30dfeee8b55f40 blockfilter: Construction of basic block filters. (Jim Posen)
53e7874e079f9ddfe8b176f11d46e6b59c7283d5 blockfilter: Simple test for GCSFilter construction and Match. (Jim Posen)
558c536e35a25594881693e6ff01d275c88d7af1 blockfilter: Implement GCSFilter Match methods. (Jim Posen)
cf70b550054eed36f194eaa13f4a9cb31e32df38 blockfilter: Implement GCSFilter constructors. (Jim Posen)
c454f0ac63c6028f54c7eb51683b3ccdb475b19b blockfilter: Declare GCSFilter class for BIP 158 impl. (Jim Posen)
9b622dc72279b027c59d6541cddff53800fc689b streams: Unit tests for BitStreamReader and BitStreamWriter. (Jim Posen)
fe943f99bf0a2bbb12e30bc4803c0337e3c95b93 streams: Implement BitStreamReader/Writer classes. (Jim Posen)
87f2d9ee43a9220076b1959d1ca65245d9591be9 streams: Unit test for VectorReader class. (Jim Posen)
947133dec92cd25ec2b3358c09b8614ba6fb40d4 streams: Create VectorReader stream interface for vectors. (Jim Posen)

Pull request description:

  This implements the compact block filter construction in [BIP 158](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki). The code is not used anywhere in the Bitcoin Core code base yet. The next step towards [BIP 157](https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki) support would be to create an indexing module similar to `TxIndex` that constructs the basic and extended filters for each validated block.

  ### Filter Sizes

  [Here](https://gateway.ipfs.io/ipfs/QmRqaAAQZ5ZX5eqxP7J2R1MzFrc2WDdKSWJEKtQzyawqog) is a CSV of filter sizes for blocks in the main chain.

  As you can see below, the ratio of filter size to block size drops after the first ~150,000 blocks:

  ![filter_sizes](https://user-images.githubusercontent.com/881253/42900589-299772d4-8a7e-11e8-886d-0d4f3f4fbe44.png)

  The reason for the relatively large filter sizes is that Golomb-coded sets only achieve good compression with a sufficient number of elements. Empirically, the average element size with 100 elements is 14% larger than with 10,000 elements.

  The ratio of filter size to block size is computed without witness data for basic filters. Here is a summary table of filter size ratios *for blocks after height 150,000*:

  | Stat | Filter Type |
  |-------|--------------|
  | Weighted Size Ratio Mean | 0.0198 |
  | Size Ratio Mean | 0.0224 |
  | Size Ratio Std Deviation | 0.0202 |
  | Mean Element Size (bits) | 21.145 |
  | Approx Theoretical Min Element Size (bits) | 21.025 |

Tree-SHA512: 2d045fbfc3fc45490ecb9b08d2f7e4dbbe7cd8c1c939f06bbdb8e8aacfe4c495cdb67c820e52520baebbf8a8305a0efd8e59d3fa8e367574a4b830509a39223f
2020-06-13 14:08:18 -05:00