Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a prepend header feature to polkatool #190

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

clw8998
Copy link

@clw8998 clw8998 commented Oct 12, 2024

This PR is based on PR76 and it is now possible to use polkatool to generate JAM-ready toplevel service blobs (as defined in equation 258 in A.7 of GP v0.4.1).

sourabhniyogi added a commit to jam-duna/jamtestnet that referenced this pull request Nov 7, 2024
1. safrole - traces: RAW kv state + state_snapshots: dev-friendly C1-C15 state

To support JAM implementers to derive each others state roots, extending to service related storage keys, here we publish a keyvals state trace format with a full range of 0x00..00 to 0xFF..FF in `traces` while leaving developer-friendly `state_snapshots` that focus on the C1-C15.  With both state dumps, we can have teams collaborate:
* deriving the stateroot from key-value pair combinations (which match the blocks parent state root) in `traces`
* making sure values in `traces` correspond to the JAM codec encoding of the data in `state_snapshots`

2. Implementation of bootstrap service code

* `main.rs` contains an implementation of the above bootstrap service, which is included in the [genesis state](../../../traces/safrole/genesis.json)
   - The `refine` service expects a `codehash` (32 bytes) starting at `0xFEFF0004`
   - The `accumulate` does a `new` and then a `write`
* `bootstrapblob.pvm` has the disassembleable code (see below `polkatool`) with "magic bytes"
* `bootstrap.pvm` has the JAM-ready code blob (no magic bytes).  We used `polkatool` to do this, with [PR #190](paritytech/polkavm#190) actually mapping `main.rs` into the above.  See links: [Building
 JAM Services in Rust](https://forum.polkadot.network/t/building-jam-services-in-rust/10161) for background


Our test does the following:
* submits a few service code blobs (fib, trib, megatron) in 3 work packages using the bootstrap service "0"
* for each work package, we retrieve the new service indexes left by the `write` after "rho" is cleared (the service has been accumulated)
* our test then runs work packages through fib + trib.  Our next goal is to do ordered accumulation with queues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant