WASM/PVM: enable `write_debug` alternative implementation if necessary
Context
For kernel debugging (in the REPL or nodes directly), there exists a write_debug alternative implementation that prints the value in the standard ouput. This MR does two things:
- adds an alternative host function registry
- adds an alternative version of the
compute_step(s) functions that are aware of these debug host functions
Manually testing the MR
This MR can be tested with the REPL directly, since the debug is activated. You can try this simple kernel:
(module
(import "smart_rollup_core" "write_debug"
(func $write_debug (param i32 i32)))
;; Durable keys
(data (i32.const 100) "hello")
(memory 1)
(export "mem" (memory 0))
(func (export "kernel_run")
(local $hello_address i32)
(local $hello_length i32)
(local.set $hello_address (i32.const 100))
(local.set $hello_length (i32.const 5))
(call $write_debug (local.get $hello_address) (local.get $hello_length))
(nop)
)
)
with the following input.json: [[]]
dune exec src/proto_alpha/bin_wasm_repl/main_wasm_repl_alpha.exe -- ../wast-kernel/write_debug.wast --inputs ../wast-kernel/inputs.json
> load inputs
Loaded 2 inputs at level 0
> step inbox
DEBUG: hello
Evaluation took 11000000000 ticks so far
Status: Waiting for input
Internal_status: Collect
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR