feat(perch-plan-cli): compile a PolicyDoc to deployable InstallParams XDR - #31
Open
willemneal wants to merge 1 commit into
Open
feat(perch-plan-cli): compile a PolicyDoc to deployable InstallParams XDR#31willemneal wants to merge 1 commit into
willemneal wants to merge 1 commit into
Conversation
… XDR Rust→client bridge for testnet wiring: `perch-plan <doc.json> <interpreter_wasm_hash>` compiles a PolicyDoc and prints each rule's InstallParams as ScVal XDR (hex) — the exact bytes an off-chain applier drops into a Nido account's `policies: Map<Address, Val>` against the deployed interpreter. The RPN lowering is Rust-only and needs a native Env, so this is how TS/browser tooling obtains a byte-identical program (a UI showing a policy and the chain enforcing it agree on doc_hash + program bytes by construction). Seed of the future in-browser wasm compiler (v2). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
perch-plan, a small Rust bin that compiles aPolicyDocand prints eachrule's
InstallParamsas ScVal XDR (hex) — the exact bytes an off-chainapplier drops into a Nido/OZ smart account's
policies: Map<Address, Val>against the deployed interpreter.
Why
The RPN lowering (
perch_compile) is Rust-only and needs a nativeEnv(a
wasm32-unknown-unknownbuild is refused by soroban-sdk's build.rs). This CLIis the Rust→client bridge for on-chain wiring: TS/browser tooling gets a
byte-identical program, so a UI showing a policy and the chain enforcing it
agree on
doc_hash+ program bytes by construction. It's also the seed of thein-browser wasm compiler (v2).
Proven on-chain
Used to install a real perch policy on Stellar testnet and prove enforcement
end-to-end (via nido's new
perch-status-onchainexample): the interpreter(
CBO4FIGR2LP242IKWDME6NPFGCFAT5R7CSLKYLOOJFVXCCIGKVF6O44G) allowspostanddenies
clearfor the same key — the first time perch runs against a realnetwork's auth framework.
just checkpasses.🤖 Generated with Claude Code