Skip to content

Add address lookup table support to TransactionComposer - #27

Closed
fulf wants to merge 4 commits into
mainfrom
feature/transaction-composer-lookup-tables
Closed

Add address lookup table support to TransactionComposer#27
fulf wants to merge 4 commits into
mainfrom
feature/transaction-composer-lookup-tables

Conversation

@fulf

@fulf fulf commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Adds address lookup table (v0 transaction) support to the composer layer and bumps the gem to 0.1.8:

  • TransactionComposer#add_lookup_table(account:, addresses:) registers an on-chain table; registering a table opts the transaction into the v0 format (matching @solana/web3.js): compose_transaction loads every eligible compiled account — non-signer, not the fee payer, not an invoked program id — through the tables and resolves instruction indices against the combined v0 account space. With no tables, the legacy path is byte-for-byte untouched.
  • Utils::LookupTableContext — the lookup-table counterpart to AccountContext: table registry, v0 loading rules (first table wins, runtime loaded-address order), and the message's AddressLookupTable references. Program ids are derived from the built instructions, so composers that emit multiple instructions for different programs are covered.
  • Utils::AccountContext#relocate_loaded_accounts rebuilds the compiled account list into [static, loaded writable, loaded readonly] and adjusts the readonly-unsigned header count. Note: the small compactions to calculate_header and merge_from are there so the class still fits the Metrics/ClassLength cop after the new method — no behavior change.
  • Connection#get_slot

Selection rules, ordering, and wire format verified against the versioned-transactions spec, the Rust SDK message compiler, and web3.js MessageV0.compile.

Testing

  • Unit tests: loading rules (signers/fee payer/program ids never load), first-wins dedup, header adjustment, combined-space index resolution, serialization round-trip, v0-with-empty-lookups, legacy path
  • Validator-backed: provisions a real lookup table on-chain (create + extend via test-support ALT program composers), then composes, signs, and lands a v0 transfer whose recipients exist only in the table — balances asserted
  • rake test: 375 runs, 0 failures · rubocop: clean

🤖 Generated with Claude Code

fulf and others added 4 commits July 15, 2026 17:33
- Utils::LookupTableContext: the lookup-table counterpart to AccountContext —
  table registry, v0 loading rules (never signers, the fee payer, or invoked
  program ids; first table wins; runtime loaded-address order), and the
  AddressLookupTable references a v0 message carries
- AccountContext#relocate_loaded_accounts: rebuilds a compiled account list
  into the combined v0 account space [static, loaded writable, loaded
  readonly] and adjusts the readonly-unsigned header count (calculate_header
  and merge_from compacted to stay within the class-length limit)
- Connection#get_slot

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
TransactionComposer#add_lookup_table registers an on-chain table (address +
full ordered address list). Registering a table opts the transaction into the
v0 format, matching @solana/web3.js: compose_transaction loads every eligible
compiled account through the tables instead of a static account slot and
rebuilds instruction indices against the combined v0 account space. With no
tables the legacy path is untouched.

Unit tests cover v0 emission, the static/loaded split, header adjustment,
table references, index resolution, serialization round-trip, and the legacy
path; a validator-backed test provisions a real lookup table (create + extend
via test-support composers for the ALT program) and lands a v0 transfer
through it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Transaction composer page: add_lookup_table + lookup_tables entries and an
  "Address lookup tables (v0)" section
- ALT concepts page: composer example; scope tip now reflects that composing
  v0 transactions from existing tables is covered
- Account context page: the v0 relocation step
- Connection page: get_slot

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sebscholl sebscholl closed this Jul 19, 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.

2 participants