mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-03 01:55:54 +00:00
fix: Fix GCC 15 discovered bugs (#2425)
This commit is contained in:
@@ -275,14 +275,17 @@ BackendInterface::updateRange(uint32_t newMax)
|
||||
{
|
||||
std::scoped_lock const lck(rngMtx_);
|
||||
|
||||
if (range_.has_value() && newMax < range_->maxSequence) {
|
||||
ASSERT(
|
||||
!range_ || newMax >= range_->maxSequence,
|
||||
"Range shouldn't exist yet or newMax should be greater. newMax = {}, range->maxSequence = {}",
|
||||
false,
|
||||
"Range shouldn't exist yet or newMax should be at least range->maxSequence. newMax = {}, "
|
||||
"range->maxSequence = {}",
|
||||
newMax,
|
||||
range_->maxSequence
|
||||
);
|
||||
}
|
||||
|
||||
if (!range_) {
|
||||
if (!range_.has_value()) {
|
||||
range_ = {.minSequence = newMax, .maxSequence = newMax};
|
||||
} else {
|
||||
range_->maxSequence = newMax;
|
||||
|
||||
@@ -66,7 +66,8 @@ public:
|
||||
defaultValue(Value value, std::optional<std::string_view> description = std::nullopt)
|
||||
{
|
||||
auto const err = checkTypeConsistency(type_, value);
|
||||
ASSERT(!err.has_value(), "{}", err->error);
|
||||
if (err.has_value())
|
||||
ASSERT(false, "{}", err->error);
|
||||
description_ = description;
|
||||
value_ = value;
|
||||
return *this;
|
||||
|
||||
@@ -45,7 +45,12 @@ TEST_F(AmendmentBlockHandlerTest, CallTonotifyAmendmentBlockedSetsStateAndRepeat
|
||||
handler.notifyAmendmentBlocked();
|
||||
EXPECT_TRUE(state.isAmendmentBlocked);
|
||||
|
||||
// Code runs significantly slower when assertions are enabled
|
||||
#ifdef _GLIBCXX_ASSERTIONS
|
||||
runContextFor(std::chrono::milliseconds{10});
|
||||
#else
|
||||
runContextFor(std::chrono::milliseconds{1});
|
||||
#endif
|
||||
}
|
||||
|
||||
struct DefaultAmendmentBlockActionTest : LoggerFixture {};
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "data/Types.hpp"
|
||||
#include "rpc/Errors.hpp"
|
||||
#include "rpc/common/impl/ForwardingProxy.hpp"
|
||||
#include "util/HandlerBaseTestFixture.hpp"
|
||||
@@ -282,10 +283,17 @@ TEST_P(ShouldForwardParameterTest, Test)
|
||||
EXPECT_CALL(*rawHandlerProviderPtr, isClioOnly(method)).Times(testBundle.called);
|
||||
|
||||
runSpawn([&](auto yield) {
|
||||
auto const range = backend_->fetchLedgerRange();
|
||||
auto const ctx = web::Context(
|
||||
yield, method, apiVersion, params.as_object(), nullptr, tagFactory_, *range, kCLIENT_IP, testBundle.isAdmin
|
||||
);
|
||||
auto const ctx = web::Context{
|
||||
yield,
|
||||
method,
|
||||
apiVersion,
|
||||
params.as_object(),
|
||||
nullptr,
|
||||
tagFactory_,
|
||||
data::LedgerRange{},
|
||||
kCLIENT_IP,
|
||||
testBundle.isAdmin,
|
||||
};
|
||||
|
||||
auto const res = proxy_.shouldForward(ctx);
|
||||
ASSERT_EQ(res, testBundle.expected);
|
||||
@@ -311,9 +319,17 @@ TEST_F(RPCForwardingProxyTest, ForwardCallsBalancerWithCorrectParams)
|
||||
EXPECT_CALL(counters_, rpcForwarded(method));
|
||||
|
||||
runSpawn([&](auto yield) {
|
||||
auto const range = backend_->fetchLedgerRange();
|
||||
auto const ctx =
|
||||
web::Context(yield, method, apiVersion, params.as_object(), nullptr, tagFactory_, *range, kCLIENT_IP, true);
|
||||
auto const ctx = web::Context{
|
||||
yield,
|
||||
method,
|
||||
apiVersion,
|
||||
params.as_object(),
|
||||
nullptr,
|
||||
tagFactory_,
|
||||
data::LedgerRange{},
|
||||
kCLIENT_IP,
|
||||
true,
|
||||
};
|
||||
|
||||
auto const res = proxy_.forward(ctx);
|
||||
|
||||
@@ -340,9 +356,17 @@ TEST_F(RPCForwardingProxyTest, ForwardingFailYieldsErrorStatus)
|
||||
EXPECT_CALL(counters_, rpcFailedToForward(method));
|
||||
|
||||
runSpawn([&](auto yield) {
|
||||
auto const range = backend_->fetchLedgerRange();
|
||||
auto const ctx =
|
||||
web::Context(yield, method, apiVersion, params.as_object(), nullptr, tagFactory_, *range, kCLIENT_IP, true);
|
||||
auto const ctx = web::Context{
|
||||
yield,
|
||||
method,
|
||||
apiVersion,
|
||||
params.as_object(),
|
||||
nullptr,
|
||||
tagFactory_,
|
||||
data::LedgerRange{},
|
||||
kCLIENT_IP,
|
||||
true,
|
||||
};
|
||||
|
||||
auto const res = proxy_.forward(ctx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user