Compare commits

..

141 Commits

Author SHA1 Message Date
Valentin Balaschenko
f2df3e1e31 disable malloc trim 2026-05-15 17:31:47 +01:00
Bart
9715573b2b release: Bump version to 3.2.0-b5 2026-05-13 17:57:16 -04:00
Bart
7a2562dc2b chore: Consolidate fix amendments (#7134)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
2026-05-13 17:56:42 -04:00
Michael Legleux
282907b08f ci: Add Conan retry (#7147) 2026-05-13 17:56:42 -04:00
Olek
dbd6c84e58 fix: Backport Permissioned Domains fixes (#7016) 2026-05-13 17:56:42 -04:00
Sergey Kuznetsov
90b9ff7c5f refactor: Move unhex lookup table out of function (#7104) 2026-05-13 17:56:42 -04:00
Luc des Trois Maisons
0450f4c45b refactor: Improve Forwarded header field parsing (#7126) 2026-05-13 17:56:42 -04:00
Sergey Kuznetsov
60a3214af1 fix: Check network ID in transactionSignFor (#7102) 2026-05-13 17:56:42 -04:00
Ayaz Salikhov
5b0bae630a feat: Implement nix-based Dockerfile for CI (#7083) 2026-05-13 17:56:42 -04:00
Sergey Kuznetsov
29f9718355 refactor: Improve RPC variable naming and handling (#7103) 2026-05-13 17:56:41 -04:00
Valentin Balaschenko
a6e1d27817 refactor: Use named constant for leaf item size (#39) (#7130)
Co-authored-by: Ed Hennis <ed@ripple.com>
2026-05-13 17:56:41 -04:00
Valentin Balaschenko
0ff849cc41 refactor: Prevent dry-run transactions from being queued (#92) (#7131) 2026-05-13 17:56:41 -04:00
Alex Kremer
158b84812c refactor: Limit JSON array size (#7112) 2026-05-13 17:56:41 -04:00
Vito Tumas
62b942f1cc feat: Enable and rename fixSecurity3_1_3 to fixCleanup3_1_3 (#7128)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-13 17:56:41 -04:00
Michael Legleux
cce8e7068a ci: Limit nproc on Linux builds temporarily (#7132) 2026-05-13 17:56:41 -04:00
Olek
fffa467d69 fix: Use transaction sequence numbers in permissioned domains (#7129) 2026-05-13 17:56:41 -04:00
Sergey Kuznetsov
bdb9ccd055 fix: Improve json parsing of currency issuers (#7110) 2026-05-13 17:56:41 -04:00
rrmanukyan
02a5bcaf23 refactor: Fill txJson based on apiVersion (#7109)
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-05-13 17:56:41 -04:00
Ed Hennis
9433fede5f fix: Fix touchy "funds are conserved" assertion in LoanPay (#6231) (#6967)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-05-13 17:56:40 -04:00
Ayaz Salikhov
2c2c45da6b refactor: Remove erroneous base_uint ctor from container (#7123) 2026-05-13 17:56:40 -04:00
Ayaz Salikhov
d2758d7142 ci: Make Show test failure summary work with no build dir (#7124) 2026-05-13 17:56:40 -04:00
Mayukha Vadari
364aa220e6 refactor: Replace featureInvariantsV1_1 with fixCleanup3_2_0 (#7116) 2026-05-13 17:56:40 -04:00
Jingchen
0e674e896e chore: Upgrade mako version (#7108) 2026-05-13 17:56:40 -04:00
Alex Kremer
d6f65a9e8c refactor: Use more scoped enums (#7086) 2026-05-13 17:56:40 -04:00
Zhiyuan Wang
e1fe35993e fix: Prevent stale AuthAccounts from persisting after tfTwoAssetIfEmpty re-initialization (#6996)
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-05-13 17:56:39 -04:00
Vito Tumas
ad2195f121 fix: Numerically-stable (1+r)^n-1 in computePaymentFactor (#7033) 2026-05-13 17:56:39 -04:00
Ayaz Salikhov
bad363e562 style: Make .clang-tidy style a bit more consistent with Clio (#7096) 2026-05-13 17:56:39 -04:00
Alex Kremer
759c6bac13 chore: More fixes for bad renames (#7092) 2026-05-13 17:56:39 -04:00
Olek
cf550ee621 fix: Stop tx processing if failed to delete expired credentials (#6715) (#6962)
Co-authored-by: Ed Hennis <ed@ripple.com>
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-13 17:56:39 -04:00
Ed Hennis
faeb806578 fix: Cap the base fee for LoanPay (#6969) (#6970)
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-05-13 17:56:39 -04:00
Bronek Kozicki
04fd8175e4 chore: Upgrade Clang sanitizer to clang-22 and switch gcc-15 sanitizer to Release (#7079) 2026-05-13 17:56:39 -04:00
Bart
8190d5168c fix: Restore clang-tidy change to section name in config (#7091)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
2026-05-13 17:56:39 -04:00
Ayaz Salikhov
7a9ff9fd87 chore: Add IWYU pragma for boost::optional to fix clang-tidy (#7088) 2026-05-13 17:56:38 -04:00
Ayaz Salikhov
bc07dfafeb chore: Update zlib to 1.3.2, sqlite to 3.53.0, libarchive to 3.8.7, jemalloc to 5.3.1, boost to 1.91.0 (#7084) 2026-05-13 17:56:38 -04:00
Ayaz Salikhov
fe08a45cac chore: Update conan.lock (#7081)
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-05-13 17:56:38 -04:00
Vito Tumas
0f315241f9 chore: Mark empty transactor invariants as future work (#7080) 2026-05-13 17:56:37 -04:00
Vet
e646df5b7e chore: Update default values of base and owner reserve to 1/0.2 (#6382)
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-05-13 17:56:37 -04:00
Mayukha Vadari
2df13ac6af fix: Fix regressions in server_definitions (#7008) 2026-05-13 17:56:37 -04:00
Ayaz Salikhov
ecc5073a26 chore: Do not duplicate sanitizer flags (#7058)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-13 17:56:37 -04:00
Ayaz Salikhov
6c712ef163 ci: Run pre-commit on diff in clang-tidy workflow (#7078)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-13 17:56:37 -04:00
Ayaz Salikhov
2105aeb766 ci: Use XRPLF/create-issue (#7076) 2026-05-13 17:56:37 -04:00
Bart
fd06404e04 release: Bump version to 3.2.0-b4 2026-05-04 14:10:37 -04:00
Ayaz Salikhov
92910466be ci: Rewrite clang-tidy workflow(s) in a reusable manner (#7062) 2026-05-04 14:10:06 -04:00
Alex Kremer
de7d9c9b54 chore: Ignore identifier-naming update in git blame (#7066)
Co-authored-by: Bart <bthomee@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-04 14:10:06 -04:00
Alex Kremer
3d06263830 refactor: Enable clang-tidy readability-identifier-naming check (#6571) 2026-05-04 14:09:33 -04:00
Bart
7515811efa refactor: Revert certain Throws by LogicErrors (#7036)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
2026-05-04 10:13:55 -04:00
Ayaz Salikhov
0de4678284 ci: Rename print-env -> print-build-env (#7061) 2026-05-04 10:13:55 -04:00
Pratik Mankawde
8cfe4524aa fix: Gate -mcmodel flags to x86_64 in sanitizer builds (#7049)
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
2026-05-04 10:13:55 -04:00
Vito Tumas
321b867978 fix: Prevents overwriting a bool value in an invariant (#6609)
Co-authored-by: Ed Hennis <ed@ripple.com>
2026-05-04 10:13:55 -04:00
Pratik Mankawde
f4a454c099 fix: Address code review comments regarding boost::coroutine2 (#6977)
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
2026-05-04 10:13:54 -04:00
Bart
3054fb8852 refactor: Apply various minor improvements and corrections (#7045)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
2026-05-04 10:13:54 -04:00
Zhiyuan Wang
4da46d31ac fix: Store Delegate object in delegating and authorized account directories for proper deletion (#6681) 2026-05-04 10:13:54 -04:00
Ayaz Salikhov
ed3aa6ecf5 ci: Use print-env from XRPLF/actions (#7052) 2026-05-04 10:13:54 -04:00
Mayukha Vadari
ebdafa3209 fix: Make assorted RPC fixes (#6529)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-05-04 10:13:54 -04:00
Alex Kremer
1c6fab8345 chore: Enable clang-tidy v21 new checks (#7031) 2026-05-04 10:13:54 -04:00
Jingchen
60fc9da97e feat: Create new transaction testing framework TxTest (#6537)
Signed-off-by: JCW <a1q123456@users.noreply.github.com>
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
Co-authored-by: Copilot <copilot@github.com>
2026-05-04 10:13:54 -04:00
Vito Tumas
168bc7bdc7 feat: Add cleanup amendment for 3.2.0 (#7037) 2026-05-04 10:13:54 -04:00
Pratik Mankawde
62c49eb1b4 fix: Fix ubsan flagged issues (#6151)
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
2026-05-04 10:13:54 -04:00
Alex Kremer
917acc59e0 chore: Enable clang-tidy modernize-use-nodiscard check (#7015) 2026-05-04 10:13:53 -04:00
Pratik Mankawde
47c620cc04 fix: Resolve MSVC Debug build failure in JobQueue.h; re-enable _CRTDBG_MAP_ALLOC in CI (#6993)
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
Co-authored-by: Ed Hennis <ed@ripple.com>
2026-05-04 10:13:53 -04:00
Zhiyuan Wang
58a89cda9c docs: Update hybrid offer invariant comment (#7007) 2026-05-04 10:13:53 -04:00
Mayukha Vadari
06f9b04634 fix: Fix flaky CI tests (#7005)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-05-04 10:13:53 -04:00
Mayukha Vadari
93be0797f0 docs: Update bug bounty information (#7006) 2026-05-04 10:13:53 -04:00
Mayukha Vadari
b8792e2422 fix: Make assorted Payments fixes (#6585) 2026-05-04 10:13:53 -04:00
Mayukha Vadari
f42915d61b refactor: Move LendingHelpers into libxrpl/ledger/helpers (#6638)
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
2026-05-04 10:13:53 -04:00
Jingchen
e34bf5bcee refactor: Clean up NetworkOPs (#6575)
Signed-off-by: JCW <a1q123456@users.noreply.github.com>
2026-05-04 10:13:53 -04:00
Alex Kremer
7345de6c67 fix: Remaining clang-tidy unchecked optionals (#6979) 2026-05-04 10:13:53 -04:00
Jingchen
3f9a83be41 refactor: Remove seq from TMGetObjectByHash (#6976) 2026-05-04 10:13:52 -04:00
Alex Kremer
20866d5af3 chore: Add pre-commit hook to fix include style (#6995)
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-05-04 10:13:52 -04:00
pdp2121
ea05679a39 feat: Add --definitions flag and artifact (#6858)
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-05-04 10:13:52 -04:00
Mayukha Vadari
2a30934bb1 fix: More clang-tidy issues (#6992) 2026-05-04 10:13:52 -04:00
Alex Kremer
c9427b0f3e chore: Optionally run clang-tidy via pre-commit (#6680)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-05-04 10:13:52 -04:00
Vito Tumas
998daf6e20 refactor: Add transaction-specific invariant checking (#6551) 2026-05-04 10:13:52 -04:00
Ayaz Salikhov
cb5678abee style: Add bashate pre-commit hook to unify bash style (#6994) 2026-05-04 10:13:52 -04:00
Alex Kremer
be86e3ce24 chore: Add -fix to clang-tidy invocation (#6990) 2026-05-04 10:13:52 -04:00
Jingchen
1aba0d9a6b chore: Remove empty Taker.h (#6984) 2026-05-04 10:13:52 -04:00
Alex Kremer
dab0ceaf8b chore: Enable clang-tidy modernize checks (#6975)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-05-04 10:13:51 -04:00
Ayaz Salikhov
4ed8178584 ci: Upload clang-tidy git diff (#6983) 2026-05-04 10:13:51 -04:00
Alex Kremer
394c7cab80 fix: Add rounding to Vault invariants (#6217) (#6955)
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
Co-authored-by: Ed Hennis <ed@ripple.com>
2026-05-04 10:13:51 -04:00
yinyiqian1
366899d5a7 fix: Disallow MPTClearRequireAuth if is set (#6712)
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-05-04 10:13:51 -04:00
Alex Kremer
5cf9e0ccfc feat: Add GRPC TLS support (#6374)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-05-04 10:13:51 -04:00
Zhiyuan Wang
6c9244e810 fix: Check for empty sfAdditionalBooks array in hybrid offer invariant (#6716) 2026-05-04 10:13:51 -04:00
chuanshanjida
d6e7dbabfa chore: Remove repetitive word in multiple files (#6978)
Signed-off-by: chuanshanjida <chuanshanjida@outlook.com>
2026-05-04 10:13:51 -04:00
Ayaz Salikhov
297f7119b5 ci: Add workflow to check PR description has been filled (#6965) 2026-05-04 10:13:50 -04:00
dependabot[bot]
c953afec55 ci: [DEPENDABOT] Bump tj-actions/changed-files from 47.0.5 to 47.0.6 (#6973)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-04 10:13:50 -04:00
Alex Kremer
9e8ac41983 chore: Enable clang-tidy include cleaner (#6947) 2026-05-04 10:13:50 -04:00
Gregory Tsipenyuk
a38d3fc725 fix: Change AMMClawback return code to tecNO_PERMISSION (#6946) 2026-05-04 10:13:50 -04:00
dependabot[bot]
e017d0cfdd ci: [DEPENDABOT] bump actions/upload-pages-artifact from 4.0.0 to 5.0.0 (#6927)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-04 10:13:50 -04:00
dependabot[bot]
6a3603211c ci: [DEPENDABOT] bump actions/upload-artifact from 7.0.0 to 7.0.1 (#6928)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-04 10:13:49 -04:00
Alex Kremer
3e67c0f71d chore: Enable clang-tidy readability checks (#6930)
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-05-04 10:13:49 -04:00
Jingchen
a29f94a764 fix: Fix unity build for book step (#6942)
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
2026-05-04 10:13:49 -04:00
Sergey Kuznetsov
392c87349f chore: Move codegen venv setup into build stage (#6617)
Co-authored-by: JCW <a1q123456@users.noreply.github.com>
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-05-04 10:13:49 -04:00
Alex Kremer
09ea87c12e chore: Enable most clang-tidy bugprone checks (#6929)
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-05-04 10:13:49 -04:00
Bart
f85e2d5bbe refactor: Improve exception handling (#6540) (#6735)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
2026-05-04 10:13:48 -04:00
Zhiyuan Wang
5a1db481df refactor: Remove unused notTooManyOffers function from NFTokenUtils (#6737) 2026-05-04 10:13:48 -04:00
Bart
d12a5490df fix: Change Tuning::bookOffers minimum limit to 1 (#6812)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
2026-05-04 10:13:48 -04:00
Ed Hennis
051d551cbe chore: Make pre-commit line ending conversions work on Windows (#6832) (#6833) 2026-05-04 10:13:48 -04:00
Gregory Tsipenyuk
ee3ef638f3 fix: Add description for terLOCKED error (#6811) 2026-05-04 10:13:48 -04:00
yinyiqian1
058ccb4da6 fix: Address AI reviewer comments for Permission Delegation (#6675) 2026-05-04 10:13:48 -04:00
Mayukha Vadari
70b770f99b refactor: Combine AMMHelpers and AMMUtils (#6733) 2026-05-04 10:13:47 -04:00
Gregory Tsipenyuk
27c28be574 feat: Add MPT support to DEX (#5285) 2026-05-04 10:13:47 -04:00
Pratik Mankawde
48ece2779d fix: Handle WSClient write failure when server closes WebSocket (#6671)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-04 10:13:47 -04:00
Ayaz Salikhov
5d03da8051 ci: Change conditions for uploading artifacts in public/private/org repos (#6734) 2026-05-04 10:13:47 -04:00
Bart
79a3ab4c22 refactor: Rename non-functional uses of ripple(d) to xrpl(d) (#6676)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
2026-05-04 10:13:47 -04:00
Mayukha Vadari
f2a7ee0067 refactor: Move more helper files into libxrpl/ledger/helpers (#6731)
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
2026-05-04 10:13:46 -04:00
Mayukha Vadari
06453c15a0 fix: Minor RPC fixes (#6730) 2026-05-04 10:13:46 -04:00
Zhiyuan Wang
f1b9046c91 fix: Prevent deletion of MPTokens with active escrow (#6635)
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-05-04 10:13:46 -04:00
Vito Tumas
26e310e498 fix: Clamp VaultClawback to assetsAvailable for zero-amount clawback (#6646) 2026-05-04 10:13:46 -04:00
Vito Tumas
6ba5576b92 fix: Add assorted Lending Protocol fixes (#6678)
Co-authored-by: Shawn Xie <35279399+shawnxie999@users.noreply.github.com>
2026-05-04 10:13:46 -04:00
Mayukha Vadari
48d2eb20b3 fix: Change variable signedness and correctly handle std::optional (#6657) 2026-05-04 10:13:45 -04:00
Mayukha Vadari
a772faf339 refactor: Reorganize RPC handler files (#6628) 2026-05-04 10:13:45 -04:00
Ayaz Salikhov
d6e8f81834 chore: Update XRPLF/actions (#6713) 2026-05-04 10:13:45 -04:00
yinyiqian1
e5b0b6f674 docs: Add explanatory comment to checkFee (#6631) 2026-05-04 10:13:45 -04:00
yinyiqian1
17f26ba973 fix: Decouple reserve from fee in delegate payment (#6568) 2026-05-04 10:13:45 -04:00
Vito Tumas
28c53362b6 fix: Check trustline limits for share-denominated vault withdrawals (#6645) 2026-05-04 10:13:45 -04:00
Bart
b6a09a4d2c release: Bump version to 3.2.0-b3 2026-04-01 13:27:58 -04:00
Valentin Balaschenko
3adad49c86 fix: Remove fatal assertion on Linux thread name truncation (#6690) 2026-04-01 13:27:23 -04:00
Alex Kremer
f04943fc50 chore: Enable clang-tidy coreguidelines checks (#6698)
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-04-01 13:27:23 -04:00
Ayaz Salikhov
ab7f683b2f ci: Allow uploading artifacts for XRPLF org (#6702) 2026-04-01 13:27:23 -04:00
Vito Tumas
14749fdfb0 fix: Enforce aggregate MaximumAmount in multi-send MPT (#6644)
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
2026-04-01 13:27:22 -04:00
Ayaz Salikhov
c6ddf6aa1c chore: Use nudb recipe from the upstream (#6701) 2026-04-01 13:27:22 -04:00
Mayukha Vadari
ee3a08c8d4 fix: Fix previous ledger size typo in RCLConsensus (#6696) 2026-04-01 13:27:22 -04:00
Alex Kremer
2dc705bd99 chore: Enable clang-tidy misc checks (#6655) 2026-04-01 13:27:22 -04:00
Ayaz Salikhov
7315c57edc ci: Use pull_request_target to check for signed commits (#6697) 2026-04-01 13:27:22 -04:00
Bart
5a66086fce chore: Remove unnecessary clang-format off/on directives (#6682)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
2026-04-01 13:27:21 -04:00
Pratik Mankawde
682dda8bfc fix: Fix Workers::stop() race between m_allPaused and m_runningTaskCount (#6574)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 13:27:21 -04:00
Bart
aac17f588a release: Bump version to 3.2.0-b2 2026-03-30 14:52:51 -04:00
Ayaz Salikhov
cbc09b2999 ci: Only publish docs in public repos (#6687) 2026-03-30 14:52:09 -04:00
Alex Kremer
453d94da17 chore: Enable remaining clang-tidy performance checks (#6648)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-30 14:52:09 -04:00
Jingchen
b36aedb4d5 refactor: Address PR comments after the modularisation PRs (#6389)
Signed-off-by: JCW <a1q123456@users.noreply.github.com>
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-03-30 14:52:09 -04:00
Alex Kremer
18540c97a5 chore: Fix clang-tidy header filter (#6686) 2026-03-30 14:52:08 -04:00
dependabot[bot]
8e3d87fce3 ci: [DEPENDABOT] bump actions/deploy-pages from 4.0.5 to 5.0.0 (#6684)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-30 14:52:08 -04:00
dependabot[bot]
b83dc9aa16 ci: [DEPENDABOT] bump codecov/codecov-action from 5.5.3 to 6.0.0 (#6685)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-30 14:52:08 -04:00
Pratik Mankawde
0c76bf991a fix: Guard Coro::resume() against completed coroutines (#6608)
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 14:52:08 -04:00
Vito Tumas
29aba28f5b refactor: Split LoanInvariant into LoanBrokerInvariant and LoanInvariant (#6674) 2026-03-30 14:52:08 -04:00
Ayaz Salikhov
b3f14c4052 ci: Don't publish docs on release branches (#6673) 2026-03-30 14:52:08 -04:00
Jingchen
e26624dcd1 refactor: Make function naming in ServiceRegistry consistent (#6390)
Signed-off-by: JCW <a1q123456@users.noreply.github.com>
Co-authored-by: Ed Hennis <ed@ripple.com>
2026-03-30 14:52:08 -04:00
Valentin Balaschenko
885f7b8c33 chore: Shorten job names to stay within Linux 15-char thread limit (#6669) 2026-03-30 14:52:07 -04:00
Vito Tumas
dcf973bc50 fix: Improve loan invariant message (#6668) 2026-03-30 14:52:07 -04:00
Ayaz Salikhov
68596f60d8 ci: Upload artifacts only in public repositories (#6670) 2026-03-30 14:52:07 -04:00
Bart
aac64d3b85 Update version (#6672) 2026-03-26 09:50:04 -04:00
814 changed files with 7454 additions and 40713 deletions

View File

@@ -171,7 +171,7 @@ CheckOptions:
readability-identifier-naming.EnumCase: CamelCase
readability-identifier-naming.EnumConstantCase: CamelCase
readability-identifier-naming.ScopedEnumConstantCase: CamelCase
readability-identifier-naming.GlobalConstantCase: CamelCase
readability-identifier-naming.GlobalConstantCase: UPPER_CASE
readability-identifier-naming.GlobalConstantPrefix: "k"
readability-identifier-naming.GlobalVariableCase: CamelCase
readability-identifier-naming.GlobalVariablePrefix: "g"
@@ -179,12 +179,14 @@ CheckOptions:
readability-identifier-naming.ConstexprMethodCase: camelBack
readability-identifier-naming.ClassMethodCase: camelBack
readability-identifier-naming.ClassMemberCase: camelBack
readability-identifier-naming.ClassConstantCase: CamelCase
readability-identifier-naming.ClassConstantCase: UPPER_CASE
readability-identifier-naming.ClassConstantPrefix: "k"
readability-identifier-naming.StaticConstantCase: CamelCase
readability-identifier-naming.StaticConstantCase: UPPER_CASE
readability-identifier-naming.StaticConstantPrefix: "k"
readability-identifier-naming.StaticVariableCase: camelBack
readability-identifier-naming.ConstexprVariableCase: camelBack
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

View File

@@ -62,7 +62,7 @@ ${SED_COMMAND} -i 's@ripple/@xrpld/@g' src/test/core/Config_test.cpp
${SED_COMMAND} -i 's/Rippled/File/g' src/test/core/Config_test.cpp
# Restore the old config file name in the code that maintains support for now.
${SED_COMMAND} -i 's/kConfigLegacyName = "xrpld.cfg"/kConfigLegacyName = "rippled.cfg"/g' src/xrpld/core/detail/Config.cpp
${SED_COMMAND} -i 's/kCONFIG_LEGACY_NAME = "xrpld.cfg"/kCONFIG_LEGACY_NAME = "rippled.cfg"/g' src/xrpld/core/detail/Config.cpp
# Restore an URL.
${SED_COMMAND} -i 's/connect-your-xrpld-to-the-xrp-test-net.html/connect-your-rippled-to-the-xrp-test-net.html/g' cfg/xrpld-example.cfg

View File

@@ -90,7 +90,7 @@ ${SED_COMMAND} -i 's/www.ripple.com/www.xrpl.org/g' src/test/protocol/Seed_test.
# Restore specific changes.
${SED_COMMAND} -i 's@b5efcc/src/xrpld@b5efcc/src/ripple@' include/xrpl/protocol/README.md
${SED_COMMAND} -i 's/dbPrefix_ = "xrpldb"/dbPrefix_ = "rippledb"/' src/xrpld/app/misc/SHAMapStoreImp.h # cspell: disable-line
${SED_COMMAND} -i 's/kConfigLegacyName = "xrpld.cfg"/kConfigLegacyName = "rippled.cfg"/' src/xrpld/core/detail/Config.cpp
${SED_COMMAND} -i 's/kCONFIG_LEGACY_NAME = "xrpld.cfg"/kCONFIG_LEGACY_NAME = "rippled.cfg"/' src/xrpld/core/detail/Config.cpp
popd
echo "Renaming complete."

View File

@@ -32,32 +32,7 @@ We will further set additional CMake arguments as follows:
"""
def build_config_name(os_entry: dict[str, str], platform: str, build_type: str) -> str:
parts = [os_entry["distro_name"]]
for key in ("distro_version", "compiler_name", "compiler_version"):
if value := os_entry[key]:
parts.append(value)
parts.append("arm64" if "arm64" in platform else "amd64")
parts.append(build_type.lower())
return "-".join(parts)
def generate_packaging_matrix(config: Config) -> list[dict]:
"""Emit one entry per os entry with `package: true`. Architecture is
hardcoded to linux/amd64 here (and the runner is hardcoded at the
workflow level) until arm64 packaging is ready.
"""
return [
{
"artifact_name": f"xrpld-{build_config_name(os, 'linux/amd64', 'Release')}",
"os": os,
}
for os in config.os
if os.get("package", False)
]
def generate_strategy_matrix(all: bool, config: Config) -> list[dict]:
def generate_strategy_matrix(all: bool, config: Config) -> list:
configurations = []
for architecture, os, build_type, cmake_args in itertools.product(
config.architecture, config.os, config.build_type, config.cmake_args
@@ -126,15 +101,14 @@ def generate_strategy_matrix(all: bool, config: Config) -> list[dict]:
continue
# RHEL:
# - 9 using GCC 12: Debug and Release on linux/amd64
# (Release is required for RPM packaging).
# - 9 using GCC 12: Debug on linux/amd64.
# - 10 using Clang: Release on linux/amd64.
if os["distro_name"] == "rhel":
skip = True
if os["distro_version"] == "9":
if (
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-12"
and build_type in ["Debug", "Release"]
and build_type == "Debug"
and architecture["platform"] == "linux/amd64"
):
skip = False
@@ -149,8 +123,7 @@ def generate_strategy_matrix(all: bool, config: Config) -> list[dict]:
continue
# Ubuntu:
# - Jammy using GCC 12: Debug on linux/arm64, Release on
# linux/amd64 (Release is required for DEB packaging).
# - Jammy using GCC 12: Debug on linux/arm64.
# - Noble using GCC 14: Release on linux/amd64.
# - Noble using Clang 18: Debug on linux/amd64.
# - Noble using Clang 19: Release on linux/arm64.
@@ -163,12 +136,6 @@ def generate_strategy_matrix(all: bool, config: Config) -> list[dict]:
and architecture["platform"] == "linux/arm64"
):
skip = False
if (
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-12"
and build_type == "Release"
and architecture["platform"] == "linux/amd64"
):
skip = False
elif os["distro_version"] == "noble":
if (
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-14"
@@ -251,7 +218,17 @@ def generate_strategy_matrix(all: bool, config: Config) -> list[dict]:
# Generate a unique name for the configuration, e.g. macos-arm64-debug
# or debian-bookworm-gcc-12-amd64-release.
config_name = build_config_name(os, architecture["platform"], build_type)
config_name = os["distro_name"]
if (n := os["distro_version"]) != "":
config_name += f"-{n}"
if (n := os["compiler_name"]) != "":
config_name += f"-{n}"
if (n := os["compiler_version"]) != "":
config_name += f"-{n}"
config_name += (
f"-{architecture['platform'][architecture['platform'].find('/')+1:]}"
)
config_name += f"-{build_type.lower()}"
if "-Dcoverage=ON" in cmake_args:
config_name += "-coverage"
if "-Dunity=ON" in cmake_args:
@@ -355,19 +332,10 @@ if __name__ == "__main__":
required=False,
type=Path,
)
parser.add_argument(
"-p",
"--packaging",
help="Emit the packaging matrix (derived from the 'package' field on os entries) instead of the build/test matrix.",
action="store_true",
)
args = parser.parse_args()
matrix = []
if args.packaging:
config_path = args.config if args.config else THIS_DIR / "linux.json"
matrix += generate_packaging_matrix(read_config(config_path))
elif args.config is None or args.config == "":
if args.config is None or args.config == "":
matrix += generate_strategy_matrix(
args.all, read_config(THIS_DIR / "linux.json")
)

View File

@@ -127,8 +127,7 @@
"distro_version": "9",
"compiler_name": "gcc",
"compiler_version": "12",
"image_sha": "4c086b9",
"package": true
"image_sha": "4c086b9"
},
{
"distro_name": "rhel",
@@ -170,8 +169,7 @@
"distro_version": "jammy",
"compiler_name": "gcc",
"compiler_version": "12",
"image_sha": "4c086b9",
"package": true
"image_sha": "4c086b9"
},
{
"distro_name": "ubuntu",

View File

@@ -11,4 +11,4 @@ on:
jobs:
check_title:
if: ${{ github.event.pull_request.draft != true }}
uses: XRPLF/actions/.github/workflows/check-pr-title.yml@291206777251b4d493641b5afbdf7c23009d2988
uses: XRPLF/actions/.github/workflows/check-pr-title.yml@a5d8dd35be543365e90a11358447130c8763871d

View File

@@ -64,13 +64,11 @@ jobs:
.github/workflows/reusable-build-test-config.yml
.github/workflows/reusable-build-test.yml
.github/workflows/reusable-clang-tidy.yml
.github/workflows/reusable-package.yml
.github/workflows/reusable-strategy-matrix.yml
.github/workflows/reusable-test.yml
.github/workflows/reusable-upload-recipe.yml
.clang-tidy
.codecov.yml
cfg/**
cmake/**
conan/**
external/**
@@ -80,10 +78,6 @@ jobs:
CMakeLists.txt
conanfile.py
conan.lock
LICENSE.md
package/**
README.md
- name: Check whether to run
# This step determines whether the rest of the workflow should
# run. The rest of the workflow will run if this job runs AND at
@@ -140,11 +134,6 @@ jobs:
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
package:
needs: [should-run, build-test]
if: ${{ needs.should-run.outputs.go == 'true' }}
uses: ./.github/workflows/reusable-package.yml
upload-recipe:
needs:
- should-run
@@ -179,7 +168,6 @@ jobs:
- check-rename
- clang-tidy
- build-test
- package
- upload-recipe
- notify-clio
runs-on: ubuntu-latest

View File

@@ -1,5 +1,5 @@
# This workflow uploads the libxrpl recipe to the Conan remote and builds
# release packages when a versioned tag is pushed.
# This workflow uploads the libxrpl recipe to the Conan remote when a versioned
# tag is pushed.
name: Tag
on:
@@ -22,22 +22,3 @@ jobs:
secrets:
remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}
build-test:
if: ${{ github.repository == 'XRPLF/rippled' }}
uses: ./.github/workflows/reusable-build-test.yml
strategy:
fail-fast: true
matrix:
os: [linux]
with:
ccache_enabled: false
os: ${{ matrix.os }}
strategy_matrix: minimal
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
package:
if: ${{ github.repository == 'XRPLF/rippled' }}
needs: build-test
uses: ./.github/workflows/reusable-package.yml

View File

@@ -21,13 +21,11 @@ on:
- ".github/workflows/reusable-build-test-config.yml"
- ".github/workflows/reusable-build-test.yml"
- ".github/workflows/reusable-clang-tidy.yml"
- ".github/workflows/reusable-package.yml"
- ".github/workflows/reusable-strategy-matrix.yml"
- ".github/workflows/reusable-test.yml"
- ".github/workflows/reusable-upload-recipe.yml"
- ".clang-tidy"
- ".codecov.yml"
- "cfg/**"
- "cmake/**"
- "conan/**"
- "external/**"
@@ -37,9 +35,6 @@ on:
- "CMakeLists.txt"
- "conanfile.py"
- "conan.lock"
- "LICENSE.md"
- "package/**"
- "README.md"
# Run at 06:32 UTC on every day of the week from Monday through Friday. This
# will force all dependencies to be rebuilt, which is useful to verify that
@@ -100,7 +95,3 @@ jobs:
secrets:
remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}
package:
needs: build-test
uses: ./.github/workflows/reusable-package.yml

View File

@@ -176,7 +176,7 @@ jobs:
- name: Create issue
if: ${{ steps.run_clang_tidy.outcome != 'success' && inputs.create_issue_on_failure }}
uses: XRPLF/actions/create-issue@36d450d12d301e8410c1b7936e5de70c291cbe36
uses: XRPLF/actions/create-issue@fbcc16eb7f20dc3199eaf1aed0d3523a5ba9008c
with:
title: "Clang-tidy check failed"
body_file: ${{ env.ISSUE_FILE }}

View File

@@ -1,99 +0,0 @@
# Build Linux packages (DEB and RPM) from pre-built binary artifacts.
# Discovers which configurations to package from linux.json (os entries
# with "package": true) and fans out one job per entry. Today only
# linux/amd64 is emitted; the architecture is hardcoded both here
# (runner) and in generate.py.
name: Package
on:
workflow_call:
inputs:
pkg_release:
description: "Package release number. Increment when repackaging the same executable."
required: false
type: string
default: "1"
defaults:
run:
shell: bash
env:
BUILD_DIR: build
jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.13
- name: Generate packaging matrix
id: generate
working-directory: .github/scripts/strategy-matrix
run: |
./generate.py --packaging --config=linux.json >> "${GITHUB_OUTPUT}"
generate-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: |
.github/actions/generate-version
src/libxrpl/protocol/BuildInfo.cpp
- name: Generate version
id: version
uses: ./.github/actions/generate-version
package:
needs: [generate-matrix, generate-version]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
name: "${{ matrix.artifact_name }}"
permissions:
contents: read
runs-on: ["self-hosted", "Linux", "X64", "heavy"]
container: ${{ format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}-sha-{4}', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version, matrix.os.image_sha) }}
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download pre-built binary
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ matrix.artifact_name }}
path: ${{ env.BUILD_DIR }}
- name: Make binary executable
run: chmod +x "${BUILD_DIR}/xrpld"
- name: Build package
env:
PKG_VERSION: ${{ needs.generate-version.outputs.version }}
PKG_RELEASE: ${{ inputs.pkg_release }}
run: ./package/build_pkg.sh
- name: Upload package artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: ${{ github.event.repository.visibility == 'public' }}
with:
name: ${{ matrix.artifact_name }}-pkg-${{ needs.generate-version.outputs.version }}
path: |
${{ env.BUILD_DIR }}/debbuild/*.deb
${{ env.BUILD_DIR }}/debbuild/*.ddeb
${{ env.BUILD_DIR }}/rpmbuild/RPMS/**/*.rpm
if-no-files-found: error

View File

@@ -93,7 +93,6 @@ find_package(OpenSSL REQUIRED)
find_package(secp256k1 REQUIRED)
find_package(SOCI REQUIRED)
find_package(SQLite3 REQUIRED)
find_package(wasmi REQUIRED)
find_package(xxHash REQUIRED)
target_link_libraries(
@@ -135,7 +134,6 @@ endif()
include(XrplCore)
include(XrplProtocolAutogen)
include(XrplInstall)
include(XrplPackaging)
include(XrplValidatorKeys)
if(tests)

View File

@@ -28,7 +28,7 @@
# https://vl.ripple.com
# https://unl.xrplf.org
# http://127.0.0.1:8000
# file:///etc/xrpld/vl.txt
# file:///etc/opt/xrpld/vl.txt
#
# [validator_list_keys]
#

View File

@@ -527,17 +527,6 @@
#
# The current default (which is subject to change) is 300 seconds.
#
# verify_endpoints = <0 | 1>
#
# If set to 0, the server will skip validation of endpoint
# addresses received in TMEndpoints peer protocol messages,
# allowing addresses that are not publicly routable or have a
# port of 0. The default is 1 (verification enabled).
#
# WARNING: Disabling this option is a security risk and should
# only be used for local testing and debugging. Do not disable
# on mainnet.
#
#
# [transaction_queue] EXPERIMENTAL
#
@@ -1283,39 +1272,6 @@
# Example:
# owner_reserve = 200000 # 0.2 XRP
#
# extension_compute_limit = <gas>
#
# The extension compute limit is the maximum amount of gas that can be
# consumed by a single transaction. The gas limit is used to prevent
# transactions from consuming too many resources.
#
# If this parameter is unspecified, xrpld will use an internal
# default. Don't change this without understanding the consequences.
#
# Example:
# extension_compute_limit = 1000000 # 1 million gas
#
# extension_size_limit = <bytes>
#
# The extension size limit is the maximum size of a WASM extension in
# bytes. The size limit is used to prevent extensions from consuming
# too many resources.
#
# If this parameter is unspecified, xrpld will use an internal
# default. Don't change this without understanding the consequences.
#
# Example:
# extension_size_limit = 100000 # 100 kb
#
# gas_price = <micro-drops>
#
# The gas price is the conversion between WASM gas and its price in drops.
#
# If this parameter is unspecified, xrpld will use an internal
# default. Don't change this without understanding the consequences.
#
# Example:
# gas_price = 1000000 # 1 drop per gas
#-------------------------------------------------------------------------------
#
# 9. Misc Settings

View File

@@ -67,7 +67,6 @@ target_link_libraries(
Xrpl::opts
Xrpl::syslibs
secp256k1::secp256k1
wasmi::wasmi
xrpl.libpb
xxHash::xxhash
$<$<BOOL:${voidstar}>:antithesis-sdk-cpp>

View File

@@ -1,44 +0,0 @@
#[===================================================================[
Linux packaging support: 'package' target.
The packaging script (package/build_pkg.sh) installs to FHS-standard
paths (/usr/bin, /etc/xrpld, etc.) regardless of CMAKE_INSTALL_PREFIX,
so no prefix guard is needed here.
#]===================================================================]
if(NOT is_linux)
message(STATUS "Packaging not supported on non-Linux hosts")
return()
endif()
if(NOT DEFINED pkg_release)
set(pkg_release 1)
endif()
find_program(RPMBUILD_EXECUTABLE rpmbuild)
find_program(DPKG_BUILDPACKAGE_EXECUTABLE dpkg-buildpackage)
if(NOT (RPMBUILD_EXECUTABLE OR DPKG_BUILDPACKAGE_EXECUTABLE))
message(
STATUS
"Neither rpmbuild nor dpkg-buildpackage found; 'package' target not available"
)
return()
endif()
set(package_env
SRC_DIR=${CMAKE_SOURCE_DIR}
BUILD_DIR=${CMAKE_BINARY_DIR}
PKG_VERSION=${xrpld_version}
PKG_RELEASE=${pkg_release}
)
add_custom_target(
package
COMMAND
${CMAKE_COMMAND} -E env ${package_env}
${CMAKE_SOURCE_DIR}/package/build_pkg.sh
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS xrpld
COMMENT "Building Linux package (deb/rpm inferred from host tooling)"
VERBATIM
)

View File

@@ -3,8 +3,6 @@
"requires": [
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1777558780.503",
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1765850149.987",
"wasmi/1.0.9#1fecdab9b90c96698eb35ea99ca4f5cb%1772227278.324",
"sqlite3/3.53.0#324ada52333108388a9a6108bfa96734%1776096494.149",
"soci/4.0.3#fe32b9ad5eb47e79ab9e45a68f363945%1774450067.231",
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1765850147.878",

View File

@@ -34,7 +34,6 @@ class Xrpl(ConanFile):
"openssl/3.6.2",
"secp256k1/0.7.1",
"soci/4.0.3",
"wasmi/1.0.9",
"zlib/1.3.2",
]
@@ -215,7 +214,6 @@ class Xrpl(ConanFile):
"soci::soci",
"secp256k1::secp256k1",
"sqlite3::sqlite",
"wasmi::wasmi",
"xxhash::xxhash",
"zlib::zlib",
]

View File

@@ -7,8 +7,6 @@ ignorePaths:
- cmake/**
- LICENSE.md
- .clang-tidy
- src/test/app/wasm_fixtures/**/*.wat
- src/test/app/wasm_fixtures/*.c
language: en
allowCompoundWords: true # TODO (#6334)
ignoreRandomStrings: true
@@ -67,7 +65,6 @@ words:
- Btrfs
- Buildx
- canonicality
- cdylib
- changespq
- checkme
- choco
@@ -102,15 +99,12 @@ words:
- desync
- desynced
- determ
- disablerepo
- distro
- doxyfile
- dxrpl
- enabled
- enablerepo
- endmacro
- exceptioned
- EXPECT_STREQ
- Falco
- fcontext
- finalizers
@@ -168,7 +162,6 @@ words:
- Merkle
- Metafuncton
- misprediction
- missingok
- mptbalance
- MPTDEX
- mptflags
@@ -200,9 +193,7 @@ words:
- NOLINT
- NOLINTNEXTLINE
- nonxrp
- noreplace
- noripple
- notifempty
- nudb
- nullptr
- nunl
@@ -222,7 +213,6 @@ words:
- preauthorize
- preauthorizes
- preclaim
- preun
- protobuf
- protos
- ptrs
@@ -257,20 +247,17 @@ words:
- sfields
- shamap
- shamapitem
- shlibs
- sidechain
- SIGGOOD
- sle
- sles
- soci
- socidb
- SRPMS
- sslws
- statsd
- STATSDCOLLECTOR
- stissue
- stnum
- stnumber
- stobj
- stobject
- stpath
@@ -293,8 +280,8 @@ words:
- txn
- txns
- txs
- ubsan
- UBSAN
- ubsan
- umant
- unacquired
- unambiguity
@@ -331,6 +318,7 @@ words:
- xbridge
- xchain
- ximinez
- EXPECT_STREQ
- XMACRO
- xrpkuwait
- xrpl
@@ -338,4 +326,3 @@ words:
- xrplf
- xxhash
- xxhasher
- CGNAT

View File

@@ -406,8 +406,8 @@ private:
// 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.
std::uintptr_t tp_{0};
static constexpr std::uintptr_t kTagMask = 1;
static constexpr std::uintptr_t kPtrMask = ~kTagMask;
static constexpr std::uintptr_t kTAG_MASK = 1;
static constexpr std::uintptr_t kPTR_MASK = ~kTAG_MASK;
private:
/** Return the raw pointer held by this object.

View File

@@ -567,14 +567,14 @@ template <class T>
bool
SharedWeakUnion<T>::isStrong() const
{
return (tp_ & kTagMask) == 0u;
return (tp_ & kTAG_MASK) == 0u;
}
template <class T>
bool
SharedWeakUnion<T>::isWeak() const
{
return (tp_ & kTagMask) != 0u;
return (tp_ & kTAG_MASK) != 0u;
}
template <class T>
@@ -641,7 +641,7 @@ template <class T>
T*
SharedWeakUnion<T>::unsafeGetRawPtr() const
{
return reinterpret_cast<T*>(tp_ & kPtrMask);
return reinterpret_cast<T*>(tp_ & kPTR_MASK);
}
template <class T>
@@ -650,7 +650,7 @@ SharedWeakUnion<T>::unsafeSetRawPtr(T* p, RefStrength rs)
{
tp_ = reinterpret_cast<std::uintptr_t>(p);
if (tp_ && rs == RefStrength::Weak)
tp_ |= kTagMask;
tp_ |= kTAG_MASK;
}
template <class T>

View File

@@ -98,11 +98,11 @@ private:
// enough for strong pointers and 14 bit counts are enough for weak
// pointers. Use type aliases to make it easy to switch types.
using CountType = std::uint16_t;
static constexpr size_t kStrongCountNumBits = sizeof(CountType) * 8;
static constexpr size_t kWeakCountNumBits = kStrongCountNumBits - 2;
static constexpr size_t kSTRONG_COUNT_NUM_BITS = sizeof(CountType) * 8;
static constexpr size_t kWEAK_COUNT_NUM_BITS = kSTRONG_COUNT_NUM_BITS - 2;
using FieldType = std::uint32_t;
static constexpr size_t kFieldTypeBits = sizeof(FieldType) * 8;
static constexpr FieldType kOne = 1;
static constexpr size_t kFIELD_TYPE_BITS = sizeof(FieldType) * 8;
static constexpr FieldType kONE = 1;
/** `refCounts` consists of four fields that are treated atomically:
@@ -137,21 +137,21 @@ private:
*/
mutable std::atomic<FieldType> refCounts_{kStrongDelta};
mutable std::atomic<FieldType> refCounts_{kSTRONG_DELTA};
/** Amount to change the strong count when adding or releasing a reference
Note: The strong count is stored in the low `StrongCountNumBits` bits
of refCounts
*/
static constexpr FieldType kStrongDelta = 1;
static constexpr FieldType kSTRONG_DELTA = 1;
/** Amount to change the weak count when adding or releasing a reference
Note: The weak count is stored in the high `WeakCountNumBits` bits of
refCounts
*/
static constexpr FieldType kWeakDelta = (kOne << kStrongCountNumBits);
static constexpr FieldType kWEAK_DELTA = (kONE << kSTRONG_COUNT_NUM_BITS);
/** Flag that is set when the partialDestroy function has started running
(or is about to start running).
@@ -159,33 +159,34 @@ private:
See description of the `refCounts` field for a fuller description of
this field.
*/
static constexpr FieldType kPartialDestroyStartedMask = (kOne << (kFieldTypeBits - 1));
static constexpr FieldType kPARTIAL_DESTROY_STARTED_MASK = (kONE << (kFIELD_TYPE_BITS - 1));
/** Flag that is set when the partialDestroy function has finished running
See description of the `refCounts` field for a fuller description of
this field.
*/
static constexpr FieldType kPartialDestroyFinishedMask = (kOne << (kFieldTypeBits - 2));
static constexpr FieldType kPARTIAL_DESTROY_FINISHED_MASK = (kONE << (kFIELD_TYPE_BITS - 2));
/** Mask that will zero out all the `count` bits and leave the tag bits
unchanged.
*/
static constexpr FieldType kTagMask = kPartialDestroyStartedMask | kPartialDestroyFinishedMask;
static constexpr FieldType kTAG_MASK =
kPARTIAL_DESTROY_STARTED_MASK | kPARTIAL_DESTROY_FINISHED_MASK;
/** Mask that will zero out the `tag` bits and leave the count bits
unchanged.
*/
static constexpr FieldType kValueMask = ~kTagMask;
static constexpr FieldType kVALUE_MASK = ~kTAG_MASK;
/** Mask that will zero out everything except the strong count.
*/
static constexpr FieldType kStrongMask = ((kOne << kStrongCountNumBits) - 1) & kValueMask;
static constexpr FieldType kSTRONG_MASK = ((kONE << kSTRONG_COUNT_NUM_BITS) - 1) & kVALUE_MASK;
/** Mask that will zero out everything except the weak count.
*/
static constexpr FieldType kWeakMask =
(((kOne << kWeakCountNumBits) - 1) << kStrongCountNumBits) & kValueMask;
static constexpr FieldType kWEAK_MASK =
(((kONE << kWEAK_COUNT_NUM_BITS) - 1) << kSTRONG_COUNT_NUM_BITS) & kVALUE_MASK;
/** Unpack the count and tag fields from the packed atomic integer form. */
struct RefCountPair
@@ -210,29 +211,29 @@ private:
[[nodiscard]] FieldType
combinedValue() const noexcept;
static constexpr CountType kMaxStrongValue =
static_cast<CountType>((kOne << kStrongCountNumBits) - 1);
static constexpr CountType kMaxWeakValue =
static_cast<CountType>((kOne << kWeakCountNumBits) - 1);
static constexpr CountType kMAX_STRONG_VALUE =
static_cast<CountType>((kONE << kSTRONG_COUNT_NUM_BITS) - 1);
static constexpr CountType kMAX_WEAK_VALUE =
static_cast<CountType>((kONE << kWEAK_COUNT_NUM_BITS) - 1);
/** Put an extra margin to detect when running up against limits.
This is only used in debug code, and is useful if we reduce the
number of bits in the strong and weak counts (to 16 and 14 bits).
*/
static constexpr CountType kCheckStrongMaxValue = kMaxStrongValue - 32;
static constexpr CountType kCheckWeakMaxValue = kMaxWeakValue - 32;
static constexpr CountType kCHECK_STRONG_MAX_VALUE = kMAX_STRONG_VALUE - 32;
static constexpr CountType kCHECK_WEAK_MAX_VALUE = kMAX_WEAK_VALUE - 32;
};
};
inline void
IntrusiveRefCounts::addStrongRef() const noexcept
{
refCounts_.fetch_add(kStrongDelta, std::memory_order_acq_rel);
refCounts_.fetch_add(kSTRONG_DELTA, std::memory_order_acq_rel);
}
inline void
IntrusiveRefCounts::addWeakRef() const noexcept
{
refCounts_.fetch_add(kWeakDelta, std::memory_order_acq_rel);
refCounts_.fetch_add(kWEAK_DELTA, std::memory_order_acq_rel);
}
inline ReleaseStrongRefAction
@@ -251,10 +252,10 @@ IntrusiveRefCounts::releaseStrongRef() const
{
RefCountPair const prevVal{prevIntVal};
XRPL_ASSERT(
(prevVal.strong >= kStrongDelta),
(prevVal.strong >= kSTRONG_DELTA),
"xrpl::IntrusiveRefCounts::releaseStrongRef : previous ref "
"higher than new");
auto nextIntVal = prevIntVal - kStrongDelta;
auto nextIntVal = prevIntVal - kSTRONG_DELTA;
ReleaseStrongRefAction action = NoOp;
if (prevVal.strong == 1)
{
@@ -264,7 +265,7 @@ IntrusiveRefCounts::releaseStrongRef() const
}
else
{
nextIntVal |= kPartialDestroyStartedMask;
nextIntVal |= kPARTIAL_DESTROY_STARTED_MASK;
action = PartialDestroy;
}
}
@@ -275,7 +276,7 @@ IntrusiveRefCounts::releaseStrongRef() const
// count to zero can start a partial destroy, and that can't happen
// twice.
XRPL_ASSERT(
(action == NoOp) || !(prevIntVal & kPartialDestroyStartedMask),
(action == NoOp) || !(prevIntVal & kPARTIAL_DESTROY_STARTED_MASK),
"xrpl::IntrusiveRefCounts::releaseStrongRef : not in partial "
"destroy");
return action;
@@ -288,8 +289,8 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
{
using enum ReleaseStrongRefAction;
static_assert(kWeakDelta > kStrongDelta);
static constexpr auto kDelta = kWeakDelta - kStrongDelta;
static_assert(kWEAK_DELTA > kSTRONG_DELTA);
auto constexpr kDELTA = kWEAK_DELTA - kSTRONG_DELTA;
auto prevIntVal = refCounts_.load(std::memory_order_acquire);
// This loop will almost always run once. The loop is needed to atomically
// change the counts and flags (the count could be atomically changed, but
@@ -311,7 +312,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
"xrpl::IntrusiveRefCounts::addWeakReleaseStrongRef : not in "
"partial destroy");
auto nextIntVal = prevIntVal + kDelta;
auto nextIntVal = prevIntVal + kDELTA;
ReleaseStrongRefAction action = NoOp;
if (prevVal.strong == 1)
{
@@ -321,14 +322,14 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
}
else
{
nextIntVal |= kPartialDestroyStartedMask;
nextIntVal |= kPARTIAL_DESTROY_STARTED_MASK;
action = PartialDestroy;
}
}
if (refCounts_.compare_exchange_weak(prevIntVal, nextIntVal, std::memory_order_acq_rel))
{
XRPL_ASSERT(
(!(prevIntVal & kPartialDestroyStartedMask)),
(!(prevIntVal & kPARTIAL_DESTROY_STARTED_MASK)),
"xrpl::IntrusiveRefCounts::addWeakReleaseStrongRef : not "
"started partial destroy");
return action;
@@ -339,7 +340,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
inline ReleaseWeakRefAction
IntrusiveRefCounts::releaseWeakRef() const
{
auto prevIntVal = refCounts_.fetch_sub(kWeakDelta, std::memory_order_acq_rel);
auto prevIntVal = refCounts_.fetch_sub(kWEAK_DELTA, std::memory_order_acq_rel);
RefCountPair prev = prevIntVal;
if (prev.weak == 1 && prev.strong == 0)
{
@@ -356,7 +357,7 @@ IntrusiveRefCounts::releaseWeakRef() const
{
// partial destroy MUST finish before running a full destroy (when
// using weak pointers)
refCounts_.wait(prevIntVal - kWeakDelta, std::memory_order_acquire);
refCounts_.wait(prevIntVal - kWEAK_DELTA, std::memory_order_acquire);
}
return ReleaseWeakRefAction::Destroy;
}
@@ -375,7 +376,7 @@ IntrusiveRefCounts::checkoutStrongRefFromWeak() const noexcept
if (prev.strong == 0u)
return false;
desiredValue = curValue + kStrongDelta;
desiredValue = curValue + kSTRONG_DELTA;
}
return true;
}
@@ -399,22 +400,23 @@ inline IntrusiveRefCounts::~IntrusiveRefCounts() noexcept
#ifndef NDEBUG
auto v = refCounts_.load(std::memory_order_acquire);
XRPL_ASSERT(
(!(v & kValueMask)), "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
auto t = v & kTagMask;
XRPL_ASSERT((!t || t == kTagMask), "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
(!(v & kVALUE_MASK)), "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
auto t = v & kTAG_MASK;
XRPL_ASSERT(
(!t || t == kTAG_MASK), "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
#endif
}
//------------------------------------------------------------------------------
inline IntrusiveRefCounts::RefCountPair::RefCountPair(IntrusiveRefCounts::FieldType v) noexcept
: strong{static_cast<CountType>(v & kStrongMask)}
, weak{static_cast<CountType>((v & kWeakMask) >> kStrongCountNumBits)}
, partialDestroyStartedBit{v & kPartialDestroyStartedMask}
, partialDestroyFinishedBit{v & kPartialDestroyFinishedMask}
: strong{static_cast<CountType>(v & kSTRONG_MASK)}
, weak{static_cast<CountType>((v & kWEAK_MASK) >> kSTRONG_COUNT_NUM_BITS)}
, partialDestroyStartedBit{v & kPARTIAL_DESTROY_STARTED_MASK}
, partialDestroyFinishedBit{v & kPARTIAL_DESTROY_FINISHED_MASK}
{
XRPL_ASSERT(
(strong < kCheckStrongMaxValue && weak < kCheckWeakMaxValue),
(strong < kCHECK_STRONG_MAX_VALUE && weak < kCHECK_WEAK_MAX_VALUE),
"xrpl::IntrusiveRefCounts::RefCountPair(FieldType) : inputs inside "
"range");
}
@@ -425,7 +427,7 @@ inline IntrusiveRefCounts::RefCountPair::RefCountPair(
: strong{s}, weak{w}
{
XRPL_ASSERT(
(strong < kCheckStrongMaxValue && weak < kCheckWeakMaxValue),
(strong < kCHECK_STRONG_MAX_VALUE && weak < kCHECK_WEAK_MAX_VALUE),
"xrpl::IntrusiveRefCounts::RefCountPair(CountType, CountType) : "
"inputs inside range");
}
@@ -434,11 +436,11 @@ inline IntrusiveRefCounts::FieldType
IntrusiveRefCounts::RefCountPair::combinedValue() const noexcept
{
XRPL_ASSERT(
(strong < kCheckStrongMaxValue && weak < kCheckWeakMaxValue),
(strong < kCHECK_STRONG_MAX_VALUE && weak < kCHECK_WEAK_MAX_VALUE),
"xrpl::IntrusiveRefCounts::RefCountPair::combinedValue : inputs "
"inside range");
return (static_cast<IntrusiveRefCounts::FieldType>(weak)
<< IntrusiveRefCounts::kStrongCountNumBits) |
<< IntrusiveRefCounts::kSTRONG_COUNT_NUM_BITS) |
static_cast<IntrusiveRefCounts::FieldType>(strong) | partialDestroyStartedBit |
partialDestroyFinishedBit;
}
@@ -449,7 +451,7 @@ partialDestructorFinished(T** o)
{
T& self = **o;
IntrusiveRefCounts::RefCountPair const p =
self.refCounts_.fetch_or(IntrusiveRefCounts::kPartialDestroyFinishedMask);
self.refCounts_.fetch_or(IntrusiveRefCounts::kPARTIAL_DESTROY_FINISHED_MASK);
XRPL_ASSERT(
(!p.partialDestroyFinishedBit && p.partialDestroyStartedBit && !p.strong),
"xrpl::partialDestructorFinished : not a weak ref");

View File

@@ -55,8 +55,8 @@ template <class = void>
boost::thread_specific_ptr<detail::LocalValues>&
getLocalValues()
{
static boost::thread_specific_ptr<detail::LocalValues> kTsp(&detail::LocalValues::cleanup);
return kTsp;
static boost::thread_specific_ptr<detail::LocalValues> kTSP(&detail::LocalValues::cleanup);
return kTSP;
}
} // namespace detail

View File

@@ -191,7 +191,7 @@ public:
private:
// Maximum line length for log messages.
// If the message exceeds this length it will be truncated with ellipses.
static constexpr auto kMaximumMessageCharacters = 12 * 1024;
static constexpr auto kMAXIMUM_MESSAGE_CHARACTERS = 12 * 1024;
static void
format(

View File

@@ -214,12 +214,12 @@ class Number
public:
// The range for the exponent when normalized
static constexpr int kMinExponent = -32768;
static constexpr int kMaxExponent = 32768;
constexpr static int kMIN_EXPONENT = -32768;
constexpr static int kMAX_EXPONENT = 32768;
static constexpr internalrep kMaxRep = std::numeric_limits<rep>::max();
static_assert(kMaxRep == 9'223'372'036'854'775'807);
static_assert(-kMaxRep == std::numeric_limits<rep>::min() + 1);
constexpr static internalrep kMAX_REP = std::numeric_limits<rep>::max();
static_assert(kMAX_REP == 9'223'372'036'854'775'807);
static_assert(-kMAX_REP == std::numeric_limits<rep>::min() + 1);
// May need to make unchecked private
struct Unchecked
@@ -409,26 +409,26 @@ public:
static internalrep
minMantissa()
{
return kRange.get().min;
return kRANGE.get().min;
}
static internalrep
maxMantissa()
{
return kRange.get().max;
return kRANGE.get().max;
}
static int
mantissaLog()
{
return kRange.get().log;
return kRANGE.get().log;
}
/// oneSmall is needed because the ranges are private
static constexpr Number
constexpr static Number
oneSmall();
/// oneLarge is needed because the ranges are private
static constexpr Number
constexpr static Number
oneLarge();
// And one is needed because it needs to choose between oneSmall and
@@ -445,25 +445,25 @@ private:
static thread_local RoundingMode mode;
// The available ranges for mantissa
static constexpr MantissaRange kSmallRange{MantissaRange::MantissaScale::Small};
static_assert(isPowerOfTen(kSmallRange.min));
static_assert(kSmallRange.min == 1'000'000'000'000'000LL);
static_assert(kSmallRange.max == 9'999'999'999'999'999LL);
static_assert(kSmallRange.log == 15);
static_assert(kSmallRange.min < kMaxRep);
static_assert(kSmallRange.max < kMaxRep);
static constexpr MantissaRange kLargeRange{MantissaRange::MantissaScale::Large};
static_assert(isPowerOfTen(kLargeRange.min));
static_assert(kLargeRange.min == 1'000'000'000'000'000'000ULL);
static_assert(kLargeRange.max == internalrep(9'999'999'999'999'999'999ULL));
static_assert(kLargeRange.log == 18);
static_assert(kLargeRange.min < kMaxRep);
static_assert(kLargeRange.max > kMaxRep);
constexpr static MantissaRange kSMALL_RANGE{MantissaRange::MantissaScale::Small};
static_assert(isPowerOfTen(kSMALL_RANGE.min));
static_assert(kSMALL_RANGE.min == 1'000'000'000'000'000LL);
static_assert(kSMALL_RANGE.max == 9'999'999'999'999'999LL);
static_assert(kSMALL_RANGE.log == 15);
static_assert(kSMALL_RANGE.min < kMAX_REP);
static_assert(kSMALL_RANGE.max < kMAX_REP);
constexpr static MantissaRange kLARGE_RANGE{MantissaRange::MantissaScale::Large};
static_assert(isPowerOfTen(kLARGE_RANGE.min));
static_assert(kLARGE_RANGE.min == 1'000'000'000'000'000'000ULL);
static_assert(kLARGE_RANGE.max == internalrep(9'999'999'999'999'999'999ULL));
static_assert(kLARGE_RANGE.log == 18);
static_assert(kLARGE_RANGE.min < kMAX_REP);
static_assert(kLARGE_RANGE.max > kMAX_REP);
// The range for the mantissa when normalized.
// Use reference_wrapper to avoid making copies, and prevent accidentally
// changing the values inside the range.
static thread_local std::reference_wrapper<MantissaRange const> kRange;
static thread_local std::reference_wrapper<MantissaRange const> kRANGE;
void
normalize();
@@ -471,7 +471,7 @@ private:
/** Normalize Number components to an arbitrary range.
*
* min/maxMantissa are parameters because this function is used by both
* normalize(), which reads from kRange, and by normalizeToRange,
* normalize(), which reads from kRANGE, and by normalizeToRange,
* which is public and can accept an arbitrary range from the caller.
*/
template <class T>
@@ -521,7 +521,7 @@ constexpr Number::Number(internalrep mantissa, int exponent, Unchecked) noexcept
{
}
static constexpr Number kNumZero{};
constexpr static Number kNUM_ZERO{};
inline Number::Number(bool negative, internalrep mantissa, int exponent, Normalized)
: Number(negative, mantissa, exponent, Unchecked{})
@@ -552,10 +552,10 @@ constexpr Number::rep
Number::mantissa() const noexcept
{
auto m = mantissa_;
if (m > kMaxRep)
if (m > kMAX_REP)
{
XRPL_ASSERT_PARTS(
!isnormal() || (m % 10 == 0 && m / 10 <= kMaxRep),
!isnormal() || (m % 10 == 0 && m / 10 <= kMAX_REP),
"xrpl::Number::mantissa",
"large normalized mantissa has no remainder");
m /= 10;
@@ -573,10 +573,10 @@ constexpr int
Number::exponent() const noexcept
{
auto e = exponent_;
if (mantissa_ > kMaxRep)
if (mantissa_ > kMAX_REP)
{
XRPL_ASSERT_PARTS(
!isnormal() || (mantissa_ % 10 == 0 && mantissa_ / 10 <= kMaxRep),
!isnormal() || (mantissa_ % 10 == 0 && mantissa_ / 10 <= kMAX_REP),
"xrpl::Number::exponent",
"large normalized mantissa has no remainder");
++e;
@@ -671,29 +671,29 @@ operator/(Number const& x, Number const& y)
inline Number
Number::min() noexcept
{
return Number{false, kRange.get().min, kMinExponent, Unchecked{}};
return Number{false, kRANGE.get().min, kMIN_EXPONENT, Unchecked{}};
}
inline Number
Number::max() noexcept
{
return Number{false, std::min(kRange.get().max, kMaxRep), kMaxExponent, Unchecked{}};
return Number{false, std::min(kRANGE.get().max, kMAX_REP), kMAX_EXPONENT, Unchecked{}};
}
inline Number
Number::lowest() noexcept
{
return Number{true, std::min(kRange.get().max, kMaxRep), kMaxExponent, Unchecked{}};
return Number{true, std::min(kRANGE.get().max, kMAX_REP), kMAX_EXPONENT, Unchecked{}};
}
inline bool
Number::isnormal() const noexcept
{
MantissaRange const& range = kRange;
MantissaRange const& range = kRANGE;
auto const absM = mantissa_;
return *this == Number{} ||
(range.min <= absM && absM <= range.max && (absM <= kMaxRep || absM % 10 == 0) &&
kMinExponent <= exponent_ && exponent_ <= kMaxExponent);
(range.min <= absM && absM <= range.max && (absM <= kMAX_REP || absM % 10 == 0) &&
kMIN_EXPONENT <= exponent_ && exponent_ <= kMAX_EXPONENT);
}
template <Integral64 T>

View File

@@ -57,10 +57,10 @@ template <class T>
std::shared_ptr<T> const&
SharedWeakCachePointer<T>::getStrong() const
{
static std::shared_ptr<T> const kEmpty;
static std::shared_ptr<T> const kEMPTY;
if (auto p = std::get_if<std::shared_ptr<T>>(&combo_))
return *p;
return kEmpty;
return kEMPTY;
}
template <class T>

View File

@@ -34,7 +34,7 @@ template <typename T>
concept SomeChar = std::same_as<std::remove_cvref_t<T>, int8_t> ||
std::same_as<std::remove_cvref_t<T>, char> || std::same_as<std::remove_cvref_t<T>, uint8_t>;
inline constexpr std::array<std::optional<int>, 256> const kDigitLookupTable = []() {
inline constexpr std::array<std::optional<int>, 256> const kDIGIT_LOOKUP_TABLE = []() {
std::array<std::optional<int>, 256> t{};
for (int i = 0; i < 10; ++i)
@@ -52,7 +52,7 @@ inline constexpr std::array<std::optional<int>, 256> const kDigitLookupTable = [
inline std::optional<int>
hexCharToInt(SomeChar auto hexChar)
{
return kDigitLookupTable[static_cast<uint8_t>(hexChar)];
return kDIGIT_LOOKUP_TABLE[static_cast<uint8_t>(hexChar)];
}
} // namespace detail

View File

@@ -30,8 +30,8 @@ public:
now(); // seconds since xrpld program start
private:
static std::atomic<rep> kNow;
static std::atomic<bool> kStop;
static std::atomic<rep> kNOW;
static std::atomic<bool> kSTOP;
struct UpdateThread : private std::thread
{

View File

@@ -73,12 +73,12 @@ class BaseUInt
static_assert(Bits >= 64, "The length of a base_uint in bits must be at least 64.");
static constexpr std::size_t kWidth = Bits / 32;
static constexpr std::size_t kWIDTH = Bits / 32;
// This is really big-endian in byte order.
// We sometimes use std::uint32_t for speed.
std::array<std::uint32_t, kWidth> data_;
std::array<std::uint32_t, kWIDTH> data_;
public:
//--------------------------------------------------------------------------
@@ -86,8 +86,8 @@ public:
// STL Container Interface
//
static constexpr std::size_t kBytes = Bits / 8;
static_assert(sizeof(data_) == kBytes, "");
static std::size_t constexpr kBYTES = Bits / 8;
static_assert(sizeof(data_) == kBYTES, "");
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
@@ -121,7 +121,7 @@ public:
iterator
end()
{
return data() + kBytes;
return data() + kBYTES;
}
[[nodiscard]] const_iterator
begin() const
@@ -131,7 +131,7 @@ public:
[[nodiscard]] const_iterator
end() const
{
return data() + kBytes;
return data() + kBYTES;
}
[[nodiscard]] const_iterator
cbegin() const
@@ -141,7 +141,7 @@ public:
[[nodiscard]] const_iterator
cend() const
{
return data() + kBytes;
return data() + kBYTES;
}
/** Value hashing function.
@@ -167,7 +167,7 @@ private:
explicit BaseUInt(void const* data, VoidHelper)
{
memcpy(data_.data(), data, kBytes);
memcpy(data_.data(), data, kBYTES);
}
// Helper function to initialize a base_uint from a std::string_view.
@@ -336,7 +336,7 @@ public:
[[nodiscard]] constexpr int
signum() const
{
for (int i = 0; i < kWidth; i++)
for (int i = 0; i < kWIDTH; i++)
{
if (data_[i] != 0)
return 1;
@@ -348,7 +348,7 @@ public:
bool
operator!() const
{
return *this == beast::kZero;
return *this == beast::kZERO;
}
constexpr BaseUInt
@@ -356,7 +356,7 @@ public:
{
BaseUInt ret;
for (int i = 0; i < kWidth; i++)
for (int i = 0; i < kWIDTH; i++)
ret.data_[i] = ~data_[i];
return ret;
@@ -365,7 +365,7 @@ public:
BaseUInt&
operator=(std::uint64_t uHost)
{
*this = beast::kZero;
*this = beast::kZERO;
// NOLINTBEGIN(cppcoreguidelines-pro-type-member-init)
union
{
@@ -375,15 +375,15 @@ public:
// NOLINTEND(cppcoreguidelines-pro-type-member-init)
// Put in least significant bits.
ul = boost::endian::native_to_big(uHost);
data_[kWidth - 2] = u[0];
data_[kWidth - 1] = u[1];
data_[kWIDTH - 2] = u[0];
data_[kWIDTH - 1] = u[1];
return *this;
}
BaseUInt&
operator^=(BaseUInt const& b)
{
for (int i = 0; i < kWidth; i++)
for (int i = 0; i < kWIDTH; i++)
data_[i] ^= b.data_[i];
return *this;
@@ -392,7 +392,7 @@ public:
BaseUInt&
operator&=(BaseUInt const& b)
{
for (int i = 0; i < kWidth; i++)
for (int i = 0; i < kWIDTH; i++)
data_[i] &= b.data_[i];
return *this;
@@ -401,7 +401,7 @@ public:
BaseUInt&
operator|=(BaseUInt const& b)
{
for (int i = 0; i < kWidth; i++)
for (int i = 0; i < kWIDTH; i++)
data_[i] |= b.data_[i];
return *this;
@@ -411,7 +411,7 @@ public:
operator++()
{
// prefix operator
for (int i = kWidth - 1; i >= 0; --i)
for (int i = kWIDTH - 1; i >= 0; --i)
{
data_[i] = boost::endian::native_to_big(boost::endian::big_to_native(data_[i]) + 1);
if (data_[i] != 0)
@@ -434,7 +434,7 @@ public:
BaseUInt&
operator--()
{
for (int i = kWidth - 1; i >= 0; --i)
for (int i = kWIDTH - 1; i >= 0; --i)
{
auto prev = data_[i];
data_[i] = boost::endian::native_to_big(boost::endian::big_to_native(data_[i]) - 1);
@@ -475,7 +475,7 @@ public:
{
std::uint64_t carry = 0;
for (int i = kWidth - 1; i >= 0; i--)
for (int i = kWIDTH - 1; i >= 0; i--)
{
std::uint64_t const n = carry + boost::endian::big_to_native(data_[i]) +
boost::endian::big_to_native(b.data_[i]);
@@ -526,10 +526,10 @@ public:
return parseHex(std::string_view{str});
}
static constexpr std::size_t
constexpr static std::size_t
size()
{
return kBytes;
return kBYTES;
}
BaseUInt<Bits, Tag>&
@@ -543,17 +543,17 @@ public:
[[nodiscard]] bool
isZero() const
{
return *this == beast::kZero;
return *this == beast::kZERO;
}
[[nodiscard]] bool
isNonZero() const
{
return *this != beast::kZero;
return *this != beast::kZERO;
}
void
zero()
{
*this = beast::kZero;
*this = beast::kZERO;
}
};
@@ -639,7 +639,7 @@ template <std::size_t Bits, class Tag>
inline std::string
toShortString(BaseUInt<Bits, Tag> const& a)
{
static_assert(BaseUInt<Bits, Tag>::kBytes > 4, "For 4 bytes or less, use a native type");
static_assert(BaseUInt<Bits, Tag>::kBYTES > 4, "For 4 bytes or less, use a native type");
return strHex(a.cbegin(), a.cbegin() + 4) + "...";
}

View File

@@ -30,10 +30,10 @@ using weeks = std::chrono::duration<int, std::ratio_multiply<days::period, std::
= seconds(946684800)
*/
static constexpr std::chrono::seconds kEpochOffset =
constexpr static std::chrono::seconds kEPOCH_OFFSET =
date::sys_days{date::year{2000} / 1 / 1} - date::sys_days{date::year{1970} / 1 / 1};
static_assert(kEpochOffset.count() == 946684800);
static_assert(kEPOCH_OFFSET.count() == 946684800);
class NetClock
{
@@ -60,7 +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
using namespace std::chrono;
return to_string(system_clock::time_point{tp.time_since_epoch() + kEpochOffset});
return to_string(system_clock::time_point{tp.time_since_epoch() + kEPOCH_OFFSET});
}
template <class Duration>
@@ -77,7 +77,7 @@ toStringIso(NetClock::time_point tp)
// 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
static_assert(std::is_same_v<NetClock::duration::period, std::ratio<1>>);
return toStringIso(date::sys_time<NetClock::duration>{tp.time_since_epoch() + kEpochOffset});
return toStringIso(date::sys_time<NetClock::duration>{tp.time_since_epoch() + kEPOCH_OFFSET});
}
/** A clock for measuring elapsed time.

View File

@@ -31,9 +31,9 @@ makeSeedPair() noexcept
// state_t(state_t const&) = delete;
// state_t& operator=(state_t const&) = delete;
};
static StateT kState;
std::scoped_lock const lock(kState.mutex);
return {kState.dist(kState.gen), kState.dist(kState.gen)};
static StateT kSTATE;
std::scoped_lock const lock(kSTATE.mutex);
return {kSTATE.dist(kSTATE.gen), kSTATE.dist(kSTATE.gen)};
}
} // namespace detail

View File

@@ -5,7 +5,7 @@
#include <optional>
namespace xrpl {
constexpr auto kMuldivMax = std::numeric_limits<std::uint64_t>::max();
auto constexpr kMULDIV_MAX = std::numeric_limits<std::uint64_t>::max();
/** Return value*mul/div accurately.
Computes the result of the multiplication and division in

View File

@@ -47,7 +47,7 @@ inline beast::xor_shift_engine&
defaultPrng()
{
// This is used to seed the thread-specific PRNGs on demand
static beast::xor_shift_engine kSeeder = [] {
static beast::xor_shift_engine kSEEDER = [] {
std::random_device rng;
std::uniform_int_distribution<std::uint64_t> distribution{1};
return beast::xor_shift_engine(distribution(rng));
@@ -57,17 +57,17 @@ defaultPrng()
static std::mutex kM;
// The thread-specific PRNGs:
thread_local beast::xor_shift_engine kEngine = [] {
thread_local beast::xor_shift_engine kENGINE = [] {
std::uint64_t seed = 0;
{
std::scoped_lock const lk(kM);
std::uniform_int_distribution<std::uint64_t> distribution{1};
seed = distribution(kSeeder);
seed = distribution(kSEEDER);
}
return beast::xor_shift_engine{seed};
}();
return kEngine;
return kENGINE;
}
/** Return a uniformly distributed random integer.

View File

@@ -22,9 +22,9 @@ safeCast(Src s) noexcept
{
static_assert(
std::is_signed_v<Dest> || std::is_unsigned_v<Src>, "Cannot cast signed to unsigned");
constexpr unsigned kNotSame = std::is_signed_v<Dest> != std::is_signed_v<Src>;
constexpr unsigned kNOT_SAME = std::is_signed_v<Dest> != std::is_signed_v<Src>;
static_assert(
sizeof(Dest) >= sizeof(Src) + kNotSame,
sizeof(Dest) >= sizeof(Src) + kNOT_SAME,
"Destination is too small to hold all values of source");
return static_cast<Dest>(s);
}

View File

@@ -83,8 +83,8 @@ template <class Facade, class Clock = Facade>
AbstractClock<Facade>&
getAbstractClock()
{
static detail::AbstractClockWrapper<Facade, Clock> kClock;
return kClock;
static detail::AbstractClockWrapper<Facade, Clock> kCLOCK;
return kCLOCK;
}
} // namespace beast

View File

@@ -21,7 +21,7 @@ setCurrentThreadName(std::string_view newThreadName);
// On Linux, thread names are limited to 16 bytes including the null terminator.
// Maximum number of characters is therefore 15.
constexpr std::size_t kMaxThreadNameLength = 15;
constexpr std::size_t kMAX_THREAD_NAME_LENGTH = 15;
/** Sets the name of the caller thread with compile-time size checking.
@tparam N The size of the string literal including null terminator
@@ -34,7 +34,7 @@ template <std::size_t N>
void
setCurrentThreadName(char const (&newThreadName)[N])
{
static_assert(N <= kMaxThreadNameLength + 1, "Thread name cannot exceed 15 characters");
static_assert(N <= kMAX_THREAD_NAME_LENGTH + 1, "Thread name cannot exceed 15 characters");
setCurrentThreadName(std::string_view(newThreadName, N - 1));
}

View File

@@ -53,7 +53,7 @@ inline void
maybeReverseBytes(T& t, Hasher&)
{
maybeReverseBytes(
t, std::integral_constant<bool, Hasher::kEndian != boost::endian::order::native>{});
t, std::integral_constant<bool, Hasher::kENDIAN != boost::endian::order::native>{});
}
} // namespace detail
@@ -154,7 +154,7 @@ struct IsContiguouslyHashable
: public std::integral_constant<
bool,
IsUniquelyRepresented<T>::value &&
(sizeof(T) == 1 || HashAlgorithm::kEndian == boost::endian::order::native)>
(sizeof(T) == 1 || HashAlgorithm::kENDIAN == boost::endian::order::native)>
{
explicit IsContiguouslyHashable() = default;
};

View File

@@ -21,9 +21,9 @@ private:
static_assert(sizeof(std::size_t) == 8, "requires 64-bit std::size_t");
// Have an internal buffer to avoid the streaming API
// A 64-byte buffer should to be big enough for us
static constexpr std::size_t kInternalBufferSize = 64;
static constexpr std::size_t kINTERNAL_BUFFER_SIZE = 64;
alignas(64) std::array<std::uint8_t, kInternalBufferSize> buffer_{};
alignas(64) std::array<std::uint8_t, kINTERNAL_BUFFER_SIZE> buffer_{};
std::span<std::uint8_t> readBuffer_;
std::span<std::uint8_t> writeBuffer_;
@@ -102,7 +102,7 @@ private:
}
public:
static constexpr auto kEndian = boost::endian::order::native;
static constexpr auto const kENDIAN = boost::endian::order::native;
Xxhasher(Xxhasher const&) = delete;
Xxhasher&

View File

@@ -62,7 +62,7 @@ private:
{
using run_time = std::pair<std::string, typename clock_type::duration>;
static constexpr auto kMaxTop = 10;
static constexpr auto kMAX_TOP = 10;
std::size_t suites = 0;
std::size_t cases = 0;
@@ -146,11 +146,11 @@ Reporter<Unused>::Results::add(SuiteResults const& r)
});
if (iter != top.end())
{
if (top.size() == kMaxTop)
if (top.size() == kMAX_TOP)
top.resize(top.size() - 1);
top.emplace(iter, r.name, elapsed);
}
else if (top.size() < kMaxTop)
else if (top.size() < kMAX_TOP)
{
top.emplace_back(r.name, elapsed);
}

View File

@@ -299,8 +299,8 @@ private:
static Suite**
pThisSuite()
{
static Suite* kPTs = nullptr; // NOLINT TODO
return &kPTs;
static Suite* kP_TS = nullptr; // NOLINT TODO
return &kP_TS;
}
/** Runs the suite. */

View File

@@ -27,7 +27,7 @@ struct Zero
};
namespace {
constexpr Zero kZero{};
constexpr Zero kZERO{};
} // namespace
/** Default implementation of signum calls the method on the class. */
@@ -102,42 +102,42 @@ template <typename T>
bool
operator==(Zero, T const& t)
{
return t == kZero;
return t == kZERO;
}
template <typename T>
bool
operator!=(Zero, T const& t)
{
return t != kZero;
return t != kZERO;
}
template <typename T>
bool
operator<(Zero, T const& t)
{
return t > kZero;
return t > kZERO;
}
template <typename T>
bool
operator>(Zero, T const& t)
{
return t < kZero;
return t < kZERO;
}
template <typename T>
bool
operator>=(Zero, T const& t)
{
return t <= kZero;
return t <= kZERO;
}
template <typename T>
bool
operator<=(Zero, T const& t)
{
return t >= kZero;
return t >= kZERO;
}
} // namespace beast

View File

@@ -14,23 +14,23 @@ void
rngfill(void* const buffer, std::size_t const bytes, Generator& g)
{
using result_type = typename Generator::result_type;
constexpr std::size_t kResultSize = sizeof(result_type);
constexpr std::size_t kRESULT_SIZE = sizeof(result_type);
std::uint8_t* const bufferStart = static_cast<std::uint8_t*>(buffer);
std::size_t const completeIterations = bytes / kResultSize;
std::size_t const bytesRemaining = bytes % kResultSize;
std::size_t const completeIterations = bytes / kRESULT_SIZE;
std::size_t const bytesRemaining = bytes % kRESULT_SIZE;
for (std::size_t count = 0; count < completeIterations; ++count)
{
result_type const v = g();
std::size_t const offset = count * kResultSize;
std::memcpy(bufferStart + offset, &v, kResultSize);
std::size_t const offset = count * kRESULT_SIZE;
std::memcpy(bufferStart + offset, &v, kRESULT_SIZE);
}
if (bytesRemaining > 0)
{
result_type const v = g();
std::size_t const offset = completeIterations * kResultSize;
std::size_t const offset = completeIterations * kRESULT_SIZE;
std::memcpy(bufferStart + offset, &v, bytesRemaining);
}
}

View File

@@ -26,14 +26,12 @@ public:
result_type
operator()();
static constexpr result_type
min()
static result_type constexpr min()
{
return std::numeric_limits<result_type>::min();
}
static constexpr result_type
max()
static result_type constexpr max()
{
return std::numeric_limits<result_type>::max();
}

View File

@@ -27,7 +27,7 @@ public:
that were previously considered valid to no longer
be allowed.
*/
static constexpr std::size_t kMaxSerializedCondition = 128;
static constexpr std::size_t kMAX_SERIALIZED_CONDITION = 128;
/** Load a condition from its binary form

View File

@@ -16,7 +16,7 @@ public:
that were previously considered valid to no longer
be allowed.
*/
static constexpr std::size_t kMaxSerializedFulfillment = 256;
static constexpr std::size_t kMAX_SERIALIZED_FULFILLMENT = 256;
/** Load a fulfillment from its binary form

View File

@@ -23,7 +23,7 @@ public:
While future versions of this code will never lower
this limit, they may opt to raise it.
*/
static constexpr std::size_t kMaxPreimageLength = 128;
static constexpr std::size_t kMAX_PREIMAGE_LENGTH = 128;
/** Parse the payload for a PreimageSha256 condition
@@ -65,7 +65,7 @@ public:
return {};
}
if (s.size() > kMaxPreimageLength)
if (s.size() > kMAX_PREIMAGE_LENGTH)
{
ec = Error::PreimageTooLong;
return {};

View File

@@ -6,7 +6,7 @@ namespace xrpl {
/// Coroutine stack size (1.5 MB). Increased from 1 MB because
/// ASAN-instrumented deep call stacks exceeded the original limit.
constexpr std::size_t kCoroStackSize = 1536 * 1024;
constexpr std::size_t kCORO_STACK_SIZE = 1536 * 1024;
template <class F>
JobQueue::Coro::Coro(CoroCreateT, JobQueue& jq, JobType type, std::string name, F&& f)
@@ -14,7 +14,7 @@ JobQueue::Coro::Coro(CoroCreateT, JobQueue& jq, JobType type, std::string name,
, type_(type)
, name_(std::move(name))
, coro_(
boost::context::protected_fixedsize_stack(kCoroStackSize),
boost::context::protected_fixedsize_stack(kCORO_STACK_SIZE),
[this, fn = std::forward<F>(f)](boost::coroutines2::coroutine<void>::push_type& doYield) {
yield_ = &doYield;
yield();

View File

@@ -101,8 +101,8 @@ public:
static JobTypes const&
instance()
{
static JobTypes const kTypes;
return kTypes;
static JobTypes const kTYPES;
return kTYPES;
}
static std::string const&

View File

@@ -3,7 +3,6 @@
#include <xrpl/basics/Blob.h>
#include <xrpl/basics/SHAMapHash.h>
#include <xrpl/basics/TaggedCache.h>
#include <xrpl/protocol/Fees.h>
#include <boost/asio.hpp>
@@ -239,9 +238,6 @@ public:
virtual DatabaseCon&
getWalletDB() = 0;
[[nodiscard]] virtual Fees
getFees() const = 0;
// Temporary: Get the underlying Application for functions that haven't
// been migrated yet. This should be removed once all code is migrated.
virtual Application&

View File

@@ -67,7 +67,7 @@ public:
[[nodiscard]] std::string
getFormattedErrorMessages() const;
static constexpr unsigned kNestLimit{25};
static constexpr unsigned kNEST_LIMIT{25};
private:
enum class TokenType {

View File

@@ -102,8 +102,8 @@ operator!=(StaticString x, std::string const& y)
/** \brief Represents a <a HREF="http://www.json.org">JSON</a> value.
*
* This class is a discriminated union wrapper that can represent a:
* - signed integer [range: Value::kMinInt - Value::kMaxInt]
* - unsigned integer (range: 0 - Value::kMaxUInt)
* - signed integer [range: Value::kMIN_INT - Value::kMAX_INT]
* - unsigned integer (range: 0 - Value::kMAX_UINT)
* - double
* - UTF-8 string
* - boolean
@@ -138,10 +138,10 @@ public:
using Int = json::Int;
using ArrayIndex = UInt;
static Value const kNull;
static constexpr Int kMinInt = std::numeric_limits<Int>::min();
static constexpr Int kMaxInt = std::numeric_limits<Int>::max();
static constexpr UInt kMaxUInt = std::numeric_limits<UInt>::max();
static Value const kNULL;
static constexpr Int kMIN_INT = std::numeric_limits<Int>::min();
static constexpr Int kMAX_INT = std::numeric_limits<Int>::max();
static constexpr UInt kMAX_UINT = std::numeric_limits<UInt>::max();
private:
class CZString
@@ -472,7 +472,7 @@ operator>=(Value const& x, Value const& y)
class ValueAllocator
{
public:
static constexpr auto kUnknown = (unsigned)-1;
static constexpr auto kUNKNOWN = (unsigned)-1;
virtual ~ValueAllocator() = default;
@@ -481,7 +481,7 @@ public:
virtual void
releaseMemberName(char* memberName) = 0;
virtual char*
duplicateStringValue(char const* value, unsigned int length = kUnknown) = 0;
duplicateStringValue(char const* value, unsigned int length = kUNKNOWN) = 0;
virtual void
releaseStringValue(char* value) = 0;
};

View File

@@ -54,18 +54,6 @@ public:
deliver_ = amount;
}
void
setGasUsed(std::optional<std::uint32_t> const gasUsed)
{
gasUsed_ = gasUsed;
}
void
setWasmReturnCode(std::int32_t const wasmReturnCode)
{
wasmReturnCode_ = wasmReturnCode;
}
/** Get the number of modified entries
*/
std::size_t
@@ -84,8 +72,6 @@ public:
private:
std::optional<STAmount> deliver_;
std::optional<std::uint32_t> gasUsed_;
std::optional<std::int32_t> wasmReturnCode_;
};
} // namespace xrpl

View File

@@ -24,7 +24,7 @@ struct CreateGenesisT
{
explicit CreateGenesisT() = default;
};
extern CreateGenesisT const kCreateGenesis;
extern CreateGenesisT const kCREATE_GENESIS;
/** Holds a ledger.

View File

@@ -12,7 +12,7 @@ namespace xrpl {
Values should not be duplicated.
@see getNextLedgerTimeResolution
*/
constexpr std::chrono::seconds kLedgerPossibleTimeResolutions[] = {
std::chrono::seconds constexpr kLEDGER_POSSIBLE_TIME_RESOLUTIONS[] = {
std::chrono::seconds{10},
std::chrono::seconds{20},
std::chrono::seconds{30},
@@ -21,16 +21,16 @@ constexpr std::chrono::seconds kLedgerPossibleTimeResolutions[] = {
std::chrono::seconds{120}};
//! Initial resolution of ledger close time.
constexpr auto kLedgerDefaultTimeResolution = kLedgerPossibleTimeResolutions[2];
auto constexpr kLEDGER_DEFAULT_TIME_RESOLUTION = kLEDGER_POSSIBLE_TIME_RESOLUTIONS[2];
//! Close time resolution in genesis ledger
constexpr auto kLedgerGenesisTimeResolution = kLedgerPossibleTimeResolutions[0];
auto constexpr kLEDGER_GENESIS_TIME_RESOLUTION = kLEDGER_POSSIBLE_TIME_RESOLUTIONS[0];
//! How often we increase the close time resolution (in numbers of ledgers)
constexpr auto kIncreaseLedgerTimeResolutionEvery = 8;
auto constexpr kINCREASE_LEDGER_TIME_RESOLUTION_EVERY = 8;
//! How often we decrease the close time resolution (in numbers of ledgers)
constexpr auto kDecreaseLedgerTimeResolutionEvery = 1;
auto constexpr kDECREASE_LEDGER_TIME_RESOLUTION_EVERY = 1;
/** Calculates the close time resolution for the specified ledger.
@@ -46,7 +46,7 @@ constexpr auto kDecreaseLedgerTimeResolutionEvery = 1;
@param ledgerSeq the sequence number of the new ledger
@pre previousResolution must be a valid bin
from @ref kLedgerPossibleTimeResolutions
from @ref kLEDGER_POSSIBLE_TIME_RESOLUTIONS
@tparam Rep Type representing number of ticks in std::chrono::duration
@tparam Period An std::ratio representing tick period in
@@ -67,30 +67,30 @@ getNextLedgerTimeResolution(
using namespace std::chrono;
// Find the current resolution:
auto iter = std::find(
std::begin(kLedgerPossibleTimeResolutions),
std::end(kLedgerPossibleTimeResolutions),
std::begin(kLEDGER_POSSIBLE_TIME_RESOLUTIONS),
std::end(kLEDGER_POSSIBLE_TIME_RESOLUTIONS),
previousResolution);
XRPL_ASSERT(
iter != std::end(kLedgerPossibleTimeResolutions),
iter != std::end(kLEDGER_POSSIBLE_TIME_RESOLUTIONS),
"xrpl::getNextLedgerTimeResolution : found time resolution");
// This should never happen, but just as a precaution
if (iter == std::end(kLedgerPossibleTimeResolutions))
if (iter == std::end(kLEDGER_POSSIBLE_TIME_RESOLUTIONS))
return previousResolution;
// If we did not previously agree, we try to decrease the resolution to
// improve the chance that we will agree now.
if (!previousAgree && (ledgerSeq % Seq{kDecreaseLedgerTimeResolutionEvery} == Seq{0}))
if (!previousAgree && (ledgerSeq % Seq{kDECREASE_LEDGER_TIME_RESOLUTION_EVERY} == Seq{0}))
{
if (++iter != std::end(kLedgerPossibleTimeResolutions))
if (++iter != std::end(kLEDGER_POSSIBLE_TIME_RESOLUTIONS))
return *iter;
}
// If we previously agreed, we try to increase the resolution to determine
// if we can continue to agree.
if (previousAgree && (ledgerSeq % Seq{kIncreaseLedgerTimeResolutionEvery} == Seq{0}))
if (previousAgree && (ledgerSeq % Seq{kINCREASE_LEDGER_TIME_RESOLUTION_EVERY} == Seq{0}))
{
if (iter-- != std::begin(kLedgerPossibleTimeResolutions))
if (iter-- != std::begin(kLEDGER_POSSIBLE_TIME_RESOLUTIONS))
return *iter;
}

View File

@@ -23,7 +23,7 @@ namespace xrpl {
inline constexpr struct OpenLedgerT
{
explicit constexpr OpenLedgerT() = default;
} kOpenLedger{};
} kOPEN_LEDGER{};
/** Batch view construction tag.
@@ -33,7 +33,7 @@ inline constexpr struct OpenLedgerT
inline constexpr struct BatchViewT
{
explicit constexpr BatchViewT() = default;
} kBatchView{};
} kBATCH_VIEW{};
//------------------------------------------------------------------------------
@@ -47,7 +47,7 @@ private:
// Initial size for the monotonic_buffer_resource used for allocations
// The size was chosen from the old `qalloc` code (which this replaces).
// It is unclear how the size initially chosen in qalloc.
static constexpr size_t kInitialBufferSize = kilobytes(256);
static constexpr size_t kINITIAL_BUFFER_SIZE = kilobytes(256);
class TxsIterImpl;
@@ -139,7 +139,7 @@ public:
std::shared_ptr<void const> hold = nullptr);
OpenView(OpenLedgerT, Rules const& rules, std::shared_ptr<ReadView const> const& base)
: OpenView(kOpenLedger, &*base, rules, base)
: OpenView(kOPEN_LEDGER, &*base, rules, base)
{
}

View File

@@ -51,8 +51,6 @@ public:
TER ter,
std::optional<STAmount> const& deliver,
std::optional<uint256 const> const& parentBatchId,
std::optional<std::uint32_t> const& gasUsed,
std::optional<std::int32_t> const& wasmReturnCode,
bool isDryRun,
beast::Journal j);

View File

@@ -19,16 +19,16 @@ public:
// Initial size for the monotonic_buffer_resource used for allocations
// The size was chosen from the old `qalloc` code (which this replaces).
// It is unclear how the size initially chosen in qalloc.
static constexpr size_t kInitialBufferSize = kilobytes(256);
static constexpr size_t kINITIAL_BUFFER_SIZE = kilobytes(256);
RawStateTable()
: monotonic_resource_{std::make_unique<boost::container::pmr::monotonic_buffer_resource>(
kInitialBufferSize)}
kINITIAL_BUFFER_SIZE)}
, items_{monotonic_resource_.get()} {};
RawStateTable(RawStateTable const& rhs)
: monotonic_resource_{std::make_unique<boost::container::pmr::monotonic_buffer_resource>(
kInitialBufferSize)}
kINITIAL_BUFFER_SIZE)}
, items_{rhs.items_, monotonic_resource_.get()}
, dropsDestroyed_{rhs.dropsDestroyed_} {};

View File

@@ -25,11 +25,11 @@ namespace detail {
Number
reduceOffer(auto const& amount)
{
static Number const kReducedOfferPct(9999, -4);
static Number const kREDUCED_OFFER_PCT(9999, -4);
// Make sure the result is always less than amount or zero.
NumberRoundModeGuard const mg(Number::RoundingMode::TowardsZero);
return amount * kReducedOfferPct;
return amount * kREDUCED_OFFER_PCT;
}
} // namespace detail
@@ -177,7 +177,7 @@ getAMMOfferStartWithTakerGets(
Quality const& targetQuality,
std::uint16_t const& tfee)
{
if (targetQuality.rate() == beast::kZero)
if (targetQuality.rate() == beast::kZERO)
return std::nullopt;
NumberRoundModeGuard const mg(Number::RoundingMode::ToNearest);
@@ -244,7 +244,7 @@ getAMMOfferStartWithTakerPays(
Quality const& targetQuality,
std::uint16_t tfee)
{
if (targetQuality.rate() == beast::kZero)
if (targetQuality.rate() == beast::kZERO)
return std::nullopt;
NumberRoundModeGuard const mg(Number::RoundingMode::ToNearest);

View File

@@ -70,21 +70,21 @@ escrowUnlockApplyHelper<Issue>(
initialBalance.get<Issue>().account = noAccount();
if (TER const ter = trustCreate(
view, // payment sandbox
recvLow, // is dest low?
issuer, // source
receiver, // destination
trustLineKey.key, // ledger index
sleDest, // Account to add to
false, // authorize account
!sleDest->isFlag(lsfDefaultRipple), //
false, // freeze trust line
false, // deep freeze trust line
initialBalance, // zero initial balance
Issue(currency, receiver), // limit of zero
0, // quality in
0, // quality out
journal); // journal
view, // payment sandbox
recvLow, // is dest low?
issuer, // source
receiver, // destination
trustLineKey.key, // ledger index
sleDest, // Account to add to
false, // authorize account
(sleDest->getFlags() & lsfDefaultRipple) == 0, //
false, // freeze trust line
false, // deep freeze trust line
initialBalance, // zero initial balance
Issue(currency, receiver), // limit of zero
0, // quality in
0, // quality out
journal); // journal
!isTesSuccess(ter))
{
return ter; // LCOV_EXCL_LINE
@@ -111,7 +111,7 @@ escrowUnlockApplyHelper<Issue>(
// whereas in a normal payment, the transfer fee is taken on top of the
// sending amount.
auto finalAmt = amount;
if ((!senderIssuer && !receiverIssuer) && lockedRate != kParityRate)
if ((!senderIssuer && !receiverIssuer) && lockedRate != kPARITY_RATE)
{
// compute transfer fee, if any
auto const xferFee =
@@ -211,7 +211,7 @@ escrowUnlockApplyHelper<MPTIssue>(
// whereas in a normal payment, the transfer fee is taken on top of the
// sending amount.
auto finalAmt = amount;
if ((!senderIssuer && !receiverIssuer) && lockedRate != kParityRate)
if ((!senderIssuer && !receiverIssuer) && lockedRate != kPARITY_RATE)
{
// compute transfer fee, if any
auto const xferFee = amount.value() - divideRound(amount, lockedRate, amount.asset(), true);
@@ -227,15 +227,4 @@ escrowUnlockApplyHelper<MPTIssue>(
journal);
}
template <class T>
static uint32_t
calculateAdditionalReserve(T const& finishFunction)
{
if (!finishFunction)
return 1;
// First 500 bytes included in the normal reserve
// Each additional 500 bytes requires an additional reserve
return 1 + (finishFunction->size() / 500);
}
} // namespace xrpl

View File

@@ -10,7 +10,7 @@ namespace xrpl {
bool
checkLendingProtocolDependencies(Rules const& rules, STTx const& tx);
static constexpr std::uint32_t kSecondsInYear = 365 * 24 * 60 * 60;
static constexpr std::uint32_t kSECONDS_IN_YEAR = 365 * 24 * 60 * 60;
Number
loanPeriodicRate(TenthBips32 interestRate, std::uint32_t paymentInterval);
@@ -42,14 +42,14 @@ struct LoanPaymentParts
// The amount of principal paid that reduces the loan balance.
// This amount is subtracted from sfPrincipalOutstanding in the Loan object
// and paid to the Vault
Number principalPaid = kNumZero;
Number principalPaid = kNUM_ZERO;
// The total amount of interest paid to the Vault.
// This includes:
// - Tracked interest from the amortization schedule
// - Untracked interest (e.g., late payment penalty interest)
// This value is always non-negative.
Number interestPaid = kNumZero;
Number interestPaid = kNUM_ZERO;
// The change in the loan's total value outstanding.
// - If valueChange < 0: Loan value decreased
@@ -62,7 +62,7 @@ struct LoanPaymentParts
// - Late payments add penalty interest to the loan value
// - Early full payment may increase or decrease the loan value based on
// terms
Number valueChange = kNumZero;
Number valueChange = kNUM_ZERO;
/* The total amount of fees paid to the Broker.
* This includes:
@@ -70,7 +70,7 @@ struct LoanPaymentParts
* - Untracked fees (e.g., late payment fees, service fees, origination
* fees) This value is always non-negative.
*/
Number feePaid = kNumZero;
Number feePaid = kNUM_ZERO;
LoanPaymentParts&
operator+=(LoanPaymentParts const& other);
@@ -161,7 +161,7 @@ adjustImpreciseNumber(
{
value = roundToAsset(asset, value + adjustment, vaultScale);
if (*value < beast::kZero)
if (*value < beast::kZERO)
value = 0;
}
@@ -169,7 +169,7 @@ inline int
getAssetsTotalScale(SLE::const_ref vaultSle)
{
if (!vaultSle)
return Number::kMinExponent - 1; // LCOV_EXCL_LINE
return Number::kMIN_EXPONENT - 1; // LCOV_EXCL_LINE
return scale(vaultSle->at(sfAssetsTotal), vaultSle->at(sfAsset));
}
@@ -311,7 +311,7 @@ struct ExtendedPaymentComponents : public PaymentComponents
// borrower is sufficient to cover all components of the payment.
Number totalDue;
ExtendedPaymentComponents(PaymentComponents const& p, Number fee, Number interest = kNumZero)
ExtendedPaymentComponents(PaymentComponents const& p, Number fee, Number interest = kNUM_ZERO)
: PaymentComponents(p)
, untrackedManagementFee(fee)
, untrackedInterest(interest)

View File

@@ -20,7 +20,7 @@ class HTTPClient
public:
explicit HTTPClient() = default;
static constexpr auto kMaxClientHeaderBytes = kilobytes(32);
static constexpr auto kMAX_CLIENT_HEADER_BYTES = kilobytes(32);
static void
initializeSSLContext(

View File

@@ -29,7 +29,7 @@ enum class NodeObjectType : std::uint32_t {
class NodeObject : public CountedObject<NodeObject>
{
public:
static constexpr std::size_t kKeyBytes = 32;
static constexpr std::size_t kKEY_BYTES = 32;
private:
// This hack is used to make the constructor effectively private

View File

@@ -9,13 +9,13 @@ namespace xrpl::NodeStore {
// This is only used to pre-allocate the array for
// batch objects and does not affect the amount written.
//
static constexpr auto kBatchWritePreallocationSize = 256;
static constexpr auto kBATCH_WRITE_PREALLOCATION_SIZE = 256;
// This sets a limit on the maximum number of writes
// in a batch. Actual usage can be twice this since
// we have a new batch growing as we write the old.
//
static constexpr auto kBatchWriteLimitSize = 65536;
static constexpr auto kBATCH_WRITE_LIMIT_SIZE = 65536;
/** Return codes from Backend operations. */
enum class Status {

View File

@@ -55,7 +55,7 @@ lz4Compress(void const* in, std::size_t inSize, BufferFactory&& bf)
using std::runtime_error;
using namespace nudb::detail;
std::pair<void const*, std::size_t> result;
std::array<std::uint8_t, varint_traits<std::size_t>::kMax> vi{};
std::array<std::uint8_t, varint_traits<std::size_t>::kMAX> vi{};
auto const n = writeVarint(vi.data(), inSize);
auto const outMax = LZ4_compressBound(inSize);
std::uint8_t* out = reinterpret_cast<std::uint8_t*>(bf(n + outMax));
@@ -254,12 +254,12 @@ nodeobjectCompress(void const* in, std::size_t inSize, BufferFactory&& bf)
}
}
std::array<std::uint8_t, varint_traits<std::size_t>::kMax> vi{};
std::array<std::uint8_t, varint_traits<std::size_t>::kMAX> vi{};
static constexpr std::size_t kCodecType = 1;
auto const vn = writeVarint(vi.data(), kCodecType);
constexpr std::size_t kCODEC_TYPE = 1;
auto const vn = writeVarint(vi.data(), kCODEC_TYPE);
std::pair<void const*, std::size_t> result;
switch (kCodecType)
switch (kCODEC_TYPE)
{
// case 0 was uncompressed data; we always compress now.
case 1: // lz4
@@ -275,7 +275,7 @@ nodeobjectCompress(void const* in, std::size_t inSize, BufferFactory&& bf)
break;
}
default:
Throw<std::logic_error>("nodeobject codec: unknown=" + std::to_string(kCodecType));
Throw<std::logic_error>("nodeobject codec: unknown=" + std::to_string(kCODEC_TYPE));
};
return result;
}

View File

@@ -25,7 +25,7 @@ struct varint_traits<T, true>
{
explicit varint_traits() = default;
static constexpr std::size_t kMax = (8 * sizeof(T) + 6) / 7;
static std::size_t constexpr kMAX = (8 * sizeof(T) + 6) / 7;
};
// Returns: Number of bytes consumed or 0 on error,

View File

@@ -8,21 +8,21 @@
namespace xrpl {
constexpr std::uint16_t kTradingFeeThreshold = 1000; // 1%
std::uint16_t constexpr kTRADING_FEE_THRESHOLD = 1000; // 1%
// Auction slot
constexpr std::uint32_t kTotalTimeSlotSecs = 24 * 3600;
constexpr std::uint16_t kAuctionSlotTimeIntervals = 20;
constexpr std::uint16_t kAuctionSlotMaxAuthAccounts = 4;
constexpr std::uint32_t kAuctionSlotFeeScaleFactor = 100000;
constexpr std::uint32_t kAuctionSlotDiscountedFeeFraction = 10;
constexpr std::uint32_t kAuctionSlotMinFeeFraction = 25;
constexpr std::uint32_t kAuctionSlotIntervalDuration =
kTotalTimeSlotSecs / kAuctionSlotTimeIntervals;
std::uint32_t constexpr kTOTAL_TIME_SLOT_SECS = 24 * 3600;
std::uint16_t constexpr kAUCTION_SLOT_TIME_INTERVALS = 20;
std::uint16_t constexpr kAUCTION_SLOT_MAX_AUTH_ACCOUNTS = 4;
std::uint32_t constexpr kAUCTION_SLOT_FEE_SCALE_FACTOR = 100000;
std::uint32_t constexpr kAUCTION_SLOT_DISCOUNTED_FEE_FRACTION = 10;
std::uint32_t constexpr kAUCTION_SLOT_MIN_FEE_FRACTION = 25;
std::uint32_t constexpr kAUCTION_SLOT_INTERVAL_DURATION =
kTOTAL_TIME_SLOT_SECS / kAUCTION_SLOT_TIME_INTERVALS;
// Votes
constexpr std::uint16_t kVoteMaxSlots = 8;
constexpr std::uint32_t kVoteWeightScaleFactor = 100000;
std::uint16_t constexpr kVOTE_MAX_SLOTS = 8;
std::uint32_t constexpr kVOTE_WEIGHT_SCALE_FACTOR = 100000;
class STObject;
class STAmount;
@@ -77,7 +77,7 @@ ammEnabled(Rules const&);
inline Number
getFee(std::uint16_t tfee)
{
return Number{tfee} / kAuctionSlotFeeScaleFactor;
return Number{tfee} / kAUCTION_SLOT_FEE_SCALE_FACTOR;
}
/** Get fee multiplier (1 - tfee)

View File

@@ -69,7 +69,7 @@ toIssuer(AccountID&, std::string const&);
inline bool
isXRP(AccountID const& c)
{
return c == beast::kZero;
return c == beast::kZERO;
}
// DEPRECATED

View File

@@ -96,9 +96,9 @@ inline MPTAmount
toAmount<MPTAmount>(STAmount const& amt)
{
XRPL_ASSERT(
amt.holds<MPTIssue>() && amt.mantissa() <= kMaxMpTokenAmount && amt.exponent() == 0,
amt.holds<MPTIssue>() && amt.mantissa() <= kMAX_MP_TOKEN_AMOUNT && amt.exponent() == 0,
"xrpl::toAmount<MPTAmount> : maximum mantissa");
if (amt.mantissa() > kMaxMpTokenAmount || amt.exponent() != 0)
if (amt.mantissa() > kMAX_MP_TOKEN_AMOUNT || amt.exponent() != 0)
Throw<std::runtime_error>("toAmount<MPTAmount>: invalid mantissa or exponent");
bool const isNeg = amt.negative();
std::int64_t const sMant = isNeg ? -std::int64_t(amt.mantissa()) : amt.mantissa();
@@ -167,8 +167,8 @@ toAmount(Asset const& asset, Number const& n, Number::RoundingMode mode = Number
}
else
{
static constexpr bool kAlwaysFalse = !std::is_same_v<T, T>;
static_assert(kAlwaysFalse, "Unsupported type for toAmount");
constexpr bool kALWAYS_FALSE = !std::is_same_v<T, T>;
static_assert(kALWAYS_FALSE, "Unsupported type for toAmount");
}
}
@@ -178,30 +178,30 @@ toMaxAmount(Asset const& asset)
{
if constexpr (std::is_same_v<IOUAmount, T>)
{
return IOUAmount(STAmount::kMaxValue, STAmount::kMaxOffset);
return IOUAmount(STAmount::kMAX_VALUE, STAmount::kMAX_OFFSET);
}
else if constexpr (std::is_same_v<XRPAmount, T>)
{
return XRPAmount(static_cast<std::int64_t>(STAmount::kMaxNativeN));
return XRPAmount(static_cast<std::int64_t>(STAmount::kMAX_NATIVE_N));
}
else if constexpr (std::is_same_v<MPTAmount, T>)
{
return MPTAmount(kMaxMpTokenAmount);
return MPTAmount(kMAX_MP_TOKEN_AMOUNT);
}
else if constexpr (std::is_same_v<STAmount, T>)
{
return asset.visit(
[](Issue const& issue) {
if (isXRP(issue))
return STAmount(issue, static_cast<std::int64_t>(STAmount::kMaxNativeN));
return STAmount(issue, STAmount::kMaxValue, STAmount::kMaxOffset);
return STAmount(issue, static_cast<std::int64_t>(STAmount::kMAX_NATIVE_N));
return STAmount(issue, STAmount::kMAX_VALUE, STAmount::kMAX_OFFSET);
},
[](MPTIssue const& issue) { return STAmount(issue, kMaxMpTokenAmount); });
[](MPTIssue const& issue) { return STAmount(issue, kMAX_MP_TOKEN_AMOUNT); });
}
else
{
static constexpr bool kAlwaysFalse = !std::is_same_v<T, T>;
static_assert(kAlwaysFalse, "Unsupported type for toMaxAmount");
constexpr bool kALWAYS_FALSE = !std::is_same_v<T, T>;
static_assert(kALWAYS_FALSE, "Unsupported type for toMaxAmount");
}
}
@@ -233,8 +233,8 @@ getAsset(T const& amt)
}
else
{
static constexpr bool kAlwaysFalse = !std::is_same_v<T, T>;
static_assert(kAlwaysFalse, "Unsupported type for getIssue");
constexpr bool kALWAYS_FALSE = !std::is_same_v<T, T>;
static_assert(kALWAYS_FALSE, "Unsupported type for getIssue");
}
}
@@ -260,8 +260,8 @@ get(STAmount const& a)
}
else
{
constexpr bool kAlwaysFalse = !std::is_same_v<T, T>;
static_assert(kAlwaysFalse, "Unsupported type for get");
constexpr bool kALWAYS_FALSE = !std::is_same_v<T, T>;
static_assert(kALWAYS_FALSE, "Unsupported type for get");
}
}

View File

@@ -35,49 +35,49 @@ namespace xrpl {
namespace RPC {
template <unsigned int Version>
static constexpr std::integral_constant<unsigned, Version> kApiVersion = {};
constexpr static std::integral_constant<unsigned, Version> kAPI_VERSION = {};
static constexpr auto kApiInvalidVersion = kApiVersion<0>;
static constexpr auto kApiMinimumSupportedVersion = kApiVersion<1>;
static constexpr auto kApiMaximumSupportedVersion = kApiVersion<2>;
static constexpr auto kApiVersionIfUnspecified = kApiVersion<1>;
static constexpr auto kApiCommandLineVersion = kApiVersion<1>; // TODO Bump to 2 later
static constexpr auto kApiBetaVersion = kApiVersion<3>;
static constexpr auto kApiMaximumValidVersion = kApiBetaVersion;
constexpr static auto kAPI_INVALID_VERSION = kAPI_VERSION<0>;
constexpr static auto kAPI_MINIMUM_SUPPORTED_VERSION = kAPI_VERSION<1>;
constexpr static auto kAPI_MAXIMUM_SUPPORTED_VERSION = kAPI_VERSION<2>;
constexpr static auto kAPI_VERSION_IF_UNSPECIFIED = kAPI_VERSION<1>;
constexpr static auto kAPI_COMMAND_LINE_VERSION = kAPI_VERSION<1>; // TODO Bump to 2 later
constexpr static auto kAPI_BETA_VERSION = kAPI_VERSION<3>;
constexpr static auto kAPI_MAXIMUM_VALID_VERSION = kAPI_BETA_VERSION;
static_assert(kApiInvalidVersion < kApiMinimumSupportedVersion);
static_assert(kAPI_INVALID_VERSION < kAPI_MINIMUM_SUPPORTED_VERSION);
static_assert(
kApiVersionIfUnspecified >= kApiMinimumSupportedVersion &&
kApiVersionIfUnspecified <= kApiMaximumSupportedVersion);
kAPI_VERSION_IF_UNSPECIFIED >= kAPI_MINIMUM_SUPPORTED_VERSION &&
kAPI_VERSION_IF_UNSPECIFIED <= kAPI_MAXIMUM_SUPPORTED_VERSION);
static_assert(
kApiCommandLineVersion >= kApiMinimumSupportedVersion &&
kApiCommandLineVersion <= kApiMaximumSupportedVersion);
static_assert(kApiMaximumSupportedVersion >= kApiMinimumSupportedVersion);
static_assert(kApiBetaVersion >= kApiMaximumSupportedVersion);
static_assert(kApiMaximumValidVersion >= kApiMaximumSupportedVersion);
kAPI_COMMAND_LINE_VERSION >= kAPI_MINIMUM_SUPPORTED_VERSION &&
kAPI_COMMAND_LINE_VERSION <= kAPI_MAXIMUM_SUPPORTED_VERSION);
static_assert(kAPI_MAXIMUM_SUPPORTED_VERSION >= kAPI_MINIMUM_SUPPORTED_VERSION);
static_assert(kAPI_BETA_VERSION >= kAPI_MAXIMUM_SUPPORTED_VERSION);
static_assert(kAPI_MAXIMUM_VALID_VERSION >= kAPI_MAXIMUM_SUPPORTED_VERSION);
inline void
setVersion(json::Value& parent, unsigned int apiVersion, bool betaEnabled)
{
XRPL_ASSERT(apiVersion != kApiInvalidVersion, "xrpl::RPC::setVersion : input is valid");
XRPL_ASSERT(apiVersion != kAPI_INVALID_VERSION, "xrpl::RPC::setVersion : input is valid");
auto& retObj = parent[jss::version] = json::ValueType::Object;
if (apiVersion == kApiVersionIfUnspecified)
if (apiVersion == kAPI_VERSION_IF_UNSPECIFIED)
{
// API version numbers used in API version 1
static beast::SemanticVersion const kFirstVersion{"1.0.0"};
static beast::SemanticVersion const kGoodVersion{"1.0.0"};
static beast::SemanticVersion const kLastVersion{"1.0.0"};
static beast::SemanticVersion const kFIRST_VERSION{"1.0.0"};
static beast::SemanticVersion const kGOOD_VERSION{"1.0.0"};
static beast::SemanticVersion const kLAST_VERSION{"1.0.0"};
retObj[jss::first] = kFirstVersion.print();
retObj[jss::good] = kGoodVersion.print();
retObj[jss::last] = kLastVersion.print();
retObj[jss::first] = kFIRST_VERSION.print();
retObj[jss::good] = kGOOD_VERSION.print();
retObj[jss::last] = kLAST_VERSION.print();
}
else
{
retObj[jss::first] = kApiMinimumSupportedVersion.value;
retObj[jss::last] = betaEnabled ? kApiBetaVersion : kApiMaximumSupportedVersion;
retObj[jss::first] = kAPI_MINIMUM_SUPPORTED_VERSION.value;
retObj[jss::last] = betaEnabled ? kAPI_BETA_VERSION : kAPI_MAXIMUM_SUPPORTED_VERSION;
}
}
@@ -98,9 +98,9 @@ setVersion(json::Value& parent, unsigned int apiVersion, bool betaEnabled)
inline unsigned int
getAPIVersionNumber(json::Value const& jv, bool betaEnabled)
{
static json::Value const kMinVersion(RPC::kApiMinimumSupportedVersion);
static json::Value const kMIN_VERSION(RPC::kAPI_MINIMUM_SUPPORTED_VERSION);
json::Value const maxVersion(
betaEnabled ? RPC::kApiBetaVersion : RPC::kApiMaximumSupportedVersion);
betaEnabled ? RPC::kAPI_BETA_VERSION : RPC::kAPI_MAXIMUM_SUPPORTED_VERSION);
if (jv.isObject())
{
@@ -109,18 +109,18 @@ getAPIVersionNumber(json::Value const& jv, bool betaEnabled)
auto const specifiedVersion = jv[jss::api_version];
if (!specifiedVersion.isInt() && !specifiedVersion.isUInt())
{
return RPC::kApiInvalidVersion;
return RPC::kAPI_INVALID_VERSION;
}
auto const specifiedVersionInt = specifiedVersion.asInt();
if (specifiedVersionInt < kMinVersion || specifiedVersionInt > maxVersion)
if (specifiedVersionInt < kMIN_VERSION || specifiedVersionInt > maxVersion)
{
return RPC::kApiInvalidVersion;
return RPC::kAPI_INVALID_VERSION;
}
return specifiedVersionInt;
}
}
return RPC::kApiVersionIfUnspecified;
return RPC::kAPI_VERSION_IF_UNSPECIFIED;
}
} // namespace RPC
@@ -128,33 +128,33 @@ getAPIVersionNumber(json::Value const& jv, bool betaEnabled)
template <unsigned MinVer, unsigned MaxVer, typename Fn, typename... Args>
void
forApiVersions(Fn const& fn, Args&&... args)
requires //
(MaxVer >= MinVer) && //
(MinVer >= RPC::kApiMinimumSupportedVersion) && //
(RPC::kApiMaximumValidVersion >= MaxVer) && requires {
requires //
(MaxVer >= MinVer) && //
(MinVer >= RPC::kAPI_MINIMUM_SUPPORTED_VERSION) && //
(RPC::kAPI_MAXIMUM_VALID_VERSION >= MaxVer) && requires {
fn(std::integral_constant<unsigned int, MinVer>{}, std::forward<Args>(args)...);
fn(std::integral_constant<unsigned int, MaxVer>{}, std::forward<Args>(args)...);
}
{
static constexpr auto kSize = MaxVer + 1 - MinVer;
constexpr auto kSIZE = MaxVer + 1 - MinVer;
[&]<std::size_t... Offset>(std::index_sequence<Offset...>) {
// NOLINTBEGIN(bugprone-use-after-move)
(((void)fn(
std::integral_constant<unsigned int, MinVer + Offset>{}, std::forward<Args>(args)...)),
...);
// NOLINTEND(bugprone-use-after-move)
}(std::make_index_sequence<kSize>{});
}(std::make_index_sequence<kSIZE>{});
}
template <typename Fn, typename... Args>
void
forAllApiVersions(Fn const& fn, Args&&... args)
requires requires {
forApiVersions<RPC::kApiMinimumSupportedVersion, RPC::kApiMaximumValidVersion>(
forApiVersions<RPC::kAPI_MINIMUM_SUPPORTED_VERSION, RPC::kAPI_MAXIMUM_VALID_VERSION>(
fn, std::forward<Args>(args)...);
}
{
forApiVersions<RPC::kApiMinimumSupportedVersion, RPC::kApiMaximumValidVersion>(
forApiVersions<RPC::kAPI_MINIMUM_SUPPORTED_VERSION, RPC::kAPI_MAXIMUM_VALID_VERSION>(
fn, std::forward<Args>(args)...);
}

View File

@@ -148,10 +148,10 @@ public:
};
template <ValidIssueType TIss>
constexpr bool kIsIssueV = std::is_same_v<TIss, Issue>;
constexpr bool kIS_ISSUE_V = std::is_same_v<TIss, Issue>;
template <ValidIssueType TIss>
constexpr bool kIsMptissueV = std::is_same_v<TIss, MPTIssue>;
constexpr bool kIS_MPTISSUE_V = std::is_same_v<TIss, MPTIssue>;
inline json::Value
toJson(Asset const& asset)
@@ -242,7 +242,7 @@ operator<=>(Asset const& lhs, Asset const& rhs)
{
return std::weak_ordering(lhs <=> rhs);
}
else if constexpr (kIsIssueV<TLhs> && kIsMptissueV<TRhs>)
else if constexpr (kIS_ISSUE_V<TLhs> && kIS_MPTISSUE_V<TRhs>)
{
return std::weak_ordering::greater;
}

View File

@@ -65,11 +65,11 @@
namespace xrpl {
// Feature names must not exceed this length (in characters, excluding the null terminator).
static constexpr std::size_t kMaxFeatureNameSize = 63;
static constexpr std::size_t kMAX_FEATURE_NAME_SIZE = 63;
// Reserve this exact feature-name length (in characters/bytes, excluding the null terminator)
// so that a 32-byte uint256 (for example, in WASM or other interop contexts) can be used
// as a compact, fixed-size feature selector without conflicting with human-readable names.
static constexpr std::size_t kReservedFeatureNameSize = 32;
static constexpr std::size_t kRESERVED_FEATURE_NAME_SIZE = 32;
// Both validFeatureNameSize and validFeatureName are consteval functions that can be used in
// static_asserts to validate feature names at compile time. They are only used inside
@@ -81,14 +81,14 @@ validFeatureNameSize(auto fn) -> bool
{
constexpr char const* kN = fn();
// Note, std::strlen is not constexpr, we need to implement our own here.
constexpr std::size_t kLen = [](auto n) {
constexpr std::size_t kLEN = [](auto n) {
std::size_t ret = 0;
for (auto ptr = n; *ptr != '\0'; ret++, ++ptr)
;
return ret;
}(kN);
return kLen != kReservedFeatureNameSize && //
kLen <= kMaxFeatureNameSize;
return kLEN != kRESERVED_FEATURE_NAME_SIZE && //
kLEN <= kMAX_FEATURE_NAME_SIZE;
}
consteval auto
@@ -136,7 +136,7 @@ namespace detail {
// Feature.cpp. Because it's only used to reserve storage, and determine how
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
// the actual number of amendments. A LogicError on startup will verify this.
static constexpr std::size_t kNumFeatures =
static constexpr std::size_t kNUM_FEATURES =
(0 +
#include <xrpl/protocol/detail/features.macro>
);
@@ -184,9 +184,9 @@ bitsetIndexToFeature(size_t i);
std::string
featureToName(uint256 const& f);
class FeatureBitset : private std::bitset<detail::kNumFeatures>
class FeatureBitset : private std::bitset<detail::kNUM_FEATURES>
{
using base = std::bitset<detail::kNumFeatures>;
using base = std::bitset<detail::kNUM_FEATURES>;
template <class... Fs>
void

View File

@@ -6,10 +6,7 @@ namespace xrpl {
// Deprecated constant for backwards compatibility with pre-XRPFees amendment.
// This was the reference fee units used in the old fee calculation.
inline constexpr std::uint32_t kFeeUnitsDeprecated = 10;
// Number of micro-drops in one drop.
constexpr std::uint32_t microDropsPerDrop{1'000'000};
inline constexpr std::uint32_t kFEE_UNITS_DEPRECATED = 10;
/** Reflects the fee settings for a particular ledger.
@@ -27,15 +24,6 @@ struct Fees
/** @brief Additional XRP reserve required per owned ledger object. */
XRPAmount increment{0};
/** @brief Compute limit for Feature Extensions (instructions). */
std::uint32_t extensionComputeLimit{0};
/** @brief Size limit for Feature Extensions (bytes). */
std::uint32_t extensionSizeLimit{0};
/** @brief Price of WASM gas (micro-drops). */
std::uint32_t gasPrice{0};
explicit Fees() = default;
Fees(Fees const&) = default;
Fees&

View File

@@ -92,7 +92,7 @@ public:
inline IOUAmount::IOUAmount(beast::Zero)
{
*this = beast::kZero;
*this = beast::kZERO;
}
inline IOUAmount::IOUAmount(mantissa_type mantissa, exponent_type exponent)

View File

@@ -82,7 +82,7 @@ struct BookT
Keylet
operator()(Book const& b) const;
};
static BookT const kBook{};
static BookT const kBOOK{};
/** The index of a trust line for a given currency
@@ -126,7 +126,7 @@ struct NextT
Keylet
operator()(Keylet const& k) const;
};
static NextT const kNext{};
static NextT const kNEXT{};
/** A ticket belonging to an account */
struct TicketT
@@ -145,7 +145,7 @@ struct TicketT
return {ltTICKET, key};
}
};
static TicketT const kTicket{};
static TicketT const kTICKET{};
/** A SignerList */
Keylet
@@ -207,12 +207,6 @@ page(Keylet const& root, std::uint64_t index = 0) noexcept
Keylet
escrow(AccountID const& src, std::uint32_t seq) noexcept;
inline Keylet
escrow(uint256 const& key) noexcept
{
return {ltESCROW, key};
}
/** A PaymentChannel */
Keylet
payChan(AccountID const& src, AccountID const& dst, std::uint32_t seq) noexcept;
@@ -379,7 +373,7 @@ struct KeyletDesc
// This list should include all of the keylet functions that take a single
// AccountID parameter.
std::array<KeyletDesc<AccountID const&>, 6> const kDirectAccountKeylets{
std::array<KeyletDesc<AccountID const&>, 6> const kDIRECT_ACCOUNT_KEYLETS{
{{.function = &keylet::account, .expectedLEName = jss::AccountRoot, .includeInTests = false},
{.function = &keylet::ownerDir, .expectedLEName = jss::DirectoryNode, .includeInTests = true},
{.function = &keylet::signers, .expectedLEName = jss::SignerList, .includeInTests = true},

View File

@@ -96,16 +96,16 @@ operator<=>(Issue const& lhs, Issue const& rhs)
inline Issue const&
xrpIssue()
{
static Issue const kIssue{xrpCurrency(), xrpAccount()};
return kIssue;
static Issue const kISSUE{xrpCurrency(), xrpAccount()};
return kISSUE;
}
/** Returns an asset specifier that represents no account and currency. */
inline Issue const&
noIssue()
{
static Issue const kIssue{noCurrency(), noAccount()};
return kIssue;
static Issue const kISSUE{noCurrency(), noAccount()};
return kISSUE;
}
inline bool

View File

@@ -26,12 +26,12 @@ struct LedgerHeader
//
// Closed means "tx set already determined"
uint256 hash = beast::kZero;
uint256 txHash = beast::kZero;
uint256 accountHash = beast::kZero;
uint256 parentHash = beast::kZero;
uint256 hash = beast::kZERO;
uint256 txHash = beast::kZERO;
uint256 accountHash = beast::kZERO;
uint256 parentHash = beast::kZERO;
XRPAmount drops = beast::kZero;
XRPAmount drops = beast::kZERO;
// If validated is false, it means "not yet validated."
// Once validated is true, it will never be set false at a later time.
@@ -53,12 +53,12 @@ struct LedgerHeader
};
// ledger close flags
static std::uint32_t const kSLcfNoConsensusTime = 0x01;
static std::uint32_t const kS_LCF_NO_CONSENSUS_TIME = 0x01;
inline bool
getCloseAgree(LedgerHeader const& info)
{
return (info.closeFlags & kSLcfNoConsensusTime) == 0;
return (info.closeFlags & kS_LCF_NO_CONSENSUS_TIME) == 0;
}
void

View File

@@ -88,7 +88,7 @@ constexpr MPTAmount::MPTAmount(value_type value) : value_(value)
constexpr MPTAmount::MPTAmount(beast::Zero)
{
*this = beast::kZero;
*this = beast::kZERO;
}
constexpr MPTAmount&

View File

@@ -15,14 +15,14 @@ namespace xrpl {
namespace detail {
template <typename T>
constexpr bool kIsIntegralConstant = false;
constexpr bool kIS_INTEGRAL_CONSTANT = false;
template <typename I, auto A>
constexpr bool kIsIntegralConstant<std::integral_constant<I, A>&> = true;
constexpr bool kIS_INTEGRAL_CONSTANT<std::integral_constant<I, A>&> = true;
template <typename I, auto A>
constexpr bool kIsIntegralConstant<std::integral_constant<I, A> const&> = true;
constexpr bool kIS_INTEGRAL_CONSTANT<std::integral_constant<I, A> const&> = true;
template <typename T>
concept some_integral_constant = detail::kIsIntegralConstant<T&>;
concept some_integral_constant = detail::kIS_INTEGRAL_CONSTANT<T&>;
// This class is designed to wrap a collection of _almost_ identical json::Value
// objects, indexed by version (i.e. there is some mapping of version to object
@@ -47,8 +47,8 @@ struct MultiApiJson
return (v < MinVer) ? 0 : static_cast<std::size_t>(v - MinVer);
}
static constexpr std::size_t kSize = MaxVer + 1 - MinVer;
std::array<json::Value, kSize> val = {};
constexpr static std::size_t kSIZE = MaxVer + 1 - MinVer;
std::array<json::Value, kSIZE> val = {};
explicit MultiApiJson(json::Value const& init = {})
{
@@ -80,7 +80,7 @@ struct MultiApiJson
if (count == 0)
return IsMemberResult::None;
return count < kSize ? IsMemberResult::Some : IsMemberResult::All;
return count < kSIZE ? IsMemberResult::Some : IsMemberResult::All;
}
static constexpr struct VisitorT final
@@ -100,7 +100,7 @@ struct MultiApiJson
std::integral_constant<unsigned int, Version>,
Args&&...>
{
static_assert(valid(Version) && index(Version) >= 0 && index(Version) < kSize);
static_assert(valid(Version) && index(Version) >= 0 && index(Version) < kSIZE);
return std::invoke(fn, json.val[index(Version)], version, std::forward<Args>(args)...);
}
@@ -111,7 +111,7 @@ struct MultiApiJson
operator()(Json& json, std::integral_constant<unsigned int, Version> const, Fn fn) const
-> std::invoke_result_t<Fn, decltype(json.val[0])>
{
static_assert(valid(Version) && index(Version) >= 0 && index(Version) < kSize);
static_assert(valid(Version) && index(Version) >= 0 && index(Version) < kSIZE);
return std::invoke(fn, json.val[index(Version)]);
}
@@ -124,7 +124,7 @@ struct MultiApiJson
-> std::invoke_result_t<Fn, decltype(json.val[0]), Version, Args&&...>
{
XRPL_ASSERT(
valid(version) && index(version) >= 0 && index(version) < kSize,
valid(version) && index(version) >= 0 && index(version) < kSIZE,
"xrpl::detail::MultiApijson::operator<Args...>() : valid "
"version");
return std::invoke(fn, json.val[index(version)], version, std::forward<Args>(args)...);
@@ -139,20 +139,20 @@ struct MultiApiJson
-> std::invoke_result_t<Fn, decltype(json.val[0])>
{
XRPL_ASSERT(
valid(version) && index(version) >= 0 && index(version) < kSize,
valid(version) && index(version) >= 0 && index(version) < kSIZE,
"xrpl::detail::MultiApijson::operator() : valid version");
return std::invoke(fn, json.val[index(version)]);
}
} kVisitor = {};
} kVISITOR = {};
auto
visit()
{
return [self = this](auto... args)
requires requires {
kVisitor(std::declval<MultiApiJson&>(), std::declval<decltype(args)>()...);
kVISITOR(std::declval<MultiApiJson&>(), std::declval<decltype(args)>()...);
}
{ return kVisitor(*self, std::forward<decltype(args)>(args)...); };
{ return kVISITOR(*self, std::forward<decltype(args)>(args)...); };
}
[[nodiscard]] auto
@@ -160,27 +160,27 @@ struct MultiApiJson
{
return [self = this](auto... args)
requires requires {
kVisitor(std::declval<MultiApiJson const&>(), std::declval<decltype(args)>()...);
kVISITOR(std::declval<MultiApiJson const&>(), std::declval<decltype(args)>()...);
}
{ return kVisitor(*self, std::forward<decltype(args)>(args)...); };
{ return kVISITOR(*self, std::forward<decltype(args)>(args)...); };
}
template <typename... Args>
auto
visit(Args... args) -> std::invoke_result_t<VisitorT, MultiApiJson&, Args...>
requires(sizeof...(args) > 0) &&
requires { kVisitor(*this, std::forward<decltype(args)>(args)...); }
requires { kVISITOR(*this, std::forward<decltype(args)>(args)...); }
{
return kVisitor(*this, std::forward<decltype(args)>(args)...);
return kVISITOR(*this, std::forward<decltype(args)>(args)...);
}
template <typename... Args>
[[nodiscard]] auto
visit(Args... args) const -> std::invoke_result_t<VisitorT, MultiApiJson const&, Args...>
requires(sizeof...(args) > 0) &&
requires { kVisitor(*this, std::forward<decltype(args)>(args)...); }
requires { kVISITOR(*this, std::forward<decltype(args)>(args)...); }
{
return kVisitor(*this, std::forward<decltype(args)>(args)...);
return kVISITOR(*this, std::forward<decltype(args)>(args)...);
}
};
@@ -188,6 +188,6 @@ struct MultiApiJson
// Wrapper for Json for all supported API versions.
using MultiApiJson =
detail::MultiApiJson<RPC::kApiMinimumSupportedVersion, RPC::kApiMaximumValidVersion>;
detail::MultiApiJson<RPC::kAPI_MINIMUM_SUPPORTED_VERSION, RPC::kAPI_MAXIMUM_VALID_VERSION>;
} // namespace xrpl

View File

@@ -52,10 +52,10 @@ public:
};
template <ValidPathAsset PA>
constexpr bool kIsCurrencyV = std::is_same_v<PA, Currency>;
constexpr bool kIS_CURRENCY_V = std::is_same_v<PA, Currency>;
template <ValidPathAsset PA>
constexpr bool kIsMptidV = std::is_same_v<PA, MPTID>;
constexpr bool kIS_MPTID_V = std::is_same_v<PA, MPTID>;
inline PathAsset::PathAsset(Asset const& asset)
{

View File

@@ -19,40 +19,40 @@ namespace xrpl {
@ingroup protocol
*/
/** Smallest legal byte size of a transaction. */
constexpr std::size_t kTxMinSizeBytes = 32;
std::size_t constexpr kTX_MIN_SIZE_BYTES = 32;
/** Largest legal byte size of a transaction. */
constexpr std::size_t kTxMaxSizeBytes = megabytes(1);
std::size_t constexpr kTX_MAX_SIZE_BYTES = megabytes(1);
/** The maximum number of unfunded offers to delete at once */
constexpr std::size_t kUnfundedOfferRemoveLimit = 1000;
std::size_t constexpr kUNFUNDED_OFFER_REMOVE_LIMIT = 1000;
/** The maximum number of expired offers to delete at once */
constexpr std::size_t kExpiredOfferRemoveLimit = 256;
std::size_t constexpr kEXPIRED_OFFER_REMOVE_LIMIT = 256;
/** The maximum number of metadata entries allowed in one transaction */
constexpr std::size_t kOversizeMetaDataCap = 5200;
std::size_t constexpr kOVERSIZE_META_DATA_CAP = 5200;
/** The maximum number of entries per directory page */
constexpr std::size_t kDirNodeMaxEntries = 32;
std::size_t constexpr kDIR_NODE_MAX_ENTRIES = 32;
/** The maximum number of pages allowed in a directory
Made obsolete by fixDirectoryLimit amendment.
*/
constexpr std::uint64_t kDirNodeMaxPages = 262144;
std::uint64_t constexpr kDIR_NODE_MAX_PAGES = 262144;
/** The maximum number of items in an NFT page */
constexpr std::size_t kDirMaxTokensPerPage = 32;
std::size_t constexpr kDIR_MAX_TOKENS_PER_PAGE = 32;
/** The maximum number of owner directory entries for account to be deletable */
constexpr std::size_t kMaxDeletableDirEntries = 1000;
std::size_t constexpr kMAX_DELETABLE_DIR_ENTRIES = 1000;
/** The maximum number of token offers that can be canceled at once */
constexpr std::size_t kMaxTokenOfferCancelCount = 500;
std::size_t constexpr kMAX_TOKEN_OFFER_CANCEL_COUNT = 500;
/** The maximum number of offers in an offer directory for NFT to be burnable */
constexpr std::size_t kMaxDeletableTokenOfferEntries = 500;
std::size_t constexpr kMAX_DELETABLE_TOKEN_OFFER_ENTRIES = 500;
/** The maximum token transfer fee allowed.
@@ -63,7 +63,7 @@ constexpr std::size_t kMaxDeletableTokenOfferEntries = 500;
Note that for extremely low transfer fees values, it is possible that the
calculated fee will be 0.
*/
constexpr std::uint16_t kMaxTransferFee = 50000;
std::uint16_t constexpr kMAX_TRANSFER_FEE = 50000;
/** There are 10,000 basis points (bips) in 100%.
*
@@ -81,32 +81,32 @@ constexpr std::uint16_t kMaxTransferFee = 50000;
*
* Example: 50% is 0.50 * bipsPerUnity = 5,000 bps.
*/
constexpr Bips32 kBipsPerUnity(100 * 100);
static_assert(kBipsPerUnity == Bips32{10'000});
constexpr TenthBips32 kTenthBipsPerUnity(kBipsPerUnity.value() * 10);
static_assert(kTenthBipsPerUnity == TenthBips32(100'000));
Bips32 constexpr kBIPS_PER_UNITY(100 * 100);
static_assert(kBIPS_PER_UNITY == Bips32{10'000});
TenthBips32 constexpr kTENTH_BIPS_PER_UNITY(kBIPS_PER_UNITY.value() * 10);
static_assert(kTENTH_BIPS_PER_UNITY == TenthBips32(100'000));
constexpr Bips32
percentageToBips(std::uint32_t percentage)
{
return Bips32(percentage * kBipsPerUnity.value() / 100);
return Bips32(percentage * kBIPS_PER_UNITY.value() / 100);
}
constexpr TenthBips32
percentageToTenthBips(std::uint32_t percentage)
{
return TenthBips32(percentage * kTenthBipsPerUnity.value() / 100);
return TenthBips32(percentage * kTENTH_BIPS_PER_UNITY.value() / 100);
}
template <typename T, class TBips>
constexpr T
bipsOfValue(T value, Bips<TBips> bips)
{
return value * bips.value() / kBipsPerUnity.value();
return value * bips.value() / kBIPS_PER_UNITY.value();
}
template <typename T, class TBips>
constexpr T
tenthBipsOfValue(T value, TenthBips<TBips> bips)
{
return value * bips.value() / kTenthBipsPerUnity.value();
return value * bips.value() / kTENTH_BIPS_PER_UNITY.value();
}
namespace Lending {
@@ -114,54 +114,54 @@ namespace Lending {
Valid values are between 0 and 10% inclusive.
*/
constexpr TenthBips16 kMaxManagementFeeRate(
TenthBips16 constexpr kMAX_MANAGEMENT_FEE_RATE(
unsafeCast<std::uint16_t>(percentageToTenthBips(10).value()));
static_assert(kMaxManagementFeeRate == TenthBips16(std::uint16_t(10'000u)));
static_assert(kMAX_MANAGEMENT_FEE_RATE == TenthBips16(std::uint16_t(10'000u)));
/** The maximum coverage rate required of a loan broker in 1/10 bips.
Valid values are between 0 and 100% inclusive.
*/
constexpr TenthBips32 kMaxCoverRate = percentageToTenthBips(100);
static_assert(kMaxCoverRate == TenthBips32(100'000u));
TenthBips32 constexpr kMAX_COVER_RATE = percentageToTenthBips(100);
static_assert(kMAX_COVER_RATE == TenthBips32(100'000u));
/** The maximum overpayment fee on a loan in 1/10 bips.
*
Valid values are between 0 and 100% inclusive.
*/
constexpr TenthBips32 kMaxOverpaymentFee = percentageToTenthBips(100);
static_assert(kMaxOverpaymentFee == TenthBips32(100'000u));
TenthBips32 constexpr kMAX_OVERPAYMENT_FEE = percentageToTenthBips(100);
static_assert(kMAX_OVERPAYMENT_FEE == TenthBips32(100'000u));
/** Annualized interest rate of the Loan in 1/10 bips.
*
* Valid values are between 0 and 100% inclusive.
*/
constexpr TenthBips32 kMaxInterestRate = percentageToTenthBips(100);
static_assert(kMaxInterestRate == TenthBips32(100'000u));
TenthBips32 constexpr kMAX_INTEREST_RATE = percentageToTenthBips(100);
static_assert(kMAX_INTEREST_RATE == TenthBips32(100'000u));
/** The maximum premium added to the interest rate for late payments on a loan
* in 1/10 bips.
*
* Valid values are between 0 and 100% inclusive.
*/
constexpr TenthBips32 kMaxLateInterestRate = percentageToTenthBips(100);
static_assert(kMaxLateInterestRate == TenthBips32(100'000u));
TenthBips32 constexpr kMAX_LATE_INTEREST_RATE = percentageToTenthBips(100);
static_assert(kMAX_LATE_INTEREST_RATE == TenthBips32(100'000u));
/** The maximum close interest rate charged for repaying a loan early in 1/10
* bips.
*
* Valid values are between 0 and 100% inclusive.
*/
constexpr TenthBips32 kMaxCloseInterestRate = percentageToTenthBips(100);
static_assert(kMaxCloseInterestRate == TenthBips32(100'000u));
TenthBips32 constexpr kMAX_CLOSE_INTEREST_RATE = percentageToTenthBips(100);
static_assert(kMAX_CLOSE_INTEREST_RATE == TenthBips32(100'000u));
/** The maximum overpayment interest rate charged on loan overpayments in 1/10
* bips.
*
* Valid values are between 0 and 100% inclusive.
*/
constexpr TenthBips32 kMaxOverpaymentInterestRate = percentageToTenthBips(100);
static_assert(kMaxOverpaymentInterestRate == TenthBips32(100'000u));
TenthBips32 constexpr kMAX_OVERPAYMENT_INTEREST_RATE = percentageToTenthBips(100);
static_assert(kMAX_OVERPAYMENT_INTEREST_RATE == TenthBips32(100'000u));
/** LoanPay transaction cost will be one base fee per X combined payments
*
@@ -172,7 +172,7 @@ static_assert(kMaxOverpaymentInterestRate == TenthBips32(100'000u));
* This number was chosen arbitrarily, but should not be changed once released
* without an amendment
*/
static constexpr int kLoanPaymentsPerFeeIncrement = 5;
static constexpr int kLOAN_PAYMENTS_PER_FEE_INCREMENT = 5;
/** Maximum number of combined payments that a LoanPay transaction will process
*
@@ -196,71 +196,65 @@ static constexpr int kLoanPaymentsPerFeeIncrement = 5;
* This number was chosen arbitrarily, but should not be changed once released
* without an amendment
*/
static constexpr int kLoanMaximumPaymentsPerTransaction = 100;
static constexpr int kLOAN_MAXIMUM_PAYMENTS_PER_TRANSACTION = 100;
} // namespace Lending
/** The maximum length of a URI inside an NFT */
constexpr std::size_t kMaxTokenUriLength = 256;
std::size_t constexpr kMAX_TOKEN_URI_LENGTH = 256;
/** The maximum length of a Data element inside a DID */
constexpr std::size_t kMaxDidDocumentLength = 256;
std::size_t constexpr kMAX_DID_DOCUMENT_LENGTH = 256;
/** The maximum length of a URI inside a DID */
constexpr std::size_t kMaxDidUriLength = 256;
std::size_t constexpr kMAX_DIDURI_LENGTH = 256;
/** The maximum length of an Attestation inside a DID */
constexpr std::size_t kMaxDidDataLength = 256;
std::size_t constexpr kMAX_DID_DATA_LENGTH = 256;
/** The maximum length of a domain */
constexpr std::size_t kMaxDomainLength = 256;
std::size_t constexpr kMAX_DOMAIN_LENGTH = 256;
/** The maximum length of a URI inside a Credential */
constexpr std::size_t kMaxCredentialUriLength = 256;
std::size_t constexpr kMAX_CREDENTIAL_URI_LENGTH = 256;
/** The maximum length of a CredentialType inside a Credential */
constexpr std::size_t kMaxCredentialTypeLength = 64;
std::size_t constexpr kMAX_CREDENTIAL_TYPE_LENGTH = 64;
/** The maximum number of credentials can be passed in array */
constexpr std::size_t kMaxCredentialsArraySize = 8;
std::size_t constexpr kMAX_CREDENTIALS_ARRAY_SIZE = 8;
/** The maximum number of credentials can be passed in array for permissioned
* domain */
constexpr std::size_t kMaxPermissionedDomainCredentialsArraySize = 10;
std::size_t constexpr kMAX_PERMISSIONED_DOMAIN_CREDENTIALS_ARRAY_SIZE = 10;
/** The maximum length of MPTokenMetadata */
constexpr std::size_t kMaxMpTokenMetadataLength = 1024;
std::size_t constexpr kMAX_MP_TOKEN_METADATA_LENGTH = 1024;
/** The maximum amount of MPTokenIssuance */
constexpr std::uint64_t kMaxMpTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull;
static_assert(Number::kMaxRep >= kMaxMpTokenAmount);
std::uint64_t constexpr kMAX_MP_TOKEN_AMOUNT = 0x7FFF'FFFF'FFFF'FFFFull;
static_assert(Number::kMAX_REP >= kMAX_MP_TOKEN_AMOUNT);
/** The maximum length of Data payload */
constexpr std::size_t kMaxDataPayloadLength = 256;
std::size_t constexpr kMAX_DATA_PAYLOAD_LENGTH = 256;
/** Vault withdrawal policies */
constexpr std::uint8_t kVaultStrategyFirstComeFirstServe = 1;
std::uint8_t constexpr kVAULT_STRATEGY_FIRST_COME_FIRST_SERVE = 1;
/** Default IOU scale factor for a Vault */
constexpr std::uint8_t kVaultDefaultIouScale = 6;
std::uint8_t constexpr kVAULT_DEFAULT_IOU_SCALE = 6;
/** Maximum scale factor for a Vault. The number is chosen to ensure that
1 IOU can be always converted to shares.
10^19 > maxMPTokenAmount (2^64-1) > 10^18 */
constexpr std::uint8_t kVaultMaximumIouScale = 18;
std::uint8_t constexpr kVAULT_MAXIMUM_IOU_SCALE = 18;
/** Maximum recursion depth for vault shares being put as an asset inside
* another vault; counted from 0 */
constexpr std::uint8_t kMaxAssetCheckDepth = 5;
/** Maximum length of a Data field in Escrow object that can be updated by WASM code. */
std::size_t constexpr maxWasmDataLength = 4 * 1024; // 4KB
/** Maximum length of parameters passed from WASM code to host functions. */
std::size_t constexpr maxWasmParamLength = 1024; // 1KB
std::uint8_t constexpr kMAX_ASSET_CHECK_DEPTH = 5;
/** A ledger index. */
using LedgerIndex = std::uint32_t;
constexpr std::uint32_t kFlagLedgerInterval = 256;
std::uint32_t constexpr kFLAG_LEDGER_INTERVAL = 256;
/** Returns true if the given ledgerIndex is a voting ledgerIndex */
bool
@@ -279,38 +273,38 @@ using TxID = uint256;
/** The maximum number of trustlines to delete as part of AMM account
* deletion cleanup.
*/
constexpr std::uint16_t kMaxDeletableAmmTrustLines = 512;
std::uint16_t constexpr kMAX_DELETABLE_AMM_TRUST_LINES = 512;
/** The maximum length of a URI inside an Oracle */
constexpr std::size_t kMaxOracleUri = 256;
std::size_t constexpr kMAX_ORACLE_URI = 256;
/** The maximum length of a Provider inside an Oracle */
constexpr std::size_t kMaxOracleProvider = 256;
std::size_t constexpr kMAX_ORACLE_PROVIDER = 256;
/** The maximum size of a data series array inside an Oracle */
constexpr std::size_t kMaxOracleDataSeries = 10;
std::size_t constexpr kMAX_ORACLE_DATA_SERIES = 10;
/** The maximum length of a SymbolClass inside an Oracle */
constexpr std::size_t kMaxOracleSymbolClass = 16;
std::size_t constexpr kMAX_ORACLE_SYMBOL_CLASS = 16;
/** The maximum allowed time difference between lastUpdateTime and the time
of the last closed ledger
*/
constexpr std::size_t kMaxLastUpdateTimeDelta = 300;
std::size_t constexpr kMAX_LAST_UPDATE_TIME_DELTA = 300;
/** The maximum price scaling factor
*/
constexpr std::size_t kMaxPriceScale = 20;
std::size_t constexpr kMAX_PRICE_SCALE = 20;
/** The maximum percentage of outliers to trim
*/
constexpr std::size_t kMaxTrim = 25;
std::size_t constexpr kMAX_TRIM = 25;
/** The maximum number of delegate permissions an account can grant
*/
constexpr std::size_t kPermissionMaxSize = 10;
std::size_t constexpr kPERMISSION_MAX_SIZE = 10;
/** The maximum number of transactions that can be in a batch. */
constexpr std::size_t kMaxBatchTxCount = 8;
std::size_t constexpr kMAX_BATCH_TX_COUNT = 8;
} // namespace xrpl

View File

@@ -43,8 +43,8 @@ class PublicKey
protected:
// All the constructed public keys are valid, non-empty and contain 33
// bytes of data.
static constexpr std::size_t kSize = 33;
std::uint8_t buf_[kSize]{}; // should be large enough
static constexpr std::size_t kSIZE = 33;
std::uint8_t buf_[kSIZE]{}; // should be large enough
public:
using const_iterator = std::uint8_t const*;
@@ -72,7 +72,7 @@ public:
static std::size_t
size() noexcept
{
return kSize;
return kSIZE;
}
[[nodiscard]] const_iterator
@@ -90,19 +90,19 @@ public:
[[nodiscard]] const_iterator
end() const noexcept
{
return buf_ + kSize;
return buf_ + kSIZE;
}
[[nodiscard]] const_iterator
cend() const noexcept
{
return buf_ + kSize;
return buf_ + kSIZE;
}
[[nodiscard]] Slice
slice() const noexcept
{
return {buf_, kSize};
return {buf_, kSIZE};
}
operator Slice() const noexcept

View File

@@ -26,7 +26,7 @@ struct TAmounts
{
TAmounts() = default;
TAmounts(beast::Zero, beast::Zero) : in(beast::kZero), out(beast::kZero)
TAmounts(beast::Zero, beast::Zero) : in(beast::kZERO), out(beast::kZERO)
{
}
@@ -38,7 +38,7 @@ struct TAmounts
[[nodiscard]] bool
empty() const noexcept
{
return in <= beast::kZero || out <= beast::kZero;
return in <= beast::kZERO || out <= beast::kZERO;
}
TAmounts&
@@ -94,8 +94,8 @@ public:
// have lower unsigned integer representations.
using value_type = std::uint64_t;
static int const kMinTickSize = 3;
static int const kMaxTickSize = 16;
static int const kMIN_TICK_SIZE = 3;
static int const kMAX_TICK_SIZE = 16;
private:
// This has the same representation as STAmount, see the comment on the
@@ -316,10 +316,10 @@ TAmounts<In, Out>
Quality::ceilIn(TAmounts<In, Out> const& amount, In const& limit) const
{
// Construct a function pointer to the function we want to call.
static constexpr Amounts (Quality::*kCeilInFnPtr)(Amounts const&, STAmount const&) const =
static constexpr Amounts (Quality::*kCEIL_IN_FN_PTR)(Amounts const&, STAmount const&) const =
&Quality::ceilIn;
return ceilTAmountsHelper(amount, limit, amount.in, kCeilInFnPtr);
return ceilTAmountsHelper(amount, limit, amount.in, kCEIL_IN_FN_PTR);
}
template <class In, class Out>
@@ -327,10 +327,10 @@ TAmounts<In, Out>
Quality::ceilInStrict(TAmounts<In, Out> const& amount, In const& limit, bool roundUp) const
{
// Construct a function pointer to the function we want to call.
static constexpr Amounts (Quality::*kCeilInFnPtr)(Amounts const&, STAmount const&, bool) const =
&Quality::ceilInStrict;
static constexpr Amounts (Quality::*kCEIL_IN_FN_PTR)(Amounts const&, STAmount const&, bool)
const = &Quality::ceilInStrict;
return ceilTAmountsHelper(amount, limit, amount.in, kCeilInFnPtr, roundUp);
return ceilTAmountsHelper(amount, limit, amount.in, kCEIL_IN_FN_PTR, roundUp);
}
template <class In, class Out>
@@ -338,10 +338,10 @@ TAmounts<In, Out>
Quality::ceilOut(TAmounts<In, Out> const& amount, Out const& limit) const
{
// Construct a function pointer to the function we want to call.
static constexpr Amounts (Quality::*kCeilOutFnPtr)(Amounts const&, STAmount const&) const =
static constexpr Amounts (Quality::*kCEIL_OUT_FN_PTR)(Amounts const&, STAmount const&) const =
&Quality::ceilOut;
return ceil_TAmounts_helper(amount, limit, amount.out, kCeilOutFnPtr);
return ceil_TAmounts_helper(amount, limit, amount.out, kCEIL_OUT_FN_PTR);
}
template <class In, class Out>
@@ -349,10 +349,10 @@ TAmounts<In, Out>
Quality::ceilOutStrict(TAmounts<In, Out> const& amount, Out const& limit, bool roundUp) const
{
// Construct a function pointer to the function we want to call.
static constexpr Amounts (Quality::*kCeilOutFnPtr)(Amounts const&, STAmount const&, bool)
static constexpr Amounts (Quality::*kCEIL_OUT_FN_PTR)(Amounts const&, STAmount const&, bool)
const = &Quality::ceilOutStrict;
return ceilTAmountsHelper(amount, limit, amount.out, kCeilOutFnPtr, roundUp);
return ceilTAmountsHelper(amount, limit, amount.out, kCEIL_OUT_FN_PTR, roundUp);
}
/** Calculate the quality of a two-hop path given the two hops.

View File

@@ -72,7 +72,7 @@ QualityFunction::QualityFunction(
std::uint32_t tfee,
QualityFunction::AMMTag)
{
if (amounts.in <= beast::kZero || amounts.out <= beast::kZero)
if (amounts.in <= beast::kZERO || amounts.out <= beast::kZERO)
Throw<std::runtime_error>("QualityFunction amounts are 0.");
Number const cfee = feeMult(tfee);
m_ = -cfee / amounts.in;

View File

@@ -72,6 +72,6 @@ transferFeeAsRate(std::uint16_t fee);
} // namespace nft
/** A transfer rate signifying a 1:1 exchange */
extern Rate const kParityRate;
extern Rate const kPARITY_RATE;
} // namespace xrpl

View File

@@ -92,7 +92,7 @@ class STCurrency;
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum SerializedTypeID { XMACRO(TO_ENUM) };
static std::map<std::string, int> const kSTypeMap = {XMACRO(TO_MAP)};
static std::map<std::string, int> const kS_TYPE_MAP = {XMACRO(TO_MAP)};
#undef XMACRO
#undef TO_ENUM
@@ -129,23 +129,23 @@ fieldCode(int id, int index)
class SField
{
public:
static constexpr auto kSmdNever = 0x00;
static constexpr auto kSmdChangeOrig = 0x01; // original value when it changes
static constexpr auto kSmdChangeNew = 0x02; // new value when it changes
static constexpr auto kSmdDeleteFinal = 0x04; // final value when it is deleted
static constexpr auto kSmdCreate = 0x08; // value when it's created
static constexpr auto kSmdAlways = 0x10; // value when node containing it is affected at all
static constexpr auto kSmdBaseTen = 0x20; // value is treated as base 10, overriding behavior
static constexpr auto kSmdPseudoAccount = 0x40; // if this field is set in an ACCOUNT_ROOT
// _only_, then it is a pseudo-account
static constexpr auto kSmdNeedsAsset = 0x80; // This field needs to be associated with an
// asset before it is serialized as a ledger
// object. Intended for STNumber.
static constexpr auto kSmdDefault =
kSmdChangeOrig | kSmdChangeNew | kSmdDeleteFinal | kSmdCreate;
static constexpr auto kSMD_NEVER = 0x00;
static constexpr auto kSMD_CHANGE_ORIG = 0x01; // original value when it changes
static constexpr auto kSMD_CHANGE_NEW = 0x02; // new value when it changes
static constexpr auto kSMD_DELETE_FINAL = 0x04; // final value when it is deleted
static constexpr auto kSMD_CREATE = 0x08; // value when it's created
static constexpr auto kSMD_ALWAYS = 0x10; // value when node containing it is affected at all
static constexpr auto kSMD_BASE_TEN = 0x20; // value is treated as base 10, overriding behavior
static constexpr auto kSMD_PSEUDO_ACCOUNT = 0x40; // if this field is set in an ACCOUNT_ROOT
// _only_, then it is a pseudo-account
static constexpr auto kSMD_NEEDS_ASSET = 0x80; // This field needs to be associated with an
// asset before it is serialized as a ledger
// object. Intended for STNumber.
static constexpr auto kSMD_DEFAULT =
kSMD_CHANGE_ORIG | kSMD_CHANGE_NEW | kSMD_DELETE_FINAL | kSMD_CREATE;
enum class IsSigning : unsigned char { No, Yes };
static IsSigning const kNotSigning = IsSigning::No;
static IsSigning const kNOT_SIGNING = IsSigning::No;
int const fieldCodeMem; // (type<<16)|index // TODO: rename, clashes with function
SerializedTypeID const fieldType; // STI_*
@@ -172,7 +172,7 @@ public:
SerializedTypeID tid,
int fv,
char const* fn,
int meta = kSmdDefault,
int meta = kSMD_DEFAULT,
IsSigning signing = IsSigning::Yes);
explicit SField(PrivateAccessTagT, int fc, char const* fn);
@@ -365,8 +365,8 @@ using SF_XCHAIN_BRIDGE = TypedField<STXChainBridge>;
#define UNTYPED_SFIELD(sfName, stiSuffix, fieldValue, ...) extern SField const sfName;
#define TYPED_SFIELD(sfName, stiSuffix, fieldValue, ...) extern SF_##stiSuffix const sfName;
extern SField const kSfInvalid;
extern SField const kSfGeneric;
extern SField const kSF_INVALID;
extern SField const kSF_GENERIC;
#include <xrpl/protocol/detail/sfields.macro>

View File

@@ -42,24 +42,24 @@ private:
public:
using value_type = STAmount;
static constexpr int kMinOffset = -96;
static constexpr int kMaxOffset = 80;
constexpr static int kMIN_OFFSET = -96;
constexpr static int kMAX_OFFSET = 80;
// Maximum native value supported by the code
static constexpr std::uint64_t kMinValue = 1'000'000'000'000'000ull;
static_assert(isPowerOfTen(kMinValue));
static constexpr std::uint64_t kMaxValue = (kMinValue * 10) - 1;
static_assert(kMaxValue == 9'999'999'999'999'999ull);
static constexpr std::uint64_t kMaxNative = 9'000'000'000'000'000'000ull;
constexpr static std::uint64_t kMIN_VALUE = 1'000'000'000'000'000ull;
static_assert(isPowerOfTen(kMIN_VALUE));
constexpr static std::uint64_t kMAX_VALUE = (kMIN_VALUE * 10) - 1;
static_assert(kMAX_VALUE == 9'999'999'999'999'999ull);
constexpr static std::uint64_t kMAX_NATIVE = 9'000'000'000'000'000'000ull;
// Max native value on network.
static constexpr std::uint64_t kMaxNativeN = 100'000'000'000'000'000ull;
static constexpr std::uint64_t kIssuedCurrency = 0x8'000'000'000'000'000ull;
static constexpr std::uint64_t kPositive = 0x4'000'000'000'000'000ull;
static constexpr std::uint64_t kMpToken = 0x2'000'000'000'000'000ull;
static constexpr std::uint64_t kValueMask = ~(kPositive | kMpToken);
constexpr static std::uint64_t kMAX_NATIVE_N = 100'000'000'000'000'000ull;
constexpr static std::uint64_t kISSUED_CURRENCY = 0x8'000'000'000'000'000ull;
constexpr static std::uint64_t kPOSITIVE = 0x4'000'000'000'000'000ull;
constexpr static std::uint64_t kMP_TOKEN = 0x2'000'000'000'000'000ull;
constexpr static std::uint64_t kVALUE_MASK = ~(kPOSITIVE | kMP_TOKEN);
static std::uint64_t const kURateOne;
static std::uint64_t const kU_RATE_ONE;
//--------------------------------------------------------------------------
STAmount(SerialIter& sit, SField const& name);
@@ -356,7 +356,7 @@ STAmount::STAmount(A const& asset, int mantissa, int exponent)
// Legacy support for new-style amounts
inline STAmount::STAmount(IOUAmount const& amount, Issue const& issue)
: asset_(issue), offset_(amount.exponent()), isNegative_(amount < beast::kZero)
: asset_(issue), offset_(amount.exponent()), isNegative_(amount < beast::kZERO)
{
if (isNegative_)
{
@@ -371,7 +371,7 @@ inline STAmount::STAmount(IOUAmount const& amount, Issue const& issue)
}
inline STAmount::STAmount(MPTAmount const& amount, MPTIssue const& mptIssue)
: asset_(mptIssue), offset_(0), isNegative_(amount < beast::kZero)
: asset_(mptIssue), offset_(0), isNegative_(amount < beast::kZERO)
{
if (isNegative_)
{
@@ -498,7 +498,7 @@ STAmount::zeroed() const
inline STAmount::
operator bool() const noexcept
{
return *this != beast::kZero;
return *this != beast::kZERO;
}
inline STAmount::
@@ -540,7 +540,7 @@ STAmount::fromNumber(A const& a, Number const& number)
return STAmount{asset, intValue, 0, negative};
}
auto const [mantissa, exponent] = working.normalizeToRange(kMinValue, kMaxValue);
auto const [mantissa, exponent] = working.normalizeToRange(kMIN_VALUE, kMAX_VALUE);
return STAmount{asset, mantissa, exponent, negative};
}
@@ -548,7 +548,7 @@ STAmount::fromNumber(A const& a, Number const& number)
inline void
STAmount::negate()
{
if (*this != beast::kZero)
if (*this != beast::kZERO)
isNegative_ = !isNegative_;
}
@@ -578,7 +578,7 @@ STAmount::value() const noexcept
inline bool
isLegalNet(STAmount const& value)
{
return !value.native() || (value.mantissa() <= STAmount::kMaxNativeN);
return !value.native() || (value.mantissa() <= STAmount::kMAX_NATIVE_N);
}
//------------------------------------------------------------------------------

View File

@@ -65,7 +65,7 @@ struct JsonOptions
}
/// Returns JsonOptions binary negation, can be used with & (above) for set
/// difference e.g. `(options & ~JsonOptions::kIncludeDate)`
/// difference e.g. `(options & ~JsonOptions::kINCLUDE_DATE)`
[[nodiscard]] constexpr JsonOptions friend
operator~(JsonOptions v) noexcept
{

View File

@@ -180,7 +180,7 @@ template <int Bits>
bool
STBitString<Bits>::isDefault() const
{
return value_ == beast::kZero;
return value_ == beast::kZERO;
}
} // namespace xrpl

View File

@@ -24,7 +24,7 @@ public:
STBlob(SField const& f, void const* data, std::size_t size);
STBlob(SField const& f, Buffer&& b);
STBlob(SField const& n);
STBlob(SerialIter&, SField const& name = kSfGeneric);
STBlob(SerialIter&, SField const& name = kSF_GENERIC);
[[nodiscard]] std::size_t
size() const;

View File

@@ -7,11 +7,11 @@
namespace xrpl {
/** Maximum JSON object nesting depth permitted during parsing. */
inline constexpr std::size_t kMaxParsedJsonDepth = 64;
inline constexpr std::size_t kMAX_PARSED_JSON_DEPTH = 64;
/** Maximum number of elements permitted in any JSON array field during parsing.
Requests exceeding this limit are rejected with an invalidParams error. */
inline constexpr std::size_t kMaxParsedJsonArraySize = 512;
inline constexpr std::size_t kMAX_PARSED_JSON_ARRAY_SIZE = 512;
/** Holds the serialized result of parsing an input JSON object.
This does validation and checking on the provided JSON.

View File

@@ -30,8 +30,8 @@ class STTx final : public STObject, public CountedObject<STTx>
TxType tx_type_;
public:
static constexpr std::size_t kMinMultiSigners = 1;
static constexpr std::size_t kMaxMultiSigners = 32;
static constexpr std::size_t kMIN_MULTI_SIGNERS = 1;
static constexpr std::size_t kMAX_MULTI_SIGNERS = 32;
STTx() = delete;
STTx(STTx const& other) = default;

View File

@@ -16,10 +16,10 @@ namespace xrpl {
// Validation flags
// This is a full (as opposed to a partial) validation
constexpr std::uint32_t kVfFullValidation = 0x00000001;
constexpr std::uint32_t kVF_FULL_VALIDATION = 0x00000001;
// The signature is fully canonical
constexpr std::uint32_t kVfFullyCanonicalSig = 0x80000000;
constexpr std::uint32_t kVF_FULLY_CANONICAL_SIG = 0x80000000;
class STValidation final : public STObject, public CountedObject<STValidation>
{
@@ -204,7 +204,7 @@ STValidation::STValidation(
f(*this);
// Finally, sign the validation and mark it as trusted:
setFlag(kVfFullyCanonicalSig);
setFlag(kVF_FULLY_CANONICAL_SIG);
setFieldVL(sfSignature, signDigest(pk, sk, getSigningHash()));
setTrusted();

View File

@@ -17,10 +17,10 @@ namespace xrpl {
class SecretKey
{
public:
static constexpr std::size_t kSize = 32;
static constexpr std::size_t kSIZE = 32;
private:
std::uint8_t buf_[kSize]{};
std::uint8_t buf_[kSIZE]{};
public:
using const_iterator = std::uint8_t const*;
@@ -37,7 +37,7 @@ public:
~SecretKey();
SecretKey(std::array<std::uint8_t, kSize> const& data);
SecretKey(std::array<std::uint8_t, kSIZE> const& data);
SecretKey(Slice const& slice);
[[nodiscard]] std::uint8_t const*

View File

@@ -134,13 +134,13 @@ public:
bool
getInteger(Integer& number, int offset)
{
static auto const kBytes = sizeof(Integer);
if ((offset + kBytes) > data_.size())
static auto const kBYTES = sizeof(Integer);
if ((offset + kBYTES) > data_.size())
return false;
number = 0;
auto ptr = &data_[offset];
for (auto i = 0; i < kBytes; ++i)
for (auto i = 0; i < kBYTES; ++i)
{
if (i)
number <<= 8;

View File

@@ -14,22 +14,22 @@ namespace xrpl {
static inline std::string const&
systemName()
{
static std::string const kName = "xrpld";
return kName;
static std::string const kNAME = "xrpld";
return kNAME;
}
/** Configure the native currency. */
/** Number of drops in the genesis account. */
constexpr XRPAmount kInitialXrp{100'000'000'000 * kDropsPerXrp};
static_assert(kInitialXrp.drops() == 100'000'000'000'000'000);
static_assert(Number::kMaxRep >= kInitialXrp.drops());
constexpr XRPAmount kINITIAL_XRP{100'000'000'000 * kDROPS_PER_XRP};
static_assert(kINITIAL_XRP.drops() == 100'000'000'000'000'000);
static_assert(Number::kMAX_REP >= kINITIAL_XRP.drops());
/** Returns true if the amount does not exceed the initial XRP in existence. */
inline bool
isLegalAmount(XRPAmount const& amount)
{
return amount <= kInitialXrp;
return amount <= kINITIAL_XRP;
}
/** Returns true if the absolute value of the amount does not exceed the initial
@@ -37,31 +37,31 @@ isLegalAmount(XRPAmount const& amount)
inline bool
isLegalAmountSigned(XRPAmount const& amount)
{
return amount >= -kInitialXrp && amount <= kInitialXrp;
return amount >= -kINITIAL_XRP && amount <= kINITIAL_XRP;
}
/* The currency code for the native currency. */
static inline std::string const&
systemCurrencyCode()
{
static std::string const kCode = "XRP";
return kCode;
static std::string const kCODE = "XRP";
return kCODE;
}
/** The XRP ledger network's earliest allowed sequence */
static constexpr std::uint32_t kXrpLedgerEarliestSeq{32570u};
static constexpr std::uint32_t kXRP_LEDGER_EARLIEST_SEQ{32570u};
/** The XRP Ledger mainnet's earliest ledger with a FeeSettings object. Only
* used in asserts and tests. */
static constexpr std::uint32_t kXrpLedgerEarliestFees{562177u};
static constexpr std::uint32_t kXRP_LEDGER_EARLIEST_FEES{562177u};
/** The minimum amount of support an amendment should have. */
constexpr std::ratio<80, 100> kAmendmentMajorityCalcThreshold;
constexpr std::ratio<80, 100> kAMENDMENT_MAJORITY_CALC_THRESHOLD;
/** The minimum amount of time an amendment must hold a majority */
constexpr std::chrono::seconds const kDefaultAmendmentMajorityTime = weeks{2};
constexpr std::chrono::seconds const kDEFAULT_AMENDMENT_MAJORITY_TIME = weeks{2};
} // namespace xrpl
/** Default peer port (IANA registered) */
inline constexpr std::uint16_t kDefaultPeerPort{2459};
inline std::uint16_t constexpr kDEFAULT_PEER_PORT{2459};

View File

@@ -127,10 +127,7 @@ enum TEMcodes : TERUnderlyingType {
temARRAY_TOO_LARGE,
temBAD_TRANSFER_FEE,
temINVALID_INNER_BATCH,
temBAD_MPT,
temBAD_WASM,
temTEMP_DISABLED,
};
//------------------------------------------------------------------------------
@@ -177,8 +174,6 @@ enum TEFcodes : TERUnderlyingType {
tefNO_TICKET,
tefNFTOKEN_IS_NOT_TRANSFERABLE,
tefINVALID_LEDGER_FIX_TYPE,
tefNO_WASM,
tefWASM_FIELD_NOT_INCLUDED,
};
//------------------------------------------------------------------------------
@@ -363,7 +358,6 @@ enum TECcodes : TERUnderlyingType {
tecLIMIT_EXCEEDED = 195,
tecPSEUDO_ACCOUNT = 196,
tecPRECISION_LOSS = 197,
tecWASM_REJECTED = 198,
};
//------------------------------------------------------------------------------

View File

@@ -84,12 +84,6 @@ public:
if (obj.isFieldPresent(sfParentBatchID))
parentBatchID_ = obj.getFieldH256(sfParentBatchID);
if (obj.isFieldPresent(sfGasUsed))
gasUsed_ = obj.getFieldU32(sfGasUsed);
if (obj.isFieldPresent(sfWasmReturnCode))
wasmReturnCode_ = obj.getFieldI32(sfWasmReturnCode);
}
[[nodiscard]] std::optional<STAmount> const&
@@ -110,30 +104,6 @@ public:
parentBatchID_ = id;
}
void
setGasUsed(std::optional<std::uint32_t> const gasUsed)
{
gasUsed_ = gasUsed;
}
[[nodiscard]] std::optional<std::uint32_t> const&
getGasUsed() const
{
return gasUsed_;
}
void
setWasmReturnCode(std::optional<std::int32_t> const wasmReturnCode)
{
wasmReturnCode_ = wasmReturnCode;
}
[[nodiscard]] std::optional<std::int32_t> const&
getWasmReturnCode() const
{
return wasmReturnCode_;
}
private:
uint256 transactionID_;
std::uint32_t ledgerSeq_;
@@ -142,8 +112,6 @@ private:
std::optional<STAmount> deliveredAmount_;
std::optional<uint256> parentBatchID_;
std::optional<std::uint32_t> gasUsed_;
std::optional<std::int32_t> wasmReturnCode_;
STArray nodes_;
};

View File

@@ -62,7 +62,7 @@ badCurrency();
inline bool
isXRP(Currency const& c)
{
return c == beast::kZero;
return c == beast::kZERO;
}
/** Returns "", "XRP", or three letter ISO code. */

View File

@@ -300,13 +300,13 @@ public:
using jsontype =
std::conditional_t<std::is_signed_v<value_type>, json::Int, json::UInt>;
constexpr auto kMin = std::numeric_limits<jsontype>::min();
constexpr auto kMax = std::numeric_limits<jsontype>::max();
constexpr auto kMIN = std::numeric_limits<jsontype>::min();
constexpr auto kMAX = std::numeric_limits<jsontype>::max();
if (value_ < kMin)
return kMin;
if (value_ > kMax)
return kMax;
if (value_ < kMIN)
return kMIN;
if (value_ > kMAX)
return kMAX;
return static_cast<jsontype>(value_);
}
else
@@ -392,14 +392,14 @@ mulDivU(Source1 value, Dest mul, Source2 div)
}
using desttype = typename Dest::value_type;
constexpr auto kMax = std::numeric_limits<desttype>::max();
constexpr auto kMAX = std::numeric_limits<desttype>::max();
// Shortcuts, since these happen a lot in the real world
if (value == div)
return mul;
if (mul.value() == div.value())
{
if (value.value() > kMax)
if (value.value() > kMAX)
return std::nullopt;
return Dest{static_cast<desttype>(value.value())};
}
@@ -414,7 +414,7 @@ mulDivU(Source1 value, Dest mul, Source2 div)
auto quotient = product / div.value();
if (quotient > kMax)
if (quotient > kMAX)
return std::nullopt;
return Dest{static_cast<desttype>(quotient)};

View File

@@ -357,7 +357,7 @@ private:
// Set a max number of allowed attestations to limit the amount of memory
// allocated and processing time. This number is much larger than the actual
// number of attestation a server would ever expect.
static constexpr std::uint32_t kMaxAttestations = 256;
static constexpr std::uint32_t kMAX_ATTESTATIONS = 256;
AttCollection attestations_;
protected:

Some files were not shown because too many files have changed in this diff Show More