Skip to content

feat(perch-plan-cli): compile a PolicyDoc to deployable InstallParams XDR - #31

Open
willemneal wants to merge 1 commit into
mainfrom
feat/testnet-deploy
Open

feat(perch-plan-cli): compile a PolicyDoc to deployable InstallParams XDR#31
willemneal wants to merge 1 commit into
mainfrom
feat/testnet-deploy

Conversation

@willemneal

Copy link
Copy Markdown
Contributor

What

Adds perch-plan, a small Rust bin that compiles a PolicyDoc and prints each
rule's InstallParams as ScVal XDR (hex) — the exact bytes an off-chain
applier drops into a Nido/OZ smart account's policies: Map<Address, Val>
against the deployed interpreter.

perch-plan <doc.json> <interpreter_wasm_hash_hex>

Why

The RPN lowering (perch_compile) is Rust-only and needs a native Env
(a wasm32-unknown-unknown build is refused by soroban-sdk's build.rs). This CLI
is 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 the
in-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-onchain example): the interpreter
(CBO4FIGR2LP242IKWDME6NPFGCFAT5R7CSLKYLOOJFVXCCIGKVF6O44G) allows post and
denies clear
for the same key — the first time perch runs against a real
network's auth framework. just check passes.

🤖 Generated with Claude Code

… 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>
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