Skip to content

Add new float host functions and versioning rules#504

Open
sappenin wants to merge 40 commits into
masterfrom
df/update-host-functions
Open

Add new float host functions and versioning rules#504
sappenin wants to merge 40 commits into
masterfrom
df/update-host-functions

Conversation

@sappenin

Copy link
Copy Markdown
Collaborator
  • Updated §5.8 (Floats) preamble to describe OpaqueFloat as a general-purpose 12-byte buffer (4-byte exponent + 8-byte mantissa), document the rounding_modes values, and drop the IOU-specific framing
  • Added six new host functions to §5.8 (all at 1000 gas, consistent with existing float operations)
  • Added §5.11 Host Function Versioning Rules, covering the immutability of deployed host functions and the requirement to introduce new function names if buffer layouts change

- Updated §5.8 (Floats) preamble to describe OpaqueFloat as a general-purpose 12-byte buffer (4-byte exponent + 8-byte mantissa), document the rounding_modes values, and drop the IOU-specific framing
- Added six new host functions to §5.8 (all at 1000 gas, consistent with existing float operations)
- Added §5.11 Host Function Versioning Rules, covering the immutability of deployed host functions and the requirement to introduce new function names if buffer layouts change

Signed-off-by: David Fuelling <sappenin@gmail.com>
@sappenin sappenin requested a review from mvadari March 23, 2026 23:54
Signed-off-by: David Fuelling <sappenin@gmail.com>
Comment thread XLS-0102-wasm-vm/README.md
Comment thread XLS-0102-wasm-vm/README.md
Comment thread XLS-0102-wasm-vm/README.md Outdated
@pwang200

Copy link
Copy Markdown
Contributor

Because a smart escrow should store the mantissa and exponent as separate integers in a contract-defined format if the smart escrow needs to persist the opaque float in the ledger. It needs a way to get the mantissa and exponent, through a new host function:

float_to_mantissa_and_exponent(
 opaque_float_in_buf: i32,
 opaque_float_in_len: i32,
 mantissa_out_buf: i32,
 mantissa_out_len: i32,
 exponent_out_buf: i32,
 exponent_out_len: i32,
)

Does it need a rounding mode? Not, right?

Signed-off-by: David Fuelling <sappenin@gmail.com>
Signed-off-by: David Fuelling <sappenin@gmail.com>
Comment thread XLS-0102-wasm-vm/README.md
Comment thread XLS-0102-wasm-vm/README.md Outdated
Signed-off-by: David Fuelling <sappenin@gmail.com>
@sappenin

Copy link
Copy Markdown
Collaborator Author

@pwang200 I addressed your comment above via e56c1b9

Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
Signed-off-by: David Fuelling <sappenin@gmail.com>
Signed-off-by: David Fuelling <sappenin@gmail.com>
Signed-off-by: David Fuelling <sappenin@gmail.com>
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
@sappenin

Copy link
Copy Markdown
Collaborator Author

@pwang200 said:

Does it need a rounding mode? Not, right?

We decided that we don't, because the float is already rounded.

Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
Remove specific byte layout
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
Fix byte ordering.
@sappenin sappenin requested a review from oleks-rip June 23, 2026 17:14
Comment thread XLS-0102-wasm-vm/README.md
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
Comment thread XLS-0102-wasm-vm/README.md Outdated
sappenin added 2 commits June 23, 2026 13:07
Signed-off-by: David Fuelling <sappenin@gmail.com>
@sappenin sappenin requested review from oleks-rip and pwang200 June 23, 2026 22:08
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
Comment thread XLS-0102-wasm-vm/README.md Outdated
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.

6 participants