feat: improve the identification of writeable accounts#542
Merged
KellianDev merged 2 commits intosevenlabs-hq:mainfrom Mar 10, 2026
Merged
feat: improve the identification of writeable accounts#542KellianDev merged 2 commits intosevenlabs-hq:mainfrom
KellianDev merged 2 commits intosevenlabs-hq:mainfrom
Conversation
KellianDev
approved these changes
Mar 10, 2026
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.
Problem
The
is_writableclosure for V0 (versioned) transactions inextract_instructions_with_metadataonly checks whether an account key exists inmeta.loaded_addresses.writable:This only identifies accounts loaded as writable through Address Lookup Tables (ALTs). Any account that is writable due to its position in the static message header is incorrectly marked as
is_writable: false.By contrast, the legacy message path correctly uses
legacy.is_maybe_writable(idx, None), which considers the full message header layout.How Solana encodes writability in V0 messages
A V0 message's account keys come from two sources, laid out sequentially:
Static keys (
v0.account_keys) — writability is determined by position relative to the message header:0..num_signers - num_readonly_signed→ writable signersnum_signers..num_static - num_readonly_unsigned→ writable non-signersALT-loaded keys (
meta.loaded_addresses) — split into.writableand.readonlylists, appended after the static keysThe existing code only handles case 2. Static writable accounts (case 1) are always reported as non-writable.
Fix
The updated closure now checks the account index against the static key boundary:
num_required_signatures,num_readonly_signed_accounts,num_readonly_unsigned_accounts), mirroring the logic ofis_maybe_writableused in the legacy path.loaded_addresses.writable.contains(key)check.This ensures both static and ALT-loaded accounts have their writability resolved correctly, matching what explorers like Solscan report and what the Solana runtime actually enforces.