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_);
|
std::scoped_lock const lck(rngMtx_);
|
||||||
|
|
||||||
ASSERT(
|
if (range_.has_value() && newMax < range_->maxSequence) {
|
||||||
!range_ || newMax >= range_->maxSequence,
|
ASSERT(
|
||||||
"Range shouldn't exist yet or newMax should be greater. newMax = {}, range->maxSequence = {}",
|
false,
|
||||||
newMax,
|
"Range shouldn't exist yet or newMax should be at least range->maxSequence. newMax = {}, "
|
||||||
range_->maxSequence
|
"range->maxSequence = {}",
|
||||||
);
|
newMax,
|
||||||
|
range_->maxSequence
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!range_) {
|
if (!range_.has_value()) {
|
||||||
range_ = {.minSequence = newMax, .maxSequence = newMax};
|
range_ = {.minSequence = newMax, .maxSequence = newMax};
|
||||||
} else {
|
} else {
|
||||||
range_->maxSequence = newMax;
|
range_->maxSequence = newMax;
|
||||||
|
|||||||
@@ -66,7 +66,8 @@ public:
|
|||||||
defaultValue(Value value, std::optional<std::string_view> description = std::nullopt)
|
defaultValue(Value value, std::optional<std::string_view> description = std::nullopt)
|
||||||
{
|
{
|
||||||
auto const err = checkTypeConsistency(type_, value);
|
auto const err = checkTypeConsistency(type_, value);
|
||||||
ASSERT(!err.has_value(), "{}", err->error);
|
if (err.has_value())
|
||||||
|
ASSERT(false, "{}", err->error);
|
||||||
description_ = description;
|
description_ = description;
|
||||||
value_ = value;
|
value_ = value;
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
@@ -45,7 +45,12 @@ TEST_F(AmendmentBlockHandlerTest, CallTonotifyAmendmentBlockedSetsStateAndRepeat
|
|||||||
handler.notifyAmendmentBlocked();
|
handler.notifyAmendmentBlocked();
|
||||||
EXPECT_TRUE(state.isAmendmentBlocked);
|
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});
|
runContextFor(std::chrono::milliseconds{1});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DefaultAmendmentBlockActionTest : LoggerFixture {};
|
struct DefaultAmendmentBlockActionTest : LoggerFixture {};
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include "data/Types.hpp"
|
||||||
#include "rpc/Errors.hpp"
|
#include "rpc/Errors.hpp"
|
||||||
#include "rpc/common/impl/ForwardingProxy.hpp"
|
#include "rpc/common/impl/ForwardingProxy.hpp"
|
||||||
#include "util/HandlerBaseTestFixture.hpp"
|
#include "util/HandlerBaseTestFixture.hpp"
|
||||||
@@ -282,10 +283,17 @@ TEST_P(ShouldForwardParameterTest, Test)
|
|||||||
EXPECT_CALL(*rawHandlerProviderPtr, isClioOnly(method)).Times(testBundle.called);
|
EXPECT_CALL(*rawHandlerProviderPtr, isClioOnly(method)).Times(testBundle.called);
|
||||||
|
|
||||||
runSpawn([&](auto yield) {
|
runSpawn([&](auto yield) {
|
||||||
auto const range = backend_->fetchLedgerRange();
|
auto const ctx = web::Context{
|
||||||
auto const ctx = web::Context(
|
yield,
|
||||||
yield, method, apiVersion, params.as_object(), nullptr, tagFactory_, *range, kCLIENT_IP, testBundle.isAdmin
|
method,
|
||||||
);
|
apiVersion,
|
||||||
|
params.as_object(),
|
||||||
|
nullptr,
|
||||||
|
tagFactory_,
|
||||||
|
data::LedgerRange{},
|
||||||
|
kCLIENT_IP,
|
||||||
|
testBundle.isAdmin,
|
||||||
|
};
|
||||||
|
|
||||||
auto const res = proxy_.shouldForward(ctx);
|
auto const res = proxy_.shouldForward(ctx);
|
||||||
ASSERT_EQ(res, testBundle.expected);
|
ASSERT_EQ(res, testBundle.expected);
|
||||||
@@ -311,9 +319,17 @@ TEST_F(RPCForwardingProxyTest, ForwardCallsBalancerWithCorrectParams)
|
|||||||
EXPECT_CALL(counters_, rpcForwarded(method));
|
EXPECT_CALL(counters_, rpcForwarded(method));
|
||||||
|
|
||||||
runSpawn([&](auto yield) {
|
runSpawn([&](auto yield) {
|
||||||
auto const range = backend_->fetchLedgerRange();
|
auto const ctx = web::Context{
|
||||||
auto const ctx =
|
yield,
|
||||||
web::Context(yield, method, apiVersion, params.as_object(), nullptr, tagFactory_, *range, kCLIENT_IP, true);
|
method,
|
||||||
|
apiVersion,
|
||||||
|
params.as_object(),
|
||||||
|
nullptr,
|
||||||
|
tagFactory_,
|
||||||
|
data::LedgerRange{},
|
||||||
|
kCLIENT_IP,
|
||||||
|
true,
|
||||||
|
};
|
||||||
|
|
||||||
auto const res = proxy_.forward(ctx);
|
auto const res = proxy_.forward(ctx);
|
||||||
|
|
||||||
@@ -340,9 +356,17 @@ TEST_F(RPCForwardingProxyTest, ForwardingFailYieldsErrorStatus)
|
|||||||
EXPECT_CALL(counters_, rpcFailedToForward(method));
|
EXPECT_CALL(counters_, rpcFailedToForward(method));
|
||||||
|
|
||||||
runSpawn([&](auto yield) {
|
runSpawn([&](auto yield) {
|
||||||
auto const range = backend_->fetchLedgerRange();
|
auto const ctx = web::Context{
|
||||||
auto const ctx =
|
yield,
|
||||||
web::Context(yield, method, apiVersion, params.as_object(), nullptr, tagFactory_, *range, kCLIENT_IP, true);
|
method,
|
||||||
|
apiVersion,
|
||||||
|
params.as_object(),
|
||||||
|
nullptr,
|
||||||
|
tagFactory_,
|
||||||
|
data::LedgerRange{},
|
||||||
|
kCLIENT_IP,
|
||||||
|
true,
|
||||||
|
};
|
||||||
|
|
||||||
auto const res = proxy_.forward(ctx);
|
auto const res = proxy_.forward(ctx);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user