polkavm icon indicating copy to clipboard operation
polkavm copied to clipboard

add polkatool jam-service support

Open sourabhniyogi opened this issue 5 months ago • 1 comments

This WIP PR sets up:

  1. 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.
  • Therefine (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) and on_transfer (entry point 15) are just stubs right now
  1. 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.

sourabhniyogi avatar Sep 24 '24 21:09 sourabhniyogi