tx-preflight: simulate a Solana transaction and report its observed effect#137
Draft
ace-coderr wants to merge 6 commits into
Draft
tx-preflight: simulate a Solana transaction and report its observed effect#137ace-coderr wants to merge 6 commits into
ace-coderr wants to merge 6 commits into
Conversation
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.
Draft — opening early for visibility while the builder plugins land.
What this is
A T1 tool plugin that answers one question before a human approves a
transaction: what will this actually do?
An agent that builds a transaction and asks for approval hands the human a
description the model wrote. Poison the model and the approval card reads
"refund the customer 25 USDC" while the bytes underneath move 2,140 and install
a delegate.
tx-preflightsimulates against the operator's own RPC and reportsthe observed effect — net amounts, authority grants, accounts closed — checked
against limits declared in config.
Holds no key. Signs nothing. Submits nothing.
Notes for reviewers
First tool plugin to declare
http_client. Every HTTP plugin in the repois a channel, and
redact-textmakes no network calls, so this path had neverbeen exercised. It works:
runtime.rs::create_plugincallswith_granted_http()and selectstool_linker_http(). Flagging it in casethat was unintentional.
Guardrails live in
__config, deliberately. The wallet being protected,the RPC endpoint, and every spending limit are read from the injected config,
never from
executeargs — the runtime strips caller-supplied__configfirst, so a poisoned agent cannot name its own wallet and collect a clean PASS
on a drain. There's a test for that.
solana-sdkdoesn't build for wasm32-wasip2 inside a WIT component, so thewire format is parsed by hand in
cupel-core(MIT/Apache-2.0, no path deps): legacy and v0 messages, address lookup tables,
SPL Token and Token-2022 layouts. 81 tests, all offline. Reusable by other
plugins in this repo.
Fails closed everywhere. Unverifiable and malicious produce the same
verdict word. Output is capped at ~160 tokens.
Status
tx-preflight— host tests, both clippy gates, wasm32-wasip2 release buildspl-transfer-buildsolana-pay-requestBuilt against
wit/v0ate112ce6. Happy to rebase if the ABI moves.