mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-05 01:37:00 +00:00
Compare commits
235 Commits
pratik/Mig
...
ripple/sma
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
532868521c | ||
|
|
e7424ce10e | ||
|
|
e5b65ec1d6 | ||
|
|
e916416642 | ||
|
|
827ecc6e3a | ||
|
|
6a54ed7f14 | ||
|
|
881087dd3d | ||
|
|
90e0bbd0fc | ||
|
|
b57df290de | ||
|
|
8a403f1241 | ||
|
|
1e0741690d | ||
|
|
6d2640871d | ||
|
|
c5d178f152 | ||
|
|
5a17940e2a | ||
|
|
27ac30208d | ||
|
|
c145598ff9 | ||
|
|
50e5608d86 | ||
|
|
abfcc4ef67 | ||
|
|
e40a4df777 | ||
|
|
dba187f8c5 | ||
|
|
7a7b96107c | ||
|
|
8f2f8d53b4 | ||
|
|
49acc61961 | ||
|
|
500bb68831 | ||
|
|
95d78a8600 | ||
|
|
53eb0f60bc | ||
|
|
41205ae928 | ||
|
|
c33b0ae463 | ||
|
|
16087c9680 | ||
|
|
56bc6d58f6 | ||
|
|
ef5d335e09 | ||
|
|
25c3060fef | ||
|
|
ce9f0b38a4 | ||
|
|
35f7cbf772 | ||
|
|
def7758a23 | ||
|
|
58e5b4ad25 | ||
|
|
578413859c | ||
|
|
0db564d261 | ||
|
|
427b7ea104 | ||
|
|
fa8aa49376 | ||
|
|
3195eb16b2 | ||
|
|
7bf6878b4b | ||
|
|
a891b49c67 | ||
|
|
eed280d169 | ||
|
|
0bc1a115ff | ||
|
|
334bcfa5ef | ||
|
|
106dea4559 | ||
|
|
3ffdcf8114 | ||
|
|
4021a7eb28 | ||
|
|
0690fda0f1 | ||
|
|
d0cc48c6d3 | ||
|
|
d66e3c949e | ||
|
|
7e2e10f02c | ||
|
|
aebec5378c | ||
|
|
0c65a386b5 | ||
|
|
22ca691e75 | ||
|
|
fc6ff69752 | ||
|
|
079e251aca | ||
|
|
67e2c1b563 | ||
|
|
29f5430881 | ||
|
|
b6bd268be2 | ||
|
|
209ee25c32 | ||
|
|
101f285bcd | ||
|
|
566b85b3d6 | ||
|
|
af6beb1d7c | ||
|
|
7d22fe804d | ||
|
|
ce19c13059 | ||
|
|
286dc6322b | ||
|
|
c9346cd40d | ||
|
|
9cfb7ac340 | ||
|
|
3a0e9aab4f | ||
|
|
43caa1ef29 | ||
|
|
1c5683ec78 | ||
|
|
9bee155d59 | ||
|
|
f34b05f4de | ||
|
|
97ce25f4ce | ||
|
|
3b6cd22e32 | ||
|
|
c9c35780d2 | ||
|
|
17f401f374 | ||
|
|
c6c54b3282 | ||
|
|
91455b6860 | ||
|
|
9e14c14a26 | ||
|
|
f16f243c22 | ||
|
|
fe601308e7 | ||
|
|
c507880d8f | ||
|
|
3f8328bbf8 | ||
|
|
e41f6a71b7 | ||
|
|
51f1be7f5b | ||
|
|
c10a5f9ef6 | ||
|
|
3c141de695 | ||
|
|
db263b696c | ||
|
|
f57b855d74 | ||
|
|
da2b9455f2 | ||
|
|
86525d8583 | ||
|
|
c41e52f57a | ||
|
|
55772a0d07 | ||
|
|
965a9e89ac | ||
|
|
51ee06429b | ||
|
|
cb622488c0 | ||
|
|
32f971fec6 | ||
|
|
ca85d09f02 | ||
|
|
8dea76baa4 | ||
|
|
299fbe04c4 | ||
|
|
57fc1df7d7 | ||
|
|
8d266d3941 | ||
|
|
a865b4da1c | ||
|
|
e59f5f3b01 | ||
|
|
8729688feb | ||
|
|
c8b06e7de1 | ||
|
|
eaba76f9e6 | ||
|
|
cb702cc238 | ||
|
|
f1f798bb85 | ||
|
|
c3fd52c177 | ||
|
|
b69b4a0a4a | ||
|
|
50d6072a73 | ||
|
|
d24cd50e61 | ||
|
|
85bff20ae5 | ||
|
|
737fab5471 | ||
|
|
e6592e93a9 | ||
|
|
5a6c4e8ae0 | ||
|
|
9f5875158c | ||
|
|
c3dc33c861 | ||
|
|
7420f47658 | ||
|
|
6be8f2124c | ||
|
|
edfed06001 | ||
|
|
1c646dba91 | ||
|
|
6781068058 | ||
|
|
cfe57c1dfe | ||
|
|
c34d09a971 | ||
|
|
ebd90c4742 | ||
|
|
ba52d34828 | ||
|
|
2f869b3cfc | ||
|
|
ffa21c27a7 | ||
|
|
1b6312afb3 | ||
|
|
bf32dc2e72 | ||
|
|
a15d65f7a2 | ||
|
|
2de8488855 | ||
|
|
129aa4bfaa | ||
|
|
b1d70db63b | ||
|
|
f03c3aafe4 | ||
|
|
51a9f106d1 | ||
|
|
bfc048e3fe | ||
|
|
83418644f7 | ||
|
|
dbc9dd5bfc | ||
|
|
5c480cf883 | ||
|
|
45ab15d4b5 | ||
|
|
adc64e7866 | ||
|
|
4d4a1cfe82 | ||
|
|
f2c7da3705 | ||
|
|
3ab0a82cd3 | ||
|
|
a46d772147 | ||
|
|
f3c50318e8 | ||
|
|
e7aa924c0e | ||
|
|
5266f04970 | ||
|
|
db957cf191 | ||
|
|
8ac514363d | ||
|
|
c2ea68cca4 | ||
|
|
3d86881ce7 | ||
|
|
697d1470f4 | ||
|
|
0b5f8f4051 | ||
|
|
0fed78fbcc | ||
|
|
8c38ef726b | ||
|
|
2399d90334 | ||
|
|
6367d68d1e | ||
|
|
155a84c8a3 | ||
|
|
10558c9eff | ||
|
|
dd30d811e6 | ||
|
|
293d8e4ddb | ||
|
|
77875c9133 | ||
|
|
647b47567e | ||
|
|
b0a1ad3b06 | ||
|
|
1d141bf2e8 | ||
|
|
0d0e279ae2 | ||
|
|
5dc0cee28a | ||
|
|
c15947da56 | ||
|
|
9bc04244e7 | ||
|
|
38c7a27010 | ||
|
|
58741d2791 | ||
|
|
8426470506 | ||
|
|
ccc3280b1a | ||
|
|
2847075705 | ||
|
|
3108ca0549 | ||
|
|
3b849ff497 | ||
|
|
66776b6a85 | ||
|
|
c8c241b50d | ||
|
|
44cb588371 | ||
|
|
6f91b8f8d1 | ||
|
|
3d93379132 | ||
|
|
84fd7d0126 | ||
|
|
7f52287aae | ||
|
|
98b8986868 | ||
|
|
250f2842ee | ||
|
|
9eca1a3a0c | ||
|
|
24b7a03224 | ||
|
|
9007097d24 | ||
|
|
bc445ec6a2 | ||
|
|
4fa0ae521e | ||
|
|
7bdf5fa8b8 | ||
|
|
65b0b976d9 | ||
|
|
a0d275feec | ||
|
|
ece3a8d7be | ||
|
|
463acf51b5 | ||
|
|
1cd16fab87 | ||
|
|
add55c4f33 | ||
|
|
51a9c0ff59 | ||
|
|
6e8a5f0f4e | ||
|
|
8a33702f26 | ||
|
|
a072d49802 | ||
|
|
a0aeeb8e07 | ||
|
|
383b225690 | ||
|
|
ace2247800 | ||
|
|
6a6fed5dce | ||
|
|
1f8aece8cd | ||
|
|
6c6f8cd4f9 | ||
|
|
fb1311e013 | ||
|
|
ce31acf030 | ||
|
|
31ad5ac63b | ||
|
|
1ede0bdec4 | ||
|
|
aef32ead2c | ||
|
|
5b43ec7f73 | ||
|
|
1e9ff88a00 | ||
|
|
bb9bb5f5c5 | ||
|
|
c533abd8b6 | ||
|
|
bb9bc764bc | ||
|
|
b4b53a6cb7 | ||
|
|
9c0204906c | ||
|
|
4670b373c1 | ||
|
|
f03b5883bd | ||
|
|
f8b2fe4dd5 | ||
|
|
be4a0c9c2b | ||
|
|
f37d52d8e9 | ||
|
|
177cdaf550 | ||
|
|
1573a443b7 | ||
|
|
911c0466c0 | ||
|
|
b6a95f9970 |
6
.github/CODEOWNERS
vendored
6
.github/CODEOWNERS
vendored
@@ -1,8 +1,2 @@
|
||||
# Allow anyone to review any change by default.
|
||||
*
|
||||
|
||||
# Require the rpc-reviewers team to review changes to the rpc code.
|
||||
include/xrpl/protocol/ @xrplf/rpc-reviewers
|
||||
src/libxrpl/protocol/ @xrplf/rpc-reviewers
|
||||
src/xrpld/rpc/ @xrplf/rpc-reviewers
|
||||
src/xrpld/app/misc/ @xrplf/rpc-reviewers
|
||||
|
||||
6
.github/ISSUE_TEMPLATE/bug_report.md
vendored
6
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Create a report to help us improve xrpld
|
||||
title: "[Title with short description] (Version: [xrpld version])"
|
||||
about: Create a report to help us improve rippled
|
||||
title: "[Title with short description] (Version: [rippled version])"
|
||||
labels: ""
|
||||
assignees: ""
|
||||
---
|
||||
@@ -27,7 +27,7 @@ assignees: ""
|
||||
## Environment
|
||||
|
||||
<!--Please describe your environment setup (such as Ubuntu 18.04 with Boost 1.70).-->
|
||||
<!-- If you are using a formal release, please use the version returned by './xrpld --version' as the version number-->
|
||||
<!-- If you are using a formal release, please use the version returned by './rippled --version' as the version number-->
|
||||
<!-- If you are working off of develop, please add the git hash via 'git rev-parse HEAD'-->
|
||||
|
||||
## Supporting Files
|
||||
|
||||
52
.github/scripts/levelization/README.md
vendored
52
.github/scripts/levelization/README.md
vendored
@@ -3,26 +3,21 @@
|
||||
Levelization is the term used to describe efforts to prevent rippled from
|
||||
having or creating cyclic dependencies.
|
||||
|
||||
rippled code is organized into directories under `src/xrpld`, `src/libxrpl` (and
|
||||
rippled code is organized into directories under `src/rippled` (and
|
||||
`src/test`) representing modules. The modules are intended to be
|
||||
organized into "tiers" or "levels" such that a module from one level can
|
||||
only include code from lower levels. Additionally, a module
|
||||
in one level should never include code in an `impl` or `detail` folder of any level
|
||||
in one level should never include code in an `impl` folder of any level
|
||||
other than it's own.
|
||||
|
||||
The codebase is split into two main areas:
|
||||
|
||||
- **libxrpl** (`src/libxrpl`, `include/xrpl`): Reusable library modules with public interfaces
|
||||
- **xrpld** (`src/xrpld`): Application-specific implementation code
|
||||
|
||||
Unfortunately, over time, enforcement of levelization has been
|
||||
inconsistent, so the current state of the code doesn't necessarily
|
||||
reflect these rules. Whenever possible, developers should refactor any
|
||||
levelization violations they find (by moving files or individual
|
||||
classes). At the very least, don't make things worse.
|
||||
|
||||
The table below summarizes the _desired_ division of modules, based on the current
|
||||
state of the rippled code. The levels are numbered from
|
||||
The table below summarizes the _desired_ division of modules, based on the
|
||||
state of the rippled code when it was created. The levels are numbered from
|
||||
the bottom up with the lower level, lower numbered, more independent
|
||||
modules listed first, and the higher level, higher numbered modules with
|
||||
more dependencies listed later.
|
||||
@@ -30,33 +25,18 @@ more dependencies listed later.
|
||||
**tl;dr:** The modules listed first are more independent than the modules
|
||||
listed later.
|
||||
|
||||
## libxrpl Modules (Reusable Libraries)
|
||||
|
||||
| Level / Tier | Module(s) |
|
||||
| ------------ | ----------------------------------- |
|
||||
| 01 | xrpl/beast |
|
||||
| 02 | xrpl/basics |
|
||||
| 03 | xrpl/json xrpl/crypto |
|
||||
| 04 | xrpl/protocol |
|
||||
| 05 | xrpl/core xrpl/resource xrpl/server |
|
||||
| 06 | xrpl/ledger xrpl/nodestore xrpl/net |
|
||||
| 07 | xrpl/shamap |
|
||||
|
||||
## xrpld Modules (Application Implementation)
|
||||
|
||||
| Level / Tier | Module(s) |
|
||||
| ------------ | -------------------------------- |
|
||||
| 05 | xrpld/conditions xrpld/consensus |
|
||||
| 06 | xrpld/core xrpld/peerfinder |
|
||||
| 07 | xrpld/shamap xrpld/overlay |
|
||||
| 08 | xrpld/app |
|
||||
| 09 | xrpld/rpc |
|
||||
| 10 | xrpld/perflog |
|
||||
|
||||
## Test Modules
|
||||
|
||||
| Level / Tier | Module(s) |
|
||||
| ------------ | -------------------------------------------------------------------------------------------------------- |
|
||||
| 01 | ripple/beast ripple/unity |
|
||||
| 02 | ripple/basics |
|
||||
| 03 | ripple/json ripple/crypto |
|
||||
| 04 | ripple/protocol |
|
||||
| 05 | ripple/core ripple/conditions ripple/consensus ripple/resource ripple/server |
|
||||
| 06 | ripple/peerfinder ripple/ledger ripple/nodestore ripple/net |
|
||||
| 07 | ripple/shamap ripple/overlay |
|
||||
| 08 | ripple/app |
|
||||
| 09 | ripple/rpc |
|
||||
| 10 | ripple/perflog |
|
||||
| 11 | test/jtx test/beast test/csf |
|
||||
| 12 | test/unit_test |
|
||||
| 13 | test/crypto test/conditions test/json test/resource test/shamap test/peerfinder test/basics test/overlay |
|
||||
@@ -65,8 +45,8 @@ listed later.
|
||||
| 16 | test/rpc test/app |
|
||||
|
||||
(Note that `test` levelization is _much_ less important and _much_ less
|
||||
strictly enforced than `xrpl`/`xrpld` levelization, other than the requirement
|
||||
that `test` code should _never_ be included in `xrpl` or `xrpld` code.)
|
||||
strictly enforced than `ripple` levelization, other than the requirement
|
||||
that `test` code should _never_ be included in `ripple` code.)
|
||||
|
||||
## Validation
|
||||
|
||||
|
||||
@@ -19,6 +19,12 @@ Loop: xrpld.app xrpld.rpc
|
||||
Loop: xrpld.app xrpld.shamap
|
||||
xrpld.shamap ~= xrpld.app
|
||||
|
||||
Loop: xrpld.core xrpld.perflog
|
||||
xrpld.perflog == xrpld.core
|
||||
|
||||
Loop: xrpld.overlay xrpld.rpc
|
||||
xrpld.rpc ~= xrpld.overlay
|
||||
|
||||
Loop: xrpld.perflog xrpld.rpc
|
||||
xrpld.rpc ~= xrpld.perflog
|
||||
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
doctest.basics > xrpl.basics
|
||||
doctest.basics > xrpl.protocol
|
||||
doctest.beast > xrpl.basics
|
||||
doctest.core > xrpl.core
|
||||
doctest.core > xrpl.json
|
||||
doctest.csf > test.csf
|
||||
doctest.nodestore > xrpl.nodestore
|
||||
doctest.protocol > xrpl.basics
|
||||
doctest.protocol > xrpl.json
|
||||
doctest.protocol > xrpl.protocol
|
||||
libxrpl.basics > xrpl.basics
|
||||
libxrpl.core > xrpl.basics
|
||||
libxrpl.core > xrpl.core
|
||||
libxrpl.crypto > xrpl.basics
|
||||
libxrpl.json > xrpl.basics
|
||||
libxrpl.json > xrpl.json
|
||||
@@ -42,7 +30,6 @@ test.app > test.rpc
|
||||
test.app > test.toplevel
|
||||
test.app > test.unit_test
|
||||
test.app > xrpl.basics
|
||||
test.app > xrpl.core
|
||||
test.app > xrpld.app
|
||||
test.app > xrpld.core
|
||||
test.app > xrpld.overlay
|
||||
@@ -55,7 +42,7 @@ test.app > xrpl.resource
|
||||
test.basics > test.jtx
|
||||
test.basics > test.unit_test
|
||||
test.basics > xrpl.basics
|
||||
test.basics > xrpl.core
|
||||
test.basics > xrpld.perflog
|
||||
test.basics > xrpld.rpc
|
||||
test.basics > xrpl.json
|
||||
test.basics > xrpl.protocol
|
||||
@@ -74,8 +61,8 @@ test.core > test.jtx
|
||||
test.core > test.toplevel
|
||||
test.core > test.unit_test
|
||||
test.core > xrpl.basics
|
||||
test.core > xrpl.core
|
||||
test.core > xrpld.core
|
||||
test.core > xrpld.perflog
|
||||
test.core > xrpl.json
|
||||
test.core > xrpl.server
|
||||
test.csf > xrpl.basics
|
||||
@@ -132,7 +119,6 @@ test.resource > xrpl.resource
|
||||
test.rpc > test.jtx
|
||||
test.rpc > test.toplevel
|
||||
test.rpc > xrpl.basics
|
||||
test.rpc > xrpl.core
|
||||
test.rpc > xrpld.app
|
||||
test.rpc > xrpld.core
|
||||
test.rpc > xrpld.overlay
|
||||
@@ -160,8 +146,6 @@ test.unit_test > xrpl.basics
|
||||
tests.libxrpl > xrpl.basics
|
||||
tests.libxrpl > xrpl.json
|
||||
tests.libxrpl > xrpl.net
|
||||
xrpl.core > xrpl.basics
|
||||
xrpl.core > xrpl.json
|
||||
xrpl.json > xrpl.basics
|
||||
xrpl.ledger > xrpl.basics
|
||||
xrpl.ledger > xrpl.protocol
|
||||
@@ -181,9 +165,9 @@ xrpl.shamap > xrpl.nodestore
|
||||
xrpl.shamap > xrpl.protocol
|
||||
xrpld.app > test.unit_test
|
||||
xrpld.app > xrpl.basics
|
||||
xrpld.app > xrpl.core
|
||||
xrpld.app > xrpld.conditions
|
||||
xrpld.app > xrpld.consensus
|
||||
xrpld.app > xrpld.perflog
|
||||
xrpld.app > xrpl.json
|
||||
xrpld.app > xrpl.ledger
|
||||
xrpld.app > xrpl.net
|
||||
@@ -197,14 +181,13 @@ xrpld.consensus > xrpl.basics
|
||||
xrpld.consensus > xrpl.json
|
||||
xrpld.consensus > xrpl.protocol
|
||||
xrpld.core > xrpl.basics
|
||||
xrpld.core > xrpl.core
|
||||
xrpld.core > xrpl.json
|
||||
xrpld.core > xrpl.net
|
||||
xrpld.core > xrpl.protocol
|
||||
xrpld.overlay > xrpl.basics
|
||||
xrpld.overlay > xrpl.core
|
||||
xrpld.overlay > xrpld.core
|
||||
xrpld.overlay > xrpld.peerfinder
|
||||
xrpld.overlay > xrpld.perflog
|
||||
xrpld.overlay > xrpl.json
|
||||
xrpld.overlay > xrpl.protocol
|
||||
xrpld.overlay > xrpl.resource
|
||||
@@ -213,11 +196,8 @@ xrpld.peerfinder > xrpl.basics
|
||||
xrpld.peerfinder > xrpld.core
|
||||
xrpld.peerfinder > xrpl.protocol
|
||||
xrpld.perflog > xrpl.basics
|
||||
xrpld.perflog > xrpl.core
|
||||
xrpld.perflog > xrpld.rpc
|
||||
xrpld.perflog > xrpl.json
|
||||
xrpld.rpc > xrpl.basics
|
||||
xrpld.rpc > xrpl.core
|
||||
xrpld.rpc > xrpld.core
|
||||
xrpld.rpc > xrpl.json
|
||||
xrpld.rpc > xrpl.ledger
|
||||
|
||||
7
.github/scripts/rename/README.md
vendored
7
.github/scripts/rename/README.md
vendored
@@ -26,11 +26,6 @@ run from the repository root.
|
||||
references to `ripple` and `rippled` (with or without capital letters) to
|
||||
`xrpl` and `xrpld`, respectively. The name of the binary will remain as-is,
|
||||
and will only be renamed to `xrpld` by a later script.
|
||||
4. `.github/scripts/rename/binary.sh`: This script will rename the binary from
|
||||
`rippled` to `xrpld`, and reverses the symlink so that `rippled` points to
|
||||
the `xrpld` binary.
|
||||
5. `.github/scripts/rename/namespace.sh`: This script will rename the C++
|
||||
namespaces from `ripple` to `xrpl`.
|
||||
|
||||
You can run all these scripts from the repository root as follows:
|
||||
|
||||
@@ -38,6 +33,4 @@ You can run all these scripts from the repository root as follows:
|
||||
./.github/scripts/rename/definitions.sh .
|
||||
./.github/scripts/rename/copyright.sh .
|
||||
./.github/scripts/rename/cmake.sh .
|
||||
./.github/scripts/rename/binary.sh .
|
||||
./.github/scripts/rename/namespace.sh .
|
||||
```
|
||||
|
||||
54
.github/scripts/rename/binary.sh
vendored
54
.github/scripts/rename/binary.sh
vendored
@@ -1,54 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Exit the script as soon as an error occurs.
|
||||
set -e
|
||||
|
||||
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
|
||||
SED_COMMAND=sed
|
||||
if [[ "${OSTYPE}" == 'darwin'* ]]; then
|
||||
if ! command -v gsed &> /dev/null; then
|
||||
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
|
||||
exit 1
|
||||
fi
|
||||
SED_COMMAND=gsed
|
||||
fi
|
||||
|
||||
# This script changes the binary name from `rippled` to `xrpld`, and reverses
|
||||
# the symlink that currently points from `xrpld` to `rippled` so that it points
|
||||
# from `rippled` to `xrpld` instead.
|
||||
# Usage: .github/scripts/rename/binary.sh <repository directory>
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: $0 <repository directory>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIRECTORY=$1
|
||||
echo "Processing directory: ${DIRECTORY}"
|
||||
if [ ! -d "${DIRECTORY}" ]; then
|
||||
echo "Error: Directory '${DIRECTORY}' does not exist."
|
||||
exit 1
|
||||
fi
|
||||
pushd ${DIRECTORY}
|
||||
|
||||
# Remove the binary name override added by the cmake.sh script.
|
||||
${SED_COMMAND} -z -i -E 's@\s+# For the time being.+"rippled"\)@@' cmake/XrplCore.cmake
|
||||
|
||||
# Reverse the symlink.
|
||||
${SED_COMMAND} -i -E 's@create_symbolic_link\(rippled@create_symbolic_link(xrpld@' cmake/XrplInstall.cmake
|
||||
${SED_COMMAND} -i -E 's@/xrpld\$\{suffix\}@/rippled${suffix}@' cmake/XrplInstall.cmake
|
||||
|
||||
# Rename references to the binary.
|
||||
${SED_COMMAND} -i -E 's@rippled@xrpld@g' BUILD.md
|
||||
${SED_COMMAND} -i -E 's@rippled@xrpld@g' CONTRIBUTING.md
|
||||
${SED_COMMAND} -i -E 's@rippled@xrpld@g' .github/ISSUE_TEMPLATE/bug_report.md
|
||||
|
||||
# Restore and/or fix certain renames. The pre-commit hook will update the
|
||||
# formatting upon saving/committing.
|
||||
${SED_COMMAND} -i -E 's@ripple/xrpld@XRPLF/rippled@g' BUILD.md
|
||||
${SED_COMMAND} -i -E 's@XRPLF/xrpld@XRPLF/rippled@g' BUILD.md
|
||||
${SED_COMMAND} -i -E 's@xrpld \(`xrpld`\)@xrpld@g' BUILD.md
|
||||
${SED_COMMAND} -i -E 's@XRPLF/xrpld@XRPLF/rippled@g' CONTRIBUTING.md
|
||||
|
||||
popd
|
||||
echo "Processing complete."
|
||||
58
.github/scripts/rename/namespace.sh
vendored
58
.github/scripts/rename/namespace.sh
vendored
@@ -1,58 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Exit the script as soon as an error occurs.
|
||||
set -e
|
||||
|
||||
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
|
||||
SED_COMMAND=sed
|
||||
if [[ "${OSTYPE}" == 'darwin'* ]]; then
|
||||
if ! command -v gsed &> /dev/null; then
|
||||
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
|
||||
exit 1
|
||||
fi
|
||||
SED_COMMAND=gsed
|
||||
fi
|
||||
|
||||
# This script renames the `ripple` namespace to `xrpl` in this project.
|
||||
# Specifically, it renames all occurrences of `namespace ripple` and `ripple::`
|
||||
# to `namespace xrpl` and `xrpl::`, respectively, by scanning all header and
|
||||
# source files in the specified directory and its subdirectories, as well as any
|
||||
# occurrences in the documentation. It also renames them in the test suites.
|
||||
# Usage: .github/scripts/rename/namespace.sh <repository directory>
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: $0 <repository directory>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIRECTORY=$1
|
||||
echo "Processing directory: ${DIRECTORY}"
|
||||
if [ ! -d "${DIRECTORY}" ]; then
|
||||
echo "Error: Directory '${DIRECTORY}' does not exist."
|
||||
exit 1
|
||||
fi
|
||||
pushd ${DIRECTORY}
|
||||
|
||||
DIRECTORIES=("include" "src" "tests")
|
||||
for DIRECTORY in "${DIRECTORIES[@]}"; do
|
||||
echo "Processing directory: ${DIRECTORY}"
|
||||
|
||||
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" \) | while read -r FILE; do
|
||||
echo "Processing file: ${FILE}"
|
||||
${SED_COMMAND} -i 's/namespace ripple/namespace xrpl/g' "${FILE}"
|
||||
${SED_COMMAND} -i 's/ripple::/xrpl::/g' "${FILE}"
|
||||
${SED_COMMAND} -i -E 's/(BEAST_DEFINE_TESTSUITE.+)ripple(.+)/\1xrpl\2/g' "${FILE}"
|
||||
done
|
||||
done
|
||||
|
||||
# Special case for NuDBFactory that has ripple twice in the test suite name.
|
||||
${SED_COMMAND} -i -E 's/(BEAST_DEFINE_TESTSUITE.+)ripple(.+)/\1xrpl\2/g' src/test/nodestore/NuDBFactory_test.cpp
|
||||
|
||||
DIRECTORY=$1
|
||||
find "${DIRECTORY}" -type f -name "*.md" | while read -r FILE; do
|
||||
echo "Processing file: ${FILE}"
|
||||
${SED_COMMAND} -i 's/ripple::/xrpl::/g' "${FILE}"
|
||||
done
|
||||
|
||||
popd
|
||||
echo "Renaming complete."
|
||||
56
.github/scripts/strategy-matrix/linux.json
vendored
56
.github/scripts/strategy-matrix/linux.json
vendored
@@ -15,196 +15,196 @@
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "12",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "13",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "14",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "15",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "16",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "17",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "18",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "19",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "20",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "trixie",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "14",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "trixie",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "15",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "trixie",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "20",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "trixie",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "21",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "8",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "14",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "8",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "any",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "9",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "12",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "9",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "13",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "9",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "14",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "9",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "any",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "10",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "14",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "10",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "any",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "jammy",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "12",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "noble",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "13",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "noble",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "14",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "noble",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "16",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "noble",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "17",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "noble",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "18",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "noble",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "19",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
}
|
||||
],
|
||||
"build_type": ["Debug", "Release"],
|
||||
|
||||
16
.github/workflows/reusable-build-test-config.yml
vendored
16
.github/workflows/reusable-build-test-config.yml
vendored
@@ -77,7 +77,7 @@ jobs:
|
||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/.github/actions/prepare-runner@99685816bb60a95a66852f212f382580e180df3a
|
||||
uses: XRPLF/actions/.github/actions/prepare-runner@ff9f8f649df5855ffe1a1ae715df43e51807f2e0
|
||||
with:
|
||||
disable_ccache: false
|
||||
|
||||
@@ -129,14 +129,14 @@ jobs:
|
||||
--parallel "${BUILD_NPROC}" \
|
||||
--target "${CMAKE_TARGET}"
|
||||
|
||||
- name: Upload the binary (Linux)
|
||||
- name: Upload rippled artifact (Linux)
|
||||
if: ${{ github.repository_owner == 'XRPLF' && runner.os == 'Linux' }}
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
env:
|
||||
BUILD_DIR: ${{ inputs.build_dir }}
|
||||
with:
|
||||
name: xrpld-${{ inputs.config_name }}
|
||||
path: ${{ env.BUILD_DIR }}/xrpld
|
||||
name: rippled-${{ inputs.config_name }}
|
||||
path: ${{ env.BUILD_DIR }}/rippled
|
||||
retention-days: 3
|
||||
if-no-files-found: error
|
||||
|
||||
@@ -144,8 +144,8 @@ jobs:
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
working-directory: ${{ inputs.build_dir }}
|
||||
run: |
|
||||
ldd ./xrpld
|
||||
if [ "$(ldd ./xrpld | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then
|
||||
ldd ./rippled
|
||||
if [ "$(ldd ./rippled | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then
|
||||
echo 'The binary is statically linked.'
|
||||
else
|
||||
echo 'The binary is dynamically linked.'
|
||||
@@ -156,7 +156,7 @@ jobs:
|
||||
if: ${{ runner.os == 'Linux' && env.ENABLED_VOIDSTAR == 'true' }}
|
||||
working-directory: ${{ inputs.build_dir }}
|
||||
run: |
|
||||
./xrpld --version | grep libvoidstar
|
||||
./rippled --version | grep libvoidstar
|
||||
|
||||
- name: Run the separate tests
|
||||
if: ${{ !inputs.build_only }}
|
||||
@@ -177,7 +177,7 @@ jobs:
|
||||
env:
|
||||
BUILD_NPROC: ${{ steps.nproc.outputs.nproc }}
|
||||
run: |
|
||||
./xrpld --unittest --unittest-jobs "${BUILD_NPROC}"
|
||||
./rippled --unittest --unittest-jobs "${BUILD_NPROC}"
|
||||
|
||||
- name: Debug failure (Linux)
|
||||
if: ${{ failure() && runner.os == 'Linux' && !inputs.build_only }}
|
||||
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
env:
|
||||
MESSAGE: |
|
||||
|
||||
The dependency relationships between the modules in xrpld have
|
||||
The dependency relationships between the modules in rippled have
|
||||
changed, which may be an improvement or a regression.
|
||||
|
||||
A rule of thumb is that if your changes caused something to be
|
||||
|
||||
4
.github/workflows/reusable-check-rename.yml
vendored
4
.github/workflows/reusable-check-rename.yml
vendored
@@ -25,10 +25,6 @@ jobs:
|
||||
run: .github/scripts/rename/copyright.sh .
|
||||
- name: Check CMake configs
|
||||
run: .github/scripts/rename/cmake.sh .
|
||||
- name: Check binary name
|
||||
run: .github/scripts/rename/binary.sh .
|
||||
- name: Check namespaces
|
||||
run: .github/scripts/rename/namespace.sh .
|
||||
- name: Check for differences
|
||||
env:
|
||||
MESSAGE: |
|
||||
|
||||
2
.github/workflows/upload-conan-deps.yml
vendored
2
.github/workflows/upload-conan-deps.yml
vendored
@@ -70,7 +70,7 @@ jobs:
|
||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/.github/actions/prepare-runner@99685816bb60a95a66852f212f382580e180df3a
|
||||
uses: XRPLF/actions/.github/actions/prepare-runner@ff9f8f649df5855ffe1a1ae715df43e51807f2e0
|
||||
with:
|
||||
disable_ccache: false
|
||||
|
||||
|
||||
56
BUILD.md
56
BUILD.md
@@ -10,7 +10,7 @@
|
||||
## Branches
|
||||
|
||||
For a stable release, choose the `master` branch or one of the [tagged
|
||||
releases](https://github.com/XRPLF/rippled/releases).
|
||||
releases](https://github.com/ripple/rippled/releases).
|
||||
|
||||
```bash
|
||||
git checkout master
|
||||
@@ -33,7 +33,7 @@ git checkout develop
|
||||
|
||||
See [System Requirements](https://xrpl.org/system-requirements.html).
|
||||
|
||||
Building xrpld generally requires git, Python, Conan, CMake, and a C++
|
||||
Building rippled generally requires git, Python, Conan, CMake, and a C++
|
||||
compiler. Some guidance on setting up such a [C++ development environment can be
|
||||
found here](./docs/build/environment.md).
|
||||
|
||||
@@ -45,7 +45,7 @@ found here](./docs/build/environment.md).
|
||||
It is possible to build with Conan 1.60+, but the instructions are
|
||||
significantly different, which is why we are not recommending it.
|
||||
|
||||
`xrpld` is written in the C++20 dialect and includes the `<concepts>` header.
|
||||
`rippled` is written in the C++20 dialect and includes the `<concepts>` header.
|
||||
The [minimum compiler versions][2] required are:
|
||||
|
||||
| Compiler | Version |
|
||||
@@ -66,7 +66,7 @@ Linux](./docs/build/environment.md#linux).
|
||||
|
||||
### Mac
|
||||
|
||||
Many xrpld engineers use macOS for development.
|
||||
Many rippled engineers use macOS for development.
|
||||
|
||||
Here are [sample instructions for setting up a C++ development environment on
|
||||
macOS](./docs/build/environment.md#macos).
|
||||
@@ -126,7 +126,7 @@ default profile.
|
||||
### Patched recipes
|
||||
|
||||
The recipes in Conan Center occasionally need to be patched for compatibility
|
||||
with the latest version of `xrpld`. We maintain a fork of the Conan Center
|
||||
with the latest version of `rippled`. We maintain a fork of the Conan Center
|
||||
[here](https://github.com/XRPLF/conan-center-index/) containing the patches.
|
||||
|
||||
To ensure our patched recipes are used, you must add our Conan remote at a
|
||||
@@ -292,7 +292,7 @@ sed -i.bak -e 's|^compiler\.libcxx=.*$|compiler.libcxx=libstdc++11|' $(conan con
|
||||
to do that is to run the shortcut "x64 Native Tools Command Prompt" for the
|
||||
version of Visual Studio that you have installed.
|
||||
|
||||
Windows developers must also build `xrpld` and its dependencies for the x64
|
||||
Windows developers must also build `rippled` and its dependencies for the x64
|
||||
architecture:
|
||||
|
||||
```bash
|
||||
@@ -422,9 +422,9 @@ tools.build:cxxflags=['-DBOOST_ASIO_DISABLE_CONCEPTS']
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -Dxrpld=ON -Dtests=ON ..
|
||||
```
|
||||
|
||||
**Note:** You can pass build options for `xrpld` in this step.
|
||||
**Note:** You can pass build options for `rippled` in this step.
|
||||
|
||||
4. Build `xrpld`.
|
||||
4. Build `rippled`.
|
||||
|
||||
For a single-configuration generator, it will build whatever configuration
|
||||
you passed for `CMAKE_BUILD_TYPE`. For a multi-configuration generator, you
|
||||
@@ -443,26 +443,26 @@ tools.build:cxxflags=['-DBOOST_ASIO_DISABLE_CONCEPTS']
|
||||
cmake --build . --config Debug
|
||||
```
|
||||
|
||||
5. Test xrpld.
|
||||
5. Test rippled.
|
||||
|
||||
Single-config generators:
|
||||
|
||||
```
|
||||
./xrpld --unittest --unittest-jobs N
|
||||
./rippled --unittest --unittest-jobs N
|
||||
```
|
||||
|
||||
Multi-config generators:
|
||||
|
||||
```
|
||||
./Release/xrpld --unittest --unittest-jobs N
|
||||
./Debug/xrpld --unittest --unittest-jobs N
|
||||
./Release/rippled --unittest --unittest-jobs N
|
||||
./Debug/rippled --unittest --unittest-jobs N
|
||||
```
|
||||
|
||||
Replace the `--unittest-jobs` parameter N with the desired unit tests
|
||||
concurrency. Recommended setting is half of the number of available CPU
|
||||
cores.
|
||||
|
||||
The location of `xrpld` binary in your build directory depends on your
|
||||
The location of `rippled` binary in your build directory depends on your
|
||||
CMake generator. Pass `--help` to see the rest of the command line options.
|
||||
|
||||
## Coverage report
|
||||
@@ -481,18 +481,18 @@ Prerequisites for the coverage report:
|
||||
|
||||
A coverage report is created when the following steps are completed, in order:
|
||||
|
||||
1. `xrpld` binary built with instrumentation data, enabled by the `coverage`
|
||||
1. `rippled` binary built with instrumentation data, enabled by the `coverage`
|
||||
option mentioned above
|
||||
2. completed one or more run of the unit tests, which populates coverage capture data
|
||||
3. completed run of the `gcovr` tool (which internally invokes either `gcov` or `llvm-cov`)
|
||||
to assemble both instrumentation data and the coverage capture data into a coverage report
|
||||
|
||||
The last step of the above is automated into a single target `coverage`. The instrumented
|
||||
`xrpld` binary can also be used for regular development or testing work, at
|
||||
`rippled` binary can also be used for regular development or testing work, at
|
||||
the cost of extra disk space utilization and a small performance hit
|
||||
(to store coverage capture data). Since `xrpld` binary is simply a dependency of the
|
||||
(to store coverage capture data). Since `rippled` binary is simply a dependency of the
|
||||
coverage report target, it is possible to re-run the `coverage` target without
|
||||
rebuilding the `xrpld` binary. Note, running of the unit tests before the `coverage`
|
||||
rebuilding the `rippled` binary. Note, running of the unit tests before the `coverage`
|
||||
target is left to the developer. Each such run will append to the coverage data
|
||||
collected in the build directory.
|
||||
|
||||
@@ -520,16 +520,16 @@ stored inside the build directory, as either of:
|
||||
|
||||
## Options
|
||||
|
||||
| Option | Default Value | Description |
|
||||
| ---------- | ------------- | ------------------------------------------------------------------ |
|
||||
| `assert` | OFF | Enable assertions. |
|
||||
| `coverage` | OFF | Prepare the coverage report. |
|
||||
| `san` | N/A | Enable a sanitizer with Clang. Choices are `thread` and `address`. |
|
||||
| `tests` | OFF | Build tests. |
|
||||
| `unity` | OFF | Configure a unity build. |
|
||||
| `xrpld` | OFF | Build the xrpld application, and not just the libxrpl library. |
|
||||
| `werr` | OFF | Treat compilation warnings as errors |
|
||||
| `wextra` | OFF | Enable additional compilation warnings |
|
||||
| Option | Default Value | Description |
|
||||
| ---------- | ------------- | -------------------------------------------------------------------------- |
|
||||
| `assert` | OFF | Enable assertions. |
|
||||
| `coverage` | OFF | Prepare the coverage report. |
|
||||
| `san` | N/A | Enable a sanitizer with Clang. Choices are `thread` and `address`. |
|
||||
| `tests` | OFF | Build tests. |
|
||||
| `unity` | OFF | Configure a unity build. |
|
||||
| `xrpld` | OFF | Build the xrpld (`rippled`) application, and not just the libxrpl library. |
|
||||
| `werr` | OFF | Treat compilation warnings as errors |
|
||||
| `wextra` | OFF | Enable additional compilation warnings |
|
||||
|
||||
[Unity builds][5] may be faster for the first build
|
||||
(at the cost of much more memory) since they concatenate sources into fewer
|
||||
@@ -573,7 +573,7 @@ you might have generated CMake files for a different `build_type` than the
|
||||
`CMAKE_BUILD_TYPE` you passed to Conan.
|
||||
|
||||
```
|
||||
/xrpld/.build/pb-xrpl.libpb/xrpl/proto/xrpl.pb.h:10:10: fatal error: 'google/protobuf/port_def.inc' file not found
|
||||
/rippled/.build/pb-xrpl.libpb/xrpl/proto/xrpl.pb.h:10:10: fatal error: 'google/protobuf/port_def.inc' file not found
|
||||
10 | #include <google/protobuf/port_def.inc>
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
1 error generated.
|
||||
|
||||
@@ -113,6 +113,7 @@ find_package(date REQUIRED)
|
||||
find_package(ed25519 REQUIRED)
|
||||
find_package(nudb REQUIRED)
|
||||
find_package(secp256k1 REQUIRED)
|
||||
find_package(wasmi REQUIRED)
|
||||
find_package(xxHash REQUIRED)
|
||||
|
||||
target_link_libraries(xrpl_libs INTERFACE
|
||||
@@ -147,5 +148,4 @@ include(XrplValidatorKeys)
|
||||
if(tests)
|
||||
include(CTest)
|
||||
add_subdirectory(src/tests/libxrpl)
|
||||
add_subdirectory(src/doctest)
|
||||
endif()
|
||||
|
||||
@@ -24,7 +24,7 @@ your verifying key. Please set up [signature verification][signing].
|
||||
|
||||
In general, external contributions should be developed in your personal
|
||||
[fork][forking]. Contributions from developers with write permissions
|
||||
should be done in [the main repository][xrpld] in a branch with
|
||||
should be done in [the main repository][rippled] in a branch with
|
||||
a permitted prefix. Permitted prefixes are:
|
||||
|
||||
- XLS-[a-zA-Z0-9]+/.+
|
||||
@@ -73,7 +73,7 @@ Ensure that your code compiles according to the build instructions in
|
||||
|
||||
Please write tests for your code.
|
||||
If your test can be run offline, in under 60 seconds, then it can be an
|
||||
automatic test run by `xrpld --unittest`.
|
||||
automatic test run by `rippled --unittest`.
|
||||
Otherwise, it must be a manual test.
|
||||
|
||||
If you create new source files, they must be organized as follows:
|
||||
@@ -256,13 +256,13 @@ pre-commit install
|
||||
We are using [Antithesis](https://antithesis.com/) for continuous fuzzing,
|
||||
and keep a copy of [Antithesis C++ SDK](https://github.com/antithesishq/antithesis-sdk-cpp/)
|
||||
in `external/antithesis-sdk`. One of the aims of fuzzing is to identify bugs
|
||||
by finding external conditions which cause contracts violations inside `xrpld`.
|
||||
by finding external conditions which cause contracts violations inside `rippled`.
|
||||
The contracts are expressed as `XRPL_ASSERT` or `UNREACHABLE` (defined in
|
||||
`include/xrpl/beast/utility/instrumentation.h`), which are effectively (outside
|
||||
of Antithesis) wrappers for `assert(...)` with added name. The purpose of name
|
||||
is to provide contracts with stable identity which does not rely on line numbers.
|
||||
|
||||
When `xrpld` is built with the Antithesis instrumentation enabled
|
||||
When `rippled` is built with the Antithesis instrumentation enabled
|
||||
(using `voidstar` CMake option) and ran on the Antithesis platform, the
|
||||
contracts become
|
||||
[test properties](https://antithesis.com/docs/using_antithesis/properties.html);
|
||||
@@ -304,7 +304,7 @@ For this reason:
|
||||
- Example **bad** name
|
||||
`"RFC1751::insert(char* s, int x, int start, int length) : length is greater than or equal zero"`
|
||||
(missing namespace, unnecessary full function signature, description too verbose).
|
||||
Good name: `"xrpl::RFC1751::insert : minimum length"`.
|
||||
Good name: `"ripple::RFC1751::insert : minimum length"`.
|
||||
- In **few** well-justified cases a non-standard name can be used, in which case a
|
||||
comment should be placed to explain the rationale (example in `contract.cpp`)
|
||||
- Do **not** rename a contract without a good reason (e.g. the name no longer
|
||||
@@ -318,7 +318,7 @@ For this reason:
|
||||
|
||||
To execute all unit tests:
|
||||
|
||||
`xrpld --unittest --unittest-jobs=<number of cores>`
|
||||
`rippled --unittest --unittest-jobs=<number of cores>`
|
||||
|
||||
(Note: Using multiple cores on a Mac M1 can cause spurious test failures. The
|
||||
cause is still under investigation. If you observe this problem, try specifying fewer jobs.)
|
||||
@@ -326,7 +326,7 @@ cause is still under investigation. If you observe this problem, try specifying
|
||||
To run a specific set of test suites:
|
||||
|
||||
```
|
||||
xrpld --unittest TestSuiteName
|
||||
rippled --unittest TestSuiteName
|
||||
```
|
||||
|
||||
Note: In this example, all tests with prefix `TestSuiteName` will be run, so if
|
||||
@@ -1075,7 +1075,7 @@ git fetch upstreams
|
||||
[contrib]: https://docs.github.com/en/get-started/quickstart/contributing-to-projects
|
||||
[squash]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits
|
||||
[forking]: https://github.com/XRPLF/rippled/fork
|
||||
[xrpld]: https://github.com/XRPLF/rippled
|
||||
[rippled]: https://github.com/XRPLF/rippled
|
||||
[signing]: https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification
|
||||
[setup-upstreams]: ./bin/git/setup-upstreams.sh
|
||||
[squash-branches]: ./bin/git/squash-branches.sh
|
||||
|
||||
@@ -1290,6 +1290,39 @@
|
||||
# Example:
|
||||
# owner_reserve = 2000000 # 2 XRP
|
||||
#
|
||||
# extension_compute_limit = <gas>
|
||||
#
|
||||
# The extension compute limit is the maximum amount of gas that can be
|
||||
# consumed by a single transaction. The gas limit is used to prevent
|
||||
# transactions from consuming too many resources.
|
||||
#
|
||||
# If this parameter is unspecified, rippled will use an internal
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
# extension_compute_limit = 1000000 # 1 million gas
|
||||
#
|
||||
# extension_size_limit = <bytes>
|
||||
#
|
||||
# The extension size limit is the maximum size of a WASM extension in
|
||||
# bytes. The size limit is used to prevent extensions from consuming
|
||||
# too many resources.
|
||||
#
|
||||
# If this parameter is unspecified, rippled will use an internal
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
# extension_size_limit = 100000 # 100 kb
|
||||
#
|
||||
# gas_price = <bytes>
|
||||
#
|
||||
# The gas price is the conversion between WASM gas and its price in drops.
|
||||
#
|
||||
# If this parameter is unspecified, rippled will use an internal
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
# gas_price = 1000000 # 1 drop per gas
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# 9. Misc Settings
|
||||
|
||||
@@ -63,6 +63,7 @@ target_link_libraries(xrpl.imports.main
|
||||
Xrpl::opts
|
||||
Xrpl::syslibs
|
||||
secp256k1::secp256k1
|
||||
wasmi::wasmi
|
||||
xrpl.libpb
|
||||
xxHash::xxhash
|
||||
$<$<BOOL:${voidstar}>:antithesis-sdk-cpp>
|
||||
@@ -94,18 +95,10 @@ target_link_libraries(xrpl.libxrpl.protocol PUBLIC
|
||||
)
|
||||
|
||||
# Level 05
|
||||
add_module(xrpl core)
|
||||
target_link_libraries(xrpl.libxrpl.core PUBLIC
|
||||
xrpl.libxrpl.basics
|
||||
xrpl.libxrpl.json
|
||||
xrpl.libxrpl.protocol
|
||||
)
|
||||
|
||||
# Level 06
|
||||
add_module(xrpl resource)
|
||||
target_link_libraries(xrpl.libxrpl.resource PUBLIC xrpl.libxrpl.protocol)
|
||||
|
||||
# Level 07
|
||||
# Level 06
|
||||
add_module(xrpl net)
|
||||
target_link_libraries(xrpl.libxrpl.net PUBLIC
|
||||
xrpl.libxrpl.basics
|
||||
@@ -152,7 +145,6 @@ target_sources(xrpl.libxrpl PRIVATE ${sources})
|
||||
target_link_modules(xrpl PUBLIC
|
||||
basics
|
||||
beast
|
||||
core
|
||||
crypto
|
||||
json
|
||||
protocol
|
||||
@@ -232,4 +224,6 @@ if(xrpld)
|
||||
src/test/ledger/Invariants_test.cpp
|
||||
PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
|
||||
endif()
|
||||
# For the time being, we will keep the name of the binary as it was.
|
||||
set_target_properties(xrpld PROPERTIES OUTPUT_NAME "rippled")
|
||||
endif()
|
||||
|
||||
@@ -16,7 +16,6 @@ install (
|
||||
xrpl.libxrpl
|
||||
xrpl.libxrpl.basics
|
||||
xrpl.libxrpl.beast
|
||||
xrpl.libxrpl.core
|
||||
xrpl.libxrpl.crypto
|
||||
xrpl.libxrpl.json
|
||||
xrpl.libxrpl.ledger
|
||||
@@ -68,8 +67,8 @@ if (is_root_project AND TARGET xrpld)
|
||||
install(CODE "
|
||||
set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\")
|
||||
include(create_symbolic_link)
|
||||
create_symbolic_link(xrpld${suffix} \
|
||||
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/rippled${suffix})
|
||||
create_symbolic_link(rippled${suffix} \
|
||||
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/xrpld${suffix})
|
||||
")
|
||||
endif ()
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"requires": [
|
||||
"zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76%1756234269.497",
|
||||
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1756234289.683",
|
||||
"wasmi/1.0.4#9cc7fac2db8eea07368fd0328a53648a%1766110559.972459",
|
||||
"sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1756234266.869",
|
||||
"soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1756234262.318",
|
||||
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1756234314.246",
|
||||
|
||||
@@ -35,6 +35,7 @@ class Xrpl(ConanFile):
|
||||
"openssl/3.5.4",
|
||||
"secp256k1/0.7.0",
|
||||
"soci/4.0.3",
|
||||
"wasmi/1.0.4",
|
||||
"zlib/1.3.1",
|
||||
]
|
||||
|
||||
@@ -125,6 +126,7 @@ class Xrpl(ConanFile):
|
||||
transitive_headers_opt = (
|
||||
{"transitive_headers": True} if conan_version.split(".")[0] == "2" else {}
|
||||
)
|
||||
|
||||
self.requires("boost/1.88.0", force=True, **transitive_headers_opt)
|
||||
self.requires("date/3.0.4", **transitive_headers_opt)
|
||||
self.requires("lz4/1.10.0", force=True)
|
||||
@@ -212,6 +214,7 @@ class Xrpl(ConanFile):
|
||||
"soci::soci",
|
||||
"secp256k1::secp256k1",
|
||||
"sqlite3::sqlite",
|
||||
"wasmi::wasmi",
|
||||
"xxhash::xxhash",
|
||||
"zlib::zlib",
|
||||
]
|
||||
|
||||
18
external/wasmi/conandata.yml
vendored
Normal file
18
external/wasmi/conandata.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# Do not update. Maintained by programmability team.
|
||||
|
||||
sources:
|
||||
"1.0.4":
|
||||
url: https://github.com/wasmi-labs/wasmi/archive/refs/tags/v1.0.4.tar.gz
|
||||
sha256: 90bfdd6d43930958c0f3eabe82e90800a7df4204b673c22f6966f94c6a5452e0
|
||||
"0.42.1":
|
||||
url: https://github.com/wasmi-labs/wasmi/archive/refs/tags/v0.42.1.tar.gz
|
||||
sha256: 2a5697be33c7afce8f671af4a5a3621d9e93ce55d253d31bd8201458e465fbb8
|
||||
patches:
|
||||
"1.0.4":
|
||||
- patch_file: "patches/0002-xrplf-1.0.4.patch"
|
||||
patch_description: Integrate wasmi lib into smart-escrow.
|
||||
patch_type: conan
|
||||
"0.42.1":
|
||||
- patch_file: "patches/0001-xrplf-0.42.1.patch"
|
||||
patch_description: Integrate wasmi lib into smart-escrow.
|
||||
patch_type: conan
|
||||
42
external/wasmi/conanfile.py
vendored
Normal file
42
external/wasmi/conanfile.py
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
from conan import ConanFile, tools
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get
|
||||
import os
|
||||
|
||||
required_conan_version = ">=2.0.0"
|
||||
|
||||
class WasmiConan(ConanFile):
|
||||
name = "wasmi"
|
||||
license = "Apache License v2.0"
|
||||
url = "https://github.com/wasmi-labs/wasmi.git"
|
||||
description = "WebAssembly (Wasm) interpreter"
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {"shared": [False]}
|
||||
default_options = {"shared": False}
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
apply_conandata_patches(self)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure(build_script_folder=os.path.join(self.source_folder, "crates", "c_api"))
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libs = ["wasmi"]
|
||||
665
external/wasmi/patches/0002-xrplf-1.0.4.patch
vendored
Normal file
665
external/wasmi/patches/0002-xrplf-1.0.4.patch
vendored
Normal file
@@ -0,0 +1,665 @@
|
||||
diff --git a/crates/c_api/CMakeLists.txt b/crates/c_api/CMakeLists.txt
|
||||
index b15c787..54eaed2 100644
|
||||
--- a/crates/c_api/CMakeLists.txt
|
||||
+++ b/crates/c_api/CMakeLists.txt
|
||||
@@ -6,6 +6,8 @@ option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
|
||||
option(WASMI_ALWAYS_BUILD "If cmake should always invoke cargo to build Wasmi" ON)
|
||||
set(WASMI_TARGET "" CACHE STRING "Rust target to build for")
|
||||
|
||||
+add_compile_definitions(COMPILING_WASM_RUNTIME_API=1)
|
||||
+
|
||||
if(NOT WASMI_TARGET)
|
||||
execute_process(
|
||||
COMMAND rustc -vV
|
||||
@@ -43,6 +45,10 @@ endif()
|
||||
list(TRANSFORM WASMI_SHARED_FILES PREPEND ${WASMI_TARGET_DIR}/)
|
||||
list(TRANSFORM WASMI_STATIC_FILES PREPEND ${WASMI_TARGET_DIR}/)
|
||||
|
||||
+if(NOT BUILD_SHARED_LIBS)
|
||||
+ set(WASMI_SHARED_FILES)
|
||||
+endif()
|
||||
+
|
||||
# Instructions on how to build and install the Wasmi Rust crate.
|
||||
find_program(WASMI_CARGO_BINARY cargo REQUIRED)
|
||||
include(ExternalProject)
|
||||
@@ -79,7 +85,6 @@ else()
|
||||
target_link_libraries(wasmi INTERFACE ${WASMI_STATIC_FILES})
|
||||
|
||||
if(WASMI_TARGET MATCHES "windows")
|
||||
- target_compile_options(wasmi INTERFACE -DWASM_API_EXTERN= -DWASI_API_EXTERN=)
|
||||
target_link_libraries(wasmi INTERFACE ws2_32 advapi32 userenv ntdll shell32 ole32 bcrypt)
|
||||
elseif(NOT WASMI_TARGET MATCHES "darwin")
|
||||
target_link_libraries(wasmi INTERFACE pthread dl m)
|
||||
@@ -112,6 +117,7 @@ install(
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
+if(BUILD_SHARED_LIBS)
|
||||
if(WASMI_TARGET MATCHES "darwin")
|
||||
set(INSTALLED_LIB "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libwasmi.dylib")
|
||||
install(
|
||||
@@ -131,6 +137,7 @@ if(WASMI_TARGET MATCHES "darwin")
|
||||
install(CODE "execute_process(COMMAND ${install_name_tool_cmd})")
|
||||
endif()
|
||||
endif()
|
||||
+endif()
|
||||
|
||||
# Documentation Generation via Doxygen:
|
||||
set(DOXYGEN_CONF_IN ${CMAKE_CURRENT_SOURCE_DIR}/doxygen.conf.in)
|
||||
@@ -141,19 +148,3 @@ add_custom_target(doc
|
||||
DEPENDS ${WASMI_GENERATED_CONF_H} ${DOXYGEN_CONF_OUT}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
-
|
||||
-# C-Header Formatting via clang-format:
|
||||
-find_program(CLANG_FORMAT clang-format REQUIRED)
|
||||
-file(GLOB_RECURSE HEADER_FILES
|
||||
- ${CMAKE_CURRENT_SOURCE_DIR}/include/wasmi.h
|
||||
- ${CMAKE_CURRENT_SOURCE_DIR}/include/wasmi/*.h
|
||||
- ${CMAKE_CURRENT_SOURCE_DIR}/include/wasmi/*.hh
|
||||
-)
|
||||
-add_custom_target(check-format
|
||||
- COMMAND ${CLANG_FORMAT} -style=llvm -Werror --dry-run ${HEADER_FILES}
|
||||
- COMMENT "clang-format: Check formatting for Wasmi C-API header files"
|
||||
-)
|
||||
-add_custom_target(format
|
||||
- COMMAND ${CLANG_FORMAT} -style=llvm -i ${HEADER_FILES}
|
||||
- COMMENT "clang-format: Apply formatting rules for Wasmi C-API header files"
|
||||
-)
|
||||
diff --git a/crates/c_api/include/wasm.h b/crates/c_api/include/wasm.h
|
||||
index 5ee617f..a76f10e 100644
|
||||
--- a/crates/c_api/include/wasm.h
|
||||
+++ b/crates/c_api/include/wasm.h
|
||||
@@ -13,11 +13,17 @@
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef WASM_API_EXTERN
|
||||
-#if defined(_WIN32) && !defined(__MINGW32__) && !defined(LIBWASM_STATIC)
|
||||
+#if defined(_MSC_BUILD)
|
||||
+#if defined(COMPILING_WASM_RUNTIME_API)
|
||||
+#define WASM_API_EXTERN __declspec(dllexport)
|
||||
+#elif defined(_DLL)
|
||||
#define WASM_API_EXTERN __declspec(dllimport)
|
||||
#else
|
||||
#define WASM_API_EXTERN
|
||||
#endif
|
||||
+#else
|
||||
+#define WASM_API_EXTERN
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -145,7 +151,13 @@ WASM_API_EXTERN own wasm_engine_t* wasm_engine_new_with_config(own wasm_config_t
|
||||
WASM_DECLARE_OWN(store)
|
||||
|
||||
WASM_API_EXTERN own wasm_store_t* wasm_store_new(wasm_engine_t*);
|
||||
+WASM_API_EXTERN own wasm_store_t* wasm_store_new_with_memory_max_pages(wasm_engine_t*, uint32_t max_pages);
|
||||
+
|
||||
+// Store fuel functions (forward declarations)
|
||||
+struct wasmi_error;
|
||||
|
||||
+WASM_API_EXTERN struct wasmi_error* wasm_store_get_fuel(const wasm_store_t*, uint64_t* fuel);
|
||||
+WASM_API_EXTERN struct wasmi_error* wasm_store_set_fuel(wasm_store_t*, uint64_t fuel);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Type Representations
|
||||
diff --git a/crates/c_api/include/wasmi.h b/crates/c_api/include/wasmi.h
|
||||
index 2caffa3..8f0f0ed 100644
|
||||
--- a/crates/c_api/include/wasmi.h
|
||||
+++ b/crates/c_api/include/wasmi.h
|
||||
@@ -10,18 +10,18 @@
|
||||
/**
|
||||
* \brief Wasmi version string.
|
||||
*/
|
||||
-#define WASMI_VERSION "0.35.0"
|
||||
+#define WASMI_VERSION "1.0.4"
|
||||
/**
|
||||
* \brief Wasmi major version number.
|
||||
*/
|
||||
-#define WASMI_VERSION_MAJOR 0
|
||||
+#define WASMI_VERSION_MAJOR 1
|
||||
/**
|
||||
* \brief Wasmi minor version number.
|
||||
*/
|
||||
-#define WASMI_VERSION_MINOR 35
|
||||
+#define WASMI_VERSION_MINOR 0
|
||||
/**
|
||||
* \brief Wasmi patch version number.
|
||||
*/
|
||||
-#define WASMI_VERSION_PATCH 0
|
||||
+#define WASMI_VERSION_PATCH 4
|
||||
|
||||
#endif // WASMI_H
|
||||
diff --git a/crates/c_api/include/wasmi/config.h b/crates/c_api/include/wasmi/config.h
|
||||
index 67baa75..491a1cc 100644
|
||||
--- a/crates/c_api/include/wasmi/config.h
|
||||
+++ b/crates/c_api/include/wasmi/config.h
|
||||
@@ -35,6 +35,40 @@ WASMI_CONFIG_PROP(void, consume_fuel, bool)
|
||||
*/
|
||||
WASMI_CONFIG_PROP(void, ignore_custom_sections, bool)
|
||||
|
||||
+/**
|
||||
+ * \brief Sets the maximum recursion depth of the engine's stack during execution.
|
||||
+ *
|
||||
+ * An execution traps if it exceeds this limit.
|
||||
+ */
|
||||
+WASMI_CONFIG_PROP(void, set_max_recursion_depth, size_t)
|
||||
+
|
||||
+/**
|
||||
+ * \brief Sets the minimum (or initial) height of the engine's value stack in bytes.
|
||||
+ *
|
||||
+ * Lower initial heights may improve memory consumption.
|
||||
+ * Higher initial heights may improve cold start times.
|
||||
+ *
|
||||
+ * Note: Panics if value is greater than the current maximum height of the value stack.
|
||||
+ */
|
||||
+WASMI_CONFIG_PROP(void, set_min_stack_height, size_t)
|
||||
+
|
||||
+/**
|
||||
+ * \brief Sets the maximum height of the engine's value stack in bytes.
|
||||
+ *
|
||||
+ * An execution traps if it exceeds this limit.
|
||||
+ *
|
||||
+ * Note: Panics if value is less than the current minimum height of the value stack.
|
||||
+ */
|
||||
+WASMI_CONFIG_PROP(void, set_max_stack_height, size_t)
|
||||
+
|
||||
+/**
|
||||
+ * \brief Sets the maximum number of cached stacks for reuse.
|
||||
+ *
|
||||
+ * A higher value may improve execution performance.
|
||||
+ * A lower value may improve memory consumption.
|
||||
+ */
|
||||
+WASMI_CONFIG_PROP(void, set_max_cached_stacks, size_t)
|
||||
+
|
||||
/**
|
||||
* \brief Whether or not to Wasm mutable-globals proposal is enabled.
|
||||
*
|
||||
@@ -92,6 +126,52 @@ WASMI_CONFIG_PROP(void, wasm_tail_call, bool)
|
||||
*/
|
||||
WASMI_CONFIG_PROP(void, wasm_extended_const, bool)
|
||||
|
||||
+/**
|
||||
+ * \brief Whether or not to Wasm multi-memory proposal is enabled.
|
||||
+ *
|
||||
+ * Default value: `true`
|
||||
+ */
|
||||
+WASMI_CONFIG_PROP(void, wasm_multi_memory, bool)
|
||||
+
|
||||
+/**
|
||||
+ * \brief Whether or not to Wasm custom-page-sizes proposal is enabled.
|
||||
+ *
|
||||
+ * Default value: `false`
|
||||
+ */
|
||||
+WASMI_CONFIG_PROP(void, wasm_custom_page_sizes, bool)
|
||||
+
|
||||
+/**
|
||||
+ * \brief Whether or not to Wasm memory64 proposal is enabled.
|
||||
+ *
|
||||
+ * Default value: `true`
|
||||
+ */
|
||||
+WASMI_CONFIG_PROP(void, wasm_memory64, bool)
|
||||
+
|
||||
+/**
|
||||
+ * \brief Whether or not to Wasm wide-arithmetic proposal is enabled.
|
||||
+ *
|
||||
+ * Default value: `false`
|
||||
+ */
|
||||
+WASMI_CONFIG_PROP(void, wasm_wide_arithmetic, bool)
|
||||
+
|
||||
+/**
|
||||
+ * \brief Whether or not to Wasm simd proposal is enabled.
|
||||
+ *
|
||||
+ * Only available when compiled with the `simd` feature.
|
||||
+ *
|
||||
+ * Default value: `true` (when feature enabled)
|
||||
+ */
|
||||
+WASMI_CONFIG_PROP(void, wasm_simd, bool)
|
||||
+
|
||||
+/**
|
||||
+ * \brief Whether or not to Wasm relaxed-simd proposal is enabled.
|
||||
+ *
|
||||
+ * Only available when compiled with the `simd` feature.
|
||||
+ *
|
||||
+ * Default value: `true` (when feature enabled)
|
||||
+ */
|
||||
+WASMI_CONFIG_PROP(void, wasm_relaxed_simd, bool)
|
||||
+
|
||||
/**
|
||||
* \brief Whether or not to floating Wasm point types and operations are
|
||||
* enabled.
|
||||
@@ -125,6 +205,58 @@ WASMI_CONFIG_PROP(void, compilation_mode, enum wasmi_compilation_mode_enum)
|
||||
|
||||
#undef WASMI_CONFIG_PROP
|
||||
|
||||
+/**
|
||||
+ * \brief Enforced limits for Wasm module parsing and compilation.
|
||||
+ *
|
||||
+ * Opaque type representing limits that can be enforced on Wasm modules.
|
||||
+ */
|
||||
+typedef struct wasmi_enforced_limits_t wasmi_enforced_limits_t;
|
||||
+
|
||||
+/**
|
||||
+ * \brief Creates a new enforced limits object with strict preset values.
|
||||
+ *
|
||||
+ * This set of strict enforced rules can be used to safeguard against
|
||||
+ * malicious actors trying to attack the Wasmi compilation procedures.
|
||||
+ *
|
||||
+ * The strict limits are:
|
||||
+ * - max_globals: 1000
|
||||
+ * - max_functions: 10,000
|
||||
+ * - max_tables: 100
|
||||
+ * - max_element_segments: 1000
|
||||
+ * - max_memories: 1
|
||||
+ * - max_data_segments: 1000
|
||||
+ * - max_params: 32
|
||||
+ * - max_results: 32
|
||||
+ * - min_avg_bytes_per_function: 40 (enforced at 1000+ total bytes)
|
||||
+ *
|
||||
+ * The returned object must be freed using wasmi_enforced_limits_delete().
|
||||
+ *
|
||||
+ * \return A new enforced limits object with strict preset values
|
||||
+ */
|
||||
+WASM_API_EXTERN wasmi_enforced_limits_t* wasmi_enforced_limits_strict();
|
||||
+
|
||||
+/**
|
||||
+ * \brief Deletes an enforced limits object.
|
||||
+ *
|
||||
+ * \param limits The enforced limits object to delete
|
||||
+ */
|
||||
+WASM_API_EXTERN void wasmi_enforced_limits_delete(wasmi_enforced_limits_t* limits);
|
||||
+
|
||||
+/**
|
||||
+ * \brief Sets the enforced limits for the configuration.
|
||||
+ *
|
||||
+ * By default no limits are enforced. Use this function to apply a set of
|
||||
+ * enforced limits (such as those created by wasmi_enforced_limits_strict())
|
||||
+ * to the configuration.
|
||||
+ *
|
||||
+ * \param config The configuration to modify
|
||||
+ * \param limits The enforced limits to apply
|
||||
+ */
|
||||
+WASM_API_EXTERN void wasmi_config_enforced_limits_set(
|
||||
+ wasm_config_t* config,
|
||||
+ const wasmi_enforced_limits_t* limits
|
||||
+);
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
diff --git a/crates/c_api/src/config.rs b/crates/c_api/src/config.rs
|
||||
index 6a1c1aa..cc69342 100644
|
||||
--- a/crates/c_api/src/config.rs
|
||||
+++ b/crates/c_api/src/config.rs
|
||||
@@ -1,5 +1,5 @@
|
||||
use alloc::boxed::Box;
|
||||
-use wasmi::{CompilationMode, Config};
|
||||
+use wasmi::{CompilationMode, Config, EnforcedLimits};
|
||||
|
||||
/// The Wasm configuration.
|
||||
///
|
||||
@@ -111,6 +111,68 @@ pub extern "C" fn wasmi_config_wasm_extended_const_set(c: &mut wasm_config_t, en
|
||||
c.inner.wasm_extended_const(enable);
|
||||
}
|
||||
|
||||
+/// Enables or disables support for the Wasm [`multi-memory`] proposal.
|
||||
+///
|
||||
+/// Wraps [`wasmi::Config::wasm_multi_memory`]
|
||||
+///
|
||||
+/// [`multi-memory`]: <https://github.com/WebAssembly/multi-memory>
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasmi_config_wasm_multi_memory_set(c: &mut wasm_config_t, enable: bool) {
|
||||
+ c.inner.wasm_multi_memory(enable);
|
||||
+}
|
||||
+
|
||||
+/// Enables or disables support for the Wasm [`custom-page-sizes`] proposal.
|
||||
+///
|
||||
+/// Wraps [`wasmi::Config::wasm_custom_page_sizes`]
|
||||
+///
|
||||
+/// [`custom-page-sizes`]: <https://github.com/WebAssembly/custom-page-sizes>
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasmi_config_wasm_custom_page_sizes_set(c: &mut wasm_config_t, enable: bool) {
|
||||
+ c.inner.wasm_custom_page_sizes(enable);
|
||||
+}
|
||||
+
|
||||
+/// Enables or disables support for the Wasm [`memory64`] proposal.
|
||||
+///
|
||||
+/// Wraps [`wasmi::Config::wasm_memory64`]
|
||||
+///
|
||||
+/// [`memory64`]: <https://github.com/WebAssembly/memory64>
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasmi_config_wasm_memory64_set(c: &mut wasm_config_t, enable: bool) {
|
||||
+ c.inner.wasm_memory64(enable);
|
||||
+}
|
||||
+
|
||||
+/// Enables or disables support for the Wasm [`wide-arithmetic`] proposal.
|
||||
+///
|
||||
+/// Wraps [`wasmi::Config::wasm_wide_arithmetic`]
|
||||
+///
|
||||
+/// [`wide-arithmetic`]: <https://github.com/WebAssembly/wide-arithmetic>
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasmi_config_wasm_wide_arithmetic_set(c: &mut wasm_config_t, enable: bool) {
|
||||
+ c.inner.wasm_wide_arithmetic(enable);
|
||||
+}
|
||||
+
|
||||
+/// Enables or disables support for the Wasm [`simd`] proposal.
|
||||
+///
|
||||
+/// Wraps [`wasmi::Config::wasm_simd`]
|
||||
+///
|
||||
+/// [`simd`]: <https://github.com/WebAssembly/simd>
|
||||
+#[cfg(feature = "simd")]
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasmi_config_wasm_simd_set(c: &mut wasm_config_t, enable: bool) {
|
||||
+ c.inner.wasm_simd(enable);
|
||||
+}
|
||||
+
|
||||
+/// Enables or disables support for the Wasm [`relaxed-simd`] proposal.
|
||||
+///
|
||||
+/// Wraps [`wasmi::Config::wasm_relaxed_simd`]
|
||||
+///
|
||||
+/// [`relaxed-simd`]: <https://github.com/WebAssembly/relaxed-simd>
|
||||
+#[cfg(feature = "simd")]
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasmi_config_wasm_relaxed_simd_set(c: &mut wasm_config_t, enable: bool) {
|
||||
+ c.inner.wasm_relaxed_simd(enable);
|
||||
+}
|
||||
+
|
||||
/// Enables or disables support for floating point numbers for the config.
|
||||
///
|
||||
/// Wraps [`wasmi::Config::floats`]
|
||||
@@ -164,3 +226,111 @@ pub extern "C" fn wasmi_config_ignore_custom_sections_set(
|
||||
) {
|
||||
config.inner.ignore_custom_sections(enable);
|
||||
}
|
||||
+
|
||||
+/// Sets the maximum recursion depth of the engine's stack during execution.
|
||||
+///
|
||||
+/// An execution traps if it exceeds this limit.
|
||||
+///
|
||||
+/// Wraps [`wasmi::Config::set_max_recursion_depth`]
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasmi_config_set_max_recursion_depth(
|
||||
+ config: &mut wasm_config_t,
|
||||
+ value: usize,
|
||||
+) {
|
||||
+ config.inner.set_max_recursion_depth(value);
|
||||
+}
|
||||
+
|
||||
+/// Sets the minimum (or initial) height of the engine's value stack in bytes.
|
||||
+///
|
||||
+/// # Note
|
||||
+///
|
||||
+/// - Lower initial heights may improve memory consumption.
|
||||
+/// - Higher initial heights may improve cold start times.
|
||||
+///
|
||||
+/// # Panics
|
||||
+///
|
||||
+/// If `value` is greater than the current maximum height of the value stack.
|
||||
+///
|
||||
+/// Wraps [`wasmi::Config::set_min_stack_height`]
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasmi_config_set_min_stack_height(config: &mut wasm_config_t, value: usize) {
|
||||
+ config.inner.set_min_stack_height(value);
|
||||
+}
|
||||
+
|
||||
+/// Sets the maximum height of the engine's value stack in bytes.
|
||||
+///
|
||||
+/// An execution traps if it exceeds this limit.
|
||||
+///
|
||||
+/// # Panics
|
||||
+///
|
||||
+/// If `value` is less than the current minimum height of the value stack.
|
||||
+///
|
||||
+/// Wraps [`wasmi::Config::set_max_stack_height`]
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasmi_config_set_max_stack_height(config: &mut wasm_config_t, value: usize) {
|
||||
+ config.inner.set_max_stack_height(value);
|
||||
+}
|
||||
+
|
||||
+/// Sets the maximum number of cached stacks for reuse.
|
||||
+///
|
||||
+/// # Note
|
||||
+///
|
||||
+/// - A higher value may improve execution performance.
|
||||
+/// - A lower value may improve memory consumption.
|
||||
+///
|
||||
+/// Wraps [`wasmi::Config::set_max_cached_stacks`]
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasmi_config_set_max_cached_stacks(config: &mut wasm_config_t, value: usize) {
|
||||
+ config.inner.set_max_cached_stacks(value);
|
||||
+}
|
||||
+
|
||||
+/// Enforced limits for Wasm module parsing and compilation.
|
||||
+///
|
||||
+/// Wraps [`wasmi::EnforcedLimits`]
|
||||
+#[repr(C)]
|
||||
+#[derive(Clone)]
|
||||
+pub struct wasmi_enforced_limits_t {
|
||||
+ pub(crate) inner: EnforcedLimits,
|
||||
+}
|
||||
+
|
||||
+wasmi_c_api_macros::declare_own!(wasmi_enforced_limits_t);
|
||||
+
|
||||
+/// Creates a new [`wasmi_enforced_limits_t`] with strict limits.
|
||||
+///
|
||||
+/// This set of strict enforced rules can be used to safeguard against
|
||||
+/// malicious actors trying to attack the Wasmi compilation procedures.
|
||||
+///
|
||||
+/// The strict limits are:
|
||||
+/// - max_globals: 1000
|
||||
+/// - max_functions: 10,000
|
||||
+/// - max_tables: 100
|
||||
+/// - max_element_segments: 1000
|
||||
+/// - max_memories: 1
|
||||
+/// - max_data_segments: 1000
|
||||
+/// - max_params: 32
|
||||
+/// - max_results: 32
|
||||
+/// - min_avg_bytes_per_function: 40 (enforced at 1000+ total bytes)
|
||||
+///
|
||||
+/// The returned [`wasmi_enforced_limits_t`] must be freed using
|
||||
+/// [`wasmi_enforced_limits_delete`] or consumed by [`wasmi_config_enforced_limits_set`].
|
||||
+///
|
||||
+/// Wraps [`wasmi::EnforcedLimits::strict`]
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasmi_enforced_limits_strict() -> Box<wasmi_enforced_limits_t> {
|
||||
+ Box::new(wasmi_enforced_limits_t {
|
||||
+ inner: EnforcedLimits::strict(),
|
||||
+ })
|
||||
+}
|
||||
+
|
||||
+/// Sets the enforced limits for the config.
|
||||
+///
|
||||
+/// By default no limits are enforced.
|
||||
+///
|
||||
+/// Wraps [`wasmi::Config::enforced_limits`]
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasmi_config_enforced_limits_set(
|
||||
+ config: &mut wasm_config_t,
|
||||
+ limits: &wasmi_enforced_limits_t,
|
||||
+) {
|
||||
+ config.inner.enforced_limits(limits.inner);
|
||||
+}
|
||||
diff --git a/crates/c_api/src/error.rs b/crates/c_api/src/error.rs
|
||||
index f51aff8..dc85727 100644
|
||||
--- a/crates/c_api/src/error.rs
|
||||
+++ b/crates/c_api/src/error.rs
|
||||
@@ -1,4 +1,5 @@
|
||||
-use alloc::{boxed::Box, string::String};
|
||||
+use crate::wasm_name_t;
|
||||
+use alloc::{boxed::Box, string::String, vec::Vec};
|
||||
use core::ffi;
|
||||
use wasmi::Error;
|
||||
|
||||
@@ -50,3 +51,16 @@ pub(crate) fn handle_result<T>(
|
||||
Err(error) => Some(Box::new(wasmi_error_t::from(error))),
|
||||
}
|
||||
}
|
||||
+
|
||||
+/// Returns the error message of the [`wasmi_error_t`].
|
||||
+///
|
||||
+/// Stores the returned error message in `out`.
|
||||
+#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
|
||||
+#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
|
||||
+pub extern "C" fn wasmi_error_message(error: &wasmi_error_t, out: &mut wasm_name_t) {
|
||||
+ let mut buffer = Vec::new();
|
||||
+ buffer.extend_from_slice(format!("{:?}", error.inner).as_bytes());
|
||||
+ buffer.reserve_exact(1);
|
||||
+ buffer.push(0);
|
||||
+ out.set_buffer(buffer.into());
|
||||
+}
|
||||
diff --git a/crates/c_api/src/store.rs b/crates/c_api/src/store.rs
|
||||
index 56d4898..9abda8e 100644
|
||||
--- a/crates/c_api/src/store.rs
|
||||
+++ b/crates/c_api/src/store.rs
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::{wasm_engine_t, wasmi_error_t, ForeignData};
|
||||
use alloc::{boxed::Box, sync::Arc};
|
||||
use core::{cell::UnsafeCell, ffi};
|
||||
-use wasmi::{AsContext, AsContextMut, Store, StoreContext, StoreContextMut};
|
||||
+use wasmi::{AsContext, AsContextMut, Store, StoreContext, StoreContextMut, StoreLimits, StoreLimitsBuilder};
|
||||
|
||||
/// This representation of a `Store` is used to implement the `wasm.h` API (and
|
||||
/// *not* the `wasmi.h` API!)
|
||||
@@ -16,7 +16,7 @@ use wasmi::{AsContext, AsContextMut, Store, StoreContext, StoreContextMut};
|
||||
/// least Wasmi's implementation).
|
||||
#[derive(Clone)]
|
||||
pub struct WasmStoreRef {
|
||||
- inner: Arc<UnsafeCell<Store<()>>>,
|
||||
+ inner: Arc<UnsafeCell<Store<StoreLimits>>>,
|
||||
}
|
||||
|
||||
impl WasmStoreRef {
|
||||
@@ -27,7 +27,7 @@ impl WasmStoreRef {
|
||||
/// # Safety
|
||||
///
|
||||
/// It is the callers responsibility to provide a valid `self`.
|
||||
- pub unsafe fn context(&self) -> StoreContext<'_, ()> {
|
||||
+ pub unsafe fn context(&self) -> StoreContext<'_, StoreLimits> {
|
||||
(*self.inner.get()).as_context()
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ impl WasmStoreRef {
|
||||
/// # Safety
|
||||
///
|
||||
/// It is the callers responsibility to provide a valid `self`.
|
||||
- pub unsafe fn context_mut(&mut self) -> StoreContextMut<'_, ()> {
|
||||
+ pub unsafe fn context_mut(&mut self) -> StoreContextMut<'_, StoreLimits> {
|
||||
(*self.inner.get()).as_context_mut()
|
||||
}
|
||||
}
|
||||
@@ -56,17 +56,71 @@ pub struct wasm_store_t {
|
||||
|
||||
wasmi_c_api_macros::declare_own!(wasm_store_t);
|
||||
|
||||
-/// Creates a new [`Store<()>`](wasmi::Store) for the given `engine`.
|
||||
+/// Creates a new [`Store<StoreLimits>`](wasmi::Store) for the given `engine`.
|
||||
+///
|
||||
+/// The store is created with no resource limits (original behavior).
|
||||
+/// For memory-limited stores, use [`wasm_store_new_with_memory_max_pages`].
|
||||
///
|
||||
/// The returned [`wasm_store_t`] must be freed using [`wasm_store_delete`].
|
||||
///
|
||||
-/// Wraps [`<wasmi::Store<()>>::new`](wasmi::Store::new).
|
||||
+/// Wraps [`<wasmi::Store<StoreLimits>>::new`](wasmi::Store::new).
|
||||
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
|
||||
pub extern "C" fn wasm_store_new(engine: &wasm_engine_t) -> Box<wasm_store_t> {
|
||||
let engine = &engine.inner;
|
||||
- let store = Store::new(engine, ());
|
||||
+
|
||||
+ // Create store with no resource limits (original behavior)
|
||||
+ let limits = StoreLimitsBuilder::new().build();
|
||||
+ let store = Store::new(engine, limits);
|
||||
+
|
||||
+ Box::new(wasm_store_t {
|
||||
+ inner: WasmStoreRef {
|
||||
+ inner: Arc::new(UnsafeCell::new(store)),
|
||||
+ },
|
||||
+ })
|
||||
+}
|
||||
+
|
||||
+/// Creates a new [`Store<StoreLimits>`](wasmi::Store) for the given `engine` with memory limits.
|
||||
+///
|
||||
+/// This function creates a store with resource limits suitable for blockchain smart contracts.
|
||||
+/// The memory limit is enforced during WebAssembly execution.
|
||||
+///
|
||||
+/// If `max_pages` exceeds 1024 (64MB), this function will panic.
|
||||
+///
|
||||
+/// The returned [`wasm_store_t`] must be freed using [`wasm_store_delete`].
|
||||
+///
|
||||
+/// Wraps [`<wasmi::Store<StoreLimits>>::new`](wasmi::Store::new).
|
||||
+#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
|
||||
+#[allow(clippy::arc_with_non_send_sync)]
|
||||
+#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
|
||||
+pub extern "C" fn wasm_store_new_with_memory_max_pages(
|
||||
+ engine: &wasm_engine_t,
|
||||
+ max_pages: u32,
|
||||
+) -> Box<wasm_store_t> {
|
||||
+ // Validate max_pages limit (64MB = 1024 pages)
|
||||
+ if max_pages > 1024 {
|
||||
+ panic!("max_pages ({}) exceeds maximum allowed value of 1024 pages (64MB)", max_pages);
|
||||
+ }
|
||||
+
|
||||
+ // Convert pages to bytes (each page is 64KB)
|
||||
+ let max_memory_bytes = (max_pages as usize) * (64 * 1024);
|
||||
+
|
||||
+ // Create store limits with blockchain-suitable defaults
|
||||
+ let limits = StoreLimitsBuilder::new()
|
||||
+ .memory_size(max_memory_bytes) // User-specified memory limit
|
||||
+ .instances(1) // Single instance for blockchain
|
||||
+ .tables(1) // Single table for blockchain
|
||||
+ .memories(1) // Single memory for blockchain
|
||||
+ .table_elements(64) // Limited table elements for blockchain
|
||||
+ .trap_on_grow_failure(false) // Return -1 on growth failure instead of trapping
|
||||
+ .build();
|
||||
+
|
||||
+ let mut store = Store::new(&engine.inner, limits);
|
||||
+
|
||||
+ // Install the resource limiter
|
||||
+ store.limiter(|limits| limits);
|
||||
+
|
||||
Box::new(wasm_store_t {
|
||||
inner: WasmStoreRef {
|
||||
inner: Arc::new(UnsafeCell::new(store)),
|
||||
@@ -175,3 +229,40 @@ pub extern "C" fn wasmi_context_set_fuel(
|
||||
) -> Option<Box<wasmi_error_t>> {
|
||||
crate::handle_result(store.set_fuel(fuel), |()| {})
|
||||
}
|
||||
+
|
||||
+////////////////////////////////////////////////////////////////////////////////////////
|
||||
+////////////////////////////////////////////////////////////////////////////////////////
|
||||
+
|
||||
+/// Returns the current fuel of the wasm store context in `fuel`.
|
||||
+///
|
||||
+/// Wraps [`Store::get_fuel`].
|
||||
+///
|
||||
+/// # Errors
|
||||
+///
|
||||
+/// If [`Store::get_fuel`] errors.
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasm_store_get_fuel(
|
||||
+ store: &wasm_store_t,
|
||||
+ fuel: &mut u64,
|
||||
+) -> Option<Box<wasmi_error_t>> {
|
||||
+ let context = unsafe { store.inner.context() };
|
||||
+ crate::handle_result(context.get_fuel(), |amt| {
|
||||
+ *fuel = amt;
|
||||
+ })
|
||||
+}
|
||||
+
|
||||
+/// Sets the current fuel of the wasm store context to `fuel`.
|
||||
+///
|
||||
+/// Wraps [`Store::set_fuel`].
|
||||
+///
|
||||
+/// # Errors
|
||||
+///
|
||||
+/// If [`Store::set_fuel`] errors.
|
||||
+#[no_mangle]
|
||||
+pub extern "C" fn wasm_store_set_fuel(
|
||||
+ store: &mut wasm_store_t,
|
||||
+ fuel: u64,
|
||||
+) -> Option<Box<wasmi_error_t>> {
|
||||
+ let mut context = unsafe { store.inner.context_mut() };
|
||||
+ crate::handle_result(context.set_fuel(fuel), |()| {})
|
||||
+}
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Extract a tar archive compressed with lz4
|
||||
|
||||
@@ -17,6 +17,6 @@ extractTarLz4(
|
||||
boost::filesystem::path const& src,
|
||||
boost::filesystem::path const& dst);
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
using IniFileSections =
|
||||
std::unordered_map<std::string, std::vector<std::string>>;
|
||||
@@ -380,6 +380,6 @@ get_if_exists<bool>(Section const& section, std::string const& name, bool& v)
|
||||
return stat;
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Storage for linear binary data.
|
||||
Blocks of binary data appear often in various idioms and structures.
|
||||
*/
|
||||
using Blob = std::vector<unsigned char>;
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Like std::vector<char> but better.
|
||||
Meets the requirements of BufferFactory.
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
XRPL_ASSERT(
|
||||
s.size() == 0 || size_ == 0 || s.data() < p_.get() ||
|
||||
s.data() >= p_.get() + size_,
|
||||
"xrpl::Buffer::operator=(Slice) : input not a subset");
|
||||
"ripple::Buffer::operator=(Slice) : input not a subset");
|
||||
|
||||
if (auto p = alloc(s.size()))
|
||||
std::memcpy(p, s.data(), s.size());
|
||||
@@ -215,6 +215,6 @@ operator!=(Buffer const& lhs, Buffer const& rhs) noexcept
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef XRPL_BASICS_BYTEUTILITIES_H_INCLUDED
|
||||
#define XRPL_BASICS_BYTEUTILITIES_H_INCLUDED
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
template <class T>
|
||||
constexpr auto
|
||||
@@ -19,6 +19,6 @@ megabytes(T value) noexcept
|
||||
|
||||
static_assert(kilobytes(2) == 2048, "kilobytes(2) == 2048");
|
||||
static_assert(megabytes(3) == 3145728, "megabytes(3) == 3145728");
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
namespace compression_algorithms {
|
||||
|
||||
@@ -144,6 +144,6 @@ lz4Decompress(
|
||||
|
||||
} // namespace compression_algorithms
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif // XRPL_COMPRESSIONALGORITHMS_H_INCLUDED
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Manages all counted object types. */
|
||||
class CountedObjects
|
||||
@@ -133,6 +133,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Sampling function using exponential decay to provide a continuous value.
|
||||
@tparam The number of seconds in the decay window.
|
||||
@@ -131,6 +131,6 @@ private:
|
||||
time_point when_;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Expected is an approximation of std::expected (hoped for in C++23)
|
||||
|
||||
@@ -232,6 +232,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif // XRPL_BASICS_EXPECTED_H_INCLUDED
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
std::string
|
||||
getFileContents(
|
||||
@@ -20,6 +20,6 @@ writeFileContents(
|
||||
boost::filesystem::path const& destPath,
|
||||
std::string const& contents);
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -492,5 +492,5 @@ dynamic_pointer_cast(TT const& v)
|
||||
return SharedPtr<T>(DynamicCastTagSharedIntrusive{}, v);
|
||||
}
|
||||
} // namespace intr_ptr
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
template <class T>
|
||||
template <CAdoptTag TAdoptTag>
|
||||
@@ -608,7 +608,7 @@ SharedWeakUnion<T>::convertToStrong()
|
||||
[[maybe_unused]] auto action = p->releaseWeakRef();
|
||||
XRPL_ASSERT(
|
||||
(action == ReleaseWeakRefAction::noop),
|
||||
"xrpl::SharedWeakUnion::convertToStrong : "
|
||||
"ripple::SharedWeakUnion::convertToStrong : "
|
||||
"action is noop");
|
||||
unsafeSetRawPtr(p, RefStrength::strong);
|
||||
return true;
|
||||
@@ -637,7 +637,7 @@ SharedWeakUnion<T>::convertToWeak()
|
||||
// We just added a weak ref. How could we destroy?
|
||||
// LCOV_EXCL_START
|
||||
UNREACHABLE(
|
||||
"xrpl::SharedWeakUnion::convertToWeak : destroying freshly "
|
||||
"ripple::SharedWeakUnion::convertToWeak : destroying freshly "
|
||||
"added ref");
|
||||
delete p;
|
||||
unsafeSetRawPtr(nullptr);
|
||||
@@ -719,5 +719,5 @@ SharedWeakUnion<T>::unsafeReleaseNoStore()
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Action to perform when releasing a strong pointer.
|
||||
|
||||
@@ -34,7 +34,7 @@ enum class ReleaseWeakRefAction { noop, destroy };
|
||||
/** Implement the strong count, weak count, and bit flags for an intrusive
|
||||
pointer.
|
||||
|
||||
A class can satisfy the requirements of a xrpl::IntrusivePointer by
|
||||
A class can satisfy the requirements of a ripple::IntrusivePointer by
|
||||
inheriting from this class.
|
||||
*/
|
||||
struct IntrusiveRefCounts
|
||||
@@ -257,7 +257,7 @@ IntrusiveRefCounts::releaseStrongRef() const
|
||||
RefCountPair const prevVal{prevIntVal};
|
||||
XRPL_ASSERT(
|
||||
(prevVal.strong >= strongDelta),
|
||||
"xrpl::IntrusiveRefCounts::releaseStrongRef : previous ref "
|
||||
"ripple::IntrusiveRefCounts::releaseStrongRef : previous ref "
|
||||
"higher than new");
|
||||
auto nextIntVal = prevIntVal - strongDelta;
|
||||
ReleaseStrongRefAction action = noop;
|
||||
@@ -282,7 +282,7 @@ IntrusiveRefCounts::releaseStrongRef() const
|
||||
// twice.
|
||||
XRPL_ASSERT(
|
||||
(action == noop) || !(prevIntVal & partialDestroyStartedMask),
|
||||
"xrpl::IntrusiveRefCounts::releaseStrongRef : not in partial "
|
||||
"ripple::IntrusiveRefCounts::releaseStrongRef : not in partial "
|
||||
"destroy");
|
||||
return action;
|
||||
}
|
||||
@@ -314,7 +314,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
|
||||
// can't happen twice.
|
||||
XRPL_ASSERT(
|
||||
(!prevVal.partialDestroyStartedBit),
|
||||
"xrpl::IntrusiveRefCounts::addWeakReleaseStrongRef : not in "
|
||||
"ripple::IntrusiveRefCounts::addWeakReleaseStrongRef : not in "
|
||||
"partial destroy");
|
||||
|
||||
auto nextIntVal = prevIntVal + delta;
|
||||
@@ -336,7 +336,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
(!(prevIntVal & partialDestroyStartedMask)),
|
||||
"xrpl::IntrusiveRefCounts::addWeakReleaseStrongRef : not "
|
||||
"ripple::IntrusiveRefCounts::addWeakReleaseStrongRef : not "
|
||||
"started partial destroy");
|
||||
return action;
|
||||
}
|
||||
@@ -408,11 +408,11 @@ inline IntrusiveRefCounts::~IntrusiveRefCounts() noexcept
|
||||
auto v = refCounts.load(std::memory_order_acquire);
|
||||
XRPL_ASSERT(
|
||||
(!(v & valueMask)),
|
||||
"xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
|
||||
"ripple::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
|
||||
auto t = v & tagMask;
|
||||
XRPL_ASSERT(
|
||||
(!t || t == tagMask),
|
||||
"xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
|
||||
"ripple::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ inline IntrusiveRefCounts::RefCountPair::RefCountPair(
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
(strong < checkStrongMaxValue && weak < checkWeakMaxValue),
|
||||
"xrpl::IntrusiveRefCounts::RefCountPair(FieldType) : inputs inside "
|
||||
"ripple::IntrusiveRefCounts::RefCountPair(FieldType) : inputs inside "
|
||||
"range");
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ inline IntrusiveRefCounts::RefCountPair::RefCountPair(
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
(strong < checkStrongMaxValue && weak < checkWeakMaxValue),
|
||||
"xrpl::IntrusiveRefCounts::RefCountPair(CountType, CountType) : "
|
||||
"ripple::IntrusiveRefCounts::RefCountPair(CountType, CountType) : "
|
||||
"inputs inside range");
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ IntrusiveRefCounts::RefCountPair::combinedValue() const noexcept
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
(strong < checkStrongMaxValue && weak < checkWeakMaxValue),
|
||||
"xrpl::IntrusiveRefCounts::RefCountPair::combinedValue : inputs "
|
||||
"ripple::IntrusiveRefCounts::RefCountPair::combinedValue : inputs "
|
||||
"inside range");
|
||||
return (static_cast<IntrusiveRefCounts::FieldType>(weak)
|
||||
<< IntrusiveRefCounts::StrongCountNumBits) |
|
||||
@@ -465,7 +465,7 @@ partialDestructorFinished(T** o)
|
||||
XRPL_ASSERT(
|
||||
(!p.partialDestroyFinishedBit && p.partialDestroyStartedBit &&
|
||||
!p.strong),
|
||||
"xrpl::partialDestructorFinished : not a weak ref");
|
||||
"ripple::partialDestructorFinished : not a weak ref");
|
||||
if (!p.weak)
|
||||
{
|
||||
// There was a weak count before the partial destructor ran (or we would
|
||||
@@ -479,5 +479,5 @@ partialDestructorFinished(T** o)
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
#endif
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
#include <xrpl/basics/TaggedCache.h>
|
||||
#include <xrpl/basics/base_uint.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
using KeyCache = TaggedCache<uint256, int, true>;
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif // XRPL_BASICS_KEYCACHE_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -109,6 +109,6 @@ LocalValue<T>::operator*()
|
||||
.emplace(this, std::make_unique<detail::LocalValues::Value<T>>(t_))
|
||||
.first->second->get());
|
||||
}
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <mutex>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
// DEPRECATED use beast::severities::Severity instead
|
||||
enum LogSeverity {
|
||||
@@ -271,6 +271,6 @@ setDebugLogSink(std::unique_ptr<beast::Journal::Sink> sink);
|
||||
beast::Journal
|
||||
debugLog();
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Calculate one number divided by another number in percentage.
|
||||
* The result is rounded up to the next integer, and capped in the range [0,100]
|
||||
@@ -44,6 +44,6 @@ static_assert(calculatePercent(50'000'000, 100'000'000) == 50);
|
||||
static_assert(calculatePercent(50'000'001, 100'000'000) == 51);
|
||||
static_assert(calculatePercent(99'999'999, 100'000'000) == 100);
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
class Number;
|
||||
|
||||
@@ -339,6 +339,10 @@ abs(Number x) noexcept
|
||||
Number
|
||||
power(Number const& f, unsigned n);
|
||||
|
||||
// logarithm with base 10
|
||||
Number
|
||||
lg(Number const& value);
|
||||
|
||||
// Returns f^(1/d)
|
||||
// Uses Newton–Raphson iterations until the result stops changing
|
||||
// to find the root of the polynomial g(x) = x^d - f
|
||||
@@ -402,6 +406,6 @@ public:
|
||||
operator=(NumberRoundModeGuard const&) = delete;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif // XRPL_BASICS_NUMBER_H_INCLUDED
|
||||
|
||||
@@ -21,11 +21,11 @@ ripple/basic should contain no dependencies on other modules.
|
||||
- `std::set`
|
||||
- For sorted containers.
|
||||
|
||||
- `xrpl::hash_set`
|
||||
- `ripple::hash_set`
|
||||
- Where inserts and contains need to be O(1).
|
||||
- For "small" sets, `std::set` might be faster and smaller.
|
||||
|
||||
- `xrpl::hardened_hash_set`
|
||||
- `ripple::hardened_hash_set`
|
||||
- For data sets where the key could be manipulated by an attacker
|
||||
in an attempt to mount an algorithmic complexity attack: see
|
||||
http://en.wikipedia.org/wiki/Algorithmic_complexity_attack
|
||||
@@ -33,5 +33,5 @@ ripple/basic should contain no dependencies on other modules.
|
||||
The following container is deprecated
|
||||
|
||||
- `std::unordered_set`
|
||||
- Use `xrpl::hash_set` instead, which uses a better hashing algorithm.
|
||||
- Or use `xrpl::hardened_hash_set` to prevent algorithmic complexity attacks.
|
||||
- Use `ripple::hash_set` instead, which uses a better hashing algorithm.
|
||||
- Or use `ripple::hardened_hash_set` to prevent algorithmic complexity attacks.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** A closed interval over the domain T.
|
||||
|
||||
@@ -85,7 +85,7 @@ to_string(RangeSet<T> const& rs)
|
||||
|
||||
std::string s;
|
||||
for (auto const& interval : rs)
|
||||
s += xrpl::to_string(interval) + ",";
|
||||
s += ripple::to_string(interval) + ",";
|
||||
s.pop_back();
|
||||
|
||||
return s;
|
||||
@@ -172,6 +172,6 @@ prevMissing(RangeSet<T> const& rs, T t, T minVal = 0)
|
||||
return boost::icl::last(tgt);
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
class Resolver
|
||||
{
|
||||
@@ -47,6 +47,6 @@ public:
|
||||
/** @} */
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <boost/asio/io_context.hpp>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
class ResolverAsio : public Resolver
|
||||
{
|
||||
@@ -17,6 +17,6 @@ public:
|
||||
New(boost::asio::io_context&, beast::Journal);
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
// A SHAMapHash is the hash of a node in a SHAMap, and also the
|
||||
// type of the hash of the entire SHAMap.
|
||||
@@ -97,6 +97,6 @@ extract(SHAMapHash const& key)
|
||||
return *reinterpret_cast<std::size_t const*>(key.as_uint256().data());
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif // XRPL_BASICS_SHAMAP_HASH_H_INCLUDED
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <memory>
|
||||
#include <variant>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** A combination of a std::shared_ptr and a std::weak_pointer.
|
||||
|
||||
@@ -112,5 +112,5 @@ public:
|
||||
private:
|
||||
std::variant<std::shared_ptr<T>, std::weak_ptr<T>> combo_;
|
||||
};
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <xrpl/basics/SharedWeakCachePointer.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
template <class T>
|
||||
SharedWeakCachePointer<T>::SharedWeakCachePointer(
|
||||
SharedWeakCachePointer const& rhs) = default;
|
||||
@@ -169,5 +169,5 @@ SharedWeakCachePointer<T>::convertToWeak()
|
||||
|
||||
return false;
|
||||
}
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
template <typename Type>
|
||||
class SlabAllocator
|
||||
@@ -128,7 +128,7 @@ class SlabAllocator
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
own(ptr),
|
||||
"xrpl::SlabAllocator::SlabBlock::deallocate : own input");
|
||||
"ripple::SlabAllocator::SlabBlock::deallocate : own input");
|
||||
|
||||
std::lock_guard l(m_);
|
||||
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
(itemAlignment_ & (itemAlignment_ - 1)) == 0,
|
||||
"xrpl::SlabAllocator::SlabAllocator : valid alignment");
|
||||
"ripple::SlabAllocator::SlabAllocator : valid alignment");
|
||||
}
|
||||
|
||||
SlabAllocator(SlabAllocator const& other) = delete;
|
||||
@@ -285,7 +285,7 @@ public:
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
ptr,
|
||||
"xrpl::SlabAllocator::SlabAllocator::deallocate : non-null "
|
||||
"ripple::SlabAllocator::SlabAllocator::deallocate : non-null "
|
||||
"input");
|
||||
|
||||
for (auto slab = slabs_.load(); slab != nullptr; slab = slab->next_)
|
||||
@@ -419,6 +419,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif // XRPL_BASICS_SLABALLOCATOR_H_INCLUDED
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** An immutable linear range of bytes.
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
i < size_,
|
||||
"xrpl::Slice::operator[](std::size_t) const : valid input");
|
||||
"ripple::Slice::operator[](std::size_t) const : valid input");
|
||||
return data_[i];
|
||||
}
|
||||
|
||||
@@ -243,6 +243,6 @@ makeSlice(std::basic_string<char, Traits, Alloc> const& s)
|
||||
return Slice(s.data(), s.size());
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Format arbitrary binary data as an SQLite "blob literal".
|
||||
|
||||
@@ -132,6 +132,6 @@ to_uint64(std::string const& s);
|
||||
bool
|
||||
isProperlyFormedTomlDomain(std::string_view domain);
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Map/cache combination.
|
||||
This class implements a cache and a map. The cache keeps objects alive
|
||||
@@ -315,6 +315,6 @@ private:
|
||||
std::uint64_t m_misses;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <xrpl/basics/IntrusivePointer.ipp>
|
||||
#include <xrpl/basics/TaggedCache.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
template <
|
||||
class Key,
|
||||
@@ -1005,6 +1005,6 @@ TaggedCache<
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** to_string() generalizes std::to_string to handle bools, chars, and strings.
|
||||
|
||||
@@ -43,6 +43,6 @@ to_string(char const* s)
|
||||
return s;
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* what container it is.
|
||||
*/
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
// hash containers
|
||||
|
||||
@@ -102,6 +102,6 @@ template <
|
||||
using hardened_hash_multiset =
|
||||
std::unordered_multiset<Value, Hash, Pred, Allocator>;
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <ratio>
|
||||
#include <thread>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Tracks program uptime to seconds precision.
|
||||
|
||||
@@ -45,6 +45,6 @@ private:
|
||||
start_clock();
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
// Requires: [first1, last1) and [first2, last2) are ordered ranges according to
|
||||
// comp.
|
||||
@@ -95,6 +95,6 @@ remove_if_intersect_or_match(
|
||||
return first1;
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
std::string
|
||||
base64_encode(std::uint8_t const* data, std::size_t len);
|
||||
@@ -53,6 +53,6 @@ base64_encode(std::string const& s)
|
||||
std::string
|
||||
base64_decode(std::string_view data);
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <cstring>
|
||||
#include <type_traits>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -275,7 +275,7 @@ public:
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
c.size() * sizeof(typename Container::value_type) == size(),
|
||||
"xrpl::base_uint::base_uint(Container auto) : input size match");
|
||||
"ripple::base_uint::base_uint(Container auto) : input size match");
|
||||
std::memcpy(data_.data(), c.data(), size());
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ public:
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
c.size() * sizeof(typename Container::value_type) == size(),
|
||||
"xrpl::base_uint::operator=(Container auto) : input size match");
|
||||
"ripple::base_uint::operator=(Container auto) : input size match");
|
||||
std::memcpy(data_.data(), c.data(), size());
|
||||
return *this;
|
||||
}
|
||||
@@ -648,12 +648,12 @@ static_assert(sizeof(uint192) == 192 / 8, "There should be no padding bytes");
|
||||
static_assert(sizeof(uint256) == 256 / 8, "There should be no padding bytes");
|
||||
#endif
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
namespace beast {
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
struct is_uniquely_represented<xrpl::base_uint<Bits, Tag>>
|
||||
struct is_uniquely_represented<ripple::base_uint<Bits, Tag>>
|
||||
: public std::true_type
|
||||
{
|
||||
explicit is_uniquely_represented() = default;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <ratio>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
// A few handy aliases
|
||||
|
||||
@@ -104,6 +104,6 @@ stopwatch()
|
||||
return beast::get_abstract_clock<Facade, Clock>();
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
@@ -52,6 +52,6 @@ using equal_to = std::equal_to<T>;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/* Programming By Contract
|
||||
|
||||
@@ -52,6 +52,6 @@ Throw(Args&&... args)
|
||||
[[noreturn]] void
|
||||
LogicError(std::string const& how) noexcept;
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <random>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -92,6 +92,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
template <class Stream, class Iter>
|
||||
Stream&
|
||||
@@ -85,6 +85,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Create a self-signed SSL context that allows anonymous Diffie Hellman. */
|
||||
std::shared_ptr<boost::asio::ssl::context>
|
||||
@@ -19,6 +19,6 @@ make_SSLContextAuthed(
|
||||
std::string const& chainFile,
|
||||
std::string const& cipherList);
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
auto constexpr muldiv_max = std::numeric_limits<std::uint64_t>::max();
|
||||
|
||||
/** Return value*mul/div accurately.
|
||||
@@ -21,6 +21,6 @@ auto constexpr muldiv_max = std::numeric_limits<std::uint64_t>::max();
|
||||
std::optional<std::uint64_t>
|
||||
mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div);
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
template <typename Key>
|
||||
static std::size_t
|
||||
@@ -242,7 +242,7 @@ public:
|
||||
map_.resize(partitions_);
|
||||
XRPL_ASSERT(
|
||||
partitions_,
|
||||
"xrpl::partitioned_unordered_map::partitioned_unordered_map : "
|
||||
"ripple::partitioned_unordered_map::partitioned_unordered_map : "
|
||||
"nonzero partitions");
|
||||
}
|
||||
|
||||
@@ -401,6 +401,6 @@ private:
|
||||
mutable partition_map_type map_{};
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif // XRPL_BASICS_PARTITIONED_UNORDERED_MAP_H
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <random>
|
||||
#include <type_traits>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
#ifndef __INTELLISENSE__
|
||||
static_assert(
|
||||
@@ -95,7 +95,7 @@ std::enable_if_t<
|
||||
Integral>
|
||||
rand_int(Engine& engine, Integral min, Integral max)
|
||||
{
|
||||
XRPL_ASSERT(max > min, "xrpl::rand_int : max over min inputs");
|
||||
XRPL_ASSERT(max > min, "ripple::rand_int : max over min inputs");
|
||||
|
||||
// This should have no state and constructing it should
|
||||
// be very cheap. If that turns out not to be the case
|
||||
@@ -186,6 +186,6 @@ rand_bool()
|
||||
}
|
||||
/** @} */
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif // XRPL_BASICS_RANDOM_H_INCLUDED
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
// safe_cast adds compile-time checks to a static_cast to ensure that
|
||||
// the destination can hold all values of the source. This is particularly
|
||||
@@ -80,6 +80,6 @@ inline constexpr std::
|
||||
return unsafe_cast<Dest>(static_cast<std::underlying_type_t<Src>>(s));
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
// RAII scope helpers. As specified in Library Fundamental, Version 3
|
||||
// Basic design of idea: https://www.youtube.com/watch?v=WjTrfoiB0MQ
|
||||
@@ -218,7 +218,7 @@ public:
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
plock->owns_lock(),
|
||||
"xrpl::scope_unlock::scope_unlock : mutex must be locked");
|
||||
"ripple::scope_unlock::scope_unlock : mutex must be locked");
|
||||
plock->unlock();
|
||||
}
|
||||
|
||||
@@ -236,6 +236,6 @@ public:
|
||||
template <class Mutex>
|
||||
scope_unlock(std::unique_lock<Mutex>&) -> scope_unlock<Mutex>;
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <immintrin.h>
|
||||
#endif
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
namespace detail {
|
||||
/** Inform the processor that we are in a tight spin-wait loop.
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
index >= 0 && (mask_ != 0),
|
||||
"xrpl::packed_spinlock::packed_spinlock : valid index and mask");
|
||||
"ripple::packed_spinlock::packed_spinlock : valid index and mask");
|
||||
}
|
||||
|
||||
[[nodiscard]] bool
|
||||
@@ -206,6 +206,6 @@ public:
|
||||
};
|
||||
/** @} */
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <boost/algorithm/hex.hpp>
|
||||
#include <boost/endian/conversion.hpp>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
template <class FwdIt>
|
||||
std::string
|
||||
@@ -28,6 +28,6 @@ strHex(T const& from)
|
||||
return strHex(from.begin(), from.end());
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <iostream>
|
||||
#include <type_traits>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** A type-safe wrap around standard integral types
|
||||
|
||||
@@ -197,11 +197,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
namespace beast {
|
||||
template <class Int, class Tag, class HashAlgorithm>
|
||||
struct is_contiguously_hashable<xrpl::tagged_integer<Int, Tag>, HashAlgorithm>
|
||||
struct is_contiguously_hashable<ripple::tagged_integer<Int, Tag>, HashAlgorithm>
|
||||
: public is_contiguously_hashable<Int, HashAlgorithm>
|
||||
{
|
||||
explicit is_contiguously_hashable() = default;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
class RFC1751
|
||||
{
|
||||
@@ -42,6 +42,6 @@ private:
|
||||
static char const* s_dictionary[];
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <mutex>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** A cryptographically secure random number engine
|
||||
|
||||
@@ -70,6 +70,6 @@ public:
|
||||
csprng_engine&
|
||||
crypto_prng();
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Attempts to clear the given blob of memory.
|
||||
|
||||
@@ -22,6 +22,6 @@ namespace xrpl {
|
||||
void
|
||||
secure_erase(void* dest, std::size_t bytes);
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <xrpl/beast/utility/PropertyStream.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** A PropertyStream::Sink which produces a Json::Value of type objectValue. */
|
||||
class JsonPropertyStream : public beast::PropertyStream
|
||||
@@ -66,6 +66,6 @@ protected:
|
||||
add(std::string const& v) override;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -234,7 +234,7 @@ inline void
|
||||
check(bool condition, std::string const& message)
|
||||
{
|
||||
if (!condition)
|
||||
xrpl::Throw<std::logic_error>(message);
|
||||
ripple::Throw<std::logic_error>(message);
|
||||
}
|
||||
|
||||
} // namespace Json
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
#define JSON_ASSERT_MESSAGE(condition, message) \
|
||||
if (!(condition)) \
|
||||
xrpl::Throw<Json::error>(message);
|
||||
ripple::Throw<Json::error>(message);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
Value(UInt value);
|
||||
Value(double value);
|
||||
Value(char const* value);
|
||||
Value(xrpl::Number const& value);
|
||||
Value(ripple::Number const& value);
|
||||
/** \brief Constructs a value from a static string.
|
||||
|
||||
* Like other value string constructor but do not duplicate the string for
|
||||
@@ -430,7 +430,7 @@ private:
|
||||
};
|
||||
|
||||
inline Value
|
||||
to_json(xrpl::Number const& number)
|
||||
to_json(ripple::Number const& number)
|
||||
{
|
||||
return to_string(number);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <xrpl/ledger/RawView.h>
|
||||
#include <xrpl/ledger/ReadView.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
enum ApplyFlags : std::uint32_t {
|
||||
tapNONE = 0x00,
|
||||
@@ -267,7 +267,7 @@ public:
|
||||
{
|
||||
// LCOV_EXCL_START
|
||||
UNREACHABLE(
|
||||
"xrpl::ApplyView::dirAppend : only Offers are appended to "
|
||||
"ripple::ApplyView::dirAppend : only Offers are appended to "
|
||||
"book directories");
|
||||
// Only Offers are appended to book directories. Call dirInsert()
|
||||
// instead
|
||||
@@ -407,6 +407,6 @@ insertPage(
|
||||
std::function<void(std::shared_ptr<SLE> const&)> const& describe);
|
||||
|
||||
} // namespace directory
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <xrpl/protocol/STAmount.h>
|
||||
#include <xrpl/protocol/TER.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Editable, discardable view that can build metadata for one tx.
|
||||
|
||||
@@ -55,6 +55,18 @@ public:
|
||||
deliver_ = amount;
|
||||
}
|
||||
|
||||
void
|
||||
setGasUsed(std::optional<std::uint32_t> const gasUsed)
|
||||
{
|
||||
gasUsed_ = gasUsed;
|
||||
}
|
||||
|
||||
void
|
||||
setWasmReturnCode(std::int32_t const wasmReturnCode)
|
||||
{
|
||||
wasmReturnCode_ = wasmReturnCode;
|
||||
}
|
||||
|
||||
/** Get the number of modified entries
|
||||
*/
|
||||
std::size_t
|
||||
@@ -73,8 +85,10 @@ public:
|
||||
|
||||
private:
|
||||
std::optional<STAmount> deliver_;
|
||||
std::optional<std::uint32_t> gasUsed_;
|
||||
std::optional<std::int32_t> wasmReturnCode_;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
#include <xrpl/ledger/ReadView.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
class BookDirs
|
||||
{
|
||||
@@ -89,6 +89,6 @@ private:
|
||||
static beast::Journal j_;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <xrpl/basics/base_uint.h>
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
using CachedSLEs = TaggedCache<uint256, SLE const>;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <mutex>
|
||||
#include <type_traits>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -47,10 +47,10 @@ public:
|
||||
return base_.open();
|
||||
}
|
||||
|
||||
LedgerHeader const&
|
||||
header() const override
|
||||
LedgerInfo const&
|
||||
info() const override
|
||||
{
|
||||
return base_.header();
|
||||
return base_.info();
|
||||
}
|
||||
|
||||
Fees const&
|
||||
@@ -164,6 +164,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/TER.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
namespace credentials {
|
||||
|
||||
// These function will be used by the code that use DepositPreauth / Credentials
|
||||
@@ -93,6 +93,6 @@ verifyDepositPreauth(
|
||||
std::shared_ptr<SLE> const& sleDst,
|
||||
beast::Journal j);
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <xrpl/ledger/ReadView.h>
|
||||
#include <xrpl/protocol/Indexes.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** A class that simplifies iterating ledger directory pages
|
||||
|
||||
@@ -108,6 +108,6 @@ private:
|
||||
std::vector<uint256>::const_iterator it_;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Open ledger construction tag.
|
||||
|
||||
@@ -82,7 +82,7 @@ private:
|
||||
monotonic_resource_;
|
||||
txs_map txs_;
|
||||
Rules rules_;
|
||||
LedgerHeader header_;
|
||||
LedgerInfo info_;
|
||||
ReadView const* base_;
|
||||
detail::RawStateTable items_;
|
||||
std::shared_ptr<void const> hold_;
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
|
||||
Effects:
|
||||
|
||||
The LedgerHeader is copied from the base.
|
||||
The LedgerInfo is copied from the base.
|
||||
|
||||
The rules are inherited from the base.
|
||||
|
||||
@@ -188,8 +188,8 @@ public:
|
||||
|
||||
// ReadView
|
||||
|
||||
LedgerHeader const&
|
||||
header() const override;
|
||||
LedgerInfo const&
|
||||
info() const override;
|
||||
|
||||
Fees const&
|
||||
fees() const override;
|
||||
@@ -252,6 +252,6 @@ public:
|
||||
std::shared_ptr<Serializer const> const& metaData) override;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -188,6 +188,6 @@ private:
|
||||
PaymentSandbox const* ps_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/Serializer.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Interface for ledger entry changes.
|
||||
|
||||
@@ -87,6 +87,6 @@ public:
|
||||
std::shared_ptr<Serializer const> const& metaData) = 0;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <optional>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -80,8 +80,8 @@ public:
|
||||
}
|
||||
|
||||
/** Returns information about the ledger. */
|
||||
virtual LedgerHeader const&
|
||||
header() const = 0;
|
||||
virtual LedgerInfo const&
|
||||
info() const = 0;
|
||||
|
||||
/** Returns true if this reflects an open ledger. */
|
||||
virtual bool
|
||||
@@ -91,14 +91,14 @@ public:
|
||||
NetClock::time_point
|
||||
parentCloseTime() const
|
||||
{
|
||||
return header().parentCloseTime;
|
||||
return info().parentCloseTime;
|
||||
}
|
||||
|
||||
/** Returns the sequence number of the base ledger. */
|
||||
LedgerIndex
|
||||
seq() const
|
||||
{
|
||||
return header().seq;
|
||||
return info().seq;
|
||||
}
|
||||
|
||||
/** Returns the fees for the base ledger. */
|
||||
@@ -258,7 +258,7 @@ makeRulesGivenLedger(
|
||||
DigestAwareReadView const& ledger,
|
||||
std::unordered_set<uint256, beast::uhash<>> const& presets);
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#include <xrpl/ledger/detail/ReadViewFwdRange.ipp>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <xrpl/ledger/RawView.h>
|
||||
#include <xrpl/ledger/detail/ApplyViewBase.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
/** Discardable, editable view to a ledger.
|
||||
|
||||
@@ -39,6 +39,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
enum class WaiveTransferFee : bool { No = false, Yes };
|
||||
enum class SkipEntry : bool { No = false, Yes };
|
||||
@@ -1197,6 +1197,6 @@ sharesToAssetsWithdraw(
|
||||
bool
|
||||
after(NetClock::time_point now, std::uint32_t mark);
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
namespace detail {
|
||||
|
||||
// Helper class that buffers modifications
|
||||
@@ -53,6 +53,8 @@ public:
|
||||
TER ter,
|
||||
std::optional<STAmount> const& deliver,
|
||||
std::optional<uint256 const> const& parentBatchId,
|
||||
std::optional<std::uint32_t> const& gasUsed,
|
||||
std::optional<std::int32_t> const& wasmReturnCode,
|
||||
bool isDryRun,
|
||||
beast::Journal j);
|
||||
|
||||
@@ -139,6 +141,6 @@ private:
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <xrpl/ledger/detail/ApplyStateTable.h>
|
||||
#include <xrpl/protocol/XRPAmount.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
namespace detail {
|
||||
|
||||
class ApplyViewBase : public ApplyView, public RawView
|
||||
@@ -27,8 +27,8 @@ public:
|
||||
bool
|
||||
open() const override;
|
||||
|
||||
LedgerHeader const&
|
||||
header() const override;
|
||||
LedgerInfo const&
|
||||
info() const override;
|
||||
|
||||
Fees const&
|
||||
fees() const override;
|
||||
@@ -106,6 +106,6 @@ protected:
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
namespace detail {
|
||||
|
||||
// Helper class that buffers raw modifications
|
||||
@@ -118,6 +118,6 @@ private:
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
|
||||
class ReadView;
|
||||
|
||||
@@ -130,6 +130,6 @@ protected:
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef XRPL_LEDGER_READVIEWFWDRANGEINL_H_INCLUDED
|
||||
#define XRPL_LEDGER_READVIEWFWDRANGEINL_H_INCLUDED
|
||||
|
||||
namespace xrpl {
|
||||
namespace ripple {
|
||||
namespace detail {
|
||||
|
||||
template <class ValueType>
|
||||
@@ -63,7 +63,7 @@ ReadViewFwdRange<ValueType>::iterator::operator==(iterator const& other) const
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
view_ == other.view_,
|
||||
"xrpl::detail::ReadViewFwdRange::iterator::operator==(iterator) "
|
||||
"ripple::detail::ReadViewFwdRange::iterator::operator==(iterator) "
|
||||
"const : input view match");
|
||||
|
||||
if (impl_ != nullptr && other.impl_ != nullptr)
|
||||
@@ -115,6 +115,6 @@ ReadViewFwdRange<ValueType>::iterator::operator++(int) -> iterator
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace xrpl
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -269,7 +269,7 @@ protected:
|
||||
error_code const& ec,
|
||||
size_t bytesTransferred)
|
||||
{
|
||||
using namespace xrpl;
|
||||
using namespace ripple;
|
||||
|
||||
if (ec)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user