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

Code to load a program from its account #30282

Merged
merged 3 commits into from
Feb 15, 2023

Conversation

pgarg66
Copy link
Contributor

@pgarg66 pgarg66 commented Feb 13, 2023

Problem

Need API to load a program from its program and programdata account.

Summary of Changes

Added a new API to bpf_loader to load the program. Also updated LoadedProgram structure to store more meta data about the program.

Fixes #

@pgarg66 pgarg66 requested a review from Lichtso February 13, 2023 18:40
@pgarg66 pgarg66 marked this pull request as ready for review February 13, 2023 18:54
@pgarg66 pgarg66 force-pushed the loader-update branch 2 times, most recently from e49b0f5 to a349b74 Compare February 14, 2023 22:01
impl LoadedPrograms {
/// Inserts a single entry
pub fn insert_entry(&mut self, key: Pubkey, entry: LoadedProgram) -> bool {
pub fn insert_entry(&mut self, key: Pubkey, entry: LoadedProgram) -> LoadedProgramEntry {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this change belongs into this PR.
At least insert_entry() is not used yet.

let loaded_program = LoadedProgram::new(
program.get_owner(),
loader,
0, // Fill in the deployment slot of the program
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO left.

This could be returned in get_programdata_offset():


And maybe rename it to get_programdata_offset_and_deployment_slot().

@pgarg66 pgarg66 merged commit a9ad0f2 into solana-labs:master Feb 15, 2023
@pgarg66 pgarg66 deleted the loader-update branch February 15, 2023 17:05
nickfrosty pushed a commit to nickfrosty/solana that referenced this pull request Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants