diff --git a/XLS-0102-wasm-vm/README.md b/XLS-0102-wasm-vm/README.md
index 65db3573..c262b94d 100644
--- a/XLS-0102-wasm-vm/README.md
+++ b/XLS-0102-wasm-vm/README.md
@@ -115,81 +115,81 @@ Note: all these functions return an `i32`, unless otherwise noted (or there is n
This section includes ledger header data, amendments, and fees.
-| Function Signature | Description | Gas Cost |
-| :---------------------------------------------------------------------------------------------- | :------------------------------------------------ | :------- |
-| `get_ledger_sqn(`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get the sequence number of the last ledger. | 60 |
-| `get_parent_ledger_time(`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get the time (in Ripple Time) of the last ledger. | 60 |
-| `get_parent_ledger_hash(`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get the hash of the last ledger. | 60 |
-| `amendment_enabled(`
`amendment_ptr: i32,`
`amendment_len: i32`
`)` | Check if a given amendment is enabled. | 100 |
-| `get_base_fee(`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get the current transaction base fee. | 60 |
+| Function Signature | Description | Gas Cost |
+| :------------------------------------------------------------------------------------------- | :------------------------------------------------ | :------- |
+| `ldgr_index(`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get the index number of the last ledger. | 60 |
+| `parent_ldgr_time(`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get the time (in Ripple Time) of the last ledger. | 60 |
+| `parent_ldgr_hash(`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get the hash of the last ledger. | 60 |
+| `amendment_enabled(`
`amendment_ptr: i32,`
`amendment_len: i32`
`)` | Check if a given amendment is enabled. | 100 |
+| `base_fee(`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get the current transaction base fee. | 60 |
### 5.2. Current Ledger Object data
The current ledger object is the ledger object that the extension lives on - for Smart Escrows that's an `Escrow` object.
-| Function Signature | Description | Gas Cost |
-| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------ | :------- |
-| `get_current_ledger_obj_field(`
`field: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get a top-level field from the ledger object that the extension is on. | 70 |
-| `get_current_ledger_obj_nested_field(`
`locator_ptr: i32,`
`locator_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get a nested field from the ledger object that the extension is on. | 110 |
-| `get_current_ledger_obj_array_len(`
`field: i32`
`)` | Get the length of an array field on the ledger object that the extension is on. | 40 |
-| `get_current_ledger_obj_nested_array_len(`
`locator_ptr: i32,`
`locator_len: i32`
`)` | Get the length of a nested array field on the ledger object that the extension is on. | 70 |
+| Function Signature | Description | Gas Cost |
+| :------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------ | :------- |
+| `home_le_field(`
`field: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get a top-level field from the ledger object that the extension is on. | 70 |
+| `home_le_inner(`
`locator_ptr: i32,`
`locator_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get an inner field from the ledger object that the extension is on. | 110 |
+| `home_le_arr_len(`
`field: i32`
`)` | Get the length of an array field on the ledger object that the extension is on. | 40 |
+| `home_le_inner_arr_len(`
`locator_ptr: i32,`
`locator_len: i32`
`)` | Get the length of an inner array field on the ledger object that the extension is on. | 70 |
#### 5.2.1. Locators
-A Locator allows a WASM developer to reference any field in any object (even nested fields) by specifying a `slot_num` (1 byte); a `locator_field_type` (1 byte); then one of an `sfield` (4 bytes) or an `index` (4 bytes).
+A Locator allows a WASM developer to reference any field in any object (even inner fields) by specifying a `slot_num` (1 byte); a `locator_field_type` (1 byte); then one of an `sfield` (4 bytes) or an `index` (4 bytes).
### 5.3. Current Transaction Data
The current transaction is the `EscrowFinish` that is executing the WASM logic
-| Function Signature | Description | Gas Cost |
-| :------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------ | :------- |
-| `get_tx_field(`
`field: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get a top-level field from the transaction that triggered the extension. | 70 |
-| `get_tx_nested_field(`
`locator_ptr: i32,`
`locator_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get a nested field from the transaction that triggered the extension. | 110 |
-| `get_tx_array_len(`
`field: i32`
`)` | Get the length of an array field from the transaction that triggered the extension. | 40 |
-| `get_tx_nested_array_len(`
`locator_ptr: i32,`
`locator_len: i32`
`)` | Get the length of a nested array field on the ledger object that the extension is on. | 70 |
+| Function Signature | Description | Gas Cost |
+| :-------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------- | :------- |
+| `tx_field(`
`field: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get a top-level field from the transaction that triggered the extension. | 70 |
+| `tx_inner(`
`locator_ptr: i32,`
`locator_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get an inner field from the transaction that triggered the extension. | 110 |
+| `tx_arr_len(`
`field: i32`
`)` | Get the length of an array field from the transaction that triggered the extension. | 40 |
+| `tx_inner_arr_len(`
`locator_ptr: i32,`
`locator_len: i32`
`)` | Get the length of an inner array field from the transaction that triggered the extension. | 70 |
### 5.4. Any Ledger Object Data
Fetch data from any other ledger object
-| Function Signature | Description | Gas Cost |
-| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------- | :------- |
-| `cache_ledger_obj(`
`keylet_ptr: i32,`
`keylet_len: i32,`
`cache_num: i32`
`)` | Cache a ledger object so that it can be used later. | 5000 |
-| `get_ledger_obj_field(`
`cache_num: i32,`
`field: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get a top-level field from any ledger object. | 70 |
-| `get_ledger_obj_nested_field(`
`cache_num: i32,`
`locator_ptr: i32,`
`locator_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get a nested field from any ledger object. | 110 |
-| `get_ledger_obj_array_len(`
`cache_num: i32,`
`field: i32`
`)` | Get the length of an array field from any ledger object. | 40 |
-| `get_ledger_obj_nested_array_len(`
`cache_num: i32,`
`locator_ptr: i32,`
`locator_len: i32`
`)` | Get the length of a nested array field from any ledger object. | 70 |
-
-### 5.5. Keylets
-
-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`.
-
-| Function Signature | Description | Gas Cost |
-| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------- | :------- |
-| `account_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `AccountRoot`'s keylet from its pieces. | 350 |
-| `amm_keylet(`
`issue1_ptr: i32,`
`issue1_len: i32,`
`issue2_ptr: i32,`
`issue2_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `AMM`’s keylet from its pieces. | 450 |
-| `check_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `Check`'s keylet from its pieces. | 350 |
-| `credential_keylet(`
`subject_ptr: i32,`
`subject_len: i32,`
`issuer_ptr: i32,`
`issuer_len: i32,`
`cred_type_ptr: i32,`
`cred_type_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `Credential`'s keylet from its pieces. | 350 |
-| `delegate_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`authorize_ptr: i32,`
`authorize_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `Delegate`'s keylet from its pieces. | 350 |
-| `deposit_preauth_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`authorize_ptr: i32,`
`authorize_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `DepositPreauth`'s keylet from its pieces. | 350 |
-| `did_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `DID`'s keylet from its pieces. | 350 |
-| `escrow_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `Escrow`'s keylet from its pieces. | 350 |
-| `line_keylet(`
`account1_ptr: i32,`
`account1_len: i32,`
`account2_ptr: i32,`
`account2_len: i32,`
`currency_ptr: i32,`
`currency_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a trustline’s keylet from its pieces. | 400 |
-| `mpt_issuance_keylet(`
`issuer_ptr: i32,`
`issuer_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `MPTIssuance`’s keylet from its pieces. | 350 |
-| `mptoken_keylet(`
`mptid_ptr: i32,`
`mptid_len: i32,`
`holder_ptr: i32,`
`holder_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `MPToken`’s keylet from its pieces. | 500 |
-| `nft_offer_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `NFTOffer`'s keylet from its pieces. | 350 |
-| `offer_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `Offer`'s keylet from its pieces. | 350 |
-| `oracle_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`document_id_ptr: i32,`
`document_id_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `Oracle`'s keylet from its pieces. | 350 |
-| `paychan_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`destination_ptr: i32,`
`destination_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `PayChannel`’s keylet from its pieces. | 350 |
-| `permissioned_domain_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `PermissionedDomain`’s keylet from its pieces. | 350 |
-| `signers_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `SignerListSet`'s keylet from its pieces. | 350 |
-| `ticket_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `Ticket`'s keylet from its pieces. | 350 |
-| `vault_keylet(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `Vault`’s keylet from its pieces. | 350 |
-
-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.
-
-The directory keylets and `NFTokenPage` were not included, since they are a bit more complex to parse through and it seemed unnecessary for now. These can always be added in the future.
+| Function Signature | Description | Gas Cost |
+| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------- | :------- |
+| `cache_le(`
`index_ptr: i32,`
`index_len: i32,`
`cache_num: i32`
`)` | Cache a ledger object so that it can be used later. | 5000 |
+| `le_field(`
`cache_num: i32,`
`field: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get a top-level field from any ledger object. | 70 |
+| `le_inner(`
`cache_num: i32,`
`locator_ptr: i32,`
`locator_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get an inner field from any ledger object. | 110 |
+| `le_arr_len(`
`cache_num: i32,`
`field: i32`
`)` | Get the length of an array field from any ledger object. | 40 |
+| `le_inner_arr_len(`
`cache_num: i32,`
`locator_ptr: i32,`
`locator_len: i32`
`)` | Get the length of an inner array field from any ledger object. | 70 |
+
+### 5.5. Ledger Entry IDs
+
+A ledger entry ID 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`.
+
+| Function Signature | Description | Gas Cost |
+| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------- | :------- |
+| `accountroot_id(`
`account_ptr: i32,`
`account_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `AccountRoot`'s index from its pieces. | 350 |
+| `amm_id(`
`issue1_ptr: i32,`
`issue1_len: i32,`
`issue2_ptr: i32,`
`issue2_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `AMM`’s index from its pieces. | 450 |
+| `check_id(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `Check`'s index from its pieces. | 350 |
+| `credential_id(`
`subject_ptr: i32,`
`subject_len: i32,`
`issuer_ptr: i32,`
`issuer_len: i32,`
`cred_type_ptr: i32,`
`cred_type_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `Credential`'s index from its pieces. | 350 |
+| `delegate_id(`
`account_ptr: i32,`
`account_len: i32,`
`authorize_ptr: i32,`
`authorize_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `Delegate`'s index from its pieces. | 350 |
+| `deposit_preauth_id(`
`account_ptr: i32,`
`account_len: i32,`
`authorize_ptr: i32,`
`authorize_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `DepositPreauth`'s index from its pieces. | 350 |
+| `did_id(`
`account_ptr: i32,`
`account_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `DID`'s index from its pieces. | 350 |
+| `escrow_id(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `Escrow`'s index from its pieces. | 350 |
+| `trustline_id(`
`account1_ptr: i32,`
`account1_len: i32,`
`account2_ptr: i32,`
`account2_len: i32,`
`currency_ptr: i32,`
`currency_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a trustline’s index from its pieces. | 400 |
+| `mpt_issuance_id(`
`issuer_ptr: i32,`
`issuer_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `MPTIssuance`’s index from its pieces. | 350 |
+| `mptoken_id(`
`mptid_ptr: i32,`
`mptid_len: i32,`
`holder_ptr: i32,`
`holder_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `MPToken`’s index from its pieces. | 500 |
+| `nft_offer_id(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `NFTOffer`'s index from its pieces. | 350 |
+| `offer_id(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `Offer`'s index from its pieces. | 350 |
+| `oracle_id(`
`account_ptr: i32,`
`account_len: i32,`
`document_id_ptr: i32,`
`document_id_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate an `Oracle`'s index from its pieces. | 350 |
+| `paychan_id(`
`account_ptr: i32,`
`account_len: i32,`
`destination_ptr: i32,`
`destination_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `PayChannel`’s index from its pieces. | 350 |
+| `permissioned_domain_id(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `PermissionedDomain`’s index from its pieces. | 350 |
+| `signers_id(`
`account_ptr: i32,`
`account_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `SignerListSet`'s index from its pieces. | 350 |
+| `ticket_id(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `Ticket`'s index from its pieces. | 350 |
+| `vault_id(`
`account_ptr: i32,`
`account_len: i32,`
`sequence_ptr: i32,`
`sequence_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate a `Vault`’s index from its pieces. | 350 |
+
+The singleton indexes (e.g. `Amendments`) are a bit unnecessary to include, as a dev can simply copy the index directly instead. They will be included as constants in `xrpl-wasm-stdlib` as well.
+
+The directory indexes and `NFTokenPage` were not included, since they are a bit more complex to parse through and it seemed unnecessary for now. These can always be added in the future.
### 5.6. NFTs
@@ -197,12 +197,12 @@ Fetch information about NFTs.
| Function Signature | Description | Gas Cost |
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------- | :------- |
-| `get_nft(`
`owner_ptr: i32,`
`owner_len: i32,`
`nft_id_ptr: i32,`
`nft_id_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get an NFT URI from its owner and ID. | 1000 |
-| `get_nft_issuer(`
`nft_id_ptr: i32,`
`nft_id_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Extract the NFT issuer from the NFT ID. | 70 |
-| `get_nft_taxon(`
`nft_id_ptr: i32,`
`nft_id_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Extract the NFT taxon from the NFT ID. | 60 |
-| `get_nft_flags(`
`nft_id_ptr: i32,`
`nft_id_len: i32`
`)` | Extract the NFT flags from the NFT ID. | 60 |
-| `get_nft_transfer_fee(`
`nft_id_ptr: i32,`
`nft_id_len: i32`
`)` | Extract the NFT transfer fee from the NFT ID. | 60 |
-| `get_nft_serial(`
`nft_id_ptr: i32,`
`nft_id_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Extract the NFT serial from the NFT ID. | 60 |
+| `nft_uri(`
`owner_ptr: i32,`
`owner_len: i32,`
`nft_id_ptr: i32,`
`nft_id_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Get an NFT URI from its owner and ID. | 1000 |
+| `nft_issuer(`
`nft_id_ptr: i32,`
`nft_id_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Extract the NFT issuer from the NFT ID. | 70 |
+| `nft_taxon(`
`nft_id_ptr: i32,`
`nft_id_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Extract the NFT taxon from the NFT ID. | 60 |
+| `nft_flags(`
`nft_id_ptr: i32,`
`nft_id_len: i32`
`)` | Extract the NFT flags from the NFT ID. | 60 |
+| `nft_xfer_fee(`
`nft_id_ptr: i32,`
`nft_id_len: i32`
`)` | Extract the NFT transfer fee from the NFT ID. | 60 |
+| `nft_serial(`
`nft_id_ptr: i32,`
`nft_id_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Extract the NFT serial from the NFT ID. | 60 |
### 5.7. Utils
@@ -211,25 +211,25 @@ Miscellaneous utility functions.
| Function Signature | Description | Gas Cost |
| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------- | :------- |
| `check_sig(`
`message_ptr: i32,`
`message_len: i32,`
`signature_ptr: i32,`
`signature_len: i32,`
`pubkey_ptr: i32,`
`pubkey_len: i32,`
`)` | Check the validity of a signature. Returns a `0` for invalid and `1` for valid. Supports both `ED25519` and `SECP256K1.` | 35000 |
-| `compute_sha512_half(`
`data_ptr: i32,`
`data_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate the `sha512` half hash of provided data. | 1500 |
+| `sha512_half(`
`data_ptr: i32,`
`data_len: i32,`
`out_buff_ptr: i32,`
`out_buff_len: i32`
`)` | Calculate the `sha512` half hash of provided data. | 1500 |
### 5.8. Floats
Helper functions for working with rippled-encoded floats (e.g. IOU amounts).
-| Function Signature | Description | Gas Cost |
-| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------- | :------- |
-| `float_from_int(`
`in_int: i64,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Create a float in rippled format from a 64-bit integer. | 100 |
-| `float_from_uint(`
`in_uint_ptr: i32,`
`in_uint_len: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Create a float in rippled format from a 64-bit unsigned integer. | 130 |
-| `float_set(`
`exponent: i32,`
`mantissa: i64,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Create a float in rippled format from an exponent and a mantissa. | 100 |
-| `float_compare(`
`in_buf1: i32,`
`in_len1: i32,`
`in_buf2: i32,`
`in_len2: i32`
`)` | Compare two floats in rippled format. | 80 |
-| `float_add(`
`in_buf1: i32,`
`in_len1: i32,`
`in_buf2: i32,`
`in_len2: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Add two floats in rippled format. | 160 |
-| `float_subtract(`
`in_buf1: i32,`
`in_len1: i32,`
`in_buf2: i32,`
`in_len2: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Subtract two floats in rippled format. | 160 |
-| `float_multiply(`
`in_buf1: i32,`
`in_len1: i32,`
`in_buf2: i32,`
`in_len2: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Multiply two floats in rippled format. | 300 |
-| `float_divide(`
`in_buf1: i32,`
`in_len1: i32,`
`in_buf2: i32,`
`in_len2: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Divide two floats in rippled format. | 300 |
-| `float_pow(`
`in_buf: i32,`
`in_len: i32,`
`pow: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Compute the nth power of a float in rippled format. | 5500 |
-| `float_root(`
`in_buf: i32,`
`in_len: i32,`
`root: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Compute the nth root of a float in rippled format. | 5500 |
-| `float_log(`
`in_buf: i32,`
`in_len: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Compute the 10 based log of a float in rippled format. | 12000 |
+| Function Signature | Description | Gas Cost |
+| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------- | :------- |
+| `float_from_int(`
`in_int: i64,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Create a float in rippled format from a 64-bit integer. | 100 |
+| `float_from_uint(`
`in_uint_ptr: i32,`
`in_uint_len: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Create a float in rippled format from a 64-bit unsigned integer. | 130 |
+| `float_set(`
`exponent: i32,`
`mantissa: i64,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Create a float in rippled format from an exponent and a mantissa. | 100 |
+| `float_cmp(`
`in_buf1: i32,`
`in_len1: i32,`
`in_buf2: i32,`
`in_len2: i32`
`)` | Compare two floats in rippled format. | 80 |
+| `float_add(`
`in_buf1: i32,`
`in_len1: i32,`
`in_buf2: i32,`
`in_len2: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Add two floats in rippled format. | 160 |
+| `float_sub(`
`in_buf1: i32,`
`in_len1: i32,`
`in_buf2: i32,`
`in_len2: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Subtract two floats in rippled format. | 160 |
+| `float_mult(`
`in_buf1: i32,`
`in_len1: i32,`
`in_buf2: i32,`
`in_len2: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Multiply two floats in rippled format. | 300 |
+| `float_div(`
`in_buf1: i32,`
`in_len1: i32,`
`in_buf2: i32,`
`in_len2: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Divide two floats in rippled format. | 300 |
+| `float_pow(`
`in_buf: i32,`
`in_len: i32,`
`pow: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Compute the nth power of a float in rippled format. | 5500 |
+| `float_root(`
`in_buf: i32,`
`in_len: i32,`
`root: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Compute the nth root of a float in rippled format. | 5500 |
+| `float_log(`
`in_buf: i32,`
`in_len: i32,`
`out_buf: i32,`
`out_len: i32,`
`rounding_modes: i32`
`)` | Compute the 10 based log of a float in rippled format. | 12000 |
### 5.9. Trace
@@ -237,13 +237,13 @@ Output debug info to the `rippled` debug log (if trace logging is enabled). The
Each of these host functions will return `0` on success and a negative value on failure.
-| Function Signature | Description | Gas Cost |
-| :------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------ | :------- |
-| `trace(`
`msg_ptr: i32,`
`msg_len: i32,`
`data_ptr: i32,`
`data_len: i32,`
`as_hex: i32`
`)` | A logging helper function. | 500 |
-| `trace_num(`
`msg_ptr: i32,`
`msg_len: i32,`
`number: i64`
`)` | A logging helper function for numbers. | 500 |
-| `trace_opaque_float(`
`msg_ptr: i32,`
`msg_len: i32,`
`opaque_float_ptr: i32,`
`opaque_float_len: i32`
`)` | A logging helper function for floats in rippled format. | 500 |
-| `trace_account(`
`msg_ptr: i32,`
`msg_len: i32,`
`account_ptr: i32,`
`account_len: i32`
`)` | A logging helper function for accounts. | 500 |
-| `trace_amount(`
`msg_ptr: i32,`
`msg_len: i32,`
`amount_ptr: i32,`
`amount_len: i32`
`)` | A logging helper function for amounts. | 500 |
+| Function Signature | Description | Gas Cost |
+| :-------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------ | :------- |
+| `trace(`
`msg_ptr: i32,`
`msg_len: i32,`
`data_ptr: i32,`
`data_len: i32,`
`as_hex: i32`
`)` | A logging helper function. | 500 |
+| `trace_num(`
`msg_ptr: i32,`
`msg_len: i32,`
`number: i64`
`)` | A logging helper function for numbers. | 500 |
+| `trace_xfloat(`
`msg_ptr: i32,`
`msg_len: i32,`
`xfloat_ptr: i32,`
`xfloat_len: i32`
`)` | A logging helper function for floats in rippled format. | 500 |
+| `trace_acct(`
`msg_ptr: i32,`
`msg_len: i32,`
`account_ptr: i32,`
`account_len: i32`
`)` | A logging helper function for accounts. | 500 |
+| `trace_amt(`
`msg_ptr: i32,`
`msg_len: i32,`
`amount_ptr: i32,`
`amount_len: i32`
`)` | A logging helper function for amounts. | 500 |
### 5.10. Updating Fields
@@ -251,9 +251,9 @@ Update on-chain data associated with the WASM code.
This section is the only section of functions that will likely be different for each Smart Feature. Each may have its own way of storing data.
-| Function Signature | Description | Gas Cost |
-| :--------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------ | :------- |
-| `update_data(`
`data_ptr: i32,`
`data_len: i32`
`)` | Update the `Data` field in the ledger object that hosts the WASM code, e.g. a Smart Escrow. | 1000 |
+| Function Signature | Description | Gas Cost |
+| :------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------ | :------- |
+| `set_data(`
`data_ptr: i32,`
`data_len: i32`
`)` | Update the `Data` field in the ledger object that hosts the WASM code, e.g. a Smart Escrow. | 1000 |
## 6. Security
@@ -281,7 +281,7 @@ User-provided WASM code is executed within a strict sandbox. It has no access to
A new WASM VM instance will be created for each WASM module execution. This ensures that there is no state that can be leaked between different executions, and that memory cannot be corrupted between runs.
-WASM code cannot directly traverse arbitrary ledger directories or iterate through global ledger state. All access must be via bounded, predefined inputs (e.g., keylets or account IDs passed into the subroutine). This design ensures that malicious WASM code cannot manipulate or exfiltrate ledger state beyond the narrow scope allowed by the host API.
+WASM code cannot directly traverse arbitrary ledger directories or iterate through global ledger state. All access must be via bounded, predefined inputs (e.g., indexes or account IDs passed into the subroutine). This design ensures that malicious WASM code cannot manipulate or exfiltrate ledger state beyond the narrow scope allowed by the host API.
### 6.4. Resource Limiting
@@ -298,15 +298,15 @@ All future changes to this spec (even just a simple change to the gas cost of a
For example, this is what it might look like to add a new host function:
```c
-WASM_IMPORT_FUNC2(i, didKeylet, "did_keylet", hfs, 350);
-WASM_IMPORT_FUNC2(i, escrowKeylet, "escrow_keylet", hfs, 350);
+WASM_IMPORT_FUNC2(i, didindex, "did_index", hfs, 350);
+WASM_IMPORT_FUNC2(i, escrowindex, "escrow_index", hfs, 350);
if (hfs->isAmendmentEnabled(featureLendingProtocol))
- WASM_IMPORT_FUNC2(i, loanKeylet, "loan_keylet", hfs, 350);
+ WASM_IMPORT_FUNC2(i, loanindex, "loan_index", hfs, 350);
```
_(in `WasmVM.cpp`)_
-This ensures that smart escrows cannot use the `loan_keylet` host function at all before the `LendingProtocol` amendment is activated, as the amendment proce`ss ensures that all nodes and validators have the code before it is run.
+This ensures that smart escrows cannot use the `loan_index` host function at all before the `LendingProtocol` amendment is activated, as the amendment process ensures that all nodes and validators have the code before it is run.
# Appendix