Compare commits

..

12 Commits

Author SHA1 Message Date
Ayaz Salikhov
0bb037286c Add string_view include to ProtocolVersion.cpp 2026-07-02 12:55:23 +01:00
Ayaz Salikhov
183284e7df Fix style 2026-07-02 12:54:52 +01:00
Ayaz Salikhov
7e8d64bc05 Update include/xrpl/beast/rfc2616.h
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
2026-07-02 12:54:01 +01:00
Ayaz Salikhov
a3becc5580 Merge branch 'develop' into copilot/convert-boost-to-std-string-view 2026-07-02 12:36:41 +01:00
Mayukha Vadari
f17e15971d Merge branch 'develop' into copilot/convert-boost-to-std-string-view 2026-06-18 12:26:50 -04:00
Mayukha Vadari
651ec66aa5 Merge branch 'develop' into copilot/convert-boost-to-std-string-view 2026-05-27 16:51:30 -04:00
copilot-swe-agent[bot]
243ca1bdec Pass std::string_view by value, fix dangling reference in ServerHandler
Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/3aef40d0-f51b-484c-a5d3-43dd37d6187f

Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
2026-04-10 17:53:48 +00:00
Mayukha Vadari
40a5871c41 Merge branch 'develop' into copilot/convert-boost-to-std-string-view 2026-04-01 16:25:53 -04:00
copilot-swe-agent[bot]
6c64a2cc3f Remove unnecessary boost/beast/core/string.hpp includes
Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
2026-04-01 16:24:15 -04:00
copilot-swe-agent[bot]
c8fc57b76a Fix lambda return type inconsistency in ServerHandler
Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
2026-04-01 16:24:15 -04:00
copilot-swe-agent[bot]
c7627adeba Fix std::string_view constructor usage in BaseWSPeer
Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
2026-04-01 16:24:14 -04:00
copilot-swe-agent[bot]
25e6606056 Replace all boost::beast::string_view with std::string_view
Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
2026-04-01 16:24:01 -04:00
13 changed files with 27 additions and 199 deletions

View File

@@ -54,8 +54,6 @@ class LinuxConfig:
suffix: str = ""
extra_cmake_args: str = ""
image: str = "" # only used by package_configs entries
# Flip every amendment to Supported::Yes before building (perf/test only).
force_supported: bool = False
# List of GitHub event names (e.g. "pull_request") on which this config
# should NOT run. Empty means it runs on every event.
exclude_event_types: list[str] = dataclasses.field(default_factory=list)
@@ -144,7 +142,6 @@ class MatrixEntry:
sanitizers: str
image: str = "" # container image; empty for macOS/Windows (runs natively)
compiler: str = "" # compiler name ("gcc" or "clang"); empty for macOS/Windows
force_supported: bool = False # flip amendments to Supported::Yes before build
@dataclasses.dataclass
@@ -214,7 +211,6 @@ def expand_linux_matrix(
architecture=arch_info,
sanitizers=sanitizer,
compiler=compiler,
force_supported=cfg.force_supported,
)
)
@@ -233,14 +229,9 @@ def expand_linux_packaging(linux: LinuxFile) -> list[PackagingEntry]:
for distro, configs in linux.package_configs.items():
for cfg in configs:
for compiler, build_type in itertools.product(cfg.compiler, cfg.build_type):
# Keep in sync with build config_name so the packaging job finds
# the matching binary artifact (e.g. the -supported variant).
artifact_name = f"xrpld-{distro}-{compiler}-{build_type.lower()}-amd64"
if cfg.suffix:
artifact_name += f"-{cfg.suffix}"
entries.append(
PackagingEntry(
artifact_name=artifact_name,
artifact_name=f"xrpld-{distro}-{compiler}-{build_type.lower()}-amd64",
image=cfg.image,
distro=distro,
)

View File

@@ -43,13 +43,6 @@
"suffix": "unity",
"extra_cmake_args": "-Dunity=ON",
"exclude_event_types": ["pull_request"]
},
{
"compiler": ["gcc"],
"build_type": ["Release"],
"arch": ["amd64"],
"suffix": "supported",
"force_supported": true
}
],
@@ -70,16 +63,6 @@
]
},
"package_configs": {
"ubuntu": [
{
"compiler": ["gcc"],
"build_type": ["Release"],
"arch": ["amd64"],
"suffix": "supported",
"image": "ghcr.io/xrplf/xrpld/packaging-debian:sha-577d745"
}
],
"debian": [
{
"compiler": ["gcc"],

View File

@@ -1,104 +0,0 @@
# Package the "all amendments Supported::Yes" build into a runtime Docker image
# and push it to GHCR, as a drop-in for the rippleci/xrpld image xrpl.js uses
# for standalone testing -- except every amendment is built Supported::Yes.
#
# This does NOT build or package anything: the Trigger workflow already builds
# the supported binary and the supported .deb (the force_supported build config
# and the matching supported package config in linux.json). This workflow waits
# for a successful Trigger run on develop, downloads that run's supported .deb
# artifact, installs it into a slim base (docker/supported.Dockerfile, which
# replicates rippleci's layout), and pushes ghcr.io/xrplf/xrpld/supported.
#
# Perf/test artifact only -- never run it on a production validator.
name: Build supported Docker image
on:
workflow_run:
workflows: ["Trigger"]
types: [completed]
branches: [develop]
# Manual runs: point at a specific completed Trigger run via its run id.
workflow_dispatch:
inputs:
trigger_run_id:
description: "Run id of the Trigger workflow whose supported .deb to package."
required: true
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
# The supported .deb artifact uploaded by reusable-package.yml:
# <artifact_name>-pkg, where artifact_name carries the -supported suffix.
DEB_ARTIFACT: xrpld-ubuntu-gcc-release-amd64-supported-pkg
IMAGE_NAME: ghcr.io/xrplf/xrpld/supported
SOURCE_RUN_ID: ${{ github.event.workflow_run.id || inputs.trigger_run_id }}
jobs:
image:
# Only for successful Trigger runs (workflow_run), and only on the canonical
# repo where GITHUB_TOKEN can push to ghcr.io/xrplf/*.
if: ${{ github.repository == 'XRPLF/rippled' && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success') }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Download the supported .deb from the Trigger run
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.DEB_ARTIFACT }}
path: dl
run-id: ${{ env.SOURCE_RUN_ID }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Assemble build context
run: |
set -euo pipefail
mkdir -p docker-context
deb="$(find dl -name '*.deb' | head -n1)"
[ -n "${deb}" ] || {
echo "::error::no supported .deb found in run ${SOURCE_RUN_ID}"
exit 1
}
mv "${deb}" docker-context/xrpld.deb
echo "Packaging $(basename "${deb}") into ${IMAGE_NAME}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Login to GitHub Container Registry
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix=sha-,format=short
type=raw,value=latest
- name: Build and push
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: docker-context
file: docker/supported.Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -63,12 +63,6 @@ on:
type: string
default: ""
force_supported:
description: "Flip every amendment to Supported::Yes before building. For perf/test builds only; never for release artifacts."
required: false
type: boolean
default: false
secrets:
CODECOV_TOKEN:
description: "The Codecov token to use for uploading coverage reports."
@@ -118,20 +112,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Force all amendments to Supported::Yes
if: ${{ inputs.force_supported }}
run: |
set -euo pipefail
MACRO="include/xrpl/protocol/detail/features.macro"
echo "Flipping Supported::No -> Supported::Yes in ${MACRO}:"
grep -n 'Supported::No,' "${MACRO}" || echo " (none found)"
sed -i 's/Supported::No,/Supported::Yes,/g' "${MACRO}"
if grep -q 'Supported::No,' "${MACRO}"; then
echo "::error::Supported::No entries remain after sed"
exit 1
fi
git diff -- "${MACRO}" || true
- name: Prepare runner
uses: XRPLF/actions/prepare-runner@64ec3cf3b152b4444638f470bbd6df7a7a30c81c
with:

View File

@@ -50,6 +50,5 @@ jobs:
config_name: ${{ matrix.config_name }}
sanitizers: ${{ matrix.sanitizers }}
compiler: ${{ matrix.compiler || '' }}
force_supported: ${{ matrix.force_supported || false }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -1,25 +0,0 @@
# Runtime image for the perf/test xrpld build with all amendments Supported::Yes.
# Installs the .deb into ubuntu:jammy (matching rippleci/xrpld): gives
# /usr/bin/xrpld, /etc/xrpld/xrpld.cfg, and the xrpld user.
# NOT for production validators.
ARG BASE_IMAGE=ubuntu:jammy
FROM ${BASE_IMAGE}
# Build context must contain the supported package as xrpld.deb.
COPY xrpld.deb /tmp/xrpld.deb
RUN set -eux; \
id -u xrpld >/dev/null 2>&1 || \
useradd --system --no-create-home --shell /usr/sbin/nologin xrpld; \
apt-get update; \
apt-get install -y --no-install-recommends ca-certificates jq /tmp/xrpld.deb; \
rm -rf /var/lib/apt/lists/* /tmp/xrpld.deb; \
mkdir -p /var/log/xrpld /var/lib/xrpld; \
chown -R xrpld:xrpld /var/log/xrpld /var/lib/xrpld; \
# Symlink for consumers that exec /opt/xrpld/bin/xrpld.
mkdir -p /opt/xrpld/bin; \
ln -sf /usr/bin/xrpld /opt/xrpld/bin/xrpld
EXPOSE 2459/tcp 5005/tcp 6006/tcp
USER xrpld
ENTRYPOINT ["/usr/bin/xrpld"]

View File

@@ -11,6 +11,7 @@
#include <cstddef>
#include <iterator>
#include <string>
#include <string_view>
#include <vector>
namespace beast::rfc2616 {
@@ -182,7 +183,7 @@ splitCommas(FwdIt first, FwdIt last)
template <class Result = std::vector<std::string>>
Result
splitCommas(boost::beast::string_view const& s)
splitCommas(std::string_view s)
{
return splitCommas(s.begin(), s.end());
}

View File

@@ -1,20 +1,19 @@
#pragma once
#include <boost/beast/core/string.hpp>
#include <functional>
#include <string>
#include <string_view>
namespace json {
class Value;
using Output = std::function<void(boost::beast::string_view const&)>;
using Output = std::function<void(std::string_view)>;
inline Output
stringOutput(std::string& s)
{
return [&](boost::beast::string_view const& b) { s.append(b.data(), b.size()); };
return [&](std::string_view b) { s.append(b.data(), b.size()); };
}
/** Writes a minimal representation of a Json value to an Output in O(n) time.

View File

@@ -24,6 +24,7 @@
#include <iterator>
#include <list>
#include <memory>
#include <string_view>
#include <utility>
#include <vector>
@@ -57,8 +58,7 @@ private:
bool pingActive_ = false;
boost::beast::websocket::ping_data payload_;
error_code ec_;
std::function<void(boost::beast::websocket::frame_type, boost::beast::string_view)>
controlCallback_;
std::function<void(boost::beast::websocket::frame_type, std::string_view)> controlCallback_;
public:
template <class Body, class Headers>
@@ -146,7 +146,7 @@ protected:
onPing(error_code const& ec);
void
onPingPong(boost::beast::websocket::frame_type kind, boost::beast::string_view payload);
onPingPong(boost::beast::websocket::frame_type kind, std::string_view payload);
void
onTimer(error_code ec);
@@ -427,11 +427,11 @@ template <class Handler, class Impl>
void
BaseWSPeer<Handler, Impl>::onPingPong(
boost::beast::websocket::frame_type kind,
boost::beast::string_view payload)
std::string_view payload)
{
if (kind == boost::beast::websocket::frame_type::pong)
{
boost::beast::string_view const p(payload_.begin());
std::string_view const p(payload_.begin(), payload_.size());
if (payload == p)
{
closeOnTimer_ = false;

View File

@@ -9,6 +9,7 @@
#include <set> // IWYU pragma: keep
#include <stack>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
@@ -87,14 +88,14 @@ public:
}
void
output(boost::beast::string_view const& bytes)
output(std::string_view bytes)
{
markStarted();
output_(bytes);
}
void
stringOutput(boost::beast::string_view const& bytes)
stringOutput(std::string_view bytes)
{
markStarted();
std::size_t position = 0, writtenUntil = 0;

View File

@@ -15,6 +15,7 @@
#include <iterator>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
namespace xrpl {
@@ -64,7 +65,7 @@ to_string(ProtocolVersion const& p)
}
std::vector<ProtocolVersion>
parseProtocolVersions(boost::beast::string_view const& value)
parseProtocolVersions(std::string_view value)
{
static boost::regex const kRE(
"^" // start of line
@@ -131,7 +132,7 @@ negotiateProtocolVersion(std::vector<ProtocolVersion> const& versions)
}
std::optional<ProtocolVersion>
negotiateProtocolVersion(boost::beast::string_view const& versions)
negotiateProtocolVersion(std::string_view versions)
{
auto const them = parseProtocolVersions(versions);

View File

@@ -1,10 +1,9 @@
#pragma once
#include <boost/beast/core/string.hpp>
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
@@ -39,7 +38,7 @@ to_string(ProtocolVersion const& p);
no duplicates and will be sorted in ascending protocol order.
*/
std::vector<ProtocolVersion>
parseProtocolVersions(boost::beast::string_view const& s);
parseProtocolVersions(std::string_view s);
/** Given a list of supported protocol versions, choose the one we prefer. */
std::optional<ProtocolVersion>
@@ -47,7 +46,7 @@ negotiateProtocolVersion(std::vector<ProtocolVersion> const& versions);
/** Given a list of supported protocol versions, choose the one we prefer. */
std::optional<ProtocolVersion>
negotiateProtocolVersion(boost::beast::string_view const& versions);
negotiateProtocolVersion(std::string_view versions);
/** The list of all the protocol versions we support. */
std::string const&

View File

@@ -264,7 +264,7 @@ ServerHandler::onHandoff(
static inline json::Output
makeOutput(Session& session)
{
return [&](boost::beast::string_view const& b) { session.write(b.data(), b.size()); };
return [&](std::string_view b) { session.write(b.data(), b.size()); };
}
static std::map<std::string, std::string>
@@ -564,11 +564,14 @@ ServerHandler::processSession(
makeOutput(*session),
coro,
forwardedFor(session->request()),
[&] {
[&]() -> std::string_view {
auto const iter = session->request().find("X-User");
if (iter != session->request().end())
return iter->value();
return boost::beast::string_view{};
{
auto const& val = iter->value();
return std::string_view(val.data(), val.size());
}
return std::string_view{};
}());
if (beast::rfc2616::isKeepAlive(session->request()))