Repository navigation
fix(client-v3): expose v3-native AddressLookupTableAccount - #19
Open
princedotrs wants to merge 1 commit into
Open
princedotrs wants to merge 1 commit into
princedotrs wants to merge 1 commit into
Conversation
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.
Summary
Under the
client-v3feature,switchboard-on-demandexposes and returns theSolana v2
AddressLookupTableAccount, so a pure Solana-3.x consumer can't usethe LUTs the client hands back. This PR points the
client-v3LUT type at thev3-native
solana_sdk::message::AddressLookupTableAccount, making the client speakv3 end-to-end. 5 files, +14/−11, and a no-op for the v2
clientfeature.Problem
client-v3is meant for consumers onsolana-sdk3.x. ButPullFeed::fetch_update_ix(and the other client LUT helpers) return
Vec<AddressLookupTableAccount>where, underclient-v3,AddressLookupTableAccountstill resolves to the v2 type via asolana_sdk_v2::address_lookup_tableshim. A v3 caller that feeds those LUTs intov0::Message::try_compilegets a hard type error:error[E0308]: mismatched types
expected AddressLookupTableAccount (solana-message-3.1.0)
found AddressLookupTableAccount (solana-message-2.4.0)
note: there are multiple different versions of crate solana_message in the dependency graph
The two types are structurally identical (
{ key: Pubkey, addresses: Vec<Pubkey> })but carry different
solana-pubkeymajors (2.4.0 vs 4.2.0), so they don't unify.Root cause
solana_compat.rsselectssolana_sdk/solana_client/solana_account_decoderas v3under
client-v3, but theaddress_lookup_tablemodule (and thus the exportedAddressLookupTableAccount) is still re-exported fromsolana_sdk_v2with a commentnoting those crates "are not yet published for v3." That's no longer true — the v3
message LUT account is available at
solana_sdk::message::AddressLookupTableAccount(and
MessageAddressLookupTableAccountalready points there).Fix
solana_compat.rs— underclient-v3, export the v3-nativesolana_sdk::message::AddressLookupTableAccountinstead of the v2 shim. Keep the v2address_lookup_tablemodule available for the on-chainstateparser andprogram::id()only. Maketo_message_address_lookup_table_accounttake the exportedalias.
client/lut_owner.rs, client/transaction_builder.rs, client/utils.rs — the
three files that imported the module-path type now use the exported alias.
The 5 LUT construction sites build addresses element-wise
(.iter().map(|a| a.to_bytes().into()).collect() instead of .to_vec()), since the
bytes are parsed with the v2 state deserializer and rewrapped into the v3 type.
Compatibility
All changes are no-ops under the v2 client feature, where the exported
AddressLookupTableAccount already equals the module-path type. Only the client-v3
build changes behavior, and only to return the type a v3 caller expects.
Testing
cargo clippy --all-targets -D warnings both clean; previously failed to compile.
with downstream instructions) lands successfully across deposit/withdraw/borrow/repay
flows against SwitchboardPull feeds.
Follow-up (not in this PR)
client-v3 still pulls a solana-sdk v2 subtree purely for the LUT state byte-parser
and program::id(). A later change could drop solana-sdk-v2 from client-v3 by using
solana-address-lookup-table-interface (already resolvable in v3 graphs), slimming the
dependency tree.