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

chore: Commits for 2.4.0-b2 #1810

Merged
merged 5 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
34 changes: 34 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Checks: '-*,
readability-enum-initial-value,
readability-implicit-bool-conversion,
readability-inconsistent-declaration-parameter-name,
readability-identifier-naming,
readability-make-member-function-const,
readability-math-missing-parentheses,
readability-misleading-indentation,
Expand All @@ -149,6 +150,39 @@ Checks: '-*,

CheckOptions:
readability-braces-around-statements.ShortStatementLines: 2
readability-identifier-naming.MacroDefinitionCase: UPPER_CASE
readability-identifier-naming.ClassCase: CamelCase
readability-identifier-naming.StructCase: CamelCase
readability-identifier-naming.UnionCase: CamelCase
readability-identifier-naming.EnumCase: CamelCase
readability-identifier-naming.EnumConstantCase: CamelCase
readability-identifier-naming.ScopedEnumConstantCase: CamelCase
readability-identifier-naming.GlobalConstantCase: UPPER_CASE
readability-identifier-naming.GlobalConstantPrefix: 'k'
readability-identifier-naming.GlobalVariableCase: CamelCase
readability-identifier-naming.GlobalVariablePrefix: 'g'
readability-identifier-naming.ConstexprFunctionCase: camelBack
readability-identifier-naming.ConstexprMethodCase: camelBack
readability-identifier-naming.ClassMethodCase: camelBack
readability-identifier-naming.ClassMemberCase: camelBack
readability-identifier-naming.ClassConstantCase: UPPER_CASE
readability-identifier-naming.ClassConstantPrefix: 'k'
readability-identifier-naming.StaticConstantCase: UPPER_CASE
readability-identifier-naming.StaticConstantPrefix: 'k'
readability-identifier-naming.StaticVariableCase: UPPER_CASE
readability-identifier-naming.StaticVariablePrefix: 'k'
readability-identifier-naming.ConstexprVariableCase: UPPER_CASE
readability-identifier-naming.ConstexprVariablePrefix: 'k'
readability-identifier-naming.LocalConstantCase: camelBack
readability-identifier-naming.LocalVariableCase: camelBack
readability-identifier-naming.TemplateParameterCase: CamelCase
readability-identifier-naming.ParameterCase: camelBack
readability-identifier-naming.FunctionCase: camelBack
readability-identifier-naming.MemberCase: camelBack
readability-identifier-naming.PrivateMemberSuffix: _
readability-identifier-naming.ProtectedMemberSuffix: _
readability-identifier-naming.PublicMemberSuffix: ''
readability-identifier-naming.FunctionIgnoredRegexp: '.*tag_invoke.*'
bugprone-unsafe-functions.ReportMoreUnsafeFunctions: true
bugprone-unused-return-value.CheckedReturnTypes: ::std::error_code;::std::error_condition;::std::errc
misc-include-cleaner.IgnoreHeaders: '.*/(detail|impl)/.*;.*(expected|unexpected).*;.*ranges_lower_bound\.h;time.h;stdlib.h'
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/prepare_runner/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ runs:
if: ${{ runner.os == 'macOS' }}
shell: bash
run: |
brew install llvm@14 pkg-config ninja bison cmake ccache jq gh conan@1
brew install llvm@14 pkg-config ninja bison cmake ccache jq gh conan@1 ca-certificates
echo "/opt/homebrew/opt/conan@1/bin" >> $GITHUB_PATH

- name: Fix git permissions on Linux
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/setup_conan/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ runs:
if: ${{ runner.os == 'macOS' }}
shell: bash
env:
CONAN_PROFILE: apple_clang_15
CONAN_PROFILE: apple_clang_16
id: conan_setup_mac
run: |
echo "Creating $CONAN_PROFILE conan profile";
echo "Creating $CONAN_PROFILE conan profile"
conan profile new $CONAN_PROFILE --detect --force
conan profile update settings.compiler.libcxx=libc++ $CONAN_PROFILE
conan profile update settings.compiler.cppstd=20 $CONAN_PROFILE
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
conan_profile: clang
code_coverage: false
static: true
- os: macos14
- os: macos15
build_type: Release
code_coverage: false
static: false
Expand Down Expand Up @@ -197,8 +197,8 @@ jobs:
image: rippleci/clio_ci:latest
conan_profile: clang
build_type: Debug
- os: macos14
conan_profile: apple_clang_15
- os: macos15
conan_profile: apple_clang_16
build_type: Release
runs-on: [self-hosted, "${{ matrix.os }}"]
container: ${{ matrix.container }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos14
- os: macos15
build_type: Release
static: false
- os: heavy
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos14
- os: macos15
build_type: Release
integration_tests: false
- os: heavy
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/util/async/ExecutionContextBenchmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ class TestAnyExecutionContextBatched {
static auto
generateData()
{
constexpr auto TOTAL = 10'000;
constexpr auto kTOTAL = 10'000;
std::vector<uint64_t> data;
data.reserve(TOTAL);
for (auto i = 0; i < TOTAL; ++i)
data.reserve(kTOTAL);
for (auto i = 0; i < kTOTAL; ++i)
data.push_back(util::Random::uniform(1, 100'000'000));

return data;
Expand Down
6 changes: 3 additions & 3 deletions cmake/Build.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@

namespace util::build {

static constexpr char versionString[] = "@CLIO_VERSION@";
static constexpr char versionString[] = "@CLIO_VERSION@"; // NOLINT(readability-identifier-naming)

std::string const&
getClioVersionString()
{
static std::string const value = versionString;
static std::string const value = versionString; // NOLINT(readability-identifier-naming)
return value;
}

std::string const&
getClioFullVersionString()
{
static std::string const value = "clio-" + getClioVersionString();
static std::string const value = "clio-" + getClioVersionString(); // NOLINT(readability-identifier-naming)
return value;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/CliArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ CliArgs::parse(int argc, char const* argv[])
description.add_options()
("help,h", "print help message and exit")
("version,v", "print version and exit")
("conf,c", po::value<std::string>()->default_value(defaultConfigPath), "configuration file")
("conf,c", po::value<std::string>()->default_value(kDEFAULT_CONFIG_PATH), "configuration file")
("ng-web-server,w", "Use ng-web-server")
("migrate", po::value<std::string>(), "start migration helper")
;
Expand Down
2 changes: 1 addition & 1 deletion src/app/CliArgs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CliArgs {
/**
* @brief Default configuration path.
*/
static constexpr char defaultConfigPath[] = "/etc/opt/clio/config.json";
static constexpr char kDEFAULT_CONFIG_PATH[] = "/etc/opt/clio/config.json";

/**
* @brief An action parsed from the command line.
Expand Down
22 changes: 11 additions & 11 deletions src/app/ClioApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,45 +101,45 @@ ClioApplication::run(bool const useNgWebServer)
auto sweepHandler = web::dosguard::IntervalSweepHandler{config_, ioc, dosGuard};

// Interface to the database
auto backend = data::make_Backend(config_);
auto backend = data::makeBackend(config_);

// Manages clients subscribed to streams
auto subscriptions = feed::SubscriptionManager::make_SubscriptionManager(config_, backend);
auto subscriptions = feed::SubscriptionManager::makeSubscriptionManager(config_, backend);

// Tracks which ledgers have been validated by the network
auto ledgers = etl::NetworkValidatedLedgers::make_ValidatedLedgers();
auto ledgers = etl::NetworkValidatedLedgers::makeValidatedLedgers();

// Handles the connection to one or more rippled nodes.
// ETL uses the balancer to extract data.
// The server uses the balancer to forward RPCs to a rippled node.
// The balancer itself publishes to streams (transactions_proposed and accounts_proposed)
auto balancer = etl::LoadBalancer::make_LoadBalancer(config_, ioc, backend, subscriptions, ledgers);
auto balancer = etl::LoadBalancer::makeLoadBalancer(config_, ioc, backend, subscriptions, ledgers);

// ETL is responsible for writing and publishing to streams. In read-only mode, ETL only publishes
auto etl = etl::ETLService::make_ETLService(config_, ioc, backend, subscriptions, balancer, ledgers);
auto etl = etl::ETLService::makeETLService(config_, ioc, backend, subscriptions, balancer, ledgers);

auto workQueue = rpc::WorkQueue::make_WorkQueue(config_);
auto counters = rpc::Counters::make_Counters(workQueue);
auto workQueue = rpc::WorkQueue::makeWorkQueue(config_);
auto counters = rpc::Counters::makeCounters(workQueue);
auto const amendmentCenter = std::make_shared<data::AmendmentCenter const>(backend);
auto const handlerProvider = std::make_shared<rpc::impl::ProductionHandlerProvider const>(
config_, backend, subscriptions, balancer, etl, amendmentCenter, counters
);

using RPCEngineType = rpc::RPCEngine<etl::LoadBalancer, rpc::Counters>;
auto const rpcEngine =
RPCEngineType::make_RPCEngine(config_, backend, balancer, dosGuard, workQueue, counters, handlerProvider);
RPCEngineType::makeRPCEngine(config_, backend, balancer, dosGuard, workQueue, counters, handlerProvider);

if (useNgWebServer or config_.get<bool>("server.__ng_web_server")) {
web::ng::RPCServerHandler<RPCEngineType, etl::ETLService> handler{config_, backend, rpcEngine, etl};

auto expectedAdminVerifier = web::make_AdminVerificationStrategy(config_);
auto expectedAdminVerifier = web::makeAdminVerificationStrategy(config_);
if (not expectedAdminVerifier.has_value()) {
LOG(util::LogService::error()) << "Error creating admin verifier: " << expectedAdminVerifier.error();
return EXIT_FAILURE;
}
auto const adminVerifier = std::move(expectedAdminVerifier).value();

auto httpServer = web::ng::make_Server(config_, OnConnectCheck{dosGuard}, DisconnectHook{dosGuard}, ioc);
auto httpServer = web::ng::makeServer(config_, OnConnectCheck{dosGuard}, DisconnectHook{dosGuard}, ioc);

if (not httpServer.has_value()) {
LOG(util::LogService::error()) << "Error creating web server: " << httpServer.error();
Expand Down Expand Up @@ -170,7 +170,7 @@ ClioApplication::run(bool const useNgWebServer)
auto handler =
std::make_shared<web::RPCServerHandler<RPCEngineType, etl::ETLService>>(config_, backend, rpcEngine, etl);

auto const httpServer = web::make_HttpServer(config_, ioc, dosGuard, handler);
auto const httpServer = web::makeHttpServer(config_, ioc, dosGuard, handler);

// Blocks until stopped.
// When stopped, shared_ptrs fall out of scope
Expand Down
1 change: 1 addition & 0 deletions src/app/ClioApplication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//==============================================================================

#pragma once

#include "util/SignalsHandler.hpp"
#include "util/newconfig/ConfigDefinition.hpp"

Expand Down
4 changes: 2 additions & 2 deletions src/app/WebHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ HealthCheckHandler::operator()(
boost::asio::yield_context
)
{
static auto constexpr HealthCheckHTML = R"html(
static auto constexpr kHEALTH_CHECK_HTML = R"html(
<!DOCTYPE html>
<html>
<head><title>Test page for Clio</title></head>
<body><h1>Clio Test</h1><p>This page shows Clio http(s) connectivity is working.</p></body>
</html>
)html";

return web::ng::Response{boost::beast::http::status::ok, HealthCheckHTML, request};
return web::ng::Response{boost::beast::http::status::ok, kHEALTH_CHECK_HTML, request};
}

} // namespace app
4 changes: 2 additions & 2 deletions src/app/WebHandlers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ class RequestHandler {
auto jsonResponse = boost::json::parse(response.message()).as_object();
jsonResponse["warning"] = "load";
if (jsonResponse.contains("warnings") && jsonResponse["warnings"].is_array()) {
jsonResponse["warnings"].as_array().push_back(rpc::makeWarning(rpc::warnRPC_RATE_LIMIT));
jsonResponse["warnings"].as_array().push_back(rpc::makeWarning(rpc::WarnRpcRateLimit));
} else {
jsonResponse["warnings"] = boost::json::array{rpc::makeWarning(rpc::warnRPC_RATE_LIMIT)};
jsonResponse["warnings"] = boost::json::array{rpc::makeWarning(rpc::WarnRpcRateLimit)};
}
response.setMessage(jsonResponse);
}
Expand Down
18 changes: 9 additions & 9 deletions src/data/AmendmentCenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
namespace {

std::unordered_set<std::string>&
SUPPORTED_AMENDMENTS()
supportedAmendments()
{
static std::unordered_set<std::string> amendments = {};
return amendments;
static std::unordered_set<std::string> kAMENDMENTS = {};
return kAMENDMENTS;
}

bool
Expand All @@ -72,8 +72,8 @@ namespace impl {

WritingAmendmentKey::WritingAmendmentKey(std::string amendmentName) : AmendmentKey{std::move(amendmentName)}
{
ASSERT(not SUPPORTED_AMENDMENTS().contains(name), "Attempt to register the same amendment twice");
SUPPORTED_AMENDMENTS().insert(name);
ASSERT(not supportedAmendments().contains(name), "Attempt to register the same amendment twice");
supportedAmendments().insert(name);
}

} // namespace impl
Expand All @@ -90,7 +90,7 @@ AmendmentKey::operator std::string_view() const

AmendmentKey::operator ripple::uint256() const
{
return Amendment::GetAmendmentId(name);
return Amendment::getAmendmentId(name);
}

AmendmentCenter::AmendmentCenter(std::shared_ptr<data::BackendInterface> const& backend) : backend_{backend}
Expand All @@ -103,9 +103,9 @@ AmendmentCenter::AmendmentCenter(std::shared_ptr<data::BackendInterface> const&
auto const& [name, support] = p;
return Amendment{
.name = name,
.feature = Amendment::GetAmendmentId(name),
.feature = Amendment::getAmendmentId(name),
.isSupportedByXRPL = support != ripple::AmendmentSupport::Unsupported,
.isSupportedByClio = rg::find(SUPPORTED_AMENDMENTS(), name) != rg::end(SUPPORTED_AMENDMENTS()),
.isSupportedByClio = rg::find(supportedAmendments(), name) != rg::end(supportedAmendments()),
.isRetired = support == ripple::AmendmentSupport::Retired
};
}),
Expand Down Expand Up @@ -180,7 +180,7 @@ AmendmentCenter::operator[](AmendmentKey const& key) const
}

ripple::uint256
Amendment::GetAmendmentId(std::string_view name)
Amendment::getAmendmentId(std::string_view name)
{
return ripple::sha512Half(ripple::Slice(name.data(), name.size()));
}
Expand Down
2 changes: 2 additions & 0 deletions src/data/AmendmentCenter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ struct Amendments {
// Most of the time it's going to be no changes at all.

/** @cond */
// NOLINTBEGIN(readability-identifier-naming)
REGISTER(OwnerPaysFee);
REGISTER(Flow);
REGISTER(FlowCross);
Expand Down Expand Up @@ -154,6 +155,7 @@ struct Amendments {
REGISTER(fix1512);
REGISTER(fix1523);
REGISTER(fix1528);
// NOLINTEND(readability-identifier-naming)
/** @endcond */
};

Expand Down
6 changes: 3 additions & 3 deletions src/data/BackendCounters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace data {

namespace {

std::vector<std::int64_t> const histogramBuckets{1, 2, 5, 10, 20, 50, 100, 200, 500, 700, 1000};
std::vector<std::int64_t> const kHISTOGRAM_BUCKETS{1, 2, 5, 10, 20, 50, 100, 200, 500, 700, 1000};

std::int64_t
durationInMillisecondsSince(std::chrono::steady_clock::time_point const startTime)
Expand Down Expand Up @@ -69,13 +69,13 @@ BackendCounters::BackendCounters()
, readDurationHistogram_(PrometheusService::histogramInt(
"backend_duration_milliseconds_histogram",
Labels({Label{"operation", "read"}}),
histogramBuckets,
kHISTOGRAM_BUCKETS,
"The duration of backend read operations including retries"
))
, writeDurationHistogram_(PrometheusService::histogramInt(
"backend_duration_milliseconds_histogram",
Labels({Label{"operation", "write"}}),
histogramBuckets,
kHISTOGRAM_BUCKETS,
"The duration of backend write operations including retries"
))
{
Expand Down
4 changes: 2 additions & 2 deletions src/data/BackendFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ namespace data {
* @return A shared_ptr<BackendInterface> with the selected implementation
*/
inline std::shared_ptr<BackendInterface>
make_Backend(util::config::ClioConfigDefinition const& config)
makeBackend(util::config::ClioConfigDefinition const& config)
{
static util::Logger const log{"Backend"};
static util::Logger const log{"Backend"}; // NOLINT(readability-identifier-naming)
LOG(log.info()) << "Constructing BackendInterface";

auto const readOnly = config.get<bool>("read_only");
Expand Down
Loading
Loading