SIP: PTB Dynamic Dispatch via Command Context & Scoped Execution#70
Open
92GC wants to merge 4 commits intosui-foundation:mainfrom
Open
SIP: PTB Dynamic Dispatch via Command Context & Scoped Execution#7092GC wants to merge 4 commits intosui-foundation:mainfrom
92GC wants to merge 4 commits intosui-foundation:mainfrom
Conversation
Propose three related enhancements to PTBs: - Command Context: Expose previous command info to Move - Scoped Execution: Isolate groups of commands within transactions - Scope Witness: Cryptographic proof for same-scope verification Key design decision: scope_depth() returns 1 for both top-level PTB and explicit scope, preventing contracts from detecting isolation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Major changes: - Lead with dynamic dispatch use case (eliminating hot potato wrappers) - Add Part 2: Argument Provenance - track where values came from - argument_source() returns Input/Result/NestedResult - Enables "accept coin only if from approved protocol" pattern - AMM censorship now secondary benefit of scopes - Add new open questions for argument indexing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- All commands in a scope can see each other (not past-only) - Cut from 355 to ~190 lines — removed redundant explanations - Tightened rationale, security, backwards compat sections
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.
Add a new
sui::ptb_contextmodule with native functions for inspecting PTB execution context:Plus a new
Scope { commands, inherit_context }PTB command variant.Problem
Composing Move protocols requires pre-built hot potato wrappers for every integration. A DAO executing "vault spend → DEX swap → vault deposit" needs a custom wrapper per DEX. New DEX = new code to write, audit, and deploy. There's no way for a contract to verify at runtime who produced a value or which commands are in the transaction.
Use Cases