Skip to content

docs(registry): document the keys_xdr encoding a manifest must use #5

Description

@0dillon

Summary

RegistryEntry.keys_xdr holds XDR-encoded ScVal ledger keys and is never decoded on-chain. The
repository documents that rule but never shows an adopter how to produce the values. Working them
out currently means writing a throwaway test that runs ScVal::try_from_val and to_xdr and
prints the hex — which is what produced the three constants in scripts/init_testnet.sh.

That is a real barrier to adoption: the first thing a new contract has to do is the one thing
nothing explains.

Acceptance Criteria

  • Documentation covers what each entry in keys_xdr is: the XDR of the ScVal form of a
    storage key, hex-encoded.
  • It shows the instance entry case (ScVal::LedgerKeyContractInstance, 00000014).
  • It shows a #[contracttype] unit enum variant case and explains why it encodes as
    ScVal::Vec([Symbol(name)]).
  • It shows a reproducible way to generate the hex for an arbitrary key.
  • The three constants in scripts/init_testnet.sh are cross-referenced as a worked example.
  • It restates that the manifest is advisory and can drift from the compiled macro keys.

Tech Stack

Rust (edition 2021, toolchain 1.93.0 pinned in rust-toolchain.toml), soroban-sdk 27.0.4,
target wasm32v1-none. Build with stellar contract build, never cargo build. Tests are
#[cfg(test)] modules on Env::default(); run them with cargo test --all.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions