Skip to content

Commit e978a4f

Browse files
authored
XLS-102: convert u32s from i32s to buffers (#447)
* XLS-102: convert u32s from i32s to buffers * add updated date
1 parent e763e78 commit e978a4f

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

XLS-0102-wasm-vm/README.md

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<pre>
22
title: WASM VM
33
description: WebAssembly VM integration into rippled
4-
created: 2025-08-08
54
author: Mayukha Vadari (@mvadari), Peng Wang (@pwang200), Oleksandr Pidskopnyi (@oleks_rip), David Fuelling (@sappenin)
65
proposal-from: https://github.com/XRPLF/XRPL-Standards/discussions/303
76
status: Draft
87
category: Amendment
8+
created: 2025-08-08
9+
updated: 2026-02-03
910
</pre>
1011

1112
# WASM VM Configuration
@@ -109,11 +110,11 @@ This section includes ledger header data, amendments, and fees.
109110

110111
| Function Signature | Description | Gas Cost |
111112
| :---------------------------------------------------------------------------------------------- | :------------------------------------------------ | :------- |
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/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Get the sequence number of the last ledger. | 60 |
114+
| `get_parent_ledger_time(`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Get the time (in Ripple Time) of the last ledger. | 60 |
114115
| `get_parent_ledger_hash(`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Get the hash of the last ledger. | 60 |
115116
| `amendment_enabled(`<br/>&emsp;`amendment_ptr: i32,`<br/>&emsp;`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/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Get the current transaction base fee. | 60 |
117118

118119
### 5.2. Current Ledger Object data
119120

@@ -157,27 +158,27 @@ Fetch data from any other ledger object
157158

158159
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`.
159160

160-
| Function Signature | Description | Gas Cost |
161-
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------- | :------- |
162-
| `account_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `AccountRoot`'s keylet from its pieces. | 350 |
163-
| `amm_keylet(`<br/>&emsp;`issue1_ptr: i32,`<br/>&emsp;`issue1_len: i32,`<br/>&emsp;`issue2_ptr: i32,`<br/>&emsp;`issue2_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `AMM`’s keylet from its pieces. | 350 |
164-
| `check_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `Check`'s keylet from its pieces. | 350 |
165-
| `credential_keylet(`<br/>&emsp;`subject_ptr: i32,`<br/>&emsp;`subject_len: i32,`<br/>&emsp;`issuer_ptr: i32,`<br/>&emsp;`issuer_len: i32,`<br/>&emsp;`cred_type_ptr: i32,`<br/>&emsp;`cred_type_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `Credential`'s keylet from its pieces. | 350 |
166-
| `delegate_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`authorize_ptr: i32,`<br/>&emsp;`authorize_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `Delegate`'s keylet from its pieces. | 350 |
167-
| `deposit_preauth_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`authorize_ptr: i32,`<br/>&emsp;`authorize_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `DepositPreauth`'s keylet from its pieces. | 350 |
168-
| `did_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `DID`'s keylet from its pieces. | 350 |
169-
| `escrow_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `Escrow`'s keylet from its pieces. | 350 |
170-
| `line_keylet(`<br/>&emsp;`account1_ptr: i32,`<br/>&emsp;`account1_len: i32,`<br/>&emsp;`account2_ptr: i32,`<br/>&emsp;`account2_len: i32,`<br/>&emsp;`currency_ptr: i32,`<br/>&emsp;`currency_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a trustline’s keylet from its pieces. | 350 |
171-
| `mpt_issuance_keylet(`<br/>&emsp;`issuer_ptr: i32,`<br/>&emsp;`issuer_len: i32,`<br/>&emsp;`sequence: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `MPTIssuance`’s keylet from its pieces. | 350 |
172-
| `mptoken_keylet(`<br/>&emsp;`mptid_ptr: i32,`<br/>&emsp;`mptid_len: i32,`<br/>&emsp;`holder_ptr: i32,`<br/>&emsp;`holder_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `MPToken`’s keylet from its pieces. | 350 |
173-
| `nft_offer_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `NFTOffer`'s keylet from its pieces. | 350 |
174-
| `offer_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `Offer`'s keylet from its pieces. | 350 |
175-
| `oracle_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`document_id: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `Oracle`'s keylet from its pieces. | 350 |
176-
| `paychan_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`destination_ptr: i32,`<br/>&emsp;`destination_len: i32,`<br/>&emsp;`sequence: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `PayChannel`’s keylet from its pieces. | 350 |
177-
| `permissioned_domain_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `PermissionedDomain`’s keylet from its pieces. | 350 |
178-
| `signers_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `SignerListSet`'s keylet from its pieces. | 350 |
179-
| `ticket_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `Ticket`'s keylet from its pieces. | 350 |
180-
| `vault_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`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/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `AccountRoot`'s keylet from its pieces. | 350 |
164+
| `amm_keylet(`<br/>&emsp;`issue1_ptr: i32,`<br/>&emsp;`issue1_len: i32,`<br/>&emsp;`issue2_ptr: i32,`<br/>&emsp;`issue2_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `AMM`’s keylet from its pieces. | 350 |
165+
| `check_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence_ptr: i32,`<br/>&emsp;`sequence_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `Check`'s keylet from its pieces. | 350 |
166+
| `credential_keylet(`<br/>&emsp;`subject_ptr: i32,`<br/>&emsp;`subject_len: i32,`<br/>&emsp;`issuer_ptr: i32,`<br/>&emsp;`issuer_len: i32,`<br/>&emsp;`cred_type_ptr: i32,`<br/>&emsp;`cred_type_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `Credential`'s keylet from its pieces. | 350 |
167+
| `delegate_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`authorize_ptr: i32,`<br/>&emsp;`authorize_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `Delegate`'s keylet from its pieces. | 350 |
168+
| `deposit_preauth_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`authorize_ptr: i32,`<br/>&emsp;`authorize_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `DepositPreauth`'s keylet from its pieces. | 350 |
169+
| `did_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `DID`'s keylet from its pieces. | 350 |
170+
| `escrow_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence_ptr: i32,`<br/>&emsp;`sequence_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `Escrow`'s keylet from its pieces. | 350 |
171+
| `line_keylet(`<br/>&emsp;`account1_ptr: i32,`<br/>&emsp;`account1_len: i32,`<br/>&emsp;`account2_ptr: i32,`<br/>&emsp;`account2_len: i32,`<br/>&emsp;`currency_ptr: i32,`<br/>&emsp;`currency_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a trustline’s keylet from its pieces. | 350 |
172+
| `mpt_issuance_keylet(`<br/>&emsp;`issuer_ptr: i32,`<br/>&emsp;`issuer_len: i32,`<br/>&emsp;`sequence_ptr: i32,`<br/>&emsp;`sequence_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `MPTIssuance`’s keylet from its pieces. | 350 |
173+
| `mptoken_keylet(`<br/>&emsp;`mptid_ptr: i32,`<br/>&emsp;`mptid_len: i32,`<br/>&emsp;`holder_ptr: i32,`<br/>&emsp;`holder_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `MPToken`’s keylet from its pieces. | 350 |
174+
| `nft_offer_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence_ptr: i32,`<br/>&emsp;`sequence_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `NFTOffer`'s keylet from its pieces. | 350 |
175+
| `offer_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence_ptr: i32,`<br/>&emsp;`sequence_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `Offer`'s keylet from its pieces. | 350 |
176+
| `oracle_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`document_id_ptr: i32,`<br/>&emsp;`document_id_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate an `Oracle`'s keylet from its pieces. | 350 |
177+
| `paychan_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`destination_ptr: i32,`<br/>&emsp;`destination_len: i32,`<br/>&emsp;`sequence_ptr: i32,`<br/>&emsp;`sequence_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `PayChannel`’s keylet from its pieces. | 350 |
178+
| `permissioned_domain_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence_ptr: i32,`<br/>&emsp;`sequence_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `PermissionedDomain`’s keylet from its pieces. | 350 |
179+
| `signers_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `SignerListSet`'s keylet from its pieces. | 350 |
180+
| `ticket_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence_ptr: i32,`<br/>&emsp;`sequence_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `Ticket`'s keylet from its pieces. | 350 |
181+
| `vault_keylet(`<br/>&emsp;`account_ptr: i32,`<br/>&emsp;`account_len: i32,`<br/>&emsp;`sequence_ptr: i32,`<br/>&emsp;`sequence_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Calculate a `Vault`’s keylet from its pieces. | 350 |
181182

182183
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.
183184

@@ -219,8 +220,8 @@ Helper functions for working with rippled-encoded floats (e.g. IOU amounts).
219220
| `float_subtract(`<br/>&emsp;`in_buf1: i32,`<br/>&emsp;`in_len1: i32,`<br/>&emsp;`in_buf2: i32,`<br/>&emsp;`in_len2: i32,`<br/>&emsp;`out_buf: i32,`<br/>&emsp;`out_len: i32,`<br/>&emsp;`rounding_modes: i32`<br />`)` | Subtract two floats in rippled format. | 1000 |
220221
| `float_multiply(`<br/>&emsp;`in_buf1: i32,`<br/>&emsp;`in_len1: i32,`<br/>&emsp;`in_buf2: i32,`<br/>&emsp;`in_len2: i32,`<br/>&emsp;`out_buf: i32,`<br/>&emsp;`out_len: i32,`<br/>&emsp;`rounding_modes: i32`<br />`)` | Multiply two floats in rippled format. | 1000 |
221222
| `float_divide(`<br/>&emsp;`in_buf1: i32,`<br/>&emsp;`in_len1: i32,`<br/>&emsp;`in_buf2: i32,`<br/>&emsp;`in_len2: i32,`<br/>&emsp;`out_buf: i32,`<br/>&emsp;`out_len: i32,`<br/>&emsp;`rounding_modes: i32`<br />`)` | Divide two floats in rippled format. | 1000 |
222-
| `float_pow(`<br/>&emsp;`in_buf: i32,`<br/>&emsp;`in_len: i32,`<br/>&emsp;`n: i32,`<br/>&emsp;`out_buf: i32,`<br/>&emsp;`out_len: i32,`<br/>&emsp;`rounding_modes: i32`<br />`)` | Compute the nth power of a float in rippled format. | 1000 |
223-
| `float_root(`<br/>&emsp;`in_buf: i32,`<br/>&emsp;`in_len: i32,`<br/>&emsp;`n: i32,`<br/>&emsp;`out_buf: i32,`<br/>&emsp;`out_len: i32,`<br/>&emsp;`rounding_modes: i32`<br />`)` | Compute the nth root of a float in rippled format. | 1000 |
223+
| `float_pow(`<br/>&emsp;`in_buf: i32,`<br/>&emsp;`in_len: i32,`<br/>&emsp;`pow: i32,`<br/>&emsp;`out_buf: i32,`<br/>&emsp;`out_len: i32,`<br/>&emsp;`rounding_modes: i32`<br />`)` | Compute the nth power of a float in rippled format. | 1000 |
224+
| `float_root(`<br/>&emsp;`in_buf: i32,`<br/>&emsp;`in_len: i32,`<br/>&emsp;`root: i32,`<br/>&emsp;`out_buf: i32,`<br/>&emsp;`out_len: i32,`<br/>&emsp;`rounding_modes: i32`<br />`)` | Compute the nth root of a float in rippled format. | 1000 |
224225
| `float_log(`<br/>&emsp;`in_buf: i32,`<br/>&emsp;`in_len: i32,`<br/>&emsp;`out_buf: i32,`<br/>&emsp;`out_len: i32,`<br/>&emsp;`rounding_modes: i32`<br />`)` | Compute the 10 based log of a float in rippled format. | 1000 |
225226

226227
### 5.9. Trace

0 commit comments

Comments
 (0)