Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
dbc9dd5
Add WAMR integration code
mvadari Sep 10, 2025
8341864
add host functions
mvadari Sep 10, 2025
bfc048e
add tests
mvadari Sep 10, 2025
51a9f10
CODEOWNERS
mvadari Sep 10, 2025
f03c3aa
misc host function files
mvadari Sep 10, 2025
b1d70db
limits
mvadari Sep 10, 2025
129aa4b
bring out IOUAmount.h
mvadari Sep 11, 2025
2de8488
add temBAD_WASM
mvadari Sep 11, 2025
a15d65f
update tests
mvadari Sep 11, 2025
bf32dc2
add fixtures files
mvadari Sep 11, 2025
1b6312a
rearrange files
mvadari Sep 11, 2025
ba52d34
test: improve codecov in `HostFuncWrapper.cpp` (#5730)
mvadari Sep 11, 2025
ebd90c4
chore: remove unneeded float stuff (#5729)
mvadari Sep 11, 2025
cfe57c1
Merge branch 'ripple/wamr' into ripple/wamr-host-functions
mvadari Sep 18, 2025
1c646db
Merge remote-tracking branch 'upstream/ripple/wamr' into wamr-host-fu…
mvadari Sep 18, 2025
edfed06
fix merge issues
mvadari Sep 18, 2025
6be8f21
Latests HF perf test (#5789)
oleks-rip Sep 18, 2025
9f58751
Merge branch 'ripple/wamr' into ripple/wamr-host-functions
mvadari Sep 22, 2025
b69b4a0
Merge branch 'ripple/wamr' into ripple/wamr-host-functions
mvadari Sep 26, 2025
eaba76f
Merge branch 'ripple/wamr' into ripple/wamr-host-functions
mvadari Sep 26, 2025
57fc1df
switch from wasm32-unknown-unknown to wasm32v1-none (#5814)
mvadari Sep 29, 2025
8dea76b
Merge branch 'ripple/wamr' into ripple/wamr-host-functions
mvadari Sep 30, 2025
cb62248
Merge branch 'ripple/wamr' into ripple/wamr-host-functions
mvadari Oct 2, 2025
da2b945
fix: remove `get_ledger_account_hash` and `get_ledger_tx_hash` host f…
mvadari Oct 6, 2025
c10a5f9
Merge branch 'ripple/wamr' into ripple/wamr-host-functions
mvadari Oct 9, 2025
c507880
Merge branch 'ripple/wamr' into ripple/wamr-host-functions
mvadari Oct 13, 2025
f34b05f
Merge branch 'ripple/wamr' into ripple/wamr-host-functions
mvadari Oct 16, 2025
1c5683e
Merge branch 'ripple/wamr' into ripple/wamr-host-functions
mvadari Oct 20, 2025
286dc63
Merge branch 'ripple/wamr' into ripple/wamr-host-functions
mvadari Oct 23, 2025
101f285
return size from updateData
mvadari Oct 24, 2025
29f5430
fix bug
mvadari Oct 24, 2025
0c65a38
fix tests
mvadari Oct 24, 2025
4021a7e
Wamr and HF security review fixes (#5965)
oleks-rip Oct 31, 2025
3ffdcf8
allow 0-value trace amounts
mvadari Nov 4, 2025
106dea4
update fixtures to use the latest version of stdlib
mvadari Nov 4, 2025
0bc1a11
Merge branch 'wamr' into wamr-host-functions
mvadari Nov 4, 2025
7bf6878
fix imports
mvadari Nov 4, 2025
427b7ea
run rename script
mvadari Nov 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -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
Comment on lines -3 to -8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change won't be merged. It's just so the group isn't pinged for all of our PRs not going into develop.

4 changes: 4 additions & 0 deletions include/xrpl/basics/Number.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,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
Expand Down
7 changes: 7 additions & 0 deletions include/xrpl/protocol/IOUAmount.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ class IOUAmount : private boost::totally_ordered<IOUAmount>,
normalize();

public:
/* The range for the mantissa when normalized */
static std::int64_t constexpr minMantissa = 1000000000000000ull;
static std::int64_t constexpr maxMantissa = 9999999999999999ull;
/* The range for the exponent when normalized */
static int constexpr minExponent = -96;
static int constexpr maxExponent = 80;

IOUAmount() = default;
explicit IOUAmount(Number const& other);
IOUAmount(beast::Zero);
Expand Down
7 changes: 7 additions & 0 deletions include/xrpl/protocol/Protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ std::uint8_t constexpr vaultMaximumIOUScale = 18;
* another vault; counted from 0 */
std::uint8_t constexpr maxAssetCheckDepth = 5;

/** The maximum length of a Data field in Escrow object that can be updated by
* Wasm code */
std::size_t constexpr maxWasmDataLength = 4 * 1024;

/** The maximum length of a parameters passed from Wasm code*/
std::size_t constexpr maxWasmParamLength = 1024;

/** A ledger index. */
using LedgerIndex = std::uint32_t;

Expand Down
2 changes: 2 additions & 0 deletions include/xrpl/protocol/TER.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ enum TEMcodes : TERUnderlyingType {
temARRAY_TOO_LARGE,
temBAD_TRANSFER_FEE,
temINVALID_INNER_BATCH,

temBAD_WASM,
};

//------------------------------------------------------------------------------
Expand Down
42 changes: 42 additions & 0 deletions src/libxrpl/basics/Number.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,48 @@ power(Number const& f, unsigned n)
return r;
}

// Continued fraction approximation of ln(x)
static Number
ln(Number const& x, unsigned iterations = 50)
{
if (x <= 0)
throw std::runtime_error("Not positive value");

Number const z = (x - 1) / (x + 1);
Number const zz = z * z;
Number denom = Number(1, -10);

// Construct the fraction from the bottom up
for (int i = iterations; i > 0; --i)
{
Number k(2 * i - 1);
denom = k - (i * i * zz / denom);
}

auto const r = 2 * z / denom;
return r;
Comment on lines +625 to +626
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could be simply return 2 * z / denom;

}

Number
lg(Number const& x)
{
static Number const ln10 = ln(Number(10));

if (x <= Number(10))
{
auto const r = ln(x) / ln10;
return r;
}

// ln(x) = ln(normX * 10^norm) = ln(normX) + norm * ln(10)
int diffExp = 15 + x.exponent();
Number const normalX = x / Number(1, diffExp); // (1 <= normalX < 10)
auto const lnX = ln(normalX) + diffExp * ln10;

auto const r = lnX / ln10;
return r;
Comment on lines +645 to +646
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same

}

// Returns f^(1/d)
// Uses Newton–Raphson iterations until the result stops changing
// to find the non-negative root of the polynomial g(x) = x^d - f
Expand Down
10 changes: 2 additions & 8 deletions src/libxrpl/protocol/IOUAmount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ setSTNumberSwitchover(bool v)
*getStaticSTNumberSwitchover() = v;
}

/* The range for the mantissa when normalized */
static std::int64_t constexpr minMantissa = 1000000000000000ull;
static std::int64_t constexpr maxMantissa = 9999999999999999ull;
/* The range for the exponent when normalized */
static int constexpr minExponent = -96;
static int constexpr maxExponent = 80;

IOUAmount
IOUAmount::minPositiveAmount()
{
Expand Down Expand Up @@ -293,7 +286,8 @@ mulRatio(
{
if (!result)
{
return IOUAmount(-minMantissa, minExponent);
return IOUAmount(
-IOUAmount::minMantissa, IOUAmount::minExponent);
}
// This subtraction cannot underflow because `result` is not zero
return IOUAmount(result.mantissa() - 1, result.exponent());
Expand Down
1 change: 1 addition & 0 deletions src/libxrpl/protocol/TER.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ transResults()
MAKE_ERROR(temARRAY_TOO_LARGE, "Malformed: Array is too large."),
MAKE_ERROR(temBAD_TRANSFER_FEE, "Malformed: Transfer fee is outside valid range."),
MAKE_ERROR(temINVALID_INNER_BATCH, "Malformed: Invalid inner batch transaction."),
MAKE_ERROR(temBAD_WASM, "Malformed: Provided WASM code is invalid."),

MAKE_ERROR(terRETRY, "Retry transaction."),
MAKE_ERROR(terFUNDS_SPENT, "DEPRECATED."),
Expand Down
Loading