Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
b6a95f9
PoC Smart Escrows (#5340)
mvadari Mar 20, 2025
911c046
Merge develop into ripple/smart-escrow (#5357)
mvadari Mar 20, 2025
1573a44
smart escrow devnet 1 host functions (#5353)
pwang200 Mar 24, 2025
177cdaf
Connect votable gas limit into VM (#5360)
mvadari Mar 25, 2025
f37d52d
Set up fees for WASM processing (#5393)
mvadari Apr 24, 2025
be4a0c9
Merge remote-tracking branch 'upstream/ripple/smart-escrow' into deve…
mvadari Apr 28, 2025
f8b2fe4
fix imports
mvadari Apr 28, 2025
f03b588
More host functions (#5411)
mvadari Apr 29, 2025
4670b37
try to fix tests
mvadari Apr 29, 2025
9c02049
fix reference fee tests
mvadari Apr 29, 2025
b4b53a6
Merge branch 'ripple/smart-escrow' into develop2
mvadari Apr 29, 2025
bb9bc76
Switch to WAMR (#5416)
oleks-rip May 1, 2025
c533abd
Update size and compute cap defaults (#5417)
mvadari May 1, 2025
bb9bb5f
Merge branch 'ripple/smart-escrow' into develop2
mvadari May 1, 2025
1e9ff88
Fix CI build issues
oleks-rip May 8, 2025
5b43ec7
refactor: switch function name from `ready` to `finish` (#5430)
mvadari May 20, 2025
aef32ea
better WASM logging to match rippled (#5395)
mvadari May 23, 2025
1ede0bd
fix: fix fixtures (#5445)
mvadari May 23, 2025
31ad5ac
Merge remote-tracking branch 'upstream/ripple/smart-escrow' into deve…
mvadari May 27, 2025
ce31acf
debug comments
mvadari May 28, 2025
fb1311e
uncomment????
mvadari May 28, 2025
6c6f8cd
Merge remote-tracking branch 'upstream/develop' into develop3
mvadari May 29, 2025
1f8aece
feat: add a `GasUsed` parameter to the metadata (#5456)
mvadari May 29, 2025
6a6fed5
More hostfunctions (#5451)
oleks-rip May 30, 2025
ace2247
Merge remote-tracking branch 'upstream/ripple/smart-escrow' into deve…
mvadari Jun 4, 2025
383b225
Fix processing nonexistent field (#5467)
oleks-rip Jun 4, 2025
a0aeeb8
Merge remote-tracking branch 'upstream/develop' into develop3.5
mvadari Jun 5, 2025
a072d49
Merge remote-tracking branch 'upstream/ripple/smart-escrow' into deve…
mvadari Jun 5, 2025
8a33702
fix merge issues
mvadari Jun 5, 2025
6e8a5f0
fix: make host function traces easier to use, fix `get_NFT` bug (#5466)
mvadari Jun 5, 2025
51a9c0f
Host function gas cost (#5488)
oleks-rip Jun 12, 2025
add55c4
Host functions gas cost for wasm_runtime interface (#5500)
oleks-rip Jun 25, 2025
1cd16fa
Host-functions perf test fixes (#5514)
oleks-rip Jun 27, 2025
463acf5
preflight checks for wasm (#5517)
oleks-rip Jun 30, 2025
ece3a8d
Merge branch 'develop' into develop4
mvadari Jun 30, 2025
a0d275f
chore: Clear CODEOWNERS (#5528)
intelliot Jul 2, 2025
65b0b97
Sync error codes (#5527)
oleks-rip Jul 2, 2025
7bdf5fa
Fix build.md wamr version (#5535)
oleks-rip Jul 3, 2025
4fa0ae5
disallow a computation allowance of 0 (#5541)
mvadari Jul 8, 2025
bc445ec
Add hostfunctions schedule table
oleks-rip Jul 11, 2025
9007097
Simplify host function boilerplate (#5534)
mvadari Jul 14, 2025
24b7a03
feat: add more keylet host functions (#5522)
mvadari Jul 17, 2025
9eca1a3
MPT and IOU support for amount and issue (#5573)
oleks-rip Jul 22, 2025
250f284
Merge remote-tracking branch 'upstream/develop' into develop4.5
mvadari Jul 23, 2025
98b8986
fix merge issues (mostly with Conan2 upgrade)
mvadari Jul 23, 2025
7f52287
rename variables (#5609)
mvadari Jul 25, 2025
84fd7d0
Merge remote-tracking branch 'upstream/develop' into develop4.6
mvadari Jul 25, 2025
3d93379
add header
mvadari Jul 25, 2025
6f91b8f
Fix windows
oleks-rip Jul 28, 2025
44cb588
Build options cleanup (#5581)
Bronek Jul 25, 2025
c8c241b
Merge remote-tracking branch 'upstream/develop' into develop4.6
mvadari Jul 29, 2025
66776b6
test: codecov for WasmHostFuncWrapper.cpp (#5601)
mvadari Jul 29, 2025
3b849ff
Add unit tests for host functions (#5578)
mvadari Jul 29, 2025
3108ca0
Float point HF (#5611)
oleks-rip Jul 30, 2025
2847075
fix: ensure `GasUsed` shows up in the metadata even on `tecWASM_REJEC…
mvadari Jul 31, 2025
ccc3280
Update wamr to 2.4.1 (#5640)
oleks-rip Jul 31, 2025
8426470
feat: add other misc host functions (#5574)
mvadari Jul 31, 2025
58741d2
feat: return an int instead of boolean from `finish`, display in meta…
mvadari Aug 4, 2025
38c7a27
clean up WASM functions a bit (#5628)
mvadari Aug 5, 2025
9bc0424
Merge remote-tracking branch 'upstream/ripple/smart-escrow' into deve…
mvadari Aug 6, 2025
c15947d
fix CI
mvadari Aug 6, 2025
5dc0cee
cache data instead of setting it in `updateData` (#5642)
mvadari Aug 11, 2025
0d0e279
Float point Hostfunctions unit tests (#5656)
oleks-rip Aug 14, 2025
1d141bf
chore: move WASM files to separate folder (#5666)
mvadari Aug 14, 2025
b0a1ad3
Disable float point instructions (#5679)
oleks-rip Aug 14, 2025
647b475
Fix float point binary format (#5688)
oleks-rip Aug 15, 2025
77875c9
fix: actually return int instead of bool (#5651)
mvadari Aug 15, 2025
293d8e4
test: store Rust source code in rippled, instead of just opaque hex s…
mvadari Aug 15, 2025
dd30d81
feat: last set of host functions (#5674)
mvadari Aug 15, 2025
10558c9
Merge remote-tracking branch 'upstream/develop' into develop5.5
mvadari Aug 22, 2025
155a84c
Merge branch 'develop' into ripple/smart-escrow
mvadari Aug 22, 2025
6367d68
Merge branch 'develop' into ripple/smart-escrow
mvadari Aug 22, 2025
2399d90
Merge branch 'develop' into ripple/smart-escrow
mvadari Aug 25, 2025
8c38ef7
chore: exclude a bunch of code that doesn't need to be tested from co…
mvadari Aug 26, 2025
0fed78f
Merge branch 'develop' into ripple/smart-escrow
mvadari Aug 26, 2025
0b5f8f4
Merge remote-tracking branch 'upstream/develop' into ripple/smart-escrow
mvadari Aug 26, 2025
697d147
change: adjust the function signatures for `get_ledger_sqn` and `get_…
mvadari Aug 27, 2025
3d86881
Merge branch 'develop' into ripple/smart-escrow
mvadari Aug 27, 2025
c2ea68c
Merge branch 'develop' into ripple/smart-escrow
mvadari Aug 28, 2025
8ac5143
get new fees and reserves working (#5714)
mvadari Aug 29, 2025
db957cf
Merge branch 'develop' into ripple/smart-escrow
mvadari Aug 29, 2025
5266f04
chore: rollback unrelated changes (#5737)
mvadari Sep 2, 2025
e7aa924
Merge branch 'develop' into ripple/smart-escrow
mvadari Sep 3, 2025
f3c5031
Merge branch 'develop' into ripple/smart-escrow
mvadari Sep 4, 2025
a46d772
fix build and tests (#5768)
mvadari Sep 4, 2025
3ab0a82
Merge branch 'develop' into ripple/smart-escrow
mvadari Sep 8, 2025
f2c7da3
Merge branch 'develop' into ripple/smart-escrow
mvadari Sep 9, 2025
4d4a1cf
Merge branch 'develop' into ripple/smart-escrow
mvadari Sep 9, 2025
adc64e7
Merge branch 'develop' into ripple/smart-escrow
mvadari Sep 10, 2025
5c480cf
Merge branch 'develop' into ripple/smart-escrow
mvadari Sep 10, 2025
ffa21c2
fix test
mvadari Sep 11, 2025
2f869b3
Merge branch 'develop' into ripple/smart-escrow
mvadari Sep 11, 2025
e6592e9
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Sep 22, 2025
85bff20
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Sep 23, 2025
f1f798b
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Sep 26, 2025
8729688
Merge remote-tracking branch 'upstream/ripple/se/fees' into ripple/sm…
mvadari Sep 26, 2025
a865b4d
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Sep 26, 2025
8d266d3
remove STInt64 (#5815)
mvadari Sep 29, 2025
965a9e8
Merge remote-tracking branch 'upstream/ripple/se/fees' into ripple/sm…
mvadari Oct 2, 2025
55772a0
add sfData preflight checks + tests (#5839)
mvadari Oct 2, 2025
c41e52f
Move Smart Escrow tests to separate file (#5849)
mvadari Oct 6, 2025
db263b6
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Oct 6, 2025
e41f6a7
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Oct 9, 2025
f16f243
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Oct 13, 2025
91455b6
respond to comments
mvadari Oct 13, 2025
c6c54b3
resolve todos
mvadari Oct 14, 2025
17f401f
reduce diff
mvadari Oct 14, 2025
c9c3578
reduce diff more
mvadari Oct 14, 2025
3b6cd22
fix
mvadari Oct 14, 2025
3a0e9aa
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Oct 20, 2025
9cfb7ac
fix build issue
mvadari Oct 20, 2025
7d22fe8
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Oct 23, 2025
566b85b
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Oct 23, 2025
b6bd268
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Oct 24, 2025
079e251
fix bug
mvadari Oct 24, 2025
fc6ff69
fix tests
mvadari Oct 24, 2025
22ca691
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Oct 24, 2025
7e2e10f
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Oct 24, 2025
a891b49
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Nov 4, 2025
fa8aa49
Merge branch 'ripple/se/fees' into ripple/smart-escrow
mvadari Nov 4, 2025
58e5b4a
Merge remote-tracking branch 'upstream/ripple/se/fees' into ripple/sm…
mvadari Nov 4, 2025
def7758
remove copyright stuff
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
14 changes: 14 additions & 0 deletions include/xrpl/ledger/ApplyViewImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ class ApplyViewImpl final : public detail::ApplyViewBase
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
Expand All @@ -73,6 +85,8 @@ class ApplyViewImpl final : public detail::ApplyViewBase

private:
std::optional<STAmount> deliver_;
std::optional<std::uint32_t> gasUsed_;
std::optional<std::int32_t> wasmReturnCode_;
};

} // namespace ripple
Expand Down
2 changes: 2 additions & 0 deletions include/xrpl/ledger/detail/ApplyStateTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class ApplyStateTable
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);

Expand Down
6 changes: 6 additions & 0 deletions include/xrpl/protocol/Indexes.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ page(Keylet const& root, std::uint64_t index = 0) noexcept
Keylet
escrow(AccountID const& src, std::uint32_t seq) noexcept;

inline Keylet
escrow(uint256 const& key) noexcept
{
return {ltESCROW, key};
}

/** A PaymentChannel */
Keylet
payChan(AccountID const& src, AccountID const& dst, std::uint32_t seq) noexcept;
Expand Down
3 changes: 3 additions & 0 deletions include/xrpl/protocol/TER.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ enum TEFcodes : TERUnderlyingType {
tefNO_TICKET,
tefNFTOKEN_IS_NOT_TRANSFERABLE,
tefINVALID_LEDGER_FIX_TYPE,
tefNO_WASM,
tefWASM_FIELD_NOT_INCLUDED,
};

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -349,6 +351,7 @@ enum TECcodes : TERUnderlyingType {
// backward compatibility with historical data on non-prod networks, can be
// reclaimed after those networks reset.
tecNO_DELEGATE_PERMISSION = 198,
tecWASM_REJECTED = 199,
};

//------------------------------------------------------------------------------
Expand Down
32 changes: 32 additions & 0 deletions include/xrpl/protocol/TxMeta.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ class TxMeta

if (obj.isFieldPresent(sfParentBatchID))
parentBatchID_ = obj.getFieldH256(sfParentBatchID);

if (obj.isFieldPresent(sfGasUsed))
gasUsed_ = obj.getFieldU32(sfGasUsed);

if (obj.isFieldPresent(sfWasmReturnCode))
wasmReturnCode_ = obj.getFieldI32(sfWasmReturnCode);
}

std::optional<STAmount> const&
Expand All @@ -105,6 +111,30 @@ class TxMeta
parentBatchID_ = id;
}

void
setGasUsed(std::optional<std::uint32_t> const gasUsed)
{
gasUsed_ = gasUsed;
}

std::optional<std::uint32_t> const&
getGasUsed() const
{
return gasUsed_;
}

void
setWasmReturnCode(std::optional<std::int32_t> const wasmReturnCode)
{
wasmReturnCode_ = wasmReturnCode;
}

std::optional<std::int32_t> const&
getWasmReturnCode() const
{
return wasmReturnCode_;
}

private:
uint256 transactionID_;
std::uint32_t ledgerSeq_;
Expand All @@ -113,6 +143,8 @@ class TxMeta

std::optional<STAmount> deliveredAmount_;
std::optional<uint256> parentBatchID_;
std::optional<std::uint32_t> gasUsed_;
std::optional<std::int32_t> wasmReturnCode_;

STArray nodes_;
};
Expand Down
2 changes: 2 additions & 0 deletions include/xrpl/protocol/detail/ledger_entries.macro
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
{sfCondition, soeOPTIONAL},
{sfCancelAfter, soeOPTIONAL},
{sfFinishAfter, soeOPTIONAL},
{sfFinishFunction, soeOPTIONAL},
{sfData, soeOPTIONAL},
{sfSourceTag, soeOPTIONAL},
{sfDestinationTag, soeOPTIONAL},
{sfOwnerNode, soeREQUIRED},
Expand Down
12 changes: 6 additions & 6 deletions include/xrpl/protocol/detail/sfields.macro
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ TYPED_SFIELD(sfMutableFlags, UINT32, 53)
TYPED_SFIELD(sfExtensionComputeLimit, UINT32, 54)
TYPED_SFIELD(sfExtensionSizeLimit, UINT32, 55)
TYPED_SFIELD(sfGasPrice, UINT32, 56)
TYPED_SFIELD(sfComputationAllowance, UINT32, 57)
TYPED_SFIELD(sfGasUsed, UINT32, 58)

// 64-bit integers (common)
TYPED_SFIELD(sfIndexNext, UINT64, 1)
Expand Down Expand Up @@ -192,11 +194,8 @@ TYPED_SFIELD(sfAssetsMaximum, NUMBER, 3)
TYPED_SFIELD(sfAssetsTotal, NUMBER, 4)
TYPED_SFIELD(sfLossUnrealized, NUMBER, 5)

// int32
// NOTE: Do not use `sfDummyInt32`. It's so far the only use of INT32
// in this file and has been defined here for test only.
// TODO: Replace `sfDummyInt32` with actually useful field.
TYPED_SFIELD(sfDummyInt32, INT32, 1) // for tests only
// 32-bit signed (common)
TYPED_SFIELD(sfWasmReturnCode, INT32, 1)

// currency amount (common)
TYPED_SFIELD(sfAmount, AMOUNT, 1)
Expand Down Expand Up @@ -226,7 +225,7 @@ TYPED_SFIELD(sfBaseFeeDrops, AMOUNT, 22)
TYPED_SFIELD(sfReserveBaseDrops, AMOUNT, 23)
TYPED_SFIELD(sfReserveIncrementDrops, AMOUNT, 24)

// currency amount (AMM)
// currency amount (more)
TYPED_SFIELD(sfLPTokenOut, AMOUNT, 25)
TYPED_SFIELD(sfLPTokenIn, AMOUNT, 26)
TYPED_SFIELD(sfEPrice, AMOUNT, 27)
Expand Down Expand Up @@ -268,6 +267,7 @@ TYPED_SFIELD(sfAssetClass, VL, 28)
TYPED_SFIELD(sfProvider, VL, 29)
TYPED_SFIELD(sfMPTokenMetadata, VL, 30)
TYPED_SFIELD(sfCredentialType, VL, 31)
TYPED_SFIELD(sfFinishFunction, VL, 32)

// account (common)
TYPED_SFIELD(sfAccount, ACCOUNT, 1)
Expand Down
5 changes: 4 additions & 1 deletion include/xrpl/protocol/detail/transactions.macro
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate,
noPriv,
({
{sfDestination, soeREQUIRED},
{sfDestinationTag, soeOPTIONAL},
{sfAmount, soeREQUIRED, soeMPTSupported},
{sfCondition, soeOPTIONAL},
{sfCancelAfter, soeOPTIONAL},
{sfFinishAfter, soeOPTIONAL},
{sfDestinationTag, soeOPTIONAL},
{sfFinishFunction, soeOPTIONAL},
{sfData, soeOPTIONAL},
}))

/** This transaction type completes an existing escrow. */
Expand All @@ -68,6 +70,7 @@ TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish,
{sfFulfillment, soeOPTIONAL},
{sfCondition, soeOPTIONAL},
{sfCredentialIDs, soeOPTIONAL},
{sfComputationAllowance, soeOPTIONAL},
}))


Expand Down
4 changes: 4 additions & 0 deletions src/libxrpl/ledger/ApplyStateTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ ApplyStateTable::apply(
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)
{
Expand All @@ -111,6 +113,8 @@ ApplyStateTable::apply(

meta.setDeliveredAmount(deliver);
meta.setParentBatchID(parentBatchId);
meta.setGasUsed(gasUsed);
meta.setWasmReturnCode(wasmReturnCode);

Mods newMod;
for (auto& item : items_)
Expand Down
11 changes: 10 additions & 1 deletion src/libxrpl/ledger/ApplyViewImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ ApplyViewImpl::apply(
bool isDryRun,
beast::Journal j)
{
return items_.apply(to, tx, ter, deliver_, parentBatchId, isDryRun, j);
return items_.apply(
to,
tx,
ter,
deliver_,
parentBatchId,
gasUsed_,
wasmReturnCode_,
isDryRun,
j);
}

std::size_t
Expand Down
3 changes: 3 additions & 0 deletions src/libxrpl/protocol/TER.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ transResults()
MAKE_ERROR(tecLIMIT_EXCEEDED, "Limit exceeded."),
MAKE_ERROR(tecPSEUDO_ACCOUNT, "This operation is not allowed against a pseudo-account."),
MAKE_ERROR(tecPRECISION_LOSS, "The amounts used by the transaction cannot interact."),
MAKE_ERROR(tecWASM_REJECTED, "The custom WASM code that was run rejected your transaction."),

MAKE_ERROR(tefALREADY, "The exact transaction was already in this ledger."),
MAKE_ERROR(tefBAD_ADD_AUTH, "Not authorized to add account."),
Expand All @@ -131,6 +132,8 @@ transResults()
MAKE_ERROR(tefNO_TICKET, "Ticket is not in ledger."),
MAKE_ERROR(tefNFTOKEN_IS_NOT_TRANSFERABLE, "The specified NFToken is not transferable."),
MAKE_ERROR(tefINVALID_LEDGER_FIX_TYPE, "The LedgerFixType field has an invalid value."),
MAKE_ERROR(tefNO_WASM, "There is no WASM code to run, but a WASM-specific field was included."),
MAKE_ERROR(tefWASM_FIELD_NOT_INCLUDED, "WASM code requires a field to be included that was not included."),

MAKE_ERROR(telLOCAL_ERROR, "Local failure."),
MAKE_ERROR(telBAD_DOMAIN, "Domain too long."),
Expand Down
6 changes: 6 additions & 0 deletions src/libxrpl/protocol/TxMeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ TxMeta::getAsObject() const
if (parentBatchID_.has_value())
metaData.setFieldH256(sfParentBatchID, *parentBatchID_);

if (gasUsed_.has_value())
metaData.setFieldU32(sfGasUsed, *gasUsed_);

if (wasmReturnCode_.has_value())
metaData.setFieldI32(sfWasmReturnCode, *wasmReturnCode_);

return metaData;
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/app/AMM_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7466,7 +7466,7 @@ struct AMM_test : public jtx::AMMTest
using namespace test::jtx;

auto const testCase = [&](std::string suffix, FeatureBitset features) {
testcase("Fail pseudo-account allocation " + suffix);
testcase("Pseudo-account allocation failure " + suffix);
std::string logs;
Env env{*this, features, std::make_unique<CaptureLogs>(&logs)};
env.fund(XRP(30'000), gw, alice);
Expand Down
Loading