Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dan): invocation of functions in templates (#4343)
Description --- * New template test that simulates a component with state, a constructor and get/set methods * For now we don't perform real calls to handle state and constructor calls as we don't have those implemented yet * Renamed existing template test to a more proper "hello world" name * Refactor of all template wasm compilation/execution/test into reusable functions, as much as possible without macros: * Template test initialization and invocation * Generation of template ABI code * Generation of template wasm code, allowing for multiple functions with different signatures Motivation and Context --- One of the next steps in template wasm compilation and execution is the implementation of a more complex example with multiple functions. We also want to refactor as much as possible all common code between examples How Has This Been Tested? --- The new units test for the templates pass
- Loading branch information
Showing
10 changed files
with
710 additions
and
62 deletions.
There are no files selected for viewing
18 changes: 9 additions & 9 deletions
18
...yer/engine/tests/test_template/Cargo.lock → dan_layer/engine/tests/common/Cargo.lock
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...yer/engine/tests/test_template/Cargo.toml → dan_layer/engine/tests/common/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[workspace] | ||
[package] | ||
name = "test_template" | ||
name = "common" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[workspace] | ||
[package] | ||
name = "hello_world" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
tari_template_abi = { path = "../../../template_abi" } | ||
common = { path = "../common" } | ||
|
||
[profile.release] | ||
opt-level = 's' # Optimize for size. | ||
lto = true # Enable Link Time Optimization. | ||
codegen-units = 1 # Reduce number of codegen units to increase optimizations. | ||
panic = 'abort' # Abort on panic. | ||
strip = "debuginfo" # Strip debug info. | ||
|
||
[lib] | ||
crate-type = ["cdylib", "lib"] |
Oops, something went wrong.