-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make solana-address-lookup-table-program crate bpf compatible #23700
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good + one nit. This might actually be a better way forward than the current design of "just stick everything in sdk / program".
Instead of using target_arch everywhere, as another option, we could use the no-entrypoint
feature as a convention even for builtin programs, so that pulling in program-runtime and sdk is dependent on the feature instead of the bpf arch. What do you think?
Approving either way since the changes are good.
#[cfg(not(target_arch = "bpf"))] | ||
impl From<AddressLookupError> for TransactionError { | ||
fn from(err: AddressLookupError) -> Self { | ||
match err { | ||
AddressLookupError::LookupTableAccountNotFound => Self::AddressLookupTableNotFound, | ||
AddressLookupError::InvalidAccountOwner => Self::InvalidAddressLookupTableOwner, | ||
AddressLookupError::InvalidAccountData => Self::InvalidAddressLookupTableData, | ||
AddressLookupError::InvalidLookupIndex => Self::InvalidAddressLookupTableIndex, | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: what do you think about keeping just this part in solana-sdk
? Then you can avoid at least one target_arch
cfg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then solana-sdk
would need to depend on solana-address-lookup-table-program
and there would be a circular dependency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, of course
# list of crates which must be buildable for bpf programs | ||
solana-address-lookup-table-program = { path = "../../../../programs/address-lookup-table", version = "=1.10.3" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great idea!
I did consider that and then considered renaming to |
Makes sense, thanks for the explanation |
Codecov Report
@@ Coverage Diff @@
## master #23700 +/- ##
=========================================
- Coverage 81.8% 81.7% -0.1%
=========================================
Files 581 582 +1
Lines 158312 158266 -46
=========================================
- Hits 129518 129364 -154
- Misses 28794 28902 +108 |
Problem
The
solana-address-lookup-table-program
crate cannot be used as a dependency when building bpf programsSummary of Changes
cfg
attributes to disable BPF incompatible dependencies and instruction processingAddressLookupError
to thesolana-address-lookup-table-program
to make state types usable without asolana-sdk
dependency.solana-address-lookup-table-program
as a dependency for thedep-crate
test program to ensure that compatibility is preserved in the futureFixes #23410