Skip to content

Add address lookup table (v0) composition support - #28

Merged
sebscholl merged 3 commits into
mainfrom
feature/alt-v0-composition-clean
Jul 19, 2026
Merged

Add address lookup table (v0) composition support#28
sebscholl merged 3 commits into
mainfrom
feature/alt-v0-composition-clean

Conversation

@sebscholl

Copy link
Copy Markdown
Collaborator

Adds address lookup table support to the composer layer (bumps the gem to 0.1.7): compose v0 transactions through existing tables, and create/extend tables on chain — with a single clean compile path rather than legacy/v0 branching.

What's included

  • TransactionComposer#add_address_lookup_table(account:, addresses:) registers a table and opts the transaction into the v0 format (tracked as explicit version state, not derived from whether tables are empty). compose_transaction resolves every loadable account (a non-signer that is not the fee payer and not an invoked program id) through the tables in a single pass over the tables; merge folds another composer's tables in, deduped by account.
  • AccountContext#compile(loaded_accounts:) rebuilds index_of against the combined v0 account space ([static..., loaded...]) while keeping only the static keys in accounts (what the message serializes) and dropping loaded accounts from the header. With no loaded accounts the legacy compilation is byte-for-byte unchanged.
  • Solace::Accounts namespace for on-chain account models, with Accounts::AddressLookupTable — a table's address + stored addresses, .deserialize for reading on-chain state, and #reference for the v0 message reference it contributes.
  • AddressLookupTableProgram Create/Extend composers + instruction builders, so tables can be provisioned on chain.
  • Connection#get_slot.

Notes for review

  • Replaces the branching/mutating approach (an if empty? fork + a post-hoc relocate_loaded_accounts that hand-patched the header) with one compile path and a loaded-aware AccountContext.
  • Metrics/ClassLength raised to 125 (our own dial) rather than compacting unrelated methods.
  • Out of scope: Freeze/Deactivate/Close composers, and a Connection#get_address_lookup_table fetch helper.

Testing

  • Static instruction-builder tests; Accounts::AddressLookupTable unit tests (deserialize/reference/initialize); AccountContext loaded-compile unit tests.
  • Behavioral (validator-backed) coverage: create, extend, and use — v0 transfers landing on chain with balances/state asserted across single-table, multiple-table, mixed static+loaded, first-table-wins, and readonly-loaded (SPL token) scenarios.
  • rake test: 373 runs, 0 failures · rubocop: clean.

🤖 Generated with Claude Code

sebscholl and others added 3 commits July 19, 2026 01:36
Compose v0 transactions through address lookup tables, and create/extend
tables on chain, with a clean single compile path rather than legacy/v0
branching.

- TransactionComposer#add_address_lookup_table registers a table and opts
  the transaction into v0; compose_transaction resolves loadable accounts
  (non-signer, not the fee payer, not an invoked program id) through the
  tables in a single pass. merge folds another composer's tables in.
- AccountContext#compile takes loaded_accounts:, resolving index_of against
  the combined v0 account space while keeping only static keys in the message
  and dropping loaded accounts from the header. Legacy compilation unchanged.
- Solace::Accounts::AddressLookupTable: on-chain account model with
  .deserialize (meta + stored addresses) and #reference for the v0 message
  reference it contributes.
- AddressLookupTableProgram Create/Extend composers + instruction builders.
- Connection#get_slot.
- Version 0.1.7; docs and CHANGELOG updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extract inline composer instantiations out of the add_instruction chains
into named local variables so the setup reads cleanly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Resolve conflicts with main's 0.1.7 release (compute budget + get_block_height):
- CHANGELOG: ALT work moves to a 0.1.8 entry above main's 0.1.7
- Connection keeps both get_block_height and get_slot
- connection-and-rpc docs list both RPC methods
- Bump version to 0.1.8 (main took 0.1.7); @SInCE tags on ALT code updated to 0.1.8

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sebscholl
sebscholl merged commit a3cf7a2 into main Jul 19, 2026
1 check passed
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