polkavm
polkavm copied to clipboard
add polkatool jam-service support
This WIP PR sets up:
- a Rust-based JAM service (named "jam-service-fib") with refine/accumulate/on_transfer/is_authorized entrypoints, use the polka_import macros for import/export/write.
- The
refine
(entry point 5) imports a 12-byte segment with [n, fib(n), f(n-1)] and exports the next segment in the same way [n+1, fib(n+1), fib(n)]. - The
accumulate
(entry point 10) reads a 12-byte segment and writes to service storage key "0" - The
is_authorized
(entry point 0) andon_transfer
(entry point 15) are just stubs right now
-
polkatool jam_service [binary]
to run @koute recommended code/approach to be "JAM-ready". By "JAM-ready" we mean having the "0/5/10/15" entry points for is_authorized/refine/accumulate/transfer.
Rather than hand assemble PVM byte code like this using @koute's assembler we would much rather use Rust. The sample code includes a first attempt to get at 23 functions from GP Appendix B and teases a few others.