Skip to content

Commit

Permalink
compat: remove glibcxx sanity checks
Browse files Browse the repository at this point in the history
These checks were added in #4339, (see also #4081), to test
our back-compat stubs, however, those stubs no-longer exist (#22930),
meaning that these checks are now just testing some specific standard
library behaviour, without a particular rationale, or reason, compared
to any other standard library functions we use.

There has also been some discussion about the sanity checks in the
context of the libbitcoinkernel refactoring, see
bitcoin/bitcoin#25065 (comment).
Removing the checks removes the need to worry about atleast the glibcxx
checks.

Also remove the list of check from the doc in init.h, because it is
incomplete, and anyone who wants to know what checks are included can
look at the function.
  • Loading branch information
fanquake authored and janus committed Aug 2, 2022
1 parent afa02d6 commit f2b5f7e
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 85 deletions.
5 changes: 0 additions & 5 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ BGL_CORE_H = \
compat/byteswap.h \
compat/cpuid.h \
compat/endian.h \
compat/sanity.h \
compressor.h \
consensus/consensus.h \
consensus/tx_check.h \
Expand Down Expand Up @@ -640,15 +639,12 @@ libBGL_common_a_SOURCES = \
$(BGL_CORE_H)

# util: shared between all executables.
# This library *must* be included to make sure that the glibc
# sanity checks are linked.
libBGL_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BGL_INCLUDES)
libBGL_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libBGL_util_a_SOURCES = \
support/lockedpool.cpp \
chainparamsbase.cpp \
clientversion.cpp \
compat/glibcxx_sanity.cpp \
fs.cpp \
interfaces/echo.cpp \
interfaces/handler.cpp \
Expand Down Expand Up @@ -868,7 +864,6 @@ libBGLkernel_la_SOURCES = \
chainparams.cpp \
clientversion.cpp \
coins.cpp \
compat/glibcxx_sanity.cpp \
compressor.cpp \
consensus/merkle.cpp \
consensus/tx_check.cpp \
Expand Down
62 changes: 0 additions & 62 deletions src/compat/glibcxx_sanity.cpp

This file was deleted.

10 changes: 0 additions & 10 deletions src/compat/sanity.h

This file was deleted.

1 change: 0 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <blockfilter.h>
#include <chain.h>
#include <chainparams.h>
#include <compat/sanity.h>
#include <consensus/amount.h>
#include <deploymentstatus.h>
#include <fs.h>
Expand Down
2 changes: 1 addition & 1 deletion src/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bool AppInitBasicSetup(const ArgsManager& args);
*/
bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandbox = true);
/**
* Initialization sanity checks: ecc init, sanity checks, dir lock.
* Initialization sanity checks.
* @note This can be done before daemonization. Do not call Shutdown() if this function fails.
* @pre Parameters should be parsed and config file should be read, AppInitParameterInteraction should have been called.
*/
Expand Down
4 changes: 0 additions & 4 deletions src/init/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#endif

#include <clientversion.h>
#include <compat/sanity.h>
#include <crypto/sha256.h>
#include <fs.h>
#include <key.h>
Expand Down Expand Up @@ -49,9 +48,6 @@ bool SanityChecks()
return InitError(Untranslated("Elliptic curve cryptography sanity check failure. Aborting."));
}

if (!glibcxx_sanity_test())
return false;

if (!Random_SanityCheck()) {
return InitError(Untranslated("OS cryptographic RNG sanity check failure. Aborting."));
}
Expand Down
2 changes: 0 additions & 2 deletions src/test/sanity_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <compat/sanity.h>
#include <key.h>
#include <test/util/setup_common.h>
#include <util/time.h>
Expand All @@ -13,7 +12,6 @@ BOOST_FIXTURE_TEST_SUITE(sanity_tests, BasicTestingSetup)

BOOST_AUTO_TEST_CASE(basic_sanity)
{
BOOST_CHECK_MESSAGE(glibcxx_sanity_test() == true, "stdlib sanity test");
BOOST_CHECK_MESSAGE(ECC_InitSanityCheck() == true, "secp256k1 sanity test");
BOOST_CHECK_MESSAGE(ChronoSanityCheck() == true, "chrono epoch test");
}
Expand Down

0 comments on commit f2b5f7e

Please sign in to comment.