mirror of
https://github.com/XRPLF/rippled.git
synced 2026-02-24 07:42:33 +00:00
Compare commits
60 Commits
pratik/Mov
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fd237d707 | ||
|
|
3542daa4cc | ||
|
|
fd9f57ec97 | ||
|
|
625becff18 | ||
|
|
4bcbc6e50f | ||
|
|
0bc4a0cfe8 | ||
|
|
cb54adefed | ||
|
|
d03d72bfd5 | ||
|
|
6f35d94b2f | ||
|
|
2c1fad1023 | ||
|
|
25cca46553 | ||
|
|
469ce9f291 | ||
|
|
31302877ab | ||
|
|
0976b2b68b | ||
|
|
36240116a5 | ||
|
|
958d8f3754 | ||
|
|
ac0ad3627f | ||
|
|
cd218346ff | ||
|
|
5edd3566f7 | ||
|
|
11e8d1f8a2 | ||
|
|
9f17d10348 | ||
|
|
ef284692db | ||
|
|
e11f6190b7 | ||
|
|
db2734cbc9 | ||
|
|
bf4674f42b | ||
|
|
f5208fc850 | ||
|
|
2305bc98a4 | ||
|
|
677758b1cc | ||
|
|
25d7c2c4ec | ||
|
|
0a626d95f4 | ||
|
|
6006c281e2 | ||
|
|
e79673cf40 | ||
|
|
7f41012e59 | ||
|
|
b449a6ee84 | ||
|
|
34ef577604 | ||
|
|
3a172301ce | ||
|
|
6c1a92fe93 | ||
|
|
7813683091 | ||
|
|
b814a09a08 | ||
|
|
6d369e0f02 | ||
|
|
b182430178 | ||
|
|
fe31cdc9f6 | ||
|
|
ff4520cc45 | ||
|
|
fe9c8d568f | ||
|
|
a0e09187b9 | ||
|
|
f3627fb5d5 | ||
|
|
5f638f5553 | ||
|
|
92046785d1 | ||
|
|
b90a843ddd | ||
|
|
bb529d0317 | ||
|
|
a2f1973574 | ||
|
|
847e875635 | ||
|
|
778da954b4 | ||
|
|
0586b5678e | ||
|
|
66158d786f | ||
|
|
c57ffdbcb8 | ||
|
|
4e3f953fc4 | ||
|
|
a4f8aa623f | ||
|
|
8695313565 | ||
|
|
68c9d5ca0f |
@@ -37,7 +37,7 @@ BinPackParameters: false
|
|||||||
BreakBeforeBinaryOperators: false
|
BreakBeforeBinaryOperators: false
|
||||||
BreakBeforeTernaryOperators: true
|
BreakBeforeTernaryOperators: true
|
||||||
BreakConstructorInitializersBeforeComma: true
|
BreakConstructorInitializersBeforeComma: true
|
||||||
ColumnLimit: 80
|
ColumnLimit: 100
|
||||||
CommentPragmas: "^ IWYU pragma:"
|
CommentPragmas: "^ IWYU pragma:"
|
||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
ConstructorInitializerIndentWidth: 4
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
|||||||
191
.clang-tidy
Normal file
191
.clang-tidy
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
---
|
||||||
|
Checks: "-*,
|
||||||
|
bugprone-argument-comment
|
||||||
|
"
|
||||||
|
# bugprone-assert-side-effect,
|
||||||
|
# bugprone-bad-signal-to-kill-thread,
|
||||||
|
# bugprone-bool-pointer-implicit-conversion,
|
||||||
|
# bugprone-casting-through-void,
|
||||||
|
# bugprone-chained-comparison,
|
||||||
|
# bugprone-compare-pointer-to-member-virtual-function,
|
||||||
|
# bugprone-copy-constructor-init,
|
||||||
|
# bugprone-crtp-constructor-accessibility,
|
||||||
|
# bugprone-dangling-handle,
|
||||||
|
# bugprone-dynamic-static-initializers,
|
||||||
|
# bugprone-empty-catch,
|
||||||
|
# bugprone-fold-init-type,
|
||||||
|
# bugprone-forward-declaration-namespace,
|
||||||
|
# bugprone-inaccurate-erase,
|
||||||
|
# bugprone-inc-dec-in-conditions,
|
||||||
|
# bugprone-incorrect-enable-if,
|
||||||
|
# bugprone-incorrect-roundings,
|
||||||
|
# bugprone-infinite-loop,
|
||||||
|
# bugprone-integer-division,
|
||||||
|
# bugprone-lambda-function-name,
|
||||||
|
# bugprone-macro-parentheses,
|
||||||
|
# bugprone-macro-repeated-side-effects,
|
||||||
|
# bugprone-misplaced-operator-in-strlen-in-alloc,
|
||||||
|
# bugprone-misplaced-pointer-arithmetic-in-alloc,
|
||||||
|
# bugprone-misplaced-widening-cast,
|
||||||
|
# bugprone-move-forwarding-reference,
|
||||||
|
# bugprone-multi-level-implicit-pointer-conversion,
|
||||||
|
# bugprone-multiple-new-in-one-expression,
|
||||||
|
# bugprone-multiple-statement-macro,
|
||||||
|
# bugprone-no-escape,
|
||||||
|
# bugprone-non-zero-enum-to-bool-conversion,
|
||||||
|
# bugprone-optional-value-conversion,
|
||||||
|
# bugprone-parent-virtual-call,
|
||||||
|
# bugprone-pointer-arithmetic-on-polymorphic-object,
|
||||||
|
# bugprone-posix-return,
|
||||||
|
# bugprone-redundant-branch-condition,
|
||||||
|
# bugprone-reserved-identifier,
|
||||||
|
# bugprone-return-const-ref-from-parameter,
|
||||||
|
# bugprone-shared-ptr-array-mismatch,
|
||||||
|
# bugprone-signal-handler,
|
||||||
|
# bugprone-signed-char-misuse,
|
||||||
|
# bugprone-sizeof-container,
|
||||||
|
# bugprone-sizeof-expression,
|
||||||
|
# bugprone-spuriously-wake-up-functions,
|
||||||
|
# bugprone-standalone-empty,
|
||||||
|
# bugprone-string-constructor,
|
||||||
|
# bugprone-string-integer-assignment,
|
||||||
|
# bugprone-string-literal-with-embedded-nul,
|
||||||
|
# bugprone-stringview-nullptr,
|
||||||
|
# bugprone-suspicious-enum-usage,
|
||||||
|
# bugprone-suspicious-include,
|
||||||
|
# bugprone-suspicious-memory-comparison,
|
||||||
|
# bugprone-suspicious-memset-usage,
|
||||||
|
# bugprone-suspicious-missing-comma,
|
||||||
|
# bugprone-suspicious-realloc-usage,
|
||||||
|
# bugprone-suspicious-semicolon,
|
||||||
|
# bugprone-suspicious-string-compare,
|
||||||
|
# bugprone-suspicious-stringview-data-usage,
|
||||||
|
# bugprone-swapped-arguments,
|
||||||
|
# bugprone-switch-missing-default-case,
|
||||||
|
# bugprone-terminating-continue,
|
||||||
|
# bugprone-throw-keyword-missing,
|
||||||
|
# bugprone-too-small-loop-variable,
|
||||||
|
# bugprone-undefined-memory-manipulation,
|
||||||
|
# bugprone-undelegated-constructor,
|
||||||
|
# bugprone-unhandled-exception-at-new,
|
||||||
|
# bugprone-unhandled-self-assignment,
|
||||||
|
# bugprone-unique-ptr-array-mismatch,
|
||||||
|
# bugprone-unsafe-functions,
|
||||||
|
# bugprone-unused-local-non-trivial-variable,
|
||||||
|
# bugprone-unused-raii,
|
||||||
|
# bugprone-unused-return-value,
|
||||||
|
# bugprone-use-after-move,
|
||||||
|
# bugprone-virtual-near-miss,
|
||||||
|
# cppcoreguidelines-init-variables,
|
||||||
|
# cppcoreguidelines-misleading-capture-default-by-value,
|
||||||
|
# cppcoreguidelines-no-suspend-with-lock,
|
||||||
|
# cppcoreguidelines-pro-type-member-init,
|
||||||
|
# cppcoreguidelines-pro-type-static-cast-downcast,
|
||||||
|
# cppcoreguidelines-rvalue-reference-param-not-moved,
|
||||||
|
# cppcoreguidelines-use-default-member-init,
|
||||||
|
# cppcoreguidelines-virtual-class-destructor,
|
||||||
|
# hicpp-ignored-remove-result,
|
||||||
|
# llvm-namespace-comment,
|
||||||
|
# misc-const-correctness,
|
||||||
|
# misc-definitions-in-headers,
|
||||||
|
# misc-header-include-cycle,
|
||||||
|
# misc-include-cleaner,
|
||||||
|
# misc-misplaced-const,
|
||||||
|
# misc-redundant-expression,
|
||||||
|
# misc-static-assert,
|
||||||
|
# misc-throw-by-value-catch-by-reference,
|
||||||
|
# misc-unused-alias-decls,
|
||||||
|
# misc-unused-using-decls,
|
||||||
|
# modernize-concat-nested-namespaces,
|
||||||
|
# modernize-deprecated-headers,
|
||||||
|
# modernize-make-shared,
|
||||||
|
# modernize-make-unique,
|
||||||
|
# modernize-pass-by-value,
|
||||||
|
# modernize-type-traits,
|
||||||
|
# modernize-use-designated-initializers,
|
||||||
|
# modernize-use-emplace,
|
||||||
|
# modernize-use-equals-default,
|
||||||
|
# modernize-use-equals-delete,
|
||||||
|
# modernize-use-override,
|
||||||
|
# modernize-use-ranges,
|
||||||
|
# modernize-use-starts-ends-with,
|
||||||
|
# modernize-use-std-numbers,
|
||||||
|
# modernize-use-using,
|
||||||
|
# performance-faster-string-find,
|
||||||
|
# performance-for-range-copy,
|
||||||
|
# performance-implicit-conversion-in-loop,
|
||||||
|
# performance-inefficient-vector-operation,
|
||||||
|
# performance-move-const-arg,
|
||||||
|
# performance-move-constructor-init,
|
||||||
|
# performance-no-automatic-move,
|
||||||
|
# performance-trivially-destructible,
|
||||||
|
# readability-avoid-nested-conditional-operator,
|
||||||
|
# readability-avoid-return-with-void-value,
|
||||||
|
# readability-braces-around-statements,
|
||||||
|
# readability-const-return-type,
|
||||||
|
# readability-container-contains,
|
||||||
|
# readability-container-size-empty,
|
||||||
|
# readability-convert-member-functions-to-static,
|
||||||
|
# readability-duplicate-include,
|
||||||
|
# readability-else-after-return,
|
||||||
|
# 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,
|
||||||
|
# readability-non-const-parameter,
|
||||||
|
# readability-redundant-casting,
|
||||||
|
# readability-redundant-declaration,
|
||||||
|
# readability-redundant-inline-specifier,
|
||||||
|
# readability-redundant-member-init,
|
||||||
|
# readability-redundant-string-init,
|
||||||
|
# readability-reference-to-constructed-temporary,
|
||||||
|
# readability-simplify-boolean-expr,
|
||||||
|
# readability-static-accessed-through-instance,
|
||||||
|
# readability-static-definition-in-anonymous-namespace,
|
||||||
|
# readability-suspicious-call-argument,
|
||||||
|
# readability-use-std-min-max
|
||||||
|
#
|
||||||
|
# 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;__chrono/.*;fmt/chrono.h;boost/uuid/uuid_hash.hpp'
|
||||||
|
#
|
||||||
|
# HeaderFilterRegex: '^.*/(src|tests)/.*\.(h|hpp)$'
|
||||||
|
WarningsAsErrors: "*"
|
||||||
247
.cmake-format.yaml
Normal file
247
.cmake-format.yaml
Normal file
@@ -0,0 +1,247 @@
|
|||||||
|
_help_parse: Options affecting listfile parsing
|
||||||
|
parse:
|
||||||
|
_help_additional_commands:
|
||||||
|
- Specify structure for custom cmake functions
|
||||||
|
additional_commands:
|
||||||
|
target_protobuf_sources:
|
||||||
|
pargs:
|
||||||
|
- target
|
||||||
|
- prefix
|
||||||
|
kwargs:
|
||||||
|
PROTOS: "*"
|
||||||
|
LANGUAGE: cpp
|
||||||
|
IMPORT_DIRS: "*"
|
||||||
|
GENERATE_EXTENSIONS: "*"
|
||||||
|
PLUGIN: "*"
|
||||||
|
_help_override_spec:
|
||||||
|
- Override configurations per-command where available
|
||||||
|
override_spec: {}
|
||||||
|
_help_vartags:
|
||||||
|
- Specify variable tags.
|
||||||
|
vartags: []
|
||||||
|
_help_proptags:
|
||||||
|
- Specify property tags.
|
||||||
|
proptags: []
|
||||||
|
_help_format: Options affecting formatting.
|
||||||
|
format:
|
||||||
|
_help_disable:
|
||||||
|
- Disable formatting entirely, making cmake-format a no-op
|
||||||
|
disable: false
|
||||||
|
_help_line_width:
|
||||||
|
- How wide to allow formatted cmake files
|
||||||
|
line_width: 100
|
||||||
|
_help_tab_size:
|
||||||
|
- How many spaces to tab for indent
|
||||||
|
tab_size: 4
|
||||||
|
_help_use_tabchars:
|
||||||
|
- If true, lines are indented using tab characters (utf-8
|
||||||
|
- 0x09) instead of <tab_size> space characters (utf-8 0x20).
|
||||||
|
- In cases where the layout would require a fractional tab
|
||||||
|
- character, the behavior of the fractional indentation is
|
||||||
|
- governed by <fractional_tab_policy>
|
||||||
|
use_tabchars: false
|
||||||
|
_help_fractional_tab_policy:
|
||||||
|
- If <use_tabchars> is True, then the value of this variable
|
||||||
|
- indicates how fractional indentions are handled during
|
||||||
|
- whitespace replacement. If set to 'use-space', fractional
|
||||||
|
- indentation is left as spaces (utf-8 0x20). If set to
|
||||||
|
- "`round-up` fractional indentation is replaced with a single"
|
||||||
|
- tab character (utf-8 0x09) effectively shifting the column
|
||||||
|
- to the next tabstop
|
||||||
|
fractional_tab_policy: use-space
|
||||||
|
_help_max_subgroups_hwrap:
|
||||||
|
- If an argument group contains more than this many sub-groups
|
||||||
|
- (parg or kwarg groups) then force it to a vertical layout.
|
||||||
|
max_subgroups_hwrap: 4
|
||||||
|
_help_max_pargs_hwrap:
|
||||||
|
- If a positional argument group contains more than this many
|
||||||
|
- arguments, then force it to a vertical layout.
|
||||||
|
max_pargs_hwrap: 5
|
||||||
|
_help_max_rows_cmdline:
|
||||||
|
- If a cmdline positional group consumes more than this many
|
||||||
|
- lines without nesting, then invalidate the layout (and nest)
|
||||||
|
max_rows_cmdline: 2
|
||||||
|
_help_separate_ctrl_name_with_space:
|
||||||
|
- If true, separate flow control names from their parentheses
|
||||||
|
- with a space
|
||||||
|
separate_ctrl_name_with_space: true
|
||||||
|
_help_separate_fn_name_with_space:
|
||||||
|
- If true, separate function names from parentheses with a
|
||||||
|
- space
|
||||||
|
separate_fn_name_with_space: false
|
||||||
|
_help_dangle_parens:
|
||||||
|
- If a statement is wrapped to more than one line, than dangle
|
||||||
|
- the closing parenthesis on its own line.
|
||||||
|
dangle_parens: false
|
||||||
|
_help_dangle_align:
|
||||||
|
- If the trailing parenthesis must be 'dangled' on its on
|
||||||
|
- "line, then align it to this reference: `prefix`: the start"
|
||||||
|
- "of the statement, `prefix-indent`: the start of the"
|
||||||
|
- "statement, plus one indentation level, `child`: align to"
|
||||||
|
- the column of the arguments
|
||||||
|
dangle_align: prefix
|
||||||
|
_help_min_prefix_chars:
|
||||||
|
- If the statement spelling length (including space and
|
||||||
|
- parenthesis) is smaller than this amount, then force reject
|
||||||
|
- nested layouts.
|
||||||
|
min_prefix_chars: 18
|
||||||
|
_help_max_prefix_chars:
|
||||||
|
- If the statement spelling length (including space and
|
||||||
|
- parenthesis) is larger than the tab width by more than this
|
||||||
|
- amount, then force reject un-nested layouts.
|
||||||
|
max_prefix_chars: 10
|
||||||
|
_help_max_lines_hwrap:
|
||||||
|
- If a candidate layout is wrapped horizontally but it exceeds
|
||||||
|
- this many lines, then reject the layout.
|
||||||
|
max_lines_hwrap: 2
|
||||||
|
_help_line_ending:
|
||||||
|
- What style line endings to use in the output.
|
||||||
|
line_ending: unix
|
||||||
|
_help_command_case:
|
||||||
|
- Format command names consistently as 'lower' or 'upper' case
|
||||||
|
command_case: canonical
|
||||||
|
_help_keyword_case:
|
||||||
|
- Format keywords consistently as 'lower' or 'upper' case
|
||||||
|
keyword_case: unchanged
|
||||||
|
_help_always_wrap:
|
||||||
|
- A list of command names which should always be wrapped
|
||||||
|
always_wrap: []
|
||||||
|
_help_enable_sort:
|
||||||
|
- If true, the argument lists which are known to be sortable
|
||||||
|
- will be sorted lexicographicall
|
||||||
|
enable_sort: true
|
||||||
|
_help_autosort:
|
||||||
|
- If true, the parsers may infer whether or not an argument
|
||||||
|
- list is sortable (without annotation).
|
||||||
|
autosort: true
|
||||||
|
_help_require_valid_layout:
|
||||||
|
- By default, if cmake-format cannot successfully fit
|
||||||
|
- everything into the desired linewidth it will apply the
|
||||||
|
- last, most aggressive attempt that it made. If this flag is
|
||||||
|
- True, however, cmake-format will print error, exit with non-
|
||||||
|
- zero status code, and write-out nothing
|
||||||
|
require_valid_layout: false
|
||||||
|
_help_layout_passes:
|
||||||
|
- A dictionary mapping layout nodes to a list of wrap
|
||||||
|
- decisions. See the documentation for more information.
|
||||||
|
layout_passes: {}
|
||||||
|
_help_markup: Options affecting comment reflow and formatting.
|
||||||
|
markup:
|
||||||
|
_help_bullet_char:
|
||||||
|
- What character to use for bulleted lists
|
||||||
|
bullet_char: "-"
|
||||||
|
_help_enum_char:
|
||||||
|
- What character to use as punctuation after numerals in an
|
||||||
|
- enumerated list
|
||||||
|
enum_char: .
|
||||||
|
_help_first_comment_is_literal:
|
||||||
|
- If comment markup is enabled, don't reflow the first comment
|
||||||
|
- block in each listfile. Use this to preserve formatting of
|
||||||
|
- your copyright/license statements.
|
||||||
|
first_comment_is_literal: false
|
||||||
|
_help_literal_comment_pattern:
|
||||||
|
- If comment markup is enabled, don't reflow any comment block
|
||||||
|
- which matches this (regex) pattern. Default is `None`
|
||||||
|
- (disabled).
|
||||||
|
literal_comment_pattern: null
|
||||||
|
_help_fence_pattern:
|
||||||
|
- Regular expression to match preformat fences in comments
|
||||||
|
- default= ``r'^\s*([`~]{3}[`~]*)(.*)$'``
|
||||||
|
fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$
|
||||||
|
_help_ruler_pattern:
|
||||||
|
- Regular expression to match rulers in comments default=
|
||||||
|
- '``r''^\s*[^\w\s]{3}.*[^\w\s]{3}$''``'
|
||||||
|
ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$
|
||||||
|
_help_explicit_trailing_pattern:
|
||||||
|
- If a comment line matches starts with this pattern then it
|
||||||
|
- is explicitly a trailing comment for the preceding
|
||||||
|
- argument. Default is '#<'
|
||||||
|
explicit_trailing_pattern: "#<"
|
||||||
|
_help_hashruler_min_length:
|
||||||
|
- If a comment line starts with at least this many consecutive
|
||||||
|
- hash characters, then don't lstrip() them off. This allows
|
||||||
|
- for lazy hash rulers where the first hash char is not
|
||||||
|
- separated by space
|
||||||
|
hashruler_min_length: 10
|
||||||
|
_help_canonicalize_hashrulers:
|
||||||
|
- If true, then insert a space between the first hash char and
|
||||||
|
- remaining hash chars in a hash ruler, and normalize its
|
||||||
|
- length to fill the column
|
||||||
|
canonicalize_hashrulers: true
|
||||||
|
_help_enable_markup:
|
||||||
|
- enable comment markup parsing and reflow
|
||||||
|
enable_markup: false
|
||||||
|
_help_lint: Options affecting the linter
|
||||||
|
lint:
|
||||||
|
_help_disabled_codes:
|
||||||
|
- a list of lint codes to disable
|
||||||
|
disabled_codes: []
|
||||||
|
_help_function_pattern:
|
||||||
|
- regular expression pattern describing valid function names
|
||||||
|
function_pattern: "[0-9a-z_]+"
|
||||||
|
_help_macro_pattern:
|
||||||
|
- regular expression pattern describing valid macro names
|
||||||
|
macro_pattern: "[0-9A-Z_]+"
|
||||||
|
_help_global_var_pattern:
|
||||||
|
- regular expression pattern describing valid names for
|
||||||
|
- variables with global (cache) scope
|
||||||
|
global_var_pattern: "[A-Z][0-9A-Z_]+"
|
||||||
|
_help_internal_var_pattern:
|
||||||
|
- regular expression pattern describing valid names for
|
||||||
|
- variables with global scope (but internal semantic)
|
||||||
|
internal_var_pattern: _[A-Z][0-9A-Z_]+
|
||||||
|
_help_local_var_pattern:
|
||||||
|
- regular expression pattern describing valid names for
|
||||||
|
- variables with local scope
|
||||||
|
local_var_pattern: "[a-z][a-z0-9_]+"
|
||||||
|
_help_private_var_pattern:
|
||||||
|
- regular expression pattern describing valid names for
|
||||||
|
- privatedirectory variables
|
||||||
|
private_var_pattern: _[0-9a-z_]+
|
||||||
|
_help_public_var_pattern:
|
||||||
|
- regular expression pattern describing valid names for public
|
||||||
|
- directory variables
|
||||||
|
public_var_pattern: "[A-Z][0-9A-Z_]+"
|
||||||
|
_help_argument_var_pattern:
|
||||||
|
- regular expression pattern describing valid names for
|
||||||
|
- function/macro arguments and loop variables.
|
||||||
|
argument_var_pattern: "[a-z][a-z0-9_]+"
|
||||||
|
_help_keyword_pattern:
|
||||||
|
- regular expression pattern describing valid names for
|
||||||
|
- keywords used in functions or macros
|
||||||
|
keyword_pattern: "[A-Z][0-9A-Z_]+"
|
||||||
|
_help_max_conditionals_custom_parser:
|
||||||
|
- In the heuristic for C0201, how many conditionals to match
|
||||||
|
- within a loop in before considering the loop a parser.
|
||||||
|
max_conditionals_custom_parser: 2
|
||||||
|
_help_min_statement_spacing:
|
||||||
|
- Require at least this many newlines between statements
|
||||||
|
min_statement_spacing: 1
|
||||||
|
_help_max_statement_spacing:
|
||||||
|
- Require no more than this many newlines between statements
|
||||||
|
max_statement_spacing: 2
|
||||||
|
max_returns: 6
|
||||||
|
max_branches: 12
|
||||||
|
max_arguments: 5
|
||||||
|
max_localvars: 15
|
||||||
|
max_statements: 50
|
||||||
|
_help_encode: Options affecting file encoding
|
||||||
|
encode:
|
||||||
|
_help_emit_byteorder_mark:
|
||||||
|
- If true, emit the unicode byte-order mark (BOM) at the start
|
||||||
|
- of the file
|
||||||
|
emit_byteorder_mark: false
|
||||||
|
_help_input_encoding:
|
||||||
|
- Specify the encoding of the input file. Defaults to utf-8
|
||||||
|
input_encoding: utf-8
|
||||||
|
_help_output_encoding:
|
||||||
|
- Specify the encoding of the output file. Defaults to utf-8.
|
||||||
|
- Note that cmake only claims to support utf-8 so be careful
|
||||||
|
- when using anything else
|
||||||
|
output_encoding: utf-8
|
||||||
|
_help_misc: Miscellaneous configurations options.
|
||||||
|
misc:
|
||||||
|
_help_per_command:
|
||||||
|
- A dictionary containing any per-command configuration
|
||||||
|
- overrides. Currently only `command_case` is supported.
|
||||||
|
per_command: {}
|
||||||
8
.github/CODEOWNERS
vendored
8
.github/CODEOWNERS
vendored
@@ -1,8 +0,0 @@
|
|||||||
# Allow anyone to review any change by default.
|
|
||||||
*
|
|
||||||
|
|
||||||
# Require the rpc-reviewers team to review changes to the rpc code.
|
|
||||||
include/xrpl/protocol/ @xrplf/rpc-reviewers
|
|
||||||
src/libxrpl/protocol/ @xrplf/rpc-reviewers
|
|
||||||
src/xrpld/rpc/ @xrplf/rpc-reviewers
|
|
||||||
src/xrpld/app/misc/ @xrplf/rpc-reviewers
|
|
||||||
8
.github/actions/generate-version/action.yml
vendored
8
.github/actions/generate-version/action.yml
vendored
@@ -17,8 +17,10 @@ runs:
|
|||||||
VERSION: ${{ github.ref_name }}
|
VERSION: ${{ github.ref_name }}
|
||||||
run: echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
|
run: echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
# When a tag is not pushed, then the version is extracted from the
|
# When a tag is not pushed, then the version (e.g. 1.2.3-b0) is extracted
|
||||||
# BuildInfo.cpp file and the shortened commit hash appended to it.
|
# from the BuildInfo.cpp file and the shortened commit hash appended to it.
|
||||||
|
# We use a plus sign instead of a hyphen because Conan recipe versions do
|
||||||
|
# not support two hyphens.
|
||||||
- name: Generate version for non-tag event
|
- name: Generate version for non-tag event
|
||||||
if: ${{ github.event_name != 'tag' }}
|
if: ${{ github.event_name != 'tag' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -32,7 +34,7 @@ runs:
|
|||||||
|
|
||||||
echo 'Appending shortened commit hash to version.'
|
echo 'Appending shortened commit hash to version.'
|
||||||
SHA='${{ github.sha }}'
|
SHA='${{ github.sha }}'
|
||||||
VERSION="${VERSION}-${SHA:0:7}"
|
VERSION="${VERSION}+${SHA:0:7}"
|
||||||
|
|
||||||
echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
|
echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
|
|||||||
2
.github/actions/setup-conan/action.yml
vendored
2
.github/actions/setup-conan/action.yml
vendored
@@ -31,7 +31,7 @@ runs:
|
|||||||
conan config install conan/profiles/ -tf $(conan config home)/profiles/
|
conan config install conan/profiles/ -tf $(conan config home)/profiles/
|
||||||
|
|
||||||
echo 'Conan profile:'
|
echo 'Conan profile:'
|
||||||
conan profile show
|
conan profile show --profile ci
|
||||||
|
|
||||||
- name: Set up Conan remote
|
- name: Set up Conan remote
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
56
.github/dependabot.yml
vendored
Normal file
56
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: "04:00"
|
||||||
|
timezone: Etc/GMT
|
||||||
|
commit-message:
|
||||||
|
prefix: "ci: [DEPENDABOT] "
|
||||||
|
target-branch: develop
|
||||||
|
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: .github/actions/build-deps/
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: "04:00"
|
||||||
|
timezone: Etc/GMT
|
||||||
|
commit-message:
|
||||||
|
prefix: "ci: [DEPENDABOT] "
|
||||||
|
target-branch: develop
|
||||||
|
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: .github/actions/generate-version/
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: "04:00"
|
||||||
|
timezone: Etc/GMT
|
||||||
|
commit-message:
|
||||||
|
prefix: "ci: [DEPENDABOT] "
|
||||||
|
target-branch: develop
|
||||||
|
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: .github/actions/print-env/
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: "04:00"
|
||||||
|
timezone: Etc/GMT
|
||||||
|
commit-message:
|
||||||
|
prefix: "ci: [DEPENDABOT] "
|
||||||
|
target-branch: develop
|
||||||
|
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: .github/actions/setup-conan/
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: "04:00"
|
||||||
|
timezone: Etc/GMT
|
||||||
|
commit-message:
|
||||||
|
prefix: "ci: [DEPENDABOT] "
|
||||||
|
target-branch: develop
|
||||||
@@ -4,14 +4,11 @@ Loop: test.jtx test.toplevel
|
|||||||
Loop: test.jtx test.unit_test
|
Loop: test.jtx test.unit_test
|
||||||
test.unit_test == test.jtx
|
test.unit_test == test.jtx
|
||||||
|
|
||||||
Loop: xrpld.app xrpld.core
|
|
||||||
xrpld.app > xrpld.core
|
|
||||||
|
|
||||||
Loop: xrpld.app xrpld.overlay
|
Loop: xrpld.app xrpld.overlay
|
||||||
xrpld.overlay > xrpld.app
|
xrpld.overlay ~= xrpld.app
|
||||||
|
|
||||||
Loop: xrpld.app xrpld.peerfinder
|
Loop: xrpld.app xrpld.peerfinder
|
||||||
xrpld.peerfinder ~= xrpld.app
|
xrpld.peerfinder == xrpld.app
|
||||||
|
|
||||||
Loop: xrpld.app xrpld.rpc
|
Loop: xrpld.app xrpld.rpc
|
||||||
xrpld.rpc > xrpld.app
|
xrpld.rpc > xrpld.app
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
libxrpl.basics > xrpl.basics
|
libxrpl.basics > xrpl.basics
|
||||||
|
libxrpl.conditions > xrpl.basics
|
||||||
|
libxrpl.conditions > xrpl.conditions
|
||||||
libxrpl.core > xrpl.basics
|
libxrpl.core > xrpl.basics
|
||||||
libxrpl.core > xrpl.core
|
libxrpl.core > xrpl.core
|
||||||
libxrpl.crypto > xrpl.basics
|
libxrpl.crypto > xrpl.basics
|
||||||
@@ -17,17 +19,27 @@ libxrpl.nodestore > xrpl.protocol
|
|||||||
libxrpl.protocol > xrpl.basics
|
libxrpl.protocol > xrpl.basics
|
||||||
libxrpl.protocol > xrpl.json
|
libxrpl.protocol > xrpl.json
|
||||||
libxrpl.protocol > xrpl.protocol
|
libxrpl.protocol > xrpl.protocol
|
||||||
|
libxrpl.rdb > xrpl.basics
|
||||||
|
libxrpl.rdb > xrpl.rdb
|
||||||
libxrpl.resource > xrpl.basics
|
libxrpl.resource > xrpl.basics
|
||||||
libxrpl.resource > xrpl.json
|
libxrpl.resource > xrpl.json
|
||||||
libxrpl.resource > xrpl.protocol
|
|
||||||
libxrpl.resource > xrpl.resource
|
libxrpl.resource > xrpl.resource
|
||||||
libxrpl.server > xrpl.basics
|
libxrpl.server > xrpl.basics
|
||||||
libxrpl.server > xrpl.json
|
libxrpl.server > xrpl.json
|
||||||
libxrpl.server > xrpl.protocol
|
libxrpl.server > xrpl.protocol
|
||||||
|
libxrpl.server > xrpl.rdb
|
||||||
libxrpl.server > xrpl.server
|
libxrpl.server > xrpl.server
|
||||||
libxrpl.shamap > xrpl.basics
|
libxrpl.shamap > xrpl.basics
|
||||||
libxrpl.shamap > xrpl.protocol
|
libxrpl.shamap > xrpl.protocol
|
||||||
libxrpl.shamap > xrpl.shamap
|
libxrpl.shamap > xrpl.shamap
|
||||||
|
libxrpl.tx > xrpl.basics
|
||||||
|
libxrpl.tx > xrpl.conditions
|
||||||
|
libxrpl.tx > xrpl.core
|
||||||
|
libxrpl.tx > xrpl.json
|
||||||
|
libxrpl.tx > xrpl.ledger
|
||||||
|
libxrpl.tx > xrpl.protocol
|
||||||
|
libxrpl.tx > xrpl.server
|
||||||
|
libxrpl.tx > xrpl.tx
|
||||||
test.app > test.jtx
|
test.app > test.jtx
|
||||||
test.app > test.rpc
|
test.app > test.rpc
|
||||||
test.app > test.toplevel
|
test.app > test.toplevel
|
||||||
@@ -42,7 +54,10 @@ test.app > xrpl.json
|
|||||||
test.app > xrpl.ledger
|
test.app > xrpl.ledger
|
||||||
test.app > xrpl.nodestore
|
test.app > xrpl.nodestore
|
||||||
test.app > xrpl.protocol
|
test.app > xrpl.protocol
|
||||||
|
test.app > xrpl.rdb
|
||||||
test.app > xrpl.resource
|
test.app > xrpl.resource
|
||||||
|
test.app > xrpl.server
|
||||||
|
test.app > xrpl.tx
|
||||||
test.basics > test.jtx
|
test.basics > test.jtx
|
||||||
test.basics > test.unit_test
|
test.basics > test.unit_test
|
||||||
test.basics > xrpl.basics
|
test.basics > xrpl.basics
|
||||||
@@ -52,7 +67,7 @@ test.basics > xrpl.json
|
|||||||
test.basics > xrpl.protocol
|
test.basics > xrpl.protocol
|
||||||
test.beast > xrpl.basics
|
test.beast > xrpl.basics
|
||||||
test.conditions > xrpl.basics
|
test.conditions > xrpl.basics
|
||||||
test.conditions > xrpld.conditions
|
test.conditions > xrpl.conditions
|
||||||
test.consensus > test.csf
|
test.consensus > test.csf
|
||||||
test.consensus > test.toplevel
|
test.consensus > test.toplevel
|
||||||
test.consensus > test.unit_test
|
test.consensus > test.unit_test
|
||||||
@@ -61,6 +76,7 @@ test.consensus > xrpld.app
|
|||||||
test.consensus > xrpld.consensus
|
test.consensus > xrpld.consensus
|
||||||
test.consensus > xrpl.json
|
test.consensus > xrpl.json
|
||||||
test.consensus > xrpl.ledger
|
test.consensus > xrpl.ledger
|
||||||
|
test.consensus > xrpl.tx
|
||||||
test.core > test.jtx
|
test.core > test.jtx
|
||||||
test.core > test.toplevel
|
test.core > test.toplevel
|
||||||
test.core > test.unit_test
|
test.core > test.unit_test
|
||||||
@@ -68,6 +84,7 @@ test.core > xrpl.basics
|
|||||||
test.core > xrpl.core
|
test.core > xrpl.core
|
||||||
test.core > xrpld.core
|
test.core > xrpld.core
|
||||||
test.core > xrpl.json
|
test.core > xrpl.json
|
||||||
|
test.core > xrpl.rdb
|
||||||
test.core > xrpl.server
|
test.core > xrpl.server
|
||||||
test.csf > xrpl.basics
|
test.csf > xrpl.basics
|
||||||
test.csf > xrpld.consensus
|
test.csf > xrpld.consensus
|
||||||
@@ -76,6 +93,7 @@ test.csf > xrpl.protocol
|
|||||||
test.json > test.jtx
|
test.json > test.jtx
|
||||||
test.json > xrpl.json
|
test.json > xrpl.json
|
||||||
test.jtx > xrpl.basics
|
test.jtx > xrpl.basics
|
||||||
|
test.jtx > xrpl.core
|
||||||
test.jtx > xrpld.app
|
test.jtx > xrpld.app
|
||||||
test.jtx > xrpld.core
|
test.jtx > xrpld.core
|
||||||
test.jtx > xrpld.rpc
|
test.jtx > xrpld.rpc
|
||||||
@@ -85,6 +103,7 @@ test.jtx > xrpl.net
|
|||||||
test.jtx > xrpl.protocol
|
test.jtx > xrpl.protocol
|
||||||
test.jtx > xrpl.resource
|
test.jtx > xrpl.resource
|
||||||
test.jtx > xrpl.server
|
test.jtx > xrpl.server
|
||||||
|
test.jtx > xrpl.tx
|
||||||
test.ledger > test.jtx
|
test.ledger > test.jtx
|
||||||
test.ledger > test.toplevel
|
test.ledger > test.toplevel
|
||||||
test.ledger > xrpl.basics
|
test.ledger > xrpl.basics
|
||||||
@@ -96,8 +115,8 @@ test.nodestore > test.jtx
|
|||||||
test.nodestore > test.toplevel
|
test.nodestore > test.toplevel
|
||||||
test.nodestore > test.unit_test
|
test.nodestore > test.unit_test
|
||||||
test.nodestore > xrpl.basics
|
test.nodestore > xrpl.basics
|
||||||
test.nodestore > xrpld.core
|
|
||||||
test.nodestore > xrpl.nodestore
|
test.nodestore > xrpl.nodestore
|
||||||
|
test.nodestore > xrpl.rdb
|
||||||
test.overlay > test.jtx
|
test.overlay > test.jtx
|
||||||
test.overlay > test.toplevel
|
test.overlay > test.toplevel
|
||||||
test.overlay > test.unit_test
|
test.overlay > test.unit_test
|
||||||
@@ -130,8 +149,11 @@ test.rpc > xrpld.core
|
|||||||
test.rpc > xrpld.overlay
|
test.rpc > xrpld.overlay
|
||||||
test.rpc > xrpld.rpc
|
test.rpc > xrpld.rpc
|
||||||
test.rpc > xrpl.json
|
test.rpc > xrpl.json
|
||||||
|
test.rpc > xrpl.ledger
|
||||||
test.rpc > xrpl.protocol
|
test.rpc > xrpl.protocol
|
||||||
test.rpc > xrpl.resource
|
test.rpc > xrpl.resource
|
||||||
|
test.rpc > xrpl.server
|
||||||
|
test.rpc > xrpl.tx
|
||||||
test.server > test.jtx
|
test.server > test.jtx
|
||||||
test.server > test.toplevel
|
test.server > test.toplevel
|
||||||
test.server > test.unit_test
|
test.server > test.unit_test
|
||||||
@@ -152,39 +174,57 @@ test.unit_test > xrpl.basics
|
|||||||
tests.libxrpl > xrpl.basics
|
tests.libxrpl > xrpl.basics
|
||||||
tests.libxrpl > xrpl.json
|
tests.libxrpl > xrpl.json
|
||||||
tests.libxrpl > xrpl.net
|
tests.libxrpl > xrpl.net
|
||||||
|
xrpl.conditions > xrpl.basics
|
||||||
|
xrpl.conditions > xrpl.protocol
|
||||||
xrpl.core > xrpl.basics
|
xrpl.core > xrpl.basics
|
||||||
xrpl.core > xrpl.json
|
xrpl.core > xrpl.json
|
||||||
|
xrpl.core > xrpl.ledger
|
||||||
|
xrpl.core > xrpl.protocol
|
||||||
xrpl.json > xrpl.basics
|
xrpl.json > xrpl.basics
|
||||||
xrpl.ledger > xrpl.basics
|
xrpl.ledger > xrpl.basics
|
||||||
xrpl.ledger > xrpl.protocol
|
xrpl.ledger > xrpl.protocol
|
||||||
|
xrpl.ledger > xrpl.server
|
||||||
|
xrpl.ledger > xrpl.shamap
|
||||||
xrpl.net > xrpl.basics
|
xrpl.net > xrpl.basics
|
||||||
xrpl.nodestore > xrpl.basics
|
xrpl.nodestore > xrpl.basics
|
||||||
xrpl.nodestore > xrpl.protocol
|
xrpl.nodestore > xrpl.protocol
|
||||||
xrpl.protocol > xrpl.basics
|
xrpl.protocol > xrpl.basics
|
||||||
xrpl.protocol > xrpl.json
|
xrpl.protocol > xrpl.json
|
||||||
|
xrpl.rdb > xrpl.basics
|
||||||
|
xrpl.rdb > xrpl.core
|
||||||
|
xrpl.rdb > xrpl.protocol
|
||||||
xrpl.resource > xrpl.basics
|
xrpl.resource > xrpl.basics
|
||||||
xrpl.resource > xrpl.json
|
xrpl.resource > xrpl.json
|
||||||
xrpl.resource > xrpl.protocol
|
xrpl.resource > xrpl.protocol
|
||||||
xrpl.server > xrpl.basics
|
xrpl.server > xrpl.basics
|
||||||
|
xrpl.server > xrpl.core
|
||||||
xrpl.server > xrpl.json
|
xrpl.server > xrpl.json
|
||||||
xrpl.server > xrpl.protocol
|
xrpl.server > xrpl.protocol
|
||||||
|
xrpl.server > xrpl.rdb
|
||||||
|
xrpl.server > xrpl.resource
|
||||||
|
xrpl.server > xrpl.shamap
|
||||||
xrpl.shamap > xrpl.basics
|
xrpl.shamap > xrpl.basics
|
||||||
xrpl.shamap > xrpl.nodestore
|
xrpl.shamap > xrpl.nodestore
|
||||||
xrpl.shamap > xrpl.protocol
|
xrpl.shamap > xrpl.protocol
|
||||||
|
xrpl.tx > xrpl.basics
|
||||||
|
xrpl.tx > xrpl.core
|
||||||
|
xrpl.tx > xrpl.ledger
|
||||||
|
xrpl.tx > xrpl.protocol
|
||||||
xrpld.app > test.unit_test
|
xrpld.app > test.unit_test
|
||||||
xrpld.app > xrpl.basics
|
xrpld.app > xrpl.basics
|
||||||
xrpld.app > xrpl.core
|
xrpld.app > xrpl.core
|
||||||
xrpld.app > xrpld.conditions
|
|
||||||
xrpld.app > xrpld.consensus
|
xrpld.app > xrpld.consensus
|
||||||
|
xrpld.app > xrpld.core
|
||||||
xrpld.app > xrpl.json
|
xrpld.app > xrpl.json
|
||||||
xrpld.app > xrpl.ledger
|
xrpld.app > xrpl.ledger
|
||||||
xrpld.app > xrpl.net
|
xrpld.app > xrpl.net
|
||||||
xrpld.app > xrpl.nodestore
|
xrpld.app > xrpl.nodestore
|
||||||
xrpld.app > xrpl.protocol
|
xrpld.app > xrpl.protocol
|
||||||
|
xrpld.app > xrpl.rdb
|
||||||
xrpld.app > xrpl.resource
|
xrpld.app > xrpl.resource
|
||||||
|
xrpld.app > xrpl.server
|
||||||
xrpld.app > xrpl.shamap
|
xrpld.app > xrpl.shamap
|
||||||
xrpld.conditions > xrpl.basics
|
xrpld.app > xrpl.tx
|
||||||
xrpld.conditions > xrpl.protocol
|
|
||||||
xrpld.consensus > xrpl.basics
|
xrpld.consensus > xrpl.basics
|
||||||
xrpld.consensus > xrpl.json
|
xrpld.consensus > xrpl.json
|
||||||
xrpld.consensus > xrpl.protocol
|
xrpld.consensus > xrpl.protocol
|
||||||
@@ -193,17 +233,21 @@ xrpld.core > xrpl.core
|
|||||||
xrpld.core > xrpl.json
|
xrpld.core > xrpl.json
|
||||||
xrpld.core > xrpl.net
|
xrpld.core > xrpl.net
|
||||||
xrpld.core > xrpl.protocol
|
xrpld.core > xrpl.protocol
|
||||||
|
xrpld.core > xrpl.rdb
|
||||||
xrpld.overlay > xrpl.basics
|
xrpld.overlay > xrpl.basics
|
||||||
xrpld.overlay > xrpl.core
|
xrpld.overlay > xrpl.core
|
||||||
xrpld.overlay > xrpld.core
|
xrpld.overlay > xrpld.core
|
||||||
xrpld.overlay > xrpld.peerfinder
|
xrpld.overlay > xrpld.peerfinder
|
||||||
xrpld.overlay > xrpl.json
|
xrpld.overlay > xrpl.json
|
||||||
xrpld.overlay > xrpl.protocol
|
xrpld.overlay > xrpl.protocol
|
||||||
|
xrpld.overlay > xrpl.rdb
|
||||||
xrpld.overlay > xrpl.resource
|
xrpld.overlay > xrpl.resource
|
||||||
xrpld.overlay > xrpl.server
|
xrpld.overlay > xrpl.server
|
||||||
|
xrpld.overlay > xrpl.tx
|
||||||
xrpld.peerfinder > xrpl.basics
|
xrpld.peerfinder > xrpl.basics
|
||||||
xrpld.peerfinder > xrpld.core
|
xrpld.peerfinder > xrpld.core
|
||||||
xrpld.peerfinder > xrpl.protocol
|
xrpld.peerfinder > xrpl.protocol
|
||||||
|
xrpld.peerfinder > xrpl.rdb
|
||||||
xrpld.perflog > xrpl.basics
|
xrpld.perflog > xrpl.basics
|
||||||
xrpld.perflog > xrpl.core
|
xrpld.perflog > xrpl.core
|
||||||
xrpld.perflog > xrpld.rpc
|
xrpld.perflog > xrpld.rpc
|
||||||
@@ -216,6 +260,8 @@ xrpld.rpc > xrpl.ledger
|
|||||||
xrpld.rpc > xrpl.net
|
xrpld.rpc > xrpl.net
|
||||||
xrpld.rpc > xrpl.nodestore
|
xrpld.rpc > xrpl.nodestore
|
||||||
xrpld.rpc > xrpl.protocol
|
xrpld.rpc > xrpl.protocol
|
||||||
|
xrpld.rpc > xrpl.rdb
|
||||||
xrpld.rpc > xrpl.resource
|
xrpld.rpc > xrpl.resource
|
||||||
xrpld.rpc > xrpl.server
|
xrpld.rpc > xrpl.server
|
||||||
|
xrpld.rpc > xrpl.tx
|
||||||
xrpld.shamap > xrpl.shamap
|
xrpld.shamap > xrpl.shamap
|
||||||
|
|||||||
30
.github/scripts/rename/include.sh
vendored
Executable file
30
.github/scripts/rename/include.sh
vendored
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Exit the script as soon as an error occurs.
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# This script checks whether there are no new include guards introduced by a new
|
||||||
|
# PR, as header files should use "#pragma once" instead. The script assumes any
|
||||||
|
# include guards will use "XRPL_" as prefix.
|
||||||
|
# Usage: .github/scripts/rename/include.sh <repository directory>
|
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: $0 <repository directory>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
DIRECTORY=$1
|
||||||
|
echo "Processing directory: ${DIRECTORY}"
|
||||||
|
if [ ! -d "${DIRECTORY}" ]; then
|
||||||
|
echo "Error: Directory '${DIRECTORY}' does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" \) | while read -r FILE; do
|
||||||
|
echo "Processing file: ${FILE}"
|
||||||
|
if grep -q "#ifndef XRPL_" "${FILE}"; then
|
||||||
|
echo "Please replace all include guards by #pragma once."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Checking complete."
|
||||||
76
.github/scripts/strategy-matrix/generate.py
vendored
76
.github/scripts/strategy-matrix/generate.py
vendored
@@ -44,29 +44,27 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
# We build and test all configurations by default, except for Windows in
|
# We build and test all configurations by default, except for Windows in
|
||||||
# Debug, because it is too slow, as well as when code coverage is
|
# Debug, because it is too slow, as well as when code coverage is
|
||||||
# enabled as that mode already runs the tests.
|
# enabled as that mode already runs the tests.
|
||||||
build_only = True
|
build_only = False
|
||||||
if os["distro_name"] == "windows" and build_type == "Debug":
|
if os["distro_name"] == "windows" and build_type == "Debug":
|
||||||
build_only = True
|
build_only = True
|
||||||
|
|
||||||
# Only generate a subset of configurations in PRs.
|
# Only generate a subset of configurations in PRs.
|
||||||
if not all:
|
if not all:
|
||||||
# Debian:
|
# Debian:
|
||||||
# - Bookworm using GCC 13: Release and Unity on linux/amd64, set
|
# - Bookworm using GCC 13: Release on linux/amd64, set the reference
|
||||||
# the reference fee to 500.
|
# fee to 500.
|
||||||
# - Bookworm using GCC 15: Debug and no Unity on linux/amd64, enable
|
# - Bookworm using GCC 15: Debug on linux/amd64, enable code
|
||||||
# code coverage (which will be done below).
|
# coverage (which will be done below).
|
||||||
# - Bookworm using Clang 16: Debug and no Unity on linux/arm64,
|
# - Bookworm using Clang 16: Debug on linux/arm64, enable voidstar.
|
||||||
# enable voidstar.
|
# - Bookworm using Clang 17: Release on linux/amd64, set the
|
||||||
# - Bookworm using Clang 17: Release and no Unity on linux/amd64,
|
# reference fee to 1000.
|
||||||
# set the reference fee to 1000.
|
# - Bookworm using Clang 20: Debug on linux/amd64.
|
||||||
# - Bookworm using Clang 20: Debug and Unity on linux/amd64.
|
|
||||||
if os["distro_name"] == "debian":
|
if os["distro_name"] == "debian":
|
||||||
skip = True
|
skip = True
|
||||||
if os["distro_version"] == "bookworm":
|
if os["distro_version"] == "bookworm":
|
||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-13"
|
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-13"
|
||||||
and build_type == "Release"
|
and build_type == "Release"
|
||||||
and "-Dunity=ON" in cmake_args
|
|
||||||
and architecture["platform"] == "linux/amd64"
|
and architecture["platform"] == "linux/amd64"
|
||||||
):
|
):
|
||||||
cmake_args = f"-DUNIT_TEST_REFERENCE_FEE=500 {cmake_args}"
|
cmake_args = f"-DUNIT_TEST_REFERENCE_FEE=500 {cmake_args}"
|
||||||
@@ -74,14 +72,12 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-15"
|
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-15"
|
||||||
and build_type == "Debug"
|
and build_type == "Debug"
|
||||||
and "-Dunity=OFF" in cmake_args
|
|
||||||
and architecture["platform"] == "linux/amd64"
|
and architecture["platform"] == "linux/amd64"
|
||||||
):
|
):
|
||||||
skip = False
|
skip = False
|
||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "clang-16"
|
f"{os['compiler_name']}-{os['compiler_version']}" == "clang-16"
|
||||||
and build_type == "Debug"
|
and build_type == "Debug"
|
||||||
and "-Dunity=OFF" in cmake_args
|
|
||||||
and architecture["platform"] == "linux/arm64"
|
and architecture["platform"] == "linux/arm64"
|
||||||
):
|
):
|
||||||
cmake_args = f"-Dvoidstar=ON {cmake_args}"
|
cmake_args = f"-Dvoidstar=ON {cmake_args}"
|
||||||
@@ -89,7 +85,6 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "clang-17"
|
f"{os['compiler_name']}-{os['compiler_version']}" == "clang-17"
|
||||||
and build_type == "Release"
|
and build_type == "Release"
|
||||||
and "-Dunity=ON" in cmake_args
|
|
||||||
and architecture["platform"] == "linux/amd64"
|
and architecture["platform"] == "linux/amd64"
|
||||||
):
|
):
|
||||||
cmake_args = f"-DUNIT_TEST_REFERENCE_FEE=1000 {cmake_args}"
|
cmake_args = f"-DUNIT_TEST_REFERENCE_FEE=1000 {cmake_args}"
|
||||||
@@ -97,7 +92,6 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "clang-20"
|
f"{os['compiler_name']}-{os['compiler_version']}" == "clang-20"
|
||||||
and build_type == "Debug"
|
and build_type == "Debug"
|
||||||
and "-Dunity=ON" in cmake_args
|
|
||||||
and architecture["platform"] == "linux/amd64"
|
and architecture["platform"] == "linux/amd64"
|
||||||
):
|
):
|
||||||
skip = False
|
skip = False
|
||||||
@@ -105,15 +99,14 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# RHEL:
|
# RHEL:
|
||||||
# - 9 using GCC 12: Debug and Unity on linux/amd64.
|
# - 9 using GCC 12: Debug on linux/amd64.
|
||||||
# - 10 using Clang: Release and no Unity on linux/amd64.
|
# - 10 using Clang: Release on linux/amd64.
|
||||||
if os["distro_name"] == "rhel":
|
if os["distro_name"] == "rhel":
|
||||||
skip = True
|
skip = True
|
||||||
if os["distro_version"] == "9":
|
if os["distro_version"] == "9":
|
||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-12"
|
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-12"
|
||||||
and build_type == "Debug"
|
and build_type == "Debug"
|
||||||
and "-Dunity=ON" in cmake_args
|
|
||||||
and architecture["platform"] == "linux/amd64"
|
and architecture["platform"] == "linux/amd64"
|
||||||
):
|
):
|
||||||
skip = False
|
skip = False
|
||||||
@@ -121,7 +114,6 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "clang-any"
|
f"{os['compiler_name']}-{os['compiler_version']}" == "clang-any"
|
||||||
and build_type == "Release"
|
and build_type == "Release"
|
||||||
and "-Dunity=OFF" in cmake_args
|
|
||||||
and architecture["platform"] == "linux/amd64"
|
and architecture["platform"] == "linux/amd64"
|
||||||
):
|
):
|
||||||
skip = False
|
skip = False
|
||||||
@@ -129,17 +121,16 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Ubuntu:
|
# Ubuntu:
|
||||||
# - Jammy using GCC 12: Debug and no Unity on linux/arm64.
|
# - Jammy using GCC 12: Debug on linux/arm64.
|
||||||
# - Noble using GCC 14: Release and Unity on linux/amd64.
|
# - Noble using GCC 14: Release on linux/amd64.
|
||||||
# - Noble using Clang 18: Debug and no Unity on linux/amd64.
|
# - Noble using Clang 18: Debug on linux/amd64.
|
||||||
# - Noble using Clang 19: Release and Unity on linux/arm64.
|
# - Noble using Clang 19: Release on linux/arm64.
|
||||||
if os["distro_name"] == "ubuntu":
|
if os["distro_name"] == "ubuntu":
|
||||||
skip = True
|
skip = True
|
||||||
if os["distro_version"] == "jammy":
|
if os["distro_version"] == "jammy":
|
||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-12"
|
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-12"
|
||||||
and build_type == "Debug"
|
and build_type == "Debug"
|
||||||
and "-Dunity=OFF" in cmake_args
|
|
||||||
and architecture["platform"] == "linux/arm64"
|
and architecture["platform"] == "linux/arm64"
|
||||||
):
|
):
|
||||||
skip = False
|
skip = False
|
||||||
@@ -147,21 +138,18 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-14"
|
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-14"
|
||||||
and build_type == "Release"
|
and build_type == "Release"
|
||||||
and "-Dunity=ON" in cmake_args
|
|
||||||
and architecture["platform"] == "linux/amd64"
|
and architecture["platform"] == "linux/amd64"
|
||||||
):
|
):
|
||||||
skip = False
|
skip = False
|
||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "clang-18"
|
f"{os['compiler_name']}-{os['compiler_version']}" == "clang-18"
|
||||||
and build_type == "Debug"
|
and build_type == "Debug"
|
||||||
and "-Dunity=OFF" in cmake_args
|
|
||||||
and architecture["platform"] == "linux/amd64"
|
and architecture["platform"] == "linux/amd64"
|
||||||
):
|
):
|
||||||
skip = False
|
skip = False
|
||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "clang-19"
|
f"{os['compiler_name']}-{os['compiler_version']}" == "clang-19"
|
||||||
and build_type == "Release"
|
and build_type == "Release"
|
||||||
and "-Dunity=ON" in cmake_args
|
|
||||||
and architecture["platform"] == "linux/arm64"
|
and architecture["platform"] == "linux/arm64"
|
||||||
):
|
):
|
||||||
skip = False
|
skip = False
|
||||||
@@ -169,20 +157,16 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# MacOS:
|
# MacOS:
|
||||||
# - Debug and no Unity on macos/arm64.
|
# - Debug on macos/arm64.
|
||||||
if os["distro_name"] == "macos" and not (
|
if os["distro_name"] == "macos" and not (
|
||||||
build_type == "Debug"
|
build_type == "Debug" and architecture["platform"] == "macos/arm64"
|
||||||
and "-Dunity=OFF" in cmake_args
|
|
||||||
and architecture["platform"] == "macos/arm64"
|
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Windows:
|
# Windows:
|
||||||
# - Release and Unity on windows/amd64.
|
# - Release on windows/amd64.
|
||||||
if os["distro_name"] == "windows" and not (
|
if os["distro_name"] == "windows" and not (
|
||||||
build_type == "Release"
|
build_type == "Release" and architecture["platform"] == "windows/amd64"
|
||||||
and "-Dunity=ON" in cmake_args
|
|
||||||
and architecture["platform"] == "windows/amd64"
|
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -209,18 +193,28 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Enable code coverage for Debian Bookworm using GCC 15 in Debug and no
|
# Enable code coverage for Debian Bookworm using GCC 15 in Debug on
|
||||||
# Unity on linux/amd64
|
# linux/amd64
|
||||||
if (
|
if (
|
||||||
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-15"
|
f"{os['distro_name']}-{os['distro_version']}" == "debian-bookworm"
|
||||||
|
and f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-15"
|
||||||
and build_type == "Debug"
|
and build_type == "Debug"
|
||||||
and "-Dunity=OFF" in cmake_args
|
|
||||||
and architecture["platform"] == "linux/amd64"
|
and architecture["platform"] == "linux/amd64"
|
||||||
):
|
):
|
||||||
cmake_args = f"-Dcoverage=ON -Dcoverage_format=xml -DCODE_COVERAGE_VERBOSE=ON -DCMAKE_C_FLAGS=-O0 -DCMAKE_CXX_FLAGS=-O0 {cmake_args}"
|
cmake_args = f"{cmake_args} -Dcoverage=ON -Dcoverage_format=xml -DCODE_COVERAGE_VERBOSE=ON -DCMAKE_C_FLAGS=-O0 -DCMAKE_CXX_FLAGS=-O0"
|
||||||
|
|
||||||
|
# Enable unity build for Ubuntu Jammy using GCC 12 in Debug on
|
||||||
|
# linux/amd64.
|
||||||
|
if (
|
||||||
|
f"{os['distro_name']}-{os['distro_version']}" == "ubuntu-jammy"
|
||||||
|
and f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-12"
|
||||||
|
and build_type == "Debug"
|
||||||
|
and architecture["platform"] == "linux/amd64"
|
||||||
|
):
|
||||||
|
cmake_args = f"{cmake_args} -Dunity=ON"
|
||||||
|
|
||||||
# Generate a unique name for the configuration, e.g. macos-arm64-debug
|
# Generate a unique name for the configuration, e.g. macos-arm64-debug
|
||||||
# or debian-bookworm-gcc-12-amd64-release-unity.
|
# or debian-bookworm-gcc-12-amd64-release.
|
||||||
config_name = os["distro_name"]
|
config_name = os["distro_name"]
|
||||||
if (n := os["distro_version"]) != "":
|
if (n := os["distro_version"]) != "":
|
||||||
config_name += f"-{n}"
|
config_name += f"-{n}"
|
||||||
|
|||||||
2
.github/scripts/strategy-matrix/linux.json
vendored
2
.github/scripts/strategy-matrix/linux.json
vendored
@@ -208,5 +208,5 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"build_type": ["Debug", "Release"],
|
"build_type": ["Debug", "Release"],
|
||||||
"cmake_args": ["-Dunity=OFF", "-Dunity=ON"]
|
"cmake_args": [""]
|
||||||
}
|
}
|
||||||
|
|||||||
5
.github/scripts/strategy-matrix/macos.json
vendored
5
.github/scripts/strategy-matrix/macos.json
vendored
@@ -15,8 +15,5 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"build_type": ["Debug", "Release"],
|
"build_type": ["Debug", "Release"],
|
||||||
"cmake_args": [
|
"cmake_args": ["-DCMAKE_POLICY_VERSION_MINIMUM=3.5"]
|
||||||
"-Dunity=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5",
|
|
||||||
"-Dunity=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
2
.github/scripts/strategy-matrix/windows.json
vendored
2
.github/scripts/strategy-matrix/windows.json
vendored
@@ -15,5 +15,5 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"build_type": ["Debug", "Release"],
|
"build_type": ["Debug", "Release"],
|
||||||
"cmake_args": ["-Dunity=OFF", "-Dunity=ON"]
|
"cmake_args": [""]
|
||||||
}
|
}
|
||||||
|
|||||||
20
.github/workflows/on-pr.yml
vendored
20
.github/workflows/on-pr.yml
vendored
@@ -33,7 +33,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
- name: Determine changed files
|
- name: Determine changed files
|
||||||
# This step checks whether any files have changed that should
|
# This step checks whether any files have changed that should
|
||||||
# cause the next jobs to run. We do it this way rather than
|
# cause the next jobs to run. We do it this way rather than
|
||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
# that Github considers any skipped jobs to have passed, and in
|
# that Github considers any skipped jobs to have passed, and in
|
||||||
# turn the required checks as well.
|
# turn the required checks as well.
|
||||||
id: changes
|
id: changes
|
||||||
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
|
uses: tj-actions/changed-files@7dee1b0c1557f278e5c7dc244927139d78c0e22a # v47.0.4
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
# These paths are unique to `on-pr.yml`.
|
# These paths are unique to `on-pr.yml`.
|
||||||
@@ -59,14 +59,18 @@ jobs:
|
|||||||
# Keep the paths below in sync with those in `on-trigger.yml`.
|
# Keep the paths below in sync with those in `on-trigger.yml`.
|
||||||
.github/actions/build-deps/**
|
.github/actions/build-deps/**
|
||||||
.github/actions/build-test/**
|
.github/actions/build-test/**
|
||||||
|
.github/actions/generate-version/**
|
||||||
.github/actions/setup-conan/**
|
.github/actions/setup-conan/**
|
||||||
.github/scripts/strategy-matrix/**
|
.github/scripts/strategy-matrix/**
|
||||||
.github/workflows/reusable-build.yml
|
.github/workflows/reusable-build.yml
|
||||||
.github/workflows/reusable-build-test-config.yml
|
.github/workflows/reusable-build-test-config.yml
|
||||||
.github/workflows/reusable-build-test.yml
|
.github/workflows/reusable-build-test.yml
|
||||||
|
.github/workflows/reusable-clang-tidy.yml
|
||||||
|
.github/workflows/reusable-clang-tidy-files.yml
|
||||||
.github/workflows/reusable-strategy-matrix.yml
|
.github/workflows/reusable-strategy-matrix.yml
|
||||||
.github/workflows/reusable-test.yml
|
.github/workflows/reusable-test.yml
|
||||||
.github/workflows/reusable-upload-recipe.yml
|
.github/workflows/reusable-upload-recipe.yml
|
||||||
|
.clang-tidy
|
||||||
.codecov.yml
|
.codecov.yml
|
||||||
cmake/**
|
cmake/**
|
||||||
conan/**
|
conan/**
|
||||||
@@ -106,6 +110,17 @@ jobs:
|
|||||||
if: ${{ needs.should-run.outputs.go == 'true' }}
|
if: ${{ needs.should-run.outputs.go == 'true' }}
|
||||||
uses: ./.github/workflows/reusable-check-rename.yml
|
uses: ./.github/workflows/reusable-check-rename.yml
|
||||||
|
|
||||||
|
clang-tidy:
|
||||||
|
needs: should-run
|
||||||
|
if: ${{ needs.should-run.outputs.go == 'true' }}
|
||||||
|
uses: ./.github/workflows/reusable-clang-tidy.yml
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
contents: read
|
||||||
|
with:
|
||||||
|
check_only_changed: true
|
||||||
|
create_issue_on_failure: false
|
||||||
|
|
||||||
build-test:
|
build-test:
|
||||||
needs: should-run
|
needs: should-run
|
||||||
if: ${{ needs.should-run.outputs.go == 'true' }}
|
if: ${{ needs.should-run.outputs.go == 'true' }}
|
||||||
@@ -155,6 +170,7 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- check-levelization
|
- check-levelization
|
||||||
- check-rename
|
- check-rename
|
||||||
|
- clang-tidy
|
||||||
- build-test
|
- build-test
|
||||||
- upload-recipe
|
- upload-recipe
|
||||||
- notify-clio
|
- notify-clio
|
||||||
|
|||||||
13
.github/workflows/on-trigger.yml
vendored
13
.github/workflows/on-trigger.yml
vendored
@@ -16,14 +16,18 @@ on:
|
|||||||
# Keep the paths below in sync with those in `on-pr.yml`.
|
# Keep the paths below in sync with those in `on-pr.yml`.
|
||||||
- ".github/actions/build-deps/**"
|
- ".github/actions/build-deps/**"
|
||||||
- ".github/actions/build-test/**"
|
- ".github/actions/build-test/**"
|
||||||
|
- ".github/actions/generate-version/**"
|
||||||
- ".github/actions/setup-conan/**"
|
- ".github/actions/setup-conan/**"
|
||||||
- ".github/scripts/strategy-matrix/**"
|
- ".github/scripts/strategy-matrix/**"
|
||||||
- ".github/workflows/reusable-build.yml"
|
- ".github/workflows/reusable-build.yml"
|
||||||
- ".github/workflows/reusable-build-test-config.yml"
|
- ".github/workflows/reusable-build-test-config.yml"
|
||||||
- ".github/workflows/reusable-build-test.yml"
|
- ".github/workflows/reusable-build-test.yml"
|
||||||
|
- ".github/workflows/reusable-clang-tidy.yml"
|
||||||
|
- ".github/workflows/reusable-clang-tidy-files.yml"
|
||||||
- ".github/workflows/reusable-strategy-matrix.yml"
|
- ".github/workflows/reusable-strategy-matrix.yml"
|
||||||
- ".github/workflows/reusable-test.yml"
|
- ".github/workflows/reusable-test.yml"
|
||||||
- ".github/workflows/reusable-upload-recipe.yml"
|
- ".github/workflows/reusable-upload-recipe.yml"
|
||||||
|
- ".clang-tidy"
|
||||||
- ".codecov.yml"
|
- ".codecov.yml"
|
||||||
- "cmake/**"
|
- "cmake/**"
|
||||||
- "conan/**"
|
- "conan/**"
|
||||||
@@ -59,6 +63,15 @@ defaults:
|
|||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
clang-tidy:
|
||||||
|
uses: ./.github/workflows/reusable-clang-tidy.yml
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
contents: read
|
||||||
|
with:
|
||||||
|
check_only_changed: false
|
||||||
|
create_issue_on_failure: ${{ github.event_name == 'schedule' }}
|
||||||
|
|
||||||
build-test:
|
build-test:
|
||||||
uses: ./.github/workflows/reusable-build-test.yml
|
uses: ./.github/workflows/reusable-build-test.yml
|
||||||
strategy:
|
strategy:
|
||||||
|
|||||||
4
.github/workflows/pre-commit.yml
vendored
4
.github/workflows/pre-commit.yml
vendored
@@ -11,7 +11,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
# Call the workflow in the XRPLF/actions repo that runs the pre-commit hooks.
|
# Call the workflow in the XRPLF/actions repo that runs the pre-commit hooks.
|
||||||
run-hooks:
|
run-hooks:
|
||||||
uses: XRPLF/actions/.github/workflows/pre-commit.yml@282890f46d6921249d5659dd38babcb0bd8aef48
|
uses: XRPLF/actions/.github/workflows/pre-commit.yml@320be44621ca2a080f05aeb15817c44b84518108
|
||||||
with:
|
with:
|
||||||
runs_on: ubuntu-latest
|
runs_on: ubuntu-latest
|
||||||
container: '{ "image": "ghcr.io/xrplf/ci/tools-rippled-pre-commit:sha-ab4d1f0" }'
|
container: '{ "image": "ghcr.io/xrplf/ci/tools-rippled-pre-commit:sha-41ec7c1" }'
|
||||||
|
|||||||
22
.github/workflows/publish-docs.yml
vendored
22
.github/workflows/publish-docs.yml
vendored
@@ -4,6 +4,18 @@ name: Build and publish documentation
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- "develop"
|
||||||
|
- "release*"
|
||||||
|
paths:
|
||||||
|
- ".github/workflows/publish-docs.yml"
|
||||||
|
- "*.md"
|
||||||
|
- "**/*.md"
|
||||||
|
- "docs/**"
|
||||||
|
- "include/**"
|
||||||
|
- "src/libxrpl/**"
|
||||||
|
- "src/xrpld/**"
|
||||||
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- ".github/workflows/publish-docs.yml"
|
- ".github/workflows/publish-docs.yml"
|
||||||
- "*.md"
|
- "*.md"
|
||||||
@@ -23,7 +35,9 @@ defaults:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
BUILD_DIR: build
|
BUILD_DIR: build
|
||||||
NPROC_SUBTRACT: 2
|
# ubuntu-latest has only 2 CPUs for private repositories
|
||||||
|
# https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for--private-repositories
|
||||||
|
NPROC_SUBTRACT: ${{ github.event.repository.private && '1' || '2' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
@@ -33,10 +47,10 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Get number of processors
|
- name: Get number of processors
|
||||||
uses: XRPLF/actions/get-nproc@2ece4ec6ab7de266859a6f053571425b2bd684b6
|
uses: XRPLF/actions/get-nproc@cf0433aa74563aead044a1e395610c96d65a37cf
|
||||||
id: nproc
|
id: nproc
|
||||||
with:
|
with:
|
||||||
subtract: ${{ env.NPROC_SUBTRACT }}
|
subtract: ${{ env.NPROC_SUBTRACT }}
|
||||||
@@ -65,7 +79,7 @@ jobs:
|
|||||||
cmake --build . --target docs --parallel ${BUILD_NPROC}
|
cmake --build . --target docs --parallel ${BUILD_NPROC}
|
||||||
|
|
||||||
- name: Publish documentation
|
- name: Publish documentation
|
||||||
if: ${{ github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch }}
|
if: ${{ github.event_name == 'push' }}
|
||||||
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
|
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
14
.github/workflows/reusable-build-test-config.yml
vendored
14
.github/workflows/reusable-build-test-config.yml
vendored
@@ -101,13 +101,13 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Cleanup workspace (macOS and Windows)
|
- name: Cleanup workspace (macOS and Windows)
|
||||||
if: ${{ runner.os == 'macOS' || runner.os == 'Windows' }}
|
if: ${{ runner.os == 'macOS' || runner.os == 'Windows' }}
|
||||||
uses: XRPLF/actions/cleanup-workspace@2ece4ec6ab7de266859a6f053571425b2bd684b6
|
uses: XRPLF/actions/cleanup-workspace@cf0433aa74563aead044a1e395610c96d65a37cf
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Prepare runner
|
- name: Prepare runner
|
||||||
uses: XRPLF/actions/prepare-runner@f05cab7b8541eee6473aa42beb9d2fe35608a190
|
uses: XRPLF/actions/prepare-runner@2cbf481018d930656e9276fcc20dc0e3a0be5b6d
|
||||||
with:
|
with:
|
||||||
enable_ccache: ${{ inputs.ccache_enabled }}
|
enable_ccache: ${{ inputs.ccache_enabled }}
|
||||||
|
|
||||||
@@ -119,12 +119,14 @@ jobs:
|
|||||||
uses: ./.github/actions/print-env
|
uses: ./.github/actions/print-env
|
||||||
|
|
||||||
- name: Get number of processors
|
- name: Get number of processors
|
||||||
uses: XRPLF/actions/get-nproc@2ece4ec6ab7de266859a6f053571425b2bd684b6
|
uses: XRPLF/actions/get-nproc@cf0433aa74563aead044a1e395610c96d65a37cf
|
||||||
id: nproc
|
id: nproc
|
||||||
with:
|
with:
|
||||||
subtract: ${{ inputs.nproc_subtract }}
|
subtract: ${{ inputs.nproc_subtract }}
|
||||||
|
|
||||||
- name: Setup Conan
|
- name: Setup Conan
|
||||||
|
env:
|
||||||
|
SANITIZERS: ${{ inputs.sanitizers }}
|
||||||
uses: ./.github/actions/setup-conan
|
uses: ./.github/actions/setup-conan
|
||||||
|
|
||||||
- name: Build dependencies
|
- name: Build dependencies
|
||||||
@@ -175,7 +177,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload the binary (Linux)
|
- name: Upload the binary (Linux)
|
||||||
if: ${{ github.repository_owner == 'XRPLF' && runner.os == 'Linux' }}
|
if: ${{ github.repository_owner == 'XRPLF' && runner.os == 'Linux' }}
|
||||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||||
with:
|
with:
|
||||||
name: xrpld-${{ inputs.config_name }}
|
name: xrpld-${{ inputs.config_name }}
|
||||||
path: ${{ env.BUILD_DIR }}/xrpld
|
path: ${{ env.BUILD_DIR }}/xrpld
|
||||||
@@ -252,7 +254,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload coverage report
|
- name: Upload coverage report
|
||||||
if: ${{ github.repository_owner == 'XRPLF' && !inputs.build_only && env.COVERAGE_ENABLED == 'true' }}
|
if: ${{ github.repository_owner == 'XRPLF' && !inputs.build_only && env.COVERAGE_ENABLED == 'true' }}
|
||||||
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
|
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
|
||||||
with:
|
with:
|
||||||
disable_search: true
|
disable_search: true
|
||||||
disable_telem: true
|
disable_telem: true
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
- name: Check levelization
|
- name: Check levelization
|
||||||
run: .github/scripts/levelization/generate.sh
|
run: .github/scripts/levelization/generate.sh
|
||||||
- name: Check for differences
|
- name: Check for differences
|
||||||
|
|||||||
4
.github/workflows/reusable-check-rename.yml
vendored
4
.github/workflows/reusable-check-rename.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
- name: Check definitions
|
- name: Check definitions
|
||||||
run: .github/scripts/rename/definitions.sh .
|
run: .github/scripts/rename/definitions.sh .
|
||||||
- name: Check copyright notices
|
- name: Check copyright notices
|
||||||
@@ -31,6 +31,8 @@ jobs:
|
|||||||
run: .github/scripts/rename/namespace.sh .
|
run: .github/scripts/rename/namespace.sh .
|
||||||
- name: Check config name
|
- name: Check config name
|
||||||
run: .github/scripts/rename/config.sh .
|
run: .github/scripts/rename/config.sh .
|
||||||
|
- name: Check include guards
|
||||||
|
run: .github/scripts/rename/include.sh .
|
||||||
- name: Check for differences
|
- name: Check for differences
|
||||||
env:
|
env:
|
||||||
MESSAGE: |
|
MESSAGE: |
|
||||||
|
|||||||
162
.github/workflows/reusable-clang-tidy-files.yml
vendored
Normal file
162
.github/workflows/reusable-clang-tidy-files.yml
vendored
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
name: Run clang-tidy on files
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
files:
|
||||||
|
description: "List of files to check (empty means check all files)"
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
create_issue_on_failure:
|
||||||
|
description: "Whether to create an issue if the check failed"
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Conan installs the generators in the build/generators directory, see the
|
||||||
|
# layout() method in conanfile.py. We then run CMake from the build directory.
|
||||||
|
BUILD_DIR: build
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-clang-tidy:
|
||||||
|
name: Run clang tidy
|
||||||
|
runs-on: ["self-hosted", "Linux", "X64", "heavy"]
|
||||||
|
container: "ghcr.io/xrplf/ci/debian-trixie:clang-21-sha-53033a2"
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Prepare runner
|
||||||
|
uses: XRPLF/actions/prepare-runner@2cbf481018d930656e9276fcc20dc0e3a0be5b6d
|
||||||
|
with:
|
||||||
|
enable_ccache: false
|
||||||
|
|
||||||
|
- name: Print build environment
|
||||||
|
uses: ./.github/actions/print-env
|
||||||
|
|
||||||
|
- name: Get number of processors
|
||||||
|
uses: XRPLF/actions/get-nproc@cf0433aa74563aead044a1e395610c96d65a37cf
|
||||||
|
id: nproc
|
||||||
|
|
||||||
|
- name: Setup Conan
|
||||||
|
uses: ./.github/actions/setup-conan
|
||||||
|
|
||||||
|
- name: Build dependencies
|
||||||
|
uses: ./.github/actions/build-deps
|
||||||
|
with:
|
||||||
|
build_nproc: ${{ steps.nproc.outputs.nproc }}
|
||||||
|
build_type: ${{ env.BUILD_TYPE }}
|
||||||
|
log_verbosity: verbose
|
||||||
|
|
||||||
|
- name: Configure CMake
|
||||||
|
working-directory: ${{ env.BUILD_DIR }}
|
||||||
|
run: |
|
||||||
|
cmake \
|
||||||
|
-G 'Ninja' \
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||||
|
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
|
||||||
|
-Dtests=ON \
|
||||||
|
-Dwerr=ON \
|
||||||
|
-Dxrpld=ON \
|
||||||
|
..
|
||||||
|
|
||||||
|
# clang-tidy needs headers generated from proto files
|
||||||
|
- name: Build libxrpl.libpb
|
||||||
|
working-directory: ${{ env.BUILD_DIR }}
|
||||||
|
run: |
|
||||||
|
ninja -j ${{ steps.nproc.outputs.nproc }} xrpl.libpb
|
||||||
|
|
||||||
|
- name: Run clang tidy
|
||||||
|
id: run_clang_tidy
|
||||||
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
FILES: ${{ inputs.files }}
|
||||||
|
run: |
|
||||||
|
run-clang-tidy -j ${{ steps.nproc.outputs.nproc }} -p "$BUILD_DIR" $FILES 2>&1 | tee clang-tidy-output.txt
|
||||||
|
|
||||||
|
- name: Upload clang-tidy output
|
||||||
|
if: steps.run_clang_tidy.outcome != 'success'
|
||||||
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||||
|
with:
|
||||||
|
name: clang-tidy-results
|
||||||
|
path: clang-tidy-output.txt
|
||||||
|
retention-days: 30
|
||||||
|
|
||||||
|
- name: Create an issue
|
||||||
|
if: steps.run_clang_tidy.outcome != 'success' && inputs.create_issue_on_failure
|
||||||
|
id: create_issue
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
# Prepare issue body with clang-tidy output
|
||||||
|
cat > issue.md <<EOF
|
||||||
|
## Clang-tidy Check Failed
|
||||||
|
|
||||||
|
**Workflow:** ${{ github.workflow }}
|
||||||
|
**Run ID:** ${{ github.run_id }}
|
||||||
|
**Commit:** ${{ github.sha }}
|
||||||
|
**Branch/Ref:** ${{ github.ref }}
|
||||||
|
**Triggered by:** ${{ github.actor }}
|
||||||
|
|
||||||
|
### Clang-tidy Output:
|
||||||
|
\`\`\`
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Append clang-tidy output (filter for errors and warnings)
|
||||||
|
if [ -f clang-tidy-output.txt ]; then
|
||||||
|
# Extract lines containing 'error:', 'warning:', or 'note:'
|
||||||
|
grep -E '(error:|warning:|note:)' clang-tidy-output.txt > filtered-output.txt || true
|
||||||
|
|
||||||
|
# If filtered output is empty, use original (might be a different error format)
|
||||||
|
if [ ! -s filtered-output.txt ]; then
|
||||||
|
cp clang-tidy-output.txt filtered-output.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Truncate if too large
|
||||||
|
head -c 60000 filtered-output.txt >> issue.md
|
||||||
|
if [ "$(wc -c < filtered-output.txt)" -gt 60000 ]; then
|
||||||
|
echo "" >> issue.md
|
||||||
|
echo "... (output truncated, see artifacts for full output)" >> issue.md
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm filtered-output.txt
|
||||||
|
else
|
||||||
|
echo "No output file found" >> issue.md
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat >> issue.md <<EOF
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
**Workflow run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
|
|
||||||
|
---
|
||||||
|
*This issue was automatically created by the clang-tidy workflow.*
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Create the issue
|
||||||
|
gh issue create \
|
||||||
|
--label "Bug,Clang-tidy" \
|
||||||
|
--title "Clang-tidy check failed" \
|
||||||
|
--body-file ./issue.md \
|
||||||
|
> create_issue.log
|
||||||
|
|
||||||
|
created_issue="$(sed 's|.*/||' create_issue.log)"
|
||||||
|
echo "created_issue=$created_issue" >> $GITHUB_OUTPUT
|
||||||
|
echo "Created issue #$created_issue"
|
||||||
|
|
||||||
|
rm -f create_issue.log issue.md clang-tidy-output.txt
|
||||||
|
|
||||||
|
- name: Fail the workflow if clang-tidy failed
|
||||||
|
if: steps.run_clang_tidy.outcome != 'success'
|
||||||
|
run: |
|
||||||
|
echo "Clang-tidy check failed!"
|
||||||
|
exit 1
|
||||||
47
.github/workflows/reusable-clang-tidy.yml
vendored
Normal file
47
.github/workflows/reusable-clang-tidy.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
name: Clang-tidy check
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
check_only_changed:
|
||||||
|
description: "Check only changed files in PR. If false, checks all files in the repository."
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
create_issue_on_failure:
|
||||||
|
description: "Whether to create an issue if the check failed"
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
determine-files:
|
||||||
|
name: Determine files to check
|
||||||
|
if: ${{ inputs.check_only_changed }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
any_changed: ${{ steps.changed_files.outputs.any_changed }}
|
||||||
|
all_changed_files: ${{ steps.changed_files.outputs.all_changed_files }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Get changed C++ files
|
||||||
|
id: changed_files
|
||||||
|
uses: tj-actions/changed-files@7dee1b0c1557f278e5c7dc244927139d78c0e22a # v47.0.4
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
**/*.cpp
|
||||||
|
**/*.h
|
||||||
|
**/*.ipp
|
||||||
|
separator: " "
|
||||||
|
|
||||||
|
run-clang-tidy:
|
||||||
|
needs: [determine-files]
|
||||||
|
if: ${{ always() && !cancelled() && (!inputs.check_only_changed || needs.determine-files.outputs.any_changed == 'true') }}
|
||||||
|
uses: ./.github/workflows/reusable-clang-tidy-files.yml
|
||||||
|
with:
|
||||||
|
files: ${{ inputs.check_only_changed && needs.determine-files.outputs.all_changed_files || '' }}
|
||||||
|
create_issue_on_failure: ${{ inputs.create_issue_on_failure }}
|
||||||
@@ -29,10 +29,10 @@ jobs:
|
|||||||
matrix: ${{ steps.generate.outputs.matrix }}
|
matrix: ${{ steps.generate.outputs.matrix }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||||
with:
|
with:
|
||||||
python-version: 3.13
|
python-version: 3.13
|
||||||
|
|
||||||
|
|||||||
43
.github/workflows/reusable-upload-recipe.yml
vendored
43
.github/workflows/reusable-upload-recipe.yml
vendored
@@ -43,16 +43,12 @@ jobs:
|
|||||||
container: ghcr.io/xrplf/ci/ubuntu-noble:gcc-13-sha-5dd7158
|
container: ghcr.io/xrplf/ci/ubuntu-noble:gcc-13-sha-5dd7158
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Generate build version number
|
- name: Generate build version number
|
||||||
id: version
|
id: version
|
||||||
uses: ./.github/actions/generate-version
|
uses: ./.github/actions/generate-version
|
||||||
|
|
||||||
- name: Determine recipe reference
|
|
||||||
id: ref
|
|
||||||
run: echo "ref=xrpl/${{ steps.version.outputs.version }}" >> "${GITHUB_OUTPUT}"
|
|
||||||
|
|
||||||
- name: Set up Conan
|
- name: Set up Conan
|
||||||
uses: ./.github/actions/setup-conan
|
uses: ./.github/actions/setup-conan
|
||||||
with:
|
with:
|
||||||
@@ -62,17 +58,40 @@ jobs:
|
|||||||
- name: Log into Conan remote
|
- name: Log into Conan remote
|
||||||
env:
|
env:
|
||||||
REMOTE_NAME: ${{ inputs.remote_name }}
|
REMOTE_NAME: ${{ inputs.remote_name }}
|
||||||
REMOTE_USERNAME: ${{ inputs.remote_username }}
|
REMOTE_USERNAME: ${{ secrets.remote_username }}
|
||||||
REMOTE_PASSWORD: ${{ inputs.remote_password }}
|
REMOTE_PASSWORD: ${{ secrets.remote_password }}
|
||||||
run: conan remote login "${REMOTE_NAME}" "${REMOTE_USERNAME}" --password "${REMOTE_PASSWORD}"
|
run: conan remote login "${REMOTE_NAME}" "${REMOTE_USERNAME}" --password "${REMOTE_PASSWORD}"
|
||||||
|
|
||||||
- name: Upload Conan recipe
|
- name: Upload Conan recipe (version)
|
||||||
env:
|
env:
|
||||||
RECIPE_REF: ${{ steps.ref.outputs.ref }}
|
|
||||||
REMOTE_NAME: ${{ inputs.remote_name }}
|
REMOTE_NAME: ${{ inputs.remote_name }}
|
||||||
run: |
|
run: |
|
||||||
conan export .
|
conan export . --version=${{ steps.version.outputs.version }}
|
||||||
conan upload --confirm --check --remote="${REMOTE_NAME}" ${RECIPE_REF}
|
conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/${{ steps.version.outputs.version }}
|
||||||
|
|
||||||
|
- name: Upload Conan recipe (develop)
|
||||||
|
if: ${{ github.ref == 'refs/heads/develop' }}
|
||||||
|
env:
|
||||||
|
REMOTE_NAME: ${{ inputs.remote_name }}
|
||||||
|
run: |
|
||||||
|
conan export . --version=develop
|
||||||
|
conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/develop
|
||||||
|
|
||||||
|
- name: Upload Conan recipe (rc)
|
||||||
|
if: ${{ startsWith(github.ref, 'refs/heads/release') }}
|
||||||
|
env:
|
||||||
|
REMOTE_NAME: ${{ inputs.remote_name }}
|
||||||
|
run: |
|
||||||
|
conan export . --version=rc
|
||||||
|
conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/rc
|
||||||
|
|
||||||
|
- name: Upload Conan recipe (release)
|
||||||
|
if: ${{ github.event_name == 'tag' }}
|
||||||
|
env:
|
||||||
|
REMOTE_NAME: ${{ inputs.remote_name }}
|
||||||
|
run: |
|
||||||
|
conan export . --version=release
|
||||||
|
conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/release
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
ref: ${{ steps.ref.outputs.ref }}
|
ref: xrpl/${{ steps.version.outputs.version }}
|
||||||
|
|||||||
11
.github/workflows/upload-conan-deps.yml
vendored
11
.github/workflows/upload-conan-deps.yml
vendored
@@ -64,13 +64,13 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Cleanup workspace (macOS and Windows)
|
- name: Cleanup workspace (macOS and Windows)
|
||||||
if: ${{ runner.os == 'macOS' || runner.os == 'Windows' }}
|
if: ${{ runner.os == 'macOS' || runner.os == 'Windows' }}
|
||||||
uses: XRPLF/actions/cleanup-workspace@2ece4ec6ab7de266859a6f053571425b2bd684b6
|
uses: XRPLF/actions/cleanup-workspace@cf0433aa74563aead044a1e395610c96d65a37cf
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Prepare runner
|
- name: Prepare runner
|
||||||
uses: XRPLF/actions/prepare-runner@f05cab7b8541eee6473aa42beb9d2fe35608a190
|
uses: XRPLF/actions/prepare-runner@2cbf481018d930656e9276fcc20dc0e3a0be5b6d
|
||||||
with:
|
with:
|
||||||
enable_ccache: false
|
enable_ccache: false
|
||||||
|
|
||||||
@@ -78,12 +78,14 @@ jobs:
|
|||||||
uses: ./.github/actions/print-env
|
uses: ./.github/actions/print-env
|
||||||
|
|
||||||
- name: Get number of processors
|
- name: Get number of processors
|
||||||
uses: XRPLF/actions/get-nproc@2ece4ec6ab7de266859a6f053571425b2bd684b6
|
uses: XRPLF/actions/get-nproc@cf0433aa74563aead044a1e395610c96d65a37cf
|
||||||
id: nproc
|
id: nproc
|
||||||
with:
|
with:
|
||||||
subtract: ${{ env.NPROC_SUBTRACT }}
|
subtract: ${{ env.NPROC_SUBTRACT }}
|
||||||
|
|
||||||
- name: Setup Conan
|
- name: Setup Conan
|
||||||
|
env:
|
||||||
|
SANITIZERS: ${{ matrix.sanitizers }}
|
||||||
uses: ./.github/actions/setup-conan
|
uses: ./.github/actions/setup-conan
|
||||||
with:
|
with:
|
||||||
remote_name: ${{ env.CONAN_REMOTE_NAME }}
|
remote_name: ${{ env.CONAN_REMOTE_NAME }}
|
||||||
@@ -98,6 +100,7 @@ jobs:
|
|||||||
# Set the verbosity to "quiet" for Windows to avoid an excessive
|
# Set the verbosity to "quiet" for Windows to avoid an excessive
|
||||||
# amount of logs. For other OSes, the "verbose" logs are more useful.
|
# amount of logs. For other OSes, the "verbose" logs are more useful.
|
||||||
log_verbosity: ${{ runner.os == 'Windows' && 'quiet' || 'verbose' }}
|
log_verbosity: ${{ runner.os == 'Windows' && 'quiet' || 'verbose' }}
|
||||||
|
sanitizers: ${{ matrix.sanitizers }}
|
||||||
|
|
||||||
- name: Log into Conan remote
|
- name: Log into Conan remote
|
||||||
if: ${{ github.repository_owner == 'XRPLF' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
|
if: ${{ github.repository_owner == 'XRPLF' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
|
||||||
|
|||||||
12
.gitignore
vendored
12
.gitignore
vendored
@@ -42,6 +42,9 @@ gmon.out
|
|||||||
# Locally patched Conan recipes
|
# Locally patched Conan recipes
|
||||||
external/conan-center-index/
|
external/conan-center-index/
|
||||||
|
|
||||||
|
# Local conan directory
|
||||||
|
.conan
|
||||||
|
|
||||||
# XCode IDE.
|
# XCode IDE.
|
||||||
*.pbxuser
|
*.pbxuser
|
||||||
!default.pbxuser
|
!default.pbxuser
|
||||||
@@ -64,7 +67,16 @@ DerivedData
|
|||||||
/.vs/
|
/.vs/
|
||||||
/.vscode/
|
/.vscode/
|
||||||
|
|
||||||
|
# zed IDE.
|
||||||
|
/.zed/
|
||||||
|
|
||||||
# AI tools.
|
# AI tools.
|
||||||
/.augment
|
/.augment
|
||||||
/.claude
|
/.claude
|
||||||
/CLAUDE.md
|
/CLAUDE.md
|
||||||
|
|
||||||
|
# Direnv's directory
|
||||||
|
/.direnv
|
||||||
|
|
||||||
|
# clangd cache
|
||||||
|
/.cache
|
||||||
|
|||||||
@@ -20,12 +20,18 @@ repos:
|
|||||||
args: [--assume-in-merge]
|
args: [--assume-in-merge]
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||||
rev: 7d85583be209cb547946c82fbe51f4bc5dd1d017 # frozen: v18.1.8
|
rev: 75ca4ad908dc4a99f57921f29b7e6c1521e10b26 # frozen: v21.1.8
|
||||||
hooks:
|
hooks:
|
||||||
- id: clang-format
|
- id: clang-format
|
||||||
args: [--style=file]
|
args: [--style=file]
|
||||||
"types_or": [c++, c, proto]
|
"types_or": [c++, c, proto]
|
||||||
|
|
||||||
|
- repo: https://github.com/cheshirekow/cmake-format-precommit
|
||||||
|
rev: e2c2116d86a80e72e7146a06e68b7c228afc6319 # frozen: v0.6.13
|
||||||
|
hooks:
|
||||||
|
- id: cmake-format
|
||||||
|
additional_dependencies: [PyYAML]
|
||||||
|
|
||||||
- repo: https://github.com/rbubley/mirrors-prettier
|
- repo: https://github.com/rbubley/mirrors-prettier
|
||||||
rev: 5ba47274f9b181bce26a5150a725577f3c336011 # frozen: v3.6.2
|
rev: 5ba47274f9b181bce26a5150a725577f3c336011 # frozen: v3.6.2
|
||||||
hooks:
|
hooks:
|
||||||
@@ -51,6 +57,16 @@ repos:
|
|||||||
- .git/COMMIT_EDITMSG
|
- .git/COMMIT_EDITMSG
|
||||||
stages: [commit-msg]
|
stages: [commit-msg]
|
||||||
|
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: nix-fmt
|
||||||
|
name: Format Nix files
|
||||||
|
entry: nix --extra-experimental-features 'nix-command flakes' fmt
|
||||||
|
language: system
|
||||||
|
types:
|
||||||
|
- nix
|
||||||
|
pass_filenames: true
|
||||||
|
|
||||||
exclude: |
|
exclude: |
|
||||||
(?x)^(
|
(?x)^(
|
||||||
external/.*|
|
external/.*|
|
||||||
|
|||||||
200
API-CHANGELOG.md
200
API-CHANGELOG.md
@@ -6,90 +6,85 @@ For info about how [API versioning](https://xrpl.org/request-formatting.html#api
|
|||||||
|
|
||||||
The API version controls the API behavior you see. This includes what properties you see in responses, what parameters you're permitted to send in requests, and so on. You specify the API version in each of your requests. When a breaking change is introduced to the `rippled` API, a new version is released. To avoid breaking your code, you should set (or increase) your version when you're ready to upgrade.
|
The API version controls the API behavior you see. This includes what properties you see in responses, what parameters you're permitted to send in requests, and so on. You specify the API version in each of your requests. When a breaking change is introduced to the `rippled` API, a new version is released. To avoid breaking your code, you should set (or increase) your version when you're ready to upgrade.
|
||||||
|
|
||||||
|
The [commandline](https://xrpl.org/docs/references/http-websocket-apis/api-conventions/request-formatting/#commandline-format) always uses the latest API version. The command line is intended for ad-hoc usage by humans, not programs or automated scripts. The command line is not meant for use in production code.
|
||||||
|
|
||||||
For a log of breaking changes, see the **API Version [number]** headings. In general, breaking changes are associated with a particular API Version number. For non-breaking changes, scroll to the **XRP Ledger version [x.y.z]** headings. Non-breaking changes are associated with a particular XRP Ledger (`rippled`) release.
|
For a log of breaking changes, see the **API Version [number]** headings. In general, breaking changes are associated with a particular API Version number. For non-breaking changes, scroll to the **XRP Ledger version [x.y.z]** headings. Non-breaking changes are associated with a particular XRP Ledger (`rippled`) release.
|
||||||
|
|
||||||
|
## API Version 3 (Beta)
|
||||||
|
|
||||||
|
API version 3 is currently a beta API. It requires enabling `[beta_rpc_api]` in the rippled configuration to use. See [API-VERSION-3.md](API-VERSION-3.md) for the full list of changes in API version 3.
|
||||||
|
|
||||||
## API Version 2
|
## API Version 2
|
||||||
|
|
||||||
API version 2 is available in `rippled` version 2.0.0 and later. To use this API, clients specify `"api_version" : 2` in each request.
|
API version 2 is available in `rippled` version 2.0.0 and later. See [API-VERSION-2.md](API-VERSION-2.md) for the full list of changes in API version 2.
|
||||||
|
|
||||||
#### Removed methods
|
|
||||||
|
|
||||||
In API version 2, the following deprecated methods are no longer available: (https://github.com/XRPLF/rippled/pull/4759)
|
|
||||||
|
|
||||||
- `tx_history` - Instead, use other methods such as `account_tx` or `ledger` with the `transactions` field set to `true`.
|
|
||||||
- `ledger_header` - Instead, use the `ledger` method.
|
|
||||||
|
|
||||||
#### Modifications to JSON transaction element in V2
|
|
||||||
|
|
||||||
In API version 2, JSON elements for transaction output have been changed and made consistent for all methods which output transactions. (https://github.com/XRPLF/rippled/pull/4775)
|
|
||||||
This helps to unify the JSON serialization format of transactions. (https://github.com/XRPLF/clio/issues/722, https://github.com/XRPLF/rippled/issues/4727)
|
|
||||||
|
|
||||||
- JSON transaction element is named `tx_json`
|
|
||||||
- Binary transaction element is named `tx_blob`
|
|
||||||
- JSON transaction metadata element is named `meta`
|
|
||||||
- Binary transaction metadata element is named `meta_blob`
|
|
||||||
|
|
||||||
Additionally, these elements are now consistently available next to `tx_json` (i.e. sibling elements), where possible:
|
|
||||||
|
|
||||||
- `hash` - Transaction ID. This data was stored inside transaction output in API version 1, but in API version 2 is a sibling element.
|
|
||||||
- `ledger_index` - Ledger index (only set on validated ledgers)
|
|
||||||
- `ledger_hash` - Ledger hash (only set on closed or validated ledgers)
|
|
||||||
- `close_time_iso` - Ledger close time expressed in ISO 8601 time format (only set on validated ledgers)
|
|
||||||
- `validated` - Bool element set to `true` if the transaction is in a validated ledger, otherwise `false`
|
|
||||||
|
|
||||||
This change affects the following methods:
|
|
||||||
|
|
||||||
- `tx` - Transaction data moved into element `tx_json` (was inline inside `result`) or, if binary output was requested, moved from `tx` to `tx_blob`. Renamed binary transaction metadata element (if it was requested) from `meta` to `meta_blob`. Changed location of `hash` and added new elements
|
|
||||||
- `account_tx` - Renamed transaction element from `tx` to `tx_json`. Renamed binary transaction metadata element (if it was requested) from `meta` to `meta_blob`. Changed location of `hash` and added new elements
|
|
||||||
- `transaction_entry` - Renamed transaction metadata element from `metadata` to `meta`. Changed location of `hash` and added new elements
|
|
||||||
- `subscribe` - Renamed transaction element from `transaction` to `tx_json`. Changed location of `hash` and added new elements
|
|
||||||
- `sign`, `sign_for`, `submit` and `submit_multisigned` - Changed location of `hash` element.
|
|
||||||
|
|
||||||
#### Modification to `Payment` transaction JSON schema
|
|
||||||
|
|
||||||
When reading Payments, the `Amount` field should generally **not** be used. Instead, use [delivered_amount](https://xrpl.org/partial-payments.html#the-delivered_amount-field) to see the amount that the Payment delivered. To clarify its meaning, the `Amount` field is being renamed to `DeliverMax`. (https://github.com/XRPLF/rippled/pull/4733)
|
|
||||||
|
|
||||||
- In `Payment` transaction type, JSON RPC field `Amount` is renamed to `DeliverMax`. To enable smooth client transition, `Amount` is still handled, as described below: (https://github.com/XRPLF/rippled/pull/4733)
|
|
||||||
- On JSON RPC input (e.g. `submit_multisigned` etc. methods), `Amount` is recognized as an alias to `DeliverMax` for both API version 1 and version 2 clients.
|
|
||||||
- On JSON RPC input, submitting both `Amount` and `DeliverMax` fields is allowed _only_ if they are identical; otherwise such input is rejected with `rpcINVALID_PARAMS` error.
|
|
||||||
- On JSON RPC output (e.g. `subscribe`, `account_tx` etc. methods), `DeliverMax` is present in both API version 1 and version 2.
|
|
||||||
- On JSON RPC output, `Amount` is only present in API version 1 and _not_ in version 2.
|
|
||||||
|
|
||||||
#### Modifications to account_info response
|
|
||||||
|
|
||||||
- `signer_lists` is returned in the root of the response. (In API version 1, it was nested under `account_data`.) (https://github.com/XRPLF/rippled/pull/3770)
|
|
||||||
- When using an invalid `signer_lists` value, the API now returns an "invalidParams" error. (https://github.com/XRPLF/rippled/pull/4585)
|
|
||||||
- (`signer_lists` must be a boolean. In API version 1, strings were accepted and may return a normal response - i.e. as if `signer_lists` were `true`.)
|
|
||||||
|
|
||||||
#### Modifications to [account_tx](https://xrpl.org/account_tx.html#account_tx) response
|
|
||||||
|
|
||||||
- Using `ledger_index_min`, `ledger_index_max`, and `ledger_index` returns `invalidParams` because if you use `ledger_index_min` or `ledger_index_max`, then it does not make sense to also specify `ledger_index`. In API version 1, no error was returned. (https://github.com/XRPLF/rippled/pull/4571)
|
|
||||||
- The same applies for `ledger_index_min`, `ledger_index_max`, and `ledger_hash`. (https://github.com/XRPLF/rippled/issues/4545#issuecomment-1565065579)
|
|
||||||
- Using a `ledger_index_min` or `ledger_index_max` beyond the range of ledgers that the server has:
|
|
||||||
- returns `lgrIdxMalformed` in API version 2. Previously, in API version 1, no error was returned. (https://github.com/XRPLF/rippled/issues/4288)
|
|
||||||
- Attempting to use a non-boolean value (such as a string) for the `binary` or `forward` parameters returns `invalidParams` (`rpcINVALID_PARAMS`). Previously, in API version 1, no error was returned. (https://github.com/XRPLF/rippled/pull/4620)
|
|
||||||
|
|
||||||
#### Modifications to [noripple_check](https://xrpl.org/noripple_check.html#noripple_check) response
|
|
||||||
|
|
||||||
- Attempting to use a non-boolean value (such as a string) for the `transactions` parameter returns `invalidParams` (`rpcINVALID_PARAMS`). Previously, in API version 1, no error was returned. (https://github.com/XRPLF/rippled/pull/4620)
|
|
||||||
|
|
||||||
## API Version 1
|
## API Version 1
|
||||||
|
|
||||||
This version is supported by all `rippled` versions. For WebSocket and HTTP JSON-RPC requests, it is currently the default API version used when no `api_version` is specified.
|
This version is supported by all `rippled` versions. For WebSocket and HTTP JSON-RPC requests, it is currently the default API version used when no `api_version` is specified.
|
||||||
|
|
||||||
The [commandline](https://xrpl.org/docs/references/http-websocket-apis/api-conventions/request-formatting/#commandline-format) always uses the latest API version. The command line is intended for ad-hoc usage by humans, not programs or automated scripts. The command line is not meant for use in production code.
|
## XRP Ledger server version 3.1.0
|
||||||
|
|
||||||
### Inconsistency: server_info - network_id
|
[Version 3.1.0](https://github.com/XRPLF/rippled/releases/tag/3.1.0) was released on Jan 27, 2026.
|
||||||
|
|
||||||
The `network_id` field was added in the `server_info` response in version 1.5.0 (2019), but it is not returned in [reporting mode](https://xrpl.org/rippled-server-modes.html#reporting-mode). However, use of reporting mode is now discouraged, in favor of using [Clio](https://github.com/XRPLF/clio) instead.
|
### Additions in 3.1.0
|
||||||
|
|
||||||
|
- `vault_info`: New RPC method to retrieve information about a specific vault (part of XLS-66 Lending Protocol). ([#6156](https://github.com/XRPLF/rippled/pull/6156))
|
||||||
|
|
||||||
|
## XRP Ledger server version 3.0.0
|
||||||
|
|
||||||
|
[Version 3.0.0](https://github.com/XRPLF/rippled/releases/tag/3.0.0) was released on Dec 9, 2025.
|
||||||
|
|
||||||
|
### Additions in 3.0.0
|
||||||
|
|
||||||
|
- `ledger_entry`: Supports all ledger entry types with dedicated parsers. ([#5237](https://github.com/XRPLF/rippled/pull/5237))
|
||||||
|
- `ledger_entry`: New error codes `entryNotFound` and `unexpectedLedgerType` for more specific error handling. ([#5237](https://github.com/XRPLF/rippled/pull/5237))
|
||||||
|
- `ledger_entry`: Improved error messages with more context (e.g., specifying which field is invalid or missing). ([#5237](https://github.com/XRPLF/rippled/pull/5237))
|
||||||
|
- `ledger_entry`: Assorted bug fixes in RPC processing. ([#5237](https://github.com/XRPLF/rippled/pull/5237))
|
||||||
|
- `simulate`: Supports additional metadata in the response. ([#5754](https://github.com/XRPLF/rippled/pull/5754))
|
||||||
|
|
||||||
|
## XRP Ledger server version 2.6.2
|
||||||
|
|
||||||
|
[Version 2.6.2](https://github.com/XRPLF/rippled/releases/tag/2.6.2) was released on Nov 19, 2025.
|
||||||
|
|
||||||
|
This release contains bug fixes only and no API changes.
|
||||||
|
|
||||||
|
## XRP Ledger server version 2.6.1
|
||||||
|
|
||||||
|
[Version 2.6.1](https://github.com/XRPLF/rippled/releases/tag/2.6.1) was released on Sep 30, 2025.
|
||||||
|
|
||||||
|
This release contains bug fixes only and no API changes.
|
||||||
|
|
||||||
|
## XRP Ledger server version 2.6.0
|
||||||
|
|
||||||
|
[Version 2.6.0](https://github.com/XRPLF/rippled/releases/tag/2.6.0) was released on Aug 27, 2025.
|
||||||
|
|
||||||
|
### Additions in 2.6.0
|
||||||
|
|
||||||
|
- `account_info`: Added `allowTrustLineLocking` flag in response. ([#5525](https://github.com/XRPLF/rippled/pull/5525))
|
||||||
|
- `ledger`: Removed the type filter from the RPC command. ([#4934](https://github.com/XRPLF/rippled/pull/4934))
|
||||||
|
- `subscribe` (`validations` stream): `network_id` is now included. ([#5579](https://github.com/XRPLF/rippled/pull/5579))
|
||||||
|
- `subscribe` (`transactions` stream): `nftoken_id`, `nftoken_ids`, and `offer_id` are now included in transaction metadata. ([#5230](https://github.com/XRPLF/rippled/pull/5230))
|
||||||
|
|
||||||
|
## XRP Ledger server version 2.5.1
|
||||||
|
|
||||||
|
[Version 2.5.1](https://github.com/XRPLF/rippled/releases/tag/2.5.1) was released on Sep 17, 2025.
|
||||||
|
|
||||||
|
This release contains bug fixes only and no API changes.
|
||||||
|
|
||||||
## XRP Ledger server version 2.5.0
|
## XRP Ledger server version 2.5.0
|
||||||
|
|
||||||
As of 2025-04-04, version 2.5.0 is in development. You can use a pre-release version by building from source or [using the `nightly` package](https://xrpl.org/docs/infrastructure/installation/install-rippled-on-ubuntu).
|
[Version 2.5.0](https://github.com/XRPLF/rippled/releases/tag/2.5.0) was released on Jun 24, 2025.
|
||||||
|
|
||||||
### Additions and bugfixes in 2.5.0
|
### Additions and bugfixes in 2.5.0
|
||||||
|
|
||||||
- `channel_authorize`: If `signing_support` is not enabled in the config, the RPC is disabled.
|
- `tx`: Added `ctid` field to the response and improved error handling. ([#4738](https://github.com/XRPLF/rippled/pull/4738))
|
||||||
|
- `ledger_entry`: Improved error messages in `permissioned_domain`. ([#5344](https://github.com/XRPLF/rippled/pull/5344))
|
||||||
|
- `simulate`: Improved multi-sign usage. ([#5479](https://github.com/XRPLF/rippled/pull/5479))
|
||||||
|
- `channel_authorize`: If `signing_support` is not enabled in the config, the RPC is disabled. ([#5385](https://github.com/XRPLF/rippled/pull/5385))
|
||||||
|
- `subscribe` (admin): Removed webhook queue limit to prevent dropping notifications; reduced HTTP timeout from 10 minutes to 30 seconds. ([#5163](https://github.com/XRPLF/rippled/pull/5163))
|
||||||
|
- `ledger_data` (gRPC): Fixed crashing issue with some invalid markers. ([#5137](https://github.com/XRPLF/rippled/pull/5137))
|
||||||
|
- `account_lines`: Fixed error with `no_ripple` and `no_ripple_peer` sometimes showing up incorrectly. ([#5345](https://github.com/XRPLF/rippled/pull/5345))
|
||||||
|
- `account_tx`: Fixed issue with incorrect CTIDs. ([#5408](https://github.com/XRPLF/rippled/pull/5408))
|
||||||
|
|
||||||
## XRP Ledger server version 2.4.0
|
## XRP Ledger server version 2.4.0
|
||||||
|
|
||||||
@@ -97,11 +92,19 @@ As of 2025-04-04, version 2.5.0 is in development. You can use a pre-release ver
|
|||||||
|
|
||||||
### Additions and bugfixes in 2.4.0
|
### Additions and bugfixes in 2.4.0
|
||||||
|
|
||||||
- `ledger_entry`: `state` is added an alias for `ripple_state`.
|
- `simulate`: A new RPC that executes a [dry run of a transaction submission](https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0069d-simulate#2-rpc-simulate). ([#5069](https://github.com/XRPLF/rippled/pull/5069))
|
||||||
- `ledger_entry`: Enables case-insensitive filtering by canonical name in addition to case-sensitive filtering by RPC name.
|
- Signing methods (`sign`, `sign_for`, `submit`): Autofill fees better, properly handle transactions without a base fee, and autofill the `NetworkID` field. ([#5069](https://github.com/XRPLF/rippled/pull/5069))
|
||||||
- `validators`: Added new field `validator_list_threshold` in response.
|
- `ledger_entry`: `state` is added as an alias for `ripple_state`. ([#5199](https://github.com/XRPLF/rippled/pull/5199))
|
||||||
- `simulate`: A new RPC that executes a [dry run of a transaction submission](https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0069d-simulate#2-rpc-simulate)
|
- `ledger`, `ledger_data`, `account_objects`: Support filtering ledger entry types by their canonical names (case-insensitive). ([#5271](https://github.com/XRPLF/rippled/pull/5271))
|
||||||
- Signing methods autofill fees better and properly handle transactions that don't have a base fee, and will also autofill the `NetworkID` field.
|
- `validators`: Added new field `validator_list_threshold` in response. ([#5112](https://github.com/XRPLF/rippled/pull/5112))
|
||||||
|
- `server_info`: Added git commit hash info on admin connection. ([#5225](https://github.com/XRPLF/rippled/pull/5225))
|
||||||
|
- `server_definitions`: Changed larger `UInt` serialized types to `Hash`. ([#5231](https://github.com/XRPLF/rippled/pull/5231))
|
||||||
|
|
||||||
|
## XRP Ledger server version 2.3.1
|
||||||
|
|
||||||
|
[Version 2.3.1](https://github.com/XRPLF/rippled/releases/tag/2.3.1) was released on Jan 29, 2025.
|
||||||
|
|
||||||
|
This release contains bug fixes only and no API changes.
|
||||||
|
|
||||||
## XRP Ledger server version 2.3.0
|
## XRP Ledger server version 2.3.0
|
||||||
|
|
||||||
@@ -109,19 +112,30 @@ As of 2025-04-04, version 2.5.0 is in development. You can use a pre-release ver
|
|||||||
|
|
||||||
### Breaking changes in 2.3.0
|
### Breaking changes in 2.3.0
|
||||||
|
|
||||||
- `book_changes`: If the requested ledger version is not available on this node, a `ledgerNotFound` error is returned and the node does not attempt to acquire the ledger from the p2p network (as with other non-admin RPCs).
|
- `book_changes`: If the requested ledger version is not available on this node, a `ledgerNotFound` error is returned and the node does not attempt to acquire the ledger from the p2p network (as with other non-admin RPCs). Admins can still attempt to retrieve old ledgers with the `ledger_request` RPC.
|
||||||
|
|
||||||
Admins can still attempt to retrieve old ledgers with the `ledger_request` RPC.
|
|
||||||
|
|
||||||
### Additions and bugfixes in 2.3.0
|
### Additions and bugfixes in 2.3.0
|
||||||
|
|
||||||
- `book_changes`: Returns a `validated` field in its response, which was missing in prior versions.
|
- `book_changes`: Returns a `validated` field in its response. ([#5096](https://github.com/XRPLF/rippled/pull/5096))
|
||||||
|
- `book_changes`: Accepts shortcut strings (`current`, `closed`, `validated`) for the `ledger_index` parameter. ([#5096](https://github.com/XRPLF/rippled/pull/5096))
|
||||||
|
- `server_definitions`: Include `index` in response. ([#5190](https://github.com/XRPLF/rippled/pull/5190))
|
||||||
|
- `account_nfts`: Fix issue where unassociated marker would return incorrect results. ([#5045](https://github.com/XRPLF/rippled/pull/5045))
|
||||||
|
- `account_objects`: Fix issue where invalid marker would not return an error. ([#5046](https://github.com/XRPLF/rippled/pull/5046))
|
||||||
|
- `account_objects`: Disallow filtering by ledger entry types that an account cannot hold. ([#5056](https://github.com/XRPLF/rippled/pull/5056))
|
||||||
|
- `tx`: Allow lowercase CTID. ([#5049](https://github.com/XRPLF/rippled/pull/5049))
|
||||||
|
- `feature`: Better error handling for invalid values of `feature`. ([#5063](https://github.com/XRPLF/rippled/pull/5063))
|
||||||
|
|
||||||
## XRP Ledger server version 2.2.0
|
## XRP Ledger server version 2.2.0
|
||||||
|
|
||||||
[Version 2.2.0](https://github.com/XRPLF/rippled/releases/tag/2.2.0) was released on Jun 5, 2024. The following additions are non-breaking (because they are purely additive):
|
[Version 2.2.0](https://github.com/XRPLF/rippled/releases/tag/2.2.0) was released on Jun 5, 2024. The following additions are non-breaking (because they are purely additive):
|
||||||
|
|
||||||
- The `feature` method now has a non-admin mode for users. (It was previously only available to admin connections.) The method returns an updated list of amendments, including their names and other information. ([#4781](https://github.com/XRPLF/rippled/pull/4781))
|
- `feature`: Add a non-admin mode for users. (It was previously only available to admin connections.) The method returns an updated list of amendments, including their names and other information. ([#4781](https://github.com/XRPLF/rippled/pull/4781))
|
||||||
|
|
||||||
|
## XRP Ledger server version 2.0.1
|
||||||
|
|
||||||
|
[Version 2.0.1](https://github.com/XRPLF/rippled/releases/tag/2.0.1) was released on Jan 29, 2024. The following additions are non-breaking:
|
||||||
|
|
||||||
|
- `path_find`: Fixes unbounded memory growth. ([#4822](https://github.com/XRPLF/rippled/pull/4822))
|
||||||
|
|
||||||
## XRP Ledger server version 2.0.0
|
## XRP Ledger server version 2.0.0
|
||||||
|
|
||||||
@@ -129,24 +143,18 @@ Admins can still attempt to retrieve old ledgers with the `ledger_request` RPC.
|
|||||||
|
|
||||||
- `server_definitions`: A new RPC that generates a `definitions.json`-like output that can be used in XRPL libraries.
|
- `server_definitions`: A new RPC that generates a `definitions.json`-like output that can be used in XRPL libraries.
|
||||||
- In `Payment` transactions, `DeliverMax` has been added. This is a replacement for the `Amount` field, which should not be used. Typically, the `delivered_amount` (in transaction metadata) should be used. To ease the transition, `DeliverMax` is present regardless of API version, since adding a field is non-breaking.
|
- In `Payment` transactions, `DeliverMax` has been added. This is a replacement for the `Amount` field, which should not be used. Typically, the `delivered_amount` (in transaction metadata) should be used. To ease the transition, `DeliverMax` is present regardless of API version, since adding a field is non-breaking.
|
||||||
- API version 2 has been moved from beta to supported, meaning that it is generally available (regardless of the `beta_rpc_api` setting).
|
- API version 2 has been moved from beta to supported, meaning that it is generally available (regardless of the `beta_rpc_api` setting). The full list of changes is in [API-VERSION-2.md](API-VERSION-2.md).
|
||||||
|
|
||||||
## XRP Ledger server version 2.2.0
|
|
||||||
|
|
||||||
The following is a non-breaking addition to the API.
|
|
||||||
|
|
||||||
- The `feature` method now has a non-admin mode for users. (It was previously only available to admin connections.) The method returns an updated list of amendments, including their names and other information. ([#4781](https://github.com/XRPLF/rippled/pull/4781))
|
|
||||||
|
|
||||||
## XRP Ledger server version 1.12.0
|
## XRP Ledger server version 1.12.0
|
||||||
|
|
||||||
[Version 1.12.0](https://github.com/XRPLF/rippled/releases/tag/1.12.0) was released on Sep 6, 2023. The following additions are non-breaking (because they are purely additive).
|
[Version 1.12.0](https://github.com/XRPLF/rippled/releases/tag/1.12.0) was released on Sep 6, 2023. The following additions are non-breaking (because they are purely additive):
|
||||||
|
|
||||||
- `server_info`: Added `ports`, an array which advertises the RPC and WebSocket ports. This information is also included in the `/crawl` endpoint (which calls `server_info` internally). `grpc` and `peer` ports are also included. (https://github.com/XRPLF/rippled/pull/4427)
|
- `server_info`: Added `ports`, an array which advertises the RPC and WebSocket ports. This information is also included in the `/crawl` endpoint (which calls `server_info` internally). `grpc` and `peer` ports are also included. ([#4427](https://github.com/XRPLF/rippled/pull/4427))
|
||||||
- `ports` contains objects, each containing a `port` for the listening port (a number string), and a `protocol` array listing the supported protocols on that port.
|
- `ports` contains objects, each containing a `port` for the listening port (a number string), and a `protocol` array listing the supported protocols on that port.
|
||||||
- This allows crawlers to build a more detailed topology without needing to port-scan nodes.
|
- This allows crawlers to build a more detailed topology without needing to port-scan nodes.
|
||||||
- (For peers and other non-admin clients, the info about admin ports is excluded.)
|
- (For peers and other non-admin clients, the info about admin ports is excluded.)
|
||||||
- Clawback: The following additions are gated by the Clawback amendment (`featureClawback`). (https://github.com/XRPLF/rippled/pull/4553)
|
- Clawback: The following additions are gated by the Clawback amendment (`featureClawback`). ([#4553](https://github.com/XRPLF/rippled/pull/4553))
|
||||||
- Adds an [AccountRoot flag](https://xrpl.org/accountroot.html#accountroot-flags) called `lsfAllowTrustLineClawback` (https://github.com/XRPLF/rippled/pull/4617)
|
- Adds an [AccountRoot flag](https://xrpl.org/accountroot.html#accountroot-flags) called `lsfAllowTrustLineClawback`. ([#4617](https://github.com/XRPLF/rippled/pull/4617))
|
||||||
- Adds the corresponding `asfAllowTrustLineClawback` [AccountSet Flag](https://xrpl.org/accountset.html#accountset-flags) as well.
|
- Adds the corresponding `asfAllowTrustLineClawback` [AccountSet Flag](https://xrpl.org/accountset.html#accountset-flags) as well.
|
||||||
- Clawback is disabled by default, so if an issuer desires the ability to claw back funds, they must use an `AccountSet` transaction to set the AllowTrustLineClawback flag. They must do this before creating any trust lines, offers, escrows, payment channels, or checks.
|
- Clawback is disabled by default, so if an issuer desires the ability to claw back funds, they must use an `AccountSet` transaction to set the AllowTrustLineClawback flag. They must do this before creating any trust lines, offers, escrows, payment channels, or checks.
|
||||||
- Adds the [Clawback transaction type](https://github.com/XRPLF/XRPL-Standards/blob/master/XLS-39d-clawback/README.md#331-clawback-transaction), containing these fields:
|
- Adds the [Clawback transaction type](https://github.com/XRPLF/XRPL-Standards/blob/master/XLS-39d-clawback/README.md#331-clawback-transaction), containing these fields:
|
||||||
@@ -181,16 +189,16 @@ The following is a non-breaking addition to the API.
|
|||||||
|
|
||||||
### Breaking changes in 1.11
|
### Breaking changes in 1.11
|
||||||
|
|
||||||
- Added the ability to mark amendments as obsolete. For the `feature` admin API, there is a new possible value for the `vetoed` field. (https://github.com/XRPLF/rippled/pull/4291)
|
- Added the ability to mark amendments as obsolete. For the `feature` admin API, there is a new possible value for the `vetoed` field. ([#4291](https://github.com/XRPLF/rippled/pull/4291))
|
||||||
- The value of `vetoed` can now be `true`, `false`, or `"Obsolete"`.
|
- The value of `vetoed` can now be `true`, `false`, or `"Obsolete"`.
|
||||||
- Removed the acceptance of seeds or public keys in place of account addresses. (https://github.com/XRPLF/rippled/pull/4404)
|
- Removed the acceptance of seeds or public keys in place of account addresses. ([#4404](https://github.com/XRPLF/rippled/pull/4404))
|
||||||
- This simplifies the API and encourages better security practices (i.e. seeds should never be sent over the network).
|
- This simplifies the API and encourages better security practices (i.e. seeds should never be sent over the network).
|
||||||
- For the `ledger_data` method, when all entries are filtered out, the `state` field of the response is now an empty list (in other words, an empty array, `[]`). (Previously, it would return `null`.) While this is technically a breaking change, the new behavior is consistent with the documentation, so this is considered only a bug fix. (https://github.com/XRPLF/rippled/pull/4398)
|
- For the `ledger_data` method, when all entries are filtered out, the `state` field of the response is now an empty list (in other words, an empty array, `[]`). (Previously, it would return `null`.) While this is technically a breaking change, the new behavior is consistent with the documentation, so this is considered only a bug fix. ([#4398](https://github.com/XRPLF/rippled/pull/4398))
|
||||||
- If and when the `fixNFTokenRemint` amendment activates, there will be a new AccountRoot field, `FirstNFTSequence`. This field is set to the current account sequence when the account issues their first NFT. If an account has not issued any NFTs, then the field is not set. ([#4406](https://github.com/XRPLF/rippled/pull/4406))
|
- If and when the `fixNFTokenRemint` amendment activates, there will be a new AccountRoot field, `FirstNFTSequence`. This field is set to the current account sequence when the account issues their first NFT. If an account has not issued any NFTs, then the field is not set. ([#4406](https://github.com/XRPLF/rippled/pull/4406))
|
||||||
- There is a new account deletion restriction: an account can only be deleted if `FirstNFTSequence` + `MintedNFTokens` + `256` is less than the current ledger sequence.
|
- There is a new account deletion restriction: an account can only be deleted if `FirstNFTSequence` + `MintedNFTokens` + `256` is less than the current ledger sequence.
|
||||||
- This is potentially a breaking change if clients have logic for determining whether an account can be deleted.
|
- This is potentially a breaking change if clients have logic for determining whether an account can be deleted.
|
||||||
- NetworkID
|
- NetworkID
|
||||||
- For sidechains and networks with a network ID greater than 1024, there is a new [transaction common field](https://xrpl.org/transaction-common-fields.html), `NetworkID`. (https://github.com/XRPLF/rippled/pull/4370)
|
- For sidechains and networks with a network ID greater than 1024, there is a new [transaction common field](https://xrpl.org/transaction-common-fields.html), `NetworkID`. ([#4370](https://github.com/XRPLF/rippled/pull/4370))
|
||||||
- This field helps to prevent replay attacks and is now required for chains whose network ID is 1025 or higher.
|
- This field helps to prevent replay attacks and is now required for chains whose network ID is 1025 or higher.
|
||||||
- The field must be omitted for Mainnet, so there is no change for Mainnet users.
|
- The field must be omitted for Mainnet, so there is no change for Mainnet users.
|
||||||
- There are three new local error codes:
|
- There are three new local error codes:
|
||||||
@@ -200,10 +208,10 @@ The following is a non-breaking addition to the API.
|
|||||||
|
|
||||||
### Additions and bug fixes in 1.11
|
### Additions and bug fixes in 1.11
|
||||||
|
|
||||||
- Added `nftoken_id`, `nftoken_ids` and `offer_id` meta fields into NFT `tx` and `account_tx` responses. (https://github.com/XRPLF/rippled/pull/4447)
|
- Added `nftoken_id`, `nftoken_ids` and `offer_id` meta fields into NFT `tx` and `account_tx` responses. ([#4447](https://github.com/XRPLF/rippled/pull/4447))
|
||||||
- Added an `account_flags` object to the `account_info` method response. (https://github.com/XRPLF/rippled/pull/4459)
|
- Added an `account_flags` object to the `account_info` method response. ([#4459](https://github.com/XRPLF/rippled/pull/4459))
|
||||||
- Added `NFTokenPages` to the `account_objects` RPC. (https://github.com/XRPLF/rippled/pull/4352)
|
- Added `NFTokenPages` to the `account_objects` RPC. ([#4352](https://github.com/XRPLF/rippled/pull/4352))
|
||||||
- Fixed: `marker` returned from the `account_lines` command would not work on subsequent commands. (https://github.com/XRPLF/rippled/pull/4361)
|
- Fixed: `marker` returned from the `account_lines` command would not work on subsequent commands. ([#4361](https://github.com/XRPLF/rippled/pull/4361))
|
||||||
|
|
||||||
## XRP Ledger server version 1.10.0
|
## XRP Ledger server version 1.10.0
|
||||||
|
|
||||||
|
|||||||
66
API-VERSION-2.md
Normal file
66
API-VERSION-2.md
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
# API Version 2
|
||||||
|
|
||||||
|
API version 2 is available in `rippled` version 2.0.0 and later. To use this API, clients specify `"api_version" : 2` in each request.
|
||||||
|
|
||||||
|
For info about how [API versioning](https://xrpl.org/request-formatting.html#api-versioning) works, including examples, please view the [XLS-22d spec](https://github.com/XRPLF/XRPL-Standards/discussions/54). For details about the implementation of API versioning, view the [implementation PR](https://github.com/XRPLF/rippled/pull/3155). API versioning ensures existing integrations and users continue to receive existing behavior, while those that request a higher API version will experience new behavior.
|
||||||
|
|
||||||
|
## Removed methods
|
||||||
|
|
||||||
|
In API version 2, the following deprecated methods are no longer available: ([#4759](https://github.com/XRPLF/rippled/pull/4759))
|
||||||
|
|
||||||
|
- `tx_history` - Instead, use other methods such as `account_tx` or `ledger` with the `transactions` field set to `true`.
|
||||||
|
- `ledger_header` - Instead, use the `ledger` method.
|
||||||
|
|
||||||
|
## Modifications to JSON transaction element in API version 2
|
||||||
|
|
||||||
|
In API version 2, JSON elements for transaction output have been changed and made consistent for all methods which output transactions. ([#4775](https://github.com/XRPLF/rippled/pull/4775))
|
||||||
|
This helps to unify the JSON serialization format of transactions. ([clio#722](https://github.com/XRPLF/clio/issues/722), [#4727](https://github.com/XRPLF/rippled/issues/4727))
|
||||||
|
|
||||||
|
- JSON transaction element is named `tx_json`
|
||||||
|
- Binary transaction element is named `tx_blob`
|
||||||
|
- JSON transaction metadata element is named `meta`
|
||||||
|
- Binary transaction metadata element is named `meta_blob`
|
||||||
|
|
||||||
|
Additionally, these elements are now consistently available next to `tx_json` (i.e. sibling elements), where possible:
|
||||||
|
|
||||||
|
- `hash` - Transaction ID. This data was stored inside transaction output in API version 1, but in API version 2 is a sibling element.
|
||||||
|
- `ledger_index` - Ledger index (only set on validated ledgers)
|
||||||
|
- `ledger_hash` - Ledger hash (only set on closed or validated ledgers)
|
||||||
|
- `close_time_iso` - Ledger close time expressed in ISO 8601 time format (only set on validated ledgers)
|
||||||
|
- `validated` - Bool element set to `true` if the transaction is in a validated ledger, otherwise `false`
|
||||||
|
|
||||||
|
This change affects the following methods:
|
||||||
|
|
||||||
|
- `tx` - Transaction data moved into element `tx_json` (was inline inside `result`) or, if binary output was requested, moved from `tx` to `tx_blob`. Renamed binary transaction metadata element (if it was requested) from `meta` to `meta_blob`. Changed location of `hash` and added new elements
|
||||||
|
- `account_tx` - Renamed transaction element from `tx` to `tx_json`. Renamed binary transaction metadata element (if it was requested) from `meta` to `meta_blob`. Changed location of `hash` and added new elements
|
||||||
|
- `transaction_entry` - Renamed transaction metadata element from `metadata` to `meta`. Changed location of `hash` and added new elements
|
||||||
|
- `subscribe` - Renamed transaction element from `transaction` to `tx_json`. Changed location of `hash` and added new elements
|
||||||
|
- `sign`, `sign_for`, `submit` and `submit_multisigned` - Changed location of `hash` element.
|
||||||
|
|
||||||
|
## Modifications to `Payment` transaction JSON schema
|
||||||
|
|
||||||
|
When reading Payments, the `Amount` field should generally **not** be used. Instead, use [delivered_amount](https://xrpl.org/partial-payments.html#the-delivered_amount-field) to see the amount that the Payment delivered. To clarify its meaning, the `Amount` field is being renamed to `DeliverMax`. ([#4733](https://github.com/XRPLF/rippled/pull/4733))
|
||||||
|
|
||||||
|
- In `Payment` transaction type, JSON RPC field `Amount` is renamed to `DeliverMax`. To enable smooth client transition, `Amount` is still handled, as described below: ([#4733](https://github.com/XRPLF/rippled/pull/4733))
|
||||||
|
- On JSON RPC input (e.g. `submit_multisigned` etc. methods), `Amount` is recognized as an alias to `DeliverMax` for both API version 1 and version 2 clients.
|
||||||
|
- On JSON RPC input, submitting both `Amount` and `DeliverMax` fields is allowed _only_ if they are identical; otherwise such input is rejected with `rpcINVALID_PARAMS` error.
|
||||||
|
- On JSON RPC output (e.g. `subscribe`, `account_tx` etc. methods), `DeliverMax` is present in both API version 1 and version 2.
|
||||||
|
- On JSON RPC output, `Amount` is only present in API version 1 and _not_ in version 2.
|
||||||
|
|
||||||
|
## Modifications to account_info response
|
||||||
|
|
||||||
|
- `signer_lists` is returned in the root of the response. (In API version 1, it was nested under `account_data`.) ([#3770](https://github.com/XRPLF/rippled/pull/3770))
|
||||||
|
- When using an invalid `signer_lists` value, the API now returns an "invalidParams" error. ([#4585](https://github.com/XRPLF/rippled/pull/4585))
|
||||||
|
- (`signer_lists` must be a boolean. In API version 1, strings were accepted and may return a normal response - i.e. as if `signer_lists` were `true`.)
|
||||||
|
|
||||||
|
## Modifications to [account_tx](https://xrpl.org/account_tx.html#account_tx) response
|
||||||
|
|
||||||
|
- Using `ledger_index_min`, `ledger_index_max`, and `ledger_index` returns `invalidParams` because if you use `ledger_index_min` or `ledger_index_max`, then it does not make sense to also specify `ledger_index`. In API version 1, no error was returned. ([#4571](https://github.com/XRPLF/rippled/pull/4571))
|
||||||
|
- The same applies for `ledger_index_min`, `ledger_index_max`, and `ledger_hash`. ([#4545](https://github.com/XRPLF/rippled/issues/4545#issuecomment-1565065579))
|
||||||
|
- Using a `ledger_index_min` or `ledger_index_max` beyond the range of ledgers that the server has:
|
||||||
|
- returns `lgrIdxMalformed` in API version 2. Previously, in API version 1, no error was returned. ([#4288](https://github.com/XRPLF/rippled/issues/4288))
|
||||||
|
- Attempting to use a non-boolean value (such as a string) for the `binary` or `forward` parameters returns `invalidParams` (`rpcINVALID_PARAMS`). Previously, in API version 1, no error was returned. ([#4620](https://github.com/XRPLF/rippled/pull/4620))
|
||||||
|
|
||||||
|
## Modifications to [noripple_check](https://xrpl.org/noripple_check.html#noripple_check) response
|
||||||
|
|
||||||
|
- Attempting to use a non-boolean value (such as a string) for the `transactions` parameter returns `invalidParams` (`rpcINVALID_PARAMS`). Previously, in API version 1, no error was returned. ([#4620](https://github.com/XRPLF/rippled/pull/4620))
|
||||||
27
API-VERSION-3.md
Normal file
27
API-VERSION-3.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# API Version 3
|
||||||
|
|
||||||
|
API version 3 is currently a **beta API**. It requires enabling `[beta_rpc_api]` in the rippled configuration to use. To use this API, clients specify `"api_version" : 3` in each request.
|
||||||
|
|
||||||
|
For info about how [API versioning](https://xrpl.org/request-formatting.html#api-versioning) works, including examples, please view the [XLS-22d spec](https://github.com/XRPLF/XRPL-Standards/discussions/54). For details about the implementation of API versioning, view the [implementation PR](https://github.com/XRPLF/rippled/pull/3155). API versioning ensures existing integrations and users continue to receive existing behavior, while those that request a higher API version will experience new behavior.
|
||||||
|
|
||||||
|
## Breaking Changes
|
||||||
|
|
||||||
|
### Modifications to `amm_info`
|
||||||
|
|
||||||
|
The order of error checks has been changed to provide more specific error messages. ([#4924](https://github.com/XRPLF/rippled/pull/4924))
|
||||||
|
|
||||||
|
- **Before (API v2)**: When sending an invalid account or asset to `amm_info` while other parameters are not set as expected, the method returns a generic `rpcINVALID_PARAMS` error.
|
||||||
|
- **After (API v3)**: The same scenario returns a more specific error: `rpcISSUE_MALFORMED` for malformed assets or `rpcACT_MALFORMED` for malformed accounts.
|
||||||
|
|
||||||
|
### Modifications to `ledger_entry`
|
||||||
|
|
||||||
|
Added support for string shortcuts to look up fixed-location ledger entries using the `"index"` parameter. ([#5644](https://github.com/XRPLF/rippled/pull/5644))
|
||||||
|
|
||||||
|
In API version 3, the following string values can be used with the `"index"` parameter:
|
||||||
|
|
||||||
|
- `"index": "amendments"` - Returns the `Amendments` ledger entry
|
||||||
|
- `"index": "fee"` - Returns the `FeeSettings` ledger entry
|
||||||
|
- `"index": "nunl"` - Returns the `NegativeUNL` ledger entry
|
||||||
|
- `"index": "hashes"` - Returns the "short" `LedgerHashes` ledger entry (recent ledger hashes)
|
||||||
|
|
||||||
|
These shortcuts are only available in API version 3 and later. In API versions 1 and 2, these string values would result in an error.
|
||||||
42
BUILD.md
42
BUILD.md
@@ -148,8 +148,8 @@ function extract_version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Define which recipes to export.
|
# Define which recipes to export.
|
||||||
recipes=('ed25519' 'grpc' 'openssl' 'secp256k1' 'snappy' 'soci')
|
recipes=('ed25519' 'grpc' 'nudb' 'openssl' 'secp256k1' 'snappy' 'soci')
|
||||||
folders=('all' 'all' '3.x.x' 'all' 'all' 'all')
|
folders=('all' 'all' 'all' '3.x.x' 'all' 'all' 'all')
|
||||||
|
|
||||||
# Selectively check out the recipes from our CCI fork.
|
# Selectively check out the recipes from our CCI fork.
|
||||||
cd external
|
cd external
|
||||||
@@ -368,6 +368,36 @@ The workaround for this error is to add two lines to your profile:
|
|||||||
tools.build:cxxflags=['-DBOOST_ASIO_DISABLE_CONCEPTS']
|
tools.build:cxxflags=['-DBOOST_ASIO_DISABLE_CONCEPTS']
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Set Up Ccache
|
||||||
|
|
||||||
|
To speed up repeated compilations, we recommend that you install
|
||||||
|
[ccache](https://ccache.dev), a tool that wraps your compiler so that it can
|
||||||
|
cache build objects locally.
|
||||||
|
|
||||||
|
#### Linux
|
||||||
|
|
||||||
|
You can install it using the package manager, e.g. `sudo apt install ccache`
|
||||||
|
(Ubuntu) or `sudo dnf install ccache` (RHEL).
|
||||||
|
|
||||||
|
#### macOS
|
||||||
|
|
||||||
|
You can install it using Homebrew, i.e. `brew install ccache`.
|
||||||
|
|
||||||
|
#### Windows
|
||||||
|
|
||||||
|
You can install it using Chocolatey, i.e. `choco install ccache`. If you already
|
||||||
|
have Ccache installed, then `choco upgrade ccache` will update it to the latest
|
||||||
|
version. However, if you see an error such as:
|
||||||
|
|
||||||
|
```
|
||||||
|
terminate called after throwing an instance of 'std::bad_alloc'
|
||||||
|
what(): std::bad_alloc
|
||||||
|
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(617,5): error MSB6006: "cl.exe" exited with code 3.
|
||||||
|
```
|
||||||
|
|
||||||
|
then please install a specific version of Ccache that we know works, via: `choco
|
||||||
|
install ccache --version 4.11.3 --allow-downgrade`.
|
||||||
|
|
||||||
### Build and Test
|
### Build and Test
|
||||||
|
|
||||||
1. Create a build directory and move into it.
|
1. Create a build directory and move into it.
|
||||||
@@ -550,10 +580,10 @@ See [Sanitizers docs](./docs/build/sanitizers.md) for more details.
|
|||||||
| `werr` | OFF | Treat compilation warnings as errors |
|
| `werr` | OFF | Treat compilation warnings as errors |
|
||||||
| `wextra` | OFF | Enable additional compilation warnings |
|
| `wextra` | OFF | Enable additional compilation warnings |
|
||||||
|
|
||||||
[Unity builds][5] may be faster for the first build
|
[Unity builds][5] may be faster for the first build (at the cost of much more
|
||||||
(at the cost of much more memory) since they concatenate sources into fewer
|
memory) since they concatenate sources into fewer translation units. Non-unity
|
||||||
translation units. Non-unity builds may be faster for incremental builds,
|
builds may be faster for incremental builds, and can be helpful for detecting
|
||||||
and can be helpful for detecting `#include` omissions.
|
`#include` omissions.
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,16 @@ if(POLICY CMP0077)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Fix "unrecognized escape" issues when passing CMAKE_MODULE_PATH on Windows.
|
# Fix "unrecognized escape" issues when passing CMAKE_MODULE_PATH on Windows.
|
||||||
|
if (DEFINED CMAKE_MODULE_PATH)
|
||||||
file(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH)
|
file(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH)
|
||||||
|
endif ()
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
project(xrpl)
|
project(xrpl)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
include(CompilationEnv)
|
include(CompilationEnv)
|
||||||
|
|
||||||
@@ -36,16 +39,16 @@ include(Ccache)
|
|||||||
# make GIT_COMMIT_HASH define available to all sources
|
# make GIT_COMMIT_HASH define available to all sources
|
||||||
find_package(Git)
|
find_package(Git)
|
||||||
if (Git_FOUND)
|
if (Git_FOUND)
|
||||||
execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git rev-parse HEAD
|
execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git rev-parse
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE gch)
|
HEAD OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE gch)
|
||||||
if (gch)
|
if (gch)
|
||||||
set(GIT_COMMIT_HASH "${gch}")
|
set(GIT_COMMIT_HASH "${gch}")
|
||||||
message(STATUS gch: ${GIT_COMMIT_HASH})
|
message(STATUS gch: ${GIT_COMMIT_HASH})
|
||||||
add_definitions(-DGIT_COMMIT_HASH="${GIT_COMMIT_HASH}")
|
add_definitions(-DGIT_COMMIT_HASH="${GIT_COMMIT_HASH}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git rev-parse --abbrev-ref HEAD
|
execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git rev-parse
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE gb)
|
--abbrev-ref HEAD OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE gb)
|
||||||
if (gb)
|
if (gb)
|
||||||
set(GIT_BRANCH "${gb}")
|
set(GIT_BRANCH "${gb}")
|
||||||
message(STATUS gb: ${GIT_BRANCH})
|
message(STATUS gb: ${GIT_BRANCH})
|
||||||
@@ -54,7 +57,8 @@ if(Git_FOUND)
|
|||||||
endif () # git
|
endif () # git
|
||||||
|
|
||||||
if (thread_safety_analysis)
|
if (thread_safety_analysis)
|
||||||
add_compile_options(-Wthread-safety -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -DXRPL_ENABLE_THREAD_SAFETY_ANNOTATIONS)
|
add_compile_options(-Wthread-safety -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
|
||||||
|
-DXRPL_ENABLE_THREAD_SAFETY_ANNOTATIONS)
|
||||||
add_compile_options("-stdlib=libc++")
|
add_compile_options("-stdlib=libc++")
|
||||||
add_link_options("-stdlib=libc++")
|
add_link_options("-stdlib=libc++")
|
||||||
endif ()
|
endif ()
|
||||||
@@ -64,17 +68,18 @@ include (FetchContent)
|
|||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
include(CMakeFuncs) # must come *after* ExternalProject b/c it overrides one function in EP
|
include(CMakeFuncs) # must come *after* ExternalProject b/c it overrides one function in EP
|
||||||
if (target)
|
if (target)
|
||||||
message (FATAL_ERROR "The target option has been removed - use native cmake options to control build")
|
message(FATAL_ERROR "The target option has been removed - use native cmake options to control build"
|
||||||
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include(XrplSanity)
|
include(XrplSanity)
|
||||||
include(XrplVersion)
|
include(XrplVersion)
|
||||||
include(XrplSettings)
|
include(XrplSettings)
|
||||||
# this check has to remain in the top-level cmake
|
# this check has to remain in the top-level cmake because of the early return statement
|
||||||
# because of the early return statement
|
|
||||||
if (packages_only)
|
if (packages_only)
|
||||||
if (NOT TARGET rpm)
|
if (NOT TARGET rpm)
|
||||||
message (FATAL_ERROR "packages_only requested, but targets were not created - is docker installed?")
|
message(FATAL_ERROR "packages_only requested, but targets were not created - is docker installed?"
|
||||||
|
)
|
||||||
endif ()
|
endif ()
|
||||||
return()
|
return()
|
||||||
endif ()
|
endif ()
|
||||||
@@ -88,8 +93,6 @@ if(only_docs)
|
|||||||
return()
|
return()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
###
|
|
||||||
|
|
||||||
include(deps/Boost)
|
include(deps/Boost)
|
||||||
|
|
||||||
add_subdirectory(external/antithesis-sdk)
|
add_subdirectory(external/antithesis-sdk)
|
||||||
@@ -105,22 +108,21 @@ find_package(SOCI REQUIRED)
|
|||||||
find_package(SQLite3 REQUIRED)
|
find_package(SQLite3 REQUIRED)
|
||||||
find_package(xxHash REQUIRED)
|
find_package(xxHash REQUIRED)
|
||||||
|
|
||||||
target_link_libraries(xrpl_libs INTERFACE
|
target_link_libraries(
|
||||||
ed25519::ed25519
|
xrpl_libs
|
||||||
|
INTERFACE ed25519::ed25519
|
||||||
lz4::lz4
|
lz4::lz4
|
||||||
OpenSSL::Crypto
|
OpenSSL::Crypto
|
||||||
OpenSSL::SSL
|
OpenSSL::SSL
|
||||||
secp256k1::secp256k1
|
secp256k1::secp256k1
|
||||||
soci::soci
|
soci::soci
|
||||||
SQLite::SQLite3
|
SQLite::SQLite3)
|
||||||
)
|
|
||||||
|
|
||||||
option(rocksdb "Enable RocksDB" ON)
|
option(rocksdb "Enable RocksDB" ON)
|
||||||
if (rocksdb)
|
if (rocksdb)
|
||||||
find_package(RocksDB REQUIRED)
|
find_package(RocksDB REQUIRED)
|
||||||
set_target_properties(RocksDB::rocksdb PROPERTIES
|
set_target_properties(RocksDB::rocksdb PROPERTIES INTERFACE_COMPILE_DEFINITIONS
|
||||||
INTERFACE_COMPILE_DEFINITIONS XRPL_ROCKSDB_AVAILABLE=1
|
XRPL_ROCKSDB_AVAILABLE=1)
|
||||||
)
|
|
||||||
target_link_libraries(xrpl_libs INTERFACE RocksDB::rocksdb)
|
target_link_libraries(xrpl_libs INTERFACE RocksDB::rocksdb)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ coherent rather than a set of _thou shalt not_ commandments.
|
|||||||
|
|
||||||
## Formatting
|
## Formatting
|
||||||
|
|
||||||
All code must conform to `clang-format` version 18,
|
All code must conform to `clang-format` version 21,
|
||||||
according to the settings in [`.clang-format`](./.clang-format),
|
according to the settings in [`.clang-format`](./.clang-format),
|
||||||
unless the result would be unreasonably difficult to read or maintain.
|
unless the result would be unreasonably difficult to read or maintain.
|
||||||
To demarcate lines that should be left as-is, surround them with comments like
|
To demarcate lines that should be left as-is, surround them with comments like
|
||||||
@@ -872,7 +872,8 @@ git push --delete upstream-push master-next
|
|||||||
11. [Create a new release on
|
11. [Create a new release on
|
||||||
Github](https://github.com/XRPLF/rippled/releases). Be sure that
|
Github](https://github.com/XRPLF/rippled/releases). Be sure that
|
||||||
"Set as the latest release" is checked.
|
"Set as the latest release" is checked.
|
||||||
12. Finally [reverse merge the release into `develop`](#follow-up-reverse-merge).
|
12. Open a PR to update the [API-CHANGELOG](API-CHANGELOG.md) and `API-VERSION-[n].md` with the changes for this release (if any are missing).
|
||||||
|
13. Finally, [reverse merge the release into `develop`](#follow-up-reverse-merge).
|
||||||
|
|
||||||
#### Special cases: point releases, hotfixes, etc.
|
#### Special cases: point releases, hotfixes, etc.
|
||||||
|
|
||||||
|
|||||||
@@ -940,23 +940,7 @@
|
|||||||
#
|
#
|
||||||
# path Location to store the database
|
# path Location to store the database
|
||||||
#
|
#
|
||||||
# Optional keys
|
# Optional keys for NuDB and RocksDB:
|
||||||
#
|
|
||||||
# cache_size Size of cache for database records. Default is 16384.
|
|
||||||
# Setting this value to 0 will use the default value.
|
|
||||||
#
|
|
||||||
# cache_age Length of time in minutes to keep database records
|
|
||||||
# cached. Default is 5 minutes. Setting this value to
|
|
||||||
# 0 will use the default value.
|
|
||||||
#
|
|
||||||
# Note: if neither cache_size nor cache_age is
|
|
||||||
# specified, the cache for database records will not
|
|
||||||
# be created. If only one of cache_size or cache_age
|
|
||||||
# is specified, the cache will be created using the
|
|
||||||
# default value for the unspecified parameter.
|
|
||||||
#
|
|
||||||
# Note: the cache will not be created if online_delete
|
|
||||||
# is specified.
|
|
||||||
#
|
#
|
||||||
# fast_load Boolean. If set, load the last persisted ledger
|
# fast_load Boolean. If set, load the last persisted ledger
|
||||||
# from disk upon process start before syncing to
|
# from disk upon process start before syncing to
|
||||||
@@ -964,8 +948,6 @@
|
|||||||
# if sufficient IOPS capacity is available.
|
# if sufficient IOPS capacity is available.
|
||||||
# Default 0.
|
# Default 0.
|
||||||
#
|
#
|
||||||
# Optional keys for NuDB or RocksDB:
|
|
||||||
#
|
|
||||||
# earliest_seq The default is 32570 to match the XRP ledger
|
# earliest_seq The default is 32570 to match the XRP ledger
|
||||||
# network's earliest allowed sequence. Alternate
|
# network's earliest allowed sequence. Alternate
|
||||||
# networks may set this value. Minimum value of 1.
|
# networks may set this value. Minimum value of 1.
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ function (git_branch branch_val)
|
|||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
RESULT_VARIABLE _git_exit_code
|
RESULT_VARIABLE _git_exit_code
|
||||||
OUTPUT_VARIABLE _temp_branch
|
OUTPUT_VARIABLE _temp_branch
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||||
ERROR_QUIET)
|
|
||||||
if (_git_exit_code EQUAL 0)
|
if (_git_exit_code EQUAL 0)
|
||||||
set(_branch ${_temp_branch})
|
set(_branch ${_temp_branch})
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
@@ -15,17 +15,16 @@ endif ()
|
|||||||
# https://github.com/ccache/ccache/wiki/MS-Visual-Studio#usage-with-cmake.
|
# https://github.com/ccache/ccache/wiki/MS-Visual-Studio#usage-with-cmake.
|
||||||
if ("${CCACHE_PATH}" MATCHES "chocolatey")
|
if ("${CCACHE_PATH}" MATCHES "chocolatey")
|
||||||
message(DEBUG "Ccache path: ${CCACHE_PATH}")
|
message(DEBUG "Ccache path: ${CCACHE_PATH}")
|
||||||
# Chocolatey uses a shim executable that we cannot use directly, in which
|
# Chocolatey uses a shim executable that we cannot use directly, in which case we have to find the executable it
|
||||||
# case we have to find the executable it points to. If we cannot find the
|
# points to. If we cannot find the target executable then we cannot use ccache.
|
||||||
# target executable then we cannot use ccache.
|
|
||||||
find_program(BASH_PATH "bash")
|
find_program(BASH_PATH "bash")
|
||||||
if (NOT BASH_PATH)
|
if (NOT BASH_PATH)
|
||||||
message(WARNING "Could not find bash.")
|
message(WARNING "Could not find bash.")
|
||||||
return()
|
return()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
execute_process(
|
execute_process(COMMAND bash -c
|
||||||
COMMAND bash -c "export LC_ALL='en_US.UTF-8'; ${CCACHE_PATH} --shimgen-noop | grep -oP 'path to executable: \\K.+' | head -c -1"
|
"export LC_ALL='en_US.UTF-8'; ${CCACHE_PATH} --shimgen-noop | grep -oP 'path to executable: \\K.+' | head -c -1"
|
||||||
OUTPUT_VARIABLE CCACHE_PATH)
|
OUTPUT_VARIABLE CCACHE_PATH)
|
||||||
|
|
||||||
if (NOT CCACHE_PATH)
|
if (NOT CCACHE_PATH)
|
||||||
@@ -37,21 +36,15 @@ endif ()
|
|||||||
message(STATUS "Found ccache: ${CCACHE_PATH}")
|
message(STATUS "Found ccache: ${CCACHE_PATH}")
|
||||||
|
|
||||||
# Tell cmake to use ccache for compiling with Visual Studio.
|
# Tell cmake to use ccache for compiling with Visual Studio.
|
||||||
file(COPY_FILE
|
file(COPY_FILE ${CCACHE_PATH} ${CMAKE_BINARY_DIR}/cl.exe ONLY_IF_DIFFERENT)
|
||||||
${CCACHE_PATH} ${CMAKE_BINARY_DIR}/cl.exe
|
set(CMAKE_VS_GLOBALS "CLToolExe=cl.exe" "CLToolPath=${CMAKE_BINARY_DIR}" "TrackFileAccess=false"
|
||||||
ONLY_IF_DIFFERENT)
|
|
||||||
set(CMAKE_VS_GLOBALS
|
|
||||||
"CLToolExe=cl.exe"
|
|
||||||
"CLToolPath=${CMAKE_BINARY_DIR}"
|
|
||||||
"TrackFileAccess=false"
|
|
||||||
"UseMultiToolTask=true")
|
"UseMultiToolTask=true")
|
||||||
|
|
||||||
# By default Visual Studio generators will use /Zi to capture debug information,
|
# By default Visual Studio generators will use /Zi to capture debug information, which is not compatible with ccache, so
|
||||||
# which is not compatible with ccache, so tell it to use /Z7 instead.
|
# tell it to use /Z7 instead.
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
foreach (var_
|
foreach (var_ CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG
|
||||||
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
CMAKE_CXX_FLAGS_RELEASE)
|
||||||
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE)
|
|
||||||
string(REPLACE "/Zi" "/Z7" ${var_} "${${var_}}")
|
string(REPLACE "/Zi" "/Z7" ${var_} "${${var_}}")
|
||||||
endforeach ()
|
endforeach ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
@@ -180,10 +180,8 @@ elseif(DEFINED ENV{CODE_COVERAGE_GCOV_TOOL})
|
|||||||
set(GCOV_TOOL "$ENV{CODE_COVERAGE_GCOV_TOOL}")
|
set(GCOV_TOOL "$ENV{CODE_COVERAGE_GCOV_TOOL}")
|
||||||
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
|
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
execute_process( COMMAND xcrun -f llvm-cov
|
execute_process(COMMAND xcrun -f llvm-cov OUTPUT_VARIABLE LLVMCOV_PATH
|
||||||
OUTPUT_VARIABLE LLVMCOV_PATH
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
)
|
|
||||||
else ()
|
else ()
|
||||||
find_program(LLVMCOV_PATH llvm-cov)
|
find_program(LLVMCOV_PATH llvm-cov)
|
||||||
endif ()
|
endif ()
|
||||||
@@ -202,14 +200,13 @@ foreach(LANG ${LANGUAGES})
|
|||||||
if ("${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS 3)
|
if ("${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS 3)
|
||||||
message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
|
message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
|
||||||
endif ()
|
endif ()
|
||||||
elseif(NOT "${CMAKE_${LANG}_COMPILER_ID}" MATCHES "GNU"
|
elseif (NOT "${CMAKE_${LANG}_COMPILER_ID}" MATCHES "GNU" AND NOT "${CMAKE_${LANG}_COMPILER_ID}"
|
||||||
AND NOT "${CMAKE_${LANG}_COMPILER_ID}" MATCHES "(LLVM)?[Ff]lang")
|
MATCHES "(LLVM)?[Ff]lang")
|
||||||
message(FATAL_ERROR "Compiler is not GNU or Flang! Aborting...")
|
message(FATAL_ERROR "Compiler is not GNU or Flang! Aborting...")
|
||||||
endif ()
|
endif ()
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
set(COVERAGE_COMPILER_FLAGS "-g --coverage"
|
set(COVERAGE_COMPILER_FLAGS "-g --coverage" CACHE INTERNAL "")
|
||||||
CACHE INTERNAL "")
|
|
||||||
|
|
||||||
set(COVERAGE_CXX_COMPILER_FLAGS "")
|
set(COVERAGE_CXX_COMPILER_FLAGS "")
|
||||||
set(COVERAGE_C_COMPILER_FLAGS "")
|
set(COVERAGE_C_COMPILER_FLAGS "")
|
||||||
@@ -325,16 +322,16 @@ function(setup_target_for_coverage_gcovr)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if ("--output" IN_LIST GCOVR_ADDITIONAL_ARGS)
|
if ("--output" IN_LIST GCOVR_ADDITIONAL_ARGS)
|
||||||
message(FATAL_ERROR "Unsupported --output option detected in GCOVR_ADDITIONAL_ARGS! Aborting...")
|
message(FATAL_ERROR "Unsupported --output option detected in GCOVR_ADDITIONAL_ARGS! Aborting..."
|
||||||
|
)
|
||||||
else ()
|
else ()
|
||||||
if((Coverage_FORMAT STREQUAL "html-details")
|
if ((Coverage_FORMAT STREQUAL "html-details") OR (Coverage_FORMAT STREQUAL "html-nested"))
|
||||||
OR (Coverage_FORMAT STREQUAL "html-nested"))
|
|
||||||
set(GCOVR_OUTPUT_FILE ${PROJECT_BINARY_DIR}/${Coverage_NAME}/index.html)
|
set(GCOVR_OUTPUT_FILE ${PROJECT_BINARY_DIR}/${Coverage_NAME}/index.html)
|
||||||
set(GCOVR_CREATE_FOLDER ${PROJECT_BINARY_DIR}/${Coverage_NAME})
|
set(GCOVR_CREATE_FOLDER ${PROJECT_BINARY_DIR}/${Coverage_NAME})
|
||||||
elseif (Coverage_FORMAT STREQUAL "html-single")
|
elseif (Coverage_FORMAT STREQUAL "html-single")
|
||||||
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.html)
|
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.html)
|
||||||
elseif((Coverage_FORMAT STREQUAL "json-summary")
|
elseif ((Coverage_FORMAT STREQUAL "json-summary") OR (Coverage_FORMAT STREQUAL
|
||||||
OR (Coverage_FORMAT STREQUAL "json-details")
|
"json-details")
|
||||||
OR (Coverage_FORMAT STREQUAL "coveralls"))
|
OR (Coverage_FORMAT STREQUAL "coveralls"))
|
||||||
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.json)
|
set(GCOVR_OUTPUT_FILE ${Coverage_NAME}.json)
|
||||||
elseif (Coverage_FORMAT STREQUAL "txt")
|
elseif (Coverage_FORMAT STREQUAL "txt")
|
||||||
@@ -348,8 +345,7 @@ function(setup_target_for_coverage_gcovr)
|
|||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if((Coverage_FORMAT STREQUAL "cobertura")
|
if ((Coverage_FORMAT STREQUAL "cobertura") OR (Coverage_FORMAT STREQUAL "xml"))
|
||||||
OR (Coverage_FORMAT STREQUAL "xml"))
|
|
||||||
list(APPEND GCOVR_ADDITIONAL_ARGS --cobertura "${GCOVR_OUTPUT_FILE}")
|
list(APPEND GCOVR_ADDITIONAL_ARGS --cobertura "${GCOVR_OUTPUT_FILE}")
|
||||||
list(APPEND GCOVR_ADDITIONAL_ARGS --cobertura-pretty)
|
list(APPEND GCOVR_ADDITIONAL_ARGS --cobertura-pretty)
|
||||||
set(Coverage_FORMAT cobertura) # overwrite xml
|
set(Coverage_FORMAT cobertura) # overwrite xml
|
||||||
@@ -408,27 +404,25 @@ function(setup_target_for_coverage_gcovr)
|
|||||||
# If EXECUTABLE is not set, the user is expected to run the tests manually
|
# If EXECUTABLE is not set, the user is expected to run the tests manually
|
||||||
# before running the coverage target NAME
|
# before running the coverage target NAME
|
||||||
if (DEFINED Coverage_EXECUTABLE)
|
if (DEFINED Coverage_EXECUTABLE)
|
||||||
set(GCOVR_EXEC_TESTS_CMD
|
set(GCOVR_EXEC_TESTS_CMD ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS})
|
||||||
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
|
|
||||||
)
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Create folder
|
# Create folder
|
||||||
if (DEFINED GCOVR_CREATE_FOLDER)
|
if (DEFINED GCOVR_CREATE_FOLDER)
|
||||||
set(GCOVR_FOLDER_CMD
|
set(GCOVR_FOLDER_CMD ${CMAKE_COMMAND} -E make_directory ${GCOVR_CREATE_FOLDER})
|
||||||
${CMAKE_COMMAND} -E make_directory ${GCOVR_CREATE_FOLDER})
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Running gcovr
|
# Running gcovr
|
||||||
set(GCOVR_CMD
|
set(GCOVR_CMD
|
||||||
${GCOVR_PATH}
|
${GCOVR_PATH}
|
||||||
--gcov-executable ${GCOV_TOOL}
|
--gcov-executable
|
||||||
|
${GCOV_TOOL}
|
||||||
--gcov-ignore-parse-errors=negative_hits.warn_once_per_file
|
--gcov-ignore-parse-errors=negative_hits.warn_once_per_file
|
||||||
-r ${BASEDIR}
|
-r
|
||||||
|
${BASEDIR}
|
||||||
${GCOVR_ADDITIONAL_ARGS}
|
${GCOVR_ADDITIONAL_ARGS}
|
||||||
${GCOVR_EXCLUDE_ARGS}
|
${GCOVR_EXCLUDE_ARGS}
|
||||||
--object-directory=${PROJECT_BINARY_DIR}
|
--object-directory=${PROJECT_BINARY_DIR})
|
||||||
)
|
|
||||||
|
|
||||||
if (CODE_COVERAGE_VERBOSE)
|
if (CODE_COVERAGE_VERBOSE)
|
||||||
message(STATUS "Executed command report")
|
message(STATUS "Executed command report")
|
||||||
@@ -454,17 +448,15 @@ function(setup_target_for_coverage_gcovr)
|
|||||||
COMMAND ${GCOVR_EXEC_TESTS_CMD}
|
COMMAND ${GCOVR_EXEC_TESTS_CMD}
|
||||||
COMMAND ${GCOVR_FOLDER_CMD}
|
COMMAND ${GCOVR_FOLDER_CMD}
|
||||||
COMMAND ${GCOVR_CMD}
|
COMMAND ${GCOVR_CMD}
|
||||||
|
|
||||||
BYPRODUCTS ${GCOVR_OUTPUT_FILE}
|
BYPRODUCTS ${GCOVR_OUTPUT_FILE}
|
||||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||||
DEPENDS ${Coverage_DEPENDENCIES}
|
DEPENDS ${Coverage_DEPENDENCIES}
|
||||||
VERBATIM # Protect arguments to commands
|
VERBATIM # Protect arguments to commands
|
||||||
COMMENT "Running gcovr to produce code coverage report."
|
COMMENT "Running gcovr to produce code coverage report.")
|
||||||
)
|
|
||||||
|
|
||||||
# Show info where to find the report
|
# Show info where to find the report
|
||||||
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
|
add_custom_command(
|
||||||
COMMAND echo
|
TARGET ${Coverage_NAME} POST_BUILD COMMAND echo
|
||||||
COMMENT "Code coverage report saved in ${GCOVR_OUTPUT_FILE} formatted as ${Coverage_FORMAT}"
|
COMMENT "Code coverage report saved in ${GCOVR_OUTPUT_FILE} formatted as ${Coverage_FORMAT}"
|
||||||
)
|
)
|
||||||
endfunction () # setup_target_for_coverage_gcovr
|
endfunction () # setup_target_for_coverage_gcovr
|
||||||
@@ -476,12 +468,10 @@ function(add_code_coverage_to_target name scope)
|
|||||||
separate_arguments(COVERAGE_C_LINKER_FLAGS NATIVE_COMMAND "${COVERAGE_C_LINKER_FLAGS}")
|
separate_arguments(COVERAGE_C_LINKER_FLAGS NATIVE_COMMAND "${COVERAGE_C_LINKER_FLAGS}")
|
||||||
|
|
||||||
# Add compiler options to the target
|
# Add compiler options to the target
|
||||||
target_compile_options(${name} ${scope}
|
target_compile_options(
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${COVERAGE_CXX_COMPILER_FLAGS}>
|
${name} ${scope} $<$<COMPILE_LANGUAGE:CXX>:${COVERAGE_CXX_COMPILER_FLAGS}>
|
||||||
$<$<COMPILE_LANGUAGE:C>:${COVERAGE_C_COMPILER_FLAGS}>)
|
$<$<COMPILE_LANGUAGE:C>:${COVERAGE_C_COMPILER_FLAGS}>)
|
||||||
|
|
||||||
target_link_libraries (${name} ${scope}
|
target_link_libraries(${name} ${scope} $<$<LINK_LANGUAGE:CXX>:${COVERAGE_CXX_LINKER_FLAGS}>
|
||||||
$<$<LINK_LANGUAGE:CXX>:${COVERAGE_CXX_LINKER_FLAGS} gcov>
|
$<$<LINK_LANGUAGE:C>:${COVERAGE_C_LINKER_FLAGS}>)
|
||||||
$<$<LINK_LANGUAGE:C>:${COVERAGE_C_LINKER_FLAGS} gcov>
|
|
||||||
)
|
|
||||||
endfunction () # add_code_coverage_to_target
|
endfunction () # add_code_coverage_to_target
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
# Shared detection of compiler, operating system, and architecture.
|
# Shared detection of compiler, operating system, and architecture.
|
||||||
#
|
#
|
||||||
# This module centralizes environment detection so that other
|
# This module centralizes environment detection so that other CMake modules can use the same variables instead of
|
||||||
# CMake modules can use the same variables instead of repeating
|
# repeating checks on CMAKE_* and built-in platform variables.
|
||||||
# checks on CMAKE_* and built-in platform variables.
|
|
||||||
|
|
||||||
# Only run once per configure step.
|
# Only run once per configure step.
|
||||||
include_guard(GLOBAL)
|
include_guard(GLOBAL)
|
||||||
@@ -13,6 +12,7 @@ include_guard(GLOBAL)
|
|||||||
set(is_clang FALSE)
|
set(is_clang FALSE)
|
||||||
set(is_gcc FALSE)
|
set(is_gcc FALSE)
|
||||||
set(is_msvc FALSE)
|
set(is_msvc FALSE)
|
||||||
|
set(is_xcode FALSE)
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") # Clang or AppleClang
|
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") # Clang or AppleClang
|
||||||
set(is_clang TRUE)
|
set(is_clang TRUE)
|
||||||
@@ -24,6 +24,10 @@ else()
|
|||||||
message(FATAL_ERROR "Unsupported C++ compiler: ${CMAKE_CXX_COMPILER_ID}")
|
message(FATAL_ERROR "Unsupported C++ compiler: ${CMAKE_CXX_COMPILER_ID}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
# Xcode generator detection
|
||||||
|
if (CMAKE_GENERATOR STREQUAL "Xcode")
|
||||||
|
set(is_xcode TRUE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
# Operating system detection
|
# Operating system detection
|
||||||
@@ -47,7 +51,7 @@ set(is_amd64 FALSE)
|
|||||||
set(is_arm64 FALSE)
|
set(is_arm64 FALSE)
|
||||||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
|
||||||
set(is_amd64 TRUE)
|
set(is_amd64 TRUE)
|
||||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64")
|
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64|ARM64")
|
||||||
set(is_arm64 TRUE)
|
set(is_arm64 TRUE)
|
||||||
else ()
|
else ()
|
||||||
message(FATAL_ERROR "Unknown architecture: ${CMAKE_SYSTEM_PROCESSOR}")
|
message(FATAL_ERROR "Unknown architecture: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
|
|||||||
@@ -3,23 +3,11 @@ include(isolate_headers)
|
|||||||
function (xrpl_add_test name)
|
function (xrpl_add_test name)
|
||||||
set(target ${PROJECT_NAME}.test.${name})
|
set(target ${PROJECT_NAME}.test.${name})
|
||||||
|
|
||||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS
|
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp")
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp"
|
|
||||||
)
|
|
||||||
add_executable(${target} ${ARGN} ${sources})
|
add_executable(${target} ${ARGN} ${sources})
|
||||||
|
|
||||||
isolate_headers(
|
isolate_headers(${target} "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests/${name}" PRIVATE)
|
||||||
${target}
|
|
||||||
"${CMAKE_SOURCE_DIR}"
|
|
||||||
"${CMAKE_SOURCE_DIR}/tests/${name}"
|
|
||||||
PRIVATE
|
|
||||||
)
|
|
||||||
|
|
||||||
# Make sure the test isn't optimized away in unity builds
|
|
||||||
set_target_properties(${target} PROPERTIES
|
|
||||||
UNITY_BUILD_MODE GROUP
|
|
||||||
UNITY_BUILD_BATCH_SIZE 0) # Adjust as needed
|
|
||||||
|
|
||||||
add_test(NAME ${target} COMMAND ${target})
|
add_test(NAME ${target} COMMAND ${target})
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|||||||
@@ -17,12 +17,13 @@ link_libraries (Xrpl::common)
|
|||||||
if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
|
if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
endif ()
|
endif ()
|
||||||
set_target_properties (common
|
set_target_properties(common PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE
|
||||||
PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE})
|
${CMAKE_POSITION_INDEPENDENT_CODE})
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
target_compile_definitions (common
|
target_compile_definitions(
|
||||||
INTERFACE
|
common
|
||||||
$<$<CONFIG:Debug>:DEBUG _DEBUG>
|
INTERFACE $<$<CONFIG:Debug>:DEBUG
|
||||||
|
_DEBUG>
|
||||||
#[===[
|
#[===[
|
||||||
NOTE: CMAKE release builds already have NDEBUG defined, so no need to add it
|
NOTE: CMAKE release builds already have NDEBUG defined, so no need to add it
|
||||||
explicitly except for the special case of (profile ON) and (assert OFF).
|
explicitly except for the special case of (profile ON) and (assert OFF).
|
||||||
@@ -31,16 +32,14 @@ target_compile_definitions (common
|
|||||||
]===]
|
]===]
|
||||||
$<$<AND:$<BOOL:${profile}>,$<NOT:$<BOOL:${assert}>>>:NDEBUG>
|
$<$<AND:$<BOOL:${profile}>,$<NOT:$<BOOL:${assert}>>>:NDEBUG>
|
||||||
# TODO: Remove once we have migrated functions from OpenSSL 1.x to 3.x.
|
# TODO: Remove once we have migrated functions from OpenSSL 1.x to 3.x.
|
||||||
OPENSSL_SUPPRESS_DEPRECATED
|
OPENSSL_SUPPRESS_DEPRECATED)
|
||||||
)
|
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# remove existing exception flag since we set it to -EHa
|
# remove existing exception flag since we set it to -EHa
|
||||||
string(REGEX REPLACE "[-/]EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
string(REGEX REPLACE "[-/]EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
|
||||||
foreach (var_
|
foreach (var_ CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG
|
||||||
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
CMAKE_CXX_FLAGS_RELEASE)
|
||||||
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE)
|
|
||||||
|
|
||||||
# also remove dynamic runtime
|
# also remove dynamic runtime
|
||||||
string(REGEX REPLACE "[-/]MD[d]*" " " ${var_} "${${var_}}")
|
string(REGEX REPLACE "[-/]MD[d]*" " " ${var_} "${${var_}}")
|
||||||
@@ -55,22 +54,36 @@ if (MSVC)
|
|||||||
endif ()
|
endif ()
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
target_compile_options (common
|
target_compile_options(
|
||||||
INTERFACE
|
common
|
||||||
-bigobj # Increase object file max size
|
INTERFACE # Increase object file max size
|
||||||
-fp:precise # Floating point behavior
|
-bigobj
|
||||||
-Gd # __cdecl calling convention
|
# Floating point behavior
|
||||||
-Gm- # Minimal rebuild: disabled
|
-fp:precise
|
||||||
-Gy- # Function level linking: disabled
|
# __cdecl calling convention
|
||||||
-MP # Multiprocessor compilation
|
-Gd
|
||||||
-openmp- # pragma omp: disabled
|
# Minimal rebuild: disabled
|
||||||
-errorReport:none # No error reporting to Internet
|
-Gm-
|
||||||
-nologo # Suppress login banner
|
# Function level linking: disabled
|
||||||
-wd4018 # Disable signed/unsigned comparison warnings
|
-Gy-
|
||||||
-wd4244 # Disable float to int possible loss of data warnings
|
# Multiprocessor compilation
|
||||||
-wd4267 # Disable size_t to T possible loss of data warnings
|
-MP
|
||||||
-wd4800 # Disable C4800(int to bool performance)
|
# pragma omp: disabled
|
||||||
-wd4503 # Decorated name length exceeded, name was truncated
|
-openmp-
|
||||||
|
# No error reporting to Internet
|
||||||
|
-errorReport:none
|
||||||
|
# Suppress login banner
|
||||||
|
-nologo
|
||||||
|
# Disable signed/unsigned comparison warnings
|
||||||
|
-wd4018
|
||||||
|
# Disable float to int possible loss of data warnings
|
||||||
|
-wd4244
|
||||||
|
# Disable size_t to T possible loss of data warnings
|
||||||
|
-wd4267
|
||||||
|
# Disable C4800(int to bool performance)
|
||||||
|
-wd4800
|
||||||
|
# Decorated name length exceeded, name was truncated
|
||||||
|
-wd4503
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:
|
$<$<COMPILE_LANGUAGE:CXX>:
|
||||||
-EHa
|
-EHa
|
||||||
-GR
|
-GR
|
||||||
@@ -83,11 +96,10 @@ if (MSVC)
|
|||||||
# static runtime
|
# static runtime
|
||||||
$<$<CONFIG:Debug>:-MTd>
|
$<$<CONFIG:Debug>:-MTd>
|
||||||
$<$<NOT:$<CONFIG:Debug>>:-MT>
|
$<$<NOT:$<CONFIG:Debug>>:-MT>
|
||||||
$<$<BOOL:${werr}>:-WX>
|
$<$<BOOL:${werr}>:-WX>)
|
||||||
)
|
target_compile_definitions(
|
||||||
target_compile_definitions (common
|
common
|
||||||
INTERFACE
|
INTERFACE _WIN32_WINNT=0x6000
|
||||||
_WIN32_WINNT=0x6000
|
|
||||||
_SCL_SECURE_NO_WARNINGS
|
_SCL_SECURE_NO_WARNINGS
|
||||||
_CRT_SECURE_NO_WARNINGS
|
_CRT_SECURE_NO_WARNINGS
|
||||||
WIN32_CONSOLE
|
WIN32_CONSOLE
|
||||||
@@ -96,17 +108,15 @@ if (MSVC)
|
|||||||
# TODO: Resolve these warnings, don't just silence them
|
# TODO: Resolve these warnings, don't just silence them
|
||||||
_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
|
_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
|
||||||
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>>:_CRTDBG_MAP_ALLOC>)
|
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>>:_CRTDBG_MAP_ALLOC>)
|
||||||
target_link_libraries (common
|
target_link_libraries(common INTERFACE -errorreport:none -machine:X64)
|
||||||
INTERFACE
|
|
||||||
-errorreport:none
|
|
||||||
-machine:X64)
|
|
||||||
else ()
|
else ()
|
||||||
target_compile_options (common
|
target_compile_options(
|
||||||
INTERFACE
|
common
|
||||||
-Wall
|
INTERFACE -Wall
|
||||||
-Wdeprecated
|
-Wdeprecated
|
||||||
$<$<BOOL:${is_clang}>:-Wno-deprecated-declarations>
|
$<$<BOOL:${is_clang}>:-Wno-deprecated-declarations>
|
||||||
$<$<BOOL:${wextra}>:-Wextra -Wno-unused-parameter>
|
$<$<BOOL:${wextra}>:-Wextra
|
||||||
|
-Wno-unused-parameter>
|
||||||
$<$<BOOL:${werr}>:-Werror>
|
$<$<BOOL:${werr}>:-Werror>
|
||||||
-fstack-protector
|
-fstack-protector
|
||||||
-Wno-sign-compare
|
-Wno-sign-compare
|
||||||
@@ -116,14 +126,12 @@ else ()
|
|||||||
$<$<AND:$<BOOL:${is_gcc}>,$<CONFIG:Debug>>:-O0>
|
$<$<AND:$<BOOL:${is_gcc}>,$<CONFIG:Debug>>:-O0>
|
||||||
# Add debug symbols to release config
|
# Add debug symbols to release config
|
||||||
$<$<CONFIG:Release>:-g>)
|
$<$<CONFIG:Release>:-g>)
|
||||||
target_link_libraries (common
|
target_link_libraries(
|
||||||
INTERFACE
|
common
|
||||||
-rdynamic
|
INTERFACE -rdynamic
|
||||||
$<$<BOOL:${is_linux}>:-Wl,-z,relro,-z,now,--build-id>
|
$<$<BOOL:${is_linux}>:-Wl,-z,relro,-z,now,--build-id>
|
||||||
# link to static libc/c++ iff:
|
# link to static libc/c++ iff: * static option set and * NOT APPLE (AppleClang does not support static
|
||||||
# * static option set and
|
# libc/c++) and * NOT SANITIZERS (sanitizers typically don't work with static libc/c++)
|
||||||
# * NOT APPLE (AppleClang does not support static libc/c++) and
|
|
||||||
# * NOT SANITIZERS (sanitizers typically don't work with static libc/c++)
|
|
||||||
$<$<AND:$<BOOL:${static}>,$<NOT:$<BOOL:${APPLE}>>,$<NOT:$<BOOL:${SANITIZERS_ENABLED}>>>:
|
$<$<AND:$<BOOL:${static}>,$<NOT:$<BOOL:${APPLE}>>,$<NOT:$<BOOL:${SANITIZERS_ENABLED}>>>:
|
||||||
-static-libstdc++
|
-static-libstdc++
|
||||||
-static-libgcc
|
-static-libgcc
|
||||||
@@ -137,24 +145,23 @@ if (voidstar)
|
|||||||
elseif (NOT is_linux)
|
elseif (NOT is_linux)
|
||||||
message(FATAL_ERROR "Antithesis instrumentation requires Linux, aborting...")
|
message(FATAL_ERROR "Antithesis instrumentation requires Linux, aborting...")
|
||||||
elseif (NOT (is_clang AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0))
|
elseif (NOT (is_clang AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0))
|
||||||
message(FATAL_ERROR "Antithesis instrumentation requires Clang version 16 or later, aborting...")
|
message(FATAL_ERROR "Antithesis instrumentation requires Clang version 16 or later, aborting..."
|
||||||
|
)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (use_mold)
|
if (use_mold)
|
||||||
# use mold linker if available
|
# use mold linker if available
|
||||||
execute_process (
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=mold -Wl,--version ERROR_QUIET
|
||||||
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=mold -Wl,--version
|
OUTPUT_VARIABLE LD_VERSION)
|
||||||
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
|
||||||
if ("${LD_VERSION}" MATCHES "mold")
|
if ("${LD_VERSION}" MATCHES "mold")
|
||||||
target_link_libraries(common INTERFACE -fuse-ld=mold)
|
target_link_libraries(common INTERFACE -fuse-ld=mold)
|
||||||
endif ()
|
endif ()
|
||||||
unset(LD_VERSION)
|
unset(LD_VERSION)
|
||||||
elseif (use_gold AND is_gcc)
|
elseif (use_gold AND is_gcc)
|
||||||
# use gold linker if available
|
# use gold linker if available
|
||||||
execute_process (
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET
|
||||||
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version
|
OUTPUT_VARIABLE LD_VERSION)
|
||||||
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
|
||||||
#[=========================================================[
|
#[=========================================================[
|
||||||
NOTE: THE gold linker inserts -rpath as DT_RUNPATH by
|
NOTE: THE gold linker inserts -rpath as DT_RUNPATH by
|
||||||
default instead of DT_RPATH, so you might have slightly
|
default instead of DT_RPATH, so you might have slightly
|
||||||
@@ -169,9 +176,9 @@ elseif (use_gold AND is_gcc)
|
|||||||
required to make gold play nicely with jemalloc.
|
required to make gold play nicely with jemalloc.
|
||||||
#]=========================================================]
|
#]=========================================================]
|
||||||
if (("${LD_VERSION}" MATCHES "GNU gold") AND (NOT jemalloc))
|
if (("${LD_VERSION}" MATCHES "GNU gold") AND (NOT jemalloc))
|
||||||
target_link_libraries (common
|
target_link_libraries(
|
||||||
INTERFACE
|
common
|
||||||
-fuse-ld=gold
|
INTERFACE -fuse-ld=gold
|
||||||
-Wl,--no-as-needed
|
-Wl,--no-as-needed
|
||||||
#[=========================================================[
|
#[=========================================================[
|
||||||
see https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1253638/comments/5
|
see https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1253638/comments/5
|
||||||
@@ -184,18 +191,16 @@ elseif (use_gold AND is_gcc)
|
|||||||
unset(LD_VERSION)
|
unset(LD_VERSION)
|
||||||
elseif (use_lld)
|
elseif (use_lld)
|
||||||
# use lld linker if available
|
# use lld linker if available
|
||||||
execute_process (
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=lld -Wl,--version ERROR_QUIET
|
||||||
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=lld -Wl,--version
|
OUTPUT_VARIABLE LD_VERSION)
|
||||||
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
|
||||||
if ("${LD_VERSION}" MATCHES "LLD")
|
if ("${LD_VERSION}" MATCHES "LLD")
|
||||||
target_link_libraries(common INTERFACE -fuse-ld=lld)
|
target_link_libraries(common INTERFACE -fuse-ld=lld)
|
||||||
endif ()
|
endif ()
|
||||||
unset(LD_VERSION)
|
unset(LD_VERSION)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
if (assert)
|
if (assert)
|
||||||
foreach (var_ CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
|
foreach (var_ CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
|
||||||
STRING (REGEX REPLACE "[-/]DNDEBUG" "" ${var_} "${${var_}}")
|
string(REGEX REPLACE "[-/]DNDEBUG" "" ${var_} "${${var_}}")
|
||||||
endforeach ()
|
endforeach ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ if (NOT DEFINED OPENSSL_ROOT_DIR)
|
|||||||
elseif (APPLE)
|
elseif (APPLE)
|
||||||
find_program(homebrew brew)
|
find_program(homebrew brew)
|
||||||
if (homebrew)
|
if (homebrew)
|
||||||
execute_process (COMMAND ${homebrew} --prefix openssl
|
execute_process(COMMAND ${homebrew} --prefix openssl OUTPUT_VARIABLE OPENSSL_ROOT_DIR
|
||||||
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
@@ -49,6 +48,5 @@ find_dependency (OpenSSL REQUIRED)
|
|||||||
find_dependency(ZLIB)
|
find_dependency(ZLIB)
|
||||||
find_dependency(date)
|
find_dependency(date)
|
||||||
if (TARGET ZLIB::ZLIB)
|
if (TARGET ZLIB::ZLIB)
|
||||||
set_target_properties(OpenSSL::Crypto PROPERTIES
|
set_target_properties(OpenSSL::Crypto PROPERTIES INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
|
||||||
INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
@@ -10,50 +10,34 @@ include(target_protobuf_sources)
|
|||||||
# so we just build them as a separate library.
|
# so we just build them as a separate library.
|
||||||
add_library(xrpl.libpb)
|
add_library(xrpl.libpb)
|
||||||
set_target_properties(xrpl.libpb PROPERTIES UNITY_BUILD OFF)
|
set_target_properties(xrpl.libpb PROPERTIES UNITY_BUILD OFF)
|
||||||
target_protobuf_sources(xrpl.libpb xrpl/proto
|
target_protobuf_sources(xrpl.libpb xrpl/proto LANGUAGE cpp IMPORT_DIRS include/xrpl/proto
|
||||||
LANGUAGE cpp
|
PROTOS include/xrpl/proto/xrpl.proto)
|
||||||
IMPORT_DIRS include/xrpl/proto
|
|
||||||
PROTOS include/xrpl/proto/xrpl.proto
|
|
||||||
)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE protos "include/xrpl/proto/org/*.proto")
|
file(GLOB_RECURSE protos "include/xrpl/proto/org/*.proto")
|
||||||
target_protobuf_sources(xrpl.libpb xrpl/proto
|
target_protobuf_sources(xrpl.libpb xrpl/proto LANGUAGE cpp IMPORT_DIRS include/xrpl/proto
|
||||||
LANGUAGE cpp
|
PROTOS "${protos}")
|
||||||
IMPORT_DIRS include/xrpl/proto
|
target_protobuf_sources(
|
||||||
PROTOS "${protos}"
|
xrpl.libpb xrpl/proto
|
||||||
)
|
|
||||||
target_protobuf_sources(xrpl.libpb xrpl/proto
|
|
||||||
LANGUAGE grpc
|
LANGUAGE grpc
|
||||||
IMPORT_DIRS include/xrpl/proto
|
IMPORT_DIRS include/xrpl/proto
|
||||||
PROTOS "${protos}"
|
PROTOS "${protos}"
|
||||||
PLUGIN protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>
|
PLUGIN protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>
|
||||||
GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc
|
GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc)
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_options(xrpl.libpb
|
target_compile_options(
|
||||||
PUBLIC
|
xrpl.libpb
|
||||||
$<$<BOOL:${MSVC}>:-wd4996>
|
PUBLIC $<$<BOOL:${is_msvc}>:-wd4996> $<$<BOOL:${is_xcode}>:
|
||||||
$<$<BOOL:${XCODE}>:
|
--system-header-prefix="google/protobuf" -Wno-deprecated-dynamic-exception-spec >
|
||||||
--system-header-prefix="google/protobuf"
|
PRIVATE $<$<BOOL:${is_msvc}>:-wd4065> $<$<NOT:$<BOOL:${is_msvc}>>:-Wno-deprecated-declarations>)
|
||||||
-Wno-deprecated-dynamic-exception-spec
|
|
||||||
>
|
|
||||||
PRIVATE
|
|
||||||
$<$<BOOL:${MSVC}>:-wd4065>
|
|
||||||
$<$<NOT:$<BOOL:${MSVC}>>:-Wno-deprecated-declarations>
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(xrpl.libpb
|
target_link_libraries(xrpl.libpb PUBLIC protobuf::libprotobuf gRPC::grpc++)
|
||||||
PUBLIC
|
|
||||||
protobuf::libprotobuf
|
|
||||||
gRPC::grpc++
|
|
||||||
)
|
|
||||||
|
|
||||||
# TODO: Clean up the number of library targets later.
|
# TODO: Clean up the number of library targets later.
|
||||||
add_library(xrpl.imports.main INTERFACE)
|
add_library(xrpl.imports.main INTERFACE)
|
||||||
|
|
||||||
target_link_libraries(xrpl.imports.main
|
target_link_libraries(
|
||||||
INTERFACE
|
xrpl.imports.main
|
||||||
absl::random_random
|
INTERFACE absl::random_random
|
||||||
date::date
|
date::date
|
||||||
ed25519::ed25519
|
ed25519::ed25519
|
||||||
LibArchive::LibArchive
|
LibArchive::LibArchive
|
||||||
@@ -65,8 +49,7 @@ target_link_libraries(xrpl.imports.main
|
|||||||
secp256k1::secp256k1
|
secp256k1::secp256k1
|
||||||
xrpl.libpb
|
xrpl.libpb
|
||||||
xxHash::xxhash
|
xxHash::xxhash
|
||||||
$<$<BOOL:${voidstar}>:antithesis-sdk-cpp>
|
$<$<BOOL:${voidstar}>:antithesis-sdk-cpp>)
|
||||||
)
|
|
||||||
|
|
||||||
include(add_module)
|
include(add_module)
|
||||||
include(target_link_modules)
|
include(target_link_modules)
|
||||||
@@ -88,18 +71,12 @@ target_link_libraries(xrpl.libxrpl.crypto PUBLIC xrpl.libxrpl.basics)
|
|||||||
|
|
||||||
# Level 04
|
# Level 04
|
||||||
add_module(xrpl protocol)
|
add_module(xrpl protocol)
|
||||||
target_link_libraries(xrpl.libxrpl.protocol PUBLIC
|
target_link_libraries(xrpl.libxrpl.protocol PUBLIC xrpl.libxrpl.crypto xrpl.libxrpl.json)
|
||||||
xrpl.libxrpl.crypto
|
|
||||||
xrpl.libxrpl.json
|
|
||||||
)
|
|
||||||
|
|
||||||
# Level 05
|
# Level 05
|
||||||
add_module(xrpl core)
|
add_module(xrpl core)
|
||||||
target_link_libraries(xrpl.libxrpl.core PUBLIC
|
target_link_libraries(xrpl.libxrpl.core PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json
|
||||||
xrpl.libxrpl.basics
|
xrpl.libxrpl.protocol)
|
||||||
xrpl.libxrpl.json
|
|
||||||
xrpl.libxrpl.protocol
|
|
||||||
)
|
|
||||||
|
|
||||||
# Level 06
|
# Level 06
|
||||||
add_module(xrpl resource)
|
add_module(xrpl resource)
|
||||||
@@ -107,62 +84,67 @@ target_link_libraries(xrpl.libxrpl.resource PUBLIC xrpl.libxrpl.protocol)
|
|||||||
|
|
||||||
# Level 07
|
# Level 07
|
||||||
add_module(xrpl net)
|
add_module(xrpl net)
|
||||||
target_link_libraries(xrpl.libxrpl.net PUBLIC
|
target_link_libraries(xrpl.libxrpl.net PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json
|
||||||
xrpl.libxrpl.basics
|
xrpl.libxrpl.protocol xrpl.libxrpl.resource)
|
||||||
xrpl.libxrpl.json
|
|
||||||
xrpl.libxrpl.protocol
|
|
||||||
xrpl.libxrpl.resource
|
|
||||||
)
|
|
||||||
|
|
||||||
add_module(xrpl server)
|
|
||||||
target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol)
|
|
||||||
|
|
||||||
add_module(xrpl nodestore)
|
add_module(xrpl nodestore)
|
||||||
target_link_libraries(xrpl.libxrpl.nodestore PUBLIC
|
target_link_libraries(xrpl.libxrpl.nodestore PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json
|
||||||
xrpl.libxrpl.basics
|
xrpl.libxrpl.protocol)
|
||||||
xrpl.libxrpl.json
|
|
||||||
xrpl.libxrpl.protocol
|
|
||||||
)
|
|
||||||
|
|
||||||
add_module(xrpl shamap)
|
add_module(xrpl shamap)
|
||||||
target_link_libraries(xrpl.libxrpl.shamap PUBLIC
|
target_link_libraries(xrpl.libxrpl.shamap PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.crypto
|
||||||
xrpl.libxrpl.basics
|
xrpl.libxrpl.protocol xrpl.libxrpl.nodestore)
|
||||||
xrpl.libxrpl.crypto
|
|
||||||
xrpl.libxrpl.protocol
|
add_module(xrpl rdb)
|
||||||
xrpl.libxrpl.nodestore
|
target_link_libraries(xrpl.libxrpl.rdb PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.core)
|
||||||
)
|
|
||||||
|
add_module(xrpl server)
|
||||||
|
target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol xrpl.libxrpl.core
|
||||||
|
xrpl.libxrpl.rdb xrpl.libxrpl.resource)
|
||||||
|
|
||||||
|
add_module(xrpl conditions)
|
||||||
|
target_link_libraries(xrpl.libxrpl.conditions PUBLIC xrpl.libxrpl.server)
|
||||||
|
|
||||||
add_module(xrpl ledger)
|
add_module(xrpl ledger)
|
||||||
target_link_libraries(xrpl.libxrpl.ledger PUBLIC
|
target_link_libraries(
|
||||||
xrpl.libxrpl.basics
|
xrpl.libxrpl.ledger
|
||||||
|
PUBLIC xrpl.libxrpl.basics
|
||||||
xrpl.libxrpl.json
|
xrpl.libxrpl.json
|
||||||
xrpl.libxrpl.protocol
|
xrpl.libxrpl.protocol
|
||||||
)
|
xrpl.libxrpl.rdb
|
||||||
|
xrpl.libxrpl.server
|
||||||
|
xrpl.libxrpl.shamap
|
||||||
|
xrpl.libxrpl.conditions)
|
||||||
|
|
||||||
|
add_module(xrpl tx)
|
||||||
|
target_link_libraries(xrpl.libxrpl.tx PUBLIC xrpl.libxrpl.ledger)
|
||||||
|
|
||||||
add_library(xrpl.libxrpl)
|
add_library(xrpl.libxrpl)
|
||||||
set_target_properties(xrpl.libxrpl PROPERTIES OUTPUT_NAME xrpl)
|
set_target_properties(xrpl.libxrpl PROPERTIES OUTPUT_NAME xrpl)
|
||||||
|
|
||||||
add_library(xrpl::libxrpl ALIAS xrpl.libxrpl)
|
add_library(xrpl::libxrpl ALIAS xrpl.libxrpl)
|
||||||
|
|
||||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS
|
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/libxrpl/*.cpp")
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/libxrpl/*.cpp"
|
|
||||||
)
|
|
||||||
target_sources(xrpl.libxrpl PRIVATE ${sources})
|
target_sources(xrpl.libxrpl PRIVATE ${sources})
|
||||||
|
|
||||||
target_link_modules(xrpl PUBLIC
|
target_link_modules(
|
||||||
|
xrpl
|
||||||
|
PUBLIC
|
||||||
basics
|
basics
|
||||||
beast
|
beast
|
||||||
|
conditions
|
||||||
core
|
core
|
||||||
crypto
|
crypto
|
||||||
json
|
json
|
||||||
|
ledger
|
||||||
|
net
|
||||||
|
nodestore
|
||||||
protocol
|
protocol
|
||||||
|
rdb
|
||||||
resource
|
resource
|
||||||
server
|
server
|
||||||
nodestore
|
|
||||||
shamap
|
shamap
|
||||||
net
|
tx)
|
||||||
ledger
|
|
||||||
)
|
|
||||||
|
|
||||||
# All headers in libxrpl are in modules.
|
# All headers in libxrpl are in modules.
|
||||||
# Uncomment this stanza if you have not yet moved new headers into a module.
|
# Uncomment this stanza if you have not yet moved new headers into a module.
|
||||||
@@ -177,33 +159,19 @@ if(xrpld)
|
|||||||
add_executable(xrpld)
|
add_executable(xrpld)
|
||||||
if (tests)
|
if (tests)
|
||||||
target_compile_definitions(xrpld PUBLIC ENABLE_TESTS)
|
target_compile_definitions(xrpld PUBLIC ENABLE_TESTS)
|
||||||
target_compile_definitions(xrpld PRIVATE
|
target_compile_definitions(xrpld PRIVATE UNIT_TEST_REFERENCE_FEE=${UNIT_TEST_REFERENCE_FEE})
|
||||||
UNIT_TEST_REFERENCE_FEE=${UNIT_TEST_REFERENCE_FEE}
|
|
||||||
)
|
|
||||||
endif ()
|
endif ()
|
||||||
target_include_directories(xrpld
|
target_include_directories(xrpld PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
|
||||||
PRIVATE
|
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
|
||||||
)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS
|
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/xrpld/*.cpp")
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/xrpld/*.cpp"
|
|
||||||
)
|
|
||||||
target_sources(xrpld PRIVATE ${sources})
|
target_sources(xrpld PRIVATE ${sources})
|
||||||
|
|
||||||
if (tests)
|
if (tests)
|
||||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS
|
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/test/*.cpp")
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/test/*.cpp"
|
|
||||||
)
|
|
||||||
target_sources(xrpld PRIVATE ${sources})
|
target_sources(xrpld PRIVATE ${sources})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_link_libraries(xrpld
|
target_link_libraries(xrpld Xrpl::boost Xrpl::opts Xrpl::libs xrpl.libxrpl)
|
||||||
Xrpl::boost
|
|
||||||
Xrpl::opts
|
|
||||||
Xrpl::libs
|
|
||||||
xrpl.libxrpl
|
|
||||||
)
|
|
||||||
exclude_if_included(xrpld)
|
exclude_if_included(xrpld)
|
||||||
# define a macro for tests that might need to
|
# define a macro for tests that might need to
|
||||||
# be excluded or run differently in CI environment
|
# be excluded or run differently in CI environment
|
||||||
@@ -212,24 +180,9 @@ if(xrpld)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (voidstar)
|
if (voidstar)
|
||||||
target_compile_options(xrpld
|
target_compile_options(xrpld PRIVATE -fsanitize-coverage=trace-pc-guard)
|
||||||
PRIVATE
|
|
||||||
-fsanitize-coverage=trace-pc-guard
|
|
||||||
)
|
|
||||||
# xrpld requires access to antithesis-sdk-cpp implementation file
|
# xrpld requires access to antithesis-sdk-cpp implementation file
|
||||||
# antithesis_instrumentation.h, which is not exported as INTERFACE
|
# antithesis_instrumentation.h, which is not exported as INTERFACE
|
||||||
target_include_directories(xrpld
|
target_include_directories(xrpld PRIVATE ${CMAKE_SOURCE_DIR}/external/antithesis-sdk)
|
||||||
PRIVATE
|
|
||||||
${CMAKE_SOURCE_DIR}/external/antithesis-sdk
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# any files that don't play well with unity should be added here
|
|
||||||
if(tests)
|
|
||||||
set_source_files_properties(
|
|
||||||
# these two seem to produce conflicts in beast teardown template methods
|
|
||||||
src/test/rpc/ValidatorRPC_test.cpp
|
|
||||||
src/test/ledger/Invariants_test.cpp
|
|
||||||
PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
|
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
@@ -16,26 +16,37 @@ ProcessorCount(PROCESSOR_COUNT)
|
|||||||
|
|
||||||
include(CodeCoverage)
|
include(CodeCoverage)
|
||||||
|
|
||||||
# The instructions for these commands come from the `CodeCoverage` module,
|
# The instructions for these commands come from the `CodeCoverage` module, which was copied from
|
||||||
# which was copied from https://github.com/bilke/cmake-modules, commit fb7d2a3,
|
# https://github.com/bilke/cmake-modules, commit fb7d2a3, then locally changed (see CHANGES: section in
|
||||||
# then locally changed (see CHANGES: section in `CodeCoverage.cmake`)
|
# `CodeCoverage.cmake`)
|
||||||
|
|
||||||
set(GCOVR_ADDITIONAL_ARGS ${coverage_extra_args})
|
set(GCOVR_ADDITIONAL_ARGS ${coverage_extra_args})
|
||||||
if (NOT GCOVR_ADDITIONAL_ARGS STREQUAL "")
|
if (NOT GCOVR_ADDITIONAL_ARGS STREQUAL "")
|
||||||
separate_arguments(GCOVR_ADDITIONAL_ARGS)
|
separate_arguments(GCOVR_ADDITIONAL_ARGS)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
list(APPEND GCOVR_ADDITIONAL_ARGS
|
list(APPEND
|
||||||
|
GCOVR_ADDITIONAL_ARGS
|
||||||
--exclude-throw-branches
|
--exclude-throw-branches
|
||||||
--exclude-noncode-lines
|
--exclude-noncode-lines
|
||||||
--exclude-unreachable-branches -s
|
--exclude-unreachable-branches
|
||||||
-j ${PROCESSOR_COUNT})
|
-s
|
||||||
|
-j
|
||||||
|
${PROCESSOR_COUNT})
|
||||||
|
|
||||||
setup_target_for_coverage_gcovr(
|
setup_target_for_coverage_gcovr(
|
||||||
NAME coverage
|
NAME
|
||||||
FORMAT ${coverage_format}
|
coverage
|
||||||
EXCLUDE "src/test" "src/tests" "include/xrpl/beast/test" "include/xrpl/beast/unit_test" "${CMAKE_BINARY_DIR}/pb-xrpl.libpb"
|
FORMAT
|
||||||
DEPENDENCIES xrpld xrpl.tests
|
${coverage_format}
|
||||||
)
|
EXCLUDE
|
||||||
|
"src/test"
|
||||||
|
"src/tests"
|
||||||
|
"include/xrpl/beast/test"
|
||||||
|
"include/xrpl/beast/unit_test"
|
||||||
|
"${CMAKE_BINARY_DIR}/pb-xrpl.libpb"
|
||||||
|
DEPENDENCIES
|
||||||
|
xrpld
|
||||||
|
xrpl.tests)
|
||||||
|
|
||||||
add_code_coverage_to_target(opts INTERFACE)
|
add_code_coverage_to_target(opts INTERFACE)
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ set(doxygen_include_path "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
|||||||
set(doxygen_index_file "${doxygen_output_directory}/html/index.html")
|
set(doxygen_index_file "${doxygen_output_directory}/html/index.html")
|
||||||
set(doxyfile "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile")
|
set(doxyfile "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile")
|
||||||
|
|
||||||
file(GLOB_RECURSE doxygen_input
|
file(GLOB_RECURSE
|
||||||
|
doxygen_input
|
||||||
docs/*.md
|
docs/*.md
|
||||||
include/*.h
|
include/*.h
|
||||||
include/*.cpp
|
include/*.cpp
|
||||||
@@ -27,9 +28,7 @@ file(GLOB_RECURSE doxygen_input
|
|||||||
src/*.md
|
src/*.md
|
||||||
Builds/*.md
|
Builds/*.md
|
||||||
*.md)
|
*.md)
|
||||||
list(APPEND doxygen_input
|
list(APPEND doxygen_input external/README.md)
|
||||||
external/README.md
|
|
||||||
)
|
|
||||||
set(dependencies "${doxygen_input}" "${doxyfile}")
|
set(dependencies "${doxygen_input}" "${doxyfile}")
|
||||||
|
|
||||||
function (verbose_find_path variable name)
|
function (verbose_find_path variable name)
|
||||||
@@ -48,8 +47,7 @@ verbose_find_path(doxygen_dot_path dot)
|
|||||||
# https://en.cppreference.com/w/Cppreference:Archives
|
# https://en.cppreference.com/w/Cppreference:Archives
|
||||||
# https://stackoverflow.com/questions/60822559/how-to-move-a-file-download-from-configure-step-to-build-step
|
# https://stackoverflow.com/questions/60822559/how-to-move-a-file-download-from-configure-step-to-build-step
|
||||||
set(download_script "${CMAKE_BINARY_DIR}/docs/download-cppreference.cmake")
|
set(download_script "${CMAKE_BINARY_DIR}/docs/download-cppreference.cmake")
|
||||||
file(WRITE
|
file(WRITE "${download_script}"
|
||||||
"${download_script}"
|
|
||||||
"file(DOWNLOAD \
|
"file(DOWNLOAD \
|
||||||
https://github.com/PeterFeicht/cppreference-doc/releases/download/v20250209/html-book-20250209.zip \
|
https://github.com/PeterFeicht/cppreference-doc/releases/download/v20250209/html-book-20250209.zip \
|
||||||
${CMAKE_BINARY_DIR}/docs/cppreference.zip \
|
${CMAKE_BINARY_DIR}/docs/cppreference.zip \
|
||||||
@@ -57,27 +55,18 @@ file(WRITE
|
|||||||
)\n \
|
)\n \
|
||||||
execute_process( \
|
execute_process( \
|
||||||
COMMAND \"${CMAKE_COMMAND}\" -E tar -xf cppreference.zip \
|
COMMAND \"${CMAKE_COMMAND}\" -E tar -xf cppreference.zip \
|
||||||
)\n"
|
)\n")
|
||||||
)
|
|
||||||
set(tagfile "${CMAKE_BINARY_DIR}/docs/cppreference-doxygen-web.tag.xml")
|
set(tagfile "${CMAKE_BINARY_DIR}/docs/cppreference-doxygen-web.tag.xml")
|
||||||
add_custom_command(
|
add_custom_command(OUTPUT "${tagfile}" COMMAND "${CMAKE_COMMAND}" -P "${download_script}"
|
||||||
OUTPUT "${tagfile}"
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/docs")
|
||||||
COMMAND "${CMAKE_COMMAND}" -P "${download_script}"
|
|
||||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/docs"
|
|
||||||
)
|
|
||||||
set(doxygen_tagfiles "${tagfile}=http://en.cppreference.com/w/")
|
set(doxygen_tagfiles "${tagfile}=http://en.cppreference.com/w/")
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT "${doxygen_index_file}"
|
OUTPUT "${doxygen_index_file}"
|
||||||
COMMAND "${CMAKE_COMMAND}" -E env
|
COMMAND "${CMAKE_COMMAND}" -E env "DOXYGEN_OUTPUT_DIRECTORY=${doxygen_output_directory}"
|
||||||
"DOXYGEN_OUTPUT_DIRECTORY=${doxygen_output_directory}"
|
"DOXYGEN_INCLUDE_PATH=${doxygen_include_path}" "DOXYGEN_TAGFILES=${doxygen_tagfiles}"
|
||||||
"DOXYGEN_INCLUDE_PATH=${doxygen_include_path}"
|
|
||||||
"DOXYGEN_TAGFILES=${doxygen_tagfiles}"
|
|
||||||
"DOXYGEN_PLANTUML_JAR_PATH=${doxygen_plantuml_jar_path}"
|
"DOXYGEN_PLANTUML_JAR_PATH=${doxygen_plantuml_jar_path}"
|
||||||
"DOXYGEN_DOT_PATH=${doxygen_dot_path}"
|
"DOXYGEN_DOT_PATH=${doxygen_dot_path}" "${DOXYGEN_EXECUTABLE}" "${doxyfile}"
|
||||||
"${DOXYGEN_EXECUTABLE}" "${doxyfile}"
|
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
DEPENDS "${dependencies}" "${tagfile}")
|
DEPENDS "${dependencies}" "${tagfile}")
|
||||||
add_custom_target(docs
|
add_custom_target(docs DEPENDS "${doxygen_index_file}" SOURCES "${dependencies}")
|
||||||
DEPENDS "${doxygen_index_file}"
|
|
||||||
SOURCES "${dependencies}")
|
|
||||||
|
|||||||
@@ -4,9 +4,13 @@
|
|||||||
|
|
||||||
include(create_symbolic_link)
|
include(create_symbolic_link)
|
||||||
|
|
||||||
install (
|
# If no suffix is defined for executables (e.g. Windows uses .exe but Linux
|
||||||
TARGETS
|
# and macOS use none), then explicitly set it to the empty string.
|
||||||
common
|
if (NOT DEFINED suffix)
|
||||||
|
set(suffix "")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
install(TARGETS common
|
||||||
opts
|
opts
|
||||||
xrpl_boost
|
xrpl_boost
|
||||||
xrpl_libs
|
xrpl_libs
|
||||||
@@ -16,9 +20,11 @@ install (
|
|||||||
xrpl.libxrpl
|
xrpl.libxrpl
|
||||||
xrpl.libxrpl.basics
|
xrpl.libxrpl.basics
|
||||||
xrpl.libxrpl.beast
|
xrpl.libxrpl.beast
|
||||||
|
xrpl.libxrpl.conditions
|
||||||
xrpl.libxrpl.core
|
xrpl.libxrpl.core
|
||||||
xrpl.libxrpl.crypto
|
xrpl.libxrpl.crypto
|
||||||
xrpl.libxrpl.json
|
xrpl.libxrpl.json
|
||||||
|
xrpl.libxrpl.rdb
|
||||||
xrpl.libxrpl.ledger
|
xrpl.libxrpl.ledger
|
||||||
xrpl.libxrpl.net
|
xrpl.libxrpl.net
|
||||||
xrpl.libxrpl.nodestore
|
xrpl.libxrpl.nodestore
|
||||||
@@ -26,26 +32,21 @@ install (
|
|||||||
xrpl.libxrpl.resource
|
xrpl.libxrpl.resource
|
||||||
xrpl.libxrpl.server
|
xrpl.libxrpl.server
|
||||||
xrpl.libxrpl.shamap
|
xrpl.libxrpl.shamap
|
||||||
|
xrpl.libxrpl.tx
|
||||||
antithesis-sdk-cpp
|
antithesis-sdk-cpp
|
||||||
EXPORT XrplExports
|
EXPORT XrplExports
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION lib
|
||||||
ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION lib
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
INCLUDES DESTINATION include)
|
INCLUDES
|
||||||
|
DESTINATION include)
|
||||||
|
|
||||||
install(
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/xrpl"
|
||||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/xrpl"
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
install (EXPORT XrplExports
|
install(EXPORT XrplExports FILE XrplTargets.cmake NAMESPACE Xrpl:: DESTINATION lib/cmake/xrpl)
|
||||||
FILE XrplTargets.cmake
|
|
||||||
NAMESPACE Xrpl::
|
|
||||||
DESTINATION lib/cmake/xrpl)
|
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
write_basic_package_version_file (
|
write_basic_package_version_file(XrplConfigVersion.cmake VERSION ${xrpld_version}
|
||||||
XrplConfigVersion.cmake
|
|
||||||
VERSION ${xrpld_version}
|
|
||||||
COMPATIBILITY SameMajorVersion)
|
COMPATIBILITY SameMajorVersion)
|
||||||
|
|
||||||
if (is_root_project AND TARGET xrpld)
|
if (is_root_project AND TARGET xrpld)
|
||||||
@@ -73,8 +74,5 @@ if (is_root_project AND TARGET xrpld)
|
|||||||
")
|
")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
install (
|
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/XrplConfig.cmake
|
||||||
FILES
|
${CMAKE_CURRENT_BINARY_DIR}/XrplConfigVersion.cmake DESTINATION lib/cmake/xrpl)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/XrplConfig.cmake
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/XrplConfigVersion.cmake
|
|
||||||
DESTINATION lib/cmake/xrpl)
|
|
||||||
|
|||||||
@@ -4,11 +4,16 @@
|
|||||||
|
|
||||||
include(CompilationEnv)
|
include(CompilationEnv)
|
||||||
|
|
||||||
|
# Set defaults for optional variables to avoid uninitialized variable warnings
|
||||||
|
if (NOT DEFINED voidstar)
|
||||||
|
set(voidstar OFF)
|
||||||
|
endif ()
|
||||||
|
|
||||||
add_library(opts INTERFACE)
|
add_library(opts INTERFACE)
|
||||||
add_library(Xrpl::opts ALIAS opts)
|
add_library(Xrpl::opts ALIAS opts)
|
||||||
target_compile_definitions (opts
|
target_compile_definitions(
|
||||||
INTERFACE
|
opts
|
||||||
BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS
|
INTERFACE BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS
|
||||||
BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT
|
BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT
|
||||||
BOOST_CONTAINER_FWD_BAD_DEQUE
|
BOOST_CONTAINER_FWD_BAD_DEQUE
|
||||||
HAS_UNCAUGHT_EXCEPTIONS=1
|
HAS_UNCAUGHT_EXCEPTIONS=1
|
||||||
@@ -25,17 +30,15 @@ target_compile_definitions (opts
|
|||||||
$<$<BOOL:${beast_disable_autolink}>:BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES=1>
|
$<$<BOOL:${beast_disable_autolink}>:BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES=1>
|
||||||
$<$<BOOL:${single_io_service_thread}>:XRPL_SINGLE_IO_SERVICE_THREAD=1>
|
$<$<BOOL:${single_io_service_thread}>:XRPL_SINGLE_IO_SERVICE_THREAD=1>
|
||||||
$<$<BOOL:${voidstar}>:ENABLE_VOIDSTAR>)
|
$<$<BOOL:${voidstar}>:ENABLE_VOIDSTAR>)
|
||||||
target_compile_options (opts
|
target_compile_options(
|
||||||
INTERFACE
|
opts
|
||||||
$<$<AND:$<BOOL:${is_gcc}>,$<COMPILE_LANGUAGE:CXX>>:-Wsuggest-override>
|
INTERFACE $<$<AND:$<BOOL:${is_gcc}>,$<COMPILE_LANGUAGE:CXX>>:-Wsuggest-override>
|
||||||
$<$<BOOL:${is_gcc}>:-Wno-maybe-uninitialized>
|
$<$<BOOL:${is_gcc}>:-Wno-maybe-uninitialized>
|
||||||
$<$<BOOL:${perf}>:-fno-omit-frame-pointer>
|
$<$<BOOL:${perf}>:-fno-omit-frame-pointer>
|
||||||
$<$<BOOL:${profile}>:-pg>
|
$<$<BOOL:${profile}>:-pg>
|
||||||
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${profile}>>:-p>)
|
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${profile}>>:-p>)
|
||||||
|
|
||||||
target_link_libraries (opts
|
target_link_libraries(opts INTERFACE $<$<BOOL:${profile}>:-pg>
|
||||||
INTERFACE
|
|
||||||
$<$<BOOL:${profile}>:-pg>
|
|
||||||
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${profile}>>:-p>)
|
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${profile}>>:-p>)
|
||||||
|
|
||||||
if (jemalloc)
|
if (jemalloc)
|
||||||
@@ -50,9 +53,9 @@ endif ()
|
|||||||
|
|
||||||
add_library(xrpl_syslibs INTERFACE)
|
add_library(xrpl_syslibs INTERFACE)
|
||||||
add_library(Xrpl::syslibs ALIAS xrpl_syslibs)
|
add_library(Xrpl::syslibs ALIAS xrpl_syslibs)
|
||||||
target_link_libraries (xrpl_syslibs
|
target_link_libraries(
|
||||||
INTERFACE
|
xrpl_syslibs
|
||||||
$<$<BOOL:${MSVC}>:
|
INTERFACE $<$<BOOL:${is_msvc}>:
|
||||||
legacy_stdio_definitions.lib
|
legacy_stdio_definitions.lib
|
||||||
Shlwapi
|
Shlwapi
|
||||||
kernel32
|
kernel32
|
||||||
@@ -69,10 +72,10 @@ target_link_libraries (xrpl_syslibs
|
|||||||
odbccp32
|
odbccp32
|
||||||
crypt32
|
crypt32
|
||||||
>
|
>
|
||||||
$<$<NOT:$<BOOL:${MSVC}>>:dl>
|
$<$<NOT:$<BOOL:${is_msvc}>>:dl>
|
||||||
$<$<NOT:$<OR:$<BOOL:${MSVC}>,$<BOOL:${APPLE}>>>:rt>)
|
$<$<NOT:$<OR:$<BOOL:${is_msvc}>,$<BOOL:${is_macos}>>>:rt>)
|
||||||
|
|
||||||
if (NOT MSVC)
|
if (NOT is_msvc)
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
target_link_libraries(xrpl_syslibs INTERFACE Threads::Threads)
|
target_link_libraries(xrpl_syslibs INTERFACE Threads::Threads)
|
||||||
|
|||||||
@@ -43,7 +43,10 @@
|
|||||||
include(CompilationEnv)
|
include(CompilationEnv)
|
||||||
|
|
||||||
# Read environment variable
|
# Read environment variable
|
||||||
set(SANITIZERS $ENV{SANITIZERS})
|
set(SANITIZERS "")
|
||||||
|
if (DEFINED ENV{SANITIZERS})
|
||||||
|
set(SANITIZERS "$ENV{SANITIZERS}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
# Set SANITIZERS_ENABLED flag for use in other modules
|
# Set SANITIZERS_ENABLED flag for use in other modules
|
||||||
if (SANITIZERS MATCHES "address|thread|undefinedbehavior")
|
if (SANITIZERS MATCHES "address|thread|undefinedbehavior")
|
||||||
@@ -106,21 +109,21 @@ if(enable_ubsan)
|
|||||||
# UB sanitizer flags
|
# UB sanitizer flags
|
||||||
list(APPEND SANITIZER_TYPES "undefined" "float-divide-by-zero")
|
list(APPEND SANITIZER_TYPES "undefined" "float-divide-by-zero")
|
||||||
if (is_clang)
|
if (is_clang)
|
||||||
# Clang supports additional UB checks. More info here https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
|
# Clang supports additional UB checks. More info here
|
||||||
|
# https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
|
||||||
list(APPEND SANITIZER_TYPES "unsigned-integer-overflow")
|
list(APPEND SANITIZER_TYPES "unsigned-integer-overflow")
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Configure code model for GCC on amd64
|
# Configure code model for GCC on amd64 Use large code model for ASAN to avoid relocation errors Use medium code model
|
||||||
# Use large code model for ASAN to avoid relocation errors
|
# for TSAN (large is not compatible with TSAN)
|
||||||
# Use medium code model for TSAN (large is not compatible with TSAN)
|
|
||||||
set(SANITIZERS_RELOCATION_FLAGS)
|
set(SANITIZERS_RELOCATION_FLAGS)
|
||||||
|
|
||||||
# Compiler-specific configuration
|
# Compiler-specific configuration
|
||||||
if (is_gcc)
|
if (is_gcc)
|
||||||
# Disable mold, gold and lld linkers for GCC with sanitizers
|
# Disable mold, gold and lld linkers for GCC with sanitizers Use default linker (bfd/ld) which is more lenient with
|
||||||
# Use default linker (bfd/ld) which is more lenient with mixed code models
|
# mixed code models This is needed since the size of instrumented binary exceeds the limits set by mold, lld and
|
||||||
# This is needed since the size of instrumented binary exceeds the limits set by mold, lld and gold linkers
|
# gold linkers
|
||||||
set(use_mold OFF CACHE BOOL "Use mold linker" FORCE)
|
set(use_mold OFF CACHE BOOL "Use mold linker" FORCE)
|
||||||
set(use_gold OFF CACHE BOOL "Use gold linker" FORCE)
|
set(use_gold OFF CACHE BOOL "Use gold linker" FORCE)
|
||||||
set(use_lld OFF CACHE BOOL "Use lld linker" FORCE)
|
set(use_lld OFF CACHE BOOL "Use lld linker" FORCE)
|
||||||
@@ -149,8 +152,7 @@ if(is_gcc)
|
|||||||
set(SANITIZERS_LINK_FLAGS "${SANITIZERS_RELOCATION_FLAGS}" "-fsanitize=${SANITIZER_TYPES_STR}")
|
set(SANITIZERS_LINK_FLAGS "${SANITIZERS_RELOCATION_FLAGS}" "-fsanitize=${SANITIZER_TYPES_STR}")
|
||||||
|
|
||||||
elseif (is_clang)
|
elseif (is_clang)
|
||||||
# Add ignorelist for Clang (GCC doesn't support this)
|
# Add ignorelist for Clang (GCC doesn't support this) Use CMAKE_SOURCE_DIR to get the path to the ignorelist
|
||||||
# Use CMAKE_SOURCE_DIR to get the path to the ignorelist
|
|
||||||
set(IGNORELIST_PATH "${CMAKE_SOURCE_DIR}/sanitizers/suppressions/sanitizer-ignorelist.txt")
|
set(IGNORELIST_PATH "${CMAKE_SOURCE_DIR}/sanitizers/suppressions/sanitizer-ignorelist.txt")
|
||||||
if (NOT EXISTS "${IGNORELIST_PATH}")
|
if (NOT EXISTS "${IGNORELIST_PATH}")
|
||||||
message(FATAL_ERROR "Sanitizer ignorelist not found: ${IGNORELIST_PATH}")
|
message(FATAL_ERROR "Sanitizer ignorelist not found: ${IGNORELIST_PATH}")
|
||||||
@@ -170,12 +172,9 @@ endif()
|
|||||||
message(STATUS " Compile flags: ${SANITIZERS_COMPILE_FLAGS}")
|
message(STATUS " Compile flags: ${SANITIZERS_COMPILE_FLAGS}")
|
||||||
message(STATUS " Link flags: ${SANITIZERS_LINK_FLAGS}")
|
message(STATUS " Link flags: ${SANITIZERS_LINK_FLAGS}")
|
||||||
|
|
||||||
# Apply the sanitizer flags to the 'common' interface library
|
# Apply the sanitizer flags to the 'common' interface library This is the same library used by XrplCompiler.cmake
|
||||||
# This is the same library used by XrplCompiler.cmake
|
target_compile_options(common INTERFACE $<$<COMPILE_LANGUAGE:CXX>:${SANITIZERS_COMPILE_FLAGS}>
|
||||||
target_compile_options(common INTERFACE
|
$<$<COMPILE_LANGUAGE:C>:${SANITIZERS_COMPILE_FLAGS}>)
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${SANITIZERS_COMPILE_FLAGS}>
|
|
||||||
$<$<COMPILE_LANGUAGE:C>:${SANITIZERS_COMPILE_FLAGS}>
|
|
||||||
)
|
|
||||||
|
|
||||||
# Apply linker flags
|
# Apply linker flags
|
||||||
target_link_options(common INTERFACE ${SANITIZERS_LINK_FLAGS})
|
target_link_options(common INTERFACE ${SANITIZERS_LINK_FLAGS})
|
||||||
|
|||||||
@@ -12,15 +12,15 @@ if (NOT is_multiconfig)
|
|||||||
message(STATUS "Build type not specified - defaulting to Release")
|
message(STATUS "Build type not specified - defaulting to Release")
|
||||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "build type" FORCE)
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "build type" FORCE)
|
||||||
elseif (NOT (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL Release))
|
elseif (NOT (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL Release))
|
||||||
# for simplicity, these are the only two config types we care about. Limiting
|
# for simplicity, these are the only two config types we care about. Limiting the build types simplifies dealing
|
||||||
# the build types simplifies dealing with external project builds especially
|
# with external project builds especially
|
||||||
message(FATAL_ERROR " *** Only Debug or Release build types are currently supported ***")
|
message(FATAL_ERROR " *** Only Debug or Release build types are currently supported ***")
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (is_clang) # both Clang and AppleClang
|
if (is_clang) # both Clang and AppleClang
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS
|
||||||
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
|
16.0)
|
||||||
message(FATAL_ERROR "This project requires clang 16 or later")
|
message(FATAL_ERROR "This project requires clang 16 or later")
|
||||||
endif ()
|
endif ()
|
||||||
elseif (is_gcc)
|
elseif (is_gcc)
|
||||||
@@ -33,7 +33,8 @@ endif ()
|
|||||||
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
||||||
message(FATAL_ERROR "Builds (in-source) are not allowed in "
|
message(FATAL_ERROR "Builds (in-source) are not allowed in "
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}. Please remove CMakeCache.txt and the CMakeFiles "
|
"${CMAKE_CURRENT_SOURCE_DIR}. Please remove CMakeCache.txt and the CMakeFiles "
|
||||||
"directory from ${CMAKE_CURRENT_SOURCE_DIR} and try building in a separate directory.")
|
"directory from ${CMAKE_CURRENT_SOURCE_DIR} and try building in a separate directory."
|
||||||
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (MSVC AND CMAKE_GENERATOR_PLATFORM STREQUAL "Win32")
|
if (MSVC AND CMAKE_GENERATOR_PLATFORM STREQUAL "Win32")
|
||||||
|
|||||||
@@ -4,10 +4,11 @@
|
|||||||
|
|
||||||
include(CompilationEnv)
|
include(CompilationEnv)
|
||||||
|
|
||||||
if("$ENV{CI}" STREQUAL "true" OR "$ENV{CONTINUOUS_INTEGRATION}" STREQUAL "true")
|
|
||||||
set(is_ci TRUE)
|
|
||||||
else()
|
|
||||||
set(is_ci FALSE)
|
set(is_ci FALSE)
|
||||||
|
if (DEFINED ENV{CI})
|
||||||
|
if ("$ENV{CI}" STREQUAL "true")
|
||||||
|
set(is_ci TRUE)
|
||||||
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
get_directory_property(has_parent PARENT_DIRECTORY)
|
get_directory_property(has_parent PARENT_DIRECTORY)
|
||||||
@@ -47,10 +48,8 @@ if(is_gcc OR is_clang)
|
|||||||
|
|
||||||
option(coverage "Generates coverage info." OFF)
|
option(coverage "Generates coverage info." OFF)
|
||||||
option(profile "Add profiling flags" OFF)
|
option(profile "Add profiling flags" OFF)
|
||||||
set(coverage_format "html-details" CACHE STRING
|
set(coverage_format "html-details" CACHE STRING "Output format of the coverage report.")
|
||||||
"Output format of the coverage report.")
|
set(coverage_extra_args "" CACHE STRING "Additional arguments to pass to gcovr.")
|
||||||
set(coverage_extra_args "" CACHE STRING
|
|
||||||
"Additional arguments to pass to gcovr.")
|
|
||||||
option(wextra "compile with extra gcc/clang warnings enabled" ON)
|
option(wextra "compile with extra gcc/clang warnings enabled" ON)
|
||||||
else ()
|
else ()
|
||||||
set(profile OFF CACHE BOOL "gcc/clang only" FORCE)
|
set(profile OFF CACHE BOOL "gcc/clang only" FORCE)
|
||||||
@@ -64,25 +63,21 @@ if(is_linux AND NOT SANITIZER)
|
|||||||
option(perf "Enables flags that assist with perf recording" OFF)
|
option(perf "Enables flags that assist with perf recording" OFF)
|
||||||
option(use_gold "enables detection of gold (binutils) linker" ON)
|
option(use_gold "enables detection of gold (binutils) linker" ON)
|
||||||
option(use_mold "enables detection of mold (binutils) linker" ON)
|
option(use_mold "enables detection of mold (binutils) linker" ON)
|
||||||
# Set a default value for the log flag based on the build type.
|
# Set a default value for the log flag based on the build type. This provides a sensible default (on for debug, off
|
||||||
# This provides a sensible default (on for debug, off for release)
|
# for release) while still allowing the user to override it for any build.
|
||||||
# while still allowing the user to override it for any build.
|
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
set(TRUNCATED_LOGS_DEFAULT ON)
|
set(TRUNCATED_LOGS_DEFAULT ON)
|
||||||
else ()
|
else ()
|
||||||
set(TRUNCATED_LOGS_DEFAULT OFF)
|
set(TRUNCATED_LOGS_DEFAULT OFF)
|
||||||
endif ()
|
endif ()
|
||||||
option(TRUNCATED_THREAD_NAME_LOGS
|
option(TRUNCATED_THREAD_NAME_LOGS "Show warnings about truncated thread names on Linux."
|
||||||
"Show warnings about truncated thread names on Linux."
|
${TRUNCATED_LOGS_DEFAULT})
|
||||||
${TRUNCATED_LOGS_DEFAULT}
|
|
||||||
)
|
|
||||||
if (TRUNCATED_THREAD_NAME_LOGS)
|
if (TRUNCATED_THREAD_NAME_LOGS)
|
||||||
add_compile_definitions(TRUNCATED_THREAD_NAME_LOGS)
|
add_compile_definitions(TRUNCATED_THREAD_NAME_LOGS)
|
||||||
endif ()
|
endif ()
|
||||||
else ()
|
else ()
|
||||||
# we are not ready to allow shared-libs on windows because it would require
|
# we are not ready to allow shared-libs on windows because it would require export declarations. On macos it's more
|
||||||
# export declarations. On macos it's more feasible, but static openssl
|
# feasible, but static openssl produces odd linker errors, thus we disable shared lib builds for now.
|
||||||
# produces odd linker errors, thus we disable shared lib builds for now.
|
|
||||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "build shared xrpl libraries - OFF for win/macos" FORCE)
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "build shared xrpl libraries - OFF for win/macos" FORCE)
|
||||||
set(static ON CACHE BOOL "static link, linux only. ON for WIN/macos" FORCE)
|
set(static ON CACHE BOOL "static link, linux only. ON for WIN/macos" FORCE)
|
||||||
set(perf OFF CACHE BOOL "perf flags, linux only" FORCE)
|
set(perf OFF CACHE BOOL "perf flags, linux only" FORCE)
|
||||||
@@ -100,21 +95,15 @@ option(jemalloc "Enables jemalloc for heap profiling" OFF)
|
|||||||
option(werr "treat warnings as errors" OFF)
|
option(werr "treat warnings as errors" OFF)
|
||||||
option(local_protobuf
|
option(local_protobuf
|
||||||
"Force a local build of protobuf instead of looking for an installed version." OFF)
|
"Force a local build of protobuf instead of looking for an installed version." OFF)
|
||||||
option(local_grpc
|
option(local_grpc "Force a local build of gRPC instead of looking for an installed version." OFF)
|
||||||
"Force a local build of gRPC instead of looking for an installed version." OFF)
|
|
||||||
|
|
||||||
# the remaining options are obscure and rarely used
|
# the remaining options are obscure and rarely used
|
||||||
option(beast_no_unit_test_inline
|
option(beast_no_unit_test_inline
|
||||||
"Prevents unit test definitions from being inserted into global table"
|
"Prevents unit test definitions from being inserted into global table" OFF)
|
||||||
OFF)
|
option(single_io_service_thread "Restricts the number of threads calling io_context::run to one. \
|
||||||
option(single_io_service_thread
|
This can be useful when debugging." OFF)
|
||||||
"Restricts the number of threads calling io_context::run to one. \
|
option(boost_show_deprecated "Allow boost to fail on deprecated usage. Only useful if you're trying\
|
||||||
This can be useful when debugging."
|
to find deprecated calls." OFF)
|
||||||
OFF)
|
|
||||||
option(boost_show_deprecated
|
|
||||||
"Allow boost to fail on deprecated usage. Only useful if you're trying\
|
|
||||||
to find deprecated calls."
|
|
||||||
OFF)
|
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
option(beast_disable_autolink "Disables autolinking of system libraries on WIN32" OFF)
|
option(beast_disable_autolink "Disables autolinking of system libraries on WIN32" OFF)
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
option (validator_keys "Enables building of validator-keys tool as a separate target (imported via FetchContent)" OFF)
|
option(validator_keys
|
||||||
|
"Enables building of validator-keys tool as a separate target (imported via FetchContent)"
|
||||||
|
OFF)
|
||||||
|
|
||||||
if (validator_keys)
|
if (validator_keys)
|
||||||
git_branch(current_branch)
|
git_branch(current_branch)
|
||||||
@@ -9,10 +11,8 @@ if (validator_keys)
|
|||||||
message(STATUS "Tracking ValidatorKeys branch: ${current_branch}")
|
message(STATUS "Tracking ValidatorKeys branch: ${current_branch}")
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
validator_keys
|
validator_keys GIT_REPOSITORY https://github.com/ripple/validator-keys-tool.git
|
||||||
GIT_REPOSITORY https://github.com/ripple/validator-keys-tool.git
|
GIT_TAG "${current_branch}")
|
||||||
GIT_TAG "${current_branch}"
|
|
||||||
)
|
|
||||||
FetchContent_MakeAvailable(validator_keys)
|
FetchContent_MakeAvailable(validator_keys)
|
||||||
set_target_properties(validator-keys PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
|
set_target_properties(validator-keys PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||||
install(TARGETS validator-keys RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS validator-keys RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
|||||||
@@ -16,22 +16,11 @@ function(add_module parent name)
|
|||||||
set(target ${PROJECT_NAME}.lib${parent}.${name})
|
set(target ${PROJECT_NAME}.lib${parent}.${name})
|
||||||
add_library(${target} OBJECT)
|
add_library(${target} OBJECT)
|
||||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS
|
file(GLOB_RECURSE sources CONFIGURE_DEPENDS
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}/*.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}/*.cpp")
|
||||||
)
|
|
||||||
target_sources(${target} PRIVATE ${sources})
|
target_sources(${target} PRIVATE ${sources})
|
||||||
target_include_directories(${target} PUBLIC
|
target_include_directories(${target} PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
|
||||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
isolate_headers(${target} "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||||
)
|
"${CMAKE_CURRENT_SOURCE_DIR}/include/${parent}/${name}" PUBLIC)
|
||||||
isolate_headers(
|
isolate_headers(${target} "${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||||
${target}
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}" PRIVATE)
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/${parent}/${name}"
|
|
||||||
PUBLIC
|
|
||||||
)
|
|
||||||
isolate_headers(
|
|
||||||
${target}
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}"
|
|
||||||
PRIVATE
|
|
||||||
)
|
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# file(CREATE_SYMLINK) only works on Windows with administrator privileges.
|
# file(CREATE_SYMLINK) only works on Windows with administrator privileges. https://stackoverflow.com/a/61244115/618906
|
||||||
# https://stackoverflow.com/a/61244115/618906
|
|
||||||
function (create_symbolic_link target link)
|
function (create_symbolic_link target link)
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
if (NOT IS_SYMLINK "${link}")
|
if (NOT IS_SYMLINK "${link}")
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ include(CompilationEnv)
|
|||||||
include(XrplSanitizers)
|
include(XrplSanitizers)
|
||||||
|
|
||||||
find_package(Boost REQUIRED
|
find_package(Boost REQUIRED
|
||||||
COMPONENTS
|
COMPONENTS chrono
|
||||||
chrono
|
|
||||||
container
|
container
|
||||||
coroutine
|
coroutine
|
||||||
date_time
|
date_time
|
||||||
@@ -12,15 +11,14 @@ find_package(Boost REQUIRED
|
|||||||
program_options
|
program_options
|
||||||
regex
|
regex
|
||||||
system
|
system
|
||||||
thread
|
thread)
|
||||||
)
|
|
||||||
|
|
||||||
add_library(xrpl_boost INTERFACE)
|
add_library(xrpl_boost INTERFACE)
|
||||||
add_library(Xrpl::boost ALIAS xrpl_boost)
|
add_library(Xrpl::boost ALIAS xrpl_boost)
|
||||||
|
|
||||||
target_link_libraries(xrpl_boost
|
target_link_libraries(
|
||||||
INTERFACE
|
xrpl_boost
|
||||||
Boost::headers
|
INTERFACE Boost::headers
|
||||||
Boost::chrono
|
Boost::chrono
|
||||||
Boost::container
|
Boost::container
|
||||||
Boost::coroutine
|
Boost::coroutine
|
||||||
@@ -30,21 +28,18 @@ target_link_libraries(xrpl_boost
|
|||||||
Boost::process
|
Boost::process
|
||||||
Boost::program_options
|
Boost::program_options
|
||||||
Boost::regex
|
Boost::regex
|
||||||
Boost::system
|
|
||||||
Boost::thread)
|
Boost::thread)
|
||||||
if (Boost_COMPILER)
|
if (Boost_COMPILER)
|
||||||
target_link_libraries(xrpl_boost INTERFACE Boost::disable_autolinking)
|
target_link_libraries(xrpl_boost INTERFACE Boost::disable_autolinking)
|
||||||
endif ()
|
endif ()
|
||||||
if (SANITIZERS_ENABLED AND is_clang)
|
if (SANITIZERS_ENABLED AND is_clang)
|
||||||
# TODO: gcc does not support -fsanitize-blacklist...can we do something else
|
# TODO: gcc does not support -fsanitize-blacklist...can we do something else for gcc ?
|
||||||
# for gcc ?
|
|
||||||
if (NOT Boost_INCLUDE_DIRS AND TARGET Boost::headers)
|
if (NOT Boost_INCLUDE_DIRS AND TARGET Boost::headers)
|
||||||
get_target_property(Boost_INCLUDE_DIRS Boost::headers INTERFACE_INCLUDE_DIRECTORIES)
|
get_target_property(Boost_INCLUDE_DIRS Boost::headers INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
endif ()
|
endif ()
|
||||||
message(STATUS "Adding [${Boost_INCLUDE_DIRS}] to sanitizer blacklist")
|
message(STATUS "Adding [${Boost_INCLUDE_DIRS}] to sanitizer blacklist")
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt "src:${Boost_INCLUDE_DIRS}/*")
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt "src:${Boost_INCLUDE_DIRS}/*")
|
||||||
target_compile_options(opts
|
target_compile_options(
|
||||||
INTERFACE
|
opts INTERFACE # ignore boost headers for sanitizing
|
||||||
# ignore boost headers for sanitizing
|
|
||||||
-fsanitize-blacklist=${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt)
|
-fsanitize-blacklist=${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt)
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
@@ -39,24 +39,16 @@ function(target_protobuf_sources target prefix)
|
|||||||
set(dir "${CMAKE_CURRENT_BINARY_DIR}/pb-${target}")
|
set(dir "${CMAKE_CURRENT_BINARY_DIR}/pb-${target}")
|
||||||
file(MAKE_DIRECTORY "${dir}/${prefix}")
|
file(MAKE_DIRECTORY "${dir}/${prefix}")
|
||||||
|
|
||||||
protobuf_generate(
|
protobuf_generate(TARGET ${target} PROTOC_OUT_DIR "${dir}/${prefix}" "${ARGN}")
|
||||||
TARGET ${target}
|
target_include_directories(
|
||||||
PROTOC_OUT_DIR "${dir}/${prefix}"
|
${target} SYSTEM
|
||||||
"${ARGN}"
|
PUBLIC # Allows #include <package/path/to/file.proto> used by consumer files.
|
||||||
)
|
|
||||||
target_include_directories(${target} SYSTEM PUBLIC
|
|
||||||
# Allows #include <package/path/to/file.proto> used by consumer files.
|
|
||||||
$<BUILD_INTERFACE:${dir}>
|
$<BUILD_INTERFACE:${dir}>
|
||||||
# Allows #include "path/to/file.proto" used by generated files.
|
# Allows #include "path/to/file.proto" used by generated files.
|
||||||
$<BUILD_INTERFACE:${dir}/${prefix}>
|
$<BUILD_INTERFACE:${dir}/${prefix}>
|
||||||
# Allows #include <package/path/to/file.proto> used by consumer files.
|
# Allows #include <package/path/to/file.proto> used by consumer files.
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
# Allows #include "path/to/file.proto" used by generated files.
|
# Allows #include "path/to/file.proto" used by generated files.
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${prefix}>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${prefix}>)
|
||||||
)
|
install(DIRECTORY ${dir}/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h")
|
||||||
install(
|
|
||||||
DIRECTORY ${dir}/
|
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
||||||
FILES_MATCHING PATTERN "*.h"
|
|
||||||
)
|
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|||||||
20
conan.lock
20
conan.lock
@@ -6,12 +6,12 @@
|
|||||||
"sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1765850149.926",
|
"sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1765850149.926",
|
||||||
"soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1765850149.46",
|
"soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1765850149.46",
|
||||||
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1765850147.878",
|
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1765850147.878",
|
||||||
"secp256k1/0.7.0#9c4ab67bdc3860c16ea5b36aed8f74ea%1765850147.928",
|
"secp256k1/0.7.1#3a61e95e220062ef32c48d019e9c81f7%1770306721.686",
|
||||||
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1765850186.86",
|
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1765850186.86",
|
||||||
"re2/20230301#ca3b241baec15bd31ea9187150e0b333%1765850148.103",
|
"re2/20230301#ca3b241baec15bd31ea9187150e0b333%1765850148.103",
|
||||||
"protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1765850161.038",
|
"protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1765850161.038",
|
||||||
"openssl/3.5.4#1b986e61b38fdfda3b40bebc1b234393%1768312656.257",
|
"openssl/3.5.5#05a4ac5b7323f7a329b2db1391d9941f%1769599205.414",
|
||||||
"nudb/2.0.9#fb8dfd1a5557f5e0528114c2da17721e%1765850143.957",
|
"nudb/2.0.9#0432758a24204da08fee953ec9ea03cb%1769436073.32",
|
||||||
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1765850143.914",
|
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1765850143.914",
|
||||||
"libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1765842973.492",
|
"libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1765842973.492",
|
||||||
"libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1765842973.03",
|
"libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1765842973.03",
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
"date/3.0.4#862e11e80030356b53c2c38599ceb32b%1765850143.772",
|
"date/3.0.4#862e11e80030356b53c2c38599ceb32b%1765850143.772",
|
||||||
"c-ares/1.34.5#5581c2b62a608b40bb85d965ab3ec7c8%1765850144.336",
|
"c-ares/1.34.5#5581c2b62a608b40bb85d965ab3ec7c8%1765850144.336",
|
||||||
"bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1765850143.837",
|
"bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1765850143.837",
|
||||||
"boost/1.88.0#8852c0b72ce8271fb8ff7c53456d4983%1765850172.862",
|
"boost/1.90.0#d5e8defe7355494953be18524a7f135b%1769454080.269",
|
||||||
"abseil/20250127.0#99262a368bd01c0ccca8790dfced9719%1766517936.993"
|
"abseil/20250127.0#99262a368bd01c0ccca8790dfced9719%1766517936.993"
|
||||||
],
|
],
|
||||||
"build_requires": [
|
"build_requires": [
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
"strawberryperl/5.32.1.1#707032463aa0620fa17ec0d887f5fe41%1765850165.196",
|
"strawberryperl/5.32.1.1#707032463aa0620fa17ec0d887f5fe41%1765850165.196",
|
||||||
"protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1765850161.038",
|
"protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1765850161.038",
|
||||||
"nasm/2.16.01#31e26f2ee3c4346ecd347911bd126904%1765850144.707",
|
"nasm/2.16.01#31e26f2ee3c4346ecd347911bd126904%1765850144.707",
|
||||||
"msys2/cci.latest#1996656c3c98e5765b25b60ff5cf77b4%1764840888.758",
|
"msys2/cci.latest#eea83308ad7e9023f7318c60d5a9e6cb%1770199879.083",
|
||||||
"m4/1.4.19#70dc8bbb33e981d119d2acc0175cf381%1763158052.846",
|
"m4/1.4.19#70dc8bbb33e981d119d2acc0175cf381%1763158052.846",
|
||||||
"cmake/4.2.0#ae0a44f44a1ef9ab68fd4b3e9a1f8671%1765850153.937",
|
"cmake/4.2.0#ae0a44f44a1ef9ab68fd4b3e9a1f8671%1765850153.937",
|
||||||
"cmake/3.31.10#313d16a1aa16bbdb2ca0792467214b76%1765850153.479",
|
"cmake/3.31.10#313d16a1aa16bbdb2ca0792467214b76%1765850153.479",
|
||||||
@@ -42,18 +42,22 @@
|
|||||||
],
|
],
|
||||||
"python_requires": [],
|
"python_requires": [],
|
||||||
"overrides": {
|
"overrides": {
|
||||||
|
"boost/1.90.0#d5e8defe7355494953be18524a7f135b": [
|
||||||
|
null,
|
||||||
|
"boost/1.90.0"
|
||||||
|
],
|
||||||
"protobuf/5.27.0": [
|
"protobuf/5.27.0": [
|
||||||
"protobuf/6.32.1"
|
"protobuf/6.32.1"
|
||||||
],
|
],
|
||||||
"lz4/1.9.4": [
|
"lz4/1.9.4": [
|
||||||
"lz4/1.10.0"
|
"lz4/1.10.0"
|
||||||
],
|
],
|
||||||
"boost/1.83.0": [
|
|
||||||
"boost/1.88.0"
|
|
||||||
],
|
|
||||||
"sqlite3/3.44.2": [
|
"sqlite3/3.44.2": [
|
||||||
"sqlite3/3.49.1"
|
"sqlite3/3.49.1"
|
||||||
],
|
],
|
||||||
|
"boost/1.83.0": [
|
||||||
|
"boost/1.90.0"
|
||||||
|
],
|
||||||
"lz4/[>=1.9.4 <2]": [
|
"lz4/[>=1.9.4 <2]": [
|
||||||
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504"
|
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ class Xrpl(ConanFile):
|
|||||||
"grpc/1.72.0",
|
"grpc/1.72.0",
|
||||||
"libarchive/3.8.1",
|
"libarchive/3.8.1",
|
||||||
"nudb/2.0.9",
|
"nudb/2.0.9",
|
||||||
"openssl/3.5.4",
|
"openssl/3.5.5",
|
||||||
"secp256k1/0.7.0",
|
"secp256k1/0.7.1",
|
||||||
"soci/4.0.3",
|
"soci/4.0.3",
|
||||||
"zlib/1.3.1",
|
"zlib/1.3.1",
|
||||||
]
|
]
|
||||||
@@ -131,7 +131,7 @@ class Xrpl(ConanFile):
|
|||||||
transitive_headers_opt = (
|
transitive_headers_opt = (
|
||||||
{"transitive_headers": True} if conan_version.split(".")[0] == "2" else {}
|
{"transitive_headers": True} if conan_version.split(".")[0] == "2" else {}
|
||||||
)
|
)
|
||||||
self.requires("boost/1.88.0", force=True, **transitive_headers_opt)
|
self.requires("boost/1.90.0", force=True, **transitive_headers_opt)
|
||||||
self.requires("date/3.0.4", **transitive_headers_opt)
|
self.requires("date/3.0.4", **transitive_headers_opt)
|
||||||
self.requires("lz4/1.10.0", force=True)
|
self.requires("lz4/1.10.0", force=True)
|
||||||
self.requires("protobuf/6.32.1", force=True)
|
self.requires("protobuf/6.32.1", force=True)
|
||||||
@@ -203,7 +203,6 @@ class Xrpl(ConanFile):
|
|||||||
"boost::program_options",
|
"boost::program_options",
|
||||||
"boost::process",
|
"boost::process",
|
||||||
"boost::regex",
|
"boost::regex",
|
||||||
"boost::system",
|
|
||||||
"boost::thread",
|
"boost::thread",
|
||||||
"date::date",
|
"date::date",
|
||||||
"ed25519::ed25519",
|
"ed25519::ed25519",
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
ignorePaths:
|
ignorePaths:
|
||||||
- build/**
|
- build/**
|
||||||
- src/libxrpl/crypto
|
- src/libxrpl/crypto
|
||||||
- src/test/** # Will be removed in the future
|
|
||||||
- CMakeUserPresets.json
|
- CMakeUserPresets.json
|
||||||
- Doxyfile
|
- Doxyfile
|
||||||
- docs/**/*.puml
|
- docs/**/*.puml
|
||||||
- cmake/**
|
- cmake/**
|
||||||
- LICENSE.md
|
- LICENSE.md
|
||||||
|
- .clang-tidy
|
||||||
language: en
|
language: en
|
||||||
allowCompoundWords: true
|
allowCompoundWords: true # TODO (#6334)
|
||||||
ignoreRandomStrings: true
|
ignoreRandomStrings: true
|
||||||
minWordLength: 5
|
minWordLength: 5
|
||||||
dictionaries:
|
dictionaries:
|
||||||
@@ -16,20 +16,29 @@ dictionaries:
|
|||||||
- en_US
|
- en_US
|
||||||
- en_GB
|
- en_GB
|
||||||
ignoreRegExpList:
|
ignoreRegExpList:
|
||||||
- /[rs][1-9A-HJ-NP-Za-km-z]{25,34}/g # addresses and seeds
|
- /\b[rs][1-9A-HJ-NP-Za-km-z]{25,34}/g # addresses and seeds
|
||||||
- /(XRPL|BEAST)_[A-Z_0-9]+_H_INCLUDED+/g # include guards
|
- /\bC[A-Z0-9]{15}/g # CTIDs
|
||||||
- /(XRPL|BEAST)_[A-Z_0-9]+_H+/g # include guards
|
- /\b(XRPL|BEAST)_[A-Z_0-9]+_H_INCLUDED+/g # include guards
|
||||||
|
- /\b(XRPL|BEAST)_[A-Z_0-9]+_H+/g # include guards
|
||||||
- /::[a-z:_]+/g # things from other namespaces
|
- /::[a-z:_]+/g # things from other namespaces
|
||||||
- /lib[a-z]+/g # libraries
|
- /\blib[a-z]+/g # libraries
|
||||||
- /[0-9]{4}-[0-9]{2}-[0-9]{2}[,:][A-Za-zÀ-ÖØ-öø-ÿ.\s]+/g # copyright dates
|
- /\b[0-9]{4}-[0-9]{2}-[0-9]{2}[,:][A-Za-zÀ-ÖØ-öø-ÿ.\s]+/g # copyright dates
|
||||||
- /[0-9]{4}[,:]?\s*[A-Za-zÀ-ÖØ-öø-ÿ.\s]+/g # copyright years
|
- /\b[0-9]{4}[,:]?\s*[A-Za-zÀ-ÖØ-öø-ÿ.\s]+/g # copyright years
|
||||||
- /\[[A-Za-z0-9-]+\]\(https:\/\/github.com\/[A-Za-z0-9-]+\)/g # Github usernames
|
- /\[[A-Za-z0-9-]+\]\(https:\/\/github.com\/[A-Za-z0-9-]+\)/g # Github usernames
|
||||||
- /-[DWw][a-zA-Z0-9_-]+=/g # compile flags
|
- /-[DWw][a-zA-Z0-9_-]+=/g # compile flags
|
||||||
- /[\['"`]-[DWw][a-zA-Z0-9_-]+['"`\]]/g # compile flags
|
- /[\['"`]-[DWw][a-zA-Z0-9_-]+['"`\]]/g # compile flags
|
||||||
|
- ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||||
|
- ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||||
|
overrides:
|
||||||
|
- filename: "**/*_test.cpp" # all test files
|
||||||
|
ignoreRegExpList:
|
||||||
|
- /"[^"]*"/g # double-quoted strings
|
||||||
|
- /'[^']*'/g # single-quoted strings
|
||||||
|
- /`[^`]*`/g # backtick strings
|
||||||
suggestWords:
|
suggestWords:
|
||||||
- xprl->xrpl
|
- xprl->xrpl
|
||||||
- xprld->xrpld
|
- xprld->xrpld # cspell: disable-line not sure what this problem is....
|
||||||
- unsynched->unsynced
|
- unsynched->unsynced # cspell: disable-line not sure what this problem is....
|
||||||
- synched->synced
|
- synched->synced
|
||||||
- synch->sync
|
- synch->sync
|
||||||
words:
|
words:
|
||||||
@@ -51,6 +60,7 @@ words:
|
|||||||
- Britto
|
- Britto
|
||||||
- Btrfs
|
- Btrfs
|
||||||
- canonicality
|
- canonicality
|
||||||
|
- changespq
|
||||||
- checkme
|
- checkme
|
||||||
- choco
|
- choco
|
||||||
- chrono
|
- chrono
|
||||||
@@ -101,19 +111,24 @@ words:
|
|||||||
- gpgcheck
|
- gpgcheck
|
||||||
- gpgkey
|
- gpgkey
|
||||||
- hotwallet
|
- hotwallet
|
||||||
|
- hwrap
|
||||||
- ifndef
|
- ifndef
|
||||||
- inequation
|
- inequation
|
||||||
- insuf
|
- insuf
|
||||||
- insuff
|
- insuff
|
||||||
|
- invasively
|
||||||
- iou
|
- iou
|
||||||
- ious
|
- ious
|
||||||
- isrdc
|
- isrdc
|
||||||
- itype
|
- itype
|
||||||
- jemalloc
|
- jemalloc
|
||||||
- jlog
|
- jlog
|
||||||
|
- jtnofill
|
||||||
- keylet
|
- keylet
|
||||||
- keylets
|
- keylets
|
||||||
- keyvadb
|
- keyvadb
|
||||||
|
- kwarg
|
||||||
|
- kwargs
|
||||||
- ledgerentry
|
- ledgerentry
|
||||||
- ledgerhash
|
- ledgerhash
|
||||||
- ledgerindex
|
- ledgerindex
|
||||||
@@ -135,6 +150,7 @@ words:
|
|||||||
- Metafuncton
|
- Metafuncton
|
||||||
- misprediction
|
- misprediction
|
||||||
- mptbalance
|
- mptbalance
|
||||||
|
- MPTDEX
|
||||||
- mptflags
|
- mptflags
|
||||||
- mptid
|
- mptid
|
||||||
- mptissuance
|
- mptissuance
|
||||||
@@ -144,6 +160,7 @@ words:
|
|||||||
- mptokenissuance
|
- mptokenissuance
|
||||||
- mptokens
|
- mptokens
|
||||||
- mpts
|
- mpts
|
||||||
|
- mtgox
|
||||||
- multisig
|
- multisig
|
||||||
- multisign
|
- multisign
|
||||||
- multisigned
|
- multisigned
|
||||||
@@ -156,6 +173,9 @@ words:
|
|||||||
- nftokens
|
- nftokens
|
||||||
- nftpage
|
- nftpage
|
||||||
- nikb
|
- nikb
|
||||||
|
- nixfmt
|
||||||
|
- nixos
|
||||||
|
- nixpkgs
|
||||||
- nonxrp
|
- nonxrp
|
||||||
- noripple
|
- noripple
|
||||||
- nudb
|
- nudb
|
||||||
@@ -163,6 +183,7 @@ words:
|
|||||||
- nunl
|
- nunl
|
||||||
- Nyffenegger
|
- Nyffenegger
|
||||||
- ostr
|
- ostr
|
||||||
|
- pargs
|
||||||
- partitioner
|
- partitioner
|
||||||
- paychan
|
- paychan
|
||||||
- paychans
|
- paychans
|
||||||
@@ -170,6 +191,7 @@ words:
|
|||||||
- perminute
|
- perminute
|
||||||
- permissioned
|
- permissioned
|
||||||
- pointee
|
- pointee
|
||||||
|
- populator
|
||||||
- preauth
|
- preauth
|
||||||
- preauthorization
|
- preauthorization
|
||||||
- preauthorize
|
- preauthorize
|
||||||
@@ -178,6 +200,7 @@ words:
|
|||||||
- protobuf
|
- protobuf
|
||||||
- protos
|
- protos
|
||||||
- ptrs
|
- ptrs
|
||||||
|
- pushd
|
||||||
- pyenv
|
- pyenv
|
||||||
- qalloc
|
- qalloc
|
||||||
- queuable
|
- queuable
|
||||||
@@ -17,8 +17,8 @@ guideline is to maintain the standards that are used in those libraries.
|
|||||||
## Guidelines
|
## Guidelines
|
||||||
|
|
||||||
If you want to do something contrary to these guidelines, understand
|
If you want to do something contrary to these guidelines, understand
|
||||||
why you're doing it. Think, use common sense, and consider that this
|
why you're doing it. Think, use common sense, and consider that these
|
||||||
your changes will probably need to be maintained long after you've
|
changes will probably need to be maintained long after you've
|
||||||
moved on to other projects.
|
moved on to other projects.
|
||||||
|
|
||||||
- Use white space and blank lines to guide the eye and keep your intent clear.
|
- Use white space and blank lines to guide the eye and keep your intent clear.
|
||||||
|
|||||||
2
docs/build/environment.md
vendored
2
docs/build/environment.md
vendored
@@ -3,6 +3,8 @@ environment complete with Git, Python, Conan, CMake, and a C++ compiler.
|
|||||||
This document exists to help readers set one up on any of the Big Three
|
This document exists to help readers set one up on any of the Big Three
|
||||||
platforms: Linux, macOS, or Windows.
|
platforms: Linux, macOS, or Windows.
|
||||||
|
|
||||||
|
As an alternative to system packages, the Nix development shell can be used to provide a development environment. See [using nix development shell](./nix.md) for more details.
|
||||||
|
|
||||||
[BUILD.md]: ../../BUILD.md
|
[BUILD.md]: ../../BUILD.md
|
||||||
|
|
||||||
## Linux
|
## Linux
|
||||||
|
|||||||
95
docs/build/nix.md
vendored
Normal file
95
docs/build/nix.md
vendored
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
# Using Nix Development Shell for xrpld Development
|
||||||
|
|
||||||
|
This guide explains how to use Nix to set up a reproducible development environment for xrpld. Using Nix eliminates the need to manually install utilities and ensures consistent tooling across different machines.
|
||||||
|
|
||||||
|
## Benefits of Using Nix
|
||||||
|
|
||||||
|
- **Reproducible environment**: Everyone gets the same versions of tools and compilers
|
||||||
|
- **No system pollution**: Dependencies are isolated and don't affect your system packages
|
||||||
|
- **Multiple compiler versions**: Easily switch between different GCC and Clang versions
|
||||||
|
- **Quick setup**: Get started with a single command
|
||||||
|
- **Works on Linux and macOS**: Consistent experience across platforms
|
||||||
|
|
||||||
|
## Install Nix
|
||||||
|
|
||||||
|
Please follow [the official installation instructions of nix package manager](https://nixos.org/download/) for your system.
|
||||||
|
|
||||||
|
## Entering the Development Shell
|
||||||
|
|
||||||
|
### Basic Usage
|
||||||
|
|
||||||
|
From the root of the xrpld repository, enter the default development shell:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix --experimental-features 'nix-command flakes' develop
|
||||||
|
```
|
||||||
|
|
||||||
|
This will:
|
||||||
|
|
||||||
|
- Download and set up all required development tools (CMake, Ninja, Conan, etc.)
|
||||||
|
- Configure the appropriate compiler for your platform:
|
||||||
|
- **macOS**: Apple Clang (default system compiler)
|
||||||
|
- **Linux**: GCC 15
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> To avoid typing `--experimental-features 'nix-command flakes'` every time, you can permanently enable flakes by creating `~/.config/nix/nix.conf`:
|
||||||
|
>
|
||||||
|
> ```bash
|
||||||
|
> mkdir -p ~/.config/nix
|
||||||
|
> echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> After this, you can simply use `nix develop` instead.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> The examples below assume you've enabled flakes in your config. If you haven't, add `--experimental-features 'nix-command flakes'` after each `nix` command.
|
||||||
|
|
||||||
|
### Choosing a different compiler
|
||||||
|
|
||||||
|
A compiler can be chosen by providing its name with the `.#` prefix, e.g. `nix develop .#gcc15`.
|
||||||
|
Use `nix flake show` to see all the available development shells.
|
||||||
|
|
||||||
|
Use `nix develop .#no_compiler` to use the compiler from your system.
|
||||||
|
|
||||||
|
### Example Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Use GCC 14
|
||||||
|
nix develop .#gcc14
|
||||||
|
|
||||||
|
# Use Clang 19
|
||||||
|
nix develop .#clang19
|
||||||
|
|
||||||
|
# Use default for your platform
|
||||||
|
nix develop
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using a different shell
|
||||||
|
|
||||||
|
`nix develop` opens bash by default. If you want to use another shell this could be done by adding `-c` flag. For example:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix develop -c zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building xrpld with Nix
|
||||||
|
|
||||||
|
Once inside the Nix development shell, follow the standard [build instructions](../../BUILD.md#steps). The Nix shell provides all necessary tools (CMake, Ninja, Conan, etc.).
|
||||||
|
|
||||||
|
## Automatic Activation with direnv
|
||||||
|
|
||||||
|
[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.
|
||||||
|
|
||||||
|
## Conan and Prebuilt Packages
|
||||||
|
|
||||||
|
Please note that there is no guarantee that binaries from conan cache will work when using nix. If you encounter any errors, please use `--build '*'` to force conan to compile everything from source:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
conan install .. --output-folder . --build '*' --settings build_type=Release
|
||||||
|
```
|
||||||
|
|
||||||
|
## Updating `flake.lock` file
|
||||||
|
|
||||||
|
To update `flake.lock` to the latest revision use `nix flake update` command.
|
||||||
26
flake.lock
generated
Normal file
26
flake.lock
generated
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1769461804,
|
||||||
|
"narHash": "sha256-6h5sROT/3CTHvzPy9koKBmoCa2eJKh4fzQK8eYFEgl8=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "b579d443b37c9c5373044201ea77604e37e748c8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
16
flake.nix
Normal file
16
flake.nix
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
description = "Nix related things for xrpld";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{ nixpkgs, ... }:
|
||||||
|
let
|
||||||
|
forEachSystem = (import ./nix/utils.nix { inherit nixpkgs; }).forEachSystem;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells = forEachSystem (import ./nix/devshell.nix);
|
||||||
|
formatter = forEachSystem ({ pkgs, ... }: pkgs.nixfmt);
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_ARCHIVE_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_ARCHIVE_H_INCLUDED
|
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
@@ -13,10 +12,6 @@ namespace xrpl {
|
|||||||
@throws runtime_error
|
@throws runtime_error
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
extractTarLz4(
|
extractTarLz4(boost::filesystem::path const& src, boost::filesystem::path const& dst);
|
||||||
boost::filesystem::path const& src,
|
|
||||||
boost::filesystem::path const& dst);
|
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_BASICCONFIG_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_BASICCONFIG_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/contract.h>
|
#include <xrpl/basics/contract.h>
|
||||||
|
|
||||||
@@ -14,8 +13,7 @@
|
|||||||
|
|
||||||
namespace xrpl {
|
namespace xrpl {
|
||||||
|
|
||||||
using IniFileSections =
|
using IniFileSections = std::unordered_map<std::string, std::vector<std::string>>;
|
||||||
std::unordered_map<std::string, std::vector<std::string>>;
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -233,10 +231,7 @@ public:
|
|||||||
The previous value, if any, is overwritten.
|
The previous value, if any, is overwritten.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
overwrite(
|
overwrite(std::string const& section, std::string const& key, std::string const& value);
|
||||||
std::string const& section,
|
|
||||||
std::string const& key,
|
|
||||||
std::string const& value);
|
|
||||||
|
|
||||||
/** Remove all the key/value pairs from the section.
|
/** Remove all the key/value pairs from the section.
|
||||||
*/
|
*/
|
||||||
@@ -274,9 +269,8 @@ public:
|
|||||||
bool
|
bool
|
||||||
had_trailing_comments() const
|
had_trailing_comments() const
|
||||||
{
|
{
|
||||||
return std::any_of(map_.cbegin(), map_.cend(), [](auto s) {
|
return std::any_of(
|
||||||
return s.second.had_trailing_comments();
|
map_.cbegin(), map_.cend(), [](auto s) { return s.second.had_trailing_comments(); });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -315,10 +309,7 @@ set(T& target, std::string const& name, Section const& section)
|
|||||||
*/
|
*/
|
||||||
template <class T>
|
template <class T>
|
||||||
bool
|
bool
|
||||||
set(T& target,
|
set(T& target, T const& defaultValue, std::string const& name, Section const& section)
|
||||||
T const& defaultValue,
|
|
||||||
std::string const& name,
|
|
||||||
Section const& section)
|
|
||||||
{
|
{
|
||||||
bool found_and_valid = set<T>(target, name, section);
|
bool found_and_valid = set<T>(target, name, section);
|
||||||
if (!found_and_valid)
|
if (!found_and_valid)
|
||||||
@@ -333,9 +324,7 @@ set(T& target,
|
|||||||
// NOTE This routine might be more clumsy than the previous two
|
// NOTE This routine might be more clumsy than the previous two
|
||||||
template <class T = std::string>
|
template <class T = std::string>
|
||||||
T
|
T
|
||||||
get(Section const& section,
|
get(Section const& section, std::string const& name, T const& defaultValue = T{})
|
||||||
std::string const& name,
|
|
||||||
T const& defaultValue = T{})
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -381,5 +370,3 @@ get_if_exists<bool>(Section const& section, std::string const& name, bool& v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_BLOB_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_BLOB_H_INCLUDED
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -11,5 +10,3 @@ namespace xrpl {
|
|||||||
using Blob = std::vector<unsigned char>;
|
using Blob = std::vector<unsigned char>;
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_BUFFER_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_BUFFER_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/Slice.h>
|
#include <xrpl/basics/Slice.h>
|
||||||
#include <xrpl/beast/utility/instrumentation.h>
|
#include <xrpl/beast/utility/instrumentation.h>
|
||||||
@@ -25,8 +24,7 @@ public:
|
|||||||
Buffer() = default;
|
Buffer() = default;
|
||||||
|
|
||||||
/** Create an uninitialized buffer with the given size. */
|
/** Create an uninitialized buffer with the given size. */
|
||||||
explicit Buffer(std::size_t size)
|
explicit Buffer(std::size_t size) : p_(size ? new std::uint8_t[size] : nullptr), size_(size)
|
||||||
: p_(size ? new std::uint8_t[size] : nullptr), size_(size)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,8 +60,7 @@ public:
|
|||||||
/** Move-construct.
|
/** Move-construct.
|
||||||
The other buffer is reset.
|
The other buffer is reset.
|
||||||
*/
|
*/
|
||||||
Buffer(Buffer&& other) noexcept
|
Buffer(Buffer&& other) noexcept : p_(std::move(other.p_)), size_(other.size_)
|
||||||
: p_(std::move(other.p_)), size_(other.size_)
|
|
||||||
{
|
{
|
||||||
other.size_ = 0;
|
other.size_ = 0;
|
||||||
}
|
}
|
||||||
@@ -94,8 +91,7 @@ public:
|
|||||||
{
|
{
|
||||||
// Ensure the slice isn't a subset of the buffer.
|
// Ensure the slice isn't a subset of the buffer.
|
||||||
XRPL_ASSERT(
|
XRPL_ASSERT(
|
||||||
s.size() == 0 || size_ == 0 || s.data() < p_.get() ||
|
s.size() == 0 || size_ == 0 || s.data() < p_.get() || s.data() >= p_.get() + size_,
|
||||||
s.data() >= p_.get() + size_,
|
|
||||||
"xrpl::Buffer::operator=(Slice) : input not a subset");
|
"xrpl::Buffer::operator=(Slice) : input not a subset");
|
||||||
|
|
||||||
if (auto p = alloc(s.size()))
|
if (auto p = alloc(s.size()))
|
||||||
@@ -216,5 +212,3 @@ operator!=(Buffer const& lhs, Buffer const& rhs) noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_BYTEUTILITIES_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_BYTEUTILITIES_H_INCLUDED
|
|
||||||
|
|
||||||
namespace xrpl {
|
namespace xrpl {
|
||||||
|
|
||||||
@@ -20,5 +19,3 @@ megabytes(T value) noexcept
|
|||||||
static_assert(kilobytes(2) == 2048, "kilobytes(2) == 2048");
|
static_assert(kilobytes(2) == 2048, "kilobytes(2) == 2048");
|
||||||
static_assert(megabytes(3) == 3145728, "megabytes(3) == 3145728");
|
static_assert(megabytes(3) == 3145728, "megabytes(3) == 3145728");
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_COMPRESSIONALGORITHMS_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_COMPRESSIONALGORITHMS_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/contract.h>
|
#include <xrpl/basics/contract.h>
|
||||||
|
|
||||||
@@ -116,9 +115,7 @@ lz4Decompress(
|
|||||||
compressed.resize(inSize);
|
compressed.resize(inSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
chunkSize = chunkSize < (inSize - copiedInSize)
|
chunkSize = chunkSize < (inSize - copiedInSize) ? chunkSize : (inSize - copiedInSize);
|
||||||
? chunkSize
|
|
||||||
: (inSize - copiedInSize);
|
|
||||||
|
|
||||||
std::copy(chunk, chunk + chunkSize, compressed.data() + copiedInSize);
|
std::copy(chunk, chunk + chunkSize, compressed.data() + copiedInSize);
|
||||||
|
|
||||||
@@ -135,8 +132,7 @@ lz4Decompress(
|
|||||||
if (in.ByteCount() > (currentBytes + copiedInSize))
|
if (in.ByteCount() > (currentBytes + copiedInSize))
|
||||||
in.BackUp(in.ByteCount() - currentBytes - copiedInSize);
|
in.BackUp(in.ByteCount() - currentBytes - copiedInSize);
|
||||||
|
|
||||||
if ((copiedInSize == 0 && chunkSize < inSize) ||
|
if ((copiedInSize == 0 && chunkSize < inSize) || (copiedInSize > 0 && copiedInSize != inSize))
|
||||||
(copiedInSize > 0 && copiedInSize != inSize))
|
|
||||||
Throw<std::runtime_error>("lz4 decompress: insufficient input size");
|
Throw<std::runtime_error>("lz4 decompress: insufficient input size");
|
||||||
|
|
||||||
return lz4Decompress(chunk, inSize, decompressed, decompressedSize);
|
return lz4Decompress(chunk, inSize, decompressed, decompressedSize);
|
||||||
@@ -145,5 +141,3 @@ lz4Decompress(
|
|||||||
} // namespace compression_algorithms
|
} // namespace compression_algorithms
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif // XRPL_COMPRESSIONALGORITHMS_H_INCLUDED
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_COUNTEDOBJECT_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_COUNTEDOBJECT_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/beast/type_name.h>
|
#include <xrpl/beast/type_name.h>
|
||||||
|
|
||||||
@@ -134,5 +133,3 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_DECAYINGSAMPLE_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_DECAYINGSAMPLE_H_INCLUDED
|
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -57,8 +56,7 @@ private:
|
|||||||
if (m_value != value_type())
|
if (m_value != value_type())
|
||||||
{
|
{
|
||||||
std::size_t elapsed =
|
std::size_t elapsed =
|
||||||
std::chrono::duration_cast<std::chrono::seconds>(now - m_when)
|
std::chrono::duration_cast<std::chrono::seconds>(now - m_when).count();
|
||||||
.count();
|
|
||||||
|
|
||||||
// A span larger than four times the window decays the
|
// A span larger than four times the window decays the
|
||||||
// value to an insignificant amount so just reset it.
|
// value to an insignificant amount so just reset it.
|
||||||
@@ -132,5 +130,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_EXPECTED_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_EXPECTED_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/contract.h>
|
#include <xrpl/basics/contract.h>
|
||||||
|
|
||||||
@@ -108,16 +107,14 @@ Unexpected(E (&)[N]) -> Unexpected<E const*>;
|
|||||||
|
|
||||||
// Definition of Expected. All of the machinery comes from boost::result.
|
// Definition of Expected. All of the machinery comes from boost::result.
|
||||||
template <class T, class E>
|
template <class T, class E>
|
||||||
class [[nodiscard]] Expected
|
class [[nodiscard]] Expected : private boost::outcome_v2::result<T, E, detail::throw_policy>
|
||||||
: private boost::outcome_v2::result<T, E, detail::throw_policy>
|
|
||||||
{
|
{
|
||||||
using Base = boost::outcome_v2::result<T, E, detail::throw_policy>;
|
using Base = boost::outcome_v2::result<T, E, detail::throw_policy>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template <typename U>
|
template <typename U>
|
||||||
requires std::convertible_to<U, T>
|
requires std::convertible_to<U, T>
|
||||||
constexpr Expected(U&& r)
|
constexpr Expected(U&& r) : Base(boost::outcome_v2::in_place_type_t<T>{}, std::forward<U>(r))
|
||||||
: Base(boost::outcome_v2::in_place_type_t<T>{}, std::forward<U>(r))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,8 +192,8 @@ public:
|
|||||||
// Specialization of Expected<void, E>. Allows returning either success
|
// Specialization of Expected<void, E>. Allows returning either success
|
||||||
// (without a value) or the reason for the failure.
|
// (without a value) or the reason for the failure.
|
||||||
template <class E>
|
template <class E>
|
||||||
class [[nodiscard]] Expected<void, E>
|
class [[nodiscard]]
|
||||||
: private boost::outcome_v2::result<void, E, detail::throw_policy>
|
Expected<void, E> : private boost::outcome_v2::result<void, E, detail::throw_policy>
|
||||||
{
|
{
|
||||||
using Base = boost::outcome_v2::result<void, E, detail::throw_policy>;
|
using Base = boost::outcome_v2::result<void, E, detail::throw_policy>;
|
||||||
|
|
||||||
@@ -233,5 +230,3 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif // XRPL_BASICS_EXPECTED_H_INCLUDED
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_FILEUTILITIES_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_FILEUTILITIES_H_INCLUDED
|
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/system/error_code.hpp>
|
#include <boost/system/error_code.hpp>
|
||||||
@@ -21,5 +20,3 @@ writeFileContents(
|
|||||||
std::string const& contents);
|
std::string const& contents);
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_INTRUSIVEPOINTER_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_INTRUSIVEPOINTER_H_INCLUDED
|
|
||||||
|
|
||||||
#include <concepts>
|
#include <concepts>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -122,9 +121,7 @@ public:
|
|||||||
controlled by the rhs param.
|
controlled by the rhs param.
|
||||||
*/
|
*/
|
||||||
template <class TT>
|
template <class TT>
|
||||||
SharedIntrusive(
|
SharedIntrusive(StaticCastTagSharedIntrusive, SharedIntrusive<TT> const& rhs);
|
||||||
StaticCastTagSharedIntrusive,
|
|
||||||
SharedIntrusive<TT> const& rhs);
|
|
||||||
|
|
||||||
/** Create a new SharedIntrusive by statically casting the pointer
|
/** Create a new SharedIntrusive by statically casting the pointer
|
||||||
controlled by the rhs param.
|
controlled by the rhs param.
|
||||||
@@ -136,9 +133,7 @@ public:
|
|||||||
controlled by the rhs param.
|
controlled by the rhs param.
|
||||||
*/
|
*/
|
||||||
template <class TT>
|
template <class TT>
|
||||||
SharedIntrusive(
|
SharedIntrusive(DynamicCastTagSharedIntrusive, SharedIntrusive<TT> const& rhs);
|
||||||
DynamicCastTagSharedIntrusive,
|
|
||||||
SharedIntrusive<TT> const& rhs);
|
|
||||||
|
|
||||||
/** Create a new SharedIntrusive by dynamically casting the pointer
|
/** Create a new SharedIntrusive by dynamically casting the pointer
|
||||||
controlled by the rhs param.
|
controlled by the rhs param.
|
||||||
@@ -304,9 +299,7 @@ class SharedWeakUnion
|
|||||||
// Tagged pointer. Low bit determines if this is a strong or a weak
|
// Tagged pointer. Low bit determines if this is a strong or a weak
|
||||||
// pointer. The low bit must be masked to zero when converting back to a
|
// pointer. The low bit must be masked to zero when converting back to a
|
||||||
// pointer. If the low bit is '1', this is a weak pointer.
|
// pointer. If the low bit is '1', this is a weak pointer.
|
||||||
static_assert(
|
static_assert(alignof(T) >= 2, "Bad alignment: Combo pointer requires low bit to be zero");
|
||||||
alignof(T) >= 2,
|
|
||||||
"Bad alignment: Combo pointer requires low bit to be zero");
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SharedWeakUnion() = default;
|
SharedWeakUnion() = default;
|
||||||
@@ -451,8 +444,7 @@ make_SharedIntrusive(Args&&... args)
|
|||||||
|
|
||||||
static_assert(
|
static_assert(
|
||||||
noexcept(SharedIntrusive<TT>(
|
noexcept(SharedIntrusive<TT>(
|
||||||
std::declval<TT*>(),
|
std::declval<TT*>(), std::declval<SharedIntrusiveAdoptNoIncrementTag>())),
|
||||||
std::declval<SharedIntrusiveAdoptNoIncrementTag>())),
|
|
||||||
"SharedIntrusive constructor should not throw or this can leak "
|
"SharedIntrusive constructor should not throw or this can leak "
|
||||||
"memory");
|
"memory");
|
||||||
|
|
||||||
@@ -493,4 +485,3 @@ dynamic_pointer_cast(TT const& v)
|
|||||||
}
|
}
|
||||||
} // namespace intr_ptr
|
} // namespace intr_ptr
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_INTRUSIVEPOINTER_IPP_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_INTRUSIVEPOINTER_IPP_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/IntrusivePointer.h>
|
#include <xrpl/basics/IntrusivePointer.h>
|
||||||
#include <xrpl/basics/IntrusiveRefCounts.h>
|
#include <xrpl/basics/IntrusiveRefCounts.h>
|
||||||
@@ -12,9 +11,7 @@ template <class T>
|
|||||||
template <CAdoptTag TAdoptTag>
|
template <CAdoptTag TAdoptTag>
|
||||||
SharedIntrusive<T>::SharedIntrusive(T* p, TAdoptTag) noexcept : ptr_{p}
|
SharedIntrusive<T>::SharedIntrusive(T* p, TAdoptTag) noexcept : ptr_{p}
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same_v<
|
if constexpr (std::is_same_v<TAdoptTag, SharedIntrusiveAdoptIncrementStrongTag>)
|
||||||
TAdoptTag,
|
|
||||||
SharedIntrusiveAdoptIncrementStrongTag>)
|
|
||||||
{
|
{
|
||||||
if (p)
|
if (p)
|
||||||
p->addStrongRef();
|
p->addStrongRef();
|
||||||
@@ -46,16 +43,14 @@ SharedIntrusive<T>::SharedIntrusive(SharedIntrusive<TT> const& rhs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
SharedIntrusive<T>::SharedIntrusive(SharedIntrusive&& rhs)
|
SharedIntrusive<T>::SharedIntrusive(SharedIntrusive&& rhs) : ptr_{rhs.unsafeExchange(nullptr)}
|
||||||
: ptr_{rhs.unsafeExchange(nullptr)}
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
template <class TT>
|
template <class TT>
|
||||||
requires std::convertible_to<TT*, T*>
|
requires std::convertible_to<TT*, T*>
|
||||||
SharedIntrusive<T>::SharedIntrusive(SharedIntrusive<TT>&& rhs)
|
SharedIntrusive<T>::SharedIntrusive(SharedIntrusive<TT>&& rhs) : ptr_{rhs.unsafeExchange(nullptr)}
|
||||||
: ptr_{rhs.unsafeExchange(nullptr)}
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -112,9 +107,7 @@ requires std::convertible_to<TT*, T*>
|
|||||||
SharedIntrusive<T>&
|
SharedIntrusive<T>&
|
||||||
SharedIntrusive<T>::operator=(SharedIntrusive<TT>&& rhs)
|
SharedIntrusive<T>::operator=(SharedIntrusive<TT>&& rhs)
|
||||||
{
|
{
|
||||||
static_assert(
|
static_assert(!std::is_same_v<T, TT>, "This overload should not be instantiated for T == TT");
|
||||||
!std::is_same_v<T, TT>,
|
|
||||||
"This overload should not be instantiated for T == TT");
|
|
||||||
|
|
||||||
unsafeReleaseAndStore(rhs.unsafeExchange(nullptr));
|
unsafeReleaseAndStore(rhs.unsafeExchange(nullptr));
|
||||||
return *this;
|
return *this;
|
||||||
@@ -139,9 +132,7 @@ template <CAdoptTag TAdoptTag>
|
|||||||
void
|
void
|
||||||
SharedIntrusive<T>::adopt(T* p)
|
SharedIntrusive<T>::adopt(T* p)
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same_v<
|
if constexpr (std::is_same_v<TAdoptTag, SharedIntrusiveAdoptIncrementStrongTag>)
|
||||||
TAdoptTag,
|
|
||||||
SharedIntrusiveAdoptIncrementStrongTag>)
|
|
||||||
{
|
{
|
||||||
if (p)
|
if (p)
|
||||||
p->addStrongRef();
|
p->addStrongRef();
|
||||||
@@ -157,9 +148,7 @@ SharedIntrusive<T>::~SharedIntrusive()
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
template <class TT>
|
template <class TT>
|
||||||
SharedIntrusive<T>::SharedIntrusive(
|
SharedIntrusive<T>::SharedIntrusive(StaticCastTagSharedIntrusive, SharedIntrusive<TT> const& rhs)
|
||||||
StaticCastTagSharedIntrusive,
|
|
||||||
SharedIntrusive<TT> const& rhs)
|
|
||||||
: ptr_{[&] {
|
: ptr_{[&] {
|
||||||
auto p = static_cast<T*>(rhs.unsafeGetRawPtr());
|
auto p = static_cast<T*>(rhs.unsafeGetRawPtr());
|
||||||
if (p)
|
if (p)
|
||||||
@@ -171,18 +160,14 @@ SharedIntrusive<T>::SharedIntrusive(
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
template <class TT>
|
template <class TT>
|
||||||
SharedIntrusive<T>::SharedIntrusive(
|
SharedIntrusive<T>::SharedIntrusive(StaticCastTagSharedIntrusive, SharedIntrusive<TT>&& rhs)
|
||||||
StaticCastTagSharedIntrusive,
|
|
||||||
SharedIntrusive<TT>&& rhs)
|
|
||||||
: ptr_{static_cast<T*>(rhs.unsafeExchange(nullptr))}
|
: ptr_{static_cast<T*>(rhs.unsafeExchange(nullptr))}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
template <class TT>
|
template <class TT>
|
||||||
SharedIntrusive<T>::SharedIntrusive(
|
SharedIntrusive<T>::SharedIntrusive(DynamicCastTagSharedIntrusive, SharedIntrusive<TT> const& rhs)
|
||||||
DynamicCastTagSharedIntrusive,
|
|
||||||
SharedIntrusive<TT> const& rhs)
|
|
||||||
: ptr_{[&] {
|
: ptr_{[&] {
|
||||||
auto p = dynamic_cast<T*>(rhs.unsafeGetRawPtr());
|
auto p = dynamic_cast<T*>(rhs.unsafeGetRawPtr());
|
||||||
if (p)
|
if (p)
|
||||||
@@ -194,9 +179,7 @@ SharedIntrusive<T>::SharedIntrusive(
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
template <class TT>
|
template <class TT>
|
||||||
SharedIntrusive<T>::SharedIntrusive(
|
SharedIntrusive<T>::SharedIntrusive(DynamicCastTagSharedIntrusive, SharedIntrusive<TT>&& rhs)
|
||||||
DynamicCastTagSharedIntrusive,
|
|
||||||
SharedIntrusive<TT>&& rhs)
|
|
||||||
{
|
{
|
||||||
// This can be simplified without the `exchange`, but the `exchange` is kept
|
// This can be simplified without the `exchange`, but the `exchange` is kept
|
||||||
// in anticipation of supporting atomic operations.
|
// in anticipation of supporting atomic operations.
|
||||||
@@ -225,7 +208,8 @@ SharedIntrusive<T>::operator->() const noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
SharedIntrusive<T>::operator bool() const noexcept
|
SharedIntrusive<T>::
|
||||||
|
operator bool() const noexcept
|
||||||
{
|
{
|
||||||
return bool(unsafeGetRawPtr());
|
return bool(unsafeGetRawPtr());
|
||||||
}
|
}
|
||||||
@@ -315,8 +299,7 @@ WeakIntrusive<T>::WeakIntrusive(WeakIntrusive&& rhs) : ptr_{rhs.ptr_}
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
WeakIntrusive<T>::WeakIntrusive(SharedIntrusive<T> const& rhs)
|
WeakIntrusive<T>::WeakIntrusive(SharedIntrusive<T> const& rhs) : ptr_{rhs.unsafeGetRawPtr()}
|
||||||
: ptr_{rhs.unsafeGetRawPtr()}
|
|
||||||
{
|
{
|
||||||
if (ptr_)
|
if (ptr_)
|
||||||
ptr_->addWeakRef();
|
ptr_->addWeakRef();
|
||||||
@@ -521,7 +504,8 @@ SharedWeakUnion<T>::getStrong() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
SharedWeakUnion<T>::operator bool() const noexcept
|
SharedWeakUnion<T>::
|
||||||
|
operator bool() const noexcept
|
||||||
{
|
{
|
||||||
return bool(get());
|
return bool(get());
|
||||||
}
|
}
|
||||||
@@ -720,4 +704,3 @@ SharedWeakUnion<T>::unsafeReleaseNoStore()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_INTRUSIVEREFCOUNTS_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_INTRUSIVEREFCOUNTS_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/beast/utility/instrumentation.h>
|
#include <xrpl/beast/utility/instrumentation.h>
|
||||||
|
|
||||||
@@ -160,22 +159,19 @@ private:
|
|||||||
See description of the `refCounts` field for a fuller description of
|
See description of the `refCounts` field for a fuller description of
|
||||||
this field.
|
this field.
|
||||||
*/
|
*/
|
||||||
static constexpr FieldType partialDestroyStartedMask =
|
static constexpr FieldType partialDestroyStartedMask = (one << (FieldTypeBits - 1));
|
||||||
(one << (FieldTypeBits - 1));
|
|
||||||
|
|
||||||
/** Flag that is set when the partialDestroy function has finished running
|
/** Flag that is set when the partialDestroy function has finished running
|
||||||
|
|
||||||
See description of the `refCounts` field for a fuller description of
|
See description of the `refCounts` field for a fuller description of
|
||||||
this field.
|
this field.
|
||||||
*/
|
*/
|
||||||
static constexpr FieldType partialDestroyFinishedMask =
|
static constexpr FieldType partialDestroyFinishedMask = (one << (FieldTypeBits - 2));
|
||||||
(one << (FieldTypeBits - 2));
|
|
||||||
|
|
||||||
/** Mask that will zero out all the `count` bits and leave the tag bits
|
/** Mask that will zero out all the `count` bits and leave the tag bits
|
||||||
unchanged.
|
unchanged.
|
||||||
*/
|
*/
|
||||||
static constexpr FieldType tagMask =
|
static constexpr FieldType tagMask = partialDestroyStartedMask | partialDestroyFinishedMask;
|
||||||
partialDestroyStartedMask | partialDestroyFinishedMask;
|
|
||||||
|
|
||||||
/** Mask that will zero out the `tag` bits and leave the count bits
|
/** Mask that will zero out the `tag` bits and leave the count bits
|
||||||
unchanged.
|
unchanged.
|
||||||
@@ -184,8 +180,7 @@ private:
|
|||||||
|
|
||||||
/** Mask that will zero out everything except the strong count.
|
/** Mask that will zero out everything except the strong count.
|
||||||
*/
|
*/
|
||||||
static constexpr FieldType strongMask =
|
static constexpr FieldType strongMask = ((one << StrongCountNumBits) - 1) & valueMask;
|
||||||
((one << StrongCountNumBits) - 1) & valueMask;
|
|
||||||
|
|
||||||
/** Mask that will zero out everything except the weak count.
|
/** Mask that will zero out everything except the weak count.
|
||||||
*/
|
*/
|
||||||
@@ -274,8 +269,7 @@ IntrusiveRefCounts::releaseStrongRef() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (refCounts.compare_exchange_weak(
|
if (refCounts.compare_exchange_weak(prevIntVal, nextIntVal, std::memory_order_acq_rel))
|
||||||
prevIntVal, nextIntVal, std::memory_order_acq_rel))
|
|
||||||
{
|
{
|
||||||
// Can't be in partial destroy because only decrementing the strong
|
// Can't be in partial destroy because only decrementing the strong
|
||||||
// count to zero can start a partial destroy, and that can't happen
|
// count to zero can start a partial destroy, and that can't happen
|
||||||
@@ -331,8 +325,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
|
|||||||
action = partialDestroy;
|
action = partialDestroy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (refCounts.compare_exchange_weak(
|
if (refCounts.compare_exchange_weak(prevIntVal, nextIntVal, std::memory_order_acq_rel))
|
||||||
prevIntVal, nextIntVal, std::memory_order_acq_rel))
|
|
||||||
{
|
{
|
||||||
XRPL_ASSERT(
|
XRPL_ASSERT(
|
||||||
(!(prevIntVal & partialDestroyStartedMask)),
|
(!(prevIntVal & partialDestroyStartedMask)),
|
||||||
@@ -376,8 +369,7 @@ IntrusiveRefCounts::checkoutStrongRefFromWeak() const noexcept
|
|||||||
auto curValue = RefCountPair{1, 1}.combinedValue();
|
auto curValue = RefCountPair{1, 1}.combinedValue();
|
||||||
auto desiredValue = RefCountPair{2, 1}.combinedValue();
|
auto desiredValue = RefCountPair{2, 1}.combinedValue();
|
||||||
|
|
||||||
while (!refCounts.compare_exchange_weak(
|
while (!refCounts.compare_exchange_weak(curValue, desiredValue, std::memory_order_acq_rel))
|
||||||
curValue, desiredValue, std::memory_order_acq_rel))
|
|
||||||
{
|
{
|
||||||
RefCountPair const prev{curValue};
|
RefCountPair const prev{curValue};
|
||||||
if (!prev.strong)
|
if (!prev.strong)
|
||||||
@@ -407,19 +399,15 @@ inline IntrusiveRefCounts::~IntrusiveRefCounts() noexcept
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
auto v = refCounts.load(std::memory_order_acquire);
|
auto v = refCounts.load(std::memory_order_acquire);
|
||||||
XRPL_ASSERT(
|
XRPL_ASSERT(
|
||||||
(!(v & valueMask)),
|
(!(v & valueMask)), "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
|
||||||
"xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
|
|
||||||
auto t = v & tagMask;
|
auto t = v & tagMask;
|
||||||
XRPL_ASSERT(
|
XRPL_ASSERT((!t || t == tagMask), "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
|
||||||
(!t || t == tagMask),
|
|
||||||
"xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
inline IntrusiveRefCounts::RefCountPair::RefCountPair(
|
inline IntrusiveRefCounts::RefCountPair::RefCountPair(IntrusiveRefCounts::FieldType v) noexcept
|
||||||
IntrusiveRefCounts::FieldType v) noexcept
|
|
||||||
: strong{static_cast<CountType>(v & strongMask)}
|
: strong{static_cast<CountType>(v & strongMask)}
|
||||||
, weak{static_cast<CountType>((v & weakMask) >> StrongCountNumBits)}
|
, weak{static_cast<CountType>((v & weakMask) >> StrongCountNumBits)}
|
||||||
, partialDestroyStartedBit{v & partialDestroyStartedMask}
|
, partialDestroyStartedBit{v & partialDestroyStartedMask}
|
||||||
@@ -451,8 +439,8 @@ IntrusiveRefCounts::RefCountPair::combinedValue() const noexcept
|
|||||||
"inside range");
|
"inside range");
|
||||||
return (static_cast<IntrusiveRefCounts::FieldType>(weak)
|
return (static_cast<IntrusiveRefCounts::FieldType>(weak)
|
||||||
<< IntrusiveRefCounts::StrongCountNumBits) |
|
<< IntrusiveRefCounts::StrongCountNumBits) |
|
||||||
static_cast<IntrusiveRefCounts::FieldType>(strong) |
|
static_cast<IntrusiveRefCounts::FieldType>(strong) | partialDestroyStartedBit |
|
||||||
partialDestroyStartedBit | partialDestroyFinishedBit;
|
partialDestroyFinishedBit;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -463,8 +451,7 @@ partialDestructorFinished(T** o)
|
|||||||
IntrusiveRefCounts::RefCountPair p =
|
IntrusiveRefCounts::RefCountPair p =
|
||||||
self.refCounts.fetch_or(IntrusiveRefCounts::partialDestroyFinishedMask);
|
self.refCounts.fetch_or(IntrusiveRefCounts::partialDestroyFinishedMask);
|
||||||
XRPL_ASSERT(
|
XRPL_ASSERT(
|
||||||
(!p.partialDestroyFinishedBit && p.partialDestroyStartedBit &&
|
(!p.partialDestroyFinishedBit && p.partialDestroyStartedBit && !p.strong),
|
||||||
!p.strong),
|
|
||||||
"xrpl::partialDestructorFinished : not a weak ref");
|
"xrpl::partialDestructorFinished : not a weak ref");
|
||||||
if (!p.weak)
|
if (!p.weak)
|
||||||
{
|
{
|
||||||
@@ -480,4 +467,3 @@ partialDestructorFinished(T** o)
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_KEYCACHE_H
|
#pragma once
|
||||||
#define XRPL_BASICS_KEYCACHE_H
|
|
||||||
|
|
||||||
#include <xrpl/basics/TaggedCache.h>
|
#include <xrpl/basics/TaggedCache.h>
|
||||||
#include <xrpl/basics/base_uint.h>
|
#include <xrpl/basics/base_uint.h>
|
||||||
@@ -9,5 +8,3 @@ namespace xrpl {
|
|||||||
using KeyCache = TaggedCache<uint256, int, true>;
|
using KeyCache = TaggedCache<uint256, int, true>;
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif // XRPL_BASICS_KEYCACHE_H
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_LOCALVALUE_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_LOCALVALUE_H_INCLUDED
|
|
||||||
|
|
||||||
#include <boost/thread/tss.hpp>
|
#include <boost/thread/tss.hpp>
|
||||||
|
|
||||||
@@ -55,8 +54,7 @@ template <class = void>
|
|||||||
boost::thread_specific_ptr<detail::LocalValues>&
|
boost::thread_specific_ptr<detail::LocalValues>&
|
||||||
getLocalValues()
|
getLocalValues()
|
||||||
{
|
{
|
||||||
static boost::thread_specific_ptr<detail::LocalValues> tsp(
|
static boost::thread_specific_ptr<detail::LocalValues> tsp(&detail::LocalValues::cleanup);
|
||||||
&detail::LocalValues::cleanup);
|
|
||||||
return tsp;
|
return tsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,10 +103,7 @@ LocalValue<T>::operator*()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return *reinterpret_cast<T*>(
|
return *reinterpret_cast<T*>(
|
||||||
lvs->values
|
lvs->values.emplace(this, std::make_unique<detail::LocalValues::Value<T>>(t_))
|
||||||
.emplace(this, std::make_unique<detail::LocalValues::Value<T>>(t_))
|
|
||||||
.first->second->get());
|
.first->second->get());
|
||||||
}
|
}
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_LOG_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_LOG_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/UnorderedContainers.h>
|
#include <xrpl/basics/UnorderedContainers.h>
|
||||||
#include <xrpl/beast/utility/Journal.h>
|
#include <xrpl/beast/utility/Journal.h>
|
||||||
@@ -39,22 +38,17 @@ private:
|
|||||||
std::string partition_;
|
std::string partition_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Sink(
|
Sink(std::string const& partition, beast::severities::Severity thresh, Logs& logs);
|
||||||
std::string const& partition,
|
|
||||||
beast::severities::Severity thresh,
|
|
||||||
Logs& logs);
|
|
||||||
|
|
||||||
Sink(Sink const&) = delete;
|
Sink(Sink const&) = delete;
|
||||||
Sink&
|
Sink&
|
||||||
operator=(Sink const&) = delete;
|
operator=(Sink const&) = delete;
|
||||||
|
|
||||||
void
|
void
|
||||||
write(beast::severities::Severity level, std::string const& text)
|
write(beast::severities::Severity level, std::string const& text) override;
|
||||||
override;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
writeAlways(beast::severities::Severity level, std::string const& text)
|
writeAlways(beast::severities::Severity level, std::string const& text) override;
|
||||||
override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Manages a system file containing logged output.
|
/** Manages a system file containing logged output.
|
||||||
@@ -140,11 +134,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::mutex mutable mutex_;
|
std::mutex mutable mutex_;
|
||||||
std::map<
|
std::map<std::string, std::unique_ptr<beast::Journal::Sink>, boost::beast::iless> sinks_;
|
||||||
std::string,
|
|
||||||
std::unique_ptr<beast::Journal::Sink>,
|
|
||||||
boost::beast::iless>
|
|
||||||
sinks_;
|
|
||||||
beast::severities::Severity thresh_;
|
beast::severities::Severity thresh_;
|
||||||
File file_;
|
File file_;
|
||||||
bool silent_ = false;
|
bool silent_ = false;
|
||||||
@@ -201,9 +191,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual std::unique_ptr<beast::Journal::Sink>
|
virtual std::unique_ptr<beast::Journal::Sink>
|
||||||
makeSink(
|
makeSink(std::string const& partition, beast::severities::Severity startingLevel);
|
||||||
std::string const& partition,
|
|
||||||
beast::severities::Severity startingLevel);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static LogSeverity
|
static LogSeverity
|
||||||
@@ -273,5 +261,3 @@ beast::Journal
|
|||||||
debugLog();
|
debugLog();
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_MATHUTILITIES_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_MATHUTILITIES_H_INCLUDED
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@@ -45,5 +44,3 @@ static_assert(calculatePercent(50'000'001, 100'000'000) == 51);
|
|||||||
static_assert(calculatePercent(99'999'999, 100'000'000) == 100);
|
static_assert(calculatePercent(99'999'999, 100'000'000) == 100);
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_NUMBER_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_NUMBER_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/beast/utility/instrumentation.h>
|
#include <xrpl/beast/utility/instrumentation.h>
|
||||||
|
|
||||||
@@ -74,10 +73,7 @@ struct MantissaRange
|
|||||||
enum mantissa_scale { small, large };
|
enum mantissa_scale { small, large };
|
||||||
|
|
||||||
explicit constexpr MantissaRange(mantissa_scale scale_)
|
explicit constexpr MantissaRange(mantissa_scale scale_)
|
||||||
: min(getMin(scale_))
|
: min(getMin(scale_)), max(min * 10 - 1), log(logTen(min).value_or(-1)), scale(scale_)
|
||||||
, max(min * 10 - 1)
|
|
||||||
, log(logTen(min).value_or(-1))
|
|
||||||
, scale(scale_)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,8 +103,7 @@ private:
|
|||||||
|
|
||||||
// Like std::integral, but only 64-bit integral types.
|
// Like std::integral, but only 64-bit integral types.
|
||||||
template <class T>
|
template <class T>
|
||||||
concept Integral64 =
|
concept Integral64 = std::is_same_v<T, std::int64_t> || std::is_same_v<T, std::uint64_t>;
|
||||||
std::is_same_v<T, std::int64_t> || std::is_same_v<T, std::uint64_t>;
|
|
||||||
|
|
||||||
/** Number is a floating point type that can represent a wide range of values.
|
/** Number is a floating point type that can represent a wide range of values.
|
||||||
*
|
*
|
||||||
@@ -251,16 +246,9 @@ public:
|
|||||||
int exponent,
|
int exponent,
|
||||||
unchecked) noexcept;
|
unchecked) noexcept;
|
||||||
// Assume unsigned values are... unsigned. i.e. positive
|
// Assume unsigned values are... unsigned. i.e. positive
|
||||||
explicit constexpr Number(
|
explicit constexpr Number(internalrep mantissa, int exponent, unchecked) noexcept;
|
||||||
internalrep mantissa,
|
|
||||||
int exponent,
|
|
||||||
unchecked) noexcept;
|
|
||||||
// Only unit tests are expected to use this ctor
|
// Only unit tests are expected to use this ctor
|
||||||
explicit Number(
|
explicit Number(bool negative, internalrep mantissa, int exponent, normalized);
|
||||||
bool negative,
|
|
||||||
internalrep mantissa,
|
|
||||||
int exponent,
|
|
||||||
normalized);
|
|
||||||
// Assume unsigned values are... unsigned. i.e. positive
|
// Assume unsigned values are... unsigned. i.e. positive
|
||||||
explicit Number(internalrep mantissa, int exponent, normalized);
|
explicit Number(internalrep mantissa, int exponent, normalized);
|
||||||
|
|
||||||
@@ -528,21 +516,14 @@ inline constexpr Number::Number(
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constexpr Number::Number(
|
inline constexpr Number::Number(internalrep mantissa, int exponent, unchecked) noexcept
|
||||||
internalrep mantissa,
|
|
||||||
int exponent,
|
|
||||||
unchecked) noexcept
|
|
||||||
: Number(false, mantissa, exponent, unchecked{})
|
: Number(false, mantissa, exponent, unchecked{})
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr static Number numZero{};
|
constexpr static Number numZero{};
|
||||||
|
|
||||||
inline Number::Number(
|
inline Number::Number(bool negative, internalrep mantissa, int exponent, normalized)
|
||||||
bool negative,
|
|
||||||
internalrep mantissa,
|
|
||||||
int exponent,
|
|
||||||
normalized)
|
|
||||||
: Number(negative, mantissa, exponent, unchecked{})
|
: Number(negative, mantissa, exponent, unchecked{})
|
||||||
{
|
{
|
||||||
normalize();
|
normalize();
|
||||||
@@ -696,15 +677,13 @@ Number::min() noexcept
|
|||||||
inline Number
|
inline Number
|
||||||
Number::max() noexcept
|
Number::max() noexcept
|
||||||
{
|
{
|
||||||
return Number{
|
return Number{false, std::min(range_.get().max, maxRep), maxExponent, unchecked{}};
|
||||||
false, std::min(range_.get().max, maxRep), maxExponent, unchecked{}};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Number
|
inline Number
|
||||||
Number::lowest() noexcept
|
Number::lowest() noexcept
|
||||||
{
|
{
|
||||||
return Number{
|
return Number{true, std::min(range_.get().max, maxRep), maxExponent, unchecked{}};
|
||||||
true, std::min(range_.get().max, maxRep), maxExponent, unchecked{}};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
@@ -713,9 +692,8 @@ Number::isnormal() const noexcept
|
|||||||
MantissaRange const& range = range_;
|
MantissaRange const& range = range_;
|
||||||
auto const abs_m = mantissa_;
|
auto const abs_m = mantissa_;
|
||||||
return *this == Number{} ||
|
return *this == Number{} ||
|
||||||
(range.min <= abs_m && abs_m <= range.max &&
|
(range.min <= abs_m && abs_m <= range.max && (abs_m <= maxRep || abs_m % 10 == 0) &&
|
||||||
(abs_m <= maxRep || abs_m % 10 == 0) && minExponent <= exponent_ &&
|
minExponent <= exponent_ && exponent_ <= maxExponent);
|
||||||
exponent_ <= maxExponent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <Integral64 T>
|
template <Integral64 T>
|
||||||
@@ -799,8 +777,7 @@ public:
|
|||||||
{
|
{
|
||||||
Number::setround(mode_);
|
Number::setround(mode_);
|
||||||
}
|
}
|
||||||
explicit saveNumberRoundMode(Number::rounding_mode mode) noexcept
|
explicit saveNumberRoundMode(Number::rounding_mode mode) noexcept : mode_{mode}
|
||||||
: mode_{mode}
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
saveNumberRoundMode(saveNumberRoundMode const&) = delete;
|
saveNumberRoundMode(saveNumberRoundMode const&) = delete;
|
||||||
@@ -838,8 +815,7 @@ class NumberMantissaScaleGuard
|
|||||||
MantissaRange::mantissa_scale const saved_;
|
MantissaRange::mantissa_scale const saved_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NumberMantissaScaleGuard(
|
explicit NumberMantissaScaleGuard(MantissaRange::mantissa_scale scale) noexcept
|
||||||
MantissaRange::mantissa_scale scale) noexcept
|
|
||||||
: saved_{Number::getMantissaScale()}
|
: saved_{Number::getMantissaScale()}
|
||||||
{
|
{
|
||||||
Number::setMantissaScale(scale);
|
Number::setMantissaScale(scale);
|
||||||
@@ -857,5 +833,3 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif // XRPL_BASICS_NUMBER_H_INCLUDED
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_RANGESET_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_RANGESET_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/beast/core/LexicalCast.h>
|
#include <xrpl/beast/core/LexicalCast.h>
|
||||||
|
|
||||||
@@ -173,5 +172,3 @@ prevMissing(RangeSet<T> const& rs, T t, T minVal = 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_RESOLVER_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_RESOLVER_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/beast/net/IPEndpoint.h>
|
#include <xrpl/beast/net/IPEndpoint.h>
|
||||||
|
|
||||||
@@ -11,8 +10,7 @@ namespace xrpl {
|
|||||||
class Resolver
|
class Resolver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using HandlerType =
|
using HandlerType = std::function<void(std::string, std::vector<beast::IP::Endpoint>)>;
|
||||||
std::function<void(std::string, std::vector<beast::IP::Endpoint>)>;
|
|
||||||
|
|
||||||
virtual ~Resolver() = 0;
|
virtual ~Resolver() = 0;
|
||||||
|
|
||||||
@@ -41,12 +39,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
resolve(
|
resolve(std::vector<std::string> const& names, HandlerType const& handler) = 0;
|
||||||
std::vector<std::string> const& names,
|
|
||||||
HandlerType const& handler) = 0;
|
|
||||||
/** @} */
|
/** @} */
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_RESOLVERASIO_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_RESOLVERASIO_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/Resolver.h>
|
#include <xrpl/basics/Resolver.h>
|
||||||
#include <xrpl/beast/utility/Journal.h>
|
#include <xrpl/beast/utility/Journal.h>
|
||||||
@@ -18,5 +17,3 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_SHAMAP_HASH_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_SHAMAP_HASH_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/base_uint.h>
|
#include <xrpl/basics/base_uint.h>
|
||||||
#include <xrpl/basics/partitioned_unordered_map.h>
|
#include <xrpl/basics/partitioned_unordered_map.h>
|
||||||
@@ -98,5 +97,3 @@ extract(SHAMapHash const& key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif // XRPL_BASICS_SHAMAP_HASH_H_INCLUDED
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_SHAREDWEAKCACHEPOINTER_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_SHAREDWEAKCACHEPOINTER_H_INCLUDED
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
@@ -113,4 +112,3 @@ private:
|
|||||||
std::variant<std::shared_ptr<T>, std::weak_ptr<T>> combo_;
|
std::variant<std::shared_ptr<T>, std::weak_ptr<T>> combo_;
|
||||||
};
|
};
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,25 +1,20 @@
|
|||||||
#ifndef XRPL_BASICS_SHAREDWEAKCACHEPOINTER_IPP_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_SHAREDWEAKCACHEPOINTER_IPP_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/SharedWeakCachePointer.h>
|
#include <xrpl/basics/SharedWeakCachePointer.h>
|
||||||
|
|
||||||
namespace xrpl {
|
namespace xrpl {
|
||||||
template <class T>
|
template <class T>
|
||||||
SharedWeakCachePointer<T>::SharedWeakCachePointer(
|
SharedWeakCachePointer<T>::SharedWeakCachePointer(SharedWeakCachePointer const& rhs) = default;
|
||||||
SharedWeakCachePointer const& rhs) = default;
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
template <class TT>
|
template <class TT>
|
||||||
requires std::convertible_to<TT*, T*>
|
requires std::convertible_to<TT*, T*>
|
||||||
SharedWeakCachePointer<T>::SharedWeakCachePointer(
|
SharedWeakCachePointer<T>::SharedWeakCachePointer(std::shared_ptr<TT> const& rhs) : combo_{rhs}
|
||||||
std::shared_ptr<TT> const& rhs)
|
|
||||||
: combo_{rhs}
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
SharedWeakCachePointer<T>::SharedWeakCachePointer(
|
SharedWeakCachePointer<T>::SharedWeakCachePointer(SharedWeakCachePointer&& rhs) = default;
|
||||||
SharedWeakCachePointer&& rhs) = default;
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
template <class TT>
|
template <class TT>
|
||||||
@@ -31,8 +26,7 @@ SharedWeakCachePointer<T>::SharedWeakCachePointer(std::shared_ptr<TT>&& rhs)
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
SharedWeakCachePointer<T>&
|
SharedWeakCachePointer<T>&
|
||||||
SharedWeakCachePointer<T>::operator=(SharedWeakCachePointer const& rhs) =
|
SharedWeakCachePointer<T>::operator=(SharedWeakCachePointer const& rhs) = default;
|
||||||
default;
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
template <class TT>
|
template <class TT>
|
||||||
@@ -70,7 +64,8 @@ SharedWeakCachePointer<T>::getStrong() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
SharedWeakCachePointer<T>::operator bool() const noexcept
|
SharedWeakCachePointer<T>::
|
||||||
|
operator bool() const noexcept
|
||||||
{
|
{
|
||||||
return !!std::get_if<std::shared_ptr<T>>(&combo_);
|
return !!std::get_if<std::shared_ptr<T>>(&combo_);
|
||||||
}
|
}
|
||||||
@@ -170,4 +165,3 @@ SharedWeakCachePointer<T>::convertToWeak()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) 2022, Nikolaos D. Bougalis <nikb@bougalis.net>
|
// Copyright (c) 2022, Nikolaos D. Bougalis <nikb@bougalis.net>
|
||||||
|
|
||||||
#ifndef XRPL_BASICS_SLABALLOCATOR_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_SLABALLOCATOR_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/ByteUtilities.h>
|
#include <xrpl/basics/ByteUtilities.h>
|
||||||
#include <xrpl/beast/type_name.h>
|
#include <xrpl/beast/type_name.h>
|
||||||
@@ -51,11 +50,7 @@ class SlabAllocator
|
|||||||
// The extent of the underlying memory block:
|
// The extent of the underlying memory block:
|
||||||
std::size_t const size_;
|
std::size_t const size_;
|
||||||
|
|
||||||
SlabBlock(
|
SlabBlock(SlabBlock* next, std::uint8_t* data, std::size_t size, std::size_t item)
|
||||||
SlabBlock* next,
|
|
||||||
std::uint8_t* data,
|
|
||||||
std::size_t size,
|
|
||||||
std::size_t item)
|
|
||||||
: next_(next), p_(data), size_(size)
|
: next_(next), p_(data), size_(size)
|
||||||
{
|
{
|
||||||
// We don't need to grab the mutex here, since we're the only
|
// We don't need to grab the mutex here, since we're the only
|
||||||
@@ -126,9 +121,7 @@ class SlabAllocator
|
|||||||
void
|
void
|
||||||
deallocate(std::uint8_t* ptr) noexcept
|
deallocate(std::uint8_t* ptr) noexcept
|
||||||
{
|
{
|
||||||
XRPL_ASSERT(
|
XRPL_ASSERT(own(ptr), "xrpl::SlabAllocator::SlabBlock::deallocate : own input");
|
||||||
own(ptr),
|
|
||||||
"xrpl::SlabAllocator::SlabBlock::deallocate : own input");
|
|
||||||
|
|
||||||
std::lock_guard l(m_);
|
std::lock_guard l(m_);
|
||||||
|
|
||||||
@@ -167,8 +160,7 @@ public:
|
|||||||
std::size_t alloc = 0,
|
std::size_t alloc = 0,
|
||||||
std::size_t align = 0)
|
std::size_t align = 0)
|
||||||
: itemAlignment_(align ? align : alignof(Type))
|
: itemAlignment_(align ? align : alignof(Type))
|
||||||
, itemSize_(
|
, itemSize_(boost::alignment::align_up(sizeof(Type) + extra, itemAlignment_))
|
||||||
boost::alignment::align_up(sizeof(Type) + extra, itemAlignment_))
|
|
||||||
, slabSize_(alloc)
|
, slabSize_(alloc)
|
||||||
{
|
{
|
||||||
XRPL_ASSERT(
|
XRPL_ASSERT(
|
||||||
@@ -222,8 +214,7 @@ public:
|
|||||||
|
|
||||||
// We want to allocate the memory at a 2 MiB boundary, to make it
|
// We want to allocate the memory at a 2 MiB boundary, to make it
|
||||||
// possible to use hugepage mappings on Linux:
|
// possible to use hugepage mappings on Linux:
|
||||||
auto buf =
|
auto buf = boost::alignment::aligned_alloc(megabytes(std::size_t(2)), size);
|
||||||
boost::alignment::aligned_alloc(megabytes(std::size_t(2)), size);
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
if (!buf) [[unlikely]]
|
if (!buf) [[unlikely]]
|
||||||
@@ -241,31 +232,24 @@ public:
|
|||||||
|
|
||||||
// We need to carve out a bit of memory for the slab header
|
// We need to carve out a bit of memory for the slab header
|
||||||
// and then align the rest appropriately:
|
// and then align the rest appropriately:
|
||||||
auto slabData = reinterpret_cast<void*>(
|
auto slabData =
|
||||||
reinterpret_cast<std::uint8_t*>(buf) + sizeof(SlabBlock));
|
reinterpret_cast<void*>(reinterpret_cast<std::uint8_t*>(buf) + sizeof(SlabBlock));
|
||||||
auto slabSize = size - sizeof(SlabBlock);
|
auto slabSize = size - sizeof(SlabBlock);
|
||||||
|
|
||||||
// This operation is essentially guaranteed not to fail but
|
// This operation is essentially guaranteed not to fail but
|
||||||
// let's be careful anyways.
|
// let's be careful anyways.
|
||||||
if (!boost::alignment::align(
|
if (!boost::alignment::align(itemAlignment_, itemSize_, slabData, slabSize))
|
||||||
itemAlignment_, itemSize_, slabData, slabSize))
|
|
||||||
{
|
{
|
||||||
boost::alignment::aligned_free(buf);
|
boost::alignment::aligned_free(buf);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
slab = new (buf) SlabBlock(
|
slab = new (buf) SlabBlock(
|
||||||
slabs_.load(),
|
slabs_.load(), reinterpret_cast<std::uint8_t*>(slabData), slabSize, itemSize_);
|
||||||
reinterpret_cast<std::uint8_t*>(slabData),
|
|
||||||
slabSize,
|
|
||||||
itemSize_);
|
|
||||||
|
|
||||||
// Link the new slab
|
// Link the new slab
|
||||||
while (!slabs_.compare_exchange_weak(
|
while (!slabs_.compare_exchange_weak(
|
||||||
slab->next_,
|
slab->next_, slab, std::memory_order_release, std::memory_order_relaxed))
|
||||||
slab,
|
|
||||||
std::memory_order_release,
|
|
||||||
std::memory_order_relaxed))
|
|
||||||
{
|
{
|
||||||
; // Nothing to do
|
; // Nothing to do
|
||||||
}
|
}
|
||||||
@@ -335,24 +319,18 @@ public:
|
|||||||
{
|
{
|
||||||
// Ensure that the specified allocators are sorted from smallest to
|
// Ensure that the specified allocators are sorted from smallest to
|
||||||
// largest by size:
|
// largest by size:
|
||||||
std::sort(
|
std::sort(std::begin(cfg), std::end(cfg), [](SlabConfig const& a, SlabConfig const& b) {
|
||||||
std::begin(cfg),
|
|
||||||
std::end(cfg),
|
|
||||||
[](SlabConfig const& a, SlabConfig const& b) {
|
|
||||||
return a.extra < b.extra;
|
return a.extra < b.extra;
|
||||||
});
|
});
|
||||||
|
|
||||||
// We should never have two slabs of the same size
|
// We should never have two slabs of the same size
|
||||||
if (std::adjacent_find(
|
if (std::adjacent_find(
|
||||||
std::begin(cfg),
|
std::begin(cfg), std::end(cfg), [](SlabConfig const& a, SlabConfig const& b) {
|
||||||
std::end(cfg),
|
|
||||||
[](SlabConfig const& a, SlabConfig const& b) {
|
|
||||||
return a.extra == b.extra;
|
return a.extra == b.extra;
|
||||||
}) != cfg.end())
|
}) != cfg.end())
|
||||||
{
|
{
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
"SlabAllocatorSet<" + beast::type_name<Type>() +
|
"SlabAllocatorSet<" + beast::type_name<Type>() + ">: duplicate slab size");
|
||||||
">: duplicate slab size");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& c : cfg)
|
for (auto const& c : cfg)
|
||||||
@@ -420,5 +398,3 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif // XRPL_BASICS_SLABALLOCATOR_H_INCLUDED
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_SLICE_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_SLICE_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/contract.h>
|
#include <xrpl/basics/contract.h>
|
||||||
#include <xrpl/basics/strHex.h>
|
#include <xrpl/basics/strHex.h>
|
||||||
@@ -85,9 +84,7 @@ public:
|
|||||||
std::uint8_t
|
std::uint8_t
|
||||||
operator[](std::size_t i) const noexcept
|
operator[](std::size_t i) const noexcept
|
||||||
{
|
{
|
||||||
XRPL_ASSERT(
|
XRPL_ASSERT(i < size_, "xrpl::Slice::operator[](std::size_t) const : valid input");
|
||||||
i < size_,
|
|
||||||
"xrpl::Slice::operator[](std::size_t) const : valid input");
|
|
||||||
return data_[i];
|
return data_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,9 +159,7 @@ public:
|
|||||||
@throws std::out_of_range if pos > size()
|
@throws std::out_of_range if pos > size()
|
||||||
*/
|
*/
|
||||||
Slice
|
Slice
|
||||||
substr(
|
substr(std::size_t pos, std::size_t count = std::numeric_limits<std::size_t>::max()) const
|
||||||
std::size_t pos,
|
|
||||||
std::size_t count = std::numeric_limits<std::size_t>::max()) const
|
|
||||||
{
|
{
|
||||||
if (pos > size())
|
if (pos > size())
|
||||||
throw std::out_of_range("Requested sub-slice is out of bounds");
|
throw std::out_of_range("Requested sub-slice is out of bounds");
|
||||||
@@ -204,10 +199,7 @@ inline bool
|
|||||||
operator<(Slice const& lhs, Slice const& rhs) noexcept
|
operator<(Slice const& lhs, Slice const& rhs) noexcept
|
||||||
{
|
{
|
||||||
return std::lexicographical_compare(
|
return std::lexicographical_compare(
|
||||||
lhs.data(),
|
lhs.data(), lhs.data() + lhs.size(), rhs.data(), rhs.data() + rhs.size());
|
||||||
lhs.data() + lhs.size(),
|
|
||||||
rhs.data(),
|
|
||||||
rhs.data() + rhs.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Stream>
|
template <class Stream>
|
||||||
@@ -219,18 +211,14 @@ operator<<(Stream& s, Slice const& v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class T, std::size_t N>
|
template <class T, std::size_t N>
|
||||||
std::enable_if_t<
|
std::enable_if_t<std::is_same<T, char>::value || std::is_same<T, unsigned char>::value, Slice>
|
||||||
std::is_same<T, char>::value || std::is_same<T, unsigned char>::value,
|
|
||||||
Slice>
|
|
||||||
makeSlice(std::array<T, N> const& a)
|
makeSlice(std::array<T, N> const& a)
|
||||||
{
|
{
|
||||||
return Slice(a.data(), a.size());
|
return Slice(a.data(), a.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T, class Alloc>
|
template <class T, class Alloc>
|
||||||
std::enable_if_t<
|
std::enable_if_t<std::is_same<T, char>::value || std::is_same<T, unsigned char>::value, Slice>
|
||||||
std::is_same<T, char>::value || std::is_same<T, unsigned char>::value,
|
|
||||||
Slice>
|
|
||||||
makeSlice(std::vector<T, Alloc> const& v)
|
makeSlice(std::vector<T, Alloc> const& v)
|
||||||
{
|
{
|
||||||
return Slice(v.data(), v.size());
|
return Slice(v.data(), v.size());
|
||||||
@@ -244,5 +232,3 @@ makeSlice(std::basic_string<char, Traits, Alloc> const& s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_STRINGUTILITIES_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_STRINGUTILITIES_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/Blob.h>
|
#include <xrpl/basics/Blob.h>
|
||||||
#include <xrpl/basics/strHex.h>
|
#include <xrpl/basics/strHex.h>
|
||||||
@@ -109,8 +108,8 @@ struct parsedURL
|
|||||||
bool
|
bool
|
||||||
operator==(parsedURL const& other) const
|
operator==(parsedURL const& other) const
|
||||||
{
|
{
|
||||||
return scheme == other.scheme && domain == other.domain &&
|
return scheme == other.scheme && domain == other.domain && port == other.port &&
|
||||||
port == other.port && path == other.path;
|
path == other.path;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -133,5 +132,3 @@ bool
|
|||||||
isProperlyFormedTomlDomain(std::string_view domain);
|
isProperlyFormedTomlDomain(std::string_view domain);
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_TAGGEDCACHE_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_TAGGEDCACHE_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/IntrusivePointer.h>
|
#include <xrpl/basics/IntrusivePointer.h>
|
||||||
#include <xrpl/basics/Log.h>
|
#include <xrpl/basics/Log.h>
|
||||||
@@ -56,8 +55,7 @@ public:
|
|||||||
clock_type::duration expiration,
|
clock_type::duration expiration,
|
||||||
clock_type& clock,
|
clock_type& clock,
|
||||||
beast::Journal journal,
|
beast::Journal journal,
|
||||||
beast::insight::Collector::ptr const& collector =
|
beast::insight::Collector::ptr const& collector = beast::insight::NullCollector::New());
|
||||||
beast::insight::NullCollector::New());
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Return the clock associated with the cache. */
|
/** Return the clock associated with the cache. */
|
||||||
@@ -114,15 +112,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
template <class R>
|
template <class R>
|
||||||
bool
|
bool
|
||||||
canonicalize(
|
canonicalize(key_type const& key, SharedPointerType& data, R&& replaceCallback);
|
||||||
key_type const& key,
|
|
||||||
SharedPointerType& data,
|
|
||||||
R&& replaceCallback);
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
canonicalize_replace_cache(
|
canonicalize_replace_cache(key_type const& key, SharedPointerType const& data);
|
||||||
key_type const& key,
|
|
||||||
SharedPointerType const& data);
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
canonicalize_replace_client(key_type const& key, SharedPointerType& data);
|
canonicalize_replace_client(key_type const& key, SharedPointerType& data);
|
||||||
@@ -136,8 +129,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
template <class ReturnType = bool>
|
template <class ReturnType = bool>
|
||||||
auto
|
auto
|
||||||
insert(key_type const& key, T const& value)
|
insert(key_type const& key, T const& value) -> std::enable_if_t<!IsKeyCache, ReturnType>;
|
||||||
-> std::enable_if_t<!IsKeyCache, ReturnType>;
|
|
||||||
|
|
||||||
template <class ReturnType = bool>
|
template <class ReturnType = bool>
|
||||||
auto
|
auto
|
||||||
@@ -226,9 +218,7 @@ private:
|
|||||||
shared_weak_combo_pointer_type ptr;
|
shared_weak_combo_pointer_type ptr;
|
||||||
clock_type::time_point last_access;
|
clock_type::time_point last_access;
|
||||||
|
|
||||||
ValueEntry(
|
ValueEntry(clock_type::time_point const& last_access_, shared_pointer_type const& ptr_)
|
||||||
clock_type::time_point const& last_access_,
|
|
||||||
shared_pointer_type const& ptr_)
|
|
||||||
: ptr(ptr_), last_access(last_access_)
|
: ptr(ptr_), last_access(last_access_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -262,18 +252,13 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef
|
typedef typename std::conditional<IsKeyCache, KeyOnlyEntry, ValueEntry>::type Entry;
|
||||||
typename std::conditional<IsKeyCache, KeyOnlyEntry, ValueEntry>::type
|
|
||||||
Entry;
|
|
||||||
|
|
||||||
using KeyOnlyCacheType =
|
using KeyOnlyCacheType = hardened_partitioned_hash_map<key_type, KeyOnlyEntry, Hash, KeyEqual>;
|
||||||
hardened_partitioned_hash_map<key_type, KeyOnlyEntry, Hash, KeyEqual>;
|
|
||||||
|
|
||||||
using KeyValueCacheType =
|
using KeyValueCacheType = hardened_partitioned_hash_map<key_type, ValueEntry, Hash, KeyEqual>;
|
||||||
hardened_partitioned_hash_map<key_type, ValueEntry, Hash, KeyEqual>;
|
|
||||||
|
|
||||||
using cache_type =
|
using cache_type = hardened_partitioned_hash_map<key_type, Entry, Hash, KeyEqual>;
|
||||||
hardened_partitioned_hash_map<key_type, Entry, Hash, KeyEqual>;
|
|
||||||
|
|
||||||
[[nodiscard]] std::thread
|
[[nodiscard]] std::thread
|
||||||
sweepHelper(
|
sweepHelper(
|
||||||
@@ -316,5 +301,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_TAGGEDCACHE_IPP_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_TAGGEDCACHE_IPP_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/IntrusivePointer.ipp>
|
#include <xrpl/basics/IntrusivePointer.ipp>
|
||||||
#include <xrpl/basics/TaggedCache.h>
|
#include <xrpl/basics/TaggedCache.h>
|
||||||
@@ -53,15 +52,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline auto
|
inline auto
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
clock() -> clock_type&
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::clock() -> clock_type&
|
|
||||||
{
|
{
|
||||||
return m_clock;
|
return m_clock;
|
||||||
}
|
}
|
||||||
@@ -76,15 +68,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline std::size_t
|
inline std::size_t
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
size() const
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::size() const
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
return m_cache.size();
|
return m_cache.size();
|
||||||
@@ -100,15 +85,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline int
|
inline int
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
getCacheSize() const
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::getCacheSize() const
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
return m_cache_count;
|
return m_cache_count;
|
||||||
@@ -124,15 +102,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline int
|
inline int
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
getTrackSize() const
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::getTrackSize() const
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
return m_cache.size();
|
return m_cache.size();
|
||||||
@@ -148,15 +119,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline float
|
inline float
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
getHitRate()
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::getHitRate()
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
auto const total = static_cast<float>(m_hits + m_misses);
|
auto const total = static_cast<float>(m_hits + m_misses);
|
||||||
@@ -173,15 +137,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline void
|
inline void
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
clear()
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::clear()
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
m_cache.clear();
|
m_cache.clear();
|
||||||
@@ -198,15 +155,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline void
|
inline void
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
reset()
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::reset()
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
m_cache.clear();
|
m_cache.clear();
|
||||||
@@ -226,15 +176,8 @@ template <
|
|||||||
class Mutex>
|
class Mutex>
|
||||||
template <class KeyComparable>
|
template <class KeyComparable>
|
||||||
inline bool
|
inline bool
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
touch_if_exists(KeyComparable const& key)
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::touch_if_exists(KeyComparable const& key)
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
auto const iter(m_cache.find(key));
|
auto const iter(m_cache.find(key));
|
||||||
@@ -258,15 +201,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline void
|
inline void
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
sweep()
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::sweep()
|
|
||||||
{
|
{
|
||||||
// Keep references to all the stuff we sweep
|
// Keep references to all the stuff we sweep
|
||||||
// For performance, each worker thread should exit before the swept data
|
// For performance, each worker thread should exit before the swept data
|
||||||
@@ -280,8 +216,7 @@ TaggedCache<
|
|||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
|
|
||||||
if (m_target_size == 0 ||
|
if (m_target_size == 0 || (static_cast<int>(m_cache.size()) <= m_target_size))
|
||||||
(static_cast<int>(m_cache.size()) <= m_target_size))
|
|
||||||
{
|
{
|
||||||
when_expire = now - m_target_age;
|
when_expire = now - m_target_age;
|
||||||
}
|
}
|
||||||
@@ -294,9 +229,8 @@ TaggedCache<
|
|||||||
when_expire = now - minimumAge;
|
when_expire = now - minimumAge;
|
||||||
|
|
||||||
JLOG(m_journal.trace())
|
JLOG(m_journal.trace())
|
||||||
<< m_name << " is growing fast " << m_cache.size() << " of "
|
<< m_name << " is growing fast " << m_cache.size() << " of " << m_target_size
|
||||||
<< m_target_size << " aging at " << (now - when_expire).count()
|
<< " aging at " << (now - when_expire).count() << " of " << m_target_age.count();
|
||||||
<< " of " << m_target_age.count();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::thread> workers;
|
std::vector<std::thread> workers;
|
||||||
@@ -306,12 +240,7 @@ TaggedCache<
|
|||||||
for (std::size_t p = 0; p < m_cache.partitions(); ++p)
|
for (std::size_t p = 0; p < m_cache.partitions(); ++p)
|
||||||
{
|
{
|
||||||
workers.push_back(sweepHelper(
|
workers.push_back(sweepHelper(
|
||||||
when_expire,
|
when_expire, now, m_cache.map()[p], allStuffToSweep[p], allRemovals, lock));
|
||||||
now,
|
|
||||||
m_cache.map()[p],
|
|
||||||
allStuffToSweep[p],
|
|
||||||
allRemovals,
|
|
||||||
lock));
|
|
||||||
}
|
}
|
||||||
for (std::thread& worker : workers)
|
for (std::thread& worker : workers)
|
||||||
worker.join();
|
worker.join();
|
||||||
@@ -320,8 +249,7 @@ TaggedCache<
|
|||||||
}
|
}
|
||||||
// At this point allStuffToSweep will go out of scope outside the lock
|
// At this point allStuffToSweep will go out of scope outside the lock
|
||||||
// and decrement the reference count on each strong pointer.
|
// and decrement the reference count on each strong pointer.
|
||||||
JLOG(m_journal.debug())
|
JLOG(m_journal.debug()) << m_name << " TaggedCache sweep lock duration "
|
||||||
<< m_name << " TaggedCache sweep lock duration "
|
|
||||||
<< std::chrono::duration_cast<std::chrono::milliseconds>(
|
<< std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
std::chrono::steady_clock::now() - start)
|
std::chrono::steady_clock::now() - start)
|
||||||
.count()
|
.count()
|
||||||
@@ -338,15 +266,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline bool
|
inline bool
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
del(key_type const& key, bool valid)
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::del(key_type const& key, bool valid)
|
|
||||||
{
|
{
|
||||||
// Remove from cache, if !valid, remove from map too. Returns true if
|
// Remove from cache, if !valid, remove from map too. Returns true if
|
||||||
// removed from cache
|
// removed from cache
|
||||||
@@ -385,19 +306,8 @@ template <
|
|||||||
class Mutex>
|
class Mutex>
|
||||||
template <class R>
|
template <class R>
|
||||||
inline bool
|
inline bool
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
canonicalize(key_type const& key, SharedPointerType& data, R&& replaceCallback)
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::
|
|
||||||
canonicalize(
|
|
||||||
key_type const& key,
|
|
||||||
SharedPointerType& data,
|
|
||||||
R&& replaceCallback)
|
|
||||||
{
|
{
|
||||||
// Return canonical value, store if needed, refresh in cache
|
// Return canonical value, store if needed, refresh in cache
|
||||||
// Return values: true=we had the data already
|
// Return values: true=we had the data already
|
||||||
@@ -480,21 +390,10 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline bool
|
inline bool
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
canonicalize_replace_cache(key_type const& key, SharedPointerType const& data)
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::
|
|
||||||
canonicalize_replace_cache(
|
|
||||||
key_type const& key,
|
|
||||||
SharedPointerType const& data)
|
|
||||||
{
|
{
|
||||||
return canonicalize(
|
return canonicalize(key, const_cast<SharedPointerType&>(data), []() { return true; });
|
||||||
key, const_cast<SharedPointerType&>(data), []() { return true; });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
@@ -507,15 +406,7 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline bool
|
inline bool
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::
|
|
||||||
canonicalize_replace_client(key_type const& key, SharedPointerType& data)
|
canonicalize_replace_client(key_type const& key, SharedPointerType& data)
|
||||||
{
|
{
|
||||||
return canonicalize(key, data, []() { return false; });
|
return canonicalize(key, data, []() { return false; });
|
||||||
@@ -531,15 +422,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline SharedPointerType
|
inline SharedPointerType
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
fetch(key_type const& key)
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::fetch(key_type const& key)
|
|
||||||
{
|
{
|
||||||
std::lock_guard<mutex_type> l(m_mutex);
|
std::lock_guard<mutex_type> l(m_mutex);
|
||||||
auto ret = initialFetch(key, l);
|
auto ret = initialFetch(key, l);
|
||||||
@@ -559,16 +443,8 @@ template <
|
|||||||
class Mutex>
|
class Mutex>
|
||||||
template <class ReturnType>
|
template <class ReturnType>
|
||||||
inline auto
|
inline auto
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
insert(key_type const& key, T const& value) -> std::enable_if_t<!IsKeyCache, ReturnType>
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::insert(key_type const& key, T const& value)
|
|
||||||
-> std::enable_if_t<!IsKeyCache, ReturnType>
|
|
||||||
{
|
{
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same_v<std::shared_ptr<T>, SharedPointerType> ||
|
std::is_same_v<std::shared_ptr<T>, SharedPointerType> ||
|
||||||
@@ -597,23 +473,13 @@ template <
|
|||||||
class Mutex>
|
class Mutex>
|
||||||
template <class ReturnType>
|
template <class ReturnType>
|
||||||
inline auto
|
inline auto
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
insert(key_type const& key) -> std::enable_if_t<IsKeyCache, ReturnType>
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::insert(key_type const& key)
|
|
||||||
-> std::enable_if_t<IsKeyCache, ReturnType>
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
clock_type::time_point const now(m_clock.now());
|
clock_type::time_point const now(m_clock.now());
|
||||||
auto [it, inserted] = m_cache.emplace(
|
auto [it, inserted] = m_cache.emplace(
|
||||||
std::piecewise_construct,
|
std::piecewise_construct, std::forward_as_tuple(key), std::forward_as_tuple(now));
|
||||||
std::forward_as_tuple(key),
|
|
||||||
std::forward_as_tuple(now));
|
|
||||||
if (!inserted)
|
if (!inserted)
|
||||||
it->second.last_access = now;
|
it->second.last_access = now;
|
||||||
return inserted;
|
return inserted;
|
||||||
@@ -629,15 +495,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline bool
|
inline bool
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
retrieve(key_type const& key, T& data)
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::retrieve(key_type const& key, T& data)
|
|
||||||
{
|
{
|
||||||
// retrieve the value of the stored data
|
// retrieve the value of the stored data
|
||||||
auto entry = fetch(key);
|
auto entry = fetch(key);
|
||||||
@@ -659,15 +518,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline auto
|
inline auto
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
peekMutex() -> mutex_type&
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::peekMutex() -> mutex_type&
|
|
||||||
{
|
{
|
||||||
return m_mutex;
|
return m_mutex;
|
||||||
}
|
}
|
||||||
@@ -682,15 +534,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline auto
|
inline auto
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
getKeys() const -> std::vector<key_type>
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::getKeys() const -> std::vector<key_type>
|
|
||||||
{
|
{
|
||||||
std::vector<key_type> v;
|
std::vector<key_type> v;
|
||||||
|
|
||||||
@@ -714,15 +559,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline double
|
inline double
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
rate() const
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::rate() const
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
auto const tot = m_hits + m_misses;
|
auto const tot = m_hits + m_misses;
|
||||||
@@ -742,15 +580,8 @@ template <
|
|||||||
class Mutex>
|
class Mutex>
|
||||||
template <class Handler>
|
template <class Handler>
|
||||||
inline SharedPointerType
|
inline SharedPointerType
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
fetch(key_type const& digest, Handler const& h)
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::fetch(key_type const& digest, Handler const& h)
|
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::lock_guard l(m_mutex);
|
std::lock_guard l(m_mutex);
|
||||||
@@ -764,8 +595,7 @@ TaggedCache<
|
|||||||
|
|
||||||
std::lock_guard l(m_mutex);
|
std::lock_guard l(m_mutex);
|
||||||
++m_misses;
|
++m_misses;
|
||||||
auto const [it, inserted] =
|
auto const [it, inserted] = m_cache.emplace(digest, Entry(m_clock.now(), std::move(sle)));
|
||||||
m_cache.emplace(digest, Entry(m_clock.now(), std::move(sle)));
|
|
||||||
if (!inserted)
|
if (!inserted)
|
||||||
it->second.touch(m_clock.now());
|
it->second.touch(m_clock.now());
|
||||||
return it->second.ptr.getStrong();
|
return it->second.ptr.getStrong();
|
||||||
@@ -782,15 +612,7 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline SharedPointerType
|
inline SharedPointerType
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::
|
|
||||||
initialFetch(key_type const& key, std::lock_guard<mutex_type> const& l)
|
initialFetch(key_type const& key, std::lock_guard<mutex_type> const& l)
|
||||||
{
|
{
|
||||||
auto cit = m_cache.find(key);
|
auto cit = m_cache.find(key);
|
||||||
@@ -827,15 +649,8 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline void
|
inline void
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
collect_metrics()
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::collect_metrics()
|
|
||||||
{
|
{
|
||||||
m_stats.size.set(getCacheSize());
|
m_stats.size.set(getCacheSize());
|
||||||
|
|
||||||
@@ -861,15 +676,7 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline std::thread
|
inline std::thread
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::
|
|
||||||
sweepHelper(
|
sweepHelper(
|
||||||
clock_type::time_point const& when_expire,
|
clock_type::time_point const& when_expire,
|
||||||
[[maybe_unused]] clock_type::time_point const& now,
|
[[maybe_unused]] clock_type::time_point const& now,
|
||||||
@@ -931,9 +738,8 @@ TaggedCache<
|
|||||||
if (mapRemovals || cacheRemovals)
|
if (mapRemovals || cacheRemovals)
|
||||||
{
|
{
|
||||||
JLOG(m_journal.debug())
|
JLOG(m_journal.debug())
|
||||||
<< "TaggedCache partition sweep " << m_name
|
<< "TaggedCache partition sweep " << m_name << ": cache = " << partition.size()
|
||||||
<< ": cache = " << partition.size() << "-" << cacheRemovals
|
<< "-" << cacheRemovals << ", map-=" << mapRemovals;
|
||||||
<< ", map-=" << mapRemovals;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allRemovals += cacheRemovals;
|
allRemovals += cacheRemovals;
|
||||||
@@ -950,15 +756,7 @@ template <
|
|||||||
class KeyEqual,
|
class KeyEqual,
|
||||||
class Mutex>
|
class Mutex>
|
||||||
inline std::thread
|
inline std::thread
|
||||||
TaggedCache<
|
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||||
Key,
|
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::
|
|
||||||
sweepHelper(
|
sweepHelper(
|
||||||
clock_type::time_point const& when_expire,
|
clock_type::time_point const& when_expire,
|
||||||
clock_type::time_point const& now,
|
clock_type::time_point const& now,
|
||||||
@@ -996,9 +794,8 @@ TaggedCache<
|
|||||||
if (mapRemovals || cacheRemovals)
|
if (mapRemovals || cacheRemovals)
|
||||||
{
|
{
|
||||||
JLOG(m_journal.debug())
|
JLOG(m_journal.debug())
|
||||||
<< "TaggedCache partition sweep " << m_name
|
<< "TaggedCache partition sweep " << m_name << ": cache = " << partition.size()
|
||||||
<< ": cache = " << partition.size() << "-" << cacheRemovals
|
<< "-" << cacheRemovals << ", map-=" << mapRemovals;
|
||||||
<< ", map-=" << mapRemovals;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allRemovals += cacheRemovals;
|
allRemovals += cacheRemovals;
|
||||||
@@ -1006,5 +803,3 @@ TaggedCache<
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_TOSTRING_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_TOSTRING_H_INCLUDED
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@@ -44,5 +43,3 @@ to_string(char const* s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_UNORDEREDCONTAINERS_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_UNORDEREDCONTAINERS_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/hardened_hash.h>
|
#include <xrpl/basics/hardened_hash.h>
|
||||||
#include <xrpl/basics/partitioned_unordered_map.h>
|
#include <xrpl/basics/partitioned_unordered_map.h>
|
||||||
@@ -40,8 +39,7 @@ template <
|
|||||||
class Hash = beast::uhash<>,
|
class Hash = beast::uhash<>,
|
||||||
class Pred = std::equal_to<Key>,
|
class Pred = std::equal_to<Key>,
|
||||||
class Allocator = std::allocator<std::pair<Key const, Value>>>
|
class Allocator = std::allocator<std::pair<Key const, Value>>>
|
||||||
using hash_multimap =
|
using hash_multimap = std::unordered_multimap<Key, Value, Hash, Pred, Allocator>;
|
||||||
std::unordered_multimap<Key, Value, Hash, Pred, Allocator>;
|
|
||||||
|
|
||||||
template <
|
template <
|
||||||
class Value,
|
class Value,
|
||||||
@@ -75,8 +73,7 @@ template <
|
|||||||
class Hash = hardened_hash<strong_hash>,
|
class Hash = hardened_hash<strong_hash>,
|
||||||
class Pred = std::equal_to<Key>,
|
class Pred = std::equal_to<Key>,
|
||||||
class Allocator = std::allocator<std::pair<Key const, Value>>>
|
class Allocator = std::allocator<std::pair<Key const, Value>>>
|
||||||
using hardened_partitioned_hash_map =
|
using hardened_partitioned_hash_map = partitioned_unordered_map<Key, Value, Hash, Pred, Allocator>;
|
||||||
partitioned_unordered_map<Key, Value, Hash, Pred, Allocator>;
|
|
||||||
|
|
||||||
template <
|
template <
|
||||||
class Key,
|
class Key,
|
||||||
@@ -84,8 +81,7 @@ template <
|
|||||||
class Hash = hardened_hash<strong_hash>,
|
class Hash = hardened_hash<strong_hash>,
|
||||||
class Pred = std::equal_to<Key>,
|
class Pred = std::equal_to<Key>,
|
||||||
class Allocator = std::allocator<std::pair<Key const, Value>>>
|
class Allocator = std::allocator<std::pair<Key const, Value>>>
|
||||||
using hardened_hash_multimap =
|
using hardened_hash_multimap = std::unordered_multimap<Key, Value, Hash, Pred, Allocator>;
|
||||||
std::unordered_multimap<Key, Value, Hash, Pred, Allocator>;
|
|
||||||
|
|
||||||
template <
|
template <
|
||||||
class Value,
|
class Value,
|
||||||
@@ -99,9 +95,6 @@ template <
|
|||||||
class Hash = hardened_hash<strong_hash>,
|
class Hash = hardened_hash<strong_hash>,
|
||||||
class Pred = std::equal_to<Value>,
|
class Pred = std::equal_to<Value>,
|
||||||
class Allocator = std::allocator<Value>>
|
class Allocator = std::allocator<Value>>
|
||||||
using hardened_hash_multiset =
|
using hardened_hash_multiset = std::unordered_multiset<Value, Hash, Pred, Allocator>;
|
||||||
std::unordered_multiset<Value, Hash, Pred, Allocator>;
|
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_UPTIMETIMER_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_UPTIMETIMER_H_INCLUDED
|
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -46,5 +45,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_ALGORITHM_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_ALGORITHM_H_INCLUDED
|
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@@ -96,5 +95,3 @@ remove_if_intersect_or_match(
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -32,8 +32,7 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef XRPL_BASICS_BASE64_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_BASE64_H_INCLUDED
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -46,13 +45,10 @@ base64_encode(std::uint8_t const* data, std::size_t len);
|
|||||||
inline std::string
|
inline std::string
|
||||||
base64_encode(std::string const& s)
|
base64_encode(std::string const& s)
|
||||||
{
|
{
|
||||||
return base64_encode(
|
return base64_encode(reinterpret_cast<std::uint8_t const*>(s.data()), s.size());
|
||||||
reinterpret_cast<std::uint8_t const*>(s.data()), s.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
base64_decode(std::string_view data);
|
base64_decode(std::string_view data);
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#ifndef XRPL_BASICS_BASE_UINT_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_BASE_UINT_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/Expected.h>
|
#include <xrpl/basics/Expected.h>
|
||||||
#include <xrpl/basics/Slice.h>
|
#include <xrpl/basics/Slice.h>
|
||||||
@@ -65,13 +64,9 @@ struct is_contiguous_container<Slice> : std::true_type
|
|||||||
template <std::size_t Bits, class Tag = void>
|
template <std::size_t Bits, class Tag = void>
|
||||||
class base_uint
|
class base_uint
|
||||||
{
|
{
|
||||||
static_assert(
|
static_assert((Bits % 32) == 0, "The length of a base_uint in bits must be a multiple of 32.");
|
||||||
(Bits % 32) == 0,
|
|
||||||
"The length of a base_uint in bits must be a multiple of 32.");
|
|
||||||
|
|
||||||
static_assert(
|
static_assert(Bits >= 64, "The length of a base_uint in bits must be at least 64.");
|
||||||
Bits >= 64,
|
|
||||||
"The length of a base_uint in bits must be at least 64.");
|
|
||||||
|
|
||||||
static constexpr std::size_t WIDTH = Bits / 32;
|
static constexpr std::size_t WIDTH = Bits / 32;
|
||||||
|
|
||||||
@@ -182,9 +177,7 @@ private:
|
|||||||
{
|
{
|
||||||
// Local lambda that converts a single hex char to four bits and
|
// Local lambda that converts a single hex char to four bits and
|
||||||
// ORs those bits into a uint32_t.
|
// ORs those bits into a uint32_t.
|
||||||
auto hexCharToUInt = [](char c,
|
auto hexCharToUInt = [](char c, std::uint32_t shift, std::uint32_t& accum) -> ParseResult {
|
||||||
std::uint32_t shift,
|
|
||||||
std::uint32_t& accum) -> ParseResult {
|
|
||||||
std::uint32_t nibble = 0xFFu;
|
std::uint32_t nibble = 0xFFu;
|
||||||
if (c < '0' || c > 'f')
|
if (c < '0' || c > 'f')
|
||||||
return ParseResult::badChar;
|
return ParseResult::badChar;
|
||||||
@@ -387,8 +380,7 @@ public:
|
|||||||
// prefix operator
|
// prefix operator
|
||||||
for (int i = WIDTH - 1; i >= 0; --i)
|
for (int i = WIDTH - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
data_[i] = boost::endian::native_to_big(
|
data_[i] = boost::endian::native_to_big(boost::endian::big_to_native(data_[i]) + 1);
|
||||||
boost::endian::big_to_native(data_[i]) + 1);
|
|
||||||
if (data_[i] != 0)
|
if (data_[i] != 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -412,8 +404,7 @@ public:
|
|||||||
for (int i = WIDTH - 1; i >= 0; --i)
|
for (int i = WIDTH - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
auto prev = data_[i];
|
auto prev = data_[i];
|
||||||
data_[i] = boost::endian::native_to_big(
|
data_[i] = boost::endian::native_to_big(boost::endian::big_to_native(data_[i]) - 1);
|
||||||
boost::endian::big_to_native(data_[i]) - 1);
|
|
||||||
|
|
||||||
if (prev != 0)
|
if (prev != 0)
|
||||||
break;
|
break;
|
||||||
@@ -456,8 +447,7 @@ public:
|
|||||||
std::uint64_t n = carry + boost::endian::big_to_native(data_[i]) +
|
std::uint64_t n = carry + boost::endian::big_to_native(data_[i]) +
|
||||||
boost::endian::big_to_native(b.data_[i]);
|
boost::endian::big_to_native(b.data_[i]);
|
||||||
|
|
||||||
data_[i] =
|
data_[i] = boost::endian::native_to_big(static_cast<std::uint32_t>(n));
|
||||||
boost::endian::native_to_big(static_cast<std::uint32_t>(n));
|
|
||||||
carry = n >> 32;
|
carry = n >> 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,8 +547,7 @@ operator<=>(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
|
|||||||
if (ret.first == lhs.cend())
|
if (ret.first == lhs.cend())
|
||||||
return std::strong_ordering::equivalent;
|
return std::strong_ordering::equivalent;
|
||||||
|
|
||||||
return (*ret.first > *ret.second) ? std::strong_ordering::greater
|
return (*ret.first > *ret.second) ? std::strong_ordering::greater : std::strong_ordering::less;
|
||||||
: std::strong_ordering::less;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <std::size_t Bits, typename Tag>
|
template <std::size_t Bits, typename Tag>
|
||||||
@@ -617,9 +606,7 @@ template <std::size_t Bits, class Tag>
|
|||||||
inline std::string
|
inline std::string
|
||||||
to_short_string(base_uint<Bits, Tag> const& a)
|
to_short_string(base_uint<Bits, Tag> const& a)
|
||||||
{
|
{
|
||||||
static_assert(
|
static_assert(base_uint<Bits, Tag>::bytes > 4, "For 4 bytes or less, use a native type");
|
||||||
base_uint<Bits, Tag>::bytes > 4,
|
|
||||||
"For 4 bytes or less, use a native type");
|
|
||||||
return strHex(a.cbegin(), a.cbegin() + 4) + "...";
|
return strHex(a.cbegin(), a.cbegin() + 4) + "...";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,12 +640,9 @@ static_assert(sizeof(uint256) == 256 / 8, "There should be no padding bytes");
|
|||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
template <std::size_t Bits, class Tag>
|
template <std::size_t Bits, class Tag>
|
||||||
struct is_uniquely_represented<xrpl::base_uint<Bits, Tag>>
|
struct is_uniquely_represented<xrpl::base_uint<Bits, Tag>> : public std::true_type
|
||||||
: public std::true_type
|
|
||||||
{
|
{
|
||||||
explicit is_uniquely_represented() = default;
|
explicit is_uniquely_represented() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace beast
|
} // namespace beast
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_CHRONO_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_CHRONO_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/beast/clock/abstract_clock.h>
|
#include <xrpl/beast/clock/abstract_clock.h>
|
||||||
#include <xrpl/beast/clock/basic_seconds_clock.h>
|
#include <xrpl/beast/clock/basic_seconds_clock.h>
|
||||||
@@ -16,12 +15,10 @@ namespace xrpl {
|
|||||||
|
|
||||||
// A few handy aliases
|
// A few handy aliases
|
||||||
|
|
||||||
using days = std::chrono::duration<
|
using days =
|
||||||
int,
|
std::chrono::duration<int, std::ratio_multiply<std::chrono::hours::period, std::ratio<24>>>;
|
||||||
std::ratio_multiply<std::chrono::hours::period, std::ratio<24>>>;
|
|
||||||
|
|
||||||
using weeks = std::chrono::
|
using weeks = std::chrono::duration<int, std::ratio_multiply<days::period, std::ratio<7>>>;
|
||||||
duration<int, std::ratio_multiply<days::period, std::ratio<7>>>;
|
|
||||||
|
|
||||||
/** Clock for measuring the network time.
|
/** Clock for measuring the network time.
|
||||||
|
|
||||||
@@ -34,8 +31,7 @@ using weeks = std::chrono::
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
constexpr static std::chrono::seconds epoch_offset =
|
constexpr static std::chrono::seconds epoch_offset =
|
||||||
date::sys_days{date::year{2000} / 1 / 1} -
|
date::sys_days{date::year{2000} / 1 / 1} - date::sys_days{date::year{1970} / 1 / 1};
|
||||||
date::sys_days{date::year{1970} / 1 / 1};
|
|
||||||
|
|
||||||
static_assert(epoch_offset.count() == 946684800);
|
static_assert(epoch_offset.count() == 946684800);
|
||||||
|
|
||||||
@@ -64,8 +60,7 @@ to_string(NetClock::time_point tp)
|
|||||||
{
|
{
|
||||||
// 2000-01-01 00:00:00 UTC is 946684800s from 1970-01-01 00:00:00 UTC
|
// 2000-01-01 00:00:00 UTC is 946684800s from 1970-01-01 00:00:00 UTC
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
return to_string(
|
return to_string(system_clock::time_point{tp.time_since_epoch() + epoch_offset});
|
||||||
system_clock::time_point{tp.time_since_epoch() + epoch_offset});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Duration>
|
template <class Duration>
|
||||||
@@ -82,8 +77,7 @@ to_string_iso(NetClock::time_point tp)
|
|||||||
// 2000-01-01 00:00:00 UTC is 946684800s from 1970-01-01 00:00:00 UTC
|
// 2000-01-01 00:00:00 UTC is 946684800s from 1970-01-01 00:00:00 UTC
|
||||||
// Note, NetClock::duration is seconds, as checked by static_assert
|
// Note, NetClock::duration is seconds, as checked by static_assert
|
||||||
static_assert(std::is_same_v<NetClock::duration::period, std::ratio<1>>);
|
static_assert(std::is_same_v<NetClock::duration::period, std::ratio<1>>);
|
||||||
return to_string_iso(date::sys_time<NetClock::duration>{
|
return to_string_iso(date::sys_time<NetClock::duration>{tp.time_since_epoch() + epoch_offset});
|
||||||
tp.time_since_epoch() + epoch_offset});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A clock for measuring elapsed time.
|
/** A clock for measuring elapsed time.
|
||||||
@@ -105,5 +99,3 @@ stopwatch()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef XRPL_BASICS_COMPARATORS_H_INCLUDED
|
#pragma once
|
||||||
#define XRPL_BASICS_COMPARATORS_H_INCLUDED
|
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@@ -53,5 +52,3 @@ using equal_to = std::equal_to<T>;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace xrpl
|
} // namespace xrpl
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user