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

Refactor - loader v4 SetProgramLength #4687

Merged

Conversation

Lichtso
Copy link

@Lichtso Lichtso commented Jan 29, 2025

Problem

See #4661 (comment)

Summary of Changes

  • Renames LoaderV4Instruction::Truncate to LoaderV4Instruction::SetProgramLength
  • Removes the check that the program is a signer on the initial invocation of LoaderV4Instruction::SetProgramLength
  • Makes the recipient optional, but only if the program is not being closed (size set to zero)

@Lichtso Lichtso requested a review from LucasSte January 29, 2025 16:27
@Lichtso Lichtso requested a review from a team as a code owner January 29, 2025 16:27
Copy link

mergify bot commented Jan 29, 2025

The Firedancer team maintains a line-for-line reimplementation of the
native programs, and until native programs are moved to BPF, those
implementations must exactly match their Agave counterparts.
If this PR represents a change to a native program implementation (not
tests), please include a reviewer from the Firedancer team. And please
keep refactors to a minimum.

@@ -200,10 +200,6 @@ fn process_instruction_truncate(
ic_logger_msg!(log_collector, "Program is not writeable");
return Err(InstructionError::InvalidArgument);
}
if !program.is_signer() {
Copy link
Author

Choose a reason for hiding this comment

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

One has to assign loader-v4 as owner of the program account using the system program, which does check the program account being the signer.

@Lichtso Lichtso force-pushed the refactor/loader_v4_set_program_length branch from b8c0bfc to ded5be8 Compare January 29, 2025 17:13
LucasSte
LucasSte previously approved these changes Jan 29, 2025
@Lichtso Lichtso force-pushed the refactor/loader_v4_set_program_length branch from ded5be8 to 6208ab6 Compare January 29, 2025 18:32
@Lichtso Lichtso merged commit 271f2ba into anza-xyz:master Jan 30, 2025
57 checks passed
@Lichtso Lichtso deleted the refactor/loader_v4_set_program_length branch January 30, 2025 14:59
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.

2 participants