Compare commits

..

145 Commits

Author SHA1 Message Date
Bronek Kozicki
d908e459ac Delete MPToken in VaultClawback, if tfVaultClawbackUnauth is set 2025-04-04 19:14:24 +01:00
Bronek Kozicki
1494ae38e1 Fix VaultDeposit::preclaim checks 2025-04-04 12:36:05 +01:00
Bronek Kozicki
8f9524b5af Enforce lsfDefaultRipple flag in addEmptyHolding 2025-04-03 19:43:12 +01:00
Bronek Kozicki
676ed9ad04 Return ter code from dirLink 2025-04-03 19:33:38 +01:00
Bronek Kozicki
f6a9b4f5b1 Remove unnecessary include 2025-04-03 19:30:24 +01:00
Bronek Kozicki
2737249500 Merge branch 'develop' into vault 2025-04-03 14:30:42 +01:00
Bronek Kozicki
591437b914 Mark featureSingleAssetVault as Supported::no 2025-04-03 14:13:21 +01:00
Bronek Kozicki
af8ea3fb40 Rename 'share' to 'shares' in vault_info RPC 2025-04-03 11:45:47 +01:00
Bronek Kozicki
6f4e7e8e44 Move isPseudoAccount near createPseudoAccount 2025-04-03 11:35:46 +01:00
Bronek Kozicki
392e3846ed Change error code to tecLOCKED 2025-04-03 11:33:17 +01:00
Bronek Kozicki
85e7d293ca Factor out isPseudoAccount 2025-04-02 19:29:04 +01:00
Bronek Kozicki
dbbf6829b9 Gate VaultCreate on featureMPTokensV1 2025-04-02 17:11:49 +01:00
Bronek Kozicki
5f53e4d1f8 Change output structure of vault_info 2025-04-02 17:09:49 +01:00
Bronek Kozicki
fa0b021fb8 Add RPC vault_info, remove RPC::supplementJson<ltVAULT> 2025-04-02 16:40:37 +01:00
Bronek Kozicki
09833abd46 Improve checks in VaultWithdraw, more tests 2025-04-02 12:10:22 +01:00
Bronek Kozicki
dc249b8b6d Add unit tests 2025-04-01 19:06:45 +01:00
Bronek Kozicki
ad6e048ab2 Bring back addEmptyHolding and removeEmptyHolding to View 2025-04-01 13:51:47 +01:00
Bronek Kozicki
2b86a1a557 Enforce Destination checks on VaultWithdraw 2025-04-01 13:51:43 +01:00
Bronek Kozicki
93bd26547f Move addEmptyHolding to VaultCreate and removeEmptyHolding to VaultDelete 2025-03-31 18:20:31 +01:00
Bronek Kozicki
b6c74303c1 Add nullptr checks 2025-03-31 16:53:58 +01:00
Bronek Kozicki
a1c21a06bc Rename sfMPTokenIssuanceID in Vault to sfShareMPTID 2025-03-31 16:40:46 +01:00
Bronek Kozicki
b67d8e676b Add more comments on usage of enforceMPTokenAuthorization 2025-03-31 16:26:30 +01:00
Bronek Kozicki
83582b6731 Add RPC unit test 2025-03-31 15:13:58 +01:00
Bronek Kozicki
124512eba9 Add terADDRESS_COLLISION to AMMCreate::preclaim 2025-03-28 21:56:56 +00:00
Bronek Kozicki
1807b441ee Fix bug in pseudoAccountAddress and add unit test 2025-03-28 21:03:49 +00:00
Bronek Kozicki
d3c1d02c72 Return terADDRESS_COLLISION from preclaim if cannot allocate AccountID 2025-03-28 19:49:37 +00:00
Bronek Kozicki
f77ad36283 Merge branch 'develop' into vault 2025-03-28 17:06:06 +00:00
Bronek Kozicki
aff08b7543 Add invariant checks for pseudo-account 2025-03-28 17:04:38 +00:00
Bronek Kozicki
696cf2b563 Merge branch 'develop' into vault 2025-03-28 17:03:15 +00:00
Bronek Kozicki
abaf213336 Fix clang, minor refactor of createPseudoAccount 2025-03-27 19:29:41 +00:00
Bronek Kozicki
0f99955ae9 Merge branch 'develop' into vault 2025-03-27 13:07:02 +00:00
Bronek Kozicki
7686c3d88d Rename ShareTotal to SharesTotal 2025-03-27 11:50:03 +00:00
Bronek Kozicki
33660eadc6 Add comment on tecNO_ENTRY vs tecOBJECT_NOT_FOUND 2025-03-26 19:43:35 +00:00
Bronek Kozicki
0636d4695d Rename sfAsset... fields to sfAssets... 2025-03-26 19:19:30 +00:00
Bronek Kozicki
b6d7ef6c02 Add check for AssetTotal in VaultDelete 2025-03-26 19:17:07 +00:00
Bronek Kozicki
2e13dc1e85 Switch 'vault not found' to tecNO_ENTRY 2025-03-26 19:07:10 +00:00
Bronek Kozicki
dee06df012 Remove tecINVALID_DOMAIN error code
Also remove superflous checks in CredentialHelpers
2025-03-26 17:24:41 +00:00
Bronek Kozicki
f5042df72b Expand tests for numberFromJson 2025-03-26 16:16:31 +00:00
Bronek Kozicki
d16e0518fd Remove Env::vault() 2025-03-26 13:22:43 +00:00
Bronek Kozicki
3883bafd52 Update transactions.macro comment for ttVAULT_CLAWBACK 2025-03-26 12:29:56 +00:00
Bronek Kozicki
275e02f190 Add UNREACHABLE and LCOV_EXCL_LINE 2025-03-26 12:20:07 +00:00
Bronek Kozicki
afaa6aec8b Add test for nontransferable shares 2025-03-25 18:50:07 +00:00
Bronek Kozicki
05ebd0d8a6 Make empty VaultID a temMALFORMED 2025-03-25 17:54:59 +00:00
Bronek Kozicki
372555bda8 Rename tecVAULT_ACCOUNT to tecPSEUDO_ACCOUNT 2025-03-25 15:04:30 +00:00
Bronek Kozicki
2f06b344a7 Extend tests for updating permissioned domain 2025-03-25 12:47:44 +00:00
Bronek Kozicki
fbe28f6536 Switch sfAssetTotal sfAssetAvailable and sfLossUnrealized to required 2025-03-25 12:07:48 +00:00
Bronek Kozicki
ae68a09b06 Supplement ShareTotal in ledger_entry, ledger_data and account_objects. 2025-03-25 11:22:26 +00:00
Bronek Kozicki
dd3edbd5b0 Missed one getSeqValue() 2025-03-24 17:23:47 +00:00
Bronek Kozicki
a173dd20e2 Disallow regular Clawback on Vault accounts 2025-03-24 11:45:50 +00:00
Bronek Kozicki
cc4f87729f Merge branch 'develop' into vault 2025-03-24 11:25:35 +00:00
Bronek Kozicki
1e565e8488 Pseudo-accounts to use sequence 0 2025-03-24 11:10:31 +00:00
Bronek Kozicki
9c1a0aad7d Cleanup handling of unsupported PseudoAccountOwnerType 2025-03-24 10:41:19 +00:00
Bronek Kozicki
d8880ddb48 Replace getSeqProxy().value() with getSeqValue() where appropriate 2025-03-24 10:35:11 +00:00
Bronek Kozicki
1f005d2370 Add WaiveTransferFee::Yes for consistency
This has no actual effect since we do not set TransferRate in
mptIssuance of the vault shares; and transfers to the issuer are never
subject to TransferRate.
2025-03-21 16:48:40 +00:00
Bronek Kozicki
0959bf82b7 Enforce no negative balance at the end of transaction 2025-03-21 16:45:52 +00:00
Bronek Kozicki
58f15307ba Add ShareTotal to ledger_entry output 2025-03-21 16:33:31 +00:00
Bronek Kozicki
3d2102106c Show Share.mpt_issuance_id rather than MPTokenIssuanceID 2025-03-21 13:52:13 +00:00
Bronek Kozicki
4c7119b92f Add support for Destination field in VaultWithdraw 2025-03-20 15:28:09 +00:00
Bronek Kozicki
6b1cf7cee7 Fix clang compilation error 2025-03-20 14:35:47 +00:00
Bronek Kozicki
9a7def38b5 Do not apply IOU fees on VaultDeposit/VaultWithdraw 2025-03-20 13:21:11 +00:00
Bronek Kozicki
b1fc3b7c41 Do not fail VaultSet if nothing changed
One of the failure conditions for VaultSet is:
* The transaction does not specify any of the modifiable fields.

This section was added because I've misread the specification as:
"The transaction does not modify any of the modifiable fields."

Turns out I was wrong, should have read more carefully.
2025-03-20 10:51:00 +00:00
Bronek Kozicki
4e862e0afd AssetMaximum less than zero should yield temMALFORMED 2025-03-19 17:50:48 +00:00
Bronek Kozicki
403ef0d6c2 Allow resetting AssetMaximum to zero 2025-03-19 17:37:20 +00:00
Bronek Kozicki
6db2144912 Improve checks in VaultSet VaultCreate and VaultDeposit 2025-03-19 16:26:44 +00:00
Bronek Kozicki
d77fc57c6a Do not delete expired MPToken 2025-03-19 12:07:52 +00:00
Bronek Kozicki
1df3ff8d76 Merge branch 'develop' into vault 2025-03-19 11:51:30 +00:00
Bronek Kozicki
8e68838543 Remove lsfMPTDomainCheck flag, delete expired MPToken 2025-03-19 11:51:03 +00:00
Bronek Kozicki
2a8861d1c5 DomainID authorization check moved to doApply 2025-03-18 12:10:59 +00:00
Bronek Kozicki
df8761d9f3 Merge branch 'develop' into vault 2025-03-17 12:48:28 +00:00
Bronek Kozicki
7b5680f536 Fix VaultClawback and unit test 2025-03-13 17:24:05 +00:00
Bronek Kozicki
b397524d85 Remove pointless comment 2025-03-13 16:26:26 +00:00
Bronek Kozicki
e0932635ed Fix formatting 2025-03-13 16:13:19 +00:00
Bronek Kozicki
238db87b7d Add check for lsfMPTCanClawback and lsfMPTCanLock 2025-03-13 16:10:14 +00:00
Bronek Kozicki
840a4644c2 Merge branch 'develop' into vault 2025-03-13 11:30:30 +00:00
Bronek Kozicki
4c586eb4b0 Merge branch 'develop' into vault 2025-03-11 23:23:02 +00:00
Bronek Kozicki
3715d7e2e4 Fix bugs related to perm. domain checks, add unit test 2025-03-11 23:04:29 +00:00
Bronek Kozicki
90fef02164 Factor out static Number getShareTotal() from View.cpp 2025-03-10 15:01:14 +00:00
Bronek Kozicki
7b4e901dd7 Replace assert with XRPL_ASSERT 2025-03-10 14:34:08 +00:00
Bronek Kozicki
8ca6a62b84 Error codes change in accountHolds must be amendment gated 2025-03-10 14:29:01 +00:00
Bronek Kozicki
65fdac09b3 Fix logic error in isVaultPseudoAccountFrozen 2025-03-10 14:22:27 +00:00
Bronek Kozicki
1441c919ad Merge branch 'develop' into vault 2025-03-07 16:51:44 +00:00
Bronek Kozicki
b0c2b97663 Enforce PD is enabled if sfDomainID is set 2025-03-07 16:51:32 +00:00
Bronek Kozicki
1589498ae1 Improve VaultClawback checks 2025-03-07 16:51:21 +00:00
Bronek Kozicki
4dc2025378 Rename maxVaultDataLength to maxDataPayloadLength 2025-03-07 11:17:45 +00:00
Bronek Kozicki
fc2e1a2b5a Remove unused Json::Value operator= 2025-03-06 15:14:01 +00:00
Bronek Kozicki
1756fa7d08 Switch sfAmount in VaultClawback from defaulted to optional 2025-03-06 13:55:07 +00:00
Bronek Kozicki
ac6d26a8b3 Switch error code for non-transferable to tecNO_AUTH 2025-03-06 13:54:44 +00:00
Bronek Kozicki
152da6e078 Use unchecked for negative amount in unit tests 2025-03-06 12:56:54 +00:00
Bronek Kozicki
6370448299 Merge branch 'develop' into vault 2025-03-06 12:43:18 +00:00
Bronek Kozicki
04503c9fa4 Enforce non-negative amounts 2025-02-25 19:37:01 +00:00
Bronek Kozicki
a0632a0cb3 Add WithdrawalPolicy 2025-02-25 19:11:04 +00:00
Bronek Kozicki
3f5df80b47 Merge branch 'develop' into vault 2025-02-24 14:10:46 +00:00
Bronek Kozicki
9d619b9dc5 Merge branch 'develop' into vault 2025-02-07 21:29:25 +00:00
Bronek Kozicki
e9ed80026e Optimise isFrozen check for pair of accounts 2025-02-07 21:25:47 +00:00
Bronek Kozicki
c1d8bc4928 Enforce freeze of pseudo-account 2025-02-07 19:29:33 +00:00
Bronek Kozicki
87d8881c81 Merge branch 'develop' into vault 2025-02-07 14:09:37 +00:00
Bronek Kozicki
b7c9577230 Remove unnecessary check 2025-02-06 16:42:23 +00:00
Bronek Kozicki
ffaa8bd24b Improve checks in Vault 2025-02-06 15:44:59 +00:00
Bronek Kozicki
acaed58d85 Prevent deposit when asset is frozen for depositor 2025-02-04 16:49:28 +00:00
Bronek Kozicki
1884ec5e60 Check for frozen assets in preclaim 2025-02-04 16:44:52 +00:00
Bronek Kozicki
6765c101a8 Check permissioned domain enabled if DomainID is used 2025-02-04 12:52:22 +00:00
Bronek Kozicki
9decc053e3 Rename getSequence to getSeqValue 2025-02-03 13:07:00 +00:00
Bronek Kozicki
8baadd5ec3 Fix clang build error 2025-02-03 11:39:52 +00:00
Bronek Kozicki
d1c7d1ae0f Merge branch 'develop' into vault 2025-02-03 10:11:31 +00:00
Ed Hennis
c3f9a4c6ff Fix MSVC build: Get the intended const& for some fields
- Also make MPTID more consistent
2025-01-31 18:06:53 -05:00
Ed Hennis
eed18d16ce Remove unnecessary ValueProxy friend operator != 2025-01-31 18:06:05 -05:00
Ed Hennis
21e0e7e97b Fix ICE errors by reusing a global static const object 2025-01-31 18:06:05 -05:00
Ed Hennis
a98e59a29a Revert "WIP trying to fix MSVC compilation error"
This reverts commit 06a8a61b23.
2025-01-31 18:06:04 -05:00
Bronek Kozicki
06a8a61b23 WIP trying to fix MSVC compilation error 2025-01-31 20:13:41 +00:00
Bronek Kozicki
ad68074d72 MPT permissioned domain checks 2025-01-31 19:26:52 +00:00
Bronek Kozicki
3eebdae3f0 Implement MPT domain checks 2025-01-30 12:42:26 +00:00
Bronek Kozicki
02dec4f797 Merge branch 'develop' into vault 2025-01-27 11:20:46 +00:00
Bronek Kozicki
65d6c48b4a Unit tests naming fix 2025-01-24 11:17:05 +00:00
Bronek Kozicki
86d249a5bb Fix checo of expired credential 2025-01-24 11:10:34 +00:00
Bronek Kozicki
9bf9a1ef12 Merge branch 'develop' into vault 2025-01-24 11:06:59 +00:00
Bronek Kozicki
2c4a2244e9 Verify credentials in VaultDeposit 2025-01-23 20:49:54 +00:00
Bronek Kozicki
25a20adf39 Add VaultID to account 2025-01-23 17:37:36 +00:00
Bronek Kozicki
c08f86d473 Remove temSTRING_TOO_LARGE, fix authorizedDomain, refactor Vault_test 2025-01-22 18:38:15 +00:00
Bronek Kozicki
580a85f2c8 WIP support adding domainID in VaultSet 2025-01-21 13:38:57 +00:00
Bronek Kozicki
dbaa12aa1c WIP permissioned domain support 2025-01-17 19:16:09 +00:00
Bronek Kozicki
c325b6c7f5 Fix Vault unit tests 2025-01-17 17:05:01 +00:00
Bronek Kozicki
375614d7ec Merge branch 'develop' into vault 2025-01-17 10:49:28 +00:00
Bronek Kozicki
bf8bbffab1 Merge branch 'develop' into vault 2025-01-15 15:49:55 +00:00
Bronek Kozicki
8d5cfb910a Merge branch 'develop' into vault 2025-01-13 16:26:51 +00:00
Bronek Kozicki
241429ba32 Simplify conversions to Json::Value
Also remove potential ODR violation from json_value.h
2024-12-18 17:30:41 +00:00
Bronek Kozicki
b9f1200652 Fix formatting 2024-12-18 17:30:39 +00:00
Bronek Kozicki
526f715f16 Comment out failing test 2024-12-18 17:30:32 +00:00
Bronek Kozicki
eae2cd3328 Fix compilation errors 2024-12-18 13:12:41 +00:00
Bronek Kozicki
ecec6e5d33 Fix failing MPToken payment test 2024-12-17 18:05:09 +00:00
John Freeman
ad581661e3 wip clawback 2024-12-17 11:11:05 +00:00
John Freeman
b5619fbcd6 bless sfAsset to carry MPT 2024-12-17 11:11:00 +00:00
John Freeman
54d511b0db remove blob constants 2024-12-17 11:10:58 +00:00
John Freeman
12646cb89e revise tests 2024-12-17 11:10:56 +00:00
John Freeman
ea30f44247 fix 2024-12-17 11:10:54 +00:00
John Freeman
ea6c040f10 wip 2024-12-17 11:10:52 +00:00
John Freeman
1ff1274ee5 AND_THEN 2024-12-17 11:10:50 +00:00
John Freeman
12552162c9 progress 2024-12-17 11:10:48 +00:00
John Freeman
6046fa239c progress 2024-12-17 11:10:47 +00:00
John Freeman
286612cf19 progress 2024-12-17 11:10:45 +00:00
John Freeman
ebc97aee25 progress 2024-12-17 11:10:44 +00:00
John Freeman
1680477e39 progress 2024-12-17 11:10:42 +00:00
John Freeman
d09e74e548 format 2024-12-17 11:10:40 +00:00
John Freeman
a8ec8e7eaa wip 2024-12-17 11:10:38 +00:00
John Freeman
ff8c6491d7 Start vault implementation 2024-12-17 11:10:36 +00:00
John Freeman
1a032f04e3 Integrate STNumber with STParsedJSON 2024-12-17 11:10:27 +00:00
358 changed files with 9458 additions and 8744 deletions

View File

@@ -94,4 +94,3 @@ SpacesInSquareBrackets: false
Standard: Cpp11 Standard: Cpp11
TabWidth: 8 TabWidth: 8
UseTab: Never UseTab: Never
QualifierAlignment: Right

View File

@@ -7,13 +7,13 @@ comment:
show_carryforward_flags: false show_carryforward_flags: false
coverage: coverage:
range: "70..85" range: "60..80"
precision: 1 precision: 1
round: nearest round: nearest
status: status:
project: project:
default: default:
target: 75% target: 60%
threshold: 2% threshold: 2%
patch: patch:
default: default:

8
.github/CODEOWNERS vendored
View File

@@ -1,8 +0,0 @@
# Allow anyone to review any change by default.
*
# Require the rpc-reviewers team to review changes to the rpc code.
include/libxrpl/protocol/ @xrplf/rpc-reviewers
src/libxrpl/protocol/ @xrplf/rpc-reviewers
src/xrpld/rpc/ @xrplf/rpc-reviewers
src/xrpld/app/misc/ @xrplf/rpc-reviewers

View File

@@ -1,13 +1,9 @@
name: clang-format name: clang-format
on: on: [push, pull_request]
push:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
jobs: jobs:
check: check:
if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }}
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
env: env:
CLANG_VERSION: 18 CLANG_VERSION: 18

View File

@@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e container: rippleci/rippled-build-ubuntu:aaf5e3e
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@@ -1,13 +1,9 @@
name: levelization name: levelization
on: on: [push, pull_request]
push:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
jobs: jobs:
check: check:
if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
CLANG_VERSION: 10 CLANG_VERSION: 10

View File

@@ -8,21 +8,19 @@ on:
paths: paths:
- 'src/libxrpl/protocol/BuildInfo.cpp' - 'src/libxrpl/protocol/BuildInfo.cpp'
- '.github/workflows/libxrpl.yml' - '.github/workflows/libxrpl.yml'
types: [opened, reopened, synchronize, ready_for_review]
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
publish: publish:
if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }}
name: Publish libXRPL name: Publish libXRPL
outputs: outputs:
outcome: ${{ steps.upload.outputs.outcome }} outcome: ${{ steps.upload.outputs.outcome }}
version: ${{ steps.version.outputs.version }} version: ${{ steps.version.outputs.version }}
channel: ${{ steps.channel.outputs.channel }} channel: ${{ steps.channel.outputs.channel }}
runs-on: [self-hosted, heavy] runs-on: [self-hosted, heavy]
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e container: rippleci/rippled-build-ubuntu:aaf5e3e
steps: steps:
- name: Wait for essential checks to succeed - name: Wait for essential checks to succeed
uses: lewagon/wait-on-check-action@v1.3.4 uses: lewagon/wait-on-check-action@v1.3.4

View File

@@ -1,7 +1,6 @@
name: macos name: macos
on: on:
pull_request: pull_request:
types: [opened, reopened, synchronize, ready_for_review]
push: push:
# If the branches list is ever changed, be sure to change it on all # If the branches list is ever changed, be sure to change it on all
# build/test jobs (nix, macos, windows, instrumentation) # build/test jobs (nix, macos, windows, instrumentation)
@@ -19,7 +18,6 @@ concurrency:
jobs: jobs:
test: test:
if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }}
strategy: strategy:
matrix: matrix:
platform: platform:
@@ -71,9 +69,6 @@ jobs:
nproc --version nproc --version
echo -n "nproc returns: " echo -n "nproc returns: "
nproc nproc
system_profiler SPHardwareDataType
sysctl -n hw.logicalcpu
clang --version
- name: configure Conan - name: configure Conan
run : | run : |
conan profile new default --detect || true conan profile new default --detect || true

View File

@@ -1,7 +1,6 @@
name: nix name: nix
on: on:
pull_request: pull_request:
types: [opened, reopened, synchronize, ready_for_review]
push: push:
# If the branches list is ever changed, be sure to change it on all # If the branches list is ever changed, be sure to change it on all
# build/test jobs (nix, macos, windows) # build/test jobs (nix, macos, windows)
@@ -40,7 +39,6 @@ concurrency:
jobs: jobs:
dependencies: dependencies:
if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -64,7 +62,7 @@ jobs:
cc: /usr/bin/clang-14 cc: /usr/bin/clang-14
cxx: /usr/bin/clang++-14 cxx: /usr/bin/clang++-14
runs-on: [self-hosted, heavy] runs-on: [self-hosted, heavy]
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e container: rippleci/rippled-build-ubuntu:aaf5e3e
env: env:
build_dir: .build build_dir: .build
steps: steps:
@@ -126,7 +124,7 @@ jobs:
- "-Dunity=ON" - "-Dunity=ON"
needs: dependencies needs: dependencies
runs-on: [self-hosted, heavy] runs-on: [self-hosted, heavy]
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e container: rippleci/rippled-build-ubuntu:aaf5e3e
env: env:
build_dir: .build build_dir: .build
steps: steps:
@@ -180,7 +178,7 @@ jobs:
- "-DUNIT_TEST_REFERENCE_FEE=1000" - "-DUNIT_TEST_REFERENCE_FEE=1000"
needs: dependencies needs: dependencies
runs-on: [self-hosted, heavy] runs-on: [self-hosted, heavy]
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e container: rippleci/rippled-build-ubuntu:aaf5e3e
env: env:
build_dir: .build build_dir: .build
steps: steps:
@@ -231,7 +229,7 @@ jobs:
- Debug - Debug
needs: dependencies needs: dependencies
runs-on: [self-hosted, heavy] runs-on: [self-hosted, heavy]
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e container: rippleci/rippled-build-ubuntu:aaf5e3e
env: env:
build_dir: .build build_dir: .build
steps: steps:
@@ -247,7 +245,7 @@ jobs:
mkdir -p ~/.conan mkdir -p ~/.conan
tar -xzf conan.tar -C ~/.conan tar -xzf conan.tar -C ~/.conan
- name: install gcovr - name: install gcovr
run: pip install "gcovr>=7,<9" run: pip install "gcovr>=7,<8"
- name: check environment - name: check environment
run: | run: |
echo ${PATH} | tr ':' '\n' echo ${PATH} | tr ':' '\n'
@@ -305,7 +303,7 @@ jobs:
conan: conan:
needs: dependencies needs: dependencies
runs-on: [self-hosted, heavy] runs-on: [self-hosted, heavy]
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e container: rippleci/rippled-build-ubuntu:aaf5e3e
env: env:
build_dir: .build build_dir: .build
configuration: Release configuration: Release
@@ -360,7 +358,6 @@ jobs:
# later # later
instrumentation-build: instrumentation-build:
if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }}
env: env:
CLANG_RELEASE: 16 CLANG_RELEASE: 16
strategy: strategy:

View File

@@ -2,7 +2,6 @@ name: windows
on: on:
pull_request: pull_request:
types: [opened, reopened, synchronize, ready_for_review]
push: push:
# If the branches list is ever changed, be sure to change it on all # If the branches list is ever changed, be sure to change it on all
# build/test jobs (nix, macos, windows, instrumentation) # build/test jobs (nix, macos, windows, instrumentation)
@@ -22,7 +21,6 @@ concurrency:
jobs: jobs:
test: test:
if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

View File

@@ -83,17 +83,9 @@ The [commandline](https://xrpl.org/docs/references/http-websocket-apis/api-conve
The `network_id` field was added in the `server_info` response in version 1.5.0 (2019), but it is not returned in [reporting mode](https://xrpl.org/rippled-server-modes.html#reporting-mode). However, use of reporting mode is now discouraged, in favor of using [Clio](https://github.com/XRPLF/clio) instead. The `network_id` field was added in the `server_info` response in version 1.5.0 (2019), but it is not returned in [reporting mode](https://xrpl.org/rippled-server-modes.html#reporting-mode). However, use of reporting mode is now discouraged, in favor of using [Clio](https://github.com/XRPLF/clio) instead.
## XRP Ledger server version 2.5.0
As of 2025-04-04, version 2.5.0 is in development. You can use a pre-release version by building from source or [using the `nightly` package](https://xrpl.org/docs/infrastructure/installation/install-rippled-on-ubuntu).
### Additions and bugfixes in 2.5.0
- `channel_authorize`: If `signing_support` is not enabled in the config, the RPC is disabled.
## XRP Ledger server version 2.4.0 ## XRP Ledger server version 2.4.0
[Version 2.4.0](https://github.com/XRPLF/rippled/releases/tag/2.4.0) was released on March 4, 2025. As of 2025-01-28, version 2.4.0 is in development. You can use a pre-release version by building from source or [using the `nightly` package](https://xrpl.org/docs/infrastructure/installation/install-rippled-on-ubuntu).
### Additions and bugfixes in 2.4.0 ### Additions and bugfixes in 2.4.0

View File

@@ -1,5 +1,3 @@
[![codecov](https://codecov.io/gh/XRPLF/rippled/graph/badge.svg?token=WyFr5ajq3O)](https://codecov.io/gh/XRPLF/rippled)
# The XRP Ledger # The XRP Ledger
The [XRP Ledger](https://xrpl.org/) is a decentralized cryptographic ledger powered by a network of peer-to-peer nodes. The XRP Ledger uses a novel Byzantine Fault Tolerant consensus algorithm to settle and record transactions in a secure distributed database without a central operator. The [XRP Ledger](https://xrpl.org/) is a decentralized cryptographic ledger powered by a network of peer-to-peer nodes. The XRP Ledger uses a novel Byzantine Fault Tolerant consensus algorithm to settle and record transactions in a secure distributed database without a central operator.

View File

@@ -26,7 +26,7 @@
# #
# Examples: # Examples:
# https://vl.ripple.com # https://vl.ripple.com
# https://unl.xrplf.org # https://vl.xrplf.org
# http://127.0.0.1:8000 # http://127.0.0.1:8000
# file:///etc/opt/ripple/vl.txt # file:///etc/opt/ripple/vl.txt
# #

View File

@@ -98,9 +98,6 @@
# 2024-04-03, Bronek Kozicki # 2024-04-03, Bronek Kozicki
# - add support for output formats: jacoco, clover, lcov # - add support for output formats: jacoco, clover, lcov
# #
# 2025-05-12, Jingchen Wu
# - add -fprofile-update=atomic to ensure atomic profile generation
#
# USAGE: # USAGE:
# #
# 1. Copy this file into your cmake modules path. # 1. Copy this file into your cmake modules path.
@@ -203,27 +200,15 @@ set(COVERAGE_COMPILER_FLAGS "-g --coverage"
CACHE INTERNAL "") CACHE INTERNAL "")
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
check_cxx_compiler_flag(-fprofile-abs-path HAVE_cxx_fprofile_abs_path) check_cxx_compiler_flag(-fprofile-abs-path HAVE_cxx_fprofile_abs_path)
if(HAVE_cxx_fprofile_abs_path) if(HAVE_cxx_fprofile_abs_path)
set(COVERAGE_CXX_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path") set(COVERAGE_CXX_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path")
endif() endif()
include(CheckCCompilerFlag)
check_c_compiler_flag(-fprofile-abs-path HAVE_c_fprofile_abs_path) check_c_compiler_flag(-fprofile-abs-path HAVE_c_fprofile_abs_path)
if(HAVE_c_fprofile_abs_path) if(HAVE_c_fprofile_abs_path)
set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path") set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path")
endif() endif()
check_cxx_compiler_flag(-fprofile-update HAVE_cxx_fprofile_update)
if(HAVE_cxx_fprofile_update)
set(COVERAGE_CXX_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-update=atomic")
endif()
check_c_compiler_flag(-fprofile-update HAVE_c_fprofile_update)
if(HAVE_c_fprofile_update)
set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-update=atomic")
endif()
endif() endif()
set(CMAKE_Fortran_FLAGS_COVERAGE set(CMAKE_Fortran_FLAGS_COVERAGE

View File

@@ -367,7 +367,7 @@ get(Section const& section,
} }
inline std::string inline std::string
get(Section const& section, std::string const& name, char const* defaultValue) get(Section const& section, std::string const& name, const char* defaultValue)
{ {
try try
{ {

View File

@@ -55,7 +55,7 @@ lz4Compress(void const* in, std::size_t inSize, BufferFactory&& bf)
auto compressed = bf(outCapacity); auto compressed = bf(outCapacity);
auto compressedSize = LZ4_compress_default( auto compressedSize = LZ4_compress_default(
reinterpret_cast<char const*>(in), reinterpret_cast<const char*>(in),
reinterpret_cast<char*>(compressed), reinterpret_cast<char*>(compressed),
inSize, inSize,
outCapacity); outCapacity);
@@ -89,7 +89,7 @@ lz4Decompress(
Throw<std::runtime_error>("lz4Decompress: integer overflow (output)"); Throw<std::runtime_error>("lz4Decompress: integer overflow (output)");
if (LZ4_decompress_safe( if (LZ4_decompress_safe(
reinterpret_cast<char const*>(in), reinterpret_cast<const char*>(in),
reinterpret_cast<char*>(decompressed), reinterpret_cast<char*>(decompressed),
inSize, inSize,
decompressedSize) != decompressedSize) decompressedSize) != decompressedSize)

View File

@@ -93,7 +93,7 @@ public:
{ {
} }
constexpr E const& constexpr const E&
value() const& value() const&
{ {
return val_; return val_;
@@ -111,7 +111,7 @@ public:
return std::move(val_); return std::move(val_);
} }
constexpr E const&& constexpr const E&&
value() const&& value() const&&
{ {
return std::move(val_); return std::move(val_);

View File

@@ -294,7 +294,7 @@ IntrusiveRefCounts::releaseStrongRef() const
} }
if (refCounts.compare_exchange_weak( if (refCounts.compare_exchange_weak(
prevIntVal, nextIntVal, std::memory_order_acq_rel)) prevIntVal, nextIntVal, std::memory_order_release))
{ {
// Can't be in partial destroy because only decrementing the strong // Can't be in partial destroy because only decrementing the strong
// count to zero can start a partial destroy, and that can't happen // count to zero can start a partial destroy, and that can't happen
@@ -351,7 +351,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
} }
} }
if (refCounts.compare_exchange_weak( if (refCounts.compare_exchange_weak(
prevIntVal, nextIntVal, std::memory_order_acq_rel)) prevIntVal, nextIntVal, std::memory_order_release))
{ {
XRPL_ASSERT( XRPL_ASSERT(
(!(prevIntVal & partialDestroyStartedMask)), (!(prevIntVal & partialDestroyStartedMask)),
@@ -374,7 +374,7 @@ IntrusiveRefCounts::releaseWeakRef() const
// This case should only be hit if the partialDestroyStartedBit is // This case should only be hit if the partialDestroyStartedBit is
// set non-atomically (and even then very rarely). The code is kept // set non-atomically (and even then very rarely). The code is kept
// in case we need to set the flag non-atomically for perf reasons. // in case we need to set the flag non-atomically for perf reasons.
refCounts.wait(prevIntVal, std::memory_order_acquire); refCounts.wait(prevIntVal, std::memory_order_acq_rel);
prevIntVal = refCounts.load(std::memory_order_acquire); prevIntVal = refCounts.load(std::memory_order_acquire);
prev = RefCountPair{prevIntVal}; prev = RefCountPair{prevIntVal};
} }
@@ -382,7 +382,7 @@ IntrusiveRefCounts::releaseWeakRef() const
{ {
// partial destroy MUST finish before running a full destroy (when // partial destroy MUST finish before running a full destroy (when
// using weak pointers) // using weak pointers)
refCounts.wait(prevIntVal - weakDelta, std::memory_order_acquire); refCounts.wait(prevIntVal - weakDelta, std::memory_order_acq_rel);
} }
return ReleaseWeakRefAction::destroy; return ReleaseWeakRefAction::destroy;
} }
@@ -396,7 +396,7 @@ IntrusiveRefCounts::checkoutStrongRefFromWeak() const noexcept
auto desiredValue = RefCountPair{2, 1}.combinedValue(); auto desiredValue = RefCountPair{2, 1}.combinedValue();
while (!refCounts.compare_exchange_weak( while (!refCounts.compare_exchange_weak(
curValue, desiredValue, std::memory_order_acq_rel)) curValue, desiredValue, std::memory_order_release))
{ {
RefCountPair const prev{curValue}; RefCountPair const prev{curValue};
if (!prev.strong) if (!prev.strong)

View File

@@ -115,7 +115,7 @@ public:
sweep(); sweep();
bool bool
del(key_type const& key, bool valid); del(const key_type& key, bool valid);
public: public:
/** Replace aliased objects with originals. /** Replace aliased objects with originals.
@@ -134,20 +134,20 @@ public:
template <class R> template <class R>
bool bool
canonicalize( canonicalize(
key_type const& key, const key_type& key,
SharedPointerType& data, SharedPointerType& data,
R&& replaceCallback); R&& replaceCallback);
bool bool
canonicalize_replace_cache( canonicalize_replace_cache(
key_type const& key, const key_type& key,
SharedPointerType const& data); SharedPointerType const& data);
bool bool
canonicalize_replace_client(key_type const& key, SharedPointerType& data); canonicalize_replace_client(const key_type& key, SharedPointerType& data);
SharedPointerType SharedPointerType
fetch(key_type const& key); fetch(const key_type& key);
/** Insert the element into the container. /** Insert the element into the container.
If the key already exists, nothing happens. If the key already exists, nothing happens.
@@ -168,7 +168,7 @@ public:
// simply return an iterator. // simply return an iterator.
// //
bool bool
retrieve(key_type const& key, T& data); retrieve(const key_type& key, T& data);
mutex_type& mutex_type&
peekMutex(); peekMutex();
@@ -322,10 +322,10 @@ private:
std::string m_name; std::string m_name;
// Desired number of cache entries (0 = ignore) // Desired number of cache entries (0 = ignore)
int const m_target_size; const int m_target_size;
// Desired maximum cache age // Desired maximum cache age
clock_type::duration const m_target_age; const clock_type::duration m_target_age;
// Number of items cached // Number of items cached
int m_cache_count; int m_cache_count;

View File

@@ -365,7 +365,7 @@ TaggedCache<
SharedPointerType, SharedPointerType,
Hash, Hash,
KeyEqual, KeyEqual,
Mutex>::del(key_type const& key, bool valid) Mutex>::del(const key_type& key, bool valid)
{ {
// Remove from cache, if !valid, remove from map too. Returns true if // Remove from cache, if !valid, remove from map too. Returns true if
// removed from cache // removed from cache
@@ -414,7 +414,7 @@ TaggedCache<
KeyEqual, KeyEqual,
Mutex>:: Mutex>::
canonicalize( canonicalize(
key_type const& key, const key_type& key,
SharedPointerType& data, SharedPointerType& data,
R&& replaceCallback) R&& replaceCallback)
{ {
@@ -509,7 +509,7 @@ TaggedCache<
KeyEqual, KeyEqual,
Mutex>:: Mutex>::
canonicalize_replace_cache( canonicalize_replace_cache(
key_type const& key, const key_type& key,
SharedPointerType const& data) SharedPointerType const& data)
{ {
return canonicalize( return canonicalize(
@@ -535,7 +535,7 @@ TaggedCache<
Hash, Hash,
KeyEqual, KeyEqual,
Mutex>:: Mutex>::
canonicalize_replace_client(key_type const& key, SharedPointerType& data) canonicalize_replace_client(const key_type& key, SharedPointerType& data)
{ {
return canonicalize(key, data, []() { return false; }); return canonicalize(key, data, []() { return false; });
} }
@@ -558,7 +558,7 @@ TaggedCache<
SharedPointerType, SharedPointerType,
Hash, Hash,
KeyEqual, KeyEqual,
Mutex>::fetch(key_type const& key) Mutex>::fetch(const key_type& key)
{ {
std::lock_guard<mutex_type> l(m_mutex); std::lock_guard<mutex_type> l(m_mutex);
auto ret = initialFetch(key, l); auto ret = initialFetch(key, l);
@@ -656,7 +656,7 @@ TaggedCache<
SharedPointerType, SharedPointerType,
Hash, Hash,
KeyEqual, KeyEqual,
Mutex>::retrieve(key_type const& key, T& data) Mutex>::retrieve(const key_type& key, T& data)
{ {
// retrieve the value of the stored data // retrieve the value of the stored data
auto entry = fetch(key); auto entry = fetch(key);

View File

@@ -374,7 +374,7 @@ public:
} }
base_uint& base_uint&
operator^=(base_uint const& b) operator^=(const base_uint& b)
{ {
for (int i = 0; i < WIDTH; i++) for (int i = 0; i < WIDTH; i++)
data_[i] ^= b.data_[i]; data_[i] ^= b.data_[i];
@@ -383,7 +383,7 @@ public:
} }
base_uint& base_uint&
operator&=(base_uint const& b) operator&=(const base_uint& b)
{ {
for (int i = 0; i < WIDTH; i++) for (int i = 0; i < WIDTH; i++)
data_[i] &= b.data_[i]; data_[i] &= b.data_[i];
@@ -392,7 +392,7 @@ public:
} }
base_uint& base_uint&
operator|=(base_uint const& b) operator|=(const base_uint& b)
{ {
for (int i = 0; i < WIDTH; i++) for (int i = 0; i < WIDTH; i++)
data_[i] |= b.data_[i]; data_[i] |= b.data_[i];
@@ -415,11 +415,11 @@ public:
return *this; return *this;
} }
base_uint const const base_uint
operator++(int) operator++(int)
{ {
// postfix operator // postfix operator
base_uint const ret = *this; const base_uint ret = *this;
++(*this); ++(*this);
return ret; return ret;
@@ -441,11 +441,11 @@ public:
return *this; return *this;
} }
base_uint const const base_uint
operator--(int) operator--(int)
{ {
// postfix operator // postfix operator
base_uint const ret = *this; const base_uint ret = *this;
--(*this); --(*this);
return ret; return ret;
@@ -466,7 +466,7 @@ public:
} }
base_uint& base_uint&
operator+=(base_uint const& b) operator+=(const base_uint& b)
{ {
std::uint64_t carry = 0; std::uint64_t carry = 0;
@@ -511,7 +511,7 @@ public:
} }
[[nodiscard]] constexpr bool [[nodiscard]] constexpr bool
parseHex(char const* str) parseHex(const char* str)
{ {
return parseHex(std::string_view{str}); return parseHex(std::string_view{str});
} }

View File

@@ -43,7 +43,7 @@ struct less
using result_type = bool; using result_type = bool;
constexpr bool constexpr bool
operator()(T const& left, T const& right) const operator()(const T& left, const T& right) const
{ {
return std::less<T>()(left, right); return std::less<T>()(left, right);
} }
@@ -55,7 +55,7 @@ struct equal_to
using result_type = bool; using result_type = bool;
constexpr bool constexpr bool
operator()(T const& left, T const& right) const operator()(const T& left, const T& right) const
{ {
return std::equal_to<T>()(left, right); return std::equal_to<T>()(left, right);
} }

View File

@@ -52,7 +52,7 @@ template <
typename Value, typename Value,
typename Hash, typename Hash,
typename Pred = std::equal_to<Key>, typename Pred = std::equal_to<Key>,
typename Alloc = std::allocator<std::pair<Key const, Value>>> typename Alloc = std::allocator<std::pair<const Key, Value>>>
class partitioned_unordered_map class partitioned_unordered_map
{ {
std::size_t partitions_; std::size_t partitions_;

View File

@@ -76,13 +76,13 @@ public:
} }
bool bool
operator<(tagged_integer const& rhs) const noexcept operator<(const tagged_integer& rhs) const noexcept
{ {
return m_value < rhs.m_value; return m_value < rhs.m_value;
} }
bool bool
operator==(tagged_integer const& rhs) const noexcept operator==(const tagged_integer& rhs) const noexcept
{ {
return m_value == rhs.m_value; return m_value == rhs.m_value;
} }
@@ -144,14 +144,14 @@ public:
} }
tagged_integer& tagged_integer&
operator<<=(tagged_integer const& rhs) noexcept operator<<=(const tagged_integer& rhs) noexcept
{ {
m_value <<= rhs.m_value; m_value <<= rhs.m_value;
return *this; return *this;
} }
tagged_integer& tagged_integer&
operator>>=(tagged_integer const& rhs) noexcept operator>>=(const tagged_integer& rhs) noexcept
{ {
m_value >>= rhs.m_value; m_value >>= rhs.m_value;
return *this; return *this;

View File

@@ -1,120 +0,0 @@
#ifndef RIPPLE_BASICS_FUNCTIONPROFILER_H_INCLUDED
#define RIPPLE_BASICS_FUNCTIONPROFILER_H_INCLUDED
#include <chrono>
#include <csignal>
#include <mutex>
#include <source_location>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>
#include <cmath>
#include <numeric> // std::accumulate
#define PROFILING 1
#if PROFILING && (defined(__x86_64__) || defined(_M_X64))
#include <x86intrin.h>
#else
#define __rdtsc() 0
#endif
namespace beast {
template <typename T>
double compute_stddev(const std::vector<T>& samples) {
if (samples.size() < 2) return 0.0;
double mean = std::accumulate(samples.begin(), samples.end(), 0.0) / samples.size();
double sum_sq = 0.0;
for (double x : samples) {
sum_sq += (x - mean) * (x - mean);
}
return std::sqrt(sum_sq / (samples.size() - 1));
}
void
logProfilingResults();
class FunctionProfiler
{
public:
std::string functionName;
std::chrono::steady_clock::time_point start;
std::uint64_t cpuCycleStart;
inline static std::mutex mutex_;
struct StatisticData
{
std::vector<std::chrono::nanoseconds> time;
std::vector<std::uint64_t> cpuCycles;
};
inline static std::unordered_map<
std::string,
StatisticData>
funcionDurations;
FunctionProfiler(
std::string const& tag,
std::source_location location = std::source_location::current())
#if PROFILING
: functionName(location.function_name() + tag)
, start(std::chrono::steady_clock::now())
, cpuCycleStart(__rdtsc())
#endif
{
}
~FunctionProfiler() noexcept
{
#if PROFILING
auto duration = std::chrono::steady_clock::now() - start;
std::lock_guard<std::mutex> lock{mutex_};
funcionDurations[functionName].time.emplace_back(duration);
funcionDurations[functionName].cpuCycles.emplace_back((__rdtsc() - cpuCycleStart));
#endif
}
};
inline std::string
getProfilingResults()
{
#if PROFILING
std::lock_guard<std::mutex> lock{FunctionProfiler::mutex_};
std::stringstream ss;
ss << "Function profiling results:" << std::endl;
ss << "name,time,cpu cycles,count,average time(ns),time standard deviation,average cpu cycles,cpu cycles standard deviation" << std::endl;
for (auto const& [name, duration] : FunctionProfiler::funcionDurations)
{
std::vector<std::int64_t> times;
times.reserve(duration.time.size());
std::transform(std::begin(duration.time), std::end(duration.time), std::back_inserter(times), [](const std::chrono::nanoseconds& time) {
return static_cast<std::int64_t>(time.count());
});
auto timeInTotal = std::accumulate(std::begin(times), std::end(times), std::int64_t{0});
auto cpuCyclesInTotal = std::accumulate(std::begin(duration.cpuCycles), std::end(duration.cpuCycles), std::int64_t{0});
ss << name << "," << timeInTotal << ","
<< cpuCyclesInTotal << ","
<< duration.time.size() << ","
<< timeInTotal / (double)duration.time.size() << ","
<< compute_stddev(times) << ","
<< cpuCyclesInTotal / (double)duration.cpuCycles.size() << ","
<< compute_stddev(duration.cpuCycles)
<< std::endl;
}
return ss.str();
#else
return "";
#endif
}
} // namespace beast
#endif

View File

@@ -20,48 +20,24 @@
#ifndef BEAST_HASH_XXHASHER_H_INCLUDED #ifndef BEAST_HASH_XXHASHER_H_INCLUDED
#define BEAST_HASH_XXHASHER_H_INCLUDED #define BEAST_HASH_XXHASHER_H_INCLUDED
#include <xrpl/beast/core/FunctionProfiler.h>
#include <boost/endian/conversion.hpp> #include <boost/endian/conversion.hpp>
#include <xxhash.h> #include <xxhash.h>
#include <cstddef> #include <cstddef>
#include <iostream>
#include <new> #include <new>
#include <span>
#include <type_traits> #include <type_traits>
#define ORIGINAL_HASH 0
#define BIT_SHIFT_HASH 0
namespace beast { namespace beast {
class xxhasher class xxhasher
{ {
public:
using HashType = std::size_t;
private: private:
// requires 64-bit std::size_t // requires 64-bit std::size_t
static_assert(sizeof(std::size_t) == 8, ""); static_assert(sizeof(std::size_t) == 8, "");
#if ORIGINAL_HASH
XXH3_state_t* state_; XXH3_state_t* state_;
#endif
#if PROFILING
std::size_t totalSize_ = 0;
std::chrono::nanoseconds duration_{};
std::uint64_t cpuCycles = 0;
#endif
XXH64_hash_t seed_ = 0;
std::array<std::uint8_t, 40> buffer_;
std::span<std::uint8_t> readBuffer_;
std::span<std::uint8_t> writeBuffer_;
#if ORIGINAL_HASH
static XXH3_state_t* static XXH3_state_t*
allocState() allocState()
{ {
@@ -70,24 +46,6 @@ private:
throw std::bad_alloc(); throw std::bad_alloc();
return ret; return ret;
} }
#endif
void
setupBuffers()
{
writeBuffer_ = std::span{buffer_};
}
void
writeBuffer(void const* data, std::size_t len)
{
auto bytesToWrite = std::min(len, writeBuffer_.size());
std::memcpy(writeBuffer_.data(), data, bytesToWrite);
writeBuffer_ = writeBuffer_.subspan(bytesToWrite);
readBuffer_ = std::span{
std::begin(buffer_), buffer_.size() - writeBuffer_.size()};
}
public: public:
using result_type = std::size_t; using result_type = std::size_t;
@@ -100,48 +58,22 @@ public:
xxhasher() xxhasher()
{ {
#if PROFILING
auto start = std::chrono::steady_clock::now();
auto cpuCyclesStart = __rdtsc();
#endif
#if ORIGINAL_HASH
state_ = allocState(); state_ = allocState();
XXH3_64bits_reset(state_); XXH3_64bits_reset(state_);
#else
setupBuffers();
#endif
#if PROFILING
duration_ += std::chrono::steady_clock::now() - start;
cpuCycles += (__rdtsc() - cpuCyclesStart);
#endif
} }
#if ORIGINAL_HASH
~xxhasher() noexcept ~xxhasher() noexcept
{ {
XXH3_freeState(state_); XXH3_freeState(state_);
} }
#endif
template < template <
class Seed, class Seed,
std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr> std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr>
explicit xxhasher(Seed seed) explicit xxhasher(Seed seed)
{ {
seed_ = seed;
#if ORIGINAL_HASH
auto start = std::chrono::steady_clock::now();
auto cpuCyclesStart = __rdtsc();
state_ = allocState(); state_ = allocState();
XXH3_64bits_reset_withSeed(state_, seed); XXH3_64bits_reset_withSeed(state_, seed);
duration_ += (std::chrono::steady_clock::now() - start);
cpuCycles += (__rdtsc() - cpuCyclesStart);
#else
setupBuffers();
#endif
} }
template < template <
@@ -149,92 +81,20 @@ public:
std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr> std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr>
xxhasher(Seed seed, Seed) xxhasher(Seed seed, Seed)
{ {
#if PROFILING
auto start = std::chrono::steady_clock::now();
auto cpuCyclesStart = __rdtsc();
#endif
seed_ = seed;
#if ORIGINAL_HASH
state_ = allocState(); state_ = allocState();
XXH3_64bits_reset_withSeed(state_, seed); XXH3_64bits_reset_withSeed(state_, seed);
#else
setupBuffers();
#endif
#if PROFILING
duration_ += (std::chrono::steady_clock::now() - start);
cpuCycles += (__rdtsc() - cpuCyclesStart);
#endif
} }
void void
operator()(void const* key, std::size_t len) noexcept operator()(void const* key, std::size_t len) noexcept
{ {
#if PROFILING
totalSize_ += len;
auto start = std::chrono::steady_clock::now();
auto cpuCyclesStart = __rdtsc();
#endif
#if ORIGINAL_HASH
XXH3_64bits_update(state_, key, len); XXH3_64bits_update(state_, key, len);
#else
writeBuffer(key, len);
#endif
#if PROFILING
duration_ += (std::chrono::steady_clock::now() - start);
cpuCycles += (__rdtsc() - cpuCyclesStart);
#endif
} }
explicit explicit
operator HashType() noexcept operator std::size_t() noexcept
{ {
#if ORIGINAL_HASH == 0 return XXH3_64bits_digest(state_);
if (readBuffer_.size() == 0) return 0;
#endif
#if PROFILING
auto start = std::chrono::steady_clock::now();
auto cpuCyclesStart = __rdtsc();
#endif
#if BIT_SHIFT_HASH
const size_t bit_width = readBuffer_.size() * 8;
const size_t shift = seed_ % bit_width;
// Copy input into a buffer long enough to safely extract 64 bits with wraparound
std::uint64_t buffer = 0;
// Load the first 8 bytes (or wrap if input < 8 bytes)
for (size_t i = 0; i < 8; ++i) {
size_t index = readBuffer_.size() - 1 - (i % readBuffer_.size());
buffer <<= 8;
buffer |= readBuffer_[index];
}
// Rotate and return
auto result = (buffer << shift) | (buffer >> (64 - shift));
#elif ORIGINAL_HASH
auto result = XXH3_64bits_digest(state_);
#else
auto result = seed_ == 0 ?
XXH3_64bits(readBuffer_.data(), readBuffer_.size()) :
XXH3_64bits_withSeed(readBuffer_.data(), readBuffer_.size(), seed_);
#endif
#if PROFILING
duration_ += (std::chrono::steady_clock::now() - start);
cpuCycles += (__rdtsc() - cpuCyclesStart);
std::lock_guard<std::mutex> lock{FunctionProfiler::mutex_};
FunctionProfiler::funcionDurations
["xxhasher-" + std::to_string(totalSize_)]
.time.emplace_back(duration_);
FunctionProfiler::funcionDurations
["xxhasher-" + std::to_string(totalSize_)]
.cpuCycles.emplace_back(cpuCycles);
#endif
return result;
} }
}; };

View File

@@ -37,9 +37,9 @@ class temp_dir
public: public:
#if !GENERATING_DOCS #if !GENERATING_DOCS
temp_dir(temp_dir const&) = delete; temp_dir(const temp_dir&) = delete;
temp_dir& temp_dir&
operator=(temp_dir const&) = delete; operator=(const temp_dir&) = delete;
#endif #endif
/// Construct a temporary directory. /// Construct a temporary directory.

View File

@@ -39,7 +39,7 @@ class Reader
{ {
public: public:
using Char = char; using Char = char;
using Location = Char const*; using Location = const Char*;
/** \brief Constructs a Reader allowing all features /** \brief Constructs a Reader allowing all features
* for parsing. * for parsing.
@@ -64,7 +64,7 @@ public:
* error occurred. * error occurred.
*/ */
bool bool
parse(char const* beginDoc, char const* endDoc, Value& root); parse(const char* beginDoc, const char* endDoc, Value& root);
/// \brief Parse from input stream. /// \brief Parse from input stream.
/// \see Json::operator>>(std::istream&, Json::Value&). /// \see Json::operator>>(std::istream&, Json::Value&).
@@ -133,7 +133,7 @@ private:
using Errors = std::deque<ErrorInfo>; using Errors = std::deque<ErrorInfo>;
bool bool
expectToken(TokenType type, Token& token, char const* message); expectToken(TokenType type, Token& token, const char* message);
bool bool
readToken(Token& token); readToken(Token& token);
void void

View File

@@ -20,11 +20,13 @@
#ifndef RIPPLE_JSON_JSON_VALUE_H_INCLUDED #ifndef RIPPLE_JSON_JSON_VALUE_H_INCLUDED
#define RIPPLE_JSON_JSON_VALUE_H_INCLUDED #define RIPPLE_JSON_JSON_VALUE_H_INCLUDED
#include <xrpl/basics/Number.h>
#include <xrpl/json/json_forwards.h> #include <xrpl/json/json_forwards.h>
#include <cstring> #include <cstring>
#include <map> #include <map>
#include <string> #include <string>
#include <utility>
#include <vector> #include <vector>
/** \brief JSON (JavaScript Object Notation). /** \brief JSON (JavaScript Object Notation).
@@ -61,24 +63,24 @@ enum ValueType {
class StaticString class StaticString
{ {
public: public:
constexpr explicit StaticString(char const* czstring) : str_(czstring) constexpr explicit StaticString(const char* czstring) : str_(czstring)
{ {
} }
constexpr constexpr
operator char const*() const operator const char*() const
{ {
return str_; return str_;
} }
constexpr char const* constexpr const char*
c_str() const c_str() const
{ {
return str_; return str_;
} }
private: private:
char const* str_; const char* str_;
}; };
inline bool inline bool
@@ -156,10 +158,10 @@ public:
using Int = Json::Int; using Int = Json::Int;
using ArrayIndex = UInt; using ArrayIndex = UInt;
static Value const null; static const Value null;
static Int const minInt; static const Int minInt;
static Int const maxInt; static const Int maxInt;
static UInt const maxUInt; static const UInt maxUInt;
private: private:
class CZString class CZString
@@ -171,24 +173,24 @@ private:
duplicateOnCopy duplicateOnCopy
}; };
CZString(int index); CZString(int index);
CZString(char const* cstr, DuplicationPolicy allocate); CZString(const char* cstr, DuplicationPolicy allocate);
CZString(CZString const& other); CZString(const CZString& other);
~CZString(); ~CZString();
CZString& CZString&
operator=(CZString const& other) = delete; operator=(const CZString& other) = delete;
bool bool
operator<(CZString const& other) const; operator<(const CZString& other) const;
bool bool
operator==(CZString const& other) const; operator==(const CZString& other) const;
int int
index() const; index() const;
char const* const char*
c_str() const; c_str() const;
bool bool
isStaticString() const; isStaticString() const;
private: private:
char const* cstr_; const char* cstr_;
int index_; int index_;
}; };
@@ -215,7 +217,8 @@ public:
Value(Int value); Value(Int value);
Value(UInt value); Value(UInt value);
Value(double value); Value(double value);
Value(char const* value); Value(const char* value);
Value(ripple::Number const& value);
/** \brief Constructs a value from a static string. /** \brief Constructs a value from a static string.
* Like other value string constructor but do not duplicate the string for * Like other value string constructor but do not duplicate the string for
@@ -227,10 +230,10 @@ public:
* Json::Value aValue( StaticString("some text") ); * Json::Value aValue( StaticString("some text") );
* \endcode * \endcode
*/ */
Value(StaticString const& value); Value(const StaticString& value);
Value(std::string const& value); Value(std::string const& value);
Value(bool value); Value(bool value);
Value(Value const& other); Value(const Value& other);
~Value(); ~Value();
Value& Value&
@@ -247,7 +250,7 @@ public:
ValueType ValueType
type() const; type() const;
char const* const char*
asCString() const; asCString() const;
/** Returns the unquoted string value. */ /** Returns the unquoted string value. */
std::string std::string
@@ -317,12 +320,12 @@ public:
/// Access an array element (zero based index ) /// Access an array element (zero based index )
/// (You may need to say 'value[0u]' to get your compiler to distinguish /// (You may need to say 'value[0u]' to get your compiler to distinguish
/// this from the operator[] which takes a string.) /// this from the operator[] which takes a string.)
Value const& const Value&
operator[](UInt index) const; operator[](UInt index) const;
/// If the array contains at least index+1 elements, returns the element /// If the array contains at least index+1 elements, returns the element
/// value, otherwise returns defaultValue. /// value, otherwise returns defaultValue.
Value Value
get(UInt index, Value const& defaultValue) const; get(UInt index, const Value& defaultValue) const;
/// Return true if index < size(). /// Return true if index < size().
bool bool
isValidIndex(UInt index) const; isValidIndex(UInt index) const;
@@ -330,25 +333,25 @@ public:
/// ///
/// Equivalent to jsonvalue[jsonvalue.size()] = value; /// Equivalent to jsonvalue[jsonvalue.size()] = value;
Value& Value&
append(Value const& value); append(const Value& value);
Value& Value&
append(Value&& value); append(Value&& value);
/// Access an object value by name, create a null member if it does not /// Access an object value by name, create a null member if it does not
/// exist. /// exist.
Value& Value&
operator[](char const* key); operator[](const char* key);
/// Access an object value by name, returns null if there is no member with /// Access an object value by name, returns null if there is no member with
/// that name. /// that name.
Value const& const Value&
operator[](char const* key) const; operator[](const char* key) const;
/// Access an object value by name, create a null member if it does not /// Access an object value by name, create a null member if it does not
/// exist. /// exist.
Value& Value&
operator[](std::string const& key); operator[](std::string const& key);
/// Access an object value by name, returns null if there is no member with /// Access an object value by name, returns null if there is no member with
/// that name. /// that name.
Value const& const Value&
operator[](std::string const& key) const; operator[](std::string const& key) const;
/** \brief Access an object value by name, create a null member if it does /** \brief Access an object value by name, create a null member if it does
not exist. not exist.
@@ -364,14 +367,16 @@ public:
* \endcode * \endcode
*/ */
Value& Value&
operator[](StaticString const& key); operator[](const StaticString& key);
Value const&
operator[](const StaticString& key) const;
/// Return the member named key if it exist, defaultValue otherwise. /// Return the member named key if it exist, defaultValue otherwise.
Value Value
get(char const* key, Value const& defaultValue) const; get(const char* key, const Value& defaultValue) const;
/// Return the member named key if it exist, defaultValue otherwise. /// Return the member named key if it exist, defaultValue otherwise.
Value Value
get(std::string const& key, Value const& defaultValue) const; get(std::string const& key, const Value& defaultValue) const;
/// \brief Remove and return the named member. /// \brief Remove and return the named member.
/// ///
@@ -380,14 +385,14 @@ public:
/// \pre type() is objectValue or nullValue /// \pre type() is objectValue or nullValue
/// \post type() is unchanged /// \post type() is unchanged
Value Value
removeMember(char const* key); removeMember(const char* key);
/// Same as removeMember(const char*) /// Same as removeMember(const char*)
Value Value
removeMember(std::string const& key); removeMember(std::string const& key);
/// Return true if the object has a member named key. /// Return true if the object has a member named key.
bool bool
isMember(char const* key) const; isMember(const char* key) const;
/// Return true if the object has a member named key. /// Return true if the object has a member named key.
bool bool
isMember(std::string const& key) const; isMember(std::string const& key) const;
@@ -414,13 +419,13 @@ public:
end(); end();
friend bool friend bool
operator==(Value const&, Value const&); operator==(const Value&, const Value&);
friend bool friend bool
operator<(Value const&, Value const&); operator<(const Value&, const Value&);
private: private:
Value& Value&
resolveReference(char const* key, bool isStatic); resolveReference(const char* key, bool isStatic);
private: private:
union ValueHolder union ValueHolder
@@ -436,32 +441,38 @@ private:
int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
}; };
inline Value
to_json(ripple::Number const& number)
{
return to_string(number);
}
bool bool
operator==(Value const&, Value const&); operator==(const Value&, const Value&);
inline bool inline bool
operator!=(Value const& x, Value const& y) operator!=(const Value& x, const Value& y)
{ {
return !(x == y); return !(x == y);
} }
bool bool
operator<(Value const&, Value const&); operator<(const Value&, const Value&);
inline bool inline bool
operator<=(Value const& x, Value const& y) operator<=(const Value& x, const Value& y)
{ {
return !(y < x); return !(y < x);
} }
inline bool inline bool
operator>(Value const& x, Value const& y) operator>(const Value& x, const Value& y)
{ {
return y < x; return y < x;
} }
inline bool inline bool
operator>=(Value const& x, Value const& y) operator>=(const Value& x, const Value& y)
{ {
return !(x < y); return !(x < y);
} }
@@ -482,11 +493,11 @@ public:
virtual ~ValueAllocator() = default; virtual ~ValueAllocator() = default;
virtual char* virtual char*
makeMemberName(char const* memberName) = 0; makeMemberName(const char* memberName) = 0;
virtual void virtual void
releaseMemberName(char* memberName) = 0; releaseMemberName(char* memberName) = 0;
virtual char* virtual char*
duplicateStringValue(char const* value, unsigned int length = unknown) = 0; duplicateStringValue(const char* value, unsigned int length = unknown) = 0;
virtual void virtual void
releaseStringValue(char* value) = 0; releaseStringValue(char* value) = 0;
}; };
@@ -503,16 +514,16 @@ public:
ValueIteratorBase(); ValueIteratorBase();
explicit ValueIteratorBase(Value::ObjectValues::iterator const& current); explicit ValueIteratorBase(const Value::ObjectValues::iterator& current);
bool bool
operator==(SelfType const& other) const operator==(const SelfType& other) const
{ {
return isEqual(other); return isEqual(other);
} }
bool bool
operator!=(SelfType const& other) const operator!=(const SelfType& other) const
{ {
return !isEqual(other); return !isEqual(other);
} }
@@ -528,7 +539,7 @@ public:
/// Return the member name of the referenced Value. "" if it is not an /// Return the member name of the referenced Value. "" if it is not an
/// objectValue. /// objectValue.
char const* const char*
memberName() const; memberName() const;
protected: protected:
@@ -542,13 +553,13 @@ protected:
decrement(); decrement();
difference_type difference_type
computeDistance(SelfType const& other) const; computeDistance(const SelfType& other) const;
bool bool
isEqual(SelfType const& other) const; isEqual(const SelfType& other) const;
void void
copy(SelfType const& other); copy(const SelfType& other);
private: private:
Value::ObjectValues::iterator current_; Value::ObjectValues::iterator current_;
@@ -566,8 +577,8 @@ class ValueConstIterator : public ValueIteratorBase
public: public:
using size_t = unsigned int; using size_t = unsigned int;
using difference_type = int; using difference_type = int;
using reference = Value const&; using reference = const Value&;
using pointer = Value const*; using pointer = const Value*;
using SelfType = ValueConstIterator; using SelfType = ValueConstIterator;
ValueConstIterator() = default; ValueConstIterator() = default;
@@ -575,11 +586,11 @@ public:
private: private:
/*! \internal Use by Value to create an iterator. /*! \internal Use by Value to create an iterator.
*/ */
explicit ValueConstIterator(Value::ObjectValues::iterator const& current); explicit ValueConstIterator(const Value::ObjectValues::iterator& current);
public: public:
SelfType& SelfType&
operator=(ValueIteratorBase const& other); operator=(const ValueIteratorBase& other);
SelfType SelfType
operator++(int) operator++(int)
@@ -632,17 +643,17 @@ public:
using SelfType = ValueIterator; using SelfType = ValueIterator;
ValueIterator() = default; ValueIterator() = default;
ValueIterator(ValueConstIterator const& other); ValueIterator(const ValueConstIterator& other);
ValueIterator(ValueIterator const& other); ValueIterator(const ValueIterator& other);
private: private:
/*! \internal Use by Value to create an iterator. /*! \internal Use by Value to create an iterator.
*/ */
explicit ValueIterator(Value::ObjectValues::iterator const& current); explicit ValueIterator(const Value::ObjectValues::iterator& current);
public: public:
SelfType& SelfType&
operator=(SelfType const& other); operator=(const SelfType& other);
SelfType SelfType
operator++(int) operator++(int)

View File

@@ -39,7 +39,7 @@ public:
{ {
} }
virtual std::string virtual std::string
write(Value const& root) = 0; write(const Value& root) = 0;
}; };
/** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format /** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format
@@ -60,11 +60,11 @@ public:
public: // overridden from Writer public: // overridden from Writer
std::string std::string
write(Value const& root) override; write(const Value& root) override;
private: private:
void void
writeValue(Value const& value); writeValue(const Value& value);
std::string document_; std::string document_;
}; };
@@ -101,15 +101,15 @@ public: // overridden from Writer
* JSON document that represents the root value. * JSON document that represents the root value.
*/ */
std::string std::string
write(Value const& root) override; write(const Value& root) override;
private: private:
void void
writeValue(Value const& value); writeValue(const Value& value);
void void
writeArrayValue(Value const& value); writeArrayValue(const Value& value);
bool bool
isMultineArray(Value const& value); isMultineArray(const Value& value);
void void
pushValue(std::string const& value); pushValue(std::string const& value);
void void
@@ -168,15 +168,15 @@ public:
* return a value. * return a value.
*/ */
void void
write(std::ostream& out, Value const& root); write(std::ostream& out, const Value& root);
private: private:
void void
writeValue(Value const& value); writeValue(const Value& value);
void void
writeArrayValue(Value const& value); writeArrayValue(const Value& value);
bool bool
isMultineArray(Value const& value); isMultineArray(const Value& value);
void void
pushValue(std::string const& value); pushValue(std::string const& value);
void void
@@ -207,12 +207,12 @@ valueToString(double value);
std::string std::string
valueToString(bool value); valueToString(bool value);
std::string std::string
valueToQuotedString(char const* value); valueToQuotedString(const char* value);
/// \brief Output using the StyledStreamWriter. /// \brief Output using the StyledStreamWriter.
/// \see Json::operator>>() /// \see Json::operator>>()
std::ostream& std::ostream&
operator<<(std::ostream&, Value const& root); operator<<(std::ostream&, const Value& root);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@@ -37,7 +37,7 @@ pretty(Value const&);
/** Output using the StyledStreamWriter. @see Json::operator>>(). */ /** Output using the StyledStreamWriter. @see Json::operator>>(). */
std::ostream& std::ostream&
operator<<(std::ostream&, Value const& root); operator<<(std::ostream&, const Value& root);
} // namespace Json } // namespace Json

View File

@@ -48,14 +48,6 @@ class STObject;
class STAmount; class STAmount;
class Rules; class Rules;
/** Calculate AMM account ID.
*/
AccountID
ammAccountID(
std::uint16_t prefix,
uint256 const& parentHash,
uint256 const& ammID);
/** Calculate Liquidity Provider Token (LPT) Currency. /** Calculate Liquidity Provider Token (LPT) Currency.
*/ */
Currency Currency

View File

@@ -20,6 +20,7 @@
#ifndef RIPPLE_PROTOCOL_ASSET_H_INCLUDED #ifndef RIPPLE_PROTOCOL_ASSET_H_INCLUDED
#define RIPPLE_PROTOCOL_ASSET_H_INCLUDED #define RIPPLE_PROTOCOL_ASSET_H_INCLUDED
#include <xrpl/basics/Number.h>
#include <xrpl/basics/base_uint.h> #include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/Issue.h> #include <xrpl/protocol/Issue.h>
#include <xrpl/protocol/MPTIssue.h> #include <xrpl/protocol/MPTIssue.h>
@@ -27,6 +28,7 @@
namespace ripple { namespace ripple {
class Asset; class Asset;
class STAmount;
template <typename TIss> template <typename TIss>
concept ValidIssueType = concept ValidIssueType =
@@ -92,6 +94,9 @@ public:
void void
setJson(Json::Value& jv) const; setJson(Json::Value& jv) const;
STAmount
operator()(Number const&) const;
bool bool
native() const native() const
{ {
@@ -114,6 +119,14 @@ public:
equalTokens(Asset const& lhs, Asset const& rhs); equalTokens(Asset const& lhs, Asset const& rhs);
}; };
inline Json::Value
to_json(Asset const& asset)
{
Json::Value jv;
asset.setJson(jv);
return jv;
}
template <ValidIssueType TIss> template <ValidIssueType TIss>
constexpr bool constexpr bool
Asset::holds() const Asset::holds() const
@@ -219,9 +232,6 @@ validJSONAsset(Json::Value const& jv);
Asset Asset
assetFromJson(Json::Value const& jv); assetFromJson(Json::Value const& jv);
Json::Value
to_json(Asset const& asset);
} // namespace ripple } // namespace ripple
#endif // RIPPLE_PROTOCOL_ASSET_H_INCLUDED #endif // RIPPLE_PROTOCOL_ASSET_H_INCLUDED

View File

@@ -120,7 +120,7 @@ enum error_code_i {
rpcSRC_ACT_MALFORMED = 65, rpcSRC_ACT_MALFORMED = 65,
rpcSRC_ACT_MISSING = 66, rpcSRC_ACT_MISSING = 66,
rpcSRC_ACT_NOT_FOUND = 67, rpcSRC_ACT_NOT_FOUND = 67,
rpcDELEGATE_ACT_NOT_FOUND = 68, // unused 68,
rpcSRC_CUR_MALFORMED = 69, rpcSRC_CUR_MALFORMED = 69,
rpcSRC_ISR_MALFORMED = 70, rpcSRC_ISR_MALFORMED = 70,
rpcSTREAM_MALFORMED = 71, rpcSTREAM_MALFORMED = 71,

View File

@@ -336,7 +336,7 @@ public:
// Output Fees as just their numeric value. // Output Fees as just their numeric value.
template <class Char, class Traits, class UnitTag, class T> template <class Char, class Traits, class UnitTag, class T>
std::basic_ostream<Char, Traits>& std::basic_ostream<Char, Traits>&
operator<<(std::basic_ostream<Char, Traits>& os, TaggedFee<UnitTag, T> const& q) operator<<(std::basic_ostream<Char, Traits>& os, const TaggedFee<UnitTag, T>& q)
{ {
return os << q.value(); return os << q.value();
} }

View File

@@ -28,7 +28,6 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include <utility>
namespace ripple { namespace ripple {

View File

@@ -279,10 +279,6 @@ amm(Asset const& issue1, Asset const& issue2) noexcept;
Keylet Keylet
amm(uint256 const& amm) noexcept; amm(uint256 const& amm) noexcept;
/** A keylet for Delegate object */
Keylet
delegate(AccountID const& account, AccountID const& authorizedAccount) noexcept;
Keylet Keylet
bridge(STXChainBridge const& bridge, STXChainBridge::ChainType chainType); bridge(STXChainBridge const& bridge, STXChainBridge::ChainType chainType);
@@ -334,6 +330,15 @@ mptoken(uint256 const& mptokenKey)
Keylet Keylet
mptoken(uint256 const& issuanceKey, AccountID const& holder) noexcept; mptoken(uint256 const& issuanceKey, AccountID const& holder) noexcept;
Keylet
vault(AccountID const& owner, std::uint32_t seq) noexcept;
inline Keylet
vault(uint256 const& vaultKey)
{
return {ltVAULT, vaultKey};
}
Keylet Keylet
permissionedDomain(AccountID const& account, std::uint32_t seq) noexcept; permissionedDomain(AccountID const& account, std::uint32_t seq) noexcept;

View File

@@ -132,7 +132,7 @@ enum LedgerSpecificFlags {
lsfNoFreeze = 0x00200000, // True, cannot freeze ripple states lsfNoFreeze = 0x00200000, // True, cannot freeze ripple states
lsfGlobalFreeze = 0x00400000, // True, all assets frozen lsfGlobalFreeze = 0x00400000, // True, all assets frozen
lsfDefaultRipple = lsfDefaultRipple =
0x00800000, // True, incoming trust lines allow rippling by default 0x00800000, // True, trust lines allow rippling by default
lsfDepositAuth = 0x01000000, // True, all deposits require authorization lsfDepositAuth = 0x01000000, // True, all deposits require authorization
/* // reserved for Hooks amendment /* // reserved for Hooks amendment
lsfTshCollect = 0x02000000, // True, allow TSH collect-calls to acc hooks lsfTshCollect = 0x02000000, // True, allow TSH collect-calls to acc hooks
@@ -191,6 +191,9 @@ enum LedgerSpecificFlags {
// ltCREDENTIAL // ltCREDENTIAL
lsfAccepted = 0x00010000, lsfAccepted = 0x00010000,
// ltVAULT
lsfVaultPrivate = 0x00010000,
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@@ -24,15 +24,12 @@
#include <xrpl/basics/contract.h> #include <xrpl/basics/contract.h>
#include <xrpl/basics/safe_cast.h> #include <xrpl/basics/safe_cast.h>
#include <xrpl/beast/utility/Zero.h> #include <xrpl/beast/utility/Zero.h>
#include <xrpl/json/json_value.h>
#include <boost/multiprecision/cpp_int.hpp> #include <boost/multiprecision/cpp_int.hpp>
#include <boost/operators.hpp> #include <boost/operators.hpp>
#include <cstdint> #include <cstdint>
#include <optional>
#include <string> #include <string>
#include <type_traits>
namespace ripple { namespace ripple {

View File

@@ -42,8 +42,11 @@ public:
AccountID const& AccountID const&
getIssuer() const; getIssuer() const;
MPTID const& constexpr MPTID const&
getMptID() const; getMptID() const
{
return mptID_;
}
std::string std::string
getText() const; getText() const;

View File

@@ -80,7 +80,7 @@ struct MultiApiJson
} }
void void
set(char const* key, auto const& v) set(const char* key, auto const& v)
requires std::constructible_from<Json::Value, decltype(v)> requires std::constructible_from<Json::Value, decltype(v)>
{ {
for (auto& a : this->val) for (auto& a : this->val)
@@ -91,7 +91,7 @@ struct MultiApiJson
enum IsMemberResult : int { none = 0, some, all }; enum IsMemberResult : int { none = 0, some, all };
[[nodiscard]] IsMemberResult [[nodiscard]] IsMemberResult
isMember(char const* key) const isMember(const char* key) const
{ {
int count = 0; int count = 0;
for (auto& a : this->val) for (auto& a : this->val)

View File

@@ -1,97 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2025 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLE_PROTOCOL_PERMISSION_H_INCLUDED
#define RIPPLE_PROTOCOL_PERMISSION_H_INCLUDED
#include <xrpl/protocol/TxFormats.h>
#include <optional>
#include <string>
#include <unordered_map>
#include <unordered_set>
namespace ripple {
/**
* We have both transaction type permissions and granular type permissions.
* Since we will reuse the TransactionFormats to parse the Transaction
* Permissions, only the GranularPermissionType is defined here. To prevent
* conflicts with TxType, the GranularPermissionType is always set to a value
* greater than the maximum value of uint16.
*/
enum GranularPermissionType : std::uint32_t {
#pragma push_macro("PERMISSION")
#undef PERMISSION
#define PERMISSION(type, txType, value) type = value,
#include <xrpl/protocol/detail/permissions.macro>
#undef PERMISSION
#pragma pop_macro("PERMISSION")
};
enum Delegation { delegatable, notDelegatable };
class Permission
{
private:
Permission();
std::unordered_map<std::uint16_t, Delegation> delegatableTx_;
std::unordered_map<std::string, GranularPermissionType>
granularPermissionMap_;
std::unordered_map<GranularPermissionType, std::string> granularNameMap_;
std::unordered_map<GranularPermissionType, TxType> granularTxTypeMap_;
public:
static Permission const&
getInstance();
Permission(Permission const&) = delete;
Permission&
operator=(Permission const&) = delete;
std::optional<std::uint32_t>
getGranularValue(std::string const& name) const;
std::optional<std::string>
getGranularName(GranularPermissionType const& value) const;
std::optional<TxType>
getGranularTxType(GranularPermissionType const& gpType) const;
bool
isDelegatable(std::uint32_t const& permissionValue) const;
// for tx level permission, permission value is equal to tx type plus one
uint32_t
txToPermissionType(TxType const& type) const;
// tx type value is permission value minus one
TxType
permissionToTxType(uint32_t const& value) const;
};
} // namespace ripple
#endif

View File

@@ -116,6 +116,12 @@ std::size_t constexpr maxMPTokenMetadataLength = 1024;
/** The maximum amount of MPTokenIssuance */ /** The maximum amount of MPTokenIssuance */
std::uint64_t constexpr maxMPTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull; std::uint64_t constexpr maxMPTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull;
/** The maximum length of Data payload */
std::size_t constexpr maxDataPayloadLength = 256;
/** Vault withdrawal policies */
std::uint8_t constexpr vaultStrategyFirstComeFirstServe = 1;
/** A ledger index. */ /** A ledger index. */
using LedgerIndex = std::uint32_t; using LedgerIndex = std::uint32_t;
@@ -155,10 +161,6 @@ std::size_t constexpr maxPriceScale = 20;
*/ */
std::size_t constexpr maxTrim = 25; std::size_t constexpr maxTrim = 25;
/** The maximum number of delegate permissions an account can grant
*/
std::size_t constexpr permissionMaxSize = 10;
} // namespace ripple } // namespace ripple
#endif #endif

View File

@@ -113,8 +113,8 @@ public:
// have lower unsigned integer representations. // have lower unsigned integer representations.
using value_type = std::uint64_t; using value_type = std::uint64_t;
static int const minTickSize = 3; static const int minTickSize = 3;
static int const maxTickSize = 16; static const int maxTickSize = 16;
private: private:
// This has the same representation as STAmount, see the comment on the // This has the same representation as STAmount, see the comment on the

View File

@@ -25,7 +25,6 @@
#include <cstdint> #include <cstdint>
#include <map> #include <map>
#include <utility>
namespace ripple { namespace ripple {
@@ -182,22 +181,22 @@ public:
private_access_tag_t, private_access_tag_t,
SerializedTypeID tid, SerializedTypeID tid,
int fv, int fv,
char const* fn, const char* fn,
int meta = sMD_Default, int meta = sMD_Default,
IsSigning signing = IsSigning::yes); IsSigning signing = IsSigning::yes);
explicit SField(private_access_tag_t, int fc); explicit SField(private_access_tag_t, int fc);
static SField const& static const SField&
getField(int fieldCode); getField(int fieldCode);
static SField const& static const SField&
getField(std::string const& fieldName); getField(std::string const& fieldName);
static SField const& static const SField&
getField(int type, int value) getField(int type, int value)
{ {
return getField(field_code(type, value)); return getField(field_code(type, value));
} }
static SField const& static const SField&
getField(SerializedTypeID type, int value) getField(SerializedTypeID type, int value)
{ {
return getField(field_code(type, value)); return getField(field_code(type, value));
@@ -284,19 +283,19 @@ public:
} }
bool bool
operator==(SField const& f) const operator==(const SField& f) const
{ {
return fieldCode == f.fieldCode; return fieldCode == f.fieldCode;
} }
bool bool
operator!=(SField const& f) const operator!=(const SField& f) const
{ {
return fieldCode != f.fieldCode; return fieldCode != f.fieldCode;
} }
static int static int
compare(SField const& f1, SField const& f2); compare(const SField& f1, const SField& f2);
static std::map<int, SField const*> const& static std::map<int, SField const*> const&
getKnownCodeToField() getKnownCodeToField()

View File

@@ -58,7 +58,7 @@ public:
add(Serializer& s) const override; add(Serializer& s) const override;
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(const STBase& t) const override;
bool bool
isDefault() const override; isDefault() const override;

View File

@@ -62,20 +62,20 @@ private:
public: public:
using value_type = STAmount; using value_type = STAmount;
static int const cMinOffset = -96; static const int cMinOffset = -96;
static int const cMaxOffset = 80; static const int cMaxOffset = 80;
// Maximum native value supported by the code // Maximum native value supported by the code
static std::uint64_t const cMinValue = 1000000000000000ull; static const std::uint64_t cMinValue = 1000000000000000ull;
static std::uint64_t const cMaxValue = 9999999999999999ull; static const std::uint64_t cMaxValue = 9999999999999999ull;
static std::uint64_t const cMaxNative = 9000000000000000000ull; static const std::uint64_t cMaxNative = 9000000000000000000ull;
// Max native value on network. // Max native value on network.
static std::uint64_t const cMaxNativeN = 100000000000000000ull; static const std::uint64_t cMaxNativeN = 100000000000000000ull;
static std::uint64_t const cIssuedCurrency = 0x8000000000000000ull; static const std::uint64_t cIssuedCurrency = 0x8000000000000000ull;
static std::uint64_t const cPositive = 0x4000000000000000ull; static const std::uint64_t cPositive = 0x4000000000000000ull;
static std::uint64_t const cMPToken = 0x2000000000000000ull; static const std::uint64_t cMPToken = 0x2000000000000000ull;
static std::uint64_t const cValueMask = ~(cPositive | cMPToken); static const std::uint64_t cValueMask = ~(cPositive | cMPToken);
static std::uint64_t const uRateOne; static std::uint64_t const uRateOne;
@@ -153,6 +153,12 @@ public:
template <AssetType A> template <AssetType A>
STAmount(A const& asset, int mantissa, int exponent = 0); STAmount(A const& asset, int mantissa, int exponent = 0);
template <AssetType A>
STAmount(A const& asset, Number const& number)
: STAmount(asset, number.mantissa(), number.exponent())
{
}
// Legacy support for new-style amounts // Legacy support for new-style amounts
STAmount(IOUAmount const& amount, Issue const& issue); STAmount(IOUAmount const& amount, Issue const& issue);
STAmount(XRPAmount const& amount); STAmount(XRPAmount const& amount);
@@ -230,6 +236,9 @@ public:
STAmount& STAmount&
operator=(XRPAmount const& amount); operator=(XRPAmount const& amount);
STAmount&
operator=(Number const&);
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// //
// Modification // Modification
@@ -268,13 +277,13 @@ public:
std::string std::string
getText() const override; getText() const override;
Json::Value getJson(JsonOptions) const override; Json::Value getJson(JsonOptions = JsonOptions::none) const override;
void void
add(Serializer& s) const override; add(Serializer& s) const override;
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(const STBase& t) const override;
bool bool
isDefault() const override; isDefault() const override;
@@ -417,7 +426,7 @@ STAmount
amountFromQuality(std::uint64_t rate); amountFromQuality(std::uint64_t rate);
STAmount STAmount
amountFromString(Asset const& issue, std::string const& amount); amountFromString(Asset const& asset, std::string const& amount);
STAmount STAmount
amountFromJson(SField const& name, Json::Value const& v); amountFromJson(SField const& name, Json::Value const& v);
@@ -541,6 +550,16 @@ STAmount::operator=(XRPAmount const& amount)
return *this; return *this;
} }
inline STAmount&
STAmount::operator=(Number const& number)
{
mIsNegative = number.mantissa() < 0;
mValue = mIsNegative ? -number.mantissa() : number.mantissa();
mOffset = number.exponent();
canonicalize();
return *this;
}
inline void inline void
STAmount::negate() STAmount::negate()
{ {

View File

@@ -128,13 +128,13 @@ public:
add(Serializer& s) const override; add(Serializer& s) const override;
void void
sort(bool (*compare)(STObject const& o1, STObject const& o2)); sort(bool (*compare)(const STObject& o1, const STObject& o2));
bool bool
operator==(STArray const& s) const; operator==(const STArray& s) const;
bool bool
operator!=(STArray const& s) const; operator!=(const STArray& s) const;
iterator iterator
erase(iterator pos); erase(iterator pos);
@@ -152,7 +152,7 @@ public:
getSType() const override; getSType() const override;
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(const STBase& t) const override;
bool bool
isDefault() const override; isDefault() const override;
@@ -275,13 +275,13 @@ STArray::swap(STArray& a) noexcept
} }
inline bool inline bool
STArray::operator==(STArray const& s) const STArray::operator==(const STArray& s) const
{ {
return v_ == s.v_; return v_ == s.v_;
} }
inline bool inline bool
STArray::operator!=(STArray const& s) const STArray::operator!=(const STArray& s) const
{ {
return v_ != s.v_; return v_ != s.v_;
} }

View File

@@ -92,6 +92,14 @@ struct JsonOptions
} }
}; };
template <typename T>
requires requires(T const& t) { t.getJson(JsonOptions::none); }
Json::Value
to_json(T const& t)
{
return t.getJson(JsonOptions::none);
}
namespace detail { namespace detail {
class STVar; class STVar;
} }
@@ -129,16 +137,16 @@ class STBase
public: public:
virtual ~STBase() = default; virtual ~STBase() = default;
STBase(); STBase();
STBase(STBase const&) = default; STBase(const STBase&) = default;
STBase& STBase&
operator=(STBase const& t); operator=(const STBase& t);
explicit STBase(SField const& n); explicit STBase(SField const& n);
bool bool
operator==(STBase const& t) const; operator==(const STBase& t) const;
bool bool
operator!=(STBase const& t) const; operator!=(const STBase& t) const;
template <class D> template <class D>
D& D&
@@ -157,7 +165,7 @@ public:
virtual std::string virtual std::string
getText() const; getText() const;
virtual Json::Value getJson(JsonOptions /*options*/) const; virtual Json::Value getJson(JsonOptions = JsonOptions::none) const;
virtual void virtual void
add(Serializer& s) const; add(Serializer& s) const;
@@ -197,7 +205,7 @@ private:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
std::ostream& std::ostream&
operator<<(std::ostream& out, STBase const& t); operator<<(std::ostream& out, const STBase& t);
template <class D> template <class D>
D& D&

View File

@@ -45,8 +45,8 @@ public:
STBitString() = default; STBitString() = default;
STBitString(SField const& n); STBitString(SField const& n);
STBitString(value_type const& v); STBitString(const value_type& v);
STBitString(SField const& n, value_type const& v); STBitString(SField const& n, const value_type& v);
STBitString(SerialIter& sit, SField const& name); STBitString(SerialIter& sit, SField const& name);
SerializedTypeID SerializedTypeID
@@ -56,7 +56,7 @@ public:
getText() const override; getText() const override;
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(const STBase& t) const override;
void void
add(Serializer& s) const override; add(Serializer& s) const override;
@@ -93,12 +93,12 @@ inline STBitString<Bits>::STBitString(SField const& n) : STBase(n)
} }
template <int Bits> template <int Bits>
inline STBitString<Bits>::STBitString(value_type const& v) : value_(v) inline STBitString<Bits>::STBitString(const value_type& v) : value_(v)
{ {
} }
template <int Bits> template <int Bits>
inline STBitString<Bits>::STBitString(SField const& n, value_type const& v) inline STBitString<Bits>::STBitString(SField const& n, const value_type& v)
: STBase(n), value_(v) : STBase(n), value_(v)
{ {
} }
@@ -160,9 +160,9 @@ STBitString<Bits>::getText() const
template <int Bits> template <int Bits>
bool bool
STBitString<Bits>::isEquivalent(STBase const& t) const STBitString<Bits>::isEquivalent(const STBase& t) const
{ {
STBitString const* v = dynamic_cast<STBitString const*>(&t); const STBitString* v = dynamic_cast<const STBitString*>(&t);
return v && (value_ == v->value_); return v && (value_ == v->value_);
} }

View File

@@ -63,7 +63,7 @@ public:
add(Serializer& s) const override; add(Serializer& s) const override;
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(const STBase& t) const override;
bool bool
isDefault() const override; isDefault() const override;

View File

@@ -65,7 +65,7 @@ public:
add(Serializer& s) const override; add(Serializer& s) const override;
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(const STBase& t) const override;
bool bool
isDefault() const override; isDefault() const override;

View File

@@ -54,7 +54,7 @@ public:
isDefault() const override; isDefault() const override;
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(const STBase& t) const override;
STInteger& STInteger&
operator=(value_type const& v); operator=(value_type const& v);
@@ -127,9 +127,9 @@ STInteger<Integer>::isDefault() const
template <typename Integer> template <typename Integer>
inline bool inline bool
STInteger<Integer>::isEquivalent(STBase const& t) const STInteger<Integer>::isEquivalent(const STBase& t) const
{ {
STInteger const* v = dynamic_cast<STInteger const*>(&t); const STInteger* v = dynamic_cast<const STInteger*>(&t);
return v && (value_ == v->value_); return v && (value_ == v->value_);
} }

View File

@@ -37,6 +37,7 @@ public:
using value_type = Asset; using value_type = Asset;
STIssue() = default; STIssue() = default;
STIssue(STIssue const& rhs) = default;
explicit STIssue(SerialIter& sit, SField const& name); explicit STIssue(SerialIter& sit, SField const& name);
@@ -45,6 +46,15 @@ public:
explicit STIssue(SField const& name); explicit STIssue(SField const& name);
STIssue&
operator=(STIssue const& rhs) = default;
STIssue&
operator=(Asset const& rhs)
{
asset_ = rhs;
return *this;
}
template <ValidIssueType TIss> template <ValidIssueType TIss>
TIss const& TIss const&
get() const; get() const;
@@ -71,7 +81,7 @@ public:
add(Serializer& s) const override; add(Serializer& s) const override;
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(const STBase& t) const override;
bool bool
isDefault() const override; isDefault() const override;

View File

@@ -35,7 +35,7 @@ class STLedgerEntry final : public STObject, public CountedObject<STLedgerEntry>
public: public:
using pointer = std::shared_ptr<STLedgerEntry>; using pointer = std::shared_ptr<STLedgerEntry>;
using ref = std::shared_ptr<STLedgerEntry> const&; using ref = const std::shared_ptr<STLedgerEntry>&;
/** Create an empty object with the given key and type. */ /** Create an empty object with the given key and type. */
explicit STLedgerEntry(Keylet const& k); explicit STLedgerEntry(Keylet const& k);

View File

@@ -63,6 +63,13 @@ public:
void void
setValue(Number const& v); setValue(Number const& v);
STNumber&
operator=(Number const& rhs)
{
setValue(rhs);
return *this;
}
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(STBase const& t) const override;
bool bool
@@ -83,6 +90,19 @@ private:
std::ostream& std::ostream&
operator<<(std::ostream& out, STNumber const& rhs); operator<<(std::ostream& out, STNumber const& rhs);
struct NumberParts
{
std::uint64_t mantissa = 0;
int exponent = 0;
bool negative = false;
};
NumberParts
partsFromString(std::string const& number);
STNumber
numberFromJson(SField const& field, Json::Value const& value);
} // namespace ripple } // namespace ripple
#endif #endif

View File

@@ -99,8 +99,8 @@ public:
STObject& STObject&
operator=(STObject&& other); operator=(STObject&& other);
STObject(SOTemplate const& type, SField const& name); STObject(const SOTemplate& type, SField const& name);
STObject(SOTemplate const& type, SerialIter& sit, SField const& name); STObject(const SOTemplate& type, SerialIter& sit, SField const& name);
STObject(SerialIter& sit, SField const& name, int depth = 0); STObject(SerialIter& sit, SField const& name, int depth = 0);
STObject(SerialIter&& sit, SField const& name); STObject(SerialIter&& sit, SField const& name);
explicit STObject(SField const& name); explicit STObject(SField const& name);
@@ -121,7 +121,7 @@ public:
reserve(std::size_t n); reserve(std::size_t n);
void void
applyTemplate(SOTemplate const& type); applyTemplate(const SOTemplate& type);
void void
applyTemplateFromSField(SField const&); applyTemplateFromSField(SField const&);
@@ -130,7 +130,7 @@ public:
isFree() const; isFree() const;
void void
set(SOTemplate const&); set(const SOTemplate&);
bool bool
set(SerialIter& u, int depth = 0); set(SerialIter& u, int depth = 0);
@@ -139,7 +139,7 @@ public:
getSType() const override; getSType() const override;
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(const STBase& t) const override;
bool bool
isDefault() const override; isDefault() const override;
@@ -154,8 +154,7 @@ public:
getText() const override; getText() const override;
// TODO(tom): options should be an enum. // TODO(tom): options should be an enum.
Json::Value Json::Value getJson(JsonOptions = JsonOptions::none) const override;
getJson(JsonOptions options) const override;
void void
addWithoutSigningFields(Serializer& s) const; addWithoutSigningFields(Serializer& s) const;
@@ -183,13 +182,13 @@ public:
uint256 uint256
getSigningHash(HashPrefix prefix) const; getSigningHash(HashPrefix prefix) const;
STBase const& const STBase&
peekAtIndex(int offset) const; peekAtIndex(int offset) const;
STBase& STBase&
getIndex(int offset); getIndex(int offset);
STBase const* const STBase*
peekAtPIndex(int offset) const; peekAtPIndex(int offset) const;
STBase* STBase*
@@ -201,13 +200,13 @@ public:
SField const& SField const&
getFieldSType(int index) const; getFieldSType(int index) const;
STBase const& const STBase&
peekAtField(SField const& field) const; peekAtField(SField const& field) const;
STBase& STBase&
getField(SField const& field); getField(SField const& field);
STBase const* const STBase*
peekAtPField(SField const& field) const; peekAtPField(SField const& field) const;
STBase* STBase*
@@ -241,11 +240,11 @@ public:
getFieldAmount(SField const& field) const; getFieldAmount(SField const& field) const;
STPathSet const& STPathSet const&
getFieldPathSet(SField const& field) const; getFieldPathSet(SField const& field) const;
STVector256 const& const STVector256&
getFieldV256(SField const& field) const; getFieldV256(SField const& field) const;
STArray const& const STArray&
getFieldArray(SField const& field) const; getFieldArray(SField const& field) const;
STCurrency const& const STCurrency&
getFieldCurrency(SField const& field) const; getFieldCurrency(SField const& field) const;
STNumber const& STNumber const&
getFieldNumber(SField const& field) const; getFieldNumber(SField const& field) const;
@@ -409,12 +408,12 @@ public:
delField(int index); delField(int index);
bool bool
hasMatchingEntry(STBase const&); hasMatchingEntry(const STBase&);
bool bool
operator==(STObject const& o) const; operator==(const STObject& o) const;
bool bool
operator!=(STObject const& o) const; operator!=(const STObject& o) const;
class FieldErr; class FieldErr;
@@ -484,9 +483,19 @@ private:
template <class T> template <class T>
class STObject::Proxy class STObject::Proxy
{ {
protected: public:
using value_type = typename T::value_type; using value_type = typename T::value_type;
value_type
value() const;
value_type
operator*() const;
T const*
operator->() const;
protected:
STObject* st_; STObject* st_;
SOEStyle style_; SOEStyle style_;
TypedField<T> const* f_; TypedField<T> const* f_;
@@ -495,9 +504,6 @@ protected:
Proxy(STObject* st, TypedField<T> const* f); Proxy(STObject* st, TypedField<T> const* f);
value_type
value() const;
T const* T const*
find() const; find() const;
@@ -512,7 +518,7 @@ template <typename U>
concept IsArithmetic = std::is_arithmetic_v<U> || std::is_same_v<U, STAmount>; concept IsArithmetic = std::is_arithmetic_v<U> || std::is_same_v<U, STAmount>;
template <class T> template <class T>
class STObject::ValueProxy : private Proxy<T> class STObject::ValueProxy : public Proxy<T>
{ {
private: private:
using value_type = typename T::value_type; using value_type = typename T::value_type;
@@ -538,6 +544,13 @@ public:
operator value_type() const; operator value_type() const;
template <typename U>
friend bool
operator==(U const& lhs, STObject::ValueProxy<T> const& rhs)
{
return rhs.value() == lhs;
}
private: private:
friend class STObject; friend class STObject;
@@ -545,7 +558,7 @@ private:
}; };
template <class T> template <class T>
class STObject::OptionalProxy : private Proxy<T> class STObject::OptionalProxy : public Proxy<T>
{ {
private: private:
using value_type = typename T::value_type; using value_type = typename T::value_type;
@@ -565,15 +578,6 @@ public:
explicit explicit
operator bool() const noexcept; operator bool() const noexcept;
/** Return the contained value
Throws:
STObject::FieldErr if !engaged()
*/
value_type
operator*() const;
operator optional_type() const; operator optional_type() const;
/** Explicit conversion to std::optional */ /** Explicit conversion to std::optional */
@@ -717,6 +721,20 @@ STObject::Proxy<T>::value() const -> value_type
return value_type{}; return value_type{};
} }
template <class T>
auto
STObject::Proxy<T>::operator*() const -> value_type
{
return this->value();
}
template <class T>
T const*
STObject::Proxy<T>::operator->() const
{
return this->find();
}
template <class T> template <class T>
inline T const* inline T const*
STObject::Proxy<T>::find() const STObject::Proxy<T>::find() const
@@ -792,13 +810,6 @@ STObject::OptionalProxy<T>::operator bool() const noexcept
return engaged(); return engaged();
} }
template <class T>
auto
STObject::OptionalProxy<T>::operator*() const -> value_type
{
return this->value();
}
template <class T> template <class T>
STObject::OptionalProxy<T>::operator typename STObject::OptionalProxy< STObject::OptionalProxy<T>::operator typename STObject::OptionalProxy<
T>::optional_type() const T>::optional_type() const
@@ -970,7 +981,7 @@ STObject::getCount() const
return v_.size(); return v_.size();
} }
inline STBase const& inline const STBase&
STObject::peekAtIndex(int offset) const STObject::peekAtIndex(int offset) const
{ {
return v_[offset].get(); return v_[offset].get();
@@ -982,7 +993,7 @@ STObject::getIndex(int offset)
return v_[offset].get(); return v_[offset].get();
} }
inline STBase const* inline const STBase*
STObject::peekAtPIndex(int offset) const STObject::peekAtPIndex(int offset) const
{ {
return &v_[offset].get(); return &v_[offset].get();
@@ -1117,7 +1128,7 @@ STObject::setFieldH160(SField const& field, base_uint<160, Tag> const& v)
} }
inline bool inline bool
STObject::operator!=(STObject const& o) const STObject::operator!=(const STObject& o) const
{ {
return !(*this == o); return !(*this == o);
} }
@@ -1126,7 +1137,7 @@ template <typename T, typename V>
V V
STObject::getFieldByValue(SField const& field) const STObject::getFieldByValue(SField const& field) const
{ {
STBase const* rf = peekAtPField(field); const STBase* rf = peekAtPField(field);
if (!rf) if (!rf)
throwFieldNotFound(field); throwFieldNotFound(field);
@@ -1136,7 +1147,7 @@ STObject::getFieldByValue(SField const& field) const
if (id == STI_NOTPRESENT) if (id == STI_NOTPRESENT)
return V(); // optional field not present return V(); // optional field not present
T const* cf = dynamic_cast<T const*>(rf); const T* cf = dynamic_cast<const T*>(rf);
if (!cf) if (!cf)
Throw<std::runtime_error>("Wrong field type"); Throw<std::runtime_error>("Wrong field type");
@@ -1153,7 +1164,7 @@ template <typename T, typename V>
V const& V const&
STObject::getFieldByConstRef(SField const& field, V const& empty) const STObject::getFieldByConstRef(SField const& field, V const& empty) const
{ {
STBase const* rf = peekAtPField(field); const STBase* rf = peekAtPField(field);
if (!rf) if (!rf)
throwFieldNotFound(field); throwFieldNotFound(field);
@@ -1163,7 +1174,7 @@ STObject::getFieldByConstRef(SField const& field, V const& empty) const
if (id == STI_NOTPRESENT) if (id == STI_NOTPRESENT)
return empty; // optional field not present return empty; // optional field not present
T const* cf = dynamic_cast<T const*>(rf); const T* cf = dynamic_cast<const T*>(rf);
if (!cf) if (!cf)
Throw<std::runtime_error>("Wrong field type"); Throw<std::runtime_error>("Wrong field type");

View File

@@ -106,10 +106,10 @@ public:
getIssuerID() const; getIssuerID() const;
bool bool
operator==(STPathElement const& t) const; operator==(const STPathElement& t) const;
bool bool
operator!=(STPathElement const& t) const; operator!=(const STPathElement& t) const;
private: private:
static std::size_t static std::size_t
@@ -164,7 +164,7 @@ public:
STPathElement& STPathElement&
operator[](int i); operator[](int i);
STPathElement const& const STPathElement&
operator[](int i) const; operator[](int i) const;
void void
@@ -196,7 +196,7 @@ public:
assembleAdd(STPath const& base, STPathElement const& tail); assembleAdd(STPath const& base, STPathElement const& tail);
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(const STBase& t) const override;
bool bool
isDefault() const override; isDefault() const override;
@@ -375,7 +375,7 @@ STPathElement::getIssuerID() const
} }
inline bool inline bool
STPathElement::operator==(STPathElement const& t) const STPathElement::operator==(const STPathElement& t) const
{ {
return (mType & typeAccount) == (t.mType & typeAccount) && return (mType & typeAccount) == (t.mType & typeAccount) &&
hash_value_ == t.hash_value_ && mAccountID == t.mAccountID && hash_value_ == t.hash_value_ && mAccountID == t.mAccountID &&
@@ -383,7 +383,7 @@ STPathElement::operator==(STPathElement const& t) const
} }
inline bool inline bool
STPathElement::operator!=(STPathElement const& t) const STPathElement::operator!=(const STPathElement& t) const
{ {
return !operator==(t); return !operator==(t);
} }
@@ -455,7 +455,7 @@ STPath::operator[](int i)
return mPath[i]; return mPath[i];
} }
inline STPathElement const& inline const STPathElement&
STPath::operator[](int i) const STPath::operator[](int i) const
{ {
return mPath[i]; return mPath[i];

View File

@@ -102,6 +102,10 @@ public:
SeqProxy SeqProxy
getSeqProxy() const; getSeqProxy() const;
/** Returns the first non-zero value of (Sequence, TicketSequence). */
std::uint32_t
getSeqValue() const;
boost::container::flat_set<AccountID> boost::container::flat_set<AccountID>
getMentionedAccounts() const; getMentionedAccounts() const;

View File

@@ -50,7 +50,7 @@ public:
Json::Value getJson(JsonOptions) const override; Json::Value getJson(JsonOptions) const override;
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(const STBase& t) const override;
bool bool
isDefault() const override; isDefault() const override;
@@ -62,7 +62,7 @@ public:
operator=(std::vector<uint256>&& v); operator=(std::vector<uint256>&& v);
void void
setValue(STVector256 const& v); setValue(const STVector256& v);
/** Retrieve a copy of the vector we contain */ /** Retrieve a copy of the vector we contain */
explicit explicit
@@ -153,7 +153,7 @@ STVector256::operator=(std::vector<uint256>&& v)
} }
inline void inline void
STVector256::setValue(STVector256 const& v) STVector256::setValue(const STVector256& v)
{ {
mValue = v.mValue; mValue = v.mValue;
} }

View File

@@ -107,7 +107,7 @@ public:
add(Serializer& s) const override; add(Serializer& s) const override;
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(const STBase& t) const override;
bool bool
isDefault() const override; isDefault() const override;

View File

@@ -139,9 +139,9 @@ public:
int int
addRaw(Slice slice); addRaw(Slice slice);
int int
addRaw(void const* ptr, int len); addRaw(const void* ptr, int len);
int int
addRaw(Serializer const& s); addRaw(const Serializer& s);
int int
addVL(Blob const& vector); addVL(Blob const& vector);
@@ -151,7 +151,7 @@ public:
int int
addVL(Iter begin, Iter end, int len); addVL(Iter begin, Iter end, int len);
int int
addVL(void const* ptr, int len); addVL(const void* ptr, int len);
// disassemble functions // disassemble functions
bool bool
@@ -161,7 +161,7 @@ public:
bool bool
getInteger(Integer& number, int offset) getInteger(Integer& number, int offset)
{ {
static auto const bytes = sizeof(Integer); static const auto bytes = sizeof(Integer);
if ((offset + bytes) > mData.size()) if ((offset + bytes) > mData.size())
return false; return false;
number = 0; number = 0;
@@ -220,7 +220,7 @@ public:
{ {
return mData.size(); return mData.size();
} }
void const* const void*
getDataPtr() const getDataPtr() const
{ {
return mData.data(); return mData.data();
@@ -238,7 +238,7 @@ public:
std::string std::string
getString() const getString() const
{ {
return std::string(static_cast<char const*>(getDataPtr()), size()); return std::string(static_cast<const char*>(getDataPtr()), size());
} }
void void
erase() erase()
@@ -296,12 +296,12 @@ public:
return v != mData; return v != mData;
} }
bool bool
operator==(Serializer const& v) const operator==(const Serializer& v) const
{ {
return v.mData == mData; return v.mData == mData;
} }
bool bool
operator!=(Serializer const& v) const operator!=(const Serializer& v) const
{ {
return v.mData != mData; return v.mData != mData;
} }

View File

@@ -225,6 +225,8 @@ enum TERcodes : TERUnderlyingType {
terQUEUED, // Transaction is being held in TxQ until fee drops terQUEUED, // Transaction is being held in TxQ until fee drops
terPRE_TICKET, // Ticket is not yet in ledger but might be on its way terPRE_TICKET, // Ticket is not yet in ledger but might be on its way
terNO_AMM, // AMM doesn't exist for the asset pair terNO_AMM, // AMM doesn't exist for the asset pair
terADDRESS_COLLISION, // Failed to allocate AccountID when trying to
// create a pseudo-account
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -265,6 +267,17 @@ enum TECcodes : TERUnderlyingType {
// Otherwise, treated as terRETRY. // Otherwise, treated as terRETRY.
// //
// DO NOT CHANGE THESE NUMBERS: They appear in ledger meta data. // DO NOT CHANGE THESE NUMBERS: They appear in ledger meta data.
//
// Note:
// tecNO_ENTRY is often used interchangeably with tecOBJECT_NOT_FOUND.
// While there does not seem to be a clear rule which to use when, the
// following guidance will help to keep errors consistent with the
// majority of (but not all) transaction types:
// - tecNO_ENTRY : cannot find the primary ledger object on which the
// transaction is being attempted
// - tecOBJECT_NOT_FOUND : cannot find the additional object(s) needed to
// complete the transaction
tecCLAIM = 100, tecCLAIM = 100,
tecPATH_PARTIAL = 101, tecPATH_PARTIAL = 101,
tecUNFUNDED_ADD = 102, // Unused legacy code tecUNFUNDED_ADD = 102, // Unused legacy code
@@ -344,6 +357,9 @@ enum TECcodes : TERUnderlyingType {
tecARRAY_TOO_LARGE = 191, tecARRAY_TOO_LARGE = 191,
tecLOCKED = 192, tecLOCKED = 192,
tecBAD_CREDENTIALS = 193, tecBAD_CREDENTIALS = 193,
tecWRONG_ASSET = 194,
tecLIMIT_EXCEEDED = 195,
tecPSEUDO_ACCOUNT = 196,
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@@ -120,13 +120,6 @@ constexpr std::uint32_t tfTrustSetMask =
~(tfUniversal | tfSetfAuth | tfSetNoRipple | tfClearNoRipple | tfSetFreeze | ~(tfUniversal | tfSetfAuth | tfSetNoRipple | tfClearNoRipple | tfSetFreeze |
tfClearFreeze | tfSetDeepFreeze | tfClearDeepFreeze); tfClearFreeze | tfSetDeepFreeze | tfClearDeepFreeze);
// valid flags for granular permission
constexpr std::uint32_t tfTrustSetGranularMask = tfSetfAuth | tfSetFreeze | tfClearFreeze;
// bits representing supportedGranularMask are set to 0 and the bits
// representing other flags are set to 1 in tfPermissionMask.
constexpr std::uint32_t tfTrustSetPermissionMask = (~tfTrustSetMask) & (~tfTrustSetGranularMask);
// EnableAmendment flags: // EnableAmendment flags:
constexpr std::uint32_t tfGotMajority = 0x00010000; constexpr std::uint32_t tfGotMajority = 0x00010000;
constexpr std::uint32_t tfLostMajority = 0x00020000; constexpr std::uint32_t tfLostMajority = 0x00020000;
@@ -162,8 +155,6 @@ constexpr std::uint32_t const tfMPTokenAuthorizeMask = ~(tfUniversal | tfMPTUna
constexpr std::uint32_t const tfMPTLock = 0x00000001; constexpr std::uint32_t const tfMPTLock = 0x00000001;
constexpr std::uint32_t const tfMPTUnlock = 0x00000002; constexpr std::uint32_t const tfMPTUnlock = 0x00000002;
constexpr std::uint32_t const tfMPTokenIssuanceSetMask = ~(tfUniversal | tfMPTLock | tfMPTUnlock); constexpr std::uint32_t const tfMPTokenIssuanceSetMask = ~(tfUniversal | tfMPTLock | tfMPTUnlock);
constexpr std::uint32_t const tfMPTokenIssuanceSetGranularMask = tfMPTLock | tfMPTUnlock;
constexpr std::uint32_t const tfMPTokenIssuanceSetPermissionMask = (~tfMPTokenIssuanceSetMask) & (~tfMPTokenIssuanceSetGranularMask);
// MPTokenIssuanceDestroy flags: // MPTokenIssuanceDestroy flags:
constexpr std::uint32_t const tfMPTokenIssuanceDestroyMask = ~tfUniversal; constexpr std::uint32_t const tfMPTokenIssuanceDestroyMask = ~tfUniversal;
@@ -233,6 +224,15 @@ constexpr std::uint32_t tfAMMClawbackMask = ~(tfUniversal | tfClawTwoAssets);
// BridgeModify flags: // BridgeModify flags:
constexpr std::uint32_t tfClearAccountCreateAmount = 0x00010000; constexpr std::uint32_t tfClearAccountCreateAmount = 0x00010000;
constexpr std::uint32_t tfBridgeModifyMask = ~(tfUniversal | tfClearAccountCreateAmount); constexpr std::uint32_t tfBridgeModifyMask = ~(tfUniversal | tfClearAccountCreateAmount);
// VaultCreate flags:
constexpr std::uint32_t const tfVaultPrivate = 0x00010000;
static_assert(tfVaultPrivate == lsfVaultPrivate);
constexpr std::uint32_t const tfVaultShareNonTransferable = 0x00020000;
constexpr std::uint32_t const tfVaultCreateMask = ~(tfUniversal | tfVaultPrivate | tfVaultShareNonTransferable);
// VaultClawback flags:
constexpr std::uint32_t const tfVaultClawbackUnauth = 0x00010000;
constexpr std::uint32_t const tfVaultClawbackMask = ~(tfUniversal | tfVaultClawbackUnauth);
// clang-format on // clang-format on
} // namespace ripple } // namespace ripple

View File

@@ -59,7 +59,7 @@ enum TxType : std::uint16_t
#pragma push_macro("TRANSACTION") #pragma push_macro("TRANSACTION")
#undef TRANSACTION #undef TRANSACTION
#define TRANSACTION(tag, value, name, delegatable, fields) tag = value, #define TRANSACTION(tag, value, name, fields) tag = value,
#include <xrpl/protocol/detail/transactions.macro> #include <xrpl/protocol/detail/transactions.macro>

View File

@@ -61,7 +61,8 @@ using NodeID = base_uint<160, detail::NodeIDTag>;
/** MPTID is a 192-bit value representing MPT Issuance ID, /** MPTID is a 192-bit value representing MPT Issuance ID,
* which is a concatenation of a 32-bit sequence (big endian) * which is a concatenation of a 32-bit sequence (big endian)
* and a 160-bit account */ * and a 160-bit account */
using MPTID = base_uint<192>; // TODO - edhennis - Add a tag
using MPTID = uint192;
/** XRP currency. */ /** XRP currency. */
Currency const& Currency const&

View File

@@ -267,7 +267,7 @@ XRPAmount::decimalXRP() const
// Output XRPAmount as just the drops value. // Output XRPAmount as just the drops value.
template <class Char, class Traits> template <class Char, class Traits>
std::basic_ostream<Char, Traits>& std::basic_ostream<Char, Traits>&
operator<<(std::basic_ostream<Char, Traits>& os, XRPAmount const& q) operator<<(std::basic_ostream<Char, Traits>& os, const XRPAmount& q)
{ {
return os << q.drops(); return os << q.drops();
} }

View File

@@ -32,8 +32,7 @@
// If you add an amendment here, then do not forget to increment `numFeatures` // If you add an amendment here, then do not forget to increment `numFeatures`
// in include/xrpl/protocol/Feature.h. // in include/xrpl/protocol/Feature.h.
XRPL_FEATURE(PermissionDelegation, Supported::yes, VoteBehavior::DefaultNo) XRPL_FEATURE(SingleAssetVault, Supported::no, VoteBehavior::DefaultNo)
XRPL_FIX (PayChanCancelAfter, Supported::yes, VoteBehavior::DefaultNo)
// Check flags in Credential transactions // Check flags in Credential transactions
XRPL_FIX (InvalidTxFlags, Supported::yes, VoteBehavior::DefaultNo) XRPL_FIX (InvalidTxFlags, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (FrozenLPTokenTransfer, Supported::yes, VoteBehavior::DefaultNo) XRPL_FIX (FrozenLPTokenTransfer, Supported::yes, VoteBehavior::DefaultNo)

View File

@@ -165,7 +165,8 @@ LEDGER_ENTRY(ltACCOUNT_ROOT, 0x0061, AccountRoot, account, ({
{sfMintedNFTokens, soeDEFAULT}, {sfMintedNFTokens, soeDEFAULT},
{sfBurnedNFTokens, soeDEFAULT}, {sfBurnedNFTokens, soeDEFAULT},
{sfFirstNFTokenSequence, soeOPTIONAL}, {sfFirstNFTokenSequence, soeOPTIONAL},
{sfAMMID, soeOPTIONAL}, {sfAMMID, soeOPTIONAL}, // pseudo-account designator
{sfVaultID, soeOPTIONAL}, // pseudo-account designator
})) }))
/** A ledger object which contains a list of object identifiers. /** A ledger object which contains a list of object identifiers.
@@ -390,21 +391,6 @@ LEDGER_ENTRY(ltAMM, 0x0079, AMM, amm, ({
{sfPreviousTxnLgrSeq, soeOPTIONAL}, {sfPreviousTxnLgrSeq, soeOPTIONAL},
})) }))
/** A ledger object which tracks Oracle
\sa keylet::oracle
*/
LEDGER_ENTRY(ltORACLE, 0x0080, Oracle, oracle, ({
{sfOwner, soeREQUIRED},
{sfProvider, soeREQUIRED},
{sfPriceDataSeries, soeREQUIRED},
{sfAssetClass, soeREQUIRED},
{sfLastUpdateTime, soeREQUIRED},
{sfURI, soeOPTIONAL},
{sfOwnerNode, soeREQUIRED},
{sfPreviousTxnID, soeREQUIRED},
{sfPreviousTxnLgrSeq, soeREQUIRED},
}))
/** A ledger object which tracks MPTokenIssuance /** A ledger object which tracks MPTokenIssuance
\sa keylet::mptIssuance \sa keylet::mptIssuance
*/ */
@@ -419,6 +405,7 @@ LEDGER_ENTRY(ltMPTOKEN_ISSUANCE, 0x007e, MPTokenIssuance, mpt_issuance, ({
{sfMPTokenMetadata, soeOPTIONAL}, {sfMPTokenMetadata, soeOPTIONAL},
{sfPreviousTxnID, soeREQUIRED}, {sfPreviousTxnID, soeREQUIRED},
{sfPreviousTxnLgrSeq, soeREQUIRED}, {sfPreviousTxnLgrSeq, soeREQUIRED},
{sfDomainID, soeOPTIONAL},
})) }))
/** A ledger object which tracks MPToken /** A ledger object which tracks MPToken
@@ -433,6 +420,21 @@ LEDGER_ENTRY(ltMPTOKEN, 0x007f, MPToken, mptoken, ({
{sfPreviousTxnLgrSeq, soeREQUIRED}, {sfPreviousTxnLgrSeq, soeREQUIRED},
})) }))
/** A ledger object which tracks Oracle
\sa keylet::oracle
*/
LEDGER_ENTRY(ltORACLE, 0x0080, Oracle, oracle, ({
{sfOwner, soeREQUIRED},
{sfProvider, soeREQUIRED},
{sfPriceDataSeries, soeREQUIRED},
{sfAssetClass, soeREQUIRED},
{sfLastUpdateTime, soeREQUIRED},
{sfURI, soeOPTIONAL},
{sfOwnerNode, soeREQUIRED},
{sfPreviousTxnID, soeREQUIRED},
{sfPreviousTxnLgrSeq, soeREQUIRED},
}))
/** A ledger object which tracks Credential /** A ledger object which tracks Credential
\sa keylet::credential \sa keylet::credential
*/ */
@@ -460,16 +462,27 @@ LEDGER_ENTRY(ltPERMISSIONED_DOMAIN, 0x0082, PermissionedDomain, permissioned_dom
{sfPreviousTxnLgrSeq, soeREQUIRED}, {sfPreviousTxnLgrSeq, soeREQUIRED},
})) }))
/** A ledger object representing permissions an account has delegated to another account. /** A ledger object representing a single asset vault.
\sa keylet::delegate
\sa keylet::mptoken
*/ */
LEDGER_ENTRY(ltDELEGATE, 0x0083, Delegate, delegate, ({ LEDGER_ENTRY(ltVAULT, 0x0083, Vault, vault, ({
{sfAccount, soeREQUIRED},
{sfAuthorize, soeREQUIRED},
{sfPermissions, soeREQUIRED},
{sfOwnerNode, soeREQUIRED},
{sfPreviousTxnID, soeREQUIRED}, {sfPreviousTxnID, soeREQUIRED},
{sfPreviousTxnLgrSeq, soeREQUIRED}, {sfPreviousTxnLgrSeq, soeREQUIRED},
{sfSequence, soeREQUIRED},
{sfOwnerNode, soeREQUIRED},
{sfOwner, soeREQUIRED},
{sfAccount, soeREQUIRED},
{sfData, soeOPTIONAL},
{sfAsset, soeREQUIRED},
{sfAssetsTotal, soeREQUIRED},
{sfAssetsAvailable, soeREQUIRED},
{sfAssetsMaximum, soeDEFAULT},
{sfLossUnrealized, soeREQUIRED},
{sfShareMPTID, soeREQUIRED},
{sfWithdrawalPolicy, soeREQUIRED},
// no SharesTotal ever (use MPTIssuance.sfOutstandingAmount)
// no PermissionedDomainID ever (use MPTIssuance.sfDomainID)
})) }))
#undef EXPAND #undef EXPAND

View File

@@ -1,68 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2025 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#if !defined(PERMISSION)
#error "undefined macro: PERMISSION"
#endif
/**
* PERMISSION(name, type, txType, value)
*
* This macro defines a permission:
* name: the name of the permission.
* type: the GranularPermissionType enum.
* txType: the corresponding TxType for this permission.
* value: the uint32 numeric value for the enum type.
*/
/** This permission grants the delegated account the ability to authorize a trustline. */
PERMISSION(TrustlineAuthorize, ttTRUST_SET, 65537)
/** This permission grants the delegated account the ability to freeze a trustline. */
PERMISSION(TrustlineFreeze, ttTRUST_SET, 65538)
/** This permission grants the delegated account the ability to unfreeze a trustline. */
PERMISSION(TrustlineUnfreeze, ttTRUST_SET, 65539)
/** This permission grants the delegated account the ability to set Domain. */
PERMISSION(AccountDomainSet, ttACCOUNT_SET, 65540)
/** This permission grants the delegated account the ability to set EmailHashSet. */
PERMISSION(AccountEmailHashSet, ttACCOUNT_SET, 65541)
/** This permission grants the delegated account the ability to set MessageKey. */
PERMISSION(AccountMessageKeySet, ttACCOUNT_SET, 65542)
/** This permission grants the delegated account the ability to set TransferRate. */
PERMISSION(AccountTransferRateSet, ttACCOUNT_SET, 65543)
/** This permission grants the delegated account the ability to set TickSize. */
PERMISSION(AccountTickSizeSet, ttACCOUNT_SET, 65544)
/** This permission grants the delegated account the ability to mint payment, which means sending a payment for a currency where the sending account is the issuer. */
PERMISSION(PaymentMint, ttPAYMENT, 65545)
/** This permission grants the delegated account the ability to burn payment, which means sending a payment for a currency where the destination account is the issuer */
PERMISSION(PaymentBurn, ttPAYMENT, 65546)
/** This permission grants the delegated account the ability to lock MPToken. */
PERMISSION(MPTokenIssuanceLock, ttMPTOKEN_ISSUANCE_SET, 65547)
/** This permission grants the delegated account the ability to unlock MPToken. */
PERMISSION(MPTokenIssuanceUnlock, ttMPTOKEN_ISSUANCE_SET, 65548)

View File

@@ -42,6 +42,7 @@ TYPED_SFIELD(sfTickSize, UINT8, 16)
TYPED_SFIELD(sfUNLModifyDisabling, UINT8, 17) TYPED_SFIELD(sfUNLModifyDisabling, UINT8, 17)
TYPED_SFIELD(sfHookResult, UINT8, 18) TYPED_SFIELD(sfHookResult, UINT8, 18)
TYPED_SFIELD(sfWasLockingChainSend, UINT8, 19) TYPED_SFIELD(sfWasLockingChainSend, UINT8, 19)
TYPED_SFIELD(sfWithdrawalPolicy, UINT8, 20)
// 16-bit integers (common) // 16-bit integers (common)
TYPED_SFIELD(sfLedgerEntryType, UINT16, 1, SField::sMD_Never) TYPED_SFIELD(sfLedgerEntryType, UINT16, 1, SField::sMD_Never)
@@ -112,7 +113,6 @@ TYPED_SFIELD(sfEmitGeneration, UINT32, 46)
TYPED_SFIELD(sfVoteWeight, UINT32, 48) TYPED_SFIELD(sfVoteWeight, UINT32, 48)
TYPED_SFIELD(sfFirstNFTokenSequence, UINT32, 50) TYPED_SFIELD(sfFirstNFTokenSequence, UINT32, 50)
TYPED_SFIELD(sfOracleDocumentID, UINT32, 51) TYPED_SFIELD(sfOracleDocumentID, UINT32, 51)
TYPED_SFIELD(sfPermissionValue, UINT32, 52)
// 64-bit integers (common) // 64-bit integers (common)
TYPED_SFIELD(sfIndexNext, UINT64, 1) TYPED_SFIELD(sfIndexNext, UINT64, 1)
@@ -155,6 +155,7 @@ TYPED_SFIELD(sfTakerGetsIssuer, UINT160, 4)
// 192-bit (common) // 192-bit (common)
TYPED_SFIELD(sfMPTokenIssuanceID, UINT192, 1) TYPED_SFIELD(sfMPTokenIssuanceID, UINT192, 1)
TYPED_SFIELD(sfShareMPTID, UINT192, 2)
// 256-bit (common) // 256-bit (common)
TYPED_SFIELD(sfLedgerHash, UINT256, 1) TYPED_SFIELD(sfLedgerHash, UINT256, 1)
@@ -192,9 +193,14 @@ TYPED_SFIELD(sfHookHash, UINT256, 31)
TYPED_SFIELD(sfHookNamespace, UINT256, 32) TYPED_SFIELD(sfHookNamespace, UINT256, 32)
TYPED_SFIELD(sfHookSetTxnID, UINT256, 33) TYPED_SFIELD(sfHookSetTxnID, UINT256, 33)
TYPED_SFIELD(sfDomainID, UINT256, 34) TYPED_SFIELD(sfDomainID, UINT256, 34)
TYPED_SFIELD(sfVaultID, UINT256, 35)
// number (common) // number (common)
TYPED_SFIELD(sfNumber, NUMBER, 1) TYPED_SFIELD(sfNumber, NUMBER, 1)
TYPED_SFIELD(sfAssetsAvailable, NUMBER, 2)
TYPED_SFIELD(sfAssetsMaximum, NUMBER, 3)
TYPED_SFIELD(sfAssetsTotal, NUMBER, 4)
TYPED_SFIELD(sfLossUnrealized, NUMBER, 5)
// currency amount (common) // currency amount (common)
TYPED_SFIELD(sfAmount, AMOUNT, 1) TYPED_SFIELD(sfAmount, AMOUNT, 1)
@@ -279,7 +285,6 @@ TYPED_SFIELD(sfRegularKey, ACCOUNT, 8)
TYPED_SFIELD(sfNFTokenMinter, ACCOUNT, 9) TYPED_SFIELD(sfNFTokenMinter, ACCOUNT, 9)
TYPED_SFIELD(sfEmitCallback, ACCOUNT, 10) TYPED_SFIELD(sfEmitCallback, ACCOUNT, 10)
TYPED_SFIELD(sfHolder, ACCOUNT, 11) TYPED_SFIELD(sfHolder, ACCOUNT, 11)
TYPED_SFIELD(sfDelegate, ACCOUNT, 12)
// account (uncommon) // account (uncommon)
TYPED_SFIELD(sfHookAccount, ACCOUNT, 16) TYPED_SFIELD(sfHookAccount, ACCOUNT, 16)
@@ -329,7 +334,6 @@ UNTYPED_SFIELD(sfSignerEntry, OBJECT, 11)
UNTYPED_SFIELD(sfNFToken, OBJECT, 12) UNTYPED_SFIELD(sfNFToken, OBJECT, 12)
UNTYPED_SFIELD(sfEmitDetails, OBJECT, 13) UNTYPED_SFIELD(sfEmitDetails, OBJECT, 13)
UNTYPED_SFIELD(sfHook, OBJECT, 14) UNTYPED_SFIELD(sfHook, OBJECT, 14)
UNTYPED_SFIELD(sfPermission, OBJECT, 15)
// inner object (uncommon) // inner object (uncommon)
UNTYPED_SFIELD(sfSigner, OBJECT, 16) UNTYPED_SFIELD(sfSigner, OBJECT, 16)
@@ -380,4 +384,3 @@ UNTYPED_SFIELD(sfAuthAccounts, ARRAY, 25)
UNTYPED_SFIELD(sfAuthorizeCredentials, ARRAY, 26) UNTYPED_SFIELD(sfAuthorizeCredentials, ARRAY, 26)
UNTYPED_SFIELD(sfUnauthorizeCredentials, ARRAY, 27) UNTYPED_SFIELD(sfUnauthorizeCredentials, ARRAY, 27)
UNTYPED_SFIELD(sfAcceptedCredentials, ARRAY, 28) UNTYPED_SFIELD(sfAcceptedCredentials, ARRAY, 28)
UNTYPED_SFIELD(sfPermissions, ARRAY, 29)

View File

@@ -50,7 +50,7 @@ class TokenCodecErrcCategory : public std::error_category
{ {
public: public:
// Return a short descriptive name for the category // Return a short descriptive name for the category
virtual char const* virtual const char*
name() const noexcept override final name() const noexcept override final
{ {
return "TokenCodecError"; return "TokenCodecError";
@@ -86,7 +86,7 @@ public:
}; };
} // namespace detail } // namespace detail
inline ripple::detail::TokenCodecErrcCategory const& inline const ripple::detail::TokenCodecErrcCategory&
TokenCodecErrcCategory() TokenCodecErrcCategory()
{ {
static ripple::detail::TokenCodecErrcCategory c; static ripple::detail::TokenCodecErrcCategory c;

View File

@@ -22,14 +22,14 @@
#endif #endif
/** /**
* TRANSACTION(tag, value, name, delegatable, fields) * TRANSACTION(tag, value, name, fields)
* *
* You must define a transactor class in the `ripple` namespace named `name`, * You must define a transactor class in the `ripple` namespace named `name`,
* and include its header in `src/xrpld/app/tx/detail/applySteps.cpp`. * and include its header in `src/xrpld/app/tx/detail/applySteps.cpp`.
*/ */
/** This transaction type executes a payment. */ /** This transaction type executes a payment. */
TRANSACTION(ttPAYMENT, 0, Payment, Delegation::delegatable, ({ TRANSACTION(ttPAYMENT, 0, Payment, ({
{sfDestination, soeREQUIRED}, {sfDestination, soeREQUIRED},
{sfAmount, soeREQUIRED, soeMPTSupported}, {sfAmount, soeREQUIRED, soeMPTSupported},
{sfSendMax, soeOPTIONAL, soeMPTSupported}, {sfSendMax, soeOPTIONAL, soeMPTSupported},
@@ -41,7 +41,7 @@ TRANSACTION(ttPAYMENT, 0, Payment, Delegation::delegatable, ({
})) }))
/** This transaction type creates an escrow object. */ /** This transaction type creates an escrow object. */
TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate, Delegation::delegatable, ({ TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate, ({
{sfDestination, soeREQUIRED}, {sfDestination, soeREQUIRED},
{sfAmount, soeREQUIRED}, {sfAmount, soeREQUIRED},
{sfCondition, soeOPTIONAL}, {sfCondition, soeOPTIONAL},
@@ -51,7 +51,7 @@ TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate, Delegation::delegatable, ({
})) }))
/** This transaction type completes an existing escrow. */ /** This transaction type completes an existing escrow. */
TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish, Delegation::delegatable, ({ TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish, ({
{sfOwner, soeREQUIRED}, {sfOwner, soeREQUIRED},
{sfOfferSequence, soeREQUIRED}, {sfOfferSequence, soeREQUIRED},
{sfFulfillment, soeOPTIONAL}, {sfFulfillment, soeOPTIONAL},
@@ -61,7 +61,7 @@ TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish, Delegation::delegatable, ({
/** This transaction type adjusts various account settings. */ /** This transaction type adjusts various account settings. */
TRANSACTION(ttACCOUNT_SET, 3, AccountSet, Delegation::notDelegatable, ({ TRANSACTION(ttACCOUNT_SET, 3, AccountSet, ({
{sfEmailHash, soeOPTIONAL}, {sfEmailHash, soeOPTIONAL},
{sfWalletLocator, soeOPTIONAL}, {sfWalletLocator, soeOPTIONAL},
{sfWalletSize, soeOPTIONAL}, {sfWalletSize, soeOPTIONAL},
@@ -75,20 +75,20 @@ TRANSACTION(ttACCOUNT_SET, 3, AccountSet, Delegation::notDelegatable, ({
})) }))
/** This transaction type cancels an existing escrow. */ /** This transaction type cancels an existing escrow. */
TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel, Delegation::delegatable, ({ TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel, ({
{sfOwner, soeREQUIRED}, {sfOwner, soeREQUIRED},
{sfOfferSequence, soeREQUIRED}, {sfOfferSequence, soeREQUIRED},
})) }))
/** This transaction type sets or clears an account's "regular key". */ /** This transaction type sets or clears an account's "regular key". */
TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey, Delegation::notDelegatable, ({ TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey, ({
{sfRegularKey, soeOPTIONAL}, {sfRegularKey, soeOPTIONAL},
})) }))
// 6 deprecated // 6 deprecated
/** This transaction type creates an offer to trade one asset for another. */ /** This transaction type creates an offer to trade one asset for another. */
TRANSACTION(ttOFFER_CREATE, 7, OfferCreate, Delegation::delegatable, ({ TRANSACTION(ttOFFER_CREATE, 7, OfferCreate, ({
{sfTakerPays, soeREQUIRED}, {sfTakerPays, soeREQUIRED},
{sfTakerGets, soeREQUIRED}, {sfTakerGets, soeREQUIRED},
{sfExpiration, soeOPTIONAL}, {sfExpiration, soeOPTIONAL},
@@ -96,14 +96,14 @@ TRANSACTION(ttOFFER_CREATE, 7, OfferCreate, Delegation::delegatable, ({
})) }))
/** This transaction type cancels existing offers to trade one asset for another. */ /** This transaction type cancels existing offers to trade one asset for another. */
TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel, Delegation::delegatable, ({ TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel, ({
{sfOfferSequence, soeREQUIRED}, {sfOfferSequence, soeREQUIRED},
})) }))
// 9 deprecated // 9 deprecated
/** This transaction type creates a new set of tickets. */ /** This transaction type creates a new set of tickets. */
TRANSACTION(ttTICKET_CREATE, 10, TicketCreate, Delegation::delegatable, ({ TRANSACTION(ttTICKET_CREATE, 10, TicketCreate, ({
{sfTicketCount, soeREQUIRED}, {sfTicketCount, soeREQUIRED},
})) }))
@@ -112,13 +112,13 @@ TRANSACTION(ttTICKET_CREATE, 10, TicketCreate, Delegation::delegatable, ({
/** This transaction type modifies the signer list associated with an account. */ /** This transaction type modifies the signer list associated with an account. */
// The SignerEntries are optional because a SignerList is deleted by // The SignerEntries are optional because a SignerList is deleted by
// setting the SignerQuorum to zero and omitting SignerEntries. // setting the SignerQuorum to zero and omitting SignerEntries.
TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet, Delegation::notDelegatable, ({ TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet, ({
{sfSignerQuorum, soeREQUIRED}, {sfSignerQuorum, soeREQUIRED},
{sfSignerEntries, soeOPTIONAL}, {sfSignerEntries, soeOPTIONAL},
})) }))
/** This transaction type creates a new unidirectional XRP payment channel. */ /** This transaction type creates a new unidirectional XRP payment channel. */
TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate, Delegation::delegatable, ({ TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate, ({
{sfDestination, soeREQUIRED}, {sfDestination, soeREQUIRED},
{sfAmount, soeREQUIRED}, {sfAmount, soeREQUIRED},
{sfSettleDelay, soeREQUIRED}, {sfSettleDelay, soeREQUIRED},
@@ -128,14 +128,14 @@ TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate, Delegation::delegatable,
})) }))
/** This transaction type funds an existing unidirectional XRP payment channel. */ /** This transaction type funds an existing unidirectional XRP payment channel. */
TRANSACTION(ttPAYCHAN_FUND, 14, PaymentChannelFund, Delegation::delegatable, ({ TRANSACTION(ttPAYCHAN_FUND, 14, PaymentChannelFund, ({
{sfChannel, soeREQUIRED}, {sfChannel, soeREQUIRED},
{sfAmount, soeREQUIRED}, {sfAmount, soeREQUIRED},
{sfExpiration, soeOPTIONAL}, {sfExpiration, soeOPTIONAL},
})) }))
/** This transaction type submits a claim against an existing unidirectional payment channel. */ /** This transaction type submits a claim against an existing unidirectional payment channel. */
TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim, Delegation::delegatable, ({ TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim, ({
{sfChannel, soeREQUIRED}, {sfChannel, soeREQUIRED},
{sfAmount, soeOPTIONAL}, {sfAmount, soeOPTIONAL},
{sfBalance, soeOPTIONAL}, {sfBalance, soeOPTIONAL},
@@ -145,7 +145,7 @@ TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim, Delegation::delegatable, (
})) }))
/** This transaction type creates a new check. */ /** This transaction type creates a new check. */
TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, Delegation::delegatable, ({ TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, ({
{sfDestination, soeREQUIRED}, {sfDestination, soeREQUIRED},
{sfSendMax, soeREQUIRED}, {sfSendMax, soeREQUIRED},
{sfExpiration, soeOPTIONAL}, {sfExpiration, soeOPTIONAL},
@@ -154,19 +154,19 @@ TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, Delegation::delegatable, ({
})) }))
/** This transaction type cashes an existing check. */ /** This transaction type cashes an existing check. */
TRANSACTION(ttCHECK_CASH, 17, CheckCash, Delegation::delegatable, ({ TRANSACTION(ttCHECK_CASH, 17, CheckCash, ({
{sfCheckID, soeREQUIRED}, {sfCheckID, soeREQUIRED},
{sfAmount, soeOPTIONAL}, {sfAmount, soeOPTIONAL},
{sfDeliverMin, soeOPTIONAL}, {sfDeliverMin, soeOPTIONAL},
})) }))
/** This transaction type cancels an existing check. */ /** This transaction type cancels an existing check. */
TRANSACTION(ttCHECK_CANCEL, 18, CheckCancel, Delegation::delegatable, ({ TRANSACTION(ttCHECK_CANCEL, 18, CheckCancel, ({
{sfCheckID, soeREQUIRED}, {sfCheckID, soeREQUIRED},
})) }))
/** This transaction type grants or revokes authorization to transfer funds. */ /** This transaction type grants or revokes authorization to transfer funds. */
TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth, Delegation::delegatable, ({ TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth, ({
{sfAuthorize, soeOPTIONAL}, {sfAuthorize, soeOPTIONAL},
{sfUnauthorize, soeOPTIONAL}, {sfUnauthorize, soeOPTIONAL},
{sfAuthorizeCredentials, soeOPTIONAL}, {sfAuthorizeCredentials, soeOPTIONAL},
@@ -174,14 +174,14 @@ TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth, Delegation::delegatable, ({
})) }))
/** This transaction type modifies a trustline between two accounts. */ /** This transaction type modifies a trustline between two accounts. */
TRANSACTION(ttTRUST_SET, 20, TrustSet, Delegation::delegatable, ({ TRANSACTION(ttTRUST_SET, 20, TrustSet, ({
{sfLimitAmount, soeOPTIONAL}, {sfLimitAmount, soeOPTIONAL},
{sfQualityIn, soeOPTIONAL}, {sfQualityIn, soeOPTIONAL},
{sfQualityOut, soeOPTIONAL}, {sfQualityOut, soeOPTIONAL},
})) }))
/** This transaction type deletes an existing account. */ /** This transaction type deletes an existing account. */
TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete, Delegation::notDelegatable, ({ TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete, ({
{sfDestination, soeREQUIRED}, {sfDestination, soeREQUIRED},
{sfDestinationTag, soeOPTIONAL}, {sfDestinationTag, soeOPTIONAL},
{sfCredentialIDs, soeOPTIONAL}, {sfCredentialIDs, soeOPTIONAL},
@@ -190,7 +190,7 @@ TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete, Delegation::notDelegatable, ({
// 22 reserved // 22 reserved
/** This transaction mints a new NFT. */ /** This transaction mints a new NFT. */
TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint, Delegation::delegatable, ({ TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint, ({
{sfNFTokenTaxon, soeREQUIRED}, {sfNFTokenTaxon, soeREQUIRED},
{sfTransferFee, soeOPTIONAL}, {sfTransferFee, soeOPTIONAL},
{sfIssuer, soeOPTIONAL}, {sfIssuer, soeOPTIONAL},
@@ -201,13 +201,13 @@ TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint, Delegation::delegatable, ({
})) }))
/** This transaction burns (i.e. destroys) an existing NFT. */ /** This transaction burns (i.e. destroys) an existing NFT. */
TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn, Delegation::delegatable, ({ TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn, ({
{sfNFTokenID, soeREQUIRED}, {sfNFTokenID, soeREQUIRED},
{sfOwner, soeOPTIONAL}, {sfOwner, soeOPTIONAL},
})) }))
/** This transaction creates a new offer to buy or sell an NFT. */ /** This transaction creates a new offer to buy or sell an NFT. */
TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer, Delegation::delegatable, ({ TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer, ({
{sfNFTokenID, soeREQUIRED}, {sfNFTokenID, soeREQUIRED},
{sfAmount, soeREQUIRED}, {sfAmount, soeREQUIRED},
{sfDestination, soeOPTIONAL}, {sfDestination, soeOPTIONAL},
@@ -216,25 +216,25 @@ TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer, Delegation::delegata
})) }))
/** This transaction cancels an existing offer to buy or sell an existing NFT. */ /** This transaction cancels an existing offer to buy or sell an existing NFT. */
TRANSACTION(ttNFTOKEN_CANCEL_OFFER, 28, NFTokenCancelOffer, Delegation::delegatable, ({ TRANSACTION(ttNFTOKEN_CANCEL_OFFER, 28, NFTokenCancelOffer, ({
{sfNFTokenOffers, soeREQUIRED}, {sfNFTokenOffers, soeREQUIRED},
})) }))
/** This transaction accepts an existing offer to buy or sell an existing NFT. */ /** This transaction accepts an existing offer to buy or sell an existing NFT. */
TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer, Delegation::delegatable, ({ TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer, ({
{sfNFTokenBuyOffer, soeOPTIONAL}, {sfNFTokenBuyOffer, soeOPTIONAL},
{sfNFTokenSellOffer, soeOPTIONAL}, {sfNFTokenSellOffer, soeOPTIONAL},
{sfNFTokenBrokerFee, soeOPTIONAL}, {sfNFTokenBrokerFee, soeOPTIONAL},
})) }))
/** This transaction claws back issued tokens. */ /** This transaction claws back issued tokens. */
TRANSACTION(ttCLAWBACK, 30, Clawback, Delegation::delegatable, ({ TRANSACTION(ttCLAWBACK, 30, Clawback, ({
{sfAmount, soeREQUIRED, soeMPTSupported}, {sfAmount, soeREQUIRED, soeMPTSupported},
{sfHolder, soeOPTIONAL}, {sfHolder, soeOPTIONAL},
})) }))
/** This transaction claws back tokens from an AMM pool. */ /** This transaction claws back tokens from an AMM pool. */
TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback, Delegation::delegatable, ({ TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback, ({
{sfHolder, soeREQUIRED}, {sfHolder, soeREQUIRED},
{sfAsset, soeREQUIRED}, {sfAsset, soeREQUIRED},
{sfAsset2, soeREQUIRED}, {sfAsset2, soeREQUIRED},
@@ -242,14 +242,14 @@ TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback, Delegation::delegatable, ({
})) }))
/** This transaction type creates an AMM instance */ /** This transaction type creates an AMM instance */
TRANSACTION(ttAMM_CREATE, 35, AMMCreate, Delegation::delegatable, ({ TRANSACTION(ttAMM_CREATE, 35, AMMCreate, ({
{sfAmount, soeREQUIRED}, {sfAmount, soeREQUIRED},
{sfAmount2, soeREQUIRED}, {sfAmount2, soeREQUIRED},
{sfTradingFee, soeREQUIRED}, {sfTradingFee, soeREQUIRED},
})) }))
/** This transaction type deposits into an AMM instance */ /** This transaction type deposits into an AMM instance */
TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit, Delegation::delegatable, ({ TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit, ({
{sfAsset, soeREQUIRED}, {sfAsset, soeREQUIRED},
{sfAsset2, soeREQUIRED}, {sfAsset2, soeREQUIRED},
{sfAmount, soeOPTIONAL}, {sfAmount, soeOPTIONAL},
@@ -260,7 +260,7 @@ TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit, Delegation::delegatable, ({
})) }))
/** This transaction type withdraws from an AMM instance */ /** This transaction type withdraws from an AMM instance */
TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw, Delegation::delegatable, ({ TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw, ({
{sfAsset, soeREQUIRED}, {sfAsset, soeREQUIRED},
{sfAsset2, soeREQUIRED}, {sfAsset2, soeREQUIRED},
{sfAmount, soeOPTIONAL}, {sfAmount, soeOPTIONAL},
@@ -270,14 +270,14 @@ TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw, Delegation::delegatable, ({
})) }))
/** This transaction type votes for the trading fee */ /** This transaction type votes for the trading fee */
TRANSACTION(ttAMM_VOTE, 38, AMMVote, Delegation::delegatable, ({ TRANSACTION(ttAMM_VOTE, 38, AMMVote, ({
{sfAsset, soeREQUIRED}, {sfAsset, soeREQUIRED},
{sfAsset2, soeREQUIRED}, {sfAsset2, soeREQUIRED},
{sfTradingFee, soeREQUIRED}, {sfTradingFee, soeREQUIRED},
})) }))
/** This transaction type bids for the auction slot */ /** This transaction type bids for the auction slot */
TRANSACTION(ttAMM_BID, 39, AMMBid, Delegation::delegatable, ({ TRANSACTION(ttAMM_BID, 39, AMMBid, ({
{sfAsset, soeREQUIRED}, {sfAsset, soeREQUIRED},
{sfAsset2, soeREQUIRED}, {sfAsset2, soeREQUIRED},
{sfBidMin, soeOPTIONAL}, {sfBidMin, soeOPTIONAL},
@@ -286,20 +286,20 @@ TRANSACTION(ttAMM_BID, 39, AMMBid, Delegation::delegatable, ({
})) }))
/** This transaction type deletes AMM in the empty state */ /** This transaction type deletes AMM in the empty state */
TRANSACTION(ttAMM_DELETE, 40, AMMDelete, Delegation::delegatable, ({ TRANSACTION(ttAMM_DELETE, 40, AMMDelete, ({
{sfAsset, soeREQUIRED}, {sfAsset, soeREQUIRED},
{sfAsset2, soeREQUIRED}, {sfAsset2, soeREQUIRED},
})) }))
/** This transactions creates a crosschain sequence number */ /** This transactions creates a crosschain sequence number */
TRANSACTION(ttXCHAIN_CREATE_CLAIM_ID, 41, XChainCreateClaimID, Delegation::delegatable, ({ TRANSACTION(ttXCHAIN_CREATE_CLAIM_ID, 41, XChainCreateClaimID, ({
{sfXChainBridge, soeREQUIRED}, {sfXChainBridge, soeREQUIRED},
{sfSignatureReward, soeREQUIRED}, {sfSignatureReward, soeREQUIRED},
{sfOtherChainSource, soeREQUIRED}, {sfOtherChainSource, soeREQUIRED},
})) }))
/** This transactions initiates a crosschain transaction */ /** This transactions initiates a crosschain transaction */
TRANSACTION(ttXCHAIN_COMMIT, 42, XChainCommit, Delegation::delegatable, ({ TRANSACTION(ttXCHAIN_COMMIT, 42, XChainCommit, ({
{sfXChainBridge, soeREQUIRED}, {sfXChainBridge, soeREQUIRED},
{sfXChainClaimID, soeREQUIRED}, {sfXChainClaimID, soeREQUIRED},
{sfAmount, soeREQUIRED}, {sfAmount, soeREQUIRED},
@@ -307,7 +307,7 @@ TRANSACTION(ttXCHAIN_COMMIT, 42, XChainCommit, Delegation::delegatable, ({
})) }))
/** This transaction completes a crosschain transaction */ /** This transaction completes a crosschain transaction */
TRANSACTION(ttXCHAIN_CLAIM, 43, XChainClaim, Delegation::delegatable, ({ TRANSACTION(ttXCHAIN_CLAIM, 43, XChainClaim, ({
{sfXChainBridge, soeREQUIRED}, {sfXChainBridge, soeREQUIRED},
{sfXChainClaimID, soeREQUIRED}, {sfXChainClaimID, soeREQUIRED},
{sfDestination, soeREQUIRED}, {sfDestination, soeREQUIRED},
@@ -316,7 +316,7 @@ TRANSACTION(ttXCHAIN_CLAIM, 43, XChainClaim, Delegation::delegatable, ({
})) }))
/** This transaction initiates a crosschain account create transaction */ /** This transaction initiates a crosschain account create transaction */
TRANSACTION(ttXCHAIN_ACCOUNT_CREATE_COMMIT, 44, XChainAccountCreateCommit, Delegation::delegatable, ({ TRANSACTION(ttXCHAIN_ACCOUNT_CREATE_COMMIT, 44, XChainAccountCreateCommit, ({
{sfXChainBridge, soeREQUIRED}, {sfXChainBridge, soeREQUIRED},
{sfDestination, soeREQUIRED}, {sfDestination, soeREQUIRED},
{sfAmount, soeREQUIRED}, {sfAmount, soeREQUIRED},
@@ -324,7 +324,7 @@ TRANSACTION(ttXCHAIN_ACCOUNT_CREATE_COMMIT, 44, XChainAccountCreateCommit, Deleg
})) }))
/** This transaction adds an attestation to a claim */ /** This transaction adds an attestation to a claim */
TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation, Delegation::delegatable, ({ TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation, ({
{sfXChainBridge, soeREQUIRED}, {sfXChainBridge, soeREQUIRED},
{sfAttestationSignerAccount, soeREQUIRED}, {sfAttestationSignerAccount, soeREQUIRED},
@@ -340,7 +340,7 @@ TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation, Deleg
})) }))
/** This transaction adds an attestation to an account */ /** This transaction adds an attestation to an account */
TRANSACTION(ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION, 46, XChainAddAccountCreateAttestation, Delegation::delegatable, ({ TRANSACTION(ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION, 46, XChainAddAccountCreateAttestation, ({
{sfXChainBridge, soeREQUIRED}, {sfXChainBridge, soeREQUIRED},
{sfAttestationSignerAccount, soeREQUIRED}, {sfAttestationSignerAccount, soeREQUIRED},
@@ -357,31 +357,31 @@ TRANSACTION(ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION, 46, XChainAddAccountCreateA
})) }))
/** This transaction modifies a sidechain */ /** This transaction modifies a sidechain */
TRANSACTION(ttXCHAIN_MODIFY_BRIDGE, 47, XChainModifyBridge, Delegation::delegatable, ({ TRANSACTION(ttXCHAIN_MODIFY_BRIDGE, 47, XChainModifyBridge, ({
{sfXChainBridge, soeREQUIRED}, {sfXChainBridge, soeREQUIRED},
{sfSignatureReward, soeOPTIONAL}, {sfSignatureReward, soeOPTIONAL},
{sfMinAccountCreateAmount, soeOPTIONAL}, {sfMinAccountCreateAmount, soeOPTIONAL},
})) }))
/** This transactions creates a sidechain */ /** This transactions creates a sidechain */
TRANSACTION(ttXCHAIN_CREATE_BRIDGE, 48, XChainCreateBridge, Delegation::delegatable, ({ TRANSACTION(ttXCHAIN_CREATE_BRIDGE, 48, XChainCreateBridge, ({
{sfXChainBridge, soeREQUIRED}, {sfXChainBridge, soeREQUIRED},
{sfSignatureReward, soeREQUIRED}, {sfSignatureReward, soeREQUIRED},
{sfMinAccountCreateAmount, soeOPTIONAL}, {sfMinAccountCreateAmount, soeOPTIONAL},
})) }))
/** This transaction type creates or updates a DID */ /** This transaction type creates or updates a DID */
TRANSACTION(ttDID_SET, 49, DIDSet, Delegation::delegatable, ({ TRANSACTION(ttDID_SET, 49, DIDSet, ({
{sfDIDDocument, soeOPTIONAL}, {sfDIDDocument, soeOPTIONAL},
{sfURI, soeOPTIONAL}, {sfURI, soeOPTIONAL},
{sfData, soeOPTIONAL}, {sfData, soeOPTIONAL},
})) }))
/** This transaction type deletes a DID */ /** This transaction type deletes a DID */
TRANSACTION(ttDID_DELETE, 50, DIDDelete, Delegation::delegatable, ({})) TRANSACTION(ttDID_DELETE, 50, DIDDelete, ({}))
/** This transaction type creates an Oracle instance */ /** This transaction type creates an Oracle instance */
TRANSACTION(ttORACLE_SET, 51, OracleSet, Delegation::delegatable, ({ TRANSACTION(ttORACLE_SET, 51, OracleSet, ({
{sfOracleDocumentID, soeREQUIRED}, {sfOracleDocumentID, soeREQUIRED},
{sfProvider, soeOPTIONAL}, {sfProvider, soeOPTIONAL},
{sfURI, soeOPTIONAL}, {sfURI, soeOPTIONAL},
@@ -391,18 +391,18 @@ TRANSACTION(ttORACLE_SET, 51, OracleSet, Delegation::delegatable, ({
})) }))
/** This transaction type deletes an Oracle instance */ /** This transaction type deletes an Oracle instance */
TRANSACTION(ttORACLE_DELETE, 52, OracleDelete, Delegation::delegatable, ({ TRANSACTION(ttORACLE_DELETE, 52, OracleDelete, ({
{sfOracleDocumentID, soeREQUIRED}, {sfOracleDocumentID, soeREQUIRED},
})) }))
/** This transaction type fixes a problem in the ledger state */ /** This transaction type fixes a problem in the ledger state */
TRANSACTION(ttLEDGER_STATE_FIX, 53, LedgerStateFix, Delegation::delegatable, ({ TRANSACTION(ttLEDGER_STATE_FIX, 53, LedgerStateFix, ({
{sfLedgerFixType, soeREQUIRED}, {sfLedgerFixType, soeREQUIRED},
{sfOwner, soeOPTIONAL}, {sfOwner, soeOPTIONAL},
})) }))
/** This transaction type creates a MPTokensIssuance instance */ /** This transaction type creates a MPTokensIssuance instance */
TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate, Delegation::delegatable, ({ TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate, ({
{sfAssetScale, soeOPTIONAL}, {sfAssetScale, soeOPTIONAL},
{sfTransferFee, soeOPTIONAL}, {sfTransferFee, soeOPTIONAL},
{sfMaximumAmount, soeOPTIONAL}, {sfMaximumAmount, soeOPTIONAL},
@@ -410,24 +410,24 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate, Delegation::de
})) }))
/** This transaction type destroys a MPTokensIssuance instance */ /** This transaction type destroys a MPTokensIssuance instance */
TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy, Delegation::delegatable, ({ TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy, ({
{sfMPTokenIssuanceID, soeREQUIRED}, {sfMPTokenIssuanceID, soeREQUIRED},
})) }))
/** This transaction type sets flags on a MPTokensIssuance or MPToken instance */ /** This transaction type sets flags on a MPTokensIssuance or MPToken instance */
TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet, Delegation::delegatable, ({ TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet, ({
{sfMPTokenIssuanceID, soeREQUIRED}, {sfMPTokenIssuanceID, soeREQUIRED},
{sfHolder, soeOPTIONAL}, {sfHolder, soeOPTIONAL},
})) }))
/** This transaction type authorizes a MPToken instance */ /** This transaction type authorizes a MPToken instance */
TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize, Delegation::delegatable, ({ TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize, ({
{sfMPTokenIssuanceID, soeREQUIRED}, {sfMPTokenIssuanceID, soeREQUIRED},
{sfHolder, soeOPTIONAL}, {sfHolder, soeOPTIONAL},
})) }))
/** This transaction type create an Credential instance */ /** This transaction type create an Credential instance */
TRANSACTION(ttCREDENTIAL_CREATE, 58, CredentialCreate, Delegation::delegatable, ({ TRANSACTION(ttCREDENTIAL_CREATE, 58, CredentialCreate, ({
{sfSubject, soeREQUIRED}, {sfSubject, soeREQUIRED},
{sfCredentialType, soeREQUIRED}, {sfCredentialType, soeREQUIRED},
{sfExpiration, soeOPTIONAL}, {sfExpiration, soeOPTIONAL},
@@ -435,47 +435,84 @@ TRANSACTION(ttCREDENTIAL_CREATE, 58, CredentialCreate, Delegation::delegatable,
})) }))
/** This transaction type accept an Credential object */ /** This transaction type accept an Credential object */
TRANSACTION(ttCREDENTIAL_ACCEPT, 59, CredentialAccept, Delegation::delegatable, ({ TRANSACTION(ttCREDENTIAL_ACCEPT, 59, CredentialAccept, ({
{sfIssuer, soeREQUIRED}, {sfIssuer, soeREQUIRED},
{sfCredentialType, soeREQUIRED}, {sfCredentialType, soeREQUIRED},
})) }))
/** This transaction type delete an Credential object */ /** This transaction type delete an Credential object */
TRANSACTION(ttCREDENTIAL_DELETE, 60, CredentialDelete, Delegation::delegatable, ({ TRANSACTION(ttCREDENTIAL_DELETE, 60, CredentialDelete, ({
{sfSubject, soeOPTIONAL}, {sfSubject, soeOPTIONAL},
{sfIssuer, soeOPTIONAL}, {sfIssuer, soeOPTIONAL},
{sfCredentialType, soeREQUIRED}, {sfCredentialType, soeREQUIRED},
})) }))
/** This transaction type modify a NFToken */ /** This transaction type modify a NFToken */
TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify, Delegation::delegatable, ({ TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify, ({
{sfNFTokenID, soeREQUIRED}, {sfNFTokenID, soeREQUIRED},
{sfOwner, soeOPTIONAL}, {sfOwner, soeOPTIONAL},
{sfURI, soeOPTIONAL}, {sfURI, soeOPTIONAL},
})) }))
/** This transaction type creates or modifies a Permissioned Domain */ /** This transaction type creates or modifies a Permissioned Domain */
TRANSACTION(ttPERMISSIONED_DOMAIN_SET, 62, PermissionedDomainSet, Delegation::delegatable, ({ TRANSACTION(ttPERMISSIONED_DOMAIN_SET, 62, PermissionedDomainSet, ({
{sfDomainID, soeOPTIONAL}, {sfDomainID, soeOPTIONAL},
{sfAcceptedCredentials, soeREQUIRED}, {sfAcceptedCredentials, soeREQUIRED},
})) }))
/** This transaction type deletes a Permissioned Domain */ /** This transaction type deletes a Permissioned Domain */
TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 63, PermissionedDomainDelete, Delegation::delegatable, ({ TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 63, PermissionedDomainDelete, ({
{sfDomainID, soeREQUIRED}, {sfDomainID, soeREQUIRED},
})) }))
/** This transaction type delegates authorized account specified permissions */ /** This transaction creates a single asset vault. */
TRANSACTION(ttDELEGATE_SET, 64, DelegateSet, Delegation::notDelegatable, ({ TRANSACTION(ttVAULT_CREATE, 64, VaultCreate, ({
{sfAuthorize, soeREQUIRED}, {sfAsset, soeREQUIRED, soeMPTSupported},
{sfPermissions, soeREQUIRED}, {sfAssetsMaximum, soeOPTIONAL},
{sfMPTokenMetadata, soeOPTIONAL},
{sfDomainID, soeOPTIONAL}, // PermissionedDomainID
{sfWithdrawalPolicy, soeOPTIONAL},
{sfData, soeOPTIONAL},
}))
/** This transaction updates a single asset vault. */
TRANSACTION(ttVAULT_SET, 65, VaultSet, ({
{sfVaultID, soeREQUIRED},
{sfAssetsMaximum, soeOPTIONAL},
{sfDomainID, soeOPTIONAL}, // PermissionedDomainID
{sfData, soeOPTIONAL},
}))
/** This transaction deletes a single asset vault. */
TRANSACTION(ttVAULT_DELETE, 66, VaultDelete, ({
{sfVaultID, soeREQUIRED},
}))
/** This transaction trades assets for shares with a vault. */
TRANSACTION(ttVAULT_DEPOSIT, 67, VaultDeposit, ({
{sfVaultID, soeREQUIRED},
{sfAmount, soeREQUIRED, soeMPTSupported},
}))
/** This transaction trades shares for assets with a vault. */
TRANSACTION(ttVAULT_WITHDRAW, 68, VaultWithdraw, ({
{sfVaultID, soeREQUIRED},
{sfAmount, soeREQUIRED, soeMPTSupported},
{sfDestination, soeOPTIONAL},
}))
/** This transaction claws back tokens from a vault. */
TRANSACTION(ttVAULT_CLAWBACK, 69, VaultClawback, ({
{sfVaultID, soeREQUIRED},
{sfHolder, soeREQUIRED},
{sfAmount, soeOPTIONAL, soeMPTSupported},
})) }))
/** This system-generated transaction type is used to update the status of the various amendments. /** This system-generated transaction type is used to update the status of the various amendments.
For details, see: https://xrpl.org/amendments.html For details, see: https://xrpl.org/amendments.html
*/ */
TRANSACTION(ttAMENDMENT, 100, EnableAmendment, Delegation::notDelegatable, ({ TRANSACTION(ttAMENDMENT, 100, EnableAmendment, ({
{sfLedgerSequence, soeREQUIRED}, {sfLedgerSequence, soeREQUIRED},
{sfAmendment, soeREQUIRED}, {sfAmendment, soeREQUIRED},
})) }))
@@ -483,7 +520,7 @@ TRANSACTION(ttAMENDMENT, 100, EnableAmendment, Delegation::notDelegatable, ({
/** This system-generated transaction type is used to update the network's fee settings. /** This system-generated transaction type is used to update the network's fee settings.
For details, see: https://xrpl.org/fee-voting.html For details, see: https://xrpl.org/fee-voting.html
*/ */
TRANSACTION(ttFEE, 101, SetFee, Delegation::notDelegatable, ({ TRANSACTION(ttFEE, 101, SetFee, ({
{sfLedgerSequence, soeOPTIONAL}, {sfLedgerSequence, soeOPTIONAL},
// Old version uses raw numbers // Old version uses raw numbers
{sfBaseFee, soeOPTIONAL}, {sfBaseFee, soeOPTIONAL},
@@ -500,7 +537,7 @@ TRANSACTION(ttFEE, 101, SetFee, Delegation::notDelegatable, ({
For details, see: https://xrpl.org/negative-unl.html For details, see: https://xrpl.org/negative-unl.html
*/ */
TRANSACTION(ttUNL_MODIFY, 102, UNLModify, Delegation::notDelegatable, ({ TRANSACTION(ttUNL_MODIFY, 102, UNLModify, ({
{sfUNLModifyDisabling, soeREQUIRED}, {sfUNLModifyDisabling, soeREQUIRED},
{sfLedgerSequence, soeREQUIRED}, {sfLedgerSequence, soeREQUIRED},
{sfUNLModifyValidator, soeREQUIRED}, {sfUNLModifyValidator, soeREQUIRED},

View File

@@ -20,7 +20,7 @@ struct JsonMissingKeyError : std::exception
JsonMissingKeyError(Json::StaticString const& k) : key{k.c_str()} JsonMissingKeyError(Json::StaticString const& k) : key{k.c_str()}
{ {
} }
char const* const char*
what() const noexcept override what() const noexcept override
{ {
if (msg.empty()) if (msg.empty())
@@ -40,7 +40,7 @@ struct JsonTypeMismatchError : std::exception
: key{k.c_str()}, expectedType{std::move(et)} : key{k.c_str()}, expectedType{std::move(et)}
{ {
} }
char const* const char*
what() const noexcept override what() const noexcept override
{ {
if (msg.empty()) if (msg.empty())

View File

@@ -89,17 +89,19 @@ JSS(SettleDelay); // in: TransactionSign
JSS(SendMax); // in: TransactionSign JSS(SendMax); // in: TransactionSign
JSS(Sequence); // in/out: TransactionSign; field. JSS(Sequence); // in/out: TransactionSign; field.
JSS(SetFlag); // field. JSS(SetFlag); // field.
JSS(SharesTotal); // out: Vault
JSS(Signer); // field. JSS(Signer); // field.
JSS(Signers); // field. JSS(Signers); // field.
JSS(SigningPubKey); // field. JSS(SigningPubKey); // field.
JSS(Subject); // in: Credential transactions JSS(Subject); // in: Credential transactions
JSS(TakerGets); // field. JSS(TakerGets); // field.
JSS(TakerPays); // field. JSS(TakerPays); // field.
JSS(TxnSignature); // field.
JSS(TradingFee); // in/out: AMM trading fee JSS(TradingFee); // in/out: AMM trading fee
JSS(TransactionType); // in: TransactionSign. JSS(TransactionType); // in: TransactionSign.
JSS(TransferRate); // in: TransferRate. JSS(TransferRate); // in: TransferRate.
JSS(TxnSignature); // field.
JSS(URI); // field. JSS(URI); // field.
JSS(VaultID); // field.
JSS(VoteSlots); // out: AMM Vote JSS(VoteSlots); // out: AMM Vote
JSS(aborted); // out: InboundLedger JSS(aborted); // out: InboundLedger
JSS(accepted); // out: LedgerToJson, OwnerInfo, SubmitTransaction JSS(accepted); // out: LedgerToJson, OwnerInfo, SubmitTransaction
@@ -145,7 +147,6 @@ JSS(attestations);
JSS(attestation_reward_account); JSS(attestation_reward_account);
JSS(auction_slot); // out: amm_info JSS(auction_slot); // out: amm_info
JSS(authorized); // out: AccountLines JSS(authorized); // out: AccountLines
JSS(authorize); // out: delegate
JSS(authorized_credentials); // in: ledger_entry DepositPreauth JSS(authorized_credentials); // in: ledger_entry DepositPreauth
JSS(auth_accounts); // out: amm_info JSS(auth_accounts); // out: amm_info
JSS(auth_change); // out: AccountInfo JSS(auth_change); // out: AccountInfo
@@ -449,6 +450,7 @@ JSS(node_reads_hit); // out: GetCounts
JSS(node_reads_total); // out: GetCounts JSS(node_reads_total); // out: GetCounts
JSS(node_reads_duration_us); // out: GetCounts JSS(node_reads_duration_us); // out: GetCounts
JSS(node_size); // out: server_info JSS(node_size); // out: server_info
JSS(nodes); // out: VaultInfo
JSS(nodestore); // out: GetCounts JSS(nodestore); // out: GetCounts
JSS(node_writes); // out: GetCounts JSS(node_writes); // out: GetCounts
JSS(node_written_bytes); // out: GetCounts JSS(node_written_bytes); // out: GetCounts
@@ -559,6 +561,7 @@ JSS(server_status); // out: NetworkOPs
JSS(server_version); // out: NetworkOPs JSS(server_version); // out: NetworkOPs
JSS(settle_delay); // out: AccountChannels JSS(settle_delay); // out: AccountChannels
JSS(severity); // in: LogLevel JSS(severity); // in: LogLevel
JSS(shares); // out: VaultInfo
JSS(signature); // out: NetworkOPs, ChannelAuthorize JSS(signature); // out: NetworkOPs, ChannelAuthorize
JSS(signature_verified); // out: ChannelVerify JSS(signature_verified); // out: ChannelVerify
JSS(signing_key); // out: NetworkOPs JSS(signing_key); // out: NetworkOPs
@@ -700,7 +703,7 @@ JSS(write_load); // out: GetCounts
#pragma push_macro("TRANSACTION") #pragma push_macro("TRANSACTION")
#undef TRANSACTION #undef TRANSACTION
#define TRANSACTION(tag, value, name, delegatable, fields) JSS(name); #define TRANSACTION(tag, value, name, fields) JSS(name);
#include <xrpl/protocol/detail/transactions.macro> #include <xrpl/protocol/detail/transactions.macro>
@@ -727,6 +730,8 @@ JSS(write_load); // out: GetCounts
#undef JSS #undef JSS
// clang-format on
} // namespace jss } // namespace jss
} // namespace ripple } // namespace ripple

View File

@@ -94,7 +94,7 @@ extractTarLz4(
if (archive_entry_size(entry) > 0) if (archive_entry_size(entry) > 0)
{ {
void const* buf; const void* buf;
size_t sz; size_t sz;
la_int64_t offset; la_int64_t offset;
while (true) while (true)

View File

@@ -63,7 +63,7 @@ getFileContents(
return {}; return {};
} }
std::string const result{ const std::string result{
std::istreambuf_iterator<char>{fileStream}, std::istreambuf_iterator<char>{fileStream},
std::istreambuf_iterator<char>{}}; std::istreambuf_iterator<char>{}};

View File

@@ -469,7 +469,7 @@ Number::operator/=(Number const& y)
} }
// Shift by 10^17 gives greatest precision while not overflowing uint128_t // Shift by 10^17 gives greatest precision while not overflowing uint128_t
// or the cast back to int64_t // or the cast back to int64_t
uint128_t const f = 100'000'000'000'000'000; const uint128_t f = 100'000'000'000'000'000;
mantissa_ = static_cast<std::int64_t>(uint128_t(nm) * f / uint128_t(dm)); mantissa_ = static_cast<std::int64_t>(uint128_t(nm) * f / uint128_t(dm));
exponent_ = ne - de - 17; exponent_ = ne - de - 17;
mantissa_ *= np * dp; mantissa_ *= np * dp;

View File

@@ -89,13 +89,13 @@ parseUrl(parsedURL& pUrl, std::string const& strUrl)
boost::algorithm::to_lower(pUrl.scheme); boost::algorithm::to_lower(pUrl.scheme);
pUrl.username = smMatch[2]; pUrl.username = smMatch[2];
pUrl.password = smMatch[3]; pUrl.password = smMatch[3];
std::string const domain = smMatch[4]; const std::string domain = smMatch[4];
// We need to use Endpoint to parse the domain to // We need to use Endpoint to parse the domain to
// strip surrounding brackets from IPv6 addresses, // strip surrounding brackets from IPv6 addresses,
// e.g. [::1] => ::1. // e.g. [::1] => ::1.
auto const result = beast::IP::Endpoint::from_string_checked(domain); const auto result = beast::IP::Endpoint::from_string_checked(domain);
pUrl.domain = result ? result->address().to_string() : domain; pUrl.domain = result ? result->address().to_string() : domain;
std::string const port = smMatch[5]; const std::string port = smMatch[5];
if (!port.empty()) if (!port.empty())
{ {
pUrl.port = beast::lexicalCast<std::uint16_t>(port); pUrl.port = beast::lexicalCast<std::uint16_t>(port);

View File

@@ -67,7 +67,7 @@ UptimeClock::time_point
UptimeClock::now() UptimeClock::now()
{ {
// start the update thread on first use // start the update thread on first use
static auto const init = start_clock(); static const auto init = start_clock();
// Return the number of seconds since rippled start // Return the number of seconds since rippled start
return time_point{duration{now_}}; return time_point{duration{now_}};

View File

@@ -31,7 +31,9 @@ namespace ripple {
std::optional<std::uint64_t> std::optional<std::uint64_t>
mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div) mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div)
{ {
boost::multiprecision::uint128_t result; using namespace boost::multiprecision;
uint128_t result;
result = multiply(result, value, mul); result = multiply(result, value, mul);
result /= div; result /= div;

View File

@@ -34,7 +34,7 @@ namespace Json {
namespace { namespace {
std::map<char, char const*> jsonSpecialCharacterEscape = { std::map<char, const char*> jsonSpecialCharacterEscape = {
{'"', "\\\""}, {'"', "\\\""},
{'\\', "\\\\"}, {'\\', "\\\\"},
{'/', "\\/"}, {'/', "\\/"},
@@ -47,13 +47,13 @@ std::map<char, char const*> jsonSpecialCharacterEscape = {
static size_t const jsonEscapeLength = 2; static size_t const jsonEscapeLength = 2;
// All other JSON punctuation. // All other JSON punctuation.
char const closeBrace = '}'; const char closeBrace = '}';
char const closeBracket = ']'; const char closeBracket = ']';
char const colon = ':'; const char colon = ':';
char const comma = ','; const char comma = ',';
char const openBrace = '{'; const char openBrace = '{';
char const openBracket = '['; const char openBracket = '[';
char const quote = '"'; const char quote = '"';
static auto const integralFloatsBecomeInts = false; static auto const integralFloatsBecomeInts = false;

View File

@@ -78,8 +78,8 @@ bool
Reader::parse(std::string const& document, Value& root) Reader::parse(std::string const& document, Value& root)
{ {
document_ = document; document_ = document;
char const* begin = document_.c_str(); const char* begin = document_.c_str();
char const* end = begin + document_.length(); const char* end = begin + document_.length();
return parse(begin, end, root); return parse(begin, end, root);
} }
@@ -99,7 +99,7 @@ Reader::parse(std::istream& sin, Value& root)
} }
bool bool
Reader::parse(char const* beginDoc, char const* endDoc, Value& root) Reader::parse(const char* beginDoc, const char* endDoc, Value& root)
{ {
begin_ = beginDoc; begin_ = beginDoc;
end_ = endDoc; end_ = endDoc;
@@ -193,7 +193,7 @@ Reader::skipCommentTokens(Token& token)
} }
bool bool
Reader::expectToken(TokenType type, Token& token, char const* message) Reader::expectToken(TokenType type, Token& token, const char* message)
{ {
readToken(token); readToken(token);
@@ -629,7 +629,7 @@ bool
Reader::decodeDouble(Token& token) Reader::decodeDouble(Token& token)
{ {
double value = 0; double value = 0;
int const bufferSize = 32; const int bufferSize = 32;
int count; int count;
int length = int(token.end_ - token.start_); int length = int(token.end_ - token.start_);
// Sanity check to avoid buffer overflow exploits. // Sanity check to avoid buffer overflow exploits.
@@ -939,7 +939,7 @@ Reader::getFormatedErrorMessages() const
itError != errors_.end(); itError != errors_.end();
++itError) ++itError)
{ {
ErrorInfo const& error = *itError; const ErrorInfo& error = *itError;
formattedMessage += formattedMessage +=
"* " + getLocationLineAndColumn(error.token_.start_) + "\n"; "* " + getLocationLineAndColumn(error.token_.start_) + "\n";
formattedMessage += " " + error.message_ + "\n"; formattedMessage += " " + error.message_ + "\n";

View File

@@ -31,10 +31,10 @@
namespace Json { namespace Json {
Value const Value::null; const Value Value::null;
Int const Value::minInt = Int(~(UInt(-1) / 2)); const Int Value::minInt = Int(~(UInt(-1) / 2));
Int const Value::maxInt = Int(UInt(-1) / 2); const Int Value::maxInt = Int(UInt(-1) / 2);
UInt const Value::maxUInt = UInt(-1); const UInt Value::maxUInt = UInt(-1);
class DefaultValueAllocator : public ValueAllocator class DefaultValueAllocator : public ValueAllocator
{ {
@@ -42,7 +42,7 @@ public:
virtual ~DefaultValueAllocator() = default; virtual ~DefaultValueAllocator() = default;
char* char*
makeMemberName(char const* memberName) override makeMemberName(const char* memberName) override
{ {
return duplicateStringValue(memberName); return duplicateStringValue(memberName);
} }
@@ -54,7 +54,7 @@ public:
} }
char* char*
duplicateStringValue(char const* value, unsigned int length = unknown) duplicateStringValue(const char* value, unsigned int length = unknown)
override override
{ {
//@todo investigate this old optimization //@todo investigate this old optimization
@@ -110,14 +110,14 @@ Value::CZString::CZString(int index) : cstr_(0), index_(index)
{ {
} }
Value::CZString::CZString(char const* cstr, DuplicationPolicy allocate) Value::CZString::CZString(const char* cstr, DuplicationPolicy allocate)
: cstr_( : cstr_(
allocate == duplicate ? valueAllocator()->makeMemberName(cstr) : cstr) allocate == duplicate ? valueAllocator()->makeMemberName(cstr) : cstr)
, index_(allocate) , index_(allocate)
{ {
} }
Value::CZString::CZString(CZString const& other) Value::CZString::CZString(const CZString& other)
: cstr_( : cstr_(
other.index_ != noDuplication && other.cstr_ != 0 other.index_ != noDuplication && other.cstr_ != 0
? valueAllocator()->makeMemberName(other.cstr_) ? valueAllocator()->makeMemberName(other.cstr_)
@@ -136,7 +136,7 @@ Value::CZString::~CZString()
} }
bool bool
Value::CZString::operator<(CZString const& other) const Value::CZString::operator<(const CZString& other) const
{ {
if (cstr_ && other.cstr_) if (cstr_ && other.cstr_)
return strcmp(cstr_, other.cstr_) < 0; return strcmp(cstr_, other.cstr_) < 0;
@@ -145,7 +145,7 @@ Value::CZString::operator<(CZString const& other) const
} }
bool bool
Value::CZString::operator==(CZString const& other) const Value::CZString::operator==(const CZString& other) const
{ {
if (cstr_ && other.cstr_) if (cstr_ && other.cstr_)
return strcmp(cstr_, other.cstr_) == 0; return strcmp(cstr_, other.cstr_) == 0;
@@ -159,7 +159,7 @@ Value::CZString::index() const
return index_; return index_;
} }
char const* const char*
Value::CZString::c_str() const Value::CZString::c_str() const
{ {
return cstr_; return cstr_;
@@ -232,18 +232,25 @@ Value::Value(double value) : type_(realValue)
value_.real_ = value; value_.real_ = value;
} }
Value::Value(char const* value) : type_(stringValue), allocated_(true) Value::Value(const char* value) : type_(stringValue), allocated_(true)
{ {
value_.string_ = valueAllocator()->duplicateStringValue(value); value_.string_ = valueAllocator()->duplicateStringValue(value);
} }
Value::Value(ripple::Number const& value) : type_(stringValue), allocated_(true)
{
auto const tmp = to_string(value);
value_.string_ =
valueAllocator()->duplicateStringValue(tmp.c_str(), tmp.length());
}
Value::Value(std::string const& value) : type_(stringValue), allocated_(true) Value::Value(std::string const& value) : type_(stringValue), allocated_(true)
{ {
value_.string_ = valueAllocator()->duplicateStringValue( value_.string_ = valueAllocator()->duplicateStringValue(
value.c_str(), (unsigned int)value.length()); value.c_str(), (unsigned int)value.length());
} }
Value::Value(StaticString const& value) : type_(stringValue), allocated_(false) Value::Value(const StaticString& value) : type_(stringValue), allocated_(false)
{ {
value_.string_ = const_cast<char*>(value.c_str()); value_.string_ = const_cast<char*>(value.c_str());
} }
@@ -253,7 +260,7 @@ Value::Value(bool value) : type_(booleanValue)
value_.bool_ = value; value_.bool_ = value;
} }
Value::Value(Value const& other) : type_(other.type_) Value::Value(const Value& other) : type_(other.type_)
{ {
switch (type_) switch (type_)
{ {
@@ -370,7 +377,7 @@ integerCmp(Int i, UInt ui)
} }
bool bool
operator<(Value const& x, Value const& y) operator<(const Value& x, const Value& y)
{ {
if (auto signum = x.type_ - y.type_) if (auto signum = x.type_ - y.type_)
{ {
@@ -419,7 +426,7 @@ operator<(Value const& x, Value const& y)
} }
bool bool
operator==(Value const& x, Value const& y) operator==(const Value& x, const Value& y)
{ {
if (x.type_ != y.type_) if (x.type_ != y.type_)
{ {
@@ -464,7 +471,7 @@ operator==(Value const& x, Value const& y)
return 0; // unreachable return 0; // unreachable
} }
char const* const char*
Value::asCString() const Value::asCString() const
{ {
XRPL_ASSERT(type_ == stringValue, "Json::Value::asCString : valid type"); XRPL_ASSERT(type_ == stringValue, "Json::Value::asCString : valid type");
@@ -795,7 +802,7 @@ Value::operator[](UInt index)
return (*it).second; return (*it).second;
} }
Value const& const Value&
Value::operator[](UInt index) const Value::operator[](UInt index) const
{ {
XRPL_ASSERT( XRPL_ASSERT(
@@ -815,13 +822,13 @@ Value::operator[](UInt index) const
} }
Value& Value&
Value::operator[](char const* key) Value::operator[](const char* key)
{ {
return resolveReference(key, false); return resolveReference(key, false);
} }
Value& Value&
Value::resolveReference(char const* key, bool isStatic) Value::resolveReference(const char* key, bool isStatic)
{ {
XRPL_ASSERT( XRPL_ASSERT(
type_ == nullValue || type_ == objectValue, type_ == nullValue || type_ == objectValue,
@@ -844,9 +851,9 @@ Value::resolveReference(char const* key, bool isStatic)
} }
Value Value
Value::get(UInt index, Value const& defaultValue) const Value::get(UInt index, const Value& defaultValue) const
{ {
Value const* value = &((*this)[index]); const Value* value = &((*this)[index]);
return value == &null ? defaultValue : *value; return value == &null ? defaultValue : *value;
} }
@@ -856,8 +863,8 @@ Value::isValidIndex(UInt index) const
return index < size(); return index < size();
} }
Value const& const Value&
Value::operator[](char const* key) const Value::operator[](const char* key) const
{ {
XRPL_ASSERT( XRPL_ASSERT(
type_ == nullValue || type_ == objectValue, type_ == nullValue || type_ == objectValue,
@@ -881,20 +888,26 @@ Value::operator[](std::string const& key)
return (*this)[key.c_str()]; return (*this)[key.c_str()];
} }
Value const& const Value&
Value::operator[](std::string const& key) const Value::operator[](std::string const& key) const
{ {
return (*this)[key.c_str()]; return (*this)[key.c_str()];
} }
Value& Value&
Value::operator[](StaticString const& key) Value::operator[](const StaticString& key)
{ {
return resolveReference(key, true); return resolveReference(key, true);
} }
Value const&
Value::operator[](const StaticString& key) const
{
return (*this)[key.c_str()];
}
Value& Value&
Value::append(Value const& value) Value::append(const Value& value)
{ {
return (*this)[size()] = value; return (*this)[size()] = value;
} }
@@ -906,20 +919,20 @@ Value::append(Value&& value)
} }
Value Value
Value::get(char const* key, Value const& defaultValue) const Value::get(const char* key, const Value& defaultValue) const
{ {
Value const* value = &((*this)[key]); const Value* value = &((*this)[key]);
return value == &null ? defaultValue : *value; return value == &null ? defaultValue : *value;
} }
Value Value
Value::get(std::string const& key, Value const& defaultValue) const Value::get(std::string const& key, const Value& defaultValue) const
{ {
return get(key.c_str(), defaultValue); return get(key.c_str(), defaultValue);
} }
Value Value
Value::removeMember(char const* key) Value::removeMember(const char* key)
{ {
XRPL_ASSERT( XRPL_ASSERT(
type_ == nullValue || type_ == objectValue, type_ == nullValue || type_ == objectValue,
@@ -946,12 +959,12 @@ Value::removeMember(std::string const& key)
} }
bool bool
Value::isMember(char const* key) const Value::isMember(const char* key) const
{ {
if (type_ != objectValue) if (type_ != objectValue)
return false; return false;
Value const* value = &((*this)[key]); const Value* value = &((*this)[key]);
return value != &null; return value != &null;
} }

View File

@@ -37,7 +37,7 @@ ValueIteratorBase::ValueIteratorBase() : current_(), isNull_(true)
} }
ValueIteratorBase::ValueIteratorBase( ValueIteratorBase::ValueIteratorBase(
Value::ObjectValues::iterator const& current) const Value::ObjectValues::iterator& current)
: current_(current), isNull_(false) : current_(current), isNull_(false)
{ {
} }
@@ -61,7 +61,7 @@ ValueIteratorBase::decrement()
} }
ValueIteratorBase::difference_type ValueIteratorBase::difference_type
ValueIteratorBase::computeDistance(SelfType const& other) const ValueIteratorBase::computeDistance(const SelfType& other) const
{ {
// Iterator for null value are initialized using the default // Iterator for null value are initialized using the default
// constructor, which initialize current_ to the default // constructor, which initialize current_ to the default
@@ -89,7 +89,7 @@ ValueIteratorBase::computeDistance(SelfType const& other) const
} }
bool bool
ValueIteratorBase::isEqual(SelfType const& other) const ValueIteratorBase::isEqual(const SelfType& other) const
{ {
if (isNull_) if (isNull_)
{ {
@@ -100,7 +100,7 @@ ValueIteratorBase::isEqual(SelfType const& other) const
} }
void void
ValueIteratorBase::copy(SelfType const& other) ValueIteratorBase::copy(const SelfType& other)
{ {
current_ = other.current_; current_ = other.current_;
} }
@@ -108,7 +108,7 @@ ValueIteratorBase::copy(SelfType const& other)
Value Value
ValueIteratorBase::key() const ValueIteratorBase::key() const
{ {
Value::CZString const czstring = (*current_).first; const Value::CZString czstring = (*current_).first;
if (czstring.c_str()) if (czstring.c_str())
{ {
@@ -124,7 +124,7 @@ ValueIteratorBase::key() const
UInt UInt
ValueIteratorBase::index() const ValueIteratorBase::index() const
{ {
Value::CZString const czstring = (*current_).first; const Value::CZString czstring = (*current_).first;
if (!czstring.c_str()) if (!czstring.c_str())
return czstring.index(); return czstring.index();
@@ -132,10 +132,10 @@ ValueIteratorBase::index() const
return Value::UInt(-1); return Value::UInt(-1);
} }
char const* const char*
ValueIteratorBase::memberName() const ValueIteratorBase::memberName() const
{ {
char const* name = (*current_).first.c_str(); const char* name = (*current_).first.c_str();
return name ? name : ""; return name ? name : "";
} }
@@ -148,13 +148,13 @@ ValueIteratorBase::memberName() const
// ////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////
ValueConstIterator::ValueConstIterator( ValueConstIterator::ValueConstIterator(
Value::ObjectValues::iterator const& current) const Value::ObjectValues::iterator& current)
: ValueIteratorBase(current) : ValueIteratorBase(current)
{ {
} }
ValueConstIterator& ValueConstIterator&
ValueConstIterator::operator=(ValueIteratorBase const& other) ValueConstIterator::operator=(const ValueIteratorBase& other)
{ {
copy(other); copy(other);
return *this; return *this;
@@ -168,23 +168,23 @@ ValueConstIterator::operator=(ValueIteratorBase const& other)
// ////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////
ValueIterator::ValueIterator(Value::ObjectValues::iterator const& current) ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current)
: ValueIteratorBase(current) : ValueIteratorBase(current)
{ {
} }
ValueIterator::ValueIterator(ValueConstIterator const& other) ValueIterator::ValueIterator(const ValueConstIterator& other)
: ValueIteratorBase(other) : ValueIteratorBase(other)
{ {
} }
ValueIterator::ValueIterator(ValueIterator const& other) ValueIterator::ValueIterator(const ValueIterator& other)
: ValueIteratorBase(other) : ValueIteratorBase(other)
{ {
} }
ValueIterator& ValueIterator&
ValueIterator::operator=(SelfType const& other) ValueIterator::operator=(const SelfType& other)
{ {
copy(other); copy(other);
return *this; return *this;

View File

@@ -40,7 +40,7 @@ isControlCharacter(char ch)
} }
static bool static bool
containsControlCharacter(char const* str) containsControlCharacter(const char* str)
{ {
while (*str) while (*str)
{ {
@@ -117,7 +117,7 @@ valueToString(bool value)
} }
std::string std::string
valueToQuotedString(char const* value) valueToQuotedString(const char* value)
{ {
// Not sure how to handle unicode... // Not sure how to handle unicode...
if (strpbrk(value, "\"\\\b\f\n\r\t") == nullptr && if (strpbrk(value, "\"\\\b\f\n\r\t") == nullptr &&
@@ -132,7 +132,7 @@ valueToQuotedString(char const* value)
result.reserve(maxsize); // to avoid lots of mallocs result.reserve(maxsize); // to avoid lots of mallocs
result += "\""; result += "\"";
for (char const* c = value; *c != 0; ++c) for (const char* c = value; *c != 0; ++c)
{ {
switch (*c) switch (*c)
{ {
@@ -197,7 +197,7 @@ valueToQuotedString(char const* value)
// ////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////
std::string std::string
FastWriter::write(Value const& root) FastWriter::write(const Value& root)
{ {
document_ = ""; document_ = "";
writeValue(root); writeValue(root);
@@ -205,7 +205,7 @@ FastWriter::write(Value const& root)
} }
void void
FastWriter::writeValue(Value const& value) FastWriter::writeValue(const Value& value)
{ {
switch (value.type()) switch (value.type())
{ {
@@ -281,7 +281,7 @@ StyledWriter::StyledWriter() : rightMargin_(74), indentSize_(3)
} }
std::string std::string
StyledWriter::write(Value const& root) StyledWriter::write(const Value& root)
{ {
document_ = ""; document_ = "";
addChildValues_ = false; addChildValues_ = false;
@@ -292,7 +292,7 @@ StyledWriter::write(Value const& root)
} }
void void
StyledWriter::writeValue(Value const& value) StyledWriter::writeValue(const Value& value)
{ {
switch (value.type()) switch (value.type())
{ {
@@ -338,7 +338,7 @@ StyledWriter::writeValue(Value const& value)
while (true) while (true)
{ {
std::string const& name = *it; std::string const& name = *it;
Value const& childValue = value[name]; const Value& childValue = value[name];
writeWithIndent(valueToQuotedString(name.c_str())); writeWithIndent(valueToQuotedString(name.c_str()));
document_ += " : "; document_ += " : ";
writeValue(childValue); writeValue(childValue);
@@ -358,7 +358,7 @@ StyledWriter::writeValue(Value const& value)
} }
void void
StyledWriter::writeArrayValue(Value const& value) StyledWriter::writeArrayValue(const Value& value)
{ {
unsigned size = value.size(); unsigned size = value.size();
@@ -377,7 +377,7 @@ StyledWriter::writeArrayValue(Value const& value)
while (true) while (true)
{ {
Value const& childValue = value[index]; const Value& childValue = value[index];
if (hasChildValue) if (hasChildValue)
writeWithIndent(childValues_[index]); writeWithIndent(childValues_[index]);
@@ -417,7 +417,7 @@ StyledWriter::writeArrayValue(Value const& value)
} }
bool bool
StyledWriter::isMultineArray(Value const& value) StyledWriter::isMultineArray(const Value& value)
{ {
int size = value.size(); int size = value.size();
bool isMultiLine = size * 3 >= rightMargin_; bool isMultiLine = size * 3 >= rightMargin_;
@@ -425,7 +425,7 @@ StyledWriter::isMultineArray(Value const& value)
for (int index = 0; index < size && !isMultiLine; ++index) for (int index = 0; index < size && !isMultiLine; ++index)
{ {
Value const& childValue = value[index]; const Value& childValue = value[index];
isMultiLine = isMultiLine || isMultiLine = isMultiLine ||
((childValue.isArray() || childValue.isObject()) && ((childValue.isArray() || childValue.isObject()) &&
childValue.size() > 0); childValue.size() > 0);
@@ -507,7 +507,7 @@ StyledStreamWriter::StyledStreamWriter(std::string indentation)
} }
void void
StyledStreamWriter::write(std::ostream& out, Value const& root) StyledStreamWriter::write(std::ostream& out, const Value& root)
{ {
document_ = &out; document_ = &out;
addChildValues_ = false; addChildValues_ = false;
@@ -518,7 +518,7 @@ StyledStreamWriter::write(std::ostream& out, Value const& root)
} }
void void
StyledStreamWriter::writeValue(Value const& value) StyledStreamWriter::writeValue(const Value& value)
{ {
switch (value.type()) switch (value.type())
{ {
@@ -564,7 +564,7 @@ StyledStreamWriter::writeValue(Value const& value)
while (true) while (true)
{ {
std::string const& name = *it; std::string const& name = *it;
Value const& childValue = value[name]; const Value& childValue = value[name];
writeWithIndent(valueToQuotedString(name.c_str())); writeWithIndent(valueToQuotedString(name.c_str()));
*document_ << " : "; *document_ << " : ";
writeValue(childValue); writeValue(childValue);
@@ -584,7 +584,7 @@ StyledStreamWriter::writeValue(Value const& value)
} }
void void
StyledStreamWriter::writeArrayValue(Value const& value) StyledStreamWriter::writeArrayValue(const Value& value)
{ {
unsigned size = value.size(); unsigned size = value.size();
@@ -603,7 +603,7 @@ StyledStreamWriter::writeArrayValue(Value const& value)
while (true) while (true)
{ {
Value const& childValue = value[index]; const Value& childValue = value[index];
if (hasChildValue) if (hasChildValue)
writeWithIndent(childValues_[index]); writeWithIndent(childValues_[index]);
@@ -643,7 +643,7 @@ StyledStreamWriter::writeArrayValue(Value const& value)
} }
bool bool
StyledStreamWriter::isMultineArray(Value const& value) StyledStreamWriter::isMultineArray(const Value& value)
{ {
int size = value.size(); int size = value.size();
bool isMultiLine = size * 3 >= rightMargin_; bool isMultiLine = size * 3 >= rightMargin_;
@@ -651,7 +651,7 @@ StyledStreamWriter::isMultineArray(Value const& value)
for (int index = 0; index < size && !isMultiLine; ++index) for (int index = 0; index < size && !isMultiLine; ++index)
{ {
Value const& childValue = value[index]; const Value& childValue = value[index];
isMultiLine = isMultiLine || isMultiLine = isMultiLine ||
((childValue.isArray() || childValue.isObject()) && ((childValue.isArray() || childValue.isObject()) &&
childValue.size() > 0); childValue.size() > 0);
@@ -726,7 +726,7 @@ StyledStreamWriter::unindent()
} }
std::ostream& std::ostream&
operator<<(std::ostream& sout, Value const& root) operator<<(std::ostream& sout, const Value& root)
{ {
Json::StyledStreamWriter writer; Json::StyledStreamWriter writer;
writer.write(sout, root); writer.write(sout, root);

View File

@@ -39,18 +39,6 @@
namespace ripple { namespace ripple {
AccountID
ammAccountID(
std::uint16_t prefix,
uint256 const& parentHash,
uint256 const& ammID)
{
ripesha_hasher rsh;
auto const hash = sha512Half(prefix, parentHash, ammID);
rsh(hash.data(), hash.size());
return AccountID{static_cast<ripesha_hasher::result_type>(rsh)};
}
Currency Currency
ammLPTCurrency(Currency const& cur1, Currency const& cur2) ammLPTCurrency(Currency const& cur1, Currency const& cur2)
{ {

View File

@@ -23,6 +23,7 @@
#include <xrpl/protocol/Asset.h> #include <xrpl/protocol/Asset.h>
#include <xrpl/protocol/Issue.h> #include <xrpl/protocol/Issue.h>
#include <xrpl/protocol/MPTIssue.h> #include <xrpl/protocol/MPTIssue.h>
#include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/jss.h> #include <xrpl/protocol/jss.h>
#include <stdexcept> #include <stdexcept>
@@ -51,6 +52,12 @@ Asset::setJson(Json::Value& jv) const
std::visit([&](auto&& issue) { issue.setJson(jv); }, issue_); std::visit([&](auto&& issue) { issue.setJson(jv); }, issue_);
} }
STAmount
Asset::operator()(Number const& number) const
{
return STAmount{*this, number};
}
std::string std::string
to_string(Asset const& asset) to_string(Asset const& asset)
{ {
@@ -78,11 +85,4 @@ assetFromJson(Json::Value const& v)
return mptIssueFromJson(v); return mptIssueFromJson(v);
} }
Json::Value
to_json(Asset const& asset)
{
return std::visit(
[&](auto const& issue) { return to_json(issue); }, asset.value());
}
} // namespace ripple } // namespace ripple

View File

@@ -36,7 +36,7 @@ namespace BuildInfo {
// and follow the format described at http://semver.org/ // and follow the format described at http://semver.org/
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// clang-format off // clang-format off
char const* const versionString = "2.5.0-b1" char const* const versionString = "2.4.0"
// clang-format on // clang-format on
#if defined(DEBUG) || defined(SANITIZER) #if defined(DEBUG) || defined(SANITIZER)

View File

@@ -96,7 +96,6 @@ constexpr static ErrorInfo unorderedErrorInfos[]{
{rpcNOT_SYNCED, "notSynced", "Not synced to the network.", 503}, {rpcNOT_SYNCED, "notSynced", "Not synced to the network.", 503},
{rpcNO_EVENTS, "noEvents", "Current transport does not support events.", 405}, {rpcNO_EVENTS, "noEvents", "Current transport does not support events.", 405},
{rpcNO_NETWORK, "noNetwork", "Not synced to the network.", 503}, {rpcNO_NETWORK, "noNetwork", "Not synced to the network.", 503},
{rpcWRONG_NETWORK, "wrongNetwork", "Wrong network.", 503},
{rpcNO_PERMISSION, "noPermission", "You don't have permission for this command.", 401}, {rpcNO_PERMISSION, "noPermission", "You don't have permission for this command.", 401},
{rpcNO_PF_REQUEST, "noPathRequest", "No pathfinding request in progress.", 404}, {rpcNO_PF_REQUEST, "noPathRequest", "No pathfinding request in progress.", 404},
{rpcOBJECT_NOT_FOUND, "objectNotFound", "The requested object was not found.", 404}, {rpcOBJECT_NOT_FOUND, "objectNotFound", "The requested object was not found.", 404},
@@ -107,7 +106,6 @@ constexpr static ErrorInfo unorderedErrorInfos[]{
{rpcSRC_ACT_MALFORMED, "srcActMalformed", "Source account is malformed.", 400}, {rpcSRC_ACT_MALFORMED, "srcActMalformed", "Source account is malformed.", 400},
{rpcSRC_ACT_MISSING, "srcActMissing", "Source account not provided.", 400}, {rpcSRC_ACT_MISSING, "srcActMissing", "Source account not provided.", 400},
{rpcSRC_ACT_NOT_FOUND, "srcActNotFound", "Source account not found.", 404}, {rpcSRC_ACT_NOT_FOUND, "srcActNotFound", "Source account not found.", 404},
{rpcDELEGATE_ACT_NOT_FOUND, "delegateActNotFound", "Delegate account not found.", 404},
{rpcSRC_CUR_MALFORMED, "srcCurMalformed", "Source currency is malformed.", 400}, {rpcSRC_CUR_MALFORMED, "srcCurMalformed", "Source currency is malformed.", 400},
{rpcSRC_ISR_MALFORMED, "srcIsrMalformed", "Source issuer is malformed.", 400}, {rpcSRC_ISR_MALFORMED, "srcIsrMalformed", "Source issuer is malformed.", 400},
{rpcSTREAM_MALFORMED, "malformedStream", "Stream malformed.", 400}, {rpcSTREAM_MALFORMED, "malformedStream", "Stream malformed.", 400},

View File

@@ -139,27 +139,27 @@ class FeatureCollections
{ {
if (i >= features.size()) if (i >= features.size())
LogicError("Invalid FeatureBitset index"); LogicError("Invalid FeatureBitset index");
auto const& sequence = features.get<Feature::byIndex>(); const auto& sequence = features.get<Feature::byIndex>();
return sequence[i]; return sequence[i];
} }
size_t size_t
getIndex(Feature const& feature) const getIndex(Feature const& feature) const
{ {
auto const& sequence = features.get<Feature::byIndex>(); const auto& sequence = features.get<Feature::byIndex>();
auto const it_to = sequence.iterator_to(feature); auto const it_to = sequence.iterator_to(feature);
return it_to - sequence.begin(); return it_to - sequence.begin();
} }
Feature const* Feature const*
getByFeature(uint256 const& feature) const getByFeature(uint256 const& feature) const
{ {
auto const& feature_index = features.get<Feature::byFeature>(); const auto& feature_index = features.get<Feature::byFeature>();
auto const feature_it = feature_index.find(feature); auto const feature_it = feature_index.find(feature);
return feature_it == feature_index.end() ? nullptr : &*feature_it; return feature_it == feature_index.end() ? nullptr : &*feature_it;
} }
Feature const* Feature const*
getByName(std::string const& name) const getByName(std::string const& name) const
{ {
auto const& name_index = features.get<Feature::byName>(); const auto& name_index = features.get<Feature::byName>();
auto const name_it = name_index.find(name); auto const name_it = name_index.find(name);
return name_it == name_index.end() ? nullptr : &*name_it; return name_it == name_index.end() ? nullptr : &*name_it;
} }
@@ -240,7 +240,7 @@ FeatureCollections::getRegisteredFeature(std::string const& name) const
} }
void void
check(bool condition, char const* logicErrorMessage) check(bool condition, const char* logicErrorMessage)
{ {
if (!condition) if (!condition)
LogicError(logicErrorMessage); LogicError(logicErrorMessage);
@@ -437,13 +437,9 @@ featureToName(uint256 const& f)
uint256 const feature##name = registerFeature(#name, supported, vote); uint256 const feature##name = registerFeature(#name, supported, vote);
#define XRPL_FIX(name, supported, vote) \ #define XRPL_FIX(name, supported, vote) \
uint256 const fix##name = registerFeature("fix" #name, supported, vote); uint256 const fix##name = registerFeature("fix" #name, supported, vote);
// clang-format off
#define XRPL_RETIRE(name) \ #define XRPL_RETIRE(name) \
[[deprecated("The referenced amendment has been retired")]] \ [[deprecated("The referenced amendment has been retired"), maybe_unused]] \
[[maybe_unused]] \
uint256 const retired##name = retireFeature(#name); uint256 const retired##name = retireFeature(#name);
// clang-format on
#include <xrpl/protocol/detail/features.macro> #include <xrpl/protocol/detail/features.macro>
@@ -459,7 +455,7 @@ featureToName(uint256 const& f)
// //
// Use initialization of one final static variable to set // Use initialization of one final static variable to set
// featureCollections::readOnly. // featureCollections::readOnly.
[[maybe_unused]] static bool const readOnlySet = [[maybe_unused]] static const bool readOnlySet =
featureCollections.registrationIsDone(); featureCollections.registrationIsDone();
} // namespace ripple } // namespace ripple

View File

@@ -94,7 +94,7 @@ enum class LedgerNameSpace : std::uint16_t {
MPTOKEN = 't', MPTOKEN = 't',
CREDENTIAL = 'D', CREDENTIAL = 'D',
PERMISSIONED_DOMAIN = 'm', PERMISSIONED_DOMAIN = 'm',
DELEGATE = 'E', VAULT = 'V',
// No longer used or supported. Left here to reserve the space // No longer used or supported. Left here to reserve the space
// to avoid accidental reuse. // to avoid accidental reuse.
@@ -453,14 +453,6 @@ amm(uint256 const& id) noexcept
return {ltAMM, id}; return {ltAMM, id};
} }
Keylet
delegate(AccountID const& account, AccountID const& authorizedAccount) noexcept
{
return {
ltDELEGATE,
indexHash(LedgerNameSpace::DELEGATE, account, authorizedAccount)};
}
Keylet Keylet
bridge(STXChainBridge const& bridge, STXChainBridge::ChainType chainType) bridge(STXChainBridge const& bridge, STXChainBridge::ChainType chainType)
{ {
@@ -552,6 +544,12 @@ credential(
indexHash(LedgerNameSpace::CREDENTIAL, subject, issuer, credType)}; indexHash(LedgerNameSpace::CREDENTIAL, subject, issuer, credType)};
} }
Keylet
vault(AccountID const& owner, std::uint32_t seq) noexcept
{
return vault(indexHash(LedgerNameSpace::VAULT, owner, seq));
}
Keylet Keylet
permissionedDomain(AccountID const& account, std::uint32_t seq) noexcept permissionedDomain(AccountID const& account, std::uint32_t seq) noexcept
{ {

View File

@@ -154,10 +154,6 @@ InnerObjectFormats::InnerObjectFormats()
{sfIssuer, soeREQUIRED}, {sfIssuer, soeREQUIRED},
{sfCredentialType, soeREQUIRED}, {sfCredentialType, soeREQUIRED},
}); });
add(sfPermission.jsonName.c_str(),
sfPermission.getCode(),
{{sfPermissionValue, soeREQUIRED}});
} }
InnerObjectFormats const& InnerObjectFormats const&

View File

@@ -37,7 +37,7 @@ Keylet::check(STLedgerEntry const& sle) const
if (type == ltCHILD) if (type == ltCHILD)
return sle.getType() != ltDIR_NODE; return sle.getType() != ltDIR_NODE;
return sle.getType() == type; return sle.getType() == type && sle.key() == key;
} }
} // namespace ripple } // namespace ripple

View File

@@ -29,7 +29,7 @@ namespace ripple {
LedgerFormats::LedgerFormats() LedgerFormats::LedgerFormats()
{ {
// Fields shared by all ledger formats: // Fields shared by all ledger formats:
static std::initializer_list<SOElement> const commonFields{ static const std::initializer_list<SOElement> commonFields{
{sfLedgerIndex, soeOPTIONAL}, {sfLedgerIndex, soeOPTIONAL},
{sfLedgerEntryType, soeREQUIRED}, {sfLedgerEntryType, soeREQUIRED},
{sfFlags, soeREQUIRED}, {sfFlags, soeREQUIRED},

View File

@@ -48,12 +48,6 @@ MPTIssue::getIssuer() const
return *account; return *account;
} }
MPTID const&
MPTIssue::getMptID() const
{
return mptID_;
}
std::string std::string
MPTIssue::getText() const MPTIssue::getText() const
{ {

View File

@@ -1,148 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2025 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/protocol/Permissions.h>
#include <xrpl/protocol/jss.h>
namespace ripple {
Permission::Permission()
{
delegatableTx_ = {
#pragma push_macro("TRANSACTION")
#undef TRANSACTION
#define TRANSACTION(tag, value, name, delegatable, fields) {value, delegatable},
#include <xrpl/protocol/detail/transactions.macro>
#undef TRANSACTION
#pragma pop_macro("TRANSACTION")
};
granularPermissionMap_ = {
#pragma push_macro("PERMISSION")
#undef PERMISSION
#define PERMISSION(type, txType, value) {#type, type},
#include <xrpl/protocol/detail/permissions.macro>
#undef PERMISSION
#pragma pop_macro("PERMISSION")
};
granularNameMap_ = {
#pragma push_macro("PERMISSION")
#undef PERMISSION
#define PERMISSION(type, txType, value) {type, #type},
#include <xrpl/protocol/detail/permissions.macro>
#undef PERMISSION
#pragma pop_macro("PERMISSION")
};
granularTxTypeMap_ = {
#pragma push_macro("PERMISSION")
#undef PERMISSION
#define PERMISSION(type, txType, value) {type, txType},
#include <xrpl/protocol/detail/permissions.macro>
#undef PERMISSION
#pragma pop_macro("PERMISSION")
};
for ([[maybe_unused]] auto const& permission : granularPermissionMap_)
XRPL_ASSERT(
permission.second > UINT16_MAX,
"ripple::Permission::granularPermissionMap_ : granular permission "
"value must not exceed the maximum uint16_t value.");
}
Permission const&
Permission::getInstance()
{
static Permission const instance;
return instance;
}
std::optional<std::uint32_t>
Permission::getGranularValue(std::string const& name) const
{
auto const it = granularPermissionMap_.find(name);
if (it != granularPermissionMap_.end())
return static_cast<uint32_t>(it->second);
return std::nullopt;
}
std::optional<std::string>
Permission::getGranularName(GranularPermissionType const& value) const
{
auto const it = granularNameMap_.find(value);
if (it != granularNameMap_.end())
return it->second;
return std::nullopt;
}
std::optional<TxType>
Permission::getGranularTxType(GranularPermissionType const& gpType) const
{
auto const it = granularTxTypeMap_.find(gpType);
if (it != granularTxTypeMap_.end())
return it->second;
return std::nullopt;
}
bool
Permission::isDelegatable(std::uint32_t const& permissionValue) const
{
auto const granularPermission =
getGranularName(static_cast<GranularPermissionType>(permissionValue));
if (granularPermission)
// granular permissions are always allowed to be delegated
return true;
auto const it = delegatableTx_.find(permissionValue - 1);
if (it != delegatableTx_.end() && it->second == Delegation::notDelegatable)
return false;
return true;
}
uint32_t
Permission::txToPermissionType(TxType const& type) const
{
return static_cast<uint32_t>(type) + 1;
}
TxType
Permission::permissionToTxType(uint32_t const& value) const
{
return static_cast<TxType>(value - 1);
}
} // namespace ripple

View File

@@ -183,7 +183,7 @@ Quality
Quality::round(int digits) const Quality::round(int digits) const
{ {
// Modulus for mantissa // Modulus for mantissa
static std::uint64_t const mod[17] = { static const std::uint64_t mod[17] = {
/* 0 */ 10000000000000000, /* 0 */ 10000000000000000,
/* 1 */ 1000000000000000, /* 1 */ 1000000000000000,
/* 2 */ 100000000000000, /* 2 */ 100000000000000,

View File

@@ -87,7 +87,7 @@ SField::SField(
private_access_tag_t, private_access_tag_t,
SerializedTypeID tid, SerializedTypeID tid,
int fv, int fv,
char const* fn, const char* fn,
int meta, int meta,
IsSigning signing) IsSigning signing)
: fieldCode(field_code(tid, fv)) : fieldCode(field_code(tid, fv))

View File

@@ -106,7 +106,7 @@ STAccount::add(Serializer& s) const
} }
bool bool
STAccount::isEquivalent(STBase const& t) const STAccount::isEquivalent(const STBase& t) const
{ {
auto const* const tPtr = dynamic_cast<STAccount const*>(&t); auto const* const tPtr = dynamic_cast<STAccount const*>(&t);
return tPtr && (default_ == tPtr->default_) && (value_ == tPtr->value_); return tPtr && (default_ == tPtr->default_) && (value_ == tPtr->value_);

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