mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-10 08:40:34 +00:00
Compare commits
13 Commits
vlntb/prat
...
ximinez/pa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13719d4eaa | ||
|
|
c7adb215ed | ||
|
|
71ee0f400b | ||
|
|
58af1e6f18 | ||
|
|
a0a99b0cc7 | ||
|
|
cc179f1ebc | ||
|
|
bb9d1323dd | ||
|
|
4a3365eb36 | ||
|
|
bd7c711ac8 | ||
|
|
e3ad106797 | ||
|
|
f6ab0b16bb | ||
|
|
a8ead867ba | ||
|
|
84589262c1 |
@@ -23,11 +23,7 @@ include(CompilationEnv)
|
||||
|
||||
if(is_gcc)
|
||||
# GCC-specific fixes
|
||||
add_compile_options(
|
||||
-Wno-unknown-pragmas
|
||||
-Wno-subobject-linkage
|
||||
-Wno-error=deprecated-declarations
|
||||
)
|
||||
add_compile_options(-Wno-unknown-pragmas -Wno-subobject-linkage)
|
||||
# -Wno-subobject-linkage can be removed when we upgrade GCC version to at least 13.3
|
||||
elseif(is_clang)
|
||||
# Clang-specific fixes
|
||||
@@ -87,11 +83,7 @@ if(only_docs)
|
||||
endif()
|
||||
|
||||
include(deps/Boost)
|
||||
find_package(OpenSSL 3.5.6 REQUIRED)
|
||||
set_target_properties(
|
||||
OpenSSL::SSL
|
||||
PROPERTIES INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2
|
||||
)
|
||||
|
||||
add_subdirectory(external/antithesis-sdk)
|
||||
find_package(date REQUIRED)
|
||||
find_package(ed25519 REQUIRED)
|
||||
|
||||
42
conan.lock
42
conan.lock
@@ -1,44 +1,44 @@
|
||||
{
|
||||
"version": "0.5",
|
||||
"requires": [
|
||||
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1778091116.056",
|
||||
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1743678659.187",
|
||||
"sqlite3/3.53.0#324ada52333108388a9a6108bfa96734%1778091117.311",
|
||||
"soci/4.0.3#e726491a03468795453f7c83fc924a96%1751554127.172",
|
||||
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1756234314.246",
|
||||
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1782392402.122708",
|
||||
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1782392402.420688",
|
||||
"sqlite3/3.53.0#324ada52333108388a9a6108bfa96734%1782392403.185447",
|
||||
"soci/4.0.3#e726491a03468795453f7c83fc924a96%1782392402.679521",
|
||||
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1782307151.633168",
|
||||
"secp256k1/0.7.1#b1f450b7f78a36fff75bb6934a356f3a%1782338841.3729",
|
||||
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1762797952.535",
|
||||
"re2/20251105#8579cfd0bda4daf0683f9e3898f964b4%1774398111.888",
|
||||
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1782392413.075713",
|
||||
"re2/20251105#8579cfd0bda4daf0683f9e3898f964b4%1782392402.431897",
|
||||
"protobuf/6.33.5#ff253ead763bd8d9904a52979cd21e81%1782392410.233933",
|
||||
"openssl/3.6.3#1163d4ddc603907084d08a6a0c6e580f%1782307150.583886",
|
||||
"nudb/2.0.9#11149c73f8f2baff9a0198fe25971fc7%1775040983.408",
|
||||
"nudb/2.0.9#11149c73f8f2baff9a0198fe25971fc7%1782392402.297166",
|
||||
"mpt-crypto/0.4.0-rc2#a580f2f9ad0e795de696aa62d54fb9af%1782425834.488828",
|
||||
"lz4/1.10.0#982d9b673900f665a1da109e09c17cab%1782392402.164188",
|
||||
"libiconv/1.17#9923bc6dc6f106646d6967e0039a5ada%1782392792.775744",
|
||||
"libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1722218217.276",
|
||||
"libarchive/3.8.7#c446109bd1f1d8ba7936c94189bc50e6%1778091117.848",
|
||||
"libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1782392402.420732",
|
||||
"libarchive/3.8.7#c446109bd1f1d8ba7936c94189bc50e6%1782392403.066892",
|
||||
"jemalloc/5.3.1#1fc58d55316041f10fbc1e8a2eae632a%1776700028.228",
|
||||
"gtest/1.17.0#5224b3b3ff3b4ce1133cbdd27d53ee7d%1768312129.152",
|
||||
"gtest/1.17.0#5224b3b3ff3b4ce1133cbdd27d53ee7d%1782392402.791979",
|
||||
"grpc/1.81.1#5217e6ef0544c42b46f4af35d5e7f649%1782307148.845616",
|
||||
"ed25519/2015.03#ae761bdc52730a843f0809bdf6c1b1f6%1765850143.772",
|
||||
"date/3.0.4#862e11e80030356b53c2c38599ceb32b%1765850143.772",
|
||||
"c-ares/1.34.6#545240bb1c40e2cacd4362d6b8967650%1774439234.681",
|
||||
"bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1765850143.837",
|
||||
"boost/1.91.0#ea540ca2133d831b560036aa24dece3c%1778091165.282",
|
||||
"abseil/20250127.0#bb0baf1f362bc4a725a24eddd419b8f7%1774365460.196"
|
||||
"ed25519/2015.03#ae761bdc52730a843f0809bdf6c1b1f6%1782307148.15562",
|
||||
"date/3.0.4#862e11e80030356b53c2c38599ceb32b%1782392402.538492",
|
||||
"c-ares/1.34.6#545240bb1c40e2cacd4362d6b8967650%1782392402.681654",
|
||||
"bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1782392402.296732",
|
||||
"boost/1.91.0#ea540ca2133d831b560036aa24dece3c%1782392419.475605",
|
||||
"abseil/20250127.0#bb0baf1f362bc4a725a24eddd419b8f7%1782307147.395833"
|
||||
],
|
||||
"build_requires": [
|
||||
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1778091116.056",
|
||||
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1782392402.122708",
|
||||
"strawberryperl/5.32.1.1#8d114504d172cfea8ea1662d09b6333e%1782395692.540639",
|
||||
"protobuf/6.33.5#ff253ead763bd8d9904a52979cd21e81%1782392410.233933",
|
||||
"nasm/2.16.01#31e26f2ee3c4346ecd347911bd126904%1782395690.33162",
|
||||
"msys2/cci.latest#d22fe7b2808f5fd34d0a7923ace9c54f%1770657326.649",
|
||||
"m4/1.4.19#34c4bbc3eeebe98ca6edf2f52d602e7d%1777282960.259",
|
||||
"cmake/4.3.3#840cf00ea09777e05c2050a50a82c722%1782392418.696091",
|
||||
"b2/5.4.2#ffd6084a119587e70f11cd45d1a386e2%1774439233.447",
|
||||
"b2/5.4.2#ffd6084a119587e70f11cd45d1a386e2%1782392402.624226",
|
||||
"automake/1.16.5#b91b7c384c3deaa9d535be02da14d04f%1755524470.56",
|
||||
"autoconf/2.71#51077f068e61700d65bb05541ea1e4b0%1731054366.86",
|
||||
"abseil/20250127.0#bb0baf1f362bc4a725a24eddd419b8f7%1774365460.196"
|
||||
"abseil/20250127.0#bb0baf1f362bc4a725a24eddd419b8f7%1782307147.395833"
|
||||
],
|
||||
"python_requires": [],
|
||||
"overrides": {
|
||||
@@ -62,4 +62,4 @@
|
||||
]
|
||||
},
|
||||
"config_requires": []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
|
||||
from conan import ConanFile
|
||||
|
||||
import subprocess
|
||||
|
||||
|
||||
class Xrpl(ConanFile):
|
||||
name = "xrpl"
|
||||
|
||||
15
docs/build/environment.md
vendored
15
docs/build/environment.md
vendored
@@ -33,9 +33,10 @@ with a single command and without installing anything system-wide:
|
||||
nix --experimental-features 'nix-command flakes' develop
|
||||
```
|
||||
|
||||
On **Linux**, Nix also provides the compiler (GCC). On **macOS**, the shell uses
|
||||
your **system-wide Apple Clang** as the compiler, so you still need to manage
|
||||
its version (see below).
|
||||
On **Linux**, Nix also provides the compiler (GCC); on **macOS**, it provides
|
||||
Clang. If you instead opt to use your system-wide Apple Clang (via
|
||||
`nix develop .#apple-clang`), you need to manage its version yourself (see
|
||||
below).
|
||||
|
||||
See [Using the Nix development shell](./nix.md) for installation and usage
|
||||
details, including how to select a different compiler.
|
||||
@@ -48,10 +49,10 @@ details, including how to select a different compiler.
|
||||
|
||||
### macOS: managing the Apple Clang version
|
||||
|
||||
Because the Nix shell uses the system-wide Apple Clang on macOS, the compiler
|
||||
version is whatever your installed Xcode (or Command Line Tools) provides. The
|
||||
following command should return a version greater than or equal to the
|
||||
[minimum required](#tested-compiler-versions):
|
||||
If you use your system-wide Apple Clang on macOS (via `nix develop .#apple-clang`),
|
||||
the compiler version is whatever your installed Xcode (or Command Line Tools)
|
||||
provides. The following command should return a version greater than or equal to
|
||||
the [minimum required](#tested-compiler-versions):
|
||||
|
||||
```bash
|
||||
clang --version
|
||||
|
||||
40
docs/build/nix.md
vendored
40
docs/build/nix.md
vendored
@@ -9,7 +9,7 @@ This guide explains how to use Nix to set up a reproducible development environm
|
||||
- **Reproducible environment**: Everyone gets the same versions of tools and compilers
|
||||
- **Matches CI**: The Linux CI runs in Docker images built from this exact Nix environment
|
||||
- **No system pollution**: Dependencies are isolated and don't affect your system packages
|
||||
- **Multiple compiler versions**: Easily switch between different GCC and Clang versions
|
||||
- **Consistent compilers**: The GCC and Clang shells use the same versions as CI
|
||||
- **Quick setup**: Get started with a single command
|
||||
- **Works on Linux and macOS**: Consistent experience across platforms
|
||||
|
||||
@@ -31,8 +31,8 @@ This will:
|
||||
|
||||
- Download and set up all required development tools (CMake, Ninja, Conan, etc.)
|
||||
- Configure the appropriate compiler for your platform:
|
||||
- **Linux**: GCC 15.2 (provided by Nix)
|
||||
- **macOS**: Apple Clang (your system compiler)
|
||||
- **Linux**: GCC (provided by Nix)
|
||||
- **macOS**: Clang (provided by Nix)
|
||||
|
||||
The first time you run this command, it will take a few minutes to download and build the environment. Subsequent runs will be much faster.
|
||||
|
||||
@@ -40,12 +40,12 @@ The first time you run this command, it will take a few minutes to download and
|
||||
|
||||
- **Linux**: `nix develop` gives you a shell with all the tooling necessary to
|
||||
develop xrpld and with GCC 15.2 (also provided by Nix). There are no caveats.
|
||||
- **macOS**: `nix develop` gives you a full environment too. The compiler is
|
||||
your system-wide Apple Clang, while every other tool — including Conan — is
|
||||
provided by Nix. Conan has no binary in the Nix cache for macOS, so it is
|
||||
built from source the first time you enter the shell, which makes the initial
|
||||
setup slower (this is handled automatically; see
|
||||
[`nix/devshell.nix`](../../nix/devshell.nix)).
|
||||
- **macOS**: `nix develop` gives you a full environment too, with Clang (and
|
||||
every other tool, including Conan) provided by Nix. To use your system-wide
|
||||
Apple Clang instead, enter `nix develop .#apple-clang`. Conan has no binary in
|
||||
the Nix cache for macOS, so it is built from source the first time you enter
|
||||
the shell, which makes the initial setup slower (this is handled
|
||||
automatically; see [`nix/devshell.nix`](../../nix/devshell.nix)).
|
||||
|
||||
> [!TIP]
|
||||
> To avoid typing `--experimental-features 'nix-command flakes'` every time, you can permanently enable flakes by creating `~/.config/nix/nix.conf`:
|
||||
@@ -62,7 +62,9 @@ The first time you run this command, it will take a few minutes to download and
|
||||
|
||||
### Choosing a different compiler
|
||||
|
||||
A compiler can be chosen by providing its name with the `.#` prefix, e.g. `nix develop .#gcc15`.
|
||||
A compiler can be chosen by providing its name with the `.#` prefix, e.g. `nix develop .#clang`.
|
||||
The `.#gcc` and `.#clang` shells provide the same GCC and Clang versions used in CI
|
||||
(pinned in [`nix/packages.nix`](../../nix/packages.nix)).
|
||||
Use `nix flake show` to see all the available development shells.
|
||||
|
||||
Use `nix develop .#no-compiler` to use the compiler from your system.
|
||||
@@ -70,11 +72,11 @@ Use `nix develop .#no-compiler` to use the compiler from your system.
|
||||
### Example Usage
|
||||
|
||||
```bash
|
||||
# Use GCC 14
|
||||
nix develop .#gcc14
|
||||
# Use GCC (same version as CI)
|
||||
nix develop .#gcc
|
||||
|
||||
# Use Clang 19
|
||||
nix develop .#clang19
|
||||
# Use Clang (same version as CI)
|
||||
nix develop .#clang
|
||||
|
||||
# Use default for your platform
|
||||
nix develop
|
||||
@@ -112,7 +114,15 @@ Once inside the Nix development shell, follow the standard [build instructions](
|
||||
|
||||
[direnv](https://direnv.net/) or [nix-direnv](https://github.com/nix-community/nix-direnv) can automatically activate the Nix development shell when you enter the repository directory.
|
||||
|
||||
This is also the most robust way to use the environment from **any shell** (bash, zsh, fish, …): direnv stays in your current shell and loads the environment _after_ your shell's startup files have run, so the Nix-provided tools take precedence over anything your shell configuration adds to `$PATH`. To use it, install direnv for your shell, then add an `.envrc` containing `use flake` at the repository root and run `direnv allow`.
|
||||
This is also the most robust way to use the environment from **any shell** (bash, zsh, fish, …): direnv stays in your current shell and loads the environment _after_ your shell's startup files have run, so the Nix-provided tools take precedence over anything your shell configuration adds to `$PATH`.
|
||||
|
||||
The repository already ships an `.envrc` at its root that activates the Nix flake development shell, so you don't need to create one. To use it:
|
||||
|
||||
1. [Install direnv](https://direnv.net/docs/installation.html) and [hook it into your shell](https://direnv.net/docs/hook.html) (bash, zsh, fish, …). Installing [nix-direnv](https://github.com/nix-community/nix-direnv) as well is recommended: it caches the shell so that activation is near-instant after the first run.
|
||||
2. Run `direnv allow` once in the repository root. direnv will then load (and reload) the Nix development shell automatically whenever you enter the directory.
|
||||
|
||||
> [!NOTE]
|
||||
> direnv only caches the `.direnv` directory (already listed in `.gitignore`); no other repository files are affected.
|
||||
|
||||
## Conan and Prebuilt Packages
|
||||
|
||||
|
||||
@@ -4,14 +4,16 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (import ./packages.nix { inherit pkgs; }) commonPackages;
|
||||
inherit (pkgs) lib;
|
||||
inherit (import ./packages.nix { inherit pkgs; })
|
||||
commonPackages
|
||||
gccPackage
|
||||
llvmPackages
|
||||
llvmVersion
|
||||
;
|
||||
|
||||
# Underlying compiler toolchains to wrap. Bump these in one place to
|
||||
# roll the whole environment forward.
|
||||
customGccPackage = pkgs.gcc15;
|
||||
customLlvmPackages = pkgs.llvmPackages_22;
|
||||
customClangMajor = lib.versions.major (lib.getVersion customLlvmPackages.clang-unwrapped);
|
||||
# Underlying compiler toolchains to wrap (versions pinned in packages.nix).
|
||||
customGccPackage = gccPackage;
|
||||
customLlvmPackages = llvmPackages;
|
||||
|
||||
# binutils wrapped to emit binaries that reference the custom glibc
|
||||
# (dynamic linker path, library search path, RPATH).
|
||||
@@ -90,7 +92,7 @@ let
|
||||
extraBuildCommands = ''
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${customLlvmPackages.clang-unwrapped.lib}/lib/clang/${customClangMajor}/include" "$rsrc/include"
|
||||
ln -s "${customLlvmPackages.clang-unwrapped.lib}/lib/clang/${toString llvmVersion}/include" "$rsrc/include"
|
||||
ln -s "${customCompilerRt.out}/lib" "$rsrc/lib"
|
||||
ln -s "${customCompilerRt.out}/share" "$rsrc/share" || true
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
|
||||
150
nix/devshell.nix
150
nix/devshell.nix
@@ -1,127 +1,57 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
inherit (import ./packages.nix { inherit pkgs; }) commonPackages;
|
||||
inherit (import ./packages.nix { inherit pkgs; })
|
||||
commonPackages
|
||||
gccVersion
|
||||
llvmPackages
|
||||
;
|
||||
|
||||
# Supported compiler versions
|
||||
gccVersion = pkgs.lib.range 13 15;
|
||||
clangVersions = pkgs.lib.range 18 21;
|
||||
# Plain nixpkgs stdenvs — no custom glibc, unlike ci-env.nix.
|
||||
gccStdenv = pkgs."gcc${toString gccVersion}Stdenv";
|
||||
clangStdenv = llvmPackages.stdenv;
|
||||
|
||||
defaultCompiler = if pkgs.stdenv.isDarwin then "apple-clang" else "gcc";
|
||||
defaultGccVersion = pkgs.lib.last gccVersion;
|
||||
defaultClangVersion = pkgs.lib.last clangVersions;
|
||||
|
||||
strToCompilerEnv =
|
||||
compiler: version:
|
||||
(
|
||||
if compiler == "gcc" then
|
||||
let
|
||||
gccPkg = pkgs."gcc${toString version}Stdenv" or null;
|
||||
in
|
||||
if gccPkg != null && builtins.elem version gccVersion then
|
||||
gccPkg
|
||||
else
|
||||
throw "Invalid GCC version: ${toString version}. Must be one of: ${toString gccVersion}"
|
||||
else if compiler == "clang" then
|
||||
let
|
||||
clangPkg = pkgs."llvmPackages_${toString version}".stdenv or null;
|
||||
in
|
||||
if clangPkg != null && builtins.elem version clangVersions then
|
||||
clangPkg
|
||||
else
|
||||
throw "Invalid Clang version: ${toString version}. Must be one of: ${toString clangVersions}"
|
||||
else if compiler == "apple-clang" || compiler == "none" then
|
||||
pkgs.stdenvNoCC
|
||||
else
|
||||
throw "Invalid compiler: ${compiler}. Must be one of: gcc, clang, apple-clang, none"
|
||||
);
|
||||
|
||||
# Helper function to create a shell with a specific compiler
|
||||
# compilerName is the command used to print the version, or null for none.
|
||||
makeShell =
|
||||
{
|
||||
compiler ? defaultCompiler,
|
||||
version ? (
|
||||
if compiler == "gcc" then
|
||||
defaultGccVersion
|
||||
else if compiler == "clang" then
|
||||
defaultClangVersion
|
||||
else
|
||||
null
|
||||
),
|
||||
stdenv,
|
||||
compilerName,
|
||||
}:
|
||||
let
|
||||
compilerStdEnv = strToCompilerEnv compiler version;
|
||||
|
||||
compilerName =
|
||||
if compiler == "apple-clang" then
|
||||
"clang"
|
||||
else if compiler == "none" then
|
||||
null
|
||||
else
|
||||
compiler;
|
||||
|
||||
gccOnMacWarning =
|
||||
if pkgs.stdenv.isDarwin && compiler == "gcc" then
|
||||
''
|
||||
echo "WARNING: Using GCC on macOS with Conan may not work."
|
||||
echo " Consider using 'nix develop .#clang' or the default shell instead."
|
||||
echo ""
|
||||
''
|
||||
else
|
||||
"";
|
||||
|
||||
compilerVersion =
|
||||
if compilerName != null then
|
||||
if compilerName == null then
|
||||
''echo "No compiler specified - using system compiler"''
|
||||
else
|
||||
''
|
||||
echo "Compiler: "
|
||||
${compilerName} --version
|
||||
''
|
||||
else
|
||||
''
|
||||
echo "No compiler specified - using system compiler"
|
||||
'';
|
||||
|
||||
shellAttrs = {
|
||||
packages = commonPackages;
|
||||
|
||||
shellHook = ''
|
||||
echo "Welcome to xrpld development shell";
|
||||
${gccOnMacWarning}${compilerVersion}
|
||||
'';
|
||||
};
|
||||
in
|
||||
pkgs.mkShell.override { stdenv = compilerStdEnv; } shellAttrs;
|
||||
|
||||
# Generate shells for each compiler version
|
||||
gccShells = builtins.listToAttrs (
|
||||
map (version: {
|
||||
name = "gcc${toString version}";
|
||||
value = makeShell {
|
||||
compiler = "gcc";
|
||||
version = version;
|
||||
};
|
||||
}) gccVersion
|
||||
);
|
||||
|
||||
clangShells = builtins.listToAttrs (
|
||||
map (version: {
|
||||
name = "clang${toString version}";
|
||||
value = makeShell {
|
||||
compiler = "clang";
|
||||
version = version;
|
||||
};
|
||||
}) clangVersions
|
||||
);
|
||||
|
||||
(pkgs.mkShell.override { inherit stdenv; }) {
|
||||
packages = commonPackages;
|
||||
shellHook = ''
|
||||
echo "Welcome to xrpld development shell";
|
||||
${compilerVersion}
|
||||
'';
|
||||
};
|
||||
in
|
||||
gccShells
|
||||
// clangShells
|
||||
// {
|
||||
# Default shells
|
||||
default = makeShell { };
|
||||
gcc = makeShell { compiler = "gcc"; };
|
||||
clang = makeShell { compiler = "clang"; };
|
||||
rec {
|
||||
# macOS: Nix Clang. Linux: Nix GCC.
|
||||
default = if pkgs.stdenv.isDarwin then clang else gcc;
|
||||
|
||||
# No compiler
|
||||
no-compiler = makeShell { compiler = "none"; };
|
||||
apple-clang = makeShell { compiler = "apple-clang"; };
|
||||
gcc = makeShell {
|
||||
stdenv = gccStdenv;
|
||||
compilerName = "gcc";
|
||||
};
|
||||
|
||||
clang = makeShell {
|
||||
stdenv = clangStdenv;
|
||||
compilerName = "clang";
|
||||
};
|
||||
|
||||
# Nix provides no compiler; use the one from your system (e.g. Apple Clang).
|
||||
no-compiler = makeShell {
|
||||
stdenv = pkgs.stdenvNoCC;
|
||||
compilerName = null;
|
||||
};
|
||||
apple-clang = no-compiler;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,33 @@
|
||||
{ pkgs }:
|
||||
let
|
||||
# Compiler versions used across the dev shell and the CI environment.
|
||||
gccVersion = 15;
|
||||
llvmVersion = 22;
|
||||
|
||||
gccPackage = pkgs."gcc${toString gccVersion}";
|
||||
llvmPackages = pkgs."llvmPackages_${toString llvmVersion}";
|
||||
|
||||
# Bound explicitly so it tracks llvmPackages above, not the `with pkgs` default.
|
||||
clangTools = llvmPackages.clang-tools;
|
||||
|
||||
# In LLVM 22, run-clang-tidy.py moved from share/clang/ to bin/, so nixpkgs
|
||||
# clang-tools no longer links it. Wrap it manually.
|
||||
runClangTidy = pkgs.writeShellScriptBin "run-clang-tidy" ''
|
||||
exec ${pkgs.python3}/bin/python3 ${pkgs.llvmPackages_22.clang-unwrapped}/bin/run-clang-tidy "$@"
|
||||
exec ${pkgs.python3}/bin/python3 ${llvmPackages.clang-unwrapped}/bin/run-clang-tidy "$@"
|
||||
'';
|
||||
in
|
||||
{
|
||||
inherit
|
||||
gccVersion
|
||||
llvmVersion
|
||||
gccPackage
|
||||
llvmPackages
|
||||
;
|
||||
|
||||
commonPackages = with pkgs; [
|
||||
ccache
|
||||
clangbuildanalyzer
|
||||
clangTools
|
||||
cmake
|
||||
conan
|
||||
curlMinimal # needed for codecov/codecov-action
|
||||
@@ -23,7 +41,6 @@ in
|
||||
gnumake
|
||||
gnupg # needed for signing commits & codecov/codecov-action
|
||||
graphviz
|
||||
llvmPackages_22.clang-tools
|
||||
less # needed for git diff
|
||||
mold
|
||||
nettools # provides netstat, used to debug failures in CI
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Compare SHA-512-half performance across OpenSSL versions.
|
||||
# Binaries are identical builds (GCC 13.3, Release, same locked deps),
|
||||
# differing only in the statically linked OpenSSL.
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.build"
|
||||
|
||||
V356=./xrpl_tests-openssl-3.5.6
|
||||
V362=./xrpl_tests-openssl-3.6.2
|
||||
V363=./xrpl_tests-openssl-3.6.3
|
||||
|
||||
# Single hash of the full 100 KB buffer. Startup-dominated (~ms), kept for
|
||||
# parity with earlier result logs; expect near-identical numbers.
|
||||
FILTER=OpenSSL.SingleHashFullSlice
|
||||
hyperfine -N \
|
||||
--warmup 5 \
|
||||
--min-runs 200 \
|
||||
--command-name "openssl-3.5.6 singlehash" "$V356 --gtest_filter=$FILTER" \
|
||||
--command-name "openssl-3.6.2 singlehash" "$V362 --gtest_filter=$FILTER" \
|
||||
--command-name "openssl-3.6.3 singlehash" "$V363 --gtest_filter=$FILTER" \
|
||||
--export-markdown openssl_comparison_singlehash.md \
|
||||
--export-json openssl_comparison_singlehash.json
|
||||
|
||||
# 100k hashes per run; the meaningful benchmark.
|
||||
FILTER=OpenSSL.MultihashAllSlices
|
||||
hyperfine \
|
||||
--warmup 5 \
|
||||
--min-runs 20 \
|
||||
--command-name "openssl-3.5.6 multihash" "$V356 --gtest_filter=$FILTER" \
|
||||
--command-name "openssl-3.6.2 multihash" "$V362 --gtest_filter=$FILTER" \
|
||||
--command-name "openssl-3.6.3 multihash" "$V363 --gtest_filter=$FILTER" \
|
||||
--export-markdown openssl_comparison.md \
|
||||
--export-json openssl_comparison.json
|
||||
|
||||
echo
|
||||
echo "Results saved to .build/openssl_comparison*.md and .build/openssl_comparison*.json"
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
./.build/xrpl_tests --gtest_filter=OpenSSL.SingleHashFullSlice
|
||||
@@ -23,7 +23,7 @@ namespace {
|
||||
//------------------------------------------------------------------------------
|
||||
// clang-format off
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
char const* const versionString = "3.3.0-b0"
|
||||
char const* const versionString = "3.3.0-b1"
|
||||
// clang-format on
|
||||
;
|
||||
|
||||
|
||||
@@ -498,7 +498,7 @@ class Batch_test : public beast::unit_test::Suite
|
||||
auto const batchFee = batch::calcBatchFee(env, 0, 2);
|
||||
auto tx1 = batch::Inner(pay(alice, bob, XRP(1)), seq + 1);
|
||||
tx1[jss::Fee] = "1.5";
|
||||
env.setParseFailureExpected(true);
|
||||
auto const g = env.getParseFailureGuard(true);
|
||||
try
|
||||
{
|
||||
env(batch::outer(alice, seq, batchFee, tfAllOrNothing),
|
||||
@@ -510,7 +510,6 @@ class Batch_test : public beast::unit_test::Suite
|
||||
{
|
||||
BEAST_EXPECT(true);
|
||||
}
|
||||
env.setParseFailureExpected(false);
|
||||
}
|
||||
|
||||
// temSEQ_AND_TICKET: Batch: inner txn cannot have both Sequence
|
||||
|
||||
@@ -5451,9 +5451,9 @@ class Vault_test : public beast::unit_test::Suite
|
||||
env.close();
|
||||
|
||||
// 2. Mantissa larger than uint64 max
|
||||
env.setParseFailureExpected(true);
|
||||
try
|
||||
{
|
||||
auto const g = env.getParseFailureGuard(true);
|
||||
tx[sfAssetsMaximum] = "18446744073709551617e5"; // uint64 max + 1
|
||||
env(tx);
|
||||
BEAST_EXPECTS(false, "Expected parse_error for mantissa larger than uint64 max");
|
||||
@@ -5464,7 +5464,6 @@ class Vault_test : public beast::unit_test::Suite
|
||||
BEAST_EXPECT(
|
||||
e.what() == "invalidParamsField 'tx_json.AssetsMaximum' has invalid data."s);
|
||||
}
|
||||
env.setParseFailureExpected(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -495,6 +495,46 @@ public:
|
||||
parseFailureExpected_ = b;
|
||||
}
|
||||
|
||||
/** RAII class to set and restore the parse failure flag (setParseFailureExpected).
|
||||
*
|
||||
* Can be created directly, or through the `getParseFailureGuard(bool)` function.
|
||||
*/
|
||||
class ParseFailureGuard final
|
||||
{
|
||||
Env& self_;
|
||||
bool oldExpected_ = self_.parseFailureExpected_;
|
||||
|
||||
public:
|
||||
ParseFailureGuard(Env& self, bool b) : self_(self)
|
||||
{
|
||||
self_.setParseFailureExpected(b);
|
||||
}
|
||||
|
||||
~ParseFailureGuard()
|
||||
{
|
||||
self_.setParseFailureExpected(oldExpected_);
|
||||
}
|
||||
|
||||
// No copy, no move
|
||||
ParseFailureGuard(ParseFailureGuard const&) = delete;
|
||||
ParseFailureGuard&
|
||||
operator=(ParseFailureGuard const&) = delete;
|
||||
ParseFailureGuard(ParseFailureGuard&& other) = delete;
|
||||
ParseFailureGuard&
|
||||
operator=(ParseFailureGuard&&) = delete;
|
||||
};
|
||||
|
||||
/** Gets an RAII guard to set and restore the parse failure flag
|
||||
*
|
||||
* Usage:
|
||||
* auto const guard = env.getParseFailureGuard(true/false);
|
||||
*/
|
||||
[[nodiscard]] ParseFailureGuard
|
||||
getParseFailureGuard(bool b)
|
||||
{
|
||||
return ParseFailureGuard{*this, b};
|
||||
}
|
||||
|
||||
/** Turn off signature checks. */
|
||||
void
|
||||
disableSigs()
|
||||
|
||||
@@ -602,7 +602,7 @@ Env::autofill(JTx& jt)
|
||||
catch (ParseError const&)
|
||||
{
|
||||
if (!parseFailureExpected_)
|
||||
test.log << "parse failed:\n" << pretty(jv) << std::endl;
|
||||
test.log << "parse failure:\n" << pretty(jv) << std::endl;
|
||||
rethrow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
#include <xrpl/basics/Slice.h>
|
||||
#include <xrpl/protocol/digest.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <random>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl::test {
|
||||
|
||||
static std::vector<char> const data = []() {
|
||||
std::vector<char> strV(pow(10, 5));
|
||||
std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
std::uniform_int_distribution<int> dis(32, 127);
|
||||
for (size_t index = 0; index < strV.size(); ++index)
|
||||
{
|
||||
strV[index] = static_cast<char>(dis(gen));
|
||||
}
|
||||
return strV;
|
||||
}();
|
||||
|
||||
TEST(OpenSSL, SingleHashFullSlice)
|
||||
{
|
||||
Slice const s{data.data(), data.size()};
|
||||
[[maybe_unused]] auto hash = sha512Half(s);
|
||||
}
|
||||
|
||||
TEST(OpenSSL, MultihashAllSlices)
|
||||
{
|
||||
for (std::size_t i = 0; i < data.size(); ++i)
|
||||
{
|
||||
Slice s(&data[i], data.size() - i);
|
||||
[[maybe_unused]] auto hash = sha512Half(s);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace xrpl::test
|
||||
@@ -1,39 +0,0 @@
|
||||
-------------------------------------------------------------------------------------------------
|
||||
Openssl 3.6.0: https://github.com/XRPLF/rippled/tree/pratik/openssl-3.6.0-alpha-performance-test
|
||||
|
||||
valentin@valentin-Thelio-Major:~/projects/rippled3/rippled$ hyperfine -N --warmup 5 --min-runs 200 -- ./run_singlehash.sh
|
||||
Benchmark 1: ./run_singlehash.sh
|
||||
Time (mean ± σ): 4.5 ms ± 0.4 ms [User: 2.3 ms, System: 2.1 ms]
|
||||
Range (min … max): 3.7 ms … 6.2 ms 673 runs
|
||||
|
||||
valentin@valentin-Thelio-Major:~/projects/rippled3/rippled$ hyperfine --warmup 5 --min-runs 20 './.build/src/tests/libxrpl/xrpl.test.basics --test-case="*MultihashAllSlices*" -s'
|
||||
Benchmark 1: ./.build/src/tests/libxrpl/xrpl.test.basics --test-case="*MultihashAllSlices*" -s
|
||||
Time (mean ± σ): 5.636 s ± 0.005 s [User: 5.633 s, System: 0.002 s]
|
||||
Range (min … max): 5.630 s … 5.651 s 20 runs
|
||||
|
||||
|
||||
----------------------------------------------------------------------------------------------
|
||||
Openssl 3.5.4: https://github.com/XRPLF/rippled/tree/pratik/openssl_354_test
|
||||
|
||||
hyperfine -N --warmup 5 --min-runs 200 -- ./run_singlehash.sh
|
||||
Benchmark 1: ./run_singlehash.sh
|
||||
Time (mean ± σ): 4.5 ms ± 0.4 ms [User: 2.3 ms, System: 2.1 ms]
|
||||
Range (min … max): 3.7 ms … 6.0 ms 663 runs
|
||||
|
||||
valentin@valentin-Thelio-Major:~/projects/rippled3/rippled$ hyperfine --warmup 5 --min-runs 20 './.build/src/tests/libxrpl/xrpl.test.basics --test-case="*MultihashAllSlices*" -s'
|
||||
Benchmark 1: ./.build/src/tests/libxrpl/xrpl.test.basics --test-case="*MultihashAllSlices*" -s
|
||||
Time (mean ± σ): 3.968 s ± 0.003 s [User: 3.966 s, System: 0.002 s]
|
||||
Range (min … max): 3.965 s … 3.977 s 20 runs
|
||||
|
||||
|
||||
----------------------------------------------------------------------------------------------
|
||||
Openssl 1.1.1: https://github.com/XRPLF/rippled/tree/pratik/openssl_111_perf_test
|
||||
valentin@valentin-Thelio-Major:~/projects/rippled3/rippled$ hyperfine -N --warmup 5 --min-runs 200 -- ./run_singlehash.sh
|
||||
Benchmark 1: ./run_singlehash.sh
|
||||
Time (mean ± σ): 4.4 ms ± 0.4 ms [User: 2.3 ms, System: 2.0 ms]
|
||||
Range (min … max): 3.7 ms … 6.1 ms 623 runs
|
||||
|
||||
valentin@valentin-Thelio-Major:~/projects/rippled3/rippled$ hyperfine --warmup 5 --min-runs 20 './.build/src/tests/libxrpl/xrpl.test.basics --test-case="*MultihashAllSlices*" -s'
|
||||
Benchmark 1: ./.build/src/tests/libxrpl/xrpl.test.basics --test-case="*MultihashAllSlices*" -s
|
||||
Time (mean ± σ): 3.969 s ± 0.004 s [User: 3.966 s, System: 0.002 s]
|
||||
Range (min … max): 3.964 s … 3.980 s 20 runs
|
||||
@@ -1,35 +0,0 @@
|
||||
-------------------------------------------------------------------------------------------------
|
||||
OpenSSL 3.5.6 vs 3.6.2 comparison
|
||||
Date: 2026-07-08
|
||||
Branch: vlntb/pratik-openssl-performance-test (commit 9b7582be93)
|
||||
Machine: valentin-Thelio-Major (Ubuntu 24.04, 48 cores)
|
||||
|
||||
Both binaries are identical Release builds (GCC 13.3, C++23, same conan.lock),
|
||||
differing only in the statically linked OpenSSL version (verified via the
|
||||
embedded version banner: grep -aom1 'OpenSSL 3\.' <binary>).
|
||||
Tests were ported from doctest to GTest, so the runner differs from the
|
||||
openssl_test_results_1 runs: single combined binary xrpl_tests, --gtest_filter
|
||||
instead of --test-case. Old absolute numbers are not directly comparable
|
||||
(different compiler: GCC 12 vs GCC 13).
|
||||
|
||||
Benchmark script: run_openssl_comparison.sh (hyperfine 1.18.0)
|
||||
|
||||
SingleHashFullSlice (hyperfine -N --warmup 5 --min-runs 200)
|
||||
Note: startup-dominated (~ms); one 100 KB hash takes microseconds.
|
||||
|
||||
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|
||||
|:---------------------------|----------:|---------:|---------:|------------:|
|
||||
| openssl-3.5.6 singlehash | 4.6 ± 0.5 | 3.9 | 7.4 | 1.02 ± 0.14 |
|
||||
| openssl-3.6.2 singlehash | 4.5 ± 0.5 | 3.9 | 6.5 | 1.00 |
|
||||
|
||||
MultihashAllSlices (hyperfine --warmup 5 --min-runs 20; 100k sha512Half calls per run)
|
||||
|
||||
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|
||||
|:---------------------------|--------------:|--------:|--------:|------------:|
|
||||
| openssl-3.5.6 multihash | 4.084 ± 0.021 | 4.056 | 4.123 | 1.01 ± 0.01 |
|
||||
| openssl-3.6.2 multihash | 4.060 ± 0.011 | 4.046 | 4.086 | 1.00 |
|
||||
|
||||
Conclusion: 3.6.2 is on par with 3.5.6 on both benchmarks (differences within
|
||||
noise). The ~42% SHA-512 regression observed with the 3.6.0 alpha (see
|
||||
openssl_test_results_1: 5.636 s vs 3.968 s for 3.5.4) is fixed in the 3.6.2
|
||||
release. No performance objection to upgrading.
|
||||
@@ -1,35 +0,0 @@
|
||||
-------------------------------------------------------------------------------------------------
|
||||
OpenSSL 3.5.6 vs 3.6.2 vs 3.6.3 comparison
|
||||
Date: 2026-07-08
|
||||
Branch: vlntb/pratik-openssl-performance-test (commit 2133ba64bf)
|
||||
Machine: valentin-Thelio-Major (Ubuntu 24.04, 48 cores)
|
||||
|
||||
All three binaries are identical Release builds (GCC 13.3, C++23, same
|
||||
conan.lock apart from the openssl entry), differing only in the statically
|
||||
linked OpenSSL version (verified via the embedded version banner:
|
||||
grep -aom1 'OpenSSL 3\.' <binary>). 3.5.6/3.6.2 recipes from conancenter,
|
||||
3.6.3 from the xrplf remote.
|
||||
|
||||
Benchmark script: run_openssl_comparison.sh (hyperfine 1.18.0)
|
||||
|
||||
SingleHashFullSlice (hyperfine -N --warmup 5 --min-runs 200)
|
||||
Note: startup-dominated (~ms); one 100 KB hash takes microseconds.
|
||||
|
||||
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|
||||
|:---------------------------|----------:|---------:|---------:|------------:|
|
||||
| openssl-3.5.6 singlehash | 4.6 ± 0.5 | 3.9 | 8.2 | 1.03 ± 0.15 |
|
||||
| openssl-3.6.2 singlehash | 4.6 ± 0.4 | 3.9 | 6.5 | 1.01 ± 0.14 |
|
||||
| openssl-3.6.3 singlehash | 4.5 ± 0.4 | 3.9 | 6.2 | 1.00 |
|
||||
|
||||
MultihashAllSlices (hyperfine --warmup 5 --min-runs 20; 100k sha512Half calls per run)
|
||||
|
||||
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|
||||
|:---------------------------|--------------:|--------:|--------:|------------:|
|
||||
| openssl-3.5.6 multihash | 4.083 ± 0.015 | 4.060 | 4.117 | 1.00 ± 0.01 |
|
||||
| openssl-3.6.2 multihash | 4.074 ± 0.017 | 4.049 | 4.116 | 1.00 |
|
||||
| openssl-3.6.3 multihash | 4.081 ± 0.028 | 4.047 | 4.125 | 1.00 ± 0.01 |
|
||||
|
||||
Conclusion: all three versions are statistically indistinguishable on both
|
||||
benchmarks. The ~42% SHA-512 regression observed with the 3.6.0 alpha (see
|
||||
openssl_test_results_1) remains fixed in 3.6.3. No performance objection to
|
||||
upgrading to either 3.6.2 or 3.6.3.
|
||||
Reference in New Issue
Block a user