Compare commits

...

18 Commits

Author SHA1 Message Date
Sergey Kuznetsov
bcc0345c35 chore: Use released libxrpl 3.2.0 (#3105) 2026-06-16 17:31:10 +01:00
Sergey Kuznetsov
14645e1494 fix: Proxy support (#3103)
Port of two changes onto release/2.7.1:
- #3006 (d3381a1d): resolve proxy ip before processing any request
- #3043 (d7bcf6e7): re-resolve client ip when a proxy reuses a TCP
connection for different clients (resolveClientIp now returns
std::optional; extractClientIp made public; isProxyConnection_ tracked)
2026-06-09 16:25:02 +01:00
Sergey Kuznetsov
ce44aec245 ci: Use docker images with glibc version in conan (#3100) 2026-06-08 15:16:50 +01:00
Sergey Kuznetsov
94da8459dd ci: Use glibc version in conan profile (#3099) 2026-06-08 14:01:33 +01:00
Sergey Kuznetsov
8f3afd09e6 chore: Use libxrpl 3.2.0 (#3095) 2026-06-05 17:48:07 +01:00
Sergey Kuznetsov
6bb4953f16 ci: Remove arm (#3094) 2026-06-05 15:37:58 +01:00
Sergey Kuznetsov
884c1e8cde ci: Remove arm 2026-06-05 15:33:38 +01:00
Sergey Kuznetsov
7edeb14629 ci: Update docker actions, fix llvm repo (#3093) 2026-06-05 14:34:51 +01:00
Sergey Kuznetsov
b6241b7c7f ci: Update actions, fix llvm repo 2026-06-05 13:00:31 +01:00
Sergey Kuznetsov
2c715323a9 ci: Fix docker update ci (#3092) 2026-06-05 12:18:10 +01:00
Sergey Kuznetsov
b5889e4382 Fix docker update ci 2026-06-05 12:00:42 +01:00
Sergey Kuznetsov
df295ff6ed ci: Ubuntu 20.04 -> 22.04 (#3090) 2026-06-05 11:03:06 +01:00
Sergey Kuznetsov
419ab53caa ci: Ubuntu 20.04 -> 22.04 2026-06-04 17:16:37 +01:00
Ayaz Salikhov
3215e43c11 ci: Restart colima on macOS (#2923) 2026-01-15 19:03:47 +00:00
Ayaz Salikhov
e8c977e7de chore: Commits for 2.7.0-rc3 (#2912) 2026-01-13 16:53:44 +00:00
Ayaz Salikhov
c59fcf343f chore: Commits for 2.7.0-rc2 (#2868) 2025-12-19 15:45:02 +00:00
Ayaz Salikhov
c35649eb6e chore: Commits for 2.7.0-rc1 (#2846) 2025-12-10 16:26:07 +00:00
Sergey Kuznetsov
4da4b49eda chore: Commits for 2.7.0-b2 (#2795) 2025-11-20 14:53:12 +00:00
288 changed files with 6220 additions and 6107 deletions

View File

@@ -34,32 +34,32 @@ runs:
steps: steps:
- name: Login to DockerHub - name: Login to DockerHub
if: ${{ inputs.push_image == 'true' && inputs.dockerhub_repo != '' }} if: ${{ inputs.push_image == 'true' && inputs.dockerhub_repo != '' }}
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with: with:
username: ${{ env.DOCKERHUB_USER }} username: ${{ env.DOCKERHUB_USER }}
password: ${{ env.DOCKERHUB_PW }} password: ${{ env.DOCKERHUB_PW }}
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
if: ${{ inputs.push_image == 'true' }} if: ${{ inputs.push_image == 'true' }}
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ env.GITHUB_TOKEN }} password: ${{ env.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 - uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
with: with:
cache-image: false cache-image: false
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 - uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 - uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
id: meta id: meta
with: with:
images: ${{ inputs.images }} images: ${{ inputs.images }}
tags: ${{ inputs.tags }} tags: ${{ inputs.tags }}
- name: Build and push - name: Build and push
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with: with:
context: ${{ inputs.directory }} context: ${{ inputs.directory }}
platforms: ${{ inputs.platforms }} platforms: ${{ inputs.platforms }}

View File

@@ -4,7 +4,7 @@ import json
LINUX_OS = ["heavy", "heavy-arm64"] LINUX_OS = ["heavy", "heavy-arm64"]
LINUX_CONTAINERS = [ LINUX_CONTAINERS = [
'{ "image": "ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696" }' '{ "image": "ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031" }'
] ]
LINUX_COMPILERS = ["gcc", "clang"] LINUX_COMPILERS = ["gcc", "clang"]

View File

@@ -49,7 +49,7 @@ jobs:
build_type: [Release, Debug] build_type: [Release, Debug]
container: container:
[ [
'{ "image": "ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696" }', '{ "image": "ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031" }',
] ]
static: [true] static: [true]
@@ -79,7 +79,7 @@ jobs:
uses: ./.github/workflows/reusable-build.yml uses: ./.github/workflows/reusable-build.yml
with: with:
runs_on: heavy runs_on: heavy
container: '{ "image": "ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696" }' container: '{ "image": "ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031" }'
conan_profile: gcc conan_profile: gcc
build_type: Debug build_type: Debug
download_ccache: true download_ccache: true
@@ -97,7 +97,7 @@ jobs:
needs: build-and-test needs: build-and-test
runs-on: heavy runs-on: heavy
container: container:
image: ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696 image: ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031
steps: steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

View File

@@ -21,7 +21,7 @@ jobs:
name: Build Clio / `libXRPL ${{ github.event.client_payload.version }}` name: Build Clio / `libXRPL ${{ github.event.client_payload.version }}`
runs-on: heavy runs-on: heavy
container: container:
image: ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696 image: ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031
steps: steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -29,7 +29,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Prepare runner - name: Prepare runner
uses: XRPLF/actions/prepare-runner@f05cab7b8541eee6473aa42beb9d2fe35608a190 uses: XRPLF/actions/prepare-runner@90f11ee655d1687824fb8793db770477d52afbab
with: with:
enable_ccache: false enable_ccache: false
@@ -69,7 +69,7 @@ jobs:
needs: build needs: build
runs-on: heavy runs-on: heavy
container: container:
image: ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696 image: ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031
steps: steps:
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0

View File

@@ -31,7 +31,7 @@ jobs:
if: github.event_name != 'push' || contains(github.event.head_commit.message, 'clang-tidy auto fixes') if: github.event_name != 'push' || contains(github.event.head_commit.message, 'clang-tidy auto fixes')
runs-on: heavy runs-on: heavy
container: container:
image: ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696 image: ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031
permissions: permissions:
contents: write contents: write
@@ -44,7 +44,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Prepare runner - name: Prepare runner
uses: XRPLF/actions/prepare-runner@f05cab7b8541eee6473aa42beb9d2fe35608a190 uses: XRPLF/actions/prepare-runner@90f11ee655d1687824fb8793db770477d52afbab
with: with:
enable_ccache: false enable_ccache: false

View File

@@ -18,7 +18,7 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696 image: ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031
steps: steps:
- name: Checkout - name: Checkout
@@ -27,7 +27,7 @@ jobs:
lfs: true lfs: true
- name: Prepare runner - name: Prepare runner
uses: XRPLF/actions/prepare-runner@f05cab7b8541eee6473aa42beb9d2fe35608a190 uses: XRPLF/actions/prepare-runner@90f11ee655d1687824fb8793db770477d52afbab
with: with:
enable_ccache: false enable_ccache: false

View File

@@ -55,17 +55,17 @@ jobs:
conan_profile: gcc conan_profile: gcc
build_type: Release build_type: Release
static: true static: true
container: '{ "image": "ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696" }' container: '{ "image": "ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031" }'
- os: heavy - os: heavy
conan_profile: gcc conan_profile: gcc
build_type: Debug build_type: Debug
static: true static: true
container: '{ "image": "ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696" }' container: '{ "image": "ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031" }'
- os: heavy - os: heavy
conan_profile: gcc.ubsan conan_profile: gcc.ubsan
build_type: Release build_type: Release
static: false static: false
container: '{ "image": "ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696" }' container: '{ "image": "ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031" }'
uses: ./.github/workflows/reusable-build-test.yml uses: ./.github/workflows/reusable-build-test.yml
with: with:
@@ -88,7 +88,7 @@ jobs:
uses: ./.github/workflows/reusable-build.yml uses: ./.github/workflows/reusable-build.yml
with: with:
runs_on: heavy runs_on: heavy
container: '{ "image": "ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696" }' container: '{ "image": "ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031" }'
conan_profile: gcc conan_profile: gcc
build_type: Release build_type: Release
download_ccache: false download_ccache: false
@@ -111,7 +111,7 @@ jobs:
include: include:
- os: heavy - os: heavy
conan_profile: clang conan_profile: clang
container: '{ "image": "ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696" }' container: '{ "image": "ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031" }'
static: true static: true
- os: macos15 - os: macos15
conan_profile: apple-clang conan_profile: apple-clang

View File

@@ -11,4 +11,4 @@ jobs:
uses: XRPLF/actions/.github/workflows/pre-commit.yml@282890f46d6921249d5659dd38babcb0bd8aef48 uses: XRPLF/actions/.github/workflows/pre-commit.yml@282890f46d6921249d5659dd38babcb0bd8aef48
with: with:
runs_on: heavy runs_on: heavy
container: '{ "image": "ghcr.io/xrplf/clio-pre-commit:14342e087ceb8b593027198bf9ef06a43833c696" }' container: '{ "image": "ghcr.io/xrplf/clio-pre-commit:94da8459ddc30e2f0d88a98cba63a57b2cda3031" }'

View File

@@ -29,7 +29,7 @@ jobs:
conan_profile: gcc conan_profile: gcc
build_type: Release build_type: Release
static: true static: true
container: '{ "image": "ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696" }' container: '{ "image": "ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031" }'
uses: ./.github/workflows/reusable-build-test.yml uses: ./.github/workflows/reusable-build-test.yml
with: with:
@@ -51,7 +51,7 @@ jobs:
uses: ./.github/workflows/reusable-build.yml uses: ./.github/workflows/reusable-build.yml
with: with:
runs_on: heavy runs_on: heavy
container: '{ "image": "ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696" }' container: '{ "image": "ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031" }'
conan_profile: gcc conan_profile: gcc
build_type: Release build_type: Release
download_ccache: false download_ccache: false

View File

@@ -95,7 +95,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Prepare runner - name: Prepare runner
uses: XRPLF/actions/prepare-runner@f05cab7b8541eee6473aa42beb9d2fe35608a190 uses: XRPLF/actions/prepare-runner@90f11ee655d1687824fb8793db770477d52afbab
with: with:
enable_ccache: ${{ inputs.download_ccache }} enable_ccache: ${{ inputs.download_ccache }}

View File

@@ -46,7 +46,7 @@ jobs:
release: release:
runs-on: heavy runs-on: heavy
container: container:
image: ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696 image: ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031
env: env:
GH_REPO: ${{ github.repository }} GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
@@ -60,7 +60,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Prepare runner - name: Prepare runner
uses: XRPLF/actions/prepare-runner@f05cab7b8541eee6473aa42beb9d2fe35608a190 uses: XRPLF/actions/prepare-runner@90f11ee655d1687824fb8793db770477d52afbab
with: with:
enable_ccache: false enable_ccache: false

View File

@@ -126,6 +126,12 @@ jobs:
if: ${{ runner.os == 'macOS' }} if: ${{ runner.os == 'macOS' }}
uses: XRPLF/actions/cleanup-workspace@cf0433aa74563aead044a1e395610c96d65a37cf uses: XRPLF/actions/cleanup-workspace@cf0433aa74563aead044a1e395610c96d65a37cf
- name: Restart colima
if: ${{ runner.os == 'macOS' }}
run: |
colima delete --force
colima start
- name: Spin up scylladb - name: Spin up scylladb
if: ${{ runner.os == 'macOS' }} if: ${{ runner.os == 'macOS' }}
timeout-minutes: 3 timeout-minutes: 3

View File

@@ -28,7 +28,7 @@ jobs:
- name: Upload coverage report - name: Upload coverage report
if: ${{ hashFiles('build/coverage_report.xml') != '' }} if: ${{ hashFiles('build/coverage_report.xml') != '' }}
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with: with:
files: build/coverage_report.xml files: build/coverage_report.xml
fail_ci_if_error: true fail_ci_if_error: true

View File

@@ -44,7 +44,7 @@ jobs:
uses: ./.github/workflows/reusable-build-test.yml uses: ./.github/workflows/reusable-build-test.yml
with: with:
runs_on: heavy runs_on: heavy
container: '{ "image": "ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696" }' container: '{ "image": "ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031" }'
download_ccache: false download_ccache: false
upload_ccache: false upload_ccache: false
conan_profile: ${{ matrix.compiler }}${{ matrix.sanitizer_ext }} conan_profile: ${{ matrix.compiler }}${{ matrix.sanitizer_ext }}

View File

@@ -77,10 +77,10 @@ jobs:
push_image: ${{ github.event_name != 'pull_request' }} push_image: ${{ github.event_name != 'pull_request' }}
directory: docker/compilers/gcc directory: docker/compilers/gcc
tags: | tags: |
type=raw,value=amd64-latest type=raw,value=latest
type=raw,value=amd64-${{ env.GCC_MAJOR_VERSION }} type=raw,value=${{ env.GCC_MAJOR_VERSION }}
type=raw,value=amd64-${{ env.GCC_VERSION }} type=raw,value=${{ env.GCC_VERSION }}
type=raw,value=amd64-${{ github.sha }} type=raw,value=${{ github.sha }}
platforms: linux/amd64 platforms: linux/amd64
build_args: | build_args: |
GCC_MAJOR_VERSION=${{ env.GCC_MAJOR_VERSION }} GCC_MAJOR_VERSION=${{ env.GCC_MAJOR_VERSION }}
@@ -89,6 +89,7 @@ jobs:
dockerhub_description: GCC compiler for XRPLF/clio. dockerhub_description: GCC compiler for XRPLF/clio.
gcc-arm64: gcc-arm64:
if: false
name: Build and push GCC docker image (arm64) name: Build and push GCC docker image (arm64)
runs-on: heavy-arm64 runs-on: heavy-arm64
needs: repo needs: repo
@@ -127,6 +128,7 @@ jobs:
dockerhub_description: GCC compiler for XRPLF/clio. dockerhub_description: GCC compiler for XRPLF/clio.
gcc-merge: gcc-merge:
if: false
name: Merge and push multi-arch GCC docker image name: Merge and push multi-arch GCC docker image
runs-on: heavy runs-on: heavy
needs: [repo, gcc-amd64, gcc-arm64] needs: [repo, gcc-amd64, gcc-arm64]
@@ -141,11 +143,11 @@ jobs:
files: "docker/compilers/gcc/**" files: "docker/compilers/gcc/**"
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
@@ -153,7 +155,7 @@ jobs:
- name: Login to DockerHub - name: Login to DockerHub
if: ${{ github.repository_owner == 'XRPLF' && github.event_name != 'pull_request' }} if: ${{ github.repository_owner == 'XRPLF' && github.event_name != 'pull_request' }}
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with: with:
username: ${{ secrets.DOCKERHUB_USER }} username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PW }} password: ${{ secrets.DOCKERHUB_PW }}
@@ -174,7 +176,7 @@ jobs:
} }
push_image ${{ needs.repo.outputs.GHCR_REPO }}/clio-gcc push_image ${{ needs.repo.outputs.GHCR_REPO }}/clio-gcc
if [[ ${{ github.repository_owner }} == 'XRPLF' ]]; then if [[ ${{ github.repository_owner }} == 'XRPLF' ]]; then
push_image rippleci/clio_clang push_image rippleci/clio_gcc
fi fi
clang: clang:
@@ -207,7 +209,8 @@ jobs:
type=raw,value=latest type=raw,value=latest
type=raw,value=${{ env.CLANG_MAJOR_VERSION }} type=raw,value=${{ env.CLANG_MAJOR_VERSION }}
type=raw,value=${{ github.sha }} type=raw,value=${{ github.sha }}
platforms: linux/amd64,linux/arm64 # platforms: linux/amd64,linux/arm64
platforms: linux/amd64
build_args: | build_args: |
CLANG_MAJOR_VERSION=${{ env.CLANG_MAJOR_VERSION }} CLANG_MAJOR_VERSION=${{ env.CLANG_MAJOR_VERSION }}
dockerhub_repo: ${{ github.repository_owner == 'XRPLF' && 'rippleci/clio_clang' || '' }} dockerhub_repo: ${{ github.repository_owner == 'XRPLF' && 'rippleci/clio_clang' || '' }}
@@ -216,7 +219,7 @@ jobs:
tools-amd64: tools-amd64:
name: Build and push tools docker image (amd64) name: Build and push tools docker image (amd64)
runs-on: heavy runs-on: heavy
needs: [repo, gcc-merge] needs: [repo, gcc-amd64]
steps: steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -237,17 +240,18 @@ jobs:
push_image: ${{ github.event_name != 'pull_request' }} push_image: ${{ github.event_name != 'pull_request' }}
directory: docker/tools directory: docker/tools
tags: | tags: |
type=raw,value=amd64-latest type=raw,value=latest
type=raw,value=amd64-${{ github.sha }} type=raw,value=${{ github.sha }}
platforms: linux/amd64 platforms: linux/amd64
build_args: | build_args: |
GHCR_REPO=${{ needs.repo.outputs.GHCR_REPO }} GHCR_REPO=${{ needs.repo.outputs.GHCR_REPO }}
GCC_VERSION=${{ env.GCC_VERSION }} GCC_VERSION=${{ env.GCC_VERSION }}
tools-arm64: tools-arm64:
if: false
name: Build and push tools docker image (arm64) name: Build and push tools docker image (arm64)
runs-on: heavy-arm64 runs-on: heavy-arm64
needs: [repo, gcc-merge] needs: [repo, gcc-amd64]
steps: steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -276,6 +280,7 @@ jobs:
GCC_VERSION=${{ env.GCC_VERSION }} GCC_VERSION=${{ env.GCC_VERSION }}
tools-merge: tools-merge:
if: false
name: Merge and push multi-arch tools docker image name: Merge and push multi-arch tools docker image
runs-on: heavy runs-on: heavy
needs: [repo, tools-amd64, tools-arm64] needs: [repo, tools-amd64, tools-arm64]
@@ -290,11 +295,11 @@ jobs:
files: "docker/tools/**" files: "docker/tools/**"
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
@@ -313,7 +318,7 @@ jobs:
pre-commit: pre-commit:
name: Build and push pre-commit docker image name: Build and push pre-commit docker image
runs-on: heavy runs-on: heavy
needs: [repo, tools-merge] needs: [repo, tools-amd64]
steps: steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -328,14 +333,15 @@ jobs:
tags: | tags: |
type=raw,value=latest type=raw,value=latest
type=raw,value=${{ github.sha }} type=raw,value=${{ github.sha }}
platforms: linux/amd64,linux/arm64 # platforms: linux/amd64,linux/arm64
platforms: linux/amd64
build_args: | build_args: |
GHCR_REPO=${{ needs.repo.outputs.GHCR_REPO }} GHCR_REPO=${{ needs.repo.outputs.GHCR_REPO }}
ci: ci:
name: Build and push CI docker image name: Build and push CI docker image
runs-on: heavy runs-on: heavy
needs: [repo, gcc-merge, clang, tools-merge] needs: [repo, gcc-amd64, clang, tools-amd64]
steps: steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -354,7 +360,8 @@ jobs:
type=raw,value=latest type=raw,value=latest
type=raw,value=gcc_${{ env.GCC_MAJOR_VERSION }}_clang_${{ env.CLANG_MAJOR_VERSION }} type=raw,value=gcc_${{ env.GCC_MAJOR_VERSION }}_clang_${{ env.CLANG_MAJOR_VERSION }}
type=raw,value=${{ github.sha }} type=raw,value=${{ github.sha }}
platforms: linux/amd64,linux/arm64 # platforms: linux/amd64,linux/arm64
platforms: linux/amd64
build_args: | build_args: |
GHCR_REPO=${{ needs.repo.outputs.GHCR_REPO }} GHCR_REPO=${{ needs.repo.outputs.GHCR_REPO }}
CLANG_MAJOR_VERSION=${{ env.CLANG_MAJOR_VERSION }} CLANG_MAJOR_VERSION=${{ env.CLANG_MAJOR_VERSION }}

View File

@@ -78,7 +78,7 @@ jobs:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Prepare runner - name: Prepare runner
uses: XRPLF/actions/prepare-runner@f05cab7b8541eee6473aa42beb9d2fe35608a190 uses: XRPLF/actions/prepare-runner@90f11ee655d1687824fb8793db770477d52afbab
with: with:
enable_ccache: false enable_ccache: false

View File

@@ -1,4 +1,4 @@
set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON) set(Boost_USE_STATIC_RUNTIME ON)
find_package(Boost 1.82 REQUIRED CONFIG COMPONENTS program_options coroutine system log log_setup) find_package(Boost 1.82 REQUIRED CONFIG COMPONENTS program_options system log log_setup)

View File

@@ -1,3 +1,3 @@
find_package(OpenSSL 1.1.1 REQUIRED CONFIG) find_package(OpenSSL 3 REQUIRED CONFIG)
set_target_properties(OpenSSL::SSL PROPERTIES INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2) set_target_properties(OpenSSL::SSL PROPERTIES INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2)

View File

@@ -1,58 +1,76 @@
{ {
"version": "0.5", "version": "0.5",
"requires": [ "requires": [
"zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76%1765850150.075", "zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1778091116.056",
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1765850149.987", "xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1765850149.987",
"xrpl/3.0.0#534d3f65a336109eee929b88962bae4e%1765375071.547", "xrpl/3.2.0#c3c124909c6461012758a4fab7c90cd5%1781569913.756",
"sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1765850149.926", "sqlite3/3.53.0#324ada52333108388a9a6108bfa96734%1778091117.311",
"spdlog/1.17.0#bcbaaf7147bda6ad24ffbd1ac3d7142c%1767636069.964", "spdlog/1.17.0#bcbaaf7147bda6ad24ffbd1ac3d7142c%1768312128.781",
"soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1765850149.46", "soci/4.0.3#fe32b9ad5eb47e79ab9e45a68f363945%1774450067.231",
"re2/20230301#ca3b241baec15bd31ea9187150e0b333%1765850148.103", "snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1765850147.878",
"secp256k1/0.7.1#481881709eb0bdd0185a12b912bbe8ad%1770910500.329",
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1765850186.86",
"re2/20251105#8579cfd0bda4daf0683f9e3898f964b4%1774398111.888",
"rapidjson/cci.20220822#1b9d8c2256876a154172dc5cfbe447c6%1754325007.656", "rapidjson/cci.20220822#1b9d8c2256876a154172dc5cfbe447c6%1754325007.656",
"protobuf/3.21.12#44ee56c0a6eea0c19aeeaca680370b88%1764175361.456", "protobuf/6.33.5#d96d52ba5baaaa532f47bda866ad87a5%1774467363.12",
"openssl/1.1.1w#a8f0792d7c5121b954578a7149d23e03%1756223730.729", "openssl/3.6.2#4789bbf131b77d0515d15e094c8f697f%1778071755.506",
"nudb/2.0.9#fb8dfd1a5557f5e0528114c2da17721e%1765850143.957", "nudb/2.0.9#11149c73f8f2baff9a0198fe25971fc7%1775040983.408",
"minizip/1.2.13#9e87d57804bd372d6d1e32b1871517a3%1754325004.374", "minizip/1.2.13#9e87d57804bd372d6d1e32b1871517a3%1754325004.374",
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1765850143.914", "lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1765850143.914",
"libuv/1.46.0#dc28c1f653fa197f00db5b577a6f6011%1754325003.592", "libuv/1.46.0#dc28c1f653fa197f00db5b577a6f6011%1754325003.592",
"libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1765842973.492", "libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1765842973.492",
"libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1765842973.03", "libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1765842973.03",
"libarchive/3.8.1#ffee18995c706e02bf96e7a2f7042e0d%1765850144.736", "libarchive/3.8.7#c446109bd1f1d8ba7936c94189bc50e6%1778091117.848",
"http_parser/2.9.4#98d91690d6fd021e9e624218a85d9d97%1754325001.385", "http_parser/2.9.4#98d91690d6fd021e9e624218a85d9d97%1754325001.385",
"gtest/1.17.0#5224b3b3ff3b4ce1133cbdd27d53ee7d%1755784855.585", "gtest/1.17.0#5224b3b3ff3b4ce1133cbdd27d53ee7d%1768312129.152",
"grpc/1.50.1#02291451d1e17200293a409410d1c4e1%1756234248.958", "grpc/1.78.1#b1a9e74b145cc471bed4dc64dc6eb2c1%1774467387.342",
"fmt/12.1.0#50abab23274d56bb8f42c94b3b9a40c7%1763984116.926", "fmt/12.1.0#50abab23274d56bb8f42c94b3b9a40c7%1763984116.926",
"doctest/2.4.11#a4211dfc329a16ba9f280f9574025659%1756234220.819", "ed25519/2015.03#ae761bdc52730a843f0809bdf6c1b1f6%1765850143.772",
"date/3.0.4#862e11e80030356b53c2c38599ceb32b%1765850143.772", "date/3.0.4#862e11e80030356b53c2c38599ceb32b%1765850143.772",
"cassandra-cpp-driver/2.17.0#bd3934138689482102c265d01288a316%1764175359.611", "cassandra-cpp-driver/2.17.0#bd3934138689482102c265d01288a316%1764175359.611",
"c-ares/1.34.5#5581c2b62a608b40bb85d965ab3ec7c8%1765850144.336", "c-ares/1.34.6#545240bb1c40e2cacd4362d6b8967650%1774439234.681",
"bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1765850143.837", "bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1765850143.837",
"boost/1.83.0#91d8b1572534d2c334d6790e3c34d0c1%1764175359.61", "boost/1.91.0#ea540ca2133d831b560036aa24dece3c%1778091165.282",
"benchmark/1.9.4#ce4403f7a24d3e1f907cd9da4b678be4%1754578869.672", "benchmark/1.9.4#ce4403f7a24d3e1f907cd9da4b678be4%1754578869.672",
"abseil/20230802.1#90ba607d4ee8fb5fb157c3db540671fc%1764175359.429" "abseil/20250127.0#bb0baf1f362bc4a725a24eddd419b8f7%1774365460.196"
], ],
"build_requires": [ "build_requires": [
"zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76%1765850150.075", "zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1778091116.056",
"protobuf/3.21.12#44ee56c0a6eea0c19aeeaca680370b88%1764175361.456", "protobuf/6.33.5#d96d52ba5baaaa532f47bda866ad87a5%1774467363.12",
"cmake/4.2.0#ae0a44f44a1ef9ab68fd4b3e9a1f8671%1765850153.937", "cmake/4.3.0#b939a42e98f593fb34d3a8c5cc860359%1774439249.183",
"cmake/3.31.10#313d16a1aa16bbdb2ca0792467214b76%1765850153.479", "cmake/3.31.11#f325c933f618a1fcebc1e1c0babfd1ba%1774439246.719",
"b2/5.3.3#107c15377719889654eb9a162a673975%1765850144.355" "b2/5.4.2#ffd6084a119587e70f11cd45d1a386e2%1774439233.447",
"abseil/20250127.0#bb0baf1f362bc4a725a24eddd419b8f7%1774365460.196"
], ],
"python_requires": [], "python_requires": [],
"overrides": { "overrides": {
"boost/1.83.0": [ "zlib/[>=1.2.11 <2]": [
null, "zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb"
"boost/1.83.0#91d8b1572534d2c334d6790e3c34d0c1"
], ],
"protobuf/3.21.12": [ "zlib/1.3.2": [
null, null,
"protobuf/3.21.12#44ee56c0a6eea0c19aeeaca680370b88" "zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb"
],
"boost/1.91.0": [
"boost/1.91.0#ea540ca2133d831b560036aa24dece3c"
],
"protobuf/[>=5.27.0 <7]": [
"protobuf/6.33.5"
], ],
"lz4/1.9.4": [ "lz4/1.9.4": [
"lz4/1.10.0" "lz4/1.10.0"
], ],
"sqlite3/3.44.2": [ "boost/[>=1.83.0 <1.91.0]": [
"sqlite3/3.49.1" "boost/1.91.0"
],
"sqlite3/[>=3.44 <4]": [
"sqlite3/3.53.0"
],
"boost/1.83.0": [
"boost/1.91.0"
],
"lz4/[>=1.9.4 <2]": [
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504"
] ]
}, },
"config_requires": [] "config_requires": []

View File

@@ -12,16 +12,11 @@ class ClioConan(ConanFile):
options = {} options = {}
requires = [ requires = [
"boost/1.83.0",
"cassandra-cpp-driver/2.17.0", "cassandra-cpp-driver/2.17.0",
"fmt/12.1.0", "fmt/12.1.0",
"grpc/1.50.1",
"libbacktrace/cci.20210118", "libbacktrace/cci.20210118",
"openssl/1.1.1w",
"protobuf/3.21.12",
"spdlog/1.17.0", "spdlog/1.17.0",
"xrpl/3.0.0", "xrpl/3.2.0",
"zlib/1.3.1",
] ]
default_options = { default_options = {
@@ -36,7 +31,7 @@ class ClioConan(ConanFile):
"protobuf/*:shared": False, "protobuf/*:shared": False,
"protobuf/*:with_zlib": True, "protobuf/*:with_zlib": True,
"snappy/*:shared": False, "snappy/*:shared": False,
"xrpl/*:rocksdb": False, "xrpl/*:rocksdb": True, # TODO: revert to false when includes are fixed in libxrpl
"xrpl/*:tests": False, "xrpl/*:tests": False,
} }
@@ -45,6 +40,19 @@ class ClioConan(ConanFile):
def requirements(self): def requirements(self):
self.requires("gtest/1.17.0") self.requires("gtest/1.17.0")
self.requires("benchmark/1.9.4") self.requires("benchmark/1.9.4")
# Clio's own code includes grpc (<grpcpp/...>) and openssl (via
# <boost/asio/ssl>) headers directly, but xrpl does not re-export them
# (only boost/date/xxhash are required with transitive_headers=True).
# So they must be direct requirements of clio to get their include dirs;
# the version pins match xrpl's, so this does not change any package_id.
self.requires("grpc/1.78.1")
self.requires("openssl/3.6.2")
# Pin the remaining transitive deps to the exact versions xrpl uses.
# override=True only sets the version when the package appears
# transitively (it does not make them direct deps), and matches xrpl's
# force=True boost pin that overrides nudb's `boost < 1.91.0` cap.
self.requires("boost/1.91.0", override=True)
self.requires("zlib/1.3.2", override=True)
def configure(self): def configure(self):
if self.settings.compiler == "apple-clang": if self.settings.compiler == "apple-clang":

View File

@@ -63,7 +63,7 @@ RUN pip install -q --no-cache-dir \
# Install LLVM tools # Install LLVM tools
ARG LLVM_TOOLS_VERSION=20 ARG LLVM_TOOLS_VERSION=20
RUN echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${LLVM_TOOLS_VERSION} main" >> /etc/apt/sources.list \ RUN echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${LLVM_TOOLS_VERSION} main" >> /etc/apt/sources.list \
&& wget --progress=dot:giga -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && wget --progress=dot:giga -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
RUN apt-get update \ RUN apt-get update \

View File

@@ -3,7 +3,7 @@
This image contains an environment to build [Clio](https://github.com/XRPLF/clio), check code and documentation. This image contains an environment to build [Clio](https://github.com/XRPLF/clio), check code and documentation.
It is used in [Clio Github Actions](https://github.com/XRPLF/clio/actions) but can also be used to compile Clio locally. It is used in [Clio Github Actions](https://github.com/XRPLF/clio/actions) but can also be used to compile Clio locally.
The image is based on Ubuntu 20.04 and contains: The image is based on Ubuntu 22.04 and contains:
- ccache 4.12.2 - ccache 4.12.2
- Clang 19 - Clang 19

View File

@@ -10,3 +10,5 @@ os=Linux
[conf] [conf]
tools.build:compiler_executables={"c": "/usr/bin/clang-19", "cpp": "/usr/bin/clang++-19"} tools.build:compiler_executables={"c": "/usr/bin/clang-19", "cpp": "/usr/bin/clang++-19"}
grpc/1.50.1:tools.build:cxxflags+=["-Wno-missing-template-arg-list-after-template-kw"] grpc/1.50.1:tools.build:cxxflags+=["-Wno-missing-template-arg-list-after-template-kw"]
user.package:libc_version=2.32
tools.info.package_id:confs+=["user.package:libc_version"]

View File

@@ -9,3 +9,5 @@ os=Linux
[conf] [conf]
tools.build:compiler_executables={"c": "/usr/bin/gcc-15", "cpp": "/usr/bin/g++-15"} tools.build:compiler_executables={"c": "/usr/bin/gcc-15", "cpp": "/usr/bin/g++-15"}
user.package:libc_version=2.32
tools.info.package_id:confs+=["user.package:libc_version"]

View File

@@ -1,4 +1,4 @@
FROM ubuntu:20.04 FROM ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive

View File

@@ -1,4 +1,4 @@
ARG UBUNTU_VERSION=20.04 ARG UBUNTU_VERSION=22.04
ARG GCC_MAJOR_VERSION=invalid ARG GCC_MAJOR_VERSION=invalid

View File

@@ -1,6 +1,6 @@
services: services:
clio_develop: clio_develop:
image: ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696 image: ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031
volumes: volumes:
- clio_develop_conan_data:/root/.conan2/p - clio_develop_conan_data:/root/.conan2/p
- clio_develop_ccache:/root/.ccache - clio_develop_ccache:/root/.ccache

View File

@@ -175,7 +175,7 @@ Open the `index.html` file in your browser to see the documentation pages.
It is also possible to build Clio using [Docker](https://www.docker.com/) if you don't want to install all the dependencies on your machine. It is also possible to build Clio using [Docker](https://www.docker.com/) if you don't want to install all the dependencies on your machine.
```sh ```sh
docker run -it ghcr.io/xrplf/clio-ci:14342e087ceb8b593027198bf9ef06a43833c696 docker run -it ghcr.io/xrplf/clio-ci:94da8459ddc30e2f0d88a98cba63a57b2cda3031
git clone https://github.com/XRPLF/clio git clone https://github.com/XRPLF/clio
cd clio cd clio
``` ```

View File

@@ -120,7 +120,7 @@ MetricsHandler::operator()(
if (!postSuccessful) { if (!postSuccessful) {
return web::ng::Response{ return web::ng::Response{
boost::beast::http::status::too_many_requests, rpc::makeError(rpc::RippledError::rpcTOO_BUSY), request boost::beast::http::status::too_many_requests, rpc::makeError(rpc::RippledError::RpcTooBusy), request
}; };
} }

View File

@@ -252,7 +252,7 @@ public:
} catch (std::exception const&) { } catch (std::exception const&) {
return web::ng::Response{ return web::ng::Response{
boost::beast::http::status::internal_server_error, boost::beast::http::status::internal_server_error,
rpc::makeError(rpc::RippledError::rpcINTERNAL), rpc::makeError(rpc::RippledError::RpcInternal),
request request
}; };
} }

View File

@@ -57,7 +57,7 @@ supportedAmendments()
} }
bool bool
lookupAmendment(auto const& allAmendments, std::vector<ripple::uint256> const& ledgerAmendments, std::string_view name) lookupAmendment(auto const& allAmendments, std::vector<xrpl::uint256> const& ledgerAmendments, std::string_view name)
{ {
namespace rg = std::ranges; namespace rg = std::ranges;
if (auto const am = rg::find(allAmendments, name, &data::Amendment::name); am != rg::end(allAmendments)) if (auto const am = rg::find(allAmendments, name, &data::Amendment::name); am != rg::end(allAmendments))
@@ -91,7 +91,7 @@ operator std::string_view() const
} }
AmendmentKey:: AmendmentKey::
operator ripple::uint256() const operator xrpl::uint256() const
{ {
return Amendment::getAmendmentId(name); return Amendment::getAmendmentId(name);
} }
@@ -102,14 +102,14 @@ AmendmentCenter::AmendmentCenter(std::shared_ptr<data::BackendInterface> const&
namespace vs = std::views; namespace vs = std::views;
rg::copy( rg::copy(
ripple::allAmendments() | vs::transform([&](auto const& p) { xrpl::allAmendments() | vs::transform([&](auto const& p) {
auto const& [name, support] = p; auto const& [name, support] = p;
return Amendment{ return Amendment{
.name = name, .name = name,
.feature = Amendment::getAmendmentId(name), .feature = Amendment::getAmendmentId(name),
.isSupportedByXRPL = support != ripple::AmendmentSupport::Unsupported, .isSupportedByXRPL = support != xrpl::AmendmentSupport::Unsupported,
.isSupportedByClio = rg::find(supportedAmendments(), name) != rg::end(supportedAmendments()), .isSupportedByClio = rg::find(supportedAmendments(), name) != rg::end(supportedAmendments()),
.isRetired = support == ripple::AmendmentSupport::Retired .isRetired = support == xrpl::AmendmentSupport::Retired
}; };
}), }),
std::back_inserter(all_) std::back_inserter(all_)
@@ -191,25 +191,25 @@ AmendmentCenter::operator[](AmendmentKey const& key) const
return getAmendment(key); return getAmendment(key);
} }
ripple::uint256 xrpl::uint256
Amendment::getAmendmentId(std::string_view name) Amendment::getAmendmentId(std::string_view name)
{ {
return ripple::sha512Half(ripple::Slice(name.data(), name.size())); return xrpl::sha512Half(xrpl::Slice(name.data(), name.size()));
} }
std::optional<std::vector<ripple::uint256>> std::optional<std::vector<xrpl::uint256>>
AmendmentCenter::fetchAmendmentsList(boost::asio::yield_context yield, uint32_t seq) const AmendmentCenter::fetchAmendmentsList(boost::asio::yield_context yield, uint32_t seq) const
{ {
// the amendments should always be present on the ledger // the amendments should always be present on the ledger
auto const amendments = backend_->fetchLedgerObject(ripple::keylet::amendments().key, seq, yield); auto const amendments = backend_->fetchLedgerObject(xrpl::keylet::amendments().key, seq, yield);
if (not amendments.has_value()) if (not amendments.has_value())
throw std::runtime_error("Amendments ledger object must be present in the database"); throw std::runtime_error("Amendments ledger object must be present in the database");
ripple::SLE const amendmentsSLE{ xrpl::SLE const amendmentsSLE{
ripple::SerialIter{amendments->data(), amendments->size()}, ripple::keylet::amendments().key xrpl::SerialIter{amendments->data(), amendments->size()}, xrpl::keylet::amendments().key
}; };
return amendmentsSLE[~ripple::sfAmendments]; return amendmentsSLE[~xrpl::sfAmendments];
} }
} // namespace data } // namespace data

View File

@@ -153,6 +153,11 @@ struct Amendments {
REGISTER(fixIncludeKeyletFields); REGISTER(fixIncludeKeyletFields);
REGISTER(fixTokenEscrowV1); REGISTER(fixTokenEscrowV1);
REGISTER(LendingProtocol); REGISTER(LendingProtocol);
REGISTER(MPTokensV2);
REGISTER(PermissionDelegationV1_1);
REGISTER(fixBatchInnerSigs);
REGISTER(fixCleanup3_1_3);
REGISTER(fixCleanup3_2_0);
// Obsolete but supported by libxrpl // Obsolete but supported by libxrpl
REGISTER(CryptoConditionsSuite); REGISTER(CryptoConditionsSuite);
@@ -276,7 +281,7 @@ public:
operator[](AmendmentKey const& key) const final; operator[](AmendmentKey const& key) const final;
private: private:
[[nodiscard]] std::optional<std::vector<ripple::uint256>> [[nodiscard]] std::optional<std::vector<xrpl::uint256>>
fetchAmendmentsList(boost::asio::yield_context yield, uint32_t seq) const; fetchAmendmentsList(boost::asio::yield_context yield, uint32_t seq) const;
}; };

View File

@@ -64,7 +64,7 @@ BackendInterface::finishWrites(std::uint32_t const ledgerSequence)
void void
BackendInterface::writeLedgerObject(std::string&& key, std::uint32_t const seq, std::string&& blob) BackendInterface::writeLedgerObject(std::string&& key, std::uint32_t const seq, std::string&& blob)
{ {
ASSERT(key.size() == sizeof(ripple::uint256), "Key must be 256 bits"); ASSERT(key.size() == sizeof(xrpl::uint256), "Key must be 256 bits");
doWriteLedgerObject(std::move(key), seq, std::move(blob)); doWriteLedgerObject(std::move(key), seq, std::move(blob));
} }
@@ -77,14 +77,14 @@ BackendInterface::hardFetchLedgerRangeNoThrow() const
// *** state data methods // *** state data methods
std::optional<Blob> std::optional<Blob>
BackendInterface::fetchLedgerObject( BackendInterface::fetchLedgerObject(
ripple::uint256 const& key, xrpl::uint256 const& key,
std::uint32_t const sequence, std::uint32_t const sequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const ) const
{ {
auto obj = cache_.get().get(key, sequence); auto obj = cache_.get().get(key, sequence);
if (obj) { if (obj) {
LOG(log_.trace()) << "Cache hit - " << ripple::strHex(key); LOG(log_.trace()) << "Cache hit - " << xrpl::strHex(key);
return obj; return obj;
} }
@@ -99,7 +99,7 @@ BackendInterface::fetchLedgerObject(
std::optional<std::uint32_t> std::optional<std::uint32_t>
BackendInterface::fetchLedgerObjectSeq( BackendInterface::fetchLedgerObjectSeq(
ripple::uint256 const& key, xrpl::uint256 const& key,
std::uint32_t const sequence, std::uint32_t const sequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const ) const
@@ -112,14 +112,14 @@ BackendInterface::fetchLedgerObjectSeq(
std::vector<Blob> std::vector<Blob>
BackendInterface::fetchLedgerObjects( BackendInterface::fetchLedgerObjects(
std::vector<ripple::uint256> const& keys, std::vector<xrpl::uint256> const& keys,
std::uint32_t const sequence, std::uint32_t const sequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const ) const
{ {
std::vector<Blob> results; std::vector<Blob> results;
results.resize(keys.size()); results.resize(keys.size());
std::vector<ripple::uint256> misses; std::vector<xrpl::uint256> misses;
for (size_t i = 0; i < keys.size(); ++i) { for (size_t i = 0; i < keys.size(); ++i) {
auto obj = cache_.get().get(keys[i], sequence); auto obj = cache_.get().get(keys[i], sequence);
if (obj) { if (obj) {
@@ -144,25 +144,25 @@ BackendInterface::fetchLedgerObjects(
} }
// Fetches the successor to key/index // Fetches the successor to key/index
std::optional<ripple::uint256> std::optional<xrpl::uint256>
BackendInterface::fetchSuccessorKey( BackendInterface::fetchSuccessorKey(
ripple::uint256 key, xrpl::uint256 key,
std::uint32_t const ledgerSequence, std::uint32_t const ledgerSequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const ) const
{ {
auto succ = cache_.get().getSuccessor(key, ledgerSequence); auto succ = cache_.get().getSuccessor(key, ledgerSequence);
if (succ) { if (succ) {
LOG(log_.trace()) << "Cache hit - " << ripple::strHex(key); LOG(log_.trace()) << "Cache hit - " << xrpl::strHex(key);
} else { } else {
LOG(log_.trace()) << "Cache miss - " << ripple::strHex(key); LOG(log_.trace()) << "Cache miss - " << xrpl::strHex(key);
} }
return succ ? succ->key : doFetchSuccessorKey(key, ledgerSequence, yield); return succ ? succ->key : doFetchSuccessorKey(key, ledgerSequence, yield);
} }
std::optional<LedgerObject> std::optional<LedgerObject>
BackendInterface::fetchSuccessorObject( BackendInterface::fetchSuccessorObject(
ripple::uint256 key, xrpl::uint256 key,
std::uint32_t const ledgerSequence, std::uint32_t const ledgerSequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const ) const
@@ -180,7 +180,7 @@ BackendInterface::fetchSuccessorObject(
BookOffersPage BookOffersPage
BackendInterface::fetchBookOffers( BackendInterface::fetchBookOffers(
ripple::uint256 const& book, xrpl::uint256 const& book,
std::uint32_t const ledgerSequence, std::uint32_t const ledgerSequence,
std::uint32_t const limit, std::uint32_t const limit,
boost::asio::yield_context yield boost::asio::yield_context yield
@@ -189,9 +189,9 @@ BackendInterface::fetchBookOffers(
// TODO try to speed this up. This can take a few seconds. The goal is // TODO try to speed this up. This can take a few seconds. The goal is
// to get it down to a few hundred milliseconds. // to get it down to a few hundred milliseconds.
BookOffersPage page; BookOffersPage page;
ripple::uint256 const bookEnd = ripple::getQualityNext(book); xrpl::uint256 const bookEnd = xrpl::getQualityNext(book);
ripple::uint256 uTipIndex = book; xrpl::uint256 uTipIndex = book;
std::vector<ripple::uint256> keys; std::vector<xrpl::uint256> keys;
auto getMillis = [](auto diff) { return std::chrono::duration_cast<std::chrono::milliseconds>(diff).count(); }; auto getMillis = [](auto diff) { return std::chrono::duration_cast<std::chrono::milliseconds>(diff).count(); };
auto begin = std::chrono::system_clock::now(); auto begin = std::chrono::system_clock::now();
std::uint32_t numSucc = 0; std::uint32_t numSucc = 0;
@@ -211,17 +211,17 @@ BackendInterface::fetchBookOffers(
uTipIndex = offerDir->key; uTipIndex = offerDir->key;
while (keys.size() < limit) { while (keys.size() < limit) {
++numPages; ++numPages;
ripple::STLedgerEntry const sle{ xrpl::STLedgerEntry const sle{
ripple::SerialIter{offerDir->blob.data(), offerDir->blob.size()}, offerDir->key xrpl::SerialIter{offerDir->blob.data(), offerDir->blob.size()}, offerDir->key
}; };
auto indexes = sle.getFieldV256(ripple::sfIndexes); auto indexes = sle.getFieldV256(xrpl::sfIndexes);
keys.insert(keys.end(), indexes.begin(), indexes.end()); keys.insert(keys.end(), indexes.begin(), indexes.end());
auto next = sle.getFieldU64(ripple::sfIndexNext); auto next = sle.getFieldU64(xrpl::sfIndexNext);
if (next == 0u) { if (next == 0u) {
LOG(log_.trace()) << "Next is empty. breaking"; LOG(log_.trace()) << "Next is empty. breaking";
break; break;
} }
auto nextKey = ripple::keylet::page(uTipIndex, next); auto nextKey = xrpl::keylet::page(uTipIndex, next);
auto nextDir = fetchLedgerObject(nextKey.key, ledgerSequence, yield); auto nextDir = fetchLedgerObject(nextKey.key, ledgerSequence, yield);
ASSERT(nextDir.has_value(), "Next dir must exist"); ASSERT(nextDir.has_value(), "Next dir must exist");
offerDir->blob = *nextDir; offerDir->blob = *nextDir;
@@ -233,7 +233,7 @@ BackendInterface::fetchBookOffers(
auto mid = std::chrono::system_clock::now(); auto mid = std::chrono::system_clock::now();
auto objs = fetchLedgerObjects(keys, ledgerSequence, yield); auto objs = fetchLedgerObjects(keys, ledgerSequence, yield);
for (size_t i = 0; i < keys.size() && i < limit; ++i) { for (size_t i = 0; i < keys.size() && i < limit; ++i) {
LOG(log_.trace()) << "Key = " << ripple::strHex(keys[i]) << " blob = " << ripple::strHex(objs[i]) LOG(log_.trace()) << "Key = " << xrpl::strHex(keys[i]) << " blob = " << xrpl::strHex(objs[i])
<< " ledgerSequence = " << ledgerSequence; << " ledgerSequence = " << ledgerSequence;
ASSERT(!objs[i].empty(), "Ledger object can't be empty"); ASSERT(!objs[i].empty(), "Ledger object can't be empty");
page.offers.push_back({keys[i], objs[i]}); page.offers.push_back({keys[i], objs[i]});
@@ -247,7 +247,7 @@ BackendInterface::fetchBookOffers(
<< ". num pages = " << std::to_string(numPages) << ". Fetching all objects took " << ". num pages = " << std::to_string(numPages) << ". Fetching all objects took "
<< std::to_string(getMillis(end - mid)) << std::to_string(getMillis(end - mid))
<< " milliseconds. total time = " << std::to_string(getMillis(end - begin)) << " milliseconds" << " milliseconds. total time = " << std::to_string(getMillis(end - begin)) << " milliseconds"
<< " book = " << ripple::strHex(book); << " book = " << xrpl::strHex(book);
return page; return page;
} }
@@ -305,7 +305,7 @@ BackendInterface::setRange(uint32_t min, uint32_t max, bool force)
LedgerPage LedgerPage
BackendInterface::fetchLedgerPage( BackendInterface::fetchLedgerPage(
std::optional<ripple::uint256> const& cursor, std::optional<xrpl::uint256> const& cursor,
std::uint32_t const ledgerSequence, std::uint32_t const ledgerSequence,
std::uint32_t const limit, std::uint32_t const limit,
bool outOfOrder, bool outOfOrder,
@@ -314,11 +314,11 @@ BackendInterface::fetchLedgerPage(
{ {
LedgerPage page; LedgerPage page;
std::vector<ripple::uint256> keys; std::vector<xrpl::uint256> keys;
bool reachedEnd = false; bool reachedEnd = false;
while (keys.size() < limit && !reachedEnd) { while (keys.size() < limit && !reachedEnd) {
ripple::uint256 const& curCursor = [&]() { xrpl::uint256 const& curCursor = [&]() {
if (!keys.empty()) if (!keys.empty())
return keys.back(); return keys.back();
return (cursor ? *cursor : kFIRST_KEY); return (cursor ? *cursor : kFIRST_KEY);
@@ -339,11 +339,11 @@ BackendInterface::fetchLedgerPage(
if (!objects[i].empty()) { if (!objects[i].empty()) {
page.objects.push_back({keys[i], std::move(objects[i])}); page.objects.push_back({keys[i], std::move(objects[i])});
} else if (!outOfOrder) { } else if (!outOfOrder) {
LOG(log_.error()) << "Deleted or non-existent object in successor table. key = " << ripple::strHex(keys[i]) LOG(log_.error()) << "Deleted or non-existent object in successor table. key = " << xrpl::strHex(keys[i])
<< " - seq = " << ledgerSequence; << " - seq = " << ledgerSequence;
std::stringstream msg; std::stringstream msg;
for (size_t j = 0; j < objects.size(); ++j) { for (size_t j = 0; j < objects.size(); ++j) {
msg << " - " << ripple::strHex(keys[j]); msg << " - " << xrpl::strHex(keys[j]);
} }
LOG(log_.error()) << msg.str(); LOG(log_.error()) << msg.str();
@@ -357,12 +357,12 @@ BackendInterface::fetchLedgerPage(
return page; return page;
} }
std::optional<ripple::Fees> std::optional<xrpl::Fees>
BackendInterface::fetchFees(std::uint32_t const seq, boost::asio::yield_context yield) const BackendInterface::fetchFees(std::uint32_t const seq, boost::asio::yield_context yield) const
{ {
ripple::Fees fees; xrpl::Fees fees;
auto key = ripple::keylet::fees().key; auto key = xrpl::keylet::fees().key;
auto bytes = fetchLedgerObject(key, seq, yield); auto bytes = fetchLedgerObject(key, seq, yield);
if (!bytes) { if (!bytes) {
@@ -370,17 +370,17 @@ BackendInterface::fetchFees(std::uint32_t const seq, boost::asio::yield_context
return {}; return {};
} }
ripple::SerialIter it(bytes->data(), bytes->size()); xrpl::SerialIter it(bytes->data(), bytes->size());
ripple::SLE const sle{it, key}; xrpl::SLE const sle{it, key};
// XRPFees amendment introduced new fields for fees calculations. // XRPFees amendment introduced new fields for fees calculations.
// New fields are set and the old fields are removed via `set_fees` tx. // New fields are set and the old fields are removed via `set_fees` tx.
// Fallback to old fields if `set_fees` was not yet used to update the fields on this tx. // Fallback to old fields if `set_fees` was not yet used to update the fields on this tx.
auto hasNewFields = false; auto hasNewFields = false;
{ {
auto const baseFeeXRP = sle.at(~ripple::sfBaseFeeDrops); auto const baseFeeXRP = sle.at(~xrpl::sfBaseFeeDrops);
auto const reserveBaseXRP = sle.at(~ripple::sfReserveBaseDrops); auto const reserveBaseXRP = sle.at(~xrpl::sfReserveBaseDrops);
auto const reserveIncrementXRP = sle.at(~ripple::sfReserveIncrementDrops); auto const reserveIncrementXRP = sle.at(~xrpl::sfReserveIncrementDrops);
if (baseFeeXRP) if (baseFeeXRP)
fees.base = baseFeeXRP->xrp(); fees.base = baseFeeXRP->xrp();
@@ -396,9 +396,9 @@ BackendInterface::fetchFees(std::uint32_t const seq, boost::asio::yield_context
if (not hasNewFields) { if (not hasNewFields) {
// Fallback to old fields // Fallback to old fields
auto const baseFee = sle.at(~ripple::sfBaseFee); auto const baseFee = sle.at(~xrpl::sfBaseFee);
auto const reserveBase = sle.at(~ripple::sfReserveBase); auto const reserveBase = sle.at(~xrpl::sfReserveBase);
auto const reserveIncrement = sle.at(~ripple::sfReserveIncrement); auto const reserveIncrement = sle.at(~xrpl::sfReserveIncrement);
if (baseFee) if (baseFee)
fees.base = baseFee.value(); fees.base = baseFee.value();

View File

@@ -192,9 +192,9 @@ public:
* *
* @param sequence The sequence number to fetch for * @param sequence The sequence number to fetch for
* @param yield The coroutine context * @param yield The coroutine context
* @return The ripple::LedgerHeader if found; nullopt otherwise * @return The xrpl::LedgerHeader if found; nullopt otherwise
*/ */
virtual std::optional<ripple::LedgerHeader> virtual std::optional<xrpl::LedgerHeader>
fetchLedgerBySequence(std::uint32_t sequence, boost::asio::yield_context yield) const = 0; fetchLedgerBySequence(std::uint32_t sequence, boost::asio::yield_context yield) const = 0;
/** /**
@@ -202,10 +202,10 @@ public:
* *
* @param hash The hash to fetch for * @param hash The hash to fetch for
* @param yield The coroutine context * @param yield The coroutine context
* @return The ripple::LedgerHeader if found; nullopt otherwise * @return The xrpl::LedgerHeader if found; nullopt otherwise
*/ */
virtual std::optional<ripple::LedgerHeader> virtual std::optional<xrpl::LedgerHeader>
fetchLedgerByHash(ripple::uint256 const& hash, boost::asio::yield_context yield) const = 0; fetchLedgerByHash(xrpl::uint256 const& hash, boost::asio::yield_context yield) const = 0;
/** /**
* @brief Fetches the latest ledger sequence. * @brief Fetches the latest ledger sequence.
@@ -231,9 +231,9 @@ public:
* @param pageSize The maximum number of accounts per page * @param pageSize The maximum number of accounts per page
* @param seq The accounts need to exist for this sequence * @param seq The accounts need to exist for this sequence
* @param yield The coroutine context * @param yield The coroutine context
* @return A vector of ripple::uint256 representing the account roots * @return A vector of xrpl::uint256 representing the account roots
*/ */
virtual std::vector<ripple::uint256> virtual std::vector<xrpl::uint256>
fetchAccountRoots( fetchAccountRoots(
std::uint32_t number, std::uint32_t number,
std::uint32_t pageSize, std::uint32_t pageSize,
@@ -275,7 +275,7 @@ public:
* @param yield The coroutine context * @param yield The coroutine context
* @return Fees if fees are found; nullopt otherwise * @return Fees if fees are found; nullopt otherwise
*/ */
std::optional<ripple::Fees> std::optional<xrpl::Fees>
fetchFees(std::uint32_t seq, boost::asio::yield_context yield) const; fetchFees(std::uint32_t seq, boost::asio::yield_context yield) const;
/** /**
@@ -286,7 +286,7 @@ public:
* @return TransactionAndMetadata if transaction is found; nullopt otherwise * @return TransactionAndMetadata if transaction is found; nullopt otherwise
*/ */
virtual std::optional<TransactionAndMetadata> virtual std::optional<TransactionAndMetadata>
fetchTransaction(ripple::uint256 const& hash, boost::asio::yield_context yield) const = 0; fetchTransaction(xrpl::uint256 const& hash, boost::asio::yield_context yield) const = 0;
/** /**
* @brief Fetches multiple transactions. * @brief Fetches multiple transactions.
@@ -296,7 +296,7 @@ public:
* @return A vector of TransactionAndMetadata matching the given hashes * @return A vector of TransactionAndMetadata matching the given hashes
*/ */
virtual std::vector<TransactionAndMetadata> virtual std::vector<TransactionAndMetadata>
fetchTransactions(std::vector<ripple::uint256> const& hashes, boost::asio::yield_context yield) const = 0; fetchTransactions(std::vector<xrpl::uint256> const& hashes, boost::asio::yield_context yield) const = 0;
/** /**
* @brief Fetches all transactions for a specific account. * @brief Fetches all transactions for a specific account.
@@ -310,7 +310,7 @@ public:
*/ */
virtual TransactionsAndCursor virtual TransactionsAndCursor
fetchAccountTransactions( fetchAccountTransactions(
ripple::AccountID const& account, xrpl::AccountID const& account,
std::uint32_t limit, std::uint32_t limit,
bool forward, bool forward,
std::optional<TransactionsCursor> const& txnCursor, std::optional<TransactionsCursor> const& txnCursor,
@@ -332,9 +332,9 @@ public:
* *
* @param ledgerSequence The ledger sequence to fetch for * @param ledgerSequence The ledger sequence to fetch for
* @param yield The coroutine context * @param yield The coroutine context
* @return Hashes as ripple::uint256 in a vector * @return Hashes as xrpl::uint256 in a vector
*/ */
virtual std::vector<ripple::uint256> virtual std::vector<xrpl::uint256>
fetchAllTransactionHashesInLedger(std::uint32_t ledgerSequence, boost::asio::yield_context yield) const = 0; fetchAllTransactionHashesInLedger(std::uint32_t ledgerSequence, boost::asio::yield_context yield) const = 0;
/** /**
@@ -346,7 +346,7 @@ public:
* @return NFT object on success; nullopt otherwise * @return NFT object on success; nullopt otherwise
*/ */
virtual std::optional<NFT> virtual std::optional<NFT>
fetchNFT(ripple::uint256 const& tokenID, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const = 0; fetchNFT(xrpl::uint256 const& tokenID, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const = 0;
/** /**
* @brief Fetches all transactions for a specific NFT. * @brief Fetches all transactions for a specific NFT.
@@ -360,7 +360,7 @@ public:
*/ */
virtual TransactionsAndCursor virtual TransactionsAndCursor
fetchNFTTransactions( fetchNFTTransactions(
ripple::uint256 const& tokenID, xrpl::uint256 const& tokenID,
std::uint32_t limit, std::uint32_t limit,
bool forward, bool forward,
std::optional<TransactionsCursor> const& cursorIn, std::optional<TransactionsCursor> const& cursorIn,
@@ -380,11 +380,11 @@ public:
*/ */
virtual NFTsAndCursor virtual NFTsAndCursor
fetchNFTsByIssuer( fetchNFTsByIssuer(
ripple::AccountID const& issuer, xrpl::AccountID const& issuer,
std::optional<std::uint32_t> const& taxon, std::optional<std::uint32_t> const& taxon,
std::uint32_t ledgerSequence, std::uint32_t ledgerSequence,
std::uint32_t limit, std::uint32_t limit,
std::optional<ripple::uint256> const& cursorIn, std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield boost::asio::yield_context yield
) const = 0; ) const = 0;
@@ -400,9 +400,9 @@ public:
*/ */
virtual MPTHoldersAndCursor virtual MPTHoldersAndCursor
fetchMPTHolders( fetchMPTHolders(
ripple::uint192 const& mptID, xrpl::uint192 const& mptID,
std::uint32_t const limit, std::uint32_t const limit,
std::optional<ripple::AccountID> const& cursorIn, std::optional<xrpl::AccountID> const& cursorIn,
std::uint32_t const ledgerSequence, std::uint32_t const ledgerSequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const = 0; ) const = 0;
@@ -419,7 +419,7 @@ public:
* @return The object as a Blob on success; nullopt otherwise * @return The object as a Blob on success; nullopt otherwise
*/ */
std::optional<Blob> std::optional<Blob>
fetchLedgerObject(ripple::uint256 const& key, std::uint32_t sequence, boost::asio::yield_context yield) const; fetchLedgerObject(xrpl::uint256 const& key, std::uint32_t sequence, boost::asio::yield_context yield) const;
/** /**
* @brief Fetches a specific ledger object sequence. * @brief Fetches a specific ledger object sequence.
@@ -432,7 +432,7 @@ public:
* @return The sequence in unit32_t on success; nullopt otherwise * @return The sequence in unit32_t on success; nullopt otherwise
*/ */
std::optional<std::uint32_t> std::optional<std::uint32_t>
fetchLedgerObjectSeq(ripple::uint256 const& key, std::uint32_t sequence, boost::asio::yield_context yield) const; fetchLedgerObjectSeq(xrpl::uint256 const& key, std::uint32_t sequence, boost::asio::yield_context yield) const;
/** /**
* @brief Fetches all ledger objects by their keys. * @brief Fetches all ledger objects by their keys.
@@ -447,7 +447,7 @@ public:
*/ */
std::vector<Blob> std::vector<Blob>
fetchLedgerObjects( fetchLedgerObjects(
std::vector<ripple::uint256> const& keys, std::vector<xrpl::uint256> const& keys,
std::uint32_t sequence, std::uint32_t sequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const; ) const;
@@ -461,7 +461,7 @@ public:
* @return The object as a Blob on success; nullopt otherwise * @return The object as a Blob on success; nullopt otherwise
*/ */
virtual std::optional<Blob> virtual std::optional<Blob>
doFetchLedgerObject(ripple::uint256 const& key, std::uint32_t sequence, boost::asio::yield_context yield) const = 0; doFetchLedgerObject(xrpl::uint256 const& key, std::uint32_t sequence, boost::asio::yield_context yield) const = 0;
/** /**
* @brief The database-specific implementation for fetching a ledger object sequence. * @brief The database-specific implementation for fetching a ledger object sequence.
@@ -473,7 +473,7 @@ public:
*/ */
virtual std::optional<std::uint32_t> virtual std::optional<std::uint32_t>
doFetchLedgerObjectSeq( doFetchLedgerObjectSeq(
ripple::uint256 const& key, xrpl::uint256 const& key,
std::uint32_t sequence, std::uint32_t sequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const = 0; ) const = 0;
@@ -488,7 +488,7 @@ public:
*/ */
virtual std::vector<Blob> virtual std::vector<Blob>
doFetchLedgerObjects( doFetchLedgerObjects(
std::vector<ripple::uint256> const& keys, std::vector<xrpl::uint256> const& keys,
std::uint32_t sequence, std::uint32_t sequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const = 0; ) const = 0;
@@ -515,7 +515,7 @@ public:
*/ */
LedgerPage LedgerPage
fetchLedgerPage( fetchLedgerPage(
std::optional<ripple::uint256> const& cursor, std::optional<xrpl::uint256> const& cursor,
std::uint32_t ledgerSequence, std::uint32_t ledgerSequence,
std::uint32_t limit, std::uint32_t limit,
bool outOfOrder, bool outOfOrder,
@@ -531,7 +531,7 @@ public:
* @return The successor on success; nullopt otherwise * @return The successor on success; nullopt otherwise
*/ */
std::optional<LedgerObject> std::optional<LedgerObject>
fetchSuccessorObject(ripple::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const; fetchSuccessorObject(xrpl::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const;
/** /**
* @brief Fetches the successor key. * @brief Fetches the successor key.
@@ -544,8 +544,8 @@ public:
* @param yield The coroutine context * @param yield The coroutine context
* @return The successor key on success; nullopt otherwise * @return The successor key on success; nullopt otherwise
*/ */
std::optional<ripple::uint256> std::optional<xrpl::uint256>
fetchSuccessorKey(ripple::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const; fetchSuccessorKey(xrpl::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const;
/** /**
* @brief Database-specific implementation of fetching the successor key * @brief Database-specific implementation of fetching the successor key
@@ -555,8 +555,8 @@ public:
* @param yield The coroutine context * @param yield The coroutine context
* @return The successor on success; nullopt otherwise * @return The successor on success; nullopt otherwise
*/ */
virtual std::optional<ripple::uint256> virtual std::optional<xrpl::uint256>
doFetchSuccessorKey(ripple::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const = 0; doFetchSuccessorKey(xrpl::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const = 0;
/** /**
* @brief Fetches book offers. * @brief Fetches book offers.
@@ -569,7 +569,7 @@ public:
*/ */
BookOffersPage BookOffersPage
fetchBookOffers( fetchBookOffers(
ripple::uint256 const& book, xrpl::uint256 const& book,
std::uint32_t ledgerSequence, std::uint32_t ledgerSequence,
std::uint32_t limit, std::uint32_t limit,
boost::asio::yield_context yield boost::asio::yield_context yield
@@ -632,7 +632,7 @@ public:
* @param blob r-value string serialization of ledger header. * @param blob r-value string serialization of ledger header.
*/ */
virtual void virtual void
writeLedger(ripple::LedgerHeader const& ledgerHeader, std::string&& blob) = 0; writeLedger(xrpl::LedgerHeader const& ledgerHeader, std::string&& blob) = 0;
/** /**
* @brief Writes a new ledger object. * @brief Writes a new ledger object.

View File

@@ -116,11 +116,11 @@ public:
NFTsAndCursor NFTsAndCursor
fetchNFTsByIssuer( fetchNFTsByIssuer(
ripple::AccountID const& issuer, xrpl::AccountID const& issuer,
std::optional<std::uint32_t> const& taxon, std::optional<std::uint32_t> const& taxon,
std::uint32_t const ledgerSequence, std::uint32_t const ledgerSequence,
std::uint32_t const limit, std::uint32_t const limit,
std::optional<ripple::uint256> const& cursorIn, std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield boost::asio::yield_context yield
) const override ) const override
{ {
@@ -130,7 +130,7 @@ public:
if (taxon.has_value()) { if (taxon.has_value()) {
auto r = schema_->selectNFTIDsByIssuerTaxon.bind(issuer); auto r = schema_->selectNFTIDsByIssuerTaxon.bind(issuer);
r.bindAt(1, *taxon); r.bindAt(1, *taxon);
r.bindAt(2, cursorIn.value_or(ripple::uint256(0))); r.bindAt(2, cursorIn.value_or(xrpl::uint256(0)));
r.bindAt(3, Limit{limit}); r.bindAt(3, Limit{limit});
return r; return r;
} }
@@ -139,8 +139,8 @@ public:
r.bindAt( r.bindAt(
1, 1,
std::make_tuple( std::make_tuple(
cursorIn.has_value() ? ripple::nft::toUInt32(ripple::nft::getTaxon(*cursorIn)) : 0, cursorIn.has_value() ? xrpl::nft::toUInt32(xrpl::nft::getTaxon(*cursorIn)) : 0,
cursorIn.value_or(ripple::uint256(0)) cursorIn.value_or(xrpl::uint256(0))
) )
); );
r.bindAt(2, Limit{limit}); r.bindAt(2, Limit{limit});
@@ -156,8 +156,8 @@ public:
return {}; return {};
} }
std::vector<ripple::uint256> nftIDs; std::vector<xrpl::uint256> nftIDs;
for (auto const [nftID] : extract<ripple::uint256>(idQueryResults)) for (auto const [nftID] : extract<xrpl::uint256>(idQueryResults))
nftIDs.push_back(nftID); nftIDs.push_back(nftID);
if (nftIDs.empty()) if (nftIDs.empty())
@@ -189,11 +189,11 @@ public:
auto const nftUris = executor_.readEach(yield, selectNFTURIStatements); auto const nftUris = executor_.readEach(yield, selectNFTURIStatements);
for (auto i = 0u; i < nftIDs.size(); i++) { for (auto i = 0u; i < nftIDs.size(); i++) {
if (auto const maybeRow = nftInfos[i].template get<uint32_t, ripple::AccountID, bool>(); if (auto const maybeRow = nftInfos[i].template get<uint32_t, xrpl::AccountID, bool>();
maybeRow.has_value()) { maybeRow.has_value()) {
auto [seq, owner, isBurned] = *maybeRow; auto [seq, owner, isBurned] = *maybeRow;
NFT nft(nftIDs[i], seq, owner, isBurned); NFT nft(nftIDs[i], seq, owner, isBurned);
if (auto const maybeUri = nftUris[i].template get<ripple::Blob>(); maybeUri.has_value()) if (auto const maybeUri = nftUris[i].template get<xrpl::Blob>(); maybeUri.has_value())
nft.uri = *maybeUri; nft.uri = *maybeUri;
ret.nfts.push_back(nft); ret.nfts.push_back(nft);
} }
@@ -201,7 +201,7 @@ public:
return ret; return ret;
} }
std::vector<ripple::uint256> std::vector<xrpl::uint256>
fetchAccountRoots( fetchAccountRoots(
std::uint32_t number, std::uint32_t number,
std::uint32_t pageSize, std::uint32_t pageSize,
@@ -209,8 +209,8 @@ public:
boost::asio::yield_context yield boost::asio::yield_context yield
) const override ) const override
{ {
std::vector<ripple::uint256> liveAccounts; std::vector<xrpl::uint256> liveAccounts;
std::optional<ripple::AccountID> lastItem; std::optional<xrpl::AccountID> lastItem;
while (liveAccounts.size() < number) { while (liveAccounts.size() < number) {
Statement const statement = lastItem ? schema_->selectAccountFromToken.bind(*lastItem, Limit{pageSize}) Statement const statement = lastItem ? schema_->selectAccountFromToken.bind(*lastItem, Limit{pageSize})
@@ -224,9 +224,9 @@ public:
break; break;
} }
// The results should not contain duplicates, we just filter out deleted accounts // The results should not contain duplicates, we just filter out deleted accounts
std::vector<ripple::uint256> fullAccounts; std::vector<xrpl::uint256> fullAccounts;
for (auto [account] : extract<ripple::AccountID>(results)) { for (auto [account] : extract<xrpl::AccountID>(results)) {
fullAccounts.push_back(ripple::keylet::account(account).key); fullAccounts.push_back(xrpl::keylet::account(account).key);
lastItem = account; lastItem = account;
} }
auto const objs = this->doFetchLedgerObjects(fullAccounts, seq, yield); auto const objs = this->doFetchLedgerObjects(fullAccounts, seq, yield);

View File

@@ -43,10 +43,10 @@
* @brief Struct used to keep track of what to write to account_transactions/account_tx tables. * @brief Struct used to keep track of what to write to account_transactions/account_tx tables.
*/ */
struct AccountTransactionsData { struct AccountTransactionsData {
boost::container::flat_set<ripple::AccountID> accounts; boost::container::flat_set<xrpl::AccountID> accounts;
std::uint32_t ledgerSequence{}; std::uint32_t ledgerSequence{};
std::uint32_t transactionIndex{}; std::uint32_t transactionIndex{};
ripple::uint256 txHash; xrpl::uint256 txHash;
/** /**
* @brief Construct a new AccountTransactionsData object * @brief Construct a new AccountTransactionsData object
@@ -54,7 +54,7 @@ struct AccountTransactionsData {
* @param meta The transaction metadata * @param meta The transaction metadata
* @param txHash The transaction hash * @param txHash The transaction hash
*/ */
AccountTransactionsData(ripple::TxMeta const& meta, ripple::uint256 const& txHash) AccountTransactionsData(xrpl::TxMeta const& meta, xrpl::uint256 const& txHash)
: accounts(meta.getAffectedAccounts()) : accounts(meta.getAffectedAccounts())
, ledgerSequence(meta.getLgrSeq()) , ledgerSequence(meta.getLgrSeq())
, transactionIndex(meta.getIndex()) , transactionIndex(meta.getIndex())
@@ -71,10 +71,10 @@ struct AccountTransactionsData {
* Gets written to nf_token_transactions table and the like. * Gets written to nf_token_transactions table and the like.
*/ */
struct NFTTransactionsData { struct NFTTransactionsData {
ripple::uint256 tokenID; xrpl::uint256 tokenID;
std::uint32_t ledgerSequence; std::uint32_t ledgerSequence;
std::uint32_t transactionIndex; std::uint32_t transactionIndex;
ripple::uint256 txHash; xrpl::uint256 txHash;
/** /**
* @brief Construct a new NFTTransactionsData object * @brief Construct a new NFTTransactionsData object
@@ -83,7 +83,7 @@ struct NFTTransactionsData {
* @param meta The transaction metadata * @param meta The transaction metadata
* @param txHash The transaction hash * @param txHash The transaction hash
*/ */
NFTTransactionsData(ripple::uint256 const& tokenID, ripple::TxMeta const& meta, ripple::uint256 const& txHash) NFTTransactionsData(xrpl::uint256 const& tokenID, xrpl::TxMeta const& meta, xrpl::uint256 const& txHash)
: tokenID(tokenID), ledgerSequence(meta.getLgrSeq()), transactionIndex(meta.getIndex()), txHash(txHash) : tokenID(tokenID), ledgerSequence(meta.getLgrSeq()), transactionIndex(meta.getIndex()), txHash(txHash)
{ {
} }
@@ -101,11 +101,11 @@ struct NFTTransactionsData {
* We only set the uri if this is a mint tx, or if we are loading initial state from NFTokenPage objects. * We only set the uri if this is a mint tx, or if we are loading initial state from NFTokenPage objects.
*/ */
struct NFTsData { struct NFTsData {
ripple::uint256 tokenID; xrpl::uint256 tokenID;
std::uint32_t ledgerSequence; std::uint32_t ledgerSequence;
std::optional<std::uint32_t> transactionIndex; std::optional<std::uint32_t> transactionIndex;
ripple::AccountID owner; xrpl::AccountID owner;
std::optional<ripple::Blob> uri; std::optional<xrpl::Blob> uri;
bool isBurned = false; bool isBurned = false;
bool onlyUriChanged = false; // Whether only the URI was changed bool onlyUriChanged = false; // Whether only the URI was changed
@@ -122,10 +122,10 @@ struct NFTsData {
* @param meta The transaction metadata * @param meta The transaction metadata
*/ */
NFTsData( NFTsData(
ripple::uint256 const& tokenID, xrpl::uint256 const& tokenID,
ripple::AccountID const& owner, xrpl::AccountID const& owner,
ripple::Blob const& uri, xrpl::Blob const& uri,
ripple::TxMeta const& meta xrpl::TxMeta const& meta
) )
: tokenID(tokenID), ledgerSequence(meta.getLgrSeq()), transactionIndex(meta.getIndex()), owner(owner), uri(uri) : tokenID(tokenID), ledgerSequence(meta.getLgrSeq()), transactionIndex(meta.getIndex()), owner(owner), uri(uri)
{ {
@@ -141,7 +141,7 @@ struct NFTsData {
* @param meta The transaction metadata * @param meta The transaction metadata
* @param isBurned Whether the NFT is burned * @param isBurned Whether the NFT is burned
*/ */
NFTsData(ripple::uint256 const& tokenID, ripple::AccountID const& owner, ripple::TxMeta const& meta, bool isBurned) NFTsData(xrpl::uint256 const& tokenID, xrpl::AccountID const& owner, xrpl::TxMeta const& meta, bool isBurned)
: tokenID(tokenID) : tokenID(tokenID)
, ledgerSequence(meta.getLgrSeq()) , ledgerSequence(meta.getLgrSeq())
, transactionIndex(meta.getIndex()) , transactionIndex(meta.getIndex())
@@ -163,10 +163,10 @@ struct NFTsData {
* @param uri The URI * @param uri The URI
*/ */
NFTsData( NFTsData(
ripple::uint256 const& tokenID, xrpl::uint256 const& tokenID,
std::uint32_t const ledgerSequence, std::uint32_t const ledgerSequence,
ripple::AccountID const& owner, xrpl::AccountID const& owner,
ripple::Blob const& uri xrpl::Blob const& uri
) )
: tokenID(tokenID), ledgerSequence(ledgerSequence), owner(owner), uri(uri) : tokenID(tokenID), ledgerSequence(ledgerSequence), owner(owner), uri(uri)
{ {
@@ -180,7 +180,7 @@ struct NFTsData {
* @param uri The new URI * @param uri The new URI
* *
*/ */
NFTsData(ripple::uint256 const& tokenID, ripple::TxMeta const& meta, ripple::Blob const& uri) NFTsData(xrpl::uint256 const& tokenID, xrpl::TxMeta const& meta, xrpl::Blob const& uri)
: tokenID(tokenID) : tokenID(tokenID)
, ledgerSequence(meta.getLgrSeq()) , ledgerSequence(meta.getLgrSeq())
, transactionIndex(meta.getIndex()) , transactionIndex(meta.getIndex())
@@ -194,8 +194,8 @@ struct NFTsData {
* @brief Represents an MPT and holder pair * @brief Represents an MPT and holder pair
*/ */
struct MPTHolderData { struct MPTHolderData {
ripple::uint192 mptID; xrpl::uint192 mptID;
ripple::AccountID holder; xrpl::AccountID holder;
}; };
/** /**
@@ -231,25 +231,25 @@ isBookDir(T const& key, R const& object)
if (!isDirNode(object)) if (!isDirNode(object))
return false; return false;
ripple::STLedgerEntry const sle{ripple::SerialIter{object.data(), object.size()}, key}; xrpl::STLedgerEntry const sle{xrpl::SerialIter{object.data(), object.size()}, key};
return !sle[~ripple::sfOwner].has_value(); return !sle[~xrpl::sfOwner].has_value();
} }
/** /**
* @brief Get the book base. * @brief Get the book base.
* *
* @param key The key to get the book base out of * @param key The key to get the book base out of
* @return Book base as ripple::uint256 * @return Book base as xrpl::uint256
*/ */
template <typename T> template <typename T>
inline ripple::uint256 inline xrpl::uint256
getBookBase(T const& key) getBookBase(T const& key)
{ {
static constexpr size_t kEY_SIZE = 24; static constexpr size_t kEY_SIZE = 24;
ASSERT(key.size() == ripple::uint256::size(), "Invalid key size {}", key.size()); ASSERT(key.size() == xrpl::uint256::size(), "Invalid key size {}", key.size());
ripple::uint256 ret; xrpl::uint256 ret;
for (size_t i = 0; i < kEY_SIZE; ++i) for (size_t i = 0; i < kEY_SIZE; ++i)
ret.data()[i] = key.data()[i]; ret.data()[i] = key.data()[i];
@@ -257,15 +257,15 @@ getBookBase(T const& key)
} }
/** /**
* @brief Stringify a ripple::uint256. * @brief Stringify a xrpl::uint256.
* *
* @param input The input value * @param input The input value
* @return The input value as a string * @return The input value as a string
*/ */
inline std::string inline std::string
uint256ToString(ripple::uint256 const& input) uint256ToString(xrpl::uint256 const& input)
{ {
return {reinterpret_cast<char const*>(input.data()), ripple::uint256::size()}; return {reinterpret_cast<char const*>(input.data()), xrpl::uint256::size()};
} }
/** @brief The ripple epoch start timestamp. Midnight on 1st January 2000. */ /** @brief The ripple epoch start timestamp. Midnight on 1st January 2000. */

View File

@@ -117,22 +117,22 @@ public:
NFTsAndCursor NFTsAndCursor
fetchNFTsByIssuer( fetchNFTsByIssuer(
ripple::AccountID const& issuer, xrpl::AccountID const& issuer,
std::optional<std::uint32_t> const& taxon, std::optional<std::uint32_t> const& taxon,
std::uint32_t const ledgerSequence, std::uint32_t const ledgerSequence,
std::uint32_t const limit, std::uint32_t const limit,
std::optional<ripple::uint256> const& cursorIn, std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield boost::asio::yield_context yield
) const override ) const override
{ {
std::vector<ripple::uint256> nftIDs; std::vector<xrpl::uint256> nftIDs;
if (taxon.has_value()) { if (taxon.has_value()) {
// Keyspace and ScyllaDB uses the same logic for taxon-filtered queries // Keyspace and ScyllaDB uses the same logic for taxon-filtered queries
nftIDs = fetchNFTIDsByTaxon(issuer, *taxon, limit, cursorIn, yield); nftIDs = fetchNFTIDsByTaxon(issuer, *taxon, limit, cursorIn, yield);
} else { } else {
// Amazon Keyspaces Workflow for non-taxon queries // Amazon Keyspaces Workflow for non-taxon queries
auto const startTaxon = cursorIn.has_value() ? ripple::nft::toUInt32(ripple::nft::getTaxon(*cursorIn)) : 0; auto const startTaxon = cursorIn.has_value() ? xrpl::nft::toUInt32(xrpl::nft::getTaxon(*cursorIn)) : 0;
auto const startTokenID = cursorIn.value_or(ripple::uint256(0)); auto const startTokenID = cursorIn.value_or(xrpl::uint256(0));
Statement const firstQuery = schema_->selectNFTIDsByIssuerTaxon.bind(issuer); Statement const firstQuery = schema_->selectNFTIDsByIssuerTaxon.bind(issuer);
firstQuery.bindAt(1, startTaxon); firstQuery.bindAt(1, startTaxon);
@@ -141,7 +141,7 @@ public:
auto const firstRes = executor_.read(yield, firstQuery); auto const firstRes = executor_.read(yield, firstQuery);
if (firstRes.has_value()) { if (firstRes.has_value()) {
for (auto const [nftID] : extract<ripple::uint256>(*firstRes)) for (auto const [nftID] : extract<xrpl::uint256>(*firstRes))
nftIDs.push_back(nftID); nftIDs.push_back(nftID);
} }
@@ -153,7 +153,7 @@ public:
auto const secondRes = executor_.read(yield, secondQuery); auto const secondRes = executor_.read(yield, secondQuery);
if (secondRes.has_value()) { if (secondRes.has_value()) {
for (auto const [nftID] : extract<ripple::uint256>(*secondRes)) for (auto const [nftID] : extract<xrpl::uint256>(*secondRes))
nftIDs.push_back(nftID); nftIDs.push_back(nftID);
} }
} }
@@ -172,9 +172,9 @@ public:
* @param pageSize The maximum number of accounts per page. * @param pageSize The maximum number of accounts per page.
* @param seq The accounts need to exist at this ledger sequence. * @param seq The accounts need to exist at this ledger sequence.
* @param yield The coroutine context. * @param yield The coroutine context.
* @return A vector of ripple::uint256 representing the account root hashes. * @return A vector of xrpl::uint256 representing the account root hashes.
*/ */
std::vector<ripple::uint256> std::vector<xrpl::uint256>
fetchAccountRoots( fetchAccountRoots(
[[maybe_unused]] std::uint32_t number, [[maybe_unused]] std::uint32_t number,
[[maybe_unused]] std::uint32_t pageSize, [[maybe_unused]] std::uint32_t pageSize,
@@ -187,41 +187,41 @@ public:
} }
private: private:
std::vector<ripple::uint256> std::vector<xrpl::uint256>
fetchNFTIDsByTaxon( fetchNFTIDsByTaxon(
ripple::AccountID const& issuer, xrpl::AccountID const& issuer,
std::uint32_t const taxon, std::uint32_t const taxon,
std::uint32_t const limit, std::uint32_t const limit,
std::optional<ripple::uint256> const& cursorIn, std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield boost::asio::yield_context yield
) const ) const
{ {
std::vector<ripple::uint256> nftIDs; std::vector<xrpl::uint256> nftIDs;
Statement const statement = schema_->selectNFTIDsByIssuerTaxon.bind(issuer); Statement const statement = schema_->selectNFTIDsByIssuerTaxon.bind(issuer);
statement.bindAt(1, taxon); statement.bindAt(1, taxon);
statement.bindAt(2, cursorIn.value_or(ripple::uint256(0))); statement.bindAt(2, cursorIn.value_or(xrpl::uint256(0)));
statement.bindAt(3, Limit{limit}); statement.bindAt(3, Limit{limit});
auto const res = executor_.read(yield, statement); auto const res = executor_.read(yield, statement);
if (res.has_value() && res->hasRows()) { if (res.has_value() && res->hasRows()) {
for (auto const [nftID] : extract<ripple::uint256>(*res)) for (auto const [nftID] : extract<xrpl::uint256>(*res))
nftIDs.push_back(nftID); nftIDs.push_back(nftID);
} }
return nftIDs; return nftIDs;
} }
std::vector<ripple::uint256> std::vector<xrpl::uint256>
fetchNFTIDsWithoutTaxon( fetchNFTIDsWithoutTaxon(
ripple::AccountID const& issuer, xrpl::AccountID const& issuer,
std::uint32_t const limit, std::uint32_t const limit,
std::optional<ripple::uint256> const& cursorIn, std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield boost::asio::yield_context yield
) const ) const
{ {
std::vector<ripple::uint256> nftIDs; std::vector<xrpl::uint256> nftIDs;
auto const startTaxon = cursorIn.has_value() ? ripple::nft::toUInt32(ripple::nft::getTaxon(*cursorIn)) : 0; auto const startTaxon = cursorIn.has_value() ? xrpl::nft::toUInt32(xrpl::nft::getTaxon(*cursorIn)) : 0;
auto const startTokenID = cursorIn.value_or(ripple::uint256(0)); auto const startTokenID = cursorIn.value_or(xrpl::uint256(0));
Statement firstQuery = schema_->selectNFTIDsByIssuerTaxon.bind(issuer); Statement firstQuery = schema_->selectNFTIDsByIssuerTaxon.bind(issuer);
firstQuery.bindAt(1, startTaxon); firstQuery.bindAt(1, startTaxon);
@@ -230,7 +230,7 @@ private:
auto const firstRes = executor_.read(yield, firstQuery); auto const firstRes = executor_.read(yield, firstQuery);
if (firstRes.has_value()) { if (firstRes.has_value()) {
for (auto const [nftID] : extract<ripple::uint256>(*firstRes)) for (auto const [nftID] : extract<xrpl::uint256>(*firstRes))
nftIDs.push_back(nftID); nftIDs.push_back(nftID);
} }
@@ -242,7 +242,7 @@ private:
auto const secondRes = executor_.read(yield, secondQuery); auto const secondRes = executor_.read(yield, secondQuery);
if (secondRes.has_value()) { if (secondRes.has_value()) {
for (auto const [nftID] : extract<ripple::uint256>(*secondRes)) for (auto const [nftID] : extract<xrpl::uint256>(*secondRes))
nftIDs.push_back(nftID); nftIDs.push_back(nftID);
} }
} }
@@ -254,7 +254,7 @@ private:
*/ */
NFTsAndCursor NFTsAndCursor
populateNFTsAndCreateCursor( populateNFTsAndCreateCursor(
std::vector<ripple::uint256> const& nftIDs, std::vector<xrpl::uint256> const& nftIDs,
std::uint32_t const ledgerSequence, std::uint32_t const ledgerSequence,
std::uint32_t const limit, std::uint32_t const limit,
boost::asio::yield_context yield boost::asio::yield_context yield
@@ -291,11 +291,11 @@ private:
// Combine the results into final NFT objects. // Combine the results into final NFT objects.
for (auto i = 0u; i < nftIDs.size(); ++i) { for (auto i = 0u; i < nftIDs.size(); ++i) {
if (auto const maybeRow = nftInfos[i].template get<uint32_t, ripple::AccountID, bool>(); if (auto const maybeRow = nftInfos[i].template get<uint32_t, xrpl::AccountID, bool>();
maybeRow.has_value()) { maybeRow.has_value()) {
auto [seq, owner, isBurned] = *maybeRow; auto [seq, owner, isBurned] = *maybeRow;
NFT nft(nftIDs[i], seq, owner, isBurned); NFT nft(nftIDs[i], seq, owner, isBurned);
if (auto const maybeUri = nftUris[i].template get<ripple::Blob>(); maybeUri.has_value()) if (auto const maybeUri = nftUris[i].template get<xrpl::Blob>(); maybeUri.has_value())
nft.uri = *maybeUri; nft.uri = *maybeUri;
ret.nfts.push_back(nft); ret.nfts.push_back(nft);
} }

View File

@@ -131,7 +131,7 @@ LedgerCache::update(std::vector<etl::model::Object> const& objs, uint32_t seq)
} }
std::optional<LedgerObject> std::optional<LedgerObject>
LedgerCache::getSuccessor(ripple::uint256 const& key, uint32_t seq) const LedgerCache::getSuccessor(xrpl::uint256 const& key, uint32_t seq) const
{ {
if (disabled_ or not full_) if (disabled_ or not full_)
return {}; return {};
@@ -148,7 +148,7 @@ LedgerCache::getSuccessor(ripple::uint256 const& key, uint32_t seq) const
} }
std::optional<LedgerObject> std::optional<LedgerObject>
LedgerCache::getPredecessor(ripple::uint256 const& key, uint32_t seq) const LedgerCache::getPredecessor(xrpl::uint256 const& key, uint32_t seq) const
{ {
if (disabled_ or not full_) if (disabled_ or not full_)
return {}; return {};
@@ -164,7 +164,7 @@ LedgerCache::getPredecessor(ripple::uint256 const& key, uint32_t seq) const
} }
std::optional<Blob> std::optional<Blob>
LedgerCache::get(ripple::uint256 const& key, uint32_t seq) const LedgerCache::get(xrpl::uint256 const& key, uint32_t seq) const
{ {
if (disabled_) if (disabled_)
return {}; return {};
@@ -183,7 +183,7 @@ LedgerCache::get(ripple::uint256 const& key, uint32_t seq) const
} }
std::optional<Blob> std::optional<Blob>
LedgerCache::getDeleted(ripple::uint256 const& key, uint32_t seq) const LedgerCache::getDeleted(xrpl::uint256 const& key, uint32_t seq) const
{ {
if (disabled_) if (disabled_)
return std::nullopt; return std::nullopt;

View File

@@ -54,7 +54,7 @@ public:
Blob blob; Blob blob;
}; };
using CacheMap = std::map<ripple::uint256, CacheEntry>; using CacheMap = std::map<xrpl::uint256, CacheEntry>;
private: private:
// counters for fetchLedgerObject(s) hit rate // counters for fetchLedgerObject(s) hit rate
@@ -97,7 +97,7 @@ private:
)}; )};
// temporary set to prevent background thread from writing already deleted data. not used when cache is full // temporary set to prevent background thread from writing already deleted data. not used when cache is full
std::unordered_set<ripple::uint256, ripple::hardened_hash<>> deletes_; std::unordered_set<xrpl::uint256, xrpl::HardenedHash<>> deletes_;
public: public:
void void
@@ -107,16 +107,16 @@ public:
update(std::vector<etl::model::Object> const& objs, uint32_t seq) override; update(std::vector<etl::model::Object> const& objs, uint32_t seq) override;
std::optional<Blob> std::optional<Blob>
get(ripple::uint256 const& key, uint32_t seq) const override; get(xrpl::uint256 const& key, uint32_t seq) const override;
std::optional<Blob> std::optional<Blob>
getDeleted(ripple::uint256 const& key, uint32_t seq) const override; getDeleted(xrpl::uint256 const& key, uint32_t seq) const override;
std::optional<LedgerObject> std::optional<LedgerObject>
getSuccessor(ripple::uint256 const& key, uint32_t seq) const override; getSuccessor(xrpl::uint256 const& key, uint32_t seq) const override;
std::optional<LedgerObject> std::optional<LedgerObject>
getPredecessor(ripple::uint256 const& key, uint32_t seq) const override; getPredecessor(xrpl::uint256 const& key, uint32_t seq) const override;
void void
setDisabled() override; setDisabled() override;

View File

@@ -75,7 +75,7 @@ public:
* @return If found in cache, will return the cached Blob; otherwise nullopt is returned * @return If found in cache, will return the cached Blob; otherwise nullopt is returned
*/ */
virtual std::optional<Blob> virtual std::optional<Blob>
get(ripple::uint256 const& key, uint32_t seq) const = 0; get(xrpl::uint256 const& key, uint32_t seq) const = 0;
/** /**
* @brief Fetch a recently deleted object by its key and sequence number. * @brief Fetch a recently deleted object by its key and sequence number.
@@ -85,7 +85,7 @@ public:
* @return If found in deleted cache, will return the cached Blob; otherwise nullopt is returned * @return If found in deleted cache, will return the cached Blob; otherwise nullopt is returned
*/ */
virtual std::optional<Blob> virtual std::optional<Blob>
getDeleted(ripple::uint256 const& key, uint32_t seq) const = 0; getDeleted(xrpl::uint256 const& key, uint32_t seq) const = 0;
/** /**
* @brief Gets a cached successor. * @brief Gets a cached successor.
@@ -97,7 +97,7 @@ public:
* @return If found in cache, will return the cached successor; otherwise nullopt is returned * @return If found in cache, will return the cached successor; otherwise nullopt is returned
*/ */
virtual std::optional<LedgerObject> virtual std::optional<LedgerObject>
getSuccessor(ripple::uint256 const& key, uint32_t seq) const = 0; getSuccessor(xrpl::uint256 const& key, uint32_t seq) const = 0;
/** /**
* @brief Gets a cached predcessor. * @brief Gets a cached predcessor.
@@ -109,7 +109,7 @@ public:
* @return If found in cache, will return the cached predcessor; otherwise nullopt is returned * @return If found in cache, will return the cached predcessor; otherwise nullopt is returned
*/ */
virtual std::optional<LedgerObject> virtual std::optional<LedgerObject>
getPredecessor(ripple::uint256 const& key, uint32_t seq) const = 0; getPredecessor(xrpl::uint256 const& key, uint32_t seq) const = 0;
/** /**
* @brief Disables the cache. * @brief Disables the cache.

View File

@@ -30,7 +30,7 @@
namespace data { namespace data {
/** /**
* @brief A simple cache holding one `ripple::LedgerHeader` to reduce DB lookups. * @brief A simple cache holding one `xrpl::LedgerHeader` to reduce DB lookups.
* *
* Used internally by backend implementations. When a ledger header is * Used internally by backend implementations. When a ledger header is
* fetched via `FetchLedgerBySeq` (often triggered by RPC commands), * fetched via `FetchLedgerBySeq` (often triggered by RPC commands),
@@ -46,7 +46,7 @@ public:
* @brief Struct to store ledger header cache entry and the sequence it belongs to * @brief Struct to store ledger header cache entry and the sequence it belongs to
*/ */
struct CacheEntry { struct CacheEntry {
ripple::LedgerHeader ledger; xrpl::LedgerHeader ledger;
uint32_t seq{}; uint32_t seq{};
/** /**

View File

@@ -39,7 +39,7 @@ using Blob = std::vector<unsigned char>;
* @brief Represents an object in the ledger. * @brief Represents an object in the ledger.
*/ */
struct LedgerObject { struct LedgerObject {
ripple::uint256 key; xrpl::uint256 key;
Blob blob; Blob blob;
bool bool
@@ -51,7 +51,7 @@ struct LedgerObject {
*/ */
struct LedgerPage { struct LedgerPage {
std::vector<LedgerObject> objects; std::vector<LedgerObject> objects;
std::optional<ripple::uint256> cursor; std::optional<xrpl::uint256> cursor;
}; };
/** /**
@@ -59,7 +59,7 @@ struct LedgerPage {
*/ */
struct BookOffersPage { struct BookOffersPage {
std::vector<LedgerObject> offers; std::vector<LedgerObject> offers;
std::optional<ripple::uint256> cursor; std::optional<xrpl::uint256> cursor;
}; };
/** /**
@@ -170,9 +170,9 @@ struct TransactionsAndCursor {
* @brief Represents a NFToken. * @brief Represents a NFToken.
*/ */
struct NFT { struct NFT {
ripple::uint256 tokenID; xrpl::uint256 tokenID;
std::uint32_t ledgerSequence{}; std::uint32_t ledgerSequence{};
ripple::AccountID owner; xrpl::AccountID owner;
Blob uri; Blob uri;
bool isBurned{}; bool isBurned{};
@@ -187,9 +187,9 @@ struct NFT {
* @param uri The URI * @param uri The URI
* @param isBurned Whether the token is burned * @param isBurned Whether the token is burned
*/ */
NFT(ripple::uint256 const& tokenID, NFT(xrpl::uint256 const& tokenID,
std::uint32_t ledgerSequence, std::uint32_t ledgerSequence,
ripple::AccountID const& owner, xrpl::AccountID const& owner,
Blob uri, Blob uri,
bool isBurned) bool isBurned)
: tokenID{tokenID}, ledgerSequence{ledgerSequence}, owner{owner}, uri{std::move(uri)}, isBurned{isBurned} : tokenID{tokenID}, ledgerSequence{ledgerSequence}, owner{owner}, uri{std::move(uri)}, isBurned{isBurned}
@@ -204,7 +204,7 @@ struct NFT {
* @param owner The owner * @param owner The owner
* @param isBurned Whether the token is burned * @param isBurned Whether the token is burned
*/ */
NFT(ripple::uint256 const& tokenID, std::uint32_t ledgerSequence, ripple::AccountID const& owner, bool isBurned) NFT(xrpl::uint256 const& tokenID, std::uint32_t ledgerSequence, xrpl::AccountID const& owner, bool isBurned)
: NFT(tokenID, ledgerSequence, owner, {}, isBurned) : NFT(tokenID, ledgerSequence, owner, {}, isBurned)
{ {
} }
@@ -230,7 +230,7 @@ struct NFT {
*/ */
struct NFTsAndCursor { struct NFTsAndCursor {
std::vector<NFT> nfts; std::vector<NFT> nfts;
std::optional<ripple::uint256> cursor; std::optional<xrpl::uint256> cursor;
}; };
/** /**
@@ -238,7 +238,7 @@ struct NFTsAndCursor {
*/ */
struct MPTHoldersAndCursor { struct MPTHoldersAndCursor {
std::vector<Blob> mptokens; std::vector<Blob> mptokens;
std::optional<ripple::AccountID> cursor; std::optional<xrpl::AccountID> cursor;
}; };
/** /**
@@ -257,7 +257,7 @@ struct LedgerRange {
*/ */
struct Amendment { struct Amendment {
std::string name; std::string name;
ripple::uint256 feature; xrpl::uint256 feature;
bool isSupportedByXRPL = false; bool isSupportedByXRPL = false;
bool isSupportedByClio = false; bool isSupportedByClio = false;
bool isRetired = false; bool isRetired = false;
@@ -268,7 +268,7 @@ struct Amendment {
* @param name The name of the amendment * @param name The name of the amendment
* @return The amendment Id as uint256 * @return The amendment Id as uint256
*/ */
static ripple::uint256 static xrpl::uint256
getAmendmentId(std::string_view const name); getAmendmentId(std::string_view const name);
/** /**
@@ -304,7 +304,7 @@ struct AmendmentKey {
operator std::string_view() const; operator std::string_view() const;
/** @brief Conversion to uint256 */ /** @brief Conversion to uint256 */
operator ripple::uint256() const; operator xrpl::uint256() const;
/** /**
* @brief Comparison operators * @brief Comparison operators
@@ -315,8 +315,8 @@ struct AmendmentKey {
operator<=>(AmendmentKey const& other) const = default; operator<=>(AmendmentKey const& other) const = default;
}; };
constexpr ripple::uint256 kFIRST_KEY{"0000000000000000000000000000000000000000000000000000000000000000"}; constexpr xrpl::uint256 kFIRST_KEY{"0000000000000000000000000000000000000000000000000000000000000000"};
constexpr ripple::uint256 kLAST_KEY{"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"}; constexpr xrpl::uint256 kLAST_KEY{"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"};
constexpr ripple::uint256 kHI192{"0000000000000000000000000000000000000000000000001111111111111111"}; constexpr xrpl::uint256 kHI192{"0000000000000000000000000000000000000000000000001111111111111111"};
} // namespace data } // namespace data

View File

@@ -148,7 +148,7 @@ public:
TransactionsAndCursor TransactionsAndCursor
fetchAccountTransactions( fetchAccountTransactions(
ripple::AccountID const& account, xrpl::AccountID const& account,
std::uint32_t const limit, std::uint32_t const limit,
bool forward, bool forward,
std::optional<TransactionsCursor> const& txnCursor, std::optional<TransactionsCursor> const& txnCursor,
@@ -169,14 +169,14 @@ public:
auto cursor = txnCursor; auto cursor = txnCursor;
if (cursor) { if (cursor) {
statement.bindAt(1, cursor->asTuple()); statement.bindAt(1, cursor->asTuple());
LOG(log_.debug()) << "account = " << ripple::strHex(account) << " tuple = " << cursor->ledgerSequence LOG(log_.debug()) << "account = " << xrpl::strHex(account) << " tuple = " << cursor->ledgerSequence
<< cursor->transactionIndex; << cursor->transactionIndex;
} else { } else {
auto const seq = forward ? rng->minSequence : rng->maxSequence; auto const seq = forward ? rng->minSequence : rng->maxSequence;
auto const placeHolder = forward ? 0u : std::numeric_limits<std::uint32_t>::max(); auto const placeHolder = forward ? 0u : std::numeric_limits<std::uint32_t>::max();
statement.bindAt(1, std::make_tuple(placeHolder, placeHolder)); statement.bindAt(1, std::make_tuple(placeHolder, placeHolder));
LOG(log_.debug()) << "account = " << ripple::strHex(account) << " idx = " << seq LOG(log_.debug()) << "account = " << xrpl::strHex(account) << " idx = " << seq
<< " tuple = " << placeHolder; << " tuple = " << placeHolder;
} }
@@ -191,11 +191,11 @@ public:
return {}; return {};
} }
std::vector<ripple::uint256> hashes = {}; std::vector<xrpl::uint256> hashes = {};
auto numRows = results.numRows(); auto numRows = results.numRows();
LOG(log_.info()) << "num_rows = " << numRows; LOG(log_.info()) << "num_rows = " << numRows;
for (auto [hash, data] : extract<ripple::uint256, std::tuple<uint32_t, uint32_t>>(results)) { for (auto [hash, data] : extract<xrpl::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
hashes.push_back(hash); hashes.push_back(hash);
if (--numRows == 0) { if (--numRows == 0) {
LOG(log_.debug()) << "Setting cursor"; LOG(log_.debug()) << "Setting cursor";
@@ -221,7 +221,7 @@ public:
} }
void void
writeLedger(ripple::LedgerHeader const& ledgerHeader, std::string&& blob) override writeLedger(xrpl::LedgerHeader const& ledgerHeader, std::string&& blob) override
{ {
executor_.write(schema_->insertLedgerHeader, ledgerHeader.seq, std::move(blob)); executor_.write(schema_->insertLedgerHeader, ledgerHeader.seq, std::move(blob));
@@ -250,7 +250,7 @@ public:
return std::nullopt; return std::nullopt;
} }
std::optional<ripple::LedgerHeader> std::optional<xrpl::LedgerHeader>
fetchLedgerBySequence(std::uint32_t const sequence, boost::asio::yield_context yield) const override fetchLedgerBySequence(std::uint32_t const sequence, boost::asio::yield_context yield) const override
{ {
if (auto const lock = ledgerCache_.get(); lock.has_value() && lock->seq == sequence) if (auto const lock = ledgerCache_.get(); lock.has_value() && lock->seq == sequence)
@@ -260,7 +260,7 @@ public:
if (res) { if (res) {
if (auto const& result = res.value(); result) { if (auto const& result = res.value(); result) {
if (auto const maybeValue = result.template get<std::vector<unsigned char>>(); maybeValue) { if (auto const maybeValue = result.template get<std::vector<unsigned char>>(); maybeValue) {
auto const header = util::deserializeHeader(ripple::makeSlice(*maybeValue)); auto const header = util::deserializeHeader(xrpl::makeSlice(*maybeValue));
ledgerCache_.put(FetchLedgerCache::CacheEntry{header, sequence}); ledgerCache_.put(FetchLedgerCache::CacheEntry{header, sequence});
return header; return header;
} }
@@ -277,8 +277,8 @@ public:
return std::nullopt; return std::nullopt;
} }
std::optional<ripple::LedgerHeader> std::optional<xrpl::LedgerHeader>
fetchLedgerByHash(ripple::uint256 const& hash, boost::asio::yield_context yield) const override fetchLedgerByHash(xrpl::uint256 const& hash, boost::asio::yield_context yield) const override
{ {
if (auto const res = executor_.read(yield, schema_->selectLedgerByHash, hash); res) { if (auto const res = executor_.read(yield, schema_->selectLedgerByHash, hash); res) {
if (auto const& result = res.value(); result) { if (auto const& result = res.value(); result) {
@@ -342,7 +342,7 @@ public:
return fetchTransactions(hashes, yield); return fetchTransactions(hashes, yield);
} }
std::vector<ripple::uint256> std::vector<xrpl::uint256>
fetchAllTransactionHashesInLedger( fetchAllTransactionHashesInLedger(
std::uint32_t const ledgerSequence, std::uint32_t const ledgerSequence,
boost::asio::yield_context yield boost::asio::yield_context yield
@@ -363,8 +363,8 @@ public:
return {}; return {};
} }
std::vector<ripple::uint256> hashes; std::vector<xrpl::uint256> hashes;
for (auto [hash] : extract<ripple::uint256>(result)) for (auto [hash] : extract<xrpl::uint256>(result))
hashes.push_back(std::move(hash)); hashes.push_back(std::move(hash));
auto end = std::chrono::system_clock::now(); auto end = std::chrono::system_clock::now();
@@ -377,7 +377,7 @@ public:
std::optional<NFT> std::optional<NFT>
fetchNFT( fetchNFT(
ripple::uint256 const& tokenID, xrpl::uint256 const& tokenID,
std::uint32_t const ledgerSequence, std::uint32_t const ledgerSequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const override ) const override
@@ -386,7 +386,7 @@ public:
if (not res) if (not res)
return std::nullopt; return std::nullopt;
if (auto const maybeRow = res->template get<uint32_t, ripple::AccountID, bool>(); maybeRow) { if (auto const maybeRow = res->template get<uint32_t, xrpl::AccountID, bool>(); maybeRow) {
auto [seq, owner, isBurned] = *maybeRow; auto [seq, owner, isBurned] = *maybeRow;
auto result = std::make_optional<NFT>(tokenID, seq, owner, isBurned); auto result = std::make_optional<NFT>(tokenID, seq, owner, isBurned);
@@ -403,7 +403,7 @@ public:
// one. // one.
auto uriRes = executor_.read(yield, schema_->selectNFTURI, tokenID, ledgerSequence); auto uriRes = executor_.read(yield, schema_->selectNFTURI, tokenID, ledgerSequence);
if (uriRes) { if (uriRes) {
if (auto const maybeUri = uriRes->template get<ripple::Blob>(); maybeUri) if (auto const maybeUri = uriRes->template get<xrpl::Blob>(); maybeUri)
result->uri = *maybeUri; result->uri = *maybeUri;
} }
@@ -416,7 +416,7 @@ public:
TransactionsAndCursor TransactionsAndCursor
fetchNFTTransactions( fetchNFTTransactions(
ripple::uint256 const& tokenID, xrpl::uint256 const& tokenID,
std::uint32_t const limit, std::uint32_t const limit,
bool const forward, bool const forward,
std::optional<TransactionsCursor> const& cursorIn, std::optional<TransactionsCursor> const& cursorIn,
@@ -437,14 +437,14 @@ public:
auto cursor = cursorIn; auto cursor = cursorIn;
if (cursor) { if (cursor) {
statement.bindAt(1, cursor->asTuple()); statement.bindAt(1, cursor->asTuple());
LOG(log_.debug()) << "token_id = " << ripple::strHex(tokenID) << " tuple = " << cursor->ledgerSequence LOG(log_.debug()) << "token_id = " << xrpl::strHex(tokenID) << " tuple = " << cursor->ledgerSequence
<< cursor->transactionIndex; << cursor->transactionIndex;
} else { } else {
auto const seq = forward ? rng->minSequence : rng->maxSequence; auto const seq = forward ? rng->minSequence : rng->maxSequence;
auto const placeHolder = forward ? 0 : std::numeric_limits<std::uint32_t>::max(); auto const placeHolder = forward ? 0 : std::numeric_limits<std::uint32_t>::max();
statement.bindAt(1, std::make_tuple(placeHolder, placeHolder)); statement.bindAt(1, std::make_tuple(placeHolder, placeHolder));
LOG(log_.debug()) << "token_id = " << ripple::strHex(tokenID) << " idx = " << seq LOG(log_.debug()) << "token_id = " << xrpl::strHex(tokenID) << " idx = " << seq
<< " tuple = " << placeHolder; << " tuple = " << placeHolder;
} }
@@ -457,11 +457,11 @@ public:
return {}; return {};
} }
std::vector<ripple::uint256> hashes = {}; std::vector<xrpl::uint256> hashes = {};
auto numRows = results.numRows(); auto numRows = results.numRows();
LOG(log_.info()) << "num_rows = " << numRows; LOG(log_.info()) << "num_rows = " << numRows;
for (auto [hash, data] : extract<ripple::uint256, std::tuple<uint32_t, uint32_t>>(results)) { for (auto [hash, data] : extract<xrpl::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
hashes.push_back(hash); hashes.push_back(hash);
if (--numRows == 0) { if (--numRows == 0) {
LOG(log_.debug()) << "Setting cursor"; LOG(log_.debug()) << "Setting cursor";
@@ -487,15 +487,15 @@ public:
MPTHoldersAndCursor MPTHoldersAndCursor
fetchMPTHolders( fetchMPTHolders(
ripple::uint192 const& mptID, xrpl::uint192 const& mptID,
std::uint32_t const limit, std::uint32_t const limit,
std::optional<ripple::AccountID> const& cursorIn, std::optional<xrpl::AccountID> const& cursorIn,
std::uint32_t const ledgerSequence, std::uint32_t const ledgerSequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const override ) const override
{ {
auto const holderEntries = executor_.read( auto const holderEntries = executor_.read(
yield, schema_->selectMPTHolders, mptID, cursorIn.value_or(ripple::AccountID(0)), Limit{limit} yield, schema_->selectMPTHolders, mptID, cursorIn.value_or(xrpl::AccountID(0)), Limit{limit}
); );
auto const& holderResults = holderEntries.value(); auto const& holderResults = holderEntries.value();
@@ -504,10 +504,10 @@ public:
return {}; return {};
} }
std::vector<ripple::uint256> mptKeys; std::vector<xrpl::uint256> mptKeys;
std::optional<ripple::AccountID> cursor; std::optional<xrpl::AccountID> cursor;
for (auto const [holder] : extract<ripple::AccountID>(holderResults)) { for (auto const [holder] : extract<xrpl::AccountID>(holderResults)) {
mptKeys.push_back(ripple::keylet::mptoken(mptID, holder).key); mptKeys.push_back(xrpl::keylet::mptoken(mptID, holder).key);
cursor = holder; cursor = holder;
} }
@@ -526,12 +526,12 @@ public:
std::optional<Blob> std::optional<Blob>
doFetchLedgerObject( doFetchLedgerObject(
ripple::uint256 const& key, xrpl::uint256 const& key,
std::uint32_t const sequence, std::uint32_t const sequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const override ) const override
{ {
LOG(log_.debug()) << "Fetching ledger object for seq " << sequence << ", key = " << ripple::to_string(key); LOG(log_.debug()) << "Fetching ledger object for seq " << sequence << ", key = " << xrpl::to_string(key);
if (auto const res = executor_.read(yield, schema_->selectObject, key, sequence); res) { if (auto const res = executor_.read(yield, schema_->selectObject, key, sequence); res) {
if (auto const result = res->template get<Blob>(); result) { if (auto const result = res->template get<Blob>(); result) {
if (result->size()) if (result->size())
@@ -548,12 +548,12 @@ public:
std::optional<std::uint32_t> std::optional<std::uint32_t>
doFetchLedgerObjectSeq( doFetchLedgerObjectSeq(
ripple::uint256 const& key, xrpl::uint256 const& key,
std::uint32_t const sequence, std::uint32_t const sequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const override ) const override
{ {
LOG(log_.debug()) << "Fetching ledger object for seq " << sequence << ", key = " << ripple::to_string(key); LOG(log_.debug()) << "Fetching ledger object for seq " << sequence << ", key = " << xrpl::to_string(key);
if (auto const res = executor_.read(yield, schema_->selectObject, key, sequence); res) { if (auto const res = executor_.read(yield, schema_->selectObject, key, sequence); res) {
if (auto const result = res->template get<Blob, std::uint32_t>(); result) { if (auto const result = res->template get<Blob, std::uint32_t>(); result) {
auto [_, seq] = result.value(); auto [_, seq] = result.value();
@@ -568,7 +568,7 @@ public:
} }
std::optional<TransactionAndMetadata> std::optional<TransactionAndMetadata>
fetchTransaction(ripple::uint256 const& hash, boost::asio::yield_context yield) const override fetchTransaction(xrpl::uint256 const& hash, boost::asio::yield_context yield) const override
{ {
if (auto const res = executor_.read(yield, schema_->selectTransaction, hash); res) { if (auto const res = executor_.read(yield, schema_->selectTransaction, hash); res) {
if (auto const maybeValue = res->template get<Blob, Blob, uint32_t, uint32_t>(); maybeValue) { if (auto const maybeValue = res->template get<Blob, Blob, uint32_t, uint32_t>(); maybeValue) {
@@ -584,15 +584,15 @@ public:
return std::nullopt; return std::nullopt;
} }
std::optional<ripple::uint256> std::optional<xrpl::uint256>
doFetchSuccessorKey( doFetchSuccessorKey(
ripple::uint256 key, xrpl::uint256 key,
std::uint32_t const ledgerSequence, std::uint32_t const ledgerSequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const override ) const override
{ {
if (auto const res = executor_.read(yield, schema_->selectSuccessor, key, ledgerSequence); res) { if (auto const res = executor_.read(yield, schema_->selectSuccessor, key, ledgerSequence); res) {
if (auto const result = res->template get<ripple::uint256>(); result) { if (auto const result = res->template get<xrpl::uint256>(); result) {
if (*result == kLAST_KEY) if (*result == kLAST_KEY)
return std::nullopt; return std::nullopt;
return result; return result;
@@ -607,7 +607,7 @@ public:
} }
std::vector<TransactionAndMetadata> std::vector<TransactionAndMetadata>
fetchTransactions(std::vector<ripple::uint256> const& hashes, boost::asio::yield_context yield) const override fetchTransactions(std::vector<xrpl::uint256> const& hashes, boost::asio::yield_context yield) const override
{ {
if (hashes.empty()) if (hashes.empty())
return {}; return {};
@@ -649,7 +649,7 @@ public:
std::vector<Blob> std::vector<Blob>
doFetchLedgerObjects( doFetchLedgerObjects(
std::vector<ripple::uint256> const& keys, std::vector<xrpl::uint256> const& keys,
std::uint32_t const sequence, std::uint32_t const sequence,
boost::asio::yield_context yield boost::asio::yield_context yield
) const override ) const override
@@ -690,7 +690,7 @@ public:
std::vector<LedgerObject> std::vector<LedgerObject>
fetchLedgerDiff(std::uint32_t const ledgerSequence, boost::asio::yield_context yield) const override fetchLedgerDiff(std::uint32_t const ledgerSequence, boost::asio::yield_context yield) const override
{ {
auto const [keys, timeDiff] = util::timed([this, &ledgerSequence, yield]() -> std::vector<ripple::uint256> { auto const [keys, timeDiff] = util::timed([this, &ledgerSequence, yield]() -> std::vector<xrpl::uint256> {
auto const res = executor_.read(yield, schema_->selectDiff, ledgerSequence); auto const res = executor_.read(yield, schema_->selectDiff, ledgerSequence);
if (not res) { if (not res) {
LOG(log_.error()) << "Could not fetch ledger diff: " << res.error() << "; ledger = " << ledgerSequence; LOG(log_.error()) << "Could not fetch ledger diff: " << res.error() << "; ledger = " << ledgerSequence;
@@ -703,8 +703,8 @@ public:
return {}; return {};
} }
std::vector<ripple::uint256> resultKeys; std::vector<xrpl::uint256> resultKeys;
for (auto [key] : extract<ripple::uint256>(results)) for (auto [key] : extract<xrpl::uint256>(results))
resultKeys.push_back(key); resultKeys.push_back(key);
return resultKeys; return resultKeys;
@@ -877,8 +877,8 @@ public:
// to record the URI and link to the issuer_nf_tokens table. // to record the URI and link to the issuer_nf_tokens table.
if (record.uri) { if (record.uri) {
statements.push_back(schema_->insertIssuerNFT.bind( statements.push_back(schema_->insertIssuerNFT.bind(
ripple::nft::getIssuer(record.tokenID), xrpl::nft::getIssuer(record.tokenID),
static_cast<uint32_t>(ripple::nft::getTaxon(record.tokenID)), static_cast<uint32_t>(xrpl::nft::getTaxon(record.tokenID)),
record.tokenID record.tokenID
)); ));
statements.push_back( statements.push_back(

View File

@@ -77,14 +77,14 @@ public:
} }
void void
append(ripple::uint256 const& value) const append(xrpl::uint256 const& value) const
{ {
auto const rc = cass_collection_append_bytes( auto const rc = cass_collection_append_bytes(
*this, *this,
static_cast<cass_byte_t const*>(static_cast<unsigned char const*>(value.data())), static_cast<cass_byte_t const*>(static_cast<unsigned char const*>(value.data())),
ripple::uint256::size() xrpl::uint256::size()
); );
throwErrorIfNeeded(rc, "Bind ripple::uint256"); throwErrorIfNeeded(rc, "Bind xrpl::uint256");
} }
}; };
} // namespace data::cassandra::impl } // namespace data::cassandra::impl

View File

@@ -62,18 +62,18 @@ extractColumn(CassRow const* row, std::size_t idx)
using UintTupleType = std::tuple<uint32_t, uint32_t>; using UintTupleType = std::tuple<uint32_t, uint32_t>;
using UCharVectorType = std::vector<unsigned char>; using UCharVectorType = std::vector<unsigned char>;
if constexpr (std::is_same_v<DecayedType, ripple::uint256>) { if constexpr (std::is_same_v<DecayedType, xrpl::uint256>) {
cass_byte_t const* buf = nullptr; cass_byte_t const* buf = nullptr;
std::size_t bufSize = 0; std::size_t bufSize = 0;
auto const rc = cass_value_get_bytes(cass_row_get_column(row, idx), &buf, &bufSize); auto const rc = cass_value_get_bytes(cass_row_get_column(row, idx), &buf, &bufSize);
throwErrorIfNeeded(rc, "Extract ripple::uint256"); throwErrorIfNeeded(rc, "Extract xrpl::uint256");
output = ripple::uint256::fromVoid(buf); output = xrpl::uint256::fromVoid(buf);
} else if constexpr (std::is_same_v<DecayedType, ripple::AccountID>) { } else if constexpr (std::is_same_v<DecayedType, xrpl::AccountID>) {
cass_byte_t const* buf = nullptr; cass_byte_t const* buf = nullptr;
std::size_t bufSize = 0; std::size_t bufSize = 0;
auto const rc = cass_value_get_bytes(cass_row_get_column(row, idx), &buf, &bufSize); auto const rc = cass_value_get_bytes(cass_row_get_column(row, idx), &buf, &bufSize);
throwErrorIfNeeded(rc, "Extract ripple::AccountID"); throwErrorIfNeeded(rc, "Extract xrpl::AccountID");
output = ripple::AccountID::fromVoid(buf); output = xrpl::AccountID::fromVoid(buf);
} else if constexpr (std::is_same_v<DecayedType, UCharVectorType>) { } else if constexpr (std::is_same_v<DecayedType, UCharVectorType>) {
cass_byte_t const* buf = nullptr; cass_byte_t const* buf = nullptr;
std::size_t bufSize = 0; std::size_t bufSize = 0;

View File

@@ -107,15 +107,15 @@ public:
using DecayedType = std::decay_t<Type>; using DecayedType = std::decay_t<Type>;
using UCharVectorType = std::vector<unsigned char>; using UCharVectorType = std::vector<unsigned char>;
using UintTupleType = std::tuple<uint32_t, uint32_t>; using UintTupleType = std::tuple<uint32_t, uint32_t>;
using UintByteTupleType = std::tuple<uint32_t, ripple::uint256>; using UintByteTupleType = std::tuple<uint32_t, xrpl::uint256>;
using ByteVectorType = std::vector<ripple::uint256>; using ByteVectorType = std::vector<xrpl::uint256>;
if constexpr (std::is_same_v<DecayedType, ripple::uint256> || std::is_same_v<DecayedType, ripple::uint192>) { if constexpr (std::is_same_v<DecayedType, xrpl::uint256> || std::is_same_v<DecayedType, xrpl::uint192>) {
auto const rc = bindBytes(value.data(), value.size()); auto const rc = bindBytes(value.data(), value.size());
throwErrorIfNeeded(rc, "Bind ripple::base_uint"); throwErrorIfNeeded(rc, "Bind xrpl::BaseUInt");
} else if constexpr (std::is_same_v<DecayedType, ripple::AccountID>) { } else if constexpr (std::is_same_v<DecayedType, xrpl::AccountID>) {
auto const rc = bindBytes(value.data(), value.size()); auto const rc = bindBytes(value.data(), value.size());
throwErrorIfNeeded(rc, "Bind ripple::AccountID"); throwErrorIfNeeded(rc, "Bind xrpl::AccountID");
} else if constexpr (std::is_same_v<DecayedType, UCharVectorType>) { } else if constexpr (std::is_same_v<DecayedType, UCharVectorType>) {
auto const rc = bindBytes(value.data(), value.size()); auto const rc = bindBytes(value.data(), value.size());
throwErrorIfNeeded(rc, "Bind vector<unsigned char>"); throwErrorIfNeeded(rc, "Bind vector<unsigned char>");
@@ -129,7 +129,7 @@ public:
} else if constexpr (std::is_same_v<DecayedType, UintTupleType> || } else if constexpr (std::is_same_v<DecayedType, UintTupleType> ||
std::is_same_v<DecayedType, UintByteTupleType>) { std::is_same_v<DecayedType, UintByteTupleType>) {
auto const rc = cass_statement_bind_tuple(*this, idx, Tuple{std::forward<Type>(value)}); auto const rc = cass_statement_bind_tuple(*this, idx, Tuple{std::forward<Type>(value)});
throwErrorIfNeeded(rc, "Bind tuple<uint32, uint32> or <uint32_t, ripple::uint256>"); throwErrorIfNeeded(rc, "Bind tuple<uint32, uint32> or <uint32_t, xrpl::uint256>");
} else if constexpr (std::is_same_v<DecayedType, ByteVectorType>) { } else if constexpr (std::is_same_v<DecayedType, ByteVectorType>) {
auto const rc = cass_statement_bind_collection(*this, idx, Collection{std::forward<Type>(value)}); auto const rc = cass_statement_bind_collection(*this, idx, Collection{std::forward<Type>(value)});
throwErrorIfNeeded(rc, "Bind collection"); throwErrorIfNeeded(rc, "Bind collection");

View File

@@ -79,14 +79,14 @@ public:
else if constexpr (std::is_convertible_v<DecayedType, int64_t>) { else if constexpr (std::is_convertible_v<DecayedType, int64_t>) {
auto const rc = cass_tuple_set_int64(*this, idx, std::forward<Type>(value)); auto const rc = cass_tuple_set_int64(*this, idx, std::forward<Type>(value));
throwErrorIfNeeded(rc, "Bind int64"); throwErrorIfNeeded(rc, "Bind int64");
} else if constexpr (std::is_same_v<DecayedType, ripple::uint256>) { } else if constexpr (std::is_same_v<DecayedType, xrpl::uint256>) {
auto const rc = cass_tuple_set_bytes( auto const rc = cass_tuple_set_bytes(
*this, *this,
idx, idx,
static_cast<cass_byte_t const*>(static_cast<unsigned char const*>(value.data())), static_cast<cass_byte_t const*>(static_cast<unsigned char const*>(value.data())),
value.size() value.size()
); );
throwErrorIfNeeded(rc, "Bind ripple::uint256"); throwErrorIfNeeded(rc, "Bind xrpl::uint256");
} else { } else {
// type not supported for binding // type not supported for binding
static_assert(util::Unsupported<DecayedType>); static_assert(util::Unsupported<DecayedType>);

View File

@@ -48,7 +48,7 @@ InputFile::readRaw(char* data, size_t size)
return not file_.fail(); return not file_.fail();
} }
ripple::uint256 xrpl::uint256
InputFile::hash() const InputFile::hash() const
{ {
auto sum = shasum_; auto sum = shasum_;

View File

@@ -51,7 +51,7 @@ public:
bool bool
readRaw(char* data, size_t size); readRaw(char* data, size_t size);
ripple::uint256 xrpl::uint256
hash() const; hash() const;
}; };
} // namespace data::impl } // namespace data::impl

View File

@@ -36,17 +36,17 @@
namespace data::impl { namespace data::impl {
using Hash = ripple::uint256; using Hash = xrpl::uint256;
using Separator = std::array<char, 16>; using Separator = std::array<char, 16>;
static constexpr Separator kSEPARATOR = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static constexpr Separator kSEPARATOR = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
namespace { namespace {
std::expected<std::pair<ripple::uint256, LedgerCache::CacheEntry>, std::string> std::expected<std::pair<xrpl::uint256, LedgerCache::CacheEntry>, std::string>
readCacheEntry(InputFile& file, size_t i) readCacheEntry(InputFile& file, size_t i)
{ {
ripple::uint256 key; xrpl::uint256 key;
if (not file.readRaw(reinterpret_cast<char*>(key.data()), ripple::base_uint<256>::bytes)) { if (not file.readRaw(reinterpret_cast<char*>(key.data()), xrpl::BaseUInt<256>::kBytes)) {
return std::unexpected(fmt::format("Failed to read key at index {}", i)); return std::unexpected(fmt::format("Failed to read key at index {}", i));
} }
@@ -98,7 +98,7 @@ LedgerCacheFile::write(DataView dataView)
file.write(kSEPARATOR); file.write(kSEPARATOR);
for (auto const& [k, v] : dataView.map) { for (auto const& [k, v] : dataView.map) {
file.write(k.data(), decltype(k)::bytes); file.write(k.data(), decltype(k)::kBytes);
file.write(v.seq); file.write(v.seq);
file.write(v.blob.size()); file.write(v.blob.size());
file.writeRaw(reinterpret_cast<char const*>(v.blob.data()), v.blob.size()); file.writeRaw(reinterpret_cast<char const*>(v.blob.data()), v.blob.size());
@@ -106,14 +106,14 @@ LedgerCacheFile::write(DataView dataView)
file.write(kSEPARATOR); file.write(kSEPARATOR);
for (auto const& [k, v] : dataView.deleted) { for (auto const& [k, v] : dataView.deleted) {
file.write(k.data(), decltype(k)::bytes); file.write(k.data(), decltype(k)::kBytes);
file.write(v.seq); file.write(v.seq);
file.write(v.blob.size()); file.write(v.blob.size());
file.writeRaw(reinterpret_cast<char const*>(v.blob.data()), v.blob.size()); file.writeRaw(reinterpret_cast<char const*>(v.blob.data()), v.blob.size());
} }
file.write(kSEPARATOR); file.write(kSEPARATOR);
auto const hash = file.hash(); auto const hash = file.hash();
file.write(hash.data(), decltype(hash)::bytes); file.write(hash.data(), decltype(hash)::kBytes);
try { try {
std::filesystem::rename(newFilePath, path_); std::filesystem::rename(newFilePath, path_);
@@ -190,8 +190,8 @@ LedgerCacheFile::read(uint32_t minLatestSequence)
} }
auto const dataHash = file.hash(); auto const dataHash = file.hash();
ripple::uint256 hashFromFile{}; xrpl::uint256 hashFromFile{};
if (not file.readRaw(reinterpret_cast<char*>(hashFromFile.data()), decltype(hashFromFile)::bytes)) { if (not file.readRaw(reinterpret_cast<char*>(hashFromFile.data()), decltype(hashFromFile)::kBytes)) {
return std::unexpected{"Error reading hash"}; return std::unexpected{"Error reading hash"};
} }

View File

@@ -52,7 +52,7 @@ OutputFile::writeToFile(char const* data, size_t size)
shasum_.update(data, size); shasum_.update(data, size);
} }
ripple::uint256 xrpl::uint256
OutputFile::hash() const OutputFile::hash() const
{ {
auto sum = shasum_; auto sum = shasum_;

View File

@@ -57,7 +57,7 @@ public:
void void
writeRaw(char const* data, size_t size); writeRaw(char const* data, size_t size);
ripple::uint256 xrpl::uint256
hash() const; hash() const;
private: private:

View File

@@ -27,16 +27,16 @@
#include <vector> #include <vector>
namespace etl { namespace etl {
std::vector<ripple::uint256> std::vector<xrpl::uint256>
getMarkers(size_t numMarkers) getMarkers(size_t numMarkers)
{ {
ASSERT(numMarkers <= 256, "Number of markers must be <= 256. Got: {}", numMarkers); ASSERT(numMarkers <= 256, "Number of markers must be <= 256. Got: {}", numMarkers);
unsigned char const incr = 256 / numMarkers; unsigned char const incr = 256 / numMarkers;
std::vector<ripple::uint256> markers; std::vector<xrpl::uint256> markers;
markers.reserve(numMarkers); markers.reserve(numMarkers);
ripple::uint256 base{0}; xrpl::uint256 base{0};
for (size_t i = 0; i < numMarkers; ++i) { for (size_t i = 0; i < numMarkers; ++i) {
markers.push_back(base); markers.push_back(base);
base.data()[0] += incr; base.data()[0] += incr;

View File

@@ -148,7 +148,7 @@ public:
* @param numMarkers Total markers to partition for * @param numMarkers Total markers to partition for
* @return The markers * @return The markers
*/ */
std::vector<ripple::uint256> std::vector<xrpl::uint256>
getMarkers(size_t numMarkers); getMarkers(size_t numMarkers);
} // namespace etl } // namespace etl

View File

@@ -303,7 +303,7 @@ ETLService::loadInitialLedgerIfNeeded()
auto [ledger, timeDiff] = ::util::timed<std::chrono::duration<double>>([this, seq]() { auto [ledger, timeDiff] = ::util::timed<std::chrono::duration<double>>([this, seq]() {
return extractor_->extractLedgerOnly(seq).and_then( return extractor_->extractLedgerOnly(seq).and_then(
[this, seq](auto&& data) -> std::optional<ripple::LedgerHeader> { [this, seq](auto&& data) -> std::optional<xrpl::LedgerHeader> {
// TODO: loadInitialLedger in balancer should be called fetchEdgeKeys or similar // TODO: loadInitialLedger in balancer should be called fetchEdgeKeys or similar
auto res = balancer_->loadInitialLedger(seq, *initialLoadObserver_); auto res = balancer_->loadInitialLedger(seq, *initialLoadObserver_);
if (not res.has_value() and res.error() == InitialLedgerLoadError::Cancelled) { if (not res.has_value() and res.error() == InitialLedgerLoadError::Cancelled) {

View File

@@ -55,7 +55,7 @@ struct LoaderInterface {
* @param data The data to load * @param data The data to load
* @return Optional ledger header * @return Optional ledger header
*/ */
[[nodiscard]] virtual std::optional<ripple::LedgerHeader> [[nodiscard]] virtual std::optional<xrpl::LedgerHeader>
loadInitialLedger(model::LedgerData const& data) = 0; loadInitialLedger(model::LedgerData const& data) = 0;
}; };

View File

@@ -20,17 +20,17 @@
#include "data/DBHelpers.hpp" #include "data/DBHelpers.hpp"
#include "util/Assert.hpp" #include "util/Assert.hpp"
#include <ripple/protocol/STBase.h>
#include <ripple/protocol/STTx.h>
#include <ripple/protocol/TxMeta.h>
#include <xrpl/basics/base_uint.h> #include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/LedgerFormats.h> #include <xrpl/protocol/LedgerFormats.h>
#include <xrpl/protocol/SField.h> #include <xrpl/protocol/SField.h>
#include <xrpl/protocol/STBase.h>
#include <xrpl/protocol/STLedgerEntry.h> #include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/STObject.h> #include <xrpl/protocol/STObject.h>
#include <xrpl/protocol/STTx.h>
#include <xrpl/protocol/Serializer.h> #include <xrpl/protocol/Serializer.h>
#include <xrpl/protocol/TER.h> #include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFormats.h> #include <xrpl/protocol/TxFormats.h>
#include <xrpl/protocol/TxMeta.h>
#include <optional> #include <optional>
#include <string> #include <string>
@@ -44,16 +44,16 @@ namespace etl {
* @return MPT and holder account pair * @return MPT and holder account pair
*/ */
std::optional<MPTHolderData> std::optional<MPTHolderData>
getMPTokenAuthorize(ripple::TxMeta const& txMeta) getMPTokenAuthorize(xrpl::TxMeta const& txMeta)
{ {
for (ripple::STObject const& node : txMeta.getNodes()) { for (xrpl::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltMPTOKEN) if (node.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltMPTOKEN)
continue; continue;
if (node.getFName() == ripple::sfCreatedNode) { if (node.getFName() == xrpl::sfCreatedNode) {
auto const& newMPT = node.peekAtField(ripple::sfNewFields).downcast<ripple::STObject>(); auto const& newMPT = node.peekAtField(xrpl::sfNewFields).downcast<xrpl::STObject>();
return MPTHolderData{ return MPTHolderData{
.mptID = newMPT[ripple::sfMPTokenIssuanceID], .holder = newMPT.getAccountID(ripple::sfAccount) .mptID = newMPT[xrpl::sfMPTokenIssuanceID], .holder = newMPT.getAccountID(xrpl::sfAccount)
}; };
} }
} }
@@ -61,9 +61,9 @@ getMPTokenAuthorize(ripple::TxMeta const& txMeta)
} }
std::optional<MPTHolderData> std::optional<MPTHolderData>
getMPTHolderFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getMPTHolderFromTx(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{ {
if (txMeta.getResultTER() != ripple::tesSUCCESS || sttx.getTxnType() != ripple::TxType::ttMPTOKEN_AUTHORIZE) if (txMeta.getResultTER() != xrpl::tesSUCCESS || sttx.getTxnType() != xrpl::TxType::ttMPTOKEN_AUTHORIZE)
return {}; return {};
return getMPTokenAuthorize(txMeta); return getMPTokenAuthorize(txMeta);
@@ -73,16 +73,16 @@ std::optional<MPTHolderData>
getMPTHolderFromObj(std::string const& key, std::string const& blob) getMPTHolderFromObj(std::string const& key, std::string const& blob)
{ {
// https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0033-multi-purpose-tokens#2121-mptoken-ledger-identifier // https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0033-multi-purpose-tokens#2121-mptoken-ledger-identifier
ASSERT(key.size() == ripple::uint256::size(), "The size of the key is expected to fit uint256 exactly"); ASSERT(key.size() == xrpl::uint256::size(), "The size of the key is expected to fit uint256 exactly");
ripple::STLedgerEntry const sle = xrpl::STLedgerEntry const sle =
ripple::STLedgerEntry(ripple::SerialIter{blob.data(), blob.size()}, ripple::uint256::fromVoid(key.data())); xrpl::STLedgerEntry(xrpl::SerialIter{blob.data(), blob.size()}, xrpl::uint256::fromVoid(key.data()));
if (sle.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltMPTOKEN) if (sle.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltMPTOKEN)
return {}; return {};
auto const mptIssuanceID = sle[ripple::sfMPTokenIssuanceID]; auto const mptIssuanceID = sle[xrpl::sfMPTokenIssuanceID];
auto const holder = sle.getAccountID(ripple::sfAccount); auto const holder = sle.getAccountID(xrpl::sfAccount);
return MPTHolderData{.mptID = mptIssuanceID, .holder = holder}; return MPTHolderData{.mptID = mptIssuanceID, .holder = holder};
} }

View File

@@ -22,8 +22,8 @@
#include "data/DBHelpers.hpp" #include "data/DBHelpers.hpp"
#include <ripple/protocol/STTx.h> #include <xrpl/protocol/STTx.h>
#include <ripple/protocol/TxMeta.h> #include <xrpl/protocol/TxMeta.h>
namespace etl { namespace etl {
@@ -35,7 +35,7 @@ namespace etl {
* @return The MPTIssuanceID and holder pair as a optional * @return The MPTIssuanceID and holder pair as a optional
*/ */
std::optional<MPTHolderData> std::optional<MPTHolderData>
getMPTHolderFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx); getMPTHolderFromTx(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/** /**
* @brief Pull MPT data from ledger object via loadInitialLedger. * @brief Pull MPT data from ledger object via loadInitialLedger.

View File

@@ -47,7 +47,7 @@ namespace etl::model {
* the Registry for its `onTransaction` and `onInitialTransaction` hooks. * the Registry for its `onTransaction` and `onInitialTransaction` hooks.
* It's a compilation error to list the same transaction type more than once. * It's a compilation error to list the same transaction type more than once.
*/ */
template <ripple::TxType... Types> template <xrpl::TxType... Types>
requires(util::hasNoDuplicates(Types...)) requires(util::hasNoDuplicates(Types...))
struct Spec { struct Spec {
static constexpr bool kSPEC_TAG = true; static constexpr bool kSPEC_TAG = true;
@@ -59,7 +59,7 @@ struct Spec {
* @return true if the transaction was requested; false otherwise * @return true if the transaction was requested; false otherwise
*/ */
[[nodiscard]] static constexpr bool [[nodiscard]] static constexpr bool
wants(ripple::TxType type) noexcept wants(xrpl::TxType type) noexcept
{ {
return ((Types == type) || ...); return ((Types == type) || ...);
} }
@@ -73,13 +73,13 @@ struct Transaction {
std::string metaRaw; std::string metaRaw;
// unpacked blob and meta // unpacked blob and meta
ripple::STTx sttx; xrpl::STTx sttx;
ripple::TxMeta meta; xrpl::TxMeta meta;
// commonly used stuff // commonly used stuff
ripple::uint256 id; xrpl::uint256 id;
std::string key; // key is the above id as a string of 32 characters std::string key; // key is the above id as a string of 32 characters
ripple::TxType type; xrpl::TxType type;
/** /**
* @brief Compares Transaction objects to each other without considering sttx and meta fields * @brief Compares Transaction objects to each other without considering sttx and meta fields
@@ -113,9 +113,9 @@ struct Object {
Deleted = 3, Deleted = 3,
}; };
ripple::uint256 key; xrpl::uint256 key;
std::string keyRaw; std::string keyRaw;
ripple::Blob data; xrpl::Blob data;
std::string dataRaw; std::string dataRaw;
std::string successor; std::string successor;
std::string predecessor; std::string predecessor;
@@ -146,7 +146,7 @@ struct LedgerData {
std::optional<std::vector<BookSuccessor>> successors; std::optional<std::vector<BookSuccessor>> successors;
std::optional<std::vector<std::string>> edgeKeys; std::optional<std::vector<std::string>> edgeKeys;
ripple::LedgerHeader header; xrpl::LedgerHeader header;
std::string rawHeader; std::string rawHeader;
uint32_t seq; uint32_t seq;
@@ -159,8 +159,8 @@ struct LedgerData {
operator==(LedgerData const& other) const operator==(LedgerData const& other) const
{ {
auto const serialized = [](auto const& hdr) { auto const serialized = [](auto const& hdr) {
ripple::Serializer ser; xrpl::Serializer ser;
ripple::addRaw(hdr, ser); xrpl::addRaw(hdr, ser);
return ser.getString(); return ser.getString();
}; };

View File

@@ -49,47 +49,47 @@
namespace etl { namespace etl {
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNftokenModifyData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getNftokenModifyData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{ {
auto const tokenID = sttx.getFieldH256(ripple::sfNFTokenID); auto const tokenID = sttx.getFieldH256(xrpl::sfNFTokenID);
// note: sfURI is optional, if it is absent, we will update the uri as empty string // note: sfURI is optional, if it is absent, we will update the uri as empty string
return { return {
{NFTTransactionsData(sttx.getFieldH256(ripple::sfNFTokenID), txMeta, sttx.getTransactionID())}, {NFTTransactionsData(sttx.getFieldH256(xrpl::sfNFTokenID), txMeta, sttx.getTransactionID())},
NFTsData(tokenID, txMeta, sttx.getFieldVL(ripple::sfURI)) NFTsData(tokenID, txMeta, sttx.getFieldVL(xrpl::sfURI))
}; };
} }
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getNFTokenMintData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{ {
// To find the minted token ID, we put all tokenIDs referenced in the // To find the minted token ID, we put all tokenIDs referenced in the
// metadata from prior to the tx application into one vector, then all // metadata from prior to the tx application into one vector, then all
// tokenIDs referenced in the metadata from after the tx application into // tokenIDs referenced in the metadata from after the tx application into
// another, then find the one tokenID that was added by this tx // another, then find the one tokenID that was added by this tx
// application. // application.
std::vector<ripple::uint256> prevIDs; std::vector<xrpl::uint256> prevIDs;
std::vector<ripple::uint256> finalIDs; std::vector<xrpl::uint256> finalIDs;
// The owner is not necessarily the issuer, if using authorized minter // The owner is not necessarily the issuer, if using authorized minter
// flow. Determine owner from the ledger object ID of the NFTokenPages // flow. Determine owner from the ledger object ID of the NFTokenPages
// that were changed. // that were changed.
std::optional<ripple::AccountID> owner; std::optional<xrpl::AccountID> owner;
for (ripple::STObject const& node : txMeta.getNodes()) { for (xrpl::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltNFTOKEN_PAGE) if (node.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltNFTOKEN_PAGE)
continue; continue;
if (!owner) if (!owner)
owner = ripple::AccountID::fromVoid(node.getFieldH256(ripple::sfLedgerIndex).data()); owner = xrpl::AccountID::fromVoid(node.getFieldH256(xrpl::sfLedgerIndex).data());
if (node.getFName() == ripple::sfCreatedNode) { if (node.getFName() == xrpl::sfCreatedNode) {
ripple::STArray const& toAddNFTs = xrpl::STArray const& toAddNFTs =
node.peekAtField(ripple::sfNewFields).downcast<ripple::STObject>().getFieldArray(ripple::sfNFTokens); node.peekAtField(xrpl::sfNewFields).downcast<xrpl::STObject>().getFieldArray(xrpl::sfNFTokens);
std::ranges::transform( std::ranges::transform(
toAddNFTs, toAddNFTs,
std::back_inserter(finalIDs), std::back_inserter(finalIDs),
[](ripple::STObject const& nft) { return nft.getFieldH256(ripple::sfNFTokenID); } [](xrpl::STObject const& nft) { return nft.getFieldH256(xrpl::sfNFTokenID); }
); );
} }
// Else it's modified, as there should never be a deleted NFToken page // Else it's modified, as there should never be a deleted NFToken page
@@ -104,26 +104,25 @@ getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
// However, there will always be NFTs listed in the final fields, // However, there will always be NFTs listed in the final fields,
// as rippled outputs all fields in final fields even if they were // as rippled outputs all fields in final fields even if they were
// not changed. // not changed.
ripple::STObject const& previousFields = xrpl::STObject const& previousFields = node.peekAtField(xrpl::sfPreviousFields).downcast<xrpl::STObject>();
node.peekAtField(ripple::sfPreviousFields).downcast<ripple::STObject>(); if (!previousFields.isFieldPresent(xrpl::sfNFTokens))
if (!previousFields.isFieldPresent(ripple::sfNFTokens))
continue; continue;
ripple::STArray const& toAddNFTs = previousFields.getFieldArray(ripple::sfNFTokens); xrpl::STArray const& toAddNFTs = previousFields.getFieldArray(xrpl::sfNFTokens);
std::ranges::transform( std::ranges::transform(
toAddNFTs, toAddNFTs,
std::back_inserter(prevIDs), std::back_inserter(prevIDs),
[](ripple::STObject const& nft) { return nft.getFieldH256(ripple::sfNFTokenID); } [](xrpl::STObject const& nft) { return nft.getFieldH256(xrpl::sfNFTokenID); }
); );
ripple::STArray const& toAddFinalNFTs = xrpl::STArray const& toAddFinalNFTs =
node.peekAtField(ripple::sfFinalFields).downcast<ripple::STObject>().getFieldArray(ripple::sfNFTokens); node.peekAtField(xrpl::sfFinalFields).downcast<xrpl::STObject>().getFieldArray(xrpl::sfNFTokens);
std::ranges::transform( std::ranges::transform(
toAddFinalNFTs, toAddFinalNFTs,
std::back_inserter(finalIDs), std::back_inserter(finalIDs),
[](ripple::STObject const& nft) { return nft.getFieldH256(ripple::sfNFTokenID); } [](xrpl::STObject const& nft) { return nft.getFieldH256(xrpl::sfNFTokenID); }
); );
} }
} }
@@ -146,22 +145,21 @@ getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
return { return {
{NFTTransactionsData(*diff.first, txMeta, sttx.getTransactionID())}, {NFTTransactionsData(*diff.first, txMeta, sttx.getTransactionID())},
NFTsData(*diff.first, *owner, sttx.getFieldVL(ripple::sfURI), txMeta) NFTsData(*diff.first, *owner, sttx.getFieldVL(xrpl::sfURI), txMeta)
}; };
} }
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getNFTokenBurnData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{ {
ripple::uint256 const tokenID = sttx.getFieldH256(ripple::sfNFTokenID); xrpl::uint256 const tokenID = sttx.getFieldH256(xrpl::sfNFTokenID);
std::vector<NFTTransactionsData> const txs = {NFTTransactionsData(tokenID, txMeta, sttx.getTransactionID())}; std::vector<NFTTransactionsData> const txs = {NFTTransactionsData(tokenID, txMeta, sttx.getTransactionID())};
// Determine who owned the token when it was burned by finding an // Determine who owned the token when it was burned by finding an
// NFTokenPage that was deleted or modified that contains this // NFTokenPage that was deleted or modified that contains this
// tokenID. // tokenID.
for (ripple::STObject const& node : txMeta.getNodes()) { for (xrpl::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltNFTOKEN_PAGE || if (node.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltNFTOKEN_PAGE || node.getFName() == xrpl::sfCreatedNode)
node.getFName() == ripple::sfCreatedNode)
continue; continue;
// NFT burn can result in an NFTokenPage being modified to no longer // NFT burn can result in an NFTokenPage being modified to no longer
@@ -172,30 +170,27 @@ getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
// deleted. In this case, we need to look in the PreviousFields. // deleted. In this case, we need to look in the PreviousFields.
// Otherwise, the page was not modified prior to deleting and we // Otherwise, the page was not modified prior to deleting and we
// need to look in the FinalFields. // need to look in the FinalFields.
std::optional<ripple::STArray> prevNFTs; std::optional<xrpl::STArray> prevNFTs;
if (node.isFieldPresent(ripple::sfPreviousFields)) { if (node.isFieldPresent(xrpl::sfPreviousFields)) {
ripple::STObject const& previousFields = xrpl::STObject const& previousFields = node.peekAtField(xrpl::sfPreviousFields).downcast<xrpl::STObject>();
node.peekAtField(ripple::sfPreviousFields).downcast<ripple::STObject>(); if (previousFields.isFieldPresent(xrpl::sfNFTokens))
if (previousFields.isFieldPresent(ripple::sfNFTokens)) prevNFTs = previousFields.getFieldArray(xrpl::sfNFTokens);
prevNFTs = previousFields.getFieldArray(ripple::sfNFTokens); } else if (node.getFName() == xrpl::sfDeletedNode) {
} else if (node.getFName() == ripple::sfDeletedNode) { prevNFTs = node.peekAtField(xrpl::sfFinalFields).downcast<xrpl::STObject>().getFieldArray(xrpl::sfNFTokens);
prevNFTs =
node.peekAtField(ripple::sfFinalFields).downcast<ripple::STObject>().getFieldArray(ripple::sfNFTokens);
} }
if (!prevNFTs) if (!prevNFTs)
continue; continue;
auto const nft = auto const nft = std::find_if(prevNFTs->begin(), prevNFTs->end(), [&tokenID](xrpl::STObject const& candidate) {
std::find_if(prevNFTs->begin(), prevNFTs->end(), [&tokenID](ripple::STObject const& candidate) { return candidate.getFieldH256(xrpl::sfNFTokenID) == tokenID;
return candidate.getFieldH256(ripple::sfNFTokenID) == tokenID; });
});
if (nft != prevNFTs->end()) { if (nft != prevNFTs->end()) {
return std::make_pair( return std::make_pair(
txs, txs,
NFTsData( NFTsData(
tokenID, ripple::AccountID::fromVoid(node.getFieldH256(ripple::sfLedgerIndex).data()), txMeta, true tokenID, xrpl::AccountID::fromVoid(node.getFieldH256(xrpl::sfLedgerIndex).data()), txMeta, true
) )
); );
} }
@@ -207,15 +202,15 @@ getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
} }
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getNFTokenAcceptOfferData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{ {
// If we have the buy offer from this tx, we can determine the owner // If we have the buy offer from this tx, we can determine the owner
// more easily by just looking at the owner of the accepted NFTokenOffer // more easily by just looking at the owner of the accepted NFTokenOffer
// object. // object.
if (sttx.isFieldPresent(ripple::sfNFTokenBuyOffer)) { if (sttx.isFieldPresent(xrpl::sfNFTokenBuyOffer)) {
auto const affectedBuyOffer = auto const affectedBuyOffer =
std::find_if(txMeta.getNodes().begin(), txMeta.getNodes().end(), [&sttx](ripple::STObject const& node) { std::find_if(txMeta.getNodes().begin(), txMeta.getNodes().end(), [&sttx](xrpl::STObject const& node) {
return node.getFieldH256(ripple::sfLedgerIndex) == sttx.getFieldH256(ripple::sfNFTokenBuyOffer); return node.getFieldH256(xrpl::sfLedgerIndex) == sttx.getFieldH256(xrpl::sfNFTokenBuyOffer);
}); });
if (affectedBuyOffer == txMeta.getNodes().end()) { if (affectedBuyOffer == txMeta.getNodes().end()) {
std::stringstream msg; std::stringstream msg;
@@ -223,13 +218,12 @@ getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
throw std::runtime_error(msg.str()); throw std::runtime_error(msg.str());
} }
ripple::uint256 const tokenID = affectedBuyOffer->peekAtField(ripple::sfFinalFields) xrpl::uint256 const tokenID = affectedBuyOffer->peekAtField(xrpl::sfFinalFields)
.downcast<ripple::STObject>() .downcast<xrpl::STObject>()
.getFieldH256(ripple::sfNFTokenID); .getFieldH256(xrpl::sfNFTokenID);
ripple::AccountID const owner = affectedBuyOffer->peekAtField(ripple::sfFinalFields) xrpl::AccountID const owner =
.downcast<ripple::STObject>() affectedBuyOffer->peekAtField(xrpl::sfFinalFields).downcast<xrpl::STObject>().getAccountID(xrpl::sfOwner);
.getAccountID(ripple::sfOwner);
return { return {
{NFTTransactionsData(tokenID, txMeta, sttx.getTransactionID())}, NFTsData(tokenID, owner, txMeta, false) {NFTTransactionsData(tokenID, txMeta, sttx.getTransactionID())}, NFTsData(tokenID, owner, txMeta, false)
}; };
@@ -237,8 +231,8 @@ getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
// Otherwise we have to infer the new owner from the affected nodes. // Otherwise we have to infer the new owner from the affected nodes.
auto const affectedSellOffer = auto const affectedSellOffer =
std::find_if(txMeta.getNodes().begin(), txMeta.getNodes().end(), [&sttx](ripple::STObject const& node) { std::find_if(txMeta.getNodes().begin(), txMeta.getNodes().end(), [&sttx](xrpl::STObject const& node) {
return node.getFieldH256(ripple::sfLedgerIndex) == sttx.getFieldH256(ripple::sfNFTokenSellOffer); return node.getFieldH256(xrpl::sfLedgerIndex) == sttx.getFieldH256(xrpl::sfNFTokenSellOffer);
}); });
if (affectedSellOffer == txMeta.getNodes().end()) { if (affectedSellOffer == txMeta.getNodes().end()) {
std::stringstream msg; std::stringstream msg;
@@ -246,37 +240,29 @@ getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
throw std::runtime_error(msg.str()); throw std::runtime_error(msg.str());
} }
ripple::uint256 const tokenID = affectedSellOffer->peekAtField(ripple::sfFinalFields) xrpl::uint256 const tokenID =
.downcast<ripple::STObject>() affectedSellOffer->peekAtField(xrpl::sfFinalFields).downcast<xrpl::STObject>().getFieldH256(xrpl::sfNFTokenID);
.getFieldH256(ripple::sfNFTokenID);
ripple::AccountID const seller = affectedSellOffer->peekAtField(ripple::sfFinalFields) xrpl::AccountID const seller =
.downcast<ripple::STObject>() affectedSellOffer->peekAtField(xrpl::sfFinalFields).downcast<xrpl::STObject>().getAccountID(xrpl::sfOwner);
.getAccountID(ripple::sfOwner);
for (ripple::STObject const& node : txMeta.getNodes()) { for (xrpl::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltNFTOKEN_PAGE || if (node.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltNFTOKEN_PAGE || node.getFName() == xrpl::sfDeletedNode)
node.getFName() == ripple::sfDeletedNode)
continue; continue;
ripple::AccountID const nodeOwner = xrpl::AccountID const nodeOwner = xrpl::AccountID::fromVoid(node.getFieldH256(xrpl::sfLedgerIndex).data());
ripple::AccountID::fromVoid(node.getFieldH256(ripple::sfLedgerIndex).data());
if (nodeOwner == seller) if (nodeOwner == seller)
continue; continue;
ripple::STArray const& nfts = [&node] { xrpl::STArray const& nfts = [&node] {
if (node.getFName() == ripple::sfCreatedNode) { if (node.getFName() == xrpl::sfCreatedNode) {
return node.peekAtField(ripple::sfNewFields) return node.peekAtField(xrpl::sfNewFields).downcast<xrpl::STObject>().getFieldArray(xrpl::sfNFTokens);
.downcast<ripple::STObject>()
.getFieldArray(ripple::sfNFTokens);
} }
return node.peekAtField(ripple::sfFinalFields) return node.peekAtField(xrpl::sfFinalFields).downcast<xrpl::STObject>().getFieldArray(xrpl::sfNFTokens);
.downcast<ripple::STObject>()
.getFieldArray(ripple::sfNFTokens);
}(); }();
auto const nft = std::ranges::find_if(nfts, [&tokenID](ripple::STObject const& candidate) { auto const nft = std::ranges::find_if(nfts, [&tokenID](xrpl::STObject const& candidate) {
return candidate.getFieldH256(ripple::sfNFTokenID) == tokenID; return candidate.getFieldH256(xrpl::sfNFTokenID) == tokenID;
}); });
if (nft != nfts.end()) { if (nft != nfts.end()) {
return { return {
@@ -296,15 +282,15 @@ getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
// transaction using this feature. This transaction also never returns an // transaction using this feature. This transaction also never returns an
// NFTsData because it does not change the state of an NFT itself. // NFTsData because it does not change the state of an NFT itself.
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenCancelOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getNFTokenCancelOfferData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{ {
std::vector<NFTTransactionsData> txs; std::vector<NFTTransactionsData> txs;
for (ripple::STObject const& node : txMeta.getNodes()) { for (xrpl::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltNFTOKEN_OFFER) if (node.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltNFTOKEN_OFFER)
continue; continue;
ripple::uint256 const tokenID = xrpl::uint256 const tokenID =
node.peekAtField(ripple::sfFinalFields).downcast<ripple::STObject>().getFieldH256(ripple::sfNFTokenID); node.peekAtField(xrpl::sfFinalFields).downcast<xrpl::STObject>().getFieldH256(xrpl::sfNFTokenID);
txs.emplace_back(tokenID, txMeta, sttx.getTransactionID()); txs.emplace_back(tokenID, txMeta, sttx.getTransactionID());
} }
@@ -322,34 +308,34 @@ getNFTokenCancelOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
// This transaction never returns an NFTokensData because it does not // This transaction never returns an NFTokensData because it does not
// change the state of an NFT itself. // change the state of an NFT itself.
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenCreateOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getNFTokenCreateOfferData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{ {
return {{NFTTransactionsData(sttx.getFieldH256(ripple::sfNFTokenID), txMeta, sttx.getTransactionID())}, {}}; return {{NFTTransactionsData(sttx.getFieldH256(xrpl::sfNFTokenID), txMeta, sttx.getTransactionID())}, {}};
} }
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTDataFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx) getNFTDataFromTx(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{ {
if (txMeta.getResultTER() != ripple::tesSUCCESS) if (txMeta.getResultTER() != xrpl::tesSUCCESS)
return {{}, {}}; return {{}, {}};
switch (sttx.getTxnType()) { switch (sttx.getTxnType()) {
case ripple::TxType::ttNFTOKEN_MINT: case xrpl::TxType::ttNFTOKEN_MINT:
return getNFTokenMintData(txMeta, sttx); return getNFTokenMintData(txMeta, sttx);
case ripple::TxType::ttNFTOKEN_BURN: case xrpl::TxType::ttNFTOKEN_BURN:
return getNFTokenBurnData(txMeta, sttx); return getNFTokenBurnData(txMeta, sttx);
case ripple::TxType::ttNFTOKEN_ACCEPT_OFFER: case xrpl::TxType::ttNFTOKEN_ACCEPT_OFFER:
return getNFTokenAcceptOfferData(txMeta, sttx); return getNFTokenAcceptOfferData(txMeta, sttx);
case ripple::TxType::ttNFTOKEN_CANCEL_OFFER: case xrpl::TxType::ttNFTOKEN_CANCEL_OFFER:
return getNFTokenCancelOfferData(txMeta, sttx); return getNFTokenCancelOfferData(txMeta, sttx);
case ripple::TxType::ttNFTOKEN_CREATE_OFFER: case xrpl::TxType::ttNFTOKEN_CREATE_OFFER:
return getNFTokenCreateOfferData(txMeta, sttx); return getNFTokenCreateOfferData(txMeta, sttx);
case ripple::TxType::ttNFTOKEN_MODIFY: case xrpl::TxType::ttNFTOKEN_MODIFY:
return getNftokenModifyData(txMeta, sttx); return getNftokenModifyData(txMeta, sttx);
default: default:
@@ -361,19 +347,19 @@ std::vector<NFTsData>
getNFTDataFromObj(std::uint32_t const seq, std::string const& key, std::string const& blob) getNFTDataFromObj(std::uint32_t const seq, std::string const& key, std::string const& blob)
{ {
// https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0020-non-fungible-tokens#tokenpage-id-format // https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0020-non-fungible-tokens#tokenpage-id-format
ASSERT(key.size() == ripple::uint256::size(), "The size of the key (token) is expected to fit uint256 exactly"); ASSERT(key.size() == xrpl::uint256::size(), "The size of the key (token) is expected to fit uint256 exactly");
auto const sle = auto const sle =
ripple::STLedgerEntry(ripple::SerialIter{blob.data(), blob.size()}, ripple::uint256::fromVoid(key.data())); xrpl::STLedgerEntry(xrpl::SerialIter{blob.data(), blob.size()}, xrpl::uint256::fromVoid(key.data()));
if (sle.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltNFTOKEN_PAGE) if (sle.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltNFTOKEN_PAGE)
return {}; return {};
auto const owner = ripple::AccountID::fromVoid(key.data()); auto const owner = xrpl::AccountID::fromVoid(key.data());
std::vector<NFTsData> nfts; std::vector<NFTsData> nfts;
for (ripple::STObject const& node : sle.getFieldArray(ripple::sfNFTokens)) for (xrpl::STObject const& node : sle.getFieldArray(xrpl::sfNFTokens))
nfts.emplace_back(node.getFieldH256(ripple::sfNFTokenID), seq, owner, node.getFieldVL(ripple::sfURI)); nfts.emplace_back(node.getFieldH256(xrpl::sfNFTokenID), seq, owner, node.getFieldVL(xrpl::sfURI));
return nfts; return nfts;
} }

View File

@@ -41,7 +41,7 @@ namespace etl {
* @return NFT URI change data as a pair of transactions and optional NFTsData * @return NFT URI change data as a pair of transactions and optional NFTsData
*/ */
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNftokenModifyData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx); getNftokenModifyData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/** /**
* @brief Get the NFT Token mint data from a transaction * @brief Get the NFT Token mint data from a transaction
@@ -51,7 +51,7 @@ getNftokenModifyData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
* @return NFT Token mint data as a pair of transactions and optional NFTsData * @return NFT Token mint data as a pair of transactions and optional NFTsData
*/ */
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx); getNFTokenMintData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/** /**
* @brief Get the NFT Token burn data from a transaction * @brief Get the NFT Token burn data from a transaction
@@ -61,7 +61,7 @@ getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
* @return NFT Token burn data as a pair of transactions and optional NFTsData * @return NFT Token burn data as a pair of transactions and optional NFTsData
*/ */
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx); getNFTokenBurnData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/** /**
* @brief Get the NFT Token accept offer data from a transaction * @brief Get the NFT Token accept offer data from a transaction
@@ -71,7 +71,7 @@ getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
* @return NFT Token accept offer data as a pair of transactions and optional NFTsData * @return NFT Token accept offer data as a pair of transactions and optional NFTsData
*/ */
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx); getNFTokenAcceptOfferData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/** /**
* @brief Get the NFT Token cancel offer data from a transaction * @brief Get the NFT Token cancel offer data from a transaction
@@ -81,7 +81,7 @@ getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
* @return NFT Token cancel offer data as a pair of transactions and optional NFTsData * @return NFT Token cancel offer data as a pair of transactions and optional NFTsData
*/ */
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenCancelOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx); getNFTokenCancelOfferData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/** /**
* @brief Get the NFT Token create offer data from a transaction * @brief Get the NFT Token create offer data from a transaction
@@ -91,7 +91,7 @@ getNFTokenCancelOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
* @return NFT Token create offer data as a pair of transactions and optional NFTsData * @return NFT Token create offer data as a pair of transactions and optional NFTsData
*/ */
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenCreateOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx); getNFTokenCreateOfferData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/** /**
* @brief Pull NFT data from TX via ETLService. * @brief Pull NFT data from TX via ETLService.
@@ -101,7 +101,7 @@ getNFTokenCreateOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
* @return NFT transactions data as a pair of transactions and optional NFTsData * @return NFT transactions data as a pair of transactions and optional NFTsData
*/ */
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>> std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTDataFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx); getNFTDataFromTx(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/** /**
* @brief Pull NFT data from ledger object via loadInitialLedger. * @brief Pull NFT data from ledger object via loadInitialLedger.

View File

@@ -58,11 +58,11 @@ namespace etl {
* @code{.cpp} * @code{.cpp}
* struct Ext { * struct Ext {
* using spec = etl::model::Spec< * using spec = etl::model::Spec<
* ripple::TxType::ttNFTOKEN_BURN, * xrpl::TxType::ttNFTOKEN_BURN,
* ripple::TxType::ttNFTOKEN_ACCEPT_OFFER, * xrpl::TxType::ttNFTOKEN_ACCEPT_OFFER,
* ripple::TxType::ttNFTOKEN_CREATE_OFFER, * xrpl::TxType::ttNFTOKEN_CREATE_OFFER,
* ripple::TxType::ttNFTOKEN_CANCEL_OFFER, * xrpl::TxType::ttNFTOKEN_CANCEL_OFFER,
* ripple::TxType::ttNFTOKEN_MINT>; * xrpl::TxType::ttNFTOKEN_MINT>;
* *
* static void * static void
* onInitialTransaction(uint32_t, etl::model::Transaction const&); * onInitialTransaction(uint32_t, etl::model::Transaction const&);

View File

@@ -43,24 +43,20 @@
namespace etl::impl { namespace etl::impl {
AsyncGrpcCall::AsyncGrpcCall( AsyncGrpcCall::AsyncGrpcCall(uint32_t seq, xrpl::uint256 const& marker, std::optional<xrpl::uint256> const& nextMarker)
uint32_t seq,
ripple::uint256 const& marker,
std::optional<ripple::uint256> const& nextMarker
)
{ {
request_.set_user("ETL"); request_.set_user("ETL");
request_.mutable_ledger()->set_sequence(seq); request_.mutable_ledger()->set_sequence(seq);
if (marker.isNonZero()) if (marker.isNonZero())
request_.set_marker(marker.data(), ripple::uint256::size()); request_.set_marker(marker.data(), xrpl::uint256::size());
nextPrefix_ = nextMarker ? nextMarker->data()[0] : 0x00; nextPrefix_ = nextMarker ? nextMarker->data()[0] : 0x00;
auto const prefix = marker.data()[0]; auto const prefix = marker.data()[0];
LOG(log_.debug()) << "Setting up AsyncGrpcCall. marker = " << ripple::strHex(marker) LOG(log_.debug()) << "Setting up AsyncGrpcCall. marker = " << xrpl::strHex(marker)
<< ". prefix = " << ripple::strHex(std::string(1, prefix)) << ". prefix = " << xrpl::strHex(std::string(1, prefix))
<< ". nextPrefix_ = " << ripple::strHex(std::string(1, nextPrefix_)); << ". nextPrefix_ = " << xrpl::strHex(std::string(1, nextPrefix_));
ASSERT( ASSERT(
nextPrefix_ > prefix or nextPrefix_ == 0x00, nextPrefix_ > prefix or nextPrefix_ == 0x00,
@@ -157,7 +153,7 @@ AsyncGrpcCall::call(std::unique_ptr<org::xrpl::rpc::v1::XRPLedgerAPIService::Stu
std::string std::string
AsyncGrpcCall::getMarkerPrefix() AsyncGrpcCall::getMarkerPrefix()
{ {
return next_->marker().empty() ? std::string{} : ripple::strHex(std::string{next_->marker().data()[0]}); return next_->marker().empty() ? std::string{} : xrpl::strHex(std::string{next_->marker().data()[0]});
} }
// this is used to generate edgeKeys - keys that were the last one in the onInitialObjects list // this is used to generate edgeKeys - keys that were the last one in the onInitialObjects list

View File

@@ -59,7 +59,7 @@ private:
std::optional<std::string> predecessorKey_; std::optional<std::string> predecessorKey_;
public: public:
AsyncGrpcCall(uint32_t seq, ripple::uint256 const& marker, std::optional<ripple::uint256> const& nextMarker); AsyncGrpcCall(uint32_t seq, xrpl::uint256 const& marker, std::optional<xrpl::uint256> const& nextMarker);
static std::vector<AsyncGrpcCall> static std::vector<AsyncGrpcCall>
makeAsyncCalls(uint32_t const sequence, uint32_t const numMarkers); makeAsyncCalls(uint32_t const sequence, uint32_t const numMarkers);

View File

@@ -26,8 +26,8 @@
namespace etl::impl { namespace etl::impl {
struct CursorPair { struct CursorPair {
ripple::uint256 start; xrpl::uint256 start;
ripple::uint256 end; xrpl::uint256 end;
}; };
struct BaseCursorProvider { struct BaseCursorProvider {

View File

@@ -120,7 +120,7 @@ private:
} }
auto [start, end] = cursor.value(); auto [start, end] = cursor.value();
LOG(log_.debug()) << "Starting a cursor: " << ripple::strHex(start); LOG(log_.debug()) << "Starting a cursor: " << xrpl::strHex(start);
while (not token.isStopRequested() and not cache_.get().isDisabled()) { while (not token.isStopRequested() and not cache_.get().isDisabled()) {
auto res = data::retryOnTimeout([this, seq, cachePageFetchSize, &start, token]() { auto res = data::retryOnTimeout([this, seq, cachePageFetchSize, &start, token]() {

View File

@@ -58,7 +58,7 @@ public:
}(); }();
rg::sort(accountRoots); rg::sort(accountRoots);
std::vector<ripple::uint256> cursors{data::kFIRST_KEY}; std::vector<xrpl::uint256> cursors{data::kFIRST_KEY};
rg::copy(accountRoots.begin(), accountRoots.end(), std::back_inserter(cursors)); rg::copy(accountRoots.begin(), accountRoots.end(), std::back_inserter(cursors));
rg::sort(cursors); rg::sort(cursors);
cursors.push_back(data::kLAST_KEY); cursors.push_back(data::kLAST_KEY);

View File

@@ -62,8 +62,8 @@ public:
auto const range = backend_->fetchLedgerRange(); auto const range = backend_->fetchLedgerRange();
ASSERT(range.has_value(), "Ledger range is not available when cache is loading"); ASSERT(range.has_value(), "Ledger range is not available when cache is loading");
std::set<ripple::uint256> liveCursors; std::set<xrpl::uint256> liveCursors;
std::set<ripple::uint256> deletedCursors; std::set<xrpl::uint256> deletedCursors;
auto i = 0; auto i = 0;
while (liveCursors.size() < numCursors_ and seq - i >= range->minSequence) { while (liveCursors.size() < numCursors_ and seq - i >= range->minSequence) {
auto diffs = fetchDiff(i++); auto diffs = fetchDiff(i++);
@@ -85,7 +85,7 @@ public:
); );
} }
std::vector<ripple::uint256> cursors{data::kFIRST_KEY}; std::vector<xrpl::uint256> cursors{data::kFIRST_KEY};
rg::copy(liveCursors | vs::take(std::min(liveCursors.size(), numCursors_)), std::back_inserter(cursors)); rg::copy(liveCursors | vs::take(std::min(liveCursors.size(), numCursors_)), std::back_inserter(cursors));
rg::sort(cursors); rg::sort(cursors);
cursors.push_back(data::kLAST_KEY); cursors.push_back(data::kLAST_KEY);

View File

@@ -74,7 +74,7 @@ public:
rg::unique(diffs, [](auto const& a, auto const& b) { return a.key == b.key; }); rg::unique(diffs, [](auto const& a, auto const& b) { return a.key == b.key; });
diffs.erase(removalCursor, last); diffs.erase(removalCursor, last);
std::vector<ripple::uint256> cursors{data::kFIRST_KEY}; std::vector<xrpl::uint256> cursors{data::kFIRST_KEY};
rg::copy( rg::copy(
diffs // diffs //
| vs::filter([](auto const& obj) { return not obj.blob.empty(); }) // | vs::filter([](auto const& obj) { return not obj.blob.empty(); }) //

View File

@@ -29,6 +29,7 @@
#include "util/Profiler.hpp" #include "util/Profiler.hpp"
#include "util/log/Logger.hpp" #include "util/log/Logger.hpp"
#include <xrpl/basics/Blob.h>
#include <xrpl/basics/Slice.h> #include <xrpl/basics/Slice.h>
#include <xrpl/basics/base_uint.h> #include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/STTx.h> #include <xrpl/protocol/STTx.h>
@@ -72,9 +73,10 @@ model::Transaction
extractTx(PBTxType tx, uint32_t seq) extractTx(PBTxType tx, uint32_t seq)
{ {
auto raw = std::move(*tx.mutable_transaction_blob()); auto raw = std::move(*tx.mutable_transaction_blob());
ripple::SerialIter it{raw.data(), raw.size()}; xrpl::SerialIter it{raw.data(), raw.size()};
ripple::STTx const sttx{it}; xrpl::STTx const sttx{it};
ripple::TxMeta meta{sttx.getTransactionID(), seq, tx.metadata_blob()}; auto const& metaBlob = tx.metadata_blob();
xrpl::TxMeta meta{sttx.getTransactionID(), seq, xrpl::Blob{metaBlob.begin(), metaBlob.end()}};
return { return {
.raw = std::move(raw), .raw = std::move(raw),
@@ -104,7 +106,7 @@ extractTxs(PBTxListType transactions, uint32_t seq)
model::Object model::Object
extractObj(PBObjType obj) extractObj(PBObjType obj)
{ {
auto const key = ripple::uint256::fromVoidChecked(obj.key()); auto const key = xrpl::uint256::fromVoidChecked(obj.key());
ASSERT(key.has_value(), "Failed to deserialize key from void"); ASSERT(key.has_value(), "Failed to deserialize key from void");
auto const valueOr = [](std::string const& maybe, std::string fallback) -> std::string { auto const valueOr = [](std::string const& maybe, std::string fallback) -> std::string {
@@ -171,7 +173,7 @@ auto
Extractor::unpack() Extractor::unpack()
{ {
return [](auto&& data) { return [](auto&& data) {
auto header = ::util::deserializeHeader(ripple::makeSlice(data.ledger_header())); auto header = ::util::deserializeHeader(xrpl::makeSlice(data.ledger_header()));
return std::make_optional<model::LedgerData>({ return std::make_optional<model::LedgerData>({
.transactions = .transactions =

View File

@@ -80,7 +80,7 @@ class LedgerPublisher : public LedgerPublisherInterface {
std::shared_ptr<feed::SubscriptionManagerInterface> subscriptions_; std::shared_ptr<feed::SubscriptionManagerInterface> subscriptions_;
std::reference_wrapper<SystemState const> state_; // shared state for ETL std::reference_wrapper<SystemState const> state_; // shared state for ETL
util::Mutex<std::chrono::time_point<ripple::NetClock>, std::shared_mutex> lastCloseTime_; util::Mutex<std::chrono::time_point<xrpl::NetClock>, std::shared_mutex> lastCloseTime_;
std::reference_wrapper<util::prometheus::CounterInt> lastPublishSeconds_ = PrometheusService::counterInt( std::reference_wrapper<util::prometheus::CounterInt> lastPublishSeconds_ = PrometheusService::counterInt(
"etl_last_publish_seconds", "etl_last_publish_seconds",
@@ -161,7 +161,7 @@ public:
* @param lgrInfo the ledger to publish * @param lgrInfo the ledger to publish
*/ */
void void
publish(ripple::LedgerHeader const& lgrInfo) publish(xrpl::LedgerHeader const& lgrInfo)
{ {
publishStrand_.submit([this, lgrInfo = lgrInfo] { publishStrand_.submit([this, lgrInfo = lgrInfo] {
LOG(log_.info()) << "Publishing ledger " << std::to_string(lgrInfo.seq); LOG(log_.info()) << "Publishing ledger " << std::to_string(lgrInfo.seq);
@@ -172,7 +172,7 @@ public:
// if the ledger closed over MAX_LEDGER_AGE_SECONDS ago, assume we are still catching up and don't publish // if the ledger closed over MAX_LEDGER_AGE_SECONDS ago, assume we are still catching up and don't publish
static constexpr std::uint32_t kMAX_LEDGER_AGE_SECONDS = 600; static constexpr std::uint32_t kMAX_LEDGER_AGE_SECONDS = 600;
if (age < kMAX_LEDGER_AGE_SECONDS) { if (age < kMAX_LEDGER_AGE_SECONDS) {
std::optional<ripple::Fees> fees = data::synchronousAndRetryOnTimeout([&](auto yield) { std::optional<xrpl::Fees> fees = data::synchronousAndRetryOnTimeout([&](auto yield) {
return backend_->fetchFees(lgrInfo.seq, yield); return backend_->fetchFees(lgrInfo.seq, yield);
}); });
ASSERT(fees.has_value(), "Fees must exist for ledger {}", lgrInfo.seq); ASSERT(fees.has_value(), "Fees must exist for ledger {}", lgrInfo.seq);
@@ -189,12 +189,12 @@ public:
// order with transaction index // order with transaction index
std::ranges::sort(transactions, [](auto const& t1, auto const& t2) { std::ranges::sort(transactions, [](auto const& t1, auto const& t2) {
ripple::SerialIter iter1{t1.metadata.data(), t1.metadata.size()}; xrpl::SerialIter iter1{t1.metadata.data(), t1.metadata.size()};
ripple::STObject const object1(iter1, ripple::sfMetadata); xrpl::STObject const object1(iter1, xrpl::sfMetadata);
ripple::SerialIter iter2{t2.metadata.data(), t2.metadata.size()}; xrpl::SerialIter iter2{t2.metadata.data(), t2.metadata.size()};
ripple::STObject const object2(iter2, ripple::sfMetadata); xrpl::STObject const object2(iter2, xrpl::sfMetadata);
return object1.getFieldU32(ripple::sfTransactionIndex) < return object1.getFieldU32(xrpl::sfTransactionIndex) <
object2.getFieldU32(ripple::sfTransactionIndex); object2.getFieldU32(xrpl::sfTransactionIndex);
}); });
for (auto const& txAndMeta : transactions) for (auto const& txAndMeta : transactions)
@@ -260,7 +260,7 @@ public:
private: private:
void void
setLastClose(std::chrono::time_point<ripple::NetClock> lastCloseTime) setLastClose(std::chrono::time_point<xrpl::NetClock> lastCloseTime)
{ {
auto closeTime = lastCloseTime_.lock<std::scoped_lock>(); auto closeTime = lastCloseTime_.lock<std::scoped_lock>();
*closeTime = lastCloseTime; *closeTime = lastCloseTime;

View File

@@ -128,7 +128,7 @@ Loader::onInitialLoadGotMoreObjects(
} }
} }
std::optional<ripple::LedgerHeader> std::optional<xrpl::LedgerHeader>
Loader::loadInitialLedger(model::LedgerData const& data) Loader::loadInitialLedger(model::LedgerData const& data)
{ {
try { try {

View File

@@ -86,7 +86,7 @@ public:
std::optional<std::string> lastKey std::optional<std::string> lastKey
) override; ) override;
std::optional<ripple::LedgerHeader> std::optional<xrpl::LedgerHeader>
loadInitialLedger(model::LedgerData const& data) override; loadInitialLedger(model::LedgerData const& data) override;
}; };

View File

@@ -49,7 +49,7 @@ MPTExt::onLedgerData(model::LedgerData const& data)
void void
MPTExt::onInitialObject(uint32_t, model::Object const& obj) MPTExt::onInitialObject(uint32_t, model::Object const& obj)
{ {
LOG(log_.trace()) << "got initial object with key: " << ripple::strHex(obj.key); LOG(log_.trace()) << "got initial object with key: " << xrpl::strHex(obj.key);
if (auto const mptHolder = getMPTHolderFromObj(obj.keyRaw, obj.dataRaw); mptHolder.has_value()) if (auto const mptHolder = getMPTHolderFromObj(obj.keyRaw, obj.dataRaw); mptHolder.has_value())
backend_->writeMPTHolders({*mptHolder}); backend_->writeMPTHolders({*mptHolder});
} }

View File

@@ -144,7 +144,7 @@ SuccessorExt::updateSuccessorFromCache(uint32_t seq, model::Object const& obj) c
if (isDeleted) { if (isDeleted) {
auto const old = cache_.get().getDeleted(obj.key, seq - 1); auto const old = cache_.get().getDeleted(obj.key, seq - 1);
ASSERT(old.has_value(), "Deleted object {} must be in cache", ripple::strHex(obj.key)); ASSERT(old.has_value(), "Deleted object {} must be in cache", xrpl::strHex(obj.key));
checkBookBase = isBookDir(obj.key, *old); checkBookBase = isBookDir(obj.key, *old);
} else { } else {
@@ -172,7 +172,7 @@ void
SuccessorExt::updateBookSuccessor( SuccessorExt::updateBookSuccessor(
std::optional<data::LedgerObject> const& maybeSuccessor, std::optional<data::LedgerObject> const& maybeSuccessor,
auto seq, auto seq,
ripple::uint256 const& bookBase xrpl::uint256 const& bookBase
) const ) const
{ {
if (maybeSuccessor.has_value()) { if (maybeSuccessor.has_value()) {
@@ -185,7 +185,7 @@ SuccessorExt::updateBookSuccessor(
void void
SuccessorExt::writeSuccessors(uint32_t seq) const SuccessorExt::writeSuccessors(uint32_t seq) const
{ {
ripple::uint256 prev = data::kFIRST_KEY; xrpl::uint256 prev = data::kFIRST_KEY;
while (auto cur = cache_.get().getSuccessor(prev, seq)) { while (auto cur = cache_.get().getSuccessor(prev, seq)) {
if (prev == data::kFIRST_KEY) if (prev == data::kFIRST_KEY)
backend_->writeSuccessor(uint256ToString(prev), seq, uint256ToString(cur->key)); backend_->writeSuccessor(uint256ToString(prev), seq, uint256ToString(cur->key));
@@ -196,7 +196,7 @@ SuccessorExt::writeSuccessors(uint32_t seq) const
// make sure the base is not an actual object // make sure the base is not an actual object
if (not cache_.get().get(base, seq)) { if (not cache_.get().get(base, seq)) {
auto succ = cache_.get().getSuccessor(base, seq); auto succ = cache_.get().getSuccessor(base, seq);
ASSERT(succ.has_value(), "Book base {} must have a successor", ripple::strHex(base)); ASSERT(succ.has_value(), "Book base {} must have a successor", xrpl::strHex(base));
if (succ->key == cur->key) if (succ->key == cur->key)
backend_->writeSuccessor(uint256ToString(base), seq, uint256ToString(cur->key)); backend_->writeSuccessor(uint256ToString(base), seq, uint256ToString(cur->key));
@@ -213,7 +213,7 @@ void
SuccessorExt::writeEdgeKeys(std::uint32_t seq, auto const& edgeKeys) const SuccessorExt::writeEdgeKeys(std::uint32_t seq, auto const& edgeKeys) const
{ {
for (auto const& key : edgeKeys) { for (auto const& key : edgeKeys) {
auto succ = cache_.get().getSuccessor(*ripple::uint256::fromVoidChecked(key), seq); auto succ = cache_.get().getSuccessor(*xrpl::uint256::fromVoidChecked(key), seq);
if (succ) if (succ)
backend_->writeSuccessor(auto{key}, seq, uint256ToString(succ->key)); backend_->writeSuccessor(auto{key}, seq, uint256ToString(succ->key));
} }

View File

@@ -69,7 +69,7 @@ private:
updateBookSuccessor( updateBookSuccessor(
std::optional<data::LedgerObject> const& maybeSuccessor, std::optional<data::LedgerObject> const& maybeSuccessor,
auto seq, auto seq,
ripple::uint256 const& bookBase xrpl::uint256 const& bookBase
) const; ) const;
void void

View File

@@ -48,7 +48,7 @@ SubscriptionManager::unsubBookChanges(SubscriberSharedPtr const& subscriber)
void void
SubscriptionManager::pubBookChanges( SubscriptionManager::pubBookChanges(
ripple::LedgerHeader const& lgrInfo, xrpl::LedgerHeader const& lgrInfo,
std::vector<data::TransactionAndMetadata> const& transactions std::vector<data::TransactionAndMetadata> const& transactions
) )
{ {
@@ -72,7 +72,7 @@ SubscriptionManager::unsubProposedTransactions(SubscriberSharedPtr const& subscr
} }
void void
SubscriptionManager::subProposedAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) SubscriptionManager::subProposedAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{ {
proposedTransactionFeed_.sub(account, subscriber); proposedTransactionFeed_.sub(account, subscriber);
// Same as proposed_transactions subscribers, proposed_account subscribers also subscribe to the transaction feed to // Same as proposed_transactions subscribers, proposed_account subscribers also subscribe to the transaction feed to
@@ -81,7 +81,7 @@ SubscriptionManager::subProposedAccount(ripple::AccountID const& account, Subscr
} }
void void
SubscriptionManager::unsubProposedAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) SubscriptionManager::unsubProposedAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{ {
proposedTransactionFeed_.unsub(account, subscriber); proposedTransactionFeed_.unsub(account, subscriber);
transactionFeed_.unsubProposed(account, subscriber); transactionFeed_.unsubProposed(account, subscriber);
@@ -107,8 +107,8 @@ SubscriptionManager::unsubLedger(SubscriberSharedPtr const& subscriber)
void void
SubscriptionManager::pubLedger( SubscriptionManager::pubLedger(
ripple::LedgerHeader const& lgrInfo, xrpl::LedgerHeader const& lgrInfo,
ripple::Fees const& fees, xrpl::Fees const& fees,
std::string const& ledgerRange, std::string const& ledgerRange,
std::uint32_t const txnCount std::uint32_t const txnCount
) )
@@ -165,31 +165,31 @@ SubscriptionManager::unsubTransactions(SubscriberSharedPtr const& subscriber)
} }
void void
SubscriptionManager::subAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) SubscriptionManager::subAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{ {
transactionFeed_.sub(account, subscriber); transactionFeed_.sub(account, subscriber);
} }
void void
SubscriptionManager::unsubAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) SubscriptionManager::unsubAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{ {
transactionFeed_.unsub(account, subscriber); transactionFeed_.unsub(account, subscriber);
} }
void void
SubscriptionManager::subBook(ripple::Book const& book, SubscriberSharedPtr const& subscriber) SubscriptionManager::subBook(xrpl::Book const& book, SubscriberSharedPtr const& subscriber)
{ {
transactionFeed_.sub(book, subscriber); transactionFeed_.sub(book, subscriber);
} }
void void
SubscriptionManager::unsubBook(ripple::Book const& book, SubscriberSharedPtr const& subscriber) SubscriptionManager::unsubBook(xrpl::Book const& book, SubscriberSharedPtr const& subscriber)
{ {
transactionFeed_.unsub(book, subscriber); transactionFeed_.unsub(book, subscriber);
} }
void void
SubscriptionManager::pubTransaction(data::TransactionAndMetadata const& txMeta, ripple::LedgerHeader const& lgrInfo) SubscriptionManager::pubTransaction(data::TransactionAndMetadata const& txMeta, xrpl::LedgerHeader const& lgrInfo)
{ {
transactionFeed_.pub(txMeta, lgrInfo, backend_, amendmentCenter_, networkID_); transactionFeed_.pub(txMeta, lgrInfo, backend_, amendmentCenter_, networkID_);
} }

View File

@@ -160,7 +160,7 @@ public:
*/ */
void void
pubBookChanges( pubBookChanges(
ripple::LedgerHeader const& lgrInfo, xrpl::LedgerHeader const& lgrInfo,
std::vector<data::TransactionAndMetadata> const& transactions std::vector<data::TransactionAndMetadata> const& transactions
) final; ) final;
@@ -184,7 +184,7 @@ public:
* @param subscriber * @param subscriber
*/ */
void void
subProposedAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) final; subProposedAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) final;
/** /**
* @brief Unsubscribe to the proposed transactions feed for particular account. * @brief Unsubscribe to the proposed transactions feed for particular account.
@@ -192,7 +192,7 @@ public:
* @param subscriber * @param subscriber
*/ */
void void
unsubProposedAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) final; unsubProposedAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) final;
/** /**
* @brief Forward the proposed transactions feed. * @brief Forward the proposed transactions feed.
@@ -226,8 +226,8 @@ public:
*/ */
void void
pubLedger( pubLedger(
ripple::LedgerHeader const& lgrInfo, xrpl::LedgerHeader const& lgrInfo,
ripple::Fees const& fees, xrpl::Fees const& fees,
std::string const& ledgerRange, std::string const& ledgerRange,
std::uint32_t txnCount std::uint32_t txnCount
) final; ) final;
@@ -294,7 +294,7 @@ public:
* @param subscriber * @param subscriber
*/ */
void void
subAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) final; subAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) final;
/** /**
* @brief Unsubscribe to the transactions feed for particular account. * @brief Unsubscribe to the transactions feed for particular account.
@@ -302,7 +302,7 @@ public:
* @param subscriber The subscriber to unsubscribe * @param subscriber The subscriber to unsubscribe
*/ */
void void
unsubAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) final; unsubAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) final;
/** /**
* @brief Subscribe to the transactions feed, only receive feed when particular order book is affected. * @brief Subscribe to the transactions feed, only receive feed when particular order book is affected.
@@ -310,7 +310,7 @@ public:
* @param subscriber * @param subscriber
*/ */
void void
subBook(ripple::Book const& book, SubscriberSharedPtr const& subscriber) final; subBook(xrpl::Book const& book, SubscriberSharedPtr const& subscriber) final;
/** /**
* @brief Unsubscribe to the transactions feed for particular order book. * @brief Unsubscribe to the transactions feed for particular order book.
@@ -318,7 +318,7 @@ public:
* @param subscriber * @param subscriber
*/ */
void void
unsubBook(ripple::Book const& book, SubscriberSharedPtr const& subscriber) final; unsubBook(xrpl::Book const& book, SubscriberSharedPtr const& subscriber) final;
/** /**
* @brief Forward the transactions feed. * @brief Forward the transactions feed.
@@ -326,7 +326,7 @@ public:
* @param lgrInfo The ledger header. * @param lgrInfo The ledger header.
*/ */
void void
pubTransaction(data::TransactionAndMetadata const& txMeta, ripple::LedgerHeader const& lgrInfo) final; pubTransaction(data::TransactionAndMetadata const& txMeta, xrpl::LedgerHeader const& lgrInfo) final;
/** /**
* @brief Get the number of subscribers. * @brief Get the number of subscribers.

View File

@@ -72,7 +72,7 @@ public:
*/ */
virtual void virtual void
pubBookChanges( pubBookChanges(
ripple::LedgerHeader const& lgrInfo, xrpl::LedgerHeader const& lgrInfo,
std::vector<data::TransactionAndMetadata> const& transactions std::vector<data::TransactionAndMetadata> const& transactions
) = 0; ) = 0;
@@ -96,7 +96,7 @@ public:
* @param subscriber * @param subscriber
*/ */
virtual void virtual void
subProposedAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0; subProposedAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0;
/** /**
* @brief Unsubscribe to the proposed transactions feed for particular account. * @brief Unsubscribe to the proposed transactions feed for particular account.
@@ -104,7 +104,7 @@ public:
* @param subscriber * @param subscriber
*/ */
virtual void virtual void
unsubProposedAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0; unsubProposedAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0;
/** /**
* @brief Forward the proposed transactions feed. * @brief Forward the proposed transactions feed.
@@ -139,8 +139,8 @@ public:
*/ */
virtual void virtual void
pubLedger( pubLedger(
ripple::LedgerHeader const& lgrInfo, xrpl::LedgerHeader const& lgrInfo,
ripple::Fees const& fees, xrpl::Fees const& fees,
std::string const& ledgerRange, std::string const& ledgerRange,
std::uint32_t txnCount std::uint32_t txnCount
) = 0; ) = 0;
@@ -207,7 +207,7 @@ public:
* @param subscriber * @param subscriber
*/ */
virtual void virtual void
subAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0; subAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0;
/** /**
* @brief Unsubscribe to the transactions feed for particular account. * @brief Unsubscribe to the transactions feed for particular account.
@@ -215,7 +215,7 @@ public:
* @param subscriber The subscriber to unsubscribe * @param subscriber The subscriber to unsubscribe
*/ */
virtual void virtual void
unsubAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0; unsubAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0;
/** /**
* @brief Subscribe to the transactions feed, only receive feed when particular order book is affected. * @brief Subscribe to the transactions feed, only receive feed when particular order book is affected.
@@ -223,7 +223,7 @@ public:
* @param subscriber * @param subscriber
*/ */
virtual void virtual void
subBook(ripple::Book const& book, SubscriberSharedPtr const& subscriber) = 0; subBook(xrpl::Book const& book, SubscriberSharedPtr const& subscriber) = 0;
/** /**
* @brief Unsubscribe to the transactions feed for particular order book. * @brief Unsubscribe to the transactions feed for particular order book.
@@ -231,7 +231,7 @@ public:
* @param subscriber * @param subscriber
*/ */
virtual void virtual void
unsubBook(ripple::Book const& book, SubscriberSharedPtr const& subscriber) = 0; unsubBook(xrpl::Book const& book, SubscriberSharedPtr const& subscriber) = 0;
/** /**
* @brief Forward the transactions feed. * @brief Forward the transactions feed.
@@ -239,7 +239,7 @@ public:
* @param lgrInfo The ledger header. * @param lgrInfo The ledger header.
*/ */
virtual void virtual void
pubTransaction(data::TransactionAndMetadata const& txMeta, ripple::LedgerHeader const& lgrInfo) = 0; pubTransaction(data::TransactionAndMetadata const& txMeta, xrpl::LedgerHeader const& lgrInfo) = 0;
/** /**
* @brief Get the number of subscribers. * @brief Get the number of subscribers.

View File

@@ -48,7 +48,7 @@ struct BookChangesFeed : public SingleFeedBase {
* @param transactions The transactions that were included in the ledger. * @param transactions The transactions that were included in the ledger.
*/ */
void void
pub(ripple::LedgerHeader const& lgrInfo, std::vector<data::TransactionAndMetadata> const& transactions) pub(xrpl::LedgerHeader const& lgrInfo, std::vector<data::TransactionAndMetadata> const& transactions)
{ {
SingleFeedBase::pub(boost::json::serialize(rpc::computeBookChanges(lgrInfo, transactions))); SingleFeedBase::pub(boost::json::serialize(rpc::computeBookChanges(lgrInfo, transactions)));
} }

View File

@@ -41,8 +41,8 @@ namespace feed::impl {
boost::json::object boost::json::object
LedgerFeed::makeLedgerPubMessage( LedgerFeed::makeLedgerPubMessage(
ripple::LedgerHeader const& lgrInfo, xrpl::LedgerHeader const& lgrInfo,
ripple::Fees const& fees, xrpl::Fees const& fees,
std::string const& ledgerRange, std::string const& ledgerRange,
uint32_t const txnCount, uint32_t const txnCount,
uint32_t const networkID uint32_t const networkID
@@ -93,8 +93,8 @@ LedgerFeed::sub(
void void
LedgerFeed::pub( LedgerFeed::pub(
ripple::LedgerHeader const& lgrInfo, xrpl::LedgerHeader const& lgrInfo,
ripple::Fees const& fees, xrpl::Fees const& fees,
std::string const& ledgerRange, std::string const& ledgerRange,
uint32_t const txnCount, uint32_t const txnCount,
uint32_t const networkID uint32_t const networkID

View File

@@ -77,8 +77,8 @@ public:
* @param networkID The network ID. * @param networkID The network ID.
*/ */
void void
pub(ripple::LedgerHeader const& lgrInfo, pub(xrpl::LedgerHeader const& lgrInfo,
ripple::Fees const& fees, xrpl::Fees const& fees,
std::string const& ledgerRange, std::string const& ledgerRange,
uint32_t txnCount, uint32_t txnCount,
uint32_t networkID); uint32_t networkID);
@@ -86,8 +86,8 @@ public:
private: private:
static boost::json::object static boost::json::object
makeLedgerPubMessage( makeLedgerPubMessage(
ripple::LedgerHeader const& lgrInfo, xrpl::LedgerHeader const& lgrInfo,
ripple::Fees const& fees, xrpl::Fees const& fees,
std::string const& ledgerRange, std::string const& ledgerRange,
uint32_t txnCount, uint32_t txnCount,
uint32_t networkID uint32_t networkID

View File

@@ -53,7 +53,7 @@ ProposedTransactionFeed::sub(SubscriberSharedPtr const& subscriber)
} }
void void
ProposedTransactionFeed::sub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) ProposedTransactionFeed::sub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{ {
auto const weakPtr = std::weak_ptr(subscriber); auto const weakPtr = std::weak_ptr(subscriber);
auto const added = accountSignal_.connectTrackableSlot( auto const added = accountSignal_.connectTrackableSlot(
@@ -82,7 +82,7 @@ ProposedTransactionFeed::unsub(SubscriberSharedPtr const& subscriber)
} }
void void
ProposedTransactionFeed::unsub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) ProposedTransactionFeed::unsub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{ {
unsubInternal(account, subscriber.get()); unsubInternal(account, subscriber.get());
} }
@@ -94,7 +94,7 @@ ProposedTransactionFeed::pub(boost::json::object const& receivedTxJson)
auto const transaction = receivedTxJson.at("transaction").as_object(); auto const transaction = receivedTxJson.at("transaction").as_object();
auto const accounts = rpc::getAccountsFromTransaction(transaction); auto const accounts = rpc::getAccountsFromTransaction(transaction);
auto affectedAccounts = std::unordered_set<ripple::AccountID>(accounts.cbegin(), accounts.cend()); auto affectedAccounts = std::unordered_set<xrpl::AccountID>(accounts.cbegin(), accounts.cend());
[[maybe_unused]] auto task = [[maybe_unused]] auto task =
strand_.execute([this, pubMsg = std::move(pubMsg), affectedAccounts = std::move(affectedAccounts)]() { strand_.execute([this, pubMsg = std::move(pubMsg), affectedAccounts = std::move(affectedAccounts)]() {
@@ -132,7 +132,7 @@ ProposedTransactionFeed::unsubInternal(SubscriberPtr subscriber)
} }
void void
ProposedTransactionFeed::unsubInternal(ripple::AccountID const& account, SubscriberPtr subscriber) ProposedTransactionFeed::unsubInternal(xrpl::AccountID const& account, SubscriberPtr subscriber)
{ {
if (accountSignal_.disconnect(subscriber, account)) { if (accountSignal_.disconnect(subscriber, account)) {
LOG(logger_.info()) << subscriber->tag() << "Unsubscribed accounts_proposed " << account; LOG(logger_.info()) << subscriber->tag() << "Unsubscribed accounts_proposed " << account;

View File

@@ -57,7 +57,7 @@ class ProposedTransactionFeed {
std::reference_wrapper<util::prometheus::GaugeInt> subAllCount_; std::reference_wrapper<util::prometheus::GaugeInt> subAllCount_;
std::reference_wrapper<util::prometheus::GaugeInt> subAccountCount_; std::reference_wrapper<util::prometheus::GaugeInt> subAccountCount_;
TrackableSignalMap<ripple::AccountID, Subscriber, std::shared_ptr<std::string>> accountSignal_; TrackableSignalMap<xrpl::AccountID, Subscriber, std::shared_ptr<std::string>> accountSignal_;
TrackableSignal<Subscriber, std::shared_ptr<std::string>> signal_; TrackableSignal<Subscriber, std::shared_ptr<std::string>> signal_;
public: public:
@@ -86,7 +86,7 @@ public:
* @param account The account to watch. * @param account The account to watch.
*/ */
void void
sub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber); sub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber);
/** /**
* @brief Unsubscribe to the proposed transaction feed. * @brief Unsubscribe to the proposed transaction feed.
@@ -101,7 +101,7 @@ public:
* @param account The account to unsubscribe. * @param account The account to unsubscribe.
*/ */
void void
unsub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber); unsub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber);
/** /**
* @brief Publishes the proposed transaction feed. * @brief Publishes the proposed transaction feed.
@@ -127,6 +127,6 @@ private:
unsubInternal(SubscriberPtr subscriber); unsubInternal(SubscriberPtr subscriber);
void void
unsubInternal(ripple::AccountID const& account, SubscriberPtr subscriber); unsubInternal(xrpl::AccountID const& account, SubscriberPtr subscriber);
}; };
} // namespace feed::impl } // namespace feed::impl

View File

@@ -37,6 +37,7 @@
#include <xrpl/json/json_value.h> #include <xrpl/json/json_value.h>
#include <xrpl/protocol/AccountID.h> #include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Book.h> #include <xrpl/protocol/Book.h>
#include <xrpl/protocol/Issue.h>
#include <xrpl/protocol/LedgerFormats.h> #include <xrpl/protocol/LedgerFormats.h>
#include <xrpl/protocol/LedgerHeader.h> #include <xrpl/protocol/LedgerHeader.h>
#include <xrpl/protocol/NFTSyntheticSerializer.h> #include <xrpl/protocol/NFTSyntheticSerializer.h>
@@ -85,7 +86,7 @@ TransactionFeed::sub(SubscriberSharedPtr const& subscriber)
} }
void void
TransactionFeed::sub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) TransactionFeed::sub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{ {
auto const added = accountSignal_.connectTrackableSlot(subscriber, account, TransactionSlot(*this, subscriber)); auto const added = accountSignal_.connectTrackableSlot(subscriber, account, TransactionSlot(*this, subscriber));
if (added) { if (added) {
@@ -105,7 +106,7 @@ TransactionFeed::subProposed(SubscriberSharedPtr const& subscriber)
} }
void void
TransactionFeed::subProposed(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) TransactionFeed::subProposed(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{ {
auto const added = auto const added =
accountProposedSignal_.connectTrackableSlot(subscriber, account, TransactionSlot(*this, subscriber)); accountProposedSignal_.connectTrackableSlot(subscriber, account, TransactionSlot(*this, subscriber));
@@ -117,7 +118,7 @@ TransactionFeed::subProposed(ripple::AccountID const& account, SubscriberSharedP
} }
void void
TransactionFeed::sub(ripple::Book const& book, SubscriberSharedPtr const& subscriber) TransactionFeed::sub(xrpl::Book const& book, SubscriberSharedPtr const& subscriber)
{ {
auto const added = bookSignal_.connectTrackableSlot(subscriber, book, TransactionSlot(*this, subscriber)); auto const added = bookSignal_.connectTrackableSlot(subscriber, book, TransactionSlot(*this, subscriber));
if (added) { if (added) {
@@ -134,7 +135,7 @@ TransactionFeed::unsub(SubscriberSharedPtr const& subscriber)
} }
void void
TransactionFeed::unsub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) TransactionFeed::unsub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{ {
unsubInternal(account, subscriber.get()); unsubInternal(account, subscriber.get());
} }
@@ -146,13 +147,13 @@ TransactionFeed::unsubProposed(SubscriberSharedPtr const& subscriber)
} }
void void
TransactionFeed::unsubProposed(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) TransactionFeed::unsubProposed(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{ {
unsubProposedInternal(account, subscriber.get()); unsubProposedInternal(account, subscriber.get());
} }
void void
TransactionFeed::unsub(ripple::Book const& book, SubscriberSharedPtr const& subscriber) TransactionFeed::unsub(xrpl::Book const& book, SubscriberSharedPtr const& subscriber)
{ {
unsubInternal(book, subscriber.get()); unsubInternal(book, subscriber.get());
} }
@@ -178,7 +179,7 @@ TransactionFeed::bookSubCount() const
void void
TransactionFeed::pub( TransactionFeed::pub(
data::TransactionAndMetadata const& txMeta, data::TransactionAndMetadata const& txMeta,
ripple::LedgerHeader const& lgrInfo, xrpl::LedgerHeader const& lgrInfo,
std::shared_ptr<data::BackendInterface const> const& backend, std::shared_ptr<data::BackendInterface const> const& backend,
std::shared_ptr<data::AmendmentCenterInterface const> const& amendmentCenter, std::shared_ptr<data::AmendmentCenterInterface const> const& amendmentCenter,
uint32_t const networkID uint32_t const networkID
@@ -186,12 +187,12 @@ TransactionFeed::pub(
{ {
auto [tx, meta] = rpc::deserializeTxPlusMeta(txMeta, lgrInfo.seq); auto [tx, meta] = rpc::deserializeTxPlusMeta(txMeta, lgrInfo.seq);
std::optional<ripple::STAmount> ownerFunds; std::optional<xrpl::STAmount> ownerFunds;
if (tx->getTxnType() == ripple::ttOFFER_CREATE) { if (tx->getTxnType() == xrpl::ttOFFER_CREATE) {
auto const account = tx->getAccountID(ripple::sfAccount); auto const account = tx->getAccountID(xrpl::sfAccount);
auto const amount = tx->getFieldAmount(ripple::sfTakerGets); auto const amount = tx->getFieldAmount(xrpl::sfTakerGets);
if (account != amount.issue().account) { if (account != amount.get<xrpl::Issue>().account) {
auto fetchFundsSynchronous = [&]() { auto fetchFundsSynchronous = [&]() {
data::synchronous([&](boost::asio::yield_context yield) { data::synchronous([&](boost::asio::yield_context yield) {
ownerFunds = rpc::accountFunds(*backend, *amendmentCenter, lgrInfo.seq, amount, account, yield); ownerFunds = rpc::accountFunds(*backend, *amendmentCenter, lgrInfo.seq, amount, account, yield);
@@ -213,8 +214,8 @@ TransactionFeed::pub(
rpc::insertDeliverMaxAlias(txnPubobj, version); rpc::insertDeliverMaxAlias(txnPubobj, version);
rpc::insertMPTIssuanceID(txnPubobj, tx, metaPubobj, meta); rpc::insertMPTIssuanceID(txnPubobj, tx, metaPubobj, meta);
Json::Value nftJson; json::Value nftJson;
ripple::RPC::insertNFTSyntheticInJson(nftJson, tx, *meta); xrpl::RPC::insertNFTSyntheticInJson(nftJson, tx, *meta);
auto const nftBoostJson = rpc::toBoostJson(nftJson).as_object(); auto const nftBoostJson = rpc::toBoostJson(nftJson).as_object();
if (nftBoostJson.contains(JS(meta)) && nftBoostJson.at(JS(meta)).is_object()) { if (nftBoostJson.contains(JS(meta)) && nftBoostJson.at(JS(meta)).is_object()) {
auto& metaObjInPub = pubObj.at(JS(meta)).as_object(); auto& metaObjInPub = pubObj.at(JS(meta)).as_object();
@@ -235,10 +236,10 @@ TransactionFeed::pub(
pubObj[JS(type)] = "transaction"; pubObj[JS(type)] = "transaction";
pubObj[JS(validated)] = true; pubObj[JS(validated)] = true;
pubObj[JS(status)] = "closed"; pubObj[JS(status)] = "closed";
pubObj[JS(close_time_iso)] = ripple::to_string_iso(lgrInfo.closeTime); pubObj[JS(close_time_iso)] = xrpl::toStringIso(lgrInfo.closeTime);
pubObj[JS(ledger_index)] = lgrInfo.seq; pubObj[JS(ledger_index)] = lgrInfo.seq;
pubObj[JS(ledger_hash)] = ripple::strHex(lgrInfo.hash); pubObj[JS(ledger_hash)] = xrpl::strHex(lgrInfo.hash);
if (version >= 2u) { if (version >= 2u) {
if (pubObj[txKey].as_object().contains(JS(hash))) { if (pubObj[txKey].as_object().contains(JS(hash))) {
pubObj[JS(hash)] = pubObj[txKey].as_object()[JS(hash)]; pubObj[JS(hash)] = pubObj[txKey].as_object()[JS(hash)];
@@ -250,7 +251,7 @@ TransactionFeed::pub(
pubObj[JS(engine_result_code)] = meta->getResult(); pubObj[JS(engine_result_code)] = meta->getResult();
std::string token; std::string token;
std::string human; std::string human;
ripple::transResultInfo(meta->getResultTER(), token, human); xrpl::transResultInfo(meta->getResultTER(), token, human);
pubObj[JS(engine_result)] = token; pubObj[JS(engine_result)] = token;
pubObj[JS(engine_result_message)] = human; pubObj[JS(engine_result_message)] = human;
@@ -267,34 +268,34 @@ TransactionFeed::pub(
auto const affectedAccountsFlat = meta->getAffectedAccounts(); auto const affectedAccountsFlat = meta->getAffectedAccounts();
auto affectedAccounts = auto affectedAccounts =
std::unordered_set<ripple::AccountID>(affectedAccountsFlat.cbegin(), affectedAccountsFlat.cend()); std::unordered_set<xrpl::AccountID>(affectedAccountsFlat.cbegin(), affectedAccountsFlat.cend());
std::unordered_set<ripple::Book> affectedBooks; std::unordered_set<xrpl::Book> affectedBooks;
for (auto const& node : meta->getNodes()) { for (auto const& node : meta->getNodes()) {
if (node.getFieldU16(ripple::sfLedgerEntryType) == ripple::ltOFFER) { if (node.getFieldU16(xrpl::sfLedgerEntryType) == xrpl::ltOFFER) {
ripple::SField const* field = nullptr; xrpl::SField const* field = nullptr;
// We need a field that contains the TakerGets and TakerPays // We need a field that contains the TakerGets and TakerPays
// parameters. // parameters.
if (node.getFName() == ripple::sfModifiedNode) { if (node.getFName() == xrpl::sfModifiedNode) {
field = &ripple::sfPreviousFields; field = &xrpl::sfPreviousFields;
} else if (node.getFName() == ripple::sfCreatedNode) { } else if (node.getFName() == xrpl::sfCreatedNode) {
field = &ripple::sfNewFields; field = &xrpl::sfNewFields;
} else if (node.getFName() == ripple::sfDeletedNode) { } else if (node.getFName() == xrpl::sfDeletedNode) {
field = &ripple::sfFinalFields; field = &xrpl::sfFinalFields;
} }
if (field != nullptr) { if (field != nullptr) {
auto const data = dynamic_cast<ripple::STObject const*>(node.peekAtPField(*field)); auto const data = dynamic_cast<xrpl::STObject const*>(node.peekAtPField(*field));
if ((data != nullptr) && data->isFieldPresent(ripple::sfTakerPays) && if ((data != nullptr) && data->isFieldPresent(xrpl::sfTakerPays) &&
data->isFieldPresent(ripple::sfTakerGets)) { data->isFieldPresent(xrpl::sfTakerGets)) {
// determine the OrderBook // determine the OrderBook
ripple::Book const book{ xrpl::Book const book{
data->getFieldAmount(ripple::sfTakerGets).issue(), data->getFieldAmount(xrpl::sfTakerGets).get<xrpl::Issue>(),
data->getFieldAmount(ripple::sfTakerPays).issue(), data->getFieldAmount(xrpl::sfTakerPays).get<xrpl::Issue>(),
(*data)[~ripple::sfDomainID] (*data)[~xrpl::sfDomainID]
}; };
if (!affectedBooks.contains(book)) { if (!affectedBooks.contains(book)) {
affectedBooks.insert(book); affectedBooks.insert(book);
@@ -340,7 +341,7 @@ TransactionFeed::unsubInternal(SubscriberPtr subscriber)
} }
void void
TransactionFeed::unsubInternal(ripple::AccountID const& account, SubscriberPtr subscriber) TransactionFeed::unsubInternal(xrpl::AccountID const& account, SubscriberPtr subscriber)
{ {
if (accountSignal_.disconnect(subscriber, account)) { if (accountSignal_.disconnect(subscriber, account)) {
LOG(logger_.info()) << subscriber->tag() << "Unsubscribed account " << account; LOG(logger_.info()) << subscriber->tag() << "Unsubscribed account " << account;
@@ -355,13 +356,13 @@ TransactionFeed::unsubProposedInternal(SubscriberPtr subscriber)
} }
void void
TransactionFeed::unsubProposedInternal(ripple::AccountID const& account, SubscriberPtr subscriber) TransactionFeed::unsubProposedInternal(xrpl::AccountID const& account, SubscriberPtr subscriber)
{ {
accountProposedSignal_.disconnect(subscriber, account); accountProposedSignal_.disconnect(subscriber, account);
} }
void void
TransactionFeed::unsubInternal(ripple::Book const& book, SubscriberPtr subscriber) TransactionFeed::unsubInternal(xrpl::Book const& book, SubscriberPtr subscriber)
{ {
if (bookSignal_.disconnect(subscriber, book)) { if (bookSignal_.disconnect(subscriber, book)) {
LOG(logger_.info()) << subscriber->tag() << "Unsubscribed book " << book; LOG(logger_.info()) << subscriber->tag() << "Unsubscribed book " << book;

View File

@@ -71,12 +71,12 @@ class TransactionFeed {
std::reference_wrapper<util::prometheus::GaugeInt> subAccountCount_; std::reference_wrapper<util::prometheus::GaugeInt> subAccountCount_;
std::reference_wrapper<util::prometheus::GaugeInt> subBookCount_; std::reference_wrapper<util::prometheus::GaugeInt> subBookCount_;
TrackableSignalMap<ripple::AccountID, Subscriber, AllVersionTransactionsType const&> accountSignal_; TrackableSignalMap<xrpl::AccountID, Subscriber, AllVersionTransactionsType const&> accountSignal_;
TrackableSignalMap<ripple::Book, Subscriber, AllVersionTransactionsType const&> bookSignal_; TrackableSignalMap<xrpl::Book, Subscriber, AllVersionTransactionsType const&> bookSignal_;
TrackableSignal<Subscriber, AllVersionTransactionsType const&> signal_; TrackableSignal<Subscriber, AllVersionTransactionsType const&> signal_;
// Signals for proposed tx subscribers // Signals for proposed tx subscribers
TrackableSignalMap<ripple::AccountID, Subscriber, AllVersionTransactionsType const&> accountProposedSignal_; TrackableSignalMap<xrpl::AccountID, Subscriber, AllVersionTransactionsType const&> accountProposedSignal_;
TrackableSignal<Subscriber, AllVersionTransactionsType const&> txProposedSignal_; TrackableSignal<Subscriber, AllVersionTransactionsType const&> txProposedSignal_;
std::unordered_set<SubscriberPtr> std::unordered_set<SubscriberPtr>
@@ -113,7 +113,7 @@ public:
* @param account The account to watch. * @param account The account to watch.
*/ */
void void
sub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber); sub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber);
/** /**
* @brief Subscribe to the transaction feed, only receive the feed when particular order book is affected. * @brief Subscribe to the transaction feed, only receive the feed when particular order book is affected.
@@ -121,7 +121,7 @@ public:
* @param book The order book to watch. * @param book The order book to watch.
*/ */
void void
sub(ripple::Book const& book, SubscriberSharedPtr const& subscriber); sub(xrpl::Book const& book, SubscriberSharedPtr const& subscriber);
/** /**
* @brief Subscribe to the transaction feed for proposed transaction stream. * @brief Subscribe to the transaction feed for proposed transaction stream.
@@ -137,7 +137,7 @@ public:
* @param account The account to watch. * @param account The account to watch.
*/ */
void void
subProposed(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber); subProposed(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber);
/** /**
* @brief Unsubscribe to the transaction feed. * @brief Unsubscribe to the transaction feed.
@@ -152,7 +152,7 @@ public:
* @param account The account to unsubscribe. * @param account The account to unsubscribe.
*/ */
void void
unsub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber); unsub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber);
/** /**
* @brief Unsubscribe to the transaction feed for proposed transaction stream. * @brief Unsubscribe to the transaction feed for proposed transaction stream.
@@ -167,7 +167,7 @@ public:
* @param account The account to unsubscribe. * @param account The account to unsubscribe.
*/ */
void void
unsubProposed(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber); unsubProposed(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber);
/** /**
* @brief Unsubscribe to the transaction feed for particular order book. * @brief Unsubscribe to the transaction feed for particular order book.
@@ -175,7 +175,7 @@ public:
* @param book The book to unsubscribe. * @param book The book to unsubscribe.
*/ */
void void
unsub(ripple::Book const& book, SubscriberSharedPtr const& subscriber); unsub(xrpl::Book const& book, SubscriberSharedPtr const& subscriber);
/** /**
* @brief Publishes the transaction feed. * @brief Publishes the transaction feed.
@@ -186,7 +186,7 @@ public:
*/ */
void void
pub(data::TransactionAndMetadata const& txMeta, pub(data::TransactionAndMetadata const& txMeta,
ripple::LedgerHeader const& lgrInfo, xrpl::LedgerHeader const& lgrInfo,
std::shared_ptr<data::BackendInterface const> const& backend, std::shared_ptr<data::BackendInterface const> const& backend,
std::shared_ptr<data::AmendmentCenterInterface const> const& amendmentCenter, std::shared_ptr<data::AmendmentCenterInterface const> const& amendmentCenter,
uint32_t networkID); uint32_t networkID);
@@ -214,15 +214,15 @@ private:
unsubInternal(SubscriberPtr subscriber); unsubInternal(SubscriberPtr subscriber);
void void
unsubInternal(ripple::AccountID const& account, SubscriberPtr subscriber); unsubInternal(xrpl::AccountID const& account, SubscriberPtr subscriber);
void void
unsubProposedInternal(SubscriberPtr subscriber); unsubProposedInternal(SubscriberPtr subscriber);
void void
unsubProposedInternal(ripple::AccountID const& account, SubscriberPtr subscriber); unsubProposedInternal(xrpl::AccountID const& account, SubscriberPtr subscriber);
void void
unsubInternal(ripple::Book const& book, SubscriberPtr subscriber); unsubInternal(xrpl::Book const& book, SubscriberPtr subscriber);
}; };
} // namespace feed::impl } // namespace feed::impl

View File

@@ -36,7 +36,7 @@ ObjectsAdapter::onRowRead(TableObjectsDesc::Row const& row)
onStateRead_(ledgerSeq, std::nullopt); onStateRead_(ledgerSeq, std::nullopt);
return; return;
} }
ripple::SLE sle{ripple::SerialIter{blob.data(), blob.size()}, key}; xrpl::SLE sle{xrpl::SerialIter{blob.data(), blob.size()}, key};
onStateRead_(ledgerSeq, std::make_optional(std::move(sle))); onStateRead_(ledgerSeq, std::make_optional(std::move(sle)));
} }

View File

@@ -41,7 +41,7 @@ namespace migration::cassandra::impl {
* @brief The description of the objects table. It has to be a TableSpec. * @brief The description of the objects table. It has to be a TableSpec.
*/ */
struct TableObjectsDesc { struct TableObjectsDesc {
using Row = std::tuple<ripple::uint256, std::uint32_t, data::Blob>; using Row = std::tuple<xrpl::uint256, std::uint32_t, data::Blob>;
static constexpr char const* kPARTITION_KEY = "key"; static constexpr char const* kPARTITION_KEY = "key";
static constexpr char const* kTABLE_NAME = "objects"; static constexpr char const* kTABLE_NAME = "objects";
}; };
@@ -52,7 +52,7 @@ struct TableObjectsDesc {
*/ */
class ObjectsAdapter : public impl::FullTableScannerAdapterBase<TableObjectsDesc> { class ObjectsAdapter : public impl::FullTableScannerAdapterBase<TableObjectsDesc> {
public: public:
using OnStateRead = std::function<void(std::uint32_t, std::optional<ripple::SLE>)>; using OnStateRead = std::function<void(std::uint32_t, std::optional<xrpl::SLE>)>;
/** /**
* @brief Construct a new Objects Adapter object * @brief Construct a new Objects Adapter object

View File

@@ -30,9 +30,9 @@ TransactionsAdapter::onRowRead(TableTransactionsDesc::Row const& row)
{ {
auto const& [txHash, date, ledgerSeq, metaBlob, txBlob] = row; auto const& [txHash, date, ledgerSeq, metaBlob, txBlob] = row;
ripple::SerialIter it{txBlob.data(), txBlob.size()}; xrpl::SerialIter it{txBlob.data(), txBlob.size()};
ripple::STTx const sttx{it}; xrpl::STTx const sttx{it};
ripple::TxMeta const txMeta{sttx.getTransactionID(), ledgerSeq, metaBlob}; xrpl::TxMeta const txMeta{sttx.getTransactionID(), ledgerSeq, metaBlob};
onTransactionRead_(sttx, txMeta); onTransactionRead_(sttx, txMeta);
} }
} // namespace migration::cassandra::impl } // namespace migration::cassandra::impl

View File

@@ -41,7 +41,7 @@ namespace migration::cassandra::impl {
*/ */
struct TableTransactionsDesc { struct TableTransactionsDesc {
// hash, date, ledger_seq, metadata, transaction // hash, date, ledger_seq, metadata, transaction
using Row = std::tuple<ripple::uint256, std::uint64_t, std::uint32_t, ripple::Blob, ripple::Blob>; using Row = std::tuple<xrpl::uint256, std::uint64_t, std::uint32_t, xrpl::Blob, xrpl::Blob>;
static constexpr char const* kPARTITION_KEY = "hash"; static constexpr char const* kPARTITION_KEY = "hash";
static constexpr char const* kTABLE_NAME = "transactions"; static constexpr char const* kTABLE_NAME = "transactions";
}; };
@@ -52,7 +52,7 @@ struct TableTransactionsDesc {
*/ */
class TransactionsAdapter : public impl::FullTableScannerAdapterBase<TableTransactionsDesc> { class TransactionsAdapter : public impl::FullTableScannerAdapterBase<TableTransactionsDesc> {
public: public:
using OnTransactionRead = std::function<void(ripple::STTx, ripple::TxMeta)>; using OnTransactionRead = std::function<void(xrpl::STTx, xrpl::TxMeta)>;
/** /**
* @brief Construct a new Transactions Adapter object * @brief Construct a new Transactions Adapter object

View File

@@ -36,14 +36,14 @@
namespace rpc { namespace rpc {
std::pair<ripple::STAmount, ripple::STAmount> std::pair<xrpl::STAmount, xrpl::STAmount>
getAmmPoolHolds( getAmmPoolHolds(
BackendInterface const& backend, BackendInterface const& backend,
data::AmendmentCenterInterface const& amendmentCenter, data::AmendmentCenterInterface const& amendmentCenter,
std::uint32_t sequence, std::uint32_t sequence,
ripple::AccountID const& ammAccountID, xrpl::AccountID const& ammAccountID,
ripple::Issue const& issue1, xrpl::Issue const& issue1,
ripple::Issue const& issue2, xrpl::Issue const& issue2,
bool freezeHandling, bool freezeHandling,
boost::asio::yield_context yield boost::asio::yield_context yield
) )
@@ -57,38 +57,38 @@ getAmmPoolHolds(
return std::make_pair(assetInBalance, assetOutBalance); return std::make_pair(assetInBalance, assetOutBalance);
} }
ripple::STAmount xrpl::STAmount
getAmmLpHolds( getAmmLpHolds(
BackendInterface const& backend, BackendInterface const& backend,
std::uint32_t sequence, std::uint32_t sequence,
ripple::Currency const& cur1, xrpl::Issue const& iss1,
ripple::Currency const& cur2, xrpl::Issue const& iss2,
ripple::AccountID const& ammAccount, xrpl::AccountID const& ammAccount,
ripple::AccountID const& lpAccount, xrpl::AccountID const& lpAccount,
boost::asio::yield_context yield boost::asio::yield_context yield
) )
{ {
auto const lptCurrency = ammLPTCurrency(cur1, cur2); auto const lptCurrency = ammLPTCurrency(iss1, iss2);
// not using accountHolds because we don't need to check if the associated tokens of the LP are frozen // not using accountHolds because we don't need to check if the associated tokens of the LP are frozen
return ammAccountHolds(backend, sequence, lpAccount, lptCurrency, ammAccount, true, yield); return ammAccountHolds(backend, sequence, lpAccount, lptCurrency, ammAccount, true, yield);
} }
ripple::STAmount xrpl::STAmount
getAmmLpHolds( getAmmLpHolds(
BackendInterface const& backend, BackendInterface const& backend,
std::uint32_t sequence, std::uint32_t sequence,
ripple::SLE const& ammSle, xrpl::SLE const& ammSle,
ripple::AccountID const& lpAccount, xrpl::AccountID const& lpAccount,
boost::asio::yield_context yield boost::asio::yield_context yield
) )
{ {
return getAmmLpHolds( return getAmmLpHolds(
backend, backend,
sequence, sequence,
ammSle[ripple::sfAsset].get<ripple::Issue>().currency, ammSle[xrpl::sfAsset].get<xrpl::Issue>(),
ammSle[ripple::sfAsset2].get<ripple::Issue>().currency, ammSle[xrpl::sfAsset2].get<xrpl::Issue>(),
ammSle[ripple::sfAccount], ammSle[xrpl::sfAccount],
lpAccount, lpAccount,
yield yield
); );

View File

@@ -47,14 +47,14 @@ namespace rpc {
* @param yield The coroutine context * @param yield The coroutine context
* @return The balances of the amm asset pair * @return The balances of the amm asset pair
*/ */
std::pair<ripple::STAmount, ripple::STAmount> std::pair<xrpl::STAmount, xrpl::STAmount>
getAmmPoolHolds( getAmmPoolHolds(
BackendInterface const& backend, BackendInterface const& backend,
data::AmendmentCenterInterface const& amendmentCenter, data::AmendmentCenterInterface const& amendmentCenter,
std::uint32_t sequence, std::uint32_t sequence,
ripple::AccountID const& ammAccountID, xrpl::AccountID const& ammAccountID,
ripple::Issue const& issue1, xrpl::Issue const& issue1,
ripple::Issue const& issue2, xrpl::Issue const& issue2,
bool freezeHandling, bool freezeHandling,
boost::asio::yield_context yield boost::asio::yield_context yield
); );
@@ -64,21 +64,21 @@ getAmmPoolHolds(
* *
* @param backend The backend to use * @param backend The backend to use
* @param sequence The sequence number to use * @param sequence The sequence number to use
* @param cur1 The first currency * @param iss1 The first issue
* @param cur2 The second currency * @param iss2 The second issue
* @param ammAccount The amm account * @param ammAccount The amm account
* @param lpAccount The lp account * @param lpAccount The lp account
* @param yield The coroutine context * @param yield The coroutine context
* @return The lp token balance * @return The lp token balance
*/ */
ripple::STAmount xrpl::STAmount
getAmmLpHolds( getAmmLpHolds(
BackendInterface const& backend, BackendInterface const& backend,
std::uint32_t sequence, std::uint32_t sequence,
ripple::Currency const& cur1, xrpl::Issue const& iss1,
ripple::Currency const& cur2, xrpl::Issue const& iss2,
ripple::AccountID const& ammAccount, xrpl::AccountID const& ammAccount,
ripple::AccountID const& lpAccount, xrpl::AccountID const& lpAccount,
boost::asio::yield_context yield boost::asio::yield_context yield
); );
@@ -92,12 +92,12 @@ getAmmLpHolds(
* @param yield The coroutine context * @param yield The coroutine context
* @return The lp token balance * @return The lp token balance
*/ */
ripple::STAmount xrpl::STAmount
getAmmLpHolds( getAmmLpHolds(
BackendInterface const& backend, BackendInterface const& backend,
std::uint32_t sequence, std::uint32_t sequence,
ripple::SLE const& ammSle, xrpl::SLE const& ammSle,
ripple::AccountID const& lpAccount, xrpl::AccountID const& lpAccount,
boost::asio::yield_context yield boost::asio::yield_context yield
); );

View File

@@ -56,13 +56,13 @@ namespace rpc {
* @brief Represents an entry in the book_changes' changes array. * @brief Represents an entry in the book_changes' changes array.
*/ */
struct BookChange { struct BookChange {
ripple::STAmount sideAVolume; xrpl::STAmount sideAVolume;
ripple::STAmount sideBVolume; xrpl::STAmount sideBVolume;
ripple::STAmount highRate; xrpl::STAmount highRate;
ripple::STAmount lowRate; xrpl::STAmount lowRate;
ripple::STAmount openRate; xrpl::STAmount openRate;
ripple::STAmount closeRate; xrpl::STAmount closeRate;
std::optional<ripple::uint256> domain; std::optional<xrpl::uint256> domain;
}; };
/** /**
@@ -109,55 +109,54 @@ private:
private: private:
void void
handleAffectedNode(ripple::STObject const& node) handleAffectedNode(xrpl::STObject const& node)
{ {
auto const& metaType = node.getFName(); auto const& metaType = node.getFName();
auto const nodeType = node.getFieldU16(ripple::sfLedgerEntryType); auto const nodeType = node.getFieldU16(xrpl::sfLedgerEntryType);
// we only care about ripple::ltOFFER objects being modified or // we only care about xrpl::ltOFFER objects being modified or
// deleted // deleted
if (nodeType != ripple::ltOFFER || metaType == ripple::sfCreatedNode) if (nodeType != xrpl::ltOFFER || metaType == xrpl::sfCreatedNode)
return; return;
// if either FF or PF are missing we can't compute // if either FF or PF are missing we can't compute
// but generally these are cancelled rather than crossed // but generally these are cancelled rather than crossed
// so skipping them is consistent // so skipping them is consistent
if (!node.isFieldPresent(ripple::sfFinalFields) || !node.isFieldPresent(ripple::sfPreviousFields)) if (!node.isFieldPresent(xrpl::sfFinalFields) || !node.isFieldPresent(xrpl::sfPreviousFields))
return; return;
auto const& finalFields = node.peekAtField(ripple::sfFinalFields).downcast<ripple::STObject>(); auto const& finalFields = node.peekAtField(xrpl::sfFinalFields).downcast<xrpl::STObject>();
auto const& previousFields = node.peekAtField(ripple::sfPreviousFields).downcast<ripple::STObject>(); auto const& previousFields = node.peekAtField(xrpl::sfPreviousFields).downcast<xrpl::STObject>();
// defensive case that should never be hit // defensive case that should never be hit
if (!finalFields.isFieldPresent(ripple::sfTakerGets) || !finalFields.isFieldPresent(ripple::sfTakerPays) || if (!finalFields.isFieldPresent(xrpl::sfTakerGets) || !finalFields.isFieldPresent(xrpl::sfTakerPays) ||
!previousFields.isFieldPresent(ripple::sfTakerGets) || !previousFields.isFieldPresent(xrpl::sfTakerGets) || !previousFields.isFieldPresent(xrpl::sfTakerPays))
!previousFields.isFieldPresent(ripple::sfTakerPays))
return; return;
// filter out any offers deleted by explicit offer cancels // filter out any offers deleted by explicit offer cancels
if (metaType == ripple::sfDeletedNode && offerCancel_ && if (metaType == xrpl::sfDeletedNode && offerCancel_ &&
finalFields.getFieldU32(ripple::sfSequence) == *offerCancel_) finalFields.getFieldU32(xrpl::sfSequence) == *offerCancel_)
return; return;
// compute the difference in gets and pays actually // compute the difference in gets and pays actually
// affected onto the offer // affected onto the offer
auto const deltaGets = auto const deltaGets =
finalFields.getFieldAmount(ripple::sfTakerGets) - previousFields.getFieldAmount(ripple::sfTakerGets); finalFields.getFieldAmount(xrpl::sfTakerGets) - previousFields.getFieldAmount(xrpl::sfTakerGets);
auto const deltaPays = auto const deltaPays =
finalFields.getFieldAmount(ripple::sfTakerPays) - previousFields.getFieldAmount(ripple::sfTakerPays); finalFields.getFieldAmount(xrpl::sfTakerPays) - previousFields.getFieldAmount(xrpl::sfTakerPays);
transformAndStore(deltaGets, deltaPays, finalFields[~ripple::sfDomainID]); transformAndStore(deltaGets, deltaPays, finalFields[~xrpl::sfDomainID]);
} }
void void
transformAndStore( transformAndStore(
ripple::STAmount const& deltaGets, xrpl::STAmount const& deltaGets,
ripple::STAmount const& deltaPays, xrpl::STAmount const& deltaPays,
std::optional<ripple::uint256> const& domain std::optional<xrpl::uint256> const& domain
) )
{ {
auto const g = to_string(deltaGets.issue()); auto const g = to_string(deltaGets.get<xrpl::Issue>());
auto const p = to_string(deltaPays.issue()); auto const p = to_string(deltaPays.get<xrpl::Issue>());
auto const noswap = [&]() { auto const noswap = [&]() {
if (isXRP(deltaGets)) if (isXRP(deltaGets))
@@ -169,15 +168,15 @@ private:
auto second = noswap ? deltaPays : deltaGets; auto second = noswap ? deltaPays : deltaGets;
// defensively programmed, should (probably) never happen // defensively programmed, should (probably) never happen
if (second == beast::zero) if (second == beast::kZero)
return; return;
auto const rate = divide(first, second, ripple::noIssue()); auto const rate = divide(first, second, xrpl::noIssue());
if (first < beast::zero) if (first < beast::kZero)
first = -first; first = -first;
if (second < beast::zero) if (second < beast::kZero)
second = -second; second = -second;
auto const key = noswap ? (g + '|' + p) : (p + '|' + g); auto const key = noswap ? (g + '|' + p) : (p + '|' + g);
@@ -212,24 +211,24 @@ private:
handleBookChange(data::TransactionAndMetadata const& blob) handleBookChange(data::TransactionAndMetadata const& blob)
{ {
auto const [tx, meta] = rpc::deserializeTxPlusMeta(blob); auto const [tx, meta] = rpc::deserializeTxPlusMeta(blob);
if (!tx || !meta || !tx->isFieldPresent(ripple::sfTransactionType)) if (!tx || !meta || !tx->isFieldPresent(xrpl::sfTransactionType))
return; return;
offerCancel_ = shouldCancelOffer(tx); offerCancel_ = shouldCancelOffer(tx);
for (auto const& node : meta->getFieldArray(ripple::sfAffectedNodes)) for (auto const& node : meta->getFieldArray(xrpl::sfAffectedNodes))
handleAffectedNode(node); handleAffectedNode(node);
} }
static std::optional<uint32_t> static std::optional<uint32_t>
shouldCancelOffer(std::shared_ptr<ripple::STTx const> const& tx) shouldCancelOffer(std::shared_ptr<xrpl::STTx const> const& tx)
{ {
switch (tx->getFieldU16(ripple::sfTransactionType)) { switch (tx->getFieldU16(xrpl::sfTransactionType)) {
// in future if any other ways emerge to cancel an offer // in future if any other ways emerge to cancel an offer
// this switch makes them easy to add // this switch makes them easy to add
case ripple::ttOFFER_CANCEL: case xrpl::ttOFFER_CANCEL:
case ripple::ttOFFER_CREATE: case xrpl::ttOFFER_CREATE:
if (tx->isFieldPresent(ripple::sfOfferSequence)) if (tx->isFieldPresent(xrpl::sfOfferSequence))
return tx->getFieldU32(ripple::sfOfferSequence); return tx->getFieldU32(xrpl::sfOfferSequence);
[[fallthrough]]; [[fallthrough]];
default: default:
return std::nullopt; return std::nullopt;
@@ -247,12 +246,12 @@ private:
inline void inline void
tag_invoke(boost::json::value_from_tag, boost::json::value& jv, BookChange const& change) tag_invoke(boost::json::value_from_tag, boost::json::value& jv, BookChange const& change)
{ {
auto amountStr = [](ripple::STAmount const& amount) -> std::string { auto amountStr = [](xrpl::STAmount const& amount) -> std::string {
return isXRP(amount) ? to_string(amount.xrp()) : to_string(amount.iou()); return isXRP(amount) ? to_string(amount.xrp()) : to_string(amount.iou());
}; };
auto currencyStr = [](ripple::STAmount const& amount) -> std::string { auto currencyStr = [](xrpl::STAmount const& amount) -> std::string {
return isXRP(amount) ? "XRP_drops" : to_string(amount.issue()); return isXRP(amount) ? "XRP_drops" : to_string(amount.get<xrpl::Issue>());
}; };
jv = { jv = {
@@ -267,7 +266,7 @@ tag_invoke(boost::json::value_from_tag, boost::json::value& jv, BookChange const
}; };
if (change.domain.has_value()) if (change.domain.has_value())
jv.as_object()[JS(domain)] = ripple::to_string(*change.domain); jv.as_object()[JS(domain)] = xrpl::to_string(*change.domain);
} }
/** /**
@@ -278,6 +277,6 @@ tag_invoke(boost::json::value_from_tag, boost::json::value& jv, BookChange const
* @return The book changes * @return The book changes
*/ */
[[nodiscard]] boost::json::object [[nodiscard]] boost::json::object
computeBookChanges(ripple::LedgerHeader const& lgrInfo, std::vector<data::TransactionAndMetadata> const& transactions); computeBookChanges(xrpl::LedgerHeader const& lgrInfo, std::vector<data::TransactionAndMetadata> const& transactions);
} // namespace rpc } // namespace rpc

View File

@@ -53,37 +53,36 @@
namespace rpc::credentials { namespace rpc::credentials {
bool bool
checkExpired(ripple::SLE const& sleCred, ripple::LedgerHeader const& ledger) checkExpired(xrpl::SLE const& sleCred, xrpl::LedgerHeader const& ledger)
{ {
if (sleCred.isFieldPresent(ripple::sfExpiration)) { if (sleCred.isFieldPresent(xrpl::sfExpiration)) {
std::uint32_t const exp = sleCred.getFieldU32(ripple::sfExpiration); std::uint32_t const exp = sleCred.getFieldU32(xrpl::sfExpiration);
std::uint32_t const now = ledger.parentCloseTime.time_since_epoch().count(); std::uint32_t const now = ledger.parentCloseTime.time_since_epoch().count();
return now > exp; return now > exp;
} }
return false; return false;
} }
std::set<std::pair<ripple::AccountID, ripple::Slice>> std::set<std::pair<xrpl::AccountID, xrpl::Slice>>
createAuthCredentials(ripple::STArray const& in) createAuthCredentials(xrpl::STArray const& in)
{ {
std::set<std::pair<ripple::AccountID, ripple::Slice>> out; std::set<std::pair<xrpl::AccountID, xrpl::Slice>> out;
for (auto const& cred : in) for (auto const& cred : in)
out.insert({cred[ripple::sfIssuer], cred[ripple::sfCredentialType]}); out.insert({cred[xrpl::sfIssuer], cred[xrpl::sfCredentialType]});
return out; return out;
} }
ripple::STArray xrpl::STArray
parseAuthorizeCredentials(boost::json::array const& jv) parseAuthorizeCredentials(boost::json::array const& jv)
{ {
ripple::STArray arr; xrpl::STArray arr;
for (auto const& jo : jv) { for (auto const& jo : jv) {
ASSERT( ASSERT(
jo.at(JS(issuer)).is_string(), jo.at(JS(issuer)).is_string(),
"issuer must be string, should already be checked in AuthorizeCredentialValidator" "issuer must be string, should already be checked in AuthorizeCredentialValidator"
); );
auto const issuer = auto const issuer = xrpl::parseBase58<xrpl::AccountID>(static_cast<std::string>(jo.at(JS(issuer)).as_string()));
ripple::parseBase58<ripple::AccountID>(static_cast<std::string>(jo.at(JS(issuer)).as_string()));
ASSERT( ASSERT(
issuer.has_value(), "issuer must be present, should already be checked in AuthorizeCredentialValidator." issuer.has_value(), "issuer must be present, should already be checked in AuthorizeCredentialValidator."
); );
@@ -92,66 +91,66 @@ parseAuthorizeCredentials(boost::json::array const& jv)
jo.at(JS(credential_type)).is_string(), jo.at(JS(credential_type)).is_string(),
"credential_type must be string, should already be checked in AuthorizeCredentialValidator" "credential_type must be string, should already be checked in AuthorizeCredentialValidator"
); );
auto const credentialType = ripple::strUnHex(static_cast<std::string>(jo.at(JS(credential_type)).as_string())); auto const credentialType = xrpl::strUnHex(static_cast<std::string>(jo.at(JS(credential_type)).as_string()));
ASSERT( ASSERT(
credentialType.has_value(), credentialType.has_value(),
"credential_type must be present, should already be checked in AuthorizeCredentialValidator." "credential_type must be present, should already be checked in AuthorizeCredentialValidator."
); );
auto credential = ripple::STObject::makeInnerObject(ripple::sfCredential); auto credential = xrpl::STObject::makeInnerObject(xrpl::sfCredential);
credential.setAccountID(ripple::sfIssuer, *issuer); credential.setAccountID(xrpl::sfIssuer, *issuer);
credential.setFieldVL(ripple::sfCredentialType, *credentialType); credential.setFieldVL(xrpl::sfCredentialType, *credentialType);
arr.push_back(std::move(credential)); arr.push_back(std::move(credential));
} }
return arr; return arr;
} }
std::expected<ripple::STArray, Status> std::expected<xrpl::STArray, Status>
fetchCredentialArray( fetchCredentialArray(
std::optional<boost::json::array> const& credID, std::optional<boost::json::array> const& credID,
ripple::AccountID const& srcAcc, xrpl::AccountID const& srcAcc,
BackendInterface const& backend, BackendInterface const& backend,
ripple::LedgerHeader const& info, xrpl::LedgerHeader const& info,
boost::asio::yield_context const& yield boost::asio::yield_context const& yield
) )
{ {
ripple::STArray authCreds; xrpl::STArray authCreds;
std::unordered_set<std::string_view> elems; std::unordered_set<std::string_view> elems;
for (auto const& elem : credID.value()) { for (auto const& elem : credID.value()) {
ASSERT(elem.is_string(), "should already be checked in validators.hpp that elem is a string."); ASSERT(elem.is_string(), "should already be checked in validators.hpp that elem is a string.");
if (elems.contains(elem.as_string())) if (elems.contains(elem.as_string()))
return Error{Status{RippledError::rpcBAD_CREDENTIALS, "duplicates in credentials."}}; return Error{Status{RippledError::RpcBadCredentials, "duplicates in credentials."}};
elems.insert(elem.as_string()); elems.insert(elem.as_string());
ripple::uint256 credHash; xrpl::uint256 credHash;
ASSERT( ASSERT(
credHash.parseHex(boost::json::value_to<std::string>(elem)), credHash.parseHex(boost::json::value_to<std::string>(elem)),
"should already be checked in validators.hpp that elem is a uint256 hex" "should already be checked in validators.hpp that elem is a uint256 hex"
); );
auto const credKeylet = ripple::keylet::credential(credHash).key; auto const credKeylet = xrpl::keylet::credential(credHash).key;
auto const credLedgerObject = backend.fetchLedgerObject(credKeylet, info.seq, yield); auto const credLedgerObject = backend.fetchLedgerObject(credKeylet, info.seq, yield);
if (!credLedgerObject) if (!credLedgerObject)
return Error{Status{RippledError::rpcBAD_CREDENTIALS, "credentials don't exist."}}; return Error{Status{RippledError::RpcBadCredentials, "credentials don't exist."}};
auto credIt = ripple::SerialIter{credLedgerObject->data(), credLedgerObject->size()}; auto credIt = xrpl::SerialIter{credLedgerObject->data(), credLedgerObject->size()};
auto const sleCred = ripple::SLE{credIt, credKeylet}; auto const sleCred = xrpl::SLE{credIt, credKeylet};
if ((sleCred.getType() != ripple::ltCREDENTIAL) || if ((sleCred.getType() != xrpl::ltCREDENTIAL) ||
((sleCred.getFieldU32(ripple::sfFlags) & ripple::lsfAccepted) == 0u)) ((sleCred.getFieldU32(xrpl::sfFlags) & xrpl::lsfAccepted) == 0u))
return Error{Status{RippledError::rpcBAD_CREDENTIALS, "credentials aren't accepted"}}; return Error{Status{RippledError::RpcBadCredentials, "credentials aren't accepted"}};
if (credentials::checkExpired(sleCred, info)) if (credentials::checkExpired(sleCred, info))
return Error{Status{RippledError::rpcBAD_CREDENTIALS, "credentials are expired"}}; return Error{Status{RippledError::RpcBadCredentials, "credentials are expired"}};
if (sleCred.getAccountID(ripple::sfSubject) != srcAcc) if (sleCred.getAccountID(xrpl::sfSubject) != srcAcc)
return Error{Status{RippledError::rpcBAD_CREDENTIALS, "credentials don't belong to the root account"}}; return Error{Status{RippledError::RpcBadCredentials, "credentials don't belong to the root account"}};
auto credential = ripple::STObject::makeInnerObject(ripple::sfCredential); auto credential = xrpl::STObject::makeInnerObject(xrpl::sfCredential);
credential.setAccountID(ripple::sfIssuer, sleCred.getAccountID(ripple::sfIssuer)); credential.setAccountID(xrpl::sfIssuer, sleCred.getAccountID(xrpl::sfIssuer));
credential.setFieldVL(ripple::sfCredentialType, sleCred.getFieldVL(ripple::sfCredentialType)); credential.setFieldVL(xrpl::sfCredentialType, sleCred.getFieldVL(xrpl::sfCredentialType));
authCreds.push_back(std::move(credential)); authCreds.push_back(std::move(credential));
} }

View File

@@ -47,7 +47,7 @@ namespace rpc::credentials {
* @return true if credential not expired, false otherwise * @return true if credential not expired, false otherwise
*/ */
bool bool
checkExpired(ripple::SLE const& sleCred, ripple::LedgerHeader const& ledger); checkExpired(xrpl::SLE const& sleCred, xrpl::LedgerHeader const& ledger);
/** /**
* @brief Creates authentication credential field (which is a set of pairs of AccountID and Credential ID) * @brief Creates authentication credential field (which is a set of pairs of AccountID and Credential ID)
@@ -55,8 +55,8 @@ checkExpired(ripple::SLE const& sleCred, ripple::LedgerHeader const& ledger);
* @param in The array of Credential objects to check * @param in The array of Credential objects to check
* @return Auth Credential array * @return Auth Credential array
*/ */
std::set<std::pair<ripple::AccountID, ripple::Slice>> std::set<std::pair<xrpl::AccountID, xrpl::Slice>>
createAuthCredentials(ripple::STArray const& in); createAuthCredentials(xrpl::STArray const& in);
/** /**
* @brief Parses each credential object and makes sure the credential type and values are correct * @brief Parses each credential object and makes sure the credential type and values are correct
@@ -64,7 +64,7 @@ createAuthCredentials(ripple::STArray const& in);
* @param jv The boost json array of credentials to parse * @param jv The boost json array of credentials to parse
* @return Array of credentials after parsing * @return Array of credentials after parsing
*/ */
ripple::STArray xrpl::STArray
parseAuthorizeCredentials(boost::json::array const& jv); parseAuthorizeCredentials(boost::json::array const& jv);
/** /**
@@ -77,12 +77,12 @@ parseAuthorizeCredentials(boost::json::array const& jv);
* @param yield The coroutine context * @param yield The coroutine context
* @return Array of credential objects, error if failed otherwise * @return Array of credential objects, error if failed otherwise
*/ */
std::expected<ripple::STArray, Status> std::expected<xrpl::STArray, Status>
fetchCredentialArray( fetchCredentialArray(
std::optional<boost::json::array> const& credID, std::optional<boost::json::array> const& credID,
ripple::AccountID const& srcAcc, xrpl::AccountID const& srcAcc,
BackendInterface const& backend, BackendInterface const& backend,
ripple::LedgerHeader const& info, xrpl::LedgerHeader const& info,
boost::asio::yield_context const& yield boost::asio::yield_context const& yield
); );

View File

@@ -53,7 +53,7 @@ operator<<(std::ostream& stream, Status const& status)
if (!status.message.empty()) { if (!status.message.empty()) {
stream << ", Message: " << status.message; stream << ", Message: " << status.message;
} else { } else {
stream << ", Message: " << ripple::RPC::get_error_info(err).message; stream << ", Message: " << xrpl::RPC::getErrorInfo(err).message;
} }
}, },
[&stream, &status](ClioError err) { [&stream, &status](ClioError err) {
@@ -157,11 +157,11 @@ boost::json::object
makeError(RippledError err, std::optional<std::string_view> customError, std::optional<std::string_view> customMessage) makeError(RippledError err, std::optional<std::string_view> customError, std::optional<std::string_view> customMessage)
{ {
boost::json::object json; boost::json::object json;
auto const& info = ripple::RPC::get_error_info(err); auto const& info = xrpl::RPC::getErrorInfo(err);
json["error"] = customError.value_or(info.token.c_str()).data(); json["error"] = customError.value_or(info.token.cStr()).data();
json["error_code"] = static_cast<uint32_t>(err); json["error_code"] = static_cast<uint32_t>(err);
json["error_message"] = customMessage.value_or(info.message.c_str()).data(); json["error_message"] = customMessage.value_or(info.message.cStr()).data();
json["status"] = "error"; json["status"] = "error";
json["type"] = "response"; json["type"] = "response";
@@ -191,7 +191,7 @@ makeError(Status const& status)
auto res = visit( auto res = visit(
util::OverloadSet{ util::OverloadSet{
[&status, &wrapOptional](RippledError err) { [&status, &wrapOptional](RippledError err) {
if (err == ripple::rpcUNKNOWN) if (err == xrpl::RpcUnknown)
return boost::json::object{{"error", status.message}, {"type", "response"}, {"status", "error"}}; return boost::json::object{{"error", status.message}, {"type", "response"}, {"status", "error"}};
return makeError(err, wrapOptional(status.error), wrapOptional(status.message)); return makeError(err, wrapOptional(status.error), wrapOptional(status.message));

View File

@@ -69,7 +69,7 @@ struct ClioErrorInfo {
}; };
/** @brief Clio uses compatible Rippled error codes for most RPC errors. */ /** @brief Clio uses compatible Rippled error codes for most RPC errors. */
using RippledError = ripple::error_code_i; using RippledError = xrpl::ErrorCodeI;
/** /**
* @brief Clio operates on a combination of Rippled and Custom Clio error codes. * @brief Clio operates on a combination of Rippled and Custom Clio error codes.
@@ -81,7 +81,7 @@ using CombinedError = std::variant<RippledError, ClioError>;
/** @brief A status returned from any RPC handler. */ /** @brief A status returned from any RPC handler. */
struct Status { struct Status {
CombinedError code = RippledError::rpcSUCCESS; CombinedError code = RippledError::RpcSuccess;
std::string error; std::string error;
std::string message; std::string message;
std::optional<boost::json::object> extraInfo; std::optional<boost::json::object> extraInfo;
@@ -111,7 +111,7 @@ struct Status {
* *
* @param message The message * @param message The message
*/ */
explicit Status(std::string message) : code(ripple::rpcUNKNOWN), message(std::move(message)) explicit Status(std::string message) : code(xrpl::RpcUnknown), message(std::move(message))
{ {
} }
@@ -148,7 +148,7 @@ struct Status {
operator bool() const operator bool() const
{ {
if (auto err = std::get_if<RippledError>(&code)) if (auto err = std::get_if<RippledError>(&code))
return *err != RippledError::rpcSUCCESS; return *err != RippledError::RpcSuccess;
return true; return true;
} }

View File

@@ -96,7 +96,7 @@ makeHttpContext(
auto const command = boost::json::value_to<std::string>(request.at("method")); auto const command = boost::json::value_to<std::string>(request.at("method"));
if (command == "subscribe" || command == "unsubscribe") if (command == "subscribe" || command == "unsubscribe")
return Error{{RippledError::rpcBAD_SYNTAX, "Subscribe and unsubscribe are only allowed for websocket."}}; return Error{{RippledError::RpcBadSyntax, "Subscribe and unsubscribe are only allowed for websocket."}};
if (!request.at("params").is_array()) if (!request.at("params").is_array())
return Error{{ClioError::RpcParamsUnparsable, "Missing params array."}}; return Error{{ClioError::RpcParamsUnparsable, "Missing params array."}};

View File

@@ -21,11 +21,11 @@
#include <xrpl/protocol/jss.h> #include <xrpl/protocol/jss.h>
/** @brief Helper macro for borrowing from ripple::jss static (J)son (S)trings. */ /** @brief Helper macro for borrowing from xrpl::jss static (J)son (S)trings. */
#define JS(x) ripple::jss::x.c_str() #define JS(x) xrpl::jss::x.cStr()
/** @brief Access the lower case copy of a static (J)son (S)tring. */ /** @brief Access the lower case copy of a static (J)son (S)tring. */
#define JSL(x) util::toLower(JS(x)) #define JSL(x) util::toLower(JS(x))
/** @brief Provides access to (SF)ield name (S)trings. */ /** @brief Provides access to (SF)ield name (S)trings. */
#define SFS(x) ripple::x.jsonName.c_str() #define SFS(x) xrpl::x.jsonName.cStr()

View File

@@ -152,7 +152,7 @@ public:
if (forwardingProxy_.shouldForward(ctx)) { if (forwardingProxy_.shouldForward(ctx)) {
// Disallow forwarding of the admin api, only user api is allowed for security reasons. // Disallow forwarding of the admin api, only user api is allowed for security reasons.
if (isAdminCmd(ctx.method, ctx.params)) if (isAdminCmd(ctx.method, ctx.params))
return Result{Status{RippledError::rpcNO_PERMISSION}}; return Result{Status{RippledError::RpcNoPermission}};
return forwardingProxy_.forward(ctx); return forwardingProxy_.forward(ctx);
} }
@@ -165,13 +165,13 @@ public:
if (backend_->isTooBusy()) { if (backend_->isTooBusy()) {
LOG(log_.error()) << "Database is too busy. Rejecting request"; LOG(log_.error()) << "Database is too busy. Rejecting request";
notifyTooBusy(); // TODO: should we add ctx.method if we have it? notifyTooBusy(); // TODO: should we add ctx.method if we have it?
return Result{Status{RippledError::rpcTOO_BUSY}}; return Result{Status{RippledError::RpcTooBusy}};
} }
auto const method = handlerProvider_->getHandler(ctx.method); auto const method = handlerProvider_->getHandler(ctx.method);
if (!method) { if (!method) {
notifyUnknownCommand(); notifyUnknownCommand();
return Result{Status{RippledError::rpcUNKNOWN_COMMAND}}; return Result{Status{RippledError::RpcUnknownCommand}};
} }
try { try {
@@ -199,12 +199,12 @@ public:
LOG(log_.error()) << "Database timeout"; LOG(log_.error()) << "Database timeout";
notifyTooBusy(); notifyTooBusy();
return Result{Status{RippledError::rpcTOO_BUSY}}; return Result{Status{RippledError::RpcTooBusy}};
} catch (std::exception const& ex) { } catch (std::exception const& ex) {
LOG(log_.error()) << ctx.tag() << "Caught exception: " << ex.what(); LOG(log_.error()) << ctx.tag() << "Caught exception: " << ex.what();
notifyInternalError(); notifyInternalError();
return Result{Status{RippledError::rpcINTERNAL}}; return Result{Status{RippledError::RpcInternal}};
} }
} }
@@ -325,13 +325,13 @@ private:
if (backend_->isTooBusy()) { if (backend_->isTooBusy()) {
LOG(log_.error()) << "Database is too busy. Rejecting request"; LOG(log_.error()) << "Database is too busy. Rejecting request";
notifyTooBusy(); // TODO: should we add ctx.method if we have it? notifyTooBusy(); // TODO: should we add ctx.method if we have it?
return Result{Status{RippledError::rpcTOO_BUSY}}; return Result{Status{RippledError::RpcTooBusy}};
} }
auto const method = handlerProvider_->getHandler(ctx.method); auto const method = handlerProvider_->getHandler(ctx.method);
if (!method) { if (!method) {
notifyUnknownCommand(); notifyUnknownCommand();
return Result{Status{RippledError::rpcUNKNOWN_COMMAND}}; return Result{Status{RippledError::RpcUnknownCommand}};
} }
try { try {
@@ -357,12 +357,12 @@ private:
LOG(log_.error()) << "Database timeout"; LOG(log_.error()) << "Database timeout";
notifyTooBusy(); notifyTooBusy();
return Result{Status{RippledError::rpcTOO_BUSY}}; return Result{Status{RippledError::RpcTooBusy}};
} catch (std::exception const& ex) { } catch (std::exception const& ex) {
LOG(log_.error()) << ctx.tag() << "Caught exception: " << ex.what(); LOG(log_.error()) << ctx.tag() << "Caught exception: " << ex.what();
notifyInternalError(); notifyInternalError();
return Result{Status{RippledError::rpcINTERNAL}}; return Result{Status{RippledError::RpcInternal}};
} }
} }
}; };

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