Skip to content

Commit ee877eb

Browse files
authored
Merge branch 'develop' into a1q123456/structured-logs-support
2 parents e14822e + cb52c9a commit ee877eb

24 files changed

+1894
-305
lines changed

.github/workflows/build-test.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,9 @@ jobs:
102102
echo 'CMake target: ${{ matrix.cmake_target }}'
103103
echo 'Config name: ${{ matrix.config_name }}'
104104
105-
- name: Clean workspace (MacOS)
106-
if: ${{ inputs.os == 'macos' }}
107-
run: |
108-
WORKSPACE=${{ github.workspace }}
109-
echo "Cleaning workspace '${WORKSPACE}'."
110-
if [ -z "${WORKSPACE}" ] || [ "${WORKSPACE}" = "/" ]; then
111-
echo "Invalid working directory '${WORKSPACE}'."
112-
exit 1
113-
fi
114-
find "${WORKSPACE}" -depth 1 | xargs rm -rfv
105+
- name: Cleanup workspace
106+
if: ${{ runner.os == 'macOS' }}
107+
uses: XRPLF/actions/.github/actions/cleanup-workspace@3f044c7478548e3c32ff68980eeb36ece02b364e
115108

116109
- name: Checkout repository
117110
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0

.github/workflows/check-format.yml

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,41 +17,10 @@ jobs:
1717
runs-on: ubuntu-latest
1818
container: ghcr.io/xrplf/ci/tools-rippled-pre-commit
1919
steps:
20-
# The $GITHUB_WORKSPACE and ${{ github.workspace }} might not point to the
21-
# same directory for jobs running in containers. The actions/checkout step
22-
# is *supposed* to checkout into $GITHUB_WORKSPACE and then add it to
23-
# safe.directory (see instructions at https://github.com/actions/checkout)
24-
# but that is apparently not happening for some container images. We
25-
# therefore preemptively add both directories to safe.directory. See also
26-
# https://github.com/actions/runner/issues/2058 for more details.
27-
- name: Configure git safe.directory
28-
run: |
29-
git config --global --add safe.directory $GITHUB_WORKSPACE
30-
git config --global --add safe.directory ${{ github.workspace }}
3120
- name: Checkout repository
3221
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
33-
- name: Check configuration
34-
run: |
35-
echo 'Checking path.'
36-
echo ${PATH} | tr ':' '\n'
37-
38-
echo 'Checking environment variables.'
39-
env | sort
40-
41-
echo 'Checking pre-commit version.'
42-
pre-commit --version
43-
44-
echo 'Checking clang-format version.'
45-
clang-format --version
46-
47-
echo 'Checking NPM version.'
48-
npm --version
49-
50-
echo 'Checking Node.js version.'
51-
node --version
52-
53-
echo 'Checking prettier version.'
54-
prettier --version
22+
- name: Prepare runner
23+
uses: XRPLF/actions/.github/actions/prepare-runner@638e0dc11ea230f91bd26622fb542116bb5254d5
5524
- name: Format code
5625
run: pre-commit run --show-diff-on-failure --color=always --all-files
5726
- name: Check for differences

.github/workflows/notify-clio.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ jobs:
5050
echo "channel=pr_${{ github.event.pull_request.number }}" >> "${GITHUB_OUTPUT}"
5151
echo 'Extracting version.'
5252
echo "version=$(cat src/libxrpl/protocol/BuildInfo.cpp | grep "versionString =" | awk -F '"' '{print $2}')" >> "${GITHUB_OUTPUT}"
53+
- name: Calculate conan reference
54+
id: conan_ref
55+
run: |
56+
echo "conan_ref=${{ steps.generate.outputs.version }}@${{ steps.generate.outputs.user }}/${{ steps.generate.outputs.channel }}" >> "${GITHUB_OUTPUT}"
5357
- name: Add Conan remote
5458
run: |
5559
echo "Adding Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
@@ -61,10 +65,9 @@ jobs:
6165
- name: Upload package
6266
run: |
6367
conan export --user=${{ steps.generate.outputs.user }} --channel=${{ steps.generate.outputs.channel }} .
64-
conan upload --confirm --check --remote=${{ inputs.conan_remote_name }} xrpl/${{ steps.generate.outputs.version }}@${{ steps.generate.outputs.user }}/${{ steps.generate.outputs.channel }}
68+
conan upload --confirm --check --remote=${{ inputs.conan_remote_name }} xrpl/${{ steps.conan_ref.outputs.conan_ref }}
6569
outputs:
66-
channel: ${{ steps.generate.outputs.channel }}
67-
version: ${{ steps.generate.outputs.version }}
70+
conan_ref: ${{ steps.conan_ref.outputs.conan_ref }}
6871

6972
notify:
7073
needs: upload
@@ -76,5 +79,5 @@ jobs:
7679
run: |
7780
gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \
7881
/repos/xrplf/clio/dispatches -f "event_type=check_libxrpl" \
79-
-F "client_payload[version]=${{ needs.upload.outputs.version }}@${{ needs.upload.outputs.user }}/${{ needs.upload.outputs.channel }}" \
80-
-F "client_payload[pr]=${{ github.event.pull_request.number }}"
82+
-F "client_payload[conan_ref]=${{ needs.upload.outputs.conan_ref }}" \
83+
-F "client_payload[pr_url]=${{ github.event.pull_request.html_url }}"

.github/workflows/on-pr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
tests/**
7676
CMakeLists.txt
7777
conanfile.py
78+
conan.lock
7879
- name: Check whether to run
7980
# This step determines whether the rest of the workflow should
8081
# run. The rest of the workflow will run if this job runs AND at

.github/workflows/on-trigger.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ on:
3232
- "tests/**"
3333
- "CMakeLists.txt"
3434
- "conanfile.py"
35+
- "conan.lock"
3536

3637
# Run at 06:32 UTC on every day of the week from Monday through Friday. This
3738
# will force all dependencies to be rebuilt, which is useful to verify that

.pre-commit-config.yaml

Lines changed: 15 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,35 @@
11
# To run pre-commit hooks, first install pre-commit:
22
# - `pip install pre-commit==${PRE_COMMIT_VERSION}`
3-
# - `pip install pre-commit-hooks==${PRE_COMMIT_HOOKS_VERSION}`
4-
#
5-
# Depending on your system, you can use `brew install` or `apt install` as well
6-
# for installing the pre-commit package, but `pip` is needed to install the
7-
# hooks; you can also use `pipx` if you prefer.
8-
# Next, install the required formatters:
9-
# - `pip install clang-format==${CLANG_VERSION}`
10-
# - `npm install prettier@${PRETTIER_VERSION}`
11-
#
12-
# See https://github.com/XRPLF/ci/blob/main/.github/workflows/tools-rippled.yml
13-
# for the versions used in the CI pipeline. You will need to have the exact same
14-
# versions of the tools installed on your system to produce the same results as
15-
# the pipeline.
163
#
174
# Then, run the following command to install the git hook scripts:
185
# - `pre-commit install`
196
# You can run all configured hooks against all files with:
207
# - `pre-commit run --all-files`
218
# To manually run a specific hook, use:
229
# - `pre-commit run <hook_id> --all-files`
23-
# To run the hooks against only the files changed in the current commit, use:
10+
# To run the hooks against only the staged files, use:
2411
# - `pre-commit run`
2512
repos:
26-
- repo: local
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
2715
hooks:
28-
- id: clang-format
29-
name: clang-format
30-
language: system
31-
entry: clang-format -i
32-
files: '\.(cpp|hpp|h|ipp|proto)$'
3316
- id: trailing-whitespace
34-
name: trailing-whitespace
35-
entry: trailing-whitespace-fixer
36-
language: system
37-
types: [text]
38-
- id: end-of-file
39-
name: end-of-file
40-
entry: end-of-file-fixer
41-
language: system
42-
types: [text]
17+
- id: end-of-file-fixer
4318
- id: mixed-line-ending
44-
name: mixed-line-ending
45-
entry: mixed-line-ending
46-
language: system
47-
types: [text]
4819
- id: check-merge-conflict
49-
name: check-merge-conflict
50-
entry: check-merge-conflict --assume-in-merge
51-
language: system
52-
types: [text]
53-
- repo: local
20+
args: [--assume-in-merge]
21+
22+
- repo: https://github.com/pre-commit/mirrors-clang-format
23+
rev: 7d85583be209cb547946c82fbe51f4bc5dd1d017 # frozen: v18.1.8
24+
hooks:
25+
- id: clang-format
26+
args: [--style=file]
27+
"types_or": [c++, c, proto]
28+
29+
- repo: https://github.com/rbubley/mirrors-prettier
30+
rev: 5ba47274f9b181bce26a5150a725577f3c336011 # frozen: v3.6.2
5431
hooks:
5532
- id: prettier
56-
name: prettier
57-
language: system
58-
entry: prettier --ignore-unknown --write
5933

6034
exclude: |
6135
(?x)^(

cmake/CodeCoverage.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
218218
set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path")
219219
endif()
220220

221-
check_cxx_compiler_flag(-fprofile-update HAVE_cxx_fprofile_update)
221+
check_cxx_compiler_flag(-fprofile-update=atomic HAVE_cxx_fprofile_update)
222222
if(HAVE_cxx_fprofile_update)
223223
set(COVERAGE_CXX_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-update=atomic")
224224
endif()
225225

226-
check_c_compiler_flag(-fprofile-update HAVE_c_fprofile_update)
226+
check_c_compiler_flag(-fprofile-update=atomic HAVE_c_fprofile_update)
227227
if(HAVE_c_fprofile_update)
228228
set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-update=atomic")
229229
endif()

include/xrpl/basics/Number.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,24 @@ class Number
150150
return (mantissa_ < 0) ? -1 : (mantissa_ ? 1 : 0);
151151
}
152152

153+
Number
154+
truncate() const noexcept
155+
{
156+
if (exponent_ >= 0 || mantissa_ == 0)
157+
return *this;
158+
159+
Number ret = *this;
160+
while (ret.exponent_ < 0 && ret.mantissa_ != 0)
161+
{
162+
ret.exponent_ += 1;
163+
ret.mantissa_ /= rep(10);
164+
}
165+
// We are guaranteed that normalize() will never throw an exception
166+
// because exponent is either negative or zero at this point.
167+
ret.normalize();
168+
return ret;
169+
}
170+
153171
friend constexpr bool
154172
operator>(Number const& x, Number const& y) noexcept
155173
{

include/xrpl/protocol/Protocol.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ std::size_t constexpr maxDataPayloadLength = 256;
122122
/** Vault withdrawal policies */
123123
std::uint8_t constexpr vaultStrategyFirstComeFirstServe = 1;
124124

125+
/** Default IOU scale factor for a Vault */
126+
std::uint8_t constexpr vaultDefaultIOUScale = 6;
127+
/** Maximum scale factor for a Vault. The number is chosen to ensure that
128+
1 IOU can be always converted to shares.
129+
10^19 > maxMPTokenAmount (2^64-1) > 10^18 */
130+
std::uint8_t constexpr vaultMaximumIOUScale = 18;
131+
125132
/** Maximum recursion depth for vault shares being put as an asset inside
126133
* another vault; counted from 0 */
127134
std::uint8_t constexpr maxAssetCheckDepth = 5;

include/xrpl/protocol/detail/ledger_entries.macro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ LEDGER_ENTRY(ltVAULT, 0x0084, Vault, vault, ({
499499
{sfLossUnrealized, soeREQUIRED},
500500
{sfShareMPTID, soeREQUIRED},
501501
{sfWithdrawalPolicy, soeREQUIRED},
502+
{sfScale, soeDEFAULT},
502503
// no SharesTotal ever (use MPTIssuance.sfOutstandingAmount)
503504
// no PermissionedDomainID ever (use MPTIssuance.sfDomainID)
504505
}))

0 commit comments

Comments
 (0)