Skip to content
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

add BPF version of address lookup table #3

Closed
wants to merge 1 commit into from
Closed

add BPF version of address lookup table #3

wants to merge 1 commit into from

Conversation

buffalojoec
Copy link
Collaborator

@buffalojoec buffalojoec commented Jan 8, 2024

This PR adds the BPF version of the Address Lookup Table program.

For now, I felt like this was a good place to kill two birds with one stone:

  • Evaluating how core programs referenced in this repository might fit in here, and setting the stage for integrating Shank
  • Reviewing the BPF version of Address Lookup Table (and maybe other core programs) as it pertains to SIMD 0088

Address Lookup Table (BPF)

This BPF implementation essentially replaces the following crates in
github.com:solana-labs/solana/programs:

  • address-lookup-table
  • address-lookup-table-tests

Biggest changes for BPF migration:

Errors

Errors are now inside of the program crate, not solana_sdk.

This was necessary for the following reasons:

  • bincode::serialize(..) does not return an error that maps to a ProgramError
  • The native program uses InstructionError variants that do not have a ProgramError counterpart, such as InstructionError::Immutable

We should discuss whether or not to remove the original errors from the SDK and lean on the newly defined ones, or add the new ones necessary to the existing SDK module. Regardless, they will need to be modified to be able to map to ProgramError.

PACKET_DATA_SIZE and limited_deserialize(..)

In this implementation, I added a temporary hack for limited_deserialize until we decide if and how to update the SDK.

We can decide to export this if we want, if other programs also need it and it's useful to on-chain program developers.

@lorisleiva lorisleiva self-requested a review January 9, 2024 12:54
Comment on lines +9 to +12
state::{
AddressLookupTable, LookupTableMeta, LookupTableStatus, ProgramState,
LOOKUP_TABLE_MAX_ADDRESSES, LOOKUP_TABLE_META_SIZE,
},
Copy link
Owner

@lorisleiva lorisleiva Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the plan to leave the state of the LUT program defined in solana_program to make it easier for other programs to access it?

If so, we just need to make sure we add that information back on the Kinobi config file because the generated IDL will be missing these types.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, honestly! On one hand, it would make more sense to contain everything in the program's crate like we do with SPL. On the other, the ALT stuff has already been in solana-program so we have to consider how we'd go about removing it. Perhaps it's appropriate to remove on a minor release?

@2501babe
Copy link
Collaborator

pls add me as a reviewer, will do this next week

@lorisleiva
Copy link
Owner

@2501babe For some reason I'm only able to add myself as a review on this PR, not sure why. 🙁

@2501babe
Copy link
Collaborator

i think you need to invite me as a collaborator https://stackoverflow.com/questions/57946787/cant-add-a-reviewer-for-github-pull-request

@lorisleiva
Copy link
Owner

Thanks! I've invited you, Joe and Jon. 🙂

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.

3 participants