Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
d859d52
add sfield constants and mock_data
pwang200 Apr 28, 2025
ad1d32a
add DataSource and Locator
pwang200 May 13, 2025
e1a12c9
WIP: updated host_lib, locator, and mock_data
pwang200 May 14, 2025
a3a0787
WIP: updated host_lib to use *u8 as pointer and usize as len
pwang200 May 14, 2025
495186d
WIP: created some host functions
pwang200 May 14, 2025
696c898
WIP: created some more host functions
pwang200 May 14, 2025
e636796
WIP: created even more host functions
pwang200 May 15, 2025
45cefeb
refactored main and vm
pwang200 May 15, 2025
ac2db07
add decoding.rs, hashing.rs, and data_provider.rs
pwang200 May 16, 2025
d6b0436
some basic tests done
pwang200 May 16, 2025
ca4f221
added devent 3 host functions, mock data from json decoded to binary
pwang200 May 19, 2025
1008a22
Add trace function
sappenin May 19, 2025
c69ebd0
Merge branch 'devnet3' of github.com:ripple/craft into df/host-func-a…
sappenin May 19, 2025
e2dc6bf
Update wasm-host/src/vm.rs
sappenin May 20, 2025
a2d44aa
Update wasm-host/src/vm.rs
sappenin May 20, 2025
6391f78
added devnet 3 host functions, mock data from json decoded to binary
pwang200 May 19, 2025
4d6a67d
rename function from `ready` to `finish` (#17)
mvadari May 20, 2025
7d1ce28
Merge branch 'devnet3' of github.com:ripple/craft into df/host-func-a…
sappenin May 20, 2025
d017cba
Update formatting
sappenin May 20, 2025
2bea9fc
added devnet 3 host functions, mock data from json decoded to binary
pwang200 May 19, 2025
ef706cc
rename function from `ready` to `finish` (#17)
mvadari May 20, 2025
49f9fff
added get_NFT and get_tx_field2~6
pwang200 May 20, 2025
35499fb
Remove function inputs check
sappenin May 20, 2025
8969849
Update docs
sappenin May 20, 2025
7e08226
Merge branch 'devnet3' of github.com:ripple/craft into df/host-func-a…
sappenin May 20, 2025
cb4ccf5
Fix includes
sappenin May 20, 2025
181dbc9
Update function names per PR comment
sappenin May 20, 2025
a8f0b46
Update formatting to fix build
sappenin May 20, 2025
1c2700c
Fix formatting
sappenin May 20, 2025
101feda
Initial commit
sappenin May 21, 2025
f36b265
Add trace functions (#18)
sappenin May 21, 2025
cea3fdb
WIP
sappenin May 22, 2025
343c903
Merge branch 'devnet3' of github.com:ripple/craft into df/struct-types
sappenin May 22, 2025
6470589
Remove comment
sappenin May 22, 2025
5ea90c4
Devnet3 remove wee_alloc (fix #22) (#24)
intelliot May 22, 2025
93fab64
add return value to updata_data, add more error code, add docs (#27)
pwang200 May 22, 2025
e63eb8f
Add TODOs for Peng
sappenin May 22, 2025
3968556
rename ledger_entry_set to cache_ledger_obj (#29)
pwang200 May 23, 2025
b630216
Add examples for Memos and Signers
sappenin May 27, 2025
2ccdb4a
WASM host: support specifying function to run (#30)
intelliot May 27, 2025
5f40cc5
Add host function test framework with call recording
intelliot May 28, 2025
97a3ba4
add WASM testing with call recording
intelliot May 28, 2025
d40c320
remove hex clipboard copy
intelliot May 28, 2025
00234a6
Merge remote-tracking branch 'origin/df/struct-types' into test-frame…
intelliot May 28, 2025
973dd19
Add test for account balance retrieval
intelliot May 28, 2025
b69ab7a
Add host functions test
intelliot May 28, 2025
c8842eb
Merge remote-tracking branch 'origin/devnet3' into test-framework
intelliot May 28, 2025
6b24190
chore: remove explorer submodule for improved simplicity (#33)
mvadari May 29, 2025
52599bb
TransactionType, ComputationAllowance, Memos, and Signers work (#31)
pwang200 May 30, 2025
4ea094b
replace `ledger_slot_set` with `cache_ledger_obj`
intelliot May 30, 2025
72fb2cb
Update host functions tests for latest host_bindings
intelliot May 30, 2025
527567a
Add host function test fixtures and update tests given get_tx_fieldN …
intelliot May 30, 2025
5fecb19
finish function: take no parameter
intelliot May 30, 2025
c0a1be7
build command: support non-interactive
intelliot May 30, 2025
2b39faf
update DESIGN.md for `finish` function update to no parameters
intelliot May 30, 2025
1595fb8
Merge remote-tracking branch 'origin/main' into test-framework
intelliot May 30, 2025
7e25ce2
Update function call to use no parameters
intelliot May 30, 2025
8b96e73
Merge remote-tracking branch 'origin/devnet3' into el/struct-types-merge
intelliot May 30, 2025
78965dd
decoder improvements for devnet3 (#35)
pwang200 May 30, 2025
1b30dd0
Merge branch 'origin/devnet3' into test-framework
intelliot May 30, 2025
a8a5ec1
chore: update to latest JS beta, clean up (#36)
mvadari May 30, 2025
82d7139
Merge devnet3 into test-framework
intelliot May 30, 2025
cdeb3fc
Add comprehensive tests for host functions
intelliot May 31, 2025
a1a2283
remove deprecated transaction field access functions
intelliot May 31, 2025
1b42785
Merge pull request #37 from ripple/el/struct-types-merge
intelliot Jun 2, 2025
da53a28
Merge remote-tracking branch 'origin/df/struct-types' into test-frame…
intelliot Jun 2, 2025
86c6921
Add AS_IS variant to Decodable enum
intelliot Jun 2, 2025
d4198d1
Applied cargo fmt --all
intelliot Jun 2, 2025
ba17fc7
Merge remote-tracking branch 'origin/main' into test-framework
intelliot Jun 6, 2025
cc11ccc
git merge origin/main
intelliot Jun 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 31 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 10 additions & 19 deletions DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,36 +44,27 @@ pub extern fn allocate(size: usize) -> *mut u8 {
}
```

##### `finish(tx_json_ptr: *mut u8, tx_json_size: usize, lo_json_ptr: *mut u8, lo_json_size: usize) -> bool`
##### `finish() -> bool`

This function evaluates whether an escrow can be finished based on the transaction and ledger object data provided.

Parameters:
- `tx_json_ptr`: Pointer to the JSON data of the EscrowFinish transaction
- `tx_json_size`: Size in bytes of the transaction JSON data
- `lo_json_ptr`: Pointer to the JSON data of the Escrow ledger object
- `lo_json_size`: Size in bytes of the ledger object JSON data
This function evaluates whether an escrow can be finished based on the current transaction and ledger state. The function uses host functions to access transaction data and ledger objects rather than receiving them as parameters.

Returns a boolean indicating whether the escrow can be finished.

#### Execution Flow

1. The host environment calls `allocate` to request memory for transaction data.
2. The host writes transaction JSON data to the allocated memory.
3. The host calls `allocate` again to request memory for ledger object data.
4. The host writes ledger object JSON data to the allocated memory.
5. The host calls `finish` with the memory pointers and sizes.
6. The `finish` function processes the data and returns a boolean result.
1. The host environment loads the WASM module and calls the `finish` function.
2. The `finish` function uses host functions to access transaction data and ledger objects.
3. The function evaluates the escrow condition logic and returns a boolean result.

### 3.2. Memory Management

The WebAssembly module manages memory explicitly through the `allocate` function, which allows the host to request memory regions where it can write data. This pattern provides:
The WebAssembly module manages memory explicitly through the `allocate` function for internal operations. Data exchange with the host occurs through host functions rather than direct memory sharing:

- **Safe data exchange**: Complex data structures like JSON can be safely passed between the host and WebAssembly module.
- **Memory control**: The WebAssembly module maintains control over its own memory.
- **Explicit ownership**: Memory allocation and access patterns are clearly defined for both the host and the module.
- **Host function interface**: Transaction and ledger data is accessed via standardized host functions.
- **Memory isolation**: The WebAssembly module maintains control over its own memory space.
- **Deterministic access**: Host functions provide consistent, validated data access patterns.

Since WebAssembly modules have their own linear memory, this explicit allocation mechanism creates a standard protocol for hosts to interact with the module's memory space.
This approach ensures secure and predictable data exchange between the host environment and WebAssembly modules.

## 4. Restrictions and Limitations

Expand Down
Empty file modified build.sh
100644 → 100755
Empty file.
23 changes: 23 additions & 0 deletions projects/host_functions_test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions projects/host_functions_test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[workspace]

[package]
name = "host_functions_test"
version = "0.1.0"
edition = "2024"

[lib]
crate-type = ["cdylib"]

[dependencies]
xrpl-std = { path = "../../xrpl-std" }

[profile.release]
opt-level = "z"
lto = true
codegen-units = 1
panic = "abort"
Loading
Loading