Skip to content

proposal: host function renames#531

Open
mvadari wants to merge 2 commits intomasterfrom
102-renames
Open

proposal: host function renames#531
mvadari wants to merge 2 commits intomasterfrom
102-renames

Conversation

@mvadari
Copy link
Copy Markdown
Collaborator

@mvadari mvadari commented Apr 28, 2026

High Level Overview of Change

Context of Change

Type of Change

  • New XLS Draft
  • XLS Update (changes to an existing XLS)
  • XLS Status Change (e.g., Draft → Final, Draft → Stagnant)
  • Process/Meta (changes to CONTRIBUTING.md, XLS-1, templates, etc.)
  • Infrastructure (CI, workflows, scripts, website)
  • Documentation (README updates, typo fixes)

Copilot AI review requested due to automatic review settings April 28, 2026 21:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_sqnldgr_index, get_base_feebase_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_halfsha512_half, float_comparefloat_cmp, trace_opaque_floattrace_xfloat).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread XLS-0102-wasm-vm/README.md Outdated
| `tx_field(`<br/>&emsp;`field: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Get a top-level field from the transaction that triggered the extension. | 70 |
| `tx_inner(`<br/>&emsp;`locator_ptr: i32,`<br/>&emsp;`locator_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Get an inner field from the transaction that triggered the extension. | 110 |
| `tx_array_len(`<br/>&emsp;`field: i32`<br />`)` | Get the length of an array field from the transaction that triggered the extension. | 40 |
| `tx_inner_array_len(`<br/>&emsp;`locator_ptr: i32,`<br/>&emsp;`locator_len: i32`<br />`)` | Get the length of an inner array field on the ledger object that the extension is on. | 70 |
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
| `tx_inner_array_len(`<br/>&emsp;`locator_ptr: i32,`<br/>&emsp;`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/>&emsp;`locator_ptr: i32,`<br/>&emsp;`locator_len: i32`<br />`)` | Get the length of an inner array field from the transaction that triggered the extension. | 70 |

Copilot uses AI. Check for mistakes.
_(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.
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo in this sentence: "proce`ss" includes an extraneous backtick and should be "process".

Suggested change
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.

Copilot uses AI. Check for mistakes.
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
| :--------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------ | :------- |
| `curr_ldgr_entry_field(`<br/>&emsp;`field: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`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/>&emsp;`locator_ptr: i32,`<br/>&emsp;`locator_len: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`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/>&emsp;`field: i32`<br />`)` | Get the length of an array field on the ledger object that the extension is on. | 40 |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `curr_ldgr_entry_array_len(`<br/>&emsp;`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/>&emsp;`field: i32`<br />`)` | Get the length of an array field on the ledger object that the extension is on. | 40 |

Comment thread XLS-0102-wasm-vm/README.md Outdated
| `get_base_fee(`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Get the current transaction base fee. | 60 |
| Function Signature | Description | Gas Cost |
| :------------------------------------------------------------------------------------------- | :------------------------------------------------ | :------- |
| `ldgr_index(`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Get the sequence number of the last ledger. | 60 |
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ldgr -> lgr

Comment thread XLS-0102-wasm-vm/README.md Outdated
| `get_current_ledger_obj_nested_array_len(`<br/>&emsp;`locator_ptr: i32,`<br/>&emsp;`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/>&emsp;`field: i32,`<br/>&emsp;`out_buff_ptr: i32,`<br/>&emsp;`out_buff_len: i32`<br />`)` | Get a top-level field from the ledger object that the extension is on. | 70 |
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tentatively: ledger_entry -> le

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants