Skip to content

Commit

Permalink
Merge branch 'development' into testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Mar 13, 2024
2 parents 0f12dbf + a16718f commit 760262c
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 82 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/)
and this project adheres to [Semantic Versioning](https://semver.org/).

## [5.4.7.0], 2024-03-13, leisure

### Added
- net, consensus: Ban nodes 5.4.5.0 and below #2751 (@jamescowens)

### Changed

### Removed

### Fixed
- util: Adjust Fraction class addition overload overflow tests #2748 (@jamescowens)

## [5.4.6.0], 2024-03-02, leisure, "Miss Piggy"

### Added
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
cmake_minimum_required(VERSION 3.18)

project("Gridcoin"
VERSION 5.4.6.1
VERSION 5.4.7.1
DESCRIPTION "POS-based cryptocurrency that rewards BOINC computation"
HOMEPAGE_URL "https://gridcoin.us"
LANGUAGES ASM C CXX
Expand Down
24 changes: 22 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 5)
define(_CLIENT_VERSION_MINOR, 4)
define(_CLIENT_VERSION_REVISION, 6)
define(_CLIENT_VERSION_REVISION, 7)
define(_CLIENT_VERSION_BUILD, 1)
define(_CLIENT_VERSION_IS_RELEASE, false)
define(_COPYRIGHT_YEAR, 2024)
Expand Down Expand Up @@ -278,6 +278,16 @@ if test "$CXXFLAGS_overridden" = "no"; then
AX_CHECK_COMPILE_FLAG([-Wdeprecated-copy],[CXXFLAGS="$CXXFLAGS -Wno-deprecated-copy"],,[[$CXXFLAG_WERROR]])
fi


dnl x87 FP operations on x86 hosts can break assumptions made about the floating point values.
dnl See the commit message which introduced this change for more details.
case $host in
i?86-*|x86_64-*)
AX_CHECK_COMPILE_FLAG([-msse2],[CXXFLAGS="$CXXFLAGS -msse2 -mfpmath=sse"],[AC_MSG_ERROR([SSE2 support is required on x86 targets.])],[[$CXXFLAG_WERROR]])
;;
*) ;;
esac

enable_sse42=no
enable_sse41=no
enable_avx2=no
Expand Down Expand Up @@ -1009,10 +1019,20 @@ dnl Check for Boost libs
AX_BOOST_BASE([MINIMUM_REQUIRED_BOOST])
AX_BOOST_SYSTEM
AX_BOOST_FILESYSTEM
AX_BOOST_THREAD
AX_BOOST_ZLIB
AX_BOOST_IOSTREAMS

dnl Prevent use of std::unary_function, which was removed in C++17,
dnl and will generate warnings with newer compilers for Boost
dnl older than 1.80.
dnl See: https://github.com/boostorg/config/pull/430.
AX_CHECK_PREPROC_FLAG([-DBOOST_NO_CXX98_FUNCTION_BASE], [BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_NO_CXX98_FUNCTION_BASE"], [], [$CXXFLAG_WERROR],
[AC_LANG_PROGRAM([[#include <boost/config.hpp>]])])

dnl AX_BOOST_THREAD check also triggers the same issue, so it has to be checked after
dnl setting -DBOOST_NO_CXX98_FUNCTION_BASE.
AX_BOOST_THREAD

dnl Boost 1.56 through 1.62 allow using std::atomic instead of its own atomic
dnl counter implementations. In 1.63 and later the std::atomic approach is default.
m4_pattern_allow(DBOOST_AC_USE_STD_ATOMIC) dnl otherwise it's treated like a macro
Expand Down
2 changes: 1 addition & 1 deletion depends/packages/boost.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ifneq (,$(findstring clang,$($(package)_cxx)))
endif
$(package)_archiver_$(host_os)=$($(package)_ar)
$(package)_config_libraries=filesystem,system,thread,test,iostreams
$(package)_cxxflags+=-std=c++17
$(package)_cxxflags+=-std=c++17 -DBOOST_NO_CXX98_FUNCTION_BASE
$(package)_cxxflags_linux=-fPIC
$(package)_cxxflags_android=-fPIC
endef
Expand Down
2 changes: 1 addition & 1 deletion depends/packages/libzip.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ define $(package)_build_cmds
endef

define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install
$(MAKE) DESTDIR=$($(package)_staging_dir) install -j1
endef
2 changes: 2 additions & 0 deletions depends/packages/qt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ $(package)_patches += qtbase-moc-ignore-gcc-macro.patch
$(package)_patches += no_qrhi.patch
$(package)_patches += drop_lrelease_dependency.patch
$(package)_patches += subdirs.pro
$(package)_patches += fix-macos-linker.patch

$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
$(package)_qttranslations_sha256_hash=c92af4171397a0ed272330b4fa0669790fcac8d050b07c8b8cc565ebeba6735e
Expand Down Expand Up @@ -255,6 +256,7 @@ endef
# CROSS_LIBRARY_PATH. See #15277.
define $(package)_preprocess_cmds
rm -f $(BASEDIR)/.qmake.stash && \
patch -p1 -i $($(package)_patch_dir)/fix-macos-linker.patch && \
patch -p1 -i $($(package)_patch_dir)/drop_lrelease_dependency.patch && \
patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \
patch -p1 -i $($(package)_patch_dir)/dont_hardcode_x86_64.patch && \
Expand Down
55 changes: 55 additions & 0 deletions depends/patches/qt/fix-macos-linker.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
qmake: Don't error out if QMAKE_DEFAULT_LIBDIRS is empty on macOS

The new linker in Xcode 15 doesn't provide any default linker or
framework paths when requested via -v, but still seems to use the
default paths documented in the ld man page.

We trust that linker will do the right thing, even if we don't
know of its default linker paths.

We also need to opt out of the default fallback logic to
set the libdirs to /lib and /usr/lib.

This may result in UnixMakefileGenerator::findLibraries finding
different libraries than expected, if additional paths are
passed with -L, which will then take precedence for qmake,
even if the linker itself will use the library from the
SDK's default paths. This should hopefully not be an issue
in practice, as we don't turn -lFoo into absolute paths in
qmake, so the only risk is that we're picking up the wrong
prl files and adding additional dependencies that the lib
in the SDK doesn't have.

Upstream commits:
- Qt 5.15.16: Not yet publicly available.
- Qt dev: cdf64b0e47115cc473e1afd1472b4b09e130b2a5

For other Qt branches see
https://codereview.qt-project.org/q/I2347b26e2df0828471373b0e15b8c9089274c65d

--- old/qtbase/mkspecs/features/toolchain.prf
+++ new/qtbase/mkspecs/features/toolchain.prf
@@ -288,9 +288,12 @@ isEmpty($${target_prefix}.INCDIRS) {
}
}
}
- isEmpty(QMAKE_DEFAULT_LIBDIRS)|isEmpty(QMAKE_DEFAULT_INCDIRS): \
+ isEmpty(QMAKE_DEFAULT_INCDIRS): \
!integrity: \
- error("failed to parse default search paths from compiler output")
+ error("failed to parse default include paths from compiler output")
+ isEmpty(QMAKE_DEFAULT_LIBDIRS): \
+ !integrity:!darwin: \
+ error("failed to parse default library paths from compiler output")
QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS)
} else: ghs {
cmd = $$QMAKE_CXX $$QMAKE_CXXFLAGS -$${LITERAL_HASH} -o /tmp/fake_output /tmp/fake_input.cpp
@@ -412,7 +415,7 @@ isEmpty($${target_prefix}.INCDIRS) {
QMAKE_DEFAULT_INCDIRS = $$split(INCLUDE, $$QMAKE_DIRLIST_SEP)
}

- unix:if(!cross_compile|host_build) {
+ unix:!darwin:if(!cross_compile|host_build) {
isEmpty(QMAKE_DEFAULT_INCDIRS): QMAKE_DEFAULT_INCDIRS = /usr/include /usr/local/include
isEmpty(QMAKE_DEFAULT_LIBDIRS): QMAKE_DEFAULT_LIBDIRS = /lib /usr/lib
}
32 changes: 26 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2049,11 +2049,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// Note the std::max is there to deal with the rollover of BlockV12Height + DISCONNECT_GRACE_PERIOD if
// BlockV12Height is set to std::numeric_limits<int>::max() which is the case during testing.
if (pfrom->nVersion < MIN_PEER_PROTO_VERSION
|| (DISCONNECT_OLD_VERSION_AFTER_GRACE_PERIOD
&& pfrom->nVersion < PROTOCOL_VERSION
&& pindexBest->nHeight > std::max(Params().GetConsensus().BlockV12Height,
Params().GetConsensus().BlockV12Height + DISCONNECT_GRACE_PERIOD)))
{
|| (DISCONNECT_OLD_VERSION_AFTER_GRACE_PERIOD
&& pfrom->nVersion < PROTOCOL_VERSION
&& pindexBest->nHeight > std::max(Params().GetConsensus().BlockV12Height,
Params().GetConsensus().BlockV12Height + DISCONNECT_GRACE_PERIOD)
)
) {
// disconnect from peers older than this proto version
LogPrint(BCLog::LogFlags::NOISY, "partner %s using obsolete version %i; disconnecting",
pfrom->addr.ToString(), pfrom->nVersion);
Expand All @@ -2064,8 +2065,27 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,

if (!vRecv.empty())
vRecv >> addrFrom >> nNonce;
if (!vRecv.empty())

if (!vRecv.empty()) {
vRecv >> pfrom->strSubVer;

// This handles the special disconnect for clients between the mandatory 5.4.0.0 and the 5.4.5.0 since
// 5.4.6.0 effectively became a mandatory due to the contract version error in TxMessage. The protocol version
// was not incremented since 5.4.6.0 was originally a leisure and so this is the only reasonable way to distinguish
// in this situation.
if (pfrom->strSubVer.find("5.4.5") != std::string::npos
|| pfrom->strSubVer.find("5.4.4") != std::string::npos
|| pfrom->strSubVer.find("5.4.3") != std::string::npos
|| pfrom->strSubVer.find("5.4.2") != std::string::npos
|| pfrom->strSubVer.find("5.4.1") != std::string::npos
|| pfrom->strSubVer.find("5.4.0") != std::string::npos
) {

pfrom->fDisconnect = true;
return false;
}
}

if (!vRecv.empty())
vRecv >> pfrom->nStartingHeight;

Expand Down
34 changes: 7 additions & 27 deletions src/test/gridcoin/claim_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,6 @@ static CKey GetTestPrivateKey()

return key;
}

// Unfortunately, GCC 13 on openSUSE i386 is misbehaving and exhibiting weird errors in the last decimal places for things
// even as straightforward as
//
// double foo = 0.0;
// text >> foo.
//
// This comparison function works around that by allowing a small error band to pass the tests, but not enough to invalidate
// the tests on compilers that work.
bool comp_double(double lhs, double rhs)
{
// Require exact match if 0=0.
if (std::min(lhs, rhs) == 0.0) {
return (lhs == rhs);
} else {
double unsigned_rel_error = std::abs(lhs - rhs) / std::min(lhs, rhs);

return (unsigned_rel_error <= double {1e-8});
}
}
} // anonymous namespace

// -----------------------------------------------------------------------------
Expand All @@ -138,7 +118,7 @@ BOOST_AUTO_TEST_CASE(it_initializes_to_an_empty_claim)

BOOST_CHECK(claim.m_magnitude == 0);
BOOST_CHECK(claim.m_research_subsidy == 0);
BOOST_CHECK(comp_double(claim.m_magnitude_unit, 0.0));
BOOST_CHECK(claim.m_magnitude_unit == 0.0);

BOOST_CHECK(claim.m_signature.empty() == true);

Expand All @@ -161,7 +141,7 @@ BOOST_AUTO_TEST_CASE(it_initializes_to_the_specified_version)

BOOST_CHECK(claim.m_magnitude == 0);
BOOST_CHECK(claim.m_research_subsidy == 0);
BOOST_CHECK(comp_double(claim.m_magnitude_unit, 0.0));
BOOST_CHECK(claim.m_magnitude_unit == 0.0);

BOOST_CHECK(claim.m_signature.empty() == true);

Expand Down Expand Up @@ -240,7 +220,7 @@ BOOST_AUTO_TEST_CASE(it_parses_a_legacy_boincblock_string_for_researcher)

BOOST_CHECK(claim.m_magnitude == 123);
BOOST_CHECK(claim.m_research_subsidy == 47.25 * COIN);
BOOST_CHECK(comp_double(claim.m_magnitude_unit, 0.123456));
BOOST_CHECK(claim.m_magnitude_unit == 0.123456);

BOOST_CHECK(claim.m_signature == signature);

Expand Down Expand Up @@ -523,7 +503,7 @@ BOOST_AUTO_TEST_CASE(it_deserializes_from_a_stream_for_investor)

BOOST_CHECK(claim.m_research_subsidy == 0);
BOOST_CHECK(claim.m_magnitude == 0.0);
BOOST_CHECK(comp_double(claim.m_magnitude_unit, 0.0));
BOOST_CHECK(claim.m_magnitude_unit == 0.0);
BOOST_CHECK(claim.m_signature.empty() == true);
BOOST_CHECK(claim.m_quorum_address.empty() == true);
BOOST_CHECK(claim.m_superblock->WellFormed() == false);
Expand Down Expand Up @@ -565,7 +545,7 @@ BOOST_AUTO_TEST_CASE(it_deserializes_from_a_stream_for_investor_with_superblock)

BOOST_CHECK(claim.m_research_subsidy == 0);
BOOST_CHECK(claim.m_magnitude == 0.0);
BOOST_CHECK(comp_double(claim.m_magnitude_unit, 0.0));
BOOST_CHECK(claim.m_magnitude_unit == 0.0);
BOOST_CHECK(claim.m_signature.empty() == true);
}

Expand Down Expand Up @@ -650,7 +630,7 @@ BOOST_AUTO_TEST_CASE(it_deserializes_from_a_stream_for_researcher)

BOOST_CHECK(claim.m_research_subsidy == expected.m_research_subsidy);
BOOST_CHECK(claim.m_magnitude == 0.0);
BOOST_CHECK(comp_double(claim.m_magnitude_unit, 0.0));
BOOST_CHECK(claim.m_magnitude_unit == 0.0);
BOOST_CHECK(claim.m_signature == expected.m_signature);

BOOST_CHECK(claim.m_quorum_hash == expected.m_quorum_hash);
Expand Down Expand Up @@ -690,7 +670,7 @@ BOOST_AUTO_TEST_CASE(it_deserializes_from_a_stream_for_researcher_with_superbloc

BOOST_CHECK(claim.m_research_subsidy == expected.m_research_subsidy);
BOOST_CHECK(claim.m_magnitude == 0.0);
BOOST_CHECK(comp_double(claim.m_magnitude_unit, 0.0));
BOOST_CHECK(claim.m_magnitude_unit == 0.0);
BOOST_CHECK(claim.m_signature == expected.m_signature);

BOOST_CHECK(claim.m_quorum_hash == expected.m_quorum_hash);
Expand Down
Loading

0 comments on commit 760262c

Please sign in to comment.