Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Update leveldb to 1.22+ #17398

Merged
merged 13 commits into from Feb 10, 2020
Merged

Conversation

laanwj
Copy link
Member

@laanwj laanwj commented Nov 6, 2019

This updates leveldb to currently newest upstream commit bitcoin-core/leveldb-subtree@0c40829:

  • CRC32C hardware acceleration is now an external library crc32c. This adds acceleration on ARM, and should be faster on x86 because of using prefetch. It also makes it easy to support similar instruction sets on other platforms in the future.
  • Thread handling uses C++11, instead of platform specific code.
  • Native windows environment was added. No need to maintain our own hacky one, anymore.
  • Upstream now builds using CMake. This doesn't mean we need to use that (phew), but internal configuration changed to a a series of checks, instead of OS profiles. This means the blanket error "Cannot build leveldb for $host. Please file a bug report' is removed.

All changes: google/leveldb@a53934a...0c40829

Pretty much all our changes have been subsumed by upstream, so we figured it was cleaner to start over with a new branch from upstream with the still-relevant patches applied: https://github.com/bitcoin-core/leveldb/tree/bitcoin-fork-new

There's quite some testing to be done (see below). See bitcoin-core/leveldb-subtree#25 and bitcoin-core/leveldb-subtree#26 for more history and context.

TODO:

  • Subtree crc32c
  • Make linters happy about crc32 subtree
  • Integrate crc32c library into build system
  • MSVC build system

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 6, 2019

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #18077 (net: Add NAT-PMP port forwarding support by hebasto)
  • #18011 (Replace current benchmarking framework with nanobench by martinus)
  • #17948 (build: pass -fno-ident to prevent compilers emitting ident directives by fanquake)
  • #17874 (build: make linker checks more robust by fanquake)
  • #17227 (Qt: Add Android packaging support by icota)
  • #15704 (Move Win32 defines to configure.ac to ensure they are globally defined by luke-jr)

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.

@laanwj laanwj added this to the 0.20.0 milestone Nov 7, 2019
@laanwj
Copy link
Member Author

laanwj commented Nov 7, 2019

OK, travis build should pass now

Testing notes:

  • check that HAVE_FULLFSYNC=1 is passed on MacOS (done, checking for F_FULLFSYNC... yes appears in both MacOS builds)
  • check that crc32c is correctly integrated
    • ARM64 (checked crc32c::ExtendArm64 in libcrc32c_arm_crc.a is invoked and contains the correct asm instructions)
    • x86_64 (checked crc32c::ExtendSse42 in libcrc32c_sse42.a is invoked and contains the correct asm instructions)
  • do full sync on ARM64 with crc32c hw accel code compiled in and in use (done, on i.MX8MQ SoC on Linux)
  • test on BSD variants
    • FreeBSD 12.0
    • OpenBSD 6.6
    • MacOS
  • test on Windows (full sync, as well as catching up an existing node)
  • verify file descriptor use (see build: Update leveldb to 1.22+ #17398 (comment) )
  • check sync performance before an after on different OS and hardware
  • test forward and backward compatibility of UTXO and block database (done here build: Update leveldb to 1.22+ #17398 (comment))

@laanwj laanwj changed the title WIP: Update leveldb to 1.22+ WIP: build: Update leveldb to 1.22+ Nov 7, 2019
@laanwj laanwj force-pushed the 2019_11_leveldb_upstream branch 2 times, most recently from 43cbeb7 to 9e34948 Compare November 7, 2019 13:11
@elichai
Copy link
Contributor

elichai commented Nov 7, 2019

Concept ACK for the new branch. it's really nice that we can again easily see the diff from upstream.
google/leveldb@master...bitcoin-core:bitcoin-fork-new

Will try to read later the (reported) changes upstream leveldb did in the past ~160 commits.

@laanwj laanwj force-pushed the 2019_11_leveldb_upstream branch 2 times, most recently from 12849e2 to f6a4f7c Compare November 7, 2019 14:09
@sipsorcery
Copy link
Member

Regarding the msvc build I didn't have any problems getting it to build after applying what I think are the relevant changes to the libleveldb project.

I do get two new warnings:

Severity	Code	Description	Project	File	Line	Suppression State	Suppression State
Warning	C26110	Caller failing to hold lock 'this->mu_' before calling function 'std::_Mutex_base::unlock'.	libleveldb	C:\DEV\GITHUB\SIPSORCERY_BITCOIN\SRC\LEVELDB\PORT\PORT_STDCXX.H	58		
Severity	Code	Description	Project	File	Line	Suppression State	Suppression State
Warning	C26110	Caller failing to hold lock 'this->mu_->mu_' before calling function 'std::unique_lock<std::mutex>::unique_lock<std::mutex>'.	libleveldb	C:\DEV\GITHUB\SIPSORCERY_BITCOIN\SRC\LEVELDB\PORT\PORT_STDCXX.H	76		

Are any of the preprocessor defines below relevant for Windows?

LEVELDB_CPPFLAGS_INT += -DHAVE_FDATASYNC=@HAVE_FDATASYNC@
LEVELDB_CPPFLAGS_INT += -DHAVE_FULLFSYNC=@HAVE_FULLFSYNC@
LEVELDB_CPPFLAGS_INT += -DHAVE_O_CLOEXEC=@HAVE_O_CLOEXEC@

In case it's of any use the diff for libleveldb.vcxproj is:

diff --git a/build_msvc/libleveldb/libleveldb.vcxproj b/build_msvc/libleveldb/libleveldb.vcxproj
index f855923c6..ba6a86fdc 100644
--- a/build_msvc/libleveldb/libleveldb.vcxproj
+++ b/build_msvc/libleveldb/libleveldb.vcxproj
@@ -24,8 +24,6 @@
     <ClCompile Include="..\..\src\leveldb\db\version_set.cc" />
     <ClCompile Include="..\..\src\leveldb\db\write_batch.cc" />
     <ClCompile Include="..\..\src\leveldb\helpers\memenv\memenv.cc" />
-    <ClCompile Include="..\..\src\leveldb\port\port_posix_sse.cc" />
-    <ClCompile Include="..\..\src\leveldb\port\port_win.cc" />
     <ClCompile Include="..\..\src\leveldb\table\block.cc" />
     <ClCompile Include="..\..\src\leveldb\table\block_builder.cc" />
     <ClCompile Include="..\..\src\leveldb\table\filter_block.cc" />
@@ -42,7 +40,7 @@
     <ClCompile Include="..\..\src\leveldb\util\comparator.cc" />
     <ClCompile Include="..\..\src\leveldb\util\crc32c.cc" />
     <ClCompile Include="..\..\src\leveldb\util\env.cc" />
-    <ClCompile Include="..\..\src\leveldb\util\env_win.cc" />
+    <ClCompile Include="..\..\src\leveldb\util\env_windows.cc" />
     <ClCompile Include="..\..\src\leveldb\util\filter_policy.cc" />
     <ClCompile Include="..\..\src\leveldb\util\hash.cc" />
     <ClCompile Include="..\..\src\leveldb\util\histogram.cc" />
@@ -52,7 +50,7 @@
   </ItemGroup>
   <ItemDefinitionGroup>
     <ClCompile>
-        <PreprocessorDefinitions>_CRT_NONSTDC_NO_DEPRECATE;LEVELDB_PLATFORM_WINDOWS;LEVELDB_ATOMIC_PRESENT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+        <PreprocessorDefinitions>HAVE_CRC32C=0;HAVE_SNAPPY=0;__STDC_LIMIT_MACROS;LEVELDB_IS_BIG_ENDIAN=0;_UNICODE;UNICODE;_CRT_NONSTDC_NO_DEPRECATE;LEVELDB_PLATFORM_WINDOWS;LEVELDB_ATOMIC_PRESENT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
         <DisableSpecificWarnings>4244;4267;4312;</DisableSpecificWarnings>
         <AdditionalIncludeDirectories>..\..\src\leveldb;..\..\src\leveldb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
        </ClCompile>

@laanwj
Copy link
Member Author

laanwj commented Nov 7, 2019

In case it's of any use the diff for libleveldb.vcxproj is:

Thanks, I'll include that!

Are any of the preprocessor defines below relevant for Windows?

I think they're only used in env_posix.cc? Yes, they are, so indeed they're irrelevant on windows.

@laanwj
Copy link
Member Author

laanwj commented Nov 8, 2019

AppVeyor fails on some warning that is promoted to error, for an unreachable destructor.

C:\projects\bitcoin\src\leveldb\util\env_windows.cc(383): error C2220: the following warning is treated as an error [C:\projects\bitcoin\build_msvc\bitcoind\bitcoind.vcxproj]
C:\projects\bitcoin\src\leveldb\util\env_windows.cc(383): warning C4722: 'leveldb::`anonymous namespace'::WindowsEnv::~WindowsEnv': destructor never returns, potential memory leak [C:\projects\bitcoin\build_msvc\bitcoind\bitcoind.vcxproj]

Did you need some flag changes too?

@fanquake
Copy link
Member

fanquake commented Nov 8, 2019

Concept ACK - have not reviewed the changes yet. Only done some minimal does it compile + start running tests. Started testing going between leveldb versions on macOS.

macOS (fed6a9b + depends):

checking for fdatasync... no
checking for F_FULLFSYNC... yes
checking for O_CLOEXEC... yes
checking for __builtin_prefetch... yes
checking for _mm_prefetch... yes
checking for strong getauxval support in the system headers... no
checking for weak getauxval support in the compiler... yes
....
LevelDB using max_open_files=1000 (default=1000)

openBSD 6.6 (fed6a9b)

checking for fdatasync... yes
checking for F_FULLFSYNC... no
checking for O_CLOEXEC... yes
checking for __builtin_prefetch... yes
checking for _mm_prefetch... yes
checking for strong getauxval support in the system headers... no
checking for weak getauxval support in the compiler... yes
....
LevelDB using max_open_files=1000 (default=1000)

Windows 10 (WSL) (fed6a9b + depends)

checking for fdatasync... no
checking for F_FULLFSYNC... no
checking for O_CLOEXEC... no
checking for __builtin_prefetch... yes
checking for _mm_prefetch... yes
checking for strong getauxval support in the system headers... no
checking for weak getauxval support in the compiler... yes
...
LevelDB using max_open_files=1000 (default=1000)

@laanwj
Copy link
Member Author

laanwj commented Nov 8, 2019

@fanquake thanks for testing, good to hear that this is not causing build failure anywhere, and that it works with regard to file dscriptors setting

@laanwj laanwj changed the title WIP: build: Update leveldb to 1.22+ build: Update leveldb to 1.22+ Nov 10, 2019
@laanwj
Copy link
Member Author

laanwj commented Nov 10, 2019

Squashed fixup commits and removed WIP tag. Should be ready for review/testing.

@sipa
Copy link
Member

sipa commented Nov 11, 2019

ACK.

Concept: very happy to get rid of all those local modifications.

Code review: I reviewed the diff between upstream LevelDB and our new branch (but not the changes in upstream LevelDB), and the new commits here. I left two nit comments on one of the commits.

Tests:

  • I verified that the crc32 asm code is being executed on x86_64 by adding asserts before the asm commands in the crc32 lib.
  • I took a datadir that was a few weeks out of date on an x86_64 machine, started it with this branch, and ran with -checkblocks=500. No issues.
  • I let this datadir sync with the network, interrupting it from time to time to force a flush.
  • I ran gettxoutsetinfo on this branch on the resulting datadir, and compared it with a node that has been running master as of a few weeks.
  • I restarted with master, let it sync another 3 blocks, and ran gettxoutsetinfo again, and compared it again with another node.

I did observe a segfault in the script verification thread once, which was very surprising. As the script verification threads shouldn't be doing any LevelDB stuff this should be unrelated, but scary regardless. I do have a large number of weird dmesg lines on this system, so this may be a hardware issue. I've been unable to reproduce the problem.

@sipsorcery
Copy link
Member

tACK* e2ef5fb.

*test on Windows (full sync, as well as catching up an existing node)

@sipa
Copy link
Member

sipa commented Nov 11, 2019

Is commit abd50f1 still needed?

@laanwj
Copy link
Member Author

laanwj commented Nov 12, 2019

Thanks for testing!

Is commit abd50f1 still needed?

The subtree check in travis didn't pass without it. I could try removing it, but I think that's still the case.

I don't understand how it's supposed to pass in the first place for the other dependencies without ever fetching them as described in the doc? Or does travis do this hidden?

@maflcko
Copy link
Member

maflcko commented Nov 12, 2019

We only check that it is a subtree, not that the subtree corresponds to some subtree hosted somewhere else.

@laanwj
Copy link
Member Author

laanwj commented Nov 12, 2019

We only check that it is a subtree, not that the subtree corresponds to some subtree hosted somewhere else.

Are you sure? Now I'm doubly confused why that commit makes a difference at all (the literal error message was something like "Could not find commit XXXXXX"). Did I subtree correctly?

@maflcko
Copy link
Member

maflcko commented Nov 12, 2019

Maybe the script doesn't work for initial subtree check ins?

@laanwj
Copy link
Member Author

laanwj commented Nov 15, 2019

I don't understand why that would be the case. What is the difference between this tree, and the tree when it is merged into master, that would make it pass a subtree check? In both cases the merge of crc32c is simply an ancestor, it's one merge deeper then.

(and if it is the case, what should we do, merge with this commit, or merge without it and hope everything will be alright after merging? Both seems suboptimal. Is this the first time that this comes up?)

@DrahtBot
Copy link
Contributor

Gitian builds

File commit 2755b2b
(master)
commit 70e9122
(master and this pull)
bitcoin-0.19.99-aarch64-linux-gnu-debug.tar.gz d9f76eed7292db66... 51c9e3dac3ac2230...
bitcoin-0.19.99-aarch64-linux-gnu.tar.gz 991ceaaa306e7256... 0deea89e75f33afa...
bitcoin-0.19.99-arm-linux-gnueabihf-debug.tar.gz 5e65de5db1d26366... 78071eb16ce18633...
bitcoin-0.19.99-arm-linux-gnueabihf.tar.gz d6e7e70ded47ed40... 23bdb6d002082384...
bitcoin-0.19.99-i686-pc-linux-gnu-debug.tar.gz 7291d221cf1c82ea... 9426090e6d3682a5...
bitcoin-0.19.99-i686-pc-linux-gnu.tar.gz 65996e392047c324... 6bcc429f3ec6243a...
bitcoin-0.19.99-osx-unsigned.dmg 626810fe317f861f... f3f5336ccb302e72...
bitcoin-0.19.99-osx64.tar.gz d1c4da450e1c21ca... c3bd1cb9e3596649...
bitcoin-0.19.99-riscv64-linux-gnu-debug.tar.gz fa07ad9df3873e01... 5fff2b53851da121...
bitcoin-0.19.99-riscv64-linux-gnu.tar.gz bdc87d12866745c7... 2989fc88dec60d75...
bitcoin-0.19.99-win64-debug.zip 04bf9d8348047394... c41c4ce97cf469cc...
bitcoin-0.19.99-win64-setup-unsigned.exe 3a3d9f777a4d6f7b... bc1baac4046e331f...
bitcoin-0.19.99-win64.zip 4affa9e22017fd56... 41f613088d01bfea...
bitcoin-0.19.99-x86_64-linux-gnu-debug.tar.gz 9708db2be1a83810... c21c54b15ba00c80...
bitcoin-0.19.99-x86_64-linux-gnu.tar.gz dbd913431b4fffeb... 376b037411c31f84...
bitcoin-0.19.99.tar.gz 7633410fae67c4c9... 6c8c461153e99da8...
bitcoin-core-linux-0.20-res.yml 0febf2425f4cb930... ae1d42e19de922a1...
bitcoin-core-osx-0.20-res.yml 8b15f8fa745c846b... 785b5e57247c7d50...
bitcoin-core-win-0.20-res.yml e2316850d6d3f136... 08bced12b63a5c3c...
linux-build.log c9fa85b07203468d... f0542e43e86df3b1...
osx-build.log 7eaf304e994ca739... 949e3c318f9f07e0...
win-build.log 702c8ee119486896... 93709dd7b58683cd...
bitcoin-core-linux-0.20-res.yml.diff 0de97ee3c19cdc73...
bitcoin-core-osx-0.20-res.yml.diff 2fd1f4c684b8a3be...
bitcoin-core-win-0.20-res.yml.diff 92cb89695e6ac398...
linux-build.log.diff 1eb20e0d62d4f442...
osx-build.log.diff ed7976e73978e241...
win-build.log.diff 4f4d26c60e5d428e...

@laanwj
Copy link
Member Author

laanwj commented Feb 5, 2020

Anything left to do here? If not, can this get some (re-)ACKs please?

@sipsorcery
Copy link
Member

ACK 6648082.

No problems using a data directory of "₿_🏃" on Windows 10.

@sipa
Copy link
Member

sipa commented Feb 8, 2020

ACK 677fb8e

laanwj added a commit that referenced this pull request Feb 10, 2020
677fb8e test: Add ubsan surpression for crc32c (Wladimir J. van der Laan)
8e68bb1 build: Disable msvc warning 4722 for leveldb build (Aaron Clauson)
be23949 build: MSVC changes for leveldb update (Aaron Clauson)
9ebdf04 build: CRC32C build system integration (Wladimir J. van der Laan)
402252a build: Add LCOV exception for crc32c (Wladimir J. van der Laan)
3a037d0 test: Add crc32c exception to various linters and generation scripts (Wladimir J. van der Laan)
84ff1b2 test: Add crc32c to subtree check linter (Wladimir J. van der Laan)
7cf13a5 doc: Add crc32c subtree to developer notes (Wladimir J. van der Laan)
24d02a9 build: Update build system for new leveldb (Wladimir J. van der Laan)
2e18193 Squashed 'src/crc32c/' content from commit 224988680f7673cd7c769963d4035cb315aa3388 (Wladimir J. van der Laan)
6648082 Squashed 'src/leveldb/' changes from f545dfa..f8ae182c1e5176d12e816fb2217ae33a5472fdd7 (Wladimir J. van der Laan)

Pull request description:

  This updates leveldb to currently newest upstream commit bitcoin-core/leveldb-subtree@0c40829:

  - CRC32C hardware acceleration is now an external library [crc32c](https://github.com/google/crc32c). This adds acceleration on ARM, and should be faster on x86 because of using prefetch. It also makes it easy to support similar instruction sets on other platforms in the future.
  - Thread handling uses C++11, instead of platform specific code.
  - Native windows environment was added. No need to maintain our own hacky one, anymore.
  - Upstream now builds using CMake. This doesn't mean we need to use that (phew), but internal configuration changed to a a series of checks, instead of OS profiles. This means the blanket error "Cannot build leveldb for $host. Please file a bug report' is removed.

  All changes: google/leveldb@a53934a...0c40829

  Pretty much all our changes have been subsumed by upstream, so we figured it was cleaner to start over with a new branch from upstream with the still-relevant patches applied: https://github.com/bitcoin-core/leveldb/tree/bitcoin-fork-new

  There's quite some testing to be done (see below). See bitcoin-core/leveldb-subtree#25 and bitcoin-core/leveldb-subtree#26 for more history and context.

  TODO:
  - [x] Subtree `crc32c`
  - [x] Make linters happy about crc32 subtree
  - [x] Integrate `crc32c` library into build system
  - [x] MSVC build system

ACKs for top commit:
  sipa:
    ACK 677fb8e

Tree-SHA512: 37ee92a750e053e924bc4626b12bb3fd81faa9f8c5ebaa343931fee810c45ba05aa6051fdea82535fa351bf2be7297801b98af9469865fc5ead771650a5d6240
@laanwj laanwj merged commit 677fb8e into bitcoin:master Feb 10, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 18, 2020
677fb8e test: Add ubsan surpression for crc32c (Wladimir J. van der Laan)
8e68bb1 build: Disable msvc warning 4722 for leveldb build (Aaron Clauson)
be23949 build: MSVC changes for leveldb update (Aaron Clauson)
9ebdf04 build: CRC32C build system integration (Wladimir J. van der Laan)
402252a build: Add LCOV exception for crc32c (Wladimir J. van der Laan)
3a037d0 test: Add crc32c exception to various linters and generation scripts (Wladimir J. van der Laan)
84ff1b2 test: Add crc32c to subtree check linter (Wladimir J. van der Laan)
7cf13a5 doc: Add crc32c subtree to developer notes (Wladimir J. van der Laan)
24d02a9 build: Update build system for new leveldb (Wladimir J. van der Laan)
2e18193 Squashed 'src/crc32c/' content from commit 224988680f7673cd7c769963d4035cb315aa3388 (Wladimir J. van der Laan)
6648082 Squashed 'src/leveldb/' changes from f545dfa..f8ae182c1e5176d12e816fb2217ae33a5472fdd7 (Wladimir J. van der Laan)

Pull request description:

  This updates leveldb to currently newest upstream commit bitcoin-core/leveldb-subtree@0c40829:

  - CRC32C hardware acceleration is now an external library [crc32c](https://github.com/google/crc32c). This adds acceleration on ARM, and should be faster on x86 because of using prefetch. It also makes it easy to support similar instruction sets on other platforms in the future.
  - Thread handling uses C++11, instead of platform specific code.
  - Native windows environment was added. No need to maintain our own hacky one, anymore.
  - Upstream now builds using CMake. This doesn't mean we need to use that (phew), but internal configuration changed to a a series of checks, instead of OS profiles. This means the blanket error "Cannot build leveldb for $host. Please file a bug report' is removed.

  All changes: google/leveldb@a53934a...0c40829

  Pretty much all our changes have been subsumed by upstream, so we figured it was cleaner to start over with a new branch from upstream with the still-relevant patches applied: https://github.com/bitcoin-core/leveldb/tree/bitcoin-fork-new

  There's quite some testing to be done (see below). See bitcoin-core/leveldb-subtree#25 and bitcoin-core/leveldb-subtree#26 for more history and context.

  TODO:
  - [x] Subtree `crc32c`
  - [x] Make linters happy about crc32 subtree
  - [x] Integrate `crc32c` library into build system
  - [x] MSVC build system

ACKs for top commit:
  sipa:
    ACK 677fb8e

Tree-SHA512: 37ee92a750e053e924bc4626b12bb3fd81faa9f8c5ebaa343931fee810c45ba05aa6051fdea82535fa351bf2be7297801b98af9469865fc5ead771650a5d6240
fanquake added a commit that referenced this pull request May 11, 2020
6853727 build: Enable -Werror=sign-compare (Ben Woosley)
eac6a30 refactor: Rework asmap Interpret to avoid ptrdiff_t (Ben Woosley)
df37377 test: Fix outstanding -Wsign-compare errors (Ben Woosley)

Pull request description:

  Disallowing sign-comparison mismatches can help to prevent the introduction of overflow and interpretation bugs.

  In this case, ~all~ most existing violations are in the tests, and most simply required annotating the literal as unsigned for comparison.

  This was previously prevented by violations in leveldb which were fixed upstream and merged in #17398. You can test that by building this branch against: 22d1118 vs 75fb37c

ACKs for top commit:
  fjahr:
    re-ACK 6853727
  practicalswift:
    ACK 6853727

Tree-SHA512: 14b5daa38c496fb51548feb30fb4dd179e6f76a8d355f52bc8e2a18f2f9340f0bc98dcf36d8b3d6521045d013891c3103749a4eda88ceef00202a6a0cf93f73c
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Jul 31, 2020
9029d86 add crc32c subtree to linter (Fuzzbawls)
f9b99e9 cmake: crc32c and leveldb native integration (Fuzzbawls)
7478a81 build: CRC32C build system integration (Wladimir J. van der Laan)
18366bf build: add LCOV exception for crc32c (Fuzzbawls)
d6e0aa2 test: add crc32c exception to generation scripts (Fuzzbawls)
6270118 doc: Add crc32c subtree to developer notes (Wladimir J. van der Laan)
de6c30e build: Update build system for new leveldb (Wladimir J. van der Laan)
c0752b7 Squashed 'src/crc32c/' content from commit 224988680f (Fuzzbawls)
9cabe58 Squashed 'src/leveldb/' changes from 64052c7..0c40829872 (Fuzzbawls)

Pull request description:

  Backport of bitcoin#17398, original description:

  > This updates leveldb to currently newest upstream commit bitcoin-core/leveldb-subtree@0c40829:
  >
  >* CRC32C hardware acceleration is now an external library [crc32c](https://github.com/google/crc32c). This adds acceleration on ARM, and should be faster on x86 because of using prefetch. It also makes it easy to support similar instruction sets on other platforms in the future.
  >* Thread handling uses C++11, instead of platform specific code.
  >* Native windows environment was added. No need to maintain our own hacky one, anymore.
  >* Upstream now builds using CMake. This doesn't mean we need to use that (phew), but internal configuration changed to a series of checks, instead of OS profiles. This means the blanket error "Cannot build leveldb for $host. Please file a bug report' is removed.

  >All changes: google/leveldb@a53934a...0c40829

  >Pretty much all our changes have been subsumed by upstream, so we figured it was cleaner to start over with a new branch from upstream with the still-relevant patches applied: https://github.com/bitcoin-core/leveldb/tree/bitcoin-fork-new

  Additional work was done to ensure compatibility with our CMake build system, but our primary Autotools build system maintains the approach of defining build targets is `Makefile.leveldb.include` and `Makefile.crc32c.include`

ACKs for top commit:
  furszy:
    nice update, ACK 9029d86
  random-zebra:
    ACK 9029d86 and merging...

Tree-SHA512: d2907a1a63b4958f351144eb62aa5d1b8d4666e54a45a96f35d8e3f243ed45ceefbb24554a1f25f89e5f9aec8aa4c92cf89f93586e80576c44d55767548bbc42
sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
677fb8e test: Add ubsan surpression for crc32c (Wladimir J. van der Laan)
8e68bb1 build: Disable msvc warning 4722 for leveldb build (Aaron Clauson)
be23949 build: MSVC changes for leveldb update (Aaron Clauson)
9ebdf04 build: CRC32C build system integration (Wladimir J. van der Laan)
402252a build: Add LCOV exception for crc32c (Wladimir J. van der Laan)
3a037d0 test: Add crc32c exception to various linters and generation scripts (Wladimir J. van der Laan)
84ff1b2 test: Add crc32c to subtree check linter (Wladimir J. van der Laan)
7cf13a5 doc: Add crc32c subtree to developer notes (Wladimir J. van der Laan)
24d02a9 build: Update build system for new leveldb (Wladimir J. van der Laan)
2e18193 Squashed 'src/crc32c/' content from commit 224988680f7673cd7c769963d4035cb315aa3388 (Wladimir J. van der Laan)
6648082 Squashed 'src/leveldb/' changes from f545dfa..f8ae182c1e5176d12e816fb2217ae33a5472fdd7 (Wladimir J. van der Laan)

Pull request description:

  This updates leveldb to currently newest upstream commit bitcoin-core/leveldb-subtree@0c40829:

  - CRC32C hardware acceleration is now an external library [crc32c](https://github.com/google/crc32c). This adds acceleration on ARM, and should be faster on x86 because of using prefetch. It also makes it easy to support similar instruction sets on other platforms in the future.
  - Thread handling uses C++11, instead of platform specific code.
  - Native windows environment was added. No need to maintain our own hacky one, anymore.
  - Upstream now builds using CMake. This doesn't mean we need to use that (phew), but internal configuration changed to a a series of checks, instead of OS profiles. This means the blanket error "Cannot build leveldb for $host. Please file a bug report' is removed.

  All changes: google/leveldb@a53934a...0c40829

  Pretty much all our changes have been subsumed by upstream, so we figured it was cleaner to start over with a new branch from upstream with the still-relevant patches applied: https://github.com/bitcoin-core/leveldb/tree/bitcoin-fork-new

  There's quite some testing to be done (see below). See bitcoin-core/leveldb-subtree#25 and bitcoin-core/leveldb-subtree#26 for more history and context.

  TODO:
  - [x] Subtree `crc32c`
  - [x] Make linters happy about crc32 subtree
  - [x] Integrate `crc32c` library into build system
  - [x] MSVC build system

ACKs for top commit:
  sipa:
    ACK 677fb8e

Tree-SHA512: 37ee92a750e053e924bc4626b12bb3fd81faa9f8c5ebaa343931fee810c45ba05aa6051fdea82535fa351bf2be7297801b98af9469865fc5ead771650a5d6240
PastaPastaPasta pushed a commit to dashpay/dash that referenced this pull request Jul 15, 2021
* Update to leveldb upstream using subtree merge

* Import crc32c using subtree merge as as 'src/crc32c'

* build: Update build system for new leveldb

Upstream leveldb switched build systems, which means we need to define
a few different values.

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>

* doc: Add crc32c subtree to developer notes

* test: Add crc32c to subtree check linter

* test: Add crc32c exception to various linters and generation scripts

* build: Add LCOV exception for crc32c

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>

* build: CRC32C build system integration

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 6, 2021
6853727 build: Enable -Werror=sign-compare (Ben Woosley)
eac6a30 refactor: Rework asmap Interpret to avoid ptrdiff_t (Ben Woosley)
df37377 test: Fix outstanding -Wsign-compare errors (Ben Woosley)

Pull request description:

  Disallowing sign-comparison mismatches can help to prevent the introduction of overflow and interpretation bugs.

  In this case, ~all~ most existing violations are in the tests, and most simply required annotating the literal as unsigned for comparison.

  This was previously prevented by violations in leveldb which were fixed upstream and merged in bitcoin#17398. You can test that by building this branch against: 22d1118 vs 75fb37c

ACKs for top commit:
  fjahr:
    re-ACK 6853727
  practicalswift:
    ACK 6853727

Tree-SHA512: 14b5daa38c496fb51548feb30fb4dd179e6f76a8d355f52bc8e2a18f2f9340f0bc98dcf36d8b3d6521045d013891c3103749a4eda88ceef00202a6a0cf93f73c
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 6, 2021
6853727 build: Enable -Werror=sign-compare (Ben Woosley)
eac6a30 refactor: Rework asmap Interpret to avoid ptrdiff_t (Ben Woosley)
df37377 test: Fix outstanding -Wsign-compare errors (Ben Woosley)

Pull request description:

  Disallowing sign-comparison mismatches can help to prevent the introduction of overflow and interpretation bugs.

  In this case, ~all~ most existing violations are in the tests, and most simply required annotating the literal as unsigned for comparison.

  This was previously prevented by violations in leveldb which were fixed upstream and merged in bitcoin#17398. You can test that by building this branch against: 22d1118 vs 75fb37c

ACKs for top commit:
  fjahr:
    re-ACK 6853727
  practicalswift:
    ACK 6853727

Tree-SHA512: 14b5daa38c496fb51548feb30fb4dd179e6f76a8d355f52bc8e2a18f2f9340f0bc98dcf36d8b3d6521045d013891c3103749a4eda88ceef00202a6a0cf93f73c
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 10, 2021
6853727 build: Enable -Werror=sign-compare (Ben Woosley)
eac6a30 refactor: Rework asmap Interpret to avoid ptrdiff_t (Ben Woosley)
df37377 test: Fix outstanding -Wsign-compare errors (Ben Woosley)

Pull request description:

  Disallowing sign-comparison mismatches can help to prevent the introduction of overflow and interpretation bugs.

  In this case, ~all~ most existing violations are in the tests, and most simply required annotating the literal as unsigned for comparison.

  This was previously prevented by violations in leveldb which were fixed upstream and merged in bitcoin#17398. You can test that by building this branch against: 22d1118 vs 75fb37c

ACKs for top commit:
  fjahr:
    re-ACK 6853727
  practicalswift:
    ACK 6853727

Tree-SHA512: 14b5daa38c496fb51548feb30fb4dd179e6f76a8d355f52bc8e2a18f2f9340f0bc98dcf36d8b3d6521045d013891c3103749a4eda88ceef00202a6a0cf93f73c
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 12, 2021
6853727 build: Enable -Werror=sign-compare (Ben Woosley)
eac6a30 refactor: Rework asmap Interpret to avoid ptrdiff_t (Ben Woosley)
df37377 test: Fix outstanding -Wsign-compare errors (Ben Woosley)

Pull request description:

  Disallowing sign-comparison mismatches can help to prevent the introduction of overflow and interpretation bugs.

  In this case, ~all~ most existing violations are in the tests, and most simply required annotating the literal as unsigned for comparison.

  This was previously prevented by violations in leveldb which were fixed upstream and merged in bitcoin#17398. You can test that by building this branch against: 22d1118 vs 75fb37c

ACKs for top commit:
  fjahr:
    re-ACK 6853727
  practicalswift:
    ACK 6853727

Tree-SHA512: 14b5daa38c496fb51548feb30fb4dd179e6f76a8d355f52bc8e2a18f2f9340f0bc98dcf36d8b3d6521045d013891c3103749a4eda88ceef00202a6a0cf93f73c
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 12, 2021
6853727 build: Enable -Werror=sign-compare (Ben Woosley)
eac6a30 refactor: Rework asmap Interpret to avoid ptrdiff_t (Ben Woosley)
df37377 test: Fix outstanding -Wsign-compare errors (Ben Woosley)

Pull request description:

  Disallowing sign-comparison mismatches can help to prevent the introduction of overflow and interpretation bugs.

  In this case, ~all~ most existing violations are in the tests, and most simply required annotating the literal as unsigned for comparison.

  This was previously prevented by violations in leveldb which were fixed upstream and merged in bitcoin#17398. You can test that by building this branch against: 22d1118 vs 75fb37c

ACKs for top commit:
  fjahr:
    re-ACK 6853727
  practicalswift:
    ACK 6853727

Tree-SHA512: 14b5daa38c496fb51548feb30fb4dd179e6f76a8d355f52bc8e2a18f2f9340f0bc98dcf36d8b3d6521045d013891c3103749a4eda88ceef00202a6a0cf93f73c
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 12, 2021
6853727 build: Enable -Werror=sign-compare (Ben Woosley)
eac6a30 refactor: Rework asmap Interpret to avoid ptrdiff_t (Ben Woosley)
df37377 test: Fix outstanding -Wsign-compare errors (Ben Woosley)

Pull request description:

  Disallowing sign-comparison mismatches can help to prevent the introduction of overflow and interpretation bugs.

  In this case, ~all~ most existing violations are in the tests, and most simply required annotating the literal as unsigned for comparison.

  This was previously prevented by violations in leveldb which were fixed upstream and merged in bitcoin#17398. You can test that by building this branch against: 22d1118 vs 75fb37c

ACKs for top commit:
  fjahr:
    re-ACK 6853727
  practicalswift:
    ACK 6853727

Tree-SHA512: 14b5daa38c496fb51548feb30fb4dd179e6f76a8d355f52bc8e2a18f2f9340f0bc98dcf36d8b3d6521045d013891c3103749a4eda88ceef00202a6a0cf93f73c
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants