Conversation
There was a problem hiding this comment.
Pull request overview
Updates the XLS-0102 WASM VM specification to reflect a proposed host function renaming scheme (shorter function names and “keylet” → “index” terminology) across the documented host API surface.
Changes:
- Renames ledger header/amendment/fee host functions (e.g.,
get_ledger_sqn→ldgr_index,get_base_fee→base_fee). - Renames field-access host functions to the new “_inner” / “entry*” naming scheme and updates the “Keylets” section to “Indexes”.
- Renames several utility/trace/float host functions (e.g.,
compute_sha512_half→sha512_half,float_compare→float_cmp,trace_opaque_float→trace_xfloat).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| | `tx_field(`<br/> `field: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Get a top-level field from the transaction that triggered the extension. | 70 | | ||
| | `tx_inner(`<br/> `locator_ptr: i32,`<br/> `locator_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Get an inner field from the transaction that triggered the extension. | 110 | | ||
| | `tx_array_len(`<br/> `field: i32`<br />`)` | Get the length of an array field from the transaction that triggered the extension. | 40 | | ||
| | `tx_inner_array_len(`<br/> `locator_ptr: i32,`<br/> `locator_len: i32`<br />`)` | Get the length of an inner array field on the ledger object that the extension is on. | 70 | |
There was a problem hiding this comment.
The description for tx_inner_array_len still says it returns the length of an array field on the ledger object that the extension is on, but this section is about the current transaction. Please update the description to reference the transaction that triggered the extension (consistent with the other tx_* entries).
| | `tx_inner_array_len(`<br/> `locator_ptr: i32,`<br/> `locator_len: i32`<br />`)` | Get the length of an inner array field on the ledger object that the extension is on. | 70 | | |
| | `tx_inner_array_len(`<br/> `locator_ptr: i32,`<br/> `locator_len: i32`<br />`)` | Get the length of an inner array field from the transaction that triggered the extension. | 70 | |
| _(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 proce`ss ensures that all nodes and validators have the code before it is run. |
There was a problem hiding this comment.
There is a typo in this sentence: "proce`ss" includes an extraneous backtick and should be "process".
| This ensures that smart escrows cannot use the `loan_index` 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. |
| | :--------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------ | :------- | | ||
| | `curr_ldgr_entry_field(`<br/> `field: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Get a top-level field from the ledger object that the extension is on. | 70 | | ||
| | `curr_ldgr_entry_inner(`<br/> `locator_ptr: i32,`<br/> `locator_len: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Get an inner field from the ledger object that the extension is on. | 110 | | ||
| | `curr_ldgr_entry_array_len(`<br/> `field: i32`<br />`)` | Get the length of an array field on the ledger object that the extension is on. | 40 | |
There was a problem hiding this comment.
| | `curr_ldgr_entry_array_len(`<br/> `field: i32`<br />`)` | Get the length of an array field on the ledger object that the extension is on. | 40 | | |
| | `curr_ldgr_entry_arr_len(`<br/> `field: i32`<br />`)` | Get the length of an array field on the ledger object that the extension is on. | 40 | |
| | `get_base_fee(`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Get the current transaction base fee. | 60 | | ||
| | Function Signature | Description | Gas Cost | | ||
| | :------------------------------------------------------------------------------------------- | :------------------------------------------------ | :------- | | ||
| | `ldgr_index(`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Get the sequence number of the last ledger. | 60 | |
| | `get_current_ledger_obj_nested_array_len(`<br/> `locator_ptr: i32,`<br/> `locator_len: i32`<br />`)` | Get the length of a nested array field on the ledger object that the extension is on. | 70 | | ||
| | Function Signature | Description | Gas Cost | | ||
| | :--------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------ | :------- | | ||
| | `curr_ldgr_entry_field(`<br/> `field: i32,`<br/> `out_buff_ptr: i32,`<br/> `out_buff_len: i32`<br />`)` | Get a top-level field from the ledger object that the extension is on. | 70 | |
There was a problem hiding this comment.
tentatively: ledger_entry -> le
High Level Overview of Change
Context of Change
Type of Change