Skip to content

Commit 68e4fbd

Browse files
committed
Merge remote-tracking branch 'origin/develop' into tapanito/lending-fix-amendment
2 parents bb0a09a + 5c8dfe5 commit 68e4fbd

107 files changed

Lines changed: 777 additions & 717 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-tidy

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
# This entire group of checks was applied to all cpp files but not all header files.
3+
# ---
24
Checks: "-*,
35
bugprone-argument-comment,
46
bugprone-assert-side-effect,
@@ -8,26 +10,26 @@ Checks: "-*,
810
bugprone-chained-comparison,
911
bugprone-compare-pointer-to-member-virtual-function,
1012
bugprone-copy-constructor-init,
11-
bugprone-crtp-constructor-accessibility,
13+
# bugprone-crtp-constructor-accessibility, # has issues
1214
bugprone-dangling-handle,
1315
bugprone-dynamic-static-initializers,
14-
bugprone-empty-catch,
16+
# bugprone-empty-catch, # has issues
1517
bugprone-fold-init-type,
16-
bugprone-forward-declaration-namespace,
17-
bugprone-inaccurate-erase,
18-
bugprone-inc-dec-in-conditions,
19-
bugprone-incorrect-enable-if,
20-
bugprone-incorrect-roundings,
21-
bugprone-infinite-loop,
22-
bugprone-integer-division,
18+
# bugprone-forward-declaration-namespace, # has issues
19+
# bugprone-inaccurate-erase,
20+
# bugprone-inc-dec-in-conditions,
21+
# bugprone-incorrect-enable-if,
22+
# bugprone-incorrect-roundings,
23+
# bugprone-infinite-loop,
24+
# bugprone-integer-division,
2325
bugprone-lambda-function-name,
24-
bugprone-macro-parentheses,
26+
# bugprone-macro-parentheses, # has issues
2527
bugprone-macro-repeated-side-effects,
2628
bugprone-misplaced-operator-in-strlen-in-alloc,
2729
bugprone-misplaced-pointer-arithmetic-in-alloc,
2830
bugprone-misplaced-widening-cast,
2931
bugprone-move-forwarding-reference,
30-
bugprone-multi-level-implicit-pointer-conversion,
32+
# bugprone-multi-level-implicit-pointer-conversion, # has issues
3133
bugprone-multiple-new-in-one-expression,
3234
bugprone-multiple-statement-macro,
3335
bugprone-no-escape,
@@ -37,13 +39,13 @@ Checks: "-*,
3739
bugprone-pointer-arithmetic-on-polymorphic-object,
3840
bugprone-posix-return,
3941
bugprone-redundant-branch-condition,
40-
bugprone-reserved-identifier,
41-
bugprone-return-const-ref-from-parameter,
42+
# bugprone-reserved-identifier, # has issues
43+
# bugprone-return-const-ref-from-parameter, # has issues
4244
bugprone-shared-ptr-array-mismatch,
4345
bugprone-signal-handler,
4446
bugprone-signed-char-misuse,
4547
bugprone-sizeof-container,
46-
bugprone-sizeof-expression,
48+
# bugprone-sizeof-expression, # has issues
4749
bugprone-spuriously-wake-up-functions,
4850
bugprone-standalone-empty,
4951
bugprone-string-constructor,
@@ -60,7 +62,7 @@ Checks: "-*,
6062
bugprone-suspicious-string-compare,
6163
bugprone-suspicious-stringview-data-usage,
6264
bugprone-swapped-arguments,
63-
bugprone-switch-missing-default-case,
65+
# bugprone-switch-missing-default-case, # has issues
6466
bugprone-terminating-continue,
6567
bugprone-throw-keyword-missing,
6668
bugprone-too-small-loop-variable,
@@ -71,61 +73,66 @@ Checks: "-*,
7173
bugprone-unhandled-self-assignment,
7274
bugprone-unique-ptr-array-mismatch,
7375
bugprone-unsafe-functions,
74-
bugprone-use-after-move,
76+
# bugprone-use-after-move, # has issues
7577
bugprone-unused-raii,
7678
bugprone-unused-return-value,
7779
bugprone-unused-local-non-trivial-variable,
7880
bugprone-virtual-near-miss,
79-
cppcoreguidelines-init-variables,
80-
cppcoreguidelines-misleading-capture-default-by-value,
81+
# cppcoreguidelines-init-variables, # has issues
82+
# cppcoreguidelines-misleading-capture-default-by-value, # has issues
8183
cppcoreguidelines-no-suspend-with-lock,
82-
cppcoreguidelines-pro-type-member-init,
84+
# cppcoreguidelines-pro-type-member-init, # has issues
8385
cppcoreguidelines-pro-type-static-cast-downcast,
84-
cppcoreguidelines-rvalue-reference-param-not-moved,
85-
cppcoreguidelines-use-default-member-init,
86-
cppcoreguidelines-virtual-class-destructor,
86+
# cppcoreguidelines-rvalue-reference-param-not-moved, # has issues
87+
# cppcoreguidelines-use-default-member-init, # has issues
88+
# cppcoreguidelines-virtual-class-destructor, # has issues
8789
hicpp-ignored-remove-result,
88-
misc-definitions-in-headers,
90+
# misc-definitions-in-headers, # has issues
8991
misc-header-include-cycle,
9092
misc-misplaced-const,
9193
misc-static-assert,
92-
misc-throw-by-value-catch-by-reference,
94+
# misc-throw-by-value-catch-by-reference, # has issues
9395
misc-unused-alias-decls,
9496
misc-unused-using-decls,
9597
modernize-deprecated-headers,
9698
modernize-make-shared,
9799
modernize-make-unique,
100+
performance-faster-string-find,
101+
performance-for-range-copy,
98102
performance-implicit-conversion-in-loop,
103+
performance-inefficient-vector-operation,
104+
performance-move-const-arg,
99105
performance-move-constructor-init,
106+
performance-no-automatic-move,
100107
performance-trivially-destructible,
101-
readability-avoid-nested-conditional-operator,
102-
readability-avoid-return-with-void-value,
103-
readability-braces-around-statements,
104-
readability-const-return-type,
105-
readability-container-contains,
106-
readability-container-size-empty,
107-
readability-convert-member-functions-to-static,
108+
# readability-avoid-nested-conditional-operator, # has issues
109+
# readability-avoid-return-with-void-value, # has issues
110+
# readability-braces-around-statements, # has issues
111+
# readability-const-return-type, # has issues
112+
# readability-container-contains, # has issues
113+
# readability-container-size-empty, # has issues
114+
# readability-convert-member-functions-to-static, # has issues
108115
readability-duplicate-include,
109-
readability-else-after-return,
110-
readability-enum-initial-value,
111-
readability-implicit-bool-conversion,
112-
readability-make-member-function-const,
113-
readability-math-missing-parentheses,
116+
# readability-else-after-return, # has issues
117+
# readability-enum-initial-value, # has issues
118+
# readability-implicit-bool-conversion, # has issues
119+
# readability-make-member-function-const, # has issues
120+
# readability-math-missing-parentheses, # has issues
114121
readability-misleading-indentation,
115122
readability-non-const-parameter,
116-
readability-redundant-casting,
117-
readability-redundant-declaration,
118-
readability-redundant-inline-specifier,
119-
readability-redundant-member-init,
123+
# readability-redundant-casting, # has issues
124+
# readability-redundant-declaration, # has issues
125+
# readability-redundant-inline-specifier, # has issues
126+
# readability-redundant-member-init, # has issues
120127
readability-redundant-string-init,
121128
readability-reference-to-constructed-temporary,
122-
readability-simplify-boolean-expr,
123-
readability-static-definition-in-anonymous-namespace,
124-
readability-suspicious-call-argument,
129+
# readability-simplify-boolean-expr, # has issues
130+
# readability-static-definition-in-anonymous-namespace, # has issues
131+
# readability-suspicious-call-argument, # has issues
125132
readability-use-std-min-max
126133
"
127134
# ---
128-
# checks that have some issues that need to be resolved:
135+
# other checks that have issues that need to be resolved:
129136
#
130137
# llvm-namespace-comment,
131138
# misc-const-correctness,
@@ -134,7 +141,7 @@ Checks: "-*,
134141
#
135142
# readability-inconsistent-declaration-parameter-name, # in this codebase this check will break a lot of arg names
136143
# readability-static-accessed-through-instance, # this check is probably unnecessary. it makes the code less readable
137-
# readability-identifier-naming,
144+
# readability-identifier-naming, # https://github.com/XRPLF/rippled/pull/6571
138145
#
139146
# modernize-concat-nested-namespaces,
140147
# modernize-pass-by-value,
@@ -148,12 +155,6 @@ Checks: "-*,
148155
# modernize-use-starts-ends-with,
149156
# modernize-use-std-numbers,
150157
# modernize-use-using,
151-
#
152-
# performance-faster-string-find,
153-
# performance-for-range-copy,
154-
# performance-inefficient-vector-operation,
155-
# performance-move-const-arg,
156-
# performance-no-automatic-move,
157158
# ---
158159
#
159160
CheckOptions:
@@ -195,5 +196,6 @@ CheckOptions:
195196
bugprone-unused-return-value.CheckedReturnTypes: ::std::error_code;::std::error_condition;::std::errc
196197
# 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'
197198
#
198-
# HeaderFilterRegex: '^.*/(src|tests)/.*\.(h|hpp)$'
199+
HeaderFilterRegex: '^.*/(test|xrpl|xrpld)/.*\.(h|hpp)$'
200+
ExcludeHeaderFilterRegex: '^.*/protocol_autogen/.*\.(h|hpp)$'
199201
WarningsAsErrors: "*"

.github/workflows/publish-docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ jobs:
8181
cmake --build . --target docs --parallel ${BUILD_NPROC}
8282
8383
- name: Create documentation artifact
84-
if: ${{ github.event_name == 'push' }}
84+
if: ${{ github.event.repository.visibility == 'public' && github.event_name == 'push' }}
8585
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
8686
with:
8787
path: ${{ env.BUILD_DIR }}/docs/html
8888

8989
deploy:
90-
if: ${{ github.event_name == 'push' }}
90+
if: ${{ github.event.repository.visibility == 'public' && github.event_name == 'push' }}
9191
needs: build
9292
runs-on: ubuntu-latest
9393
permissions:
@@ -99,4 +99,4 @@ jobs:
9999
steps:
100100
- name: Deploy to GitHub Pages
101101
id: deploy
102-
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
102+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0

.github/workflows/reusable-build-test-config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ jobs:
298298
299299
- name: Upload coverage report
300300
if: ${{ github.repository == 'XRPLF/rippled' && !inputs.build_only && env.COVERAGE_ENABLED == 'true' }}
301-
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5.5.3
301+
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
302302
with:
303303
disable_search: true
304304
disable_telem: true

include/xrpl/core/Coro.ipp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,24 @@ JobQueue::Coro::resume()
7070
running_ = true;
7171
}
7272
{
73-
std::lock_guard lock(jq_.m_mutex);
73+
std::lock_guard lk(jq_.m_mutex);
7474
--jq_.nSuspend_;
7575
}
7676
auto saved = detail::getLocalValues().release();
7777
detail::getLocalValues().reset(&lvs_);
7878
std::lock_guard lock(mutex_);
79-
XRPL_ASSERT(static_cast<bool>(coro_), "xrpl::JobQueue::Coro::resume : is runnable");
80-
coro_();
79+
// A late resume() can arrive after the coroutine has already completed.
80+
// This is an expected (if rare) outcome of the race condition documented
81+
// in JobQueue.h:354-377 where post() schedules a resume job before the
82+
// coroutine yields — the mutex serializes access, but by the time this
83+
// resume() acquires the lock the coroutine may have already run to
84+
// completion. Calling operator() on a completed boost::coroutine2 is
85+
// undefined behavior, so we must check and skip invoking the coroutine
86+
// body if it has already completed.
87+
if (coro_)
88+
{
89+
coro_();
90+
}
8191
detail::getLocalValues().release();
8292
detail::getLocalValues().reset(saved);
8393
std::lock_guard lk(mutex_run_);

include/xrpl/core/JobQueue.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ class JobQueue : private Workers::Callback
9999
Effects:
100100
The coroutine continues execution from where it last left off
101101
using this same thread.
102-
Undefined behavior if called after the coroutine has completed
103-
with a return (as opposed to a yield()).
102+
If the coroutine has already completed, returns immediately
103+
(handles the documented post-before-yield race condition).
104104
Undefined behavior if resume() or post() called consecutively
105105
without a corresponding yield.
106106
*/
@@ -357,8 +357,10 @@ class JobQueue : private Workers::Callback
357357
If the post() job were to be executed before yield(), undefined behavior
358358
would occur. The lock ensures that coro_ is not called again until we exit
359359
the coroutine. At which point a scheduled resume() job waiting on the lock
360-
would gain entry, harmlessly call coro_ and immediately return as we have
361-
already completed the coroutine.
360+
would gain entry. resume() checks if the coroutine has already completed
361+
(coro_ converts to false) and, if so, skips invoking operator() since
362+
calling operator() on a completed boost::coroutine2 pull_type is undefined
363+
behavior.
362364
363365
The race condition occurs as follows:
364366

include/xrpl/core/StartUpType.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace xrpl {
77

8-
enum class StartUpType { FRESH, NORMAL, LOAD, LOAD_FILE, REPLAY, NETWORK };
8+
enum class StartUpType { Fresh, Normal, Load, LoadFile, Replay, Network };
99

1010
inline std::ostream&
1111
operator<<(std::ostream& os, StartUpType const& type)

include/xrpl/ledger/OrderBookDB.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,33 @@ class OrderBookDB
7676
@return true if a book from this issue to XRP exists
7777
*/
7878
virtual bool
79-
isBookToXRP(Issue const& issue, std::optional<Domain> domain = std::nullopt) = 0;
80-
79+
isBookToXRP(Issue const& issue, std::optional<Domain> const& domain = std::nullopt) = 0;
80+
81+
/**
82+
* Process a transaction for order book tracking.
83+
* @param ledger The ledger the transaction was applied to
84+
* @param alTx The transaction to process
85+
* @param jvObj The JSON object of the transaction
86+
*/
8187
virtual void
8288
processTxn(
8389
std::shared_ptr<ReadView const> const& ledger,
8490
AcceptedLedgerTx const& alTx,
8591
MultiApiJson const& jvObj) = 0;
8692

93+
/**
94+
* Get the book listeners for a book.
95+
* @param book The book to get the listeners for
96+
* @return The book listeners for the book
97+
*/
8798
virtual BookListeners::pointer
8899
getBookListeners(Book const&) = 0;
100+
101+
/**
102+
* Create a new book listeners for a book.
103+
* @param book The book to create the listeners for
104+
* @return The new book listeners for the book
105+
*/
89106
virtual BookListeners::pointer
90107
makeBookListeners(Book const&) = 0;
91108
};

include/xrpl/protocol/STVector256.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ class STVector256 : public STBase, public CountedObject<STVector256>
6969
std::vector<uint256>::iterator
7070
insert(std::vector<uint256>::const_iterator pos, uint256 const& value);
7171

72-
std::vector<uint256>::iterator
73-
insert(std::vector<uint256>::const_iterator pos, uint256&& value);
74-
7572
void
7673
push_back(uint256 const& v);
7774

@@ -184,12 +181,6 @@ STVector256::insert(std::vector<uint256>::const_iterator pos, uint256 const& val
184181
return mValue.insert(pos, value);
185182
}
186183

187-
inline std::vector<uint256>::iterator
188-
STVector256::insert(std::vector<uint256>::const_iterator pos, uint256&& value)
189-
{
190-
return mValue.insert(pos, std::move(value));
191-
}
192-
193184
inline void
194185
STVector256::push_back(uint256 const& v)
195186
{

include/xrpl/protocol/TxSearched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
namespace xrpl {
44

5-
enum class TxSearched { all, some, unknown };
5+
enum class TxSearched { All, Some, Unknown };
66

77
}

include/xrpl/rdb/DatabaseCon.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class DatabaseCon
7070
{
7171
explicit Setup() = default;
7272

73-
StartUpType startUp = StartUpType::NORMAL;
73+
StartUpType startUp = StartUpType::Normal;
7474
bool standAlone = false;
7575
boost::filesystem::path dataDir;
7676
// Indicates whether or not to return the `globalPragma`
@@ -107,9 +107,8 @@ class DatabaseCon
107107
beast::Journal journal)
108108
// Use temporary files or regular DB files?
109109
: DatabaseCon(
110-
setup.standAlone && setup.startUp != StartUpType::LOAD &&
111-
setup.startUp != StartUpType::LOAD_FILE &&
112-
setup.startUp != StartUpType::REPLAY
110+
setup.standAlone && setup.startUp != StartUpType::Load &&
111+
setup.startUp != StartUpType::LoadFile && setup.startUp != StartUpType::Replay
113112
? ""
114113
: (setup.dataDir / dbName),
115114
setup.commonPragma(),

0 commit comments

Comments
 (0)