SIP: PTB Structural Digest - #70
Open
92GC wants to merge 6 commits into
Open
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
Updated the description of the current_command_range_hash function for clarity.
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 one native function on
sui::tx_context:This returns a versioned hash of a given sequential range of the current PTB commands.
This let's a contract lock in the part of a PTB it cares about,
while leaving the rest of the PTB open for wallets, solvers, sponsors, or other
composition.
This is more useful than a whole-PTB hash for smart accounts and governance,
because the authorized intent can be fixed without forcing the whole transaction
to be fixed.