|
1 | 1 | <pre> |
2 | 2 | title: WASM VM |
3 | 3 | description: WebAssembly VM integration into rippled |
4 | | - created: 2025-08-08 |
5 | 4 | author: Mayukha Vadari (@mvadari), Peng Wang (@pwang200), Oleksandr Pidskopnyi (@oleks_rip), David Fuelling (@sappenin) |
6 | 5 | proposal-from: https://github.com/XRPLF/XRPL-Standards/discussions/303 |
7 | 6 | status: Draft |
8 | 7 | category: Amendment |
| 8 | + created: 2025-08-08 |
| 9 | + updated: 2026-02-03 |
9 | 10 | </pre> |
10 | 11 |
|
11 | 12 | # WASM VM Configuration |
@@ -109,11 +110,11 @@ This section includes ledger header data, amendments, and fees. |
109 | 110 |
|
110 | 111 | | Function Signature | Description | Gas Cost | |
111 | 112 | | :---------------------------------------------------------------------------------------------- | :------------------------------------------------ | :------- | |
112 | | -| `get_ledger_sqn()` | Get the sequence number of the last ledger. | 60 | |
113 | | -| `get_parent_ledger_time()` | Get the time (in Ripple Time) of the last ledger. | 60 | |
| 113 | +| `get_ledger_sqn(`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Get the sequence number of the last ledger. | 60 | |
| 114 | +| `get_parent_ledger_time(`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Get the time (in Ripple Time) of the last ledger. | 60 | |
114 | 115 | | `get_parent_ledger_hash(`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Get the hash of the last ledger. | 60 | |
115 | 116 | | `amendment_enabled(`<br/> `amendment_ptr: i32,`<br/> `amendment_len: i32`<br />`)` | Check if a given amendment is enabled. | 60 | |
116 | | -| `get_base_fee()` | Get the current transaction base fee. | 60 | |
| 117 | +| `get_base_fee(`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Get the current transaction base fee. | 60 | |
117 | 118 |
|
118 | 119 | ### 5.2. Current Ledger Object data |
119 | 120 |
|
@@ -157,27 +158,27 @@ Fetch data from any other ledger object |
157 | 158 |
|
158 | 159 | A keylet is a unique hash that represents a ledger object on the XRP Ledger. It is a 256-bit hash, constructed from unique identifiers for an object. For example, an `AccountRoot`'s hash is constructed from its `AccountID`, and an `Oracle`'s hash is constructed from its `Owner` and `DocumentID`. |
159 | 160 |
|
160 | | -| Function Signature | Description | Gas Cost | |
161 | | -| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------- | :------- | |
162 | | -| `account_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `AccountRoot`'s keylet from its pieces. | 350 | |
163 | | -| `amm_keylet(`<br/> `issue1_ptr: i32,`<br/> `issue1_len: i32,`<br/> `issue2_ptr: i32,`<br/> `issue2_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `AMM`’s keylet from its pieces. | 350 | |
164 | | -| `check_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `Check`'s keylet from its pieces. | 350 | |
165 | | -| `credential_keylet(`<br/> `subject_ptr: i32,`<br/> `subject_len: i32,`<br/> `issuer_ptr: i32,`<br/> `issuer_len: i32,`<br/> `cred_type_ptr: i32,`<br/> `cred_type_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `Credential`'s keylet from its pieces. | 350 | |
166 | | -| `delegate_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `authorize_ptr: i32,`<br/> `authorize_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `Delegate`'s keylet from its pieces. | 350 | |
167 | | -| `deposit_preauth_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `authorize_ptr: i32,`<br/> `authorize_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `DepositPreauth`'s keylet from its pieces. | 350 | |
168 | | -| `did_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `DID`'s keylet from its pieces. | 350 | |
169 | | -| `escrow_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `Escrow`'s keylet from its pieces. | 350 | |
170 | | -| `line_keylet(`<br/> `account1_ptr: i32,`<br/> `account1_len: i32,`<br/> `account2_ptr: i32,`<br/> `account2_len: i32,`<br/> `currency_ptr: i32,`<br/> `currency_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a trustline’s keylet from its pieces. | 350 | |
171 | | -| `mpt_issuance_keylet(`<br/> `issuer_ptr: i32,`<br/> `issuer_len: i32,`<br/> `sequence: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `MPTIssuance`’s keylet from its pieces. | 350 | |
172 | | -| `mptoken_keylet(`<br/> `mptid_ptr: i32,`<br/> `mptid_len: i32,`<br/> `holder_ptr: i32,`<br/> `holder_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `MPToken`’s keylet from its pieces. | 350 | |
173 | | -| `nft_offer_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `NFTOffer`'s keylet from its pieces. | 350 | |
174 | | -| `offer_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `Offer`'s keylet from its pieces. | 350 | |
175 | | -| `oracle_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `document_id: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `Oracle`'s keylet from its pieces. | 350 | |
176 | | -| `paychan_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `destination_ptr: i32,`<br/> `destination_len: i32,`<br/> `sequence: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `PayChannel`’s keylet from its pieces. | 350 | |
177 | | -| `permissioned_domain_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `PermissionedDomain`’s keylet from its pieces. | 350 | |
178 | | -| `signers_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `SignerListSet`'s keylet from its pieces. | 350 | |
179 | | -| `ticket_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `Ticket`'s keylet from its pieces. | 350 | |
180 | | -| `vault_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `Vault`’s keylet from its pieces. | 350 | |
| 161 | +| Function Signature | Description | Gas Cost | |
| 162 | +| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------- | :------- | |
| 163 | +| `account_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `AccountRoot`'s keylet from its pieces. | 350 | |
| 164 | +| `amm_keylet(`<br/> `issue1_ptr: i32,`<br/> `issue1_len: i32,`<br/> `issue2_ptr: i32,`<br/> `issue2_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `AMM`’s keylet from its pieces. | 350 | |
| 165 | +| `check_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence_ptr: i32,`<br/> `sequence_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `Check`'s keylet from its pieces. | 350 | |
| 166 | +| `credential_keylet(`<br/> `subject_ptr: i32,`<br/> `subject_len: i32,`<br/> `issuer_ptr: i32,`<br/> `issuer_len: i32,`<br/> `cred_type_ptr: i32,`<br/> `cred_type_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `Credential`'s keylet from its pieces. | 350 | |
| 167 | +| `delegate_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `authorize_ptr: i32,`<br/> `authorize_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `Delegate`'s keylet from its pieces. | 350 | |
| 168 | +| `deposit_preauth_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `authorize_ptr: i32,`<br/> `authorize_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `DepositPreauth`'s keylet from its pieces. | 350 | |
| 169 | +| `did_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `DID`'s keylet from its pieces. | 350 | |
| 170 | +| `escrow_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence_ptr: i32,`<br/> `sequence_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `Escrow`'s keylet from its pieces. | 350 | |
| 171 | +| `line_keylet(`<br/> `account1_ptr: i32,`<br/> `account1_len: i32,`<br/> `account2_ptr: i32,`<br/> `account2_len: i32,`<br/> `currency_ptr: i32,`<br/> `currency_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a trustline’s keylet from its pieces. | 350 | |
| 172 | +| `mpt_issuance_keylet(`<br/> `issuer_ptr: i32,`<br/> `issuer_len: i32,`<br/> `sequence_ptr: i32,`<br/> `sequence_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `MPTIssuance`’s keylet from its pieces. | 350 | |
| 173 | +| `mptoken_keylet(`<br/> `mptid_ptr: i32,`<br/> `mptid_len: i32,`<br/> `holder_ptr: i32,`<br/> `holder_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `MPToken`’s keylet from its pieces. | 350 | |
| 174 | +| `nft_offer_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence_ptr: i32,`<br/> `sequence_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `NFTOffer`'s keylet from its pieces. | 350 | |
| 175 | +| `offer_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence_ptr: i32,`<br/> `sequence_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `Offer`'s keylet from its pieces. | 350 | |
| 176 | +| `oracle_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `document_id_ptr: i32,`<br/> `document_id_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate an `Oracle`'s keylet from its pieces. | 350 | |
| 177 | +| `paychan_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `destination_ptr: i32,`<br/> `destination_len: i32,`<br/> `sequence_ptr: i32,`<br/> `sequence_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `PayChannel`’s keylet from its pieces. | 350 | |
| 178 | +| `permissioned_domain_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence_ptr: i32,`<br/> `sequence_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `PermissionedDomain`’s keylet from its pieces. | 350 | |
| 179 | +| `signers_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `SignerListSet`'s keylet from its pieces. | 350 | |
| 180 | +| `ticket_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence_ptr: i32,`<br/> `sequence_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `Ticket`'s keylet from its pieces. | 350 | |
| 181 | +| `vault_keylet(`<br/> `account_ptr: i32,`<br/> `account_len: i32,`<br/> `sequence_ptr: i32,`<br/> `sequence_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Calculate a `Vault`’s keylet from its pieces. | 350 | |
181 | 182 |
|
182 | 183 | The singleton keylets (e.g. `Amendments`) are a bit unnecessary to include, as a dev can simply copy the keylet directly instead. They will be included as constants in `xrpl-wasm-stdlib` as well. |
183 | 184 |
|
@@ -219,8 +220,8 @@ Helper functions for working with rippled-encoded floats (e.g. IOU amounts). |
219 | 220 | | `float_subtract(`<br/> `in_buf1: i32,`<br/> `in_len1: i32,`<br/> `in_buf2: i32,`<br/> `in_len2: i32,`<br/> `out_buf: i32,`<br/> `out_len: i32,`<br/> `rounding_modes: i32`<br />`)` | Subtract two floats in rippled format. | 1000 | |
220 | 221 | | `float_multiply(`<br/> `in_buf1: i32,`<br/> `in_len1: i32,`<br/> `in_buf2: i32,`<br/> `in_len2: i32,`<br/> `out_buf: i32,`<br/> `out_len: i32,`<br/> `rounding_modes: i32`<br />`)` | Multiply two floats in rippled format. | 1000 | |
221 | 222 | | `float_divide(`<br/> `in_buf1: i32,`<br/> `in_len1: i32,`<br/> `in_buf2: i32,`<br/> `in_len2: i32,`<br/> `out_buf: i32,`<br/> `out_len: i32,`<br/> `rounding_modes: i32`<br />`)` | Divide two floats in rippled format. | 1000 | |
222 | | -| `float_pow(`<br/> `in_buf: i32,`<br/> `in_len: i32,`<br/> `n: i32,`<br/> `out_buf: i32,`<br/> `out_len: i32,`<br/> `rounding_modes: i32`<br />`)` | Compute the nth power of a float in rippled format. | 1000 | |
223 | | -| `float_root(`<br/> `in_buf: i32,`<br/> `in_len: i32,`<br/> `n: i32,`<br/> `out_buf: i32,`<br/> `out_len: i32,`<br/> `rounding_modes: i32`<br />`)` | Compute the nth root of a float in rippled format. | 1000 | |
| 223 | +| `float_pow(`<br/> `in_buf: i32,`<br/> `in_len: i32,`<br/> `pow: i32,`<br/> `out_buf: i32,`<br/> `out_len: i32,`<br/> `rounding_modes: i32`<br />`)` | Compute the nth power of a float in rippled format. | 1000 | |
| 224 | +| `float_root(`<br/> `in_buf: i32,`<br/> `in_len: i32,`<br/> `root: i32,`<br/> `out_buf: i32,`<br/> `out_len: i32,`<br/> `rounding_modes: i32`<br />`)` | Compute the nth root of a float in rippled format. | 1000 | |
224 | 225 | | `float_log(`<br/> `in_buf: i32,`<br/> `in_len: i32,`<br/> `out_buf: i32,`<br/> `out_len: i32,`<br/> `rounding_modes: i32`<br />`)` | Compute the 10 based log of a float in rippled format. | 1000 | |
225 | 226 |
|
226 | 227 | ### 5.9. Trace |
|
0 commit comments