Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Require program account to be writable in extend program data ix #27911

Merged
merged 2 commits into from
Sep 22, 2022

Conversation

jstarry
Copy link
Contributor

@jstarry jstarry commented Sep 19, 2022

Problem

The ExtendProgramData instruction doesn't write lock the program account and so the runtime can be sure of the size of a program's data account when loading a program for a transaction. This presented an issue when restricting the total account data size of a transaction in #27840

Summary of Changes

  • Rename ExtendProgramData to ExtendProgram now that this instruction operates on the program account itself too
  • Include the program account in the ExtendProgram instruction and require it to be writable
  • Fix the bpf upgradeable loader ix parser to properly handle the fact that the system program is optional

Modifies Feature Gate: #26385

@jstarry jstarry added the feature-gate Pull Request adds or modifies a runtime feature gate label Sep 19, 2022
@jstarry jstarry force-pushed the feat/write-program-in-extend branch 4 times, most recently from 06fd7f3 to 8cf6288 Compare September 19, 2022 14:47
@jstarry jstarry force-pushed the feat/write-program-in-extend branch from 8cf6288 to 1c2a7de Compare September 20, 2022 00:39
@jstarry jstarry requested a review from Lichtso September 20, 2022 02:31
ic_logger_msg!(log_collector, "Invalid Program account");
return Err(InstructionError::InvalidAccountData);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move drop(program_account); here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's more clear. Moved.

Lichtso
Lichtso previously approved these changes Sep 20, 2022
@mergify mergify bot dismissed Lichtso’s stale review September 21, 2022 07:58

Pull request has been modified.

@jstarry jstarry added the automerge Merge this Pull Request automatically once CI passes label Sep 21, 2022
@mergify
Copy link
Contributor

mergify bot commented Sep 21, 2022

automerge label removed due to a CI failure

@mergify mergify bot removed the automerge Merge this Pull Request automatically once CI passes label Sep 21, 2022
@jstarry jstarry merged commit 108b245 into solana-labs:master Sep 22, 2022
@jstarry jstarry deleted the feat/write-program-in-extend branch September 22, 2022 04:03
mergify bot pushed a commit that referenced this pull request Sep 22, 2022
)

* Require program account to be writable in extend program data ix

* feedback

(cherry picked from commit 108b245)

# Conflicts:
#	programs/bpf_loader/src/lib.rs
#	sdk/program/src/bpf_loader_upgradeable.rs
#	sdk/program/src/loader_upgradeable_instruction.rs
#	sdk/src/feature_set.rs
#	transaction-status/src/parse_bpf_loader.rs
mergify bot pushed a commit that referenced this pull request Sep 22, 2022
)

* Require program account to be writable in extend program data ix

* feedback

(cherry picked from commit 108b245)

# Conflicts:
#	programs/bpf_loader/src/lib.rs
#	sdk/program/src/bpf_loader_upgradeable.rs
#	sdk/program/src/loader_upgradeable_instruction.rs
#	sdk/src/feature_set.rs
#	transaction-status/src/parse_bpf_loader.rs
mergify bot pushed a commit that referenced this pull request Sep 22, 2022
)

* Require program account to be writable in extend program data ix

* feedback

(cherry picked from commit 108b245)

# Conflicts:
#	programs/bpf_loader/src/lib.rs
mergify bot added a commit that referenced this pull request Sep 22, 2022
…kport #27911) (#27978)

* Require program account to be writable in extend program data ix (#27911)

* Require program account to be writable in extend program data ix

* feedback

(cherry picked from commit 108b245)

# Conflicts:
#	programs/bpf_loader/src/lib.rs

* fix conflicts

Co-authored-by: Justin Starry <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-gate Pull Request adds or modifies a runtime feature gate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants