Skip to content

SIP: PTB Structural Digest - #70

Open
92GC wants to merge 6 commits into
sui-foundation:mainfrom
92GC:sip-ptb-command-context
Open

SIP: PTB Structural Digest#70
92GC wants to merge 6 commits into
sui-foundation:mainfrom
92GC:sip-ptb-command-context

Conversation

@92GC

@92GC 92GC commented Feb 5, 2026

Copy link
Copy Markdown

Add one native function on sui::tx_context:

public fun current_command_range_hash(ctx: &TxContext, additional_commands: u64): vector<u8>

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.

92GC and others added 4 commits February 5, 2026 21:36
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
@92GC 92GC changed the title SIP: PTB Command Context & Scoped Execution SIP: PTB Dynamic Dispatch via Command Context & Scoped Execution Feb 13, 2026
@92GC 92GC changed the title SIP: PTB Dynamic Dispatch via Command Context & Scoped Execution SIP: PTB Command Range Hash Jul 6, 2026
Updated the description of the current_command_range_hash function for clarity.
@92GC 92GC changed the title SIP: PTB Command Range Hash SIP: PTB Structural Digest Jul 6, 2026
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