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 loader-v4 instruction constructors #33151

Merged
merged 3 commits into from
Sep 6, 2023

Conversation

pgarg66
Copy link
Contributor

@pgarg66 pgarg66 commented Sep 5, 2023

Problem

Need convenient methods to construct loader-v4 instructions. These will be useful in CLI and other places.

Summary of Changes

Add the constructors.

Fixes #

@pgarg66 pgarg66 marked this pull request as ready for review September 5, 2023 20:04
@dmakarov
Copy link
Contributor

dmakarov commented Sep 5, 2023

LGTM. I assume there will be some tests that will use these methods?

@pgarg66
Copy link
Contributor Author

pgarg66 commented Sep 5, 2023

LGTM. I assume there will be some tests that will use these methods?

Yes, need to add some tests. I looked into bpf_loader_upgradeable.rs for some inspiration, but those tests are not as useful. loader-v4/src/lib.rs is another place where the tests could potentially be added.

@dmakarov
Copy link
Contributor

dmakarov commented Sep 5, 2023

LGTM. I assume there will be some tests that will use these methods?

Yes, need to add some tests. I looked into bpf_loader_upgradeable.rs for some inspiration, but those tests are not as useful. loader-v4/src/lib.rs is another place where the tests could potentially be added.

Sounds good. I thought maybe in some tests that construct instructions directly, these methods could be used, if that's convenient.

@pgarg66
Copy link
Contributor Author

pgarg66 commented Sep 5, 2023

LGTM. I assume there will be some tests that will use these methods?

Yes, need to add some tests. I looked into bpf_loader_upgradeable.rs for some inspiration, but those tests are not as useful. loader-v4/src/lib.rs is another place where the tests could potentially be added.

Sounds good. I thought maybe in some tests that construct instructions directly, these methods could be used, if that's convenient.

Yes, those should be simpler to add. Let me try and add it in this PR. I would also like to add some tests that calls the loader with the constructed instructions. Maybe that can go in a separate PR.

@pgarg66 pgarg66 force-pushed the loader-v4-instructions branch from 1d5b0ed to ba8ffa2 Compare September 5, 2023 20:35
@pgarg66 pgarg66 force-pushed the loader-v4-instructions branch from ba8ffa2 to f1ef158 Compare September 5, 2023 21:25
@pgarg66
Copy link
Contributor Author

pgarg66 commented Sep 5, 2023

Added tests for the constructors.

dmakarov
dmakarov previously approved these changes Sep 5, 2023
Copy link
Contributor

@dmakarov dmakarov left a comment

Choose a reason for hiding this comment

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

LGTM.

sdk/program/src/loader_v4.rs Outdated Show resolved Hide resolved
sdk/program/src/loader_v4.rs Outdated Show resolved Hide resolved
@pgarg66 pgarg66 force-pushed the loader-v4-instructions branch from 84d80b6 to d78b029 Compare September 5, 2023 22:32
@pgarg66 pgarg66 requested review from Lichtso and dmakarov September 6, 2023 00:49
@pgarg66 pgarg66 merged commit a3399d0 into solana-labs:master Sep 6, 2023
@pgarg66 pgarg66 deleted the loader-v4-instructions branch September 6, 2023 01:01
vec![
AccountMeta::new(*buffer_address, true),
AccountMeta::new_readonly(*authority, true),
AccountMeta::new(*recipient_address, false),
Copy link
Contributor

Choose a reason for hiding this comment

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

recipient_address is not needed and should be payer_address here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about it. The caller can pass the payer address as the recipient_address.

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