mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Compare commits
73 Commits
Bronek/vau
...
vlntb/lock
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab0a72ad93 | ||
|
|
83ae5e3050 | ||
|
|
e18f27f5f7 | ||
|
|
df6daf0d8f | ||
|
|
e9d46f0bfc | ||
|
|
42fd74b77b | ||
|
|
c55ea56c5e | ||
|
|
1e01cd34f7 | ||
|
|
e2fa5c1b7c | ||
|
|
fc0984d286 | ||
|
|
8b3dcd41f7 | ||
|
|
56f5189a2b | ||
|
|
8f2f5310e2 | ||
|
|
da694c8304 | ||
|
|
d0f836581b | ||
|
|
edb4f0342c | ||
|
|
984c70955a | ||
|
|
3effb54e49 | ||
|
|
316f9535e3 | ||
|
|
ea17abb92a | ||
|
|
35a40a8e62 | ||
|
|
d494bf45b2 | ||
|
|
8bf4a5cbff | ||
|
|
58c2c82a30 | ||
|
|
11edaa441d | ||
|
|
a5e953b191 | ||
|
|
506ae12a8c | ||
|
|
0310c5cbe0 | ||
|
|
053e1af7ff | ||
|
|
7e24adbdd0 | ||
|
|
621df422a7 | ||
|
|
0a34b5c691 | ||
|
|
e0bc3dd51f | ||
|
|
dacecd24ba | ||
|
|
05105743e9 | ||
|
|
9e1fe9a85e | ||
|
|
d71ce51901 | ||
|
|
be668ee26d | ||
|
|
cae5294b4e | ||
|
|
cd777f79ef | ||
|
|
8b9e21e3f5 | ||
|
|
2a61aee562 | ||
|
|
40ce8a8833 | ||
|
|
7713ff8c5c | ||
|
|
70371a4344 | ||
|
|
e514de76ed | ||
|
|
dd62cfcc22 | ||
|
|
09690f1b38 | ||
|
|
380ba9f1c1 | ||
|
|
c3e9380fb4 | ||
|
|
e3ebc253fa | ||
|
|
c6c7c84355 | ||
|
|
28f50cb7cf | ||
|
|
3e152fec74 | ||
|
|
2db2791805 | ||
|
|
9ec2d7f8ff | ||
|
|
4a084ce34c | ||
|
|
3502df2174 | ||
|
|
fa1e25abef | ||
|
|
217ba8dd4d | ||
|
|
405f4613d8 | ||
|
|
cba512068b | ||
|
|
1c99ea23d1 | ||
|
|
c4308b216f | ||
|
|
aafd2d8525 | ||
|
|
a574ec6023 | ||
|
|
e429455f4d | ||
|
|
7692eeb9a0 | ||
|
|
a099f5a804 | ||
|
|
ca0bc767fe | ||
|
|
4ba9288935 | ||
|
|
e923ec6d36 | ||
|
|
851d99d99e |
@@ -94,3 +94,4 @@ SpacesInSquareBrackets: false
|
|||||||
Standard: Cpp11
|
Standard: Cpp11
|
||||||
TabWidth: 8
|
TabWidth: 8
|
||||||
UseTab: Never
|
UseTab: Never
|
||||||
|
QualifierAlignment: Right
|
||||||
@@ -7,13 +7,13 @@ comment:
|
|||||||
show_carryforward_flags: false
|
show_carryforward_flags: false
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
range: "60..80"
|
range: "70..85"
|
||||||
precision: 1
|
precision: 1
|
||||||
round: nearest
|
round: nearest
|
||||||
status:
|
status:
|
||||||
project:
|
project:
|
||||||
default:
|
default:
|
||||||
target: 60%
|
target: 75%
|
||||||
threshold: 2%
|
threshold: 2%
|
||||||
patch:
|
patch:
|
||||||
default:
|
default:
|
||||||
|
|||||||
8
.github/CODEOWNERS
vendored
Normal file
8
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Allow anyone to review any change by default.
|
||||||
|
*
|
||||||
|
|
||||||
|
# Require the rpc-reviewers team to review changes to the rpc code.
|
||||||
|
include/xrpl/protocol/ @xrplf/rpc-reviewers
|
||||||
|
src/libxrpl/protocol/ @xrplf/rpc-reviewers
|
||||||
|
src/xrpld/rpc/ @xrplf/rpc-reviewers
|
||||||
|
src/xrpld/app/misc/ @xrplf/rpc-reviewers
|
||||||
6
.github/workflows/clang-format.yml
vendored
6
.github/workflows/clang-format.yml
vendored
@@ -1,9 +1,13 @@
|
|||||||
name: clang-format
|
name: clang-format
|
||||||
|
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
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
|
||||||
|
|||||||
4
.github/workflows/doxygen.yml
vendored
4
.github/workflows/doxygen.yml
vendored
@@ -10,11 +10,11 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
job:
|
documentation:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
container: rippleci/rippled-build-ubuntu:aaf5e3e
|
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
6
.github/workflows/levelization.yml
vendored
6
.github/workflows/levelization.yml
vendored
@@ -1,9 +1,13 @@
|
|||||||
name: levelization
|
name: levelization
|
||||||
|
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
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
|
||||||
|
|||||||
6
.github/workflows/libxrpl.yml
vendored
6
.github/workflows/libxrpl.yml
vendored
@@ -1,6 +1,6 @@
|
|||||||
name: Check libXRPL compatibility with Clio
|
name: Check libXRPL compatibility with Clio
|
||||||
env:
|
env:
|
||||||
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
|
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/dev
|
||||||
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
|
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
|
||||||
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
|
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
|
||||||
on:
|
on:
|
||||||
@@ -8,19 +8,21 @@ 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: rippleci/rippled-build-ubuntu:aaf5e3e
|
container: ghcr.io/xrplf/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
|
||||||
|
|||||||
10
.github/workflows/macos.yml
vendored
10
.github/workflows/macos.yml
vendored
@@ -1,6 +1,7 @@
|
|||||||
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)
|
||||||
@@ -18,6 +19,7 @@ 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:
|
||||||
@@ -69,6 +71,9 @@ 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
|
||||||
@@ -91,4 +96,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
n=$(nproc)
|
n=$(nproc)
|
||||||
echo "Using $n test jobs"
|
echo "Using $n test jobs"
|
||||||
${build_dir}/rippled --unittest --unittest-jobs $n
|
|
||||||
|
cd ${build_dir}
|
||||||
|
./rippled --unittest --unittest-jobs $n
|
||||||
|
ctest -j $n --output-on-failure
|
||||||
|
|||||||
25
.github/workflows/nix.yml
vendored
25
.github/workflows/nix.yml
vendored
@@ -1,6 +1,7 @@
|
|||||||
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)
|
||||||
@@ -39,6 +40,7 @@ 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:
|
||||||
@@ -62,7 +64,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: rippleci/rippled-build-ubuntu:aaf5e3e
|
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e
|
||||||
env:
|
env:
|
||||||
build_dir: .build
|
build_dir: .build
|
||||||
steps:
|
steps:
|
||||||
@@ -124,7 +126,7 @@ jobs:
|
|||||||
- "-Dunity=ON"
|
- "-Dunity=ON"
|
||||||
needs: dependencies
|
needs: dependencies
|
||||||
runs-on: [self-hosted, heavy]
|
runs-on: [self-hosted, heavy]
|
||||||
container: rippleci/rippled-build-ubuntu:aaf5e3e
|
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e
|
||||||
env:
|
env:
|
||||||
build_dir: .build
|
build_dir: .build
|
||||||
steps:
|
steps:
|
||||||
@@ -161,7 +163,9 @@ jobs:
|
|||||||
cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}"
|
cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}"
|
||||||
- name: test
|
- name: test
|
||||||
run: |
|
run: |
|
||||||
${build_dir}/rippled --unittest --unittest-jobs $(nproc)
|
cd ${build_dir}
|
||||||
|
./rippled --unittest --unittest-jobs $(nproc)
|
||||||
|
ctest -j $(nproc) --output-on-failure
|
||||||
|
|
||||||
reference-fee-test:
|
reference-fee-test:
|
||||||
strategy:
|
strategy:
|
||||||
@@ -178,7 +182,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: rippleci/rippled-build-ubuntu:aaf5e3e
|
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e
|
||||||
env:
|
env:
|
||||||
build_dir: .build
|
build_dir: .build
|
||||||
steps:
|
steps:
|
||||||
@@ -215,8 +219,9 @@ jobs:
|
|||||||
cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}"
|
cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}"
|
||||||
- name: test
|
- name: test
|
||||||
run: |
|
run: |
|
||||||
${build_dir}/rippled --unittest --unittest-jobs $(nproc)
|
cd ${build_dir}
|
||||||
|
./rippled --unittest --unittest-jobs $(nproc)
|
||||||
|
ctest -j $(nproc) --output-on-failure
|
||||||
coverage:
|
coverage:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -229,7 +234,7 @@ jobs:
|
|||||||
- Debug
|
- Debug
|
||||||
needs: dependencies
|
needs: dependencies
|
||||||
runs-on: [self-hosted, heavy]
|
runs-on: [self-hosted, heavy]
|
||||||
container: rippleci/rippled-build-ubuntu:aaf5e3e
|
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e
|
||||||
env:
|
env:
|
||||||
build_dir: .build
|
build_dir: .build
|
||||||
steps:
|
steps:
|
||||||
@@ -245,7 +250,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,<8"
|
run: pip install "gcovr>=7,<9"
|
||||||
- name: check environment
|
- name: check environment
|
||||||
run: |
|
run: |
|
||||||
echo ${PATH} | tr ':' '\n'
|
echo ${PATH} | tr ':' '\n'
|
||||||
@@ -303,7 +308,7 @@ jobs:
|
|||||||
conan:
|
conan:
|
||||||
needs: dependencies
|
needs: dependencies
|
||||||
runs-on: [self-hosted, heavy]
|
runs-on: [self-hosted, heavy]
|
||||||
container: rippleci/rippled-build-ubuntu:aaf5e3e
|
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e
|
||||||
env:
|
env:
|
||||||
build_dir: .build
|
build_dir: .build
|
||||||
configuration: Release
|
configuration: Release
|
||||||
@@ -358,6 +363,7 @@ 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:
|
||||||
@@ -438,3 +444,4 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd ${BUILD_DIR}
|
cd ${BUILD_DIR}
|
||||||
./rippled -u --unittest-jobs $(( $(nproc)/4 ))
|
./rippled -u --unittest-jobs $(( $(nproc)/4 ))
|
||||||
|
ctest -j $(nproc) --output-on-failure
|
||||||
|
|||||||
7
.github/workflows/windows.yml
vendored
7
.github/workflows/windows.yml
vendored
@@ -2,6 +2,7 @@ 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)
|
||||||
@@ -21,6 +22,7 @@ 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:
|
||||||
@@ -93,5 +95,6 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
if: ${{ matrix.configuration.tests }}
|
if: ${{ matrix.configuration.tests }}
|
||||||
run: |
|
run: |
|
||||||
${build_dir}/${{ matrix.configuration.type }}/rippled --unittest \
|
cd ${build_dir}/${{ matrix.configuration.type }}
|
||||||
--unittest-jobs $(nproc)
|
./rippled --unittest --unittest-jobs $(nproc)
|
||||||
|
ctest -j $(nproc) --output-on-failure
|
||||||
|
|||||||
@@ -83,9 +83,17 @@ 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
|
||||||
|
|
||||||
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).
|
[Version 2.4.0](https://github.com/XRPLF/rippled/releases/tag/2.4.0) was released on March 4, 2025.
|
||||||
|
|
||||||
### Additions and bugfixes in 2.4.0
|
### Additions and bugfixes in 2.4.0
|
||||||
|
|
||||||
|
|||||||
2
BUILD.md
2
BUILD.md
@@ -288,7 +288,7 @@ It fixes some source files to add missing `#include`s.
|
|||||||
Single-config generators:
|
Single-config generators:
|
||||||
|
|
||||||
```
|
```
|
||||||
cmake --build .
|
cmake --build . -j $(nproc)
|
||||||
```
|
```
|
||||||
|
|
||||||
Multi-config generators:
|
Multi-config generators:
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ test.shamap > xrpl.protocol
|
|||||||
test.toplevel > test.csf
|
test.toplevel > test.csf
|
||||||
test.toplevel > xrpl.json
|
test.toplevel > xrpl.json
|
||||||
test.unit_test > xrpl.basics
|
test.unit_test > xrpl.basics
|
||||||
|
tests.libxrpl > xrpl.basics
|
||||||
xrpl.json > xrpl.basics
|
xrpl.json > xrpl.basics
|
||||||
xrpl.protocol > xrpl.basics
|
xrpl.protocol > xrpl.basics
|
||||||
xrpl.protocol > xrpl.json
|
xrpl.protocol > xrpl.json
|
||||||
|
|||||||
@@ -90,6 +90,11 @@ set_target_properties(OpenSSL::SSL PROPERTIES
|
|||||||
INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2
|
INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2
|
||||||
)
|
)
|
||||||
set(SECP256K1_INSTALL TRUE)
|
set(SECP256K1_INSTALL TRUE)
|
||||||
|
set(SECP256K1_BUILD_BENCHMARK FALSE)
|
||||||
|
set(SECP256K1_BUILD_TESTS FALSE)
|
||||||
|
set(SECP256K1_BUILD_EXHAUSTIVE_TESTS FALSE)
|
||||||
|
set(SECP256K1_BUILD_CTIME_TESTS FALSE)
|
||||||
|
set(SECP256K1_BUILD_EXAMPLES FALSE)
|
||||||
add_subdirectory(external/secp256k1)
|
add_subdirectory(external/secp256k1)
|
||||||
add_library(secp256k1::secp256k1 ALIAS secp256k1)
|
add_library(secp256k1::secp256k1 ALIAS secp256k1)
|
||||||
add_subdirectory(external/ed25519-donna)
|
add_subdirectory(external/ed25519-donna)
|
||||||
@@ -144,3 +149,8 @@ set(PROJECT_EXPORT_SET RippleExports)
|
|||||||
include(RippledCore)
|
include(RippledCore)
|
||||||
include(RippledInstall)
|
include(RippledInstall)
|
||||||
include(RippledValidatorKeys)
|
include(RippledValidatorKeys)
|
||||||
|
|
||||||
|
if(tests)
|
||||||
|
include(CTest)
|
||||||
|
add_subdirectory(src/tests/libxrpl)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
[](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.
|
||||||
|
|||||||
4817
RELEASENOTES.md
4817
RELEASENOTES.md
File diff suppressed because it is too large
Load Diff
@@ -83,7 +83,7 @@ To report a qualifying bug, please send a detailed report to:
|
|||||||
|Long Key ID | `0xCD49A0AFC57929BE` |
|
|Long Key ID | `0xCD49A0AFC57929BE` |
|
||||||
|Fingerprint | `24E6 3B02 37E0 FA9C 5E96 8974 CD49 A0AF C579 29BE` |
|
|Fingerprint | `24E6 3B02 37E0 FA9C 5E96 8974 CD49 A0AF C579 29BE` |
|
||||||
|
|
||||||
The full PGP key for this address, which is also available on several key servers (e.g. on [keys.gnupg.net](https://keys.gnupg.net)), is:
|
The full PGP key for this address, which is also available on several key servers (e.g. on [keyserver.ubuntu.com](https://keyserver.ubuntu.com)), is:
|
||||||
```
|
```
|
||||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
mQINBFUwGHYBEAC0wpGpBPkd8W1UdQjg9+cEFzeIEJRaoZoeuJD8mofwI5Ejnjdt
|
mQINBFUwGHYBEAC0wpGpBPkd8W1UdQjg9+cEFzeIEJRaoZoeuJD8mofwI5Ejnjdt
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#
|
#
|
||||||
# Examples:
|
# Examples:
|
||||||
# https://vl.ripple.com
|
# https://vl.ripple.com
|
||||||
# https://vl.xrplf.org
|
# https://unl.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
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -98,6 +98,9 @@
|
|||||||
# 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.
|
||||||
@@ -200,15 +203,27 @@ 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
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ set(download_script "${CMAKE_BINARY_DIR}/docs/download-cppreference.cmake")
|
|||||||
file(WRITE
|
file(WRITE
|
||||||
"${download_script}"
|
"${download_script}"
|
||||||
"file(DOWNLOAD \
|
"file(DOWNLOAD \
|
||||||
http://upload.cppreference.com/mwiki/images/b/b2/html_book_20190607.zip \
|
https://github.com/PeterFeicht/cppreference-doc/releases/download/v20250209/html-book-20250209.zip \
|
||||||
${CMAKE_BINARY_DIR}/docs/cppreference.zip \
|
${CMAKE_BINARY_DIR}/docs/cppreference.zip \
|
||||||
EXPECTED_HASH MD5=82b3a612d7d35a83e3cb1195a63689ab \
|
EXPECTED_HASH MD5=bda585f72fbca4b817b29a3d5746567b \
|
||||||
)\n \
|
)\n \
|
||||||
execute_process( \
|
execute_process( \
|
||||||
COMMAND \"${CMAKE_COMMAND}\" -E tar -xf cppreference.zip \
|
COMMAND \"${CMAKE_COMMAND}\" -E tar -xf cppreference.zip \
|
||||||
|
|||||||
@@ -2,16 +2,6 @@
|
|||||||
convenience variables and sanity checks
|
convenience variables and sanity checks
|
||||||
#]===================================================================]
|
#]===================================================================]
|
||||||
|
|
||||||
include(ProcessorCount)
|
|
||||||
|
|
||||||
if (NOT ep_procs)
|
|
||||||
ProcessorCount(ep_procs)
|
|
||||||
if (ep_procs GREATER 1)
|
|
||||||
# never use more than half of cores for EP builds
|
|
||||||
math (EXPR ep_procs "${ep_procs} / 2")
|
|
||||||
message (STATUS "Using ${ep_procs} cores for ExternalProject builds.")
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
get_property(is_multiconfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
get_property(is_multiconfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
|
||||||
set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
|
set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
|
||||||
|
|||||||
41
cmake/xrpl_add_test.cmake
Normal file
41
cmake/xrpl_add_test.cmake
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
include(isolate_headers)
|
||||||
|
|
||||||
|
function(xrpl_add_test name)
|
||||||
|
set(target ${PROJECT_NAME}.test.${name})
|
||||||
|
|
||||||
|
file(GLOB_RECURSE sources CONFIGURE_DEPENDS
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp"
|
||||||
|
)
|
||||||
|
add_executable(${target} EXCLUDE_FROM_ALL ${ARGN} ${sources})
|
||||||
|
|
||||||
|
isolate_headers(
|
||||||
|
${target}
|
||||||
|
"${CMAKE_SOURCE_DIR}"
|
||||||
|
"${CMAKE_SOURCE_DIR}/tests/${name}"
|
||||||
|
PRIVATE
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make sure the test isn't optimized away in unity builds
|
||||||
|
set_target_properties(${target} PROPERTIES
|
||||||
|
UNITY_BUILD_MODE GROUP
|
||||||
|
UNITY_BUILD_BATCH_SIZE 0) # Adjust as needed
|
||||||
|
|
||||||
|
add_test(NAME ${target} COMMAND ${target})
|
||||||
|
set_tests_properties(
|
||||||
|
${target} PROPERTIES
|
||||||
|
FIXTURES_REQUIRED ${target}_fixture
|
||||||
|
)
|
||||||
|
|
||||||
|
add_test(
|
||||||
|
NAME ${target}.build
|
||||||
|
COMMAND
|
||||||
|
${CMAKE_COMMAND}
|
||||||
|
--build ${CMAKE_BINARY_DIR}
|
||||||
|
--config $<CONFIG>
|
||||||
|
--target ${target}
|
||||||
|
)
|
||||||
|
set_tests_properties(${target}.build PROPERTIES
|
||||||
|
FIXTURES_SETUP ${target}_fixture
|
||||||
|
)
|
||||||
|
endfunction()
|
||||||
11
conanfile.py
11
conanfile.py
@@ -1,4 +1,4 @@
|
|||||||
from conan import ConanFile
|
from conan import ConanFile, __version__ as conan_version
|
||||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@@ -24,13 +24,12 @@ class Xrpl(ConanFile):
|
|||||||
}
|
}
|
||||||
|
|
||||||
requires = [
|
requires = [
|
||||||
'date/3.0.3',
|
'doctest/2.4.11',
|
||||||
'grpc/1.50.1',
|
'grpc/1.50.1',
|
||||||
'libarchive/3.7.6',
|
'libarchive/3.7.6',
|
||||||
'nudb/2.0.8',
|
'nudb/2.0.8',
|
||||||
'openssl/1.1.1v',
|
'openssl/1.1.1v',
|
||||||
'soci/4.0.3',
|
'soci/4.0.3',
|
||||||
'xxhash/0.8.2',
|
|
||||||
'zlib/1.3.1',
|
'zlib/1.3.1',
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -99,7 +98,10 @@ class Xrpl(ConanFile):
|
|||||||
self.options['boost'].visibility = 'global'
|
self.options['boost'].visibility = 'global'
|
||||||
|
|
||||||
def requirements(self):
|
def requirements(self):
|
||||||
self.requires('boost/1.83.0', force=True)
|
# Conan 2 requires transitive headers to be specified
|
||||||
|
transitive_headers_opt = {'transitive_headers': True} if conan_version.split('.')[0] == '2' else {}
|
||||||
|
self.requires('boost/1.83.0', force=True, **transitive_headers_opt)
|
||||||
|
self.requires('date/3.0.3', **transitive_headers_opt)
|
||||||
self.requires('lz4/1.10.0', force=True)
|
self.requires('lz4/1.10.0', force=True)
|
||||||
self.requires('protobuf/3.21.9', force=True)
|
self.requires('protobuf/3.21.9', force=True)
|
||||||
self.requires('sqlite3/3.47.0', force=True)
|
self.requires('sqlite3/3.47.0', force=True)
|
||||||
@@ -107,6 +109,7 @@ class Xrpl(ConanFile):
|
|||||||
self.requires('jemalloc/5.3.0')
|
self.requires('jemalloc/5.3.0')
|
||||||
if self.options.rocksdb:
|
if self.options.rocksdb:
|
||||||
self.requires('rocksdb/9.7.3')
|
self.requires('rocksdb/9.7.3')
|
||||||
|
self.requires('xxhash/0.8.2', **transitive_headers_opt)
|
||||||
|
|
||||||
exports_sources = (
|
exports_sources = (
|
||||||
'CMakeLists.txt',
|
'CMakeLists.txt',
|
||||||
|
|||||||
5
docs/build/environment.md
vendored
5
docs/build/environment.md
vendored
@@ -23,7 +23,7 @@ direction.
|
|||||||
|
|
||||||
```
|
```
|
||||||
apt update
|
apt update
|
||||||
apt install --yes curl git libssl-dev python3.10-dev python3-pip make g++-11 libprotobuf-dev protobuf-compiler
|
apt install --yes curl git libssl-dev pipx python3.10-dev python3-pip make g++-11 libprotobuf-dev protobuf-compiler
|
||||||
|
|
||||||
curl --location --remote-name \
|
curl --location --remote-name \
|
||||||
"https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1.tar.gz"
|
"https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1.tar.gz"
|
||||||
@@ -35,7 +35,8 @@ make --jobs $(nproc)
|
|||||||
make install
|
make install
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
pip3 install 'conan<2'
|
pipx install 'conan<2'
|
||||||
|
pipx ensurepath
|
||||||
```
|
```
|
||||||
|
|
||||||
[1]: https://github.com/thejohnfreeman/rippled-docker/blob/master/ubuntu-22.04/install.sh
|
[1]: https://github.com/thejohnfreeman/rippled-docker/blob/master/ubuntu-22.04/install.sh
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ get(Section const& section,
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline std::string
|
inline std::string
|
||||||
get(Section const& section, std::string const& name, const char* defaultValue)
|
get(Section const& section, std::string const& name, char const* defaultValue)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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<const char*>(in),
|
reinterpret_cast<char const*>(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<const char*>(in),
|
reinterpret_cast<char const*>(in),
|
||||||
reinterpret_cast<char*>(decompressed),
|
reinterpret_cast<char*>(decompressed),
|
||||||
inSize,
|
inSize,
|
||||||
decompressedSize) != decompressedSize)
|
decompressedSize) != decompressedSize)
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const E&
|
constexpr E const&
|
||||||
value() const&
|
value() const&
|
||||||
{
|
{
|
||||||
return val_;
|
return val_;
|
||||||
@@ -111,7 +111,7 @@ public:
|
|||||||
return std::move(val_);
|
return std::move(val_);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const E&&
|
constexpr E const&&
|
||||||
value() const&&
|
value() const&&
|
||||||
{
|
{
|
||||||
return std::move(val_);
|
return std::move(val_);
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ IntrusiveRefCounts::releaseStrongRef() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (refCounts.compare_exchange_weak(
|
if (refCounts.compare_exchange_weak(
|
||||||
prevIntVal, nextIntVal, std::memory_order_release))
|
prevIntVal, nextIntVal, std::memory_order_acq_rel))
|
||||||
{
|
{
|
||||||
// Can't be in partial destroy because only decrementing the strong
|
// Can't be in partial destroy because only decrementing the strong
|
||||||
// count to zero can start a partial destroy, and that can't happen
|
// count to zero can start a partial destroy, and that can't happen
|
||||||
@@ -351,7 +351,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (refCounts.compare_exchange_weak(
|
if (refCounts.compare_exchange_weak(
|
||||||
prevIntVal, nextIntVal, std::memory_order_release))
|
prevIntVal, nextIntVal, std::memory_order_acq_rel))
|
||||||
{
|
{
|
||||||
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_acq_rel);
|
refCounts.wait(prevIntVal, std::memory_order_acquire);
|
||||||
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_acq_rel);
|
refCounts.wait(prevIntVal - weakDelta, std::memory_order_acquire);
|
||||||
}
|
}
|
||||||
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_release))
|
curValue, desiredValue, std::memory_order_acq_rel))
|
||||||
{
|
{
|
||||||
RefCountPair const prev{curValue};
|
RefCountPair const prev{curValue};
|
||||||
if (!prev.strong)
|
if (!prev.strong)
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#define RIPPLE_BASICS_SHAMAP_HASH_H_INCLUDED
|
#define RIPPLE_BASICS_SHAMAP_HASH_H_INCLUDED
|
||||||
|
|
||||||
#include <xrpl/basics/base_uint.h>
|
#include <xrpl/basics/base_uint.h>
|
||||||
#include <xrpl/basics/partitioned_unordered_map.h>
|
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public:
|
|||||||
sweep();
|
sweep();
|
||||||
|
|
||||||
bool
|
bool
|
||||||
del(const key_type& key, bool valid);
|
del(key_type const& 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(
|
||||||
const key_type& key,
|
key_type const& key,
|
||||||
SharedPointerType& data,
|
SharedPointerType& data,
|
||||||
R&& replaceCallback);
|
R&& replaceCallback);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
canonicalize_replace_cache(
|
canonicalize_replace_cache(
|
||||||
const key_type& key,
|
key_type const& key,
|
||||||
SharedPointerType const& data);
|
SharedPointerType const& data);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
canonicalize_replace_client(const key_type& key, SharedPointerType& data);
|
canonicalize_replace_client(key_type const& key, SharedPointerType& data);
|
||||||
|
|
||||||
SharedPointerType
|
SharedPointerType
|
||||||
fetch(const key_type& key);
|
fetch(key_type const& 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,10 +168,7 @@ public:
|
|||||||
// simply return an iterator.
|
// simply return an iterator.
|
||||||
//
|
//
|
||||||
bool
|
bool
|
||||||
retrieve(const key_type& key, T& data);
|
retrieve(key_type const& key, T& data);
|
||||||
|
|
||||||
mutex_type&
|
|
||||||
peekMutex();
|
|
||||||
|
|
||||||
std::vector<key_type>
|
std::vector<key_type>
|
||||||
getKeys() const;
|
getKeys() const;
|
||||||
@@ -193,11 +190,14 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SharedPointerType
|
SharedPointerType
|
||||||
initialFetch(key_type const& key, std::lock_guard<mutex_type> const& l);
|
initialFetch(key_type const& key);
|
||||||
|
|
||||||
void
|
void
|
||||||
collect_metrics();
|
collect_metrics();
|
||||||
|
|
||||||
|
Mutex&
|
||||||
|
lockPartition(key_type const& key) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Stats
|
struct Stats
|
||||||
{
|
{
|
||||||
@@ -300,8 +300,8 @@ private:
|
|||||||
[[maybe_unused]] clock_type::time_point const& now,
|
[[maybe_unused]] clock_type::time_point const& now,
|
||||||
typename KeyValueCacheType::map_type& partition,
|
typename KeyValueCacheType::map_type& partition,
|
||||||
SweptPointersVector& stuffToSweep,
|
SweptPointersVector& stuffToSweep,
|
||||||
std::atomic<int>& allRemovals,
|
std::atomic<int>& allRemoval,
|
||||||
std::lock_guard<std::recursive_mutex> const&);
|
Mutex& partitionLock);
|
||||||
|
|
||||||
[[nodiscard]] std::thread
|
[[nodiscard]] std::thread
|
||||||
sweepHelper(
|
sweepHelper(
|
||||||
@@ -310,28 +310,27 @@ private:
|
|||||||
typename KeyOnlyCacheType::map_type& partition,
|
typename KeyOnlyCacheType::map_type& partition,
|
||||||
SweptPointersVector&,
|
SweptPointersVector&,
|
||||||
std::atomic<int>& allRemovals,
|
std::atomic<int>& allRemovals,
|
||||||
std::lock_guard<std::recursive_mutex> const&);
|
Mutex& partitionLock);
|
||||||
|
|
||||||
beast::Journal m_journal;
|
beast::Journal m_journal;
|
||||||
clock_type& m_clock;
|
clock_type& m_clock;
|
||||||
Stats m_stats;
|
Stats m_stats;
|
||||||
|
|
||||||
mutex_type mutable m_mutex;
|
|
||||||
|
|
||||||
// Used for logging
|
// Used for logging
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
|
|
||||||
// Desired number of cache entries (0 = ignore)
|
// Desired number of cache entries (0 = ignore)
|
||||||
const int m_target_size;
|
int const m_target_size;
|
||||||
|
|
||||||
// Desired maximum cache age
|
// Desired maximum cache age
|
||||||
const clock_type::duration m_target_age;
|
clock_type::duration const m_target_age;
|
||||||
|
|
||||||
// Number of items cached
|
// Number of items cached
|
||||||
int m_cache_count;
|
std::atomic<int> m_cache_count;
|
||||||
cache_type m_cache; // Hold strong reference to recent objects
|
cache_type m_cache; // Hold strong reference to recent objects
|
||||||
std::uint64_t m_hits;
|
std::atomic<std::uint64_t> m_hits;
|
||||||
std::uint64_t m_misses;
|
std::atomic<std::uint64_t> m_misses;
|
||||||
|
mutable std::vector<mutex_type> partitionLocks_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <xrpl/basics/IntrusivePointer.ipp>
|
#include <xrpl/basics/IntrusivePointer.ipp>
|
||||||
#include <xrpl/basics/TaggedCache.h>
|
#include <xrpl/basics/TaggedCache.h>
|
||||||
|
#include <xrpl/beast/core/CurrentThreadName.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
@@ -60,6 +61,7 @@ inline TaggedCache<
|
|||||||
, m_hits(0)
|
, m_hits(0)
|
||||||
, m_misses(0)
|
, m_misses(0)
|
||||||
{
|
{
|
||||||
|
partitionLocks_ = std::vector<mutex_type>(m_cache.partitions());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
@@ -105,8 +107,13 @@ TaggedCache<
|
|||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::size() const
|
Mutex>::size() const
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
std::size_t totalSize = 0;
|
||||||
return m_cache.size();
|
for (size_t i = 0; i < partitionLocks_.size(); ++i)
|
||||||
|
{
|
||||||
|
std::lock_guard<Mutex> lock(partitionLocks_[i]);
|
||||||
|
totalSize += m_cache.map()[i].size();
|
||||||
|
}
|
||||||
|
return totalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
@@ -129,8 +136,7 @@ TaggedCache<
|
|||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::getCacheSize() const
|
Mutex>::getCacheSize() const
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
return m_cache_count.load(std::memory_order_relaxed);
|
||||||
return m_cache_count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
@@ -153,8 +159,7 @@ TaggedCache<
|
|||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::getTrackSize() const
|
Mutex>::getTrackSize() const
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
return size();
|
||||||
return m_cache.size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
@@ -177,9 +182,10 @@ TaggedCache<
|
|||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::getHitRate()
|
Mutex>::getHitRate()
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
auto hits = m_hits.load(std::memory_order_relaxed);
|
||||||
auto const total = static_cast<float>(m_hits + m_misses);
|
auto misses = m_misses.load(std::memory_order_relaxed);
|
||||||
return m_hits * (100.0f / std::max(1.0f, total));
|
float total = float(hits + misses);
|
||||||
|
return hits * (100.0f / std::max(1.0f, total));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
@@ -202,9 +208,12 @@ TaggedCache<
|
|||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::clear()
|
Mutex>::clear()
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
for (auto& mutex : partitionLocks_)
|
||||||
|
mutex.lock();
|
||||||
m_cache.clear();
|
m_cache.clear();
|
||||||
m_cache_count = 0;
|
for (auto& mutex : partitionLocks_)
|
||||||
|
mutex.unlock();
|
||||||
|
m_cache_count.store(0, std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
@@ -227,11 +236,14 @@ TaggedCache<
|
|||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::reset()
|
Mutex>::reset()
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
for (auto& mutex : partitionLocks_)
|
||||||
|
mutex.lock();
|
||||||
m_cache.clear();
|
m_cache.clear();
|
||||||
m_cache_count = 0;
|
for (auto& mutex : partitionLocks_)
|
||||||
m_hits = 0;
|
mutex.unlock();
|
||||||
m_misses = 0;
|
m_cache_count.store(0, std::memory_order_relaxed);
|
||||||
|
m_hits.store(0, std::memory_order_relaxed);
|
||||||
|
m_misses.store(0, std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
@@ -255,7 +267,7 @@ TaggedCache<
|
|||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::touch_if_exists(KeyComparable const& key)
|
Mutex>::touch_if_exists(KeyComparable const& key)
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard<Mutex> lock(lockPartition(key));
|
||||||
auto const iter(m_cache.find(key));
|
auto const iter(m_cache.find(key));
|
||||||
if (iter == m_cache.end())
|
if (iter == m_cache.end())
|
||||||
{
|
{
|
||||||
@@ -297,8 +309,6 @@ TaggedCache<
|
|||||||
|
|
||||||
auto const start = std::chrono::steady_clock::now();
|
auto const start = std::chrono::steady_clock::now();
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
|
||||||
|
|
||||||
if (m_target_size == 0 ||
|
if (m_target_size == 0 ||
|
||||||
(static_cast<int>(m_cache.size()) <= m_target_size))
|
(static_cast<int>(m_cache.size()) <= m_target_size))
|
||||||
{
|
{
|
||||||
@@ -330,12 +340,13 @@ TaggedCache<
|
|||||||
m_cache.map()[p],
|
m_cache.map()[p],
|
||||||
allStuffToSweep[p],
|
allStuffToSweep[p],
|
||||||
allRemovals,
|
allRemovals,
|
||||||
lock));
|
partitionLocks_[p]));
|
||||||
}
|
}
|
||||||
for (std::thread& worker : workers)
|
for (std::thread& worker : workers)
|
||||||
worker.join();
|
worker.join();
|
||||||
|
|
||||||
m_cache_count -= allRemovals;
|
int removals = allRemovals.load(std::memory_order_relaxed);
|
||||||
|
m_cache_count.fetch_sub(removals, std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
// At this point allStuffToSweep will go out of scope outside the lock
|
// At this point allStuffToSweep will go out of scope outside the lock
|
||||||
// and decrement the reference count on each strong pointer.
|
// and decrement the reference count on each strong pointer.
|
||||||
@@ -365,11 +376,12 @@ TaggedCache<
|
|||||||
SharedPointerType,
|
SharedPointerType,
|
||||||
Hash,
|
Hash,
|
||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::del(const key_type& key, bool valid)
|
Mutex>::del(key_type const& key, bool valid)
|
||||||
{
|
{
|
||||||
// Remove from cache, if !valid, remove from map too. Returns true if
|
// Remove from cache, if !valid, remove from map too. Returns true if
|
||||||
// removed from cache
|
// removed from cache
|
||||||
std::lock_guard lock(m_mutex);
|
|
||||||
|
std::lock_guard<Mutex> lock(lockPartition(key));
|
||||||
|
|
||||||
auto cit = m_cache.find(key);
|
auto cit = m_cache.find(key);
|
||||||
|
|
||||||
@@ -382,7 +394,7 @@ TaggedCache<
|
|||||||
|
|
||||||
if (entry.isCached())
|
if (entry.isCached())
|
||||||
{
|
{
|
||||||
--m_cache_count;
|
m_cache_count.fetch_sub(1, std::memory_order_relaxed);
|
||||||
entry.ptr.convertToWeak();
|
entry.ptr.convertToWeak();
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
@@ -414,23 +426,22 @@ TaggedCache<
|
|||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::
|
Mutex>::
|
||||||
canonicalize(
|
canonicalize(
|
||||||
const key_type& key,
|
key_type const& key,
|
||||||
SharedPointerType& data,
|
SharedPointerType& data,
|
||||||
R&& replaceCallback)
|
R&& replaceCallback)
|
||||||
{
|
{
|
||||||
// Return canonical value, store if needed, refresh in cache
|
// Return canonical value, store if needed, refresh in cache
|
||||||
// Return values: true=we had the data already
|
// Return values: true=we had the data already
|
||||||
std::lock_guard lock(m_mutex);
|
|
||||||
|
|
||||||
|
std::lock_guard<Mutex> lock(lockPartition(key));
|
||||||
auto cit = m_cache.find(key);
|
auto cit = m_cache.find(key);
|
||||||
|
|
||||||
if (cit == m_cache.end())
|
if (cit == m_cache.end())
|
||||||
{
|
{
|
||||||
m_cache.emplace(
|
m_cache.emplace(
|
||||||
std::piecewise_construct,
|
std::piecewise_construct,
|
||||||
std::forward_as_tuple(key),
|
std::forward_as_tuple(key),
|
||||||
std::forward_as_tuple(m_clock.now(), data));
|
std::forward_as_tuple(m_clock.now(), data));
|
||||||
++m_cache_count;
|
m_cache_count.fetch_add(1, std::memory_order_relaxed);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,12 +490,12 @@ TaggedCache<
|
|||||||
data = cachedData;
|
data = cachedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
++m_cache_count;
|
m_cache_count.fetch_add(1, std::memory_order_relaxed);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.ptr = data;
|
entry.ptr = data;
|
||||||
++m_cache_count;
|
m_cache_count.fetch_add(1, std::memory_order_relaxed);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -509,7 +520,7 @@ TaggedCache<
|
|||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::
|
Mutex>::
|
||||||
canonicalize_replace_cache(
|
canonicalize_replace_cache(
|
||||||
const key_type& key,
|
key_type const& key,
|
||||||
SharedPointerType const& data)
|
SharedPointerType const& data)
|
||||||
{
|
{
|
||||||
return canonicalize(
|
return canonicalize(
|
||||||
@@ -535,7 +546,7 @@ TaggedCache<
|
|||||||
Hash,
|
Hash,
|
||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::
|
Mutex>::
|
||||||
canonicalize_replace_client(const key_type& key, SharedPointerType& data)
|
canonicalize_replace_client(key_type const& key, SharedPointerType& data)
|
||||||
{
|
{
|
||||||
return canonicalize(key, data, []() { return false; });
|
return canonicalize(key, data, []() { return false; });
|
||||||
}
|
}
|
||||||
@@ -558,12 +569,13 @@ TaggedCache<
|
|||||||
SharedPointerType,
|
SharedPointerType,
|
||||||
Hash,
|
Hash,
|
||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::fetch(const key_type& key)
|
Mutex>::fetch(key_type const& key)
|
||||||
{
|
{
|
||||||
std::lock_guard<mutex_type> l(m_mutex);
|
std::lock_guard<Mutex> lock(lockPartition(key));
|
||||||
auto ret = initialFetch(key, l);
|
|
||||||
|
auto ret = initialFetch(key);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
++m_misses;
|
m_misses.fetch_add(1, std::memory_order_relaxed);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,8 +639,8 @@ TaggedCache<
|
|||||||
Mutex>::insert(key_type const& key)
|
Mutex>::insert(key_type const& key)
|
||||||
-> std::enable_if_t<IsKeyCache, ReturnType>
|
-> std::enable_if_t<IsKeyCache, ReturnType>
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
|
||||||
clock_type::time_point const now(m_clock.now());
|
clock_type::time_point const now(m_clock.now());
|
||||||
|
std::lock_guard<Mutex> lock(lockPartition(key));
|
||||||
auto [it, inserted] = m_cache.emplace(
|
auto [it, inserted] = m_cache.emplace(
|
||||||
std::piecewise_construct,
|
std::piecewise_construct,
|
||||||
std::forward_as_tuple(key),
|
std::forward_as_tuple(key),
|
||||||
@@ -656,7 +668,7 @@ TaggedCache<
|
|||||||
SharedPointerType,
|
SharedPointerType,
|
||||||
Hash,
|
Hash,
|
||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::retrieve(const key_type& key, T& data)
|
Mutex>::retrieve(key_type const& key, T& data)
|
||||||
{
|
{
|
||||||
// retrieve the value of the stored data
|
// retrieve the value of the stored data
|
||||||
auto entry = fetch(key);
|
auto entry = fetch(key);
|
||||||
@@ -668,29 +680,6 @@ TaggedCache<
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
|
||||||
class Key,
|
|
||||||
class T,
|
|
||||||
bool IsKeyCache,
|
|
||||||
class SharedWeakUnionPointer,
|
|
||||||
class SharedPointerType,
|
|
||||||
class Hash,
|
|
||||||
class KeyEqual,
|
|
||||||
class Mutex>
|
|
||||||
inline auto
|
|
||||||
TaggedCache<
|
|
||||||
Key,
|
|
||||||
T,
|
|
||||||
IsKeyCache,
|
|
||||||
SharedWeakUnionPointer,
|
|
||||||
SharedPointerType,
|
|
||||||
Hash,
|
|
||||||
KeyEqual,
|
|
||||||
Mutex>::peekMutex() -> mutex_type&
|
|
||||||
{
|
|
||||||
return m_mutex;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <
|
template <
|
||||||
class Key,
|
class Key,
|
||||||
class T,
|
class T,
|
||||||
@@ -714,10 +703,13 @@ TaggedCache<
|
|||||||
std::vector<key_type> v;
|
std::vector<key_type> v;
|
||||||
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
|
||||||
v.reserve(m_cache.size());
|
v.reserve(m_cache.size());
|
||||||
for (auto const& _ : m_cache)
|
for (std::size_t i = 0; i < partitionLocks_.size(); ++i)
|
||||||
v.push_back(_.first);
|
{
|
||||||
|
std::lock_guard<Mutex> lock(partitionLocks_[i]);
|
||||||
|
for (auto const& entry : m_cache.map()[i])
|
||||||
|
v.push_back(entry.first);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
@@ -743,11 +735,12 @@ TaggedCache<
|
|||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::rate() const
|
Mutex>::rate() const
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
auto hits = m_hits.load(std::memory_order_relaxed);
|
||||||
auto const tot = m_hits + m_misses;
|
auto misses = m_misses.load(std::memory_order_relaxed);
|
||||||
|
auto const tot = hits + misses;
|
||||||
if (tot == 0)
|
if (tot == 0)
|
||||||
return 0;
|
return 0.0;
|
||||||
return double(m_hits) / tot;
|
return double(hits) / tot;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
@@ -771,18 +764,16 @@ TaggedCache<
|
|||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::fetch(key_type const& digest, Handler const& h)
|
Mutex>::fetch(key_type const& digest, Handler const& h)
|
||||||
{
|
{
|
||||||
{
|
std::lock_guard<Mutex> lock(lockPartition(digest));
|
||||||
std::lock_guard l(m_mutex);
|
|
||||||
if (auto ret = initialFetch(digest, l))
|
if (auto ret = initialFetch(digest))
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
auto sle = h();
|
auto sle = h();
|
||||||
if (!sle)
|
if (!sle)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
std::lock_guard l(m_mutex);
|
m_misses.fetch_add(1, std::memory_order_relaxed);
|
||||||
++m_misses;
|
|
||||||
auto const [it, inserted] =
|
auto const [it, inserted] =
|
||||||
m_cache.emplace(digest, Entry(m_clock.now(), std::move(sle)));
|
m_cache.emplace(digest, Entry(m_clock.now(), std::move(sle)));
|
||||||
if (!inserted)
|
if (!inserted)
|
||||||
@@ -809,9 +800,10 @@ TaggedCache<
|
|||||||
SharedPointerType,
|
SharedPointerType,
|
||||||
Hash,
|
Hash,
|
||||||
KeyEqual,
|
KeyEqual,
|
||||||
Mutex>::
|
Mutex>::initialFetch(key_type const& key)
|
||||||
initialFetch(key_type const& key, std::lock_guard<mutex_type> const& l)
|
|
||||||
{
|
{
|
||||||
|
std::lock_guard<Mutex> lock(lockPartition(key));
|
||||||
|
|
||||||
auto cit = m_cache.find(key);
|
auto cit = m_cache.find(key);
|
||||||
if (cit == m_cache.end())
|
if (cit == m_cache.end())
|
||||||
return {};
|
return {};
|
||||||
@@ -819,7 +811,7 @@ TaggedCache<
|
|||||||
Entry& entry = cit->second;
|
Entry& entry = cit->second;
|
||||||
if (entry.isCached())
|
if (entry.isCached())
|
||||||
{
|
{
|
||||||
++m_hits;
|
m_hits.fetch_add(1, std::memory_order_relaxed);
|
||||||
entry.touch(m_clock.now());
|
entry.touch(m_clock.now());
|
||||||
return entry.ptr.getStrong();
|
return entry.ptr.getStrong();
|
||||||
}
|
}
|
||||||
@@ -827,12 +819,13 @@ TaggedCache<
|
|||||||
if (entry.isCached())
|
if (entry.isCached())
|
||||||
{
|
{
|
||||||
// independent of cache size, so not counted as a hit
|
// independent of cache size, so not counted as a hit
|
||||||
++m_cache_count;
|
m_cache_count.fetch_add(1, std::memory_order_relaxed);
|
||||||
entry.touch(m_clock.now());
|
entry.touch(m_clock.now());
|
||||||
return entry.ptr.getStrong();
|
return entry.ptr.getStrong();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cache.erase(cit);
|
m_cache.erase(cit); // TODO: if this erase happens on fetch, what is left
|
||||||
|
// for a sweep?
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -861,10 +854,11 @@ TaggedCache<
|
|||||||
{
|
{
|
||||||
beast::insight::Gauge::value_type hit_rate(0);
|
beast::insight::Gauge::value_type hit_rate(0);
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
auto const hits = m_hits.load(std::memory_order_relaxed);
|
||||||
auto const total(m_hits + m_misses);
|
auto const misses = m_misses.load(std::memory_order_relaxed);
|
||||||
|
auto const total = hits + misses;
|
||||||
if (total != 0)
|
if (total != 0)
|
||||||
hit_rate = (m_hits * 100) / total;
|
hit_rate = (hits * 100) / total;
|
||||||
}
|
}
|
||||||
m_stats.hit_rate.set(hit_rate);
|
m_stats.hit_rate.set(hit_rate);
|
||||||
}
|
}
|
||||||
@@ -895,12 +889,16 @@ TaggedCache<
|
|||||||
typename KeyValueCacheType::map_type& partition,
|
typename KeyValueCacheType::map_type& partition,
|
||||||
SweptPointersVector& stuffToSweep,
|
SweptPointersVector& stuffToSweep,
|
||||||
std::atomic<int>& allRemovals,
|
std::atomic<int>& allRemovals,
|
||||||
std::lock_guard<std::recursive_mutex> const&)
|
Mutex& partitionLock)
|
||||||
{
|
{
|
||||||
return std::thread([&, this]() {
|
return std::thread([&, this]() {
|
||||||
|
beast::setCurrentThreadName("sweep-1");
|
||||||
|
|
||||||
int cacheRemovals = 0;
|
int cacheRemovals = 0;
|
||||||
int mapRemovals = 0;
|
int mapRemovals = 0;
|
||||||
|
|
||||||
|
std::lock_guard<Mutex> lock(partitionLock);
|
||||||
|
|
||||||
// Keep references to all the stuff we sweep
|
// Keep references to all the stuff we sweep
|
||||||
// so that we can destroy them outside the lock.
|
// so that we can destroy them outside the lock.
|
||||||
stuffToSweep.reserve(partition.size());
|
stuffToSweep.reserve(partition.size());
|
||||||
@@ -984,12 +982,16 @@ TaggedCache<
|
|||||||
typename KeyOnlyCacheType::map_type& partition,
|
typename KeyOnlyCacheType::map_type& partition,
|
||||||
SweptPointersVector&,
|
SweptPointersVector&,
|
||||||
std::atomic<int>& allRemovals,
|
std::atomic<int>& allRemovals,
|
||||||
std::lock_guard<std::recursive_mutex> const&)
|
Mutex& partitionLock)
|
||||||
{
|
{
|
||||||
return std::thread([&, this]() {
|
return std::thread([&, this]() {
|
||||||
|
beast::setCurrentThreadName("sweep-2");
|
||||||
|
|
||||||
int cacheRemovals = 0;
|
int cacheRemovals = 0;
|
||||||
int mapRemovals = 0;
|
int mapRemovals = 0;
|
||||||
|
|
||||||
|
std::lock_guard<Mutex> lock(partitionLock);
|
||||||
|
|
||||||
// Keep references to all the stuff we sweep
|
// Keep references to all the stuff we sweep
|
||||||
// so that we can destroy them outside the lock.
|
// so that we can destroy them outside the lock.
|
||||||
{
|
{
|
||||||
@@ -1024,6 +1026,29 @@ TaggedCache<
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Key,
|
||||||
|
class T,
|
||||||
|
bool IsKeyCache,
|
||||||
|
class SharedWeakUnionPointer,
|
||||||
|
class SharedPointerType,
|
||||||
|
class Hash,
|
||||||
|
class KeyEqual,
|
||||||
|
class Mutex>
|
||||||
|
inline Mutex&
|
||||||
|
TaggedCache<
|
||||||
|
Key,
|
||||||
|
T,
|
||||||
|
IsKeyCache,
|
||||||
|
SharedWeakUnionPointer,
|
||||||
|
SharedPointerType,
|
||||||
|
Hash,
|
||||||
|
KeyEqual,
|
||||||
|
Mutex>::lockPartition(key_type const& key) const
|
||||||
|
{
|
||||||
|
return partitionLocks_[m_cache.partition_index(key)];
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
base_uint&
|
base_uint&
|
||||||
operator^=(const base_uint& b)
|
operator^=(base_uint const& 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&=(const base_uint& b)
|
operator&=(base_uint const& 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|=(const base_uint& b)
|
operator|=(base_uint const& 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
const base_uint
|
base_uint const
|
||||||
operator++(int)
|
operator++(int)
|
||||||
{
|
{
|
||||||
// postfix operator
|
// postfix operator
|
||||||
const base_uint ret = *this;
|
base_uint const ret = *this;
|
||||||
++(*this);
|
++(*this);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -441,11 +441,11 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
const base_uint
|
base_uint const
|
||||||
operator--(int)
|
operator--(int)
|
||||||
{
|
{
|
||||||
// postfix operator
|
// postfix operator
|
||||||
const base_uint ret = *this;
|
base_uint const ret = *this;
|
||||||
--(*this);
|
--(*this);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -466,7 +466,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
base_uint&
|
base_uint&
|
||||||
operator+=(const base_uint& b)
|
operator+=(base_uint const& b)
|
||||||
{
|
{
|
||||||
std::uint64_t carry = 0;
|
std::uint64_t carry = 0;
|
||||||
|
|
||||||
@@ -511,7 +511,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] constexpr bool
|
[[nodiscard]] constexpr bool
|
||||||
parseHex(const char* str)
|
parseHex(char const* str)
|
||||||
{
|
{
|
||||||
return parseHex(std::string_view{str});
|
return parseHex(std::string_view{str});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ struct less
|
|||||||
using result_type = bool;
|
using result_type = bool;
|
||||||
|
|
||||||
constexpr bool
|
constexpr bool
|
||||||
operator()(const T& left, const T& right) const
|
operator()(T const& left, T const& 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()(const T& left, const T& right) const
|
operator()(T const& left, T const& right) const
|
||||||
{
|
{
|
||||||
return std::equal_to<T>()(left, right);
|
return std::equal_to<T>()(left, right);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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<const Key, Value>>>
|
typename Alloc = std::allocator<std::pair<Key const, Value>>>
|
||||||
class partitioned_unordered_map
|
class partitioned_unordered_map
|
||||||
{
|
{
|
||||||
std::size_t partitions_;
|
std::size_t partitions_;
|
||||||
@@ -277,6 +277,12 @@ public:
|
|||||||
return map_;
|
return map_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
partition_map_type const&
|
||||||
|
map() const
|
||||||
|
{
|
||||||
|
return map_;
|
||||||
|
}
|
||||||
|
|
||||||
iterator
|
iterator
|
||||||
begin()
|
begin()
|
||||||
{
|
{
|
||||||
@@ -321,6 +327,12 @@ public:
|
|||||||
return cend();
|
return cend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::size_t
|
||||||
|
partition_index(key_type const& key) const
|
||||||
|
{
|
||||||
|
return partitioner(key);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <class T>
|
template <class T>
|
||||||
void
|
void
|
||||||
@@ -380,7 +392,7 @@ public:
|
|||||||
clear()
|
clear()
|
||||||
{
|
{
|
||||||
for (auto& p : map_)
|
for (auto& p : map_)
|
||||||
p.clear();
|
p.clear(); // TODO make sure that it is locked inside
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator
|
iterator
|
||||||
@@ -406,7 +418,7 @@ public:
|
|||||||
{
|
{
|
||||||
std::size_t ret = 0;
|
std::size_t ret = 0;
|
||||||
for (auto& p : map_)
|
for (auto& p : map_)
|
||||||
ret += p.size();
|
ret += p.size(); // TODO make sure that it is locked inside
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,13 +76,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator<(const tagged_integer& rhs) const noexcept
|
operator<(tagged_integer const& rhs) const noexcept
|
||||||
{
|
{
|
||||||
return m_value < rhs.m_value;
|
return m_value < rhs.m_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator==(const tagged_integer& rhs) const noexcept
|
operator==(tagged_integer const& 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<<=(const tagged_integer& rhs) noexcept
|
operator<<=(tagged_integer const& rhs) noexcept
|
||||||
{
|
{
|
||||||
m_value <<= rhs.m_value;
|
m_value <<= rhs.m_value;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
tagged_integer&
|
tagged_integer&
|
||||||
operator>>=(const tagged_integer& rhs) noexcept
|
operator>>=(tagged_integer const& rhs) noexcept
|
||||||
{
|
{
|
||||||
m_value >>= rhs.m_value;
|
m_value >>= rhs.m_value;
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace beast {
|
|||||||
template <class Hasher = xxhasher>
|
template <class Hasher = xxhasher>
|
||||||
struct uhash
|
struct uhash
|
||||||
{
|
{
|
||||||
explicit uhash() = default;
|
uhash() = default;
|
||||||
|
|
||||||
using result_type = typename Hasher::result_type;
|
using result_type = typename Hasher::result_type;
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ namespace std {
|
|||||||
template <>
|
template <>
|
||||||
struct hash<::beast::IP::Endpoint>
|
struct hash<::beast::IP::Endpoint>
|
||||||
{
|
{
|
||||||
explicit hash() = default;
|
hash() = default;
|
||||||
|
|
||||||
std::size_t
|
std::size_t
|
||||||
operator()(::beast::IP::Endpoint const& endpoint) const
|
operator()(::beast::IP::Endpoint const& endpoint) const
|
||||||
@@ -230,7 +230,7 @@ namespace boost {
|
|||||||
template <>
|
template <>
|
||||||
struct hash<::beast::IP::Endpoint>
|
struct hash<::beast::IP::Endpoint>
|
||||||
{
|
{
|
||||||
explicit hash() = default;
|
hash() = default;
|
||||||
|
|
||||||
std::size_t
|
std::size_t
|
||||||
operator()(::beast::IP::Endpoint const& endpoint) const
|
operator()(::beast::IP::Endpoint const& endpoint) const
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ class temp_dir
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
#if !GENERATING_DOCS
|
#if !GENERATING_DOCS
|
||||||
temp_dir(const temp_dir&) = delete;
|
temp_dir(temp_dir const&) = delete;
|
||||||
temp_dir&
|
temp_dir&
|
||||||
operator=(const temp_dir&) = delete;
|
operator=(temp_dir const&) = delete;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Construct a temporary directory.
|
/// Construct a temporary directory.
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class Reader
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Char = char;
|
using Char = char;
|
||||||
using Location = const Char*;
|
using Location = Char const*;
|
||||||
|
|
||||||
/** \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(const char* beginDoc, const char* endDoc, Value& root);
|
parse(char const* beginDoc, char const* 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, const char* message);
|
expectToken(TokenType type, Token& token, char const* message);
|
||||||
bool
|
bool
|
||||||
readToken(Token& token);
|
readToken(Token& token);
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -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(const char* czstring) : str_(czstring)
|
constexpr explicit StaticString(char const* czstring) : str_(czstring)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr
|
constexpr
|
||||||
operator const char*() const
|
operator char const*() const
|
||||||
{
|
{
|
||||||
return str_;
|
return str_;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const char*
|
constexpr char const*
|
||||||
c_str() const
|
c_str() const
|
||||||
{
|
{
|
||||||
return str_;
|
return str_;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* str_;
|
char const* 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 const Value null;
|
static Value const null;
|
||||||
static const Int minInt;
|
static Int const minInt;
|
||||||
static const Int maxInt;
|
static Int const maxInt;
|
||||||
static const UInt maxUInt;
|
static UInt const maxUInt;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class CZString
|
class CZString
|
||||||
@@ -171,24 +173,24 @@ private:
|
|||||||
duplicateOnCopy
|
duplicateOnCopy
|
||||||
};
|
};
|
||||||
CZString(int index);
|
CZString(int index);
|
||||||
CZString(const char* cstr, DuplicationPolicy allocate);
|
CZString(char const* cstr, DuplicationPolicy allocate);
|
||||||
CZString(const CZString& other);
|
CZString(CZString const& other);
|
||||||
~CZString();
|
~CZString();
|
||||||
CZString&
|
CZString&
|
||||||
operator=(const CZString& other) = delete;
|
operator=(CZString const& other) = delete;
|
||||||
bool
|
bool
|
||||||
operator<(const CZString& other) const;
|
operator<(CZString const& other) const;
|
||||||
bool
|
bool
|
||||||
operator==(const CZString& other) const;
|
operator==(CZString const& other) const;
|
||||||
int
|
int
|
||||||
index() const;
|
index() const;
|
||||||
const char*
|
char const*
|
||||||
c_str() const;
|
c_str() const;
|
||||||
bool
|
bool
|
||||||
isStaticString() const;
|
isStaticString() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* cstr_;
|
char const* 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(const char* value);
|
Value(char const* 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(const StaticString& value);
|
Value(StaticString const& value);
|
||||||
Value(std::string const& value);
|
Value(std::string const& value);
|
||||||
Value(bool value);
|
Value(bool value);
|
||||||
Value(const Value& other);
|
Value(Value const& other);
|
||||||
~Value();
|
~Value();
|
||||||
|
|
||||||
Value&
|
Value&
|
||||||
@@ -247,7 +250,7 @@ public:
|
|||||||
ValueType
|
ValueType
|
||||||
type() const;
|
type() const;
|
||||||
|
|
||||||
const char*
|
char const*
|
||||||
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.)
|
||||||
const Value&
|
Value const&
|
||||||
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, const Value& defaultValue) const;
|
get(UInt index, Value const& 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(const Value& value);
|
append(Value const& 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[](const char* key);
|
operator[](char 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.
|
||||||
const Value&
|
Value const&
|
||||||
operator[](const char* key) const;
|
operator[](char const* 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.
|
||||||
const Value&
|
Value const&
|
||||||
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[](const StaticString& key);
|
operator[](StaticString const& key);
|
||||||
|
Value const&
|
||||||
|
operator[](StaticString const& 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(const char* key, const Value& defaultValue) const;
|
get(char const* key, Value const& 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, const Value& defaultValue) const;
|
get(std::string const& key, Value const& 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(const char* key);
|
removeMember(char const* 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(const char* key) const;
|
isMember(char const* 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==(const Value&, const Value&);
|
operator==(Value const&, Value const&);
|
||||||
friend bool
|
friend bool
|
||||||
operator<(const Value&, const Value&);
|
operator<(Value const&, Value const&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Value&
|
Value&
|
||||||
resolveReference(const char* key, bool isStatic);
|
resolveReference(char const* 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==(const Value&, const Value&);
|
operator==(Value const&, Value const&);
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
operator!=(const Value& x, const Value& y)
|
operator!=(Value const& x, Value const& y)
|
||||||
{
|
{
|
||||||
return !(x == y);
|
return !(x == y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator<(const Value&, const Value&);
|
operator<(Value const&, Value const&);
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
operator<=(const Value& x, const Value& y)
|
operator<=(Value const& x, Value const& y)
|
||||||
{
|
{
|
||||||
return !(y < x);
|
return !(y < x);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
operator>(const Value& x, const Value& y)
|
operator>(Value const& x, Value const& y)
|
||||||
{
|
{
|
||||||
return y < x;
|
return y < x;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
operator>=(const Value& x, const Value& y)
|
operator>=(Value const& x, Value const& y)
|
||||||
{
|
{
|
||||||
return !(x < y);
|
return !(x < y);
|
||||||
}
|
}
|
||||||
@@ -482,11 +493,11 @@ public:
|
|||||||
virtual ~ValueAllocator() = default;
|
virtual ~ValueAllocator() = default;
|
||||||
|
|
||||||
virtual char*
|
virtual char*
|
||||||
makeMemberName(const char* memberName) = 0;
|
makeMemberName(char const* memberName) = 0;
|
||||||
virtual void
|
virtual void
|
||||||
releaseMemberName(char* memberName) = 0;
|
releaseMemberName(char* memberName) = 0;
|
||||||
virtual char*
|
virtual char*
|
||||||
duplicateStringValue(const char* value, unsigned int length = unknown) = 0;
|
duplicateStringValue(char const* 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(const Value::ObjectValues::iterator& current);
|
explicit ValueIteratorBase(Value::ObjectValues::iterator const& current);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator==(const SelfType& other) const
|
operator==(SelfType const& other) const
|
||||||
{
|
{
|
||||||
return isEqual(other);
|
return isEqual(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator!=(const SelfType& other) const
|
operator!=(SelfType const& 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.
|
||||||
const char*
|
char const*
|
||||||
memberName() const;
|
memberName() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -542,13 +553,13 @@ protected:
|
|||||||
decrement();
|
decrement();
|
||||||
|
|
||||||
difference_type
|
difference_type
|
||||||
computeDistance(const SelfType& other) const;
|
computeDistance(SelfType const& other) const;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEqual(const SelfType& other) const;
|
isEqual(SelfType const& other) const;
|
||||||
|
|
||||||
void
|
void
|
||||||
copy(const SelfType& other);
|
copy(SelfType const& 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 = const Value&;
|
using reference = Value const&;
|
||||||
using pointer = const Value*;
|
using pointer = Value const*;
|
||||||
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(const Value::ObjectValues::iterator& current);
|
explicit ValueConstIterator(Value::ObjectValues::iterator const& current);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SelfType&
|
SelfType&
|
||||||
operator=(const ValueIteratorBase& other);
|
operator=(ValueIteratorBase const& other);
|
||||||
|
|
||||||
SelfType
|
SelfType
|
||||||
operator++(int)
|
operator++(int)
|
||||||
@@ -632,17 +643,17 @@ public:
|
|||||||
using SelfType = ValueIterator;
|
using SelfType = ValueIterator;
|
||||||
|
|
||||||
ValueIterator() = default;
|
ValueIterator() = default;
|
||||||
ValueIterator(const ValueConstIterator& other);
|
ValueIterator(ValueConstIterator const& other);
|
||||||
ValueIterator(const ValueIterator& other);
|
ValueIterator(ValueIterator const& other);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*! \internal Use by Value to create an iterator.
|
/*! \internal Use by Value to create an iterator.
|
||||||
*/
|
*/
|
||||||
explicit ValueIterator(const Value::ObjectValues::iterator& current);
|
explicit ValueIterator(Value::ObjectValues::iterator const& current);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SelfType&
|
SelfType&
|
||||||
operator=(const SelfType& other);
|
operator=(SelfType const& other);
|
||||||
|
|
||||||
SelfType
|
SelfType
|
||||||
operator++(int)
|
operator++(int)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual std::string
|
virtual std::string
|
||||||
write(const Value& root) = 0;
|
write(Value const& 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(const Value& root) override;
|
write(Value const& root) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void
|
void
|
||||||
writeValue(const Value& value);
|
writeValue(Value const& 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(const Value& root) override;
|
write(Value const& root) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void
|
void
|
||||||
writeValue(const Value& value);
|
writeValue(Value const& value);
|
||||||
void
|
void
|
||||||
writeArrayValue(const Value& value);
|
writeArrayValue(Value const& value);
|
||||||
bool
|
bool
|
||||||
isMultineArray(const Value& value);
|
isMultineArray(Value const& 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, const Value& root);
|
write(std::ostream& out, Value const& root);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void
|
void
|
||||||
writeValue(const Value& value);
|
writeValue(Value const& value);
|
||||||
void
|
void
|
||||||
writeArrayValue(const Value& value);
|
writeArrayValue(Value const& value);
|
||||||
bool
|
bool
|
||||||
isMultineArray(const Value& value);
|
isMultineArray(Value const& 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(const char* value);
|
valueToQuotedString(char const* value);
|
||||||
|
|
||||||
/// \brief Output using the StyledStreamWriter.
|
/// \brief Output using the StyledStreamWriter.
|
||||||
/// \see Json::operator>>()
|
/// \see Json::operator>>()
|
||||||
std::ostream&
|
std::ostream&
|
||||||
operator<<(std::ostream&, const Value& root);
|
operator<<(std::ostream&, Value const& root);
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -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&, const Value& root);
|
operator<<(std::ostream&, Value const& root);
|
||||||
|
|
||||||
} // namespace Json
|
} // namespace Json
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ namespace std {
|
|||||||
template <>
|
template <>
|
||||||
struct hash<ripple::AccountID> : ripple::AccountID::hasher
|
struct hash<ripple::AccountID> : ripple::AccountID::hasher
|
||||||
{
|
{
|
||||||
explicit hash() = default;
|
hash() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
37
include/xrpl/protocol/Batch.h
Normal file
37
include/xrpl/protocol/Batch.h
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
This file is part of rippled: https://github.com/ripple/rippled
|
||||||
|
Copyright (c) 2024 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/protocol/HashPrefix.h>
|
||||||
|
#include <xrpl/protocol/STVector256.h>
|
||||||
|
#include <xrpl/protocol/Serializer.h>
|
||||||
|
|
||||||
|
namespace ripple {
|
||||||
|
|
||||||
|
inline void
|
||||||
|
serializeBatch(
|
||||||
|
Serializer& msg,
|
||||||
|
std::uint32_t const& flags,
|
||||||
|
std::vector<uint256> const& txids)
|
||||||
|
{
|
||||||
|
msg.add32(HashPrefix::batch);
|
||||||
|
msg.add32(flags);
|
||||||
|
msg.add32(std::uint32_t(txids.size()));
|
||||||
|
for (auto const& txid : txids)
|
||||||
|
msg.addBitString(txid);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ripple
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#define RIPPLE_PROTOCOL_BOOK_H_INCLUDED
|
#define RIPPLE_PROTOCOL_BOOK_H_INCLUDED
|
||||||
|
|
||||||
#include <xrpl/basics/CountedObject.h>
|
#include <xrpl/basics/CountedObject.h>
|
||||||
|
#include <xrpl/basics/base_uint.h>
|
||||||
#include <xrpl/protocol/Issue.h>
|
#include <xrpl/protocol/Issue.h>
|
||||||
|
|
||||||
#include <boost/utility/base_from_member.hpp>
|
#include <boost/utility/base_from_member.hpp>
|
||||||
@@ -36,12 +37,17 @@ class Book final : public CountedObject<Book>
|
|||||||
public:
|
public:
|
||||||
Issue in;
|
Issue in;
|
||||||
Issue out;
|
Issue out;
|
||||||
|
std::optional<uint256> domain;
|
||||||
|
|
||||||
Book()
|
Book()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Book(Issue const& in_, Issue const& out_) : in(in_), out(out_)
|
Book(
|
||||||
|
Issue const& in_,
|
||||||
|
Issue const& out_,
|
||||||
|
std::optional<uint256> const& domain_)
|
||||||
|
: in(in_), out(out_), domain(domain_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -61,6 +67,8 @@ hash_append(Hasher& h, Book const& b)
|
|||||||
{
|
{
|
||||||
using beast::hash_append;
|
using beast::hash_append;
|
||||||
hash_append(h, b.in, b.out);
|
hash_append(h, b.in, b.out);
|
||||||
|
if (b.domain)
|
||||||
|
hash_append(h, *(b.domain));
|
||||||
}
|
}
|
||||||
|
|
||||||
Book
|
Book
|
||||||
@@ -71,7 +79,8 @@ reversed(Book const& book);
|
|||||||
[[nodiscard]] inline constexpr bool
|
[[nodiscard]] inline constexpr bool
|
||||||
operator==(Book const& lhs, Book const& rhs)
|
operator==(Book const& lhs, Book const& rhs)
|
||||||
{
|
{
|
||||||
return (lhs.in == rhs.in) && (lhs.out == rhs.out);
|
return (lhs.in == rhs.in) && (lhs.out == rhs.out) &&
|
||||||
|
(lhs.domain == rhs.domain);
|
||||||
}
|
}
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
@@ -82,7 +91,18 @@ operator<=>(Book const& lhs, Book const& rhs)
|
|||||||
{
|
{
|
||||||
if (auto const c{lhs.in <=> rhs.in}; c != 0)
|
if (auto const c{lhs.in <=> rhs.in}; c != 0)
|
||||||
return c;
|
return c;
|
||||||
return lhs.out <=> rhs.out;
|
if (auto const c{lhs.out <=> rhs.out}; c != 0)
|
||||||
|
return c;
|
||||||
|
|
||||||
|
// Manually compare optionals
|
||||||
|
if (lhs.domain && rhs.domain)
|
||||||
|
return *lhs.domain <=> *rhs.domain; // Compare values if both exist
|
||||||
|
if (!lhs.domain && rhs.domain)
|
||||||
|
return std::weak_ordering::less; // Empty is considered less
|
||||||
|
if (lhs.domain && !rhs.domain)
|
||||||
|
return std::weak_ordering::greater; // Non-empty is greater
|
||||||
|
|
||||||
|
return std::weak_ordering::equivalent; // Both are empty
|
||||||
}
|
}
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
@@ -104,7 +124,7 @@ private:
|
|||||||
boost::base_from_member<std::hash<ripple::AccountID>, 1>;
|
boost::base_from_member<std::hash<ripple::AccountID>, 1>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit hash() = default;
|
hash() = default;
|
||||||
|
|
||||||
using value_type = std::size_t;
|
using value_type = std::size_t;
|
||||||
using argument_type = ripple::Issue;
|
using argument_type = ripple::Issue;
|
||||||
@@ -126,12 +146,14 @@ template <>
|
|||||||
struct hash<ripple::Book>
|
struct hash<ripple::Book>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using hasher = std::hash<ripple::Issue>;
|
using issue_hasher = std::hash<ripple::Issue>;
|
||||||
|
using uint256_hasher = ripple::uint256::hasher;
|
||||||
|
|
||||||
hasher m_hasher;
|
issue_hasher m_issue_hasher;
|
||||||
|
uint256_hasher m_uint256_hasher;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit hash() = default;
|
hash() = default;
|
||||||
|
|
||||||
using value_type = std::size_t;
|
using value_type = std::size_t;
|
||||||
using argument_type = ripple::Book;
|
using argument_type = ripple::Book;
|
||||||
@@ -139,8 +161,12 @@ public:
|
|||||||
value_type
|
value_type
|
||||||
operator()(argument_type const& value) const
|
operator()(argument_type const& value) const
|
||||||
{
|
{
|
||||||
value_type result(m_hasher(value.in));
|
value_type result(m_issue_hasher(value.in));
|
||||||
boost::hash_combine(result, m_hasher(value.out));
|
boost::hash_combine(result, m_issue_hasher(value.out));
|
||||||
|
|
||||||
|
if (value.domain)
|
||||||
|
boost::hash_combine(result, m_uint256_hasher(*value.domain));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -154,7 +180,7 @@ namespace boost {
|
|||||||
template <>
|
template <>
|
||||||
struct hash<ripple::Issue> : std::hash<ripple::Issue>
|
struct hash<ripple::Issue> : std::hash<ripple::Issue>
|
||||||
{
|
{
|
||||||
explicit hash() = default;
|
hash() = default;
|
||||||
|
|
||||||
using Base = std::hash<ripple::Issue>;
|
using Base = std::hash<ripple::Issue>;
|
||||||
// VFALCO NOTE broken in vs2012
|
// VFALCO NOTE broken in vs2012
|
||||||
@@ -164,7 +190,7 @@ struct hash<ripple::Issue> : std::hash<ripple::Issue>
|
|||||||
template <>
|
template <>
|
||||||
struct hash<ripple::Book> : std::hash<ripple::Book>
|
struct hash<ripple::Book> : std::hash<ripple::Book>
|
||||||
{
|
{
|
||||||
explicit hash() = default;
|
hash() = default;
|
||||||
|
|
||||||
using Base = std::hash<ripple::Book>;
|
using Base = std::hash<ripple::Book>;
|
||||||
// VFALCO NOTE broken in vs2012
|
// VFALCO NOTE broken in vs2012
|
||||||
|
|||||||
@@ -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,
|
||||||
// unused 68,
|
rpcDELEGATE_ACT_NOT_FOUND = 68,
|
||||||
rpcSRC_CUR_MALFORMED = 69,
|
rpcSRC_CUR_MALFORMED = 69,
|
||||||
rpcSRC_ISR_MALFORMED = 70,
|
rpcSRC_ISR_MALFORMED = 70,
|
||||||
rpcSTREAM_MALFORMED = 71,
|
rpcSTREAM_MALFORMED = 71,
|
||||||
@@ -154,7 +154,10 @@ enum error_code_i {
|
|||||||
// Simulate
|
// Simulate
|
||||||
rpcTX_SIGNED = 96,
|
rpcTX_SIGNED = 96,
|
||||||
|
|
||||||
rpcLAST = rpcTX_SIGNED // rpcLAST should always equal the last code.
|
// Pathfinding
|
||||||
|
rpcDOMAIN_MALFORMED = 97,
|
||||||
|
|
||||||
|
rpcLAST = rpcDOMAIN_MALFORMED // rpcLAST should always equal the last code.
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Codes returned in the `warnings` array of certain RPC commands.
|
/** Codes returned in the `warnings` array of certain RPC commands.
|
||||||
|
|||||||
@@ -55,6 +55,18 @@
|
|||||||
* `VoteBehavior::DefaultYes`. The communication process is beyond
|
* `VoteBehavior::DefaultYes`. The communication process is beyond
|
||||||
* the scope of these instructions.
|
* the scope of these instructions.
|
||||||
*
|
*
|
||||||
|
* 5) A feature marked as Obsolete can mean either:
|
||||||
|
* 1) It is in the ledger (marked as Supported::yes) and it is on its way to
|
||||||
|
* become Retired
|
||||||
|
* 2) The feature is not in the ledger (has always been marked as
|
||||||
|
* Supported::no) and the code to support it has been removed
|
||||||
|
*
|
||||||
|
* If we want to discontinue a feature that we've never fully supported and
|
||||||
|
* the feature has never been enabled, we should remove all the related
|
||||||
|
* code, and mark the feature as "abandoned". To do this:
|
||||||
|
*
|
||||||
|
* 1) Open features.macro, move the feature to the abandoned section and
|
||||||
|
* change the macro to XRPL_ABANDON
|
||||||
*
|
*
|
||||||
* When a feature has been enabled for several years, the conditional code
|
* When a feature has been enabled for several years, the conditional code
|
||||||
* may be removed, and the feature "retired". To retire a feature:
|
* may be removed, and the feature "retired". To retire a feature:
|
||||||
@@ -88,10 +100,13 @@ namespace detail {
|
|||||||
#undef XRPL_FIX
|
#undef XRPL_FIX
|
||||||
#pragma push_macro("XRPL_RETIRE")
|
#pragma push_macro("XRPL_RETIRE")
|
||||||
#undef XRPL_RETIRE
|
#undef XRPL_RETIRE
|
||||||
|
#pragma push_macro("XRPL_ABANDON")
|
||||||
|
#undef XRPL_ABANDON
|
||||||
|
|
||||||
#define XRPL_FEATURE(name, supported, vote) +1
|
#define XRPL_FEATURE(name, supported, vote) +1
|
||||||
#define XRPL_FIX(name, supported, vote) +1
|
#define XRPL_FIX(name, supported, vote) +1
|
||||||
#define XRPL_RETIRE(name) +1
|
#define XRPL_RETIRE(name) +1
|
||||||
|
#define XRPL_ABANDON(name) +1
|
||||||
|
|
||||||
// This value SHOULD be equal to the number of amendments registered in
|
// This value SHOULD be equal to the number of amendments registered in
|
||||||
// Feature.cpp. Because it's only used to reserve storage, and determine how
|
// Feature.cpp. Because it's only used to reserve storage, and determine how
|
||||||
@@ -108,6 +123,8 @@ static constexpr std::size_t numFeatures =
|
|||||||
#pragma pop_macro("XRPL_FIX")
|
#pragma pop_macro("XRPL_FIX")
|
||||||
#undef XRPL_FEATURE
|
#undef XRPL_FEATURE
|
||||||
#pragma pop_macro("XRPL_FEATURE")
|
#pragma pop_macro("XRPL_FEATURE")
|
||||||
|
#undef XRPL_ABANDON
|
||||||
|
#pragma pop_macro("XRPL_ABANDON")
|
||||||
|
|
||||||
/** Amendments that this server supports and the default voting behavior.
|
/** Amendments that this server supports and the default voting behavior.
|
||||||
Whether they are enabled depends on the Rules defined in the validated
|
Whether they are enabled depends on the Rules defined in the validated
|
||||||
@@ -349,10 +366,13 @@ foreachFeature(FeatureBitset bs, F&& f)
|
|||||||
#undef XRPL_FIX
|
#undef XRPL_FIX
|
||||||
#pragma push_macro("XRPL_RETIRE")
|
#pragma push_macro("XRPL_RETIRE")
|
||||||
#undef XRPL_RETIRE
|
#undef XRPL_RETIRE
|
||||||
|
#pragma push_macro("XRPL_ABANDON")
|
||||||
|
#undef XRPL_ABANDON
|
||||||
|
|
||||||
#define XRPL_FEATURE(name, supported, vote) extern uint256 const feature##name;
|
#define XRPL_FEATURE(name, supported, vote) extern uint256 const feature##name;
|
||||||
#define XRPL_FIX(name, supported, vote) extern uint256 const fix##name;
|
#define XRPL_FIX(name, supported, vote) extern uint256 const fix##name;
|
||||||
#define XRPL_RETIRE(name)
|
#define XRPL_RETIRE(name)
|
||||||
|
#define XRPL_ABANDON(name)
|
||||||
|
|
||||||
#include <xrpl/protocol/detail/features.macro>
|
#include <xrpl/protocol/detail/features.macro>
|
||||||
|
|
||||||
@@ -362,6 +382,8 @@ foreachFeature(FeatureBitset bs, F&& f)
|
|||||||
#pragma pop_macro("XRPL_FIX")
|
#pragma pop_macro("XRPL_FIX")
|
||||||
#undef XRPL_FEATURE
|
#undef XRPL_FEATURE
|
||||||
#pragma pop_macro("XRPL_FEATURE")
|
#pragma pop_macro("XRPL_FEATURE")
|
||||||
|
#undef XRPL_ABANDON
|
||||||
|
#pragma pop_macro("XRPL_ABANDON")
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|
||||||
|
|||||||
@@ -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, const TaggedFee<UnitTag, T>& q)
|
operator<<(std::basic_ostream<Char, Traits>& os, TaggedFee<UnitTag, T> const& q)
|
||||||
{
|
{
|
||||||
return os << q.value();
|
return os << q.value();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ enum class HashPrefix : std::uint32_t {
|
|||||||
|
|
||||||
/** Credentials signature */
|
/** Credentials signature */
|
||||||
credential = detail::make_hash_prefix('C', 'R', 'D'),
|
credential = detail::make_hash_prefix('C', 'R', 'D'),
|
||||||
|
|
||||||
|
/** Batch */
|
||||||
|
batch = detail::make_hash_prefix('B', 'C', 'H'),
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Hasher>
|
template <class Hasher>
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
@@ -99,6 +98,12 @@ public:
|
|||||||
|
|
||||||
static IOUAmount
|
static IOUAmount
|
||||||
minPositiveAmount();
|
minPositiveAmount();
|
||||||
|
|
||||||
|
friend std::ostream&
|
||||||
|
operator<<(std::ostream& os, IOUAmount const& x)
|
||||||
|
{
|
||||||
|
return os << to_string(x);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline IOUAmount::IOUAmount(beast::Zero)
|
inline IOUAmount::IOUAmount(beast::Zero)
|
||||||
|
|||||||
@@ -279,6 +279,10 @@ 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);
|
||||||
|
|
||||||
@@ -330,6 +334,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;
|
||||||
|
|
||||||
|
|||||||
@@ -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, trust lines allow rippling by default
|
0x00800000, // True, incoming 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
|
||||||
@@ -145,13 +145,15 @@ enum LedgerSpecificFlags {
|
|||||||
0x10000000, // True, reject new paychans
|
0x10000000, // True, reject new paychans
|
||||||
lsfDisallowIncomingTrustline =
|
lsfDisallowIncomingTrustline =
|
||||||
0x20000000, // True, reject new trustlines (only if no issued assets)
|
0x20000000, // True, reject new trustlines (only if no issued assets)
|
||||||
// 0x40000000 is available
|
lsfAllowTrustLineLocking =
|
||||||
|
0x40000000, // True, enable trustline locking
|
||||||
lsfAllowTrustLineClawback =
|
lsfAllowTrustLineClawback =
|
||||||
0x80000000, // True, enable clawback
|
0x80000000, // True, enable clawback
|
||||||
|
|
||||||
// ltOFFER
|
// ltOFFER
|
||||||
lsfPassive = 0x00010000,
|
lsfPassive = 0x00010000,
|
||||||
lsfSell = 0x00020000, // True, offer was placed as a sell.
|
lsfSell = 0x00020000, // True, offer was placed as a sell.
|
||||||
|
lsfHybrid = 0x00040000, // True, offer is hybrid.
|
||||||
|
|
||||||
// ltRIPPLE_STATE
|
// ltRIPPLE_STATE
|
||||||
lsfLowReserve = 0x00010000, // True, if entry counts toward reserve.
|
lsfLowReserve = 0x00010000, // True, if entry counts toward reserve.
|
||||||
@@ -191,6 +193,9 @@ enum LedgerSpecificFlags {
|
|||||||
|
|
||||||
// ltCREDENTIAL
|
// ltCREDENTIAL
|
||||||
lsfAccepted = 0x00010000,
|
lsfAccepted = 0x00010000,
|
||||||
|
|
||||||
|
// ltVAULT
|
||||||
|
lsfVaultPrivate = 0x00010000,
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ struct MultiApiJson
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
set(const char* key, auto const& v)
|
set(char const* 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(const char* key) const
|
isMember(char const* key) const
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (auto& a : this->val)
|
for (auto& a : this->val)
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
namespace RPC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Adds common synthetic fields to transaction-related JSON responses
|
Adds common synthetic fields to transaction-related JSON responses
|
||||||
|
|
||||||
@@ -40,6 +42,7 @@ insertNFTSyntheticInJson(
|
|||||||
TxMeta const&);
|
TxMeta const&);
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
} // namespace RPC
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
97
include/xrpl/protocol/Permissions.h
Normal file
97
include/xrpl/protocol/Permissions.h
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
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
|
||||||
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include <xrpl/basics/ByteUtilities.h>
|
#include <xrpl/basics/ByteUtilities.h>
|
||||||
#include <xrpl/basics/base_uint.h>
|
#include <xrpl/basics/base_uint.h>
|
||||||
#include <xrpl/basics/partitioned_unordered_map.h>
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -116,6 +115,16 @@ 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;
|
||||||
|
|
||||||
|
/** Maximum recursion depth for vault shares being put as an asset inside
|
||||||
|
* another vault; counted from 0 */
|
||||||
|
std::uint8_t constexpr maxAssetCheckDepth = 5;
|
||||||
|
|
||||||
/** A ledger index. */
|
/** A ledger index. */
|
||||||
using LedgerIndex = std::uint32_t;
|
using LedgerIndex = std::uint32_t;
|
||||||
|
|
||||||
@@ -155,6 +164,13 @@ 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;
|
||||||
|
|
||||||
|
/** The maximum number of transactions that can be in a batch. */
|
||||||
|
std::size_t constexpr maxBatchTxCount = 8;
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -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 const int minTickSize = 3;
|
static int const minTickSize = 3;
|
||||||
static const int maxTickSize = 16;
|
static int const 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
|
||||||
|
|||||||
@@ -28,6 +28,9 @@
|
|||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
bool
|
||||||
|
isFeatureEnabled(uint256 const& feature);
|
||||||
|
|
||||||
class DigestAwareReadView;
|
class DigestAwareReadView;
|
||||||
|
|
||||||
/** Rules controlling protocol behavior. */
|
/** Rules controlling protocol behavior. */
|
||||||
|
|||||||
@@ -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,
|
||||||
const char* fn,
|
char const* 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 const SField&
|
static SField const&
|
||||||
getField(int fieldCode);
|
getField(int fieldCode);
|
||||||
static const SField&
|
static SField const&
|
||||||
getField(std::string const& fieldName);
|
getField(std::string const& fieldName);
|
||||||
static const SField&
|
static SField const&
|
||||||
getField(int type, int value)
|
getField(int type, int value)
|
||||||
{
|
{
|
||||||
return getField(field_code(type, value));
|
return getField(field_code(type, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const SField&
|
static SField const&
|
||||||
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==(const SField& f) const
|
operator==(SField const& f) const
|
||||||
{
|
{
|
||||||
return fieldCode == f.fieldCode;
|
return fieldCode == f.fieldCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator!=(const SField& f) const
|
operator!=(SField const& f) const
|
||||||
{
|
{
|
||||||
return fieldCode != f.fieldCode;
|
return fieldCode != f.fieldCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
compare(const SField& f1, const SField& f2);
|
compare(SField const& f1, SField const& f2);
|
||||||
|
|
||||||
static std::map<int, SField const*> const&
|
static std::map<int, SField const*> const&
|
||||||
getKnownCodeToField()
|
getKnownCodeToField()
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
add(Serializer& s) const override;
|
add(Serializer& s) const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEquivalent(const STBase& t) const override;
|
isEquivalent(STBase const& t) const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isDefault() const override;
|
isDefault() const override;
|
||||||
|
|||||||
@@ -62,20 +62,20 @@ private:
|
|||||||
public:
|
public:
|
||||||
using value_type = STAmount;
|
using value_type = STAmount;
|
||||||
|
|
||||||
static const int cMinOffset = -96;
|
static int const cMinOffset = -96;
|
||||||
static const int cMaxOffset = 80;
|
static int const cMaxOffset = 80;
|
||||||
|
|
||||||
// Maximum native value supported by the code
|
// Maximum native value supported by the code
|
||||||
static const std::uint64_t cMinValue = 1000000000000000ull;
|
static std::uint64_t const cMinValue = 1000000000000000ull;
|
||||||
static const std::uint64_t cMaxValue = 9999999999999999ull;
|
static std::uint64_t const cMaxValue = 9999999999999999ull;
|
||||||
static const std::uint64_t cMaxNative = 9000000000000000000ull;
|
static std::uint64_t const cMaxNative = 9000000000000000000ull;
|
||||||
|
|
||||||
// Max native value on network.
|
// Max native value on network.
|
||||||
static const std::uint64_t cMaxNativeN = 100000000000000000ull;
|
static std::uint64_t const cMaxNativeN = 100000000000000000ull;
|
||||||
static const std::uint64_t cIssuedCurrency = 0x8000000000000000ull;
|
static std::uint64_t const cIssuedCurrency = 0x8000000000000000ull;
|
||||||
static const std::uint64_t cPositive = 0x4000000000000000ull;
|
static std::uint64_t const cPositive = 0x4000000000000000ull;
|
||||||
static const std::uint64_t cMPToken = 0x2000000000000000ull;
|
static std::uint64_t const cMPToken = 0x2000000000000000ull;
|
||||||
static const std::uint64_t cValueMask = ~(cPositive | cMPToken);
|
static std::uint64_t const 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(const STBase& t) const override;
|
isEquivalent(STBase const& 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()
|
||||||
{
|
{
|
||||||
@@ -684,6 +703,12 @@ isXRP(STAmount const& amount)
|
|||||||
return amount.native();
|
return amount.native();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
canAdd(STAmount const& amt1, STAmount const& amt2);
|
||||||
|
|
||||||
|
bool
|
||||||
|
canSubtract(STAmount const& amt1, STAmount const& amt2);
|
||||||
|
|
||||||
// Since `canonicalize` does not have access to a ledger, this is needed to put
|
// Since `canonicalize` does not have access to a ledger, this is needed to put
|
||||||
// the low-level routine stAmountCanonicalize on an amendment switch. Only
|
// the low-level routine stAmountCanonicalize on an amendment switch. Only
|
||||||
// transactions need to use this switchover. Outside of a transaction it's safe
|
// transactions need to use this switchover. Outside of a transaction it's safe
|
||||||
|
|||||||
@@ -128,13 +128,13 @@ public:
|
|||||||
add(Serializer& s) const override;
|
add(Serializer& s) const override;
|
||||||
|
|
||||||
void
|
void
|
||||||
sort(bool (*compare)(const STObject& o1, const STObject& o2));
|
sort(bool (*compare)(STObject const& o1, STObject const& o2));
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator==(const STArray& s) const;
|
operator==(STArray const& s) const;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator!=(const STArray& s) const;
|
operator!=(STArray const& s) const;
|
||||||
|
|
||||||
iterator
|
iterator
|
||||||
erase(iterator pos);
|
erase(iterator pos);
|
||||||
@@ -152,7 +152,7 @@ public:
|
|||||||
getSType() const override;
|
getSType() const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEquivalent(const STBase& t) const override;
|
isEquivalent(STBase const& 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==(const STArray& s) const
|
STArray::operator==(STArray const& s) const
|
||||||
{
|
{
|
||||||
return v_ == s.v_;
|
return v_ == s.v_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
STArray::operator!=(const STArray& s) const
|
STArray::operator!=(STArray const& s) const
|
||||||
{
|
{
|
||||||
return v_ != s.v_;
|
return v_ != s.v_;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,16 @@ struct JsonOptions
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
requires requires(T const& t) {
|
||||||
|
{ t.getJson(JsonOptions::none) } -> std::convertible_to<Json::Value>;
|
||||||
|
}
|
||||||
|
Json::Value
|
||||||
|
to_json(T const& t)
|
||||||
|
{
|
||||||
|
return t.getJson(JsonOptions::none);
|
||||||
|
}
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
class STVar;
|
class STVar;
|
||||||
}
|
}
|
||||||
@@ -129,16 +139,16 @@ class STBase
|
|||||||
public:
|
public:
|
||||||
virtual ~STBase() = default;
|
virtual ~STBase() = default;
|
||||||
STBase();
|
STBase();
|
||||||
STBase(const STBase&) = default;
|
STBase(STBase const&) = default;
|
||||||
STBase&
|
STBase&
|
||||||
operator=(const STBase& t);
|
operator=(STBase const& t);
|
||||||
|
|
||||||
explicit STBase(SField const& n);
|
explicit STBase(SField const& n);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator==(const STBase& t) const;
|
operator==(STBase const& t) const;
|
||||||
bool
|
bool
|
||||||
operator!=(const STBase& t) const;
|
operator!=(STBase const& t) const;
|
||||||
|
|
||||||
template <class D>
|
template <class D>
|
||||||
D&
|
D&
|
||||||
@@ -157,7 +167,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 +207,7 @@ private:
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
operator<<(std::ostream& out, const STBase& t);
|
operator<<(std::ostream& out, STBase const& t);
|
||||||
|
|
||||||
template <class D>
|
template <class D>
|
||||||
D&
|
D&
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ public:
|
|||||||
STBitString() = default;
|
STBitString() = default;
|
||||||
|
|
||||||
STBitString(SField const& n);
|
STBitString(SField const& n);
|
||||||
STBitString(const value_type& v);
|
STBitString(value_type const& v);
|
||||||
STBitString(SField const& n, const value_type& v);
|
STBitString(SField const& n, value_type const& 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(const STBase& t) const override;
|
isEquivalent(STBase const& 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(const value_type& v) : value_(v)
|
inline STBitString<Bits>::STBitString(value_type const& v) : value_(v)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <int Bits>
|
template <int Bits>
|
||||||
inline STBitString<Bits>::STBitString(SField const& n, const value_type& v)
|
inline STBitString<Bits>::STBitString(SField const& n, value_type const& 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(const STBase& t) const
|
STBitString<Bits>::isEquivalent(STBase const& t) const
|
||||||
{
|
{
|
||||||
const STBitString* v = dynamic_cast<const STBitString*>(&t);
|
STBitString const* v = dynamic_cast<STBitString const*>(&t);
|
||||||
return v && (value_ == v->value_);
|
return v && (value_ == v->value_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
add(Serializer& s) const override;
|
add(Serializer& s) const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEquivalent(const STBase& t) const override;
|
isEquivalent(STBase const& t) const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isDefault() const override;
|
isDefault() const override;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
add(Serializer& s) const override;
|
add(Serializer& s) const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEquivalent(const STBase& t) const override;
|
isEquivalent(STBase const& t) const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isDefault() const override;
|
isDefault() const override;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
isDefault() const override;
|
isDefault() const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEquivalent(const STBase& t) const override;
|
isEquivalent(STBase const& 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(const STBase& t) const
|
STInteger<Integer>::isEquivalent(STBase const& t) const
|
||||||
{
|
{
|
||||||
const STInteger* v = dynamic_cast<const STInteger*>(&t);
|
STInteger const* v = dynamic_cast<STInteger const*>(&t);
|
||||||
return v && (value_ == v->value_);
|
return v && (value_ == v->value_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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,9 @@ public:
|
|||||||
|
|
||||||
explicit STIssue(SField const& name);
|
explicit STIssue(SField const& name);
|
||||||
|
|
||||||
|
STIssue&
|
||||||
|
operator=(STIssue const& rhs) = default;
|
||||||
|
|
||||||
template <ValidIssueType TIss>
|
template <ValidIssueType TIss>
|
||||||
TIss const&
|
TIss const&
|
||||||
get() const;
|
get() const;
|
||||||
@@ -71,7 +75,7 @@ public:
|
|||||||
add(Serializer& s) const override;
|
add(Serializer& s) const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEquivalent(const STBase& t) const override;
|
isEquivalent(STBase const& t) const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isDefault() const override;
|
isDefault() const override;
|
||||||
|
|||||||
@@ -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 = const std::shared_ptr<STLedgerEntry>&;
|
using ref = std::shared_ptr<STLedgerEntry> const&;
|
||||||
|
|
||||||
/** 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);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ public:
|
|||||||
STObject&
|
STObject&
|
||||||
operator=(STObject&& other);
|
operator=(STObject&& other);
|
||||||
|
|
||||||
STObject(const SOTemplate& type, SField const& name);
|
STObject(SOTemplate const& type, SField const& name);
|
||||||
STObject(const SOTemplate& type, SerialIter& sit, SField const& name);
|
STObject(SOTemplate const& 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(const SOTemplate& type);
|
applyTemplate(SOTemplate const& type);
|
||||||
|
|
||||||
void
|
void
|
||||||
applyTemplateFromSField(SField const&);
|
applyTemplateFromSField(SField const&);
|
||||||
@@ -130,7 +130,7 @@ public:
|
|||||||
isFree() const;
|
isFree() const;
|
||||||
|
|
||||||
void
|
void
|
||||||
set(const SOTemplate&);
|
set(SOTemplate const&);
|
||||||
|
|
||||||
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(const STBase& t) const override;
|
isEquivalent(STBase const& 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;
|
||||||
|
|
||||||
const STBase&
|
STBase const&
|
||||||
peekAtIndex(int offset) const;
|
peekAtIndex(int offset) const;
|
||||||
|
|
||||||
STBase&
|
STBase&
|
||||||
getIndex(int offset);
|
getIndex(int offset);
|
||||||
|
|
||||||
const STBase*
|
STBase const*
|
||||||
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;
|
||||||
|
|
||||||
const STBase&
|
STBase const&
|
||||||
peekAtField(SField const& field) const;
|
peekAtField(SField const& field) const;
|
||||||
|
|
||||||
STBase&
|
STBase&
|
||||||
getField(SField const& field);
|
getField(SField const& field);
|
||||||
|
|
||||||
const STBase*
|
STBase const*
|
||||||
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;
|
||||||
const STVector256&
|
STVector256 const&
|
||||||
getFieldV256(SField const& field) const;
|
getFieldV256(SField const& field) const;
|
||||||
const STArray&
|
STArray const&
|
||||||
getFieldArray(SField const& field) const;
|
getFieldArray(SField const& field) const;
|
||||||
const STCurrency&
|
STCurrency const&
|
||||||
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(const STBase&);
|
hasMatchingEntry(STBase const&);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator==(const STObject& o) const;
|
operator==(STObject const& o) const;
|
||||||
bool
|
bool
|
||||||
operator!=(const STObject& o) const;
|
operator!=(STObject const& 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 const STBase&
|
inline STBase const&
|
||||||
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 const STBase*
|
inline STBase const*
|
||||||
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!=(const STObject& o) const
|
STObject::operator!=(STObject const& 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
|
||||||
{
|
{
|
||||||
const STBase* rf = peekAtPField(field);
|
STBase const* 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
|
||||||
|
|
||||||
const T* cf = dynamic_cast<const T*>(rf);
|
T const* cf = dynamic_cast<T const*>(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
|
||||||
{
|
{
|
||||||
const STBase* rf = peekAtPField(field);
|
STBase const* 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
|
||||||
|
|
||||||
const T* cf = dynamic_cast<const T*>(rf);
|
T const* cf = dynamic_cast<T const*>(rf);
|
||||||
|
|
||||||
if (!cf)
|
if (!cf)
|
||||||
Throw<std::runtime_error>("Wrong field type");
|
Throw<std::runtime_error>("Wrong field type");
|
||||||
|
|||||||
@@ -106,10 +106,10 @@ public:
|
|||||||
getIssuerID() const;
|
getIssuerID() const;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator==(const STPathElement& t) const;
|
operator==(STPathElement const& t) const;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator!=(const STPathElement& t) const;
|
operator!=(STPathElement const& 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);
|
||||||
|
|
||||||
const STPathElement&
|
STPathElement const&
|
||||||
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(const STBase& t) const override;
|
isEquivalent(STBase const& t) const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isDefault() const override;
|
isDefault() const override;
|
||||||
@@ -375,7 +375,7 @@ STPathElement::getIssuerID() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
STPathElement::operator==(const STPathElement& t) const
|
STPathElement::operator==(STPathElement const& 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==(const STPathElement& t) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
STPathElement::operator!=(const STPathElement& t) const
|
STPathElement::operator!=(STPathElement const& t) const
|
||||||
{
|
{
|
||||||
return !operator==(t);
|
return !operator==(t);
|
||||||
}
|
}
|
||||||
@@ -455,7 +455,7 @@ STPath::operator[](int i)
|
|||||||
return mPath[i];
|
return mPath[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const STPathElement&
|
inline STPathElement const&
|
||||||
STPath::operator[](int i) const
|
STPath::operator[](int i) const
|
||||||
{
|
{
|
||||||
return mPath[i];
|
return mPath[i];
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
@@ -121,10 +125,16 @@ public:
|
|||||||
@return `true` if valid signature. If invalid, the error message string.
|
@return `true` if valid signature. If invalid, the error message string.
|
||||||
*/
|
*/
|
||||||
enum class RequireFullyCanonicalSig : bool { no, yes };
|
enum class RequireFullyCanonicalSig : bool { no, yes };
|
||||||
|
|
||||||
Expected<void, std::string>
|
Expected<void, std::string>
|
||||||
checkSign(RequireFullyCanonicalSig requireCanonicalSig, Rules const& rules)
|
checkSign(RequireFullyCanonicalSig requireCanonicalSig, Rules const& rules)
|
||||||
const;
|
const;
|
||||||
|
|
||||||
|
Expected<void, std::string>
|
||||||
|
checkBatchSign(
|
||||||
|
RequireFullyCanonicalSig requireCanonicalSig,
|
||||||
|
Rules const& rules) const;
|
||||||
|
|
||||||
// SQL Functions with metadata.
|
// SQL Functions with metadata.
|
||||||
static std::string const&
|
static std::string const&
|
||||||
getMetaSQLInsertReplaceHeader();
|
getMetaSQLInsertReplaceHeader();
|
||||||
@@ -140,6 +150,9 @@ public:
|
|||||||
char status,
|
char status,
|
||||||
std::string const& escapedMetaData) const;
|
std::string const& escapedMetaData) const;
|
||||||
|
|
||||||
|
std::vector<uint256>
|
||||||
|
getBatchTransactionIDs() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Expected<void, std::string>
|
Expected<void, std::string>
|
||||||
checkSingleSign(RequireFullyCanonicalSig requireCanonicalSig) const;
|
checkSingleSign(RequireFullyCanonicalSig requireCanonicalSig) const;
|
||||||
@@ -149,12 +162,24 @@ private:
|
|||||||
RequireFullyCanonicalSig requireCanonicalSig,
|
RequireFullyCanonicalSig requireCanonicalSig,
|
||||||
Rules const& rules) const;
|
Rules const& rules) const;
|
||||||
|
|
||||||
|
Expected<void, std::string>
|
||||||
|
checkBatchSingleSign(
|
||||||
|
STObject const& batchSigner,
|
||||||
|
RequireFullyCanonicalSig requireCanonicalSig) const;
|
||||||
|
|
||||||
|
Expected<void, std::string>
|
||||||
|
checkBatchMultiSign(
|
||||||
|
STObject const& batchSigner,
|
||||||
|
RequireFullyCanonicalSig requireCanonicalSig,
|
||||||
|
Rules const& rules) const;
|
||||||
|
|
||||||
STBase*
|
STBase*
|
||||||
copy(std::size_t n, void* buf) const override;
|
copy(std::size_t n, void* buf) const override;
|
||||||
STBase*
|
STBase*
|
||||||
move(std::size_t n, void* buf) override;
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
friend class detail::STVar;
|
friend class detail::STVar;
|
||||||
|
mutable std::vector<uint256> batch_txn_ids_;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
Json::Value getJson(JsonOptions) const override;
|
Json::Value getJson(JsonOptions) const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEquivalent(const STBase& t) const override;
|
isEquivalent(STBase const& 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(const STVector256& v);
|
setValue(STVector256 const& 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(const STVector256& v)
|
STVector256::setValue(STVector256 const& v)
|
||||||
{
|
{
|
||||||
mValue = v.mValue;
|
mValue = v.mValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
add(Serializer& s) const override;
|
add(Serializer& s) const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEquivalent(const STBase& t) const override;
|
isEquivalent(STBase const& t) const override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isDefault() const override;
|
isDefault() const override;
|
||||||
|
|||||||
@@ -139,9 +139,9 @@ public:
|
|||||||
int
|
int
|
||||||
addRaw(Slice slice);
|
addRaw(Slice slice);
|
||||||
int
|
int
|
||||||
addRaw(const void* ptr, int len);
|
addRaw(void const* ptr, int len);
|
||||||
int
|
int
|
||||||
addRaw(const Serializer& s);
|
addRaw(Serializer const& 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(const void* ptr, int len);
|
addVL(void const* 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 const auto bytes = sizeof(Integer);
|
static auto const 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();
|
||||||
}
|
}
|
||||||
const void*
|
void const*
|
||||||
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<const char*>(getDataPtr()), size());
|
return std::string(static_cast<char const*>(getDataPtr()), size());
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
erase()
|
erase()
|
||||||
@@ -296,12 +296,12 @@ public:
|
|||||||
return v != mData;
|
return v != mData;
|
||||||
}
|
}
|
||||||
bool
|
bool
|
||||||
operator==(const Serializer& v) const
|
operator==(Serializer const& v) const
|
||||||
{
|
{
|
||||||
return v.mData == mData;
|
return v.mData == mData;
|
||||||
}
|
}
|
||||||
bool
|
bool
|
||||||
operator!=(const Serializer& v) const
|
operator!=(Serializer const& v) const
|
||||||
{
|
{
|
||||||
return v.mData != mData;
|
return v.mData != mData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,8 +139,8 @@ enum TEMcodes : TERUnderlyingType {
|
|||||||
|
|
||||||
temARRAY_EMPTY,
|
temARRAY_EMPTY,
|
||||||
temARRAY_TOO_LARGE,
|
temARRAY_TOO_LARGE,
|
||||||
|
|
||||||
temBAD_TRANSFER_FEE,
|
temBAD_TRANSFER_FEE,
|
||||||
|
temINVALID_INNER_BATCH,
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -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,11 @@ 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,
|
||||||
|
tecPRECISION_LOSS = 197,
|
||||||
|
tecNO_DELEGATE_PERMISSION = 198,
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -629,37 +647,37 @@ using TER = TERSubset<CanCvtToTER>;
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
isTelLocal(TER x)
|
isTelLocal(TER x) noexcept
|
||||||
{
|
{
|
||||||
return ((x) >= telLOCAL_ERROR && (x) < temMALFORMED);
|
return (x >= telLOCAL_ERROR && x < temMALFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
isTemMalformed(TER x)
|
isTemMalformed(TER x) noexcept
|
||||||
{
|
{
|
||||||
return ((x) >= temMALFORMED && (x) < tefFAILURE);
|
return (x >= temMALFORMED && x < tefFAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
isTefFailure(TER x)
|
isTefFailure(TER x) noexcept
|
||||||
{
|
{
|
||||||
return ((x) >= tefFAILURE && (x) < terRETRY);
|
return (x >= tefFAILURE && x < terRETRY);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
isTerRetry(TER x)
|
isTerRetry(TER x) noexcept
|
||||||
{
|
{
|
||||||
return ((x) >= terRETRY && (x) < tesSUCCESS);
|
return (x >= terRETRY && x < tesSUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
isTesSuccess(TER x)
|
isTesSuccess(TER x) noexcept
|
||||||
{
|
{
|
||||||
return ((x) == tesSUCCESS);
|
return (x == tesSUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
isTecClaim(TER x)
|
isTecClaim(TER x) noexcept
|
||||||
{
|
{
|
||||||
return ((x) >= tecCLAIM);
|
return ((x) >= tecCLAIM);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ namespace ripple {
|
|||||||
// clang-format off
|
// clang-format off
|
||||||
// Universal Transaction flags:
|
// Universal Transaction flags:
|
||||||
constexpr std::uint32_t tfFullyCanonicalSig = 0x80000000;
|
constexpr std::uint32_t tfFullyCanonicalSig = 0x80000000;
|
||||||
constexpr std::uint32_t tfUniversal = tfFullyCanonicalSig;
|
constexpr std::uint32_t tfInnerBatchTxn = 0x40000000;
|
||||||
|
constexpr std::uint32_t tfUniversal = tfFullyCanonicalSig | tfInnerBatchTxn;
|
||||||
constexpr std::uint32_t tfUniversalMask = ~tfUniversal;
|
constexpr std::uint32_t tfUniversalMask = ~tfUniversal;
|
||||||
|
|
||||||
// AccountSet flags:
|
// AccountSet flags:
|
||||||
@@ -91,14 +92,16 @@ constexpr std::uint32_t asfDisallowIncomingCheck = 13;
|
|||||||
constexpr std::uint32_t asfDisallowIncomingPayChan = 14;
|
constexpr std::uint32_t asfDisallowIncomingPayChan = 14;
|
||||||
constexpr std::uint32_t asfDisallowIncomingTrustline = 15;
|
constexpr std::uint32_t asfDisallowIncomingTrustline = 15;
|
||||||
constexpr std::uint32_t asfAllowTrustLineClawback = 16;
|
constexpr std::uint32_t asfAllowTrustLineClawback = 16;
|
||||||
|
constexpr std::uint32_t asfAllowTrustLineLocking = 17;
|
||||||
|
|
||||||
// OfferCreate flags:
|
// OfferCreate flags:
|
||||||
constexpr std::uint32_t tfPassive = 0x00010000;
|
constexpr std::uint32_t tfPassive = 0x00010000;
|
||||||
constexpr std::uint32_t tfImmediateOrCancel = 0x00020000;
|
constexpr std::uint32_t tfImmediateOrCancel = 0x00020000;
|
||||||
constexpr std::uint32_t tfFillOrKill = 0x00040000;
|
constexpr std::uint32_t tfFillOrKill = 0x00040000;
|
||||||
constexpr std::uint32_t tfSell = 0x00080000;
|
constexpr std::uint32_t tfSell = 0x00080000;
|
||||||
|
constexpr std::uint32_t tfHybrid = 0x00100000;
|
||||||
constexpr std::uint32_t tfOfferCreateMask =
|
constexpr std::uint32_t tfOfferCreateMask =
|
||||||
~(tfUniversal | tfPassive | tfImmediateOrCancel | tfFillOrKill | tfSell);
|
~(tfUniversal | tfPassive | tfImmediateOrCancel | tfFillOrKill | tfSell | tfHybrid);
|
||||||
|
|
||||||
// Payment flags:
|
// Payment flags:
|
||||||
constexpr std::uint32_t tfNoRippleDirect = 0x00010000;
|
constexpr std::uint32_t tfNoRippleDirect = 0x00010000;
|
||||||
@@ -119,6 +122,7 @@ constexpr std::uint32_t tfClearDeepFreeze = 0x00800000;
|
|||||||
constexpr std::uint32_t tfTrustSetMask =
|
constexpr std::uint32_t tfTrustSetMask =
|
||||||
~(tfUniversal | tfSetfAuth | tfSetNoRipple | tfClearNoRipple | tfSetFreeze |
|
~(tfUniversal | tfSetfAuth | tfSetNoRipple | tfClearNoRipple | tfSetFreeze |
|
||||||
tfClearFreeze | tfSetDeepFreeze | tfClearDeepFreeze);
|
tfClearFreeze | tfSetDeepFreeze | tfClearDeepFreeze);
|
||||||
|
constexpr std::uint32_t tfTrustSetPermissionMask = ~(tfUniversal | tfSetfAuth | tfSetFreeze | tfClearFreeze);
|
||||||
|
|
||||||
// EnableAmendment flags:
|
// EnableAmendment flags:
|
||||||
constexpr std::uint32_t tfGotMajority = 0x00010000;
|
constexpr std::uint32_t tfGotMajority = 0x00010000;
|
||||||
@@ -155,6 +159,7 @@ 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 tfMPTokenIssuanceSetPermissionMask = ~(tfUniversal | tfMPTLock | tfMPTUnlock);
|
||||||
|
|
||||||
// MPTokenIssuanceDestroy flags:
|
// MPTokenIssuanceDestroy flags:
|
||||||
constexpr std::uint32_t const tfMPTokenIssuanceDestroyMask = ~tfUniversal;
|
constexpr std::uint32_t const tfMPTokenIssuanceDestroyMask = ~tfUniversal;
|
||||||
@@ -224,6 +229,26 @@ 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);
|
||||||
|
|
||||||
|
// Batch Flags:
|
||||||
|
constexpr std::uint32_t tfAllOrNothing = 0x00010000;
|
||||||
|
constexpr std::uint32_t tfOnlyOne = 0x00020000;
|
||||||
|
constexpr std::uint32_t tfUntilFailure = 0x00040000;
|
||||||
|
constexpr std::uint32_t tfIndependent = 0x00080000;
|
||||||
|
/**
|
||||||
|
* @note If nested Batch transactions are supported in the future, the tfInnerBatchTxn flag
|
||||||
|
* will need to be removed from this mask to allow Batch transaction to be inside
|
||||||
|
* the sfRawTransactions array.
|
||||||
|
*/
|
||||||
|
constexpr std::uint32_t const tfBatchMask =
|
||||||
|
~(tfUniversal | tfAllOrNothing | tfOnlyOne | tfUntilFailure | tfIndependent) | tfInnerBatchTxn;
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|||||||
@@ -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, fields) tag = value,
|
#define TRANSACTION(tag, value, name, delegatable, fields) tag = value,
|
||||||
|
|
||||||
#include <xrpl/protocol/detail/transactions.macro>
|
#include <xrpl/protocol/detail/transactions.macro>
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,10 @@ private:
|
|||||||
CtorHelper);
|
CtorHelper);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TxMeta(uint256 const& transactionID, std::uint32_t ledger);
|
TxMeta(
|
||||||
|
uint256 const& transactionID,
|
||||||
|
std::uint32_t ledger,
|
||||||
|
std::optional<uint256> parentBatchId = std::nullopt);
|
||||||
TxMeta(uint256 const& txID, std::uint32_t ledger, Blob const&);
|
TxMeta(uint256 const& txID, std::uint32_t ledger, Blob const&);
|
||||||
TxMeta(uint256 const& txID, std::uint32_t ledger, std::string const&);
|
TxMeta(uint256 const& txID, std::uint32_t ledger, std::string const&);
|
||||||
TxMeta(uint256 const& txID, std::uint32_t ledger, STObject const&);
|
TxMeta(uint256 const& txID, std::uint32_t ledger, STObject const&);
|
||||||
@@ -130,6 +133,27 @@ public:
|
|||||||
return static_cast<bool>(mDelivered);
|
return static_cast<bool>(mDelivered);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
setParentBatchId(uint256 const& parentBatchId)
|
||||||
|
{
|
||||||
|
mParentBatchId = parentBatchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint256
|
||||||
|
getParentBatchId() const
|
||||||
|
{
|
||||||
|
XRPL_ASSERT(
|
||||||
|
hasParentBatchId(),
|
||||||
|
"ripple::TxMeta::getParentBatchId : non-null batch id");
|
||||||
|
return *mParentBatchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
hasParentBatchId() const
|
||||||
|
{
|
||||||
|
return static_cast<bool>(mParentBatchId);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint256 mTransactionID;
|
uint256 mTransactionID;
|
||||||
std::uint32_t mLedger;
|
std::uint32_t mLedger;
|
||||||
@@ -137,6 +161,7 @@ private:
|
|||||||
int mResult;
|
int mResult;
|
||||||
|
|
||||||
std::optional<STAmount> mDelivered;
|
std::optional<STAmount> mDelivered;
|
||||||
|
std::optional<uint256> mParentBatchId;
|
||||||
|
|
||||||
STArray mNodes;
|
STArray mNodes;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ using NodeID = base_uint<160, detail::NodeIDTag>;
|
|||||||
* and a 160-bit account */
|
* and a 160-bit account */
|
||||||
using MPTID = base_uint<192>;
|
using MPTID = base_uint<192>;
|
||||||
|
|
||||||
|
/** Domain is a 256-bit hash representing a specific domain. */
|
||||||
|
using Domain = base_uint<256>;
|
||||||
|
|
||||||
/** XRP currency. */
|
/** XRP currency. */
|
||||||
Currency const&
|
Currency const&
|
||||||
xrpCurrency();
|
xrpCurrency();
|
||||||
@@ -119,25 +122,25 @@ namespace std {
|
|||||||
template <>
|
template <>
|
||||||
struct hash<ripple::Currency> : ripple::Currency::hasher
|
struct hash<ripple::Currency> : ripple::Currency::hasher
|
||||||
{
|
{
|
||||||
explicit hash() = default;
|
hash() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<ripple::NodeID> : ripple::NodeID::hasher
|
struct hash<ripple::NodeID> : ripple::NodeID::hasher
|
||||||
{
|
{
|
||||||
explicit hash() = default;
|
hash() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<ripple::Directory> : ripple::Directory::hasher
|
struct hash<ripple::Directory> : ripple::Directory::hasher
|
||||||
{
|
{
|
||||||
explicit hash() = default;
|
hash() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<ripple::uint256> : ripple::uint256::hasher
|
struct hash<ripple::uint256> : ripple::uint256::hasher
|
||||||
{
|
{
|
||||||
explicit hash() = default;
|
hash() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|||||||
@@ -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, const XRPAmount& q)
|
operator<<(std::basic_ostream<Char, Traits>& os, XRPAmount const& q)
|
||||||
{
|
{
|
||||||
return os << q.drops();
|
return os << q.drops();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,12 +26,23 @@
|
|||||||
#if !defined(XRPL_RETIRE)
|
#if !defined(XRPL_RETIRE)
|
||||||
#error "undefined macro: XRPL_RETIRE"
|
#error "undefined macro: XRPL_RETIRE"
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(XRPL_ABANDON)
|
||||||
|
#error "undefined macro: XRPL_ABANDON"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Add new amendments to the top of this list.
|
// Add new amendments to the top of this list.
|
||||||
// Keep it sorted in reverse chronological order.
|
// Keep it sorted in reverse chronological order.
|
||||||
// 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(TokenEscrow, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
|
XRPL_FIX (EnforceNFTokenTrustlineV2, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
|
XRPL_FIX (AMMv1_3, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
|
XRPL_FEATURE(PermissionedDEX, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
|
XRPL_FEATURE(Batch, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
|
XRPL_FEATURE(SingleAssetVault, Supported::no, VoteBehavior::DefaultNo)
|
||||||
|
XRPL_FEATURE(PermissionDelegation, Supported::yes, 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)
|
||||||
@@ -106,7 +117,6 @@ XRPL_FEATURE(DepositAuth, Supported::yes, VoteBehavior::DefaultYe
|
|||||||
XRPL_FIX (1513, Supported::yes, VoteBehavior::DefaultYes)
|
XRPL_FIX (1513, Supported::yes, VoteBehavior::DefaultYes)
|
||||||
XRPL_FEATURE(FlowCross, Supported::yes, VoteBehavior::DefaultYes)
|
XRPL_FEATURE(FlowCross, Supported::yes, VoteBehavior::DefaultYes)
|
||||||
XRPL_FEATURE(Flow, Supported::yes, VoteBehavior::DefaultYes)
|
XRPL_FEATURE(Flow, Supported::yes, VoteBehavior::DefaultYes)
|
||||||
XRPL_FEATURE(OwnerPaysFee, Supported::no, VoteBehavior::DefaultNo)
|
|
||||||
|
|
||||||
// The following amendments are obsolete, but must remain supported
|
// The following amendments are obsolete, but must remain supported
|
||||||
// because they could potentially get enabled.
|
// because they could potentially get enabled.
|
||||||
@@ -124,6 +134,11 @@ XRPL_FIX (NFTokenDirV1, Supported::yes, VoteBehavior::Obsolete)
|
|||||||
XRPL_FEATURE(NonFungibleTokensV1, Supported::yes, VoteBehavior::Obsolete)
|
XRPL_FEATURE(NonFungibleTokensV1, Supported::yes, VoteBehavior::Obsolete)
|
||||||
XRPL_FEATURE(CryptoConditionsSuite, Supported::yes, VoteBehavior::Obsolete)
|
XRPL_FEATURE(CryptoConditionsSuite, Supported::yes, VoteBehavior::Obsolete)
|
||||||
|
|
||||||
|
// The following amendments were never supported, never enabled, and
|
||||||
|
// we've abanded them. These features should never be in the ledger,
|
||||||
|
// and we've removed all the related code.
|
||||||
|
XRPL_ABANDON(OwnerPaysFee)
|
||||||
|
|
||||||
// The following amendments have been active for at least two years. Their
|
// The following amendments have been active for at least two years. Their
|
||||||
// pre-amendment code has been removed and the identifiers are deprecated.
|
// pre-amendment code has been removed and the identifiers are deprecated.
|
||||||
// All known amendments and amendments that may appear in a validated
|
// All known amendments and amendments that may appear in a validated
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -187,6 +188,7 @@ LEDGER_ENTRY(ltDIR_NODE, 0x0064, DirectoryNode, directory, ({
|
|||||||
{sfNFTokenID, soeOPTIONAL},
|
{sfNFTokenID, soeOPTIONAL},
|
||||||
{sfPreviousTxnID, soeOPTIONAL},
|
{sfPreviousTxnID, soeOPTIONAL},
|
||||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||||
|
{sfDomainID, soeOPTIONAL}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** The ledger object which lists details about amendments on the network.
|
/** The ledger object which lists details about amendments on the network.
|
||||||
@@ -248,6 +250,8 @@ LEDGER_ENTRY(ltOFFER, 0x006f, Offer, offer, ({
|
|||||||
{sfPreviousTxnID, soeREQUIRED},
|
{sfPreviousTxnID, soeREQUIRED},
|
||||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||||
{sfExpiration, soeOPTIONAL},
|
{sfExpiration, soeOPTIONAL},
|
||||||
|
{sfDomainID, soeOPTIONAL},
|
||||||
|
{sfAdditionalBooks, soeOPTIONAL},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** A ledger object which describes a deposit preauthorization.
|
/** A ledger object which describes a deposit preauthorization.
|
||||||
@@ -350,6 +354,8 @@ LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
|
|||||||
{sfPreviousTxnID, soeREQUIRED},
|
{sfPreviousTxnID, soeREQUIRED},
|
||||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||||
{sfDestinationNode, soeOPTIONAL},
|
{sfDestinationNode, soeOPTIONAL},
|
||||||
|
{sfTransferRate, soeOPTIONAL},
|
||||||
|
{sfIssuerNode, soeOPTIONAL},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** A ledger object describing a single unidirectional XRP payment channel.
|
/** A ledger object describing a single unidirectional XRP payment channel.
|
||||||
@@ -390,6 +396,37 @@ LEDGER_ENTRY(ltAMM, 0x0079, AMM, amm, ({
|
|||||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
/** A ledger object which tracks MPTokenIssuance
|
||||||
|
\sa keylet::mptIssuance
|
||||||
|
*/
|
||||||
|
LEDGER_ENTRY(ltMPTOKEN_ISSUANCE, 0x007e, MPTokenIssuance, mpt_issuance, ({
|
||||||
|
{sfIssuer, soeREQUIRED},
|
||||||
|
{sfSequence, soeREQUIRED},
|
||||||
|
{sfTransferFee, soeDEFAULT},
|
||||||
|
{sfOwnerNode, soeREQUIRED},
|
||||||
|
{sfAssetScale, soeDEFAULT},
|
||||||
|
{sfMaximumAmount, soeOPTIONAL},
|
||||||
|
{sfOutstandingAmount, soeREQUIRED},
|
||||||
|
{sfLockedAmount, soeOPTIONAL},
|
||||||
|
{sfMPTokenMetadata, soeOPTIONAL},
|
||||||
|
{sfPreviousTxnID, soeREQUIRED},
|
||||||
|
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||||
|
{sfDomainID, soeOPTIONAL},
|
||||||
|
}))
|
||||||
|
|
||||||
|
/** A ledger object which tracks MPToken
|
||||||
|
\sa keylet::mptoken
|
||||||
|
*/
|
||||||
|
LEDGER_ENTRY(ltMPTOKEN, 0x007f, MPToken, mptoken, ({
|
||||||
|
{sfAccount, soeREQUIRED},
|
||||||
|
{sfMPTokenIssuanceID, soeREQUIRED},
|
||||||
|
{sfMPTAmount, soeDEFAULT},
|
||||||
|
{sfLockedAmount, soeOPTIONAL},
|
||||||
|
{sfOwnerNode, soeREQUIRED},
|
||||||
|
{sfPreviousTxnID, soeREQUIRED},
|
||||||
|
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||||
|
}))
|
||||||
|
|
||||||
/** A ledger object which tracks Oracle
|
/** A ledger object which tracks Oracle
|
||||||
\sa keylet::oracle
|
\sa keylet::oracle
|
||||||
*/
|
*/
|
||||||
@@ -405,34 +442,6 @@ LEDGER_ENTRY(ltORACLE, 0x0080, Oracle, oracle, ({
|
|||||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** A ledger object which tracks MPTokenIssuance
|
|
||||||
\sa keylet::mptIssuance
|
|
||||||
*/
|
|
||||||
LEDGER_ENTRY(ltMPTOKEN_ISSUANCE, 0x007e, MPTokenIssuance, mpt_issuance, ({
|
|
||||||
{sfIssuer, soeREQUIRED},
|
|
||||||
{sfSequence, soeREQUIRED},
|
|
||||||
{sfTransferFee, soeDEFAULT},
|
|
||||||
{sfOwnerNode, soeREQUIRED},
|
|
||||||
{sfAssetScale, soeDEFAULT},
|
|
||||||
{sfMaximumAmount, soeOPTIONAL},
|
|
||||||
{sfOutstandingAmount, soeREQUIRED},
|
|
||||||
{sfMPTokenMetadata, soeOPTIONAL},
|
|
||||||
{sfPreviousTxnID, soeREQUIRED},
|
|
||||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
|
||||||
}))
|
|
||||||
|
|
||||||
/** A ledger object which tracks MPToken
|
|
||||||
\sa keylet::mptoken
|
|
||||||
*/
|
|
||||||
LEDGER_ENTRY(ltMPTOKEN, 0x007f, MPToken, mptoken, ({
|
|
||||||
{sfAccount, soeREQUIRED},
|
|
||||||
{sfMPTokenIssuanceID, soeREQUIRED},
|
|
||||||
{sfMPTAmount, soeDEFAULT},
|
|
||||||
{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,6 +469,41 @@ LEDGER_ENTRY(ltPERMISSIONED_DOMAIN, 0x0082, PermissionedDomain, permissioned_dom
|
|||||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
/** A ledger object representing permissions an account has delegated to another account.
|
||||||
|
\sa keylet::delegate
|
||||||
|
*/
|
||||||
|
LEDGER_ENTRY(ltDELEGATE, 0x0083, Delegate, delegate, ({
|
||||||
|
{sfAccount, soeREQUIRED},
|
||||||
|
{sfAuthorize, soeREQUIRED},
|
||||||
|
{sfPermissions, soeREQUIRED},
|
||||||
|
{sfOwnerNode, soeREQUIRED},
|
||||||
|
{sfPreviousTxnID, soeREQUIRED},
|
||||||
|
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||||
|
}))
|
||||||
|
|
||||||
|
/** A ledger object representing a single asset vault.
|
||||||
|
|
||||||
|
\sa keylet::mptoken
|
||||||
|
*/
|
||||||
|
LEDGER_ENTRY(ltVAULT, 0x0084, Vault, vault, ({
|
||||||
|
{sfPreviousTxnID, 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
|
||||||
#undef LEDGER_ENTRY_DUPLICATE
|
#undef LEDGER_ENTRY_DUPLICATE
|
||||||
|
|
||||||
|
|||||||
68
include/xrpl/protocol/detail/permissions.macro
Normal file
68
include/xrpl/protocol/detail/permissions.macro
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
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)
|
||||||
@@ -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,6 +113,7 @@ 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)
|
||||||
@@ -142,6 +144,7 @@ TYPED_SFIELD(sfOutstandingAmount, UINT64, 25, SField::sMD_BaseTen|SFie
|
|||||||
TYPED_SFIELD(sfMPTAmount, UINT64, 26, SField::sMD_BaseTen|SField::sMD_Default)
|
TYPED_SFIELD(sfMPTAmount, UINT64, 26, SField::sMD_BaseTen|SField::sMD_Default)
|
||||||
TYPED_SFIELD(sfIssuerNode, UINT64, 27)
|
TYPED_SFIELD(sfIssuerNode, UINT64, 27)
|
||||||
TYPED_SFIELD(sfSubjectNode, UINT64, 28)
|
TYPED_SFIELD(sfSubjectNode, UINT64, 28)
|
||||||
|
TYPED_SFIELD(sfLockedAmount, UINT64, 29, SField::sMD_BaseTen|SField::sMD_Default)
|
||||||
|
|
||||||
// 128-bit
|
// 128-bit
|
||||||
TYPED_SFIELD(sfEmailHash, UINT128, 1)
|
TYPED_SFIELD(sfEmailHash, UINT128, 1)
|
||||||
@@ -154,6 +157,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)
|
||||||
@@ -191,9 +195,15 @@ 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)
|
||||||
|
TYPED_SFIELD(sfParentBatchID, UINT256, 36)
|
||||||
|
|
||||||
// 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)
|
||||||
@@ -278,6 +288,7 @@ 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)
|
||||||
@@ -327,6 +338,7 @@ 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)
|
||||||
@@ -347,6 +359,9 @@ UNTYPED_SFIELD(sfXChainClaimAttestationCollectionElement, OBJECT, 30)
|
|||||||
UNTYPED_SFIELD(sfXChainCreateAccountAttestationCollectionElement, OBJECT, 31)
|
UNTYPED_SFIELD(sfXChainCreateAccountAttestationCollectionElement, OBJECT, 31)
|
||||||
UNTYPED_SFIELD(sfPriceData, OBJECT, 32)
|
UNTYPED_SFIELD(sfPriceData, OBJECT, 32)
|
||||||
UNTYPED_SFIELD(sfCredential, OBJECT, 33)
|
UNTYPED_SFIELD(sfCredential, OBJECT, 33)
|
||||||
|
UNTYPED_SFIELD(sfRawTransaction, OBJECT, 34)
|
||||||
|
UNTYPED_SFIELD(sfBatchSigner, OBJECT, 35)
|
||||||
|
UNTYPED_SFIELD(sfBook, OBJECT, 36)
|
||||||
|
|
||||||
// array of objects (common)
|
// array of objects (common)
|
||||||
// ARRAY/1 is reserved for end of array
|
// ARRAY/1 is reserved for end of array
|
||||||
@@ -362,6 +377,7 @@ UNTYPED_SFIELD(sfMemos, ARRAY, 9)
|
|||||||
UNTYPED_SFIELD(sfNFTokens, ARRAY, 10)
|
UNTYPED_SFIELD(sfNFTokens, ARRAY, 10)
|
||||||
UNTYPED_SFIELD(sfHooks, ARRAY, 11)
|
UNTYPED_SFIELD(sfHooks, ARRAY, 11)
|
||||||
UNTYPED_SFIELD(sfVoteSlots, ARRAY, 12)
|
UNTYPED_SFIELD(sfVoteSlots, ARRAY, 12)
|
||||||
|
UNTYPED_SFIELD(sfAdditionalBooks, ARRAY, 13)
|
||||||
|
|
||||||
// array of objects (uncommon)
|
// array of objects (uncommon)
|
||||||
UNTYPED_SFIELD(sfMajorities, ARRAY, 16)
|
UNTYPED_SFIELD(sfMajorities, ARRAY, 16)
|
||||||
@@ -377,3 +393,6 @@ 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)
|
||||||
|
UNTYPED_SFIELD(sfRawTransactions, ARRAY, 30)
|
||||||
|
UNTYPED_SFIELD(sfBatchSigners, ARRAY, 31, SField::sMD_Default, SField::notSigning)
|
||||||
|
|||||||
@@ -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 const char*
|
virtual char const*
|
||||||
name() const noexcept override final
|
name() const noexcept override final
|
||||||
{
|
{
|
||||||
return "TokenCodecError";
|
return "TokenCodecError";
|
||||||
@@ -86,7 +86,7 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
inline const ripple::detail::TokenCodecErrcCategory&
|
inline ripple::detail::TokenCodecErrcCategory const&
|
||||||
TokenCodecErrcCategory()
|
TokenCodecErrcCategory()
|
||||||
{
|
{
|
||||||
static ripple::detail::TokenCodecErrcCategory c;
|
static ripple::detail::TokenCodecErrcCategory c;
|
||||||
|
|||||||
@@ -22,14 +22,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TRANSACTION(tag, value, name, fields)
|
* TRANSACTION(tag, value, name, delegatable, 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, ({
|
TRANSACTION(ttPAYMENT, 0, Payment, Delegation::delegatable, ({
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED, soeMPTSupported},
|
{sfAmount, soeREQUIRED, soeMPTSupported},
|
||||||
{sfSendMax, soeOPTIONAL, soeMPTSupported},
|
{sfSendMax, soeOPTIONAL, soeMPTSupported},
|
||||||
@@ -38,12 +38,13 @@ TRANSACTION(ttPAYMENT, 0, Payment, ({
|
|||||||
{sfDestinationTag, soeOPTIONAL},
|
{sfDestinationTag, soeOPTIONAL},
|
||||||
{sfDeliverMin, soeOPTIONAL, soeMPTSupported},
|
{sfDeliverMin, soeOPTIONAL, soeMPTSupported},
|
||||||
{sfCredentialIDs, soeOPTIONAL},
|
{sfCredentialIDs, soeOPTIONAL},
|
||||||
|
{sfDomainID, soeOPTIONAL},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type creates an escrow object. */
|
/** This transaction type creates an escrow object. */
|
||||||
TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate, ({
|
TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate, Delegation::delegatable, ({
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED},
|
{sfAmount, soeREQUIRED, soeMPTSupported},
|
||||||
{sfCondition, soeOPTIONAL},
|
{sfCondition, soeOPTIONAL},
|
||||||
{sfCancelAfter, soeOPTIONAL},
|
{sfCancelAfter, soeOPTIONAL},
|
||||||
{sfFinishAfter, soeOPTIONAL},
|
{sfFinishAfter, soeOPTIONAL},
|
||||||
@@ -51,7 +52,7 @@ TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type completes an existing escrow. */
|
/** This transaction type completes an existing escrow. */
|
||||||
TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish, ({
|
TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish, Delegation::delegatable, ({
|
||||||
{sfOwner, soeREQUIRED},
|
{sfOwner, soeREQUIRED},
|
||||||
{sfOfferSequence, soeREQUIRED},
|
{sfOfferSequence, soeREQUIRED},
|
||||||
{sfFulfillment, soeOPTIONAL},
|
{sfFulfillment, soeOPTIONAL},
|
||||||
@@ -61,7 +62,7 @@ TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish, ({
|
|||||||
|
|
||||||
|
|
||||||
/** This transaction type adjusts various account settings. */
|
/** This transaction type adjusts various account settings. */
|
||||||
TRANSACTION(ttACCOUNT_SET, 3, AccountSet, ({
|
TRANSACTION(ttACCOUNT_SET, 3, AccountSet, Delegation::notDelegatable, ({
|
||||||
{sfEmailHash, soeOPTIONAL},
|
{sfEmailHash, soeOPTIONAL},
|
||||||
{sfWalletLocator, soeOPTIONAL},
|
{sfWalletLocator, soeOPTIONAL},
|
||||||
{sfWalletSize, soeOPTIONAL},
|
{sfWalletSize, soeOPTIONAL},
|
||||||
@@ -75,35 +76,36 @@ TRANSACTION(ttACCOUNT_SET, 3, AccountSet, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type cancels an existing escrow. */
|
/** This transaction type cancels an existing escrow. */
|
||||||
TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel, ({
|
TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey, Delegation::notDelegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttOFFER_CREATE, 7, OfferCreate, Delegation::delegatable, ({
|
||||||
{sfTakerPays, soeREQUIRED},
|
{sfTakerPays, soeREQUIRED},
|
||||||
{sfTakerGets, soeREQUIRED},
|
{sfTakerGets, soeREQUIRED},
|
||||||
{sfExpiration, soeOPTIONAL},
|
{sfExpiration, soeOPTIONAL},
|
||||||
{sfOfferSequence, soeOPTIONAL},
|
{sfOfferSequence, soeOPTIONAL},
|
||||||
|
{sfDomainID, soeOPTIONAL},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** 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, ({
|
TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttTICKET_CREATE, 10, TicketCreate, Delegation::delegatable, ({
|
||||||
{sfTicketCount, soeREQUIRED},
|
{sfTicketCount, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@@ -112,13 +114,13 @@ TRANSACTION(ttTICKET_CREATE, 10, TicketCreate, ({
|
|||||||
/** 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, ({
|
TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet, Delegation::notDelegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate, Delegation::delegatable, ({
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED},
|
{sfAmount, soeREQUIRED},
|
||||||
{sfSettleDelay, soeREQUIRED},
|
{sfSettleDelay, soeREQUIRED},
|
||||||
@@ -128,14 +130,14 @@ TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** 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, ({
|
TRANSACTION(ttPAYCHAN_FUND, 14, PaymentChannelFund, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim, Delegation::delegatable, ({
|
||||||
{sfChannel, soeREQUIRED},
|
{sfChannel, soeREQUIRED},
|
||||||
{sfAmount, soeOPTIONAL},
|
{sfAmount, soeOPTIONAL},
|
||||||
{sfBalance, soeOPTIONAL},
|
{sfBalance, soeOPTIONAL},
|
||||||
@@ -145,7 +147,7 @@ TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type creates a new check. */
|
/** This transaction type creates a new check. */
|
||||||
TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, ({
|
TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, Delegation::delegatable, ({
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
{sfSendMax, soeREQUIRED},
|
{sfSendMax, soeREQUIRED},
|
||||||
{sfExpiration, soeOPTIONAL},
|
{sfExpiration, soeOPTIONAL},
|
||||||
@@ -154,19 +156,19 @@ TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type cashes an existing check. */
|
/** This transaction type cashes an existing check. */
|
||||||
TRANSACTION(ttCHECK_CASH, 17, CheckCash, ({
|
TRANSACTION(ttCHECK_CASH, 17, CheckCash, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttCHECK_CANCEL, 18, CheckCancel, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth, Delegation::delegatable, ({
|
||||||
{sfAuthorize, soeOPTIONAL},
|
{sfAuthorize, soeOPTIONAL},
|
||||||
{sfUnauthorize, soeOPTIONAL},
|
{sfUnauthorize, soeOPTIONAL},
|
||||||
{sfAuthorizeCredentials, soeOPTIONAL},
|
{sfAuthorizeCredentials, soeOPTIONAL},
|
||||||
@@ -174,14 +176,14 @@ TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type modifies a trustline between two accounts. */
|
/** This transaction type modifies a trustline between two accounts. */
|
||||||
TRANSACTION(ttTRUST_SET, 20, TrustSet, ({
|
TRANSACTION(ttTRUST_SET, 20, TrustSet, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete, Delegation::notDelegatable, ({
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
{sfDestinationTag, soeOPTIONAL},
|
{sfDestinationTag, soeOPTIONAL},
|
||||||
{sfCredentialIDs, soeOPTIONAL},
|
{sfCredentialIDs, soeOPTIONAL},
|
||||||
@@ -190,7 +192,7 @@ TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete, ({
|
|||||||
// 22 reserved
|
// 22 reserved
|
||||||
|
|
||||||
/** This transaction mints a new NFT. */
|
/** This transaction mints a new NFT. */
|
||||||
TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint, ({
|
TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint, Delegation::delegatable, ({
|
||||||
{sfNFTokenTaxon, soeREQUIRED},
|
{sfNFTokenTaxon, soeREQUIRED},
|
||||||
{sfTransferFee, soeOPTIONAL},
|
{sfTransferFee, soeOPTIONAL},
|
||||||
{sfIssuer, soeOPTIONAL},
|
{sfIssuer, soeOPTIONAL},
|
||||||
@@ -201,13 +203,13 @@ TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction burns (i.e. destroys) an existing NFT. */
|
/** This transaction burns (i.e. destroys) an existing NFT. */
|
||||||
TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn, ({
|
TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer, Delegation::delegatable, ({
|
||||||
{sfNFTokenID, soeREQUIRED},
|
{sfNFTokenID, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED},
|
{sfAmount, soeREQUIRED},
|
||||||
{sfDestination, soeOPTIONAL},
|
{sfDestination, soeOPTIONAL},
|
||||||
@@ -216,25 +218,25 @@ TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** 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, ({
|
TRANSACTION(ttNFTOKEN_CANCEL_OFFER, 28, NFTokenCancelOffer, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttCLAWBACK, 30, Clawback, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback, Delegation::delegatable, ({
|
||||||
{sfHolder, soeREQUIRED},
|
{sfHolder, soeREQUIRED},
|
||||||
{sfAsset, soeREQUIRED},
|
{sfAsset, soeREQUIRED},
|
||||||
{sfAsset2, soeREQUIRED},
|
{sfAsset2, soeREQUIRED},
|
||||||
@@ -242,14 +244,14 @@ TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type creates an AMM instance */
|
/** This transaction type creates an AMM instance */
|
||||||
TRANSACTION(ttAMM_CREATE, 35, AMMCreate, ({
|
TRANSACTION(ttAMM_CREATE, 35, AMMCreate, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit, Delegation::delegatable, ({
|
||||||
{sfAsset, soeREQUIRED},
|
{sfAsset, soeREQUIRED},
|
||||||
{sfAsset2, soeREQUIRED},
|
{sfAsset2, soeREQUIRED},
|
||||||
{sfAmount, soeOPTIONAL},
|
{sfAmount, soeOPTIONAL},
|
||||||
@@ -260,7 +262,7 @@ TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type withdraws from an AMM instance */
|
/** This transaction type withdraws from an AMM instance */
|
||||||
TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw, ({
|
TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw, Delegation::delegatable, ({
|
||||||
{sfAsset, soeREQUIRED},
|
{sfAsset, soeREQUIRED},
|
||||||
{sfAsset2, soeREQUIRED},
|
{sfAsset2, soeREQUIRED},
|
||||||
{sfAmount, soeOPTIONAL},
|
{sfAmount, soeOPTIONAL},
|
||||||
@@ -270,14 +272,14 @@ TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type votes for the trading fee */
|
/** This transaction type votes for the trading fee */
|
||||||
TRANSACTION(ttAMM_VOTE, 38, AMMVote, ({
|
TRANSACTION(ttAMM_VOTE, 38, AMMVote, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttAMM_BID, 39, AMMBid, Delegation::delegatable, ({
|
||||||
{sfAsset, soeREQUIRED},
|
{sfAsset, soeREQUIRED},
|
||||||
{sfAsset2, soeREQUIRED},
|
{sfAsset2, soeREQUIRED},
|
||||||
{sfBidMin, soeOPTIONAL},
|
{sfBidMin, soeOPTIONAL},
|
||||||
@@ -286,20 +288,20 @@ TRANSACTION(ttAMM_BID, 39, AMMBid, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type deletes AMM in the empty state */
|
/** This transaction type deletes AMM in the empty state */
|
||||||
TRANSACTION(ttAMM_DELETE, 40, AMMDelete, ({
|
TRANSACTION(ttAMM_DELETE, 40, AMMDelete, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttXCHAIN_CREATE_CLAIM_ID, 41, XChainCreateClaimID, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttXCHAIN_COMMIT, 42, XChainCommit, Delegation::delegatable, ({
|
||||||
{sfXChainBridge, soeREQUIRED},
|
{sfXChainBridge, soeREQUIRED},
|
||||||
{sfXChainClaimID, soeREQUIRED},
|
{sfXChainClaimID, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED},
|
{sfAmount, soeREQUIRED},
|
||||||
@@ -307,7 +309,7 @@ TRANSACTION(ttXCHAIN_COMMIT, 42, XChainCommit, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction completes a crosschain transaction */
|
/** This transaction completes a crosschain transaction */
|
||||||
TRANSACTION(ttXCHAIN_CLAIM, 43, XChainClaim, ({
|
TRANSACTION(ttXCHAIN_CLAIM, 43, XChainClaim, Delegation::delegatable, ({
|
||||||
{sfXChainBridge, soeREQUIRED},
|
{sfXChainBridge, soeREQUIRED},
|
||||||
{sfXChainClaimID, soeREQUIRED},
|
{sfXChainClaimID, soeREQUIRED},
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
@@ -316,7 +318,7 @@ TRANSACTION(ttXCHAIN_CLAIM, 43, XChainClaim, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction initiates a crosschain account create transaction */
|
/** This transaction initiates a crosschain account create transaction */
|
||||||
TRANSACTION(ttXCHAIN_ACCOUNT_CREATE_COMMIT, 44, XChainAccountCreateCommit, ({
|
TRANSACTION(ttXCHAIN_ACCOUNT_CREATE_COMMIT, 44, XChainAccountCreateCommit, Delegation::delegatable, ({
|
||||||
{sfXChainBridge, soeREQUIRED},
|
{sfXChainBridge, soeREQUIRED},
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED},
|
{sfAmount, soeREQUIRED},
|
||||||
@@ -324,7 +326,7 @@ TRANSACTION(ttXCHAIN_ACCOUNT_CREATE_COMMIT, 44, XChainAccountCreateCommit, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction adds an attestation to a claim */
|
/** This transaction adds an attestation to a claim */
|
||||||
TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation, ({
|
TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation, Delegation::delegatable, ({
|
||||||
{sfXChainBridge, soeREQUIRED},
|
{sfXChainBridge, soeREQUIRED},
|
||||||
|
|
||||||
{sfAttestationSignerAccount, soeREQUIRED},
|
{sfAttestationSignerAccount, soeREQUIRED},
|
||||||
@@ -340,7 +342,7 @@ TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction adds an attestation to an account */
|
/** This transaction adds an attestation to an account */
|
||||||
TRANSACTION(ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION, 46, XChainAddAccountCreateAttestation, ({
|
TRANSACTION(ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION, 46, XChainAddAccountCreateAttestation, Delegation::delegatable, ({
|
||||||
{sfXChainBridge, soeREQUIRED},
|
{sfXChainBridge, soeREQUIRED},
|
||||||
|
|
||||||
{sfAttestationSignerAccount, soeREQUIRED},
|
{sfAttestationSignerAccount, soeREQUIRED},
|
||||||
@@ -357,31 +359,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, ({
|
TRANSACTION(ttXCHAIN_MODIFY_BRIDGE, 47, XChainModifyBridge, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttXCHAIN_CREATE_BRIDGE, 48, XChainCreateBridge, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttDID_SET, 49, DIDSet, Delegation::delegatable, ({
|
||||||
{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, ({}))
|
TRANSACTION(ttDID_DELETE, 50, DIDDelete, Delegation::delegatable, ({}))
|
||||||
|
|
||||||
/** This transaction type creates an Oracle instance */
|
/** This transaction type creates an Oracle instance */
|
||||||
TRANSACTION(ttORACLE_SET, 51, OracleSet, ({
|
TRANSACTION(ttORACLE_SET, 51, OracleSet, Delegation::delegatable, ({
|
||||||
{sfOracleDocumentID, soeREQUIRED},
|
{sfOracleDocumentID, soeREQUIRED},
|
||||||
{sfProvider, soeOPTIONAL},
|
{sfProvider, soeOPTIONAL},
|
||||||
{sfURI, soeOPTIONAL},
|
{sfURI, soeOPTIONAL},
|
||||||
@@ -391,18 +393,18 @@ TRANSACTION(ttORACLE_SET, 51, OracleSet, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type deletes an Oracle instance */
|
/** This transaction type deletes an Oracle instance */
|
||||||
TRANSACTION(ttORACLE_DELETE, 52, OracleDelete, ({
|
TRANSACTION(ttORACLE_DELETE, 52, OracleDelete, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttLEDGER_STATE_FIX, 53, LedgerStateFix, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate, Delegation::delegatable, ({
|
||||||
{sfAssetScale, soeOPTIONAL},
|
{sfAssetScale, soeOPTIONAL},
|
||||||
{sfTransferFee, soeOPTIONAL},
|
{sfTransferFee, soeOPTIONAL},
|
||||||
{sfMaximumAmount, soeOPTIONAL},
|
{sfMaximumAmount, soeOPTIONAL},
|
||||||
@@ -410,24 +412,24 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type destroys a MPTokensIssuance instance */
|
/** This transaction type destroys a MPTokensIssuance instance */
|
||||||
TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy, ({
|
TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttCREDENTIAL_CREATE, 58, CredentialCreate, Delegation::delegatable, ({
|
||||||
{sfSubject, soeREQUIRED},
|
{sfSubject, soeREQUIRED},
|
||||||
{sfCredentialType, soeREQUIRED},
|
{sfCredentialType, soeREQUIRED},
|
||||||
{sfExpiration, soeOPTIONAL},
|
{sfExpiration, soeOPTIONAL},
|
||||||
@@ -435,41 +437,96 @@ TRANSACTION(ttCREDENTIAL_CREATE, 58, CredentialCreate, ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type accept an Credential object */
|
/** This transaction type accept an Credential object */
|
||||||
TRANSACTION(ttCREDENTIAL_ACCEPT, 59, CredentialAccept, ({
|
TRANSACTION(ttCREDENTIAL_ACCEPT, 59, CredentialAccept, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttCREDENTIAL_DELETE, 60, CredentialDelete, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttPERMISSIONED_DOMAIN_SET, 62, PermissionedDomainSet, Delegation::delegatable, ({
|
||||||
{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, ({
|
TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 63, PermissionedDomainDelete, Delegation::delegatable, ({
|
||||||
{sfDomainID, soeREQUIRED},
|
{sfDomainID, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
/** This transaction type delegates authorized account specified permissions */
|
||||||
|
TRANSACTION(ttDELEGATE_SET, 64, DelegateSet, Delegation::notDelegatable, ({
|
||||||
|
{sfAuthorize, soeREQUIRED},
|
||||||
|
{sfPermissions, soeREQUIRED},
|
||||||
|
}))
|
||||||
|
|
||||||
|
/** This transaction creates a single asset vault. */
|
||||||
|
TRANSACTION(ttVAULT_CREATE, 65, VaultCreate, Delegation::delegatable, ({
|
||||||
|
{sfAsset, soeREQUIRED, soeMPTSupported},
|
||||||
|
{sfAssetsMaximum, soeOPTIONAL},
|
||||||
|
{sfMPTokenMetadata, soeOPTIONAL},
|
||||||
|
{sfDomainID, soeOPTIONAL}, // PermissionedDomainID
|
||||||
|
{sfWithdrawalPolicy, soeOPTIONAL},
|
||||||
|
{sfData, soeOPTIONAL},
|
||||||
|
}))
|
||||||
|
|
||||||
|
/** This transaction updates a single asset vault. */
|
||||||
|
TRANSACTION(ttVAULT_SET, 66, VaultSet, Delegation::delegatable, ({
|
||||||
|
{sfVaultID, soeREQUIRED},
|
||||||
|
{sfAssetsMaximum, soeOPTIONAL},
|
||||||
|
{sfDomainID, soeOPTIONAL}, // PermissionedDomainID
|
||||||
|
{sfData, soeOPTIONAL},
|
||||||
|
}))
|
||||||
|
|
||||||
|
/** This transaction deletes a single asset vault. */
|
||||||
|
TRANSACTION(ttVAULT_DELETE, 67, VaultDelete, Delegation::delegatable, ({
|
||||||
|
{sfVaultID, soeREQUIRED},
|
||||||
|
}))
|
||||||
|
|
||||||
|
/** This transaction trades assets for shares with a vault. */
|
||||||
|
TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit, Delegation::delegatable, ({
|
||||||
|
{sfVaultID, soeREQUIRED},
|
||||||
|
{sfAmount, soeREQUIRED, soeMPTSupported},
|
||||||
|
}))
|
||||||
|
|
||||||
|
/** This transaction trades shares for assets with a vault. */
|
||||||
|
TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw, Delegation::delegatable, ({
|
||||||
|
{sfVaultID, soeREQUIRED},
|
||||||
|
{sfAmount, soeREQUIRED, soeMPTSupported},
|
||||||
|
{sfDestination, soeOPTIONAL},
|
||||||
|
}))
|
||||||
|
|
||||||
|
/** This transaction claws back tokens from a vault. */
|
||||||
|
TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback, Delegation::delegatable, ({
|
||||||
|
{sfVaultID, soeREQUIRED},
|
||||||
|
{sfHolder, soeREQUIRED},
|
||||||
|
{sfAmount, soeOPTIONAL, soeMPTSupported},
|
||||||
|
}))
|
||||||
|
|
||||||
|
/** This transaction type batches together transactions. */
|
||||||
|
TRANSACTION(ttBATCH, 71, Batch, Delegation::notDelegatable, ({
|
||||||
|
{sfRawTransactions, soeREQUIRED},
|
||||||
|
{sfBatchSigners, soeOPTIONAL},
|
||||||
|
}))
|
||||||
|
|
||||||
/** 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, ({
|
TRANSACTION(ttAMENDMENT, 100, EnableAmendment, Delegation::notDelegatable, ({
|
||||||
{sfLedgerSequence, soeREQUIRED},
|
{sfLedgerSequence, soeREQUIRED},
|
||||||
{sfAmendment, soeREQUIRED},
|
{sfAmendment, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
@@ -477,7 +534,7 @@ TRANSACTION(ttAMENDMENT, 100, EnableAmendment, ({
|
|||||||
/** 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, ({
|
TRANSACTION(ttFEE, 101, SetFee, Delegation::notDelegatable, ({
|
||||||
{sfLedgerSequence, soeOPTIONAL},
|
{sfLedgerSequence, soeOPTIONAL},
|
||||||
// Old version uses raw numbers
|
// Old version uses raw numbers
|
||||||
{sfBaseFee, soeOPTIONAL},
|
{sfBaseFee, soeOPTIONAL},
|
||||||
@@ -494,9 +551,8 @@ TRANSACTION(ttFEE, 101, SetFee, ({
|
|||||||
|
|
||||||
For details, see: https://xrpl.org/negative-unl.html
|
For details, see: https://xrpl.org/negative-unl.html
|
||||||
*/
|
*/
|
||||||
TRANSACTION(ttUNL_MODIFY, 102, UNLModify, ({
|
TRANSACTION(ttUNL_MODIFY, 102, UNLModify, Delegation::notDelegatable, ({
|
||||||
{sfUNLModifyDisabling, soeREQUIRED},
|
{sfUNLModifyDisabling, soeREQUIRED},
|
||||||
{sfLedgerSequence, soeREQUIRED},
|
{sfLedgerSequence, soeREQUIRED},
|
||||||
{sfUNLModifyValidator, soeREQUIRED},
|
{sfUNLModifyValidator, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
@@ -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()}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
const char*
|
char const*
|
||||||
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)}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
const char*
|
char const*
|
||||||
what() const noexcept override
|
what() const noexcept override
|
||||||
{
|
{
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ JSS(PriceDataSeries); // field.
|
|||||||
JSS(PriceData); // field.
|
JSS(PriceData); // field.
|
||||||
JSS(Provider); // field.
|
JSS(Provider); // field.
|
||||||
JSS(QuoteAsset); // in: Oracle.
|
JSS(QuoteAsset); // in: Oracle.
|
||||||
|
JSS(RawTransaction); // in: Batch
|
||||||
|
JSS(RawTransactions); // in: Batch
|
||||||
JSS(SLE_hit_rate); // out: GetCounts.
|
JSS(SLE_hit_rate); // out: GetCounts.
|
||||||
JSS(Scale); // field.
|
JSS(Scale); // field.
|
||||||
JSS(SettleDelay); // in: TransactionSign
|
JSS(SettleDelay); // in: TransactionSign
|
||||||
@@ -95,10 +97,10 @@ 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(VoteSlots); // out: AMM Vote
|
JSS(VoteSlots); // out: AMM Vote
|
||||||
JSS(aborted); // out: InboundLedger
|
JSS(aborted); // out: InboundLedger
|
||||||
@@ -145,6 +147,7 @@ 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
|
||||||
@@ -388,6 +391,7 @@ JSS(load_fee); // out: LoadFeeTrackImp, NetworkOPs
|
|||||||
JSS(local); // out: resource/Logic.h
|
JSS(local); // out: resource/Logic.h
|
||||||
JSS(local_txs); // out: GetCounts
|
JSS(local_txs); // out: GetCounts
|
||||||
JSS(local_static_keys); // out: ValidatorList
|
JSS(local_static_keys); // out: ValidatorList
|
||||||
|
JSS(locked); // out: GatewayBalances
|
||||||
JSS(low); // out: BookChanges
|
JSS(low); // out: BookChanges
|
||||||
JSS(lowest_sequence); // out: AccountInfo
|
JSS(lowest_sequence); // out: AccountInfo
|
||||||
JSS(lowest_ticket); // out: AccountInfo
|
JSS(lowest_ticket); // out: AccountInfo
|
||||||
@@ -448,6 +452,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
|
||||||
@@ -558,6 +563,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
|
||||||
@@ -683,6 +689,7 @@ JSS(validations); // out: AmendmentTableImpl
|
|||||||
JSS(validator_list_threshold); // out: ValidatorList
|
JSS(validator_list_threshold); // out: ValidatorList
|
||||||
JSS(validator_sites); // out: ValidatorSites
|
JSS(validator_sites); // out: ValidatorSites
|
||||||
JSS(value); // out: STAmount
|
JSS(value); // out: STAmount
|
||||||
|
JSS(vault_id); // in: VaultInfo
|
||||||
JSS(version); // out: RPCVersion
|
JSS(version); // out: RPCVersion
|
||||||
JSS(vetoed); // out: AmendmentTableImpl
|
JSS(vetoed); // out: AmendmentTableImpl
|
||||||
JSS(volume_a); // out: BookChanges
|
JSS(volume_a); // out: BookChanges
|
||||||
@@ -699,7 +706,7 @@ JSS(write_load); // out: GetCounts
|
|||||||
#pragma push_macro("TRANSACTION")
|
#pragma push_macro("TRANSACTION")
|
||||||
#undef TRANSACTION
|
#undef TRANSACTION
|
||||||
|
|
||||||
#define TRANSACTION(tag, value, name, fields) JSS(name);
|
#define TRANSACTION(tag, value, name, delegatable, fields) JSS(name);
|
||||||
|
|
||||||
#include <xrpl/protocol/detail/transactions.macro>
|
#include <xrpl/protocol/detail/transactions.macro>
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ struct Key
|
|||||||
|
|
||||||
struct key_equal
|
struct key_equal
|
||||||
{
|
{
|
||||||
explicit key_equal() = default;
|
key_equal() = default;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator()(Key const& lhs, Key const& rhs) const
|
operator()(Key const& lhs, Key const& rhs) const
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ extractTarLz4(
|
|||||||
|
|
||||||
if (archive_entry_size(entry) > 0)
|
if (archive_entry_size(entry) > 0)
|
||||||
{
|
{
|
||||||
const void* buf;
|
void const* buf;
|
||||||
size_t sz;
|
size_t sz;
|
||||||
la_int64_t offset;
|
la_int64_t offset;
|
||||||
while (true)
|
while (true)
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ getFileContents(
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string result{
|
std::string const result{
|
||||||
std::istreambuf_iterator<char>{fileStream},
|
std::istreambuf_iterator<char>{fileStream},
|
||||||
std::istreambuf_iterator<char>{}};
|
std::istreambuf_iterator<char>{}};
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
const uint128_t f = 100'000'000'000'000'000;
|
uint128_t const 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;
|
||||||
|
|||||||
@@ -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];
|
||||||
const std::string domain = smMatch[4];
|
std::string const 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.
|
||||||
const auto result = beast::IP::Endpoint::from_string_checked(domain);
|
auto const result = beast::IP::Endpoint::from_string_checked(domain);
|
||||||
pUrl.domain = result ? result->address().to_string() : domain;
|
pUrl.domain = result ? result->address().to_string() : domain;
|
||||||
const std::string port = smMatch[5];
|
std::string const 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);
|
||||||
|
|||||||
@@ -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 const auto init = start_clock();
|
static auto const 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_}};
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user