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

safrole traces: RAW kv state + bootstrap service implementation #12

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

sourabhniyogi
Copy link
Contributor

@sourabhniyogi sourabhniyogi commented Nov 7, 2024

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

Implementation of bootstrap service code

  • main.rs contains an implementation of the above bootstrap service, which is included in the genesis state
    • 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 actually mapping main.rs into the above. See links: Building
    JAM Services in Rust
    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.

@sourabhniyogi sourabhniyogi changed the title safrole traces: RAW kv state; state_snapshots: dev-friendly equiv safrole traces: RAW kv state + bootstrap service implementation Nov 7, 2024
@sourabhniyogi sourabhniyogi merged commit 933f7f8 into main Nov 7, 2024
@sourabhniyogi sourabhniyogi deleted the kv branch November 7, 2024 19:34
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